summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2006-04-14 06:50:23 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2006-04-14 06:50:23 +0000
commitfe67a5ac72d12dd8faf471d1c612492fed829a4b (patch)
treee63047006842dfddf0388368324211987cc15509
parent71fa4db0b20e97806bd5b11d96370695112f21b4 (diff)
downloadclasspath-fe67a5ac72d12dd8faf471d1c612492fed829a4b.tar.gz
2006-04-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD --> generics-branch from 2006/03/26 to 2006/04/13.
-rw-r--r--.settings/org.eclipse.core.resources.prefs3
-rw-r--r--ChangeLog2013
-rw-r--r--INSTALL2
-rw-r--r--NEWS8
-rw-r--r--configure.ac30
-rw-r--r--examples/Makefile.am5
-rw-r--r--examples/gnu/classpath/examples/swing/Demo.java53
-rw-r--r--examples/gnu/classpath/examples/swing/TextAreaDemo.java6
-rw-r--r--examples/gnu/classpath/examples/swing/TextFieldDemo.java566
-rw-r--r--gnu/CORBA/CDR/EncapsulationStream.java1
-rw-r--r--gnu/CORBA/GIOP/MessageHeader.java33
-rw-r--r--gnu/CORBA/IorDelegate.java15
-rw-r--r--gnu/CORBA/NamingService/NameParser.java5
-rw-r--r--gnu/CORBA/OrbRestricted.java55
-rw-r--r--gnu/CORBA/SocketRepository.java3
-rw-r--r--gnu/CORBA/gnuRequest.java25
-rw-r--r--gnu/classpath/SystemProperties.java7
-rw-r--r--gnu/java/awt/peer/gtk/GdkGraphics.java45
-rw-r--r--gnu/java/awt/peer/gtk/GtkCanvasPeer.java4
-rw-r--r--gnu/java/awt/peer/gtk/GtkClipboard.java11
-rw-r--r--gnu/java/awt/peer/gtk/GtkComponentPeer.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkFramePeer.java37
-rw-r--r--gnu/java/awt/peer/gtk/GtkPanelPeer.java11
-rw-r--r--gnu/java/awt/peer/gtk/GtkWindowPeer.java120
-rw-r--r--gnu/java/lang/reflect/GenericSignatureParser.java22
-rw-r--r--gnu/java/lang/reflect/TypeImpl.java63
-rw-r--r--gnu/java/net/DefaultContentHandlerFactory.java94
-rw-r--r--gnu/java/rmi/activation/ActivationSystemTransient.java32
-rw-r--r--gnu/java/rmi/activation/BidiTable.java68
-rw-r--r--gnu/java/rmi/dgc/LeaseRenewingTask.java14
-rw-r--r--gnu/java/rmi/server/ActivatableRef.java175
-rw-r--r--gnu/java/rmi/server/ActivatableServerRef.java29
-rw-r--r--gnu/java/rmi/server/UnicastRef.java21
-rw-r--r--gnu/java/security/hash/Whirlpool.java583
-rw-r--r--gnu/java/security/jce/hash/HavalSpi.java2
-rw-r--r--gnu/java/security/jce/hash/MD2Spi.java2
-rw-r--r--gnu/java/security/jce/hash/MD4Spi.java2
-rw-r--r--gnu/java/security/jce/hash/MD5Spi.java2
-rw-r--r--gnu/java/security/jce/hash/MessageDigestAdapter.java2
-rw-r--r--gnu/java/security/jce/hash/RipeMD128Spi.java2
-rw-r--r--gnu/java/security/jce/hash/RipeMD160Spi.java2
-rw-r--r--gnu/java/security/jce/hash/Sha160Spi.java2
-rw-r--r--gnu/java/security/jce/hash/Sha256Spi.java2
-rw-r--r--gnu/java/security/jce/hash/Sha384Spi.java2
-rw-r--r--gnu/java/security/jce/hash/Sha512Spi.java2
-rw-r--r--gnu/java/security/jce/hash/TigerSpi.java2
-rw-r--r--gnu/java/security/jce/hash/WhirlpoolSpi.java2
-rw-r--r--gnu/java/security/jce/prng/SecureRandomAdapter.java8
-rw-r--r--gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java2
-rw-r--r--gnu/java/security/jce/sig/DSSRawSignatureSpi.java2
-rw-r--r--gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java2
-rw-r--r--gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java2
-rw-r--r--gnu/java/security/key/IKeyPairCodec.java2
-rw-r--r--gnu/java/security/key/IKeyPairGenerator.java2
-rw-r--r--gnu/java/security/key/KeyPairGeneratorFactory.java13
-rw-r--r--gnu/java/security/key/dss/DSSKey.java1
-rw-r--r--gnu/java/security/key/dss/DSSKeyPairRawCodec.java2
-rw-r--r--gnu/java/security/key/dss/DSSPrivateKey.java2
-rw-r--r--gnu/java/security/key/dss/DSSPublicKey.java2
-rw-r--r--gnu/java/security/key/dss/FIPS186.java2
-rw-r--r--gnu/java/security/key/rsa/GnuRSAKey.java2
-rw-r--r--gnu/java/security/key/rsa/GnuRSAPrivateKey.java2
-rw-r--r--gnu/java/security/key/rsa/GnuRSAPublicKey.java2
-rw-r--r--gnu/java/security/prng/MDGenerator.java14
-rw-r--r--gnu/java/security/sig/ISignature.java2
-rw-r--r--gnu/java/security/sig/ISignatureCodec.java2
-rw-r--r--gnu/java/security/sig/dss/DSSSignature.java2
-rw-r--r--gnu/java/security/sig/dss/DSSSignatureRawCodec.java2
-rw-r--r--gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java2
-rw-r--r--gnu/java/security/sig/rsa/EMSA_PSS.java2
-rw-r--r--gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java2
-rw-r--r--gnu/java/security/sig/rsa/RSAPSSSignature.java2
-rw-r--r--gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java2
-rw-r--r--gnu/java/security/util/Util.java2
-rw-r--r--gnu/java/util/jar/JarUtils.java18
-rw-r--r--gnu/javax/crypto/assembly/Assembly.java1
-rw-r--r--gnu/javax/crypto/assembly/Cascade.java2
-rw-r--r--gnu/javax/crypto/assembly/CascadeStage.java2
-rw-r--r--gnu/javax/crypto/assembly/CascadeTransformer.java2
-rw-r--r--gnu/javax/crypto/assembly/Direction.java2
-rw-r--r--gnu/javax/crypto/assembly/LoopbackTransformer.java2
-rw-r--r--gnu/javax/crypto/assembly/ModeStage.java2
-rw-r--r--gnu/javax/crypto/assembly/Operation.java2
-rw-r--r--gnu/javax/crypto/assembly/PaddingTransformer.java2
-rw-r--r--gnu/javax/crypto/assembly/Stage.java1
-rw-r--r--gnu/javax/crypto/assembly/Transformer.java1
-rw-r--r--gnu/javax/crypto/cipher/Square.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/AESSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/ARCFourSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/AnubisSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/BlowfishSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/CipherAdapter.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/DESSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/KhazadSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/NullCipherSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/PBES2.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/RijndaelSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/SerpentSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/SquareSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/TripleDESSpi.java4
-rw-r--r--gnu/javax/crypto/jce/cipher/TwofishSpi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacMD2Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacMD4Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacMD5Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA160Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA256Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA384Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA512Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacTigerSpi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/MacAdapter.java4
-rw-r--r--gnu/javax/crypto/jce/mac/TMMH16Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/UHash32Spi.java4
-rw-r--r--gnu/javax/crypto/jce/mac/UMac32Spi.java4
-rw-r--r--gnu/javax/crypto/key/dh/DiffieHellmanSender.java1
-rw-r--r--gnu/javax/crypto/key/srp6/SRP6TLSServer.java2
-rw-r--r--gnu/javax/crypto/keyring/PrivateKeyEntry.java2
-rw-r--r--gnu/javax/crypto/mode/IAuthenticatedMode.java4
-rw-r--r--gnu/javax/crypto/pad/WrongPaddingException.java4
-rw-r--r--gnu/javax/crypto/prng/Fortuna.java9
-rw-r--r--gnu/javax/crypto/prng/ICMGenerator.java4
-rw-r--r--gnu/javax/crypto/prng/IPBE.java4
-rw-r--r--gnu/javax/crypto/prng/PBKDF2.java4
-rw-r--r--gnu/javax/crypto/sasl/ConfidentialityException.java4
-rw-r--r--gnu/javax/crypto/sasl/IllegalMechanismStateException.java4
-rw-r--r--gnu/javax/crypto/sasl/srp/IALG.java4
-rw-r--r--gnu/javax/crypto/sasl/srp/SRPServer.java4
-rw-r--r--gnu/javax/swing/tree/GnuPath.java65
-rw-r--r--gnu/regexp/CharIndexed.java20
-rw-r--r--gnu/regexp/CharIndexedCharArray.java33
-rw-r--r--gnu/regexp/CharIndexedCharSequence.java82
-rw-r--r--gnu/regexp/CharIndexedInputStream.java22
-rw-r--r--gnu/regexp/CharIndexedString.java35
-rw-r--r--gnu/regexp/CharIndexedStringBuffer.java32
-rw-r--r--gnu/regexp/RE.java128
-rw-r--r--gnu/regexp/REMatch.java10
-rw-r--r--gnu/regexp/REToken.java29
-rw-r--r--gnu/regexp/RETokenBackRef.java4
-rw-r--r--gnu/regexp/RETokenChar.java13
-rw-r--r--gnu/regexp/RETokenEndOfPreviousMatch.java72
-rw-r--r--gnu/regexp/RETokenEndSub.java2
-rw-r--r--gnu/regexp/RETokenLookBehind.java2
-rw-r--r--gnu/regexp/RETokenNamedProperty.java4
-rw-r--r--gnu/regexp/RETokenRange.java4
-rw-r--r--gnu/xml/dom/DomDocument.java3
-rw-r--r--gnu/xml/dom/DomNode.java22
-rw-r--r--gnu/xml/dom/DomNodeIterator.java3
-rw-r--r--gnu/xml/dom/html2/DomHTMLAppletElement.java21
-rw-r--r--gnu/xml/dom/html2/DomHTMLDocument.java2
-rw-r--r--gnu/xml/dom/html2/DomHTMLEmbedElement.java129
-rw-r--r--gnu/xml/dom/html2/DomHTMLObjectElement.java79
-rw-r--r--gnu/xml/dom/html2/DomHTMLParser.java11
-rw-r--r--gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java12
-rw-r--r--gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java13
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h1
-rw-r--r--java/awt/Choice.java11
-rw-r--r--java/awt/Component.java152
-rw-r--r--java/awt/Container.java13
-rw-r--r--java/awt/DefaultKeyboardFocusManager.java50
-rw-r--r--java/awt/Dialog.java896
-rw-r--r--java/awt/Frame.java13
-rw-r--r--java/awt/Toolkit.java142
-rw-r--r--java/awt/Window.java23
-rw-r--r--java/awt/event/MouseEvent.java6
-rw-r--r--java/awt/geom/Point2D.java10
-rw-r--r--java/awt/image/ComponentSampleModel.java886
-rw-r--r--java/awt/image/DirectColorModel.java2
-rw-r--r--java/awt/image/SampleModel.java412
-rw-r--r--java/awt/image/renderable/RenderableImageProducer.java31
-rw-r--r--java/beans/beancontext/BeanContext.java2
-rw-r--r--java/beans/beancontext/BeanContextMembershipEvent.java4
-rw-r--r--java/beans/beancontext/BeanContextServiceAvailableEvent.java4
-rw-r--r--java/beans/beancontext/BeanContextServiceRevokedEvent.java4
-rw-r--r--java/beans/beancontext/BeanContextServicesSupport.java124
-rw-r--r--java/beans/beancontext/BeanContextSupport.java197
-rw-r--r--java/io/DataOutputStream.java105
-rw-r--r--java/io/FilePermission.java22
-rw-r--r--java/lang/Class.java8
-rw-r--r--java/lang/EnumConstantNotPresentException.java2
-rw-r--r--java/lang/StackTraceElement.java4
-rw-r--r--java/lang/Thread.java3
-rw-r--r--java/lang/TypeNotPresentException.java3
-rw-r--r--java/lang/annotation/AnnotationFormatError.java1
-rw-r--r--java/lang/reflect/GenericDeclaration.java18
-rw-r--r--java/lang/reflect/GenericSignatureFormatError.java1
-rw-r--r--java/lang/reflect/MalformedParameterizedTypeException.java17
-rw-r--r--java/lang/reflect/Modifier.java34
-rw-r--r--java/lang/reflect/TypeVariable.java50
-rw-r--r--java/net/MimeTypeMapper.java360
-rw-r--r--java/net/URLConnection.java97
-rw-r--r--java/rmi/activation/ActivationGroup_Stub.java2
-rw-r--r--java/rmi/server/RemoteObject.java124
-rw-r--r--java/security/SecureRandom.java30
-rw-r--r--java/security/cert/Certificate.java2
-rw-r--r--java/util/AbstractList.java25
-rw-r--r--java/util/Arrays.java144
-rw-r--r--java/util/BitSet.java2
-rw-r--r--java/util/HashMap.java3
-rw-r--r--java/util/Hashtable.java3
-rw-r--r--java/util/IdentityHashMap.java3
-rw-r--r--java/util/InvalidPropertiesFormatException.java17
-rw-r--r--java/util/LinkedHashMap.java3
-rw-r--r--java/util/LinkedList.java8
-rw-r--r--java/util/TreeMap.java3
-rw-r--r--java/util/WeakHashMap.java3
-rw-r--r--java/util/jar/Attributes.java12
-rw-r--r--java/util/jar/JarFile.java27
-rw-r--r--java/util/logging/Level.java5
-rw-r--r--java/util/logging/LogManager.java297
-rw-r--r--java/util/logging/Logger.java15
-rw-r--r--java/util/regex/Matcher.java14
-rw-r--r--java/util/regex/Pattern.java4
-rw-r--r--java/util/zip/ZipFile.java17
-rw-r--r--javax/accessibility/AccessibleAttributeSequence.java (renamed from org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java)52
-rw-r--r--javax/accessibility/AccessibleContext.java29
-rw-r--r--javax/accessibility/AccessibleExtendedText.java108
-rw-r--r--javax/accessibility/AccessibleRelation.java106
-rw-r--r--javax/accessibility/AccessibleStreamable.java62
-rw-r--r--javax/accessibility/AccessibleText.java2
-rw-r--r--javax/accessibility/AccessibleTextSequence.java68
-rw-r--r--javax/imageio/ImageWriteParam.java2
-rw-r--r--javax/imageio/plugins/jpeg/JPEGHuffmanTable.java240
-rw-r--r--javax/imageio/plugins/jpeg/JPEGImageReadParam.java161
-rw-r--r--javax/imageio/plugins/jpeg/JPEGImageWriteParam.java293
-rw-r--r--javax/imageio/plugins/jpeg/JPEGQTable.java196
-rw-r--r--javax/naming/Binding.java66
-rw-r--r--javax/naming/CompositeName.java25
-rw-r--r--javax/naming/NameClassPair.java97
-rw-r--r--javax/naming/directory/BasicAttribute.java31
-rw-r--r--javax/naming/directory/BasicAttributes.java23
-rw-r--r--javax/security/auth/kerberos/DelegationPermission.java136
-rw-r--r--javax/security/auth/kerberos/KerberosKey.java180
-rw-r--r--javax/security/auth/kerberos/KerberosPrincipal.java207
-rw-r--r--javax/security/auth/kerberos/KerberosTicket.java339
-rw-r--r--javax/security/auth/kerberos/KeyImpl.java93
-rw-r--r--javax/security/auth/kerberos/ServicePermission.java172
-rw-r--r--javax/security/auth/x500/X500Principal.java2
-rw-r--r--javax/swing/AbstractAction.java29
-rw-r--r--javax/swing/AbstractButton.java453
-rw-r--r--javax/swing/ActionMap.java26
-rw-r--r--javax/swing/CompatibilityFocusTraversalPolicy.java164
-rw-r--r--javax/swing/DefaultComboBoxModel.java18
-rw-r--r--javax/swing/DefaultListSelectionModel.java72
-rw-r--r--javax/swing/JComboBox.java30
-rw-r--r--javax/swing/JComponent.java577
-rw-r--r--javax/swing/JDesktopPane.java41
-rw-r--r--javax/swing/JFileChooser.java4
-rw-r--r--javax/swing/JInternalFrame.java185
-rw-r--r--javax/swing/JLabel.java17
-rw-r--r--javax/swing/JLayeredPane.java1
-rw-r--r--javax/swing/JMenu.java3
-rw-r--r--javax/swing/JMenuItem.java26
-rw-r--r--javax/swing/JRootPane.java14
-rw-r--r--javax/swing/JSlider.java545
-rw-r--r--javax/swing/JSplitPane.java58
-rw-r--r--javax/swing/JTabbedPane.java42
-rw-r--r--javax/swing/JTable.java97
-rw-r--r--javax/swing/JTextField.java50
-rw-r--r--javax/swing/JToolBar.java4
-rw-r--r--javax/swing/JTree.java80
-rw-r--r--javax/swing/LookAndFeel.java46
-rw-r--r--javax/swing/MenuSelectionManager.java57
-rw-r--r--javax/swing/RepaintManager.java5
-rw-r--r--javax/swing/ScrollPaneLayout.java40
-rw-r--r--javax/swing/SizeSequence.java193
-rw-r--r--javax/swing/UIManager.java9
-rw-r--r--javax/swing/ViewportLayout.java43
-rw-r--r--javax/swing/event/InternalFrameEvent.java67
-rw-r--r--javax/swing/plaf/basic/BasicInternalFrameTitlePane.java23
-rw-r--r--javax/swing/plaf/basic/BasicLookAndFeel.java163
-rw-r--r--javax/swing/plaf/basic/BasicMenuItemUI.java487
-rw-r--r--javax/swing/plaf/basic/BasicSliderUI.java628
-rw-r--r--javax/swing/plaf/basic/BasicTableUI.java18
-rw-r--r--javax/swing/plaf/basic/BasicTextAreaUI.java7
-rw-r--r--javax/swing/plaf/basic/BasicTextUI.java52
-rw-r--r--javax/swing/plaf/basic/BasicTreeUI.java1389
-rw-r--r--javax/swing/plaf/metal/MetalButtonUI.java11
-rw-r--r--javax/swing/plaf/metal/MetalDesktopIconUI.java16
-rw-r--r--javax/swing/plaf/metal/MetalRootPaneUI.java156
-rw-r--r--javax/swing/plaf/metal/MetalSliderUI.java6
-rw-r--r--javax/swing/plaf/metal/MetalTabbedPaneUI.java16
-rw-r--r--javax/swing/plaf/metal/MetalToggleButtonUI.java9
-rw-r--r--javax/swing/plaf/synth/SynthPainter.java17
-rw-r--r--javax/swing/text/AsyncBoxView.java4
-rw-r--r--javax/swing/text/BoxView.java9
-rw-r--r--javax/swing/text/CompositeView.java33
-rw-r--r--javax/swing/text/DefaultCaret.java24
-rw-r--r--javax/swing/text/FieldView.java171
-rw-r--r--javax/swing/text/GapContent.java8
-rw-r--r--javax/swing/text/InternationalFormatter.java2
-rw-r--r--javax/swing/text/PlainView.java10
-rw-r--r--javax/swing/text/Position.java2
-rw-r--r--javax/swing/text/Segment.java5
-rw-r--r--javax/swing/text/Utilities.java29
-rw-r--r--javax/swing/text/WrappedPlainView.java130
-rw-r--r--javax/swing/text/html/HTML.java4
-rw-r--r--javax/swing/text/html/NullView.java4
-rw-r--r--javax/swing/text/html/parser/Entity.java2
-rw-r--r--javax/swing/tree/AbstractLayoutCache.java725
-rw-r--r--javax/swing/tree/DefaultTreeSelectionModel.java1388
-rw-r--r--javax/swing/tree/FixedHeightLayoutCache.java470
-rw-r--r--javax/swing/tree/TreePath.java5
-rw-r--r--javax/swing/tree/VariableHeightLayoutCache.java593
-rw-r--r--javax/xml/XMLConstants.java9
-rw-r--r--javax/xml/datatype/DatatypeConstants.java9
-rw-r--r--javax/xml/datatype/DatatypeFactory.java8
-rw-r--r--javax/xml/datatype/Duration.java10
-rw-r--r--javax/xml/validation/SchemaFactory.java17
-rw-r--r--javax/xml/validation/SchemaFactoryLoader.java52
-rw-r--r--javax/xml/xpath/XPathConstants.java8
-rw-r--r--lib/Makefile.am16
-rwxr-xr-xlib/gen-classlist.sh.in67
-rwxr-xr-xlib/split-for-gcj.sh28
-rw-r--r--m4/acinclude.m44
-rw-r--r--native/fdlibm/fdlibm.h2
-rw-r--r--native/jni/classpath/jcl.c4
-rw-r--r--native/jni/classpath/jcl.h2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c6
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c36
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c14
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c7
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c21
-rw-r--r--native/jni/java-net/javanet.h14
-rw-r--r--native/target/generic/target_generic.h2
-rw-r--r--native/target/generic/target_generic_misc.h2
-rw-r--r--org/omg/CORBA/ORB.java17
-rw-r--r--org/omg/CORBA/ParameterMode.java8
-rw-r--r--org/omg/CosNaming/NamingContextOperations.java4
-rw-r--r--org/omg/CosNaming/_BindingIteratorStub.java4
-rw-r--r--org/omg/CosNaming/_NamingContextExtStub.java4
-rw-r--r--org/omg/CosNaming/_NamingContextStub.java9
-rw-r--r--org/omg/DynamicAny/_DynAnyFactoryStub.java17
-rw-r--r--org/omg/DynamicAny/_DynAnyStub.java15
-rw-r--r--org/omg/DynamicAny/_DynArrayStub.java558
-rw-r--r--org/omg/DynamicAny/_DynEnumStub.java560
-rw-r--r--org/omg/DynamicAny/_DynFixedStub.java559
-rw-r--r--org/omg/DynamicAny/_DynSequenceStub.java557
-rw-r--r--org/omg/DynamicAny/_DynStructStub.java558
-rw-r--r--org/omg/DynamicAny/_DynUnionStub.java558
-rw-r--r--org/omg/DynamicAny/_DynValueStub.java556
-rw-r--r--org/omg/PortableInterceptor/ObjectReferenceFactory.java26
-rw-r--r--org/omg/PortableServer/ServantActivatorPOA.java36
-rw-r--r--org/omg/PortableServer/ServantLocatorPOA.java34
-rw-r--r--resource/javax/imageio/plugins/jpeg/MessagesBundle.properties9
-rw-r--r--tools/.cvsignore1
-rwxr-xr-xtools/Makefile.am6
-rw-r--r--tools/README3
-rw-r--r--tools/gnu/classpath/tools/giop/GRMIC.java18
-rw-r--r--tools/gnu/classpath/tools/giop/IorParser.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/CompilationError.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/Generator.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/GiopIo.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/HashFinder.java22
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java18
-rw-r--r--tools/gnu/classpath/tools/jarsigner/HashUtils.java27
-rw-r--r--tools/gnu/classpath/tools/jarsigner/JarSigner.java23
-rw-r--r--tools/gnu/classpath/tools/jarsigner/JarVerifier.java21
-rw-r--r--tools/gnu/classpath/tools/jarsigner/Main.java204
-rw-r--r--tools/gnu/classpath/tools/jarsigner/SFHelper.java25
-rw-r--r--tools/gnu/classpath/tools/jarsigner/jarsigner.txt2
-rw-r--r--tools/gnu/classpath/tools/rmi/Persistent.java87
-rw-r--r--tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java268
-rw-r--r--tools/gnu/classpath/tools/rmi/PersistentHashTable.java246
-rw-r--r--tools/gnu/classpath/tools/rmi/REGISTRY.java165
-rw-r--r--tools/gnu/classpath/tools/rmi/REGISTRY.txt28
-rw-r--r--tools/gnu/classpath/tools/rmi/RMIC.java19
-rw-r--r--tools/gnu/classpath/tools/rmi/RMID.java189
-rw-r--r--tools/gnu/classpath/tools/rmi/RMID.txt30
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java139
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java278
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java263
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/package.html46
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java14
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java13
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java19
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav2
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav2
-rw-r--r--tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java244
-rw-r--r--tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java556
-rw-r--r--tools/jarsigner.sh.in46
-rw-r--r--vm/reference/java/lang/VMClass.java5
-rw-r--r--vm/reference/java/lang/reflect/Constructor.java2
-rw-r--r--vm/reference/java/lang/reflect/Field.java3
-rw-r--r--vm/reference/java/lang/reflect/Method.java6
387 files changed, 22451 insertions, 7207 deletions
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index e1373e63c..000000000
--- a/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Sep 20 12:53:19 MDT 2004
-eclipse.preferences.version=1
-encoding/ChangeLog=ISO-8859-1
diff --git a/ChangeLog b/ChangeLog
index d59de702e..5a39a8abb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,1283 @@
* javax/imageio/metadata/IIOMetadataFormatImpl.java (addObjectValue):
Fixed parameter bounds.
+2006-04-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * gnu/javax/crypto/assembly/Assembly.java,
+ * gnu/javax/crypto/assembly/Cascade.java,
+ * gnu/javax/crypto/assembly/CascadeStage.java,
+ * gnu/javax/crypto/assembly/CascadeTransformer.java,
+ * gnu/javax/crypto/assembly/Direction.java,
+ * gnu/javax/crypto/assembly/LoopbackTransformer.java,
+ * gnu/javax/crypto/assembly/ModeStage.java,
+ * gnu/javax/crypto/assembly/Operation.java,
+ * gnu/javax/crypto/assembly/PaddingTransformer.java,
+ * gnu/javax/crypto/assembly/Stage.java,
+ * gnu/javax/crypto/assembly/Transformer.java,
+ * gnu/javax/crypto/cipher/Square.java,
+ * gnu/javax/crypto/jce/cipher/AESSpi.java,
+ * gnu/javax/crypto/jce/cipher/ARCFourSpi.java,
+ * gnu/javax/crypto/jce/cipher/AnubisSpi.java,
+ * gnu/javax/crypto/jce/cipher/BlowfishSpi.java,
+ * gnu/javax/crypto/jce/cipher/CipherAdapter.java,
+ * gnu/javax/crypto/jce/cipher/DESSpi.java,
+ * gnu/javax/crypto/jce/cipher/KhazadSpi.java,
+ * gnu/javax/crypto/jce/cipher/NullCipherSpi.java,
+ * gnu/javax/crypto/jce/cipher/PBES2.java,
+ * gnu/javax/crypto/jce/cipher/RijndaelSpi.java,
+ * gnu/javax/crypto/jce/cipher/SerpentSpi.java,
+ * gnu/javax/crypto/jce/cipher/SquareSpi.java,
+ * gnu/javax/crypto/jce/cipher/TripleDESSpi.java,
+ * gnu/javax/crypto/jce/cipher/TwofishSpi.java,
+ * gnu/javax/crypto/jce/mac/HMacMD2Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacMD4Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacMD5Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacSHA160Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacSHA256Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacSHA384Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacSHA512Spi.java,
+ * gnu/javax/crypto/jce/mac/HMacTigerSpi.java,
+ * gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java,
+ * gnu/javax/crypto/jce/mac/MacAdapter.java,
+ * gnu/javax/crypto/jce/mac/TMMH16Spi.java,
+ * gnu/javax/crypto/jce/mac/UHash32Spi.java,
+ * gnu/javax/crypto/jce/mac/UMac32Spi.java,
+ * gnu/javax/crypto/key/dh/DiffieHellmanSender.java,
+ * gnu/javax/crypto/key/srp6/SRP6TLSServer.java,
+ * gnu/javax/crypto/keyring/PrivateKeyEntry.java,
+ * gnu/javax/crypto/mode/IAuthenticatedMode.java,
+ * gnu/javax/crypto/pad/WrongPaddingException.java,
+ * gnu/javax/crypto/prng/ICMGenerator.java,
+ * gnu/javax/crypto/prng/IPBE.java,
+ * gnu/javax/crypto/prng/PBKDF2.java,
+ * gnu/javax/crypto/sasl/ConfidentialityException.java,
+ * gnu/javax/crypto/sasl/IllegalMechanismStateException.java,
+ * gnu/javax/crypto/sasl/srp/IALG.java,
+ * gnu/javax/crypto/sasl/srp/SRPServer.java:
+ Remove CVS revision tags.
+
+2006-04-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java (getPreferredSize):
+ Removed debugging code.
+
+2006-04-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/JTree.java (getPreferredSize): Return the
+ cloned instance.
+ * javax/swing/ViewportLayout.java (layoutContainer):
+ Do not manage the view size and location if the view is
+ in the scroll pane. Also manage size and location for
+ Scrollable, if it is not in the scroll pane.
+ * javax/swing/plaf/basic/BasicTreeUI.java,
+ * javax/swing/tree/FixedHeightLayoutCache.java,
+ * javax/swing/tree/VariableHeightLayoutCache.java: Rewritten.
+ * gnu/javax/swing/tree/GnuPath.java: New file.
+
+2006-04-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JToolBar.java
+ (AccessibleJToolBar.getAccessibleStateSet): Marked as stub.
+
+2006-04-13 Robert Schuster <robertschuster@fsfe.org>
+
+ * examples/gnu/classpath/examples/swing/TextAreaDemo.java:
+ (createCustomColoredPanel): Set background color as demo intends,
+ changed custom selection color to red.
+ * examples/gnu/classpath/examples/swing/TextFieldDemo.java:
+ Replaced various single variables with a Compound instance, added
+ custom highlighter demo.
+ (TextFieldDemo.DemoHighlightPainter): New class (taken from
+ TextAreaDemo).
+ (TextFieldDemo.Compound): New class.
+ (createTextFieldCompound): New method.
+ (createLeftAlignedPanel): Rewritten.
+ (createRightAlignedPanel): Rewritten.
+ (createCenteredPanel): Rewritten.
+ (createCustomColoredPanel): Removed.
+ (createCustomColoredPanel1): New method.
+ (createCustomColoredPanel2): New method.
+ (createCustomBordersPanel): New method.
+ (createMiscPanel): Rewritten.
+ (actionPerformed): Rewritten.
+ (createContent): Add panels of new compounds to main panel, put
+ main panel in a JScrollPane.
+ * examples/gnu/classpath/examples/swing/Demo.java:
+ (Demo): Put desktop in a scrollpane.
+ (mkMenuBar): Check availability of MetalLookAndFeel.getCurrentTheme()
+ method via reflection.
+
+2006-04-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalDesktopIconUI.java
+ (createUI): Return new instance rather than shared instance.
+
+2006-04-13 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/FieldView.java:
+ (checkContainer): Call updateVisibility() at the end.
+
+2006-04-13 Robert Schuster <robertschuster@fsfe.org>
+
+ * java/awt/event/MouseEvent.java:
+ (paramString): Add value of 'consumed' variable in string.
+
+2006-04-13 Robert Schuster <robertschuster@fsfe.org>
+
+ PR 26967
+ * javax/swing/JTextField.java: Removed scrollOffset variable.
+ (JTextField): Moved up initialization of horizontalVisibility field.
+ (getScrollOffset): Implemented.
+ (setScrollOffset): Implemented.
+ (getHorizonztalVisibility): Removed note.
+ (scrollRectToVisible): New method.
+ * javax/swing/text/FieldView.java: Added cachedSpan variable.
+ (checkContainer): New method.
+ (updateVisibility): New method.
+ (calculateHorizontalSpan): New method.
+ (adjustAllocation): Removed unneeded local variables, added code
+ to handle scrolling.
+ (getPreferredSpan): Use new method calculateHorizontalSpan,
+ avoid calculation by returning cached value cachedSpan.
+ (paint): Added check whether the hosted component is a JTextField.
+ (insertUpdate): Invalidate cached span value, update visibility
+ if neccessary.
+ (removeUpdate): Dito.
+ (changeUpdate): Dito.
+
+2006-04-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JInternalFrame.java
+ (setTitle): Set old value to 'this.title', not 'title'.
+
+2006-04-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JInternalFrame.java
+ (AccessibleJInternalFrame.getAccessibleName): Implemented,
+ (AccessibleJInternalFrame.getAccessibleRole): Implemented,
+ (AccessibleJInternalFrame.getAccessibleValue): Implemented,
+ (AccessibleJInternalFrame.getCurrentAccessibleValue): Implemented,
+ (AccessibleJInternalFrame.getMaximumAccessibleValue): Implemented,
+ (AccessibleJInternalFrame.getMinimumAccessibleValue): Implemented,
+ (AccessibleJInternalFrame.setCurrentAccessibleValue): Implemented,
+ (JDesktopIcon.AccessibleJDesktopIcon.getAccessibleRole): Implemented,
+ (JDesktopIcon.AccessibleJDesktopIcon.getAccessibleValue): Implemented,
+ (JDesktopIcon.AccessibleJDesktopIcon.getCurrentAccessibleValue):
+ Implemented,
+ (JDesktopIcon.AccessibleJDesktopIcon.getMaximumAccessibleValue):
+ Implemented,
+ (JDesktopIcon.AccessibleJDesktopIcon.getMinimumAccessibleValue):
+ Implemented,
+ (JDesktopIcon.AccessibleJDesktopIcon.setCurrentAccessibleValue):
+ Implemented,
+ (JInternalFrame()): Use "" for default title,
+ (getAccessibleContext): Updated API docs,
+ (getDesktopIcon): Likewise,
+ (getLayer): Check for layer in client properties, and return
+ DEFAULT_LAYER if no setting is found,
+ (getTitle): Updated API docs,
+ (setDesktopIcon): Fire property change event.
+
+2006-04-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/ScrollPaneLayout.java (layoutContainer):
+ Mind that the presence of one scroll bar may cause the
+ need for another.
+
+2006-04-12 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ * gnu/regexp/REToken.java(unicodeAware): New field,
+ (toLowerCase, toUpperCase): New methods.
+ * gnu/regexp/RETokenBackRef.java, gnu/regexp/RETokenChar.java,
+ gnu/regexp/RETokenNamedProperty.java, gnu/regexp/RETokenRange.java:
+ Use toLowerCase and toUpperCase defined in REToken instead of
+ those defined in java.lang.Character.
+ * gnu/regexp/gnu/regexp/RE.java(REG_ICASE_USASCII): New flag.
+ (initialize): Sets unicodeAware of the generated REToken to false if
+ REG_ICASE_USASCII is set.
+ * gnu/regexp/RETokenChar.java(constructor): Don't convert the character
+ to lower case and keep the original value.
+ (matchOneString): Use the new method charEquals to compare characters.
+ (charEquals): New method to compare characters.
+ * java/util/regex/Pattern.java: Sets the flag REG_ICASE_USASCII to true.
+
+2006-04-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/InternalFrameEvent.java:
+ (paramString): Implemented,
+ updated API docs all over.
+
+2006-04-12 Casey Marshall <csm@gnu.org>
+
+ * gnu/javax/crypto/prng/Fortuna.java (setup): call `fillBlock.'
+ (Generator.setup): call `fillBlock.'
+
+2006-04-12 Casey Marshall <csm@gnu.org>
+
+ Fixes PR classpath/24481.
+ * gnu/java/security/jce/prng/SecureRandomAdapter.java (<init>):
+ initialize the adaptee.
+ (setSeed): call `addRandomBytes;' don't re-initialize the adaptee.
+ * gnu/java/security/prng/MDGenerator.java (addRandomByte,
+ addRandomBytes): new methods.
+
+2006-04-12 Tom Tromey <tromey@redhat.com>
+
+ * java/io/DataOutputStream.java (writeUTF): Correctly handle zero
+ length strings.
+
+2006-04-12 Lillian Angel <langel@redhat.com>
+
+ * gnu/xml/dom/DomDocument.java
+ (checkNCName): Removed unneeded part of check.
+ * gnu/xml/dom/DomNode.java
+ (dispatchEvent): Added code to grow ancestors array
+ if needed. Changed checks to use depth of node instead.
+ Fixes an infinite loop and segmentation fault.
+ * gnu/xml/dom/html2/DomHTMLParser.java
+ (handleEndTag): No need to use/make a copy of the node.
+ Causes an infinite loop.
+
+2006-04-12 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/27131:
+ * java/util/BitSet.java (get): Early return if to==from.
+
+2006-04-12 Mark Wielaard <mark@klomp.org>
+
+ * java/security/SecureRandom.java (algorithm): New private field.
+ (SecureRandom): Initialize algorithm.
+ (SecureRandom(SecureRandomSpi,Provider,String)): New private
+ constructor.
+ (getInstance): Call 3 argument constructor.
+ (getAlgorithm): New method.
+
+2006-04-12 Mark Wielaard <mark@klomp.org>
+
+ Port UncaughtExceptionHandler support from generics branch.
+ * NEWS: Document Thread.UncaughtExceptionHandler VMThread change.
+
+2006-04-12 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/lang/Thread.java:
+ (setUncaughtExceptionHandler(UncaughtExceptionHandler):
+ Added docs and security check.
+ (getUncaughtExceptionHandler()): Documented.
+ (setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler):
+ Added docs and security check.
+ (getDefaultUncaughtExceptionHandler()): Documented.
+ (getId()): Documented.
+
+2006-04-12 Tom Tromey <tromey@redhat.com>
+
+ * vm/reference/java/lang/VMThread.java (run): Use thread's
+ uncaught handler.
+ * java/lang/Thread.java (defaultHandler): New field.
+ (setDefaultUncaughtExceptionHandler,
+ getDefaultUncaughtExceptionHandler, setUncaughtExceptionHandler,
+ getUncaughtExceptionHandler): New methods.
+ * java/lang/ThreadGroup.java (ThreadGroup): Implements
+ UncaughtExceptionHandler.
+ (uncaughtException): Use getDefaultUncaughtExceptionHandler.
+
+2006-04-11 Bryce McKinlay <mckinlay@redhat.com>
+
+ * java/io/DataOutputStream.java (writeUTF): Re-use fixed length byte
+ buffer. Loop only once to determine Utf8 length when possible. Make
+ the inner loop bounded by buf.length.
+ (getUTFlength): New private method.
+ (buf): New private field.
+
+2006-04-11 Lillian Angel <langel@redhat.com>
+
+ * gnu/xml/dom/DomNodeIterator.java
+ (nextNode): Moved line of code to avoid an infinite loop.
+ * gnu/xml/dom/html2/DomHTMLAppletElement.java
+ (getCls): New function.
+ (setCls): Likewise.
+ (getSrc): Likewise.
+ (setSrc): Likewise.
+ * gnu/xml/dom/html2/DomHTMLDocument.java:
+ Added DomHTMLEmbedElement to map.
+ (getApplets): Added node name, 'embed'.
+ * gnu/xml/dom/html2/DomHTMLEmbedElement.java:
+ New class.
+ * gnu/xml/dom/html2/DomHTMLObjectElement.java
+ (getJavaCode): New function.
+ (setJavaCode): Likewise.
+ (getObject): Likewise.
+ (setObject): Likewise.
+ (getJavaObject): Likewise.
+ (setJavaObject): Likewise.
+ (getJavaArchive): Likewise.
+ (setJavaArchive): Likewise.
+ (getJavaCodeBase): Likewise.
+ (setJavaCodeBase): Likewise.
+ (getJavaType): Likewise.
+ (setJavaType): Likewise.
+ (setMayscript): Likewise.
+ (getMayscript): Likewise.
+ (setScriptable): Likewise.
+ (getScriptable): Likewise.
+ * gnu/xml/dom/html2/DomHTMLParser.java
+ (parseDocument): Should not check for well formedness
+ when parsing an html document.
+ * java/awt/Window.java
+ (dispatchEvent): Added check to avoid NPE.
+
+2006-04-10 Tom Tromey <tromey@redhat.com>
+
+ * javax/accessibility/AccessibleStreamable.java (getStream): Fixed
+ name.
+ * javax/accessibility/AccessibleRelation.java (EMBEDS): Fixed value.
+ (SUBWINDOW_OF, SUBWINDOW_OF_PROPERTY): Likewise.
+
+2006-04-10 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (getNextVisualPositionFrom): Marked as stub.
+
+2006-04-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initSystemColorDefaults): Changed to use loadSystemColorDefaults
+ and create the defaults as strings constants.
+ (loadSystemColors): Implemented stubbed method.
+
+2006-04-10 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.core.resources.prefs: Set encoding for
+ ChangeLog.
+
+2006-04-10 Tom Tromey <tromey@redhat.com>
+
+ * java/io/CharArrayWriter.java (append): Javadoc fix.
+ (append): Likewise.
+
+2006-04-10 Tom Tromey <tromey@redhat.com>
+
+ * javax/accessibility/AccessibleTextSequence.java: New file.
+ * javax/accessibility/AccessibleRelation.java (CHILD_NODE_OF): New
+ field.
+ (CHILD_NODE_OF_PROPERTY, EMBEDDED_BY, EMBEDDED_BY_PROPERTY, EMBEDS,
+ EMBEDS_PROPERTY, FLOWS_FROM, FLOWS_FROM_PROPERTY, FLOWS_TO,
+ FLOWS_TO_PROPERTY, PARENT_WINDOW_OF, PARENT_WINDOW_OF_PROPERTY,
+ SUBWINDOW_OF, SUBWINDOW_OF_PROPERTY): Likewise.
+ * javax/accessibility/AccessibleExtendedText.java: New file.
+ * javax/accessibility/AccessibleContext.java
+ (ACCESSIBLE_COMPONENT_BOUNDS_CHANGED): New field.
+ (ACCESSIBLE_INVALIDATE_CHILDREN): Likewise.
+ (ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED): Likewise.
+ * javax/accessibility/AccessibleAttributeSequence.java: New file.
+ * javax/accessibility/AccessibleStreamable.java: New file.
+ * javax/accessibility/AccessibleText.java (getIndexAtPoint): Javadoc
+ fix.
+
+2006-04-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/tree/AbstractLayoutCache.java
+ (getNodeDimensions, getRowsForPath): Implemented.
+ * javax/swing/tree/FixedHeightLayoutCache.java: Rewritten.
+ * javax/swing/tree/VariableHeightLayoutCache.java: Rewritten.
+
+2006-04-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/tree/AbstractLayoutCache.java: Reformatted.
+
+2006-04-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JInternalFrame.java
+ (AccessibleJInternalFrame): Marked all stubbed methods as such
+ by adding throws NotImplementedException.
+
+2006-04-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JFileChooser.java
+ (getAccessibleContext): Don't create a new instance on each
+ call, instead store the accessible context in the
+ accessibleContext field.
+
+2006-04-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComboBox.java
+ (AccessibleJComboBox): Marked all stubbed methods as such
+ by adding throws NotImplementedException.
+
+2006-04-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ActionMap.java
+ (readObject): Removed.
+ (writeObject): Removed.
+
+2006-04-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/tree/DefaultTreeSelectionModel.java
+ (addSelectionPaths, setSelectionPaths): Call
+ insureUniqueness. (clone, setRowMapper): Implemented.
+ * TreePath (path): Marked final.
+
+2006-04-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/tree/DefaultTreeSelectionModel.java:
+ Documented and autoformatted. (insureUniqueness):
+ Removed stub marking.
+
+2006-04-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/SizeSequence.java
+ (sizes): Don't initialise here,
+ (SizeSequence(int, int)): Initialise sizes field,
+ (SizeSequence(int[])): Clone argument instead of calling setSizes(),
+ (setSize): Do nothing when index is out of bounds,
+ (getIndex): Implemented,
+ (setSizes): Reimplemented,
+ (getSizes): Likewise,
+ (insertEntries): Likewise,
+ (removeEntries): Likewise,
+ plus added API docs all over.
+
+2006-04-09 Audrius Meskauskas <AudriusA@Bioinformatics.org
+
+ * gnu/CORBA/gnuRequest.java (submit): Do not read any response after
+ one way message and retry after any IOException.
+
+2006-04-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/EncapsulationStream.java (constructor):
+ Set the byte order.
+
+2006-04-09 Wolfgang Baer <WBaer@gmx.de>
+
+ * org/omg/PortableServer/ServantLocatorPOA.java:
+ (preinvoke, postinvoke): Remove default implementation.
+ * org/omg/PortableServer/ServantActivatorPOA.java:
+ (incarnate, etherealize): Remove default implementation.
+ * org/omg/PortableInterceptor/ObjectReferenceFactory.java:
+ Extends from ValueBase and not from ObjectReferenceFactoryOperations.
+ (make_object): Moved method from ObjectReferenceFactoryOperations.
+ * org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java:
+ Removed unspecified interface.
+ * org/omg/DynamicAny/_DynAnyStub.java:
+ (_DynAnyStub(Delegate)): Removed constructor.
+ * org/omg/DynamicAny/_DynArrayStub.java,
+ * org/omg/DynamicAny/_DynAnyFactoryStub.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:
+ Extend from ObjectImpl and not from _DynAnyStub.
+ (type, next, destroy, copy, rewind, assign, component_count,
+ current_component, equal, from_any, get_any, get_boolean, get_char,
+ get_double, get_dyn_any, get_float, get_long, get_longlong, get_octet,
+ get_reference, get_short, get_string, get_typecode, get_ulong,
+ get_ulonglong, get_ushort, get_val, get_wchar, get_wstring, insert_any,
+ insert_boolean, insert_char, insert_double, insert_dyn_any, insert_float,
+ insert_long, insert_longlong, insert_octet, insert_reference,
+ insert_short, insert_string, insert_typecode, insert_ulong,
+ insert_ulonglong, insert_ushort, insert_val, insert_wchar,
+ insert_wstring, seek, to_any): New methods copied from _DynAnyStub.
+ * org/omg/CosNaming/_BindingIteratorStub.java:
+ (_BindingIteratorStub(Delegate)): Made package private.
+ * org/omg/CosNaming/_NamingContextExtStub.java:
+ (_NamingContextExtStub(Delegate)): Made package private.
+ * org/omg/CosNaming/_NamingContextStub.java:
+ (_NamingContextStub(Delegate)): Made package private.
+ (throw4, throw5): Likewise.
+ * gnu/CORBA/NamingService/NameParser.java (resolve):
+ Adapt to package private constructor. Use _set_delegate instead.
+ * org/omg/CosNaming/NamingContextOperations.java: Do not extend IDLEntity.
+ * org/omg/CORBA/ORB.java:
+ (create_recursive_sequence_tc): Made abstract.
+ (get_default_context): Likewise.
+ * gnu/CORBA/OrbRestricted.java:
+ (create_recursive_sequence_tc): New moved method.
+ (get_default_context): Likewise.
+ * org/omg/CORBA/ParameterMode.java:
+ (PARAM_IN, PARAM_OUT, PARAM_INOUT): Made final.
+
+2006-04-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/GIOP/MessageHeader.java (write):
+ More informative exception.
+ * gnu/CORBA/IorDelegate.java (release): Do not close the socket.
+ * gnu/CORBA/SocketRepository.java (get_socket):
+ Removed debugging code.
+
+2006-04-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/gnuRequest.java (submit): Try to read the response for the
+ one way message, but ignore if EOF was received.
+ * gnu/CORBA/GIOP/MessageHeader.java (read): Set the minor code to
+ Minor.EOF if the end of file is received instead of the header.
+
+2006-04-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalRootPaneUI.java
+ (MetalTitlePane.IconifyAction): New inner class.
+ (MetalTitlePane.MaximizeAction): New inner class.
+ (MetalTitlePane.createActions): Create iconifyAction and
+ maximizeAction.
+ (MetalRootLayout.titlePane): New field.
+ (MetalRootLayout.MetalRootLayout): Take titlePane parameter in
+ constructor.
+ (MetalRootLayout.preferredLayoutSize): Changed to not make
+ assumptions about the actual component order.
+ (MetalRootLayout.layoutContainer): Changed to not make
+ assumptions about the actual component order.
+ (installWindowDecorations): Pass the titlePane as parameter to
+ the MetalRootLayout constructor.
+ (uninstallWindowDecorations): Changed to not make
+ assumptions about the actual component order.
+
+2006-04-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalRootPaneUI.java
+ (MetalTitlePane.MouseHandler): New inner class to handle dragging
+ of frames.
+ (MetalTitlePane.installListeners): Don't register a focus listener
+ on the window. This is a potential memory leak and must be
+ implemented on a different way. Install mouse listener here.
+ (installWindowDecorations): Fixed assertion condition. Always
+ insert the window decoration at index#1 in the layered
+ pane.
+
+2006-04-08 Roman Kennke <kennke@aicas.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked):
+ Only resize window if actual width or height value changes.
+ Avoids nasty flicker when only setLocation() is beeing called
+ on a window.
+
+2006-04-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/GIOP/MessageHeader.java (read): Throw more informative
+ exception if the magic sequence does not match.
+
+2006-04-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/gnuRequest.java (p_invoke, submit): Do not try to read
+ response for the one way messages.
+
+2006-04-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/MenuSelectionManager.java
+ (processKeyEvent): Implemented stub method.
+ * javax/swing/JMenu.java
+ (processKeyEvent): Implemented stub method.
+ * javax/swing/JMenu.java
+ (processKeyEvent): Implemented stub method.
+ (processMenuKeyEvent): Implemented stub method.
+
+2006-04-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractAction.java
+ (readObject): Removed unneeded method.
+ (writeObject): Removed unneeded method.
+
+2006-04-08 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/swing/plaf/synth/SynthPainter.java:
+ (paintSplitPaneDividerBorder): Removed.
+
+2006-04-08 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:
+ (CLOSE_CMD, ICONIFY_CMD, MAXIMIZE_CMD, MOVE_CMD, RESTORE_CMD, SIZE_CMD):
+ No longer constants.
+ (static_initializer): Added to initialize above fields.
+ * javax/accessibility/AccessibleRelation.java (LABEL_FOR, LABELED_BY,
+ MEMBER_OF, CONTROLLER_FOR, CONTROLLED_BY): No longer constants.
+ (static_initializer): Added to initialize above fields.
+
+2006-04-08 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/awt/Dialog.java: Improved documentation all over.
+ (Dialog(Frame)): If gc is null use the owners GraphicsConfiguration.
+ (Dialog(Dialog)): Likewise.
+
+2006-04-08 Mark Wielaard <mark@klomp.org>
+
+ * java/util/jar/JarFile.java (provider): New static field.
+ (verify, verifyHashes, EntryInputStream.<init>): Pass provider
+ to `getInstance.'
+
+2006-04-08 Mark Wielaard <mark@klomp.org>
+
+ PR 27081
+ * java/lang/StackTraceElement.java (toString): Don't add space
+ between type and source indicator.
+
+2006-04-07 Casey Marshall <csm@gnu.org>
+
+ Fixes PR classpath/24464
+ * java/util/jar/JarFile.java (verify, verifyHashes,
+ EntryInputStream.<init>): pass the Gnu provider directly to
+ `getInstance.'
+
+2006-04-08 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ PR classpath/27071
+ * gnu/java/security/hash/Whirlpool.java: Updated documentation.
+ (DIGEST0): Use version 3 test vector.
+ (Sd): Removed.
+ (S_box): New field: Version 3 S-box values.
+ (<clinit>): Use Version 3 circulant matrix to construct lookup tables.
+ (transform): Formating.
+ (padBuffer): Likewise.
+ (getResult): Likewise.
+ (selfTest): Likewise.
+
+2006-04-07 Tom Tromey <tromey@redhat.com>
+
+ * java/util/InvalidPropertiesFormatException.java
+ (serialVersionUID): New field.
+ (readObject, writeObject): New methods.
+ * java/util/Arrays.java (toString): Javadoc fixes.
+ * java/net/URLConnection.java: Cleaned up imports.
+ * java/lang/reflect/ParameterizedType.java: Javadoc fix.
+ * java/lang/reflect/MalformedParameterizedTypeException.java
+ (serialVersionUID): New field.
+ * java/lang/reflect/GenericSignatureFormatError.java
+ (serialVersionUID): New field.
+ * java/lang/Class.java (Class): Javado fixes.
+ (getComponentType): Likewise.
+ (getGenericInterfaces): Likewise.
+ (getTypeParameters): Likewise.
+ * java/io/CharArrayWriter.java (append): Javadoc fixes.
+ * java/lang/annotation/AnnotationFormatError.java (serialVersionUID):
+ New field.
+ * java/lang/TypeNotPresentException.java (serialVersionUID): New
+ field.
+ * java/lang/EnumConstantNotPresentException.java (serialVersionUID):
+ New field.
+
+2006-04-07 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/awt/Dialog.java
+ (AccessibleAWTDialog): Added api docs
+ (AccessibleAWTDialog.getAccessibleStateSet):
+ Renamed from getAccessibleState.
+ * java/awt/Frame.java
+ (AccessibleAWTFrame): Added api docs
+ (AccessibleAWTFrame.getAccessibleStateSet):
+ Renamed from getAccessibleState.
+
+2006-04-07 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/awt/Dialog.java: Reformatted.
+
+2006-04-07 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Component.java
+ (eventTypeEnabled): Added code for HierarchyEvent.HIERARCHY_CHANGED,
+ HierarchyEvent.ANCESTOR_MOVED and HierarchyEvent.ANCESTOR_RESIZED.
+
+2006-04-07 Tom Tromey <tromey@redhat.com>
+
+ * java/beans/beancontext/BeanContextMembershipEvent.java
+ (serialVersionUID): New field.
+ * java/beans/beancontext/BeanContextServicesSupport.java
+ (addBeanContextServicesListener): Synchronize.
+ (addService): Implemented.
+ (createBCSChild): Implemented.
+ (BCSSChild): Added arguments.
+ (fireServiceAdded): Implemented.
+ (fireServiceRevoked): Implemented.
+ (getCurrentServiceSelectors): Implemented.
+ (hasService): Implemented.
+ (removeBeanContextServicesListener): Implemented.
+ (serviceAvailable): Implemented.
+ (serviceRevoked): Implemented.
+ * java/beans/beancontext/BeanContextSupport.java (BCSChild): Added
+ arguments.
+ (createBCSChild): Implemented.
+ (BeanContextSupport):
+ (addBeanContextMembershipListener): Synchronize.
+ (fireChildrenAdded): Implemented.
+ (fireChildrenRemoved): Implemented.
+ (BeanContextSupport): Use default locale.
+ (isEmpty): Implemented.
+ (isDesignTime): Implemented.
+ (size): Implemented.
+ (toArray): Synchronized.
+ (toArray): Likewise.
+ (iterator): Likewise.
+ (BCSIterator): Implemented.
+ (bcsChildren): Implemented.
+ (validatePendingAdd): Implemented.
+ (validatePendingRemove): Likewise.
+ (childJustAddedHook): Implemented.
+ (childJustRemovedHook): Likewise.
+ (classEquals): Likewise.
+ (toArray): Mark as stub.
+ (setDesignTime): Implemented.
+ (copyChildren): Implemented.
+ (containsKey): Implemented.
+ (contains): Likewise.
+ (containsAll): Likewise.
+ (getResource): Implemented.
+ (getResourceAsStream): Likewise.
+ (removeBeanContextMembershipListener): Likewise.
+ * java/beans/beancontext/BeanContextServiceRevokedEvent.java
+ (serialVersionUID): New field.
+ * java/beans/beancontext/BeanContextServiceAvailableEvent.java
+ (serialVersionUID): New field.
+ * java/beans/beancontext/BeanContext.java (instantiateChild): Javadoc
+ fix.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ PR 26937
+ * javax/swing/MenuSelectionManager.java
+ (setSelectedPath): Search one more item in the loop.
+
+2006-04-06 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/image/renderable/RenderableImageProducer.java
+ (image, context, consumers): New fields.
+ (RenderableImageProducer): Implemented.
+ (setRenderContext): Likewise.
+ (addConsumer): Likewise.
+ (isConsumer): Likewise.
+ (removeConsumer): Likewise.
+ (startProduction): Likewise.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (AccessibleAWTComponent.getBounds): Return the component
+ bounds regardless of its showing state.
+ (AccessibleAWTComponent.getLocation): Return the component
+ location regardless of its showing state.
+ (AccessibleAWTComponent.getSize): Return the component
+ size regardless of its showing state.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JRootPane.java
+ (getAccessibleContext): New method. Provides an accessibleContext
+ for JRootPanes.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Toolkit.java
+ (initAccessibility): Use the 'gnu.classpath.home.url' property
+ to determine the system confiuration directory.
+ * java/awt/Component.java
+ (dispatchEvent): Trigger Toolkit dispatching here.
+ (dispatchEventImpl): Moved Toolkit dispatching to dispatchEvent,
+ so it can't be overridden by subclasses and is performed in
+ any case.
+
+2006-04-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/naming/Binding.java: Added API docs.
+ * javax/naming/NameClassPair.java: Added API docs.
+ (fullName): New field.
+ (setNameInNamespace): New 1.5 method.
+ (getNameInNamespace): Likewise.
+
+2006-04-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/naming/CompositeName.java:
+ (readObject): New deserialization method.
+ (writeObject): New serialization method.
+
+2006-03-29 Nektarios K. Papadopoulos <npapadop at inaccessnetworks.com>
+
+ * javax/security/auth/x500/X500Principal.java
+ (readAttributeValue) Check for separator after quoted value was
+ failing in all cases.
+
+2006-04-06 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/Class.java (getClassLoader): Don't do security check
+ when loader is null.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Toolkit.java
+ (getDefaultToolkit): Initialize accessibility after setting
+ up the toolkit.
+ (initAccessibility): New helper method to setup accessibility.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AccessibleAbstractButton.getAccessibleIcon): Implemented stub.
+ (AccessibleAbstractButton.getAccessibleRelationSet): Implemented
+ stub.
+ (AccessibleAbstractButton.getIndexAtPoint): Implemented stub.
+ (AccessibleAbstractButton.getAccessibleIcon): Implemented stub.
+ (AccessibleAbstractButton.getCharacterBounds): Implemented stub.
+ (AccessibleAbstractButton.getCharCount): Implemented stub.
+ (AccessibleAbstractButton.getCaretPosition): Implemented stub.
+ (AccessibleAbstractButton.getCharacterAttribute): Implemented stub.
+ (AccessibleAbstractButton.getSelectionStart): Implemented stub.
+ (AccessibleAbstractButton.getSelectionEnd): Implemented stub.
+ (AccessibleAbstractButton.getSelectedText): Implemented stub.
+ (AccessibleAbstractButton.getTextRectangle): Removed unneeded
+ private method.
+
+2006-04-06 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (AccessibleAWTComponent.getAccessibleStateSet): Don't handle opaque
+ state here. This is only done in JComponent.
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.getAccessibleStateSet): Handle opaque flag
+ here.
+ (getNextFocusableComponent): Implemented stub method.
+ (grabFocus): Implemented stub method.
+ (unregisterKeyboardAction): Implemented stub method.
+ (setNextFocusableComponent): Implemented stub method.
+ * javax/swing/CompatibilityFocusTraversalPolicy.java: New file.
+ This is a helper class for providing compatibility with the older
+ Swing focus API.
+
+2006-04-06 Wolfgang Baer <WBaer@gmx.de>
+
+ Fixes bug #26995
+ * javax/naming/directory/BasicAttribute.java,
+ * javax/naming/directory/BasicAttributes.java:
+ (readObject): New deserialization method.
+ (writeObject): New serialization method.
+
+2006-04-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/xml/validation/SchemaFactory.java: Corrected since tag.
+ (getErrorHandler): Made method abstract.
+ (setErrorHanlder): Likewise.
+ * gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
+ (getErrorHandler): Implement abstract method from superclass.
+ (setErrorHandler): Likewise.
+ (errorHandler): New field.
+ * gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java:
+ (getErrorHandler): Implement abstract method from superclass.
+ (setErrorHandler): Likewise.
+ (errorHandler): New field.
+ * javax/xml/XMLConstants.java: Corrected since tag.
+ (XMLConstants): Added private constructor.
+ * javax/xml/datatype/Duration.java: Corrected since tag.
+ (multiply): Made method abstract.
+ * javax/xml/datatype/DatatypeConstants.java: Corrected since tag.
+ (DatatypeConstants): Added private constructor.
+ * javax/xml/xpath/XPathConstants.java: Corrected since tag.
+ (XPathConstants): Added private constructor.
+
+2006-04-05 Tom Tromey <tromey@redhat.com>
+
+ * javax/security/auth/kerberos/ServicePermission.java: Now final.
+
+2006-04-05 Tom Tromey <tromey@redhat.com>
+
+ PR libgcj/26625:
+ * lib/Makefile.am (compile-classes): Touch the output file.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AccessibleAbstractButton.getAccessibleStateSet): Removed handling
+ of the focused state. This is already done in AccessibleAWTComponent.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (accessibleContext): Fixed API doc for this field.
+ (AccessibleJComponent.AccessibleFocusHandler): Fixed API docs.
+ (AccessibleJComponent.AccessibleFocusHandler.focusGained):
+ Implemented and added API docs.
+ (AccessibleJComponent.AccessibleFocusHandler.focusLost):
+ Implemented and added API docs.
+ (AccessibleJComponent.AccessibleContainerHandler): Fixed API docs.
+ (AccessibleJComponent.AccessibleContainerHandler.componentAdded):
+ Implemented and added API docs.
+ (AccessibleJComponent.AccessibleContainerHandler.componentRemoved):
+ Implemented and added API docs.
+ (AccessibleJComponent.accessibleContainerHandler): Added API docs.
+ (AccessibleJComponent.accessibleFocusHandler): Added API docs.
+ (AccessibleJComponent.addPropertyChangeListener): Added API docs.
+ (AccessibleJComponent.removePropertyChangeListener): Added API docs.
+ (AccessibleJComponent.getAccessibleStateSet): Simply return
+ super here. Added comment about this.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.addPropertyChangeListener): Install
+ ContainerHandler and FocusHandler here.
+ (AccessibleJComponent.removePropertyChangeListener): Uninstall
+ ContainerHandler and FocusHandler here.
+ (AccessibleJComponent.getAccessibleChildrenCount): Replaced
+ by super.getAccessibleChildrenCount().
+ (AccessibleJComponent.getAccessibleChild): Replaced
+ by super.getAccessibleChild().
+ (AccessibleJComponent.getAccessibleStateSet): Implemented by
+ adding OPAQUE to the supported states.
+ (AccessibleJComponent.getAccessibleName): Added titled border
+ and label fallbacks.
+ (AccessibleJComponent.getAccessibleDescription): Added tooltip
+ and label fallbacks.
+ (AccessibleJComponent.getAccessibleRole): Removed TODO.
+ (AccessibleJComponent.getAccessibleKeyBinding): Added comment
+ explaining why return null seems correct here.
+ * javax/swing/JLabel.java
+ (LABEL_PROPERTY): New constant.
+ (setLabelFor): Store label in labeled component's client properties
+ for the AccessibleJComponent to read.
+
+2006-04-05 Tom Tromey <tromey@redhat.com>
+
+ * java/util/zip/ZipFile.java (available): Defer to super if
+ entry's size is unknown.
+
+2006-04-05 Tom Tromey <tromey@redhat.com>
+
+ * java/net/MimeTypeMapper.java (MimeTypeMapper): Look for system
+ property with mime.types name.
+ * gnu/classpath/SystemProperties.java: Set
+ gnu.classpath.mime.types.file if not already set.
+ * java/net/URLConnection.java (defaultFactory): New field.
+ (guessContentTypeFromStream): Mark as unimplemented.
+ (getContentHandler): Updated with libgcj's implementation.
+ * gnu/java/net/DefaultContentHandlerFactory.java: New file,
+ from libgcj.
+
+2006-04-05 Bryce McKinlay <mckinlay@redhat.com>
+
+ PR classpath/27028
+ PR classpath/24752
+ * java/util/AbstractList.java (hasNext): Don't throw
+ ConcurrentModificationException. Update Javadoc.
+ (hasPrevious): Likewise.
+ (nextIndex): Likewise.
+ (previousIndex): Likewise.
+ * java/util/HashMap.java (hasNext): Likewise.
+ * java/util/Hashtable.java (hasNext): Likewise.
+ * java/util/IdentityHashMap.java (hasNext): Likewise.
+ * java/util/LinkedHashMap.java (hasNext): Likewise.
+ * java/util/LinkedList.java (nextIndex): Likewise.
+ (previousIndex): Likewise.
+ (hasNext): Likewise.
+ (hasPrevious): Likewise.
+ * java/util/TreeMap.java (hasNext): Likewise.
+ * java/util/WeakHashMap.java (hasNext): Likewise.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AccessibleAbstractButton.getAccessibleStateSet): Implemented stub.
+ (AccessibleAbstractButton.doAccessibleAction): Implemented stub.
+ (AccessibleAbstractButton.getAccessibleAction): Implemented stub.
+ (AccessibleAbstractButton.getAccessibleActionCount): Implemented stub.
+ (AccessibleAbstractButton.getAccessibleActionDescription):
+ Implemented stub.
+ (AccessibleAbstractButton.getAccessibleText): Implemented stub.
+ (AccessibleAbstractButton.getAccessibleAction): Implemented stub.
+ (AccessibleAbstractButton.getCurrentAccessibleValue): Implemented stub.
+ (AccessibleAbstractButton.setCurrentAccessibleValue): Implemented stub.
+ (AccessibleAbstractButton.getMinimumAccessibleValue): Implemented stub.
+ (AccessibleAbstractButton.getMaximumAccessibleValue): Implemented stub.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComboBox.java
+ (selectWithKeyChar): Implemented stubbed method.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/LookAndFeel.java
+ (installProperty): New method. Allows primitive typed properties
+ to be handled like UIResources.
+ * javax/swing/AbstractButton.java
+ (clientBorderPaintedSet): New field.
+ (clientRolloverEnabledSet): New field.
+ (clientIconTextGapSet): New field.
+ (clientContentAreaFilledSet): New field.
+ (setRolloverEnabled): Set the client field to true.
+ (setBorderPainted): Likewise.
+ (setIconTextGap): Likewise.
+ (setContentAreaFilled): Likewise.
+ (setUIProperty): New helper method.
+ * javax/swing/JComponent.java
+ (clientOpaqueSet): New field.
+ (clientAutoscrollsSet): New field.
+ (setAutoscrolls): Set the client field to true.
+ (setOpaque): Likewise.
+ (setUIProperty): New helper method.
+ * javax/swing/JDesktopPane.java
+ (clientDragModeSet): New field.
+ (setDragMode): Set the client field to true.
+ (setUIProperty): New helper method.
+ * javax/swing/JSplitPane.java
+ (clientDividerSizeSet): New field.
+ (clientOneTouchExpandableSet): New field.
+ (setDividerSize): Set the client field to true.
+ (setOneTouchExpandable): Likewise.
+ (setUIProperty): New helper method.
+ * javax/swing/JTable.java
+ (clientRowHeightSet): New field.
+ (setRowHeight): Set the client field to true.
+ (setUIProperty): New helper method.
+ * javax/swing/JTree.java
+ (clientRowHeightSet): New field.
+ (clientScrollsOnExpandSet): New field.
+ (clientShowsRootHandlesSet): New field.
+ (setRowHeight): Set the client field to true.
+ (setShowsRootHandles): Likewise.
+ (setScrollsOnExpand): Likewise.
+ (setUIProperty): New helper method.
+
+2006-04-05 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getFont): Don't request the font from the peer's graphics. The
+ graphics should instead get the font from the Component, which might
+ result in a loop.
+ (getFocusCycleAncestor): Don't special case Window.
+ (nextFocus): Moved implementation from the DefaultKeyboardFocusManager
+ to here. Correctly determine the focus cycle root.
+ (transferFocusBackward): Likewise.
+ (transferFocusUpCycle): Likewise.
+ * java/awt/Container.java
+ (transferFocusDownCycle): Moved implementation from
+ DefaultKeyboardFocusManager to here.
+ * java/awt/DefaultKeyboardFocusManager.java
+ (focusPreviousComponent): Moved implementation to
+ Component.transferFocusBackward().
+ (focusNextComponent): Moved implementation to
+ Component.nextFocus().
+ (upFocusCycle): Moved implementation to
+ Component.transferFocusUpCycle().
+ (downFocusCycle): Moved implementation to
+ Container.transferFocusDownCycle().
+
+2006-04-05 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/ComponentSampleModel.java
+ (equals): Implemented,
+ (hashCode): Likewise.
+
+2006-04-05 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/Class.java
+ (cast): New method.
+
+2006-04-05 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/ComponentSampleModel.java
+ (getBankIndices): Return a copy of the array, not a reference to the
+ original,
+ (getBandOffsets): Likewise.
+
+2006-04-05 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/ComponentSampleModel.java: Added API docs all over.
+
+2006-04-04 Tom Tromey <tromey@redhat.com>
+
+ * java/net/MimeTypeMapper.java (MimeTypeMapper): Fixed indices.
+
+2006-04-04 Tom Tromey <tromey@redhat.com>
+
+ * java/net/MimeTypeMapper.java (mime_types): No longer static.
+ (MimeTypeMapper): Initialize.
+ (fillFromFile): New method.
+ (main): New method.
+ (mime_strings): Updated.
+
+2006-04-04 Tom Tromey <tromey@redhat.com>
+
+ * lib/gen-classlist.sh.in: Correct handle generated files.
+
+2006-04-04 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ * gnu/regexp/CharIndexed.java(setAnchor): New method.
+ * gnu/regexp/CharIndexedInputStream.java(setAnchor): New method.
+ * gnu/regexp/CharIndexedCharSequence.java: New file.
+ * gnu/regexp/CharIndexedCharArray.java: Rewritten as an extention of
+ gnu.regexp.CharIndexedCharSequence.
+ * gnu/regexp/CharIndexedString.java: Likewise.
+ * gnu/regexp/CharIndexedStringBuffer.java: Likewise.
+ * gnu/regexp/RE.java(makeCharIndexed): Make a new CharIndexed
+ using CharIndexedCharSequence. Use setAnchor when the input
+ object is already a CharIndexed.
+ * java/util/regex/Matcher.java(inputCharIndexed): New field
+ to be used as a parameter of the RE#getMatch.
+
+2006-04-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/SampleModel.java: Reformatted.
+
+2006-04-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/ComponentSampleModel.java
+ (ComponentSampleModel(int, int, int, int, int[])): Added API
+ documentation,
+ (ComponentSampleModel(int, int, int, int, int[], int[]): Throw
+ IllegalArgumentException for DataBuffer.TYPE_UNDEFINED, take copies
+ of the bandOffsets and bankIndices arguments, added API documentation,
+ * java/awt/image/SampleModel.java
+ (SampleModel(int, int, int, int): Throw IllegalArgumentException for
+ unrecognised dataTypes, w * h exceeds Integer.MAX_VALUE, and numBands
+ less than or equal to zero, added API documentation.
+
+2006-04-04 Lillian Angel <langel@redhat.com>
+
+ * java/util/zip/ZipFile.java
+ (getInputStream): Fixed to return size of ZipEntry
+ minus the total bytes read. This guarantees that the
+ right value is returned even if some bytes have already
+ been read.
+
+2006-04-04 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/plugins/jpeg/JPEGImageWriteParam.java (messages):
+ Remove static modifier.
+
+2006-04-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/ComponentSampleModel.java: Reformatted.
+
+2006-04-03 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/plugins/jpeg/JPEGImageWriteParam.java: New file.
+ * javax/imageio/plugins/jpeg/JPEGImageReadParam.java: Add
+ retrieval instructions to javadoc header.
+ * javax/imageio/ImageWriteParam.java: Fix javadoc for
+ compressionType field.
+ * lib/Makefile.am (propertydirs): Add javax directory.
+ (propertyfiles): Likewise.
+ * resource/javax/imageio/plugins/jpeg/MessagesBundle.properties:
+ New file.
+
+2006-04-03 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/26971:
+ * javax/naming/directory/BasicAttribute.java: Added missing @since.
+ (BasicAttributeEnumeration.where): Initialize to 0.
+ (BasicAttributeEnumeration.nextElement): Post-increment 'where'.
+
+2006-04-03 Lillian Angel <langel@redhat.com>
+
+ PR classpath/24596 and PR classpath/26930
+ * java/util/zip/ZipFile.java
+ (getInputStream): Override available function for
+ InflaterInputStream instance.
+
+2006-04-03 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/plugins/jpeg/JPEGImageReadParam.java: New file.
+
+2006-04-03 Tom Tromey <tromey@redhat.com>
+
+ * javax/security/auth/kerberos/ServicePermission.java: New file.
+ * javax/security/auth/kerberos/DelegationPermission.java: New file.
+ * javax/security/auth/kerberos/KerberosKey.java: New file.
+ * javax/security/auth/kerberos/KeyImpl.java: New file.
+ * javax/security/auth/kerberos/KerberosTicket.java: New file.
+ * javax/security/auth/kerberos/KerberosPrincipal.java: New file.
+
+2006-04-03 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/gtk/GtkClipboard.java: Add support for
+ non-GtkImage images.
+
+2006-04-03 Mark Wielaard <mark@klomp.org>
+
+ * lib/gen-classlist.sh.in: Use classes.tmp, not classes.2
+ as temporary file name.
+
+2006-04-03 Dalibor Topic <robilad@kaffe.org>
+
+ * INSTALL: Documented --with-glibj-zip option.
+
+2006-04-03 Dalibor Topic <robilad@kaffe.org>
+
+ Fixed all pscan warnings.
+
+ * native/jni/classpath/jcl.c (JCL_ThrowException),
+ native/jni/classpath/jcl.h (DBG),
+ native/target/generic/target_generic.h (TARGET_NATIVE_LAST_ERROR_STRING_FORMAT),
+ native/target/generic/target_generic_misc.h (TARGET_NATIVE_MISC_FORMAT_STRING0):
+ Use "%s" format in fprintf and snprintf explicitely when printing a single
+ string to prevent format string exploits.
+
+ * native/jni/java-net/javanet.h (DBG): Removed duplicate
+ definition. Included jcl.h instead.
+
+2006-04-03 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * tools/gnu/classpath/tools/jarsigner/Main.java: Removed unused imports.
+ (provider): Made it protected.
+ (providerInstalled): New field.
+ (Main): Made it a 0-arguments constructor.
+ Removed throws clasue.
+ (main): Removed throws clause.
+ Call processArgs(args) after constructing instance.
+ Call teardown() before existing.
+ (processArgs): Added javadoc.
+ Reduced to throws Exception.
+ (start): Likewise.
+ (teardown): New method.
+ (setupCommonParams): Added javadoc.
+ Install designated provider if not already installed.
+ (installNewProvider): New method.
+ (setupSigningParams): Added javadoc.
+ Instantiate the KeyStore using type only.
+ * tools/gnu/classpath/tools/jarsigner/JarSigner.java:
+ Removed unused imports.
+ (start): Reduced to throws Exception.
+ * tools/gnu/classpath/tools/jarsigner/JarVerifier.java (start): Likewise.
+ * tools/gnu/classpath/tools/jarsigner/HashUtils.java:
+ Re-organized imports.
+ * gnu/java/security/key/KeyPairGeneratorFactory.java (getInstance):
+ Test ignoring case.
+ (getNames): Add "dsa" as an algorithm provided by this Factory.
+ (makeInstance): Construct IllegalArgumentException with 2 arguments.
+
+2006-04-03 Roman Kennke <kennke@aicas.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
+ Replaced g_free() with pango_item_free() to avoid problems
+ with the allocator.
+
+2006-04-03 Rafael H. Schloming <rafaels@redhat.com>
+
+ Fixes bug #26668
+ * java/util/logging/Level.java (parse): Document.
+ * java/util/logging/LogManager.java (rootLogger): Removed.
+ (LogManager): Just set loggers to new HashMap.
+ (getLogManager): Make synchronized. Create and init LogManager if it
+ doesn't exist yet.
+ (static): Removed block.
+ (MANAGER_PROPERTY): New private final string.
+ (makeLogManager): Use new property string, move warning to
+ createInstance() method.
+ (CONFIG_PROPERTY): New private final string.
+ (initLogManager): New method.
+ (addLogger): Use Logger.root, not rootLogger.
+ (findAncestor): Likewise.
+ (readConfiguration): Move warning to createInstance() method.
+ Add handlers directly to Logger.root. Warn about bad level values.
+ (getClassProperty): Use new locateClass() method.
+ (getInstanceProperty): Only catch specific newInstance Errors.
+ (createInstance): Make private and takes a string to use in warning
+ messages. Use new locateClass() method and generate appropriate
+ warning message.
+ (warn): New methods.
+ (locateClass): Locates a class through the context class loader and
+ system class loader as backup.
+ * java/util/logging/Logger.java (root): New static final field.
+ (Logger): Set parent to root.
+ (setParent): Directly check root field.
+
2006-04-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/Collections.java:
@@ -26,6 +1303,364 @@
* java/io/ObjectStreamConstants.java:
(SC_ENUM): Added.
+2006-04-02 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/Segment.java:
+ (setPosition): Make exception message more verbose.
+ * javax/swing/text/WrappedPlainView.java:
+ (insertUpdate): Removed unneeded repaint call.
+ (changeUpdate): Dito.
+ (removeUpdate): Dito.
+ (WrappedLine.determineNumLines): Do not return numLines, break
+ from loop if no new break point has been calculated.
+ (WrappedLine.updateDamage): Rewritten.
+ (WrappedLine.insertUpdate): Removed unneeded update code.
+ (WrappedLine.removeUpdate): Removed unneeded update code, added
+ comment.
+
+2006-04-02 Dalibor Topic <robilad@kaffe.org>
+
+ * configure.ac (with-glibj-zip): Added new option.
+
+ * examples/Makefile.am,
+ lib/Makefile.am,
+ tools/Makefile.am: Adapted build classpath to use glibj.zip,
+ in addition to classes in lib directory.
+
+2006-04-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * tools/gnu/classpath/tools/giop/GRMIC.java,
+ tools/gnu/classpath/tools/giop/IorParser.java,
+ tools/gnu/classpath/tools/giop/grmic/CompilationError.java,
+ tools/gnu/classpath/tools/giop/grmic/Generator.java,
+ tools/gnu/classpath/tools/giop/grmic/GiopIo.java,
+ tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java,
+ tools/gnu/classpath/tools/giop/grmic/HashFinder.java,
+ tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java,
+ tools/gnu/classpath/tools/rmi/RMIC.java,
+ tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java,
+ tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java,
+ tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java: Removed
+ linking exception from the licensing header.
+ * tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java:
+ Added licensing header.
+
+2006-04-02 Mark Wielaard <mark@klomp.org>
+
+ * tools/Makefile.am (bin_SCRIPTS): Renamed to jarsigner.sh.
+ (jarsigner): Removed.
+
+2006-04-02 Dalibor Topic <robilad@kaffe.org>
+
+ * configure.ac: don't check for isnan function.
+ * native/fdlibm/fdlibm.h: Always use the isnan macro.
+
+2006-04-02 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * configure.ac: Added tools/jarsigner.sh to AC_CONFIG_FILES.
+ * tools/Makefile.am: Generate jarsigner shell script.
+ * tools/jarsigner.sh.in: New template.
+ * tools/.cvsignore: Added jarsigner.sh.
+
+2006-04-02 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * tools/gnu/classpath/tools/jarsigner/HashUtils.java: Use GPL.
+ * tools/gnu/classpath/tools/jarsigner/SFHelper.java: Likewise.
+ * tools/gnu/classpath/tools/jarsigner/JarVerifier.java: Likewise.
+ * tools/gnu/classpath/tools/jarsigner/JarSigner.java: Likewise.
+ * tools/gnu/classpath/tools/jarsigner/Main.java: Likewise.
+ Re-organised imports.
+
+2006-04-01 Bernhard Rosenkraenzer <bero@arklinux.org>
+
+ PR classpath/25924:
+ * java/awt/image/DirectColorModel.java (extractAndNormalizeSample):
+ Handle case where alpha==0.
+
+2006-04-02 Robert Schuster <robertschuster@fsfe.org>
+
+ PR #26676
+ * javax/swing/text/Utilities.java:
+ (getTabbedTextOffset): Added check to decrement pos not below zero,
+ changed '>' comparison to '>='.
+ * javax/swing/text/WrappedPlainView.java:
+ (lineHeight): New field.
+ (calculateBreakPosition): Throw InternalError in catch block, removed
+ unneeded brackets, use specific version of
+ Utilities.getTabbedTextOffset.
+ (paint): Set various properties neccessary for drawing.
+ (WrappedLine.paint): Removed code to set field of outer class.
+ (WrappedLine.modelToView): Removed unneeded expression from
+ if-statement.
+ (WrappedLine.viewToModel): Initialize end with endOffset - 1, removed
+ -1 from return statement, copy only a subset into the Segment, removed
+ special handling of mark value - just return it, simplified
+ incrementation of currLineStart.
+ (WrappedLine.insertUpdate): Recalculate numLines, report preference
+ change to parent view.
+ (WrappedLine.removeUpdate): Dito.
+
+2006-04-02 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/Segment.java:
+ (toString): Return empty string when array is null.
+
+2006-04-02 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (damageRange): Use SwingUtilities.computeUnion to avoid
+ unneccessary Rectangle instantiation.
+
+2006-04-01 Tom Tromey <tromey@redhat.com>
+
+ * java/security/cert/Certificate.java (serialVersionUID): Fixed.
+
+2006-04-01 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/CompositeView.java: Fixed copyright header.
+ * javax/swing/text/BoxView.java: Fixed copyright header.
+ * javax/swing/text/WrappedPlainView.java: Fixed copyright header.
+ * javax/swing/text/Utilities.java: Fixed copyright header.
+
+2006-04-01 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/CompositeView.java:
+ (modelToView): Throw BadLocationException when no child
+ view can be found, restructed to throw exception as early
+ as possible.
+ (viewToModel): Use mutable allocation as argument for viewToModel
+ call on child view.
+ * javax/swing/text/BoxView.java:
+ (getViewAtPoint): Call setBounds() r before method returns with
+ suitable child view.
+ * javax/swing/text/Utilities.java:
+ (getPositionBelow): Added try-catch-block around modelToView call,
+ added method return when BadLocationException was thrown.
+ * javax/swing/text/WrappedPlainView.java:
+ (WrappedLine.viewToModel): Changed '<=' to '<' in if-expression,
+ added note about meaning of rect.x and rect.width, removed unneeded
+ checks, added code to not return the last possible document offset.
+
+2006-04-01 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/WrappedPlainView.java:
+ (WrappedLine.viewToModel): Change < to <= in if-statement,
+ removed addition of currLineStart to return value.
+ * javax/swing/text/BoxView.java:
+ (getViewAtPoint): Use copy instead of r for method call
+ which modifies the second argument.
+
+2006-04-01 Mark Wielaard <mark@klomp.org>
+
+ Fixes PR26973
+ * java/util/jar/Attributes.java: Fully qualify java.util.Map.
+
+2006-03-31 Tom Tromey <tromey@redhat.com>
+
+ * lib/split-for-gcj.sh: Updated for multi-field format.
+ * lib/Makefile.am (CLEANFILES): Added classes.2.
+ * lib/gen-classlist.sh.in (GCJ): Removed. Create classes.1 and
+ classes.2 using multiple fields.
+
+2006-03-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/JTable.java (columnSelectionChanged):
+ Removed print statement.
+ * javax/swing/DefaultListSelectionModel.java
+ (addSelectionInterval, removeSelectionInterval):
+ Fire the difference between selection. (setLeadSelectionIndex):
+ Fire the difference and mark current and previous lead
+ selection indexes for repaint.
+
+2006-03-31 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/plugins/jpeg/JPEGHuffmanTable.java: Eliminate
+ unnecessary copying.
+ * javax/imageio/plugins/jpeg/JPEGQTable.java: Likewise.
+
+2006-03-31 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Component.java
+ (translateEvent): oldKey should be the value of the
+ key char.
+
+2006-03-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/JTable.java (columnSelectionChanged):
+ Treat second repaint parameter as width.
+
+2006-03-31 Lillian Angel <langel@redhat.com>
+
+ PR classpath/26924
+ * gnu/java/awt/peer/gtk/GtkCanvasPeer.java
+ (realize): New native function.
+ * include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h:
+ Added new function declaration.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+ (realize): New function.
+
+2006-03-31 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/GapContent.java:
+ (replace): Move all Position instances from gap's end to
+ it's start before increasing the gap start.
+ * javax/swing/plaf/basic/BasicTextAreaUI.java:
+ (propertyChanged): Update the view only instead of
+ indicating a document change.
+
+2006-03-31 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (fireActionPerformed): Put the textfields text in the action
+ instead of the action name.
+
+2006-04-01 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * tools/gnu/classpath/tools/jarsigner/Main.java (setupCommonParams):
+ Check for null jar-file argument.
+ (setupSigningParams): Check for null alias argument.
+
+2006-03-31 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintChildren): Split up in two cases, depending on the
+ optimizedDrawingEnabled flag.
+ (paintChildrenWithOverlap): New method. Paints children when
+ not optimizedDrawingEnabled. This implements better painting
+ algorithm for overlapping components, so that the painted
+ regions are minimized.
+ (paintChildrenOptimized): New method. Paints children when
+ when optimizedDrawingEnabled. This implements a painting
+ algorithm that is optimized for the case when all children
+ are guaranteed to be tiled.
+
+2006-03-31 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * tools/gnu/classpath/tools/jarsigner/SFHelper.java (updateEntry): Use
+ Attributes.putValue(String,String).
+ (finishSigning): Likewise.
+ * gnu/java/util/jar/JarUtils.java (MANIFEST_VERSION): New constant.
+ (SIGNATURE_VERSION): Likewise.
+ (readSFManifest): Use local string constant.
+ (readMainSection): Likewise.
+ (readVersionInfo): Likewise.
+ * java/util/jar/Attributes.java (MANIFEST_VERSION):
+ Redefined using JarUtils constant.
+ (SIGNATURE_VERSION): Likewise.
+ (putValue(Name,String)): Made it private.
+
+2006-03-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/DefaultListSelectionModel.java (fireDifference):
+ New method. (clearSelection): Rewritten. (setSelectionInterval):
+ Fire the difference between current and new selection.
+ * javax/swing/JTable.java (columnSelectionChanged, valueChanged):
+ Only repaint the region, where selection has been changed.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (TableAction.actionPerformed): Do not change the column selection
+ when only row selection change is wanted (and in reverse) and
+ do not call the repaint() here.
+
+2006-03-31 David Gilbert <david.gilbert@object-refinery.com>
+
+ Fixes bug #26951
+ * javax/swing/DefaultComboBoxModel.java
+ (DefaultComboBoxModel(Vector)): Call getSize() instead of
+ vector.size(),
+ (addElement): Call list.addElement() rather than list.add(), and only
+ update selected item if it is currently null,
+ (removeElementAt): Update selected item, then remove the element.
+
+2006-03-31 David Gilbert <david.gilbert@object-refinery.com>
+
+ Fixes bug #26955
+ * java/awt/geom/Point2D.java
+ (distanceSq(double, double)): Fixed order of arguments,
+ (distanceSq(Point2D)): Likewise,
+ (distance(double, double)): Likewise,
+ (distance(Point2D)): Likewise.
+
+2006-03-30 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/plugins/jpeg/JPEGQTable.java: New file.
+ * javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
+ (ACChrominanceLengths, ACChrominanceValues, ACLuminanceLengths,
+ ACLuminanceValues, DCChrominanceLengths, DCChrominanceValues,
+ DCLuminanceLengths, DCLuminanceValues): Remove fields.
+
+2006-03-30 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax.swing.JTable (constructor): Initialize column
+ model column margin and table row margin before setting the
+ table column model. (initialiseLocalVars): Do not call
+ setIntercellSpacing.
+
+2006-03-30 Chris Burdess <dog@gnu.org>
+
+ * javax/xml/datatype/DatatypeFactory.java (newDurationDayTime): Fix
+ method signature.
+ * javax/xml/validation/SchemaFactoryLoader.java: New file.
+
+2006-03-30 Mark Wielaard <mark@klomp.org>
+
+ PR 26848
+ * java/awt/Window.java (dispatchEventImpl): On ComponentEvents
+ adjust bounds. On resize invalidate and validate container.
+ Always pass on ComponentEvents to Container super class.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (setBounds): Adjust for
+ menuBar and pass to GtkWindowPeer super class.
+ (postConfigureEvent): Adjust menu bar width. Adjust y and height
+ bounds and pass to GtkWindowPeer super class.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java (x, y, width, height):
+ New fields for local bounds.
+ (getX, getY): New methods.
+ (getWidth): Don't call into awtComponent.
+ (getHeight): Likewise.
+ (create): Cache local bounds.
+ (setLocation): Documented, made protected and just call
+ nativeSetLocation.
+ (setLocationUnlocked): Removed unused method.
+ (setBoundsUnlocked): Likewise.
+ (setBounds): Check whether bounds actually changed and cache local
+ bounds.
+ (setSize): Documented and made protected.
+ (setResizable): Documented and cache local bounds.
+ (postConfigureEvent): Update local bounds. Don't call awtComponent
+ directly but post ComponentEvents.
+ (show): Cache local bounds.
+ (getBounds): Override to return cached bounds.
+
+2006-03-30 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (drawImage): Added check to prevent NPE.
+ (drawImage): Likewise.
+ (drawImage): Likewise.
+ * java/awt/Choice.java
+ (dispatchEventImpl): New function. selectedIndex was
+ not being updated properly otherwise.
+
+2006-03-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTabbedPane.java
+ (removeTabAt): Removed debug code.
+
+2006-03-30 Roman Kennke <kennke@aicas.com>
+
+ PR 26045
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installKeyboardActions): Simply call getKeymap() and install this.
+ (createKeymap): Reimplemented to fetch a keymap from the UIManager.
+
+2006-03-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTabbedPane.java
+ (removeTabAt): Adjust selection correctly when removing a tab
+ before the selected tab. Also remove the component from the
+ container, not only the tab object. Repaint and revalidate the
+ component after the removal.
+ (removeAll): Set selection to -1 before removing the tabs.
+
2006-03-29 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/io/ObjectInputStream.java:
@@ -34,6 +1669,220 @@
(TC_ENUM): Added.
(TC_MAX): Changed to new maximum, TC_ENUM.
+2006-03-29 Lillian Angel <langel@redhat.com>
+
+ Partial fix for bug #26929
+ * gnu/java/awt/peer/gtk/GtkPanelPeer.java
+ (updateComponent): Removed. We want to clear the panel
+ before painting.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect): Fixed typo.
+ Should set the background to the saved background color.
+
+2006-03-29 Mark Wielaard <mark@klomp.org>
+
+ Partial fix for bug #26848 (pack).
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java (setVisible):
+ Always show instances of Window.
+
+2006-03-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JSlider.java
+ (setPaintLabels): Only create standard labels if labelTable is null,
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (PropertyChangeHandler.propertyChange): Recalculate geometry for
+ "paintTicks" property change,
+ (calculateThumbSize): Updated API docs,
+ (calculateContentRect): Likewise,
+ (calculateTrackBuffer): Take into account the lowest and highest
+ labels when calculating buffer space,
+ (calculateTrackRect): Include labels, if visible, in the calculation of
+ the trackRect position,
+ (calculateTickRect): Height is zero if ticks are not painted,
+ (calculateLabelRect): Use max dimensions of actual labels,
+ (getWidthOfHighValueLabel): Use preferred size,
+ (getWidthOfLowValueLabel): Likewise,
+ (getHeightOfHighValueLabel): Likewise,
+ (getHeightOfLowValueLabel): Likewise,
+ (drawInverted): Just return slider setting,
+ (getHighestValueLabel): Updated API docs,
+ (paintTicks): Removed redundant (and buggy) code, replaced with calls
+ to xPositionForValue() and yPositionForValue(),
+ (paintHorizontalLabel): Removed full qualification of class name,
+ (paintVerticalLabel): Likewise,
+ (xPositionForValue): Reimplemented,
+ (yPositionForValue): Reimplemented,
+ * javax/swing/plaf/metal/MetalSliderUI.java
+ (paintTrack): Made track one pixel longer.
+
+2006-03-29 Tom Tromey <tromey@redhat.com>
+
+ PR gcc/26901:
+ * tools/Makefile.am (JCOMPILER): Added encoding options.
+ * examples/Makefile.am (JCOMPILER): Added encoding options.
+
+2006-03-29 Gary Benson <gbenson@redhat.com>
+
+ Partial fix for PR classpath/24895
+ * java/io/FilePermission.java (implies): Canonicalize paths.
+
+2006-03-29 Robert Schuster <robertschuster@fsfe.org>
+
+ PR 26888
+ * javax/swing/text/GapContent.java:
+ (replace): Added call to resetMarksAtZero.
+
+2006-03-29 Roman Kennke <kennke@aicas.com>
+
+ PR 23527
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (cachedRect): New field.
+ (BasicMenuItemUI): Initialize cachedRect field.
+ (getPreferredMenuItemSize): Use layoutMenuItem() helper method
+ to determine layout. Store maximum accelerator and text width
+ in client properties of parent to allow correct alignment
+ of accelerators among menu items of one menu.
+ (paintMenuItem): Outsourced menu item layout into layoutMenuItem
+ method. Align accelerators according to the values calculated
+ in getPreferredMenuItemSize.
+ (getAcceleratorString) New helper method.
+ (layoutMenuItem): New helper method.
+
+2006-03-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/java/rmi/activation/ActivationSystemTransient.java: Rewritten.
+ * gnu/java/rmi/activation/BidiTable.java: Rewritten.
+ * gnu/java/rmi/dgc/LeaseRenewingTask.java (constructor, sheduleLeases):
+ Avoid NPEs.
+ * gnu/java/rmi/server/ActivatableServerRef.java (getRefClass,
+ readExternal, writeExternal): New methods.
+ * gnu/java/rmi/server/UnicastRef.java (invokeCommon): Splitten into
+ two stages, invokeCommon(Remote, ...) and
+ invokeCommen(UnicastConnection, ...).
+ * java/rmi/server/RemoteObject.java (readObject, writeObject): Expect
+ also the ActivatableRef. toString(): Documented.
+ * gnu/java/rmi/server/ActivatableRef.java,
+ tools/gnu/classpath/tools/rmi/Persistent.java,
+ tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java,
+ tools/gnu/classpath/tools/rmi/PersistentHashTable.java,
+ tools/gnu/classpath/tools/rmi/REGISTRY.java,
+ tools/gnu/classpath/tools/rmi/REGISTRY.txt,
+ tools/gnu/classpath/tools/rmi/RMID.java,
+ tools/gnu/classpath/tools/rmi/RMID.txt,
+ tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java,
+ tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java,
+ tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java,
+ tools/gnu/classpath/tools/rmi/registry/package.html,
+ tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java,
+ tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java:
+ New files.
+ * tools/README: Documented.
+ * NEWS: Added entry about the activation.
+
+2006-03-29 Roman Kennke <kennke@aicas.com>
+
+ PR 23527
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (viewRect): New field.
+ (textRect): New field.
+ (accelRect): New field.
+ (iconRect): New field.
+ (arrowIconRect): New field.
+ (checkIconRect): New field.
+ (BasicMenuItemUI): Initialize new fields.
+ (paintMenuItem): Rewritten to correctly layout and paint
+ the menu item in a more straightforward way. Use cached rectangle
+ objects for layout.
+ (paintAccelerator): Pulled inside the paintMenuItem method.
+
+2006-03-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav:
+ Do not use initCause with UnexpectedException.
+ * tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav:
+ Likewise.
+
+2006-03-29 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (setCursorID): Removed unused static variable.
+
+2006-03-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java: Reformatted.
+
+2006-03-29 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #26527
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (gtkWidgetSetCursorUnlocked): Call gdk_flush().
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/UIManager.java
+ (installLookAndFeel): Implemented.
+ (setInstalledLookAndFeels): Implemented.
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (update): Paint gradient only when the background color
+ is not a UIResource and if the button is neither armed nor
+ pressed and if the button is contentAreaFilled.
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (addImpl): Repaint added component.
+
+2006-03-28 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ * java/util/regex/Matcher.java: Reverted.
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/AsyncBoxView.java
+ (setEstimatedMajorSpan): Made method protected.
+ (getEstimatedMajorSpan): Made method protected.
+ * javax/swing/text/BoxView.java
+ (flipEastAndWestAtEnds): Fixed typo.
+ * javax/swing/text/InternationalFormatter.java
+ (getActions): Made method protected.
+ * javax/swing/text/Position.java
+ (Bias): Made class final.
+ * javax/swing/text/html/HTML.java
+ (MEDIA): Made field package private. Not specified.
+ (NOBR): Made field package private. Not specified.
+ * javax/swing/text/html/NullView.java
+ Made class package private.
+ * javax/swing/text/html/parser/Entity.java
+ Made class non-serializable as specified.
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (update): Don't paint gradient if the background color is
+ no UIResource. Removed double getModel() call. Don't check for
+ OceanTheme.
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paint): Call paintMenuItem with the selectionBackground as
+ parameter.
+ (paintBackground): Fixed the condition and color for the background
+ painting.
+
+2006-03-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ (tabsOpaque): New field.
+ (paintLeftTabBorder): Paint some parts only when the tabs are
+ opaque. Determine the tab background using the paintLeftTabBorder()
+ helper method.
+ (paintRightTabBorder): Likewise.
+ (installDefaults): Fetch tabsOpaque property from the UIDefaults.
+
2006-03-27 Tom Tromey <tromey@redhat.com>
PR classpath/25189:
@@ -93,6 +1942,86 @@
* vm/reference/java/lang/reflect/Method.java
(getTypeParameters): Check return value of getSignature for null.
+2006-03-27 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/rmi/activation/ActivationGroup_Stub.java:
+ Made final.
+
+2006-03-27 Tom Tromey <tromey@redhat.com>
+
+ * java/io/CharArrayWriter.java (append): New overloads.
+
+2006-03-27 Lillian Angel <langel@redhat.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeDispose):
+ Added check for colormap. Prevents assertion error.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeCopyState):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked):
+ Likewise.
+
+2006-03-27 Dalibor Topic <robilad@kaffe.org>
+
+ * m4/acinclude.m4 (CLASSPATH_FIND_JAVAC): Use
+ AC_MSG_ERROR instead of echoing the error message
+ that no compiler has been found manually.
+
+2006-03-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/RepaintManager.java
+ (commitBuffer): Use simple drawImage() method instead of the
+ scaling version.
+
+2006-03-27 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/PlainView.java:
+ (drawLine): Use 'endOffset' instead of 'selectionEnd'
+ for painting the selected line.
+
+2006-03-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (getThumbSize): Removed TODO and updated API docs.
+
+2006-03-27 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/DefaultCaret.java:
+ (mouseClicked): Word selection rewritten.
+ (paint): Draw line inside the bounding rectangle.
+ (damage): Retrieve caret height from line height.
+
+2006-03-28 Raif S. Naffah <raif@swiftdsl.com.au>
+
+ * tools/gnu/classpath/tools/jarsigner/Main.java (processArgs): Check
+ for null args.
+ Check for -help option.
+ * tools/gnu/classpath/tools/jarsigner/jarsigner.txt: Added -help option.
+
+2006-03-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/FieldView.java
+ (getPreferredSpan): Don't include trailing newline in
+ calculations.
+ * javax/swing/text/PlainView.java
+ (drawLine): Don't include trailing newline.
+ (determineMaxLineLength): Don't include trailing newline.
+ (getLineBuffer): Made method final.
+
+2006-03-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JSlider.java
+ (AccessibleJSlider.AccessibleJSlider): Minor API doc edit,
+ (AccessibleJSlider.getAccessibleRole): Removed declaration of
+ NotImplementedException,
+ (AccessibleJSlider.getAccessibleValue): Updated API docs.
+
2006-03-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/lang/ProcessBuilder.java:
@@ -107,6 +2036,75 @@
* java/awt/datatransfer/DataFlavor.java
Likewise.
+2006-03-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * gnu/java/security/jce/hash/HavalSpi.java,
+ * gnu/java/security/jce/hash/MD2Spi.java,
+ * gnu/java/security/jce/hash/MD4Spi.java,
+ * gnu/java/security/jce/hash/MD5Spi.java,
+ * gnu/java/security/jce/hash/MessageDigestAdapter.java,
+ * gnu/java/security/jce/hash/RipeMD128Spi.java,
+ * gnu/java/security/jce/hash/RipeMD160Spi.java,
+ * gnu/java/security/jce/hash/Sha160Spi.java,
+ * gnu/java/security/jce/hash/Sha256Spi.java,
+ * gnu/java/security/jce/hash/Sha384Spi.java,
+ * gnu/java/security/jce/hash/Sha512Spi.java,
+ * gnu/java/security/jce/hash/TigerSpi.java,
+ * gnu/java/security/jce/hash/WhirlpoolSpi.java,
+ * gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java,
+ * gnu/java/security/jce/sig/DSSRawSignatureSpi.java,
+ * gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java,
+ * gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java,
+ * gnu/java/security/jce/sig/SignatureAdapter.java,
+ * gnu/java/security/key/IKeyPairCodec.java,
+ * gnu/java/security/key/IKeyPairGenerator.java,
+ * gnu/java/security/key/KeyPairGeneratorFactory.java,
+ * gnu/java/security/key/dss/DSSKey.java,
+ * gnu/java/security/key/dss/DSSKeyPairRawCodec.java,
+ * gnu/java/security/key/dss/DSSPrivateKey.java,
+ * gnu/java/security/key/dss/DSSPublicKey.java,
+ * gnu/java/security/key/dss/FIPS186.java,
+ * gnu/java/security/key/rsa/GnuRSAKey.java,
+ * gnu/java/security/key/rsa/GnuRSAPrivateKey.java,
+ * gnu/java/security/key/rsa/GnuRSAPublicKey.java,
+ * gnu/java/security/sig/ISignature.java,
+ * gnu/java/security/sig/ISignatureCodec.java,
+ * gnu/java/security/sig/dss/DSSSignature.java,
+ * gnu/java/security/sig/dss/DSSSignatureRawCodec.java,
+ * gnu/java/security/sig/rsa/RSAPSSSignature.java,
+ * gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java,
+ * gnu/java/security/util/Util.java:
+ Remove CVS revision tags.
+
+2006-03-26 Tom Tromey <tromey@redhat.com>
+
+ * java/io/InputStream.java (InputStream): Implements Closeable.
+
+2006-03-26 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ * gnu/regexp/CharIndexed.java(setLastMatch, getLastMatch, getAnchor):
+ New methods.
+ * gnu/regexp/CharIndexedCharArray.java(setLastMatch, getLastMatch,
+ getAnchor): New methods.
+ * gnu/regexp/CharIndexedInputStream.java(setLastMatch, getLastMatch,
+ getAnchor): New methods.
+ * gnu/regexp/CharIndexedString.java(setLastMatch, getLastMatch,
+ getAnchor): New methods.
+ * gnu/regexp/CharIndexedStringBuffer.java(setLastMatch, getLastMatch,
+ getAnchor): New methods.
+ * gnu/regexp/REMatch.java(start1): New field.
+ * gnu/regexp/RE.java(initialize): Added support for \z and \G,
+ (match): set the starting position to start1[] instead of start[],
+ (getMatchImpl): Set the found REMatch to the input,
+ (makeCharIndexed): Made public.
+ * gnu/regexp/RETokenEndOfPreviousMatch.java: New file.
+ * gnu/regexp/RETokenEndSub.java(matchThis, findMatch):
+ set the value of start[] copying from start1[].
+ * gnu/regexp/RETokenLookBehind.java(matchThis): Added the settings of
+ offset.
+ * java/util/regex/Matcher.java(inputCharIndexed): New field
+ to be used as a parameter of the RE#getMatch.
+
2006-03-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/java/rmi/activation/DefaultActivationGroup.java:
@@ -1816,9 +3814,18 @@
2006-03-17 Roman Kennke <kennke@aicas.com>
- * gnu/java/rmi/activation/ActivationSystemTransient.java (debug):
- Set to false.
-
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Only install UI margin if installed margin.
+ is null or a UIResource.
+ (uninstallDefaults): Only uninstall margin if it's
+ a UIResource.
+
+ 2006-03-17 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/text/DefaultCaret.java:
+ (mouseClicked) Use setDot() and moveDot() instead of
+ JTextComponent.select().
+
2006-03-17 Robert Schuster <robertschuster@fsfe.org>
* javax/swing/text/DefaultEditorKit.java: Refactored anonymous
diff --git a/INSTALL b/INSTALL
index 7da236669..96059a50a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -130,6 +130,8 @@ gives a complete list.
--with-gjdoc generate documentation using gjdoc default=no
--with-jay Regenerate the parsers with jay must be given the
path to the jay executable
+ --with-glibj-zip=ABS.PATH
+ use prebuilt glibj.zip class library
For more flags run configure --help.
diff --git a/NEWS b/NEWS
index f75d4f2a3..1bc11e6ed 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
New in release 0.91 (UNRELEASED)
+* Experimental activation (java.rmi.activation) support, including RMI
+ activation daemon and persistent naming service tools.
* Experimental printing support: The API implementation of the javax.print
packages has been finished and work on the printing provider implementation
started. Currently supported features from the Java Print Service API are
@@ -23,6 +25,12 @@ Runtime interface changes:
array creation method from java.lang.reflect.Array.
* A new class, gnu.classpath.Unsafe, is provided for handling the
new low-level operations required by java.util.concurrent.
+* The reference implementations of Method, Constructor, and Field
+ now have a new native getModifiersInternal() method. The public
+ getModifiers() method in each case has been rewritten in terms of
+ this method.
+* The reference implementation of VMThread has been updated to handle
+ the new Thread.UncaughtExceptionHandler support.
New in release 0.90 (March 6, 2006)
diff --git a/configure.ac b/configure.ac
index 46fd996f4..1731b9955 100644
--- a/configure.ac
+++ b/configure.ac
@@ -293,7 +293,7 @@ if test "x${COMPILE_JNI}" = xyes; then
strerror_r \
fcntl \
mmap munmap mincore msync madvise getpagesize sysconf \
- isnan])
+ ])
AC_HEADER_TIME
AC_STRUCT_TM
@@ -584,6 +584,33 @@ AC_ARG_ENABLE([portable-native-sync],
AX_CREATE_STDINT_H([include/config-int.h])
+dnl -----------------------------------------------------------------------
+dnl Support for using a prebuilt class library
+dnl -----------------------------------------------------------------------
+AC_ARG_WITH([glibj_zip],
+ AS_HELP_STRING([--with-glibj-zip=ABS.PATH],
+ [use prebuilt glibj.zip class library]))
+
+case "$with_glibj_zip" in
+"")
+ use_glibj_zip=false
+ ;;
+"no" )
+ use_glibj_zip=false
+ ;;
+"yes")
+ AC_MSG_ERROR([Please suply an absolute path to a prebuilt glibj.zip])
+ ;;
+*)
+ use_glibj_zip=true
+ PATH_TO_GLIBJ_ZIP=$with_glibj_zip
+ ;;
+esac;
+
+AM_CONDITIONAL(USE_PREBUILT_GLIBJ_ZIP, test x$use_glibj_zip = xtrue)
+AC_SUBST(PATH_TO_GLIBJ_ZIP)
+
+
dnl -----------------------------------------------------------
dnl output files
dnl -----------------------------------------------------------
@@ -621,6 +648,7 @@ lib/Makefile
lib/gen-classlist.sh
lib/copy-vmresources.sh
tools/Makefile
+tools/jarsigner.sh
examples/Makefile
examples/Makefile.jawt])
AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 08bfdb4b6..774abd021 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,4 +1,5 @@
## Input file for automake to generate the Makefile.in used by configure
+GLIBJ_CLASSPATH='$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip'
# Setup the compiler to use the GNU Classpath library we just build
#if FOUND_GCJ
@@ -8,10 +9,10 @@
#JCOMPILER = $(JIKES) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_builddir)/lib:.
#else
if FOUND_GCJX
-JCOMPILER = $(GCJX) -bootclasspath '' -sourcepath '' -classpath $(top_builddir)/lib:.
+JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
else
if FOUND_ECJ
-JCOMPILER = $(ECJ) -1.5 -bootclasspath '$(top_builddir)/lib' -classpath .
+JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
else
error dunno how to setup the JCOMPILER and compile
endif
diff --git a/examples/gnu/classpath/examples/swing/Demo.java b/examples/gnu/classpath/examples/swing/Demo.java
index ba1c7fa3d..3a47e0609 100644
--- a/examples/gnu/classpath/examples/swing/Demo.java
+++ b/examples/gnu/classpath/examples/swing/Demo.java
@@ -33,6 +33,7 @@ import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.MetalTheme;
import javax.swing.plaf.metal.OceanTheme;
+import java.lang.reflect.Method;
import java.net.URL;
public class Demo
@@ -166,7 +167,8 @@ public class Demo
+ " Version "
+ System.getProperty("java.vm.version")
+ " distributed by "
- + System.getProperty("java.vm.vendor");
+ + System.getProperty("java.vm.vendor")
+ + ".";
String gnuClasspath = System.getProperty("gnu.classpath.version");
if(gnuClasspath != null)
@@ -197,17 +199,39 @@ public class Demo
// Create themes menu.
themesMenu = new JMenu("Themes");
ButtonGroup themesGroup = new ButtonGroup();
- JRadioButtonMenuItem ocean =
- new JRadioButtonMenuItem(new ChangeThemeAction(new OceanTheme()));
- ocean.setSelected(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme);
- themesMenu.add(ocean);
- themesGroup.add(ocean);
- JRadioButtonMenuItem steel =
- new JRadioButtonMenuItem(new ChangeThemeAction(new DefaultMetalTheme()));
- ocean.setSelected(MetalLookAndFeel.getCurrentTheme()
- instanceof DefaultMetalTheme);
- themesMenu.add(steel);
- themesGroup.add(steel);
+
+ // In order to make the demo runable on a 1.4 type VM we have to avoid calling
+ // MetalLookAndFeel.getCurrentTheme(). We simply check whether this method exists
+ // and is public.
+ Method m = null;
+ try
+ {
+ m = MetalLookAndFeel.class.getMethod("getCurrentTheme", null);
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ // Ignore it.
+ }
+
+ if (m != null)
+ {
+ JRadioButtonMenuItem ocean =
+ new JRadioButtonMenuItem(new ChangeThemeAction(new OceanTheme()));
+ ocean.setSelected(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme);
+ themesMenu.add(ocean);
+ themesGroup.add(ocean);
+
+ JRadioButtonMenuItem steel =
+ new JRadioButtonMenuItem(new ChangeThemeAction(new DefaultMetalTheme()));
+ ocean.setSelected(MetalLookAndFeel.getCurrentTheme()
+ instanceof DefaultMetalTheme);
+ themesMenu.add(steel);
+ themesGroup.add(steel);
+ }
+ else
+ {
+ themesMenu.setEnabled(false);
+ }
bar.add(file);
bar.add(edit);
@@ -334,7 +358,10 @@ public class Demo
JPanel main = new JPanel();
main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
desktop = createDesktop();
- main.add(desktop);
+
+ // Put the desktop in a scrollpane. The scrollbars may show then
+ // up when the them or LaF is changed.
+ main.add(new JScrollPane(desktop));
main.add(mkButtonBar());
component.add(main, BorderLayout.CENTER);
frame.pack();
diff --git a/examples/gnu/classpath/examples/swing/TextAreaDemo.java b/examples/gnu/classpath/examples/swing/TextAreaDemo.java
index 6efad8477..b72997cb3 100644
--- a/examples/gnu/classpath/examples/swing/TextAreaDemo.java
+++ b/examples/gnu/classpath/examples/swing/TextAreaDemo.java
@@ -1,5 +1,5 @@
/* TextAreaDemo.java -- An example showing various textareas in Swing.
- Copyright (C) 2005, 2006, Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
@@ -426,7 +426,7 @@ public class TextAreaDemo
innerPanel.add(new JScrollPane(textarea10));
textarea11 = new JTextArea("custom background", 10, 15);
- textarea11.setForeground(Color.YELLOW);
+ textarea11.setBackground(Color.YELLOW);
innerPanel.add(new JScrollPane(textarea11));
textarea12 = new JTextArea("custom disabled textcolor", 10, 15);
@@ -438,7 +438,7 @@ public class TextAreaDemo
innerPanel.add(new JScrollPane(textarea13));
textarea14 = new JTextArea("custom selection color", 10, 15);
- textarea14.setSelectionColor(Color.CYAN);
+ textarea14.setSelectionColor(Color.RED);
innerPanel.add(new JScrollPane(textarea14));
textarea14b = new JTextArea("custom selection and selected text color", 10, 15);
diff --git a/examples/gnu/classpath/examples/swing/TextFieldDemo.java b/examples/gnu/classpath/examples/swing/TextFieldDemo.java
index 6e5239fc8..ba0fefa31 100644
--- a/examples/gnu/classpath/examples/swing/TextFieldDemo.java
+++ b/examples/gnu/classpath/examples/swing/TextFieldDemo.java
@@ -1,5 +1,5 @@
/* TextFieldDemo.java -- An example showing various textfields in Swing.
- Copyright (C) 2005, 2006, Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath examples.
@@ -27,7 +27,9 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
+import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -39,11 +41,19 @@ import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
+import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.TitledBorder;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultCaret;
+import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
+import javax.swing.text.View;
+import javax.swing.text.LayeredHighlighter.LayerPainter;
/**
* A simple textfield demo showing various textfields in different states.
@@ -108,52 +118,88 @@ public class TextFieldDemo
}
}
}
+
+ static class DemoHighlightPainter
+ extends LayerPainter
+ {
+
+ static DemoHighlightPainter INSTANCE = new DemoHighlightPainter();
+
+
+ static Color[] colors = { Color.BLUE, Color.CYAN, Color.GRAY, Color.GREEN,
+ Color.MAGENTA, Color.ORANGE, Color.PINK,
+ Color.ORANGE, Color.RED, Color.BLUE, Color.YELLOW };
+
+
+ public DemoHighlightPainter()
+ {
+ super();
+ }
+
+ private void paintHighlight(Graphics g, Rectangle rect)
+ {
+ g.fillRect(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent t)
+ {
+ try
+ {
+
+ for (int i = p0; i < p1; i++)
+ {
+ Rectangle r = t.modelToView(i);
+ Point l1 = t.modelToView(i + 1).getLocation();
+
+ g.setColor(colors[(int) (Math.random() * colors.length)]);
+ g.fillOval(r.x, r.y, l1.x - r.x, r.height);
+ }
+ }
+ catch (BadLocationException ble)
+ {
+ }
+ }
+
+ public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds,
+ JTextComponent c, View view)
+ {
+ paint(g, p0, p1, bounds, c);
+
+ return bounds;
+ }
+
+ }
/**
* The left aligned textfields and state buttons.
*/
- JTextField textfield1;
- JTextField textfield2;
- JTextField textfield3;
- JCheckBox enabled1;
- JCheckBox editable1;
- JPanel textFieldPanel1;
+ Compound compound1;
+
/**
* The right aligned textfields and state buttons.
*/
- JTextField textfield4;
- JTextField textfield5;
- JTextField textfield6;
- JCheckBox enabled2;
- JCheckBox editable2;
+ Compound compound2;
/**
* The centered textfields and state buttons.
*/
- JTextField textfield7;
- JTextField textfield8;
- JTextField textfield9;
- JCheckBox enabled3;
- JCheckBox editable3;
+ Compound compound3;
/**
* The custom colored textfields and state buttons.
*/
- JTextField textfield10;
- JTextField textfield11;
- JTextField textfield12;
- JTextField textfield13;
- JTextField textfield14;
- JCheckBox enabled4;
- JCheckBox editable4;
+ Compound compound4;
+ Compound compound5;
/**
- * Some miscallenous textfield demos.
+ * Some miscellaneous textfield demos.
*/
- JTextField textfield15;
- JTextField textfield16;
- JCheckBox enabled5;
- JCheckBox editable5;
+ Compound compound6;
+
+ /**
+ * Some textfields with custom borders.
+ */
+ Compound compound7;
/**
* Creates a new demo instance.
@@ -191,231 +237,182 @@ public class TextFieldDemo
private void createContent()
{
setLayout(new BorderLayout());
- JPanel panel = new JPanel(new GridLayout(5, 1));
+ JPanel panel = new JPanel(new GridLayout(7, 1));
panel.add(createLeftAlignedPanel());
panel.add(createRightAlignedPanel());
panel.add(createCenteredPanel());
- panel.add(createCustomColoredPanel());
+ panel.add(createCustomColorPanel1());
+ panel.add(createCustomColorPanel2());
+ panel.add(createCustomBordersPanel());
panel.add(createMiscPanel());
- add(panel);
+
+ // Put everything in a scroll pane to make it neccessary
+ // to reach the bottom inner panels if the screen is to small.
+ add(new JScrollPane(panel));
}
private JPanel createLeftAlignedPanel()
{
- JPanel panel = new JPanel(new BorderLayout());
- panel.setBorder(BorderFactory.createTitledBorder("Left aligned"));
+ compound1 = createTextFieldCompound("Left aligned", 1);
+
+ compound1.setupTextfields("Hello World!",
+ JTextField.LEFT,
+ new Font[] { new Font("Dialog", Font.PLAIN, 8),
+ new Font("Dialog", Font.ITALIC, 12),
+ new Font("Dialog", Font.BOLD, 14)
+ });
- textFieldPanel1 = new JPanel();
- textFieldPanel1.setLayout(new BoxLayout(textFieldPanel1, BoxLayout.X_AXIS));
-
- textfield1 = new JTextField("Hello World!");
- textfield1.setHorizontalAlignment(JTextField.LEFT);
- textfield1.setFont(new Font("Dialog", Font.PLAIN, 8));
- textFieldPanel1.add(textfield1);
-
- textfield2 = new JTextField("Hello World!");
- textfield2.setHorizontalAlignment(JTextField.LEFT);
- textfield2.setFont(new Font("Dialog", Font.ITALIC, 12));
- textFieldPanel1.add(textfield2);
-
- textfield3 = new JTextField("Hello World!");
- textfield3.setHorizontalAlignment(JTextField.LEFT);
- textfield3.setFont(new Font("Dialog", Font.BOLD, 14));
- textFieldPanel1.add(textfield3);
+ return compound1.panel;
+ }
+
+ private Compound createTextFieldCompound(String title, int actionCommandNo)
+ {
+ Compound compound = new Compound();
+ compound.panel = new JPanel(new BorderLayout());
+ compound.panel.setBorder(BorderFactory.createTitledBorder(title));
+
+ compound.textFieldPanel = new JPanel();
+ compound.textFieldPanel.setLayout(new BoxLayout(compound.textFieldPanel, BoxLayout.X_AXIS));
- panel.add(textFieldPanel1);
+ compound.panel.add(compound.textFieldPanel);
JPanel statePanel = new JPanel();
statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
statePanel.add(Box.createVerticalGlue());
- enabled1 = new JCheckBox("enabled");
- enabled1.setSelected(true);
- enabled1.addActionListener(this);
- enabled1.setActionCommand("ENABLED1");
- statePanel.add(enabled1);
- editable1 = new JCheckBox("editable");
- editable1.setSelected(true);
- editable1.addActionListener(this);
- editable1.setActionCommand("EDITABLE1");
- statePanel.add(editable1);
+ compound.enabled = new JCheckBox("enabled");
+ compound.enabled.setSelected(true);
+ compound.enabled.addActionListener(this);
+ compound.enabled.setActionCommand("ENABLED" + actionCommandNo);
+ statePanel.add(compound.enabled);
+ compound.editable = new JCheckBox("editable");
+ compound.editable.setSelected(true);
+ compound.editable.addActionListener(this);
+ compound.editable.setActionCommand("EDITABLE" + actionCommandNo);
+ statePanel.add(compound.editable);
statePanel.add(Box.createVerticalGlue());
- panel.add(statePanel, BorderLayout.EAST);
+ compound.panel.add(statePanel, BorderLayout.EAST);
- return panel;
+ return compound;
}
private JPanel createRightAlignedPanel()
{
- JPanel panel = new JPanel(new BorderLayout());
- panel.setBorder(BorderFactory.createTitledBorder("Right aligned"));
+ compound2 = createTextFieldCompound("Right aligned", 2);
+
+ compound2.setupTextfields("Hello World!",
+ JTextField.RIGHT,
+ new Font[] { new Font("Dialog", Font.PLAIN, 8),
+ new Font("Dialog", Font.ITALIC, 12),
+ new Font("Dialog", Font.BOLD, 14)
+ });
- JPanel textFieldPanel = new JPanel();
- textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
-
- textfield4 = new JTextField("Hello World!");
- textfield4.setHorizontalAlignment(JTextField.RIGHT);
- textfield4.setFont(new Font("Dialog", Font.PLAIN, 8));
- textFieldPanel.add(textfield4);
-
- textfield5 = new JTextField("Hello World!");
- textfield5.setHorizontalAlignment(JTextField.RIGHT);
- textfield5.setFont(new Font("Dialog", Font.ITALIC, 12));
- textFieldPanel.add(textfield5);
-
- textfield6 = new JTextField("Hello World!");
- textfield6.setHorizontalAlignment(JTextField.RIGHT);
- textfield6.setFont(new Font("Dialog", Font.BOLD, 14));
- textFieldPanel.add(textfield6);
-
- panel.add(textFieldPanel);
-
- JPanel statePanel = new JPanel();
- statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
- statePanel.add(Box.createVerticalGlue());
- enabled2 = new JCheckBox("enabled");
- enabled2.setSelected(true);
- enabled2.addActionListener(this);
- enabled2.setActionCommand("ENABLED2");
- statePanel.add(enabled2);
- editable2 = new JCheckBox("editable");
- editable2.setSelected(true);
- editable2.addActionListener(this);
- editable2.setActionCommand("EDITABLE2");
- statePanel.add(editable2);
- statePanel.add(Box.createVerticalGlue());
- panel.add(statePanel, BorderLayout.EAST);
-
- return panel;
+ return compound2.panel;
}
private JPanel createCenteredPanel()
{
- JPanel panel = new JPanel(new BorderLayout());
- panel.setBorder(BorderFactory.createTitledBorder("Centered"));
-
- JPanel textFieldPanel = new JPanel();
- textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
-
- textfield7 = new JTextField("Hello World!");
- textfield7.setHorizontalAlignment(JTextField.CENTER);
- textfield7.setFont(new Font("Dialog", Font.PLAIN, 8));
- textFieldPanel.add(textfield7);
-
- textfield8 = new JTextField("Hello World!");
- textfield8.setHorizontalAlignment(JTextField.CENTER);
- textfield8.setFont(new Font("Dialog", Font.ITALIC, 12));
- textFieldPanel.add(textfield8);
-
- textfield9 = new JTextField("Hello World!");
- textfield9.setHorizontalAlignment(JTextField.CENTER);
- textfield9.setFont(new Font("Dialog", Font.BOLD, 14));
- textFieldPanel.add(textfield9);
-
- panel.add(textFieldPanel);
-
- JPanel statePanel = new JPanel();
- statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
- statePanel.add(Box.createVerticalGlue());
- enabled3 = new JCheckBox("enabled");
- enabled3.setSelected(true);
- enabled3.addActionListener(this);
- enabled3.setActionCommand("ENABLED3");
- statePanel.add(enabled3);
- editable3 = new JCheckBox("editable");
- editable3.setSelected(true);
- editable3.addActionListener(this);
- editable3.setActionCommand("EDITABLE3");
- statePanel.add(editable3);
- statePanel.add(Box.createVerticalGlue());
- panel.add(statePanel, BorderLayout.EAST);
-
- return panel;
+ compound3 = createTextFieldCompound("Centered", 3);
+
+ compound3.setupTextfields("Hello World!",
+ JTextField.CENTER,
+ new Font[] { new Font("Dialog", Font.PLAIN, 8),
+ new Font("Dialog", Font.ITALIC, 12),
+ new Font("Dialog", Font.BOLD, 14)
+ });
+
+ return compound3.panel;
}
- private JPanel createCustomColoredPanel()
+ private JPanel createCustomColorPanel1()
{
- JPanel panel = new JPanel(new BorderLayout());
-
- JPanel textFieldPanel = new JPanel();
- panel.setBorder(BorderFactory.createTitledBorder("Custom colors"));
- textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
-
- textfield10 = new JTextField("custom foreground");
- textfield10.setForeground(Color.GREEN);
- textFieldPanel.add(textfield10);
+ compound4 = createTextFieldCompound("Custom colors I", 4);
- textfield11 = new JTextField("custom background");
- textfield11.setForeground(Color.YELLOW);
- textFieldPanel.add(textfield11);
+ compound4.textfield1 = new JTextField("custom foreground");
+ compound4.textfield1.setForeground(Color.RED);
+ compound4.textFieldPanel.add(compound4.textfield1);
- textfield12 = new JTextField("custom disabled textcolor");
- textfield12.setDisabledTextColor(Color.BLUE);
- textFieldPanel.add(textfield12);
+ compound4.textfield2 = new JTextField("custom background");
+ compound4.textfield2.setBackground(Color.YELLOW);
+ compound4.textFieldPanel.add(compound4.textfield2);
- textfield13 = new JTextField("custom selected text color");
- textfield13.setSelectedTextColor(Color.RED);
- textFieldPanel.add(textfield13);
-
- textfield14 = new JTextField("custom selection color");
- textfield14.setSelectionColor(Color.CYAN);
- textFieldPanel.add(textfield14);
+ compound4.textfield3 = new JTextField("custom foreground and background");
+ compound4.textfield3.setForeground(Color.RED);
+ compound4.textfield3.setBackground(Color.YELLOW);
+ compound4.textFieldPanel.add(compound4.textfield3);
+
+ return compound4.panel;
+
+ }
+
+ private JPanel createCustomColorPanel2()
+ {
+ compound5 = createTextFieldCompound("Custom colors II", 5);
- panel.add(textFieldPanel);
+ compound5.textfield1 = new JTextField("custom disabled textcolor");
+ compound5.textfield1.setDisabledTextColor(Color.BLUE);
+ compound5.textFieldPanel.add(compound5.textfield1);
- JPanel statePanel = new JPanel();
- statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
- statePanel.add(Box.createVerticalGlue());
- enabled4 = new JCheckBox("enabled");
- enabled4.setSelected(true);
- enabled4.addActionListener(this);
- enabled4.setActionCommand("ENABLED4");
- statePanel.add(enabled4);
- editable4 = new JCheckBox("editable");
- editable4.setSelected(true);
- editable4.addActionListener(this);
- editable4.setActionCommand("EDITABLE4");
- statePanel.add(editable4);
- statePanel.add(Box.createVerticalGlue());
- panel.add(statePanel, BorderLayout.EAST);
+ compound5.textfield2 = new JTextField("custom selected text color");
+ compound5.textfield2.setSelectedTextColor(Color.RED);
+ compound5.textFieldPanel.add(compound5.textfield2);
- return panel;
+ compound5.textfield3 = new JTextField("custom selection color");
+ compound5.textfield3.setSelectionColor(Color.BLACK);
+ compound5.textFieldPanel.add(compound5.textfield3);
+
+ return compound5.panel;
+
}
private JPanel createMiscPanel()
{
- JPanel panel = new JPanel(new BorderLayout());
- panel.setBorder(BorderFactory.createTitledBorder("Miscallenous"));
-
- JPanel textFieldPanel = new JPanel();
- textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
+ compound6 = createTextFieldCompound("Miscellaneous", 6);
+
+ compound6.textfield1 = new JTextField("Custom Caret");
+ compound6.textfield1.setCaret(new CornerCaret());
+ compound6.textFieldPanel.add(compound6.textfield1);
+
+ compound6.textfield2 = new JTextField("Custom Caret color");
+ compound6.textfield2.setForeground(Color.LIGHT_GRAY);
+ compound6.textfield2.setBackground(Color.BLACK);
+ compound6.textfield2.setSelectedTextColor(Color.BLACK);
+ compound6.textfield2.setCaretColor(Color.WHITE);
+ compound6.textfield2.setSelectionColor(Color.DARK_GRAY);
+ compound6.textFieldPanel.add(compound6.textfield2);
+
+ compound6.textfield3 = new JTextField("Custom highlighter");
+ compound6.textfield3.setCaret(new DefaultCaret()
+ {
+ public Highlighter.HighlightPainter getSelectionPainter()
+ {
+ return DemoHighlightPainter.INSTANCE;
+ }
+ });
+ compound6.textFieldPanel.add(compound6.textfield3);
- textfield15 = new JTextField("Custom Caret");
- textfield15.setCaret(new CornerCaret());
- textFieldPanel.add(textfield15);
+ return compound6.panel;
+ }
+
+ private JPanel createCustomBordersPanel()
+ {
+ compound7 = createTextFieldCompound("Custom borders", 7);
- textfield16 = new JTextField("Custom Caret color");
- textfield16.setCaretColor(Color.MAGENTA);
- textFieldPanel.add(textfield16);
+ compound7.textfield1 = new JTextField("red 5 pixel lineborder");
+ compound7.textfield1.setBorder(new LineBorder(Color.RED, 5));
+ compound7.textFieldPanel.add(compound7.textfield1);
- panel.add(textFieldPanel);
+ compound7.textfield2 = new JTextField("complex irregular border");
- JPanel statePanel = new JPanel();
- statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
- statePanel.add(Box.createVerticalGlue());
- enabled5 = new JCheckBox("enabled");
- enabled5.setSelected(true);
- enabled5.addActionListener(this);
- enabled5.setActionCommand("ENABLED5");
- statePanel.add(enabled5);
- editable5 = new JCheckBox("editable");
- editable5.setSelected(true);
- editable5.addActionListener(this);
- editable5.setActionCommand("EDITABLE5");
- statePanel.add(editable5);
- statePanel.add(Box.createVerticalGlue());
- panel.add(statePanel, BorderLayout.EAST);
+ CompoundBorder innerCompound = new CompoundBorder(new EmptyBorder(5, 40, 15, 10), new LineBorder(Color.BLACK));
+ CompoundBorder outerCompound = new CompoundBorder(new LineBorder(Color.BLACK), innerCompound);
+ compound7.textfield2.setBorder(outerCompound);
+ compound7.textFieldPanel.add(compound7.textfield2);
- return panel;
+ compound7.textfield3 = new JTextField("a titled border", 10);
+ compound7.textfield3.setBorder(new TitledBorder(null, "Freak Out Border", TitledBorder.CENTER, TitledBorder.LEFT));
+ compound7.textFieldPanel.add(compound7.textfield3);
+
+ return compound7.panel;
}
public void actionPerformed(ActionEvent e)
@@ -426,63 +423,101 @@ public class TextFieldDemo
}
else if (e.getActionCommand().equals("ENABLED1"))
{
- boolean enabled = enabled1.isSelected();
- textfield1.setEnabled(enabled);
- textfield2.setEnabled(enabled);
- textfield3.setEnabled(enabled);
+ boolean enabled = compound1.enabled.isSelected();
+ compound1.textfield1.setEnabled(enabled);
+ compound1.textfield2.setEnabled(enabled);
+ compound1.textfield3.setEnabled(enabled);
}
else if (e.getActionCommand().equals("EDITABLE1"))
{
- boolean editable = editable1.isSelected();
- textfield1.setEditable(editable);
- textfield2.setEditable(editable);
- textfield3.setEditable(editable);
+ boolean editable = compound1.editable.isSelected();
+ compound1.textfield1.setEditable(editable);
+ compound1.textfield2.setEditable(editable);
+ compound1.textfield3.setEditable(editable);
}
else if (e.getActionCommand().equals("ENABLED2"))
{
- boolean enabled = enabled2.isSelected();
- textfield4.setEnabled(enabled);
- textfield5.setEnabled(enabled);
- textfield6.setEnabled(enabled);
+ boolean enabled = compound2.enabled.isSelected();
+ compound2.textfield1.setEnabled(enabled);
+ compound2.textfield2.setEnabled(enabled);
+ compound2.textfield3.setEnabled(enabled);
}
else if (e.getActionCommand().equals("EDITABLE2"))
{
- boolean editable = editable2.isSelected();
- textfield4.setEditable(editable);
- textfield5.setEditable(editable);
- textfield6.setEditable(editable);
+ boolean editable = compound2.editable.isSelected();
+ compound2.textfield1.setEditable(editable);
+ compound2.textfield2.setEditable(editable);
+ compound2.textfield3.setEditable(editable);
}
else if (e.getActionCommand().equals("ENABLED3"))
{
- boolean enabled = enabled3.isSelected();
- textfield7.setEnabled(enabled);
- textfield8.setEnabled(enabled);
- textfield9.setEnabled(enabled);
+ boolean enabled = compound3.enabled.isSelected();
+ compound3.textfield1.setEnabled(enabled);
+ compound3.textfield2.setEnabled(enabled);
+ compound3.textfield3.setEnabled(enabled);
}
else if (e.getActionCommand().equals("EDITABLE3"))
{
- boolean editable = editable3.isSelected();
- textfield7.setEditable(editable);
- textfield8.setEditable(editable);
- textfield9.setEditable(editable);
+ boolean editable = compound3.editable.isSelected();
+ compound3.textfield1.setEditable(editable);
+ compound3.textfield2.setEditable(editable);
+ compound3.textfield3.setEditable(editable);
}
else if (e.getActionCommand().equals("ENABLED4"))
{
- boolean enabled = enabled4.isSelected();
- textfield10.setEnabled(enabled);
- textfield11.setEnabled(enabled);
- textfield12.setEnabled(enabled);
- textfield13.setEnabled(enabled);
- textfield14.setEnabled(enabled);
+ boolean enabled = compound4.enabled.isSelected();
+ compound4.textfield1.setEnabled(enabled);
+ compound4.textfield2.setEnabled(enabled);
+ compound4.textfield3.setEnabled(enabled);
}
else if (e.getActionCommand().equals("EDITABLE4"))
{
- boolean editable = editable4.isSelected();
- textfield10.setEditable(editable);
- textfield11.setEditable(editable);
- textfield12.setEditable(editable);
- textfield13.setEditable(editable);
- textfield14.setEditable(editable);
+ boolean editable = compound4.editable.isSelected();
+ compound4.textfield1.setEditable(editable);
+ compound4.textfield2.setEditable(editable);
+ compound4.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED5"))
+ {
+ boolean enabled = compound5.enabled.isSelected();
+ compound5.textfield1.setEnabled(enabled);
+ compound5.textfield2.setEnabled(enabled);
+ compound5.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE5"))
+ {
+ boolean editable = compound5.editable.isSelected();
+ compound5.textfield1.setEditable(editable);
+ compound5.textfield2.setEditable(editable);
+ compound5.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED6"))
+ {
+ boolean enabled = compound6.enabled.isSelected();
+ compound6.textfield1.setEnabled(enabled);
+ compound6.textfield2.setEnabled(enabled);
+ compound6.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE6"))
+ {
+ boolean editable = compound6.editable.isSelected();
+ compound6.textfield1.setEditable(editable);
+ compound6.textfield2.setEditable(editable);
+ compound6.textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED7"))
+ {
+ boolean enabled = compound7.enabled.isSelected();
+ compound7.textfield1.setEnabled(enabled);
+ compound7.textfield2.setEnabled(enabled);
+ compound7.textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE7"))
+ {
+ boolean editable = compound7.editable.isSelected();
+ compound7.textfield1.setEditable(editable);
+ compound7.textfield2.setEditable(editable);
+ compound7.textfield3.setEditable(editable);
}
}
@@ -519,4 +554,41 @@ public class TextFieldDemo
};
}
+ static class Compound
+ {
+ JTextField textfield1;
+ JTextField textfield2;
+ JTextField textfield3;
+ JCheckBox enabled;
+ JCheckBox editable;
+ JPanel textFieldPanel;
+ JPanel panel;
+
+ /** Creates and initializes the textfields with the same text and
+ * alignment but with a different font.
+ *
+ * @param title The text for the textfields.
+ * @param align The alignment for the textfields.
+ * @param fonts The fonts to be used for the textfields.
+ */
+ void setupTextfields(String title, int align, Font[] fonts)
+ {
+ textfield1 = new JTextField(title);
+ textfield1.setHorizontalAlignment(align);
+ textfield1.setFont(fonts[0]);
+ textFieldPanel.add(textfield1);
+
+ textfield2 = new JTextField(title);
+ textfield2.setHorizontalAlignment(align);
+ textfield2.setFont(fonts[1]);
+ textFieldPanel.add(textfield2);
+
+ textfield3 = new JTextField(title);
+ textfield3.setHorizontalAlignment(align);
+ textfield3.setFont(fonts[2]);
+ textFieldPanel.add(textfield3);
+ }
+
+ }
+
}
diff --git a/gnu/CORBA/CDR/EncapsulationStream.java b/gnu/CORBA/CDR/EncapsulationStream.java
index 4945d9c90..e42991232 100644
--- a/gnu/CORBA/CDR/EncapsulationStream.java
+++ b/gnu/CORBA/CDR/EncapsulationStream.java
@@ -79,6 +79,7 @@ public class EncapsulationStream
boolean use_big_endian)
{
super();
+ setBigEndian(use_big_endian);
buffer = new AligningOutput();
setOutputStream(buffer);
parent = _parent;
diff --git a/gnu/CORBA/GIOP/MessageHeader.java b/gnu/CORBA/GIOP/MessageHeader.java
index e1bdb512b..025283858 100644
--- a/gnu/CORBA/GIOP/MessageHeader.java
+++ b/gnu/CORBA/GIOP/MessageHeader.java
@@ -51,6 +51,7 @@ import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.IDLEntity;
import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -273,20 +274,36 @@ public class MessageHeader
* Read the header from the stream.
*
* @param istream a stream to read from.
- *
* @throws MARSHAL if this is not a GIOP 1.0 header.
*/
- public void read(java.io.InputStream istream)
- throws MARSHAL
+ public void read(java.io.InputStream istream)
+ throws MARSHAL, EOFException
{
try
{
byte[] xMagic = new byte[MAGIC.length];
- istream.read(xMagic);
- if (!Arrays.equals(xMagic, MAGIC))
+ int r = istream.read(xMagic);
+ int minor;
+ if (! Arrays.equals(xMagic, MAGIC))
{
- MARSHAL m = new MARSHAL("Not a GIOP message");
- m.minor = Minor.Giop;
+ StringBuffer b = new StringBuffer();
+ if (r == - 1)
+ {
+ b.append("Immediate EOF");
+ minor = Minor.EOF;
+ }
+ else
+ {
+ minor = Minor.Giop;
+ b.append(r + " bytes: ");
+ for (int i = 0; i < xMagic.length; i++)
+ {
+ b.append(Integer.toHexString(xMagic[i] & 0xFF));
+ b.append(' ');
+ }
+ }
+ MARSHAL m = new MARSHAL("Not a GIOP message: " + b);
+ m.minor = minor;
throw m;
}
@@ -354,7 +371,7 @@ public class MessageHeader
}
catch (IOException ex)
{
- MARSHAL t = new MARSHAL();
+ MARSHAL t = new MARSHAL(ex.getMessage());
t.minor = Minor.Header;
t.initCause(ex);
throw t;
diff --git a/gnu/CORBA/IorDelegate.java b/gnu/CORBA/IorDelegate.java
index 27fb5de9a..8eb43aa7d 100644
--- a/gnu/CORBA/IorDelegate.java
+++ b/gnu/CORBA/IorDelegate.java
@@ -407,20 +407,7 @@ public class IorDelegate extends SimpleDelegate
*/
public void release(org.omg.CORBA.Object target)
{
- String key = ior.Internet.host + ":" + ior.Internet.port;
-
- Socket socket = SocketRepository.get_socket(key);
- try
- {
- if (socket != null)
- {
- socket.close();
- }
- }
- catch (IOException ex)
- {
- // do nothing, then.
- }
+ // Do nothing here.
}
/**
diff --git a/gnu/CORBA/NamingService/NameParser.java b/gnu/CORBA/NamingService/NameParser.java
index 422db1c58..c750b2eb4 100644
--- a/gnu/CORBA/NamingService/NameParser.java
+++ b/gnu/CORBA/NamingService/NameParser.java
@@ -1,5 +1,5 @@
/* NameParser.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -425,7 +425,8 @@ public class NameParser
else
{
Delegate delegate = ((ObjectImpl) object)._get_delegate();
- ns = new _NamingContextStub(delegate);
+ ns = new _NamingContextStub();
+ ((_NamingContextStub) ns)._set_delegate(delegate);
}
}
catch (Exception ex)
diff --git a/gnu/CORBA/OrbRestricted.java b/gnu/CORBA/OrbRestricted.java
index c0401800a..c34584995 100644
--- a/gnu/CORBA/OrbRestricted.java
+++ b/gnu/CORBA/OrbRestricted.java
@@ -41,11 +41,13 @@ package gnu.CORBA;
import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.typecodes.AliasTypeCode;
import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import gnu.CORBA.typecodes.RecordTypeCode;
import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
import org.omg.CORBA.Environment;
import org.omg.CORBA.ExceptionList;
@@ -526,4 +528,57 @@ public class OrbRestricted extends org.omg.CORBA_2_3.ORB
super.destroy();
}
+
+ /**
+ * Create a typecode, representing a tree-like structure.
+ * This structure contains a member that is a sequence of the same type,
+ * as the structure itself. You can imagine as if the folder definition
+ * contains a variable-length array of the enclosed (nested) folder
+ * definitions. In this way, it is possible to have a tree like
+ * structure that can be transferred via CORBA CDR stream.
+ *
+ * @deprecated It is easier and clearler to use a combination of
+ * create_recursive_tc and create_sequence_tc instead.
+ *
+ * @param bound the maximal expected number of the nested components
+ * on each node; 0 if not limited.
+ *
+ * @param offset the position of the field in the returned structure
+ * that contains the sequence of the structures of the same field.
+ * The members before this field are intialised using parameterless
+ * StructMember constructor.
+ *
+ * @return a typecode, defining a stucture, where a member at the
+ * <code>offset</code> position defines an array of the identical
+ * structures.
+ *
+ * @see #create_recursive_tc(String)
+ * @see #create_sequence_tc(int, TypeCode)
+ */
+ public TypeCode create_recursive_sequence_tc(int bound, int offset)
+ {
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
+ for (int i = 0; i < offset; i++)
+ r.add(new StructMember());
+
+ TypeCode recurs = new PrimitiveTypeCode(TCKind.tk_sequence);
+
+ r.add(new StructMember("", recurs, null));
+ return r;
+ }
+
+ /**
+ * Get the default context of this ORB. This is an initial root of all
+ * contexts.
+ *
+ * The default method returns a new context with the empty name and
+ * no parent context.
+ *
+ * @return the default context of this ORB.
+ */
+ public Context get_default_context()
+ {
+ return new gnuContext("", null);
+ }
+
} \ No newline at end of file
diff --git a/gnu/CORBA/SocketRepository.java b/gnu/CORBA/SocketRepository.java
index e48a9a5da..5d4a5099c 100644
--- a/gnu/CORBA/SocketRepository.java
+++ b/gnu/CORBA/SocketRepository.java
@@ -116,9 +116,6 @@ public class SocketRepository
*/
public static Socket get_socket(Object key)
{
- if (true)
- return null;
-
synchronized (sockets)
{
Socket s = (Socket) sockets.get(key);
diff --git a/gnu/CORBA/gnuRequest.java b/gnu/CORBA/gnuRequest.java
index 5adf74129..0b3338d34 100644
--- a/gnu/CORBA/gnuRequest.java
+++ b/gnu/CORBA/gnuRequest.java
@@ -83,6 +83,7 @@ import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
import org.omg.PortableInterceptor.ForwardRequest;
import org.omg.PortableInterceptor.InvalidSlot;
+import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -593,7 +594,7 @@ public class gnuRequest extends Request implements Cloneable
{
final gnuRequest cloned = Clone();
cloned.oneWay = true;
-
+
new Thread()
{
public void run()
@@ -717,12 +718,11 @@ public class gnuRequest extends Request implements Cloneable
* 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.
- *
+ * 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 RawReply submit()
+public synchronized RawReply submit()
throws ForwardRequest
{
gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();
@@ -788,20 +788,21 @@ public class gnuRequest extends Request implements Cloneable
if (socket == null)
{
- // The BindException may be thrown under very heavy parallel
+ // The IOException may be thrown under very heavy parallel
// load. For some time, just wait, exceptiong the socket to free.
Open: for (int i = 0; i < PAUSE_STEPS; i++)
{
try
{
if (orb instanceof OrbFunctional)
- socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
- ior.Internet.host, ior.Internet.port);
+ socket = ((OrbFunctional) orb).socketFactory.
+ createClientSocket(
+ ior.Internet.host, ior.Internet.port);
else
socket = new Socket(ior.Internet.host, ior.Internet.port);
break Open;
}
- catch (BindException ex)
+ catch (IOException ex)
{
try
{
@@ -833,7 +834,7 @@ public class gnuRequest extends Request implements Cloneable
request_part.buffer.writeTo(socketOutput);
socketOutput.flush();
- if (!socket.isClosed())
+ if (!socket.isClosed() && !oneWay)
{
MessageHeader response_header = new MessageHeader();
InputStream socketInput = socket.getInputStream();
@@ -937,6 +938,10 @@ public class gnuRequest extends Request implements Cloneable
throws SystemException, ForwardRequest
{
RawReply response = submit();
+
+ // If this is a one way message, do not care about the response.
+ if (oneWay && response == EMPTY)
+ return;
if (m_rph == null)
m_rph = response.header.create_reply_header();
diff --git a/gnu/classpath/SystemProperties.java b/gnu/classpath/SystemProperties.java
index 0c2d0e8de..d091f1ed0 100644
--- a/gnu/classpath/SystemProperties.java
+++ b/gnu/classpath/SystemProperties.java
@@ -111,6 +111,13 @@ public class SystemProperties
defaultProperties.put("java.io.tmpdir",
defaultProperties.get("java.tmpdir"));
+ // FIXME: we need a better way to handle this.
+ // For instance, having a single VM class for each OS might help.
+ if (defaultProperties.get("gnu.classpath.mime.types.file") == null
+ && "Linux".equals(defaultProperties.get("os.name")))
+ defaultProperties.put("gnu.classpath.mime.types.file",
+ "/etc/mime.types");
+
VMSystemProperties.postInit(defaultProperties);
// Note that we use clone here and not new. Some programs assume
diff --git a/gnu/java/awt/peer/gtk/GdkGraphics.java b/gnu/java/awt/peer/gtk/GdkGraphics.java
index c45892800..3c3cbdf32 100644
--- a/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ b/gnu/java/awt/peer/gtk/GdkGraphics.java
@@ -219,8 +219,10 @@ public class GdkGraphics extends Graphics
public boolean drawImage (Image img, int x, int y,
Color bgcolor, ImageObserver observer)
{
- return drawImage(img, x, y, img.getWidth(null), img.getHeight(null),
- bgcolor, observer);
+ if (img != null)
+ return drawImage(img, x, y, img.getWidth(null), img.getHeight(null),
+ bgcolor, observer);
+ return false;
}
public boolean drawImage (Image img, int x, int y, ImageObserver observer)
@@ -228,16 +230,19 @@ public class GdkGraphics extends Graphics
return drawImage (img, x, y, null, observer);
}
- public boolean drawImage (Image img, int x, int y, int width, int height,
- Color bgcolor, ImageObserver observer)
+ public boolean drawImage(Image img, int x, int y, int width, int height,
+ Color bgcolor, ImageObserver observer)
{
- if (img instanceof GtkImage)
- return ((GtkImage)img).drawImage (this, x, y, width, height,
- bgcolor, observer);
- else
- return (new GtkImage(img.getSource())).drawImage (this, x, y,
- width, height,
- bgcolor, observer);
+ if (img != null)
+ {
+ if (img instanceof GtkImage)
+ return ((GtkImage) img).drawImage(this, x, y, width, height, bgcolor,
+ observer);
+ return (new GtkImage(img.getSource())).drawImage(this, x, y, width,
+ height, bgcolor,
+ observer);
+ }
+ return false;
}
public boolean drawImage (Image img, int x, int y, int width, int height,
@@ -250,14 +255,16 @@ public class GdkGraphics extends Graphics
int sx1, int sy1, int sx2, int sy2,
Color bgcolor, ImageObserver observer)
{
- if (img instanceof GtkImage)
- return ((GtkImage)img).drawImage(this, dx1, dy1, dx2, dy2,
- sx1, sy1, sx2, sy2, bgcolor, observer);
- else
- return (new GtkImage(img.getSource())).drawImage(this, dx1, dy1,
- dx2, dy2,
- sx1, sy1, sx2, sy2,
- bgcolor, observer);
+ if (img != null)
+ {
+ if (img instanceof GtkImage)
+ return ((GtkImage) img).drawImage(this, dx1, dy1, dx2, dy2, sx1, sy1,
+ sx2, sy2, bgcolor, observer);
+ return (new GtkImage(img.getSource())).drawImage(this, dx1, dy1, dx2,
+ dy2, sx1, sy1, sx2,
+ sy2, bgcolor, observer);
+ }
+ return false;
}
public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2,
diff --git a/gnu/java/awt/peer/gtk/GtkCanvasPeer.java b/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
index 16166afa4..797d653d2 100644
--- a/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
@@ -38,16 +38,14 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
-import java.awt.AWTEvent;
import java.awt.Canvas;
import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.event.PaintEvent;
import java.awt.peer.CanvasPeer;
public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer
{
native void create ();
+ native void realize ();
public GtkCanvasPeer (Canvas c)
{
diff --git a/gnu/java/awt/peer/gtk/GtkClipboard.java b/gnu/java/awt/peer/gtk/GtkClipboard.java
index ceb42599b..f520fe224 100644
--- a/gnu/java/awt/peer/gtk/GtkClipboard.java
+++ b/gnu/java/awt/peer/gtk/GtkClipboard.java
@@ -172,15 +172,12 @@ public class GtkClipboard extends Clipboard
|| 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))
{
try
{
Object o = contents.getTransferData(DataFlavor.imageFlavor);
- if (o instanceof GtkImage)
+ if (o instanceof Image)
images = true;
}
catch (UnsupportedFlavorException ufe)
@@ -291,7 +288,11 @@ public class GtkClipboard extends Clipboard
try
{
- return (GtkImage) contents.getTransferData(DataFlavor.imageFlavor);
+ Object o = contents.getTransferData(DataFlavor.imageFlavor);
+ if( o instanceof GtkImage )
+ return (GtkImage) o;
+ else
+ return new GtkImage(((Image)o).getSource());
}
catch (UnsupportedFlavorException ufe)
{
diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index 1a4aa0afb..1a85de5fe 100644
--- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -567,7 +567,7 @@ public class GtkComponentPeer extends GtkGenericPeer
public void setVisible (boolean b)
{
// Only really set visible when component is bigger than zero pixels.
- if (b)
+ if (b && ! (awtComponent instanceof Window))
{
Rectangle bounds = awtComponent.getBounds();
b = (bounds.width > 0) && (bounds.height > 0);
diff --git a/gnu/java/awt/peer/gtk/GtkFramePeer.java b/gnu/java/awt/peer/gtk/GtkFramePeer.java
index c8cc9423b..6ec0b7298 100644
--- a/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -1,5 +1,5 @@
/* GtkFramePeer.java -- Implements FramePeer with GTK
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -122,25 +122,11 @@ 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);
- nativeSetBounds (x, y,
- width - insets.left - insets.right,
- height - insets.top - insets.bottom
- + menuBarHeight);
+ super.setBounds(x, y, width, height + menuBarHeight);
}
public void setResizable (boolean resizable)
@@ -198,26 +184,19 @@ public class GtkFramePeer extends GtkWindowPeer
protected void postConfigureEvent (int x, int y, int width, int height)
{
- int frame_width = width + insets.left + insets.right;
+ if (menuBar != null && width > 0)
+ setMenuBarWidthUnlocked (menuBar, width);
+
// 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_width != awtComponent.getWidth()
- || frame_height != awtComponent.getHeight())
- awtComponent.setSize(frame_width, frame_height);
+ int frame_height = height - menuBarHeight;
- 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;
+ int frame_y = y + menuBarHeight;
- if (frame_x != awtComponent.getX()
- || frame_y != awtComponent.getY())
- {
- // awtComponent.setLocation(frame_x, frame_y);
- }
+ super.postConfigureEvent(x, frame_y, width, frame_height);
}
public int getState ()
diff --git a/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/gnu/java/awt/peer/gtk/GtkPanelPeer.java
index 16eb8c8fb..51fe2bc8e 100644
--- a/gnu/java/awt/peer/gtk/GtkPanelPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkPanelPeer.java
@@ -39,9 +39,7 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
import java.awt.AWTEvent;
-import java.awt.Graphics;
import java.awt.Panel;
-import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.event.PaintEvent;
import java.awt.peer.PanelPeer;
@@ -62,16 +60,9 @@ public class GtkPanelPeer extends GtkContainerPeer
if (id == MouseEvent.MOUSE_PRESSED)
awtComponent.requestFocusInWindow();
-
+
super.handleEvent(event);
}
- protected void updateComponent (PaintEvent event)
- {
- // Do not want to clear anything before painting. Sun never
- // calls Panel.update, only Panel.paint.
- paintComponent(event);
- }
-
native void connectSignals ();
}
diff --git a/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/gnu/java/awt/peer/gtk/GtkWindowPeer.java
index 70c6615fa..d15beacb4 100644
--- a/gnu/java/awt/peer/gtk/GtkWindowPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkWindowPeer.java
@@ -1,5 +1,5 @@
/* GtkWindowPeer.java -- Implements WindowPeer with GTK
- Copyright (C) 1998, 1999, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,7 @@ import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Window;
+import java.awt.event.ComponentEvent;
import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent;
import java.awt.peer.WindowPeer;
@@ -63,20 +64,37 @@ public class GtkWindowPeer extends GtkContainerPeer
private boolean hasBeenShown = false;
private int oldState = Frame.NORMAL;
+ // Cached awt window component location, width and height.
+ private int x, y, width, height;
+
native void gtkWindowSetTitle (String title);
native void gtkWindowSetResizable (boolean resizable);
native void gtkWindowSetModal (boolean modal);
native void realize ();
+ /** Returns the cached width of the AWT window component. */
+ int getX ()
+ {
+ return x;
+ }
+
+ /** Returns the cached width of the AWT window component. */
+ int getY ()
+ {
+ return y;
+ }
+
+ /** Returns the cached width of the AWT window component. */
int getWidth ()
{
- return awtComponent.getWidth();
+ return width;
}
+ /** Returns the cached height of the AWT window component. */
int getHeight ()
{
- return awtComponent.getHeight();
+ return height;
}
native void create (int type, boolean decorated, GtkWindowPeer parent);
@@ -86,6 +104,10 @@ public class GtkWindowPeer extends GtkContainerPeer
Window window = (Window) awtComponent;
GtkWindowPeer parent_peer = null;
Component parent = awtComponent.getParent();
+ x = awtComponent.getX();
+ y = awtComponent.getY();
+ height = awtComponent.getHeight();
+ width = awtComponent.getWidth();
if (!window.isFocusableWindow())
type = GDK_WINDOW_TYPE_HINT_MENU;
@@ -130,37 +152,28 @@ public class GtkWindowPeer extends GtkContainerPeer
native void nativeSetLocation (int x, int y);
native void nativeSetLocationUnlocked (int x, int y);
- public void setLocation (int x, int y)
+ // Called from show.
+ protected void setLocation (int x, int y)
{
- // prevent window_configure_cb -> awtComponent.setSize ->
- // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock.
- if (Thread.currentThread() == GtkToolkit.mainThread)
- return;
nativeSetLocation (x, y);
}
- public void setLocationUnlocked (int x, int y)
- {
- nativeSetLocationUnlocked (x, y);
- }
-
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);
+ if (x != getX()
+ || y != getY()
+ || width != getWidth()
+ || height != getHeight())
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+
+ nativeSetBounds (x, y,
+ width - insets.left - insets.right,
+ height - insets.top - insets.bottom);
+ }
}
public void setTitle (String title)
@@ -168,15 +181,25 @@ public class GtkWindowPeer extends GtkContainerPeer
gtkWindowSetTitle (title);
}
- native void setSize (int width, int height);
-
+ // Called from setResizable
+ protected native void setSize (int width, int height);
+
+ /**
+ * Needed by both GtkFramePeer and GtkDialogPeer subclasses, so
+ * implemented here. But never actually called on a GtkWindowPeer
+ * itself.
+ */
public void setResizable (boolean resizable)
{
// Call setSize; otherwise when resizable is changed from true to
// false the window will shrink to the dimensions it had before it
// was resizable.
- setSize (awtComponent.getWidth() - insets.left - insets.right,
- awtComponent.getHeight() - insets.top - insets.bottom);
+ x = awtComponent.getX();
+ y = awtComponent.getY();
+ width = awtComponent.getWidth();
+ height = awtComponent.getHeight();
+ setSize (width - insets.left - insets.right,
+ height - insets.top - insets.bottom);
gtkWindowSetResizable (resizable);
}
@@ -196,23 +219,35 @@ public class GtkWindowPeer extends GtkContainerPeer
int frame_width = width + insets.left + insets.right;
int frame_height = height + insets.top + insets.bottom;
- if (frame_width != awtComponent.getWidth()
- || frame_height != awtComponent.getHeight())
- awtComponent.setSize(frame_width, frame_height);
+ if (frame_width != getWidth()
+ || frame_height != getHeight())
+ {
+ this.width = frame_width;
+ this.height = frame_height;
+ q().postEvent(new ComponentEvent(awtComponent,
+ ComponentEvent.COMPONENT_RESIZED));
+ }
int frame_x = x - insets.left;
int frame_y = y - insets.top;
- if (frame_x != awtComponent.getX()
- || frame_y != awtComponent.getY())
+ if (frame_x != getX()
+ || frame_y != getY())
{
- // awtComponent.setLocation(frame_x, frame_y);
+ this.x = frame_x;
+ this.y = frame_y;
+ q().postEvent(new ComponentEvent(awtComponent,
+ ComponentEvent.COMPONENT_MOVED));
}
}
public void show ()
{
- setLocation(awtComponent.getX(), awtComponent.getY());
+ x = awtComponent.getX();
+ y = awtComponent.getY();
+ width = awtComponent.getWidth();
+ height = awtComponent.getHeight();
+ setLocation(x, y);
setVisible (true);
}
@@ -296,4 +331,11 @@ public class GtkWindowPeer extends GtkContainerPeer
x + insets.left, y + insets.top,
clickCount, popupTrigger);
}
+
+ // We override this to keep it in sync with our internal
+ // representation.
+ public Rectangle getBounds()
+ {
+ return new Rectangle(x, y, width, height);
+ }
}
diff --git a/gnu/java/lang/reflect/GenericSignatureParser.java b/gnu/java/lang/reflect/GenericSignatureParser.java
index b3ee3662c..10d7537b4 100644
--- a/gnu/java/lang/reflect/GenericSignatureParser.java
+++ b/gnu/java/lang/reflect/GenericSignatureParser.java
@@ -42,28 +42,6 @@ import java.lang.reflect.*;
import java.util.ArrayList;
import java.util.Arrays;
-abstract class TypeImpl implements Type
-{
- abstract Type resolve();
-
- static void resolve(Type[] types)
- {
- for (int i = 0; i < types.length; i++)
- {
- types[i] = resolve(types[i]);
- }
- }
-
- static Type resolve(Type type)
- {
- if (type instanceof TypeImpl)
- {
- type = ((TypeImpl) type).resolve();
- }
- return type;
- }
-}
-
final class TypeVariableImpl extends TypeImpl implements TypeVariable
{
private GenericDeclaration decl;
diff --git a/gnu/java/lang/reflect/TypeImpl.java b/gnu/java/lang/reflect/TypeImpl.java
new file mode 100644
index 000000000..30906f629
--- /dev/null
+++ b/gnu/java/lang/reflect/TypeImpl.java
@@ -0,0 +1,63 @@
+/* TypeImpl.java
+ 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
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.reflect;
+
+import java.lang.reflect.Type;
+
+abstract class TypeImpl implements Type
+{
+ abstract Type resolve();
+
+ static void resolve(Type[] types)
+ {
+ for (int i = 0; i < types.length; i++)
+ {
+ types[i] = resolve(types[i]);
+ }
+ }
+
+ static Type resolve(Type type)
+ {
+ if (type instanceof TypeImpl)
+ {
+ type = ((TypeImpl) type).resolve();
+ }
+ return type;
+ }
+}
diff --git a/gnu/java/net/DefaultContentHandlerFactory.java b/gnu/java/net/DefaultContentHandlerFactory.java
new file mode 100644
index 000000000..bb0a7ce5d
--- /dev/null
+++ b/gnu/java/net/DefaultContentHandlerFactory.java
@@ -0,0 +1,94 @@
+/* DefaultContentHandlerFactory.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. */
+
+
+package gnu.java.net;
+
+import java.io.IOException;
+import java.net.ContentHandler;
+import java.net.ContentHandlerFactory;
+import java.net.URLConnection;
+import java.util.Arrays;
+import java.util.HashSet;
+
+/** Content Handler for Image types, using the AWT Toolkit's image decoder. */
+class ImageHandler extends ContentHandler
+{
+ static ImageHandler instance = new ImageHandler();
+
+ public Object getContent(URLConnection urlc) throws IOException
+ {
+ // FIXME: implement using ImageIO
+ // ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit();
+ // java.awt.image.ImageProducer ip = tk.createImageProducer(urlc.getURL());
+ // return ip;
+ return null;
+ }
+}
+
+/**
+ */
+public class DefaultContentHandlerFactory implements ContentHandlerFactory
+{
+ /** For now, hard code the list of types that we assume should
+ * be supported by the Toolkit. ClasspathToolkit should perhaps provide
+ * an API to express what Image MIME types the Toolkit understands.
+ */
+ private static String[] known_image_types =
+ {
+ "image/bmp",
+ "image/gif",
+ "image/jpeg",
+ "image/png",
+ "image/tiff",
+ "image/x-portable-anymap",
+ "image/x-cmu-raster",
+ "image/x-xbitmap",
+ "image/x-xpixmap"
+ };
+
+ private static HashSet imageTypes
+ = new HashSet(Arrays.asList(known_image_types));
+
+ public ContentHandler createContentHandler(String mimeType)
+ {
+ if (imageTypes.contains(mimeType))
+ return ImageHandler.instance;
+ // Currently, only image types are handled.
+ return null;
+ }
+}
diff --git a/gnu/java/rmi/activation/ActivationSystemTransient.java b/gnu/java/rmi/activation/ActivationSystemTransient.java
index ea31e4bdf..1557220e1 100644
--- a/gnu/java/rmi/activation/ActivationSystemTransient.java
+++ b/gnu/java/rmi/activation/ActivationSystemTransient.java
@@ -1,4 +1,4 @@
-/* DefaultActivationSystem.java -- FIXME: briefly describe file purpose
+/* ActivationSystemTransient.java -- The transient RMI object activation system.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,23 +69,23 @@ public class ActivationSystemTransient
/**
* Maps group identifiers into group descriptions.
*/
- BidiTable groupDescs = new BidiTable();
+ protected final BidiTable groupDescs;
/**
* Maps object identifiers into object activation descriptions
*/
- BidiTable descriptions = new BidiTable();
+ protected final BidiTable descriptions;
/**
- * Maps group descriptions into group object instantiators.
+ * Maps group identifiers into already activated groups.
*/
- Map groupInstantiators = new Hashtable();
+ protected transient final Map groupInstantiators = new Hashtable();
/**
* The cache of the activated objects, maps activation ids to remote
* object stubs.
*/
- Map activatedObjects = new HashMap();
+ protected transient final Map activatedObjects = new HashMap();
/**
* The object incarnation counter.
@@ -102,11 +102,23 @@ public class ActivationSystemTransient
*/
public static boolean debug = false;
+
+ /**
+ * Creates the group which uses the given maps to store the data.
+ */
+ protected ActivationSystemTransient(BidiTable objectDescriptions,
+ BidiTable groupDescriptiopns)
+ {
+ descriptions = objectDescriptions;
+ groupDescs = groupDescriptiopns;
+ }
+
/**
- * This group should not be instantiated outside the group code.
+ * Creates the group with transient maps.
*/
protected ActivationSystemTransient()
{
+ this (new BidiTable(), new BidiTable());
}
public static ActivationSystem getInstance()
@@ -282,11 +294,13 @@ public class ActivationSystemTransient
}
/**
- * No action.
+ * Calls .shutdown on all bidirectional tables (has no effect if these
+ * table are not persistent).
*/
public void shutdown() throws RemoteException
{
- // Nothing to do.
+ descriptions.shutdown();
+ groupDescs.shutdown();
}
/**
diff --git a/gnu/java/rmi/activation/BidiTable.java b/gnu/java/rmi/activation/BidiTable.java
index 0a8d895f3..5e421fe8d 100644
--- a/gnu/java/rmi/activation/BidiTable.java
+++ b/gnu/java/rmi/activation/BidiTable.java
@@ -38,7 +38,10 @@ exception statement from your version. */
package gnu.java.rmi.activation;
-import java.util.Hashtable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
/**
* The bidirectional hash table, maps both a to b and b to a.
@@ -55,17 +58,36 @@ public class BidiTable
/**
* Maps keys to values
*/
- Hashtable k2v = new Hashtable();
+ protected Map k2v;
/**
* Maps values to keys (in reverse)
*/
- Hashtable v2k = new Hashtable();
+ protected Map v2k;
+
+ /**
+ * Create a new table that is ready to use.
+ */
+ public BidiTable()
+ {
+ k2v = new HashMap();
+ v2k = new HashMap();
+ }
+
+ /**
+ * Create a new instance where the hashtable fields are not initialised
+ * (called from derivatives that intialise hashtables in they own way.
+ *
+ * @param flags currently used to mark the different constructor only.
+ */
+ protected BidiTable(int flags)
+ {
+ }
/**
* Get key by value
*/
- Object getKey(Object value)
+ public synchronized Object getKey(Object value)
{
return v2k.get(value);
}
@@ -73,7 +95,7 @@ public class BidiTable
/**
* Put key-value pair.
*/
- public void put(Object key, Object value)
+ public synchronized void put(Object key, Object value)
{
k2v.put(key, value);
v2k.put(value, key);
@@ -82,7 +104,7 @@ public class BidiTable
/**
* Get value from key
*/
- public Object get(Object key)
+ public synchronized Object get(Object key)
{
return k2v.get(key);
}
@@ -90,7 +112,7 @@ public class BidiTable
/**
* Remove the key-value pair by key
*/
- public void removeKey(Object key)
+ public synchronized void removeKey(Object key)
{
Object value = k2v.get(key);
if (value!=null)
@@ -103,9 +125,39 @@ public class BidiTable
/**
* Check if the table contains this key.
*/
- public boolean containsKey(Object key)
+ public synchronized boolean containsKey(Object key)
{
return k2v.containsKey(key);
}
+ /**
+ * This method is called before exit and may be used to write the database
+ * to the disk. The default method does nothing.
+ */
+ public synchronized void shutdown()
+ {
+ }
+
+ /**
+ * Get the size.
+ */
+ public synchronized int size()
+ {
+ return k2v.size();
+ }
+
+ /**
+ * Get the key collection.
+ */
+ public synchronized Object[] keys()
+ {
+ Collection keys = k2v.keySet();
+ Object[] k = new Object[keys.size()];
+
+ Iterator iter = keys.iterator();
+ for (int i = 0; i < k.length; i++)
+ k[i] = iter.next();
+
+ return k;
+ }
}
diff --git a/gnu/java/rmi/dgc/LeaseRenewingTask.java b/gnu/java/rmi/dgc/LeaseRenewingTask.java
index 7e3bb258b..ffb5560af 100644
--- a/gnu/java/rmi/dgc/LeaseRenewingTask.java
+++ b/gnu/java/rmi/dgc/LeaseRenewingTask.java
@@ -110,9 +110,12 @@ public class LeaseRenewingTask
*/
public LeaseRenewingTask(UnicastRef renewIt)
{
- ref.add(new WeakReference(renewIt));
lease = notifyDGC(renewIt);
- schedule(lease);
+ if (lease != null)
+ {
+ schedule(lease);
+ ref.add(new WeakReference(renewIt));
+ }
}
/**
@@ -122,6 +125,9 @@ public class LeaseRenewingTask
*/
public static void scheduleLeases(UnicastRef renewIt)
{
+ // No need to schedule leases for null.
+ if (renewIt == null)
+ return;
try {
synchronized (existingTasks)
{
@@ -144,7 +150,9 @@ public class LeaseRenewingTask
}
catch (Exception ex)
{
- ex.printStackTrace();
+ InternalError ierr = new InternalError("Lease for "+renewIt);
+ ierr.initCause(ex);
+ throw ierr;
}
}
diff --git a/gnu/java/rmi/server/ActivatableRef.java b/gnu/java/rmi/server/ActivatableRef.java
new file mode 100644
index 000000000..d191c0c17
--- /dev/null
+++ b/gnu/java/rmi/server/ActivatableRef.java
@@ -0,0 +1,175 @@
+/* ActivatableRef.java -- Activatable server reference
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.rmi.server;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationID;
+import java.rmi.server.ObjID;
+import java.rmi.server.RMIClientSocketFactory;
+import java.rmi.server.RemoteObject;
+import java.rmi.server.RemoteObjectInvocationHandler;
+import java.rmi.server.RemoteRef;
+
+/**
+ * The activatable reference works like UnicastRef, but if the remote object
+ * appears to be not accessible, it tries to reactivate it before reporting
+ * any errors. Apart the fields of the UnicastRef, the activatable reference
+ * contains the ActivationID that is used for this activation.
+ *
+ * @author Audrius Meskauskas (Audriusa@Bioinformatics.org)
+ */
+public class ActivatableRef extends UnicastRef
+{
+ /**
+ * Use serial version UID for iteroperability
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The activation id.
+ */
+ ActivationID actId;
+
+ /**
+ * Delegate call to the superclass.
+ */
+ public ActivatableRef()
+ {
+ super();
+ }
+
+ /**
+ * Delegate call to the superclass.
+ */
+ public ActivatableRef(ObjID objid, String host, int port,
+ RMIClientSocketFactory csf)
+ {
+ super(objid, host, port, csf);
+ }
+
+ /**
+ * Delegate call to the superclass.
+ */
+ public ActivatableRef(ObjID objid)
+ {
+ super(objid);
+ }
+
+ /**
+ * Get the referencing class.
+ */
+ public String getRefClass(ObjectOutput out)
+ {
+ return "ActivatableRef";
+ }
+
+ /**
+ * Read the content from the input stream.
+ */
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException
+ {
+ super.readExternal(in);
+ actId = (ActivationID) in.readObject();
+ }
+
+ /**
+ * Write the content to the output stream.
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(actId);
+ }
+
+ /**
+ * Invoke the remote method on the given object and try to activate the object
+ * if it is not reacheable with the current manager.
+ */
+ protected Object invokeCommon(Remote obj, Method method, Object[] params,
+ int opnum, long hash) throws Exception
+ {
+ UnicastConnection conn;
+ try
+ {
+ conn = manager.getConnection();
+ }
+ catch (IOException e1)
+ {
+ // Connection failed: try to activate.
+ Remote reactivated = actId.activate(false);
+
+ if (reactivated instanceof RemoteObject)
+ {
+ RemoteRef ref = ((RemoteObject) reactivated).getRef();
+ manager = ((UnicastRef) ref).manager;
+ }
+ else if (Proxy.isProxyClass(reactivated.getClass()))
+ {
+ RemoteObjectInvocationHandler hander =
+ (RemoteObjectInvocationHandler)
+ Proxy.getInvocationHandler(reactivated);
+
+ RemoteRef ref = hander.getRef();
+ manager = ((UnicastRef) ref).manager;
+ }
+ else
+ throw new ActivationException("Activating into unsupported class "
+ + reactivated.getClass());
+
+ try
+ {
+ conn = manager.getConnection();
+ }
+ catch (IOException e2)
+ {
+ throw new RemoteException("connection failed to host: "
+ + manager.serverName, e1);
+ }
+ }
+ return invokeCommon(conn, obj, method, params, opnum, hash);
+ }
+}
diff --git a/gnu/java/rmi/server/ActivatableServerRef.java b/gnu/java/rmi/server/ActivatableServerRef.java
index d89e351d3..09595ec5f 100644
--- a/gnu/java/rmi/server/ActivatableServerRef.java
+++ b/gnu/java/rmi/server/ActivatableServerRef.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package gnu.java.rmi.server;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.activation.ActivationID;
@@ -194,5 +197,31 @@ public class ActivatableServerRef extends UnicastServerRef
UnicastServer.registerActivatable(this);
return stub;
}
+
+ /**
+ * Get the referencing class.
+ */
+ public String getRefClass(ObjectOutput out)
+ {
+ return "ActivatableRef";
+ }
+
+ /**
+ * Read the content from the input stream.
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ actId = (ActivationID) in.readObject();
+ }
+
+ /**
+ * Write the content to the output stream.
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ out.writeObject(actId);
+ }
}
diff --git a/gnu/java/rmi/server/UnicastRef.java b/gnu/java/rmi/server/UnicastRef.java
index ef3c5f91b..def1acdcf 100644
--- a/gnu/java/rmi/server/UnicastRef.java
+++ b/gnu/java/rmi/server/UnicastRef.java
@@ -251,21 +251,34 @@ public class UnicastRef
return (Lease) returnval;
}
-
- private Object invokeCommon(Remote obj, Method method, Object[] params,
- int opnum, long hash) throws Exception
+ /**
+ * Invoke the remote method on the given object. This part is overridden by
+ * the activatable objects.
+ */
+ protected Object invokeCommon(Remote obj, Method method, Object[] params,
+ int opnum, long hash) throws Exception
{
UnicastConnection conn;
try
{
conn = manager.getConnection();
+ return invokeCommon(conn, obj, method, params, opnum, hash);
}
catch (IOException e1)
{
throw new RemoteException("connection failed to host: "
+ manager.serverName, e1);
}
+ }
+ /**
+ * Invoke the remote method on the given object when connection is already
+ * established.
+ */
+ protected Object invokeCommon(UnicastConnection conn, Remote obj,
+ Method method, Object[] params, int opnum,
+ long hash) throws Exception
+ {
ObjectOutputStream out;
DataOutputStream dout;
try
@@ -326,7 +339,7 @@ public class UnicastRef
else
{
returnval = ((RMIObjectInputStream) in).readValue(cls); // get
- // returnvalue
+ // returnvalue
}
}
catch (IOException e3)
diff --git a/gnu/java/security/hash/Whirlpool.java b/gnu/java/security/hash/Whirlpool.java
index 8c5d9f360..95a4515d9 100644
--- a/gnu/java/security/hash/Whirlpool.java
+++ b/gnu/java/security/hash/Whirlpool.java
@@ -42,25 +42,25 @@ import gnu.java.security.Registry;
import gnu.java.security.util.Util;
/**
- * <p>Whirlpool, a new 512-bit hashing function operating on messages less than
+ * Whirlpool, a new 512-bit hashing function operating on messages less than
* 2 ** 256 bits in length. The function structure is designed according to the
* Wide Trail strategy and permits a wide variety of implementation trade-offs.
- * </p>
- *
- * <p><b>IMPORTANT</b>: This implementation is not thread-safe.</p>
- *
- * <p>References:</p>
- *
+ * <p>
+ * This implementation is of Whirlpool Version 3, described in [1] last revised
+ * on May 24th, 2003.
+ * <p>
+ * <b>IMPORTANT</b>: This implementation is not thread-safe.
+ * <p>
+ * References:
* <ol>
* <li><a href="http://planeta.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html">
* The WHIRLPOOL Hashing Function</a>.<br>
* <a href="mailto:paulo.barreto@terra.com.br">Paulo S.L.M. Barreto</a> and
- * <a href="mailto:vincent.rijmen@esat.kuleuven.ac.be">Vincent Rijmen</a>.</li>
+ * <a href="mailto:vincent.rijmen@iaik.tugraz.at">Vincent Rijmen</a>.</li>
* </ol>
*/
public final class Whirlpool extends BaseHash
{
-
// Debugging methods and variables
// -------------------------------------------------------------------------
@@ -74,45 +74,43 @@ public final class Whirlpool extends BaseHash
private static final int BLOCK_SIZE = 64; // inner block size in bytes
/** The digest of the 0-bit long message. */
- private static final String DIGEST0 = "470F0409ABAA446E49667D4EBE12A14387CEDBD10DD17B8243CAD550A089DC0F"
- + "EEA7AA40F6C2AAAB71C6EBD076E43C7CFCA0AD32567897DCB5969861049A0F5A";
-
- private static final int R = 10; // default number of rounds
-
- private static final String Sd = // p. 19 [WHIRLPOOL]
- "\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152"
- + "\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57"
- + "\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85"
- + "\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8"
- + "\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333"
- + "\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0"
- + "\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE"
- + "\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d"
- + "\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF"
- + "\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A"
- + "\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c"
- + "\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04"
- + "\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB"
- + "\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9"
- + "\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1"
- + "\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886";
-
+ private static final String DIGEST0 =
+ "19FA61D75522A4669B44E39C1D2E1726C530232130D407F89AFEE0964997F7A7"
+ + "3E83BE698B288FEBCF88E3E03C4F0757EA8964E59B63D93708B138CC42A66EB3";
+
+ /** Default number of rounds. */
+ private static final int R = 10;
+
+ /** Whirlpool S-box; p. 19. */
+ private static final String S_box = // p. 19 [WHIRLPOOL]
+ "\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152" +
+ "\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57" +
+ "\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85" +
+ "\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8" +
+ "\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333" +
+ "\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0" +
+ "\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE" +
+ "\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d" +
+ "\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF" +
+ "\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A" +
+ "\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c" +
+ "\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04" +
+ "\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB" +
+ "\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9" +
+ "\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1" +
+ "\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886";
+
+ /** The 64-bit lookup tables; section 7.1 p. 13. */
private static final long[] T0 = new long[256];
-
private static final long[] T1 = new long[256];
-
private static final long[] T2 = new long[256];
-
private static final long[] T3 = new long[256];
-
private static final long[] T4 = new long[256];
-
private static final long[] T5 = new long[256];
-
private static final long[] T6 = new long[256];
-
private static final long[] T7 = new long[256];
+ /** The round constants. */
private static final long[] rc = new long[R];
/** caches the result of the correctness test, once executed. */
@@ -123,12 +121,10 @@ public final class Whirlpool extends BaseHash
/** Work area for computing the round key schedule. */
private long k00, k01, k02, k03, k04, k05, k06, k07;
-
private long Kr0, Kr1, Kr2, Kr3, Kr4, Kr5, Kr6, Kr7;
/** work area for transforming the 512-bit buffer. */
private long n0, n1, n2, n3, n4, n5, n6, n7;
-
private long nn0, nn1, nn2, nn3, nn4, nn5, nn6, nn7;
/** work area for holding block cipher's intermediate values. */
@@ -140,72 +136,67 @@ public final class Whirlpool extends BaseHash
{
long time = System.currentTimeMillis();
- int ROOT = 0x11d; // para. 2.1 [WHIRLPOOL]
+ int ROOT = 0x11D; // para. 2.1 [WHIRLPOOL]
int i, r, j;
- long s, s2, s3, s4, s5, s8, s9, t;
+ long s1, s2, s4, s5, s8, s9, t;
char c;
final byte[] S = new byte[256];
for (i = 0; i < 256; i++)
{
- c = Sd.charAt(i >>> 1);
+ c = S_box.charAt(i >>> 1);
- s = ((i & 1) == 0 ? c >>> 8 : c) & 0xFFL;
- s2 = s << 1;
+ s1 = ((i & 1) == 0 ? c >>> 8 : c) & 0xFFL;
+ s2 = s1 << 1;
if (s2 > 0xFFL)
- {
- s2 ^= ROOT;
- }
- s3 = s2 ^ s;
+ s2 ^= ROOT;
+
s4 = s2 << 1;
if (s4 > 0xFFL)
- {
- s4 ^= ROOT;
- }
- s5 = s4 ^ s;
+ s4 ^= ROOT;
+
+ s5 = s4 ^ s1;
s8 = s4 << 1;
if (s8 > 0xFFL)
- {
- s8 ^= ROOT;
- }
- s9 = s8 ^ s;
+ s8 ^= ROOT;
- S[i] = (byte) s;
- T0[i] = t = s << 56 | s << 48 | s3 << 40 | s << 32 | s5 << 24
- | s8 << 16 | s9 << 8 | s5;
- T1[i] = t >>> 8 | t << 56;
+ s9 = s8 ^ s1;
+
+ T0[i] = t = s1 << 56 | s1 << 48 | s4 << 40 | s1 << 32
+ | s8 << 24 | s5 << 16 | s2 << 8 | s9;
+ T1[i] = t >>> 8 | t << 56;
T2[i] = t >>> 16 | t << 48;
T3[i] = t >>> 24 | t << 40;
T4[i] = t >>> 32 | t << 32;
T5[i] = t >>> 40 | t << 24;
T6[i] = t >>> 48 | t << 16;
- T7[i] = t >>> 56 | t << 8;
+ T7[i] = t >>> 56 | t << 8;
}
- for (r = 1, i = 0, j = 0; r < R + 1; r++)
- {
- rc[i++] = (S[j++] & 0xFFL) << 56 | (S[j++] & 0xFFL) << 48
- | (S[j++] & 0xFFL) << 40 | (S[j++] & 0xFFL) << 32
- | (S[j++] & 0xFFL) << 24 | (S[j++] & 0xFFL) << 16
- | (S[j++] & 0xFFL) << 8 | (S[j++] & 0xFFL);
- }
+ for (r = 0, i = 0; r < R; )
+ rc[r++] = (T0[i++] & 0xFF00000000000000L)
+ ^ (T1[i++] & 0x00FF000000000000L)
+ ^ (T2[i++] & 0x0000FF0000000000L)
+ ^ (T3[i++] & 0x000000FF00000000L)
+ ^ (T4[i++] & 0x00000000FF000000L)
+ ^ (T5[i++] & 0x0000000000FF0000L)
+ ^ (T6[i++] & 0x000000000000FF00L)
+ ^ (T7[i++] & 0x00000000000000FFL);
time = System.currentTimeMillis() - time;
-
if (DEBUG && debuglevel > 8)
{
System.out.println("==========");
System.out.println();
System.out.println("Static data");
System.out.println();
-
+
System.out.println();
System.out.println("T0[]:");
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T0[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T0[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -213,9 +204,8 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T1[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T1[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -223,9 +213,8 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T2[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T2[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -233,9 +222,8 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T3[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T3[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -243,9 +231,8 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T4[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T4[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -253,9 +240,8 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -263,9 +249,8 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
@@ -273,17 +258,15 @@ public final class Whirlpool extends BaseHash
for (i = 0; i < 64; i++)
{
for (j = 0; j < 4; j++)
- {
- System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", ");
- }
+ System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", ");
+
System.out.println();
}
System.out.println();
System.out.println("rc[]:");
for (i = 0; i < R; i++)
- {
- System.out.println("0x" + Util.toString(rc[i]));
- }
+ System.out.println("0x" + Util.toString(rc[i]));
+
System.out.println();
System.out.println();
@@ -340,38 +323,70 @@ public final class Whirlpool extends BaseHash
protected void transform(byte[] in, int offset)
{
// apply mu to the input
- n0 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n1 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n2 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n3 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n4 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n5 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n6 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
- n7 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48
- | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32
- | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16
- | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL);
+ n0 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n1 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n2 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n3 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n4 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n5 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n6 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
+ n7 = (in[offset++] & 0xFFL) << 56
+ | (in[offset++] & 0xFFL) << 48
+ | (in[offset++] & 0xFFL) << 40
+ | (in[offset++] & 0xFFL) << 32
+ | (in[offset++] & 0xFFL) << 24
+ | (in[offset++] & 0xFFL) << 16
+ | (in[offset++] & 0xFFL) << 8
+ | (in[offset++] & 0xFFL);
// transform K into the key schedule Kr; 0 <= r <= R
k00 = H0;
@@ -399,62 +414,70 @@ public final class Whirlpool extends BaseHash
{
// 1. compute intermediate round key schedule by applying ro[rc]
// to the previous round key schedule --rc being the round constant
- Kr0 = T0[(int) ((k00 >> 56) & 0xFFL)] ^ T1[(int) ((k07 >> 48) & 0xFFL)]
- ^ T2[(int) ((k06 >> 40) & 0xFFL)]
- ^ T3[(int) ((k05 >> 32) & 0xFFL)]
- ^ T4[(int) ((k04 >> 24) & 0xFFL)]
- ^ T5[(int) ((k03 >> 16) & 0xFFL)]
- ^ T6[(int) ((k02 >> 8) & 0xFFL)] ^ T7[(int) (k01 & 0xFFL)]
- ^ rc[r];
-
- Kr1 = T0[(int) ((k01 >> 56) & 0xFFL)] ^ T1[(int) ((k00 >> 48) & 0xFFL)]
- ^ T2[(int) ((k07 >> 40) & 0xFFL)]
- ^ T3[(int) ((k06 >> 32) & 0xFFL)]
- ^ T4[(int) ((k05 >> 24) & 0xFFL)]
- ^ T5[(int) ((k04 >> 16) & 0xFFL)]
- ^ T6[(int) ((k03 >> 8) & 0xFFL)] ^ T7[(int) (k02 & 0xFFL)];
-
- Kr2 = T0[(int) ((k02 >> 56) & 0xFFL)] ^ T1[(int) ((k01 >> 48) & 0xFFL)]
- ^ T2[(int) ((k00 >> 40) & 0xFFL)]
- ^ T3[(int) ((k07 >> 32) & 0xFFL)]
- ^ T4[(int) ((k06 >> 24) & 0xFFL)]
- ^ T5[(int) ((k05 >> 16) & 0xFFL)]
- ^ T6[(int) ((k04 >> 8) & 0xFFL)] ^ T7[(int) (k03 & 0xFFL)];
-
- Kr3 = T0[(int) ((k03 >> 56) & 0xFFL)] ^ T1[(int) ((k02 >> 48) & 0xFFL)]
- ^ T2[(int) ((k01 >> 40) & 0xFFL)]
- ^ T3[(int) ((k00 >> 32) & 0xFFL)]
- ^ T4[(int) ((k07 >> 24) & 0xFFL)]
- ^ T5[(int) ((k06 >> 16) & 0xFFL)]
- ^ T6[(int) ((k05 >> 8) & 0xFFL)] ^ T7[(int) (k04 & 0xFFL)];
-
- Kr4 = T0[(int) ((k04 >> 56) & 0xFFL)] ^ T1[(int) ((k03 >> 48) & 0xFFL)]
- ^ T2[(int) ((k02 >> 40) & 0xFFL)]
- ^ T3[(int) ((k01 >> 32) & 0xFFL)]
- ^ T4[(int) ((k00 >> 24) & 0xFFL)]
- ^ T5[(int) ((k07 >> 16) & 0xFFL)]
- ^ T6[(int) ((k06 >> 8) & 0xFFL)] ^ T7[(int) (k05 & 0xFFL)];
-
- Kr5 = T0[(int) ((k05 >> 56) & 0xFFL)] ^ T1[(int) ((k04 >> 48) & 0xFFL)]
- ^ T2[(int) ((k03 >> 40) & 0xFFL)]
- ^ T3[(int) ((k02 >> 32) & 0xFFL)]
- ^ T4[(int) ((k01 >> 24) & 0xFFL)]
- ^ T5[(int) ((k00 >> 16) & 0xFFL)]
- ^ T6[(int) ((k07 >> 8) & 0xFFL)] ^ T7[(int) (k06 & 0xFFL)];
-
- Kr6 = T0[(int) ((k06 >> 56) & 0xFFL)] ^ T1[(int) ((k05 >> 48) & 0xFFL)]
- ^ T2[(int) ((k04 >> 40) & 0xFFL)]
- ^ T3[(int) ((k03 >> 32) & 0xFFL)]
- ^ T4[(int) ((k02 >> 24) & 0xFFL)]
- ^ T5[(int) ((k01 >> 16) & 0xFFL)]
- ^ T6[(int) ((k00 >> 8) & 0xFFL)] ^ T7[(int) (k07 & 0xFFL)];
-
- Kr7 = T0[(int) ((k07 >> 56) & 0xFFL)] ^ T1[(int) ((k06 >> 48) & 0xFFL)]
- ^ T2[(int) ((k05 >> 40) & 0xFFL)]
- ^ T3[(int) ((k04 >> 32) & 0xFFL)]
- ^ T4[(int) ((k03 >> 24) & 0xFFL)]
- ^ T5[(int) ((k02 >> 16) & 0xFFL)]
- ^ T6[(int) ((k01 >> 8) & 0xFFL)] ^ T7[(int) (k00 & 0xFFL)];
+ Kr0 = T0[(int)((k00 >> 56) & 0xFFL)]
+ ^ T1[(int)((k07 >> 48) & 0xFFL)]
+ ^ T2[(int)((k06 >> 40) & 0xFFL)]
+ ^ T3[(int)((k05 >> 32) & 0xFFL)]
+ ^ T4[(int)((k04 >> 24) & 0xFFL)]
+ ^ T5[(int)((k03 >> 16) & 0xFFL)]
+ ^ T6[(int)((k02 >> 8) & 0xFFL)]
+ ^ T7[(int)( k01 & 0xFFL)] ^ rc[r];
+ Kr1 = T0[(int)((k01 >> 56) & 0xFFL)]
+ ^ T1[(int)((k00 >> 48) & 0xFFL)]
+ ^ T2[(int)((k07 >> 40) & 0xFFL)]
+ ^ T3[(int)((k06 >> 32) & 0xFFL)]
+ ^ T4[(int)((k05 >> 24) & 0xFFL)]
+ ^ T5[(int)((k04 >> 16) & 0xFFL)]
+ ^ T6[(int)((k03 >> 8) & 0xFFL)]
+ ^ T7[(int)( k02 & 0xFFL)];
+ Kr2 = T0[(int)((k02 >> 56) & 0xFFL)]
+ ^ T1[(int)((k01 >> 48) & 0xFFL)]
+ ^ T2[(int)((k00 >> 40) & 0xFFL)]
+ ^ T3[(int)((k07 >> 32) & 0xFFL)]
+ ^ T4[(int)((k06 >> 24) & 0xFFL)]
+ ^ T5[(int)((k05 >> 16) & 0xFFL)]
+ ^ T6[(int)((k04 >> 8) & 0xFFL)]
+ ^ T7[(int)( k03 & 0xFFL)];
+ Kr3 = T0[(int)((k03 >> 56) & 0xFFL)]
+ ^ T1[(int)((k02 >> 48) & 0xFFL)]
+ ^ T2[(int)((k01 >> 40) & 0xFFL)]
+ ^ T3[(int)((k00 >> 32) & 0xFFL)]
+ ^ T4[(int)((k07 >> 24) & 0xFFL)]
+ ^ T5[(int)((k06 >> 16) & 0xFFL)]
+ ^ T6[(int)((k05 >> 8) & 0xFFL)]
+ ^ T7[(int)( k04 & 0xFFL)];
+ Kr4 = T0[(int)((k04 >> 56) & 0xFFL)]
+ ^ T1[(int)((k03 >> 48) & 0xFFL)]
+ ^ T2[(int)((k02 >> 40) & 0xFFL)]
+ ^ T3[(int)((k01 >> 32) & 0xFFL)]
+ ^ T4[(int)((k00 >> 24) & 0xFFL)]
+ ^ T5[(int)((k07 >> 16) & 0xFFL)]
+ ^ T6[(int)((k06 >> 8) & 0xFFL)]
+ ^ T7[(int)( k05 & 0xFFL)];
+ Kr5 = T0[(int)((k05 >> 56) & 0xFFL)]
+ ^ T1[(int)((k04 >> 48) & 0xFFL)]
+ ^ T2[(int)((k03 >> 40) & 0xFFL)]
+ ^ T3[(int)((k02 >> 32) & 0xFFL)]
+ ^ T4[(int)((k01 >> 24) & 0xFFL)]
+ ^ T5[(int)((k00 >> 16) & 0xFFL)]
+ ^ T6[(int)((k07 >> 8) & 0xFFL)]
+ ^ T7[(int)( k06 & 0xFFL)];
+ Kr6 = T0[(int)((k06 >> 56) & 0xFFL)]
+ ^ T1[(int)((k05 >> 48) & 0xFFL)]
+ ^ T2[(int)((k04 >> 40) & 0xFFL)]
+ ^ T3[(int)((k03 >> 32) & 0xFFL)]
+ ^ T4[(int)((k02 >> 24) & 0xFFL)]
+ ^ T5[(int)((k01 >> 16) & 0xFFL)]
+ ^ T6[(int)((k00 >> 8) & 0xFFL)]
+ ^ T7[(int)( k07 & 0xFFL)];
+ Kr7 = T0[(int)((k07 >> 56) & 0xFFL)]
+ ^ T1[(int)((k06 >> 48) & 0xFFL)]
+ ^ T2[(int)((k05 >> 40) & 0xFFL)]
+ ^ T3[(int)((k04 >> 32) & 0xFFL)]
+ ^ T4[(int)((k03 >> 24) & 0xFFL)]
+ ^ T5[(int)((k02 >> 16) & 0xFFL)]
+ ^ T6[(int)((k01 >> 8) & 0xFFL)]
+ ^ T7[(int)( k00 & 0xFFL)];
k00 = Kr0;
k01 = Kr1;
@@ -466,54 +489,70 @@ public final class Whirlpool extends BaseHash
k07 = Kr7;
// 2. incrementally compute the cipher output
- w0 = T0[(int) ((nn0 >> 56) & 0xFFL)] ^ T1[(int) ((nn7 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn6 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn5 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn4 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn3 >> 16) & 0xFFL)] ^ T6[(int) ((nn2 >> 8) & 0xFFL)]
- ^ T7[(int) (nn1 & 0xFFL)] ^ Kr0;
- w1 = T0[(int) ((nn1 >> 56) & 0xFFL)] ^ T1[(int) ((nn0 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn7 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn6 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn5 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn4 >> 16) & 0xFFL)] ^ T6[(int) ((nn3 >> 8) & 0xFFL)]
- ^ T7[(int) (nn2 & 0xFFL)] ^ Kr1;
- w2 = T0[(int) ((nn2 >> 56) & 0xFFL)] ^ T1[(int) ((nn1 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn0 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn7 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn6 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn5 >> 16) & 0xFFL)] ^ T6[(int) ((nn4 >> 8) & 0xFFL)]
- ^ T7[(int) (nn3 & 0xFFL)] ^ Kr2;
- w3 = T0[(int) ((nn3 >> 56) & 0xFFL)] ^ T1[(int) ((nn2 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn1 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn0 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn7 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn6 >> 16) & 0xFFL)] ^ T6[(int) ((nn5 >> 8) & 0xFFL)]
- ^ T7[(int) (nn4 & 0xFFL)] ^ Kr3;
- w4 = T0[(int) ((nn4 >> 56) & 0xFFL)] ^ T1[(int) ((nn3 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn2 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn1 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn0 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn7 >> 16) & 0xFFL)] ^ T6[(int) ((nn6 >> 8) & 0xFFL)]
- ^ T7[(int) (nn5 & 0xFFL)] ^ Kr4;
- w5 = T0[(int) ((nn5 >> 56) & 0xFFL)] ^ T1[(int) ((nn4 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn3 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn2 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn1 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn0 >> 16) & 0xFFL)] ^ T6[(int) ((nn7 >> 8) & 0xFFL)]
- ^ T7[(int) (nn6 & 0xFFL)] ^ Kr5;
- w6 = T0[(int) ((nn6 >> 56) & 0xFFL)] ^ T1[(int) ((nn5 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn4 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn3 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn2 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn1 >> 16) & 0xFFL)] ^ T6[(int) ((nn0 >> 8) & 0xFFL)]
- ^ T7[(int) (nn7 & 0xFFL)] ^ Kr6;
- w7 = T0[(int) ((nn7 >> 56) & 0xFFL)] ^ T1[(int) ((nn6 >> 48) & 0xFFL)]
- ^ T2[(int) ((nn5 >> 40) & 0xFFL)]
- ^ T3[(int) ((nn4 >> 32) & 0xFFL)]
- ^ T4[(int) ((nn3 >> 24) & 0xFFL)]
- ^ T5[(int) ((nn2 >> 16) & 0xFFL)] ^ T6[(int) ((nn1 >> 8) & 0xFFL)]
- ^ T7[(int) (nn0 & 0xFFL)] ^ Kr7;
+ w0 = T0[(int)((nn0 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn7 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn6 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn5 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn4 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn3 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn2 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn1 & 0xFFL)] ^ Kr0;
+ w1 = T0[(int)((nn1 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn0 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn7 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn6 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn5 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn4 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn3 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn2 & 0xFFL)] ^ Kr1;
+ w2 = T0[(int)((nn2 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn1 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn0 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn7 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn6 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn5 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn4 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn3 & 0xFFL)] ^ Kr2;
+ w3 = T0[(int)((nn3 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn2 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn1 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn0 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn7 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn6 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn5 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn4 & 0xFFL)] ^ Kr3;
+ w4 = T0[(int)((nn4 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn3 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn2 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn1 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn0 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn7 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn6 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn5 & 0xFFL)] ^ Kr4;
+ w5 = T0[(int)((nn5 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn4 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn3 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn2 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn1 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn0 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn7 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn6 & 0xFFL)] ^ Kr5;
+ w6 = T0[(int)((nn6 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn5 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn4 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn3 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn2 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn1 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn0 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn7 & 0xFFL)] ^ Kr6;
+ w7 = T0[(int)((nn7 >> 56) & 0xFFL)]
+ ^ T1[(int)((nn6 >> 48) & 0xFFL)]
+ ^ T2[(int)((nn5 >> 40) & 0xFFL)]
+ ^ T3[(int)((nn4 >> 32) & 0xFFL)]
+ ^ T4[(int)((nn3 >> 24) & 0xFFL)]
+ ^ T5[(int)((nn2 >> 16) & 0xFFL)]
+ ^ T6[(int)((nn1 >> 8) & 0xFFL)]
+ ^ T7[(int)( nn0 & 0xFFL)] ^ Kr7;
nn0 = w0;
nn1 = w1;
@@ -547,7 +586,7 @@ public final class Whirlpool extends BaseHash
// are 33 (1 for the 1-bit followed by the 0-bits and the encoding of
// the count framed in a 256-bit block). our formula is then:
// count + 33 + padding = 0 (mod BLOCK_SIZE)
- int n = (int) ((count + 33) % BLOCK_SIZE);
+ int n = (int)((count + 33) % BLOCK_SIZE);
int padding = n == 0 ? 33 : BLOCK_SIZE - n + 33;
byte[] result = new byte[padding];
@@ -558,14 +597,14 @@ public final class Whirlpool extends BaseHash
// save (right justified) the number of bits hashed
long bits = count * 8;
int i = padding - 8;
- result[i++] = (byte) (bits >>> 56);
- result[i++] = (byte) (bits >>> 48);
- result[i++] = (byte) (bits >>> 40);
- result[i++] = (byte) (bits >>> 32);
- result[i++] = (byte) (bits >>> 24);
- result[i++] = (byte) (bits >>> 16);
- result[i++] = (byte) (bits >>> 8);
- result[i] = (byte) bits;
+ result[i++] = (byte)(bits >>> 56);
+ result[i++] = (byte)(bits >>> 48);
+ result[i++] = (byte)(bits >>> 40);
+ result[i++] = (byte)(bits >>> 32);
+ result[i++] = (byte)(bits >>> 24);
+ result[i++] = (byte)(bits >>> 16);
+ result[i++] = (byte)(bits >>> 8);
+ result[i ] = (byte) bits;
return result;
}
@@ -573,38 +612,24 @@ public final class Whirlpool extends BaseHash
protected byte[] getResult()
{
// apply inverse mu to the context
- byte[] result = new byte[] { (byte) (H0 >>> 56), (byte) (H0 >>> 48),
- (byte) (H0 >>> 40), (byte) (H0 >>> 32),
- (byte) (H0 >>> 24), (byte) (H0 >>> 16),
- (byte) (H0 >>> 8), (byte) H0,
- (byte) (H1 >>> 56), (byte) (H1 >>> 48),
- (byte) (H1 >>> 40), (byte) (H1 >>> 32),
- (byte) (H1 >>> 24), (byte) (H1 >>> 16),
- (byte) (H1 >>> 8), (byte) H1,
- (byte) (H2 >>> 56), (byte) (H2 >>> 48),
- (byte) (H2 >>> 40), (byte) (H2 >>> 32),
- (byte) (H2 >>> 24), (byte) (H2 >>> 16),
- (byte) (H2 >>> 8), (byte) H2,
- (byte) (H3 >>> 56), (byte) (H3 >>> 48),
- (byte) (H3 >>> 40), (byte) (H3 >>> 32),
- (byte) (H3 >>> 24), (byte) (H3 >>> 16),
- (byte) (H3 >>> 8), (byte) H3,
- (byte) (H4 >>> 56), (byte) (H4 >>> 48),
- (byte) (H4 >>> 40), (byte) (H4 >>> 32),
- (byte) (H4 >>> 24), (byte) (H4 >>> 16),
- (byte) (H4 >>> 8), (byte) H4,
- (byte) (H5 >>> 56), (byte) (H5 >>> 48),
- (byte) (H5 >>> 40), (byte) (H5 >>> 32),
- (byte) (H5 >>> 24), (byte) (H5 >>> 16),
- (byte) (H5 >>> 8), (byte) H5,
- (byte) (H6 >>> 56), (byte) (H6 >>> 48),
- (byte) (H6 >>> 40), (byte) (H6 >>> 32),
- (byte) (H6 >>> 24), (byte) (H6 >>> 16),
- (byte) (H6 >>> 8), (byte) H6,
- (byte) (H7 >>> 56), (byte) (H7 >>> 48),
- (byte) (H7 >>> 40), (byte) (H7 >>> 32),
- (byte) (H7 >>> 24), (byte) (H7 >>> 16),
- (byte) (H7 >>> 8), (byte) H7 };
+ byte[] result = new byte[] {
+ (byte)(H0 >>> 56), (byte)(H0 >>> 48), (byte)(H0 >>> 40), (byte)(H0 >>> 32),
+ (byte)(H0 >>> 24), (byte)(H0 >>> 16), (byte)(H0 >>> 8), (byte) H0,
+ (byte)(H1 >>> 56), (byte)(H1 >>> 48), (byte)(H1 >>> 40), (byte)(H1 >>> 32),
+ (byte)(H1 >>> 24), (byte)(H1 >>> 16), (byte)(H1 >>> 8), (byte) H1,
+ (byte)(H2 >>> 56), (byte)(H2 >>> 48), (byte)(H2 >>> 40), (byte)(H2 >>> 32),
+ (byte)(H2 >>> 24), (byte)(H2 >>> 16), (byte)(H2 >>> 8), (byte) H2,
+ (byte)(H3 >>> 56), (byte)(H3 >>> 48), (byte)(H3 >>> 40), (byte)(H3 >>> 32),
+ (byte)(H3 >>> 24), (byte)(H3 >>> 16), (byte)(H3 >>> 8), (byte) H3,
+ (byte)(H4 >>> 56), (byte)(H4 >>> 48), (byte)(H4 >>> 40), (byte)(H4 >>> 32),
+ (byte)(H4 >>> 24), (byte)(H4 >>> 16), (byte)(H4 >>> 8), (byte) H4,
+ (byte)(H5 >>> 56), (byte)(H5 >>> 48), (byte)(H5 >>> 40), (byte)(H5 >>> 32),
+ (byte)(H5 >>> 24), (byte)(H5 >>> 16), (byte)(H5 >>> 8), (byte) H5,
+ (byte)(H6 >>> 56), (byte)(H6 >>> 48), (byte)(H6 >>> 40), (byte)(H6 >>> 32),
+ (byte)(H6 >>> 24), (byte)(H6 >>> 16), (byte)(H6 >>> 8), (byte) H6,
+ (byte)(H7 >>> 56), (byte)(H7 >>> 48), (byte)(H7 >>> 40), (byte)(H7 >>> 32),
+ (byte)(H7 >>> 24), (byte)(H7 >>> 16), (byte)(H7 >>> 8), (byte) H7
+ };
return result;
}
@@ -617,10 +642,8 @@ public final class Whirlpool extends BaseHash
public boolean selfTest()
{
if (valid == null)
- {
- valid = new Boolean(
- DIGEST0.equals(Util.toString(new Whirlpool().digest())));
- }
+ valid = new Boolean(DIGEST0.equals(Util.toString(new Whirlpool().digest())));
+
return valid.booleanValue();
}
}
diff --git a/gnu/java/security/jce/hash/HavalSpi.java b/gnu/java/security/jce/hash/HavalSpi.java
index e127779ef..05595edea 100644
--- a/gnu/java/security/jce/hash/HavalSpi.java
+++ b/gnu/java/security/jce/hash/HavalSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the <code>HAVAL</code> <i>Service Provider Interface</i>
* (<b>SPI</b>) Adapter.<p>
- *
- * @version Revision: $
*/
public class HavalSpi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/MD2Spi.java b/gnu/java/security/jce/hash/MD2Spi.java
index 3fc382138..001cbaf3c 100644
--- a/gnu/java/security/jce/hash/MD2Spi.java
+++ b/gnu/java/security/jce/hash/MD2Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the MD2 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class MD2Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/MD4Spi.java b/gnu/java/security/jce/hash/MD4Spi.java
index 52ad9ea74..41fef87bf 100644
--- a/gnu/java/security/jce/hash/MD4Spi.java
+++ b/gnu/java/security/jce/hash/MD4Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the MD4 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class MD4Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/MD5Spi.java b/gnu/java/security/jce/hash/MD5Spi.java
index 39aee85c7..aa1a8844e 100644
--- a/gnu/java/security/jce/hash/MD5Spi.java
+++ b/gnu/java/security/jce/hash/MD5Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the MD5 <i>Service Provider Interface</i> (<b>SPI</b>)
* adapter.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class MD5Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/MessageDigestAdapter.java b/gnu/java/security/jce/hash/MessageDigestAdapter.java
index c804f5f00..e30beca3d 100644
--- a/gnu/java/security/jce/hash/MessageDigestAdapter.java
+++ b/gnu/java/security/jce/hash/MessageDigestAdapter.java
@@ -59,8 +59,6 @@ import java.security.MessageDigestSpi;
*
* All the implementations which subclass this object, and which are serviced by
* the GNU Crypto provider implement the {@link java.lang.Cloneable} interface.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
class MessageDigestAdapter extends MessageDigestSpi implements Cloneable
{
diff --git a/gnu/java/security/jce/hash/RipeMD128Spi.java b/gnu/java/security/jce/hash/RipeMD128Spi.java
index c5f45ea5b..404214d91 100644
--- a/gnu/java/security/jce/hash/RipeMD128Spi.java
+++ b/gnu/java/security/jce/hash/RipeMD128Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the RIPEMD-128 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class RipeMD128Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/RipeMD160Spi.java b/gnu/java/security/jce/hash/RipeMD160Spi.java
index 408a9b54d..841f46b3b 100644
--- a/gnu/java/security/jce/hash/RipeMD160Spi.java
+++ b/gnu/java/security/jce/hash/RipeMD160Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the RIPEMD-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class RipeMD160Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/Sha160Spi.java b/gnu/java/security/jce/hash/Sha160Spi.java
index 55075dee8..419884382 100644
--- a/gnu/java/security/jce/hash/Sha160Spi.java
+++ b/gnu/java/security/jce/hash/Sha160Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the SHA-1 (160-bit) <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class Sha160Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/Sha256Spi.java b/gnu/java/security/jce/hash/Sha256Spi.java
index 7bb321cde..f07e18941 100644
--- a/gnu/java/security/jce/hash/Sha256Spi.java
+++ b/gnu/java/security/jce/hash/Sha256Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the SHA-2-1 (256-bit) <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class Sha256Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/Sha384Spi.java b/gnu/java/security/jce/hash/Sha384Spi.java
index 2fd7ff4a9..fc17077e8 100644
--- a/gnu/java/security/jce/hash/Sha384Spi.java
+++ b/gnu/java/security/jce/hash/Sha384Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the SHA-2-2 (384-bit) <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class Sha384Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/Sha512Spi.java b/gnu/java/security/jce/hash/Sha512Spi.java
index 8b38a442b..0b4c3d62c 100644
--- a/gnu/java/security/jce/hash/Sha512Spi.java
+++ b/gnu/java/security/jce/hash/Sha512Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the SHA-2-3 (512-bit) <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class Sha512Spi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/TigerSpi.java b/gnu/java/security/jce/hash/TigerSpi.java
index fe0f8d67a..599437410 100644
--- a/gnu/java/security/jce/hash/TigerSpi.java
+++ b/gnu/java/security/jce/hash/TigerSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the Tiger <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class TigerSpi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/hash/WhirlpoolSpi.java b/gnu/java/security/jce/hash/WhirlpoolSpi.java
index d37464ef0..d1864bc7c 100644
--- a/gnu/java/security/jce/hash/WhirlpoolSpi.java
+++ b/gnu/java/security/jce/hash/WhirlpoolSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Whirlpool <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class WhirlpoolSpi extends MessageDigestAdapter
{
diff --git a/gnu/java/security/jce/prng/SecureRandomAdapter.java b/gnu/java/security/jce/prng/SecureRandomAdapter.java
index e7cb72091..70d30f153 100644
--- a/gnu/java/security/jce/prng/SecureRandomAdapter.java
+++ b/gnu/java/security/jce/prng/SecureRandomAdapter.java
@@ -42,7 +42,7 @@ import gnu.java.security.prng.LimitReachedException;
import gnu.java.security.prng.MDGenerator;
import java.security.SecureRandomSpi;
-import java.util.HashMap;
+import java.util.Collections;
/**
* <p>The implementation of a generic {@link java.security.SecureRandom} adapter
@@ -80,6 +80,7 @@ abstract class SecureRandomAdapter extends SecureRandomSpi
super();
this.mdName = mdName;
+ adaptee.init (Collections.singletonMap (MDGenerator.MD_NAME, mdName));
}
// Class methods
@@ -118,9 +119,6 @@ abstract class SecureRandomAdapter extends SecureRandomSpi
public void engineSetSeed(byte[] seed)
{
- HashMap attributes = new HashMap();
- attributes.put(MDGenerator.MD_NAME, mdName);
- attributes.put(MDGenerator.SEEED, seed);
- adaptee.init(attributes);
+ adaptee.addRandomBytes (seed);
}
}
diff --git a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java
index 49a64afbd..44503b26b 100644
--- a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java
+++ b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java
@@ -57,8 +57,6 @@ import java.util.HashMap;
* In case the client does not explicitly initialize the KeyPairGenerator (via
* a call to an <code>initialize()</code> method), the GNU Crypto provider
* uses a default <i>modulus</i> size (keysize) of 1024 bits.<p>
- *
- * @version $Revision: 1.3.2.1 $
*/
public class DSSKeyPairGeneratorSpi extends KeyPairGeneratorAdapter implements
DSAKeyPairGenerator
diff --git a/gnu/java/security/jce/sig/DSSRawSignatureSpi.java b/gnu/java/security/jce/sig/DSSRawSignatureSpi.java
index 5573b39f3..a63c51afa 100644
--- a/gnu/java/security/jce/sig/DSSRawSignatureSpi.java
+++ b/gnu/java/security/jce/sig/DSSRawSignatureSpi.java
@@ -45,8 +45,6 @@ import gnu.java.security.sig.dss.DSSSignatureRawCodec;
* The implementation of <i>Service Provider Interface</i> (<b>SPI</b>) adapter
* for the DSS (Digital Signature Standard) signature scheme, encoded and/or
* decoded in RAW format.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class DSSRawSignatureSpi extends SignatureAdapter
{
diff --git a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java
index 29a10ecf9..edf19f627 100644
--- a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java
+++ b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java
@@ -63,8 +63,6 @@ import java.security.spec.AlgorithmParameterSpec;
* supplies (and document) default values to be used. For example, the GNU
* Crypto provider uses a default <i>modulus</i> size (keysize) of 1024 bits for
* the DSS (Digital Signature Standard) a.k.a <i>DSA</i>.<p>
- *
- * @version $Revision: 1.3.2.1 $
*/
public abstract class KeyPairGeneratorAdapter extends KeyPairGenerator
{
diff --git a/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java b/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java
index d2e15f819..f3548d884 100644
--- a/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java
+++ b/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java
@@ -44,8 +44,6 @@ import gnu.java.security.sig.rsa.RSAPSSSignatureRawCodec;
/**
* The implementation of <i>Service Provider Interface</i> (<b>SPI</b>) adapter
* for the RSA-PSS signature scheme, encoded and/or decoded in RAW format.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class RSAPSSRawSignatureSpi extends SignatureAdapter
{
diff --git a/gnu/java/security/key/IKeyPairCodec.java b/gnu/java/security/key/IKeyPairCodec.java
index 4a234173f..965a317d4 100644
--- a/gnu/java/security/key/IKeyPairCodec.java
+++ b/gnu/java/security/key/IKeyPairCodec.java
@@ -48,8 +48,6 @@ import java.security.PublicKey;
* cryptographic asymmetric keypairs. Codecs are useful for (a) externalising
* public and private keys for storage and on-the-wire transmission, as well as
* (b) re-creating their internal Java representation from external sources.</p>
- *
- * @version $Revision: 1.2.2.1 $
*/
public interface IKeyPairCodec
{
diff --git a/gnu/java/security/key/IKeyPairGenerator.java b/gnu/java/security/key/IKeyPairGenerator.java
index 8287ec607..2e0b29928 100644
--- a/gnu/java/security/key/IKeyPairGenerator.java
+++ b/gnu/java/security/key/IKeyPairGenerator.java
@@ -43,8 +43,6 @@ import java.util.Map;
/**
* The visible methods of every asymmetric keypair generator.<p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public interface IKeyPairGenerator
{
diff --git a/gnu/java/security/key/KeyPairGeneratorFactory.java b/gnu/java/security/key/KeyPairGeneratorFactory.java
index 2121489ca..8c2f348c9 100644
--- a/gnu/java/security/key/KeyPairGeneratorFactory.java
+++ b/gnu/java/security/key/KeyPairGeneratorFactory.java
@@ -49,8 +49,6 @@ import java.util.Set;
/**
* <p>A Factory to instantiate asymmetric keypair generators.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class KeyPairGeneratorFactory
{
@@ -87,7 +85,7 @@ public class KeyPairGeneratorFactory
name = name.trim();
IKeyPairGenerator result = null;
if (name.equalsIgnoreCase(Registry.DSA_KPG)
- || name.equals(Registry.DSS_KPG))
+ || name.equalsIgnoreCase(Registry.DSS_KPG))
{
result = new DSSKeyPairGenerator();
}
@@ -118,6 +116,7 @@ public class KeyPairGeneratorFactory
{
HashSet hs = new HashSet();
hs.add(Registry.DSS_KPG);
+ hs.add(Registry.DSA_KPG);
hs.add(Registry.RSA_KPG);
hs.add(Registry.DH_KPG);
hs.add(Registry.SRP_KPG);
@@ -135,11 +134,9 @@ public class KeyPairGeneratorFactory
}
catch (Exception x)
{
- IllegalArgumentException iae =
- new IllegalArgumentException ("strong crypto key pair generator not available: "
- + clazz);
- iae.initCause (x);
- throw iae;
+ throw new IllegalArgumentException(
+ "strong crypto key pair generator not available: " + clazz,
+ x);
}
}
diff --git a/gnu/java/security/key/dss/DSSKey.java b/gnu/java/security/key/dss/DSSKey.java
index c406607d2..c4d3847a5 100644
--- a/gnu/java/security/key/dss/DSSKey.java
+++ b/gnu/java/security/key/dss/DSSKey.java
@@ -60,7 +60,6 @@ import java.security.spec.DSAParameterSpec;
* the relevant <code>getEncoded()</code> methods of each of the private and
* public keys.</p>
*
- * @version $Revision: 1.4.2.2 $
* @see DSSPrivateKey#getEncoded
* @see DSSPublicKey#getEncoded
*/
diff --git a/gnu/java/security/key/dss/DSSKeyPairRawCodec.java b/gnu/java/security/key/dss/DSSKeyPairRawCodec.java
index 1d4a0a7d7..7c5491d6f 100644
--- a/gnu/java/security/key/dss/DSSKeyPairRawCodec.java
+++ b/gnu/java/security/key/dss/DSSKeyPairRawCodec.java
@@ -49,8 +49,6 @@ import java.security.PublicKey;
/**
* <p>An object that implements the {@link IKeyPairCodec} operations for the
* <i>Raw</i> format to use with DSS keypairs.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class DSSKeyPairRawCodec implements IKeyPairCodec
{
diff --git a/gnu/java/security/key/dss/DSSPrivateKey.java b/gnu/java/security/key/dss/DSSPrivateKey.java
index 786fc47b9..fe59cb6d7 100644
--- a/gnu/java/security/key/dss/DSSPrivateKey.java
+++ b/gnu/java/security/key/dss/DSSPrivateKey.java
@@ -49,12 +49,10 @@ import java.security.interfaces.DSAPrivateKey;
/**
* <p>An object that embodies a DSS (Digital Signature Standard) private key.</p>
*
- * @version $Revision: 1.2.2.2 $
* @see #getEncoded
*/
public class DSSPrivateKey extends DSSKey implements PrivateKey, DSAPrivateKey
{
-
// Constants and variables
// -------------------------------------------------------------------------
diff --git a/gnu/java/security/key/dss/DSSPublicKey.java b/gnu/java/security/key/dss/DSSPublicKey.java
index 34e726280..522921313 100644
--- a/gnu/java/security/key/dss/DSSPublicKey.java
+++ b/gnu/java/security/key/dss/DSSPublicKey.java
@@ -49,12 +49,10 @@ import java.security.interfaces.DSAPublicKey;
/**
* <p>An object that embodies a DSS (Digital Signature Standard) public key.</p>
*
- * @version $Revision: 1.2.2.2 $
* @see #getEncoded
*/
public class DSSPublicKey extends DSSKey implements PublicKey, DSAPublicKey
{
-
// Constants and variables
// -------------------------------------------------------------------------
diff --git a/gnu/java/security/key/dss/FIPS186.java b/gnu/java/security/key/dss/FIPS186.java
index 6b351d229..5984bcc93 100644
--- a/gnu/java/security/key/dss/FIPS186.java
+++ b/gnu/java/security/key/dss/FIPS186.java
@@ -53,8 +53,6 @@ import java.security.SecureRandom;
* <a href="http://www.itl.nist.gov/fipspubs/fip186.htm">Digital Signature
* Standard (DSS)</a>, Federal Information Processing Standards Publication 186.
* National Institute of Standards and Technology.
- *
- * @version $Revision: 1.2.2.1 $
*/
public class FIPS186
{
diff --git a/gnu/java/security/key/rsa/GnuRSAKey.java b/gnu/java/security/key/rsa/GnuRSAKey.java
index 7846323f6..098d372dc 100644
--- a/gnu/java/security/key/rsa/GnuRSAKey.java
+++ b/gnu/java/security/key/rsa/GnuRSAKey.java
@@ -48,8 +48,6 @@ import java.security.interfaces.RSAKey;
/**
* <p>A base asbtract class for both public and private RSA keys.</p>
- *
- * @version $Revision: 1.3.2.1 $
*/
public abstract class GnuRSAKey implements Key, RSAKey
{
diff --git a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java
index b3b94d8e2..7d3144bcd 100644
--- a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java
+++ b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java
@@ -56,8 +56,6 @@ import java.security.interfaces.RSAPrivateKey;
* Primitive specification and supporting documentation.<br>
* Jakob Jonsson and Burt Kaliski.</li>
* </ol>
- *
- * @version $Revision: 1.3.2.1 $
*/
public class GnuRSAPrivateKey extends GnuRSAKey implements PrivateKey,
RSAPrivateCrtKey
diff --git a/gnu/java/security/key/rsa/GnuRSAPublicKey.java b/gnu/java/security/key/rsa/GnuRSAPublicKey.java
index 4c8ca597d..bb5d0a49f 100644
--- a/gnu/java/security/key/rsa/GnuRSAPublicKey.java
+++ b/gnu/java/security/key/rsa/GnuRSAPublicKey.java
@@ -55,8 +55,6 @@ import java.security.interfaces.RSAPublicKey;
* Primitive specification and supporting documentation.<br>
* Jakob Jonsson and Burt Kaliski.</li>
* </ol>
- *
- * @version $Revision: 1.2.2.1 $
*/
public class GnuRSAPublicKey extends GnuRSAKey implements PublicKey,
RSAPublicKey
diff --git a/gnu/java/security/prng/MDGenerator.java b/gnu/java/security/prng/MDGenerator.java
index 255647d1c..073c559ae 100644
--- a/gnu/java/security/prng/MDGenerator.java
+++ b/gnu/java/security/prng/MDGenerator.java
@@ -122,6 +122,20 @@ public class MDGenerator extends BasePRNG implements Cloneable
md.update(buffer, 0, buffer.length);
}
+ public void addRandomByte (final byte b)
+ {
+ if (md == null)
+ throw new IllegalStateException ("not initialized");
+ md.update (b);
+ }
+
+ public void addRandomBytes (final byte[] buf, final int off, final int len)
+ {
+ if (md == null)
+ throw new IllegalStateException ("not initialized");
+ md.update (buf, off, len);
+ }
+
// Cloneable interface implementation ---------------------------------------
public Object clone() throws CloneNotSupportedException
diff --git a/gnu/java/security/sig/ISignature.java b/gnu/java/security/sig/ISignature.java
index 118b7701a..e77f39d2c 100644
--- a/gnu/java/security/sig/ISignature.java
+++ b/gnu/java/security/sig/ISignature.java
@@ -56,8 +56,6 @@ import java.util.Map;
* Cryptography</a>, Alfred J. Menezes, Paul C. van Oorschot and Scott A.
* Vanstone. Section 11.2.2 Digital signature schemes with appendix.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public interface ISignature extends Cloneable
{
diff --git a/gnu/java/security/sig/ISignatureCodec.java b/gnu/java/security/sig/ISignatureCodec.java
index 86d190944..b6ab0ba9b 100644
--- a/gnu/java/security/sig/ISignatureCodec.java
+++ b/gnu/java/security/sig/ISignatureCodec.java
@@ -45,8 +45,6 @@ import gnu.java.security.Registry;
* cryptographic signatures. Codecs are useful for (a) externalising signature
* output data for storage and on-the-wire transmission, as well as (b) re-
* creating their internal Java representation from external sources.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public interface ISignatureCodec
{
diff --git a/gnu/java/security/sig/dss/DSSSignature.java b/gnu/java/security/sig/dss/DSSSignature.java
index dd4087316..370a93854 100644
--- a/gnu/java/security/sig/dss/DSSSignature.java
+++ b/gnu/java/security/sig/dss/DSSSignature.java
@@ -111,8 +111,6 @@ import java.util.Random;
* Signature Standard (DSS)</a>, Federal Information Processing Standards
* Publication 186. National Institute of Standards and Technology.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class DSSSignature extends BaseSignature
{
diff --git a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
index fa25c9201..b0590a573 100644
--- a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
+++ b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
@@ -47,8 +47,6 @@ import java.math.BigInteger;
/**
* <p>An object that implements the {@link ISignatureCodec} operations for the
* <i>Raw</i> format to use with DSS signatures.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class DSSSignatureRawCodec implements ISignatureCodec
{
diff --git a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
index 27ab5d493..d155fc88f 100644
--- a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
+++ b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
@@ -57,8 +57,6 @@ import java.io.ByteArrayOutputStream;
* RSA Cryptography Specifications Version 2.1.<br>
* Jakob Jonsson and Burt Kaliski.</li>
* </ol>
- *
- * @version $Revision: 1.2.2.1 $
*/
public class EMSA_PKCS1_V1_5 implements Cloneable
{
diff --git a/gnu/java/security/sig/rsa/EMSA_PSS.java b/gnu/java/security/sig/rsa/EMSA_PSS.java
index 845b6ab56..c1c9760ed 100644
--- a/gnu/java/security/sig/rsa/EMSA_PSS.java
+++ b/gnu/java/security/sig/rsa/EMSA_PSS.java
@@ -67,8 +67,6 @@ import java.util.Arrays;
* Primitive specification and supporting documentation.<br>
* Jakob Jonsson and Burt Kaliski.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class EMSA_PSS implements Cloneable
{
diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
index 38cdf2934..e64d30b69 100644
--- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
+++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
@@ -67,8 +67,6 @@ import java.util.Arrays;
* RSA Cryptography Specifications Version 2.1.<br>
* Jakob Jonsson and Burt Kaliski.</li>
* </ol>
- *
- * @version $Revision: 1.2.2.1 $
*/
public class RSAPKCS1V1_5Signature extends BaseSignature
{
diff --git a/gnu/java/security/sig/rsa/RSAPSSSignature.java b/gnu/java/security/sig/rsa/RSAPSSSignature.java
index cbf66c958..7ec62568a 100644
--- a/gnu/java/security/sig/rsa/RSAPSSSignature.java
+++ b/gnu/java/security/sig/rsa/RSAPSSSignature.java
@@ -70,8 +70,6 @@ import java.security.interfaces.RSAPublicKey;
* Primitive specification and supporting documentation.<br>
* Jakob Jonsson and Burt Kaliski.</li>
* </ol>
- *
- * @version $Revision: 1.2.2.1 $
*/
public class RSAPSSSignature extends BaseSignature
{
diff --git a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
index 16e70c69e..2be79165f 100644
--- a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
+++ b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
@@ -46,8 +46,6 @@ import java.io.ByteArrayOutputStream;
/**
* <p>An object that implements the {@link gnu.crypto.sig.ISignatureCodec}
* operations for the <i>Raw</i> format to use with RSA-PSS signatures.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class RSAPSSSignatureRawCodec implements ISignatureCodec
{
diff --git a/gnu/java/security/util/Util.java b/gnu/java/security/util/Util.java
index 7eb308e2d..f39afb931 100644
--- a/gnu/java/security/util/Util.java
+++ b/gnu/java/security/util/Util.java
@@ -42,8 +42,6 @@ import java.math.BigInteger;
/**
* <p>A collection of utility methods used throughout this project.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class Util
{
diff --git a/gnu/java/util/jar/JarUtils.java b/gnu/java/util/jar/JarUtils.java
index bf40dbef6..c35daec55 100644
--- a/gnu/java/util/jar/JarUtils.java
+++ b/gnu/java/util/jar/JarUtils.java
@@ -67,6 +67,18 @@ public abstract class JarUtils
public static final String DSA_SUFFIX = ".DSA";
public static final String SF_SUFFIX = ".SF";
public static final String NAME = "Name";
+
+ /**
+ * The original string representation of the manifest version attribute name.
+ */
+ public static final String MANIFEST_VERSION = "Manifest-Version";
+
+ /**
+ * The original string representation of the signature version attribute
+ * name.
+ */
+ public static final String SIGNATURE_VERSION = "Signature-Version";
+
/** Platform-independent line-ending. */
public static final byte[] CRLF = new byte[] { 0x0D, 0x0A };
private static final String DEFAULT_MF_VERSION = "1.0";
@@ -99,7 +111,7 @@ public abstract class JarUtils
try
{
String version = expectHeader(version_header, br);
- attr.putValue(Name.SIGNATURE_VERSION, version);
+ attr.putValue(SIGNATURE_VERSION, version);
if (! DEFAULT_SF_VERSION.equals(version))
log.warning("Unexpected version number: " + version
+ ". Continue (but may fail later)");
@@ -130,7 +142,7 @@ public abstract class JarUtils
// attributes of Manifest.
// XXX (rsn): why 0.0 and not 1.0?
if (attr.getValue(Name.MANIFEST_VERSION) == null)
- attr.putValue(Name.MANIFEST_VERSION, "0.0");
+ attr.putValue(MANIFEST_VERSION, "0.0");
}
private static void readIndividualSections(Map entries, BufferedReader br)
@@ -157,7 +169,7 @@ public abstract class JarUtils
try
{
String value = expectHeader(version_header, br);
- attr.putValue(Name.MANIFEST_VERSION, value);
+ attr.putValue(MANIFEST_VERSION, value);
}
catch (IOException ioe)
{
diff --git a/gnu/javax/crypto/assembly/Assembly.java b/gnu/javax/crypto/assembly/Assembly.java
index 56bc5003b..2d5bba364 100644
--- a/gnu/javax/crypto/assembly/Assembly.java
+++ b/gnu/javax/crypto/assembly/Assembly.java
@@ -51,7 +51,6 @@ import java.util.Map;
* of the {@link Transformer} chain of the <code>Assembly</code>.</p>
*
* @see Transformer
- * @version $Revision: 1.1.4.1 $
*/
public class Assembly
{
diff --git a/gnu/javax/crypto/assembly/Cascade.java b/gnu/javax/crypto/assembly/Cascade.java
index 313532d2e..678a7e730 100644
--- a/gnu/javax/crypto/assembly/Cascade.java
+++ b/gnu/javax/crypto/assembly/Cascade.java
@@ -72,8 +72,6 @@ import java.util.Set;
* CRC Press, Inc. ISBN 0-8493-8523-7, 1997<br>
* Menezes, A., van Oorschot, P. and S. Vanstone.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class Cascade
{
diff --git a/gnu/javax/crypto/assembly/CascadeStage.java b/gnu/javax/crypto/assembly/CascadeStage.java
index ba1123713..81629f5a8 100644
--- a/gnu/javax/crypto/assembly/CascadeStage.java
+++ b/gnu/javax/crypto/assembly/CascadeStage.java
@@ -45,8 +45,6 @@ import java.util.Set;
/**
* <p>A Cascade <i>Stage</i> in a Cascade Cipher.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
class CascadeStage extends Stage
{
diff --git a/gnu/javax/crypto/assembly/CascadeTransformer.java b/gnu/javax/crypto/assembly/CascadeTransformer.java
index 828bda343..dbbc7cd28 100644
--- a/gnu/javax/crypto/assembly/CascadeTransformer.java
+++ b/gnu/javax/crypto/assembly/CascadeTransformer.java
@@ -44,8 +44,6 @@ import java.util.Map;
/**
* An Adapter to use any {@link Cascade} as a {@link Transformer} in an
* {@link Assembly}.
- *
- * @version $Revision: 1.1.4.1 $
*/
class CascadeTransformer extends Transformer
{
diff --git a/gnu/javax/crypto/assembly/Direction.java b/gnu/javax/crypto/assembly/Direction.java
index eea026d3e..58b59a630 100644
--- a/gnu/javax/crypto/assembly/Direction.java
+++ b/gnu/javax/crypto/assembly/Direction.java
@@ -49,8 +49,6 @@ package gnu.javax.crypto.assembly;
* its inverse value</li>
* <li>REVERSED: equivalent to {@link gnu.crypto.mode.IMode#DECRYPTION}.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class Direction
{
diff --git a/gnu/javax/crypto/assembly/LoopbackTransformer.java b/gnu/javax/crypto/assembly/LoopbackTransformer.java
index 546b5f86f..3c0bdfab3 100644
--- a/gnu/javax/crypto/assembly/LoopbackTransformer.java
+++ b/gnu/javax/crypto/assembly/LoopbackTransformer.java
@@ -43,8 +43,6 @@ import java.util.Map;
/**
* A trivial {@link Transformer} to allow closing a chain in an {@link Assembly}.
* This class is not visible outside this package.
- *
- * @version $Revision: 1.1.4.1 $
*/
final class LoopbackTransformer extends Transformer
{
diff --git a/gnu/javax/crypto/assembly/ModeStage.java b/gnu/javax/crypto/assembly/ModeStage.java
index 09029a8d8..1143348f6 100644
--- a/gnu/javax/crypto/assembly/ModeStage.java
+++ b/gnu/javax/crypto/assembly/ModeStage.java
@@ -53,8 +53,6 @@ import java.util.Set;
* <p>Such a stage wraps an implementation of a Block Cipher Mode of Operation
* ({@link IMode}) to allow inclusion of such an instance in a cascade of block
* ciphers.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
class ModeStage extends Stage
{
diff --git a/gnu/javax/crypto/assembly/Operation.java b/gnu/javax/crypto/assembly/Operation.java
index 209a9786e..34cae52ea 100644
--- a/gnu/javax/crypto/assembly/Operation.java
+++ b/gnu/javax/crypto/assembly/Operation.java
@@ -51,8 +51,6 @@ package gnu.javax.crypto.assembly;
* the chain, and the resulting bytes are then processed by the current
* {@link Transformer}.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class Operation
{
diff --git a/gnu/javax/crypto/assembly/PaddingTransformer.java b/gnu/javax/crypto/assembly/PaddingTransformer.java
index 5ac27548d..c63f92e87 100644
--- a/gnu/javax/crypto/assembly/PaddingTransformer.java
+++ b/gnu/javax/crypto/assembly/PaddingTransformer.java
@@ -50,8 +50,6 @@ import java.util.Map;
* <p>When using such a {@link Transformer}, in an {@link Assembly}, there must
* be at least one element behind this instance in the constructed chain;
* otherwise, a {@link TransformerException} is thrown at initialisation time.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
class PaddingTransformer extends Transformer
{
diff --git a/gnu/javax/crypto/assembly/Stage.java b/gnu/javax/crypto/assembly/Stage.java
index 41fbb4f88..23d50bb82 100644
--- a/gnu/javax/crypto/assembly/Stage.java
+++ b/gnu/javax/crypto/assembly/Stage.java
@@ -82,7 +82,6 @@ import java.util.Set;
*
* @see ModeStage
* @see CascadeStage
- * @version $Revision: 1.1.4.1 $
*/
public abstract class Stage
{
diff --git a/gnu/javax/crypto/assembly/Transformer.java b/gnu/javax/crypto/assembly/Transformer.java
index 3e8bced31..80430dc19 100644
--- a/gnu/javax/crypto/assembly/Transformer.java
+++ b/gnu/javax/crypto/assembly/Transformer.java
@@ -77,7 +77,6 @@ import java.util.Map;
* @see CascadeTransformer
* @see PaddingTransformer
* @see DeflateTransformer
- * @version $Revision: 1.1.4.1 $
*/
public abstract class Transformer
{
diff --git a/gnu/javax/crypto/cipher/Square.java b/gnu/javax/crypto/cipher/Square.java
index 55e986526..97773e5ea 100644
--- a/gnu/javax/crypto/cipher/Square.java
+++ b/gnu/javax/crypto/cipher/Square.java
@@ -59,8 +59,6 @@ import java.util.Iterator;
* <a href="mailto:lars.knudsen@esat.kuleuven.ac.be">Lars Knudsen</a> and
* <a href="mailto:vincent.rijmen@esat.kuleuven.ac.be">Vincent Rijmen</a>.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class Square extends BaseCipher
{
@@ -517,4 +515,4 @@ public final class Square extends BaseCipher
}
return valid.booleanValue();
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/AESSpi.java b/gnu/javax/crypto/jce/cipher/AESSpi.java
index 541868c50..33de68956 100644
--- a/gnu/javax/crypto/jce/cipher/AESSpi.java
+++ b/gnu/javax/crypto/jce/cipher/AESSpi.java
@@ -52,8 +52,6 @@ import java.security.spec.InvalidParameterSpecException;
/**
* The implementation of the AES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class AESSpi extends CipherAdapter
{
@@ -101,4 +99,4 @@ public final class AESSpi extends CipherAdapter
}
engineInit(opmode, key, spec, random);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/ARCFourSpi.java b/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
index 7f2c9aeee..963fa1c00 100644
--- a/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
+++ b/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
@@ -64,8 +64,6 @@ import javax.crypto.ShortBufferException;
/**
* The <i>Service Provider Interface</i> (<b>SPI</b>) for the ARCFOUR
* stream cipher.
- *
- * @version $Revision: 1.1.4.1 $
*/
public class ARCFourSpi extends CipherSpi
{
@@ -205,4 +203,4 @@ public class ARCFourSpi extends CipherSpi
{
return engineUpdate(in, inOffset, length, out, outOffset);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/AnubisSpi.java b/gnu/javax/crypto/jce/cipher/AnubisSpi.java
index 732993736..0fca3b491 100644
--- a/gnu/javax/crypto/jce/cipher/AnubisSpi.java
+++ b/gnu/javax/crypto/jce/cipher/AnubisSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Anubis <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class AnubisSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class AnubisSpi extends CipherAdapter
{
super(Registry.ANUBIS_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/BlowfishSpi.java b/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
index 9c8ef0547..d31d7e193 100644
--- a/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
+++ b/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Blowfish <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class BlowfishSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class BlowfishSpi extends CipherAdapter
{
super(Registry.BLOWFISH_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/CipherAdapter.java b/gnu/javax/crypto/jce/cipher/CipherAdapter.java
index 96d7741dd..5eaa31b77 100644
--- a/gnu/javax/crypto/jce/cipher/CipherAdapter.java
+++ b/gnu/javax/crypto/jce/cipher/CipherAdapter.java
@@ -82,8 +82,6 @@ import javax.crypto.spec.IvParameterSpec;
* and the initialization vector, the subclass should override those methods.
* Otherwise a subclass need only call the {@link #CipherAdapter(String)}
* constructor with the name of the cipher.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
class CipherAdapter extends CipherSpi
{
@@ -504,4 +502,4 @@ class CipherAdapter extends CipherSpi
partBlock = new byte[blockLen];
partLen = 0;
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/DESSpi.java b/gnu/javax/crypto/jce/cipher/DESSpi.java
index 801b2f138..ff86071c4 100644
--- a/gnu/javax/crypto/jce/cipher/DESSpi.java
+++ b/gnu/javax/crypto/jce/cipher/DESSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the DES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class DESSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class DESSpi extends CipherAdapter
{
super(Registry.DES_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/KhazadSpi.java b/gnu/javax/crypto/jce/cipher/KhazadSpi.java
index 93c4ce37b..397c27d2e 100644
--- a/gnu/javax/crypto/jce/cipher/KhazadSpi.java
+++ b/gnu/javax/crypto/jce/cipher/KhazadSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Khazad <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class KhazadSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class KhazadSpi extends CipherAdapter
{
super(Registry.KHAZAD_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/NullCipherSpi.java b/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
index 596edee63..e6d78ef39 100644
--- a/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
+++ b/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Null cipher <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class NullCipherSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class NullCipherSpi extends CipherAdapter
{
super(Registry.NULL_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/PBES2.java b/gnu/javax/crypto/jce/cipher/PBES2.java
index 0efb61e45..9889ab9fc 100644
--- a/gnu/javax/crypto/jce/cipher/PBES2.java
+++ b/gnu/javax/crypto/jce/cipher/PBES2.java
@@ -56,8 +56,6 @@ import javax.crypto.spec.SecretKeySpec;
/**
* <p>.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public abstract class PBES2 extends CipherAdapter
{
@@ -1349,4 +1347,4 @@ public abstract class PBES2 extends CipherAdapter
}
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/RijndaelSpi.java b/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
index 0094b2a73..137db2c3f 100644
--- a/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
+++ b/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Rijndael <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class RijndaelSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class RijndaelSpi extends CipherAdapter
{
super(Registry.RIJNDAEL_CIPHER, 16);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/SerpentSpi.java b/gnu/javax/crypto/jce/cipher/SerpentSpi.java
index ec2e591fe..9df9685cc 100644
--- a/gnu/javax/crypto/jce/cipher/SerpentSpi.java
+++ b/gnu/javax/crypto/jce/cipher/SerpentSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Serpent <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class SerpentSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class SerpentSpi extends CipherAdapter
{
super(Registry.SERPENT_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/SquareSpi.java b/gnu/javax/crypto/jce/cipher/SquareSpi.java
index c162d1616..96e5dee38 100644
--- a/gnu/javax/crypto/jce/cipher/SquareSpi.java
+++ b/gnu/javax/crypto/jce/cipher/SquareSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Square <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class SquareSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class SquareSpi extends CipherAdapter
{
super(Registry.SQUARE_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/TripleDESSpi.java b/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
index 9ff9df97e..5c58ea551 100644
--- a/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
+++ b/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Triple-DES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class TripleDESSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class TripleDESSpi extends CipherAdapter
{
super(Registry.TRIPLEDES_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/TwofishSpi.java b/gnu/javax/crypto/jce/cipher/TwofishSpi.java
index 3a75a9858..31df5ea40 100644
--- a/gnu/javax/crypto/jce/cipher/TwofishSpi.java
+++ b/gnu/javax/crypto/jce/cipher/TwofishSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Twofish <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class TwofishSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class TwofishSpi extends CipherAdapter
{
super(Registry.TWOFISH_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacMD2Spi.java b/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
index 343556db4..dd489639f 100644
--- a/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-MD2 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacMD2Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacMD2Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD2_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacMD4Spi.java b/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
index d00e257d4..6fadf0262 100644
--- a/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-MD4 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacMD4Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacMD4Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD4_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacMD5Spi.java b/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
index fdf2ebf69..2ef43974f 100644
--- a/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-MD5 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacMD5Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacMD5Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD5_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java b/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
index 1fcd0f2bc..ad7a2340e 100644
--- a/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-RIPEMD-128 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacRipeMD128Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacRipeMD128Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD128_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java b/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
index 56854c214..c14e3b3bf 100644
--- a/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-RIPEMD-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacRipeMD160Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacRipeMD160Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD160_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
index 8594e03f4..f102c9ebc 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-SHA-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacSHA160Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacSHA160Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.SHA160_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
index 4e147407d..cadad1cf5 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
@@ -42,8 +42,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the HMAC-SHA-256 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacSHA256Spi extends MacAdapter
{
@@ -64,4 +62,4 @@ public final class HMacSHA256Spi extends MacAdapter
// Instance methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
index e909e9896..69ef38e50 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
@@ -42,8 +42,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the HMAC-SHA-384 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class HMacSHA384Spi extends MacAdapter
{
@@ -64,4 +62,4 @@ public class HMacSHA384Spi extends MacAdapter
// Instance methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
index 8c4c041bb..abceb4a92 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
@@ -42,8 +42,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the HMAC-SHA-512 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class HMacSHA512Spi extends MacAdapter
{
@@ -64,4 +62,4 @@ public class HMacSHA512Spi extends MacAdapter
// Instance methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacTigerSpi.java b/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
index a42af05b7..511993ea4 100644
--- a/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
+++ b/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Tiger <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacTigerSpi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacTigerSpi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.TIGER_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java b/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
index 06ca3445c..706e0cd5a 100644
--- a/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
+++ b/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-Whirlpool <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class HMacWhirlpoolSpi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacWhirlpoolSpi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.WHIRLPOOL_HASH);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/MacAdapter.java b/gnu/javax/crypto/jce/mac/MacAdapter.java
index 073959a4e..dc019ca20 100644
--- a/gnu/javax/crypto/jce/mac/MacAdapter.java
+++ b/gnu/javax/crypto/jce/mac/MacAdapter.java
@@ -57,8 +57,6 @@ import javax.crypto.MacSpi;
* the {@link javax.crypto.Mac} class, which provides the functionality of a
* message authentication code algorithm, such as the <i>Hashed Message
* Authentication Code</i> (<b>HMAC</b>) algorithms.</p>
- *
- * @version $Revision: 1.2.4.1 $
*/
class MacAdapter extends MacSpi implements Cloneable
{
@@ -153,4 +151,4 @@ class MacAdapter extends MacSpi implements Cloneable
{
mac.update(in, off, len);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/TMMH16Spi.java b/gnu/javax/crypto/jce/mac/TMMH16Spi.java
index defd70c67..1734e1e69 100644
--- a/gnu/javax/crypto/jce/mac/TMMH16Spi.java
+++ b/gnu/javax/crypto/jce/mac/TMMH16Spi.java
@@ -50,8 +50,6 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* The implementation of the TMMH16 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class TMMH16Spi extends MacAdapter
{
@@ -88,4 +86,4 @@ public final class TMMH16Spi extends MacAdapter
throw new InvalidAlgorithmParameterException(iae.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/UHash32Spi.java b/gnu/javax/crypto/jce/mac/UHash32Spi.java
index bd68c5291..af678c0fa 100644
--- a/gnu/javax/crypto/jce/mac/UHash32Spi.java
+++ b/gnu/javax/crypto/jce/mac/UHash32Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the UHash-32 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class UHash32Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class UHash32Spi extends MacAdapter
{
super(Registry.UHASH32);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/UMac32Spi.java b/gnu/javax/crypto/jce/mac/UMac32Spi.java
index 77de29b9c..4e90468b1 100644
--- a/gnu/javax/crypto/jce/mac/UMac32Spi.java
+++ b/gnu/javax/crypto/jce/mac/UMac32Spi.java
@@ -50,8 +50,6 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* The implementation of the UMAC-32 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class UMac32Spi extends MacAdapter
{
@@ -88,4 +86,4 @@ public final class UMac32Spi extends MacAdapter
throw new InvalidAlgorithmParameterException(iae.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/key/dh/DiffieHellmanSender.java b/gnu/javax/crypto/key/dh/DiffieHellmanSender.java
index 71838fdac..0be82bfb4 100644
--- a/gnu/javax/crypto/key/dh/DiffieHellmanSender.java
+++ b/gnu/javax/crypto/key/dh/DiffieHellmanSender.java
@@ -55,7 +55,6 @@ import javax.crypto.interfaces.DHPrivateKey;
* Diffie-Hellman key agreement exchange (A in [HAC]).</p>
*
* @see DiffieHellmanKeyAgreement
- * @version $Revision: 1.1.4.1 $
*/
public class DiffieHellmanSender extends DiffieHellmanKeyAgreement
{
diff --git a/gnu/javax/crypto/key/srp6/SRP6TLSServer.java b/gnu/javax/crypto/key/srp6/SRP6TLSServer.java
index 718646012..ecbe36f62 100644
--- a/gnu/javax/crypto/key/srp6/SRP6TLSServer.java
+++ b/gnu/javax/crypto/key/srp6/SRP6TLSServer.java
@@ -61,8 +61,6 @@ import java.util.Map;
* SRP for TLS Authentication</a>. The only difference between it and the SASL
* variant is that the shared secret is the entity <code>S</code> and not
* <code>H(S)</code>.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class SRP6TLSServer extends SRP6KeyAgreement
{
diff --git a/gnu/javax/crypto/keyring/PrivateKeyEntry.java b/gnu/javax/crypto/keyring/PrivateKeyEntry.java
index c9c997da0..882495633 100644
--- a/gnu/javax/crypto/keyring/PrivateKeyEntry.java
+++ b/gnu/javax/crypto/keyring/PrivateKeyEntry.java
@@ -57,8 +57,6 @@ import java.util.Date;
/**
* <p>An immutable class representing a private or secret key entry.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class PrivateKeyEntry extends PrimitiveEntry
{
diff --git a/gnu/javax/crypto/mode/IAuthenticatedMode.java b/gnu/javax/crypto/mode/IAuthenticatedMode.java
index 9ca23933c..989e3edbc 100644
--- a/gnu/javax/crypto/mode/IAuthenticatedMode.java
+++ b/gnu/javax/crypto/mode/IAuthenticatedMode.java
@@ -50,11 +50,9 @@ import gnu.javax.crypto.mac.IMac;
* is done via the {@link IMac#digest()} method, and header updating
* (if supported by the mode) is done via the {@link
* IMac#update(byte[],int,int)} method.
- *
- * @version $Revision: 1.1.4.1 $
*/
public interface IAuthenticatedMode extends IMode, IMac
{
// Trivial conjunction of IMode and IMac.
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/pad/WrongPaddingException.java b/gnu/javax/crypto/pad/WrongPaddingException.java
index 4317a5c18..e477cf303 100644
--- a/gnu/javax/crypto/pad/WrongPaddingException.java
+++ b/gnu/javax/crypto/pad/WrongPaddingException.java
@@ -41,8 +41,6 @@ package gnu.javax.crypto.pad;
/**
* <p>A checked exception that indicates that a padding algorithm did not find the
* expected padding bytes when unpadding some data.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class WrongPaddingException extends Exception
{
@@ -60,4 +58,4 @@ public class WrongPaddingException extends Exception
// Instant methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/prng/Fortuna.java b/gnu/javax/crypto/prng/Fortuna.java
index 6453a9d02..69ce860f4 100644
--- a/gnu/javax/crypto/prng/Fortuna.java
+++ b/gnu/javax/crypto/prng/Fortuna.java
@@ -142,6 +142,14 @@ public class Fortuna extends BasePRNG implements Serializable,
pool = 0;
pool0Count = 0;
generator.init(attributes);
+ try
+ {
+ fillBlock ();
+ }
+ catch (LimitReachedException shouldNotHappen)
+ {
+ throw new RuntimeException (shouldNotHappen);
+ }
}
public void fillBlock() throws LimitReachedException
@@ -324,6 +332,7 @@ public class Fortuna extends BasePRNG implements Serializable,
byte[] seed = (byte[]) attributes.get(SEED);
if (seed != null)
addRandomBytes(seed);
+ fillBlock ();
}
/**
diff --git a/gnu/javax/crypto/prng/ICMGenerator.java b/gnu/javax/crypto/prng/ICMGenerator.java
index 541003a97..7d4f4c9a3 100644
--- a/gnu/javax/crypto/prng/ICMGenerator.java
+++ b/gnu/javax/crypto/prng/ICMGenerator.java
@@ -98,8 +98,6 @@ import java.util.Map;
* <li><a href="http://www.ietf.org/internet-drafts/draft-mcgrew-saag-icm-00.txt">
* Integer Counter Mode</a>, David A. McGrew.</li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class ICMGenerator extends BasePRNG implements Cloneable
{
@@ -376,4 +374,4 @@ public class ICMGenerator extends BasePRNG implements Cloneable
cipher.encryptBlock(buffer, 0, buffer, 0);
blockNdx = blockNdx.add(BigInteger.ONE); // increment blockNdx
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/prng/IPBE.java b/gnu/javax/crypto/prng/IPBE.java
index 69ff493fb..ef0f3aa48 100644
--- a/gnu/javax/crypto/prng/IPBE.java
+++ b/gnu/javax/crypto/prng/IPBE.java
@@ -40,8 +40,6 @@ package gnu.javax.crypto.prng;
/**
* <p>Trivial interface to group Password-based encryption property names.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public interface IPBE
{
@@ -66,4 +64,4 @@ public interface IPBE
* with this is expected to be a byte array.
*/
public static final String SALT = "gnu.crypto.pbe.salt";
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/prng/PBKDF2.java b/gnu/javax/crypto/prng/PBKDF2.java
index 87bbd1e89..78e4ae0da 100644
--- a/gnu/javax/crypto/prng/PBKDF2.java
+++ b/gnu/javax/crypto/prng/PBKDF2.java
@@ -62,8 +62,6 @@ import java.util.Map;
* <li>B. Kaliski, <a href="http://www.ietf.org/rfc/rfc2898.txt">RFC 2898:
* Password-Based Cryptography Specification, Version 2.0</a></li>
* </ol>
- *
- * @version $Revision: 1.1.4.1 $
*/
public class PBKDF2 extends BasePRNG implements Cloneable
{
@@ -213,4 +211,4 @@ public class PBKDF2 extends BasePRNG implements Cloneable
}
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/sasl/ConfidentialityException.java b/gnu/javax/crypto/sasl/ConfidentialityException.java
index b77e4d110..adfc06593 100644
--- a/gnu/javax/crypto/sasl/ConfidentialityException.java
+++ b/gnu/javax/crypto/sasl/ConfidentialityException.java
@@ -44,8 +44,6 @@ import javax.security.sasl.SaslException;
* Used by mechanisms that offer a security services layer, this checked
* exception is thrown to indicate that a violation has occured during the
* processing of a <i>confidentiality</i> protection filter.
- *
- * @version $Revision: 1.1.4.1 $
*/
public class ConfidentialityException extends SaslException
{
@@ -81,4 +79,4 @@ public class ConfidentialityException extends SaslException
{
super(s, x);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/sasl/IllegalMechanismStateException.java b/gnu/javax/crypto/sasl/IllegalMechanismStateException.java
index 00baceaa4..b46ad98e3 100644
--- a/gnu/javax/crypto/sasl/IllegalMechanismStateException.java
+++ b/gnu/javax/crypto/sasl/IllegalMechanismStateException.java
@@ -46,8 +46,6 @@ import javax.security.sasl.AuthenticationException;
* that mechanism was not completed yet, or that an operation that should be
* invoked on incomplete mechanisms was invoked but the authentication phase of
* that mechanism was already completed.
- *
- * @version $Revision: 1.1.4.1 $
*/
public class IllegalMechanismStateException extends AuthenticationException
{
@@ -83,4 +81,4 @@ public class IllegalMechanismStateException extends AuthenticationException
{
super(detail, ex);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/sasl/srp/IALG.java b/gnu/javax/crypto/sasl/srp/IALG.java
index 2c65dfda1..51492f977 100644
--- a/gnu/javax/crypto/sasl/srp/IALG.java
+++ b/gnu/javax/crypto/sasl/srp/IALG.java
@@ -50,8 +50,6 @@ import javax.security.sasl.SaslException;
/**
* <p>A Factory class that returns IALG (Integrity Algorithm) instances that
* operate as described in the draft-burdis-cat-sasl-srp-04 and later.</p>
- *
- * @version $Revision: 1.1.4.1 $
*/
public final class IALG implements Cloneable
{
@@ -156,4 +154,4 @@ public final class IALG implements Cloneable
{
return hmac.macSize();
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/sasl/srp/SRPServer.java b/gnu/javax/crypto/sasl/srp/SRPServer.java
index f4421c1e8..672660b26 100644
--- a/gnu/javax/crypto/sasl/srp/SRPServer.java
+++ b/gnu/javax/crypto/sasl/srp/SRPServer.java
@@ -72,8 +72,6 @@ import javax.security.sasl.SaslServer;
/**
* <p>The SASL-SRP server-side mechanism.</p>
- *
- * @version $Revision: 1.2.2.1 $
*/
public class SRPServer extends ServerMechanism implements SaslServer
{
@@ -1153,4 +1151,4 @@ public class SRPServer extends ServerMechanism implements SaslServer
return prng;
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/swing/tree/GnuPath.java b/gnu/javax/swing/tree/GnuPath.java
new file mode 100644
index 000000000..dd576e8d3
--- /dev/null
+++ b/gnu/javax/swing/tree/GnuPath.java
@@ -0,0 +1,65 @@
+/* GnuPath.java -- The extended version of TreePath
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.swing.tree;
+
+import javax.swing.tree.TreePath;
+
+/**
+ * The tree path with additional data. Needed for the optimized tree drawing.
+ * Returned by layout caches.
+ *
+ * @author Audrius Meskauskas
+ */
+public class GnuPath extends TreePath
+{
+ /**
+ * The flag, marking the last visible child.
+ */
+ public boolean isLastChild;
+
+ /**
+ * Create a new path, specifying flag if this path is the path to the
+ * last visible child (needed for optimized tree drawing).
+ */
+ public GnuPath(Object[] path, boolean lastChild)
+ {
+ super(path);
+ isLastChild = lastChild;
+ }
+}
diff --git a/gnu/regexp/CharIndexed.java b/gnu/regexp/CharIndexed.java
index df1d8930c..8aedc49f6 100644
--- a/gnu/regexp/CharIndexed.java
+++ b/gnu/regexp/CharIndexed.java
@@ -93,4 +93,24 @@ public interface CharIndexed {
* Returns the effective length of this CharIndexed
*/
int length();
+
+ /**
+ * Sets the REMatch last found on this input.
+ */
+ void setLastMatch(REMatch match);
+
+ /**
+ * Returns the REMatch last found on this input.
+ */
+ REMatch getLastMatch();
+
+ /**
+ * Returns the anchor.
+ */
+ int getAnchor();
+
+ /**
+ * Sets the anchor.
+ */
+ void setAnchor(int anchor);
}
diff --git a/gnu/regexp/CharIndexedCharArray.java b/gnu/regexp/CharIndexedCharArray.java
index 1388d4729..96a609beb 100644
--- a/gnu/regexp/CharIndexedCharArray.java
+++ b/gnu/regexp/CharIndexedCharArray.java
@@ -1,5 +1,5 @@
/* gnu/regexp/CharIndexedCharArray.java
- Copyright (C) 1998-2001, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,36 +36,11 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.regexp;
-import java.io.Serializable;
+import java.nio.CharBuffer;
-class CharIndexedCharArray implements CharIndexed, Serializable {
- private char[] s;
- private int anchor;
+class CharIndexedCharArray extends CharIndexedCharSequence {
CharIndexedCharArray(char[] str, int index) {
- s = str;
- anchor = index;
- }
-
- public char charAt(int index) {
- int pos = anchor + index;
- return ((pos < s.length) && (pos >= 0)) ? s[pos] : OUT_OF_BOUNDS;
- }
-
- public boolean isValid() {
- return (anchor < s.length);
- }
-
- public boolean move(int index) {
- return ((anchor += index) < s.length);
- }
-
- public CharIndexed lookBehind(int index, int length) {
- if (length > (anchor + index)) length = anchor + index;
- return new CharIndexedCharArray(s, anchor + index - length);
- }
-
- public int length() {
- return s.length - anchor;
+ super(CharBuffer.wrap(str), index);
}
}
diff --git a/gnu/regexp/CharIndexedCharSequence.java b/gnu/regexp/CharIndexedCharSequence.java
new file mode 100644
index 000000000..5bbe4abfe
--- /dev/null
+++ b/gnu/regexp/CharIndexedCharSequence.java
@@ -0,0 +1,82 @@
+/* gnu/regexp/CharIndexedCharSequence.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.regexp;
+import java.io.Serializable;
+
+class CharIndexedCharSequence implements CharIndexed, Serializable {
+ private CharSequence s;
+ private int anchor;
+ private int len;
+
+ CharIndexedCharSequence(CharSequence s, int index) {
+ this.s = s;
+ len = s.length();
+ anchor = index;
+ }
+
+ public char charAt(int index) {
+ int pos = anchor + index;
+ return ((pos < len) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS;
+ }
+
+ public boolean isValid() {
+ return (anchor < len);
+ }
+
+ public boolean move(int index) {
+ return ((anchor += index) < len);
+ }
+
+ public CharIndexed lookBehind(int index, int length) {
+ if (length > (anchor + index)) length = anchor + index;
+ return new CharIndexedCharSequence(s, anchor + index - length);
+ }
+
+ public int length() {
+ return len - anchor;
+ }
+
+ private REMatch lastMatch;
+ public void setLastMatch(REMatch match) {
+ lastMatch = (REMatch)match.clone();
+ lastMatch.anchor = anchor;
+ }
+ public REMatch getLastMatch() { return lastMatch; }
+ public int getAnchor() { return anchor; }
+ public void setAnchor(int anchor) { this.anchor = anchor; }
+}
diff --git a/gnu/regexp/CharIndexedInputStream.java b/gnu/regexp/CharIndexedInputStream.java
index d5225a793..290a94e7f 100644
--- a/gnu/regexp/CharIndexedInputStream.java
+++ b/gnu/regexp/CharIndexedInputStream.java
@@ -155,5 +155,27 @@ class CharIndexedInputStream implements CharIndexed {
throw new UnsupportedOperationException(
"difficult to tell the length for an input stream");
}
+
+ public void setLastMatch(REMatch match) {
+ throw new UnsupportedOperationException(
+ "difficult to support setLastMatch for an input stream");
+ }
+
+ public REMatch getLastMatch() {
+ throw new UnsupportedOperationException(
+ "difficult to support getLastMatch for an input stream");
+ }
+
+ public int getAnchor() {
+ throw new UnsupportedOperationException(
+ "difficult to support getAnchor for an input stream");
+ }
+
+ public void setAnchor(int anchor) {
+ throw new UnsupportedOperationException(
+ "difficult to support setAnchor for an input stream");
+ }
+
+
}
diff --git a/gnu/regexp/CharIndexedString.java b/gnu/regexp/CharIndexedString.java
index fe4fa8f76..24982659b 100644
--- a/gnu/regexp/CharIndexedString.java
+++ b/gnu/regexp/CharIndexedString.java
@@ -1,5 +1,5 @@
/* gnu/regexp/CharIndexedString.java
- Copyright (C) 1998-2001, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,38 +36,9 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.regexp;
-import java.io.Serializable;
-class CharIndexedString implements CharIndexed, Serializable {
- private String s;
- private int anchor;
- private int len;
-
+class CharIndexedString extends CharIndexedCharSequence {
CharIndexedString(String str, int index) {
- s = str;
- len = s.length();
- anchor = index;
- }
-
- public char charAt(int index) {
- int pos = anchor + index;
- return ((pos < len) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS;
- }
-
- public boolean isValid() {
- return (anchor < len);
- }
-
- public boolean move(int index) {
- return ((anchor += index) < len);
- }
-
- public CharIndexed lookBehind(int index, int length) {
- if (length > (anchor + index)) length = anchor + index;
- return new CharIndexedString(s, anchor + index - length);
- }
-
- public int length() {
- return len - anchor;
+ super(str, index);
}
}
diff --git a/gnu/regexp/CharIndexedStringBuffer.java b/gnu/regexp/CharIndexedStringBuffer.java
index 9c9118dfe..d6b03bba5 100644
--- a/gnu/regexp/CharIndexedStringBuffer.java
+++ b/gnu/regexp/CharIndexedStringBuffer.java
@@ -1,5 +1,5 @@
/* gnu/regexp/CharIndexedStringBuffer.java
- Copyright (C) 1998-2001, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,36 +36,10 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.regexp;
-import java.io.Serializable;
-class CharIndexedStringBuffer implements CharIndexed, Serializable {
- private StringBuffer s;
- private int anchor;
+class CharIndexedStringBuffer extends CharIndexedCharSequence {
CharIndexedStringBuffer(StringBuffer str, int index) {
- s = str;
- anchor = index;
+ super(str, index);
}
-
- public char charAt(int index) {
- int pos = anchor + index;
- return ((pos < s.length()) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS;
- }
-
- public boolean isValid() {
- return (anchor < s.length());
- }
-
- public boolean move(int index) {
- return ((anchor += index) < s.length());
- }
-
- public CharIndexed lookBehind(int index, int length) {
- if (length > (anchor + index)) length = anchor + index;
- return new CharIndexedStringBuffer(s, anchor + index - length);
- }
-
- public int length() {
- return s.length() - anchor;
- }
}
diff --git a/gnu/regexp/RE.java b/gnu/regexp/RE.java
index b78959a9d..e0665f097 100644
--- a/gnu/regexp/RE.java
+++ b/gnu/regexp/RE.java
@@ -79,13 +79,18 @@ import java.util.Vector;
* <P>
*
* These methods all have similar argument lists. The input can be a
- * String, a character array, a StringBuffer, or an
+ * CharIndexed, String, a character array, a StringBuffer, or an
* InputStream of some sort. Note that when using an
* InputStream, the stream read position cannot be guaranteed after
* attempting a match (this is not a bug, but a consequence of the way
* regular expressions work). Using an REMatchEnumeration can
* eliminate most positioning problems.
*
+ * Although the input object can be of various types, it is recommended
+ * that it should be a CharIndexed because {@link CharIndexed#getLastMatch()}
+ * can show the last match found on this input, which helps the expression
+ * \G work as the end of the previous match.
+ *
* <P>
*
* The optional index argument specifies the offset from the beginning
@@ -240,9 +245,13 @@ public class RE extends REToken {
* Compilation flag. Allow whitespace and comments in pattern.
* This is equivalent to the "/x" operator in Perl.
*/
-
public static final int REG_X_COMMENTS = 0x0400;
+ /**
+ * Compilation flag. If set, REG_ICASE is effective only for US-ASCII.
+ */
+ public static final int REG_ICASE_USASCII = 0x0800;
+
/** Returns a string representing the version of the gnu.regexp package. */
public static final String version() {
return VERSION;
@@ -342,6 +351,7 @@ public class RE extends REToken {
// Precalculate these so we don't pay for the math every time we
// need to access them.
boolean insens = ((cflags & REG_ICASE) > 0);
+ boolean insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
// Parse pattern into tokens. Does anyone know if it's more efficient
// to use char[] than a String.charAt()? I'm assuming so.
@@ -453,6 +463,7 @@ public class RE extends REToken {
else {
addToken(currentToken);
currentToken = new RETokenChar(subIndex,unit.ch,insens);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
}
@@ -528,7 +539,7 @@ public class RE extends REToken {
case 'd':
case 'm':
case 's':
- // case 'u': not supported
+ case 'u':
case 'x':
case '-':
if (!syntax.get(RESyntax.RE_EMBEDDED_FLAGS)) break;
@@ -568,7 +579,13 @@ public class RE extends REToken {
newCflags |= REG_DOT_NEWLINE;
flagIndex++;
break;
- // case 'u': not supported
+ case 'u':
+ if (negate)
+ newCflags |= REG_ICASE_USASCII;
+ else
+ newCflags &= ~REG_ICASE_USASCII;
+ flagIndex++;
+ break;
case 'x':
if (negate)
newCflags &= ~REG_X_COMMENTS;
@@ -592,6 +609,7 @@ public class RE extends REToken {
syntax = newSyntax;
cflags = newCflags;
insens = ((cflags & REG_ICASE) > 0);
+ insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
// This can be treated as though it were a comment.
comment = true;
index = flagIndex - 1;
@@ -604,6 +622,7 @@ public class RE extends REToken {
syntax = newSyntax;
cflags = newCflags;
insens = ((cflags & REG_ICASE) > 0);
+ insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
index = flagIndex -1;
// Fall through to the next case.
}
@@ -712,6 +731,7 @@ public class RE extends REToken {
syntax = savedSyntax;
cflags = savedCflags;
insens = ((cflags & REG_ICASE) > 0);
+ insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
flagsSaved = false;
}
} // not a comment
@@ -824,6 +844,7 @@ public class RE extends REToken {
index = index - 2 + ce.len;
addToken(currentToken);
currentToken = new RETokenChar(subIndex,ce.ch,insens);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// BACKREFERENCE OPERATOR
@@ -851,6 +872,7 @@ public class RE extends REToken {
int num = parseInt(pattern, numBegin, numEnd-numBegin, 10);
currentToken = new RETokenBackRef(subIndex,num,insens);
+ if (insensUSASCII) currentToken.unicodeAware = false;
index = numEnd;
}
@@ -899,6 +921,7 @@ public class RE extends REToken {
else if (unit.bk && (unit.ch == 'd') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
addToken(currentToken);
currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,false);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// NON-DIGIT OPERATOR
@@ -907,6 +930,7 @@ public class RE extends REToken {
else if (unit.bk && (unit.ch == 'D') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
addToken(currentToken);
currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,true);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// NEWLINE ESCAPE
@@ -931,6 +955,7 @@ public class RE extends REToken {
else if (unit.bk && (unit.ch == 's') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
addToken(currentToken);
currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,false);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// NON-WHITESPACE OPERATOR
@@ -939,6 +964,7 @@ public class RE extends REToken {
else if (unit.bk && (unit.ch == 'S') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
addToken(currentToken);
currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,true);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// TAB ESCAPE
@@ -955,6 +981,7 @@ public class RE extends REToken {
else if (unit.bk && (unit.ch == 'w') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
addToken(currentToken);
currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,false);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// NON-ALPHANUMERIC OPERATOR
@@ -963,12 +990,19 @@ public class RE extends REToken {
else if (unit.bk && (unit.ch == 'W') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) {
addToken(currentToken);
currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,true);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// END OF STRING OPERATOR
- // \Z
+ // \Z, \z
+
+ // FIXME: \Z and \z are different in that if the input string
+ // ends with a line terminator, \Z matches the position before
+ // the final terminator. This special behavior of \Z is yet
+ // to be implemented.
- else if (unit.bk && (unit.ch == 'Z') && syntax.get(RESyntax.RE_STRING_ANCHORS)) {
+ else if (unit.bk && (unit.ch == 'Z' || unit.ch == 'z') &&
+ syntax.get(RESyntax.RE_STRING_ANCHORS)) {
addToken(currentToken);
currentToken = new RETokenEnd(subIndex,null);
}
@@ -984,6 +1018,7 @@ public class RE extends REToken {
index = index - 2 + ce.len;
addToken(currentToken);
currentToken = new RETokenChar(subIndex,ce.ch,insens);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
// NAMED PROPERTY
@@ -997,6 +1032,16 @@ public class RE extends REToken {
index = index - 2 + np.len;
addToken(currentToken);
currentToken = getRETokenNamedProperty(subIndex,np,insens,index);
+ if (insensUSASCII) currentToken.unicodeAware = false;
+ }
+
+ // END OF PREVIOUS MATCH
+ // \G
+
+ else if (unit.bk && (unit.ch == 'G') &&
+ syntax.get(RESyntax.RE_STRING_ANCHORS)) {
+ addToken(currentToken);
+ currentToken = new RETokenEndOfPreviousMatch(subIndex);
}
// NON-SPECIAL CHARACTER (or escape to make literal)
@@ -1005,6 +1050,7 @@ public class RE extends REToken {
else { // not a special character
addToken(currentToken);
currentToken = new RETokenChar(subIndex,unit.ch,insens);
+ if (insensUSASCII) currentToken.unicodeAware = false;
}
} // end while
@@ -1045,6 +1091,7 @@ public class RE extends REToken {
throws REException {
boolean insens = ((cflags & REG_ICASE) > 0);
+ boolean insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0);
Vector options = new Vector();
Vector addition = new Vector();
boolean additionAndAppeared = false;
@@ -1074,7 +1121,9 @@ public class RE extends REToken {
if ((ch == '-') && (lastCharIsSet)) {
if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
if ((ch = pattern[index]) == ']') {
- options.addElement(new RETokenChar(subIndex,lastChar,insens));
+ RETokenChar t = new RETokenChar(subIndex,lastChar,insens);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
lastChar = '-';
} else {
if ((ch == '\\') && syntax.get(RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) {
@@ -1084,7 +1133,9 @@ public class RE extends REToken {
ch = ce.ch;
index = index + ce.len - 1;
}
- options.addElement(new RETokenRange(subIndex,lastChar,ch,insens));
+ RETokenRange t = new RETokenRange(subIndex,lastChar,ch,insens);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
lastChar = 0; lastCharIsSet = false;
index++;
}
@@ -1127,12 +1178,20 @@ public class RE extends REToken {
asciiEsc = ce.ch; asciiEscIsSet = true;
index = index - 1 + ce.len - 1;
}
- if (lastCharIsSet) options.addElement(new RETokenChar(subIndex,lastChar,insens));
+ if (lastCharIsSet) {
+ RETokenChar t = new RETokenChar(subIndex,lastChar,insens);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
+ }
if (posixID != -1) {
- options.addElement(new RETokenPOSIX(subIndex,posixID,insens,negate));
+ RETokenPOSIX t = new RETokenPOSIX(subIndex,posixID,insens,negate);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
} else if (np != null) {
- options.addElement(getRETokenNamedProperty(subIndex,np,insens,index));
+ RETokenNamedProperty t = getRETokenNamedProperty(subIndex,np,insens,index);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
} else if (asciiEscIsSet) {
lastChar = asciiEsc; lastCharIsSet = true;
} else {
@@ -1143,8 +1202,11 @@ public class RE extends REToken {
StringBuffer posixSet = new StringBuffer();
index = getPosixSet(pattern,index+1,posixSet);
int posixId = RETokenPOSIX.intValue(posixSet.toString());
- if (posixId != -1)
- options.addElement(new RETokenPOSIX(subIndex,posixId,insens,false));
+ if (posixId != -1) {
+ RETokenPOSIX t = new RETokenPOSIX(subIndex,posixId,insens,false);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
+ }
} else if ((ch == '[') && (syntax.get(RESyntax.RE_NESTED_CHARCLASS))) {
ParseCharClassResult result = parseCharClass(
subIndex, pattern, index, pLength, cflags, syntax, 0);
@@ -1197,14 +1259,22 @@ public class RE extends REToken {
result.index: result.index - 1);
}
} else {
- if (lastCharIsSet) options.addElement(new RETokenChar(subIndex,lastChar,insens));
+ if (lastCharIsSet) {
+ RETokenChar t = new RETokenChar(subIndex,lastChar,insens);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
+ }
lastChar = ch; lastCharIsSet = true;
}
if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index);
} // while in list
// Out of list, index is one past ']'
- if (lastCharIsSet) options.addElement(new RETokenChar(subIndex,lastChar,insens));
+ if (lastCharIsSet) {
+ RETokenChar t = new RETokenChar(subIndex,lastChar,insens);
+ if (insensUSASCII) t.unicodeAware = false;
+ options.addElement(t);
+ }
ParseCharClassResult result = new ParseCharClassResult();
// Create a new RETokenOneOf
@@ -1552,7 +1622,7 @@ public class RE extends REToken {
}
// Note the start of this subexpression
- mymatch.start[subIndex] = mymatch.index;
+ mymatch.start1[subIndex] = mymatch.index;
return firstToken.match(input, mymatch);
}
@@ -1562,8 +1632,6 @@ public class RE extends REToken {
mymatch.backtrackStack = new BacktrackStack();
boolean b = match(input, mymatch);
if (b) {
- // mymatch.backtrackStack.push(new REMatch.Backtrack(
- // this, input, mymatch, null));
return mymatch;
}
return null;
@@ -1652,6 +1720,7 @@ public class RE extends REToken {
*/
best.end[0] = best.index;
best.finish(input);
+ input.setLastMatch(best);
return best;
}
}
@@ -2003,10 +2072,23 @@ public class RE extends REToken {
}
// Cast input appropriately or throw exception
- private static CharIndexed makeCharIndexed(Object input, int index) {
- // We could let a String fall through to final input, but since
- // it's the most likely input type, we check it first.
- if (input instanceof String)
+ // This method was originally a private method, but has been made
+ // public because java.util.regex.Matcher uses this.
+ public static CharIndexed makeCharIndexed(Object input, int index) {
+ // The case where input is already a CharIndexed is supposed
+ // be the most likely because this is the case with
+ // java.util.regex.Matcher.
+ // We could let a String or a CharSequence fall through
+ // to final input, but since it'a very likely input type,
+ // we check it first.
+ if (input instanceof CharIndexed) {
+ CharIndexed ci = (CharIndexed) input;
+ ci.setAnchor(index);
+ return ci;
+ }
+ else if (input instanceof CharSequence)
+ return new CharIndexedCharSequence((CharSequence) input,index);
+ else if (input instanceof String)
return new CharIndexedString((String) input,index);
else if (input instanceof char[])
return new CharIndexedCharArray((char[]) input,index);
@@ -2014,8 +2096,6 @@ public class RE extends REToken {
return new CharIndexedStringBuffer((StringBuffer) input,index);
else if (input instanceof InputStream)
return new CharIndexedInputStream((InputStream) input,index);
- else if (input instanceof CharIndexed)
- return (CharIndexed) input; // do we lose index info?
else
return new CharIndexedString(input.toString(), index);
}
diff --git a/gnu/regexp/REMatch.java b/gnu/regexp/REMatch.java
index 01a6455b6..140a9c43e 100644
--- a/gnu/regexp/REMatch.java
+++ b/gnu/regexp/REMatch.java
@@ -65,7 +65,12 @@ public final class REMatch implements Serializable, Cloneable {
// Package scope; used by RE.
int index; // used while matching to mark current match position in input
+ // start1[i] is set when the i-th subexp starts. And start1[i] is copied
+ // to start[i] when the i-th subexp ends. So start[i] keeps the previously
+ // assigned value while the i-th subexp is being processed. This makes
+ // backreference to the i-th subexp within the i-th subexp possible.
int[] start; // start positions (relative to offset) for each (sub)exp.
+ int[] start1; // start positions (relative to offset) for each (sub)exp.
int[] end; // end positions for the same
// start[i] == -1 or end[i] == -1 means that the start/end position is void.
// start[i] == p or end[i] == p where p < 0 and p != -1 means that
@@ -81,6 +86,7 @@ public final class REMatch implements Serializable, Cloneable {
REMatch copy = (REMatch) super.clone();
copy.start = (int[]) start.clone();
+ copy.start1 = (int[]) start1.clone();
copy.end = (int[]) end.clone();
return copy;
@@ -91,6 +97,7 @@ public final class REMatch implements Serializable, Cloneable {
void assignFrom(REMatch other) {
start = other.start;
+ start1 = other.start1;
end = other.end;
index = other.index;
backtrackStack = other.backtrackStack;
@@ -98,6 +105,7 @@ public final class REMatch implements Serializable, Cloneable {
REMatch(int subs, int anchor, int eflags) {
start = new int[subs+1];
+ start1 = new int[subs+1];
end = new int[subs+1];
this.anchor = anchor;
this.eflags = eflags;
@@ -128,7 +136,7 @@ public final class REMatch implements Serializable, Cloneable {
offset = index;
this.index = 0;
for (int i = 0; i < start.length; i++) {
- start[i] = end[i] = -1;
+ start[i] = start1[i] = end[i] = -1;
}
backtrackStack = null;
}
diff --git a/gnu/regexp/REToken.java b/gnu/regexp/REToken.java
index 87780bc7a..f2abc029f 100644
--- a/gnu/regexp/REToken.java
+++ b/gnu/regexp/REToken.java
@@ -43,6 +43,7 @@ abstract class REToken implements Serializable, Cloneable {
protected REToken next = null;
protected REToken uncle = null;
protected int subIndex;
+ protected boolean unicodeAware = true;
public Object clone() {
try {
@@ -157,4 +158,32 @@ abstract class REToken implements Serializable, Cloneable {
return os.toString();
}
+ /**
+ * Converts the character argument to lowercase.
+ * @param ch the character to be converted.
+ * @param unicodeAware If true, use java.lang.Character#toLowerCase;
+ * otherwise, only US-ASCII charactes can be converted.
+ * @return the lowercase equivalent of the character, if any;
+ * otherwise, the character itself.
+ */
+ public static char toLowerCase(char ch, boolean unicodeAware) {
+ if (unicodeAware) return Character.toLowerCase(ch);
+ if (ch >= 'A' && ch <= 'Z') return (char)(ch + 'a' - 'A');
+ return ch;
+ }
+
+ /**
+ * Converts the character argument to uppercase.
+ * @param ch the character to be converted.
+ * @param unicodeAware If true, use java.lang.Character#toUpperCase;
+ * otherwise, only US-ASCII charactes can be converted.
+ * @return the uppercase equivalent of the character, if any;
+ * otherwise, the character itself.
+ */
+ public static char toUpperCase(char ch, boolean unicodeAware) {
+ if (unicodeAware) return Character.toUpperCase(ch);
+ if (ch >= 'a' && ch <= 'z') return (char)(ch + 'A' - 'a');
+ return ch;
+ }
+
}
diff --git a/gnu/regexp/RETokenBackRef.java b/gnu/regexp/RETokenBackRef.java
index ea0ffbc5f..25ef9522e 100644
--- a/gnu/regexp/RETokenBackRef.java
+++ b/gnu/regexp/RETokenBackRef.java
@@ -64,8 +64,8 @@ final class RETokenBackRef extends REToken {
char c2 = input.charAt(i);
if (c1 != c2) {
if (insens) {
- if (c1 != Character.toLowerCase(c2) &&
- c1 != Character.toUpperCase(c2)) {
+ if (c1 != toLowerCase(c2, unicodeAware) &&
+ c1 != toUpperCase(c2, unicodeAware)) {
return null;
}
}
diff --git a/gnu/regexp/RETokenChar.java b/gnu/regexp/RETokenChar.java
index 1b29727f3..1b3a74855 100644
--- a/gnu/regexp/RETokenChar.java
+++ b/gnu/regexp/RETokenChar.java
@@ -44,8 +44,9 @@ final class RETokenChar extends REToken {
RETokenChar(int subIndex, char c, boolean ins) {
super(subIndex);
+ insens = ins;
ch = new char [1];
- ch[0] = (insens = ins) ? Character.toLowerCase(c) : c;
+ ch[0] = c;
}
int getMinimumLength() {
@@ -70,13 +71,21 @@ final class RETokenChar extends REToken {
char c;
for (int i=0; i<z; i++) {
c = input.charAt(index+i);
- if (( (insens) ? Character.toLowerCase(c) : c ) != ch[i]) {
+ if (! charEquals(c, ch[i])) {
return false;
}
}
return true;
}
+ private boolean charEquals(char c1, char c2) {
+ if (c1 == c2) return true;
+ if (! insens) return false;
+ if (toLowerCase(c1, unicodeAware) == c2) return true;
+ if (toUpperCase(c1, unicodeAware) == c2) return true;
+ return false;
+ }
+
boolean returnsFixedLengthMatches() { return true; }
int findFixedLengthMatches(CharIndexed input, REMatch mymatch, int max) {
diff --git a/gnu/regexp/RETokenEndOfPreviousMatch.java b/gnu/regexp/RETokenEndOfPreviousMatch.java
new file mode 100644
index 000000000..167d10b5f
--- /dev/null
+++ b/gnu/regexp/RETokenEndOfPreviousMatch.java
@@ -0,0 +1,72 @@
+/* gnu/regexp/RETokenEndOfPreviousMatch.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.regexp;
+
+class RETokenEndOfPreviousMatch extends RETokenStart {
+
+ RETokenEndOfPreviousMatch(int subIndex) {
+ super(subIndex, null);
+ }
+
+ int getMaximumLength() {
+ return 0;
+ }
+
+ REMatch matchThis(CharIndexed input, REMatch mymatch) {
+ REMatch lastMatch = input.getLastMatch();
+ if (lastMatch == null) return super.matchThis(input, mymatch);
+ if (input.getAnchor()+mymatch.index ==
+ lastMatch.anchor+lastMatch.index) {
+ return mymatch;
+ }
+ else {
+ return null;
+ }
+ }
+
+ boolean returnsFixedLengthmatches() { return true; }
+
+ int findFixedLengthMatches(CharIndexed input, REMatch mymatch, int max) {
+ if (matchThis(input, mymatch) != null) return max;
+ else return 0;
+ }
+
+ void dump(StringBuffer os) {
+ os.append("\\G");
+ }
+}
diff --git a/gnu/regexp/RETokenEndSub.java b/gnu/regexp/RETokenEndSub.java
index 6421c7f74..fca01c7f3 100644
--- a/gnu/regexp/RETokenEndSub.java
+++ b/gnu/regexp/RETokenEndSub.java
@@ -47,11 +47,13 @@ final class RETokenEndSub extends REToken {
}
REMatch matchThis(CharIndexed input, REMatch mymatch) {
+ mymatch.start[subIndex] = mymatch.start1[subIndex];
mymatch.end[subIndex] = mymatch.index;
return mymatch;
}
REMatch findMatch(CharIndexed input, REMatch mymatch) {
+ mymatch.start[subIndex] = mymatch.start1[subIndex];
mymatch.end[subIndex] = mymatch.index;
return super.findMatch(input, mymatch);
}
diff --git a/gnu/regexp/RETokenLookBehind.java b/gnu/regexp/RETokenLookBehind.java
index 60058188d..8311d1a7a 100644
--- a/gnu/regexp/RETokenLookBehind.java
+++ b/gnu/regexp/RETokenLookBehind.java
@@ -65,6 +65,7 @@ final class RETokenLookBehind extends REToken
int diff = behind.length() - input.length();
int curIndex = trymatch.index + diff;
trymatch.index = 0;
+ trymatch.offset = 0;
RETokenMatchHereOnly stopper = new RETokenMatchHereOnly(curIndex);
REToken re1 = (REToken) re.clone();
re1.chain(stopper);
@@ -79,6 +80,7 @@ final class RETokenLookBehind extends REToken
}
}
trymatch.index = mymatch.index;
+ trymatch.offset = mymatch.offset;
return trymatch;
}
else {
diff --git a/gnu/regexp/RETokenNamedProperty.java b/gnu/regexp/RETokenNamedProperty.java
index e9ae00428..6147e87dc 100644
--- a/gnu/regexp/RETokenNamedProperty.java
+++ b/gnu/regexp/RETokenNamedProperty.java
@@ -122,8 +122,8 @@ final class RETokenNamedProperty extends REToken {
boolean retval = handler.includes(ch);
if (insens) {
retval = retval ||
- handler.includes(Character.toUpperCase(ch)) ||
- handler.includes(Character.toLowerCase(ch));
+ handler.includes(toUpperCase(ch, unicodeAware)) ||
+ handler.includes(toLowerCase(ch, unicodeAware));
}
if (negate) retval = !retval;
diff --git a/gnu/regexp/RETokenRange.java b/gnu/regexp/RETokenRange.java
index 94a775dc0..9d3da324e 100644
--- a/gnu/regexp/RETokenRange.java
+++ b/gnu/regexp/RETokenRange.java
@@ -69,10 +69,10 @@ final class RETokenRange extends REToken {
if (c == CharIndexed.OUT_OF_BOUNDS) return false;
boolean matches = (c >= lo) && (c <= hi);
if (! matches && insens) {
- char c1 = Character.toLowerCase(c);
+ char c1 = toLowerCase(c, unicodeAware);
matches = (c1 >= lo) && (c1 <= hi);
if (!matches) {
- c1 = Character.toUpperCase(c);
+ c1 = toUpperCase(c, unicodeAware);
matches = (c1 >= lo) && (c1 <= hi);
}
}
diff --git a/gnu/xml/dom/DomDocument.java b/gnu/xml/dom/DomDocument.java
index 900d03ac3..0d52a23ff 100644
--- a/gnu/xml/dom/DomDocument.java
+++ b/gnu/xml/dom/DomDocument.java
@@ -535,8 +535,7 @@ public class DomDocument
int index = name.indexOf(':');
if (index != -1)
{
- if (index == 0 || index == (len - 1) ||
- name.lastIndexOf(':') != index)
+ if (index == 0 || name.lastIndexOf(':') != index)
{
throw new DomDOMException(DOMException.NAMESPACE_ERR,
name, null, 0);
diff --git a/gnu/xml/dom/DomNode.java b/gnu/xml/dom/DomNode.java
index 93f7c6f64..c06a4c1f1 100644
--- a/gnu/xml/dom/DomNode.java
+++ b/gnu/xml/dom/DomNode.java
@@ -1120,7 +1120,6 @@ public abstract class DomNode
node.appendChild(newChild);
}
}
-
if (nodeType == ENTITY_REFERENCE_NODE)
{
node.makeReadonly();
@@ -1556,23 +1555,30 @@ public abstract class DomNode
ancestorLen = ancestors.length;
}
- // XXX autogrow ancestors ... based on statistics
-
// Climb to the top of this subtree and handle capture, letting
// each node (from the top down) capture until one stops it or
// until we get to this one.
-
- for (index = 0, current = parent;
- current != null && index < ancestorLen;
- index++, current = current.parent)
+ current = parent;
+ if (current.depth >= ANCESTORS_INIT)
{
+ DomNode[] newants = new DomNode[current.depth + 1];
+ System.arraycopy(ancestors, 0, newants, 0, ancestors.length);
+ ancestors = newants;
+ ancestorLen = ancestors.length;
+ }
+ for (index = 0; index < ancestorLen; index++)
+ {
+ if (current == null || current.depth == 0)
+ break;
+
if (current.nListeners != 0)
{
haveAncestorRegistrations = true;
}
ancestors [index] = current;
+ current = current.parent;
}
- if (current != null)
+ if (current.depth > 0)
{
throw new RuntimeException("dispatchEvent capture stack size");
}
diff --git a/gnu/xml/dom/DomNodeIterator.java b/gnu/xml/dom/DomNodeIterator.java
index 6079f7a12..8001556e5 100644
--- a/gnu/xml/dom/DomNodeIterator.java
+++ b/gnu/xml/dom/DomNodeIterator.java
@@ -137,9 +137,10 @@ public class DomNodeIterator
{
ret = current.getNextSibling();
}
+ current = (ret == null) ? current : ret;
}
while (!accept(ret));
- current = (ret == null) ? current : ret;
+
return ret;
}
diff --git a/gnu/xml/dom/html2/DomHTMLAppletElement.java b/gnu/xml/dom/html2/DomHTMLAppletElement.java
index 8ec4d3c83..918cf0d92 100644
--- a/gnu/xml/dom/html2/DomHTMLAppletElement.java
+++ b/gnu/xml/dom/html2/DomHTMLAppletElement.java
@@ -65,6 +65,26 @@ public class DomHTMLAppletElement
setHTMLAttribute("align", align);
}
+ public String getCls()
+ {
+ return getHTMLAttribute("class");
+ }
+
+ public void setCls(String cls)
+ {
+ setHTMLAttribute("class", cls);
+ }
+
+ public String getSrc()
+ {
+ return getHTMLAttribute("src");
+ }
+
+ public void setSrc(String src)
+ {
+ setHTMLAttribute("src", src);
+ }
+
public String getAlt()
{
return getHTMLAttribute("alt");
@@ -164,6 +184,5 @@ public class DomHTMLAppletElement
{
setHTMLAttribute("width", width);
}
-
}
diff --git a/gnu/xml/dom/html2/DomHTMLDocument.java b/gnu/xml/dom/html2/DomHTMLDocument.java
index 10ee9e747..d45c1b223 100644
--- a/gnu/xml/dom/html2/DomHTMLDocument.java
+++ b/gnu/xml/dom/html2/DomHTMLDocument.java
@@ -87,6 +87,7 @@ public class DomHTMLDocument
map.put("dir", DomHTMLDirectoryElement.class);
map.put("div", DomHTMLDivElement.class);
map.put("dlist", DomHTMLDListElement.class);
+ map.put("embed", DomHTMLEmbedElement.class);
map.put("fieldset", DomHTMLFieldSetElement.class);
map.put("font", DomHTMLFontElement.class);
map.put("form", DomHTMLFormElement.class);
@@ -311,6 +312,7 @@ public class DomHTMLDocument
public HTMLCollection getApplets()
{
DomHTMLCollection ret = new DomHTMLCollection(this, this);
+ ret.addNodeName("embed");
ret.addNodeName("object");
ret.addNodeName("applet");
ret.evaluate();
diff --git a/gnu/xml/dom/html2/DomHTMLEmbedElement.java b/gnu/xml/dom/html2/DomHTMLEmbedElement.java
new file mode 100644
index 000000000..1ae081c28
--- /dev/null
+++ b/gnu/xml/dom/html2/DomHTMLEmbedElement.java
@@ -0,0 +1,129 @@
+/* DomHTMLEmbedElement.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.xml.dom.html2;
+
+public class DomHTMLEmbedElement
+ extends DomHTMLAppletElement
+{
+ protected DomHTMLEmbedElement(DomHTMLDocument owner, String namespaceURI,
+ String name)
+ {
+ super(owner, namespaceURI, name);
+ }
+
+ public String getJavaObject()
+ {
+ return getHTMLAttribute("java_object");
+ }
+
+ public void setJavaObject(String object)
+ {
+ setHTMLAttribute("java_object", object);
+ }
+
+ public String getJavaCodeBase()
+ {
+ return getHTMLAttribute("java_codebase");
+ }
+
+ public void setJavaCodeBase(String codeBase)
+ {
+ setHTMLAttribute("java_codebase", codeBase);
+ }
+
+ public String getJavaArchive()
+ {
+ return getHTMLAttribute("java_archive");
+ }
+
+ public void setJavaArchive(String archive)
+ {
+ setHTMLAttribute("java_archive", archive);
+ }
+
+ public void setJavaCode(String code)
+ {
+ setHTMLAttribute("java_code", code);
+ }
+
+ public String getJavaCode()
+ {
+ return getHTMLAttribute("java_code");
+ }
+
+ public void setJavaType(String type)
+ {
+ setHTMLAttribute("java_type", type);
+ }
+
+ public String getJavaType()
+ {
+ return getHTMLAttribute("java_type");
+ }
+
+ public void setType(String type)
+ {
+ setHTMLAttribute("type", type);
+ }
+
+ public String getType()
+ {
+ return getHTMLAttribute("type");
+ }
+
+ public String getPluginsPage()
+ {
+ return getHTMLAttribute("pluginspage");
+ }
+
+ public void setPluginsPage(String pluginspage)
+ {
+ setHTMLAttribute("pluginspage", pluginspage);
+ }
+
+ public String getMayscript()
+ {
+ return getHTMLAttribute("mayscript");
+ }
+
+ public void setMayscript(String mayscript)
+ {
+ setHTMLAttribute("mayscript", mayscript);
+ }
+}
diff --git a/gnu/xml/dom/html2/DomHTMLObjectElement.java b/gnu/xml/dom/html2/DomHTMLObjectElement.java
index fdea9b153..9bb621122 100644
--- a/gnu/xml/dom/html2/DomHTMLObjectElement.java
+++ b/gnu/xml/dom/html2/DomHTMLObjectElement.java
@@ -72,6 +72,36 @@ public class DomHTMLObjectElement
setHTMLAttribute("code", code);
}
+ public String getJavaCode()
+ {
+ return getHTMLAttribute("java_code");
+ }
+
+ public void setJavaCode(String code)
+ {
+ setHTMLAttribute("java_code", code);
+ }
+
+ public String getObject()
+ {
+ return getHTMLAttribute("object");
+ }
+
+ public void setObject(String obj)
+ {
+ setHTMLAttribute("object", obj);
+ }
+
+ public String getJavaObject()
+ {
+ return getHTMLAttribute("java_object");
+ }
+
+ public void setJavaObject(String obj)
+ {
+ setHTMLAttribute("java_object", obj);
+ }
+
public String getAlign()
{
return getHTMLAttribute("align");
@@ -92,6 +122,16 @@ public class DomHTMLObjectElement
setHTMLAttribute("archive", archive);
}
+ public String getJavaArchive()
+ {
+ return getHTMLAttribute("java_archive");
+ }
+
+ public void setJavaArchive(String archive)
+ {
+ setHTMLAttribute("java_archive", archive);
+ }
+
public String getBorder()
{
return getHTMLAttribute("border");
@@ -112,6 +152,16 @@ public class DomHTMLObjectElement
setHTMLAttribute("codebase", codeBase);
}
+ public String getJavaCodeBase()
+ {
+ return getHTMLAttribute("java_codebase");
+ }
+
+ public void setJavaCodeBase(String codeBase)
+ {
+ setHTMLAttribute("java_codebase", codeBase);
+ }
+
public String getCodeType()
{
return getHTMLAttribute("codetype");
@@ -202,6 +252,16 @@ public class DomHTMLObjectElement
setHTMLAttribute("type", type);
}
+ public String getJavaType()
+ {
+ return getHTMLAttribute("java_type");
+ }
+
+ public void setJavaType(String type)
+ {
+ setHTMLAttribute("java_type", type);
+ }
+
public String getUseMap()
{
return getHTMLAttribute("usemap");
@@ -238,5 +298,24 @@ public class DomHTMLObjectElement
return null;
}
+ public void setMayscript(String may)
+ {
+ setHTMLAttribute("mayscript", may);
+ }
+
+ public String getMayscript()
+ {
+ return getHTMLAttribute("mayscript");
+ }
+
+ public void setScriptable(String scr)
+ {
+ setHTMLAttribute("scriptable", scr);
+ }
+
+ public String getScriptable()
+ {
+ return getHTMLAttribute("scriptable");
+ }
}
diff --git a/gnu/xml/dom/html2/DomHTMLParser.java b/gnu/xml/dom/html2/DomHTMLParser.java
index 7b4456225..2164e052c 100644
--- a/gnu/xml/dom/html2/DomHTMLParser.java
+++ b/gnu/xml/dom/html2/DomHTMLParser.java
@@ -124,9 +124,10 @@ public class DomHTMLParser
try
{
document = new DomHTMLDocument();
-
+ document.setCheckWellformedness(false);
+
cursor = document;
-
+
parse(input);
DomHTMLDocument h = document;
@@ -224,7 +225,6 @@ public class DomHTMLParser
open.addFirst(close);
close = close.getParentNode();
}
-
if (close == null)
cursor = document;
else
@@ -235,9 +235,8 @@ public class DomHTMLParser
while (iter.hasNext())
{
Node item = (Node) iter.next();
- Node copy = item.cloneNode(true);
- cursor.appendChild(copy);
- cursor = copy;
+ cursor.appendChild(item);
+ cursor = item;
}
}
}
diff --git a/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java b/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
index e1eb758ea..890ca8eeb 100644
--- a/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
+++ b/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java
@@ -51,6 +51,7 @@ import javax.xml.validation.SchemaFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -64,6 +65,7 @@ public class RELAXNGSchemaFactory
{
LSResourceResolver resourceResolver;
+ ErrorHandler errorHandler;
public LSResourceResolver getResourceResolver()
{
@@ -73,6 +75,16 @@ public class RELAXNGSchemaFactory
public void setResourceResolver(LSResourceResolver resourceResolver)
{
this.resourceResolver = resourceResolver;
+ }
+
+ public ErrorHandler getErrorHandler()
+ {
+ return this.errorHandler;
+ }
+
+ public void setErrorHandler(ErrorHandler errorHandler)
+ {
+ this.errorHandler = errorHandler;
}
public boolean isSchemaLanguageSupported(String schemaLanguage)
diff --git a/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java b/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java
index b37ae5431..2b985a28c 100644
--- a/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java
+++ b/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java
@@ -52,6 +52,7 @@ import org.relaxng.datatype.DatatypeException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -65,6 +66,7 @@ public class XMLSchemaSchemaFactory
{
LSResourceResolver resourceResolver;
+ ErrorHandler errorHandler;
public LSResourceResolver getResourceResolver()
{
@@ -75,6 +77,17 @@ public class XMLSchemaSchemaFactory
{
this.resourceResolver = resourceResolver;
}
+
+ public ErrorHandler getErrorHandler()
+ {
+ return this.errorHandler;
+ }
+
+ public void setErrorHandler(ErrorHandler errorHandler)
+ {
+ this.errorHandler = errorHandler;
+ }
+
public boolean isSchemaLanguageSupported(String schemaLanguage)
{
diff --git a/include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h b/include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h
index e774713a7..44ab6870c 100644
--- a/include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkCanvasPeer.h
@@ -11,6 +11,7 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_realize (JNIEnv *env, jobject);
#ifdef __cplusplus
}
diff --git a/java/awt/Choice.java b/java/awt/Choice.java
index 9fbcd9343..47ca540bd 100644
--- a/java/awt/Choice.java
+++ b/java/awt/Choice.java
@@ -556,6 +556,17 @@ processEvent(AWTEvent event)
super.processEvent(event);
}
+void
+dispatchEventImpl(AWTEvent e)
+{
+ if (e.id <= ItemEvent.ITEM_LAST
+ && e.id >= ItemEvent.ITEM_FIRST
+ && (item_listeners != null || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
+ processEvent(e);
+ else
+ super.dispatchEventImpl(e);
+}
+
/*************************************************************************/
/**
diff --git a/java/awt/Component.java b/java/awt/Component.java
index 588b43548..8dbcc0696 100644
--- a/java/awt/Component.java
+++ b/java/awt/Component.java
@@ -1075,8 +1075,6 @@ public abstract class Component
Component p = parent;
if (p != null)
return p.getFont();
- if (peer != null)
- return peer.getGraphics().getFont();
return null;
}
@@ -2315,6 +2313,10 @@ public abstract class Component
if (oldEvent != null)
postEvent (oldEvent);
+ // Give toolkit a chance to dispatch the event
+ // to globally registered listeners.
+ Toolkit.getDefaultToolkit().globalDispatchEvent(e);
+
// Some subclasses in the AWT package need to override this behavior,
// hence the use of dispatchEventImpl().
dispatchEventImpl(e);
@@ -4079,14 +4081,9 @@ public abstract class Component
*/
public Container getFocusCycleRootAncestor ()
{
- if (this instanceof Window
- && ((Container) this).isFocusCycleRoot ())
- return (Container) this;
-
Container parent = getParent ();
- while (parent != null
- && !parent.isFocusCycleRoot ())
+ while (parent != null && !parent.isFocusCycleRoot())
parent = parent.getParent ();
return parent;
@@ -4114,9 +4111,32 @@ public abstract class Component
*/
public void nextFocus ()
{
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+ // Find the nearest valid (== showing && focusable && enabled) focus
+ // cycle root ancestor and the focused component in it.
+ Container focusRoot = getFocusCycleRootAncestor();
+ Component focusComp = this;
+ while (focusRoot != null
+ && ! (focusRoot.isShowing() && focusRoot.isFocusable()
+ && focusRoot.isEnabled()))
+ {
+ focusComp = focusRoot;
+ focusRoot = focusComp.getFocusCycleRootAncestor();
+ }
+
+ if (focusRoot != null)
+ {
+ // First try to get the componentBefore from the policy.
+ FocusTraversalPolicy policy = focusRoot.getFocusTraversalPolicy();
+ Component nextFocus = policy.getComponentAfter(focusRoot, focusComp);
- manager.focusNextComponent (this);
+ // If this fails, then ask for the defaultComponent.
+ if (nextFocus == null)
+ nextFocus = policy.getDefaultComponent(focusRoot);
+
+ // Request focus on this component, if not null.
+ if (nextFocus != null)
+ nextFocus.requestFocus();
+ }
}
/**
@@ -4128,9 +4148,32 @@ public abstract class Component
*/
public void transferFocusBackward ()
{
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+ // Find the nearest valid (== showing && focusable && enabled) focus
+ // cycle root ancestor and the focused component in it.
+ Container focusRoot = getFocusCycleRootAncestor();
+ Component focusComp = this;
+ while (focusRoot != null
+ && ! (focusRoot.isShowing() && focusRoot.isFocusable()
+ && focusRoot.isEnabled()))
+ {
+ focusComp = focusRoot;
+ focusRoot = focusComp.getFocusCycleRootAncestor();
+ }
- manager.focusPreviousComponent (this);
+ if (focusRoot != null)
+ {
+ // First try to get the componentBefore from the policy.
+ FocusTraversalPolicy policy = focusRoot.getFocusTraversalPolicy();
+ Component nextFocus = policy.getComponentBefore(focusRoot, focusComp);
+
+ // If this fails, then ask for the defaultComponent.
+ if (nextFocus == null)
+ nextFocus = policy.getDefaultComponent(focusRoot);
+
+ // Request focus on this component, if not null.
+ if (nextFocus != null)
+ nextFocus.requestFocus();
+ }
}
/**
@@ -4144,9 +4187,63 @@ public abstract class Component
*/
public void transferFocusUpCycle ()
{
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+ // Find the nearest focus cycle root ancestor that is itself
+ // focusable, showing and enabled.
+ Container focusCycleRoot = getFocusCycleRootAncestor();
+ while (focusCycleRoot != null &&
+ ! (focusCycleRoot.isShowing() && focusCycleRoot.isFocusable()
+ && focusCycleRoot.isEnabled()))
+ {
+ focusCycleRoot = focusCycleRoot.getFocusCycleRootAncestor();
+ }
+
+ KeyboardFocusManager fm =
+ KeyboardFocusManager.getCurrentKeyboardFocusManager();
+
+ if (focusCycleRoot != null)
+ {
+ // If we found a focus cycle root, then we make this the new
+ // focused component, and make it's focus cycle root the new
+ // global focus cycle root. If the found root has no focus cycle
+ // root ancestor itself, then the component will be both the focused
+ // component and the new global focus cycle root.
+ Container focusCycleAncestor =
+ focusCycleRoot.getFocusCycleRootAncestor();
+ Container globalFocusCycleRoot;
+ if (focusCycleAncestor == null)
+ globalFocusCycleRoot = focusCycleRoot;
+ else
+ globalFocusCycleRoot = focusCycleAncestor;
+
+ fm.setGlobalCurrentFocusCycleRoot(globalFocusCycleRoot);
+ focusCycleRoot.requestFocus();
+ }
+ else
+ {
+ // If this component has no applicable focus cycle root, we try
+ // find the nearest window and set this as the new global focus cycle
+ // root and the default focus component of this window the new focused
+ // component.
+ Container cont;
+ if (this instanceof Container)
+ cont = (Container) this;
+ else
+ cont = getParent();
+
+ while (cont != null && !(cont instanceof Window))
+ cont = cont.getParent();
- manager.upFocusCycle (this);
+ if (cont != null)
+ {
+ FocusTraversalPolicy policy = cont.getFocusTraversalPolicy();
+ Component focusComp = policy.getDefaultComponent(cont);
+ if (focusComp != null)
+ {
+ fm.setGlobalCurrentFocusCycleRoot(cont);
+ focusComp.requestFocus();
+ }
+ }
+ }
}
/**
@@ -4876,7 +4973,7 @@ p * <li>the set of backward traversal keys
oldKey = Event.UP;
break;
default:
- oldKey = newKey;
+ oldKey = (int) ((KeyEvent) e).getKeyChar();
}
translated = new Event (target, when, oldID,
@@ -4922,10 +5019,6 @@ p * <li>the set of backward traversal keys
void dispatchEventImpl(AWTEvent e)
{
- // Give toolkit a chance to dispatch the event
- // to globally registered listeners.
- Toolkit.getDefaultToolkit().globalDispatchEvent(e);
-
// This boolean tells us not to process focus events when the focus
// opposite component is the same as the focus component.
boolean ignoreFocus =
@@ -4979,6 +5072,15 @@ p * <li>the set of backward traversal keys
switch (type)
{
+ case HierarchyEvent.HIERARCHY_CHANGED:
+ return (hierarchyListener != null
+ || (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0);
+
+ case HierarchyEvent.ANCESTOR_MOVED:
+ case HierarchyEvent.ANCESTOR_RESIZED:
+ return (hierarchyBoundsListener != null
+ || (eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0);
+
case ComponentEvent.COMPONENT_HIDDEN:
case ComponentEvent.COMPONENT_MOVED:
case ComponentEvent.COMPONENT_RESIZED:
@@ -5333,8 +5435,10 @@ p * <li>the set of backward traversal keys
s.add(AccessibleState.FOCUSABLE);
if (isFocusOwner())
s.add(AccessibleState.FOCUSED);
- if (isOpaque())
- s.add(AccessibleState.OPAQUE);
+ // Note: While the java.awt.Component has an 'opaque' property, it
+ // seems that it is not added to the accessible state set here, even
+ // if this property is true. However, it is handled for
+ // javax.swing.JComponent, so we add it there.
if (Component.this.isShowing())
s.add(AccessibleState.SHOWING);
if (Component.this.isVisible())
@@ -5618,7 +5722,7 @@ p * <li>the set of backward traversal keys
*/
public Point getLocation()
{
- return Component.this.isShowing() ? Component.this.getLocation() : null;
+ return Component.this.getLocation();
}
/**
@@ -5642,7 +5746,7 @@ p * <li>the set of backward traversal keys
*/
public Rectangle getBounds()
{
- return Component.this.isShowing() ? Component.this.getBounds() : null;
+ return Component.this.getBounds();
}
/**
@@ -5665,7 +5769,7 @@ p * <li>the set of backward traversal keys
*/
public Dimension getSize()
{
- return Component.this.isShowing() ? Component.this.getSize() : null;
+ return Component.this.getSize();
}
/**
diff --git a/java/awt/Container.java b/java/awt/Container.java
index 6fadd029a..c2c0d7f1d 100644
--- a/java/awt/Container.java
+++ b/java/awt/Container.java
@@ -1538,9 +1538,16 @@ public class Container extends Component
*/
public void transferFocusDownCycle ()
{
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
-
- manager.downFocusCycle (this);
+ if (isFocusCycleRoot())
+ {
+ KeyboardFocusManager fm =
+ KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ fm.setGlobalCurrentFocusCycleRoot(this);
+ FocusTraversalPolicy policy = getFocusTraversalPolicy();
+ Component defaultComponent = policy.getDefaultComponent(this);
+ if (defaultComponent != null)
+ defaultComponent.requestFocus();
+ }
}
/**
diff --git a/java/awt/DefaultKeyboardFocusManager.java b/java/awt/DefaultKeyboardFocusManager.java
index bce6352a9..a60cefd9c 100644
--- a/java/awt/DefaultKeyboardFocusManager.java
+++ b/java/awt/DefaultKeyboardFocusManager.java
@@ -478,59 +478,25 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
public void focusPreviousComponent (Component comp)
{
- Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;
- Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();
- FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
-
- Component previous = policy.getComponentBefore (focusCycleRoot, focusComp);
- if (previous != null)
- previous.requestFocusInWindow ();
+ if (comp != null)
+ comp.transferFocusBackward();
}
public void focusNextComponent (Component comp)
{
- Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;
- Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();
- FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
-
- Component next = policy.getComponentAfter (focusCycleRoot, focusComp);
- if (next != null)
- next.requestFocusInWindow ();
+ if (comp != null)
+ comp.transferFocus();
}
public void upFocusCycle (Component comp)
{
- Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;
- Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();
-
- if (focusCycleRoot instanceof Window)
- {
- FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
- Component defaultComponent = policy.getDefaultComponent (focusCycleRoot);
- if (defaultComponent != null)
- defaultComponent.requestFocusInWindow ();
- }
- else
- {
- Container parentFocusCycleRoot = focusCycleRoot.getFocusCycleRootAncestor ();
-
- focusCycleRoot.requestFocusInWindow ();
- setGlobalCurrentFocusCycleRoot (parentFocusCycleRoot);
- }
+ if (comp != null)
+ comp.transferFocusUpCycle();
}
public void downFocusCycle (Container cont)
{
- if (cont == null)
- return;
-
- if (cont.isFocusCycleRoot (cont))
- {
- FocusTraversalPolicy policy = cont.getFocusTraversalPolicy ();
- Component defaultComponent = policy.getDefaultComponent (cont);
- if (defaultComponent != null)
- defaultComponent.requestFocusInWindow ();
- setGlobalCurrentFocusCycleRoot (cont);
- }
+ if (cont != null)
+ cont.transferFocusDownCycle();
}
} // class DefaultKeyboardFocusManager
diff --git a/java/awt/Dialog.java b/java/awt/Dialog.java
index 7213e29b2..55c3371e6 100644
--- a/java/awt/Dialog.java
+++ b/java/awt/Dialog.java
@@ -1,39 +1,40 @@
/* Dialog.java -- An AWT dialog box
- Copyright (C) 1999, 2000, 2001, 2002, 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) 1999, 2000, 2001, 2002, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package java.awt;
@@ -46,460 +47,422 @@ import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
/**
- * A dialog box widget class.
- *
+ * <code>Dialog</code> provides a top-level window normally used to receive
+ * user input in applications.
+ * <p>
+ * A dialog always has another top-level window as owner and is only visible
+ * if this owner is visible to the user. The default layout of dialogs is the
+ * <code>BorderLayout</code>. Dialogs can be modal (blocks user input to other
+ * components) or non-modal (user input in other components are allowed).
+ * </p>
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@redhat.com)
*/
public class Dialog extends Window
{
+ // Serialization constant
+ private static final long serialVersionUID = 5920926903803293709L;
-/*
- * Static Variables
- */
-
-// Serialization constant
-private static final long serialVersionUID = 5920926903803293709L;
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * @serial Indicates whether or not this dialog box is modal.
- */
-private boolean modal;
-
-/**
- * @serial Indicates whether or not this dialog box is resizable.
- */
-private boolean resizable = true;
-
-/**
- * @serial The title string for this dialog box, which can be
- * <code>null</code>.
- */
-private String title;
-
-/**
- * This field indicates whether the dialog is undecorated or not.
- */
-private boolean undecorated = false;
-
-/**
- * Indicates that we are blocked for modality in show
- */
-private boolean blocked = false;
-
-/**
- * Secondary EventQueue to handle AWT events while
- * we are blocked for modality in show
- */
-private EventQueue eq2 = null;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified
- * parent, that is resizable and not modal, and which has no title.
- *
- * @param parent The parent frame of this dialog box.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is always
- * thrown when GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent)
-{
- this(parent, "", false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified
- * parent and modality, that is resizable and which has no title.
- *
- * @param parent The parent frame of this dialog box.
- * @param modal <code>true</code> if this dialog box is modal,
- * <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is always
- * thrown when GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent, boolean modal)
-{
- this(parent, "", modal);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified
- * parent, that is resizable and not modal, and which has the specified
- * title.
- *
- * @param parent The parent frame of this dialog box.
- * @param title The title string for this dialog box.
- *
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is always
- * thrown when GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent, String title)
-{
- this(parent, title, false);
-}
-
-/*************************************************************************/
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified,
- * parent, title, and modality, that is resizable.
- *
- * @param parent The parent frame of this dialog box.
- * @param title The title string for this dialog box.
- * @param modal <code>true</code> if this dialog box is modal,
- * <code>false</code> otherwise.
- *
- * @exception IllegalArgumentException If owner is null or
- * GraphicsEnvironment.isHeadless() returns true.
- */
-public
-Dialog(Frame parent, String title, boolean modal)
-{
- this (parent, title, modal, parent.getGraphicsConfiguration ());
-}
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified,
- * parent, title, modality and <code>GraphicsConfiguration</code>,
- * that is resizable.
- *
- * @param parent The parent frame of this dialog box.
- * @param title The title string for this dialog box.
- * @param modal <code>true</code> if this dialog box is modal,
- * <code>false</code> otherwise.
- * @param gc The <code>GraphicsConfiguration</code> object to use.
- *
- * @exception IllegalArgumentException If owner is null, the
- * GraphicsConfiguration is not a screen device or
- * GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.4
- */
-public
-Dialog (Frame parent, String title, boolean modal, GraphicsConfiguration gc)
-{
- super (parent, gc);
-
- // A null title is equivalent to an empty title
- this.title = (title != null) ? title : "";
- this.modal = modal;
- visible = false;
-
- setLayout(new BorderLayout());
-}
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified,
- * parent, that is resizable.
- *
- * @exception IllegalArgumentException If parent is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.2
- */
-public
-Dialog (Dialog owner)
-{
- this (owner, "", false, owner.getGraphicsConfiguration ());
-}
-
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified,
- * parent and title, that is resizable.
- *
- * @exception IllegalArgumentException If parent is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.2
- */
-public
-Dialog (Dialog owner, String title)
-{
- this (owner, title, false, owner.getGraphicsConfiguration ());
-}
+ /**
+ * @serial Indicates whether or not this dialog box is modal.
+ */
+ private boolean modal;
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified,
- * parent, title and modality, that is resizable.
- *
- * @exception IllegalArgumentException If parent is null. This exception is
- * always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.2
- */
-public
-Dialog (Dialog owner, String title, boolean modal)
-{
- this (owner, title, modal, owner.getGraphicsConfiguration ());
-}
+ /**
+ * @serial Indicates whether or not this dialog box is resizable.
+ */
+ private boolean resizable = true;
-/**
- * Initializes a new instance of <code>Dialog</code> with the specified,
- * parent, title, modality and <code>GraphicsConfiguration</code>,
- * that is resizable.
- *
- * @exception IllegalArgumentException If parent is null, the
- * GraphicsConfiguration is not a screen device or
- * GraphicsEnvironment.isHeadless() returns true.
- *
- * @since 1.4
- */
-public
-Dialog (Dialog parent, String title, boolean modal, GraphicsConfiguration gc)
-{
- super (parent, parent.getGraphicsConfiguration ());
+ /**
+ * @serial The title string for this dialog box, which can be
+ * <code>null</code>.
+ */
+ private String title;
- // A null title is equivalent to an empty title
- this.title = (title != null) ? title : "";
- this.modal = modal;
- visible = false;
+ /**
+ * This field indicates whether the dialog is undecorated or not.
+ */
+ private boolean undecorated = false;
- setLayout (new BorderLayout ());
-}
+ /**
+ * Indicates that we are blocked for modality in show
+ */
+ private boolean blocked = false;
-/*************************************************************************/
+ /**
+ * Secondary EventQueue to handle AWT events while we are blocked for
+ * modality in show.
+ */
+ private EventQueue eq2 = null;
-/*
- * Instance Variables
- */
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified
+ * parent, that is resizable and not modal, and which has no title.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+ * is not from a screen device, or if owner is null. This exception is
+ * always thrown when GraphicsEnvironment.isHeadless() returns true.
+ */
+ public Dialog(Frame parent)
+ {
+ this(parent, "", false);
+ }
-/**
- * Returns the title of this dialog box.
- *
- * @return The title of this dialog box.
- */
-public String
-getTitle()
-{
- return(title);
-}
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified
+ * parent and modality, that is resizable and which has no title.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param modal <code>true</code> if this dialog box is modal,
+ * <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+ * is not from a screen device, or if owner is null. This exception is
+ * always thrown when GraphicsEnvironment.isHeadless() returns true.
+ */
+ public Dialog(Frame parent, boolean modal)
+ {
+ this(parent, "", modal);
+ }
-/*************************************************************************/
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified
+ * parent, that is resizable and not modal, and which has the specified
+ * title.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ *
+ * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+ * is not from a screen device, or if owner is null. This exceptionnis
+ * always thrown when GraphicsEnvironment.isHeadless() returns true.
+ */
+ public Dialog(Frame parent, String title)
+ {
+ this(parent, title, false);
+ }
-/**
- * Sets the title of this dialog box to the specified string.
- *
- * @param title The new title.
- */
-public synchronized void
-setTitle(String title)
-{
- // A null title is equivalent to an empty title
- this.title = (title != null) ? title : "";
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title, and modality, that is resizable.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ * @param modal <code>true</code> if this dialog box is modal,
+ * <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException If owner is null or
+ * GraphicsEnvironment.isHeadless() returns true.
+ */
+ public Dialog(Frame parent, String title, boolean modal)
+ {
+ this(parent, title, modal, parent.getGraphicsConfiguration());
+ }
- if (peer != null)
- {
- DialogPeer d = (DialogPeer) peer;
- d.setTitle (title);
- }
-}
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title, modality and <code>GraphicsConfiguration</code>, that is
+ * resizable.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ * @param modal <code>true</code> if this dialog box is modal,
+ * <code>false</code> otherwise.
+ * @param gc The <code>GraphicsConfiguration</code> object to use. If
+ * <code>null</code> the <code>GraphicsConfiguration</code> of the target
+ * frame is used.
+ *
+ * @exception IllegalArgumentException If owner is null, the
+ * GraphicsConfiguration is not a screen device or
+ * GraphicsEnvironment.isHeadless() returns true.
+ * @since 1.4
+ */
+ public Dialog(Frame parent, String title, boolean modal,
+ GraphicsConfiguration gc)
+ {
+ super(parent, (gc == null) ? parent.getGraphicsConfiguration() : gc);
-/*************************************************************************/
+ // A null title is equivalent to an empty title
+ this.title = (title != null) ? title : "";
+ this.modal = modal;
+ visible = false;
-/**
- * Tests whether or not this dialog box is modal.
- *
- * @return <code>true</code> if this dialog box is modal,
- * <code>false</code> otherwise.
- */
-public boolean
-isModal()
-{
- return(modal);
-}
+ setLayout(new BorderLayout());
+ }
-/*************************************************************************/
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, that is resizable.
+ *
+ * @param owner The parent frame of this dialog box.
+ *
+ * @exception IllegalArgumentException If parent is null. This exception is
+ * always thrown when GraphicsEnvironment.isHeadless() returns true.
+ *
+ * @since 1.2
+ */
+ public Dialog(Dialog owner)
+ {
+ this(owner, "", false, owner.getGraphicsConfiguration());
+ }
-/**
- * Changes the modality of this dialog box. This can only be done before
- * the peer is created.
- *
- * @param modal <code>true</code> to make this dialog box modal,
- * <code>false</code> to make it non-modal.
- */
-public void
-setModal(boolean modal)
-{
- this.modal = modal;
-}
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent and title, that is resizable.
+ *
+ * @param owner The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ *
+ * @exception IllegalArgumentException If parent is null. This exception is
+ * always thrown when GraphicsEnvironment.isHeadless() returns
+ * true.
+ * @since 1.2
+ */
+ public Dialog(Dialog owner, String title)
+ {
+ this(owner, title, false, owner.getGraphicsConfiguration());
+ }
-/*************************************************************************/
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title and modality, that is resizable.
+ *
+ * @param owner The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ * @param modal <code>true</code> if this dialog box is modal,
+ * <code>false</code> otherwise.
+ *
+ * @exception IllegalArgumentException If parent is null. This exception is
+ * always thrown when GraphicsEnvironment.isHeadless() returns true.
+ * @since 1.2
+ */
+ public Dialog(Dialog owner, String title, boolean modal)
+ {
+ this(owner, title, modal, owner.getGraphicsConfiguration());
+ }
-/**
- * Tests whether or not this dialog box is resizable.
- *
- * @return <code>true</code> if this dialog is resizable, <code>false</code>,
- * otherwise.
- */
-public boolean
-isResizable()
-{
- return(resizable);
-}
+ /**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title, modality and <code>GraphicsConfiguration</code>, that is
+ * resizable.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ * @param modal <code>true</code> if this dialog box is modal,
+ * <code>false</code> otherwise.
+ * @param gc The <code>GraphicsConfiguration</code> object to use. If
+ * <code>null</code> the <code>GraphicsConfiguration</code> of the target
+ * frame is used.
+ *
+ * @exception IllegalArgumentException If parent is null, the
+ * GraphicsConfiguration is not a screen device or
+ * GraphicsEnvironment.isHeadless() returns true.
+ *
+ * @since 1.4
+ */
+ public Dialog(Dialog parent, String title, boolean modal,
+ GraphicsConfiguration gc)
+ {
+ super(parent, (gc == null) ? parent.getGraphicsConfiguration() : gc);
-/*************************************************************************/
+ // A null title is equivalent to an empty title
+ this.title = (title != null) ? title : "";
+ this.modal = modal;
+ visible = false;
-/**
- * Changes the resizability of this dialog box.
- *
- * @param resizable <code>true</code> to make this dialog resizable,
- * <code>false</code> to make it non-resizable.
- */
-public synchronized void
-setResizable(boolean resizable)
-{
- this.resizable = resizable;
- if (peer != null)
- {
- DialogPeer d = (DialogPeer) peer;
- d.setResizable (resizable);
- }
-}
+ setLayout(new BorderLayout());
+ }
-/*************************************************************************/
+ /**
+ * Returns the title of this dialog box.
+ *
+ * @return The title of this dialog box.
+ */
+ public String getTitle()
+ {
+ return title;
+ }
-/**
- * Creates this object's native peer.
- */
-public synchronized void
-addNotify()
-{
- if (peer == null)
- peer = getToolkit ().createDialog (this);
- super.addNotify ();
-}
+ /**
+ * Sets the title of this dialog box to the specified string.
+ *
+ * @param title the new title. If <code>null</code> an empty
+ * title will be set.
+ */
+ public synchronized void setTitle(String title)
+ {
+ // A null title is equivalent to an empty title
+ this.title = (title != null) ? title : "";
+
+ if (peer != null)
+ {
+ DialogPeer d = (DialogPeer) peer;
+ d.setTitle(title);
+ }
+ }
-/*************************************************************************/
+ /**
+ * Tests whether or not this dialog box is modal.
+ *
+ * @return <code>true</code> if this dialog box is modal, <code>false</code>
+ * otherwise.
+ */
+ public boolean isModal()
+ {
+ return modal;
+ }
-/**
- * Makes this dialog visible and brings it to the front.
- * If the dialog is modal and is not already visible, this call will not
- * return until the dialog is hidden by someone calling hide or dispose.
- * If this is the event dispatching thread we must ensure that another event
- * thread runs while the one which invoked this method is blocked.
- * @specnote Deprecated starting in 1.5.
- */
-@Deprecated
-public synchronized void
-show()
-{
- super.show();
-
- if (isModal())
- {
- // If already shown (and blocked) just return
- if (blocked)
- return;
-
- /* If show is called in the dispatch thread for a modal dialog it will
- block so we must run another thread so the events keep being
- dispatched.*/
- if (EventQueue.isDispatchThread ())
- {
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
- eq2 = new EventQueue ();
- eq.push (eq2);
- }
-
- try
- {
- blocked = true;
- wait ();
- blocked = false;
- }
- catch (InterruptedException e)
- {
- blocked = false;
- }
-
- if (eq2 != null)
- {
- eq2.pop ();
- eq2 = null;
- }
- }
-}
+ /**
+ * Changes the modality of this dialog box. This can only be done before the
+ * peer is created.
+ *
+ * @param modal <code>true</code> to make this dialog box modal,
+ * <code>false</code> to make it non-modal.
+ */
+ public void setModal(boolean modal)
+ {
+ this.modal = modal;
+ }
-/*************************************************************************/
+ /**
+ * Tests whether or not this dialog box is resizable.
+ *
+ * @return <code>true</code> if this dialog is resizable,
+ * <code>false</code> otherwise.
+ */
+ public boolean isResizable()
+ {
+ return resizable;
+ }
-/**
- * Hides the Dialog and then
- * causes show() to return if it is currently blocked.
- * @specnote Deprecated starting in 1.5
- */
-@Deprecated
-public synchronized void
-hide ()
-{
- if (blocked)
- {
- notifyAll ();
- }
+ /**
+ * Changes the resizability of this dialog box.
+ *
+ * @param resizable <code>true</code> to make this dialog resizable,
+ * <code>false</code> to make it non-resizable.
+ */
+ public synchronized void setResizable(boolean resizable)
+ {
+ this.resizable = resizable;
+ if (peer != null)
+ {
+ DialogPeer d = (DialogPeer) peer;
+ d.setResizable(resizable);
+ }
+ }
- super.hide();
-}
+ /**
+ * Creates this object's native peer.
+ */
+ public synchronized void addNotify()
+ {
+ if (peer == null)
+ peer = getToolkit().createDialog(this);
+ super.addNotify();
+ }
-/*************************************************************************/
+ /**
+ * Makes this dialog visible and brings it to the front. If the dialog is
+ * modal and is not already visible, this call will not return until the
+ * dialog is hidden by someone calling hide or dispose. If this is the event
+ * dispatching thread we must ensure that another event thread runs while the
+ * one which invoked this method is blocked.
+ *
+ * @deprecated Use {@link Component#setVisible(boolean)} instead.
+ */
+ public synchronized void show()
+ {
+ super.show();
+
+ if (isModal())
+ {
+ // If already shown (and blocked) just return
+ if (blocked)
+ return;
+
+ /*
+ * If show is called in the dispatch thread for a modal dialog it will
+ * block so we must run another thread so the events keep being
+ * dispatched.
+ */
+ if (EventQueue.isDispatchThread())
+ {
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ eq2 = new EventQueue();
+ eq.push(eq2);
+ }
+
+ try
+ {
+ blocked = true;
+ wait();
+ blocked = false;
+ }
+ catch (InterruptedException e)
+ {
+ blocked = false;
+ }
+
+ if (eq2 != null)
+ {
+ eq2.pop();
+ eq2 = null;
+ }
+ }
+ }
-/**
- * Disposes the Dialog and then causes show() to return
- * if it is currently blocked.
- */
+ /**
+ * Hides the Dialog and then causes show() to return if it is currently
+ * blocked.
+ *
+ * @deprecated Use {@link Component#setVisible(boolean)} instead.
+ */
+ public synchronized void hide()
+ {
+ if (blocked)
+ {
+ notifyAll();
+ }
-public synchronized void
-dispose ()
-{
- if (blocked)
- {
- notifyAll ();
- }
+ super.hide();
+ }
- super.dispose();
-}
+ /**
+ * Disposes the Dialog and then causes show() to return if it is currently
+ * blocked.
+ */
+ public synchronized void dispose()
+ {
+ if (blocked)
+ {
+ notifyAll();
+ }
-/*************************************************************************/
+ super.dispose();
+ }
-/**
- * Returns a debugging string for this component.
- *
- * @return A debugging string for this component.
- */
-protected String
-paramString()
-{
- return ("title+" + title + ",modal=" + modal +
- ",resizable=" + resizable + "," + super.paramString());
-}
+ /**
+ * Returns a debugging string for this component.
+ *
+ * @return A debugging string for this component.
+ */
+ protected String paramString()
+ {
+ return "title+" + title + ",modal=" + modal + ",resizable=" + resizable
+ + "," + super.paramString();
+ }
/**
* Returns whether this frame is undecorated or not.
*
+ * @return <code>true</code> if this dialog is undecorated,
+ * <code>false</code> otherwise.
+ *
* @since 1.4
*/
- public boolean isUndecorated ()
+ public boolean isUndecorated()
{
return undecorated;
}
@@ -508,28 +471,42 @@ paramString()
* Disables or enables decorations for this frame. This method can only be
* called while the frame is not displayable.
*
- * @exception IllegalComponentStateException If this frame is displayable.
+ * @param undecorated <code>true</code> to disable dialog decorations,
+ * <code>false</code> otherwise.
*
+ * @exception IllegalComponentStateException If this frame is displayable.
* @since 1.4
*/
- public void setUndecorated (boolean undecorated)
+ public void setUndecorated(boolean undecorated)
{
- if (isDisplayable ())
- throw new IllegalComponentStateException ();
+ if (isDisplayable())
+ throw new IllegalComponentStateException();
this.undecorated = undecorated;
}
-
- protected class AccessibleAWTDialog extends AccessibleAWTWindow
+
+ /**
+ * Accessibility support for <code>Dialog</code>.
+ */
+ protected class AccessibleAWTDialog
+ extends AccessibleAWTWindow
{
private static final long serialVersionUID = 4837230331833941201L;
+ /**
+ * Gets the role of this object.
+ * @return AccessibleRole.DIALOG
+ */
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.DIALOG;
}
-
- public AccessibleStateSet getAccessibleState()
+
+ /**
+ * Gets the state set of this object.
+ * @return The current state of this dialog.
+ */
+ public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
if (isResizable())
@@ -539,11 +516,11 @@ paramString()
return states;
}
}
-
+
/**
- * Gets the AccessibleContext associated with this <code>Dialog</code>.
- * The context is created, if necessary.
- *
+ * Gets the AccessibleContext associated with this <code>Dialog</code>. The
+ * context is created, if necessary.
+ *
* @return the associated context
*/
public AccessibleContext getAccessibleContext()
@@ -554,5 +531,4 @@ paramString()
return accessibleContext;
}
-} // class Dialog
-
+}
diff --git a/java/awt/Frame.java b/java/awt/Frame.java
index 7003dac91..542013671 100644
--- a/java/awt/Frame.java
+++ b/java/awt/Frame.java
@@ -614,16 +614,27 @@ public class Frame extends Window implements MenuContainer
return next_frame_number++;
}
+ /**
+ * Accessibility support for <code>Frame</code>.
+ */
protected class AccessibleAWTFrame extends AccessibleAWTWindow
{
private static final long serialVersionUID = -6172960752956030250L;
+ /**
+ * Gets the role of this object.
+ * @return AccessibleRole.FRAME
+ */
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.FRAME;
}
- public AccessibleStateSet getAccessibleState()
+ /**
+ * Gets the state set of this object.
+ * @return The current state of this frame.
+ */
+ public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
if (isResizable())
diff --git a/java/awt/Toolkit.java b/java/awt/Toolkit.java
index f2d254310..24b72de86 100644
--- a/java/awt/Toolkit.java
+++ b/java/awt/Toolkit.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt;
+import gnu.classpath.SystemProperties;
import gnu.java.awt.peer.GLightweightPeer;
import java.awt.datatransfer.Clipboard;
@@ -79,11 +80,16 @@ import java.awt.peer.TextFieldPeer;
import java.awt.peer.WindowPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.io.File;
+import java.io.FileInputStream;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Map;
import java.util.Properties;
+import java.util.StringTokenizer;
/**
* The AWT system uses a set of native peer objects to implement its
@@ -538,6 +544,8 @@ public abstract class Toolkit
throw new AWTError(toolkit_name + " is not a subclass of " +
"java.awt.Toolkit");
toolkit = (Toolkit) obj;
+
+ initAccessibility();
return toolkit;
}
catch (ThreadDeath death)
@@ -1219,4 +1227,138 @@ public abstract class Toolkit
*/
public abstract Map<TextAttribute,?>
mapInputMethodHighlight(InputMethodHighlight highlight);
+
+ /**
+ * Initializes the accessibility framework. In particular, this loads the
+ * properties javax.accessibility.screen_magnifier_present and
+ * javax.accessibility.screen_reader_present and loads
+ * the classes specified in javax.accessibility.assistive_technologies.
+ */
+ private static void initAccessibility()
+ {
+ AccessController.doPrivileged
+ (new PrivilegedAction()
+ {
+ public Object run()
+ {
+ Properties props = new Properties();
+ String sep = File.separator;
+
+ // Try the user configuration.
+ try
+ {
+ File propsFile = new File(System.getProperty("user.home") + sep
+ + ".accessibility.properties");
+ FileInputStream in = new FileInputStream(propsFile);
+ props.load(in);
+ in.close();
+ }
+ catch (Exception ex)
+ {
+ // User configuration not present, ignore.
+ }
+
+ // Try the system configuration if there was no user configuration.
+ if (props.size() == 0)
+ {
+ try
+ {
+ File propsFile =
+ new File(System.getProperty("gnu.classpath.home.url")
+ + sep + "accessibility.properties");
+ FileInputStream in = new FileInputStream(propsFile);
+ props.load(in);
+ in.close();
+ }
+ catch (Exception ex)
+ {
+ // System configuration not present, ignore.
+ }
+ }
+
+ // Fetch the screen_magnifier_present property. Check systen properties
+ // first, then fallback to the configuration file.
+ String magPresent = SystemProperties.getProperty
+ ("javax.accessibility.screen_magnifier_present");
+ if (magPresent == null)
+ {
+ magPresent = props.getProperty("screen_magnifier_present");
+ if (magPresent != null)
+ {
+ SystemProperties.setProperty
+ ("javax.accessibility.screen_magnifier_present", magPresent);
+ }
+ }
+
+ // Fetch the screen_reader_present property. Check systen properties
+ // first, then fallback to the configuration file.
+ String readerPresent = SystemProperties.getProperty
+ ("javax.accessibility.screen_reader_present");
+ if (readerPresent == null)
+ {
+ readerPresent = props.getProperty("screen_reader_present");
+ if (readerPresent != null)
+ {
+ SystemProperties.setProperty
+ ("javax.accessibility.screen_reader_present", readerPresent);
+ }
+ }
+
+ // Fetch the list of classes to be loaded.
+ String classes = SystemProperties.getProperty
+ ("javax.accessibility.assistive_technologies");
+ if (classes == null)
+ {
+ classes = props.getProperty("assistive_technologies");
+ if (classes != null)
+ {
+ SystemProperties.setProperty
+ ("javax.accessibility.assistive_technologies", classes);
+ }
+ }
+
+ // Try to load the assisitive_technologies classes.
+ if (classes != null)
+ {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ StringTokenizer tokenizer = new StringTokenizer(classes, ",");
+ while (tokenizer.hasMoreTokens())
+ {
+ String className = tokenizer.nextToken();
+ try
+ {
+ Class atClass = cl.loadClass(className);
+ atClass.newInstance();
+ }
+ catch (ClassNotFoundException ex)
+ {
+ AWTError err = new AWTError("Assistive Technology class not"
+ + " found: " + className);
+ err.initCause(ex);
+ throw err;
+ }
+ catch (InstantiationException ex)
+ {
+ AWTError err =
+ new AWTError("Assistive Technology class cannot be "
+ + "instantiated: " + className);
+ err.initCause(ex);
+ throw err;
+ }
+ catch (IllegalAccessException ex)
+ {
+ AWTError err =
+ new AWTError("Assistive Technology class cannot be "
+ + "accessed: " + className);
+ err.initCause(err);
+ throw err;
+ }
+ }
+ }
+ return null;
+ }
+ });
+
+ }
+
} // class Toolkit
diff --git a/java/awt/Window.java b/java/awt/Window.java
index db4cd24bb..2be2d5f17 100644
--- a/java/awt/Window.java
+++ b/java/awt/Window.java
@@ -628,10 +628,25 @@ 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);
+ else
+ {
+ if (peer != null && (e.id == ComponentEvent.COMPONENT_RESIZED
+ || e.id == ComponentEvent.COMPONENT_MOVED))
+ {
+ Rectangle bounds = peer.getBounds();
+ x = bounds.x;
+ y = bounds.y;
+ height = bounds.height;
+ width = bounds.width;
+
+ if (e.id == ComponentEvent.COMPONENT_RESIZED)
+ {
+ invalidate();
+ validate();
+ }
+ }
+ super.dispatchEventImpl(e);
+ }
}
/**
diff --git a/java/awt/event/MouseEvent.java b/java/awt/event/MouseEvent.java
index 3e0fecacf..f2bcfbcc6 100644
--- a/java/awt/event/MouseEvent.java
+++ b/java/awt/event/MouseEvent.java
@@ -402,7 +402,11 @@ public class MouseEvent extends InputEvent
// FIXME: need a mauve test for this method
if (modifiersEx != 0)
s.append(",extModifiers=").append(getModifiersExText(modifiersEx));
- return s.append(",clickCount=").append(clickCount).toString();
+
+ s.append(",clickCount=").append(clickCount);
+ s.append(",consumed=").append(consumed);
+
+ return s.toString();
}
/**
diff --git a/java/awt/geom/Point2D.java b/java/awt/geom/Point2D.java
index 9f22a5a67..a2689abf8 100644
--- a/java/awt/geom/Point2D.java
+++ b/java/awt/geom/Point2D.java
@@ -1,5 +1,5 @@
/* Point2D.java -- generic point in 2-D space
- Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
+ Copyright (C) 1999, 2000, 2002, 2004, 2006, Free Software Foundation
This file is part of GNU Classpath.
@@ -135,7 +135,7 @@ public abstract class Point2D implements Cloneable
*/
public double distanceSq(double x, double y)
{
- return distanceSq(getX(), x, getY(), y);
+ return distanceSq(getX(), getY(), x, y);
}
/**
@@ -147,7 +147,7 @@ public abstract class Point2D implements Cloneable
*/
public double distanceSq(Point2D p)
{
- return distanceSq(getX(), p.getX(), getY(), p.getY());
+ return distanceSq(getX(), getY(), p.getX(), p.getY());
}
/**
@@ -159,7 +159,7 @@ public abstract class Point2D implements Cloneable
*/
public double distance(double x, double y)
{
- return distance(getX(), x, getY(), y);
+ return distance(getX(), getY(), x, y);
}
/**
@@ -171,7 +171,7 @@ public abstract class Point2D implements Cloneable
*/
public double distance(Point2D p)
{
- return distance(getX(), p.getX(), getY(), p.getY());
+ return distance(getX(), getY(), p.getX(), p.getY());
}
/**
diff --git a/java/awt/image/ComponentSampleModel.java b/java/awt/image/ComponentSampleModel.java
index 5cf06e4a1..b4e9450b0 100644
--- a/java/awt/image/ComponentSampleModel.java
+++ b/java/awt/image/ComponentSampleModel.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2006, Free Software Foundation
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ package java.awt.image;
import gnu.java.awt.Buffers;
+import java.util.Arrays;
+
/* FIXME: This class does not yet support data type TYPE_SHORT */
/**
@@ -60,11 +62,14 @@ import gnu.java.awt.Buffers;
*/
public class ComponentSampleModel extends SampleModel
{
+ /** The offsets to the first sample for each band. */
protected int[] bandOffsets;
+
+ /** The indices of the bank used to store each band in a data buffer. */
protected int[] bankIndices;
/**
- * Number of bands in the image described.
+ * The number of bands in the image.
* @specnote This field shadows the protected numBands in SampleModel.
*/
protected int numBands;
@@ -72,42 +77,128 @@ public class ComponentSampleModel extends SampleModel
/** Used when creating data buffers. */
protected int numBanks;
+ /**
+ * The number of data elements between a sample in one row and the
+ * corresponding sample in the next row.
+ */
protected int scanlineStride;
+ /**
+ * The number of data elements between a sample for one pixel and the
+ * corresponding sample for the next pixel in the same row.
+ */
protected int pixelStride;
private boolean tightPixelPacking = false;
+ /**
+ * Creates a new sample model that assumes that all bands are stored in a
+ * single bank of the {@link DataBuffer}.
+ * <p>
+ * Note that the <code>bandOffsets</code> array is copied to internal storage
+ * to prevent subsequent changes to the array from affecting this object.
+ *
+ * @param dataType the data type (one of {@link DataBuffer#TYPE_BYTE},
+ * {@link DataBuffer#TYPE_USHORT}, {@link DataBuffer#TYPE_SHORT},
+ * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT} or
+ * {@link DataBuffer#TYPE_DOUBLE}).
+ * @param w the width in pixels.
+ * @param h the height in pixels.
+ * @param pixelStride the number of data elements in the step from a sample
+ * in one pixel to the corresponding sample in the next pixel.
+ * @param scanlineStride the number of data elements in the step from a
+ * sample in a pixel to the corresponding sample in the pixel in the next
+ * row.
+ * @param bandOffsets the offset to the first element for each band, with
+ * the size of the array defining the number of bands (<code>null</code>
+ * not permitted).
+ *
+ * @throws IllegalArgumentException if <code>dataType</code> is not one of
+ * the specified values.
+ * @throws IllegalArgumentException if <code>w</code> is less than or equal
+ * to zero.
+ * @throws IllegalArgumentException if <code>h</code> is less than or equal
+ * to zero.
+ * @throws IllegalArgumentException if <code>w * h</code> exceeds
+ * {@link Integer#MAX_VALUE}.
+ * @throws IllegalArgumentException if <code>pixelStride</code> is negative.
+ * @throws IllegalArgumentException if <code>scanlineStride</code> is less
+ * than or equal to zero.
+ * @throws IllegalArgumentException if <code>bandOffsets</code> has zero
+ * length.
+ */
public ComponentSampleModel(int dataType,
- int w, int h,
- int pixelStride,
- int scanlineStride,
- int[] bandOffsets)
+ int w, int h,
+ int pixelStride,
+ int scanlineStride,
+ int[] bandOffsets)
{
this(dataType, w, h, pixelStride, scanlineStride,
- new int[bandOffsets.length], bandOffsets);
+ new int[bandOffsets.length], bandOffsets);
}
+ /**
+ * Creates a new sample model that assumes that all bands are stored in a
+ * single bank of the {@link DataBuffer}.
+ *
+ * @param dataType the data type (one of {@link DataBuffer#TYPE_BYTE},
+ * {@link DataBuffer#TYPE_USHORT}, {@link DataBuffer#TYPE_SHORT},
+ * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT} or
+ * {@link DataBuffer#TYPE_DOUBLE}).
+ * @param w the width in pixels.
+ * @param h the height in pixels.
+ * @param pixelStride the number of data elements in the step from a sample
+ * in one pixel to the corresponding sample in the next pixel.
+ * @param scanlineStride the number of data elements in the step from a
+ * sample in a pixel to the corresponding sample in the pixel in the next
+ * row.
+ * @param bankIndices the index of the bank in which each band is stored
+ * (<code>null</code> not permitted). This array is copied to internal
+ * storage so that subsequent updates to the array do not affect the sample
+ * model.
+ * @param bandOffsets the offset to the first element for each band, with
+ * the size of the array defining the number of bands (<code>null</code>
+ * not permitted). This array is copied to internal storage so that
+ * subsequent updates to the array do not affect the sample model.
+ *
+ * @throws IllegalArgumentException if <code>dataType</code> is not one of
+ * the specified values.
+ * @throws IllegalArgumentException if <code>w</code> is less than or equal
+ * to zero.
+ * @throws IllegalArgumentException if <code>h</code> is less than or equal
+ * to zero.
+ * @throws IllegalArgumentException if <code>w * h</code> exceeds
+ * {@link Integer#MAX_VALUE}.
+ * @throws IllegalArgumentException if <code>pixelStride</code> is negative.
+ * @throws IllegalArgumentException if <code>scanlineStride</code> is less
+ * than or equal to zero.
+ * @throws IllegalArgumentException if <code>bandOffsets</code> has zero
+ * length.
+ */
public ComponentSampleModel(int dataType,
- int w, int h,
- int pixelStride,
- int scanlineStride,
- int[] bankIndices,
- int[] bandOffsets)
+ int w, int h,
+ int pixelStride,
+ int scanlineStride,
+ int[] bankIndices,
+ int[] bandOffsets)
{
super(dataType, w, h, bandOffsets.length);
- if ((pixelStride<0) || (scanlineStride<0) ||
- (bandOffsets.length<1) ||
- (bandOffsets.length != bankIndices.length))
+
+ // super permits DataBuffer.TYPE_UNDEFINED but this class doesn't...
+ if (dataType == DataBuffer.TYPE_UNDEFINED)
+ throw new IllegalArgumentException("Unsupported dataType.");
+
+ if ((pixelStride < 0) || (scanlineStride < 0) || (bandOffsets.length < 1)
+ || (bandOffsets.length != bankIndices.length))
throw new IllegalArgumentException();
- this.bandOffsets = bandOffsets;
- this.bankIndices = bankIndices;
+ this.bandOffsets = (int[]) bandOffsets.clone();
+ this.bankIndices = (int[]) bankIndices.clone();
this.numBands = bandOffsets.length;
this.numBanks = 0;
- for (int b=0; b<bankIndices.length; b++)
- this.numBanks = Math.max(this.numBanks, bankIndices[b]+1);
+ for (int b = 0; b < bankIndices.length; b++)
+ this.numBanks = Math.max(this.numBanks, bankIndices[b] + 1);
this.scanlineStride = scanlineStride;
this.pixelStride = pixelStride;
@@ -116,68 +207,122 @@ public class ComponentSampleModel extends SampleModel
/* FIXME: May these checks should be reserved for the
PixelInterleavedSampleModel? */
-
+
if (pixelStride == numBands)
{
- tightPixelPacking = true;
- for (int b=0; b<numBands; b++) {
- if ((bandOffsets[b] != b) || (bankIndices[b] !=0))
- {
- tightPixelPacking = false;
- break;
- }
- }
+ tightPixelPacking = true;
+ for (int b = 0; b < numBands; b++) {
+ if ((bandOffsets[b] != b) || (bankIndices[b] != 0))
+ {
+ tightPixelPacking = false;
+ break;
+ }
+ }
}
- }
-
+ }
+
+ /**
+ * Creates a new sample model that is compatible with this one, but with the
+ * specified dimensions.
+ *
+ * @param w the width (must be greater than zero).
+ * @param h the height (must be greater than zero).
+ *
+ * @return A new sample model.
+ */
public SampleModel createCompatibleSampleModel(int w, int h)
{
return new ComponentSampleModel(dataType, w, h, pixelStride,
- scanlineStride, bankIndices,
- bandOffsets);
+ scanlineStride, bankIndices,
+ bandOffsets);
}
+ /**
+ * Creates a new sample model that provides access to a subset of the bands
+ * that this sample model supports.
+ *
+ * @param bands the bands (<code>null</code> not permitted).
+ *
+ * @return The new sample model.
+ */
public SampleModel createSubsetSampleModel(int[] bands)
{
int numBands = bands.length;
int[] bankIndices = new int[numBands];
int[] bandOffsets = new int[numBands];
- for (int b=0; b<numBands; b++)
+ for (int b = 0; b < numBands; b++)
{
- bankIndices[b] = this.bankIndices[bands[b]];
- bandOffsets[b] = this.bandOffsets[bands[b]];
+ bankIndices[b] = this.bankIndices[bands[b]];
+ bandOffsets[b] = this.bandOffsets[bands[b]];
}
return new ComponentSampleModel(dataType, width, height, pixelStride,
- scanlineStride, bankIndices,
- bandOffsets);
+ scanlineStride, bankIndices,
+ bandOffsets);
}
+ /**
+ * Creates a new data buffer that is compatible with this sample model.
+ *
+ * @return The new data buffer.
+ */
public DataBuffer createDataBuffer()
{
// Maybe this value should be precalculated in the constructor?
int highestOffset = 0;
- for (int b=0; b<numBands; b++)
+ for (int b = 0; b < numBands; b++)
{
- highestOffset = Math.max(highestOffset, bandOffsets[b]);
+ highestOffset = Math.max(highestOffset, bandOffsets[b]);
}
- int size = pixelStride*(width-1) + scanlineStride*(height-1) +
- highestOffset + 1;
+ int size = pixelStride * (width - 1) + scanlineStride * (height - 1)
+ + highestOffset + 1;
return Buffers.createBuffer(getDataType(), size, numBanks);
}
+ /**
+ * Returns the offset of the sample in band 0 for the pixel at location
+ * <code>(x, y)</code>. This offset can be used to read a sample value from
+ * a {@link DataBuffer}.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ *
+ * @return The offset.
+ *
+ * @see #getOffset(int, int, int)
+ */
public int getOffset(int x, int y)
{
return getOffset(x, y, 0);
}
+ /**
+ * Returns the offset of the sample in band <code>b</code> for the pixel at
+ * location <code>(x, y)</code>. This offset can be used to read a sample
+ * value from a {@link DataBuffer}.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param b the band index.
+ *
+ * @return The offset.
+ */
public int getOffset(int x, int y, int b)
{
- return bandOffsets[b] + pixelStride*x + scanlineStride*y;
+ return bandOffsets[b] + pixelStride * x + scanlineStride * y;
}
+ /**
+ * Returns the size in bits for each sample (one per band). For this sample
+ * model, each band has the same sample size and this is determined by the
+ * data type for the sample model.
+ *
+ * @return The sample sizes.
+ *
+ * @see SampleModel#getDataType()
+ */
public final int[] getSampleSize()
{
int size = DataBuffer.getDataTypeSize(getDataType());
@@ -187,39 +332,101 @@ public class ComponentSampleModel extends SampleModel
return sizes;
}
+ /**
+ * Returns the size in bits for the samples in the specified band. In this
+ * class, the sample size is the same for every band and is determined from
+ * the data type for the model.
+ *
+ * @param band the band index (ignored here).
+ *
+ * @return The sample size in bits.
+ *
+ * @see SampleModel#getDataType()
+ */
public final int getSampleSize(int band)
{
return DataBuffer.getDataTypeSize(getDataType());
}
+ /**
+ * Returns the indices of the bank(s) in the {@link DataBuffer} used to
+ * store the samples for each band. The returned array is a copy, so that
+ * altering it will not impact the sample model.
+ *
+ * @return The bank indices.
+ */
public final int[] getBankIndices()
{
- return bankIndices;
+ return (int[]) bankIndices.clone();
}
+ /**
+ * Returns the offsets to the first sample in each band. The returned array
+ * is a copy, so that altering it will not impact the sample model.
+ *
+ * @return The offsets.
+ */
public final int[] getBandOffsets()
{
- return bandOffsets;
+ return (int[]) bandOffsets.clone();
}
+ /**
+ * Returns the distance (in terms of element indices) between the sample for
+ * one pixel and the corresponding sample for the equivalent pixel in the
+ * next row. This is used in the calculation of the element offset for
+ * retrieving samples from a {@link DataBuffer}.
+ *
+ * @return The distance between pixel samples in consecutive rows.
+ */
public final int getScanlineStride()
{
return scanlineStride;
}
+ /**
+ * Returns the distance (in terms of element indices) between the sample for
+ * one pixel and the corresponding sample for the next pixel in a row. This
+ * is used in the calculation of the element offset for retrieving samples
+ * from a {@link DataBuffer}.
+ *
+ * @return The distance between pixel samples in the same row.
+ */
public final int getPixelStride()
{
return pixelStride;
}
+ /**
+ * Returns the number of data elements used to store the samples for one
+ * pixel. In this model, this is the same as the number of bands.
+ *
+ * @return The number of data elements used to store the samples for one
+ * pixel.
+ */
public final int getNumDataElements()
{
return numBands;
}
+ /**
+ * Returns the samples for the pixel at location <code>(x, y)</code> in
+ * a primitive array (the array type is determined by the data type for
+ * this model). The <code>obj</code> argument provides an option to supply
+ * an existing array to hold the result, if this is <code>null</code> a new
+ * array will be allocated.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param obj a primitive array that, if not <code>null</code>, will be
+ * used to store and return the sample values.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @return An array of sample values for the specified pixel.
+ */
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
{
- int xyOffset = pixelStride*x + scanlineStride*y;
+ int xyOffset = pixelStride * x + scanlineStride * y;
int[] totalBandDataOffsets = new int[numBands];
@@ -235,124 +442,147 @@ public class ComponentSampleModel extends SampleModel
int[] bankOffsets = data.getOffsets();
- for (int b=0; b<numBands; b++)
+ for (int b = 0; b < numBands; b++)
{
- totalBandDataOffsets[b] =
- bandOffsets[b]+bankOffsets[bankIndices[b]] + xyOffset;
+ totalBandDataOffsets[b] = bandOffsets[b] + bankOffsets[bankIndices[b]]
+ + xyOffset;
}
-
+
try
{
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- DataBufferByte inByte = (DataBufferByte) data;
- byte[] outByte = (byte[]) obj;
- if (outByte == null) outByte = new byte[numBands];
-
- for (int b=0; b<numBands; b++)
- {
- int dOffset = totalBandDataOffsets[b];
- outByte[b] = inByte.getData(bankIndices[b])[dOffset];
- }
- return outByte;
-
- case DataBuffer.TYPE_USHORT:
- DataBufferUShort inUShort = (DataBufferUShort) data;
- short[] outUShort = (short[]) obj;
- if (outUShort == null) outUShort = new short[numBands];
-
- for (int b=0; b<numBands; b++)
- {
- int dOffset = totalBandDataOffsets[b];
- outUShort[b] = inUShort.getData(bankIndices[b])[dOffset];
- }
- return outUShort;
-
- case DataBuffer.TYPE_SHORT:
- DataBufferShort inShort = (DataBufferShort) data;
- short[] outShort = (short[]) obj;
- if (outShort == null) outShort = new short[numBands];
-
- for (int b=0; b<numBands; b++)
- {
- int dOffset = totalBandDataOffsets[b];
- outShort[b] = inShort.getData(bankIndices[b])[dOffset];
- }
- return outShort;
-
- case DataBuffer.TYPE_INT:
- DataBufferInt inInt = (DataBufferInt) data;
- int[] outInt = (int[]) obj;
- if (outInt == null) outInt = new int[numBands];
-
- for (int b=0; b<numBands; b++)
- {
- int dOffset = totalBandDataOffsets[b];
- outInt[b] = inInt.getData(bankIndices[b])[dOffset];
- }
- return outInt;
-
- case DataBuffer.TYPE_FLOAT:
- DataBufferFloat inFloat = (DataBufferFloat) data;
- float[] outFloat = (float[]) obj;
- if (outFloat == null) outFloat = new float[numBands];
-
- for (int b=0; b<numBands; b++)
- {
- int dOffset = totalBandDataOffsets[b];
- outFloat[b] = inFloat.getData(bankIndices[b])[dOffset];
- }
- return outFloat;
-
- case DataBuffer.TYPE_DOUBLE:
- DataBufferDouble inDouble = (DataBufferDouble) data;
- double[] outDouble = (double[]) obj;
- if (outDouble == null) outDouble = new double[numBands];
-
- for (int b=0; b<numBands; b++)
- {
- int dOffset = totalBandDataOffsets[b];
- outDouble[b] = inDouble.getData(bankIndices[b])[dOffset];
- }
- return outDouble;
-
- default:
- throw new IllegalStateException("unknown transfer type " +
- getTransferType());
- }
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ DataBufferByte inByte = (DataBufferByte) data;
+ byte[] outByte = (byte[]) obj;
+ if (outByte == null)
+ outByte = new byte[numBands];
+
+ for (int b = 0; b < numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outByte[b] = inByte.getData(bankIndices[b])[dOffset];
+ }
+ return outByte;
+
+ case DataBuffer.TYPE_USHORT:
+ DataBufferUShort inUShort = (DataBufferUShort) data;
+ short[] outUShort = (short[]) obj;
+ if (outUShort == null)
+ outUShort = new short[numBands];
+
+ for (int b = 0; b < numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outUShort[b] = inUShort.getData(bankIndices[b])[dOffset];
+ }
+ return outUShort;
+
+ case DataBuffer.TYPE_SHORT:
+ DataBufferShort inShort = (DataBufferShort) data;
+ short[] outShort = (short[]) obj;
+ if (outShort == null)
+ outShort = new short[numBands];
+
+ for (int b = 0; b < numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outShort[b] = inShort.getData(bankIndices[b])[dOffset];
+ }
+ return outShort;
+
+ case DataBuffer.TYPE_INT:
+ DataBufferInt inInt = (DataBufferInt) data;
+ int[] outInt = (int[]) obj;
+ if (outInt == null)
+ outInt = new int[numBands];
+
+ for (int b = 0; b < numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outInt[b] = inInt.getData(bankIndices[b])[dOffset];
+ }
+ return outInt;
+
+ case DataBuffer.TYPE_FLOAT:
+ DataBufferFloat inFloat = (DataBufferFloat) data;
+ float[] outFloat = (float[]) obj;
+ if (outFloat == null)
+ outFloat = new float[numBands];
+
+ for (int b = 0; b < numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outFloat[b] = inFloat.getData(bankIndices[b])[dOffset];
+ }
+ return outFloat;
+
+ case DataBuffer.TYPE_DOUBLE:
+ DataBufferDouble inDouble = (DataBufferDouble) data;
+ double[] outDouble = (double[]) obj;
+ if (outDouble == null)
+ outDouble = new double[numBands];
+
+ for (int b = 0; b < numBands; b++)
+ {
+ int dOffset = totalBandDataOffsets[b];
+ outDouble[b] = inDouble.getData(bankIndices[b])[dOffset];
+ }
+ return outDouble;
+
+ default:
+ throw new IllegalStateException("unknown transfer type "
+ + getTransferType());
+ }
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
- String msg = "While reading data elements, " +
- "x=" + x + ", y=" + y +", " + ", xyOffset=" + xyOffset +
- ", data.getSize()=" + data.getSize() + ": " + aioobe;
- throw new ArrayIndexOutOfBoundsException(msg);
+ String msg = "While reading data elements, " +
+ "x=" + x + ", y=" + y +", " + ", xyOffset=" + xyOffset +
+ ", data.getSize()=" + data.getSize() + ": " + aioobe;
+ throw new ArrayIndexOutOfBoundsException(msg);
}
}
+ /**
+ * Returns the samples for the pixels in the region defined by
+ * <code>(x, y, w, h)</code> in a primitive array (the array type is
+ * determined by the data type for this model). The <code>obj</code>
+ * argument provides an option to supply an existing array to hold the
+ * result, if this is <code>null</code> a new array will be allocated.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ * @param obj a primitive array that, if not <code>null</code>, will be
+ * used to store and return the sample values.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @return An array of sample values for the specified pixels.
+ *
+ * @see #setDataElements(int, int, int, int, Object, DataBuffer)
+ */
public Object getDataElements(int x, int y, int w, int h, Object obj,
- DataBuffer data)
+ DataBuffer data)
{
if (!tightPixelPacking)
{
- return super.getDataElements(x, y, w, h, obj, data);
+ return super.getDataElements(x, y, w, h, obj, data);
}
// using get speedup
// We can copy whole rows
- int rowSize = w*numBands;
- int dataSize = rowSize*h;
+ int rowSize = w * numBands;
+ int dataSize = rowSize * h;
- DataBuffer transferBuffer =
- Buffers.createBuffer(getTransferType(), obj, dataSize);
+ DataBuffer transferBuffer = Buffers.createBuffer(getTransferType(), obj,
+ dataSize);
obj = Buffers.getData(transferBuffer);
- int inOffset =
- pixelStride*x +
- scanlineStride*y +
- data.getOffset(); // Assumes only one band is used
+ int inOffset = pixelStride * x + scanlineStride * y + data.getOffset();
+ // Assumes only one band is used
/* We don't add band offsets since we assume that bands have
offsets 0, 1, 2, ... */
@@ -360,189 +590,345 @@ public class ComponentSampleModel extends SampleModel
// See if we can copy everything in one go
if (scanlineStride == rowSize)
{
- // Collapse scan lines:
- rowSize *= h;
- // We ignore scanlineStride since it won't be of any use
- h = 1;
+ // Collapse scan lines:
+ rowSize *= h;
+ // We ignore scanlineStride since it won't be of any use
+ h = 1;
}
int outOffset = 0;
Object inArray = Buffers.getData(data);
- for (int yd = 0; yd<h; yd++)
+ for (int yd = 0; yd < h; yd++)
{
- System.arraycopy(inArray, inOffset, obj, outOffset, rowSize);
- inOffset += scanlineStride;
- outOffset += rowSize;
+ System.arraycopy(inArray, inOffset, obj, outOffset, rowSize);
+ inOffset += scanlineStride;
+ outOffset += rowSize;
}
return obj;
}
+ /**
+ * Sets the samples for the pixels in the region defined by
+ * <code>(x, y, w, h)</code> from a supplied primitive array (the array type
+ * must be consistent with the data type for this model).
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ * @param obj a primitive array containing the sample values.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @see #getDataElements(int, int, int, int, Object, DataBuffer)
+ */
public void setDataElements(int x, int y, int w, int h,
- Object obj, DataBuffer data)
+ Object obj, DataBuffer data)
{
if (!tightPixelPacking)
{
- super.setDataElements(x, y, w, h, obj, data);
- return;
+ super.setDataElements(x, y, w, h, obj, data);
+ return;
}
// using set speedup, we can copy whole rows
- int rowSize = w*numBands;
- int dataSize = rowSize*h;
+ int rowSize = w * numBands;
+ int dataSize = rowSize * h;
- DataBuffer transferBuffer =
- Buffers.createBufferFromData(getTransferType(), obj, dataSize);
+ DataBuffer transferBuffer
+ = Buffers.createBufferFromData(getTransferType(), obj, dataSize);
int[] bankOffsets = data.getOffsets();
- int outOffset =
- pixelStride*x +
- scanlineStride*y +
- bankOffsets[0]; // same assuptions as in get...
+ int outOffset = pixelStride * x + scanlineStride * y + bankOffsets[0];
+ // same assumptions as in get...
// See if we can copy everything in one go
if (scanlineStride == rowSize)
{
- // Collapse scan lines:
- rowSize *= h;
- h = 1;
+ // Collapse scan lines:
+ rowSize *= h;
+ h = 1;
}
int inOffset = 0;
Object outArray = Buffers.getData(data);
- for (int yd = 0; yd<h; yd++)
+ for (int yd = 0; yd < h; yd++)
{
- System.arraycopy(obj, inOffset, outArray, outOffset, rowSize);
- outOffset += scanlineStride;
- inOffset += rowSize;
+ System.arraycopy(obj, inOffset, outArray, outOffset, rowSize);
+ outOffset += scanlineStride;
+ inOffset += rowSize;
}
}
+ /**
+ * Returns all the samples for the pixel at location <code>(x, y)</code>
+ * stored in the specified data buffer.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param iArray an array that will be populated with the sample values and
+ * returned as the result. The size of this array should be equal to the
+ * number of bands in the model. If the array is <code>null</code>, a new
+ * array is created.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @return The samples for the specified pixel.
+ *
+ * @see #setPixel(int, int, int[], DataBuffer)
+ */
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
{
- int offset = pixelStride*x + scanlineStride*y;
- if (iArray == null) iArray = new int[numBands];
- for (int b=0; b<numBands; b++)
+ int offset = pixelStride * x + scanlineStride * y;
+ if (iArray == null)
+ iArray = new int[numBands];
+ for (int b = 0; b < numBands; b++)
{
- iArray[b] = data.getElem(bankIndices[b], offset+bandOffsets[b]);
+ iArray[b] = data.getElem(bankIndices[b], offset + bandOffsets[b]);
}
return iArray;
}
+ /**
+ * Returns the samples for all the pixels in a rectangular region.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ * @param iArray an array that if non-<code>null</code> will be populated
+ * with the sample values and returned as the result.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @return The samples for all the pixels in the rectangle.
+ */
public int[] getPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
- int offset = pixelStride*x + scanlineStride*y;
- if (iArray == null) iArray = new int[numBands*w*h];
+ int offset = pixelStride * x + scanlineStride * y;
+ if (iArray == null)
+ iArray = new int[numBands * w * h];
int outOffset = 0;
- for (y=0; y<h; y++)
+ for (y = 0; y < h; y++)
{
- int lineOffset = offset;
- for (x=0; x<w; x++)
- {
- for (int b=0; b<numBands; b++)
- {
- iArray[outOffset++] =
- data.getElem(bankIndices[b], lineOffset+bandOffsets[b]);
- }
- lineOffset += pixelStride;
- }
- offset += scanlineStride;
+ int lineOffset = offset;
+ for (x = 0; x < w; x++)
+ {
+ for (int b = 0; b < numBands; b++)
+ {
+ iArray[outOffset++]
+ = data.getElem(bankIndices[b], lineOffset+bandOffsets[b]);
+ }
+ lineOffset += pixelStride;
+ }
+ offset += scanlineStride;
}
return iArray;
}
-
+
+ /**
+ * Returns the sample for band <code>b</code> of the pixel at
+ * <code>(x, y)</code> that is stored in the specified data buffer.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param b the band index.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @return The sample value.
+ *
+ * @see #setSample(int, int, int, int, DataBuffer)
+ */
public int getSample(int x, int y, int b, DataBuffer data)
{
return data.getElem(bankIndices[b], getOffset(x, y, b));
}
+ /**
+ * Sets the samples for the pixel at location <code>(x, y)</code> from the
+ * supplied primitive array (the array type must be consistent with the data
+ * type for this model).
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param obj a primitive array containing the pixel's sample values.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @see #setDataElements(int, int, Object, DataBuffer)
+ */
public void setDataElements(int x, int y, Object obj, DataBuffer data)
{
- int offset = pixelStride*x + scanlineStride*y;
+ int offset = pixelStride * x + scanlineStride * y;
int[] totalBandDataOffsets = new int[numBands];
int[] bankOffsets = data.getOffsets();
- for (int b=0; b<numBands; b++)
- totalBandDataOffsets[b] =
- bandOffsets[b]+bankOffsets[bankIndices[b]] + offset;
+ for (int b = 0; b < numBands; b++)
+ totalBandDataOffsets[b] = bandOffsets[b] + bankOffsets[bankIndices[b]]
+ + offset;
switch (getTransferType())
{
case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] in = (byte[]) obj;
-
- for (int b=0; b<numBands; b++)
- out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
-
- return;
- }
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] in = (byte[]) obj;
+
+ for (int b = 0; b < numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
case DataBuffer.TYPE_USHORT:
- {
- DataBufferUShort out = (DataBufferUShort) data;
- short[] in = (short[]) obj;
-
- for (int b=0; b<numBands; b++)
- out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
-
- return;
- }
+ {
+ DataBufferUShort out = (DataBufferUShort) data;
+ short[] in = (short[]) obj;
+
+ for (int b = 0; b < numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
case DataBuffer.TYPE_SHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] in = (short[]) obj;
-
- for (int b=0; b<numBands; b++)
- out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
-
- return;
- }
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] in = (short[]) obj;
+
+ for (int b = 0; b < numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] in = (int[]) obj;
-
- for (int b=0; b<numBands; b++)
- out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
-
- return;
- }
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] in = (int[]) obj;
+
+ for (int b = 0; b < numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
case DataBuffer.TYPE_FLOAT:
- {
- DataBufferFloat out = (DataBufferFloat) data;
- float[] in = (float[]) obj;
-
- for (int b=0; b<numBands; b++)
- out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
-
- return;
- }
+ {
+ DataBufferFloat out = (DataBufferFloat) data;
+ float[] in = (float[]) obj;
+
+ for (int b = 0; b < numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
case DataBuffer.TYPE_DOUBLE:
- {
- DataBufferDouble out = (DataBufferDouble) data;
- double[] in = (double[]) obj;
-
- for (int b=0; b<numBands; b++)
- out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
-
- return;
- }
+ {
+ DataBufferDouble out = (DataBufferDouble) data;
+ double[] in = (double[]) obj;
+
+ for (int b = 0; b < numBands; b++)
+ out.getData(bankIndices[b])[totalBandDataOffsets[b]] = in[b];
+
+ return;
+ }
default:
- throw new UnsupportedOperationException("transfer type not " +
- "implemented");
+ throw new UnsupportedOperationException("transfer type not " +
+ "implemented");
}
}
+ /**
+ * Sets the sample values for the pixel at location <code>(x, y)</code>
+ * stored in the specified data buffer.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param iArray the pixel sample values (<code>null</code> not permitted).
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @see #getPixel(int, int, int[], DataBuffer)
+ */
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
{
- int offset = pixelStride*x + scanlineStride*y;
- for (int b=0; b<numBands; b++)
- data.setElem(bankIndices[b], offset+bandOffsets[b], iArray[b]);
+ int offset = pixelStride * x + scanlineStride * y;
+ for (int b = 0; b < numBands; b++)
+ data.setElem(bankIndices[b], offset + bandOffsets[b], iArray[b]);
}
+ /**
+ * Sets the sample value for band <code>b</code> of the pixel at location
+ * <code>(x, y)</code> in the specified data buffer.
+ *
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param b the band index.
+ * @param s the sample value.
+ * @param data the data buffer (<code>null</code> not permitted).
+ *
+ * @see #getSample(int, int, int, DataBuffer)
+ */
public void setSample(int x, int y, int b, int s, DataBuffer data)
{
data.setElem(bankIndices[b], getOffset(x, y, b), s);
}
+
+ /**
+ * Tests this sample model for equality with an arbitrary object. Returns
+ * <code>true</code> if and only if:
+ * <ul>
+ * <li><code>obj</code> is not <code>null</code>;</li>
+ * <li><code>obj</code> is an instance of <code>ComponentSampleModel</code>;
+ * </li>
+ * <li>both models have the same values for the <code>dataType</code>,
+ * <code>width</code>, <code>height</code>, <code>pixelStride</code>,
+ * <code>scanlineStride</code>, <code>bandOffsets</code> and
+ * <code>bankIndices</code> fields.</li>
+ * </ul>
+ *
+ * @param obj the object to test (<code>null</code> permitted).
+ *
+ * @return <code>true</code> if this sample model is equal to
+ * <code>obj</code>, and <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ return false;
+ if (! (obj instanceof ComponentSampleModel))
+ return false;
+ ComponentSampleModel that = (ComponentSampleModel) obj;
+ if (this.dataType != that.dataType)
+ return false;
+ if (this.width != that.width)
+ return false;
+ if (this.height != that.height)
+ return false;
+ if (this.pixelStride != that.pixelStride)
+ return false;
+ if (this.scanlineStride != that.scanlineStride)
+ return false;
+ if (! Arrays.equals(this.bandOffsets, that.bandOffsets))
+ return false;
+ if (! Arrays.equals(this.bankIndices, that.bankIndices))
+ return false;
+ // couldn't find any difference, so...
+ return true;
+ }
+
+ /**
+ * Returns a hash code for this sample model.
+ *
+ * @return The hash code.
+ */
+ public int hashCode()
+ {
+ // this computation is based on the method described in Chapter 3
+ // of Joshua Bloch's Effective Java...
+ int result = 17;
+ result = 37 * result + dataType;
+ result = 37 * result + width;
+ result = 37 * result + height;
+ result = 37 * result + pixelStride;
+ result = 37 * result + scanlineStride;
+ for (int i = 0; i < bandOffsets.length; i++)
+ result = 37 * result + bandOffsets[i];
+ for (int i = 0; i < bankIndices.length; i++)
+ result = 37 * result + bankIndices[i];
+ return result;
+ }
}
diff --git a/java/awt/image/DirectColorModel.java b/java/awt/image/DirectColorModel.java
index 4f3715178..579dc97df 100644
--- a/java/awt/image/DirectColorModel.java
+++ b/java/awt/image/DirectColorModel.java
@@ -167,7 +167,7 @@ public class DirectColorModel extends PackedColorModel
private int extractAndNormalizeSample(int pixel, int component)
{
int value = extractAndScaleSample(pixel, component);
- if (hasAlpha() && isAlphaPremultiplied())
+ if (hasAlpha() && isAlphaPremultiplied() && getAlpha(pixel) != 0)
value = value*255/getAlpha(pixel);
return value;
}
diff --git a/java/awt/image/SampleModel.java b/java/awt/image/SampleModel.java
index 115966222..6e3fd4069 100644
--- a/java/awt/image/SampleModel.java
+++ b/java/awt/image/SampleModel.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2005 Free Software Foundation
+/* Copyright (C) 2000, 2001, 2002, 2005, 2006, Free Software Foundation
This file is part of GNU Classpath.
@@ -57,15 +57,43 @@ public abstract class SampleModel
*/
protected int dataType;
+ /**
+ * Creates a new sample model with the specified attributes.
+ *
+ * @param dataType the data type (one of {@link DataBuffer#TYPE_BYTE},
+ * {@link DataBuffer#TYPE_USHORT}, {@link DataBuffer#TYPE_SHORT},
+ * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT},
+ * {@link DataBuffer#TYPE_DOUBLE} or {@link DataBuffer#TYPE_UNDEFINED}).
+ * @param w the width in pixels (must be greater than zero).
+ * @param h the height in pixels (must be greater than zero).
+ * @param numBands the number of bands (must be greater than zero).
+ *
+ * @throws IllegalArgumentException if <code>dataType</code> is not one of
+ * the listed values.
+ * @throws IllegalArgumentException if <code>w</code> is less than or equal
+ * to zero.
+ * @throws IllegalArgumentException if <code>h</code> is less than or equal
+ * to zero.
+ * @throws IllegalArgumentException if <code>w * h</code> is greater than
+ * {@link Integer#MAX_VALUE}.
+ */
public SampleModel(int dataType, int w, int h, int numBands)
{
+ if (dataType != DataBuffer.TYPE_UNDEFINED)
+ if (dataType < DataBuffer.TYPE_BYTE || dataType > DataBuffer.TYPE_DOUBLE)
+ throw new IllegalArgumentException("Unrecognised 'dataType' argument.");
+
if ((w <= 0) || (h <= 0))
throw new IllegalArgumentException((w <= 0 ? " width<=0" : " width is ok")
- +(h <= 0 ? " height<=0" : " height is ok"));
-
- // FIXME: How can an int be greater than Integer.MAX_VALUE?
- // FIXME: How do we identify an unsupported data type?
-
+ + (h <= 0 ? " height<=0" : " height is ok"));
+
+ long area = (long) w * (long) h;
+ if (area > Integer.MAX_VALUE)
+ throw new IllegalArgumentException("w * h exceeds Integer.MAX_VALUE.");
+
+ if (numBands <= 0)
+ throw new IllegalArgumentException("Requires numBands > 0.");
+
this.dataType = dataType;
this.width = w;
this.height = h;
@@ -102,8 +130,10 @@ public abstract class SampleModel
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
{
- if (iArray == null) iArray = new int[numBands];
- for (int b=0; b<numBands; b++) iArray[b] = getSample(x, y, b, data);
+ if (iArray == null)
+ iArray = new int[numBands];
+ for (int b = 0; b < numBands; b++)
+ iArray[b] = getSample(x, y, b, data);
return iArray;
}
@@ -121,94 +151,95 @@ public abstract class SampleModel
* DataBuffer.TYPE_USHORT, then a short[] object is returned.
*/
public abstract Object getDataElements(int x, int y, Object obj,
- DataBuffer data);
+ DataBuffer data);
public Object getDataElements(int x, int y, int w, int h, Object obj,
- DataBuffer data)
+ DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int numDataElements = getNumDataElements();
- int dataSize = numDataElements*size;
+ int dataSize = numDataElements * size;
if (obj == null)
{
- switch (getTransferType())
- {
- case DataBuffer.TYPE_BYTE:
- obj = new byte[dataSize];
- break;
- case DataBuffer.TYPE_USHORT:
- obj = new short[dataSize];
- break;
- case DataBuffer.TYPE_INT:
- obj = new int[dataSize];
- break;
- default:
- // Seems like the only sensible thing to do.
- throw new ClassCastException();
- }
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ obj = new byte[dataSize];
+ break;
+ case DataBuffer.TYPE_USHORT:
+ obj = new short[dataSize];
+ break;
+ case DataBuffer.TYPE_INT:
+ obj = new int[dataSize];
+ break;
+ default:
+ // Seems like the only sensible thing to do.
+ throw new ClassCastException();
+ }
}
Object pixelData = null;
int outOffset = 0;
- for (int yy = y; yy<(y+h); yy++)
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx = x; xx<(x+w); xx++)
- {
- pixelData = getDataElements(xx, yy, pixelData, data);
- System.arraycopy(pixelData, 0, obj, outOffset,
- numDataElements);
- outOffset += numDataElements;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ pixelData = getDataElements(xx, yy, pixelData, data);
+ System.arraycopy(pixelData, 0, obj, outOffset,
+ numDataElements);
+ outOffset += numDataElements;
+ }
}
return obj;
}
public abstract void setDataElements(int x, int y, Object obj,
- DataBuffer data);
+ DataBuffer data);
public void setDataElements(int x, int y, int w, int h,
- Object obj, DataBuffer data)
+ Object obj, DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int numDataElements = getNumDataElements();
- int dataSize = numDataElements*size;
+ int dataSize = numDataElements * size;
Object pixelData;
switch (getTransferType())
{
case DataBuffer.TYPE_BYTE:
- pixelData = new byte[numDataElements];
- break;
+ pixelData = new byte[numDataElements];
+ break;
case DataBuffer.TYPE_USHORT:
- pixelData = new short[numDataElements];
- break;
+ pixelData = new short[numDataElements];
+ break;
case DataBuffer.TYPE_INT:
- pixelData = new int[numDataElements];
- break;
+ pixelData = new int[numDataElements];
+ break;
default:
- // Seems like the only sensible thing to do.
- throw new ClassCastException();
+ // Seems like the only sensible thing to do.
+ throw new ClassCastException();
}
int inOffset = 0;
- for (int yy=y; yy<(y+h); yy++)
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- System.arraycopy(obj, inOffset, pixelData, 0,
- numDataElements);
- setDataElements(xx, yy, pixelData, data);
- inOffset += numDataElements;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ System.arraycopy(obj, inOffset, pixelData, 0,
+ numDataElements);
+ setDataElements(xx, yy, pixelData, data);
+ inOffset += numDataElements;
+ }
}
}
public float[] getPixel(int x, int y, float[] fArray, DataBuffer data)
{
- if (fArray == null) fArray = new float[numBands];
+ if (fArray == null)
+ fArray = new float[numBands];
- for (int b=0; b<numBands; b++)
+ for (int b = 0; b < numBands; b++)
{
fArray[b] = getSampleFloat(x, y, b, data);
}
@@ -216,10 +247,11 @@ public abstract class SampleModel
}
public double[] getPixel(int x, int y, double[] dArray, DataBuffer data) {
- if (dArray == null) dArray = new double[numBands];
- for (int b=0; b<numBands; b++)
+ if (dArray == null)
+ dArray = new double[numBands];
+ for (int b = 0; b < numBands; b++)
{
- dArray[b] = getSampleDouble(x, y, b, data);
+ dArray[b] = getSampleDouble(x, y, b, data);
}
return dArray;
}
@@ -227,20 +259,21 @@ public abstract class SampleModel
/* FIXME: Should it return a banded or pixel interleaved array of
samples? (Assume interleaved.) */
public int[] getPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int outOffset = 0;
int[] pixel = null;
- if (iArray == null) iArray = new int[w*h*numBands];
- for (int yy=y; yy<(y+h); yy++)
+ if (iArray == null)
+ iArray = new int[w * h * numBands];
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- pixel = getPixel(xx, yy, pixel, data);
- System.arraycopy(pixel, 0, iArray, outOffset, numBands);
- outOffset += numBands;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ pixel = getPixel(xx, yy, pixel, data);
+ System.arraycopy(pixel, 0, iArray, outOffset, numBands);
+ outOffset += numBands;
+ }
}
return iArray;
}
@@ -248,20 +281,20 @@ public abstract class SampleModel
/* FIXME: Should it return a banded or pixel interleaved array of
samples? (Assume interleaved.) */
public float[] getPixels(int x, int y, int w, int h, float[] fArray,
- DataBuffer data)
+ DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int outOffset = 0;
float[] pixel = null;
- if (fArray == null) fArray = new float[w*h*numBands];
- for (int yy=y; yy<(y+h); yy++)
+ if (fArray == null) fArray = new float[w * h * numBands];
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- pixel = getPixel(xx, yy, pixel, data);
- System.arraycopy(pixel, 0, fArray, outOffset, numBands);
- outOffset += numBands;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ pixel = getPixel(xx, yy, pixel, data);
+ System.arraycopy(pixel, 0, fArray, outOffset, numBands);
+ outOffset += numBands;
+ }
}
return fArray;
}
@@ -269,20 +302,21 @@ public abstract class SampleModel
/* FIXME: Should it return a banded or pixel interleaved array of
samples? (Assume interleaved.) */
public double[] getPixels(int x, int y, int w, int h, double[] dArray,
- DataBuffer data)
+ DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int outOffset = 0;
double[] pixel = null;
- if (dArray == null) dArray = new double[w*h*numBands];
- for (int yy=y; yy<(y+h); yy++)
+ if (dArray == null)
+ dArray = new double[w * h * numBands];
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- pixel = getPixel(xx, yy, pixel, data);
- System.arraycopy(pixel, 0, dArray, outOffset, numBands);
- outOffset += numBands;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ pixel = getPixel(xx, yy, pixel, data);
+ System.arraycopy(pixel, 0, dArray, outOffset, numBands);
+ outOffset += numBands;
+ }
}
return dArray;
}
@@ -300,179 +334,185 @@ public abstract class SampleModel
}
public int[] getSamples(int x, int y, int w, int h, int b,
- int[] iArray, DataBuffer data)
+ int[] iArray, DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int outOffset = 0;
- if (iArray == null) iArray = new int[size];
- for (int yy=y; yy<(y+h); yy++)
+ if (iArray == null)
+ iArray = new int[size];
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- iArray[outOffset++] = getSample(xx, yy, b, data);
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ iArray[outOffset++] = getSample(xx, yy, b, data);
+ }
}
return iArray;
}
public float[] getSamples(int x, int y, int w, int h, int b,
- float[] fArray, DataBuffer data)
+ float[] fArray, DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int outOffset = 0;
- if (fArray == null) fArray = new float[size];
- for (int yy=y; yy<(y+h); yy++)
+ if (fArray == null)
+ fArray = new float[size];
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- fArray[outOffset++] = getSampleFloat(xx, yy, b, data);
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ fArray[outOffset++] = getSampleFloat(xx, yy, b, data);
+ }
}
return fArray;
}
public double[] getSamples(int x, int y, int w, int h, int b,
- double[] dArray, DataBuffer data)
+ double[] dArray, DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int outOffset = 0;
- if (dArray == null) dArray = new double[size];
- for (int yy=y; yy<(y+h); yy++)
+ if (dArray == null)
+ dArray = new double[size];
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- dArray[outOffset++] = getSampleDouble(xx, yy, b, data);
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ dArray[outOffset++] = getSampleDouble(xx, yy, b, data);
+ }
}
return dArray;
}
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
{
- for (int b=0; b<numBands; b++) setSample(x, y, b, iArray[b], data);
+ for (int b = 0; b < numBands; b++)
+ setSample(x, y, b, iArray[b], data);
}
public void setPixel(int x, int y, float[] fArray, DataBuffer data)
{
- for (int b=0; b<numBands; b++) setSample(x, y, b, fArray[b], data);
+ for (int b = 0; b < numBands; b++)
+ setSample(x, y, b, fArray[b], data);
}
public void setPixel(int x, int y, double[] dArray, DataBuffer data)
{
- for (int b=0; b<numBands; b++) setSample(x, y, b, dArray[b], data);
+ for (int b = 0; b < numBands; b++)
+ setSample(x, y, b, dArray[b], data);
}
public void setPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
int inOffset = 0;
int[] pixel = new int[numBands];
- for (int yy=y; yy<(y+h); yy++)
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- System.arraycopy(iArray, inOffset, pixel, 0, numBands);
- setPixel(xx, yy, pixel, data);
- inOffset += numBands;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ System.arraycopy(iArray, inOffset, pixel, 0, numBands);
+ setPixel(xx, yy, pixel, data);
+ inOffset += numBands;
+ }
}
}
public void setPixels(int x, int y, int w, int h, float[] fArray,
- DataBuffer data)
+ DataBuffer data)
{
int inOffset = 0;
float[] pixel = new float[numBands];
- for (int yy=y; yy<(y+h); yy++)
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- System.arraycopy(fArray, inOffset, pixel, 0, numBands);
- setPixel(xx, yy, pixel, data);
- inOffset += numBands;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ System.arraycopy(fArray, inOffset, pixel, 0, numBands);
+ setPixel(xx, yy, pixel, data);
+ inOffset += numBands;
+ }
}
}
public void setPixels(int x, int y, int w, int h, double[] dArray,
- DataBuffer data)
+ DataBuffer data)
{
int inOffset = 0;
double[] pixel = new double[numBands];
- for (int yy=y; yy<(y+h); yy++)
+ for (int yy = y; yy < (y + h); yy++)
{
- for (int xx=x; xx<(x+w); xx++)
- {
- System.arraycopy(dArray, inOffset, pixel, 0, numBands);
- setPixel(xx, yy, pixel, data);
- inOffset += numBands;
- }
+ for (int xx = x; xx < (x + w); xx++)
+ {
+ System.arraycopy(dArray, inOffset, pixel, 0, numBands);
+ setPixel(xx, yy, pixel, data);
+ inOffset += numBands;
+ }
}
}
public abstract void setSample(int x, int y, int b, int s,
- DataBuffer data);
+ DataBuffer data);
public void setSample(int x, int y, int b, float s,
- DataBuffer data)
+ DataBuffer data)
{
setSample(x, y, b, (int) s, data);
}
public void setSample(int x, int y, int b, double s,
- DataBuffer data)
+ DataBuffer data)
{
setSample(x, y, b, (float) s, data);
}
public void setSamples(int x, int y, int w, int h, int b,
- int[] iArray, DataBuffer data)
+ int[] iArray, DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
int inOffset = 0;
- for (int yy=y; yy<(y+h); yy++)
- for (int xx=x; xx<(x+w); xx++)
- setSample(xx, yy, b, iArray[inOffset++], data);
+ for (int yy = y; yy < (y + h); yy++)
+ for (int xx = x; xx < (x + w); xx++)
+ setSample(xx, yy, b, iArray[inOffset++], data);
}
public void setSamples(int x, int y, int w, int h, int b,
- float[] fArray, DataBuffer data)
+ float[] fArray, DataBuffer data)
{
- int size = w*h;
+ int size = w * h;
+ int inOffset = 0;
+ for (int yy = y; yy < (y + h); yy++)
+ for (int xx = x; xx < (x + w); xx++)
+ setSample(xx, yy, b, fArray[inOffset++], data);
+
+ }
+
+ public void setSamples(int x, int y, int w, int h, int b,
+ double[] dArray, DataBuffer data) {
+ int size = w * h;
int inOffset = 0;
- for (int yy=y; yy<(y+h); yy++)
- for (int xx=x; xx<(x+w); xx++)
- setSample(xx, yy, b, fArray[inOffset++], data);
-
- }
-
- public void setSamples(int x, int y, int w, int h, int b,
- double[] dArray, DataBuffer data) {
- int size = w*h;
- int inOffset = 0;
- for (int yy=y; yy<(y+h); yy++)
- for (int xx=x; xx<(x+w); xx++)
- setSample(xx, yy, b, dArray[inOffset++], data);
- }
-
- public abstract SampleModel createCompatibleSampleModel(int w, int h);
-
- /**
- * Return a SampleModel with a subset of the bands in this model.
- *
- * Selects bands.length bands from this sample model. The bands chosen
- * are specified in the indices of bands[]. This also permits permuting
- * the bands as well as taking a subset. Thus, giving an array with
- * 1, 2, 3, ..., numbands, will give an identical sample model.
- *
- * @param bands Array with band indices to include.
- * @return A new sample model
- */
- public abstract SampleModel createSubsetSampleModel(int[] bands);
-
- public abstract DataBuffer createDataBuffer();
-
- public abstract int[] getSampleSize();
-
- public abstract int getSampleSize(int band);
+ for (int yy = y; yy < (y + h); yy++)
+ for (int xx = x; xx < (x + w); xx++)
+ setSample(xx, yy, b, dArray[inOffset++], data);
+ }
+
+ public abstract SampleModel createCompatibleSampleModel(int w, int h);
+
+ /**
+ * Return a SampleModel with a subset of the bands in this model.
+ *
+ * Selects bands.length bands from this sample model. The bands chosen
+ * are specified in the indices of bands[]. This also permits permuting
+ * the bands as well as taking a subset. Thus, giving an array with
+ * 1, 2, 3, ..., numbands, will give an identical sample model.
+ *
+ * @param bands Array with band indices to include.
+ * @return A new sample model
+ */
+ public abstract SampleModel createSubsetSampleModel(int[] bands);
+
+ public abstract DataBuffer createDataBuffer();
+
+ public abstract int[] getSampleSize();
+
+ public abstract int getSampleSize(int band);
}
diff --git a/java/awt/image/renderable/RenderableImageProducer.java b/java/awt/image/renderable/RenderableImageProducer.java
index 6ed25561f..a84191987 100644
--- a/java/awt/image/renderable/RenderableImageProducer.java
+++ b/java/awt/image/renderable/RenderableImageProducer.java
@@ -42,39 +42,54 @@ import gnu.classpath.NotImplementedException;
import java.awt.image.ImageConsumer;
import java.awt.image.ImageProducer;
+import java.util.ArrayList;
public class RenderableImageProducer implements ImageProducer, Runnable
{
+ private RenderableImage image;
+ private RenderContext context;
+ private ArrayList consumers = new ArrayList();
+
public RenderableImageProducer(RenderableImage image, RenderContext context)
- throws NotImplementedException
{
- throw new Error("not implemented");
+ this.image = image;
+ this.context = context;
}
public void setRenderContext(RenderContext context)
- throws NotImplementedException
{
+ this.context = context;
}
public void addConsumer(ImageConsumer consumer)
- throws NotImplementedException
{
+ synchronized (consumers)
+ {
+ if (! consumers.contains(consumer))
+ consumers.add(consumer);
+ }
}
public boolean isConsumer(ImageConsumer consumer)
- throws NotImplementedException
{
- return false;
+ synchronized (consumers)
+ {
+ return consumers.contains(consumer);
+ }
}
public void removeConsumer(ImageConsumer consumer)
- throws NotImplementedException
{
+ synchronized (consumers)
+ {
+ consumers.remove(consumer);
+ }
}
public void startProduction(ImageConsumer consumer)
- throws NotImplementedException
{
+ Thread t = new Thread(this, "RenderableImageProducerWorker");
+ t.start();
}
public void requestTopDownLeftRightResend(ImageConsumer consumer)
diff --git a/java/beans/beancontext/BeanContext.java b/java/beans/beancontext/BeanContext.java
index 3d1be7fc8..02f4a1a40 100644
--- a/java/beans/beancontext/BeanContext.java
+++ b/java/beans/beancontext/BeanContext.java
@@ -198,7 +198,7 @@ public interface BeanContext
* @return the created Bean
*
* @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String)
- * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.lang.BeanContext)
+ * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.beans.beancontext.BeanContext)
* @exception IOException if there is an I/O problem during
* instantiation.
* @exception ClassNotFoundException if a serialized Bean's class
diff --git a/java/beans/beancontext/BeanContextMembershipEvent.java b/java/beans/beancontext/BeanContextMembershipEvent.java
index 317654266..9560889f8 100644
--- a/java/beans/beancontext/BeanContextMembershipEvent.java
+++ b/java/beans/beancontext/BeanContextMembershipEvent.java
@@ -52,7 +52,9 @@ import java.util.Iterator;
* @see java.beans.beancontext.BeanContextMembershipListener
*/
public class BeanContextMembershipEvent extends BeanContextEvent {
- /**
+ private static final long serialVersionUID = 3499346510334590959L;
+
+ /**
* The children that were added or removed.
*/
protected Collection children;
diff --git a/java/beans/beancontext/BeanContextServiceAvailableEvent.java b/java/beans/beancontext/BeanContextServiceAvailableEvent.java
index eea10f261..6dc2c38ab 100644
--- a/java/beans/beancontext/BeanContextServiceAvailableEvent.java
+++ b/java/beans/beancontext/BeanContextServiceAvailableEvent.java
@@ -49,7 +49,9 @@ import java.util.Iterator;
*/
public class BeanContextServiceAvailableEvent extends BeanContextEvent {
- /**
+ private static final long serialVersionUID = -5333985775656400778L;
+
+ /**
* The <code>Class</code> representing the service which is now
* available.
*/
diff --git a/java/beans/beancontext/BeanContextServiceRevokedEvent.java b/java/beans/beancontext/BeanContextServiceRevokedEvent.java
index dfa2b89b3..1f5ebd3cd 100644
--- a/java/beans/beancontext/BeanContextServiceRevokedEvent.java
+++ b/java/beans/beancontext/BeanContextServiceRevokedEvent.java
@@ -47,7 +47,9 @@ package java.beans.beancontext;
*/
public class BeanContextServiceRevokedEvent extends BeanContextEvent {
- /**
+ private static final long serialVersionUID = -1295543154724961754L;
+
+ /**
* The <code>Class</code> representing the service which is now
* available.
*/
diff --git a/java/beans/beancontext/BeanContextServicesSupport.java b/java/beans/beancontext/BeanContextServicesSupport.java
index 679464478..4da523eeb 100644
--- a/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/java/beans/beancontext/BeanContextServicesSupport.java
@@ -65,8 +65,9 @@ public class BeanContextServicesSupport
{
private static final long serialVersionUID = -3263851306889194873L;
- private BCSSChild()
+ BCSSChild(Object targetChild, Object peer)
{
+ super(targetChild, peer);
}
}
@@ -166,22 +167,33 @@ public class BeanContextServicesSupport
public void addBeanContextServicesListener
(BeanContextServicesListener listener)
{
- if (! bcsListeners.contains(listener))
- bcsListeners.add(listener);
+ synchronized (bcsListeners)
+ {
+ if (! bcsListeners.contains(listener))
+ bcsListeners.add(listener);
+ }
}
- public boolean addService (Class serviceClass, BeanContextServiceProvider bcsp)
- throws NotImplementedException
+ public boolean addService (Class serviceClass,
+ BeanContextServiceProvider bcsp)
{
- throw new Error ("Not implemented");
+ return addService(serviceClass, bcsp, true);
}
protected boolean addService (Class serviceClass,
BeanContextServiceProvider bcsp,
boolean fireEvent)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (services)
+ {
+ if (services.containsKey(serviceClass))
+ return false;
+ services.put(serviceClass, bcsp);
+ if (bcsp instanceof Serializable)
+ ++serializable;
+ fireServiceAdded(serviceClass);
+ return true;
+ }
}
protected void bcsPreDeserializationHook (ObjectInputStream ois)
@@ -205,9 +217,8 @@ public class BeanContextServicesSupport
protected BeanContextSupport.BCSChild createBCSChild (Object targetChild,
Object peer)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return new BCSSChild(targetChild, peer);
}
protected BeanContextServicesSupport.BCSSServiceProvider
@@ -218,28 +229,44 @@ public class BeanContextServicesSupport
}
protected final void fireServiceAdded (BeanContextServiceAvailableEvent bcssae)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (bcsListeners)
+ {
+ int size = bcsListeners.size();
+ for (int i = 0; i < size; ++i)
+ {
+ BeanContextServicesListener bcsl
+ = (BeanContextServicesListener) bcsListeners.get(i);
+ bcsl.serviceAvailable(bcssae);
+ }
+ }
}
protected final void fireServiceAdded (Class serviceClass)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ fireServiceAdded(new BeanContextServiceAvailableEvent(this,
+ serviceClass));
}
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (bcsListeners)
+ {
+ int size = bcsListeners.size();
+ for (int i = 0; i < size; ++i)
+ {
+ BeanContextServicesListener bcsl
+ = (BeanContextServicesListener) bcsListeners.get(i);
+ bcsl.serviceRevoked(event);
+ }
+ }
}
protected final void fireServiceRevoked (Class serviceClass,
boolean revokeNow)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ fireServiceRevoked(new BeanContextServiceRevokedEvent(this, serviceClass,
+ revokeNow));
}
public BeanContextServices getBeanContextServicesPeer ()
@@ -256,15 +283,22 @@ public class BeanContextServicesSupport
}
public Iterator getCurrentServiceClasses ()
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (services)
+ {
+ return services.keySet().iterator();
+ }
}
public Iterator getCurrentServiceSelectors (Class serviceClass)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (services)
+ {
+ // FIXME: what if service does not exist? Must write a test.
+ BeanContextServiceProvider bcsp
+ = (BeanContextServiceProvider) services.get(serviceClass);
+ return bcsp.getCurrentServiceSelectors(this, serviceClass);
+ }
}
public Object getService (BeanContextChild child, Object requestor,
@@ -276,9 +310,11 @@ public class BeanContextServicesSupport
}
public boolean hasService (Class serviceClass)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (services)
+ {
+ return services.containsKey(serviceClass);
+ }
}
public void initialize ()
@@ -311,10 +347,12 @@ public class BeanContextServicesSupport
public void removeBeanContextServicesListener
(BeanContextServicesListener listener)
{
- int index = bcsListeners.indexOf(listener);
-
- if (index > -1)
- bcsListeners.remove(index);
+ synchronized (bcsListeners)
+ {
+ int index = bcsListeners.indexOf(listener);
+ if (index > -1)
+ bcsListeners.remove(index);
+ }
}
public void revokeService (Class serviceClass, BeanContextServiceProvider bcsp,
@@ -325,14 +363,36 @@ public class BeanContextServicesSupport
}
public void serviceAvailable (BeanContextServiceAvailableEvent bcssae)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (services)
+ {
+ Class klass = bcssae.getServiceClass();
+ if (services.containsKey(klass))
+ return;
+ Iterator it = bcsChildren();
+ while (it.hasNext())
+ {
+ Object obj = it.next();
+ if (obj instanceof BeanContextServices)
+ ((BeanContextServices) obj).serviceAvailable(bcssae);
+ }
+ }
}
public void serviceRevoked (BeanContextServiceRevokedEvent bcssre)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (services)
+ {
+ Class klass = bcssre.getServiceClass();
+ if (services.containsKey(klass))
+ return;
+ Iterator it = bcsChildren();
+ while (it.hasNext())
+ {
+ Object obj = it.next();
+ if (obj instanceof BeanContextServices)
+ ((BeanContextServices) obj).serviceRevoked(bcssre);
+ }
+ }
}
}
diff --git a/java/beans/beancontext/BeanContextSupport.java b/java/beans/beancontext/BeanContextSupport.java
index 5770c4fb0..f964e2e75 100644
--- a/java/beans/beancontext/BeanContextSupport.java
+++ b/java/beans/beancontext/BeanContextSupport.java
@@ -40,6 +40,7 @@ package java.beans.beancontext;
import gnu.classpath.NotImplementedException;
+import java.beans.DesignMode;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
@@ -87,27 +88,35 @@ public class BeanContextSupport extends BeanContextChildSupport
{
private static final long serialVersionUID = -5815286101609939109L;
- BCSChild()
+ private Object targetChild;
+ private Object peer;
+
+ BCSChild(Object targetChild, Object peer)
{
+ this.targetChild = targetChild;
+ this.peer = peer;
}
}
protected static final class BCSIterator implements Iterator
{
- BCSIterator()
+ private Iterator child;
+
+ BCSIterator(Iterator child)
{
+ this.child = child;
}
public boolean hasNext ()
throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return child.hasNext();
}
public Object next ()
throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return child.next();
}
public void remove ()
@@ -164,7 +173,9 @@ public class BeanContextSupport extends BeanContextChildSupport
public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime,
boolean visible)
{
- locale = lcle;
+ super(peer);
+
+ locale = lcle == null ? Locale.getDefault() : lcle;
designTime = dtime;
okToUseGui = visible;
@@ -176,24 +187,38 @@ public class BeanContextSupport extends BeanContextChildSupport
if (targetChild == null)
throw new IllegalArgumentException();
- if (children.containsKey(targetChild))
- return false;
-
- // FIXME: The second argument is surely wrong.
- children.put(targetChild, targetChild);
+ BCSChild child;
+ synchronized (children)
+ {
+ if (children.containsKey(targetChild)
+ || ! validatePendingAdd(targetChild))
+ return false;
+ child = createBCSChild(targetChild, beanContextChildPeer);
+ children.put(targetChild, child);
+ }
+ synchronized (targetChild)
+ {
+ childJustAddedHook(targetChild, child);
+ }
+ fireChildrenAdded(new BeanContextMembershipEvent(this,
+ new Object[] { targetChild }));
return true;
}
public boolean addAll (Collection c)
{
+ // Intentionally throws an exception.
throw new UnsupportedOperationException();
}
public void addBeanContextMembershipListener
(BeanContextMembershipListener listener)
{
- if (! bcmListeners.contains(listener))
- bcmListeners.add(listener);
+ synchronized (bcmListeners)
+ {
+ if (! bcmListeners.contains(listener))
+ bcmListeners.add(listener);
+ }
}
public boolean avoidingGui ()
@@ -203,9 +228,11 @@ public class BeanContextSupport extends BeanContextChildSupport
}
protected Iterator bcsChildren ()
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ return new BCSIterator(children.values().iterator());
+ }
}
protected void bcsPreDeserializationHook (ObjectInputStream ois)
@@ -227,58 +254,67 @@ public class BeanContextSupport extends BeanContextChildSupport
}
protected void childJustAddedHook (Object child, BeanContextSupport.BCSChild bcsc)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ // Do nothing in the base class.
}
protected void childJustRemovedHook (Object child, BeanContextSupport.BCSChild bcsc)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ // Do nothing in the base class.
}
protected static final boolean classEquals (Class first, Class second)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ // Lame function!
+ return (first == second || first.getName().equals(second.getName()));
}
public void clear ()
{
- // This is probably the right thing to do.
+ // This is the right thing to do.
// The JDK docs are really bad here.
throw new UnsupportedOperationException();
}
public boolean contains (Object o)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ return children.containsKey(o);
+ }
}
public boolean containsAll (Collection c)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ Iterator it = c.iterator();
+ while (it.hasNext())
+ if (! children.containsKey(it.next()))
+ return false;
+ }
+ return true;
}
public boolean containsKey (Object o)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ return children.containsKey(o);
+ }
}
protected final Object[] copyChildren ()
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ return children.keySet().toArray();
+ }
}
protected BeanContextSupport.BCSChild createBCSChild (Object targetChild, Object peer)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return new BCSChild(targetChild, peer);
}
protected final void deserialize (ObjectInputStream ois, Collection coll)
@@ -294,15 +330,31 @@ public class BeanContextSupport extends BeanContextChildSupport
}
protected final void fireChildrenAdded (BeanContextMembershipEvent bcme)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (bcmListeners)
+ {
+ Iterator it = bcmListeners.iterator();
+ while (it.hasNext())
+ {
+ BeanContextMembershipListener l
+ = (BeanContextMembershipListener) it.next();
+ l.childrenAdded(bcme);
+ }
+ }
}
protected final void fireChildrenRemoved (BeanContextMembershipEvent bcme)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (bcmListeners)
+ {
+ Iterator it = bcmListeners.iterator();
+ while (it.hasNext())
+ {
+ BeanContextMembershipListener l
+ = (BeanContextMembershipListener) it.next();
+ l.childrenRemoved(bcme);
+ }
+ }
}
public BeanContext getBeanContextPeer ()
@@ -353,15 +405,21 @@ public class BeanContextSupport extends BeanContextChildSupport
}
public URL getResource (String name, BeanContextChild bcc)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ if (! contains(bcc))
+ throw new IllegalArgumentException("argument not a child");
+ ClassLoader loader = bcc.getClass().getClassLoader();
+ return (loader == null ? ClassLoader.getSystemResource(name)
+ : loader.getResource(name));
}
public InputStream getResourceAsStream (String name, BeanContextChild bcc)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ if (! contains(bcc))
+ throw new IllegalArgumentException("argument not a child");
+ ClassLoader loader = bcc.getClass().getClassLoader();
+ return (loader == null ? ClassLoader.getSystemResourceAsStream(name)
+ : loader.getResourceAsStream(name));
}
protected void initialize ()
@@ -377,15 +435,16 @@ public class BeanContextSupport extends BeanContextChildSupport
}
public boolean isDesignTime ()
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return designTime;
}
public boolean isEmpty ()
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ return children.isEmpty();
+ }
}
public boolean isSerializing ()
@@ -396,7 +455,10 @@ public class BeanContextSupport extends BeanContextChildSupport
public Iterator iterator ()
{
- return children.keySet().iterator();
+ synchronized (children)
+ {
+ return children.keySet().iterator();
+ }
}
public boolean needsGui ()
@@ -439,17 +501,21 @@ public class BeanContextSupport extends BeanContextChildSupport
public boolean removeAll (Collection c)
{
+ // Intentionally throws an exception.
throw new UnsupportedOperationException();
}
public void removeBeanContextMembershipListener (BeanContextMembershipListener bcml)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (bcmListeners)
+ {
+ bcmListeners.remove(bcml);
+ }
}
public boolean retainAll (Collection c)
{
+ // Intentionally throws an exception.
throw new UnsupportedOperationException();
}
@@ -460,43 +526,58 @@ public class BeanContextSupport extends BeanContextChildSupport
}
public void setDesignTime (boolean dtime)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ boolean save = designTime;
+ designTime = dtime;
+ firePropertyChange(DesignMode.PROPERTYNAME, Boolean.valueOf(save),
+ Boolean.valueOf(dtime));
}
public void setLocale (Locale newLocale)
- throws PropertyVetoException, NotImplementedException
+ throws PropertyVetoException
{
- throw new Error ("Not implemented");
+ if (newLocale == null || locale == newLocale)
+ return;
+ fireVetoableChange("locale", locale, newLocale);
+ Locale oldLocale = locale;
+ locale = newLocale;
+ firePropertyChange("locale", oldLocale, newLocale);
}
public int size ()
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ synchronized (children)
+ {
+ return children.size();
+ }
}
public Object[] toArray ()
{
- return children.keySet().toArray();
+ synchronized (children)
+ {
+ return children.keySet().toArray();
+ }
}
public Object[] toArray(Object[] array)
+ throws NotImplementedException
{
- return children.keySet().toArray(array);
+ // This implementation is incorrect, I think.
+ synchronized (children)
+ {
+ return children.keySet().toArray(array);
+ }
}
protected boolean validatePendingAdd (Object targetChild)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return true;
}
protected boolean validatePendingRemove (Object targetChild)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ return true;
}
public void vetoableChange (PropertyChangeEvent pce)
diff --git a/java/io/DataOutputStream.java b/java/io/DataOutputStream.java
index 25178160d..6670c2dba 100644
--- a/java/io/DataOutputStream.java
+++ b/java/io/DataOutputStream.java
@@ -63,6 +63,11 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
protected int written;
/**
+ * Utf8 byte buffer, used by writeUTF()
+ */
+ private byte[] buf;
+
+ /**
* This method initializes an instance of <code>DataOutputStream</code> to
* write its data to the specified underlying <code>OutputStream</code>
*
@@ -373,6 +378,37 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
}
/**
+ * Calculate the length, in bytes, of a <code>String</code> in Utf8 format.
+ *
+ * @param value The <code>String</code> to measure
+ * @param start String index at which to begin count
+ * @param sum Starting Utf8 byte count
+ *
+ * @throws UTFDataFormatException if result would exceed 65535
+ */
+ private int getUTFlength(String value, int start, int sum)
+ throws IOException
+ {
+ int len = value.length();
+
+ for (int i = start; i < len && sum <= 65535; ++i)
+ {
+ char c = value.charAt(i);
+ if (c >= '\u0001' && c <= '\u007f')
+ sum += 1;
+ else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
+ sum += 2;
+ else
+ sum += 3;
+ }
+
+ if (sum > 65535)
+ throw new UTFDataFormatException ();
+
+ return sum;
+ }
+
+ /**
* This method writes a Java <code>String</code> to the stream in a modified
* UTF-8 format. First, two bytes are written to the stream indicating the
* number of bytes to follow. Note that this is the number of bytes in the
@@ -407,48 +443,47 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
public final synchronized void writeUTF(String value) throws IOException
{
int len = value.length();
- int sum = 0;
-
- for (int i = 0; i < len && sum <= 65535; ++i)
- {
- char c = value.charAt(i);
- if (c >= '\u0001' && c <= '\u007f')
- sum += 1;
- else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
- sum += 2;
- else
- sum += 3;
- }
-
- if (sum > 65535)
- throw new UTFDataFormatException ();
-
+ int i = 0;
int pos = 0;
- byte[] buf = new byte[sum];
+ boolean lengthWritten = false;
- for (int i = 0; i < len; ++i)
+ if (buf == null)
+ buf = new byte[512];
+
+ do
{
- char c = value.charAt(i);
- if (c >= '\u0001' && c <= '\u007f')
- buf[pos++] = (byte) c;
- else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
+ while (i < len && pos < buf.length - 3)
{
- buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6)));
- buf[pos++] = (byte) (0x80 | (0x3f & c));
+ char c = value.charAt(i++);
+ if (c >= '\u0001' && c <= '\u007f')
+ buf[pos++] = (byte) c;
+ else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
+ {
+ buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6)));
+ buf[pos++] = (byte) (0x80 | (0x3f & c));
+ }
+ else
+ {
+ // JSL says the first byte should be or'd with 0xc0, but
+ // that is a typo. Unicode says 0xe0, and that is what is
+ // consistent with DataInputStream.
+ buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12)));
+ buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6)));
+ buf[pos++] = (byte) (0x80 | (0x3f & c));
+ }
}
- else
+ if (! lengthWritten)
{
- // JSL says the first byte should be or'd with 0xc0, but
- // that is a typo. Unicode says 0xe0, and that is what is
- // consistent with DataInputStream.
- buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12)));
- buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6)));
- buf[pos++] = (byte) (0x80 | (0x3f & c));
+ if (i == len)
+ writeShort(pos);
+ else
+ writeShort(getUTFlength(value, i, pos));
+ lengthWritten = true;
}
- }
-
- writeShort (sum);
- write(buf, 0, sum);
+ write(buf, 0, pos);
+ pos = 0;
+ }
+ while (i < len);
}
} // class DataOutputStream
diff --git a/java/io/FilePermission.java b/java/io/FilePermission.java
index 31802c631..9a83efba6 100644
--- a/java/io/FilePermission.java
+++ b/java/io/FilePermission.java
@@ -1,5 +1,6 @@
/* FilePermission.java --
- Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,9 +45,6 @@ public final class FilePermission extends Permission implements Serializable
{
private static final long serialVersionUID = 7930732926638008763L;
- private static final String CURRENT_DIRECTORY =
- System.getProperty("user.dir");
-
private static final String ALL_FILES = "<<ALL FILES>>";
private boolean readPerm = false;
@@ -213,10 +211,18 @@ public final class FilePermission extends Permission implements Serializable
FilePermission fp = (FilePermission) p;
String f2 = fp.getName();
- if (f1.charAt(0) != File.separatorChar)
- f1 = CURRENT_DIRECTORY + f1;
- if (f2.charAt(0) != File.separatorChar)
- f2 = CURRENT_DIRECTORY + f2;
+ if (f2.equals(ALL_FILES))
+ return false;
+
+ try
+ {
+ f1 = new File(f1).getCanonicalPath();
+ f2 = new File(f2).getCanonicalPath();
+ }
+ catch (IOException ioe)
+ {
+ return false;
+ }
String sub1;
diff --git a/java/lang/Class.java b/java/lang/Class.java
index af5f3c723..2152accf3 100644
--- a/java/lang/Class.java
+++ b/java/lang/Class.java
@@ -265,7 +265,7 @@ public final class Class<T>
ClassLoader loader = VMClass.getClassLoader(this);
// Check if we may get the classloader
SecurityManager sm = SecurityManager.current;
- if (sm != null)
+ if (loader != null && sm != null)
{
// Get the calling classloader
ClassLoader cl = VMStackWalker.getCallingClassLoader();
@@ -1139,7 +1139,7 @@ public final class Class<T>
}
try
{
- return constructor.newInstance();
+ return constructor.newInstance(null);
}
catch (InvocationTargetException e)
{
@@ -1302,7 +1302,9 @@ public final class Class<T>
*/
public T cast(Object obj)
{
- return (T)VMClass.cast(obj, this);
+ if (obj != null && ! isInstance(obj))
+ throw new ClassCastException();
+ return (T) obj;
}
/**
diff --git a/java/lang/EnumConstantNotPresentException.java b/java/lang/EnumConstantNotPresentException.java
index 50b0b45b9..4586c372c 100644
--- a/java/lang/EnumConstantNotPresentException.java
+++ b/java/lang/EnumConstantNotPresentException.java
@@ -48,6 +48,8 @@ package java.lang;
*/
public class EnumConstantNotPresentException extends RuntimeException
{
+ private static final long serialVersionUID = -6046998521960521108L;
+
/**
* The enum's type. Note that the name is fixed by the
* serialization spec.
diff --git a/java/lang/StackTraceElement.java b/java/lang/StackTraceElement.java
index cf4d1c76f..746dd63db 100644
--- a/java/lang/StackTraceElement.java
+++ b/java/lang/StackTraceElement.java
@@ -1,5 +1,5 @@
/* StackTraceElement.java -- One function call or call stack element
- Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -211,7 +211,7 @@ public final class StackTraceElement implements Serializable
}
if (methodName != null)
sb.append(methodName);
- sb.append(" (");
+ sb.append("(");
if (fileName != null)
sb.append(fileName);
else
diff --git a/java/lang/Thread.java b/java/lang/Thread.java
index b4ebd58e4..99c8381aa 100644
--- a/java/lang/Thread.java
+++ b/java/lang/Thread.java
@@ -1,5 +1,5 @@
/* Thread -- an independent thread of executable code
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation
This file is part of GNU Classpath.
@@ -1220,4 +1220,5 @@ public class Thread implements Runnable
*/
private static final long serialVersionUID = 605505746047245783L;
}
+
}
diff --git a/java/lang/TypeNotPresentException.java b/java/lang/TypeNotPresentException.java
index 3010c968b..65d98457e 100644
--- a/java/lang/TypeNotPresentException.java
+++ b/java/lang/TypeNotPresentException.java
@@ -58,7 +58,8 @@ package java.lang;
public class TypeNotPresentException
extends RuntimeException
{
-
+ private static final long serialVersionUID = -5101214195716534496L;
+
/**
* Constructs a <code>TypeNotPresentException</code> for
* the supplied type. The specified cause <code>Throwable</code>
diff --git a/java/lang/annotation/AnnotationFormatError.java b/java/lang/annotation/AnnotationFormatError.java
index 40ce3ca10..36f600632 100644
--- a/java/lang/annotation/AnnotationFormatError.java
+++ b/java/lang/annotation/AnnotationFormatError.java
@@ -49,6 +49,7 @@ package java.lang.annotation;
*/
public class AnnotationFormatError extends Error
{
+ private static final long serialVersionUID = -4256701562333669892L;
/**
* Constructs a new <code>AnnotationFormatError</code>
diff --git a/java/lang/reflect/GenericDeclaration.java b/java/lang/reflect/GenericDeclaration.java
index 0ee7cc4a1..244befd88 100644
--- a/java/lang/reflect/GenericDeclaration.java
+++ b/java/lang/reflect/GenericDeclaration.java
@@ -38,7 +38,25 @@ exception statement from your version. */
package java.lang.reflect;
+/**
+ * Represents an entity that declares one or more type parameters.
+ * This includes classes and methods (including constructors).
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
public interface GenericDeclaration
{
+ /**
+ * Returns a <code>TypeVariable</code> object for each type variable
+ * declared by this entity, in order of declaration. An empty array
+ * is returned if no type variables are declared.
+ *
+ * @return an array of <code>TypeVariable</code> objects.
+ * @throws GenericSignatureFormatError if the signature format within the
+ * class file does not conform to that specified in the 3rd edition
+ * of the Java Virtual Machine Specification.
+ */
TypeVariable<?>[] getTypeParameters();
}
diff --git a/java/lang/reflect/GenericSignatureFormatError.java b/java/lang/reflect/GenericSignatureFormatError.java
index ab6928de6..0f09522bc 100644
--- a/java/lang/reflect/GenericSignatureFormatError.java
+++ b/java/lang/reflect/GenericSignatureFormatError.java
@@ -51,6 +51,7 @@ package java.lang.reflect;
public class GenericSignatureFormatError
extends ClassFormatError
{
+ private static final long serialVersionUID = 6709919147137911034L;
/**
* Constructs a new <code>GenericSignatureFormatError</code>.
diff --git a/java/lang/reflect/MalformedParameterizedTypeException.java b/java/lang/reflect/MalformedParameterizedTypeException.java
index fe53290ec..50ae23000 100644
--- a/java/lang/reflect/MalformedParameterizedTypeException.java
+++ b/java/lang/reflect/MalformedParameterizedTypeException.java
@@ -38,9 +38,22 @@ exception statement from your version. */
package java.lang.reflect;
-/** @since 1.5 */
-public class MalformedParameterizedTypeException extends RuntimeException
+/**
+ * This exception class is thrown when one of the reflection
+ * methods encountered an invalid parameterized type within
+ * the metadata of a class. One possible reason for this
+ * exception being thrown is the specification of too few or
+ * too many type variables.
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+public class MalformedParameterizedTypeException
+ extends RuntimeException
{
+ private static final long serialVersionUID = -5696557788586220964L;
+
public MalformedParameterizedTypeException()
{
}
diff --git a/java/lang/reflect/Modifier.java b/java/lang/reflect/Modifier.java
index 1799b0d39..45fc4e37e 100644
--- a/java/lang/reflect/Modifier.java
+++ b/java/lang/reflect/Modifier.java
@@ -173,7 +173,7 @@ public class Modifier
static final int SYNTHETIC = 0x1000;
/**
- * Flag indicating an enum constant.
+ * Flag indicating an enum constant or an enum class.
*/
static final int ENUM = 0x4000;
@@ -319,42 +319,12 @@ public class Modifier
*/
static StringBuilder toString(int mod, StringBuilder r)
{
- if (isPublic(mod))
- r.append("public ");
- if (isProtected(mod))
- r.append("protected ");
- if (isPrivate(mod))
- r.append("private ");
- if (isAbstract(mod))
- r.append("abstract ");
- if (isStatic(mod))
- r.append("static ");
- if (isFinal(mod))
- r.append("final ");
- if (isTransient(mod))
- r.append("transient ");
- if (isVolatile(mod))
- r.append("volatile ");
- if (isSynchronized(mod))
- r.append("synchronized ");
- if (isNative(mod))
- r.append("native ");
- if (isStrict(mod))
- r.append("strictfp ");
- if (isInterface(mod))
- r.append("interface ");
-
- // Trim trailing space.
- if ((mod & ALL_FLAGS) != 0)
- r.setLength(r.length() - 1);
+ r.append(toString(mod, new StringBuffer()));
return r;
}
/**
* Package helper method that can take a StringBuffer.
- * This is indeed a duplicate of the method that takes a StringBuilder
- * since some runtimes override the given Method, Constructor and Field
- * classes that and use a StringBuffer.
* @param mod the modifier
* @param r the StringBuffer to which the String representation is appended
* @return r, with information appended
diff --git a/java/lang/reflect/TypeVariable.java b/java/lang/reflect/TypeVariable.java
index 5cbd81b80..ec6af69db 100644
--- a/java/lang/reflect/TypeVariable.java
+++ b/java/lang/reflect/TypeVariable.java
@@ -38,9 +38,59 @@ exception statement from your version. */
package java.lang.reflect;
+/**
+ * <p>
+ * This is a common interface for all type variables provided by
+ * the Java language. Instances are created the first time a type
+ * variable is needed by one of the reflective methods declared in
+ * this package.
+ * </p>
+ * <p>
+ * Creating a type variable requires resolving the appropriate type.
+ * This may involve resolving other classes as a side effect (e.g.
+ * if the type is nested inside other classes). Creation should not
+ * involve resolving the bounds. Repeated creation has no effect; an
+ * equivalent instance is returned. Caching is not required, but all
+ * instances must be <code>equal()</code> to each other.
+ * </p>
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
public interface TypeVariable<T extends GenericDeclaration> extends Type
{
+
+ /**
+ * Returns an array of <code>Type</code> objects which represent the upper
+ * bounds of this type variable. There is always a default bound of
+ * <code>Object</code>. Any <code>ParameterizedType</code>s will be
+ * created as necessary, and other types resolved.
+ *
+ * @return an array of <code>Type</code> objects representing the upper
+ * bounds.
+ * @throws TypeNotPresentException if any of the bounds refer to a
+ * non-existant type.
+ * @throws MalformedParameterizedTypeException if the creation of a
+ * <code>ParameterizedType</code> fails.
+ */
Type[] getBounds();
+
+
+ /**
+ * Returns a representation of the declaration used to declare this
+ * type variable.
+ *
+ * @return the <code>GenericDeclaration</code> object for this type
+ * variable.
+ */
T getGenericDeclaration();
+
+ /**
+ * Returns the name of the type variable, as written in the source
+ * code.
+ *
+ * @return the name of the type variable.
+ */
String getName();
}
diff --git a/java/net/MimeTypeMapper.java b/java/net/MimeTypeMapper.java
index 1747f4d56..8153694b4 100644
--- a/java/net/MimeTypeMapper.java
+++ b/java/net/MimeTypeMapper.java
@@ -37,7 +37,17 @@ exception statement from your version. */
package java.net;
+import gnu.classpath.SystemProperties;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.LineNumberReader;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
/**
@@ -56,131 +66,230 @@ class MimeTypeMapper implements FileNameMap
*/
protected static final String[][] mime_strings =
{
- { "application/mac-binhex40", "hqx" },
- { "application/mac-compactpro", "cpt" },
- { "application/msword", "doc" },
- { "application/octet-stream", "bin" },
- { "application/octet-stream", "dms" },
- { "application/octet-stream", "lha" },
- { "application/octet-stream", "lzh" },
- { "application/octet-stream", "exe" },
- { "application/octet-stream", "class" },
- { "application/oda", "oda" },
- { "application/pdf", "pdf" },
- { "application/postscript", "ai" },
- { "application/postscript", "eps" },
- { "application/postscript", "ps" },
- { "application/powerpoint", "ppt" },
- { "application/rtf", "rtf" },
- { "application/x-bcpio", "bcpio" },
- { "application/x-cdlink", "vcd" },
- { "application/x-compress", "Z" },
- { "application/x-cpio", "cpio" },
- { "application/x-csh", "csh" },
- { "application/x-director", "dcr" },
- { "application/x-director", "dir" },
- { "application/x-director", "dxr" },
- { "application/x-dvi", "dvi" },
- { "application/x-gtar", "gtar" },
- { "application/x-gzip", "gz" },
- { "application/x-hdf", "hdf" },
- { "application/x-httpd-cgi", "cgi" },
- { "application/x-koan", "skp" },
- { "application/x-koan", "skd" },
- { "application/x-koan", "skt" },
- { "application/x-koan", "skm" },
- { "application/x-latex", "latex" },
- { "application/x-mif", "mif" },
- { "application/x-netcdf", "nc" },
- { "application/x-netcdf", "cdf" },
- { "application/x-sh", "sh" },
- { "application/x-shar", "shar" },
- { "application/x-stuffit", "sit" },
- { "application/x-sv4cpio", "sv4cpio" },
- { "application/x-sv4crc", "sv4crc" },
- { "application/x-tar", "tar" },
- { "application/x-tcl", "tcl" },
- { "application/x-tex", "tex" },
- { "application/x-texinfo", "texinfo" },
- { "application/x-texinfo", "texi" },
- { "application/x-troff", "t" },
- { "application/x-troff", "tr" },
- { "application/x-troff", "roff" },
- { "application/x-troff-man", "man" },
- { "application/x-troff-me", "me" },
- { "application/x-troff-ms", "ms" },
- { "application/x-ustar", "ustar" },
- { "application/x-wais-source", "src" },
- { "application/zip", "zip" },
- { "audio/basic", "au" },
- { "audio/basic", "snd" },
- { "audio/mpeg", "mpga" },
- { "audio/mpeg", "mp2" },
- { "audio/mpeg", "mp3" },
- { "audio/x-aiff", "aif" },
- { "audio/x-aiff", "aiff" },
- { "audio/x-aiff", "aifc" },
- { "audio/x-pn-realaudio", "ram" },
- { "audio/x-pn-realaudio-plugin", "rpm" },
- { "audio/x-realaudio", "ra" },
- { "audio/x-wav", "wav" },
- { "chemical/x-pdb", "pdb" },
- { "chemical/x-pdb", "xyz" },
- { "image/gif", "gif" },
- { "image/ief", "ief" },
- { "image/jpeg", "jpeg" },
- { "image/jpeg", "jpg" },
- { "image/jpeg", "jpe" },
- { "image/png", "png" },
- { "image/tiff", "tiff" },
- { "image/tiff", "tif" },
- { "image/x-cmu-raster", "ras" },
- { "image/x-portable-anymap", "pnm" },
- { "image/x-portable-bitmap", "pbm" },
- { "image/x-portable-graymap", "pgm" },
- { "image/x-portable-pixmap", "ppm" },
- { "image/x-rgb", "rgb" },
- { "image/x-xbitmap", "xbm" },
- { "image/x-xpixmap", "xpm" },
- { "image/x-xwindowdump", "xwd" },
- { "text/html", "html" },
- { "text/html", "htm" },
- { "text/plain", "txt" },
- { "text/richtext", "rtx" },
- { "text/tab-separated-values", "tsv" },
- { "text/x-setext", "etx" },
- { "text/x-sgml", "sgml" },
- { "text/x-sgml", "sgm" },
- { "video/mpeg", "mpeg" },
- { "video/mpeg", "mpg" },
- { "video/mpeg", "mpe" },
- { "video/quicktime", "qt" },
- { "video/quicktime", "mov" },
- { "video/x-msvideo", "avi" },
- { "video/x-sgi-movie", "movie" },
- { "x-conference/x-cooltalk", "ice" },
- { "x-world/x-vrml", "wrl" },
- { "x-world/x-vrml", "vrml" }
+ { "ai", "application/postscript" }
+ , { "aif", "audio/x-aiff" }
+ , { "aifc", "audio/x-aiff" }
+ , { "aiff", "audio/x-aiff" }
+ , { "asc", "text/plain" }
+ , { "au", "audio/basic" }
+ , { "avi", "video/x-msvideo" }
+ , { "bcpio", "application/x-bcpio" }
+ , { "bin", "application/octet-stream" }
+ , { "bmp", "image/bmp" }
+ , { "bz2", "application/x-bzip2" }
+ , { "cdf", "application/x-netcdf" }
+ , { "chrt", "application/x-kchart" }
+ , { "class", "application/octet-stream" }
+ , { "cpio", "application/x-cpio" }
+ , { "cpt", "application/mac-compactpro" }
+ , { "csh", "application/x-csh" }
+ , { "css", "text/css" }
+ , { "dcr", "application/x-director" }
+ , { "dir", "application/x-director" }
+ , { "djv", "image/vnd.djvu" }
+ , { "djvu", "image/vnd.djvu" }
+ , { "dll", "application/octet-stream" }
+ , { "dms", "application/octet-stream" }
+ , { "doc", "application/msword" }
+ , { "dvi", "application/x-dvi" }
+ , { "dxr", "application/x-director" }
+ , { "eps", "application/postscript" }
+ , { "etx", "text/x-setext" }
+ , { "exe", "application/octet-stream" }
+ , { "ez", "application/andrew-inset" }
+ , { "gif", "image/gif" }
+ , { "gtar", "application/x-gtar" }
+ , { "gz", "application/x-gzip" }
+ , { "hdf", "application/x-hdf" }
+ , { "hqx", "application/mac-binhex40" }
+ , { "htm", "text/html" }
+ , { "html", "text/html" }
+ , { "ice", "x-conference/x-cooltalk" }
+ , { "ief", "image/ief" }
+ , { "iges", "model/iges" }
+ , { "igs", "model/iges" }
+ , { "img", "application/octet-stream" }
+ , { "iso", "application/octet-stream" }
+ , { "jpe", "image/jpeg" }
+ , { "jpeg", "image/jpeg" }
+ , { "jpg", "image/jpeg" }
+ , { "js", "application/x-javascript" }
+ , { "kar", "audio/midi" }
+ , { "kil", "application/x-killustrator" }
+ , { "kpr", "application/x-kpresenter" }
+ , { "kpt", "application/x-kpresenter" }
+ , { "ksp", "application/x-kspread" }
+ , { "kwd", "application/x-kword" }
+ , { "kwt", "application/x-kword" }
+ , { "latex", "application/x-latex" }
+ , { "lha", "application/octet-stream" }
+ , { "lzh", "application/octet-stream" }
+ , { "m3u", "audio/x-mpegurl" }
+ , { "man", "application/x-troff-man" }
+ , { "me", "application/x-troff-me" }
+ , { "mesh", "model/mesh" }
+ , { "mid", "audio/midi" }
+ , { "midi", "audio/midi" }
+ , { "mif", "application/vnd.mif" }
+ , { "mov", "video/quicktime" }
+ , { "movie", "video/x-sgi-movie" }
+ , { "mp2", "audio/mpeg" }
+ , { "mp3", "audio/mpeg" }
+ , { "mpe", "video/mpeg" }
+ , { "mpeg", "video/mpeg" }
+ , { "mpg", "video/mpeg" }
+ , { "mpga", "audio/mpeg" }
+ , { "ms", "application/x-troff-ms" }
+ , { "msh", "model/mesh" }
+ , { "mxu", "video/vnd.mpegurl" }
+ , { "nc", "application/x-netcdf" }
+ , { "ogg", "application/ogg" }
+ , { "pbm", "image/x-portable-bitmap" }
+ , { "pdb", "chemical/x-pdb" }
+ , { "pdf", "application/pdf" }
+ , { "pgm", "image/x-portable-graymap" }
+ , { "pgn", "application/x-chess-pgn" }
+ , { "png", "image/png" }
+ , { "pnm", "image/x-portable-anymap" }
+ , { "ppm", "image/x-portable-pixmap" }
+ , { "ppt", "application/vnd.ms-powerpoint" }
+ , { "ps", "application/postscript" }
+ , { "qt", "video/quicktime" }
+ , { "ra", "audio/x-realaudio" }
+ , { "ram", "audio/x-pn-realaudio" }
+ , { "ras", "image/x-cmu-raster" }
+ , { "rgb", "image/x-rgb" }
+ , { "rm", "audio/x-pn-realaudio" }
+ , { "roff", "application/x-troff" }
+ , { "rpm", "application/x-rpm" }
+ , { "rtf", "text/rtf" }
+ , { "rtx", "text/richtext" }
+ , { "sgm", "text/sgml" }
+ , { "sgml", "text/sgml" }
+ , { "sh", "application/x-sh" }
+ , { "shar", "application/x-shar" }
+ , { "silo", "model/mesh" }
+ , { "sit", "application/x-stuffit" }
+ , { "skd", "application/x-koan" }
+ , { "skm", "application/x-koan" }
+ , { "skp", "application/x-koan" }
+ , { "skt", "application/x-koan" }
+ , { "smi", "application/smil" }
+ , { "smil", "application/smil" }
+ , { "snd", "audio/basic" }
+ , { "so", "application/octet-stream" }
+ , { "spl", "application/x-futuresplash" }
+ , { "src", "application/x-wais-source" }
+ , { "stc", "application/vnd.sun.xml.calc.template" }
+ , { "std", "application/vnd.sun.xml.draw.template" }
+ , { "sti", "application/vnd.sun.xml.impress.template" }
+ , { "stw", "application/vnd.sun.xml.writer.template" }
+ , { "sv4cpio", "application/x-sv4cpio" }
+ , { "sv4crc", "application/x-sv4crc" }
+ , { "swf", "application/x-shockwave-flash" }
+ , { "sxc", "application/vnd.sun.xml.calc" }
+ , { "sxd", "application/vnd.sun.xml.draw" }
+ , { "sxg", "application/vnd.sun.xml.writer.global" }
+ , { "sxi", "application/vnd.sun.xml.impress" }
+ , { "sxm", "application/vnd.sun.xml.math" }
+ , { "sxw", "application/vnd.sun.xml.writer" }
+ , { "t", "application/x-troff" }
+ , { "tar", "application/x-tar" }
+ , { "tcl", "application/x-tcl" }
+ , { "tex", "application/x-tex" }
+ , { "texi", "application/x-texinfo" }
+ , { "texinfo", "application/x-texinfo" }
+ , { "tgz", "application/x-gzip" }
+ , { "tif", "image/tiff" }
+ , { "tiff", "image/tiff" }
+ , { "torrent", "application/x-bittorrent" }
+ , { "tr", "application/x-troff" }
+ , { "tsv", "text/tab-separated-values" }
+ , { "txt", "text/plain" }
+ , { "ustar", "application/x-ustar" }
+ , { "vcd", "application/x-cdlink" }
+ , { "vrml", "model/vrml" }
+ , { "wav", "audio/x-wav" }
+ , { "wbmp", "image/vnd.wap.wbmp" }
+ , { "wbxml", "application/vnd.wap.wbxml" }
+ , { "wml", "text/vnd.wap.wml" }
+ , { "wmlc", "application/vnd.wap.wmlc" }
+ , { "wmls", "text/vnd.wap.wmlscript" }
+ , { "wmlsc", "application/vnd.wap.wmlscriptc" }
+ , { "wrl", "model/vrml" }
+ , { "xbm", "image/x-xbitmap" }
+ , { "xht", "application/xhtml+xml" }
+ , { "xhtml", "application/xhtml+xml" }
+ , { "xls", "application/vnd.ms-excel" }
+ , { "xml", "text/xml" }
+ , { "xpm", "image/x-xpixmap" }
+ , { "xsl", "text/xml" }
+ , { "xwd", "image/x-xwindowdump" }
+ , { "xyz", "chemical/x-xyz" }
+ , { "zip", "application/zip" }
};
/**
* The MIME types above are put into this Hashtable for faster lookup.
*/
- private static Hashtable mime_types = new Hashtable(150);
-
- // Static initializer to load MIME types into Hashtable
- static
- {
- for (int i = 0; i < mime_strings.length; i++)
- mime_types.put(mime_strings[i][1], mime_strings[i][0]);
- }
+ private Hashtable mime_types = new Hashtable(150);
/**
* Create a new <code>MimeTypeMapper</code> object.
*/
public MimeTypeMapper()
{
- // Do nothing here.
+ for (int i = 0; i < mime_strings.length; i++)
+ mime_types.put(mime_strings[i][0], mime_strings[i][1]);
+
+ // Now read from the system mime database, if it exists. Entries found
+ // here override our internal ones.
+ try
+ {
+ // On Linux this usually means /etc/mime.types.
+ String file
+ = SystemProperties.getProperty("gnu.classpath.mime.types.file");
+ if (file != null)
+ fillFromFile(mime_types, file);
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+
+ public static void fillFromFile (Map table, String fname)
+ throws IOException
+ {
+ LineNumberReader reader =
+ new LineNumberReader (new FileReader (fname));
+
+ while (reader.ready ())
+ {
+ StringTokenizer tokenizer =
+ new StringTokenizer (reader.readLine ());
+
+ try
+ {
+ String t = tokenizer.nextToken ();
+
+ if (! t.startsWith ("#"))
+ {
+ while (true)
+ {
+ // Read the next extension
+ String e = tokenizer.nextToken ();
+ if ((e != null) && (! e.startsWith ("#")))
+ table.put (e, t);
+ else
+ break;
+ }
+ }
+ }
+ catch (NoSuchElementException ex)
+ {
+ // Do nothing.
+ }
+ }
}
/**
@@ -210,4 +319,27 @@ class MimeTypeMapper implements FileNameMap
else
return type;
}
+
+ /**
+ * Run this class as a program to create a new mime_strings table.
+ */
+ public static void main(String[] args) throws IOException
+ {
+ TreeMap map = new TreeMap();
+ // It is fine to hard-code the name here. This is only ever
+ // used by maintainers, who can hack it if they need to re-run
+ // it.
+ fillFromFile(map, "/etc/mime.types");
+ Iterator it = map.keySet().iterator();
+ boolean first = true;
+ while (it.hasNext())
+ {
+ String key = (String) it.next();
+ String value = (String) map.get(key);
+ // Put the "," first since it is easier to make correct syntax this way.
+ System.out.println(" " + (first ? " " : ", ")
+ + "{ \"" + key + "\", \"" + value + "\" }");
+ first = false;
+ }
+ }
}
diff --git a/java/net/URLConnection.java b/java/net/URLConnection.java
index 2f85907e8..b6b6435dc 100644
--- a/java/net/URLConnection.java
+++ b/java/net/URLConnection.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package java.net;
+import gnu.classpath.NotImplementedException;
+import gnu.classpath.SystemProperties;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -50,6 +53,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.StringTokenizer;
/**
* Written using on-line Java Platform 1.2 API Specification, as well
@@ -115,6 +119,12 @@ public abstract class URLConnection
private static boolean defaultUseCaches = true;
/**
+ * Default internal content handler factory.
+ */
+ private static ContentHandlerFactory defaultFactory
+ = new gnu.java.net.DefaultContentHandlerFactory();
+
+ /**
* This variable determines whether or not interaction is allowed with
* the user. For example, to prompt for a username and password.
*/
@@ -161,6 +171,7 @@ public abstract class URLConnection
* This is the URL associated with this connection
*/
protected URL url;
+
private static SimpleDateFormat[] dateFormats;
private static boolean dateformats_initialized;
@@ -924,8 +935,10 @@ public abstract class URLConnection
* @exception IOException If an error occurs
*/
public static String guessContentTypeFromStream(InputStream is)
- throws IOException
+ throws IOException, NotImplementedException
{
+ // See /etc/gnome-vfs-mime-magic or /etc/mime-magic for a reasonable
+ // idea of how to handle this.
return "application/octet-stream";
}
@@ -980,44 +993,66 @@ public abstract class URLConnection
if (factory != null)
handler = factory.createContentHandler(contentType);
- // Then try our default class.
- try
- {
- String typeClass = contentType.replace('/', '.');
-
- // Deal with "Content-Type: text/html; charset=ISO-8859-1".
- int parameterBegin = typeClass.indexOf(';');
- if (parameterBegin >= 1)
- typeClass = typeClass.substring(0, parameterBegin);
+ // Now try default factory. Using this factory to instantiate built-in
+ // content handlers is preferable
+ if (handler == null)
+ handler = defaultFactory.createContentHandler(contentType);
- Class cls = Class.forName("gnu.java.net.content." + typeClass);
- Object obj = cls.newInstance();
-
- if (obj instanceof ContentHandler)
- {
- handler = (ContentHandler) obj;
- return handler;
- }
- }
- catch (ClassNotFoundException e)
- {
- // Ignore.
- }
- catch (InstantiationException e)
- {
- // Ignore.
- }
- catch (IllegalAccessException e)
+ // User-set factory has not returned a handler. Use the default search
+ // algorithm.
+ if (handler == null)
{
- // Ignore.
+ // Get the list of packages to check and append our default handler
+ // to it, along with the JDK specified default as a last resort.
+ // Except in very unusual environments the JDK specified one shouldn't
+ // ever be needed (or available).
+ String propVal = SystemProperties.getProperty("java.content.handler.pkgs");
+ propVal = (((propVal == null) ? "" : (propVal + "|"))
+ + "gnu.java.net.content|sun.net.www.content");
+
+ // Deal with "Content-Type: text/html; charset=ISO-8859-1".
+ int parameterBegin = contentType.indexOf(';');
+ if (parameterBegin >= 1)
+ contentType = contentType.substring(0, parameterBegin);
+ contentType = contentType.trim();
+
+ // Replace the '/' character in the content type with '.' and
+ // all other non-alphabetic, non-numeric characters with '_'.
+ char[] cArray = contentType.toCharArray();
+ for (int i = 0; i < cArray.length; i++)
+ {
+ if (cArray[i] == '/')
+ cArray[i] = '.';
+ else if (! ((cArray[i] >= 'A' && cArray[i] <= 'Z') ||
+ (cArray[i] >= 'a' && cArray[i] <= 'z') ||
+ (cArray[i] >= '0' && cArray[i] <= '9')))
+ cArray[i] = '_';
+ }
+ String contentClass = new String(cArray);
+
+ // See if a class of this content type exists in any of the packages.
+ StringTokenizer pkgPrefix = new StringTokenizer(propVal, "|");
+ do
+ {
+ String facName = pkgPrefix.nextToken() + "." + contentClass;
+ try
+ {
+ handler =
+ (ContentHandler) Class.forName(facName).newInstance();
+ }
+ catch (Exception e)
+ {
+ // Can't instantiate; handler still null, go on to next element.
+ }
+ } while (handler == null && pkgPrefix.hasMoreTokens());
}
return handler;
}
// We don't put these in a static initializer, because it creates problems
- // with initializer co-dependency: SimpleDateFormat's constructors eventually
- // depend on URLConnection (via the java.text.*Symbols classes).
+ // with initializer co-dependency: SimpleDateFormat's constructors
+ // eventually depend on URLConnection (via the java.text.*Symbols classes).
private static synchronized void initializeDateFormats()
{
if (dateformats_initialized)
diff --git a/java/rmi/activation/ActivationGroup_Stub.java b/java/rmi/activation/ActivationGroup_Stub.java
index 249137b08..fb55e5fd9 100644
--- a/java/rmi/activation/ActivationGroup_Stub.java
+++ b/java/rmi/activation/ActivationGroup_Stub.java
@@ -51,7 +51,7 @@ import java.rmi.server.RemoteStub;
*
* @author Roman Kennke (kennke@aicas.com)
*/
-public class ActivationGroup_Stub extends RemoteStub
+public final class ActivationGroup_Stub extends RemoteStub
implements ActivationInstantiator, Remote
{
private static final long serialVersionUID = 2L;
diff --git a/java/rmi/server/RemoteObject.java b/java/rmi/server/RemoteObject.java
index 60e57dc24..5b926bfc3 100644
--- a/java/rmi/server/RemoteObject.java
+++ b/java/rmi/server/RemoteObject.java
@@ -39,6 +39,7 @@ package java.rmi.server;
import java.io.IOException;
import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.rmi.NoSuchObjectException;
@@ -101,6 +102,9 @@ public boolean equals(Object obj) {
return (this == obj);
}
+/**
+ * Get the string representation of this remote object.
+ */
public String toString()
{
if (ref == null)
@@ -108,55 +112,91 @@ public boolean equals(Object obj) {
return (ref.toString ());
}
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+ /**
+ * Read the remote object from the input stream. Expects the class name
+ * without package first. Then the method creates and assigns the {@link #ref}
+ * an instance of this class and calls its .readExternal method. The standard
+ * packageless class names are UnicastRef, UnicastRef2, UnicastServerRef,
+ * UnicastServerRef2, ActivatableRef or ActivatableServerRef.
+ *
+ * @param in the stream to read from
+ * @throws IOException if the IO exception occurs
+ * @throws ClassNotFoundException if the class with the given name is not
+ * present in the package gnu.java.rmi.server (for the case of the
+ * GNU Classpath.
+ */
+ private void readObject(ObjectInputStream in) throws IOException,
+ ClassNotFoundException
{
String cname = in.readUTF();
- if (!cname.equals(""))
+ if (! cname.equals(""))
{
- if (cname.equals ("UnicastRef2"))
- {
- // hack for interoperating with JDK
- cname = "UnicastRef";
- in.read (); //some unknown UnicastRef2 field
- }
-
- // It would be nice to use RemoteRef.packagePrefix here, but for binary
- // compatibility with the JDK that has to contain "sun.rmi.server"...
- cname = "gnu.java.rmi.server." + cname;
- try
- {
- Class cls = Class.forName(cname);
- ref = (RemoteRef)cls.newInstance();
- }
- catch (InstantiationException e1)
- {
- throw new UnmarshalException("failed to create ref", e1);
- }
- catch (IllegalAccessException e2)
- {
- throw new UnmarshalException("failed to create ref", e2);
- }
- ref.readExternal(in);
+ if (cname.equals("UnicastRef2"))
+ {
+ // hack for interoperating with JDK
+ cname = "UnicastRef";
+ in.read(); // some unknown UnicastRef2 field
+ }
+
+ // It would be nice to use RemoteRef.packagePrefix here, but for binary
+ // compatibility with the JDK that has to contain "sun.rmi.server"...
+ cname = "gnu.java.rmi.server." + cname;
+ try
+ {
+ Class cls = Class.forName(cname);
+ ref = (RemoteRef) cls.newInstance();
+ }
+ catch (InstantiationException e1)
+ {
+ throw new UnmarshalException("failed to create ref", e1);
+ }
+ catch (IllegalAccessException e2)
+ {
+ throw new UnmarshalException("failed to create ref", e2);
+ }
+ ref.readExternal(in);
}
- else
+ else
{
- ref = (RemoteRef)in.readObject();
+ ref = (RemoteRef) in.readObject();
}
}
-private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException {
- if (ref == null) {
- throw new UnmarshalException("no ref to serialize");
- }
- String cname = ref.getRefClass(out);
- if (cname != null && cname.length() > 0) {
- out.writeUTF(cname);
- ref.writeExternal(out);
- }
- else {
- out.writeUTF("");
- out.writeObject(ref);
- }
-}
+ /**
+ * Write the remote object to the output stream. This method first calls
+ * {@link RemoteRef#getRefClass(ObjectOutput)} on the {@link #ref} to get the
+ * class name without package, writes this name and then calls the
+ * ref.writeObject to write the data. The standard packageless class names are
+ * UnicastRef, UnicastRef2, UnicastServerRef, UnicastServerRef2,
+ * ActivatableRef or ActivatableServerRef. The empty string with the
+ * subsequently following serialized ref instance be written if the
+ * ref.getRefClass returns null.
+ *
+ * @param out the stream to write to
+ * @throws IOException if one occurs during writing
+ * @throws ClassNotFoundException never in this implementation (specified as
+ * part of the API standard)
+ * @throws UnmarshalException if the remote reference of this remote object is
+ * null.
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException,
+ ClassNotFoundException
+ {
+ if (ref == null)
+ {
+ throw new UnmarshalException("no ref to serialize");
+ }
+ String cname = ref.getRefClass(out);
+ if (cname != null && cname.length() > 0)
+ {
+ out.writeUTF(cname);
+ ref.writeExternal(out);
+ }
+ else
+ {
+ out.writeUTF("");
+ out.writeObject(ref);
+ }
+ }
}
diff --git a/java/security/SecureRandom.java b/java/security/SecureRandom.java
index 0d892253c..5ac9a4a8c 100644
--- a/java/security/SecureRandom.java
+++ b/java/security/SecureRandom.java
@@ -1,5 +1,6 @@
/* SecureRandom.java --- Secure Random class implementation
- Copyright (C) 1999, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2005, 2006
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,6 +72,7 @@ public class SecureRandom extends Random
int randomBytesUsed = 0;
SecureRandomSpi secureRandomSpi = null;
byte[] state = null;
+ private String algorithm;
// Constructors.
// ------------------------------------------------------------------------
@@ -111,6 +113,7 @@ public class SecureRandom extends Random
secureRandomSpi = (SecureRandomSpi) Class.
forName(classname).newInstance();
provider = p[i];
+ algorithm = key.substring(13); // Minus SecureRandom.
return;
}
catch (ThreadDeath death)
@@ -128,6 +131,7 @@ public class SecureRandom extends Random
// Nothing found. Fall back to SHA1PRNG
secureRandomSpi = new Sha160RandomSpi();
+ algorithm = "Sha160";
}
/**
@@ -159,8 +163,18 @@ public class SecureRandom extends Random
*/
protected SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider)
{
+ this(secureRandomSpi, provider, "unknown");
+ }
+
+ /**
+ * Private constructor called from the getInstance() method.
+ */
+ private SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider,
+ String algorithm)
+ {
this.secureRandomSpi = secureRandomSpi;
this.provider = provider;
+ this.algorithm = algorithm;
}
// Class methods.
@@ -243,7 +257,7 @@ public class SecureRandom extends Random
{
return new SecureRandom((SecureRandomSpi)
Engine.getInstance(SECURE_RANDOM, algorithm, provider),
- provider);
+ provider, algorithm);
}
catch (java.lang.reflect.InvocationTargetException ite)
{
@@ -269,6 +283,18 @@ public class SecureRandom extends Random
}
/**
+ * Returns the algorithm name used or "unknown" when the algorithm
+ * used couldn't be determined (as when constructed by the protected
+ * 2 argument constructor).
+ *
+ * @since 1.5
+ */
+ public String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
Seeds the SecureRandom. The class is re-seeded for each call and
each seed builds on the previous seed so as not to weaken security.
diff --git a/java/security/cert/Certificate.java b/java/security/cert/Certificate.java
index f8456f97a..33a14a439 100644
--- a/java/security/cert/Certificate.java
+++ b/java/security/cert/Certificate.java
@@ -73,7 +73,7 @@ import java.security.SignatureException;
*/
public abstract class Certificate implements Serializable
{
- private static final long serialVersionUID = -6751606818319535583L;
+ private static final long serialVersionUID = -3585440601605666277L;
private String type;
diff --git a/java/util/AbstractList.java b/java/util/AbstractList.java
index 27e0e1d52..c47b59b21 100644
--- a/java/util/AbstractList.java
+++ b/java/util/AbstractList.java
@@ -330,12 +330,9 @@ while (i.hasNext())
*
* @return True if the end of the list has not yet been
* reached.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public boolean hasNext()
{
- checkMod();
return pos < size;
}
@@ -464,12 +461,9 @@ while (i.hasNext())
*
* @return True if the end of the list has not yet been
* reached.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public boolean hasNext()
{
- checkMod();
return position < size;
}
@@ -479,12 +473,9 @@ while (i.hasNext())
*
* @return True if objects exist prior to the current
* position of the iterator.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public boolean hasPrevious()
{
- checkMod();
return position > 0;
}
@@ -529,12 +520,9 @@ while (i.hasNext())
* list, which will be retrieved by <code>next()</code>
*
* @return The index of the next element.
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
*/
public int nextIndex()
{
- checkMod();
return position;
}
@@ -543,12 +531,9 @@ while (i.hasNext())
* list, which will be retrieved by <code>previous()</code>
*
* @return The index of the previous element.
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
*/
public int previousIndex()
{
- checkMod();
return position - 1;
}
@@ -1034,12 +1019,9 @@ while (i.hasNext())
*
* @return True if the end of the list has not yet been
* reached.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public boolean hasNext()
{
- checkMod();
return position < size;
}
@@ -1049,12 +1031,9 @@ while (i.hasNext())
*
* @return True if objects exist prior to the current
* position of the iterator.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public boolean hasPrevious()
{
- checkMod();
return position > 0;
}
@@ -1097,8 +1076,6 @@ while (i.hasNext())
* list, which will be retrieved by <code>next()</code>
*
* @return The index of the next element.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public int nextIndex()
{
@@ -1110,8 +1087,6 @@ while (i.hasNext())
* list, which will be retrieved by <code>previous()</code>
*
* @return The index of the previous element.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
*/
public int previousIndex()
{
diff --git a/java/util/Arrays.java b/java/util/Arrays.java
index 23b1895dd..cfe8f2e53 100644
--- a/java/util/Arrays.java
+++ b/java/util/Arrays.java
@@ -2353,7 +2353,19 @@ public class Arrays
return new Arrays.ArrayList(a);
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of long numbers. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents longs in their wrapper class, <code>Long</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of long numbers for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(long[] v)
{
if (v == null)
@@ -2367,7 +2379,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of integer numbers. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents ints in their wrapper class, <code>Integer</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of integer numbers for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(int[] v)
{
if (v == null)
@@ -2378,7 +2402,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of short numbers. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents shorts in their wrapper class, <code>Short</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of short numbers for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(short[] v)
{
if (v == null)
@@ -2389,7 +2425,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of characters. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents chars in their wrapper class, <code>Character</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of characters for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(char[] v)
{
if (v == null)
@@ -2400,7 +2448,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of bytes. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents bytes in their wrapper class, <code>Byte</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of bytes for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(byte[] v)
{
if (v == null)
@@ -2411,7 +2471,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of booleans. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents booleans in their wrapper class,
+ * <code>Boolean</code>. For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of booleans for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(boolean[] v)
{
if (v == null)
@@ -2422,7 +2494,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of floats. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents floats in their wrapper class, <code>Float</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of floats for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(float[] v)
{
if (v == null)
@@ -2433,7 +2517,19 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of doubles. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object. This has the same
+ * data, but represents doubles in their wrapper class, <code>Double</code>.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of doubles for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(double[] v)
{
if (v == null)
@@ -2448,7 +2544,18 @@ public class Arrays
return result;
}
- /** @since 1.5 */
+ /**
+ * Returns the hashcode of an array of objects. If two arrays
+ * are equal, according to <code>equals()</code>, they should have the
+ * same hashcode. The hashcode returned by the method is equal to that
+ * obtained by the corresponding <code>List</code> object.
+ * For <code>null</code>, 0 is returned.
+ *
+ * @param v an array of integer numbers for which the hash code should be
+ * computed.
+ * @return the hash code of the array, or 0 if null was given.
+ * @since 1.5
+ */
public static int hashCode(Object[] v)
{
if (v == null)
@@ -2462,7 +2569,6 @@ public class Arrays
return result;
}
- /** @since 1.5 */
public static int deepHashCode(Object[] v)
{
if (v == null)
@@ -2547,7 +2653,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2569,7 +2675,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2591,7 +2697,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2613,7 +2719,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2635,7 +2741,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2657,7 +2763,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2679,7 +2785,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2701,7 +2807,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
@@ -2723,7 +2829,7 @@ public class Arrays
/**
* Returns a String representation of the argument array. Returns "null"
* if <code>a</code> is null.
- * @param a the array to represent
+ * @param v the array to represent
* @return a String representing this array
* @since 1.5
*/
diff --git a/java/util/BitSet.java b/java/util/BitSet.java
index 855ea3e37..e4f923b7f 100644
--- a/java/util/BitSet.java
+++ b/java/util/BitSet.java
@@ -365,7 +365,7 @@ public class BitSet implements Cloneable, Serializable
throw new IndexOutOfBoundsException();
BitSet bs = new BitSet(to - from);
int lo_offset = from >>> 6;
- if (lo_offset >= bits.length)
+ if (lo_offset >= bits.length || to == from)
return bs;
int lo_bit = from & LONG_MASK;
diff --git a/java/util/HashMap.java b/java/util/HashMap.java
index 715569a3f..92022a7d5 100644
--- a/java/util/HashMap.java
+++ b/java/util/HashMap.java
@@ -853,12 +853,9 @@ public class HashMap<K, V> extends AbstractMap<K, V>
/**
* Returns true if the Iterator has more elements.
* @return true if there are more elements
- * @throws ConcurrentModificationException if the HashMap was modified
*/
public boolean hasNext()
{
- if (knownMod != modCount)
- throw new ConcurrentModificationException();
return count > 0;
}
diff --git a/java/util/Hashtable.java b/java/util/Hashtable.java
index de3c4a944..2e265a473 100644
--- a/java/util/Hashtable.java
+++ b/java/util/Hashtable.java
@@ -1022,12 +1022,9 @@ public class Hashtable<K, V> extends Dictionary<K, V>
/**
* Returns true if the Iterator has more elements.
* @return true if there are more elements
- * @throws ConcurrentModificationException if the hashtable was modified
*/
public boolean hasNext()
{
- if (knownMod != modCount)
- throw new ConcurrentModificationException();
return count > 0;
}
diff --git a/java/util/IdentityHashMap.java b/java/util/IdentityHashMap.java
index 78de47cb0..e64f7d532 100644
--- a/java/util/IdentityHashMap.java
+++ b/java/util/IdentityHashMap.java
@@ -705,12 +705,9 @@ public class IdentityHashMap<K,V> extends AbstractMap<K,V>
/**
* Returns true if the Iterator has more elements.
* @return true if there are more elements
- * @throws ConcurrentModificationException if the Map was modified
*/
public boolean hasNext()
{
- if (knownMod != modCount)
- throw new ConcurrentModificationException();
return count > 0;
}
diff --git a/java/util/InvalidPropertiesFormatException.java b/java/util/InvalidPropertiesFormatException.java
index 6540c2313..aaa6c4eb4 100644
--- a/java/util/InvalidPropertiesFormatException.java
+++ b/java/util/InvalidPropertiesFormatException.java
@@ -39,11 +39,16 @@ exception statement from your version. */
package java.util;
import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
-// FIXME: serialization methods should throw NotSerializableException
/** @since 1.5 */
public class InvalidPropertiesFormatException extends IOException
{
+ // This class won't serialize, but we have a UID to placate the compiler.
+ private static final long serialVersionUID = 7763056076009360219L;
+
public InvalidPropertiesFormatException(String message)
{
super(message);
@@ -54,4 +59,14 @@ public class InvalidPropertiesFormatException extends IOException
super();
initCause(cause);
}
+
+ private void writeObject(ObjectOutputStream out) throws IOException
+ {
+ throw new NotSerializableException("objects of this type are not serializable");
+ }
+
+ private void readObject(ObjectInputStream in) throws IOException
+ {
+ throw new NotSerializableException("objects of this type are not serializable");
+ }
}
diff --git a/java/util/LinkedHashMap.java b/java/util/LinkedHashMap.java
index 1a344ab00..6ec06a949 100644
--- a/java/util/LinkedHashMap.java
+++ b/java/util/LinkedHashMap.java
@@ -454,12 +454,9 @@ public class LinkedHashMap<K,V> extends HashMap<K,V>
* Returns true if the Iterator has more elements.
*
* @return true if there are more elements
- * @throws ConcurrentModificationException if the HashMap was modified
*/
public boolean hasNext()
{
- if (knownMod != modCount)
- throw new ConcurrentModificationException();
return current != null;
}
diff --git a/java/util/LinkedList.java b/java/util/LinkedList.java
index f89c36514..2d78573d0 100644
--- a/java/util/LinkedList.java
+++ b/java/util/LinkedList.java
@@ -849,11 +849,9 @@ public class LinkedList<T> extends AbstractSequentialList<T>
* Returns the index of the next element.
*
* @return the next index
- * @throws ConcurrentModificationException if the list was modified
*/
public int nextIndex()
{
- checkMod();
return position;
}
@@ -861,11 +859,9 @@ public class LinkedList<T> extends AbstractSequentialList<T>
* Returns the index of the previous element.
*
* @return the previous index
- * @throws ConcurrentModificationException if the list was modified
*/
public int previousIndex()
{
- checkMod();
return position - 1;
}
@@ -873,11 +869,9 @@ public class LinkedList<T> extends AbstractSequentialList<T>
* Returns true if more elements exist via next.
*
* @return true if next will succeed
- * @throws ConcurrentModificationException if the list was modified
*/
public boolean hasNext()
{
- checkMod();
return (next != null);
}
@@ -885,11 +879,9 @@ public class LinkedList<T> extends AbstractSequentialList<T>
* Returns true if more elements exist via previous.
*
* @return true if previous will succeed
- * @throws ConcurrentModificationException if the list was modified
*/
public boolean hasPrevious()
{
- checkMod();
return (previous != null);
}
diff --git a/java/util/TreeMap.java b/java/util/TreeMap.java
index d366f067e..88abce10d 100644
--- a/java/util/TreeMap.java
+++ b/java/util/TreeMap.java
@@ -1434,12 +1434,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
/**
* Returns true if the Iterator has more elements.
* @return true if there are more elements
- * @throws ConcurrentModificationException if the TreeMap was modified
*/
public boolean hasNext()
{
- if (knownMod != modCount)
- throw new ConcurrentModificationException();
return next != max;
}
diff --git a/java/util/WeakHashMap.java b/java/util/WeakHashMap.java
index 4114ed97d..1f4602915 100644
--- a/java/util/WeakHashMap.java
+++ b/java/util/WeakHashMap.java
@@ -294,12 +294,9 @@ public class WeakHashMap<K,V> extends AbstractMap<K,V>
/**
* Checks if there are more entries.
* @return true, iff there are more elements.
- * @throws ConcurrentModificationException if the hash map was
- * modified.
*/
public boolean hasNext()
{
- checkMod();
return nextEntry != null;
}
diff --git a/java/util/jar/Attributes.java b/java/util/jar/Attributes.java
index 1c8a00baf..329fe6323 100644
--- a/java/util/jar/Attributes.java
+++ b/java/util/jar/Attributes.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.util.jar;
+import gnu.java.util.jar.JarUtils;
+
import java.util.Collection;
import java.util.Hashtable;
import java.util.Map;
@@ -65,7 +67,8 @@ import java.util.Set;
* @see java.util.jar.Attributes.Name
* @author Mark Wielaard (mark@klomp.org)
*/
-public class Attributes implements Cloneable, Map<Object, Object>
+public class Attributes
+ implements Cloneable, Map<Object, Object>
{
// Fields
@@ -121,14 +124,13 @@ public class Attributes implements Cloneable, Map<Object, Object>
* General main attribute -
* the version of this Manifest file.
*/
- public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
+ public static final Name MANIFEST_VERSION = new Name(JarUtils.MANIFEST_VERSION);
/**
* General main attribute -
* the version of the jar file signature.
*/
- public static final Name SIGNATURE_VERSION
- = new Name("Signature-Version");
+ public static final Name SIGNATURE_VERSION = new Name(JarUtils.SIGNATURE_VERSION);
/**
* General main attribute -
@@ -433,7 +435,7 @@ public class Attributes implements Cloneable, Map<Object, Object>
* @returns the old value of the attribute name or null if it didn't exist
* yet
*/
- public String putValue(Name name, String value)
+ private String putValue(Name name, String value)
{
return (String) put(name, value);
}
diff --git a/java/util/jar/JarFile.java b/java/util/jar/JarFile.java
index 97b3711c7..ac5609b14 100644
--- a/java/util/jar/JarFile.java
+++ b/java/util/jar/JarFile.java
@@ -1,5 +1,5 @@
/* JarFile.java - Representation of a jar file
- Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,7 @@ import gnu.java.io.Base64InputStream;
import gnu.java.security.OID;
import gnu.java.security.pkcs.PKCS7SignedData;
import gnu.java.security.pkcs.SignerInfo;
+import gnu.java.security.provider.Gnu;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -105,6 +106,13 @@ public class JarFile extends ZipFile
/** The suffix for signature files. */
private static final String SF_SUFFIX = ".SF";
+ /**
+ * The security provider to use for signature verification.
+ * We need a known fallback to be able to read any signed jar file
+ * (which might contain the user selected security provider).
+ */
+ private static final Gnu provider = new Gnu();
+
// Signature OIDs.
private static final OID MD2_OID = new OID("1.2.840.113549.2.2");
private static final OID MD4_OID = new OID("1.2.840.113549.2.4");
@@ -636,19 +644,19 @@ public class JarFile extends ZipFile
{
if (!signerInfo.getDigestAlgorithmId().equals(SHA1_OID))
return;
- sig = Signature.getInstance("SHA1withDSA");
+ sig = Signature.getInstance("SHA1withDSA", provider);
}
else if (alg.equals(RSA_ENCRYPTION_OID))
{
OID hash = signerInfo.getDigestAlgorithmId();
if (hash.equals(MD2_OID))
- sig = Signature.getInstance("md2WithRsaEncryption");
+ sig = Signature.getInstance("md2WithRsaEncryption", provider);
else if (hash.equals(MD4_OID))
- sig = Signature.getInstance("md4WithRsaEncryption");
+ sig = Signature.getInstance("md4WithRsaEncryption", provider);
else if (hash.equals(MD5_OID))
- sig = Signature.getInstance("md5WithRsaEncryption");
+ sig = Signature.getInstance("md5WithRsaEncryption", provider);
else if (hash.equals(SHA1_OID))
- sig = Signature.getInstance("sha1WithRsaEncryption");
+ sig = Signature.getInstance("sha1WithRsaEncryption", provider);
else
return;
}
@@ -756,7 +764,7 @@ public class JarFile extends ZipFile
try
{
byte[] hash = Base64InputStream.decode((String) e.getValue());
- MessageDigest md = MessageDigest.getInstance(alg);
+ MessageDigest md = MessageDigest.getInstance(alg, provider);
md.update(entryBytes);
byte[] hash2 = md.digest();
if (DEBUG)
@@ -939,8 +947,9 @@ public class JarFile extends ZipFile
hashes.add(Base64InputStream.decode((String) e.getValue()));
try
{
- md.add(MessageDigest.getInstance
- (key.substring(0, key.length() - DIGEST_KEY_SUFFIX.length())));
+ int length = key.length() - DIGEST_KEY_SUFFIX.length();
+ String alg = key.substring(0, length);
+ md.add(MessageDigest.getInstance(alg, provider));
}
catch (NoSuchAlgorithmException nsae)
{
diff --git a/java/util/logging/Level.java b/java/util/logging/Level.java
index 2c400dc3a..48ff318a4 100644
--- a/java/util/logging/Level.java
+++ b/java/util/logging/Level.java
@@ -1,5 +1,5 @@
/* Level.java -- a class for indicating logging levels
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -341,6 +341,9 @@ public class Level implements Serializable
for (int i = 0; i < knownLevels.length; i++)
{
+ // It's safe to use == instead of .equals here because only the
+ // standard logging levels will be returned by this method, and
+ // they are all created using string literals.
if (name == knownLevels[i].name)
return knownLevels[i];
}
diff --git a/java/util/logging/LogManager.java b/java/util/logging/LogManager.java
index 5897a12af..521145f6b 100644
--- a/java/util/logging/LogManager.java
+++ b/java/util/logging/LogManager.java
@@ -1,6 +1,6 @@
/* LogManager.java -- a class for maintaining Loggers and managing
configuration properties
- Copyright (C) 2002,2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,11 +48,14 @@ import java.lang.ref.WeakReference;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
+import gnu.classpath.SystemProperties;
+
/**
* The <code>LogManager</code> maintains a hierarchical namespace
* of Logger objects and manages properties for configuring the logging
@@ -114,7 +117,6 @@ public class LogManager
* a WeakReference to it.
*/
private Map<String, WeakReference<Logger>> loggers;
- final Logger rootLogger;
/**
* The properties for the logging framework which have been
@@ -135,83 +137,62 @@ public class LogManager
* this case.
*/
private final PropertyChangeSupport pcs = new PropertyChangeSupport( /* source bean */
- LogManager.class);
+ LogManager.class);
protected LogManager()
{
- if (logManager != null)
- throw new IllegalStateException("there can be only one LogManager; use LogManager.getLogManager()");
-
- logManager = this;
- loggers = new java.util.HashMap<String, WeakReference<Logger>>();
- rootLogger = new Logger("", null);
- rootLogger.setLevel(Level.INFO);
- addLogger(rootLogger);
-
- /* Make sure that Logger.global has the rootLogger as its parent.
- *
- * Logger.global is set during class initialization of Logger,
- * which may or may not be before this code is being executed.
- * For example, on the Sun 1.3.1 and 1.4.0 JVMs, Logger.global
- * has been set before this code is being executed. In contrast,
- * Logger.global still is null on GCJ 3.2. Since the LogManager
- * and Logger classes are mutually dependent, both behaviors are
- * correct.
- *
- * This means that we cannot depend on Logger.global to have its
- * value when this code executes, although that variable is final.
- * Since Logger.getLogger will always return the same logger for
- * the same name, the subsequent line works fine irrespective of
- * the order in which classes are initialized.
- */
- Logger.getLogger("global").setParent(rootLogger);
- Logger.getLogger("global").setUseParentHandlers(true);
+ loggers = new HashMap();
}
/**
* Returns the globally shared LogManager instance.
*/
- public static LogManager getLogManager()
+ public static synchronized LogManager getLogManager()
{
+ if (logManager == null)
+ {
+ logManager = makeLogManager();
+ initLogManager();
+ }
return logManager;
}
- static
- {
- makeLogManager();
-
- /* The Javadoc description of the class explains
- * what is going on here.
- */
- Object configurator = createInstance(System.getProperty("java.util.logging.config.class"),
- /* must be instance of */ Object.class);
-
- try
- {
- if (configurator == null)
- getLogManager().readConfiguration();
- }
- catch (IOException ex)
- {
- /* FIXME: Is it ok to ignore exceptions here? */
- }
- }
+ private static final String MANAGER_PROPERTY = "java.util.logging.manager";
private static LogManager makeLogManager()
{
- String managerClassName;
- LogManager manager;
+ String managerClassName = SystemProperties.getProperty(MANAGER_PROPERTY);
+ LogManager manager = (LogManager) createInstance
+ (managerClassName, LogManager.class, MANAGER_PROPERTY);
+ if (manager == null)
+ manager = new LogManager();
+ return manager;
+ }
- managerClassName = System.getProperty("java.util.logging.manager");
- manager = (LogManager) createInstance(managerClassName, LogManager.class);
- if (manager != null)
- return manager;
+ private static final String CONFIG_PROPERTY = "java.util.logging.config.class";
- if (managerClassName != null)
- System.err.println("WARNING: System property \"java.util.logging.manager\""
- + " should be the name of a subclass of java.util.logging.LogManager");
+ private static void initLogManager()
+ {
+ LogManager manager = getLogManager();
+ Logger.root.setLevel(Level.INFO);
+ manager.addLogger(Logger.root);
+
+ /* The Javadoc description of the class explains
+ * what is going on here.
+ */
+ Object configurator = createInstance(System.getProperty(CONFIG_PROPERTY),
+ /* must be instance of */ Object.class,
+ CONFIG_PROPERTY);
- return new LogManager();
+ try
+ {
+ if (configurator == null)
+ manager.readConfiguration();
+ }
+ catch (IOException ex)
+ {
+ /* FIXME: Is it ok to ignore exceptions here? */
+ }
}
/**
@@ -314,7 +295,7 @@ public class LogManager
if(index > -1)
searchName = searchName.substring(0,index);
else
- searchName = "";
+ searchName = "";
}
logger.setLevel(logLevel);
@@ -324,7 +305,7 @@ public class LogManager
* When adding "foo.bar", the logger "foo.bar.baz" should change
* its parent to "foo.bar".
*/
- if (parent != rootLogger)
+ if (parent != Logger.root)
{
for (Iterator<String> iter = loggers.keySet().iterator();
iter.hasNext(); )
@@ -367,19 +348,17 @@ public class LogManager
{
String childName = child.getName();
int childNameLength = childName.length();
- Logger best = rootLogger;
+ Logger best = Logger.root;
int bestNameLength = 0;
Logger cand;
- String candName;
int candNameLength;
- if (child == rootLogger)
+ if (child == Logger.root)
return null;
- for (Iterator<String> iter = loggers.keySet().iterator(); iter.hasNext();)
+ for (String candName : loggers.keySet())
{
- candName = iter.next();
candNameLength = candName.length();
if (candNameLength > bestNameLength
@@ -457,8 +436,8 @@ public class LogManager
Iterator<WeakReference<Logger>> iter = loggers.values().iterator();
while (iter.hasNext())
+ for (WeakReference<Logger> ref : loggers.values())
{
- WeakReference<Logger> ref;
Logger logger;
ref = iter.next();
@@ -468,7 +447,7 @@ public class LogManager
if (logger == null)
iter.remove();
- else if (logger != rootLogger)
+ else if (logger != Logger.root)
{
logger.resetLogger();
logger.setLevel(null);
@@ -476,8 +455,8 @@ public class LogManager
}
}
- rootLogger.setLevel(Level.INFO);
- rootLogger.resetLogger();
+ Logger.root.setLevel(Level.INFO);
+ Logger.root.resetLogger();
}
/**
@@ -524,11 +503,11 @@ public class LogManager
// If no config file could be found use a default configuration.
if(inputStream == null)
- {
- String defaultConfig = "handlers = java.util.logging.ConsoleHandler \n"
+ {
+ String defaultConfig = "handlers = java.util.logging.ConsoleHandler \n"
+ ".level=INFO \n";
- inputStream = new ByteArrayInputStream(defaultConfig.getBytes());
- }
+ inputStream = new ByteArrayInputStream(defaultConfig.getBytes());
+ }
}
else
inputStream = new java.io.FileInputStream(path);
@@ -574,21 +553,9 @@ public class LogManager
while (tokenizer.hasMoreTokens())
{
String handlerName = tokenizer.nextToken();
- try
- {
- Class handlerClass = ClassLoader.getSystemClassLoader().loadClass(handlerName);
- getLogger("").addHandler((Handler) handlerClass
- .newInstance());
- }
- catch (ClassCastException ex)
- {
- System.err.println("[LogManager] class " + handlerName
- + " is not subclass of java.util.logging.Handler");
- }
- catch (Exception ex)
- {
- //System.out.println("[LogManager.readConfiguration]"+ex);
- }
+ Handler handler = (Handler)
+ createInstance(handlerName, Handler.class, key);
+ Logger.root.addHandler(handler);
}
}
@@ -602,14 +569,19 @@ public class LogManager
logger = Logger.getLogger(loggerName);
addLogger(logger);
}
+ Level level = null;
try
- {
- logger.setLevel(Level.parse(value));
- }
- catch (Exception _)
- {
- //System.out.println("[LogManager.readConfiguration] "+_);
- }
+ {
+ level = Level.parse(value);
+ }
+ catch (IllegalArgumentException e)
+ {
+ warn("bad level \'" + value + "\'", e);
+ }
+ if (level != null)
+ {
+ logger.setLevel(level);
+ }
continue;
}
}
@@ -748,19 +720,17 @@ public class LogManager
*/
static final Class getClassProperty(String propertyName, Class defaultValue)
{
- Class usingClass = null;
+ String propertyValue = logManager.getProperty(propertyName);
- try
- {
- String propertyValue = logManager.getProperty(propertyName);
- if (propertyValue != null)
- usingClass = Class.forName(propertyValue);
- if (usingClass != null)
- return usingClass;
- }
- catch (Exception _)
- {
- }
+ if (propertyValue != null)
+ try
+ {
+ return locateClass(propertyValue);
+ }
+ catch (ClassNotFoundException e)
+ {
+ warn(propertyName + " = " + propertyValue, e);
+ }
return defaultValue;
}
@@ -774,12 +744,17 @@ public class LogManager
try
{
- Object obj = klass.newInstance();
- if (ofClass.isInstance(obj))
- return obj;
+ Object obj = klass.newInstance();
+ if (ofClass.isInstance(obj))
+ return obj;
}
- catch (Exception _)
+ catch (InstantiationException e)
{
+ warn(propertyName + " = " + klass.getName(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ warn(propertyName + " = " + klass.getName(), e);
}
if (defaultClass == null)
@@ -824,14 +799,17 @@ public class LogManager
}
/**
- * Creates a new instance of a class specified by name.
+ * Creates a new instance of a class specified by name and verifies
+ * that it is an instance (or subclass of) a given type.
*
* @param className the name of the class of which a new instance
* should be created.
*
- * @param ofClass the class to which the new instance should
- * be either an instance or an instance of a subclass.
- * FIXME: This description is just terrible.
+ * @param type the object created must be an instance of
+ * <code>type</code> or any subclass of <code>type</code>
+ *
+ * @param property the system property to reference in error
+ * messages
*
* @return the new instance, or <code>null</code> if
* <code>className</code> is <code>null</code>, if no class
@@ -839,28 +817,89 @@ public class LogManager
* loading that class, or if the constructor of the class
* has thrown an exception.
*/
- static final Object createInstance(String className, Class ofClass)
+ private static final Object createInstance(String className, Class type,
+ String property)
{
- Class klass;
+ Class klass = null;
if ((className == null) || (className.length() == 0))
return null;
try
{
- klass = Class.forName(className);
- if (! ofClass.isAssignableFrom(klass))
- return null;
-
- return klass.newInstance();
+ klass = locateClass(className);
+ if (type.isAssignableFrom(klass))
+ return klass.newInstance();
+ warn(property, className, "not an instance of " + type.getName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ warn(property, className, "class not found");
+ }
+ catch (IllegalAccessException e)
+ {
+ warn(property, className, "illegal access");
}
- catch (Exception _)
+ catch (InstantiationException e)
{
- return null;
+ warn(property, className, e);
}
- catch (java.lang.LinkageError _)
+ catch (java.lang.LinkageError e)
{
- return null;
+ warn(property, className, "linkage error");
}
+
+ return null;
}
+
+ private static final void warn(String property, String klass, Throwable t)
+ {
+ warn(property, klass, null, t);
+ }
+
+ private static final void warn(String property, String klass, String msg)
+ {
+ warn(property, klass, msg, null);
+ }
+
+ private static final void warn(String property, String klass, String msg,
+ Throwable t)
+ {
+ warn("error instantiating '" + klass + "' referenced by " + property +
+ (msg == null ? "" : ", " + msg), t);
+ }
+
+ /**
+ * All debug warnings go through this method.
+ */
+
+ private static final void warn(String msg, Throwable t)
+ {
+ System.err.println("WARNING: " + msg);
+ if (t != null)
+ t.printStackTrace(System.err);
+ }
+
+ /**
+ * Locates a class by first checking the system class loader and
+ * then checking the context class loader.
+ *
+ * @param name the fully qualified name of the Class to locate
+ * @return Class the located Class
+ */
+
+ private static Class locateClass(String name) throws ClassNotFoundException
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ return Class.forName(name, true, loader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ loader = ClassLoader.getSystemClassLoader();
+ return Class.forName(name, true, loader);
+ }
+ }
+
}
diff --git a/java/util/logging/Logger.java b/java/util/logging/Logger.java
index 367faad97..567020ef7 100644
--- a/java/util/logging/Logger.java
+++ b/java/util/logging/Logger.java
@@ -1,5 +1,5 @@
/* Logger.java -- a class for logging messages
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,6 +67,9 @@ import java.util.ResourceBundle;
*/
public class Logger
{
+
+ static final Logger root = new Logger("", null);
+
/**
* A logger provided to applications that make only occasional use
* of the logging framework, typically early prototypes. Serious
@@ -175,7 +178,7 @@ public class Logger
/* This is null when the root logger is being constructed,
* and the root logger afterwards.
*/
- parent = LogManager.getLogManager().rootLogger;
+ parent = root;
useParentHandlers = (parent != null);
}
@@ -1148,16 +1151,12 @@ public class Logger
*/
public synchronized void setParent(Logger parent)
{
- LogManager lm;
-
/* Throw a new NullPointerException if parent is null. */
parent.getClass();
- lm = LogManager.getLogManager();
-
- if (this == lm.rootLogger)
+ if (this == root)
throw new IllegalArgumentException(
- "only the root logger can have a null parent");
+ "the root logger can only have a null parent");
/* An application is allowed to control an anonymous logger
* without having the permission to control the logging
diff --git a/java/util/regex/Matcher.java b/java/util/regex/Matcher.java
index 98086bfdb..e86be25fc 100644
--- a/java/util/regex/Matcher.java
+++ b/java/util/regex/Matcher.java
@@ -40,6 +40,7 @@ package java.util.regex;
import gnu.regexp.RE;
import gnu.regexp.REMatch;
+import gnu.regexp.CharIndexed;
/**
* Instance of a regular expression applied to a char sequence.
@@ -50,6 +51,10 @@ public final class Matcher implements MatchResult
{
private Pattern pattern;
private CharSequence input;
+ // We use CharIndexed as an input object to the getMatch method in order
+ // that /\G/ (the end of the previous match) may work. The information
+ // of the previous match is stored in the CharIndexed object.
+ private CharIndexed inputCharIndexed;
private int position;
private int appendPosition;
private REMatch match;
@@ -58,6 +63,7 @@ public final class Matcher implements MatchResult
{
this.pattern = pattern;
this.input = input;
+ this.inputCharIndexed = RE.makeCharIndexed(input, 0);
}
/**
@@ -119,7 +125,7 @@ public final class Matcher implements MatchResult
public boolean find ()
{
boolean first = (match == null);
- match = pattern.getRE().getMatch(input, position);
+ match = pattern.getRE().getMatch(inputCharIndexed, position);
if (match != null)
{
int endIndex = match.getEndIndex();
@@ -150,7 +156,7 @@ public final class Matcher implements MatchResult
*/
public boolean find (int start)
{
- match = pattern.getRE().getMatch(input, start);
+ match = pattern.getRE().getMatch(inputCharIndexed, start);
if (match != null)
{
position = match.getEndIndex();
@@ -212,7 +218,7 @@ public final class Matcher implements MatchResult
public boolean lookingAt ()
{
- match = pattern.getRE().getMatch(input, 0);
+ match = pattern.getRE().getMatch(inputCharIndexed, 0);
if (match != null)
{
if (match.getStartIndex() == 0)
@@ -237,7 +243,7 @@ public final class Matcher implements MatchResult
*/
public boolean matches ()
{
- match = pattern.getRE().getMatch(input, 0, RE.REG_TRY_ENTIRE_MATCH);
+ match = pattern.getRE().getMatch(inputCharIndexed, 0, RE.REG_TRY_ENTIRE_MATCH);
if (match != null)
{
if (match.getStartIndex() == 0)
diff --git a/java/util/regex/Pattern.java b/java/util/regex/Pattern.java
index 28913642b..8c1998343 100644
--- a/java/util/regex/Pattern.java
+++ b/java/util/regex/Pattern.java
@@ -74,14 +74,16 @@ public final class Pattern implements Serializable
this.flags = flags;
int gnuFlags = 0;
+ gnuFlags |= RE.REG_ICASE_USASCII;
if ((flags & CASE_INSENSITIVE) != 0)
gnuFlags |= RE.REG_ICASE;
if ((flags & MULTILINE) != 0)
gnuFlags |= RE.REG_MULTILINE;
if ((flags & DOTALL) != 0)
gnuFlags |= RE.REG_DOT_NEWLINE;
+ if ((flags & UNICODE_CASE) != 0)
+ gnuFlags &= ~RE.REG_ICASE_USASCII;
// not yet supported:
- // if ((flags & UNICODE_CASE) != 0) gnuFlags =
// if ((flags & CANON_EQ) != 0) gnuFlags =
RESyntax syntax = RESyntax.RE_SYNTAX_JAVA_1_4;
diff --git a/java/util/zip/ZipFile.java b/java/util/zip/ZipFile.java
index e4f7dcbd5..fed32203c 100644
--- a/java/util/zip/ZipFile.java
+++ b/java/util/zip/ZipFile.java
@@ -445,7 +445,19 @@ public class ZipFile implements ZipConstants
case ZipOutputStream.STORED:
return inp;
case ZipOutputStream.DEFLATED:
- return new InflaterInputStream(inp, new Inflater(true));
+ final Inflater inf = new Inflater(true);
+ final int sz = (int) entry.getSize();
+ return new InflaterInputStream(inp, inf)
+ {
+ public int available() throws IOException
+ {
+ if (sz == -1)
+ return super.available();
+ if (super.available() != 0)
+ return sz - inf.getTotalOut();
+ return 0;
+ }
+ };
default:
throw new ZipException("Unknown compression method " + method);
}
@@ -551,6 +563,7 @@ public class ZipFile implements ZipConstants
pos = 0;
fillBuffer();
}
+
return buffer[pos++] & 0xFF;
}
@@ -581,7 +594,7 @@ public class ZipFile implements ZipConstants
len -= remain;
totalBytesRead += remain;
}
-
+
return totalBytesRead;
}
diff --git a/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java b/javax/accessibility/AccessibleAttributeSequence.java
index b5d912d12..5ee50e5d7 100644
--- a/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java
+++ b/javax/accessibility/AccessibleAttributeSequence.java
@@ -1,5 +1,5 @@
-/* ObjectReferenceFactoryOperations.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+/* AccessibleAttributeSequence.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,34 +36,36 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package org.omg.PortableInterceptor;
+package javax.accessibility;
-import org.omg.CORBA.portable.ValueBase;
+import javax.swing.text.AttributeSet;
/**
- * Defines the operations, applicable to the ObjectReferenceFactory.
- *
+ * This is a convenience class that represents an accessible
+ * attribute sequence.
* @since 1.5
- *
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface ObjectReferenceFactoryOperations
- extends ValueBase
+public class AccessibleAttributeSequence
{
/**
- * Create an object with the given repository and object ids. This interface
- * does not specify where and how the returned object must be connected and
- * activated. The derived {@link ObjectReferenceTemplate} interface assumes
- * the the object must be connected to the POA that is specific to that
- * template (name can be obtained).
- *
- * If the object with this objectId already exists in the given context, it is
- * found and returned; the new object is <i>not</i> created.
- *
- * @param repositoryId the repository id of the object being created, defines
- * the type of the object.
- *
- * @param objectId the byte array, defining the identity of the object.
+ * The attributes of the text.
*/
- org.omg.CORBA.Object make_object(String repositoryId, byte[] objectId);
-} \ No newline at end of file
+ public AttributeSet attributes;
+
+ /**
+ * The starting index.
+ */
+ public int startIndex;
+
+ /**
+ * The ending index.
+ */
+ public int endIndex;
+
+ /**
+ * Create a new instance.
+ */
+ public AccessibleAttributeSequence()
+ {
+ }
+}
diff --git a/javax/accessibility/AccessibleContext.java b/javax/accessibility/AccessibleContext.java
index 129e19728..972f4feae 100644
--- a/javax/accessibility/AccessibleContext.java
+++ b/javax/accessibility/AccessibleContext.java
@@ -249,6 +249,35 @@ public abstract class AccessibleContext
= "AccessibleHypertextOffset";
/**
+ * Constant used when a component's bounds have changed. The old and
+ * new bounds are given in the event.
+ * @since 1.5
+ */
+ public static final String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED
+ = "accessibleComponentBoundsChanged";
+
+ /**
+ * Constant used when the state of child objects changes. The old
+ * value in the event is always null, and the new value is the component
+ * whose children have changed.
+ * @since 1.5
+ */
+ public static final String ACCESSIBLE_INVALIDATE_CHILDREN
+ = "accessibleInvalidateChildren";
+
+ /**
+ * Constant used when the attributes of some text have changed.
+ * On insertion, the old value is null and the new value is an
+ * {@link AccessibleAttributeSequence} describing the insertion.
+ * On deletion, the old value is an {@link AccessibleAttributeSequence}
+ * and the new value is null. For replacement, both the old
+ * and new values are {@link AccessibleAttributeSequence} objects.
+ * @since 1.5
+ */
+ public static final String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED
+ = "accessibleTextAttributesChanged";
+
+ /**
* The accessible parent of this object.
*
* @see #getAccessibleParent()
diff --git a/javax/accessibility/AccessibleExtendedText.java b/javax/accessibility/AccessibleExtendedText.java
new file mode 100644
index 000000000..f40fa0fd2
--- /dev/null
+++ b/javax/accessibility/AccessibleExtendedText.java
@@ -0,0 +1,108 @@
+/* AccessibleExtendedText.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.accessibility;
+
+import java.awt.Rectangle;
+
+/**
+ * This interface provides extended text functionality, similar
+ * to AccessibleText.
+ * @see AccessibleText
+ * @since 1.5
+ */
+public interface AccessibleExtendedText
+{
+ /**
+ * This constant indicates that the retrieved text should be a
+ * complete line.
+ */
+ int LINE = 4;
+
+ /**
+ * This constant indicates that the retrieved text should consist
+ * of a run with identical attributes.
+ */
+ int ATTRIBUTE_RUN = 5;
+
+ /**
+ * Determines the bounding box of some text held by this object.
+ * @param start the starting index
+ * @param end the ending index
+ * @return the bounding box
+ * @see AccessibleText#getCharacterBounds(int)
+ */
+ Rectangle getTextBounds(int start, int end);
+
+ /**
+ * Return a range of text from the underlying object.
+ * @param start the starting index
+ * @param end the ending index
+ */
+ String getTextRange(int start, int end);
+
+ /**
+ * Return a text sequence from the underlying object. The part
+ * parameter describes the type of sequence to return; it is one
+ * of the constants from {@link AccessibleText} or from this
+ * class.
+ * @param part the type of the sequence to return
+ * @param index start of the sequence
+ */
+ AccessibleTextSequence getTextSequenceAfter(int part, int index);
+
+ /**
+ * Return a text sequence from the underlying object. The part
+ * parameter describes the type of sequence to return; it is one
+ * of the constants from {@link AccessibleText} or from this
+ * class.
+ * @param part the type of the sequence to return
+ * @param index start of the sequence
+ */
+ AccessibleTextSequence getTextSequenceAt(int part, int index);
+
+ /**
+ * Return a text sequence from the underlying object. The part
+ * parameter describes the type of sequence to return; it is one
+ * of the constants from {@link AccessibleText} or from this
+ * class.
+ * @param part the type of the sequence to return
+ * @param index end of the sequence
+ */
+ AccessibleTextSequence getTextSequenceBefore(int part, int index);
+}
diff --git a/javax/accessibility/AccessibleRelation.java b/javax/accessibility/AccessibleRelation.java
index fae69efc4..3d515fd57 100644
--- a/javax/accessibility/AccessibleRelation.java
+++ b/javax/accessibility/AccessibleRelation.java
@@ -61,7 +61,7 @@ public class AccessibleRelation extends AccessibleBundle
* @see #LABELED_BY
* @see #MEMBER_OF
*/
- public static final String LABEL_FOR = "labelFor";
+ public static final String LABEL_FOR;
/**
* Indicates the object is labeled by other objects.
@@ -72,7 +72,7 @@ public class AccessibleRelation extends AccessibleBundle
* @see #LABEL_FOR
* @see #MEMBER_OF
*/
- public static final String LABELED_BY = "labeledBy";
+ public static final String LABELED_BY;
/**
* Indicates an object is a member of a group of target objects.
@@ -83,7 +83,7 @@ public class AccessibleRelation extends AccessibleBundle
* @see #LABEL_FOR
* @see #LABELED_BY
*/
- public static final String MEMBER_OF = "memberOf";
+ public static final String MEMBER_OF;
/**
* Indicates an object is a controller for other objects.
@@ -94,7 +94,7 @@ public class AccessibleRelation extends AccessibleBundle
* @see #LABELED_BY
* @see #MEMBER_OF
*/
- public static final String CONTROLLER_FOR = "controllerFor";
+ public static final String CONTROLLER_FOR;
/**
* Indicates an object is controlled by other objects.
@@ -105,7 +105,7 @@ public class AccessibleRelation extends AccessibleBundle
* @see #LABELED_BY
* @see #MEMBER_OF
*/
- public static final String CONTROLLED_BY = "controlledBy";
+ public static final String CONTROLLED_BY;
/** Indicates that the label target group has changed. */
public static final String LABEL_FOR_PROPERTY = "labelForProperty";
@@ -122,8 +122,104 @@ public class AccessibleRelation extends AccessibleBundle
/** Indicates that the controlling objects have changed. */
public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty";
+ /**
+ * Indicates that an object is a child of another object.
+ * @since 1.5
+ */
+ public static final String CHILD_NODE_OF = "childNodeOf";
+
+ /**
+ * Indicates that the ancestry relationship has changed.
+ * @since 1.5
+ */
+ public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty";
+
+ /**
+ * Indicates that an object is embedded by another object.
+ * @since 1.5
+ */
+ public static final String EMBEDDED_BY = "embeddedBy";
+
+ /**
+ * Indicates that the {@link #EMBEDDED_BY} property changed.
+ * @since 1.5
+ */
+ public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty";
+
+ /**
+ * Indicates that an object embeds another object.
+ * @since 1.5
+ */
+ public static final String EMBEDS = "embeds";
+
+ /**
+ * Indicates that the {@link #EMBEDS} property changed.
+ * @since 1.5
+ */
+ public static final String EMBEDS_PROPERTY = "embedsProperty";
+
+ /**
+ * Indicates that one object directly follows another object,
+ * as in a paragraph flow.
+ * @since 1.5
+ */
+ public static final String FLOWS_FROM = "flowsFrom";
+
+ /**
+ * Indicates that the {@link #FLOWS_FROM} property changed.
+ * @since 1.5
+ */
+ public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty";
+
+ /**
+ * Indicates that one object comes directly before another object,
+ * as in a paragraph flow.
+ * @since 1.5
+ */
+ public static final String FLOWS_TO = "flowsTo";
+
+ /**
+ * Indicates that the {@link #FLOWS_TO} property changed.
+ * @since 1.5
+ */
+ public static final String FLOWS_TO_PROPERTY = "flowsToProperty";
+
+ /**
+ * Indicates that one object is a parent window of another object.
+ * @since 1.5
+ */
+ public static final String PARENT_WINDOW_OF = "parentWindowOf";
+
+ /**
+ * Indicates that the {@link #PARENT_WINDOW_OF} property changed.
+ * @since 1.5
+ */
+ public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty";
+
+ /**
+ * Indicates that one object is a subwindow of another object.
+ * @since 1.5
+ */
+ public static final String SUBWINDOW_OF = "subwindowOf";
+
+ /**
+ * Indicates that the {@link #SUBWINDOW_OF} property changed.
+ * @since 1.5
+ */
+ public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty";
+
/** An empty set of targets. */
private static final Object[] EMPTY_TARGETS = { };
+
+ static
+ {
+ // not constants in JDK
+ LABEL_FOR = "labelFor";
+ LABELED_BY = "labeledBy";
+ MEMBER_OF = "memberOf";
+ CONTROLLER_FOR = "controllerFor";
+ CONTROLLED_BY = "controlledBy";
+ }
/**
* The related objects.
diff --git a/javax/accessibility/AccessibleStreamable.java b/javax/accessibility/AccessibleStreamable.java
new file mode 100644
index 000000000..cbeedf783
--- /dev/null
+++ b/javax/accessibility/AccessibleStreamable.java
@@ -0,0 +1,62 @@
+/* AccessibleStreamable.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.accessibility;
+
+import java.awt.datatransfer.DataFlavor;
+import java.io.InputStream;
+
+/**
+ * This interface represents a streamable accessible object.
+ * @since 1.5
+ */
+public interface AccessibleStreamable
+{
+ /**
+ * Return an array of the data flavors supported by this object.
+ */
+ DataFlavor[] getMimeTypes();
+
+ /**
+ * Return an input stream that yields the contents of this object,
+ * using the given data flavor. If the given data flavor cannot
+ * be used, returns null.
+ * @param flavor the data flavor
+ */
+ InputStream getStream(DataFlavor flavor);
+}
diff --git a/javax/accessibility/AccessibleText.java b/javax/accessibility/AccessibleText.java
index 88aee1495..be5f45c7e 100644
--- a/javax/accessibility/AccessibleText.java
+++ b/javax/accessibility/AccessibleText.java
@@ -92,7 +92,7 @@ public interface AccessibleText
* Given a point in the coordinate system of this object, return the
* 0-based index of the character at that point, or -1 if there is none.
*
- * @param p the point to look at
+ * @param point the point to look at
* @return the character index, or -1
*/
int getIndexAtPoint(Point point);
diff --git a/javax/accessibility/AccessibleTextSequence.java b/javax/accessibility/AccessibleTextSequence.java
new file mode 100644
index 000000000..88fa4c2b8
--- /dev/null
+++ b/javax/accessibility/AccessibleTextSequence.java
@@ -0,0 +1,68 @@
+/* AccessibleTextSequence.java
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.accessibility;
+
+/**
+ * This is a convenience class that encapsulates a String and a range.
+ * @since 1.5
+ */
+public class AccessibleTextSequence
+{
+ /**
+ * The text of the sequence.
+ */
+ public String text;
+
+ /**
+ * The starting index.
+ */
+ public int startIndex;
+
+ /**
+ * The ending index.
+ */
+ public int endIndex;
+
+ /**
+ * Create a new instance.
+ */
+ public AccessibleTextSequence()
+ {
+ }
+}
diff --git a/javax/imageio/ImageWriteParam.java b/javax/imageio/ImageWriteParam.java
index 1979957fe..4d8efc37a 100644
--- a/javax/imageio/ImageWriteParam.java
+++ b/javax/imageio/ImageWriteParam.java
@@ -103,7 +103,7 @@ public class ImageWriteParam extends IIOParam
protected float compressionQuality;
/**
- * Contains the name of the available compression types.
+ * Contains the name of the current compression type.
*/
protected String compressionType;
diff --git a/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java b/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
index 82059c69b..c0567be78 100644
--- a/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
+++ b/javax/imageio/plugins/jpeg/JPEGHuffmanTable.java
@@ -45,119 +45,115 @@ package javax.imageio.plugins.jpeg;
*/
public class JPEGHuffmanTable
{
+ /**
+ * Huffman code lengths.
+ */
private short[] lengths;
+ /**
+ * Huffman values.
+ */
private short[] values;
- private static short[] ACChrominanceLengths = { 0, 2, 1, 2, 4, 4, 3, 4, 7, 5,
- 4, 4, 0, 1, 2, 0x77 };
-
- private static short[] ACChrominanceValues = { 0x00, 0x01, 0x02, 0x03, 0x11,
- 0x04, 0x05, 0x21, 0x31, 0x06,
- 0x12, 0x41, 0x51, 0x07, 0x61,
- 0x71, 0x13, 0x22, 0x32, 0x81,
- 0x08, 0x14, 0x42, 0x91, 0xa1,
- 0xb1, 0xc1, 0x09, 0x23, 0x33,
- 0x52, 0xf0, 0x15, 0x62, 0x72,
- 0xd1, 0x0a, 0x16, 0x24, 0x34,
- 0xe1, 0x25, 0xf1, 0x17, 0x18,
- 0x19, 0x1a, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x35, 0x36, 0x37,
- 0x38, 0x39, 0x3a, 0x43, 0x44,
- 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x53, 0x54, 0x55, 0x56,
- 0x57, 0x58, 0x59, 0x5a, 0x63,
- 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x69, 0x6a, 0x73, 0x74, 0x75,
- 0x76, 0x77, 0x78, 0x79, 0x7a,
- 0x82, 0x83, 0x84, 0x85, 0x86,
- 0x87, 0x88, 0x89, 0x8a, 0x92,
- 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x9a, 0xa2, 0xa3,
- 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
- 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
- 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
- 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca,
- 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
- 0xd7, 0xd8, 0xd9, 0xda, 0xe2,
- 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
- 0xe8, 0xe9, 0xea, 0xf2, 0xf3,
- 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
-
- private static short[] ACLuminanceLengths = { 0, 2, 1, 3, 3, 2, 4, 3, 5, 5,
- 4, 4, 0, 0, 1, 0x7d };
-
- private static short[] ACLuminanceValues = { 0x01, 0x02, 0x03, 0x00, 0x04,
- 0x11, 0x05, 0x12, 0x21, 0x31,
- 0x41, 0x06, 0x13, 0x51, 0x61,
- 0x07, 0x22, 0x71, 0x14, 0x32,
- 0x81, 0x91, 0xa1, 0x08, 0x23,
- 0x42, 0xb1, 0xc1, 0x15, 0x52,
- 0xd1, 0xf0, 0x24, 0x33, 0x62,
- 0x72, 0x82, 0x09, 0x0a, 0x16,
- 0x17, 0x18, 0x19, 0x1a, 0x25,
- 0x26, 0x27, 0x28, 0x29, 0x2a,
- 0x34, 0x35, 0x36, 0x37, 0x38,
- 0x39, 0x3a, 0x43, 0x44, 0x45,
- 0x46, 0x47, 0x48, 0x49, 0x4a,
- 0x53, 0x54, 0x55, 0x56, 0x57,
- 0x58, 0x59, 0x5a, 0x63, 0x64,
- 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x73, 0x74, 0x75, 0x76,
- 0x77, 0x78, 0x79, 0x7a, 0x83,
- 0x84, 0x85, 0x86, 0x87, 0x88,
- 0x89, 0x8a, 0x92, 0x93, 0x94,
- 0x95, 0x96, 0x97, 0x98, 0x99,
- 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,
- 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
- 0xb7, 0xb8, 0xb9, 0xba, 0xc2,
- 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
- 0xc8, 0xc9, 0xca, 0xd2, 0xd3,
- 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
- 0xd9, 0xda, 0xe1, 0xe2, 0xe3,
- 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
- 0xe9, 0xea, 0xf1, 0xf2, 0xf3,
- 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
-
- private static short[] DCChrominanceLengths = { 0, 3, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 0, 0, 0, 0 };
-
- private static short[] DCChrominanceValues = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11 };
-
- private static short[] DCLuminanceLengths = { 0, 1, 5, 1, 1, 1, 1, 1, 1, 0,
- 0, 0, 0, 0, 0, 0 };
-
- private static short[] DCLuminanceValues = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11 };
-
+ // The private constructors are used for these final fields to avoid
+ // unnecessary copying.
/**
* The standard JPEG AC chrominance Huffman table.
*/
public static final JPEGHuffmanTable StdACChrominance =
- new JPEGHuffmanTable(ACChrominanceLengths, ACChrominanceValues);
+ new JPEGHuffmanTable(new short[] { 0, 2, 1, 2, 4, 4, 3, 4, 7, 5,
+ 4, 4, 0, 1, 2, 0x77 },
+ new short[] { 0x00, 0x01, 0x02, 0x03, 0x11,
+ 0x04, 0x05, 0x21, 0x31, 0x06,
+ 0x12, 0x41, 0x51, 0x07, 0x61,
+ 0x71, 0x13, 0x22, 0x32, 0x81,
+ 0x08, 0x14, 0x42, 0x91, 0xa1,
+ 0xb1, 0xc1, 0x09, 0x23, 0x33,
+ 0x52, 0xf0, 0x15, 0x62, 0x72,
+ 0xd1, 0x0a, 0x16, 0x24, 0x34,
+ 0xe1, 0x25, 0xf1, 0x17, 0x18,
+ 0x19, 0x1a, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x43, 0x44,
+ 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4a, 0x53, 0x54, 0x55, 0x56,
+ 0x57, 0x58, 0x59, 0x5a, 0x63,
+ 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x73, 0x74, 0x75,
+ 0x76, 0x77, 0x78, 0x79, 0x7a,
+ 0x82, 0x83, 0x84, 0x85, 0x86,
+ 0x87, 0x88, 0x89, 0x8a, 0x92,
+ 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9a, 0xa2, 0xa3,
+ 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
+ 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+ 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
+ 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+ 0xc6, 0xc7, 0xc8, 0xc9, 0xca,
+ 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
+ 0xd7, 0xd8, 0xd9, 0xda, 0xe2,
+ 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+ 0xe8, 0xe9, 0xea, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa }, false);
/**
* The standard JPEG AC luminance Huffman table.
*/
public static final JPEGHuffmanTable StdACLuminance =
- new JPEGHuffmanTable(ACLuminanceLengths, ACLuminanceValues);
+ new JPEGHuffmanTable(new short[] { 0, 2, 1, 3, 3, 2, 4, 3, 5, 5,
+ 4, 4, 0, 0, 1, 0x7d },
+ new short[] { 0x01, 0x02, 0x03, 0x00, 0x04,
+ 0x11, 0x05, 0x12, 0x21, 0x31,
+ 0x41, 0x06, 0x13, 0x51, 0x61,
+ 0x07, 0x22, 0x71, 0x14, 0x32,
+ 0x81, 0x91, 0xa1, 0x08, 0x23,
+ 0x42, 0xb1, 0xc1, 0x15, 0x52,
+ 0xd1, 0xf0, 0x24, 0x33, 0x62,
+ 0x72, 0x82, 0x09, 0x0a, 0x16,
+ 0x17, 0x18, 0x19, 0x1a, 0x25,
+ 0x26, 0x27, 0x28, 0x29, 0x2a,
+ 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x43, 0x44, 0x45,
+ 0x46, 0x47, 0x48, 0x49, 0x4a,
+ 0x53, 0x54, 0x55, 0x56, 0x57,
+ 0x58, 0x59, 0x5a, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6a, 0x73, 0x74, 0x75, 0x76,
+ 0x77, 0x78, 0x79, 0x7a, 0x83,
+ 0x84, 0x85, 0x86, 0x87, 0x88,
+ 0x89, 0x8a, 0x92, 0x93, 0x94,
+ 0x95, 0x96, 0x97, 0x98, 0x99,
+ 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+ 0xa6, 0xa7, 0xa8, 0xa9, 0xaa,
+ 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+ 0xb7, 0xb8, 0xb9, 0xba, 0xc2,
+ 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+ 0xc8, 0xc9, 0xca, 0xd2, 0xd3,
+ 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
+ 0xd9, 0xda, 0xe1, 0xe2, 0xe3,
+ 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
+ 0xe9, 0xea, 0xf1, 0xf2, 0xf3,
+ 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+ 0xf9, 0xfa }, false);
/**
* The standard JPEG DC chrominance Huffman table.
*/
public static final JPEGHuffmanTable StdDCChrominance =
- new JPEGHuffmanTable(DCChrominanceLengths, DCChrominanceValues);
+ new JPEGHuffmanTable(new short[] { 0, 3, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0 },
+ new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11 }, false);
/**
* The standard JPEG DC luminance Huffman table.
*/
public static final JPEGHuffmanTable StdDCLuminance =
- new JPEGHuffmanTable(DCLuminanceLengths, DCLuminanceValues);
+ new JPEGHuffmanTable(new short[] { 0, 1, 5, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0 },
+ new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11 }, false);
/**
* Construct and initialize a Huffman table. Copies are created of
@@ -174,9 +170,28 @@ public class JPEGHuffmanTable
*/
public JPEGHuffmanTable(short[] lengths, short[] values)
{
- if (lengths == null || values == null || lengths.length > 16
- || values.length > 256)
- throw new IllegalArgumentException("invalid length or values array");
+ // Create copies of the lengths and values arguments.
+ this(checkLengths(lengths), checkValues(values, lengths), true);
+ }
+
+ /**
+ * Private constructor that avoids unnecessary copying and argument
+ * checking.
+ *
+ * @param lengths an array of Huffman code lengths
+ * @param values a sorted array of Huffman values
+ * @param copy true if copies should be created of the given arrays
+ */
+ private JPEGHuffmanTable(short[] lengths, short[] values, boolean copy)
+ {
+ this.lengths = copy ? (short[]) lengths.clone() : lengths;
+ this.values = copy ? (short[]) values.clone() : values;
+ }
+
+ private static short[] checkLengths(short[] lengths)
+ {
+ if (lengths == null || lengths.length > 16)
+ throw new IllegalArgumentException("invalid length array");
for (int i = 0; i < lengths.length; i++)
{
@@ -184,12 +199,6 @@ public class JPEGHuffmanTable
throw new IllegalArgumentException("negative length");
}
- for (int i = 0; i < values.length; i++)
- {
- if (values[i] < 0)
- throw new IllegalArgumentException("negative value");
- }
-
int sum = 0;
for (int i = 0; i < lengths.length; i++)
{
@@ -198,15 +207,30 @@ public class JPEGHuffmanTable
+ " for code length " + (i + 1));
sum += lengths[i];
}
+
+ return lengths;
+ }
+
+ private static short[] checkValues(short[] values, short[] lengths)
+ {
+ if (values == null || values.length > 256)
+ throw new IllegalArgumentException("invalid values array");
+
+ for (int i = 0; i < values.length; i++)
+ {
+ if (values[i] < 0)
+ throw new IllegalArgumentException("negative value");
+ }
+ // lengths is known-valid by this point.
+ int sum = 0;
+ for (int i = 0; i < lengths.length; i++)
+ sum += lengths[i];
+
if (values.length != sum)
throw new IllegalArgumentException("invalid number of values"
+ " for number of codes");
- this.lengths = new short[lengths.length];
- System.arraycopy(lengths, 0, this.lengths, 0, lengths.length);
-
- this.values = new short[values.length];
- System.arraycopy(values, 0, this.values, 0, values.length);
+ return values;
}
/**
@@ -218,9 +242,7 @@ public class JPEGHuffmanTable
*/
public short[] getLengths()
{
- short[] lengthsCopy = new short[lengths.length];
- System.arraycopy(lengths, 0, lengthsCopy, 0, lengths.length);
- return lengthsCopy;
+ return (short[]) lengths.clone();
}
/**
@@ -231,9 +253,7 @@ public class JPEGHuffmanTable
*/
public short[] getValues()
{
- short[] valuesCopy = new short[values.length];
- System.arraycopy(values, 0, valuesCopy, 0, values.length);
- return valuesCopy;
+ return (short[]) values.clone();
}
/**
diff --git a/javax/imageio/plugins/jpeg/JPEGImageReadParam.java b/javax/imageio/plugins/jpeg/JPEGImageReadParam.java
new file mode 100644
index 000000000..b570922f9
--- /dev/null
+++ b/javax/imageio/plugins/jpeg/JPEGImageReadParam.java
@@ -0,0 +1,161 @@
+/* JPEGImageReadParam.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package javax.imageio.plugins.jpeg;
+
+import javax.imageio.ImageReadParam;
+
+/**
+ * The JPEGImageReadParam class is only used to set JPEG decoding
+ * tables for streams that do not provide their own tables. If a
+ * stream does not provide tables and a custom JPEGImageReadParam is
+ * not provided, then the standard JPEG tables are used from the
+ * JPEGQTable and JPEGHuffmanTable classes. If a stream does provide
+ * decoding tables then JPEGImageReadParam will be ignored.
+ * JPEGImageReadParam cannot be used to retrieve the tables from a
+ * stream. Instead, use IIOMetadata for this purpose.
+ *
+ * A JPEGImageReadParam instance is retrieved from the built-in JPEG
+ * ImageReader using the getDefaultImageReadParam method.
+ */
+public class JPEGImageReadParam
+ extends ImageReadParam
+{
+ private JPEGQTable[] qTables;
+ private JPEGHuffmanTable[] DCHuffmanTables;
+ private JPEGHuffmanTable[] ACHuffmanTables;
+
+ /**
+ * Construct a JPEGImageReadParam.
+ */
+ public JPEGImageReadParam()
+ {
+ super();
+ }
+
+ /**
+ * Check if the decoding tables are set.
+ *
+ * @return true if the decoding tables are set, false otherwise
+ */
+ public boolean areTablesSet()
+ {
+ // If qTables is not null then all tables are set.
+ return (qTables != null);
+ }
+
+ /**
+ * Set the quantization and Huffman tables that will be used to
+ * decode the stream. Copies are created of the array arguments.
+ * The number of Huffman tables must be the same in both Huffman
+ * table arrays. No argument may be null and no array may be longer
+ * than four elements.
+ *
+ * @param qTables JPEG quantization tables
+ * @param DCHuffmanTables JPEG DC Huffman tables
+ * @param ACHuffmanTables JPEG AC Huffman tables
+ *
+ * @throws IllegalArgumentException if any argument is null, if any
+ * of the arrays are longer than four elements, or if the Huffman
+ * table arrays do not have the same number of elements
+ */
+ public void setDecodeTables(JPEGQTable[] qTables,
+ JPEGHuffmanTable[] DCHuffmanTables,
+ JPEGHuffmanTable[] ACHuffmanTables)
+ {
+ if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null)
+ throw new IllegalArgumentException("null argument");
+
+ if (qTables.length > 4 || DCHuffmanTables.length > 4
+ || ACHuffmanTables.length > 4)
+ throw new IllegalArgumentException("argument has too many elements");
+
+ if (DCHuffmanTables.length != ACHuffmanTables.length)
+ throw new IllegalArgumentException("Huffman table arrays differ in length");
+
+ // Do a shallow copy. JPEGQTable's data is not directly
+ // modifyable since JPEGQTable.getTable returns a copy. Therefore
+ // it is safe to have multiple references to a single JPEGQTable.
+ // Likewise for JPEGHuffmanTable.
+ this.qTables = (JPEGQTable[]) qTables.clone();
+ this.DCHuffmanTables = (JPEGHuffmanTable[]) DCHuffmanTables.clone();
+ this.ACHuffmanTables = (JPEGHuffmanTable[]) ACHuffmanTables.clone();
+ }
+
+ /**
+ * Clear the quantization and Huffman decoding tables.
+ */
+ public void unsetDecodeTables()
+ {
+ qTables = null;
+ DCHuffmanTables = null;
+ ACHuffmanTables = null;
+ }
+
+ /**
+ * Retrieve the quantization tables.
+ *
+ * @returns an array of JPEG quantization tables
+ */
+ public JPEGQTable[] getQTables()
+ {
+ return qTables == null ? qTables : (JPEGQTable[]) qTables.clone();
+ }
+
+ /**
+ * Retrieve the DC Huffman tables.
+ *
+ * @return an array of JPEG DC Huffman tables
+ */
+ public JPEGHuffmanTable[] getDCHuffmanTables()
+ {
+ return DCHuffmanTables == null ? DCHuffmanTables
+ : (JPEGHuffmanTable[]) DCHuffmanTables.clone();
+ }
+
+ /**
+ * Retrieve the AC Huffman tables.
+ *
+ * @return an array of JPEG AC Huffman tables
+ */
+ public JPEGHuffmanTable[] getACHuffmanTables()
+ {
+ return ACHuffmanTables == null ? ACHuffmanTables
+ : (JPEGHuffmanTable[]) ACHuffmanTables.clone();
+ }
+}
diff --git a/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java b/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java
new file mode 100644
index 000000000..1e7989e82
--- /dev/null
+++ b/javax/imageio/plugins/jpeg/JPEGImageWriteParam.java
@@ -0,0 +1,293 @@
+/* JPEGImageWriteParam.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package javax.imageio.plugins.jpeg;
+
+import java.util.Locale;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+import javax.imageio.ImageWriteParam;
+
+/**
+ * The JPEGImageWriteParam class can be used to specify tables and
+ * settings used in the JPEG encoding process. Encoding tables are
+ * taken from the metadata associated with the output stream, and
+ * failing that (if the metadata tables are null) from an instance of
+ * JPEGImageWriteParam. The default metadata uses the standard JPEG
+ * tables from the JPEGQTable and JPEGHuffmanTable classes. Non-null
+ * metadata tables override JPEGImageWriteParam tables. Compression
+ * settings range from 1.0, best compression, through 0.75, default
+ * compression, to 0.0, worst compression.
+ *
+ * A JPEGImageWriteParam instance is retrieved from the built-in JPEG
+ * ImageWriter using the getDefaultImageWriteParam method.
+ */
+public class JPEGImageWriteParam
+ extends ImageWriteParam
+{
+ private JPEGQTable[] qTables;
+ private JPEGHuffmanTable[] DCHuffmanTables;
+ private JPEGHuffmanTable[] ACHuffmanTables;
+ private boolean optimize;
+ private String[] compressionQualityDescriptions;
+ private float[] compressionQualityValues;
+
+ /**
+ * Localized messages are stored in separate files.
+ */
+ private ResourceBundle messages;
+
+ /**
+ * Construct a JPEGImageWriteParam with the following state: tiling
+ * is not supported, progressive mode is supported, initial
+ * progressive mode is MODE_DISABLED, compression is supported, one
+ * compression type named "JPEG" is supported and the default
+ * compression quality is 0.75f. Compression type names and
+ * compression quality descriptions are localized to the given
+ * locale.
+ *
+ * @param locale the locale used for message localization
+ */
+ public JPEGImageWriteParam(Locale locale)
+ {
+ super(locale);
+
+ // Get localized compression type and compression quality
+ // description strings for the given locale.
+ messages = PropertyResourceBundle.getBundle
+ ("javax/imageio/plugins/jpeg/MessagesBundle", locale);
+
+ // Initialize inherited ImageWriter fields.
+ canWriteTiles = false;
+ canWriteProgressive = true;
+ progressiveMode = MODE_DISABLED;
+ canWriteCompressed = true;
+ compressionTypes = new String[]
+ {
+ messages.getString("compression.types.jpeg")
+ };
+ compressionType = compressionTypes[0];
+ compressionQuality = 0.75f;
+ }
+
+ /**
+ * Reset the compression quality to 0.75f.
+ */
+ public void unsetCompression()
+ {
+ compressionQuality = 0.75f;
+ }
+
+ /**
+ * Check if compression algorithm is lossless. JPEGImageWriteParam
+ * overrides this ImageWriteParam method to always return false
+ * since JPEG compression is inherently lossy.
+ *
+ * @return false
+ */
+ public boolean isCompressionLossless()
+ {
+ return false;
+ }
+
+ /**
+ * Retrieve an array of compression quality descriptions. These
+ * messages are localized using the locale provided upon
+ * construction. Each compression quality description in the
+ * returned array corresponds to the compression quality value at
+ * the same index in the array returned by
+ * getCompressionQualityValues.
+ *
+ * @return an array of strings each of which describes a compression
+ * quality value
+ */
+ public String[] getCompressionQualityDescriptions()
+ {
+ // Make sure exceptions are thrown when this image write param is
+ // in the wrong state.
+ super.getCompressionQualityDescriptions();
+
+ if (compressionQualityDescriptions == null)
+ {
+ compressionQualityDescriptions = new String[]
+ {
+ messages.getString("compression.minimum"),
+ messages.getString("compression.default"),
+ messages.getString("compression.maximum")
+ };
+ }
+
+ return compressionQualityDescriptions;
+ }
+
+ /**
+ * Retrieve an array of compression quality values, ordered from
+ * lowest quality to highest quality.
+ *
+ * @return an array of compressions quality values
+ */
+ public float[] getCompressionQualityValues()
+ {
+ // Make sure exceptions are thrown when this image write param is
+ // in the wrong state.
+ super.getCompressionQualityValues();
+
+ if (compressionQualityValues == null)
+ compressionQualityValues = new float[] { 0.05f, 0.75f, 0.95f };
+
+ return compressionQualityValues;
+ }
+
+ /**
+ * Check if the encoding tables are set.
+ *
+ * @return true if the encoding tables are set, false otherwise
+ */
+ public boolean areTablesSet()
+ {
+ // If qTables is not null then all tables are set.
+ return (qTables != null);
+ }
+
+ /**
+ * Set the quantization and Huffman tables that will be used to
+ * encode the stream. Copies are created of the array arguments.
+ * The number of Huffman tables must be the same in both Huffman
+ * table arrays. No argument may be null and no array may be longer
+ * than four elements.
+ *
+ * @param qTables JPEG quantization tables
+ * @param DCHuffmanTables JPEG DC Huffman tables
+ * @param ACHuffmanTables JPEG AC Huffman tables
+ *
+ * @throws IllegalArgumentException if any argument is null, if any
+ * of the arrays are longer than four elements, or if the Huffman
+ * table arrays do not have the same number of elements
+ */
+ public void setEncodeTables(JPEGQTable[] qTables,
+ JPEGHuffmanTable[] DCHuffmanTables,
+ JPEGHuffmanTable[] ACHuffmanTables)
+ {
+ if (qTables == null || DCHuffmanTables == null || ACHuffmanTables == null)
+ throw new IllegalArgumentException("null argument");
+
+ if (qTables.length > 4 || DCHuffmanTables.length > 4
+ || ACHuffmanTables.length > 4)
+ throw new IllegalArgumentException("argument has too many elements");
+
+ if (DCHuffmanTables.length != ACHuffmanTables.length)
+ throw new IllegalArgumentException("Huffman table arrays differ in length");
+
+ // Do a shallow copy. JPEGQTable's data is not directly
+ // modifyable since JPEGQTable.getTable returns a copy. Therefore
+ // it is safe to have multiple references to a single JPEGQTable.
+ // Likewise for JPEGHuffmanTable.
+ this.qTables = (JPEGQTable[]) qTables.clone();
+ this.DCHuffmanTables = (JPEGHuffmanTable[]) DCHuffmanTables.clone();
+ this.ACHuffmanTables = (JPEGHuffmanTable[]) ACHuffmanTables.clone();
+ }
+
+ /**
+ * Clear the quantization and Huffman encoding tables.
+ */
+ public void unsetEncodeTables()
+ {
+ qTables = null;
+ DCHuffmanTables = null;
+ ACHuffmanTables = null;
+ }
+
+ /**
+ * Retrieve the quantization tables.
+ *
+ * @returns an array of JPEG quantization tables
+ */
+ public JPEGQTable[] getQTables()
+ {
+ return qTables == null ? qTables : (JPEGQTable[]) qTables.clone();
+ }
+
+ /**
+ * Retrieve the DC Huffman tables.
+ *
+ * @return an array of JPEG DC Huffman tables
+ */
+ public JPEGHuffmanTable[] getDCHuffmanTables()
+ {
+ return DCHuffmanTables == null ? DCHuffmanTables
+ : (JPEGHuffmanTable[]) DCHuffmanTables.clone();
+ }
+
+ /**
+ * Retrieve the AC Huffman tables.
+ *
+ * @return an array of JPEG AC Huffman tables
+ */
+ public JPEGHuffmanTable[] getACHuffmanTables()
+ {
+ return ACHuffmanTables == null ? ACHuffmanTables
+ : (JPEGHuffmanTable[]) ACHuffmanTables.clone();
+ }
+
+ /**
+ * Specify whether or not Huffman tables written to the output
+ * stream should be optimized. Every image encoded with this flag
+ * set will contain a Huffman table, and the generated Huffman
+ * tables will override those specified in the metadata.
+ *
+ * @param optimize true to generate optimized Huffman tables, false
+ * otherwise
+ */
+ public void setOptimizeHuffmanTables(boolean optimize)
+ {
+ this.optimize = optimize;
+ }
+
+ /**
+ * Check whether or not Huffman tables written to the output stream
+ * will be optimized. Unless otherwise set using
+ * setOptimizeHuffmanTables, this returns false.
+ *
+ * @return true Huffman tables written to the output stream will be
+ * optimized, false otherwise
+ */
+ public boolean getOptimizeHuffmanTables()
+ {
+ return optimize;
+ }
+}
diff --git a/javax/imageio/plugins/jpeg/JPEGQTable.java b/javax/imageio/plugins/jpeg/JPEGQTable.java
new file mode 100644
index 000000000..a94e8b188
--- /dev/null
+++ b/javax/imageio/plugins/jpeg/JPEGQTable.java
@@ -0,0 +1,196 @@
+/* JPEGQTable.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package javax.imageio.plugins.jpeg;
+
+/**
+ * The JPEGQTable class represents a quantization table that can be
+ * used to encode or decode a JPEG stream. The standard JPEG
+ * luminance and chrominance quantization tables are provided as
+ * static fields. Table entries are stored in natural order, not
+ * zig-zag order.
+ */
+public class JPEGQTable
+{
+ /**
+ * The table entries, stored in natural order.
+ */
+ private int[] table;
+
+ /**
+ * The standard JPEG luminance quantization table. Values are
+ * stored in natural order.
+ */
+ public static final JPEGQTable K1Luminance = new JPEGQTable(new int[]
+ {
+ 16, 11, 10, 16, 24, 40, 51, 61,
+ 12, 12, 14, 19, 26, 58, 60, 55,
+ 14, 13, 16, 24, 40, 57, 69, 56,
+ 14, 17, 22, 29, 51, 87, 80, 62,
+ 18, 22, 37, 56, 68, 109, 103, 77,
+ 24, 35, 55, 64, 81, 104, 113, 92,
+ 49, 64, 78, 87, 103, 121, 120, 101,
+ 72, 92, 95, 98, 112, 100, 103, 99
+ }, false);
+
+ /**
+ * The standard JPEG luminance quantization table, scaled by
+ * one-half. Values are stored in natural order.
+ */
+ public static final JPEGQTable K1Div2Luminance =
+ K1Luminance.getScaledInstance(0.5f, true);
+
+ /**
+ * The standard JPEG chrominance quantization table. Values are
+ * stored in natural order.
+ */
+ public static final JPEGQTable K2Chrominance = new JPEGQTable(new int[]
+ {
+ 17, 18, 24, 47, 99, 99, 99, 99,
+ 18, 21, 26, 66, 99, 99, 99, 99,
+ 24, 26, 56, 99, 99, 99, 99, 99,
+ 47, 66, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+ }, false);
+
+ /**
+ * The standard JPEG chrominance quantization table, scaled by
+ * one-half. Values are stored in natural order.
+ */
+ public static final JPEGQTable K2Div2Chrominance =
+ K2Chrominance.getScaledInstance(0.5f, true);
+
+ /**
+ * Construct a new JPEG quantization table. A copy is created of
+ * the table argument.
+ *
+ * @param table the 64-element value table, stored in natural order
+ *
+ * @throws IllegalArgumentException if the table is null or if
+ * table's length is not equal to 64.
+ */
+ public JPEGQTable(int[] table)
+ {
+ this(checkTable(table), true);
+ }
+
+ /**
+ * Private constructor that avoids unnecessary copying and argument
+ * checking.
+ *
+ * @param table the 64-element value table, stored in natural order
+ * @param copy true if a copy should be created of the given table
+ */
+ private JPEGQTable(int[] table, boolean copy)
+ {
+ this.table = copy ? (int[]) table.clone() : table;
+ }
+
+ private static int[] checkTable(int[] table)
+ {
+ if (table == null || table.length != 64)
+ throw new IllegalArgumentException("invalid JPEG quantization table");
+
+ return table;
+ }
+
+ /**
+ * Retrieve a copy of the quantization values for this table.
+ *
+ * @return a copy of the quantization value array
+ */
+ public int[] getTable()
+ {
+ return (int[]) table.clone();
+ }
+
+ /**
+ * Retrieve a copy of this JPEG quantization table with every value
+ * scaled by the given scale factor, and clamped from 1 to 255
+ * baseline or from 1 to 32767 otherwise.
+ *
+ * @param scaleFactor the factor by which to scale this table
+ * @param forceBaseline clamp scaled values to a maximum of 255 if
+ * true, 32767 if false
+ *
+ * @return a new scaled JPEG quantization table
+ */
+ public JPEGQTable getScaledInstance(float scaleFactor,
+ boolean forceBaseline)
+ {
+ int[] scaledTable = getTable();
+ int max = forceBaseline ? 255 : 32767;
+
+ for (int i = 0; i < scaledTable.length; i++)
+ {
+ scaledTable[i] = Math.round (scaleFactor * (float) scaledTable[i]);
+ if (scaledTable[i] < 1)
+ scaledTable[i] = 1;
+ else if (scaledTable[i] > max)
+ scaledTable[i] = max;
+ }
+
+ // Do not copy scaledTable. It is already a copy because we used
+ // getTable to retrieve it.
+ return new JPEGQTable(scaledTable, false);
+ }
+
+ /**
+ * Create a string representing this JPEG quantization table.
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("JPEGQTable:\n");
+ for (int i = 0; i < 8; i++)
+ {
+ buffer.append(" ");
+ for (int j = 0; j < 8; j++)
+ {
+ buffer.append(table[i * 8 + j] + " ");
+ }
+ buffer.append("\n");
+ }
+
+ return buffer.toString();
+ }
+}
diff --git a/javax/naming/Binding.java b/javax/naming/Binding.java
index 9d6608aba..a34f8b329 100644
--- a/javax/naming/Binding.java
+++ b/javax/naming/Binding.java
@@ -39,31 +39,73 @@ exception statement from your version. */
package javax.naming;
/**
+ * <code>Binding</code> represents the name-object mapping of a
+ * binding in a context.
+ * <p>
+ * Bindings are mappings of a name to an object and this class is used to
+ * specify such mappings. The bindings of a context are retrieved by the
+ * <code>Context#listBindings()</code> methods.
+ * </p>
+ *
* @author Tom Tromey (tromey@redhat.com)
- * @date May 16, 2001
+ * @since 1.3
*/
public class Binding extends NameClassPair
{
private static final long serialVersionUID = 8839217842691845890L;
+ /**
+ * Constructs an instance with the given name and object.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param obj the bound object
+ */
public Binding (String name, Object obj)
{
super (name, null);
boundObj = obj;
}
+ /**
+ * Constructs an instance with the given name and object and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param obj the bound object
+ * @param isRelative flag indicating if the name is relative or not
+ */
public Binding (String name, Object obj, boolean isRelative)
{
super (name, null, isRelative);
boundObj = obj;
}
+ /**
+ * Constructs an instance with the given name, classname and object.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param className the classname to set (maybe <code>null</code>)
+ * @param obj the bound object
+ */
public Binding (String name, String className, Object obj)
{
super (name, className);
boundObj = obj;
}
+ /**
+ * Constructs an instance with the given name, classname, object and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param className the classname to set (maybe <code>null</code>)
+ * @param isRelative flag indicating if the name is relative or not
+ * @param obj the bound object
+ */
public Binding (String name, String className, Object obj,
boolean isRelative)
{
@@ -71,6 +113,15 @@ public class Binding extends NameClassPair
boundObj = obj;
}
+ /**
+ * Returns the classname of the bound object.
+ * <p>
+ * Returns the classname if set explicitly. If not and the bound object is
+ * not <code>null</code> the classname of the bound object is used.
+ * </p>
+ *
+ * @return The fully qualified classname (may be <code>null</code>).
+ */
public String getClassName ()
{
String r = super.getClassName ();
@@ -79,16 +130,29 @@ public class Binding extends NameClassPair
return boundObj == null ? null : boundObj.getClass ().getName ();
}
+ /**
+ * Returns the bound object of this binding.
+ * @return The bound object (maybe <code>null</code>).
+ */
public Object getObject ()
{
return boundObj;
}
+ /**
+ * Sets the bound object of this binding.
+ * @param obj the bound object.
+ */
public void setObject (Object obj)
{
boundObj = obj;
}
+ /**
+ * Returns the string representation.
+ * @return The string as given by the NameClassPair superclass plus
+ * the bound objects string representation seperated by a colon.
+ */
public String toString ()
{
// Format specified by the documentation.
diff --git a/javax/naming/CompositeName.java b/javax/naming/CompositeName.java
index 6c4b1df46..46e841b93 100644
--- a/javax/naming/CompositeName.java
+++ b/javax/naming/CompositeName.java
@@ -1,5 +1,5 @@
/* CompositeName.java --
- Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,9 @@ exception statement from your version. */
package javax.naming;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.NoSuchElementException;
@@ -45,10 +48,6 @@ import java.util.Vector;
/**
* @author Tom Tromey (tromey@redhat.com)
- * @date May 16, 2001
- *
- * FIXME: must write readObject and writeObject to conform to
- * serialization spec.
*/
public class CompositeName implements Name, Cloneable, Serializable
{
@@ -316,6 +315,22 @@ public class CompositeName implements Name, Cloneable, Serializable
}
return result.toString ();
}
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ int size = s.readInt();
+ elts = new Vector(size);
+ for (int i = 0; i < size; i++)
+ elts.add(s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.get(i));
+ }
private transient Vector elts;
}
diff --git a/javax/naming/NameClassPair.java b/javax/naming/NameClassPair.java
index 127730af4..7925d45d8 100644
--- a/javax/naming/NameClassPair.java
+++ b/javax/naming/NameClassPair.java
@@ -41,18 +41,43 @@ package javax.naming;
import java.io.Serializable;
/**
+ * <code>NameClassPair</code> represents the name-classname mapping pair
+ * of a binding in a context.
+ * <p>
+ * Bindings are mappings of a name to an object and this class is used to
+ * specify the mapping of the name to the class type of the bound object.
+ * As classname the fully qualified classname is used.
+ * </p>
+ *
* @author Tom Tromey (tromey@redhat.com)
- * @date May 16, 2001
+ * @since 1.3
*/
public class NameClassPair implements Serializable
{
private static final long serialVersionUID = 5620776610160863339L;
+ /**
+ * Constructs an instance with the given name and classname.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param className the name of the class. If <code>null</code> the bound
+ * object is also <code>null</code>
+ */
public NameClassPair (String name, String className)
{
this (name, className, true);
}
+ /**
+ * Constructs an instance with the given name and classname and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding (may not be <code>null</code>)
+ * @param className the name of the class. If <code>null</code> the bound
+ * object is also <code>null</code>
+ * @param isRelative flag indicating if the name is relative or not
+ */
public NameClassPair (String name, String className, boolean isRelative)
{
this.name = name;
@@ -60,36 +85,105 @@ public class NameClassPair implements Serializable
this.isRel = isRelative;
}
+ /**
+ * Returns the classname of the binding.
+ * @return The fully qualified classname or <code>null</code> if the
+ * bound object is null.
+ */
public String getClassName ()
{
return className;
}
+ /**
+ * Returns the name of the binding.
+ * @return The name.
+ */
public String getName ()
{
return name;
}
+ /**
+ * Checks whether the name is relative to the target context or not.
+ * @return <code>true</code> if the name is relative,
+ * <code>false</code> otherwise.
+ */
public boolean isRelative ()
{
return isRel;
}
+ /**
+ * Sets the classname of the bound object.
+ * @param name the classname to set (maybe <code>null</code>)
+ */
public void setClassName (String name)
{
this.className = name;
}
+ /**
+ * Sets the name of the binding.
+ * @param name the name to set
+ */
public void setName (String name)
{
this.name = name;
}
+ /**
+ * Sets if the name is relative to the target context.
+ * @param r <code>true</code> to mark as relative
+ */
public void setRelative (boolean r)
{
this.isRel = r;
}
+
+ /**
+ * Sets the full name for this binding. Setting the full name by this
+ * method is the only way to initialize full names of bindings if
+ * supported by a specific naming system.
+ *
+ * @param fullName the full name of this binding. If not set or set to
+ * <code>null</code> the <code>getNameInNamespace()</code> method will
+ * throw an exception
+ *
+ * @see #getNameInNamespace()
+ *
+ * @since 1.5
+ */
+ public void setNameInNamespace(String fullName)
+ {
+ this.fullName = fullName;
+ }
+
+ /**
+ * Returns the full name for this binding. The full name of a binding is
+ * defined as the absolute name in its own namespace and is not valid
+ * outside.
+ *
+ * @return The full name in the bindings namespace.
+ * @throws UnsupportedOperationException if no full name is applicable in
+ * the specific naming system.
+ *
+ * @see Context#getNameInNamespace()
+ *
+ * @since 1.5
+ */
+ public String getNameInNamespace()
+ {
+ if (this.fullName == null)
+ throw new UnsupportedOperationException();
+
+ return this.fullName;
+ }
+ /**
+ * Returns the string representation.
+ * @return The string <code>getName() + ":" + getClassName()</code>.
+ */
public String toString ()
{
// Specified by class documentation.
@@ -100,4 +194,5 @@ public class NameClassPair implements Serializable
private String name;
private String className;
private boolean isRel;
+ private String fullName;
}
diff --git a/javax/naming/directory/BasicAttribute.java b/javax/naming/directory/BasicAttribute.java
index bc1487fd4..5a1bb0e88 100644
--- a/javax/naming/directory/BasicAttribute.java
+++ b/javax/naming/directory/BasicAttribute.java
@@ -1,5 +1,5 @@
/* BasicAttribute.java --
- Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,9 @@ exception statement from your version. */
package javax.naming.directory;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.NoSuchElementException;
import java.util.Vector;
@@ -48,6 +51,7 @@ import javax.naming.OperationNotSupportedException;
/**
* @author Tom Tromey (tromey@redhat.com)
* @date June 20, 2001
+ * @since 1.3
*/
public class BasicAttribute implements Attribute
{
@@ -297,11 +301,29 @@ public class BasicAttribute implements Attribute
return one.equals (two);
}
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ int size = s.readInt();
+ values = new Vector(size);
+ for (int i=0; i < size; i++)
+ values.add(s.readObject());
+ }
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.defaultWriteObject();
+ s.writeInt(values.size());
+ for (int i=0; i < values.size(); i++)
+ s.writeObject(values.get(i));
+ }
+
// Used when enumerating this attribute.
private class BasicAttributeEnumeration implements NamingEnumeration
{
- int where = -1;
+ int where = 0;
public BasicAttributeEnumeration ()
{
@@ -328,10 +350,9 @@ public class BasicAttribute implements Attribute
public Object nextElement () throws NoSuchElementException
{
- if (where + 1 >= values.size ())
+ if (where == values.size ())
throw new NoSuchElementException ("no more elements");
- ++where;
- return values.get (where);
+ return values.get (where++);
}
}
}
diff --git a/javax/naming/directory/BasicAttributes.java b/javax/naming/directory/BasicAttributes.java
index 8ab4f2e8c..6880f5b33 100644
--- a/javax/naming/directory/BasicAttributes.java
+++ b/javax/naming/directory/BasicAttributes.java
@@ -1,5 +1,5 @@
/* BasicAttributes.java --
- Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,9 @@ exception statement from your version. */
package javax.naming.directory;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.NoSuchElementException;
import java.util.Vector;
@@ -196,6 +199,24 @@ public class BasicAttributes implements Attributes
// Package-private to avoid a trampoline.
transient Vector attributes;
+ private void readObject(ObjectInputStream s) throws IOException,
+ ClassNotFoundException
+ {
+ s.defaultReadObject();
+ int size = s.readInt();
+ attributes = new Vector(size);
+ for (int i = 0; i < size; i++)
+ attributes.add(s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.defaultWriteObject();
+ s.writeInt(attributes.size());
+ for (int i = 0; i < attributes.size(); i++)
+ s.writeObject(attributes.get(i));
+ }
+
// Used when enumerating.
private class BasicAttributesEnumeration implements NamingEnumeration
{
diff --git a/javax/security/auth/kerberos/DelegationPermission.java b/javax/security/auth/kerberos/DelegationPermission.java
new file mode 100644
index 000000000..33e1f9893
--- /dev/null
+++ b/javax/security/auth/kerberos/DelegationPermission.java
@@ -0,0 +1,136 @@
+/* DelegationPermission.java -- kerberos delegation permission
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.kerberos;
+
+import java.security.BasicPermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ * @since 1.4
+ */
+public final class DelegationPermission
+ extends BasicPermission
+{
+ // FIXME: Enable this when serialization works.
+ // private static final long serialVersionUID = 883133252142523922L;
+
+ /**
+ * Create a new instance with the given name.
+ */
+ public DelegationPermission(String name)
+ {
+ super(name);
+ checkSyntax(name);
+ }
+
+ /**
+ * Create a new instance with the given name and actions.
+ *
+ * The name consists of two parts: first the subordinate
+ * service principal, then the target service principal.
+ * Each principal is surrounded by quotes; the two are separated
+ * by a space.
+ *
+ * @param name the name
+ * @param actions the actions; this is ignored
+ */
+ public DelegationPermission(String name, String actions)
+ {
+ super(name, actions);
+ checkSyntax(name);
+ }
+
+ private static void checkSyntax(String name)
+ {
+ int index = name.indexOf('"', 1);
+ int len = name.length();
+ if (name.charAt(0) != '"' || name.charAt(len - 1) != '"'
+ || index == -1 || index + 3 >= len
+ || name.charAt(index + 1) != ' '
+ || name.charAt(index + 2) != '"')
+ // FIXME: better message here.
+ throw new IllegalArgumentException("invalid syntax for principals");
+ }
+
+ public boolean implies(Permission perm)
+ {
+ return equals(perm);
+ }
+
+ public PermissionCollection newPermissionCollection()
+ {
+ // FIXME: don't know how to serialize here. I suspect this
+ // class has to have a particular name, etc ...
+ return new PermissionCollection()
+ {
+ private Vector permissions = new Vector();
+
+ public void add(Permission perm)
+ {
+ if (isReadOnly())
+ throw new SecurityException("readonly");
+ if (! (perm instanceof DelegationPermission))
+ throw new IllegalArgumentException("can only add DelegationPermissions");
+ permissions.add(perm);
+ }
+
+ public boolean implies(Permission perm)
+ {
+ if (! (perm instanceof DelegationPermission))
+ return false;
+ Enumeration e = elements();
+ while (e.hasMoreElements())
+ {
+ DelegationPermission dp = (DelegationPermission) e.nextElement();
+ if (dp.implies(perm))
+ return true;
+ }
+ return false;
+ }
+
+ public Enumeration elements()
+ {
+ return permissions.elements();
+ }
+ };
+ }
+}
diff --git a/javax/security/auth/kerberos/KerberosKey.java b/javax/security/auth/kerberos/KerberosKey.java
new file mode 100644
index 000000000..3372a162f
--- /dev/null
+++ b/javax/security/auth/kerberos/KerberosKey.java
@@ -0,0 +1,180 @@
+/* KerberosKey.java -- kerberos key
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.kerberos;
+
+import gnu.classpath.NotImplementedException;
+
+import java.io.Serializable;
+
+import javax.crypto.SecretKey;
+import javax.security.auth.DestroyFailedException;
+import javax.security.auth.Destroyable;
+
+/**
+ * This class represents a Kerberos key. See the Kerberos
+ * authentication RFC for more information:
+ * <a href="http://www.ietf.org/rfc/rfc1510.txt">RFC 1510</a>.
+ *
+ * @since 1.4
+ */
+public class KerberosKey
+ implements Serializable, SecretKey, Destroyable
+{
+ private static final long serialVersionUID = -4625402278148246993L;
+
+ private KerberosPrincipal principal;
+ private int versionNum;
+ private KeyImpl key;
+
+ /**
+ * Construct a new key with the indicated principal and key.
+ * @param principal the principal
+ * @param key the key's data
+ * @param type the key's type
+ * @param version the key's version number
+ */
+ public KerberosKey(KerberosPrincipal principal, byte[] key, int type,
+ int version)
+ {
+ this.principal = principal;
+ this.versionNum = version;
+ this.key = new KeyImpl(key, type);
+ }
+
+ /**
+ * Construct a new key with the indicated principal and a password.
+ * @param principal the principal
+ * @param passwd the password to use
+ * @param algo the algorithm; if null the "DES" algorithm is used
+ */
+ public KerberosKey(KerberosPrincipal principal, char[] passwd, String algo)
+ // Not implemented because KeyImpl really does nothing here.
+ throws NotImplementedException
+ {
+ this.principal = principal;
+ this.versionNum = 0; // FIXME: correct?
+ this.key = new KeyImpl(passwd, algo);
+ }
+
+ /**
+ * Return the name of the algorithm used to create this key.
+ */
+ public final String getAlgorithm()
+ {
+ checkDestroyed();
+ return key.algorithm;
+ }
+
+ /**
+ * Return the format of this key. This implementation always returns "RAW".
+ */
+ public final String getFormat()
+ {
+ checkDestroyed();
+ // Silly, but specified.
+ return "RAW";
+ }
+
+ /**
+ * Return the principal associated with this key.
+ */
+ public final KerberosPrincipal getPrincipal()
+ {
+ checkDestroyed();
+ return principal;
+ }
+
+ /**
+ * Return the type of this key.
+ */
+ public final int getKeyType()
+ {
+ checkDestroyed();
+ return key.type;
+ }
+
+ /**
+ * Return the version number of this key.
+ */
+ public final int getVersionNumber()
+ {
+ checkDestroyed();
+ return versionNum;
+ }
+
+ /**
+ * Return the encoded form of this key.
+ */
+ public final byte[] getEncoded()
+ {
+ checkDestroyed();
+ return (byte[]) key.key.clone();
+ }
+
+ /**
+ * Destroy this key.
+ */
+ public void destroy() throws DestroyFailedException
+ {
+ if (key == null)
+ throw new DestroyFailedException("already destroyed");
+ key = null;
+ }
+
+ /**
+ * Return true if this key has been destroyed. After this has been
+ * called, other methods on this object will throw IllegalStateException.
+ */
+ public boolean isDestroyed()
+ {
+ return key == null;
+ }
+
+ private void checkDestroyed()
+ {
+ if (key == null)
+ throw new IllegalStateException("key is destroyed");
+ }
+
+ public String toString()
+ {
+ // FIXME: random choice here.
+ return principal + ":" + versionNum;
+ }
+}
diff --git a/javax/security/auth/kerberos/KerberosPrincipal.java b/javax/security/auth/kerberos/KerberosPrincipal.java
new file mode 100644
index 000000000..d52b5cf9e
--- /dev/null
+++ b/javax/security/auth/kerberos/KerberosPrincipal.java
@@ -0,0 +1,207 @@
+/* KerberosPrincipal.java -- a kerberos principal
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.kerberos;
+
+import gnu.classpath.NotImplementedException;
+import gnu.classpath.SystemProperties;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+/**
+ * This represents a Kerberos principal. See the Kerberos
+ * authentication RFC for more information:
+ * <a href="http://www.ietf.org/rfc/rfc1510.txt">RFC 1510</a>.
+ *
+ * @since 1.4
+ */
+public final class KerberosPrincipal
+ implements Serializable, Principal
+{
+ // Uncomment when serialization is correct.
+ // private static final long serialVersionUID = -7374788026156829911L;
+
+ /**
+ * Constant from the RFC: "Just the name of the principal as in DCE, or
+ * for users".
+ */
+ public static final int KRB_NT_PRINCIPAL = 1;
+
+ /**
+ * Constant from the RFC: "Service and other unique instance (krbtgt)".
+ */
+ public static final int KRB_NT_SRV_HST = 3;
+
+ /**
+ * Constant from the RFC: "Service with host name as instance (telnet,
+ * rcommands)".
+ */
+ public static final int KRB_NT_SRV_INST = 2;
+
+ /**
+ * Constant from the RFC: "Service with host as remaining components".
+ */
+ public static final int KRB_NT_SRV_XHST = 4;
+
+ /**
+ * Constant from the RFC: "Unique ID".
+ */
+ public static final int KRB_NT_UID = 5;
+
+ /**
+ * Constant from the RFC: "Name type not known".
+ */
+ public static final int KRB_NT_UNKNOWN = 0;
+
+ private String name;
+ private int type;
+ private String realm;
+
+ /**
+ * Create a new instance with the given name and a type of
+ * {@link #KRB_NT_PRINCIPAL}.
+ * @param name the principal's name
+ */
+ public KerberosPrincipal(String name)
+ {
+ this(name, KRB_NT_PRINCIPAL);
+ }
+
+ /**
+ * Create a new instance with the given name and type. The name is
+ * parsed according to the rules in the RFC. If there is no realm,
+ * then the local realm is used instead.
+ *
+ * @param name the principal's name
+ * @param type the principal's type
+ */
+ public KerberosPrincipal(String name, int type)
+ // Marked as unimplemented because we don't look for the realm as needed.
+ throws NotImplementedException
+ {
+ if (type < KRB_NT_UNKNOWN || type > KRB_NT_UID)
+ throw new IllegalArgumentException("unknown type: " + type);
+ this.name = name;
+ this.type = type;
+ this.realm = parseRealm();
+ }
+
+ private String parseRealm()
+ {
+ // Handle quoting as specified by the Kerberos RFC.
+ int i, len = name.length();
+ boolean quoted = false;
+ for (i = 0; i < len; ++i)
+ {
+ if (quoted)
+ {
+ quoted = false;
+ continue;
+ }
+ char c = name.charAt(i);
+ if (c == '\\')
+ {
+ quoted = true;
+ continue;
+ }
+ if (c == '@')
+ break;
+ }
+ if (quoted || i == len - 1)
+ throw new IllegalArgumentException("malformed principal: " + name);
+ if (i < len)
+ {
+ // We have the realm. FIXME: verify its syntax?
+ return name.substring(i + 1);
+ }
+ // Try to find the default realm.
+ String def = SystemProperties.getProperty("java.security.krb5.realm");
+ if (def != null)
+ return def;
+ // Now ask the system.
+ // FIXME: use java.security.krb5.conf,
+ // or $JAVA_HOME/lib/security/krb5.conf to find the krb config file.
+ // Then pass to native code using krb5_set_config_files() and
+ // krb5_get_default_realm(). But... what about /etc/krb5.conf?
+ throw new IllegalArgumentException("default realm can't be found");
+ }
+
+ /**
+ * Return the name of this principal.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return the realm of this principal.
+ */
+ public String getRealm()
+ {
+ return realm;
+ }
+
+ /**
+ * Return the type of this principal.
+ */
+ public int getNameType()
+ {
+ return type;
+ }
+
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+
+ public boolean equals(Object other)
+ {
+ if (! (other instanceof KerberosPrincipal))
+ return false;
+ KerberosPrincipal kp = (KerberosPrincipal) other;
+ return name.equals(kp.name) && type == kp.type;
+ }
+
+ public String toString()
+ {
+ // This is what came to mind.
+ return name + ":" + type;
+ }
+}
diff --git a/javax/security/auth/kerberos/KerberosTicket.java b/javax/security/auth/kerberos/KerberosTicket.java
new file mode 100644
index 000000000..85e253749
--- /dev/null
+++ b/javax/security/auth/kerberos/KerberosTicket.java
@@ -0,0 +1,339 @@
+/* KerberosTicket.java -- a kerberos ticket
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.kerberos;
+
+import gnu.classpath.NotImplementedException;
+
+import java.io.Serializable;
+import java.net.InetAddress;
+import java.util.Date;
+
+import javax.crypto.SecretKey;
+import javax.security.auth.DestroyFailedException;
+import javax.security.auth.Destroyable;
+import javax.security.auth.RefreshFailedException;
+import javax.security.auth.Refreshable;
+
+/**
+ * This class represents a Kerberos ticket. See the Kerberos
+ * authentication RFC for more information:
+ * <a href="http://www.ietf.org/rfc/rfc1510.txt">RFC 1510</a>.
+ *
+ * @since 1.4
+ */
+public class KerberosTicket
+ implements Destroyable, Serializable, Refreshable
+{
+ private static final long serialVersionUID = 7395334370157380539L;
+
+ // Indices of the various flags. From the kerberos spec.
+ // We only list the ones we use.
+ private static final int FORWARDABLE = 1;
+ private static final int FORWARDED = 2;
+ private static final int PROXIABLE = 3;
+ private static final int PROXY = 4;
+ private static final int POSTDATED = 6;
+ private static final int RENEWABLE = 8;
+ private static final int INITIAL = 9;
+ private static final int NUM_FLAGS = 12;
+
+ private byte[] asn1Encoding;
+ private KeyImpl sessionKey;
+ private boolean[] flags;
+ private Date authTime;
+ private Date startTime;
+ private Date endTime;
+ private Date renewTill;
+ private KerberosPrincipal client;
+ private KerberosPrincipal server;
+ private InetAddress[] clientAddresses;
+
+ /**
+ * Create a new ticket given all the facts about it.
+ *
+ * Note that flags may be null or "short"; any flags not specified
+ * will be taken to be false.
+ *
+ * If the key is not renewable, then renewTill may be null.
+ *
+ * If authTime is null, then it is taken to be the same as startTime.
+ *
+ * If clientAddresses is null, then the ticket can be used anywhere.
+ *
+ * @param asn1Encoding the contents of the ticket, as ASN1
+ * @param client the client principal
+ * @param server the server principal
+ * @param key the contents of the session key
+ * @param type the type of the key
+ * @param flags an array of flags, as specified by the RFC
+ * @param authTime when the client was authenticated
+ * @param startTime starting time at which the ticket is valid
+ * @param endTime ending time, after which the ticket is invalid
+ * @param renewTill for a rewewable ticket, the time before which it must
+ * be renewed
+ * @param clientAddresses a possibly-null array of addresses where this
+ * ticket may be used
+ */
+ public KerberosTicket(byte[] asn1Encoding, KerberosPrincipal client,
+ KerberosPrincipal server, byte[] key, int type,
+ boolean[] flags, Date authTime, Date startTime,
+ Date endTime, Date renewTill,
+ InetAddress[] clientAddresses)
+ {
+ this.asn1Encoding = (byte[]) asn1Encoding.clone();
+ this.sessionKey = new KeyImpl(key, type);
+ this.flags = new boolean[NUM_FLAGS];
+ if (flags != null)
+ System.arraycopy(flags, 0, this.flags, 0,
+ Math.min(flags.length, NUM_FLAGS));
+ this.flags = (boolean[]) flags.clone();
+ this.authTime = (Date) authTime.clone();
+ this.startTime = (Date) ((startTime == null)
+ ? authTime : startTime).clone();
+ this.endTime = (Date) endTime.clone();
+ this.renewTill = (Date) renewTill.clone();
+ this.client = client;
+ this.server = server;
+ this.clientAddresses = (clientAddresses == null
+ ? null
+ : (InetAddress[]) clientAddresses.clone());
+ }
+
+ /**
+ * Destroy this ticket. This discards secret information. After this
+ * method is called, other methods will throw IllegalStateException.
+ */
+ public void destroy() throws DestroyFailedException
+ {
+ if (sessionKey == null)
+ throw new DestroyFailedException("already destroyed");
+ sessionKey = null;
+ asn1Encoding = null;
+ }
+
+ /**
+ * Return true if this ticket has been destroyed.
+ */
+ public boolean isDestroyed()
+ {
+ return sessionKey == null;
+ }
+
+ /**
+ * Return true if the ticket is currently valid. This is true if
+ * the system time is between the ticket's start and end times.
+ */
+ public boolean isCurrent()
+ {
+ long now = System.currentTimeMillis();
+ return startTime.getTime() <= now && now <= endTime.getTime();
+ }
+
+ /**
+ * If the ticket is renewable, and the renewal time has not yet elapsed,
+ * attempt to renew the ticket.
+ * @throws RefreshFailedException if the renewal fails for any reason
+ */
+ public void refresh() throws RefreshFailedException, NotImplementedException
+ {
+ if (! isRenewable())
+ throw new RefreshFailedException("not renewable");
+ if (renewTill != null
+ && System.currentTimeMillis() >= renewTill.getTime())
+ throw new RefreshFailedException("renewal time elapsed");
+ // FIXME: must contact the KDC.
+ // Use the java.security.krb5.kdc property...
+ throw new RefreshFailedException("not implemented");
+ }
+
+ /**
+ * Return the client principal for this ticket.
+ */
+ public final KerberosPrincipal getClient()
+ {
+ return client;
+ }
+
+ /**
+ * Return the server principal for this ticket.
+ */
+ public final KerberosPrincipal getServer()
+ {
+ return server;
+ }
+
+ /**
+ * Return true if this ticket is forwardable.
+ */
+ public final boolean isForwardable()
+ {
+ return flags[FORWARDABLE];
+ }
+
+ /**
+ * Return true if this ticket has been forwarded.
+ */
+ public final boolean isForwarded()
+ {
+ return flags[FORWARDED];
+ }
+
+ /**
+ * Return true if this ticket is proxiable.
+ */
+ public final boolean isProxiable()
+ {
+ return flags[PROXIABLE];
+ }
+
+ /**
+ * Return true if this ticket is a proxy ticket.
+ */
+ public final boolean isProxy()
+ {
+ return flags[PROXY];
+ }
+
+ /**
+ * Return true if this ticket was post-dated.
+ */
+ public final boolean isPostdated()
+ {
+ return flags[POSTDATED];
+ }
+
+ /**
+ * Return true if this ticket is renewable.
+ */
+ public final boolean isRenewable()
+ {
+ return flags[RENEWABLE];
+ }
+
+ /**
+ * Return true if this ticket was granted by an application
+ * server, and not via a ticket-granting ticket.
+ */
+ public final boolean isInitial()
+ {
+ return flags[INITIAL];
+ }
+
+ /**
+ * Return the flags for this ticket as a boolean array.
+ * See the RFC to understand what the different entries mean.
+ */
+ public final boolean[] getFlags()
+ {
+ return (boolean[]) flags.clone();
+ }
+
+ /**
+ * Return the authentication time for this ticket.
+ */
+ public final Date getAuthTime()
+ {
+ return (Date) authTime.clone();
+ }
+
+ /**
+ * Return the start time for this ticket.
+ */
+ public final Date getStartTime()
+ {
+ return (Date) startTime.clone();
+ }
+
+ /**
+ * Return the end time for this ticket.
+ */
+ public final Date getEndTime()
+ {
+ return (Date) endTime.clone();
+ }
+
+ /**
+ * Return the renewal time for this ticket. For a non-renewable
+ * ticket, this will return null.
+ */
+ public final Date getRenewTill()
+ {
+ return flags[RENEWABLE] ? ((Date) renewTill.clone()) : null;
+ }
+
+ /**
+ * Return the allowable client addresses for this ticket. This will
+ * return null if the ticket can be used anywhere.
+ */
+ public final InetAddress[] getClientAddresses()
+ {
+ return (clientAddresses == null
+ ? null
+ : (InetAddress[]) clientAddresses.clone());
+ }
+
+ /**
+ * Return the encoded form of this ticket.
+ */
+ public final byte[] getEncoded()
+ {
+ checkDestroyed();
+ return (byte[]) sessionKey.key.clone();
+ }
+
+ /**
+ * Return the secret key associated with this ticket.
+ */
+ public final SecretKey getSessionKey()
+ {
+ checkDestroyed();
+ return sessionKey;
+ }
+
+ private void checkDestroyed()
+ {
+ if (sessionKey == null)
+ throw new IllegalStateException("key is destroyed");
+ }
+
+ public String toString()
+ {
+ return "FIXME bob";
+ }
+}
diff --git a/javax/security/auth/kerberos/KeyImpl.java b/javax/security/auth/kerberos/KeyImpl.java
new file mode 100644
index 000000000..6773dfa3e
--- /dev/null
+++ b/javax/security/auth/kerberos/KeyImpl.java
@@ -0,0 +1,93 @@
+/* KeyImpl.java -- kerberos key implementation
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.kerberos;
+
+import java.io.Serializable;
+
+import javax.crypto.SecretKey;
+
+/**
+ * Note that the name of this class is fixed by the serialization
+ * spec, even though the class itself is not public.
+ */
+final class KeyImpl implements Serializable, SecretKey
+{
+ // Enable this when serialization works.
+ // private static final long serialVersionUID = -7889313790214321193L;
+
+ public String algorithm;
+ public int type;
+ public byte[] key;
+
+ public KeyImpl(byte[] key, int type)
+ {
+ // From kerberos spec.
+ if (type == 0)
+ this.algorithm = null;
+ else if (type == 1)
+ this.algorithm = "DES";
+ else
+ this.algorithm = "FIXME";
+ this.type = type;
+ this.key = (byte[]) key.clone();
+ }
+
+ public KeyImpl(char[] passwd, String algo)
+ {
+ this.algorithm = (algo == null) ? "DES" : algo;
+ this.type = 0; // FIXME
+ this.key = null; // double FIXME
+ }
+
+ public String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ public byte[] getEncoded()
+ {
+ return key;
+ }
+
+ public String getFormat()
+ {
+ // FIXME.
+ return null;
+ }
+}
diff --git a/javax/security/auth/kerberos/ServicePermission.java b/javax/security/auth/kerberos/ServicePermission.java
new file mode 100644
index 000000000..452f8e966
--- /dev/null
+++ b/javax/security/auth/kerberos/ServicePermission.java
@@ -0,0 +1,172 @@
+/* ServicePermission.java -- kerberos service permission
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.kerberos;
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * This represents permission to access to a Kerberos service principal.
+ * See the Kerberos authentication RFC for more information:
+ * <a href="http://www.ietf.org/rfc/rfc1510.txt">RFC 1510</a>.
+ *
+ * @since 1.4
+ */
+public final class ServicePermission
+ extends Permission
+{
+ // FIXME: Enable this when serialization works.
+ // private static final long serialVersionUID = -1227585031618624935L;
+
+ private static final int INITIATE = 1;
+ private static final int ACCEPT = 2;
+
+ private int flags;
+
+ /**
+ * Create a new service permission with the indicated name and actions.
+ *
+ * The name is the name of the kerberos principal for the service.
+ *
+ * The actions are a comma-separated list of strings. The recognized
+ * actions are "initiate" and "accept". The "initiate" action means
+ * that the holder of the permission can access the service. The
+ * "accept" action means that the holder of the permission can operate
+ * as this service.
+ *
+ * @param name the prinicpal's name
+ * @param action the allowed actions
+ */
+ public ServicePermission(String name, String action)
+ {
+ super(name);
+ parseActions(action);
+ }
+
+ public boolean implies(Permission perm)
+ {
+ if (! (perm instanceof ServicePermission))
+ return false;
+ ServicePermission sp = (ServicePermission) perm;
+ if ((flags & sp.flags) != sp.flags)
+ return false;
+ return getName().equals(sp.getName());
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof ServicePermission))
+ return false;
+ ServicePermission sp = (ServicePermission) obj;
+ return flags == sp.flags && getName().equals(sp.getName());
+ }
+
+ public int hashCode()
+ {
+ return getName().hashCode() + flags;
+ }
+
+ /**
+ * Return a string representing the actions.
+ */
+ public String getActions()
+ {
+ if (flags == (INITIATE | ACCEPT))
+ return "initiate,accept";
+ if (flags == INITIATE)
+ return "initiate";
+ if (flags == ACCEPT)
+ return "accept";
+ return "";
+ }
+
+ public PermissionCollection newPermissionCollection()
+ {
+ return new PermissionCollection()
+ {
+ private Vector permissions = new Vector();
+
+ public void add(Permission perm)
+ {
+ if (isReadOnly())
+ throw new SecurityException("readonly");
+ if (! (perm instanceof ServicePermission))
+ throw new IllegalArgumentException("can only add DelegationPermissions");
+ permissions.add(perm);
+ }
+
+ public boolean implies(Permission perm)
+ {
+ if (! (perm instanceof ServicePermission))
+ return false;
+ Enumeration e = elements();
+ while (e.hasMoreElements())
+ {
+ ServicePermission sp = (ServicePermission) e.nextElement();
+ if (sp.implies(perm))
+ return true;
+ }
+ return false;
+ }
+
+ public Enumeration elements()
+ {
+ return permissions.elements();
+ }
+ };
+ }
+
+ private void parseActions(String actions)
+ {
+ StringTokenizer tok = new StringTokenizer(actions, ",");
+ while (tok.hasMoreTokens())
+ {
+ String token = tok.nextToken();
+ if ("accept".equals(token))
+ flags |= ACCEPT;
+ else if ("initiate".equals(token))
+ flags |= INITIATE;
+ else
+ throw new IllegalArgumentException("unrecognized token: " + token);
+ }
+ }
+}
diff --git a/javax/security/auth/x500/X500Principal.java b/javax/security/auth/x500/X500Principal.java
index fcbb4950a..d78b0d3ee 100644
--- a/javax/security/auth/x500/X500Principal.java
+++ b/javax/security/auth/x500/X500Principal.java
@@ -395,7 +395,7 @@ public final class X500Principal implements Principal, Serializable
buf.append((char) ch);
}
sep = in.read();
- if (sep != '+' || sep != ',')
+ if (sep != '+' && sep != ',')
throw new IOException("illegal character: " + (char) ch);
return buf.toString();
}
diff --git a/javax/swing/AbstractAction.java b/javax/swing/AbstractAction.java
index 4a2334570..ffd122fe0 100644
--- a/javax/swing/AbstractAction.java
+++ b/javax/swing/AbstractAction.java
@@ -40,9 +40,6 @@ package javax.swing;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.HashMap;
@@ -110,32 +107,6 @@ public abstract class AbstractAction
}
/**
- * readObject
- *
- * @param stream the stream to read from
- *
- * @exception ClassNotFoundException TODO
- * @exception IOException if an error occurs
- */
- private void readObject(ObjectInputStream stream)
- throws ClassNotFoundException, IOException
- {
- // TODO
- }
-
- /**
- * writeObject
- *
- * @param stream the stream to write to
- *
- * @exception IOException if an error occurs
- */
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- // TODO
- }
-
- /**
* Returns a clone of the action.
*
* @return A clone of the action.
diff --git a/javax/swing/AbstractButton.java b/javax/swing/AbstractButton.java
index 49c74dd06..d4e35cfa3 100644
--- a/javax/swing/AbstractButton.java
+++ b/javax/swing/AbstractButton.java
@@ -45,6 +45,7 @@ import java.awt.Insets;
import java.awt.ItemSelectable;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@@ -53,17 +54,26 @@ import java.awt.image.ImageObserver;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
+import java.util.Enumeration;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleIcon;
+import javax.accessibility.AccessibleRelation;
import javax.accessibility.AccessibleRelationSet;
+import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleText;
import javax.accessibility.AccessibleValue;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ButtonUI;
+import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Position;
+import javax.swing.text.View;
/**
@@ -277,6 +287,42 @@ public abstract class AbstractButton extends JComponent
protected ChangeEvent changeEvent = new ChangeEvent(this);
/**
+ * Indicates if the borderPainted property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientBorderPaintedSet = false;
+
+ /**
+ * Indicates if the rolloverEnabled property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientRolloverEnabledSet = false;
+
+ /**
+ * Indicates if the iconTextGap property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientIconTextGapSet = false;
+
+ /**
+ * Indicates if the contentAreaFilled property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientContentAreaFilledSet = false;
+
+ /**
* Fired in a PropertyChangeEvent when the "borderPainted" property changes.
*/
public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
@@ -390,10 +436,27 @@ public abstract class AbstractButton extends JComponent
// Nothing to do here yet.
}
+ /**
+ * Returns the accessible state set of this object. In addition to the
+ * superclass's states, the <code>AccessibleAbstractButton</code>
+ * supports the following states: {@link AccessibleState#ARMED},
+ * {@link AccessibleState#FOCUSED}, {@link AccessibleState#PRESSED} and
+ * {@link AccessibleState#CHECKED}.
+ *
+ * @return the curren state of this accessible object
+ */
public AccessibleStateSet getAccessibleStateSet()
- throws NotImplementedException
{
- return null; // TODO
+ AccessibleStateSet state = super.getAccessibleStateSet();
+
+ if (getModel().isArmed())
+ state.add(AccessibleState.ARMED);
+ if (getModel().isPressed())
+ state.add(AccessibleState.PRESSED);
+ if (isSelected())
+ state.add(AccessibleState.CHECKED);
+
+ return state;
}
/**
@@ -407,101 +470,300 @@ public abstract class AbstractButton extends JComponent
return result;
}
+ /**
+ * Returns the accessible icons of this object. If the AbstractButton's
+ * icon is an Accessible, and it's AccessibleContext is an AccessibleIcon,
+ * then this AccessibleIcon is returned, otherwise <code>null</code>.
+ *
+ * @return the accessible icons of this object, or <code>null</code> if
+ * there is no accessible icon
+ */
public AccessibleIcon[] getAccessibleIcon()
- throws NotImplementedException
{
- return null; // TODO
+ AccessibleIcon[] ret = null;
+ Icon icon = getIcon();
+ if (icon instanceof Accessible)
+ {
+ AccessibleContext ctx = ((Accessible) icon).getAccessibleContext();
+ if (ctx instanceof AccessibleIcon)
+ {
+ ret = new AccessibleIcon[]{ (AccessibleIcon) ctx };
+ }
+ }
+ return ret;
}
+ /**
+ * Returns the accessible relations of this AccessibleAbstractButton.
+ * If the AbstractButton is part of a ButtonGroup, then all the buttons
+ * in this button group are added as targets in a MEMBER_OF relation,
+ * otherwise an empty relation set is returned (from super).
+ *
+ * @return the accessible relations of this AccessibleAbstractButton
+ */
public AccessibleRelationSet getAccessibleRelationSet()
- throws NotImplementedException
{
- // TODO: What should be modified here?
- return super.getAccessibleRelationSet();
+ AccessibleRelationSet relations = super.getAccessibleRelationSet();
+ ButtonModel model = getModel();
+ if (model instanceof DefaultButtonModel)
+ {
+ ButtonGroup group = ((DefaultButtonModel) model).getGroup();
+ if (group != null)
+ {
+ Object[] target = new Object[group.getButtonCount()];
+ Enumeration els = group.getElements();
+
+ for (int index = 0; els.hasMoreElements(); ++index)
+ {
+ target[index] = els.nextElement();
+ }
+
+ AccessibleRelation rel =
+ new AccessibleRelation(AccessibleRelation.MEMBER_OF);
+ rel.setTarget(target);
+ relations.add(rel);
+ }
+ }
+ return relations;
}
+ /**
+ * Returns the accessible action associated with this object. For buttons,
+ * this will be <code>this</code>.
+ *
+ * @return <code>this</code>
+ */
public AccessibleAction getAccessibleAction()
- throws NotImplementedException
{
- return null; // TODO
+ return this;
}
+ /**
+ * Returns the accessible value of this AccessibleAbstractButton, which
+ * is always <code>this</code>.
+ *
+ * @return the accessible value of this AccessibleAbstractButton, which
+ * is always <code>this</code>
+ */
public AccessibleValue getAccessibleValue()
- throws NotImplementedException
{
- return null; // TODO
+ return this;
}
+ /**
+ * Returns the number of accessible actions that are supported by this
+ * object. Buttons support one action by default ('press button'), so this
+ * method always returns <code>1</code>.
+ *
+ * @return <code>1</code>, the number of supported accessible actions
+ */
public int getAccessibleActionCount()
- throws NotImplementedException
{
- return 0; // TODO
+ return 1;
}
- public String getAccessibleActionDescription(int value0)
- throws NotImplementedException
+ /**
+ * Returns a description for the action with the specified index or
+ * <code>null</code> if such action does not exist.
+ *
+ * @param actionIndex the zero based index to the actions
+ *
+ * @return a description for the action with the specified index or
+ * <code>null</code> if such action does not exist
+ */
+ public String getAccessibleActionDescription(int actionIndex)
{
- return null; // TODO
+ String descr = null;
+ if (actionIndex == 0)
+ {
+ // FIXME: Supply localized descriptions in the UIDefaults.
+ descr = UIManager.getString("AbstractButton.clickText");
+ }
+ return descr;
}
- public boolean doAccessibleAction(int value0)
- throws NotImplementedException
+ /**
+ * Performs the acccessible action with the specified index on this object.
+ * Since buttons have only one action by default (which is to press the
+ * button), this method performs a 'press button' when the specified index
+ * is <code>0</code> and nothing otherwise.
+ *
+ * @param actionIndex a zero based index into the actions of this button
+ *
+ * @return <code>true</code> if the specified action has been performed
+ * successfully, <code>false</code> otherwise
+ */
+ public boolean doAccessibleAction(int actionIndex)
{
- return false; // TODO
+ boolean retVal = false;
+ if (actionIndex == 0)
+ {
+ doClick();
+ retVal = true;
+ }
+ return retVal;
}
+ /**
+ * Returns the current value of this object as a number. This
+ * implementation returns an <code>Integer(1)</code> if the button is
+ * selected, <code>Integer(0)</code> if the button is not selected.
+ *
+ * @return the current value of this object as a number
+ */
public Number getCurrentAccessibleValue()
- throws NotImplementedException
{
- return null; // TODO
+ Integer retVal;
+ if (isSelected())
+ retVal = new Integer(1);
+ else
+ retVal = new Integer(0);
+ return retVal;
}
- public boolean setCurrentAccessibleValue(Number value0)
- throws NotImplementedException
+ /**
+ * Sets the current accessible value as object. If the specified number
+ * is 0 the button will be deselected, otherwise the button will
+ * be selected.
+ *
+ * @param value 0 for deselected button, other for selected button
+ *
+ * @return <code>true</code> if the value has been set, <code>false</code>
+ * otherwise
+ */
+ public boolean setCurrentAccessibleValue(Number value)
{
- return false; // TODO
+ boolean retVal = false;
+ if (value != null)
+ {
+ if (value.intValue() == 0)
+ setSelected(false);
+ else
+ setSelected(true);
+ retVal = true;
+ }
+ return retVal;
}
+ /**
+ * Returns the minimum accessible value for the AccessibleAbstractButton,
+ * which is <code>0</code>.
+ *
+ * @return the maxinimum accessible value for the AccessibleAbstractButton,
+ * which is <code>1</code>
+ */
public Number getMinimumAccessibleValue()
- throws NotImplementedException
{
- return null; // TODO
+ return new Integer(0);
}
+ /**
+ * Returns the maximum accessible value for the AccessibleAbstractButton,
+ * which is <code>1</code>.
+ *
+ * @return the maximum accessible value for the AccessibleAbstractButton,
+ * which is <code>1</code>
+ */
public Number getMaximumAccessibleValue()
- throws NotImplementedException
{
- return null; // TODO
+ return new Integer(1);
}
+ /**
+ * Returns the accessible text for this AccessibleAbstractButton. This
+ * will be <code>null</code> if the button has a non-HTML label, otherwise
+ * <code>this</code>.
+ *
+ * @return the accessible text for this AccessibleAbstractButton
+ */
public AccessibleText getAccessibleText()
- throws NotImplementedException
{
- return null; // TODO
+ AccessibleText accessibleText = null;
+ if (getClientProperty(BasicHTML.propertyKey) != null)
+ accessibleText = this;
+
+ return accessibleText;
}
- public int getIndexAtPoint(Point value0)
- throws NotImplementedException
+ /**
+ * Returns the index of the label's character at the specified point,
+ * relative to the local bounds of the button. This only works for
+ * HTML labels.
+ *
+ * @param p the point, relative to the buttons local bounds
+ *
+ * @return the index of the label's character at the specified point
+ */
+ public int getIndexAtPoint(Point p)
{
- return 0; // TODO
+ int index = -1;
+ View view = (View) getClientProperty(BasicHTML.propertyKey);
+ if (view != null)
+ {
+ Rectangle shape = new Rectangle(0, 0, getWidth(), getHeight());
+ index = view.viewToModel(p.x, p.y, shape, new Position.Bias[1]);
+ }
+ return index;
}
- public Rectangle getCharacterBounds(int value0)
- throws NotImplementedException
+ /**
+ * Returns the bounds of the character at the specified index of the
+ * button's label. This will only work for HTML labels.
+ *
+ * @param i the index of the character of the label
+ *
+ * @return the bounds of the character at the specified index of the
+ * button's label
+ */
+ public Rectangle getCharacterBounds(int i)
{
- return null; // TODO
+ Rectangle rect = null;
+ View view = (View) getClientProperty(BasicHTML.propertyKey);
+ if (view != null)
+ {
+ Rectangle shape = new Rectangle(0, 0, getWidth(), getHeight());
+ try
+ {
+ Shape s = view.modelToView(i, shape, Position.Bias.Forward);
+ rect = s.getBounds();
+ }
+ catch (BadLocationException ex)
+ {
+ rect = null;
+ }
+ }
+ return rect;
}
+ /**
+ * Returns the number of characters in the button's label.
+ *
+ * @return the bounds of the character at the specified index of the
+ * button's label
+ */
public int getCharCount()
- throws NotImplementedException
{
- return 0; // TODO
+ int charCount;
+ View view = (View) getClientProperty(BasicHTML.propertyKey);
+ if (view != null)
+ {
+ charCount = view.getDocument().getLength();
+ }
+ else
+ {
+ charCount = getAccessibleName().length();
+ }
+ return charCount;
}
+ /**
+ * This always returns <code>-1</code> since there is no caret in a button.
+ *
+ * @return <code>-1</code> since there is no caret in a button
+ */
public int getCaretPosition()
- throws NotImplementedException
{
- return 0; // TODO
+ return -1;
}
public String getAtIndex(int value0, int value1)
@@ -522,34 +784,57 @@ public abstract class AbstractButton extends JComponent
return null; // TODO
}
- public AttributeSet getCharacterAttribute(int value0)
- throws NotImplementedException
+ /**
+ * Returns the text attribute for the character at the specified character
+ * index.
+ *
+ * @param i the character index
+ *
+ * @return the character attributes for the specified character or
+ * <code>null</code> if the character has no attributes
+ */
+ public AttributeSet getCharacterAttribute(int i)
{
- return null; // TODO
+ AttributeSet atts = null;
+ View view = (View) getClientProperty(BasicHTML.propertyKey);
+ if (view != null)
+ {
+
+ }
+ return atts;
}
+ /**
+ * This always returns <code>-1</code> since
+ * button labels can't be selected.
+ *
+ * @return <code>-1</code>, button labels can't be selected
+ */
public int getSelectionStart()
- throws NotImplementedException
{
- return 0; // TODO
+ return -1;
}
+ /**
+ * This always returns <code>-1</code> since
+ * button labels can't be selected.
+ *
+ * @return <code>-1</code>, button labels can't be selected
+ */
public int getSelectionEnd()
- throws NotImplementedException
{
- return 0; // TODO
+ return -1;
}
+ /**
+ * Returns the selected text. This always returns <code>null</code> since
+ * button labels can't be selected.
+ *
+ * @return <code>null</code>, button labels can't be selected
+ */
public String getSelectedText()
- throws NotImplementedException
{
- return null; // TODO
- }
-
- private Rectangle getTextRectangle()
- throws NotImplementedException
- {
- return null; // TODO
+ return null;
}
}
@@ -939,6 +1224,7 @@ public abstract class AbstractButton extends JComponent
*/
public void setRolloverEnabled(boolean r)
{
+ clientRolloverEnabledSet = true;
if (rollOverEnabled != r)
{
rollOverEnabled = r;
@@ -1171,6 +1457,7 @@ public abstract class AbstractButton extends JComponent
*/
public void setBorderPainted(boolean b)
{
+ clientBorderPaintedSet = true;
if (borderPainted == b)
return;
boolean old = borderPainted;
@@ -1321,6 +1608,7 @@ public abstract class AbstractButton extends JComponent
*/
public void setIconTextGap(int i)
{
+ clientIconTextGapSet = true;
if (iconTextGap == i)
return;
@@ -1954,6 +2242,7 @@ public abstract class AbstractButton extends JComponent
*/
public void setContentAreaFilled(boolean b)
{
+ clientContentAreaFilledSet = true;
if (contentAreaFilled == b)
return;
@@ -2081,4 +2370,58 @@ public abstract class AbstractButton extends JComponent
multiClickThreshhold = threshhold;
}
+
+ /**
+ * Helper method for
+ * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+ *
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ */
+ void setUIProperty(String propertyName, Object value)
+ {
+ if (propertyName.equals("borderPainted"))
+ {
+ if (! clientBorderPaintedSet)
+ {
+ setBorderPainted(((Boolean) value).booleanValue());
+ clientBorderPaintedSet = false;
+ }
+ }
+ else if (propertyName.equals("rolloverEnabled"))
+ {
+ if (! clientRolloverEnabledSet)
+ {
+ setRolloverEnabled(((Boolean) value).booleanValue());
+ clientRolloverEnabledSet = false;
+ }
+ }
+ else if (propertyName.equals("iconTextGap"))
+ {
+ if (! clientIconTextGapSet)
+ {
+ setIconTextGap(((Integer) value).intValue());
+ clientIconTextGapSet = false;
+ }
+ }
+ else if (propertyName.equals("contentAreaFilled"))
+ {
+ if (! clientContentAreaFilledSet)
+ {
+ setContentAreaFilled(((Boolean) value).booleanValue());
+ clientContentAreaFilledSet = false;
+ }
+ }
+ else
+ {
+ super.setUIProperty(propertyName, value);
+ }
+ }
}
diff --git a/javax/swing/ActionMap.java b/javax/swing/ActionMap.java
index 65e193d2e..2a8c78d66 100644
--- a/javax/swing/ActionMap.java
+++ b/javax/swing/ActionMap.java
@@ -195,30 +195,4 @@ public class ActionMap
return null;
}
- /**
- * writeObject
- *
- * @param stream the stream to write to
- *
- * @exception IOException If an error occurs
- */
- private void writeObject(ObjectOutputStream stream)
- throws IOException
- {
- // TODO
- }
-
- /**
- * readObject
- *
- * @param stream the stream to read from
- *
- * @exception ClassNotFoundException If the serialized class cannot be found
- * @exception IOException If an error occurs
- */
- private void readObject(ObjectInputStream stream)
- throws ClassNotFoundException, IOException
- {
- // TODO
- }
}
diff --git a/javax/swing/CompatibilityFocusTraversalPolicy.java b/javax/swing/CompatibilityFocusTraversalPolicy.java
new file mode 100644
index 000000000..40c2010c3
--- /dev/null
+++ b/javax/swing/CompatibilityFocusTraversalPolicy.java
@@ -0,0 +1,164 @@
+/* CompatibilityFocusTraversalPolicy.java -- Provides compatibility to old
+ focus API
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FocusTraversalPolicy;
+import java.util.HashMap;
+
+/**
+ * Provides compatibility to the older focus API in
+ * {@link JComponent#setNextFocusableComponent(Component)}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+class CompatibilityFocusTraversalPolicy
+ extends FocusTraversalPolicy
+{
+
+ /**
+ * The focus traversal policy that has been installed on the focus cycle
+ * root before, and to which we fall back.
+ */
+ private FocusTraversalPolicy fallback;
+
+ /**
+ * Maps components to their next focused components.
+ */
+ private HashMap forward;
+
+ /**
+ * Maps components to their previous focused components.
+ */
+ private HashMap backward;
+
+ /**
+ * Creates a new CompatibilityFocusTraversalPolicy with the specified
+ * policy as fallback.
+ *
+ * @param p the fallback policy
+ */
+ CompatibilityFocusTraversalPolicy(FocusTraversalPolicy p)
+ {
+ fallback = p;
+ forward = new HashMap();
+ backward = new HashMap();
+ }
+
+ public Component getComponentAfter(Container root, Component current)
+ {
+ Component next = (Component) forward.get(current);
+ if (next == null && fallback != null)
+ next = fallback.getComponentAfter(root, current);
+ return next;
+ }
+
+ public Component getComponentBefore(Container root, Component current)
+ {
+ Component previous = (Component) backward.get(current);
+ if (previous == null && fallback != null)
+ previous = fallback.getComponentAfter(root, current);
+ return previous;
+ }
+
+ public Component getFirstComponent(Container root)
+ {
+ Component first = null;
+ if (fallback != null)
+ first = fallback.getFirstComponent(root);
+ return first;
+ }
+
+ public Component getLastComponent(Container root)
+ {
+ Component last = null;
+ if (fallback != null)
+ last = fallback.getLastComponent(root);
+ return last;
+ }
+
+ public Component getDefaultComponent(Container root)
+ {
+ Component def = null;
+ if (fallback != null)
+ def = fallback.getDefaultComponent(root);
+ return def;
+ }
+
+ /**
+ * Sets a next focused component for a specified component. This is called
+ * by {@link JComponent#setNextFocusableComponent(Component)}.
+ *
+ * @param current the current component
+ * @param next the next focused component
+ */
+ void setNextFocusableComponent(Component current, Component next)
+ {
+ forward.put(current, next);
+ backward.put(next, current);
+ }
+
+ /**
+ * Sets a next focused component for a specified component. This is called
+ * by {@link JComponent#setNextFocusableComponent(Component)}.
+ *
+ * @param current the current component
+ * @param next the next focused component
+ */
+ void addNextFocusableComponent(Component current, Component next)
+ {
+ forward.put(current, next);
+ backward.put(next, current);
+ }
+
+ /**
+ * Removes a focused component mapping. This is called
+ * by {@link JComponent#setNextFocusableComponent(Component)}.
+ *
+ * @param current the current component
+ * @param next the next focused component
+ */
+ void removeNextFocusableComponent(Component current, Component next)
+ {
+ forward.remove(current);
+ backward.remove(next);
+ }
+}
diff --git a/javax/swing/DefaultComboBoxModel.java b/javax/swing/DefaultComboBoxModel.java
index ae9a8c27a..f958850eb 100644
--- a/javax/swing/DefaultComboBoxModel.java
+++ b/javax/swing/DefaultComboBoxModel.java
@@ -1,5 +1,5 @@
/* DefaultComboBoxModel.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -107,22 +107,24 @@ public class DefaultComboBoxModel extends AbstractListModel
public DefaultComboBoxModel(Vector<?> vector)
{
this.list = vector;
- if (vector.size() > 0)
+ if (getSize() > 0)
selectedItem = vector.get(0);
}
/**
* Adds an element to the model's item list and sends a {@link ListDataEvent}
* to all registered listeners. If the new element is the first item added
- * to the list, it is set as the selected item.
+ * to the list, and the selected item is <code>null</code>, the new element
+ * is set as the selected item.
*
* @param object item to add to the model's item list.
*/
public void addElement(Object object)
{
- list.add(object);
- fireIntervalAdded(this, list.size() - 1, list.size() - 1);
- if (list.size() == 1)
+ list.addElement(object);
+ int index = list.size() - 1;
+ fireIntervalAdded(this, index, index);
+ if (list.size() == 1 && selectedItem == null)
setSelectedItem(object);
}
@@ -141,14 +143,14 @@ public class DefaultComboBoxModel extends AbstractListModel
public void removeElementAt(int index)
{
int selected = getIndexOf(selectedItem);
- list.remove(index);
if (selected == index) // choose a new selected item
{
if (selected > 0)
selectedItem = getElementAt(selected - 1);
else
- selectedItem = getElementAt(selected);
+ selectedItem = getElementAt(selected + 1);
}
+ list.removeElementAt(index);
fireIntervalRemoved(this, index, index);
}
diff --git a/javax/swing/DefaultListSelectionModel.java b/javax/swing/DefaultListSelectionModel.java
index ccca487f1..003513a23 100644
--- a/javax/swing/DefaultListSelectionModel.java
+++ b/javax/swing/DefaultListSelectionModel.java
@@ -286,8 +286,14 @@ public class DefaultListSelectionModel implements Cloneable,
int beg = sel.nextSetBit(0), end = -1;
for(int i=beg; i >= 0; i=sel.nextSetBit(i+1))
end = i;
- if (sel.equals(oldSel) == false)
- fireValueChanged(beg, end, valueIsAdjusting);
+
+ BitSet old = (BitSet) oldSel;
+
+ // The new and previous lead location requires repainting.
+ old.set(oldLeadIndex, !sel.get(oldLeadIndex));
+ old.set(leadSelectionIndex, !sel.get(leadSelectionIndex));
+
+ fireDifference(sel, old);
}
/**
@@ -492,8 +498,7 @@ public class DefaultListSelectionModel implements Cloneable,
leadSelectionIndex = index1;
anchorSelectionIndex = index0;
sel.set(lo, hi+1);
- if (sel.equals(oldSel) == false)
- fireValueChanged(lo, hi, valueIsAdjusting);
+ fireDifference(sel, (BitSet) oldSel);
}
}
@@ -530,8 +535,8 @@ public class DefaultListSelectionModel implements Cloneable,
//TODO: will probably need MouseDragged to test properly and know if this works
setAnchorSelectionIndex(index0);
leadSelectionIndex = index1;
- if (sel.equals(oldSel) == false)
- fireValueChanged(lo, hi, valueIsAdjusting);
+
+ fireDifference(sel, (BitSet) oldSel);
}
/**
@@ -539,20 +544,47 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public void clearSelection()
{
- oldSel = sel.clone();
- int sz = sel.size();
- sel.clear();
- if (sel.equals(oldSel) == false)
- fireValueChanged(0, sz, valueIsAdjusting);
+ // Find the selected interval.
+ int from = sel.nextSetBit(0);
+ if (from < 0)
+ return; // Empty selection - nothing to do.
+ int to = from;
+
+ int i;
+
+ Up: for (i = from; i>=0; i=sel.nextSetBit(i+1))
+ to = i;
+
+ fireValueChanged(from, to, valueIsAdjusting);
}
/**
- * Clears the current selection and marks a given interval as
- * "selected". If the current selection mode is
- * <code>SINGLE_SELECTION</code> only the index <code>index2</code> is
- * selected.
- *
- * @param index0 The low end of the new selection
+ * Fire the change event, covering the difference between the two sets.
+ *
+ * @param current the current set
+ * @param x the previous set, the object will be reused.
+ */
+ private void fireDifference(BitSet current, BitSet x)
+ {
+ x.xor(current);
+ int from = x.nextSetBit(0);
+ if (from < 0)
+ return; // No difference.
+ int to = from;
+ int i;
+
+ for (i = from; i >= 0; i = x.nextSetBit(i+1))
+ to = i;
+
+ fireValueChanged(from, to, valueIsAdjusting);
+ }
+
+ /**
+ * Clears the current selection and marks a given interval as "selected". If
+ * the current selection mode is <code>SINGLE_SELECTION</code> only the
+ * index <code>index2</code> is selected.
+ *
+ * @param index0 The low end of the new selection
* @param index1 The high end of the new selection
*/
public void setSelectionInterval(int index0, int index1)
@@ -560,7 +592,7 @@ public class DefaultListSelectionModel implements Cloneable,
if (index0 == -1 || index1 == -1)
return;
- oldSel = sel.clone();
+ BitSet oldSel = (BitSet) sel.clone();
sel.clear();
if (selectionMode == SINGLE_SELECTION)
index0 = index1;
@@ -571,8 +603,8 @@ public class DefaultListSelectionModel implements Cloneable,
// update the anchorSelectionIndex and leadSelectionIndex variables
setAnchorSelectionIndex(index0);
leadSelectionIndex=index1;
- if (sel.equals(oldSel) == false)
- fireValueChanged(lo, hi, valueIsAdjusting);
+
+ fireDifference(sel, oldSel);
}
/**
diff --git a/javax/swing/JComboBox.java b/javax/swing/JComboBox.java
index 5c5da42f6..9425ac258 100644
--- a/javax/swing/JComboBox.java
+++ b/javax/swing/JComboBox.java
@@ -944,10 +944,20 @@ public class JComboBox extends JComponent implements ItemSelectable,
* exists in the combo box. Otherwise false is returned.
*/
public boolean selectWithKeyChar(char keyChar)
- throws NotImplementedException
{
- // FIXME: Need to implement
- return false;
+ if (keySelectionManager == null)
+ {
+ keySelectionManager = createDefaultKeySelectionManager();
+ }
+
+ int index = keySelectionManager.selectionForKey(keyChar, getModel());
+ boolean retVal = false;
+ if (index >= 0)
+ {
+ setSelectedIndex(index);
+ retVal = true;
+ }
+ return retVal;
}
/**
@@ -1215,26 +1225,31 @@ public class JComboBox extends JComponent implements ItemSelectable,
}
public int getAccessibleChildrenCount()
+ throws NotImplementedException
{
return 0;
}
public Accessible getAccessibleChild(int value0)
+ throws NotImplementedException
{
return null;
}
public AccessibleSelection getAccessibleSelection()
+ throws NotImplementedException
{
return null;
}
public Accessible getAccessibleSelection(int value0)
+ throws NotImplementedException
{
return null;
}
public boolean isAccessibleChildSelected(int value0)
+ throws NotImplementedException
{
return false;
}
@@ -1245,46 +1260,55 @@ public class JComboBox extends JComponent implements ItemSelectable,
}
public AccessibleAction getAccessibleAction()
+ throws NotImplementedException
{
return null;
}
public String getAccessibleActionDescription(int value0)
+ throws NotImplementedException
{
return null;
}
public int getAccessibleActionCount()
+ throws NotImplementedException
{
return 0;
}
public boolean doAccessibleAction(int value0)
+ throws NotImplementedException
{
return false;
}
public int getAccessibleSelectionCount()
+ throws NotImplementedException
{
return 0;
}
public void addAccessibleSelection(int value0)
+ throws NotImplementedException
{
// TODO: Implement this properly.
}
public void removeAccessibleSelection(int value0)
+ throws NotImplementedException
{
// TODO: Implement this properly.
}
public void clearAccessibleSelection()
+ throws NotImplementedException
{
// TODO: Implement this properly.
}
public void selectAllAccessibleSelection()
+ throws NotImplementedException
{
// TODO: Implement this properly.
}
diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java
index 4dbaa8b6b..eba05d03c 100644
--- a/javax/swing/JComponent.java
+++ b/javax/swing/JComponent.java
@@ -70,6 +70,7 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.EventListener;
import java.util.Hashtable;
import java.util.Locale;
@@ -80,6 +81,7 @@ import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleExtendedComponent;
import javax.accessibility.AccessibleKeyBinding;
import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
@@ -103,7 +105,7 @@ public abstract class JComponent extends Container implements Serializable
private static final long serialVersionUID = -7908749299918704233L;
/**
- * Accessibility support is currently missing.
+ * The accessible context of this <code>JComponent</code>.
*/
protected AccessibleContext accessibleContext;
@@ -116,74 +118,185 @@ public abstract class JComponent extends Container implements Serializable
implements AccessibleExtendedComponent
{
/**
- * Accessibility support for <code>JComponent</code>'s focus handler.
+ * Receives notification if the focus on the JComponent changes and
+ * fires appropriate PropertyChangeEvents to listeners registered with
+ * the AccessibleJComponent.
*/
protected class AccessibleFocusHandler
implements FocusListener
{
+ /**
+ * Creates a new AccessibleFocusHandler.
+ */
protected AccessibleFocusHandler()
{
- // TODO: Implement this properly.
+ // Nothing to do here.
}
+
+ /**
+ * Receives notification when the JComponent gained focus and fires
+ * a PropertyChangeEvent to listeners registered on the
+ * AccessibleJComponent with a property name of
+ * {@link AccessibleContext#ACCESSIBLE_STATE_PROPERTY} and a new value
+ * of {@link AccessibleState#FOCUSED}.
+ */
public void focusGained(FocusEvent event)
{
- // TODO: Implement this properly.
+ AccessibleJComponent.this.firePropertyChange
+ (AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
+ AccessibleState.FOCUSED);
}
+
+ /**
+ * Receives notification when the JComponent lost focus and fires
+ * a PropertyChangeEvent to listeners registered on the
+ * AccessibleJComponent with a property name of
+ * {@link AccessibleContext#ACCESSIBLE_STATE_PROPERTY} and an old value
+ * of {@link AccessibleState#FOCUSED}.
+ */
public void focusLost(FocusEvent valevent)
{
- // TODO: Implement this properly.
+ AccessibleJComponent.this.firePropertyChange
+ (AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.FOCUSED, null);
}
}
/**
- * Accessibility support for <code>JComponent</code>'s container handler.
+ * Receives notification if there are child components are added or removed
+ * from the JComponent and fires appropriate PropertyChangeEvents to
+ * interested listeners on the AccessibleJComponent.
*/
protected class AccessibleContainerHandler
implements ContainerListener
{
+ /**
+ * Creates a new AccessibleContainerHandler.
+ */
protected AccessibleContainerHandler()
{
- // TODO: Implement this properly.
+ // Nothing to do here.
}
+
+ /**
+ * Receives notification when a child component is added to the
+ * JComponent and fires a PropertyChangeEvent on listeners registered
+ * with the AccessibleJComponent with a property name of
+ * {@link AccessibleContext#ACCESSIBLE_CHILD_PROPERTY}.
+ *
+ * @param event the container event
+ */
public void componentAdded(ContainerEvent event)
{
- // TODO: Implement this properly.
+ Component c = event.getChild();
+ if (c != null && c instanceof Accessible)
+ {
+ AccessibleContext childCtx = c.getAccessibleContext();
+ AccessibleJComponent.this.firePropertyChange
+ (AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null, childCtx);
+ }
}
- public void componentRemoved(ContainerEvent valevent)
+
+ /**
+ * Receives notification when a child component is removed from the
+ * JComponent and fires a PropertyChangeEvent on listeners registered
+ * with the AccessibleJComponent with a property name of
+ * {@link AccessibleContext#ACCESSIBLE_CHILD_PROPERTY}.
+ *
+ * @param event the container event
+ */
+ public void componentRemoved(ContainerEvent event)
{
- // TODO: Implement this properly.
+ Component c = event.getChild();
+ if (c != null && c instanceof Accessible)
+ {
+ AccessibleContext childCtx = c.getAccessibleContext();
+ AccessibleJComponent.this.firePropertyChange
+ (AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, childCtx, null);
+ }
}
}
private static final long serialVersionUID = -7047089700479897799L;
-
+
+ /**
+ * Receives notification when a child component is added to the
+ * JComponent and fires a PropertyChangeEvent on listeners registered
+ * with the AccessibleJComponent.
+ *
+ * @specnote AccessibleAWTContainer has a protected field with the same
+ * name. Looks like a bug or nasty misdesign to me.
+ */
protected ContainerListener accessibleContainerHandler;
+
+ /**
+ * Receives notification if the focus on the JComponent changes and
+ * fires appropriate PropertyChangeEvents to listeners registered with
+ * the AccessibleJComponent.
+ *
+ * @specnote AccessibleAWTComponent has a protected field
+ * accessibleAWTFocusHandler. Looks like a bug or nasty misdesign
+ * to me.
+ */
protected FocusListener accessibleFocusHandler;
+ /**
+ * Creates a new AccessibleJComponent.
+ */
protected AccessibleJComponent()
{
- // nothing to do here
+ // Nothing to do here.
}
/**
* Adds a property change listener to the list of registered listeners.
*
+ * This sets up the {@link #accessibleContainerHandler} and
+ * {@link #accessibleFocusHandler} fields and calls
+ * <code>super.addPropertyChangeListener(listener)</code>.
+ *
* @param listener the listener to add
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
{
- // TODO: figure out what is done differently here, if anything...
+ // Tests seem to indicate that this method also sets up the other two
+ // handlers.
+ if (accessibleContainerHandler == null)
+ {
+ accessibleContainerHandler = new AccessibleContainerHandler();
+ addContainerListener(accessibleContainerHandler);
+ }
+ if (accessibleFocusHandler == null)
+ {
+ accessibleFocusHandler = new AccessibleFocusHandler();
+ addFocusListener(accessibleFocusHandler);
+ }
super.addPropertyChangeListener(listener);
}
/**
- * Removes a propery change listener from the list of registered listeners.
+ * Removes a property change listener from the list of registered listeners.
+ *
+ * This uninstalls the {@link #accessibleContainerHandler} and
+ * {@link #accessibleFocusHandler} fields and calls
+ * <code>super.removePropertyChangeListener(listener)</code>.
*
* @param listener the listener to remove
*/
public void removePropertyChangeListener(PropertyChangeListener listener)
{
- // TODO: figure out what is done differently here, if anything...
+ // Tests seem to indicate that this method also resets the other two
+ // handlers.
+ if (accessibleContainerHandler != null)
+ {
+ removeContainerListener(accessibleContainerHandler);
+ accessibleContainerHandler = null;
+ }
+ if (accessibleFocusHandler != null)
+ {
+ removeFocusListener(accessibleFocusHandler);
+ accessibleFocusHandler = null;
+ }
super.removePropertyChangeListener(listener);
}
@@ -194,14 +307,11 @@ public abstract class JComponent extends Container implements Serializable
*/
public int getAccessibleChildrenCount()
{
- int count = 0;
- Component[] children = getComponents();
- for (int i = 0; i < children.length; ++i)
- {
- if (children[i] instanceof Accessible)
- count++;
- }
- return count;
+ // TODO: The functionality should be performed in the superclass.
+ // Find out why this is overridden. However, it is very well possible
+ // that this is left over from times when there was no such superclass
+ // method.
+ return super.getAccessibleChildrenCount();
}
/**
@@ -213,18 +323,11 @@ public abstract class JComponent extends Container implements Serializable
*/
public Accessible getAccessibleChild(int i)
{
- int index = 0;
- Component[] children = getComponents();
- Accessible found = null;
- for (int j = 0; index != i; j++)
- {
- if (children[j] instanceof Accessible)
- index++;
- if (index == i)
- found = (Accessible) children[index];
- }
- // TODO: Figure out what to do when i is not a valid index.
- return found;
+ // TODO: The functionality should be performed in the superclass.
+ // Find out why this is overridden. However, it is very well possible
+ // that this is left over from times when there was no such superclass
+ // method.
+ return super.getAccessibleChild(i);
}
/**
@@ -234,9 +337,14 @@ public abstract class JComponent extends Container implements Serializable
*/
public AccessibleStateSet getAccessibleStateSet()
{
- // FIXME: Figure out which states should be set here, and which are
- // inherited from the super class.
- return super.getAccessibleStateSet();
+ // Note: While the java.awt.Component has an 'opaque' property, it
+ // seems that it is not added to the accessible state set there, even
+ // if this property is true. However, it is handled for JComponent, so
+ // we add it here.
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ if (isOpaque())
+ state.add(AccessibleState.OPAQUE);
+ return state;
}
/**
@@ -252,8 +360,33 @@ public abstract class JComponent extends Container implements Serializable
*/
public String getAccessibleName()
{
- // TODO: Figure out what exactly to return here.
- return super.getAccessibleName();
+ String name = super.getAccessibleName();
+
+ // There are two fallbacks provided by the JComponent in the case the
+ // superclass returns null:
+ // - If the component is inside a titled border, then it inherits the
+ // name from the border title.
+ // - If the component is not inside a titled border but has a label
+ // (via JLabel.setLabelFor()), then it gets the name from the label's
+ // accessible context.
+
+ if (name == null)
+ {
+ name = getTitledBorderText();
+ }
+
+ if (name == null)
+ {
+ Object l = getClientProperty(JLabel.LABEL_PROPERTY);
+ if (l instanceof Accessible)
+ {
+ AccessibleContext labelCtx =
+ ((Accessible) l).getAccessibleContext();
+ name = labelCtx.getAccessibleName();
+ }
+ }
+
+ return name;
}
/**
@@ -264,8 +397,32 @@ public abstract class JComponent extends Container implements Serializable
*/
public String getAccessibleDescription()
{
- // TODO: Figure out how this differs from the super method.
- return super.getAccessibleDescription();
+ // There are two fallbacks provided by the JComponent in the case the
+ // superclass returns null:
+ // - If the component has a tooltip, then inherit the description from
+ // the tooltip.
+ // - If the component is not inside a titled border but has a label
+ // (via JLabel.setLabelFor()), then it gets the name from the label's
+ // accessible context.
+ String descr = super.getAccessibleDescription();
+
+ if (descr == null)
+ {
+ descr = getToolTipText();
+ }
+
+ if (descr == null)
+ {
+ Object l = getClientProperty(JLabel.LABEL_PROPERTY);
+ if (l instanceof Accessible)
+ {
+ AccessibleContext labelCtx =
+ ((Accessible) l).getAccessibleContext();
+ descr = labelCtx.getAccessibleName();
+ }
+ }
+
+ return descr;
}
/**
@@ -277,7 +434,6 @@ public abstract class JComponent extends Container implements Serializable
*/
public AccessibleRole getAccessibleRole()
{
- // TODO: Check if this is correct.
return AccessibleRole.SWING_COMPONENT;
}
@@ -343,7 +499,8 @@ public abstract class JComponent extends Container implements Serializable
*/
public AccessibleKeyBinding getAccessibleKeyBinding()
{
- // TODO: Implement this properly.
+ // The reference implementation seems to always return null here,
+ // independent of the key bindings of the JComponent. So do we.
return null;
}
}
@@ -610,6 +767,24 @@ public abstract class JComponent extends Container implements Serializable
boolean isCompletelyDirty = false;
/**
+ * Indicates if the opaque property has been set by a client program or by
+ * the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientOpaqueSet = false;
+
+ /**
+ * Indicates if the autoscrolls property has been set by a client program or
+ * by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientAutoscrollsSet = false;
+
+ /**
* Creates a new <code>JComponent</code> instance.
*/
public JComponent()
@@ -1222,7 +1397,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public Component getNextFocusableComponent()
{
- return null;
+ Container focusRoot = this;
+ if (! this.isFocusCycleRoot())
+ focusRoot = getFocusCycleRootAncestor();
+
+ FocusTraversalPolicy policy = focusRoot.getFocusTraversalPolicy();
+ return policy.getComponentAfter(focusRoot, this);
}
/**
@@ -1416,7 +1596,7 @@ public abstract class JComponent extends Container implements Serializable
*/
public void grabFocus()
{
- // TODO: Implement this properly.
+ requestFocus();
}
/**
@@ -1645,39 +1825,237 @@ public abstract class JComponent extends Container implements Serializable
*/
protected void paintChildren(Graphics g)
{
+ if (getComponentCount() > 0)
+ {
+ if (isOptimizedDrawingEnabled())
+ paintChildrenOptimized(g);
+ else
+ paintChildrenWithOverlap(g);
+ }
+ }
+
+ /**
+ * Paints the children of this JComponent in the case when the component
+ * is not marked as optimizedDrawingEnabled, that means the container cannot
+ * guarantee that it's children are tiled. For this case we must
+ * perform a more complex optimization to determine the minimal rectangle
+ * to be painted for each child component.
+ *
+ * @param g the graphics context to use
+ */
+ private void paintChildrenWithOverlap(Graphics g)
+ {
Shape originalClip = g.getClip();
Rectangle inner = SwingUtilities.calculateInnerArea(this, rectCache);
g.clipRect(inner.x, inner.y, inner.width, inner.height);
Component[] children = getComponents();
- // Find the bottommost component that needs to be painted. This is a
- // component that completely covers the current clip and is opaque. In
- // this case we don't need to paint the components below it.
+ // Find the rectangles that need to be painted for each child component.
+ // We push on this list arrays that have the Rectangles to be painted as
+ // the first elements and the component to be painted as the last one.
+ // Later we go through that list in reverse order and paint the rectangles.
+ ArrayList paintRegions = new ArrayList(children.length);
+ ArrayList paintRectangles = new ArrayList();
+ ArrayList newPaintRects = new ArrayList();
+ paintRectangles.add(g.getClipBounds());
+ ArrayList componentRectangles = new ArrayList();
+
+ // Go through children from top to bottom and find out their paint
+ // rectangles.
+ int index = 0;
+ while (paintRectangles.size() > 0 && index < children.length)
+ {
+ Component comp = children[index];
+ if (! comp.isVisible())
+ continue;
+
+ Rectangle compBounds = comp.getBounds();
+ boolean isOpaque = comp instanceof JComponent
+ && ((JComponent) comp).isOpaque();
+
+ // Add all the current paint rectangles that intersect with the
+ // component to the component's paint rectangle array.
+ for (int i = paintRectangles.size() - 1; i >= 0; i--)
+ {
+ Rectangle r = (Rectangle) paintRectangles.get(i);
+ if (r.intersects(compBounds))
+ {
+ Rectangle compRect = r.intersection(compBounds);
+ componentRectangles.add(compRect);
+ // If the component is opaque, split up each paint rect and
+ // add paintRect - compBounds to the newPaintRects array.
+ if (isOpaque)
+ {
+ int x, y, w, h;
+ Rectangle rect = new Rectangle();
+
+ // The north retangle.
+ x = Math.max(compBounds.x, r.x);
+ y = r.y;
+ w = Math.min(compBounds.width, r.width + r.x - x);
+ h = compBounds.y - r.y;
+ rect.setBounds(x, y, w, h);
+ if (! rect.isEmpty())
+ {
+ newPaintRects.add(rect);
+ rect = new Rectangle();
+ }
+
+ // The south rectangle.
+ x = Math.max(compBounds.x, r.x);
+ y = compBounds.y + compBounds.height;
+ w = Math.min(compBounds.width, r.width + r.x - x);
+ h = r.height - (compBounds.y - r.y) - compBounds.height;
+ rect.setBounds(x, y, w, h);
+ if (! rect.isEmpty())
+ {
+ newPaintRects.add(rect);
+ rect = new Rectangle();
+ }
+
+ // The west rectangle.
+ x = r.x;
+ y = r.y;
+ w = compBounds.x - r.x;
+ h = r.height;
+ rect.setBounds(x, y, w, h);
+ if (! rect.isEmpty())
+ {
+ newPaintRects.add(rect);
+ rect = new Rectangle();
+ }
+
+ // The east rectangle.
+ x = compBounds.x + compBounds.width;
+ y = r.y;
+ w = r.width - (compBounds.x - r.x) - compBounds.width;
+ h = r.height;
+ rect.setBounds(x, y, w, h);
+ if (! rect.isEmpty())
+ {
+ newPaintRects.add(rect);
+ }
+ }
+
+ }
+ else
+ {
+ newPaintRects.add(r);
+ }
+ }
+
+ // Replace the paintRectangles with the new split up
+ // paintRectangles.
+ paintRectangles.clear();
+ paintRectangles.addAll(newPaintRects);
+ newPaintRects.clear();
+
+ // Store paint rectangles if there are any for the current component.
+ int compRectsSize = componentRectangles.size();
+ if (compRectsSize > 0)
+ {
+ componentRectangles.add(comp);
+ paintRegions.add(componentRectangles);
+ componentRectangles = new ArrayList();
+ }
+
+ index++;
+ }
+
+ // paintingTile becomes true just before we start painting the component's
+ // children.
+ paintingTile = true;
+
+ // We must go through the painting regions backwards, because the
+ // topmost components have been added first, followed by the components
+ // below.
+ int prEndIndex = paintRegions.size() - 1;
+ for (int i = prEndIndex; i >= 0; i--)
+ {
+ // paintingTile must be set to false before we begin to start painting
+ // the last tile.
+ if (i == 0)
+ paintingTile = false;
+
+ ArrayList paintingRects = (ArrayList) paintRegions.get(i);
+ // The last element is always the component.
+ Component c = (Component) paintingRects.get(paintingRects.size() - 1);
+ int endIndex = paintingRects.size() - 2;
+ for (int j = 0; j <= endIndex; j++)
+ {
+ Rectangle cBounds = c.getBounds();
+ Rectangle bounds = (Rectangle) paintingRects.get(j);
+ Rectangle oldClip = g.getClipBounds();
+ if (oldClip == null)
+ oldClip = bounds;
+
+ boolean translated = false;
+ try
+ {
+ g.setClip(bounds);
+ g.translate(cBounds.x, cBounds.y);
+ translated = true;
+ c.paint(g);
+ }
+ finally
+ {
+ if (translated)
+ g.translate(-cBounds.x, -cBounds.y);
+ g.setClip(oldClip);
+ }
+ }
+ }
+ g.setClip(originalClip);
+ }
+
+ /**
+ * Paints the children of this container when it is marked as
+ * optimizedDrawingEnabled. In this case the container can guarantee that
+ * it's children are tiled, which allows for a much more efficient
+ * algorithm to determine the minimum rectangles to be painted for
+ * each child.
+ *
+ * @param g the graphics context to use
+ */
+ private void paintChildrenOptimized(Graphics g)
+ {
+ Shape originalClip = g.getClip();
+ Rectangle inner = SwingUtilities.calculateInnerArea(this, rectCache);
+ g.clipRect(inner.x, inner.y, inner.width, inner.height);
+ Component[] children = getComponents();
+
+ // Find the bottommost component that needs to be painted. This is the
+ // component that - together with the rectangles of the components that
+ // are painted above it - covers the whole clip area.
+ Rectangle rect = new Rectangle();
int startIndex = children.length - 1;
- // No need to check for overlapping components when this component is
- // optimizedDrawingEnabled (== it tiles its children).
- if (! isOptimizedDrawingEnabled())
+ for (int i = 0; i < children.length; i++)
{
- for (int i = 0; i < children.length; i++)
+ Rectangle b = children[i].getBounds();
+ if (children[i].isOpaque() && children[i].isVisible()
+ && g.hitClip(b.x, b.y, b.width, b.height))
{
- Rectangle childBounds = children[i].getBounds();
- if (children[i].isOpaque() && children[i].isVisible()
- && SwingUtilities.isRectangleContainingRectangle(childBounds,
- g.getClipBounds()))
+ if (rect.isEmpty())
+ rect.setBounds(b);
+ else
+ SwingUtilities.computeUnion(b.x, b.y, b.width, b.height, rect);
+
+ if (SwingUtilities.isRectangleContainingRectangle(rect, inner))
{
startIndex = i;
break;
}
}
}
+
// paintingTile becomes true just before we start painting the component's
// children.
paintingTile = true;
- for (int i = startIndex; i >= 0; --i)
+ for (int i = startIndex; i >= 0; i--) //children.length; i++)
{
// paintingTile must be set to false before we begin to start painting
// the last tile.
- if (i == 0)
+ if (i == children.length - 1)
paintingTile = false;
if (!children[i].isVisible())
@@ -2206,7 +2584,20 @@ public abstract class JComponent extends Container implements Serializable
*/
public void unregisterKeyboardAction(KeyStroke aKeyStroke)
{
- // FIXME: Must be implemented.
+ ActionMap am = getActionMap();
+ // This loops through the conditions WHEN_FOCUSED,
+ // WHEN_ANCESTOR_OF_FOCUSED_COMPONENT and WHEN_IN_FOCUSED_WINDOW.
+ for (int cond = 0; cond < 3; cond++)
+ {
+ InputMap im = getInputMap(cond);
+ if (im != null)
+ {
+ Object action = im.get(aKeyStroke);
+ if (action != null && am != null)
+ am.remove(action);
+ im.remove(aKeyStroke);
+ }
+ }
}
@@ -2345,6 +2736,7 @@ public abstract class JComponent extends Container implements Serializable
public void setAutoscrolls(boolean a)
{
autoscrolls = a;
+ clientAutoscrollsSet = true;
}
/**
@@ -2483,7 +2875,29 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setNextFocusableComponent(Component aComponent)
{
- // TODO: Implement this properly.
+ Container focusRoot = this;
+ if (! this.isFocusCycleRoot())
+ focusRoot = getFocusCycleRootAncestor();
+
+ FocusTraversalPolicy policy = focusRoot.getFocusTraversalPolicy();
+ if (policy instanceof CompatibilityFocusTraversalPolicy)
+ {
+ policy = new CompatibilityFocusTraversalPolicy(policy);
+ focusRoot.setFocusTraversalPolicy(policy);
+ }
+ CompatibilityFocusTraversalPolicy p =
+ (CompatibilityFocusTraversalPolicy) policy;
+
+ Component old = getNextFocusableComponent();
+ if (old != null)
+ {
+ p.removeNextFocusableComponent(this, old);
+ }
+
+ if (aComponent != null)
+ {
+ p.addNextFocusableComponent(this, aComponent);
+ }
}
/**
@@ -2538,6 +2952,7 @@ public abstract class JComponent extends Container implements Serializable
{
boolean oldOpaque = opaque;
opaque = isOpaque;
+ clientOpaqueSet = true;
firePropertyChange("opaque", oldOpaque, opaque);
}
@@ -3213,4 +3628,44 @@ public abstract class JComponent extends Container implements Serializable
km.registerEntireMap((ComponentInputMap)
getInputMap(WHEN_IN_FOCUSED_WINDOW));
}
+
+ /**
+ * Helper method for
+ * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+ *
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ */
+ void setUIProperty(String propertyName, Object value)
+ {
+ if (propertyName.equals("opaque"))
+ {
+ if (! clientOpaqueSet)
+ {
+ setOpaque(((Boolean) value).booleanValue());
+ clientOpaqueSet = false;
+ }
+ }
+ else if (propertyName.equals("autoscrolls"))
+ {
+ if (! clientAutoscrollsSet)
+ {
+ setAutoscrolls(((Boolean) value).booleanValue());
+ clientAutoscrollsSet = false;
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException
+ ("Unsupported property for LookAndFeel.installProperty(): "
+ + propertyName);
+ }
+ }
}
diff --git a/javax/swing/JDesktopPane.java b/javax/swing/JDesktopPane.java
index 9c4e9a1fc..92b25f979 100644
--- a/javax/swing/JDesktopPane.java
+++ b/javax/swing/JDesktopPane.java
@@ -85,6 +85,15 @@ public class JDesktopPane extends JLayeredPane implements Accessible
private transient int dragMode = LIVE_DRAG_MODE;
/**
+ * Indicates if the dragMode property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientDragModeSet = false;
+
+ /**
* AccessibleJDesktopPane
*/
protected class AccessibleJDesktopPane extends AccessibleJComponent
@@ -153,6 +162,8 @@ public class JDesktopPane extends JLayeredPane implements Accessible
if ((mode != LIVE_DRAG_MODE) && (mode != OUTLINE_DRAG_MODE))
throw new IllegalArgumentException("Drag mode not valid.");
+ clientDragModeSet = true;
+
// FIXME: Unsupported mode.
if (mode == OUTLINE_DRAG_MODE)
// throw new IllegalArgumentException("Outline drag modes are
@@ -330,4 +341,34 @@ public class JDesktopPane extends JLayeredPane implements Accessible
return accessibleContext;
}
+
+ /**
+ * Helper method for
+ * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+ *
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ */
+ void setUIProperty(String propertyName, Object value)
+ {
+ if (propertyName.equals("dragMode"))
+ {
+ if (! clientDragModeSet)
+ {
+ setDragMode(((Integer) value).intValue());
+ clientDragModeSet = false;
+ }
+ }
+ else
+ {
+ super.setUIProperty(propertyName, value);
+ }
+ }
}
diff --git a/javax/swing/JFileChooser.java b/javax/swing/JFileChooser.java
index d9b0f4eb1..7da3a132d 100644
--- a/javax/swing/JFileChooser.java
+++ b/javax/swing/JFileChooser.java
@@ -1530,7 +1530,9 @@ public class JFileChooser extends JComponent implements Accessible
*/
public AccessibleContext getAccessibleContext()
{
- return new AccessibleJFileChooser();
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJFileChooser();
+ return accessibleContext;
}
/**
diff --git a/javax/swing/JInternalFrame.java b/javax/swing/JInternalFrame.java
index 92bd8ec4a..937212562 100644
--- a/javax/swing/JInternalFrame.java
+++ b/javax/swing/JInternalFrame.java
@@ -1,5 +1,5 @@
/* JInternalFrame.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,6 +44,7 @@ import java.awt.Graphics;
import java.awt.KeyboardFocusManager;
import java.awt.LayoutManager;
import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyVetoException;
import javax.accessibility.Accessible;
@@ -67,11 +68,12 @@ public class JInternalFrame extends JComponent implements Accessible,
WindowConstants,
RootPaneContainer
{
- /** DOCUMENT ME! */
+
private static final long serialVersionUID = -5425177187760785402L;
/**
- * DOCUMENT ME!
+ * Provides the accessibility features for the <code>JInternalFrame</code>
+ * component.
*/
protected class AccessibleJInternalFrame extends AccessibleJComponent
implements AccessibleValue
@@ -79,7 +81,7 @@ public class JInternalFrame extends JComponent implements Accessible,
private static final long serialVersionUID = 5931936924175476797L;
/**
- * Creates a new AccessibleJInternalFrame object.
+ * Creates a new <code>AccessibleJInternalFrame</code> instance.
*/
protected AccessibleJInternalFrame()
{
@@ -87,75 +89,83 @@ public class JInternalFrame extends JComponent implements Accessible,
}
/**
- * DOCUMENT ME!
+ * Returns the frame title.
*
- * @return DOCUMENT ME!
+ * @return The frame title.
*/
public String getAccessibleName()
{
- return null;
+ return getTitle();
}
/**
- * DOCUMENT ME!
+ * Returns the accessible role for the <code>JInternalFrame</code>
+ * component.
*
- * @return DOCUMENT ME!
+ * @return {@link AccessibleRole#INTERNAL_FRAME}.
*/
public AccessibleRole getAccessibleRole()
{
- return null;
+ return AccessibleRole.INTERNAL_FRAME;
}
/**
- * DOCUMENT ME!
+ * Returns an object that provides access to the current, minimum and
+ * maximum values for the {@link JInternalFrame}. Since this class
+ * implements {@link AccessibleValue}, it returns itself.
*
- * @return DOCUMENT ME!
+ * @return The accessible value.
*/
public AccessibleValue getAccessibleValue()
{
- return null;
+ return this;
}
/**
- * DOCUMENT ME!
+ * Returns the current layer for the {@link JInternalFrame} component,
+ * as an {@link Integer}.
*
- * @return DOCUMENT ME!
+ * @return The layer for the {@link JInternalFrame} component.
*/
public Number getCurrentAccessibleValue()
{
- return null;
+ return new Integer(getLayer());
}
/**
- * DOCUMENT ME!
+ * Returns the maximum permitted accessible value.
*
- * @return DOCUMENT ME!
+ * @return <code>Integer(Integer.MAX_VALUE)</code>.
*/
public Number getMaximumAccessibleValue()
{
- return null;
+ return new Integer(Integer.MAX_VALUE);
}
/**
- * DOCUMENT ME!
+ * Returns the minimum permitted accessible value.
*
- * @return DOCUMENT ME!
+ * @return <code>Integer(Integer.MIN_VALUE)</code>.
*/
public Number getMinimumAccessibleValue()
{
- return null;
+ return new Integer(Integer.MIN_VALUE);
}
/**
- * DOCUMENT ME!
+ * Sets the layer for the internal frame.
*
- * @param n DOCUMENT ME!
+ * @param n the layer (see the constants defined in {@link JLayeredPane}).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the value is set, and <code>false</code>
+ * if it was not set.
*/
public boolean setCurrentAccessibleValue(Number n)
{
- return false;
+ if (n == null)
+ return false;
+ setLayer(n.intValue());
+ return true;
}
}
@@ -165,7 +175,8 @@ public class JInternalFrame extends JComponent implements Accessible,
public static class JDesktopIcon extends JComponent implements Accessible
{
/**
- * DOCUMENT ME!
+ * Provides the accessibility features for the <code>JDesktopIcon</code>
+ * component.
*/
protected class AccessibleJDesktopIcon extends AccessibleJComponent
implements AccessibleValue
@@ -173,73 +184,83 @@ public class JInternalFrame extends JComponent implements Accessible,
private static final long serialVersionUID = 5035560458941637802L;
/**
- * Creates a new AccessibleJDesktopIcon object.
+ * Creates a new <code>AccessibleJDesktopIcon</code> instance.
*/
protected AccessibleJDesktopIcon()
{
- super();
+ super();
}
/**
- * DOCUMENT ME!
+ * Returns the accessible role for the <code>JDesktopIcon</code>
+ * component.
*
- * @return DOCUMENT ME!
+ * @return {@link AccessibleRole#DESKTOP_ICON}.
*/
public AccessibleRole getAccessibleRole()
{
- return null;
+ return AccessibleRole.DESKTOP_ICON;
}
/**
- * DOCUMENT ME!
+ * Returns an object that provides access to the current, minimum and
+ * maximum values for the {@link JDesktopIcon}. Since this class
+ * implements {@link AccessibleValue}, it returns itself.
*
- * @return DOCUMENT ME!
+ * @return The accessible value.
*/
public AccessibleValue getAccessibleValue()
{
- return null;
+ return this;
}
/**
- * DOCUMENT ME!
+ * Returns the current layer for the {@link JInternalFrame} component
+ * represented by this <code>JDesktopIcon</code>, as an {@link Integer}.
*
- * @return DOCUMENT ME!
+ * @return The layer.
*/
public Number getCurrentAccessibleValue()
{
- return null;
+ return new Integer(frame.getLayer());
}
/**
- * DOCUMENT ME!
+ * Returns the maximum permitted accessible value.
*
- * @return DOCUMENT ME!
+ * @return <code>Integer(Integer.MAX_VALUE)</code>.
*/
public Number getMaximumAccessibleValue()
{
- return null;
+ return new Integer(Integer.MAX_VALUE);
}
/**
- * DOCUMENT ME!
+ * Returns the minimum permitted accessible value.
*
- * @return DOCUMENT ME!
+ * @return <code>Integer(Integer.MIN_VALUE)</code>.
*/
public Number getMinimumAccessibleValue()
{
- return null;
+ return new Integer(Integer.MIN_VALUE);
}
/**
- * DOCUMENT ME!
+ * Sets the layer for the internal frame represented by this
+ * <code>JDesktopIcon</code> component.
*
- * @param n DOCUMENT ME!
+ * @param n the layer (see the constants defined in
+ * {@link JLayeredPane}).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the value is set, and <code>false</code>
+ * if it was not set.
*/
public boolean setCurrentAccessibleValue(Number n)
{
- return false;
+ if (n == null)
+ return false;
+ frame.setLayer(n.intValue());
+ return true;
}
}
@@ -477,12 +498,13 @@ public class JInternalFrame extends JComponent implements Accessible,
private transient boolean wasIcon = false;
/**
- * Creates a new JInternalFrame object that has no title, and is
- * non-resizable, non-maximizable, non-iconifiable, and non-closable.
+ * Creates a new JInternalFrame object that has an empty string for its
+ * title, and is non-resizable, non-maximizable, non-iconifiable, and
+ * non-closable.
*/
public JInternalFrame()
{
- this(null, false, false, false, false);
+ this("", false, false, false, false);
}
/**
@@ -727,9 +749,11 @@ public class JInternalFrame extends JComponent implements Accessible,
}
/**
- * DOCUMENT ME!
+ * Returns the object that provides accessibility features for this
+ * <code>JInternalFrame</code> component.
*
- * @return DOCUMENT ME!
+ * @return The accessible context (an instance of
+ * {@link AccessibleJInternalFrame}).
*/
public AccessibleContext getAccessibleContext()
{
@@ -760,11 +784,10 @@ public class JInternalFrame extends JComponent implements Accessible,
}
/**
- * This method returns the JDesktopIcon that represents this JInternalFrame
- * while it is iconified.
+ * Returns the <code>JDesktopIcon</code> that represents this
+ * <code>JInternalFrame</code> while it is iconified.
*
- * @return The JDesktopIcon that represents this JInternalFrame while it is
- * iconified.
+ * @return The desktop icon component.
*/
public JDesktopIcon getDesktopIcon()
{
@@ -879,7 +902,12 @@ public class JInternalFrame extends JComponent implements Accessible,
// instead of the static method (this would lead to infinite
// recursion).
return pane.getLayer((Component) this);
- return -1;
+
+ Integer layer = (Integer) getClientProperty(JLayeredPane.LAYER_PROPERTY);
+ if (layer != null)
+ return layer.intValue();
+
+ return JLayeredPane.DEFAULT_LAYER.intValue();
}
/**
@@ -951,9 +979,11 @@ public class JInternalFrame extends JComponent implements Accessible,
}
/**
- * This method sets the title of the JInternalFrame.
+ * Returns the frame's title.
*
- * @return The String displayed in the TitlePane of this JInternalFrame.
+ * @return The frame's title (can be <code>null</code>).
+ *
+ * @see #setTitle(String)
*/
public String getTitle()
{
@@ -1309,16 +1339,24 @@ public class JInternalFrame extends JComponent implements Accessible,
}
/**
- * This method sets the JDesktopIcon that represents this JInternalFrame
- * while it is iconified.
+ * Sets the <code>JDesktopIcon</code> instance that represents this
+ * <code>JInternalFrame</code> while it is iconified and, if the new icon is
+ * not the same instance as the existing icon, sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * <code>"desktopIcon"</code>) to all registered listeners..
*
- * @param d The JDesktopIcon that represents this JInternalFrame while it is
- * iconified.
+ * @param d the icon.
+ *
+ * @see #getDesktopIcon()
*/
public void setDesktopIcon(JDesktopIcon d)
{
- d.setInternalFrame(this);
- desktopIcon = d;
+ if (desktopIcon != d)
+ {
+ JDesktopIcon oldIcon = desktopIcon;
+ desktopIcon = d;
+ firePropertyChange("desktopIcon", oldIcon, d);
+ }
}
/**
@@ -1624,10 +1662,13 @@ public class JInternalFrame extends JComponent implements Accessible,
}
/**
- * This method sets the title displayed in the TitlePane of this
- * JInternalFrame.
+ * Sets the title for the <code>JInternalFrame</code> and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #TITLE_PROPERTY}) to all registered listeners.
*
- * @param title The title displayed.
+ * @param title the new title (<code>null</code> permitted).
+ *
+ * @see #getTitle()
*/
public void setTitle(String title)
{
@@ -1635,9 +1676,9 @@ public class JInternalFrame extends JComponent implements Accessible,
return;
if (title == null || this.title == null || ! this.title.equals(title))
{
- String old = title;
- this.title = title;
- firePropertyChange(TITLE_PROPERTY, old, this.title);
+ String old = this.title;
+ this.title = title;
+ firePropertyChange(TITLE_PROPERTY, old, this.title);
}
}
diff --git a/javax/swing/JLabel.java b/javax/swing/JLabel.java
index a9adc96b2..7c552469e 100644
--- a/javax/swing/JLabel.java
+++ b/javax/swing/JLabel.java
@@ -295,6 +295,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
/** DOCUMENT ME! */
private static final long serialVersionUID = 5496508283662221534L;
+ static final String LABEL_PROPERTY = "labeledBy";
+
/**
* The Component the label will give focus to when its mnemonic is
* activated.
@@ -860,8 +862,23 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
{
if (c != labelFor)
{
+ // We put the label into the client properties for the labeled
+ // component so that it can be read by the AccessibleJComponent.
+ // The other option would be to reserve a default visible field
+ // in JComponent, but since this is relativly seldomly used, it
+ // would be unnecessary waste of memory to do so.
Component oldLabelFor = labelFor;
+ if (oldLabelFor instanceof JComponent)
+ {
+ ((JComponent) oldLabelFor).putClientProperty(LABEL_PROPERTY, null);
+ }
+
labelFor = c;
+ if (labelFor instanceof JComponent)
+ {
+ ((JComponent) labelFor).putClientProperty(LABEL_PROPERTY, this);
+ }
+
firePropertyChange("labelFor", oldLabelFor, labelFor);
}
}
diff --git a/javax/swing/JLayeredPane.java b/javax/swing/JLayeredPane.java
index 84cd8322f..0ad38b5e9 100644
--- a/javax/swing/JLayeredPane.java
+++ b/javax/swing/JLayeredPane.java
@@ -599,6 +599,7 @@ public class JLayeredPane extends JComponent implements Accessible
int newIdx = insertIndexForLayer(layer, index);
setLayer(comp, layer);
super.addImpl(comp, layerConstraint, newIdx);
+ repaint(comp.getX(), comp.getY(), comp.getWidth(), comp.getHeight());
}
/**
diff --git a/javax/swing/JMenu.java b/javax/swing/JMenu.java
index f86ffe0b7..438fc49f1 100644
--- a/javax/swing/JMenu.java
+++ b/javax/swing/JMenu.java
@@ -55,7 +55,6 @@ import javax.accessibility.AccessibleSelection;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import javax.swing.plaf.MenuItemUI;
-import javax.swing.plaf.PanelUI;
/**
* This class represents a menu that can be added to a menu bar or
@@ -765,7 +764,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
protected void processKeyEvent(KeyEvent event)
{
- // TODO: Implement this properly.
+ MenuSelectionManager.defaultManager().processKeyEvent(event);
}
/**
diff --git a/javax/swing/JMenuItem.java b/javax/swing/JMenuItem.java
index cbd8d6e3c..643fe8fd5 100644
--- a/javax/swing/JMenuItem.java
+++ b/javax/swing/JMenuItem.java
@@ -56,7 +56,6 @@ import javax.swing.event.MenuDragMouseListener;
import javax.swing.event.MenuKeyEvent;
import javax.swing.event.MenuKeyListener;
import javax.swing.plaf.MenuItemUI;
-import javax.swing.plaf.PanelUI;
/**
* JMenuItem represents element in the menu. It inherits most of
@@ -397,7 +396,15 @@ public class JMenuItem extends AbstractButton implements Accessible,
public void processKeyEvent(KeyEvent event, MenuElement[] path,
MenuSelectionManager manager)
{
- // Need to implement.
+ MenuKeyEvent e = new MenuKeyEvent(event.getComponent(), event.getID(),
+ event.getWhen(), event.getModifiers(),
+ event.getKeyCode(), event.getKeyChar(),
+ path, manager);
+ processMenuKeyEvent(e);
+
+ // Consume original key event, if the menu key event has been consumed.
+ if (e.isConsumed())
+ event.consume();
}
/**
@@ -435,7 +442,20 @@ public class JMenuItem extends AbstractButton implements Accessible,
*/
public void processMenuKeyEvent(MenuKeyEvent event)
{
- // Need to implement.
+ switch (event.getID())
+ {
+ case KeyEvent.KEY_PRESSED:
+ fireMenuKeyPressed(event);
+ break;
+ case KeyEvent.KEY_RELEASED:
+ fireMenuKeyReleased(event);
+ break;
+ case KeyEvent.KEY_TYPED:
+ fireMenuKeyTyped(event);
+ break;
+ default:
+ break;
+ }
}
/**
diff --git a/javax/swing/JRootPane.java b/javax/swing/JRootPane.java
index b99384a32..a2cd9c7a0 100644
--- a/javax/swing/JRootPane.java
+++ b/javax/swing/JRootPane.java
@@ -50,6 +50,7 @@ import java.awt.Rectangle;
import java.io.Serializable;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.plaf.RootPaneUI;
@@ -677,4 +678,17 @@ public class JRootPane extends JComponent implements Accessible
{
return ! glassPane.isVisible();
}
+
+ /**
+ * Returns the accessible context for this JRootPane. This will be
+ * an instance of {@link AccessibleJRootPane}.
+ *
+ * @return the accessible context for this JRootPane
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJRootPane();
+ return accessibleContext;
+ }
}
diff --git a/javax/swing/JSlider.java b/javax/swing/JSlider.java
index ceb14f14d..f298cbebf 100644
--- a/javax/swing/JSlider.java
+++ b/javax/swing/JSlider.java
@@ -1,5 +1,5 @@
/* JSlider.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package javax.swing;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Dimension;
import java.awt.MenuContainer;
import java.awt.image.ImageObserver;
@@ -60,13 +58,12 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.SliderUI;
/**
- * The JSlider is a Swing component that allows selection of a value within a
+ * A visual component that allows selection of a value within a
* range by adjusting a thumb in a track. The values for the minimum,
* maximum, extent and value are stored in a {@link
* DefaultBoundedRangeModel}.
- *
* <p>
- * JSliders have the following properties:
+ * A <code>JSlider</code> component has the following properties:
* </p>
*
* <table>
@@ -75,38 +72,38 @@ import javax.swing.plaf.SliderUI;
* <tr><td> inverted </td><td> slider </td><td> yes </td></tr>
* <tr><td> labelTable </td><td> slider </td><td> yes </td></tr>
* <tr><td> majorTickSpacing </td><td> slider </td><td> yes </td></tr>
- * <tr><td> maximum </td><td> model </td><td> no </td></tr>
- * <tr><td> minimum </td><td> model </td><td> no </td></tr>
+ * <tr><td> maximum </td><td> model </td><td> yes </td></tr>
+ * <tr><td> minimum </td><td> model </td><td> yes </td></tr>
* <tr><td> minorTickSpacing </td><td> slider </td><td> yes </td></tr>
* <tr><td> model </td><td> slider </td><td> yes </td></tr>
* <tr><td> orientation </td><td> slider </td><td> yes </td></tr>
* <tr><td> paintLabels </td><td> slider </td><td> yes </td></tr>
* <tr><td> paintTicks </td><td> slider </td><td> yes </td></tr>
- * <tr><td> snapToTicks </td><td> slider </td><td> no </td></tr>
+ * <tr><td> snapToTicks </td><td> slider </td><td> yes </td></tr>
* <tr><td> value </td><td> model </td><td> no </td></tr>
* <tr><td> valueIsAdjusting </td><td> model </td><td> no </td></tr>
* </table>
*
* <p>
- * The various behavioral aspects of these properties follows:
+ * The various behavioural aspects of these properties follows:
* </p>
*
* <ul>
* <li>
- * When non-bound properties stored in the slider change, the slider fires
- * ChangeEvents to its ChangeListeners.
+ * When a non-bound property stored in the slider changes, the slider fires
+ * a {@link ChangeEvent} to its change listeners.
* </li>
* <li>
- * When bound properties stored in the slider change, the slider fires
- * PropertyChangeEvents to its PropertyChangeListeners
+ * When a bound property stored in the slider changes, the slider fires a
+ * {@link PropertyChangeEvent} to its property change listeners.
* </li>
* <li>
- * If any of the model's properties change, it fires a ChangeEvent to its
- * ChangeListeners, which include the slider.
+ * If any of the model's properties change, it fires a {@link ChangeEvent} to
+ * its listeners, which include the slider.
* </li>
* <li>
- * If the slider receives a ChangeEvent from its model, it will propagate the
- * ChangeEvent to its ChangeListeners, with the ChangeEvent's "source"
+ * If the slider receives a {@link ChangeEvent} from its model, it will
+ * propagate the event to its own change listeners, with the event's "source"
* property set to refer to the slider, rather than the model.
* </li>
* </ul>
@@ -115,7 +112,6 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
ImageObserver,
MenuContainer, Serializable
{
- /** DOCUMENT ME! */
private static final long serialVersionUID = -1441275936141218479L;
/**
@@ -128,7 +124,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
private static final long serialVersionUID = -6301740148041106789L;
/**
- * Creates a new AccessibleJSlider object.
+ * Creates a new <code>AccessibleJSlider</code> instance.
*/
protected AccessibleJSlider()
{
@@ -157,13 +153,14 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* @return {@link AccessibleRole#SLIDER}.
*/
public AccessibleRole getAccessibleRole()
- throws NotImplementedException
{
return AccessibleRole.SLIDER;
}
/**
- * Returns an object that provides access to the accessible value.
+ * Returns an object that provides access to the current, minimum and
+ * maximum values for the {@link JSlider}. Since this class implements
+ * {@link AccessibleValue}, it returns itself.
*
* @return The accessible value.
*/
@@ -244,33 +241,36 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
*/
private transient Dictionary labelTable;
- /** The model used to describe the slider. */
+ /** The model used to store the slider's range and current value. */
protected BoundedRangeModel sliderModel;
- /** The space between major ticks. */
+ /** The space/distance between major ticks. */
protected int majorTickSpacing;
- /** The space between minor ticks. */
+ /** The space/distance between minor ticks. */
protected int minorTickSpacing;
/** Whether the slider snaps its values to ticks. */
protected boolean snapToTicks = false;
- /** The orientation of the slider. */
+ /** The orientation (horizontal or vertical) of the slider. */
protected int orientation = HORIZONTAL;
/** Whether the slider is inverted. */
private transient boolean isInverted;
- /** The ChangeListener that listens to the model. */
+ /**
+ * The listener that monitors the slider's model and forwards events to the
+ * slider's listeners (see <code>createChangeListener()</code>).
+ */
protected ChangeListener changeListener;
- /** The ChangeEvent that is passed to all listeners of this slider. */
+ /** The change event that is passed to all listeners of this slider. */
protected transient ChangeEvent changeEvent;
/**
- * Creates a new horizontal JSlider object with a minimum of 0, a maximum of
- * 100, and a value of 50.
+ * Creates a new horizontal <code>JSlider</code> instance with a minimum of
+ * 0, a maximum of 100, and a value of 50.
*/
public JSlider()
{
@@ -278,8 +278,8 @@ 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.
+ * Creates a new <code>JSlider</code> instance 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 ({@link #HORIZONTAL} or
* {@link #VERTICAL}).
@@ -293,12 +293,15 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * Creates a new horizontal JSlider object with the given maximum and
- * minimum and a value that is halfway between the minimum and the
+ * Creates a new horizontal <code>JSlider</code> instance with the given
+ * maximum and minimum and a value that is halfway between the minimum and the
* maximum.
*
- * @param minimum The minimum value of the JSlider.
- * @param maximum The maximum value of the JSlider.
+ * @param minimum The minimum value.
+ * @param maximum The maximum value.
+ *
+ * @throws IllegalArgumentException if <code>minimum</code> is greater than
+ * <code>maximum</code>.
*/
public JSlider(int minimum, int maximum)
{
@@ -306,12 +309,17 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * Creates a new horizontal JSlider object with the given minimum, maximum,
- * and value.
+ * Creates a new horizontal <code>JSlider</code> instance with the given
+ * minimum, maximum, and value.
*
- * @param minimum The minimum value of the JSlider.
- * @param maximum The maximum value of the JSlider.
- * @param value The initial value of the JSlider.
+ * @param minimum The minimum value.
+ * @param maximum The maximum value.
+ * @param value The initial value.
+ *
+ * @throws IllegalArgumentException if <code>value</code> is not in the
+ * specified range.
+ * @throws IllegalArgumentException if <code>minimum</code> is greater than
+ * <code>maximum</code>.
*/
public JSlider(int minimum, int maximum, int value)
{
@@ -319,8 +327,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * Creates a new JSlider object with the given orientation, minimum,
- * maximum, and value.
+ * Creates a new <code>JSlider</code> instance with the given orientation,
+ * minimum, maximum, and value.
*
* @param orientation The orientation of the slider ({@link #HORIZONTAL} or
* {@link #VERTICAL}).
@@ -329,13 +337,18 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* @param value The initial value of the JSlider.
*
* @throws IllegalArgumentException if <code>orientation</code> is not one of
- * the specified values.
+ * the specified values.
+ * @throws IllegalArgumentException if <code>value</code> is not in the
+ * specified range.
+ * @throws IllegalArgumentException if <code>minimum</code> is greater than
+ * <code>maximum</code>.
*/
public JSlider(int orientation, int minimum, int maximum, int value)
{
sliderModel = new DefaultBoundedRangeModel(value, 0, minimum, maximum);
if (orientation != HORIZONTAL && orientation != VERTICAL)
- throw new IllegalArgumentException(orientation + " is not a legal orientation");
+ throw new IllegalArgumentException(orientation
+ + " is not a legal orientation");
this.orientation = orientation;
changeListener = createChangeListener();
sliderModel.addChangeListener(changeListener);
@@ -343,7 +356,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * Creates a new horizontal JSlider object with the given model.
+ * Creates a new horizontal <code>JSlider</code> instance with the given
+ * model.
*
* @param model The model (<code>null</code> not permitted).
*
@@ -358,9 +372,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns the current value of the slider.
+ * Returns the slider's value (from the slider's model).
*
- * @return The value of the slider stored in the model.
+ * @return The value of the slider.
+ *
+ * @see #setValue(int)
*/
public int getValue()
{
@@ -368,9 +384,15 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets the value of the slider.
+ * Sets the slider's value and sends a {@link ChangeEvent} to all
+ * registered listeners. Note that the model will fire a change event to all
+ * of its registered listeners first (with the model as the event source) and
+ * then the slider will fire another change event to all of its registered
+ * listeners (this time with the slider as the event source).
*
- * @param value The slider's new value.
+ * @param value the new value.
+ *
+ * @see #getValue()
*/
public void setValue(int value)
{
@@ -378,7 +400,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns the slider's UI delegate.
+ * Returns the slider's UI delegate.
*
* @return The slider's UI delegate.
*/
@@ -388,9 +410,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets the slider's UI delegate.
+ * Sets the slider's UI delegate.
*
- * @param ui A SliderUI object to use with this slider.
+ * @param ui the UI delegate.
*/
public void setUI(SliderUI ui)
{
@@ -398,8 +420,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets this slider's UI to the UIManager's default for the
- * current look and feel.
+ * Sets this slider's UI delegate to the default (obtained from the
+ * {@link UIManager}) for the current look and feel.
*/
public void updateUI()
{
@@ -407,10 +429,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns a name to identify which look and feel class will be
- * the UI delegate for the slider.
+ * Returns the suffix (<code>"SliderUI"</code> in this case) used to
+ * determine the class name for a UI delegate that can provide the look and
+ * feel for a <code>JSlider</code>.
*
- * @return The Look and Feel classID. "SliderUI"
+ * @return <code>"SliderUI"</code>.
*/
public String getUIClassID()
{
@@ -418,29 +441,36 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * Creates a ChangeListener for this Slider.
+ * Creates a {@link ChangeListener} that is added to the slider's model and
+ * forwards change events generated by the model to the listeners that are
+ * registered with the <code>JSlider</code> (by calling the
+ * {@link #fireStateChanged} method).
*
- * @return A new ChangeListener.
+ * @return A new listener.
*/
protected ChangeListener createChangeListener()
{
return new ChangeListener()
{
- public void stateChanged(ChangeEvent ce)
- {
- // No need to trigger a repaint since the UI listens to the model
- // as well. All we need to do is pass on the stateChanged event
- // to our listeners.
- fireStateChanged();
- }
+ public void stateChanged(ChangeEvent ce)
+ {
+ // No need to trigger a repaint since the UI listens to the model
+ // as well. All we need to do is pass on the stateChanged event
+ // to our listeners.
+ fireStateChanged();
+ }
};
}
/**
- * This method registers a listener to this slider. The listener will be
- * informed of new ChangeEvents.
+ * Registers a listener with the slider so that it will receive
+ * {@link ChangeEvent} notifications. Note that change events generated
+ * by the slider's model will be forwarded automatically to the slider's
+ * listeners.
*
- * @param listener The listener to register.
+ * @param listener the listener to register.
+ *
+ * @see #removeChangeListener(ChangeListener)
*/
public void addChangeListener(ChangeListener listener)
{
@@ -448,9 +478,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method removes a listener from this slider.
+ * Removes a listener from this slider so that it will no longer receive
+ * {@link ChangeEvent} notifications from the slider.
*
* @param listener The listener to remove.
+ *
+ * @see #addChangeListener(ChangeListener)
*/
public void removeChangeListener(ChangeListener listener)
{
@@ -458,9 +491,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method is called whenever the model fires a ChangeEvent. It should
- * propagate the ChangeEvent to its listeners with a new ChangeEvent that
- * identifies the slider as the source.
+ * Sends a {@link ChangeEvent} to all registered listeners, with this slider
+ * as the source.
*/
protected void fireStateChanged()
{
@@ -469,16 +501,19 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
changeEvent = new ChangeEvent(this);
for (int i = changeListeners.length - 2; i >= 0; i -= 2)
{
- if (changeListeners[i] == ChangeListener.class)
- ((ChangeListener) changeListeners[i + 1]).stateChanged(changeEvent);
+ if (changeListeners[i] == ChangeListener.class)
+ ((ChangeListener) changeListeners[i + 1]).stateChanged(changeEvent);
}
}
/**
- * This method returns an array of all ChangeListeners listening to this
- * slider.
+ * Returns an array containing all the {@link ChangeListener} instances
+ * registered with this slider. If no listeners are registered, this method
+ * returns an empty array.
*
- * @return An array of ChangeListeners listening to this slider.
+ * @return An array array containing all the {@link ChangeListener} instances
+ * registered with this slider (possibly empty, but never
+ * <code>null</code>).
*/
public ChangeListener[] getChangeListeners()
{
@@ -486,9 +521,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns the model of the slider.
+ * Returns the slider's model, which stores the minimum, maximum and current
+ * values.
*
* @return The slider's model.
+ *
+ * @see #setModel(BoundedRangeModel)
*/
public BoundedRangeModel getModel()
{
@@ -496,11 +534,16 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "model" property. It also needs to unregister
- * any listeners to the old model and register any listeners to the new
- * model.
+ * Sets the slider's model and sends a {@link PropertyChangeEvent} (with the
+ * property name "model") to all registered listeners. The change listener
+ * that the slider registered with the original model is removed and added
+ * to the new model (this ensures that {@link ChangeEvent} notifications
+ * generated by the model are automatically forwarded to listeners that are
+ * registered with the slider).
*
* @param model The model to use with the slider.
+ *
+ * @see #getModel()
*/
public void setModel(BoundedRangeModel model)
{
@@ -509,18 +552,20 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
// and bork the next time it tries to access the model.
if (model != sliderModel)
{
- BoundedRangeModel oldModel = sliderModel;
- sliderModel = model;
- oldModel.removeChangeListener(changeListener);
- sliderModel.addChangeListener(changeListener);
- firePropertyChange("model", oldModel, sliderModel);
+ BoundedRangeModel oldModel = sliderModel;
+ sliderModel = model;
+ oldModel.removeChangeListener(changeListener);
+ sliderModel.addChangeListener(changeListener);
+ firePropertyChange("model", oldModel, sliderModel);
}
}
/**
- * This method returns the minimum value of the slider.
+ * Returns the minimum value of the slider (from the slider's model).
*
* @return The minimum value of the slider.
+ *
+ * @see #setMinimum(int)
*/
public int getMinimum()
{
@@ -528,9 +573,20 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets the minimum value of the slider.
- *
+ * Sets the minimum value of the slider and fires a
+ * {@link PropertyChangeEvent} (with the property name "minimum") to all
+ * registered listeners. Note that:
+ * <p>
+ * <ul>
+ * <li>the minimum value is stored in the slider's model (see
+ * {@link #getModel()});</li>
+ * <li>in addition to the property change event, the slider also fires a
+ * {@link ChangeEvent}.</li>
+ * </ul>
+ *
* @param minimum The minimum value of the slider.
+ *
+ * @see #getMinimum()
*/
public void setMinimum(int minimum)
{
@@ -541,9 +597,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns the maximum value of the slider.
+ * Returns the slider's maximum value (obtained from the slider's model).
*
* @return The maximum value of the slider.
+ *
+ * @see #setMaximum(int)
*/
public int getMaximum()
{
@@ -551,9 +609,20 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets the maximum value of the slider.
+ * Sets the maximum value of the slider and fires a
+ * {@link PropertyChangeEvent} (with the property name "maximum") to all
+ * registered listeners. Note that:
+ * <p>
+ * <ul>
+ * <li>the maximum value is stored in the slider's model (see
+ * {@link #getModel()});</li>
+ * <li>in addition to the property change event, the slider also fires a
+ * {@link ChangeEvent}.</li>
+ * </ul>
*
* @param maximum The maximum value of the slider.
+ *
+ * @see #getMaximum()
*/
public void setMaximum(int maximum)
{
@@ -564,10 +633,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns this slider's isAdjusting value which is true if the
- * thumb is being dragged.
+ * Returns the <code>valueIsAdjusting</code> flag from the slider's model.
*
- * @return The slider's isAdjusting value.
+ * @return The <code>valueIsAdjusting</code> flag from the slider's model.
+ *
+ * @see #setValueIsAdjusting(boolean)
*/
public boolean getValueIsAdjusting()
{
@@ -575,9 +645,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets the isAdjusting value for the slider.
+ * Sets the <code>valueIsAdjusting</code> flag in the slider's model, and
+ * sends a {@link ChangeEvent} to all registered listeners.
*
- * @param adjusting The slider's isAdjusting value.
+ * @param adjusting the new flag value.
+ *
+ * @see #getValueIsAdjusting()
*/
public void setValueIsAdjusting(boolean adjusting)
{
@@ -585,9 +658,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns the extent value for this slider.
+ * Returns the slider's extent value, obtained from the slider's model.
*
- * @return The extent value for this slider.
+ * @return The extent value.
+ *
+ * @see #setExtent(int)
*/
public int getExtent()
{
@@ -595,9 +670,15 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets the extent value for this slider.
+ * Sets the slider's extent value and sends a {@link ChangeEvent} to all
+ * registered listeners. Note that the model will fire a change event to all
+ * of its registered listeners first (with the model as the event source) and
+ * then the slider will fire another change event to all of its registered
+ * listeners (this time with the slider as the event source).
*
* @param extent The extent value for this slider.
+ *
+ * @see #getExtent()
*/
public void setExtent(int extent)
{
@@ -605,9 +686,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns the slider orientation.
+ * Returns the orientation of the slider, either {@link JSlider#HORIZONTAL}
+ * or {@link JSlider#VERTICAL}.
*
* @return The orientation of the slider.
+ *
+ * @see #setOrientation(int)
*/
public int getOrientation()
{
@@ -615,28 +699,37 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "orientation" property of this slider. If the
- * orientation is not VERTICAL or HORIZONTAL, this method does nothing.
+ * Sets the orientation for the slider and sends a
+ * {@link PropertyChangeEvent} (with the property name "orientation") to all
+ * registered listeners.
*
- * @param orientation The orientation of this slider.
+ * @param orientation the orientation (one of {@link JSlider#HORIZONTAL} or
+ * {@link JSlider#VERTICAL}).
+ *
+ * @throws IllegalArgumentException if <code>orientation</code> is not one of
+ * the permitted values.
+ *
+ * @see #getOrientation()
*/
public void setOrientation(int orientation)
{
if (orientation != VERTICAL && orientation != HORIZONTAL)
- throw new IllegalArgumentException("orientation must be one of: VERTICAL, HORIZONTAL");
+ throw new IllegalArgumentException(
+ "orientation must be one of: VERTICAL, HORIZONTAL");
if (orientation != this.orientation)
{
- int oldOrientation = this.orientation;
- this.orientation = orientation;
- firePropertyChange("orientation", oldOrientation,
- this.orientation);
+ int oldOrientation = this.orientation;
+ this.orientation = orientation;
+ firePropertyChange("orientation", oldOrientation, this.orientation);
}
}
/**
- * This method returns the label table for this slider.
+ * Returns the label table for the slider.
*
- * @return The label table for this slider.
+ * @return The label table for the slider (possibly <code>null</code>).
+ *
+ * @see #setLabelTable(Dictionary)
*/
public Dictionary getLabelTable()
{
@@ -644,23 +737,27 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "labelTable" property of this slider.
+ * Sets the table of labels for the slider and sends a
+ * {@link PropertyChangeEvent} (with the property name "labelTable") to all
+ * registered listeners.
*
- * @param table The label table for this slider.
+ * @param table the table of labels (<code>null</code> permitted).
+ *
+ * @see #getLabelTable()
*/
public void setLabelTable(Dictionary table)
{
if (table != labelTable)
{
- Dictionary oldTable = labelTable;
- labelTable = table;
- firePropertyChange("labelTable", oldTable, labelTable);
+ Dictionary oldTable = labelTable;
+ labelTable = table;
+ firePropertyChange("labelTable", oldTable, labelTable);
}
}
/**
- * This method is called to reset UI delegates for the labels in the
- * labelTable to a default for the current look and feel.
+ * Resets the UI delegates for the labels in the <code>labelTable</code> to
+ * the default for the current look and feel.
*/
protected void updateLabelUIs()
{
@@ -668,20 +765,20 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
return;
for (Enumeration list = labelTable.elements(); list.hasMoreElements();)
{
- JLabel label = (JLabel) list.nextElement();
- label.updateUI();
+ JLabel label = (JLabel) list.nextElement();
+ label.updateUI();
}
}
/**
- * Creates a hashtable of (Integer, JLabel) pairs that can be used as a
- * label table for this slider. The labels will start from the sliders
- * minimum and increase by the increment. Each label will have a text
- * string indicating their integer value.
+ * Creates a hashtable of <code>(Integer, JLabel)</code> pairs that can be
+ * used as a label table for this slider. The labels will start from the
+ * slider's minimum and increase by the increment. Each label will have a text
+ * string indicating its integer value.
*
* @param increment The increment between labels (must be > 0).
*
- * @return A hashtable with the labels and their keys.
+ * @return A hashtable containing the labels.
*
* @throws IllegalArgumentException if <code>increment</code> is not greater
* than zero.
@@ -692,10 +789,10 @@ 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 its integer value.
+ * Creates a hashtable of <code>(Integer, JLabel)</code> 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 its integer value.
*
* @param increment The increment between labels (must be > 0).
* @param start The value to start from.
@@ -720,29 +817,29 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
for (int i = start; i <= max; i += increment)
{
- label = new JLabel(String.valueOf(i));
- label.setVerticalAlignment(CENTER);
- label.setHorizontalAlignment(CENTER);
-
- // Make sure these labels have the width and height
- // they want.
- dim = label.getPreferredSize();
- label.setBounds(label.getX(), label.getY(),
- (int) dim.getWidth(),
- (int) dim.getHeight());
- table.put(new Integer(i), label);
+ label = new JLabel(String.valueOf(i));
+ label.setVerticalAlignment(CENTER);
+ label.setHorizontalAlignment(CENTER);
+
+ // Make sure these labels have the width and height
+ // they want.
+ dim = label.getPreferredSize();
+ label.setBounds(label.getX(), label.getY(),
+ (int) dim.getWidth(),
+ (int) dim.getHeight());
+ table.put(new Integer(i), label);
}
return table;
}
/**
- * This method returns whether the slider is inverted. Horizontal sliders
- * that are not inverted will have the minimums on the left. If they are
- * inverted, the minimums will be on the right. Vertical sliders that are
- * not inverted will have the minimums at the bottom. If they are inverted,
- * the minimums will be at the top.
+ * Returns the flag that controls whether or not the value scale for the
+ * slider is inverted (the default value is <code>false</code>).
*
- * @return Whether this slider is inverted.
+ * @return The flag that controls whether or not the value scale for the
+ * slider is inverted.
+ *
+ * @see #setInverted(boolean)
*/
public boolean getInverted()
{
@@ -750,30 +847,36 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "inverted" property for this slider.Horizontal
- * sliders that are not inverted will have the minimums on the left. If
- * they are inverted, the minimums will be on the right. Vertical sliders
- * that are not inverted will have the minimums at the bottom. If they are
- * inverted, the minimums will be at the top. However, if the slider's
- * componentOrientation is set to RIGHT_TO_LEFT, then everything gets
- * reversed again.
+ * Sets the flag that controls whether or not the value scale for the
+ * slider is inverted and, if the new flag value is different to the old flag
+ * value, sends a {@link PropertyChangeEvent} to all registered listeners.
+ * Typically, a horizontal slider will display a scale that increases from
+ * left to right, but this is reversed if the 'inverted' flag is set to
+ * <code>true</code>. Similarly, a vertical slider will display a scale that
+ * increases from bottom to top, and this is reversed if the 'inverted' flag
+ * is set to <code>true</code>.
*
- * @param inverted Whether the slider should be inverted.
+ * @param inverted the new flag value.
+ *
+ * @see #getInverted()
*/
public void setInverted(boolean inverted)
{
if (isInverted != inverted)
{
- boolean oldInverted = isInverted;
- isInverted = inverted;
- firePropertyChange("inverted", oldInverted, isInverted);
+ boolean oldInverted = isInverted;
+ isInverted = inverted;
+ firePropertyChange("inverted", oldInverted, isInverted);
}
}
/**
- * This method returns the amount of units between each major tick mark.
+ * Returns the distance between major tick marks along the slider's value
+ * scale.
*
* @return The amount of units between each major tick mark.
+ *
+ * @see #setMajorTickSpacing(int)
*/
public int getMajorTickSpacing()
{
@@ -781,26 +884,32 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "majorTickSpacing" property for this slider. The
- * major tick spacing is the amount of units between each major tick mark.
+ * Sets the distance between major tick marks along the slider's value scale,
+ * and sends a {@link PropertyChangeEvent} (with the property name
+ * "majorTickSpacing") to all registered listeners.
*
- * @param spacing The amount of units between each major tick mark.
+ * @param spacing the distance between major tick marks.
+ *
+ * @see #getMajorTickSpacing()
*/
public void setMajorTickSpacing(int spacing)
{
if (majorTickSpacing != spacing)
{
- int oldSpacing = majorTickSpacing;
- majorTickSpacing = spacing;
- firePropertyChange("majorTickSpacing", oldSpacing,
- majorTickSpacing);
+ int oldSpacing = majorTickSpacing;
+ majorTickSpacing = spacing;
+ firePropertyChange("majorTickSpacing", oldSpacing, majorTickSpacing);
}
}
/**
- * This method returns the amount of units between each minor tick mark.
+ * Returns the distance between minor tick marks along the slider's value
+ * scale.
*
- * @return The amount of units between each minor tick mark.
+ * @return The distance between minor tick marks along the slider's value
+ * scale.
+ *
+ * @see #setMinorTickSpacing(int)
*/
public int getMinorTickSpacing()
{
@@ -808,28 +917,32 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "minorTickSpacing" property for this slider. The
- * minor tick spacing is the amount of units between each minor tick mark.
+ * Sets the distance between minor tick marks along the slider's value scale,
+ * and sends a {@link PropertyChangeEvent} (with the property name
+ * "minorTickSpacing") to all registered listeners.
*
- * @param spacing The amount of units between each minor tick mark.
+ * @param spacing the distance between minor tick marks.
+ *
+ * @see #getMinorTickSpacing()
*/
public void setMinorTickSpacing(int spacing)
{
if (minorTickSpacing != spacing)
{
- int oldSpacing = minorTickSpacing;
- minorTickSpacing = spacing;
- firePropertyChange("minorTickSpacing", oldSpacing,
- minorTickSpacing);
+ int oldSpacing = minorTickSpacing;
+ minorTickSpacing = spacing;
+ firePropertyChange("minorTickSpacing", oldSpacing, minorTickSpacing);
}
}
/**
- * This method returns whether this slider is snapping to ticks. Sliders
- * that snap to ticks will automatically move the thumb to the nearest tick
- * mark.
+ * Returns the flag that controls whether the slider thumb will snap to ticks.
+ * Sliders that snap to ticks will automatically move the thumb to the
+ * nearest tick mark.
*
- * @return Whether this slider snaps to ticks.
+ * @return <code>true</code> if the slider thumb automatically.
+ *
+ * @see #setSnapToTicks(boolean)
*/
public boolean getSnapToTicks()
{
@@ -837,28 +950,32 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method sets whether this slider will snap to ticks. Sliders that
- * snap to ticks will automatically move the thumb to the nearest tick
- * mark.
+ * Sets the flag that controls whether the slider thumb will snap to ticks
+ * and sends a {@link PropertyChangeEvent} (with the property name
+ * 'snapToTicks') to all registered listeners. Sliders that snap to ticks
+ * will automatically move the thumb to the nearest tick mark.
*
- * @param snap Whether this slider snaps to ticks.
+ * @param snap the new flag value.
+ *
+ * @see #getSnapToTicks()
*/
public void setSnapToTicks(boolean snap)
{
if (snap != snapToTicks)
{
- snapToTicks = snap;
- firePropertyChange("snapToTicks", !snap, snap);
+ snapToTicks = snap;
+ firePropertyChange("snapToTicks", !snap, snap);
}
}
/**
- * This method returns whether the slider will paint its tick marks. In
- * addition to setting this property to true, one of minor tick spacing or
- * major tick spacing must be set to a value greater than 0 in order for
- * ticks to be painted.
+ * Returns the flag that controls whether or not tick marks are painted along
+ * the slider's value scale.
*
- * @return Whether ticks will be painted.
+ * @return <code>true</code> if tick marks should be painted, and
+ * <code>false</code> if tick marks should not be painted.
+ *
+ * @see #setPaintTicks(boolean)
*/
public boolean getPaintTicks()
{
@@ -866,27 +983,33 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "paintTicks" property for this slider. In
- * addition to setting this property to true, one of minor tick spacing or
- * major tick spacing must be set to a value greater than 0 in order for
- * ticks to be painted.
+ * Sets the flag that controls whether or not tick marks are painted along
+ * the slider's value scale, and sends a {@link PropertyChangeEvent} (with
+ * the property name "paintTicks") to all registered listeners. In
+ * addition to setting this property to <code>true</code>, one or both of the
+ * minor tick spacing and major tick spacing attributes must be set to a
+ * value greater than 0 in order for ticks to be painted.
*
* @param paint Whether ticks will be painted.
+ *
+ * @see #getPaintTicks()
*/
public void setPaintTicks(boolean paint)
{
if (paint != paintTicks)
{
- boolean oldPaintTicks = paintTicks;
- paintTicks = paint;
- firePropertyChange("paintTicks", oldPaintTicks, paintTicks);
+ boolean oldPaintTicks = paintTicks;
+ paintTicks = paint;
+ firePropertyChange("paintTicks", oldPaintTicks, paintTicks);
}
}
/**
- * This method returns whether the track will be painted.
+ * Returns the flag that controls whether or not the track is painted.
*
* @return Whether the track will be painted.
+ *
+ * @see #setPaintTrack(boolean)
*/
public boolean getPaintTrack()
{
@@ -899,6 +1022,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
* registered listeners.
*
* @param paint Whether the track will be painted.
+ *
+ * @see #getPaintTrack()
*/
public void setPaintTrack(boolean paint)
{
@@ -910,9 +1035,12 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method returns whether labels will be painted.
+ * Returns the flag that controls whether or not labels are painted for the
+ * tick marks along the slider.
*
* @return Whether labels will be painted.
+ *
+ * @see #setPaintLabels(boolean)
*/
public boolean getPaintLabels()
{
@@ -920,26 +1048,31 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
}
/**
- * This method changes the "paintLabels" property.
+ * Sets the flag that controls whether or not labels are painted for the
+ * tick marks along the slider and sends a {@link PropertyChangeEvent} (with
+ * the property name "paintLabels") to all registered listeners.
*
* @param paint Whether labels will be painted.
+ *
+ * @see #getPaintLabels()
*/
public void setPaintLabels(boolean paint)
{
if (paint != paintLabels)
{
- paintLabels = paint;
- if (paint && majorTickSpacing > 0)
+ paintLabels = paint;
+ if (paint && majorTickSpacing > 0 && labelTable == null)
labelTable = createStandardLabels(majorTickSpacing);
- firePropertyChange("paintLabels", !paint, paint);
+ firePropertyChange("paintLabels", !paint, paint);
}
}
/**
- * This method is used primarily for debugging purposes and returns a string
- * that can be used to represent this slider.
+ * Returns a string describing the attributes of this slider, for debugging
+ * purposes. According to the specification, this method is implementation
+ * specific, we just return "JSlider" at present.
*
- * @return A string representing this slider.
+ * @return Returns a string describing the attributes of this slider.
*/
protected String paramString()
{
diff --git a/javax/swing/JSplitPane.java b/javax/swing/JSplitPane.java
index 934bfd703..cb2640570 100644
--- a/javax/swing/JSplitPane.java
+++ b/javax/swing/JSplitPane.java
@@ -223,6 +223,24 @@ public class JSplitPane extends JComponent implements Accessible
private transient double resizeWeight;
/**
+ * Indicates if the dividerSize property has been set by a client program or
+ * by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientDividerSizeSet = false;
+
+ /**
+ * Indicates if the oneTouchExpandable property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientOneTouchExpandableSet = false;
+
+ /**
* Creates a new JSplitPane object with the given orientation, layout mode,
* and left and right components.
*
@@ -672,6 +690,7 @@ public class JSplitPane extends JComponent implements Accessible
*/
public void setDividerSize(int newSize)
{
+ clientDividerSizeSet = true;
if (newSize != dividerSize)
{
int oldSize = dividerSize;
@@ -723,6 +742,7 @@ public class JSplitPane extends JComponent implements Accessible
*/
public void setOneTouchExpandable(boolean newValue)
{
+ clientOneTouchExpandableSet = true;
if (newValue != oneTouchExpandable)
{
boolean oldValue = oneTouchExpandable;
@@ -822,4 +842,42 @@ public class JSplitPane extends JComponent implements Accessible
{
return "SplitPaneUI";
}
+
+ /**
+ * Helper method for
+ * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+ *
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ */
+ void setUIProperty(String propertyName, Object value)
+ {
+ if (propertyName.equals("dividerSize"))
+ {
+ if (! clientDividerSizeSet)
+ {
+ setDividerSize(((Integer) value).intValue());
+ clientDividerSizeSet = false;
+ }
+ }
+ else if (propertyName.equals("oneTouchExpandable"))
+ {
+ if (! clientOneTouchExpandableSet)
+ {
+ setOneTouchExpandable(((Boolean) value).booleanValue());
+ clientOneTouchExpandableSet = false;
+ }
+ }
+ else
+ {
+ super.setUIProperty(propertyName, value);
+ }
+ }
}
diff --git a/javax/swing/JTabbedPane.java b/javax/swing/JTabbedPane.java
index a5e8fd0a7..0c2180969 100644
--- a/javax/swing/JTabbedPane.java
+++ b/javax/swing/JTabbedPane.java
@@ -1157,8 +1157,45 @@ public class JTabbedPane extends JComponent implements Serializable,
public void removeTabAt(int index)
{
checkIndex(index, 0, tabs.size());
+
+ // We need to adjust the selection if we remove a tab that comes
+ // before the selected tab or if the selected tab is removed.
+ // This decrements the selected index by 1 if any of this is the case.
+ // Note that this covers all cases:
+ // - When the selected tab comes after the removed tab, this simply
+ // adjusts the selection so that after the removal the selected tab
+ // is still the same.
+ // - When we remove the currently selected tab, then the tab before the
+ // selected tab gets selected.
+ // - When the last tab is removed, then we have an index==0, which gets
+ // decremented to -1, which means no selection, which is 100% perfect.
+ int selectedIndex = getSelectedIndex();
+ if (selectedIndex >= index)
+ setSelectedIndex(selectedIndex - 1);
+
+ Component comp = getComponentAt(index);
+
+ // Remove the tab object.
tabs.remove(index);
- getComponentAt(index).show();
+
+ // Remove the component. I think we cannot assume that the tab order
+ // is equal to the component order, so we iterate over the children
+ // here to find the and remove the correct component.
+ if (comp != null)
+ {
+ Component[] children = getComponents();
+ for (int i = children.length - 1; i >= 0; --i)
+ {
+ if (children[i] == comp)
+ {
+ super.remove(i);
+ comp.setVisible(true);
+ break;
+ }
+ }
+ }
+ revalidate();
+ repaint();
}
/**
@@ -1188,7 +1225,8 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void removeAll()
{
- for (int i = tabs.size() - 1; i >= 0; i--)
+ setSelectedIndex(-1);
+ for (int i = getTabCount() - 1; i >= 0; i--)
removeTabAt(i);
}
diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java
index 6b192c1df..89272451e 100644
--- a/javax/swing/JTable.java
+++ b/javax/swing/JTable.java
@@ -1575,6 +1575,15 @@ public class JTable
private Rectangle rectCache = new Rectangle();
/**
+ * Indicates if the rowHeight property has been set by a client program or by
+ * the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientRowHeightSet = false;
+
+ /**
* Creates a new <code>JTable</code> instance.
*/
public JTable ()
@@ -1651,13 +1660,22 @@ public class JTable
public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm)
{
boolean autoCreate = false;
+ TableColumnModel columnModel;
if (cm != null)
- setColumnModel(cm);
+ columnModel = cm;
else
{
- setColumnModel(createDefaultColumnModel());
+ columnModel = createDefaultColumnModel();
autoCreate = true;
- }
+ }
+
+ // Initialise the intercelar spacing before setting the column model to
+ // avoid firing unnecessary events.
+ // The initial incellar spacing is new Dimenstion(1,1).
+ rowMargin = 1;
+ columnModel.setColumnMargin(1);
+ setColumnModel(columnModel);
+
setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);
setModel(dm == null ? createDefaultDataModel() : dm);
setAutoCreateColumnsFromModel(autoCreate);
@@ -1717,7 +1735,6 @@ public class JTable
this.showVerticalLines = true;
this.editingColumn = -1;
this.editingRow = -1;
- setIntercellSpacing(new Dimension(1,1));
}
/**
@@ -1864,13 +1881,33 @@ public class JTable
}
/**
- * Invoked when the the column selection changes.
+ * Invoked when the the column selection changes, repaints the changed
+ * columns. It is not recommended to override this method, register the
+ * listener instead.
*/
public void columnSelectionChanged (ListSelectionEvent event)
{
- repaint();
+ // Does not make sense for the table with the single column.
+ if (getColumnCount() < 2)
+ return;
+
+ int x0 = 0;
+
+ int idx0 = event.getFirstIndex();
+ int idxn = event.getLastIndex();
+ int i;
+
+ for (i = 0; i < idx0; i++)
+ x0 += columnModel.getColumn(i).getWidth();
+
+ int xn = x0;
+
+ for (i = idx0; i <= idxn; i++)
+ xn += columnModel.getColumn(i).getWidth();
+
+ repaint(x0, 0, xn-x0, getHeight());
}
-
+
/**
* Invoked when the editing is cancelled.
*/
@@ -1929,11 +1966,19 @@ public class JTable
}
/**
- * Invoked when another table row is selected.
+ * Invoked when another table row is selected. It is not recommended
+ * to override thid method, register the listener instead.
*/
public void valueChanged (ListSelectionEvent event)
{
- repaint();
+ // Does not make sense for the table with the single row.
+ if (getRowCount() < 2)
+ return;
+
+ int y_gap = rowMargin;
+ int y0 = (getRowHeight() + y_gap) * (event.getFirstIndex());
+ int yn = (getRowHeight() + y_gap) * (event.getLastIndex()+1);
+ repaint(0, y0, getWidth(), yn-y0);
}
/**
@@ -2711,7 +2756,9 @@ public class JTable
{
if (r < 1)
throw new IllegalArgumentException();
-
+
+ clientRowHeightSet = true;
+
rowHeight = r;
revalidate();
repaint();
@@ -3754,4 +3801,34 @@ public class JTable
// TODO: Implement functionality of this property (in UI impl).
return surrendersFocusOnKeystroke;
}
+
+ /**
+ * Helper method for
+ * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+ *
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ */
+ void setUIProperty(String propertyName, Object value)
+ {
+ if (propertyName.equals("rowHeight"))
+ {
+ if (! clientRowHeightSet)
+ {
+ setRowHeight(((Integer) value).intValue());
+ clientRowHeightSet = false;
+ }
+ }
+ else
+ {
+ super.setUIProperty(propertyName, value);
+ }
+ }
}
diff --git a/javax/swing/JTextField.java b/javax/swing/JTextField.java
index 01c5c06a3..367503b73 100644
--- a/javax/swing/JTextField.java
+++ b/javax/swing/JTextField.java
@@ -1,5 +1,5 @@
/* JTextField.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,7 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Insets;
+import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
@@ -110,8 +111,7 @@ public class JTextField extends JTextComponent
private int columns;
private int align;
- private int scrollOffset;
-
+
/** @since 1.3 */
private Action action;
@@ -184,6 +184,9 @@ public class JTextField extends JTextComponent
this.columns = columns;
+ // Initialize the horizontal visibility model.
+ horizontalVisibility = new DefaultBoundedRangeModel();
+
setDocument(doc == null ? createDefaultModel() : doc);
if (text != null)
@@ -191,9 +194,6 @@ public class JTextField extends JTextComponent
// default value for alignment
align = LEADING;
-
- // Initialize the horizontal visibility model.
- horizontalVisibility = new DefaultBoundedRangeModel();
}
/**
@@ -270,7 +270,7 @@ public class JTextField extends JTextComponent
*/
protected void fireActionPerformed()
{
- ActionEvent event = new ActionEvent(this, 0, notifyAction);
+ ActionEvent event = new ActionEvent(this, 0, getText());
ActionListener[] listeners = getActionListeners();
for (int index = 0; index < listeners.length; ++index)
@@ -368,8 +368,7 @@ public class JTextField extends JTextComponent
*/
public int getScrollOffset()
{
- //FIXME: this should return horizontalVisibility's value
- return scrollOffset;
+ return horizontalVisibility.getValue();
}
/**
@@ -379,8 +378,13 @@ public class JTextField extends JTextComponent
*/
public void setScrollOffset(int offset)
{
- //FIXME: this should actualy scroll the field if needed
- scrollOffset = offset;
+ // Automatically sets to the highest possible value if
+ // offset is bigger than that.
+ horizontalVisibility.setValue(
+ Math.min(horizontalVisibility.getMaximum()
+ - horizontalVisibility.getExtent(),
+ offset));
+
}
/**
@@ -525,9 +529,6 @@ public class JTextField extends JTextComponent
*/
public BoundedRangeModel getHorizontalVisibility()
{
- // TODO: The real implementation of this property is still missing.
- // However, this is not done in JTextField but must instead be handled in
- // javax.swing.text.FieldView.
return horizontalVisibility;
}
@@ -544,4 +545,25 @@ public class JTextField extends JTextComponent
{
return ! (getParent() instanceof JViewport);
}
+
+ public void scrollRectToVisible(Rectangle r)
+ {
+ int v = horizontalVisibility.getValue();
+
+ // The extent value is the inner width of the text field.
+ int e = horizontalVisibility.getExtent();
+ Insets i = getInsets();
+
+ // The x value in the rectangle (usually) denotes the new location
+ // of the caret. We check whether the location lies inside the left or
+ // right border and scroll into the appropriate direction.
+ // The calculation has to be shifted by the BoundedRangeModel's value
+ // because that value was already used to calculate r.x (this happens
+ // as part of a modelToView() call in FieldView).
+ if (r.x < i.left)
+ setScrollOffset(v + r.x - i.left);
+ else if (r.x > e + i.left)
+ setScrollOffset(r.x + v - e - i.left);
+ }
+
}
diff --git a/javax/swing/JToolBar.java b/javax/swing/JToolBar.java
index 488e106e8..bc97f9ecd 100644
--- a/javax/swing/JToolBar.java
+++ b/javax/swing/JToolBar.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing;
+import gnu.classpath.NotImplementedException;
+
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
@@ -50,7 +52,6 @@ import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
-import javax.swing.JButton;
import javax.swing.plaf.ToolBarUI;
/**
@@ -89,6 +90,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
* @return AccessibleStateSet
*/
public AccessibleStateSet getAccessibleStateSet()
+ throws NotImplementedException
{
return null; // TODO
}
diff --git a/javax/swing/JTree.java b/javax/swing/JTree.java
index 63184891c..f4b37e106 100644
--- a/javax/swing/JTree.java
+++ b/javax/swing/JTree.java
@@ -1443,6 +1443,33 @@ public class JTree extends JComponent implements Scrollable, Accessible
new TreeSelectionRedirector();
/**
+ * Indicates if the rowHeight property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientRowHeightSet = false;
+
+ /**
+ * Indicates if the scrollsOnExpand property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientScrollsOnExpandSet = false;
+
+ /**
+ * Indicates if the showsRootHandles property has been set by a client
+ * program or by the UI.
+ *
+ * @see #setUIProperty(String, Object)
+ * @see LookAndFeel#installProperty(JComponent, String, Object)
+ */
+ private boolean clientShowsRootHandlesSet = false;
+
+ /**
* Creates a new <code>JTree</code> object.
*/
public JTree()
@@ -1619,7 +1646,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
*/
public Dimension getPreferredScrollableViewportSize()
{
- return new Dimension (getPreferredSize().width, getVisibleRowCount()*getRowHeight());
+ return getPreferredSize();
}
/**
@@ -1926,6 +1953,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
public void setShowsRootHandles(boolean flag)
{
+ clientShowsRootHandlesSet = true;
+
if (showsRootHandles == flag)
return;
@@ -2025,6 +2054,8 @@ public class JTree extends JComponent implements Scrollable, Accessible
public void setRowHeight(int height)
{
+ clientRowHeightSet = true;
+
if (rowHeight == height)
return;
@@ -2114,6 +2145,7 @@ public class JTree extends JComponent implements Scrollable, Accessible
public void setScrollsOnExpand(boolean scroll)
{
+ clientScrollsOnExpandSet = true;
if (scrollsOnExpand == scroll)
return;
@@ -2944,4 +2976,50 @@ public class JTree extends JComponent implements Scrollable, Accessible
{
repaint();
}
+
+ /**
+ * Helper method for
+ * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+ *
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ */
+ void setUIProperty(String propertyName, Object value)
+ {
+ if (propertyName.equals("rowHeight"))
+ {
+ if (! clientRowHeightSet)
+ {
+ setRowHeight(((Integer) value).intValue());
+ clientRowHeightSet = false;
+ }
+ }
+ else if (propertyName.equals("scrollsOnExpand"))
+ {
+ if (! clientScrollsOnExpandSet)
+ {
+ setScrollsOnExpand(((Boolean) value).booleanValue());
+ clientScrollsOnExpandSet = false;
+ }
+ }
+ else if (propertyName.equals("showsRootHandles"))
+ {
+ if (! clientShowsRootHandlesSet)
+ {
+ setShowsRootHandles(((Boolean) value).booleanValue());
+ clientShowsRootHandlesSet = false;
+ }
+ }
+ else
+ {
+ super.setUIProperty(propertyName, value);
+ }
+ }
}
diff --git a/javax/swing/LookAndFeel.java b/javax/swing/LookAndFeel.java
index b9f2aa3f7..6cd949082 100644
--- a/javax/swing/LookAndFeel.java
+++ b/javax/swing/LookAndFeel.java
@@ -384,4 +384,50 @@ public abstract class LookAndFeel
if (c.getBorder() instanceof UIResource)
c.setBorder(null);
}
+
+ /**
+ * This methods installs a UI property if it hasn't already been set by an
+ * application. This method is used by UI delegates that install a default
+ * value for a property with a primitive type but do not want to override
+ * a value that has been set by an application.
+ *
+ * The supported properties depend on the actual type of the component and
+ * are listed in the table below. The supported properties are of course
+ * inherited to subclasses.
+ *
+ * <table>
+ * <tr><th>Type</th><th>Supported properties</th></tr>
+ * <tr><td><code>JComponent</code></td>
+ * <td><code>opaque, autoscrolls</code></td></tr>
+ * <tr><td><code>AbstractButton</code></td>
+ * <td><code>borderPainted, rolloverEnabled, iconTextGap,
+ * contentAreaFilled</code></td></tr>
+ * <tr><td><code>JDesktopPane</code></td>
+ * <td><code>dragMode</code></td></tr>
+ * <tr><td><code>JSplitPane</code></td>
+ * <td><code>dividerSize, oneTouchExpandable</code></td></tr>
+ * <tr><td><code>JTable</code></td>
+ * <td><code>rowHeight</code></td></tr>
+ * <tr><td><code>JTree</code></td>
+ * <td><code>rowHeight, scrollsOnExpand, showsRootHandles</code></td></tr>
+ * </table>
+ *
+ * @param c the component to install the property to
+ * @param propertyName the name of the property
+ * @param value the value of the property
+ *
+ * @throws IllegalArgumentException if the specified property cannot be set
+ * by this method
+ * @throws ClassCastException if the property value does not match the
+ * property type
+ * @throws NullPointerException if <code>c</code> or
+ * <code>propertyValue</code> is <code>null</code>
+ *
+ * @since 1.5
+ */
+ public static void installProperty(JComponent c, String propertyName,
+ Object value)
+ {
+ c.setUIProperty(propertyName, value);
+ }
}
diff --git a/javax/swing/MenuSelectionManager.java b/javax/swing/MenuSelectionManager.java
index 4ba0dbda7..12f6d2f9e 100644
--- a/javax/swing/MenuSelectionManager.java
+++ b/javax/swing/MenuSelectionManager.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package javax.swing;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
@@ -249,14 +247,59 @@ public class MenuSelectionManager
}
/**
- * DOCUMENT ME!
+ * Processes key events on behalf of the MenuElements. MenuElement
+ * instances should always forward their key events to this method and
+ * get their {@link MenuElement#processKeyEvent(KeyEvent, MenuElement[],
+ * MenuSelectionManager)} eventually called back.
*
- * @param e DOCUMENT ME!
+ * @param e the key event
*/
public void processKeyEvent(KeyEvent e)
- throws NotImplementedException
{
- throw new UnsupportedOperationException("not implemented");
+ MenuElement[] selection = (MenuElement[])
+ selectedPath.toArray(new MenuElement[selectedPath.size()]);
+ MenuElement[] path;
+ for (int index = selection.length - 1; index >= 0; index--)
+ {
+ MenuElement el = selection[index];
+ // This method's main purpose is to forward key events to the
+ // relevant menu items, so that they can act in response to their
+ // mnemonics beeing typed. So we also need to forward the key event
+ // to all the subelements of the currently selected menu elements
+ // in the path.
+ MenuElement[] subEls = el.getSubElements();
+ path = null;
+ for (int subIndex = 0; subIndex < subEls.length; subIndex++)
+ {
+ MenuElement sub = subEls[subIndex];
+ // Skip elements that are not showing or not enabled.
+ if (sub == null || ! sub.getComponent().isShowing()
+ || ! sub.getComponent().isEnabled())
+ {
+ continue;
+ }
+
+ if (path == null)
+ {
+ path = new MenuElement[index + 2];
+ System.arraycopy(selection, 0, path, 0, index + 1);
+ }
+ path[index + 1] = sub;
+ sub.processKeyEvent(e, path, this);
+ if (e.isConsumed())
+ break;
+ }
+ if (e.isConsumed())
+ break;
+ }
+
+ // Dispatch to first element in selection if it hasn't been consumed.
+ if (! e.isConsumed())
+ {
+ path = new MenuElement[1];
+ path[0] = selection[0];
+ path[0].processKeyEvent(e, path, this);
+ }
}
/**
@@ -363,7 +406,7 @@ public class MenuSelectionManager
{
oldSelectedItem = (MenuElement) selectedPath.get(i);
- if (path[i].equals(oldSelectedItem))
+ if ((i + 1) < path.length && path[i + 1].equals(oldSelectedItem))
break;
oldSelectedItem.menuSelectionChanged(false);
diff --git a/javax/swing/RepaintManager.java b/javax/swing/RepaintManager.java
index 8a025ece5..a5e0379f6 100644
--- a/javax/swing/RepaintManager.java
+++ b/javax/swing/RepaintManager.java
@@ -43,7 +43,6 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
-import java.awt.Window;
import java.awt.image.VolatileImage;
import java.util.ArrayList;
import java.util.Collections;
@@ -414,7 +413,6 @@ public class RepaintManager
{
if (w <= 0 || h <= 0 || !component.isShowing())
return;
-
component.computeVisibleRect(rectCache);
SwingUtilities.computeIntersection(x, y, w, h, rectCache);
@@ -663,8 +661,7 @@ public class RepaintManager
dy1 = Math.min(bufferHeight, dy1);
dx2 = Math.min(bufferWidth, dx2);
dy2 = Math.min(bufferHeight, dy2);
- g.drawImage(buffer, dx1, dy1, dx2, dy2,
- dx1, dy1, dx2, dy2, root);
+ g.drawImage(buffer, 0, 0, root);
g.dispose();
}
// Otherwise queue this request up, until all the RepaintManager work
diff --git a/javax/swing/ScrollPaneLayout.java b/javax/swing/ScrollPaneLayout.java
index b00b5c4e7..9f6829f4d 100644
--- a/javax/swing/ScrollPaneLayout.java
+++ b/javax/swing/ScrollPaneLayout.java
@@ -350,27 +350,49 @@ public class ScrollPaneLayout
int vsbPolicy = sc.getVerticalScrollBarPolicy();
int hsbPolicy = sc.getHorizontalScrollBarPolicy();
+
+ int vsWidth = 0;
+ int hsHeight = 0;
boolean showVsb =
(vsb != null)
&& ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS)
|| (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED
&& viewSize.height > (y4 - y2)));
+
+ if (showVsb)
+ vsWidth = vsb.getPreferredSize().width;
+
+ // The horizontal scroll bar may become necessary if the vertical scroll
+ // bar appears, reducing the space, left for the component.
+
boolean showHsb =
(hsb != null)
&& ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS)
|| (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED
- && viewSize.width > (x4 - x2)));
-
+ && viewSize.width > (x4 - x2 - vsWidth)));
+
+ if (showHsb)
+ hsHeight = hsb.getPreferredSize().height;
+
+ // If the horizontal scroll bar appears, and the vertical scroll bar
+ // was not necessary assuming that there is no horizontal scroll bar,
+ // the vertical scroll bar may become necessary because the horizontal
+ // scroll bar reduces the vertical space for the component.
if (!showVsb)
- x3 = x4;
- else
- x3 = x4 - vsb.getPreferredSize().width;
+ {
+ showVsb =
+ (vsb != null)
+ && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS)
+ || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED
+ && viewSize.height > (y4 - y2)));
+
+ if (showVsb)
+ vsWidth = vsb.getPreferredSize().width;
+ }
- if (!showHsb)
- y3 = y4;
- else
- y3 = y4 - hsb.getPreferredSize().height;
+ x3 = x4 - vsWidth;
+ y3 = y4 - hsHeight;
// now set the layout
if (viewport != null)
diff --git a/javax/swing/SizeSequence.java b/javax/swing/SizeSequence.java
index dff966b3e..26099a154 100644
--- a/javax/swing/SizeSequence.java
+++ b/javax/swing/SizeSequence.java
@@ -1,5 +1,5 @@
/* SizeSequence.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,20 +38,22 @@ exception statement from your version. */
package javax.swing;
/**
- * SizeSequence
+ * A sequence of values that represent the dimensions (widths or heights) of
+ * some collection of items (for example, the widths of the columns in a table).
+ *
* @author Andrew Selkirk
- * @version 1.0
*/
public class SizeSequence
{
+ // TODO: Sun's API specification for this class contains an implementation
+ // note regarding the encoding for the element sizes. We currently use the
+ // simple size encoding but we should look at improving this.
- /**
- * sizes
- */
- private int[] sizes = new int[0];
+ /** Storage for the element sizes. */
+ private int[] sizes;
/**
- * Constructor SizeSequence
+ * Creates a new empty <code>SizeSequence</code> instance.
*/
public SizeSequence()
{
@@ -59,8 +61,10 @@ public class SizeSequence
}
/**
- * Constructor SizeSequence
- * @param numEntries TODO
+ * Creates a new <code>SizeSequence</code> instance with the specified number
+ * of elements, each having a size of 0.
+ *
+ * @param numEntries the number of elements.
*/
public SizeSequence(int numEntries)
{
@@ -68,48 +72,66 @@ public class SizeSequence
}
/**
- * Constructor SizeSequence
- * @param numEntries TODO
- * @param value TODO
+ * Creates a new <code>SizeSequence</code> instance with the specified number
+ * of elements all having the same size (<code>value</code>).
+ *
+ * @param numEntries the number of elements.
+ * @param value the value for each element.
*/
public SizeSequence(int numEntries, int value)
{
+ sizes = new int[0];
insertEntries(0, numEntries, value);
}
/**
- * Constructor SizeSequence
- * @param sizes TODO
+ * Creates a new <code>SizeSequence</code> instance using the specified
+ * element sizes.
+ *
+ * @param sizes the element sizes (<code>null</code> not permitted).
*/
public SizeSequence(int[] sizes)
{
- setSizes(sizes);
+ this.sizes = (int[]) sizes.clone();
}
/**
- * setSize
- * @param index TODO
- * @param size TODO
+ * Sets the size of the element at the specified index.
+ *
+ * @param index the index.
+ * @param size the size.
*/
public void setSize(int index, int size)
{
- sizes[index] = size;
+ if (index >= 0 && index < sizes.length)
+ sizes[index] = size;
}
/**
- * getIndex
- * @param position TODO
- * @returns int
+ * Returns the index of the element that contains the specified position.
+ *
+ * @param position the position.
+ *
+ * @return The index of the element that contains the specified position.
*/
public int getIndex(int position)
{
- return 0; // TODO
+ int i = 0;
+ int runningTotal = 0;
+ while (i < sizes.length && position >= runningTotal + sizes[i])
+ {
+ runningTotal += sizes[i];
+ i++;
+ }
+ return i;
}
/**
- * getSize
- * @param index TODO
- * @returns int
+ * Returns the size of the specified element.
+ *
+ * @param index the element index.
+ *
+ * @return The size of the specified element.
*/
public int getSize(int index)
{
@@ -117,122 +139,81 @@ public class SizeSequence
}
/**
- * setSizes
- * @param sizes TODO
+ * Sets the sizes for the elements in the sequence.
+ *
+ * @param sizes the element sizes (<code>null</code> not permitted).
*/
public void setSizes(int[] sizes)
{
- int index;
- // Initialize sizes.
- this.sizes = new int[sizes.length];
- for (index = 0; index < sizes.length; index++)
- this.sizes[index] = sizes[index];
-
+ this.sizes = (int[]) sizes.clone();
}
/**
- * getSizes
- * @returns int[]
+ * Returns an array containing the sizes for all the elements in the sequence.
+ *
+ * @return The element sizes.
*/
public int[] getSizes()
{
- int[] array;
- int index;
-
- // Create new array.
- array = new int[sizes.length];
- for (index = 0; index < sizes.length; index++)
- array[index] = sizes[index];
-
- // Return newly created array.
- return array;
-
+ return (int[]) sizes.clone();
}
/**
- * getPosition
- * @param index TODO
- * @returns int
+ * Returns the position of the specified element.
+ *
+ * @param index the element index.
+ *
+ * @return The position.
*/
public int getPosition(int index)
{
int position;
int loop;
-
- // Process sizes.
position = 0;
for (loop = 0; loop < index; loop++)
position += sizes[loop];
-
- // Return position.
return position;
}
/**
- * insertEntries
- * @param start TODO
- * @param length TODO
- * @param value TODO
+ * Inserts new entries into the sequence at the <code>start</code> position.
+ * There are <code>length</code> new entries each having the specified
+ * <code>value</code>.
+ *
+ * @param start the start element.
+ * @param length the number of elements to insert.
+ * @param value the size for each of the new elements.
*/
public void insertEntries(int start, int length, int value)
{
- int[] array;
- int index;
- int arrayIndex;
- int loop;
-
- // Create new array.
- array = new int[sizes.length + length];
- arrayIndex = 0;
- for (index = 0; index < sizes.length; index++)
- {
- if (index == start)
- {
- for (loop = 0; loop < length; loop++)
- {
- array[arrayIndex] = value;
- arrayIndex++;
- }
- }
- else
- {
- array[arrayIndex] = sizes[index];
- arrayIndex++;
- }
- }
-
- }
+ int[] newSizes = new int[sizes.length + length];
+ System.arraycopy(sizes, 0, newSizes, 0, start);
+ for (int i = start; i < start + length; i++)
+ newSizes[i] = value;
+ System.arraycopy(sizes, start, newSizes, start + length,
+ sizes.length - start);
+ sizes = newSizes;
+ }
/**
- * removeEntries
- * @param start TODO
- * @param length TODO
+ * Removes the element(s) at index <code>start</code> (the number of elements
+ * removed is <code>length</code>).
+ *
+ * @param start the index of the first element to remove.
+ * @param length the number of elements to remove.
*/
public void removeEntries(int start, int length)
{
- int[] array;
- int index;
- int arrayIndex;
-
// Sanity check.
if ((start + length) > sizes.length)
throw new IllegalArgumentException("Specified start/length that "
+ "is greater than available sizes");
- // Create new array.
- array = new int[sizes.length - length];
- arrayIndex = 0;
- for (index = 0; index < sizes.length; index++)
- {
- if (index == start)
- index += length - 1;
- else
- {
- array[arrayIndex] = sizes[index];
- arrayIndex++;
- }
- }
+ int[] newSizes = new int[sizes.length - length];
+ System.arraycopy(sizes, 0, newSizes, 0, start);
+ System.arraycopy(sizes, start + length, newSizes, start,
+ sizes.length - start - length);
+ sizes = newSizes;
}
-
}
diff --git a/javax/swing/UIManager.java b/javax/swing/UIManager.java
index f0c90ea7b..3b9166261 100644
--- a/javax/swing/UIManager.java
+++ b/javax/swing/UIManager.java
@@ -614,9 +614,11 @@ public class UIManager implements Serializable
* setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).
*/
public static void installLookAndFeel(LookAndFeelInfo info)
- throws NotImplementedException
{
- // FIXME: not yet implemented
+ LookAndFeelInfo[] newInstalled = new LookAndFeelInfo[installed.length + 1];
+ System.arraycopy(installed, 0, newInstalled, 0, installed.length);
+ newInstalled[newInstalled.length - 1] = info;
+ setInstalledLookAndFeels(newInstalled);
}
/**
@@ -635,9 +637,8 @@ public class UIManager implements Serializable
* Replaces the current array of installed LookAndFeelInfos.
*/
public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
- throws NotImplementedException
{
- // FIXME: not yet implemented.
+ installed = infos;
}
/**
diff --git a/javax/swing/ViewportLayout.java b/javax/swing/ViewportLayout.java
index 4fbe37f31..67b69eb28 100644
--- a/javax/swing/ViewportLayout.java
+++ b/javax/swing/ViewportLayout.java
@@ -120,23 +120,19 @@ public class ViewportLayout implements LayoutManager, Serializable
}
/**
- * Layout the view and viewport to respect the following rules. These are
- * not precisely the rules described in sun's javadocs, but they are the
- * rules which sun's swing implementation follows, if you watch its
- * behavior:
- *
- * <ol>
- *
- * <li>If the port is smaller than the view, leave the view at its
- * current size.</li>
+ * Layout the view and viewport to respect the following rules. These are not
+ * precisely the rules described in sun's javadocs, but they are the rules
+ * which sun's swing implementation follows, if you watch its behavior:
+ * <ol>
+ * <li>If the port is smaller than the view, leave the view at its current
+ * size.</li>
* <li>If the view is smaller than the port, the view is top aligned.</li>
- * <li>If the view tracks the port size, the view position is always zero
- * and the size equal to the viewport size</li>
+ * <li>If the view tracks the port size, the view position is always zero and
+ * the size equal to the viewport size</li>
* <li>In {@link JViewport#setViewSize(Dimension)}, the view size is never
* set smaller that its minimum size.</li>
- *
* </ol>
- *
+ *
* @see JViewport#getViewSize
* @see JViewport#setViewSize
* @see JViewport#getViewPosition
@@ -147,7 +143,7 @@ public class ViewportLayout implements LayoutManager, Serializable
// The way to interpret this function is basically to ignore the names
// of methods it calls, and focus on the variable names here. getViewRect
// doesn't, for example, return the view; it returns the port bounds in
- // view space. Likwise setViewPosition doesn't reposition the view; it
+ // view space. Likwise setViewPosition doesn't reposition the view; it
// positions the port, in view coordinates.
JViewport port = (JViewport) parent;
@@ -156,7 +152,7 @@ public class ViewportLayout implements LayoutManager, Serializable
if (view == null)
return;
- // These dimensions and positions are in *view space*. Do not mix
+ // These dimensions and positions are in *view space*. Do not mix
// variables in here from port space (eg. parent.getBounds()). This
// function should be entirely in view space, because the methods on
// the viewport require inputs in view space.
@@ -185,20 +181,23 @@ public class ViewportLayout implements LayoutManager, Serializable
portBounds.y = 0;
}
}
- else
+
+ // The scroll pane manages the view size itself.
+ if (! (port.getParent() instanceof JScrollPane) )
{
if (viewPref.width < portBounds.width)
viewPref.width = portBounds.width;
if (viewPref.height < portBounds.height)
viewPref.height = portBounds.height;
+ }
- // If the view is larger than the port, the port is top and right aligned.
- if (portLowerRight.x > viewPref.width)
- portBounds.x = 0;
+ // If the view is larger than the port, the port is top and right
+ // aligned.
+ if (portLowerRight.x > viewPref.width)
+ portBounds.x = 0;
- if (portLowerRight.y > viewPref.height)
- portBounds.y = 0;
- }
+ if (portLowerRight.y > viewPref.height)
+ portBounds.y = 0;
port.setViewSize(viewPref);
port.setViewPosition(portBounds.getLocation());
diff --git a/javax/swing/event/InternalFrameEvent.java b/javax/swing/event/InternalFrameEvent.java
index badfa80ac..4e289bfb7 100644
--- a/javax/swing/event/InternalFrameEvent.java
+++ b/javax/swing/event/InternalFrameEvent.java
@@ -1,5 +1,5 @@
/* InternalFrameEvent.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,6 +43,8 @@ import java.awt.AWTEvent;
import javax.swing.JInternalFrame;
/**
+ * An event that indicates a change to a {@link JInternalFrame} component.
+ *
* @author Andrew Selkirk
*/
public class InternalFrameEvent extends AWTEvent
@@ -50,55 +52,59 @@ public class InternalFrameEvent extends AWTEvent
private static final long serialVersionUID = -5204823611874873183L;
/**
- * Internal frame activated event
+ * Internal frame activated event.
*/
public static final int INTERNAL_FRAME_ACTIVATED = 25554;
/**
- * Internal frame closed event
+ * Internal frame closed event.
*/
public static final int INTERNAL_FRAME_CLOSED = 25551;
/**
- * Internal frame closing event
+ * Internal frame closing event.
*/
public static final int INTERNAL_FRAME_CLOSING = 25550;
/**
- * Internal frame deactivated event
+ * Internal frame deactivated event.
*/
public static final int INTERNAL_FRAME_DEACTIVATED = 25555;
/**
- * Internal frame deiconifed event
+ * Internal frame deiconifed event.
*/
public static final int INTERNAL_FRAME_DEICONIFIED = 25553;
/**
- * Internal frame frame first event
+ * Internal frame frame first event.
*/
public static final int INTERNAL_FRAME_FIRST = 25549;
/**
- * Internal frame iconified event
+ * Internal frame iconified event.
*/
public static final int INTERNAL_FRAME_ICONIFIED = 25552;
/**
- * Internal frame last event
+ * Internal frame last event.
*/
public static final int INTERNAL_FRAME_LAST = 25555;
/**
- * Internal frame opened event
+ * Internal frame opened event.
*/
public static final int INTERNAL_FRAME_OPENED = 25549;
/**
- * Creates a <code>JInternalFrameEvent</code> object.
+ * Creates a new <code>JInternalFrameEvent</code> instance.
*
- * @param source The source of this event.
- * @param id Then event ID of this event.
+ * @param source the source of this event (<code>null</code> not permitted).
+ * @param id the event ID of this event (see the constants defined by this
+ * class).
+ *
+ * @throws IllegalArgumentException if <code>source</code> is
+ * <code>null</code>.
*/
public InternalFrameEvent(JInternalFrame source, int id)
{
@@ -106,10 +112,43 @@ public class InternalFrameEvent extends AWTEvent
}
/**
- * Returns the <code>JInternalFrame</code> object stored in this event.
+ * Returns the <code>JInternalFrame</code> component that is the source for
+ * this event.
+ *
+ * @return The source.
+ *
+ * @since 1.3
*/
public JInternalFrame getInternalFrame()
{
return (JInternalFrame) source;
}
+
+ /**
+ * Returns a string that indicates the event id. This is used by the
+ * {@link #toString()} method.
+ *
+ * @return A string that indicates the event id.
+ */
+ public String paramString()
+ {
+ switch (id) {
+ case INTERNAL_FRAME_ACTIVATED:
+ return "INTERNAL_FRAME_ACTIVATED";
+ case INTERNAL_FRAME_CLOSED:
+ return "INTERNAL_FRAME_CLOSED";
+ case INTERNAL_FRAME_CLOSING:
+ return "INTERNAL_FRAME_CLOSING";
+ case INTERNAL_FRAME_DEACTIVATED:
+ return "INTERNAL_FRAME_DEACTIVATED";
+ case INTERNAL_FRAME_DEICONIFIED:
+ return "INTERNAL_FRAME_DEICONIFIED";
+ case INTERNAL_FRAME_ICONIFIED:
+ return "INTERNAL_FRAME_ICONIFIED";
+ case INTERNAL_FRAME_OPENED:
+ return "INTERNAL_FRAME_OPENED";
+ default:
+ return "unknown type";
+ }
+ }
}
diff --git a/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index d7e26669f..11980f6ca 100644
--- a/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -520,22 +520,22 @@ public class BasicInternalFrameTitlePane extends JComponent
}
/** The action command for the Close action. */
- protected static final String CLOSE_CMD = "Close";
+ protected static final String CLOSE_CMD;
/** The action command for the Minimize action. */
- protected static final String ICONIFY_CMD = "Minimize";
+ protected static final String ICONIFY_CMD;
/** The action command for the Maximize action. */
- protected static final String MAXIMIZE_CMD = "Maximize";
+ protected static final String MAXIMIZE_CMD;
/** The action command for the Move action. */
- protected static final String MOVE_CMD = "Move";
+ protected static final String MOVE_CMD;
/** The action command for the Restore action. */
- protected static final String RESTORE_CMD = "Restore";
+ protected static final String RESTORE_CMD;
/** The action command for the Size action. */
- protected static final String SIZE_CMD = "Size";
+ protected static final String SIZE_CMD;
/** The action associated with closing the JInternalFrame. */
protected Action closeAction;
@@ -614,6 +614,17 @@ public class BasicInternalFrameTitlePane extends JComponent
* This is package-private to avoid an accessor method.
*/
transient JLabel title;
+
+ static
+ {
+ // not constants in JDK
+ CLOSE_CMD = "Close";
+ ICONIFY_CMD = "Minimize";
+ MAXIMIZE_CMD = "Maximize";
+ MOVE_CMD = "Move";
+ RESTORE_CMD = "Restore";
+ SIZE_CMD = "Size";
+ }
/**
* Creates a new BasicInternalFrameTitlePane object that is used in the
diff --git a/javax/swing/plaf/basic/BasicLookAndFeel.java b/javax/swing/plaf/basic/BasicLookAndFeel.java
index b6c8b902b..78c16ef08 100644
--- a/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -38,14 +38,13 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import gnu.classpath.NotImplementedException;
-
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.SystemColor;
import java.awt.Toolkit;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
@@ -205,7 +204,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
*/
public BasicLookAndFeel()
{
- // TODO
+ // Nothing to do here.
}
/**
@@ -291,60 +290,138 @@ public abstract class BasicLookAndFeel extends LookAndFeel
/**
* Populates the <code>defaults</code> table with system color defaults.
+ *
+ * This sets up a couple of default values and passes them to
+ * {@link #loadSystemColors(UIDefaults, String[], boolean)}. If the
+ * look and feel is a native look and feel, these defaults may be overridden
+ * by the corresponding SystemColor constants.
*
* @param defaults the defaults table (<code>null</code> not permitted).
*/
protected void initSystemColorDefaults(UIDefaults defaults)
{
- Color highLight = new Color(249, 247, 246);
- Color light = new Color(239, 235, 231);
- Color shadow = new Color(139, 136, 134);
- Color darkShadow = new Color(16, 16, 16);
-
- Object[] uiDefaults;
- uiDefaults = new Object[] {
- "activeCaption", new ColorUIResource(0, 0, 128),
- "activeCaptionBorder", new ColorUIResource(Color.lightGray),
- "activeCaptionText", new ColorUIResource(Color.white),
- "control", new ColorUIResource(light),
- "controlDkShadow", new ColorUIResource(shadow),
- "controlHighlight", new ColorUIResource(highLight),
- "controlLtHighlight", new ColorUIResource(highLight),
- "controlShadow", new ColorUIResource(shadow),
- "controlText", new ColorUIResource(darkShadow),
- "desktop", new ColorUIResource(0, 92, 92),
- "inactiveCaption", new ColorUIResource(Color.gray),
- "inactiveCaptionBorder", new ColorUIResource(Color.lightGray),
- "inactiveCaptionText", new ColorUIResource(Color.lightGray),
- "info", new ColorUIResource(light),
- "infoText", new ColorUIResource(darkShadow),
- "menu", new ColorUIResource(light),
- "menuText", new ColorUIResource(darkShadow),
- "scrollbar", new ColorUIResource(light),
- "text", new ColorUIResource(Color.white),
- "textHighlight", new ColorUIResource(Color.black),
- "textHighlightText", new ColorUIResource(Color.white),
- "textInactiveText", new ColorUIResource(Color.gray),
- "textText", new ColorUIResource(Color.black),
- "window", new ColorUIResource(light),
- "windowBorder", new ColorUIResource(Color.black),
- "windowText", new ColorUIResource(darkShadow)
+ String[] defaultColors = new String[] {
+ "activeCaption", "#000080",
+ "activeCaptionBorder", "#C0C0C0",
+ "activeCaptionText", "#FFFFFF",
+ "control", "#C0C0C0",
+ "controlDkShadow", "#000000",
+ "controlHighlight", "#C0C0C0",
+ "controlLtHighlight", "#FFFFFF",
+ "controlShadow", "#808080",
+ "controlText", "#000000",
+ "desktop", "#005C5C",
+ "inactiveCaption", "#808080",
+ "inactiveCaptionBorder", "#C0C0C0",
+ "inactiveCaptionText", "#C0C0C0",
+ "info", "#FFFFE1",
+ "infoText", "#000000",
+ "menu", "#C0C0C0",
+ "menuText", "#000000",
+ "scrollbar", "#E0E0E0",
+ "text", "#C0C0C0",
+ "textHighlight", "#000080",
+ "textHighlightText", "#FFFFFF",
+ "textInactiveText", "#808080",
+ "textText", "#000000",
+ "window", "#FFFFFF",
+ "windowBorder", "#000000",
+ "windowText", "#000000"
};
- defaults.putDefaults(uiDefaults);
+ loadSystemColors(defaults, defaultColors, isNativeLookAndFeel());
}
/**
- * Loads the system colors. This method is not implemented yet.
- *
+ * Populates the <code>defaults</code> table with the system colors. If
+ * <code>useNative</code> is <code>true</code>, the table is populated
+ * with the constants in {@link SystemColor}, otherwise the
+ * <code>systemColors</code> parameter is decoded into the defaults table.
+ * The system colors array is made up of pairs, where the first entry is the
+ * name of the system color, and the second entry is a string denoting
+ * an RGB color value like &quot;#C0C0C0&quot;, which is decoded using
+ * {@link Color#decode(String)}.
+ *
* @param defaults the defaults table (<code>null</code> not permitted).
- * @param systemColors TODO
- * @param useNative TODO
+ * @param systemColors defaults to use when <code>useNative</code> is
+ * <code>false</code>
+ * @param useNative when <code>true</code>, installs the values of the
+ * SystemColor constants, when <code>false</code>, install the values
+ * from <code>systemColors</code>
*/
protected void loadSystemColors(UIDefaults defaults, String[] systemColors,
boolean useNative)
- throws NotImplementedException
{
- // TODO
+ if (useNative)
+ {
+ defaults.put("activeCaption",
+ new ColorUIResource(SystemColor.ACTIVE_CAPTION));
+ defaults.put("activeCaptionBorder",
+ new ColorUIResource(SystemColor.ACTIVE_CAPTION_BORDER));
+ defaults.put("activeCaptionText",
+ new ColorUIResource(SystemColor.ACTIVE_CAPTION_TEXT));
+ defaults.put("control",
+ new ColorUIResource(SystemColor.CONTROL));
+ defaults.put("controlDkShadow",
+ new ColorUIResource(SystemColor.CONTROL_DK_SHADOW));
+ defaults.put("controlHighlight",
+ new ColorUIResource(SystemColor.CONTROL_HIGHLIGHT));
+ defaults.put("controlLtHighlight",
+ new ColorUIResource(SystemColor.CONTROL_LT_HIGHLIGHT));
+ defaults.put("controlShadow",
+ new ColorUIResource(SystemColor.CONTROL_SHADOW));
+ defaults.put("controlText",
+ new ColorUIResource(SystemColor.CONTROL_TEXT));
+ defaults.put("desktop",
+ new ColorUIResource(SystemColor.DESKTOP));
+ defaults.put("inactiveCaption",
+ new ColorUIResource(SystemColor.INACTIVE_CAPTION));
+ defaults.put("inactiveCaptionBorder",
+ new ColorUIResource(SystemColor.INACTIVE_CAPTION_BORDER));
+ defaults.put("inactiveCaptionText",
+ new ColorUIResource(SystemColor.INACTIVE_CAPTION_TEXT));
+ defaults.put("info",
+ new ColorUIResource(SystemColor.INFO));
+ defaults.put("infoText",
+ new ColorUIResource(SystemColor.INFO_TEXT));
+ defaults.put("menu",
+ new ColorUIResource(SystemColor.MENU));
+ defaults.put("menuText",
+ new ColorUIResource(SystemColor.MENU_TEXT));
+ defaults.put("scrollbar",
+ new ColorUIResource(SystemColor.SCROLLBAR));
+ defaults.put("text",
+ new ColorUIResource(SystemColor.TEXT));
+ defaults.put("textHighlight",
+ new ColorUIResource(SystemColor.TEXT_HIGHLIGHT));
+ defaults.put("textHighlightText",
+ new ColorUIResource(SystemColor.TEXT_HIGHLIGHT_TEXT));
+ defaults.put("textInactiveText",
+ new ColorUIResource(SystemColor.TEXT_INACTIVE_TEXT));
+ defaults.put("textText",
+ new ColorUIResource(SystemColor.TEXT_TEXT));
+ defaults.put("window",
+ new ColorUIResource(SystemColor.WINDOW));
+ defaults.put("windowBorder",
+ new ColorUIResource(SystemColor.WINDOW_BORDER));
+ defaults.put("windowText",
+ new ColorUIResource(SystemColor.WINDOW_TEXT));
+ }
+ else
+ {
+ for (int i = 0; i < systemColors.length; i += 2)
+ {
+ Color color = Color.BLACK;
+ try
+ {
+ color = Color.decode(systemColors[i + 1]);
+ }
+ catch (NumberFormatException e)
+ {
+ e.printStackTrace();
+ }
+ defaults.put(systemColors[i], new ColorUIResource(color));
+ }
+ }
}
/**
diff --git a/javax/swing/plaf/basic/BasicMenuItemUI.java b/javax/swing/plaf/basic/BasicMenuItemUI.java
index 9166c49ee..69c9c4507 100644
--- a/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -40,6 +40,7 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
@@ -82,6 +83,7 @@ import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentInputMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuItemUI;
+import javax.swing.text.View;
/**
* UI Delegate for JMenuItem.
@@ -183,7 +185,43 @@ public class BasicMenuItemUI extends MenuItemUI
/** A PropertyChangeListener to make UI updates after property changes **/
PropertyChangeHandler propertyChangeListener;
-
+
+ /**
+ * The view rectangle used for layout of the menu item.
+ */
+ private Rectangle viewRect;
+
+ /**
+ * The rectangle that holds the area of the label.
+ */
+ private Rectangle textRect;
+
+ /**
+ * The rectangle that holds the area of the accelerator.
+ */
+ private Rectangle accelRect;
+
+ /**
+ * The rectangle that holds the area of the icon.
+ */
+ private Rectangle iconRect;
+
+ /**
+ * The rectangle that holds the area of the icon.
+ */
+ private Rectangle arrowIconRect;
+
+ /**
+ * The rectangle that holds the area of the check icon.
+ */
+ private Rectangle checkIconRect;
+
+ /**
+ * A rectangle used for temporary storage to avoid creation of new
+ * rectangles.
+ */
+ private Rectangle cachedRect;
+
/**
* A class to handle PropertChangeEvents for the JMenuItem
* @author Anthony Balkissoon abalkiss at redhat dot com.
@@ -242,6 +280,15 @@ public class BasicMenuItemUI extends MenuItemUI
menuKeyListener = createMenuKeyListener(menuItem);
itemListener = new ItemHandler();
propertyChangeListener = new PropertyChangeHandler();
+
+ // Initialize rectangles for layout.
+ viewRect = new Rectangle();
+ textRect = new Rectangle();
+ iconRect = new Rectangle();
+ arrowIconRect = new Rectangle();
+ checkIconRect = new Rectangle();
+ accelRect = new Rectangle();
+ cachedRect = new Rectangle();
}
/**
@@ -378,50 +425,69 @@ public class BasicMenuItemUI extends MenuItemUI
int defaultTextIconGap)
{
JMenuItem m = (JMenuItem) c;
- Dimension d = BasicGraphicsUtils.getPreferredButtonSize(m,
- defaultTextIconGap);
-
- // if menu item has accelerator then take accelerator's size into account
- // when calculating preferred size.
- KeyStroke accelerator = m.getAccelerator();
- Rectangle rect;
-
- if (accelerator != null)
+ String accelText = getAcceleratorString(m);
+
+ // Layout the menu item. The result gets stored in the rectangle
+ // fields of this class.
+ layoutMenuItem(m, accelText);
+
+ // The union of the text and icon areas is the label area.
+ cachedRect.setBounds(textRect);
+ Rectangle pref = SwingUtilities.computeUnion(iconRect.x, iconRect.y,
+ iconRect.width,
+ iconRect.height,
+ cachedRect);
+
+ // Find the widest menu item text and accelerator and store it in
+ // client properties of the parent, so that we can align the accelerators
+ // properly. Of course, we only need can do this, if the parent is
+ // a JComponent and this menu item is not a toplevel menu.
+ Container parent = m.getParent();
+ if (parent != null && parent instanceof JComponent
+ && !(m instanceof JMenu && ((JMenu) m).isTopLevelMenu()))
{
- rect = getAcceleratorRect(
- accelerator,
- m.getToolkit().getFontMetrics(acceleratorFont));
+ JComponent p = (JComponent) parent;
- // add width of accelerator's text
- d.width += rect.width + defaultAcceleratorLabelGap;
+ // The widest text so far.
+ Integer maxTextWidth = (Integer) p.getClientProperty("maxTextWidth");
+ int maxTextValue = maxTextWidth == null ? 0 : maxTextWidth.intValue();
+ if (pref.width < maxTextValue)
+ pref.width = maxTextValue;
+ else
+ p.putClientProperty("maxTextWidth", new Integer(pref.width));
- // adjust the heigth of the preferred size if necessary
- if (d.height < rect.height)
- d.height = rect.height;
+ // The widest accelerator so far.
+ Integer maxAccelWidth = (Integer) p.getClientProperty("maxAccelWidth");
+ int maxAccelValue = maxAccelWidth == null ? 0
+ : maxAccelWidth.intValue();
+ if (accelRect.width > maxAccelValue)
+ {
+ maxAccelValue = accelRect.width;
+ p.putClientProperty("maxAccelWidth", new Integer(accelRect.width));
+ }
+ pref.width += maxAccelValue;
+ pref.width += defaultTextIconGap;
}
- if (checkIcon != null)
+ // Add arrow and check size if appropriate.
+ if (! (m instanceof JMenu && ((JMenu) m).isTopLevelMenu()))
{
- d.width += checkIcon.getIconWidth() + defaultTextIconGap;
-
- if (checkIcon.getIconHeight() > d.height)
- d.height = checkIcon.getIconHeight();
+ pref.width += checkIconRect.width;
+ pref.width += defaultTextIconGap;
+ pref.width += arrowIconRect.width;
+ pref.width += defaultTextIconGap;
}
- if (arrowIcon != null && (c instanceof JMenu))
- {
- int pWidth = m.getParent().getWidth();
- if (!((JMenu)c).isTopLevelMenu() && d.width < pWidth)
- d.width = pWidth
- - m.getInsets().left - m.getInsets().right;
- else
- d.width += arrowIcon.getIconWidth() + MenuGap;
-
- if (arrowIcon.getIconHeight() > d.height)
- d.height = arrowIcon.getIconHeight();
- }
-
- return d;
+ // Add a gap ~2 times as wide as the defaultTextIconGap.
+ pref.width += 2 * defaultTextIconGap;
+
+ // Respect the insets of the menu item.
+ Insets i = m.getInsets();
+ pref.width += i.left + i.right;
+ pref.height += i.top + i.bottom;
+
+ // Return a copy, so that nobody messes with our textRect.
+ return pref.getSize();
}
/**
@@ -541,7 +607,7 @@ public class BasicMenuItemUI extends MenuItemUI
*/
public void paint(Graphics g, JComponent c)
{
- paintMenuItem(g, c, checkIcon, arrowIcon, c.getBackground(),
+ paintMenuItem(g, c, checkIcon, arrowIcon, selectionBackground,
c.getForeground(), defaultTextIconGap);
}
@@ -560,16 +626,18 @@ public class BasicMenuItemUI extends MenuItemUI
// Menu item is considered to be highlighted when it is selected.
// But we don't want to paint the background of JCheckBoxMenuItems
ButtonModel mod = menuItem.getModel();
- if (menuItem.isContentAreaFilled())
+ Color saved = g.getColor();
+ if (mod.isArmed() || ((menuItem instanceof JMenu) && mod.isSelected()))
{
- if ((menuItem.isSelected() && checkIcon == null) || (mod != null &&
- mod.isArmed())
- && (menuItem.getParent() instanceof MenuElement))
- g.setColor(selectionBackground);
- else
- g.setColor(bgColor);
+ g.setColor(bgColor);
+ g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight());
+ }
+ else if (menuItem.isOpaque())
+ {
+ g.setColor(menuItem.getBackground());
g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight());
- }
+ }
+ g.setColor(saved);
}
/**
@@ -595,87 +663,123 @@ public class BasicMenuItemUI extends MenuItemUI
Color foreground, int defaultTextIconGap)
{
JMenuItem m = (JMenuItem) c;
- Rectangle tr = new Rectangle(); // text rectangle
- Rectangle ir = new Rectangle(); // icon rectangle
- Rectangle vr = new Rectangle(); // view rectangle
- Rectangle br = new Rectangle(); // border rectangle
- Rectangle ar = new Rectangle(); // accelerator rectangle
- Rectangle cr = new Rectangle(); // checkIcon rectangle
-
- int vertAlign = m.getVerticalAlignment();
- int horAlign = m.getHorizontalAlignment();
- int vertTextPos = m.getVerticalTextPosition();
- int horTextPos = m.getHorizontalTextPosition();
-
- Font f = m.getFont();
- g.setFont(f);
- FontMetrics fm = g.getFontMetrics(f);
- SwingUtilities.calculateInnerArea(m, vr);
+
+ // Fetch fonts.
+ Font oldFont = g.getFont();
+ Font font = c.getFont();
+ g.setFont(font);
+ FontMetrics accelFm = m.getFontMetrics(acceleratorFont);
+
+ // Create accelerator string.
+ String accelText = getAcceleratorString(m);
+
+ // Layout menu item. The result gets stored in the rectangle fields
+ // of this class.
+ layoutMenuItem(m, accelText);
+
+ // Paint the background.
paintBackground(g, m, background);
- /*
- * MenuItems insets are equal to menuItems margin, space between text and
- * menuItems border. We need to paint insets region as well.
- */
- Insets insets = m.getInsets();
- br.x -= insets.left;
- br.y -= insets.top;
- br.width += insets.right + insets.left;
- br.height += insets.top + insets.bottom;
+ Color oldColor = g.getColor();
- // If this menu item is a JCheckBoxMenuItem then paint check icon
+ // Paint the check icon.
if (checkIcon != null)
{
- SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign,
- horAlign, vertTextPos, horTextPos,
- vr, cr, tr, defaultTextIconGap);
- 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
- // checkIcon.width + defaultTextIconGap.
- vr.x = cr.x + cr.width + defaultTextIconGap;
+ checkIcon.paintIcon(m, g, checkIconRect.x, checkIconRect.y);
+ }
+
+ // Paint the icon.
+ ButtonModel model = m.getModel();
+ if (m.getIcon() != null)
+ {
+ // Determine icon depending on the menu item
+ // state (normal/disabled/pressed).
+ Icon icon;
+ if (! m.isEnabled())
+ {
+ icon = m.getDisabledIcon();
+ }
+ else if (model.isPressed() && model.isArmed())
+ {
+ icon = m.getPressedIcon();
+ if (icon == null)
+ {
+ icon = m.getIcon();
+ }
+ }
+ else
+ {
+ icon = m.getIcon();
+ }
+
+ if (icon != null)
+ {
+ icon.paintIcon(m, g, iconRect.x, iconRect.y);
+ }
}
- // if this is a submenu, then paint arrow icon to indicate it.
- if (arrowIcon != null && (c instanceof JMenu))
+ // Paint the text.
+ String text = m.getText();
+ if (text != null)
{
- if (!((JMenu) c).isTopLevelMenu())
+ // Handle HTML.
+ View html = (View) m.getClientProperty(BasicHTML.propertyKey);
+ if (html != null)
+ {
+ html.paint(g, textRect);
+ }
+ else
{
- int width = arrowIcon.getIconWidth();
- int height = arrowIcon.getIconHeight();
- int offset = (vr.height - height) / 2;
- arrowIcon.paintIcon(m, g, vr.width - width, vr.y + offset);
+ paintText(g, m, textRect, text);
}
}
- // paint text and user menu icon if it exists
- Icon i = m.getIcon();
- SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign,
- horAlign, vertTextPos, horTextPos, vr,
- ir, tr, defaultTextIconGap);
- if (i != null)
- i.paintIcon(c, g, ir.x, ir.y);
- paintText(g, m, tr, m.getText());
+ // Paint accelerator text.
+ if (! accelText.equals(""))
+ {
+ // Align the accelerator text. In getPreferredMenuItemSize() we
+ // store a client property 'maxAccelWidth' in the parent which holds
+ // the maximum accelerator width for the children of this parent.
+ // We use this here to align the accelerators properly.
+ int accelOffset = 0;
+ Container parent = m.getParent();
+ if (parent != null && parent instanceof JComponent)
+ {
+ JComponent p = (JComponent) parent;
+ Integer maxAccelWidth =
+ (Integer) p.getClientProperty("maxAccelWidth");
+ int maxAccelValue = maxAccelWidth == null ? 0
+ : maxAccelWidth.intValue();
+ accelOffset = maxAccelValue - accelRect.width;
+ }
- // paint accelerator
- String acceleratorText = "";
+ g.setFont(acceleratorFont);
+ if (! m.isEnabled())
+ {
+ // Paint accelerator disabled.
+ g.setColor(disabledForeground);
+ }
+ else
+ {
+ if (m.isArmed() || (m instanceof JMenu && m.isSelected()))
+ g.setColor(acceleratorSelectionForeground);
+ else
+ g.setColor(acceleratorForeground);
+ }
+ g.drawString(accelText, accelRect.x - accelOffset,
+ accelRect.y + accelFm.getAscent());
+ }
- if (m.getAccelerator() != null)
+ // Paint arrow.
+ if (arrowIcon != null
+ && ! (m instanceof JMenu && ((JMenu) m).isTopLevelMenu()))
{
- acceleratorText = getAcceleratorText(m.getAccelerator());
- fm = g.getFontMetrics(acceleratorFont);
- ar.width = fm.stringWidth(acceleratorText);
- ar.x = br.width - ar.width;
- vr.x = br.width - ar.width - defaultTextIconGap;
-
- SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null,
- vertAlign, horAlign, vertTextPos,
- horTextPos, vr, ir, ar,
- defaultTextIconGap);
-
- paintAccelerator(g, m, ar, acceleratorText);
+ arrowIcon.paintIcon(m, g, arrowIconRect.x, arrowIconRect.y);
}
+
+ g.setFont(oldFont);
+ g.setColor(oldColor);
+
}
/**
@@ -860,37 +964,6 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Paints accelerator inside menu item
- *
- * @param g
- * The graphics context used to paint the border
- * @param menuItem
- * Menu item for which to draw accelerator
- * @param acceleratorRect
- * rectangle representing position of the accelerator relative to the
- * menu item
- * @param acceleratorText
- * accelerator's text
- */
- private void paintAccelerator(Graphics g, JMenuItem menuItem,
- Rectangle acceleratorRect,
- String acceleratorText)
- {
- g.setFont(acceleratorFont);
- FontMetrics fm = g.getFontMetrics(acceleratorFont);
-
- if (menuItem.isEnabled())
- g.setColor(acceleratorForeground);
- else
- // FIXME: should fix this to use 'disabledForeground', but its
- // default value in BasicLookAndFeel is null.
- g.setColor(Color.gray);
-
- BasicGraphicsUtils.drawString(g, acceleratorText, 0, acceleratorRect.x,
- acceleratorRect.y + fm.getAscent());
- }
-
- /**
* This class handles mouse events occuring inside the menu item. Most of the
* events are forwarded for processing to MenuSelectionManager of the current
* menu hierarchy.
@@ -1139,4 +1212,134 @@ public class BasicMenuItemUI extends MenuItemUI
menuItem.repaint();
}
}
+
+ /**
+ * A helper method to create the accelerator string from the menu item's
+ * accelerator property. The returned string is empty if there is
+ * no accelerator defined.
+ *
+ * @param m the menu item
+ *
+ * @return the accelerator string, not null
+ */
+ private String getAcceleratorString(JMenuItem m)
+ {
+ // Create accelerator string.
+ KeyStroke accel = m.getAccelerator();
+ String accelText = "";
+ if (accel != null)
+ {
+ int mods = accel.getModifiers();
+ if (mods > 0)
+ {
+ accelText = KeyEvent.getKeyModifiersText(mods);
+ accelText += acceleratorDelimiter;
+ }
+ int keycode = accel.getKeyCode();
+ if (keycode != 0)
+ accelText += KeyEvent.getKeyText(keycode);
+ else
+ accelText += accel.getKeyChar();
+ }
+ return accelText;
+ }
+
+ /**
+ * A helper method that lays out the menu item. The layout is stored
+ * in the fields of this class.
+ *
+ * @param m the menu item to layout
+ * @param accelText the accelerator text
+ */
+ private void layoutMenuItem(JMenuItem m, String accelText)
+ {
+ int width = m.getWidth();
+ int height = m.getHeight();
+
+ // Reset rectangles.
+ iconRect.setBounds(0, 0, 0, 0);
+ textRect.setBounds(0, 0, 0, 0);
+ accelRect.setBounds(0, 0, 0, 0);
+ checkIconRect.setBounds(0, 0, 0, 0);
+ arrowIconRect.setBounds(0, 0, 0, 0);
+ viewRect.setBounds(0, 0, width, height);
+
+ // Substract insets to the view rect.
+ Insets insets = m.getInsets();
+ viewRect.x += insets.left;
+ viewRect.y += insets.top;
+ viewRect.width -= (insets.left + insets.right);
+ viewRect.height -= (insets.top + insets.bottom);
+
+ // Fetch the fonts.
+ Font font = m.getFont();
+ FontMetrics fm = m.getFontMetrics(font);
+ FontMetrics accelFm = m.getFontMetrics(acceleratorFont);
+
+ String text = m.getText();
+ SwingUtilities.layoutCompoundLabel(m, fm, text, m.getIcon(),
+ m.getVerticalAlignment(),
+ m.getHorizontalAlignment(),
+ m.getVerticalTextPosition(),
+ m.getHorizontalTextPosition(),
+ viewRect, iconRect, textRect,
+ defaultTextIconGap);
+
+ // Initialize accelerator width and height.
+ if (! accelText.equals(""))
+ {
+ accelRect.width = accelFm.stringWidth(accelText);
+ accelRect.height = accelFm.getHeight();
+ }
+
+ // Initialize check and arrow icon width and height.
+ if (! (m instanceof JMenu && ((JMenu) m).isTopLevelMenu()))
+ {
+ if (checkIcon != null)
+ {
+ checkIconRect.width = checkIcon.getIconWidth();
+ checkIconRect.height = checkIcon.getIconHeight();
+ }
+ if (arrowIcon != null)
+ {
+ arrowIconRect.width = arrowIcon.getIconWidth();
+ arrowIconRect.height = arrowIcon.getIconHeight();
+ }
+ }
+
+ // The union of the icon and text of the menu item is the 'label area'.
+ cachedRect.setBounds(textRect);
+ Rectangle labelRect = SwingUtilities.computeUnion(iconRect.x,
+ iconRect.y,
+ iconRect.width,
+ iconRect.height,
+ cachedRect);
+ textRect.x += defaultTextIconGap;
+ iconRect.x += defaultTextIconGap;
+
+ // Layout accelerator rect.
+ accelRect.x = viewRect.x + viewRect.width - arrowIconRect.width
+ - defaultTextIconGap - accelRect.width;
+ // Layout check and arrow icons only when not in toplevel menu.
+ if (! (m instanceof JMenu && ((JMenu) m).isTopLevelMenu()))
+ {
+ checkIconRect.x = viewRect.x + defaultTextIconGap;
+ textRect.x += defaultTextIconGap + checkIconRect.width;
+ iconRect.x += defaultTextIconGap + checkIconRect.width;
+ arrowIconRect.x = viewRect.x + viewRect.width - defaultTextIconGap
+ - arrowIconRect.width;
+ }
+
+ // Align the accelerator text and all the icons vertically centered to
+ // the menu text.
+ accelRect.y = labelRect.y + (labelRect.height / 2)
+ - (accelRect.height / 2);
+ if (! (m instanceof JMenu && ((JMenu) m).isTopLevelMenu()))
+ {
+ arrowIconRect.y = labelRect.y + (labelRect.height / 2)
+ - (arrowIconRect.height / 2);
+ checkIconRect.y = labelRect.y + (labelRect.height / 2)
+ - (checkIconRect.height / 2);
+ }
+ }
}
diff --git a/javax/swing/plaf/basic/BasicSliderUI.java b/javax/swing/plaf/basic/BasicSliderUI.java
index 694aa9612..9137ae9dc 100644
--- a/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/javax/swing/plaf/basic/BasicSliderUI.java
@@ -1,5 +1,5 @@
/* BasicSliderUI.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import gnu.classpath.NotImplementedException;
+
import java.awt.Color;
import java.awt.Component;
import java.awt.ComponentOrientation;
@@ -204,6 +206,7 @@ public class BasicSliderUI extends SliderUI
* @param e A {@link FocusEvent}.
*/
public void focusGained(FocusEvent e)
+ throws NotImplementedException
{
// FIXME: implement.
}
@@ -215,6 +218,7 @@ public class BasicSliderUI extends SliderUI
* @param e A {@link FocusEvent}.
*/
public void focusLost(FocusEvent e)
+ throws NotImplementedException
{
// FIXME: implement.
}
@@ -236,14 +240,16 @@ public class BasicSliderUI extends SliderUI
{
// Check for orientation changes.
if (e.getPropertyName().equals("orientation"))
- recalculateIfOrientationChanged();
+ recalculateIfOrientationChanged();
else if (e.getPropertyName().equals("model"))
{
- BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
- oldModel.removeChangeListener(changeListener);
- slider.getModel().addChangeListener(changeListener);
- calculateThumbLocation();
+ BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
+ oldModel.removeChangeListener(changeListener);
+ slider.getModel().addChangeListener(changeListener);
+ calculateThumbLocation();
}
+ else if (e.getPropertyName().equals("paintTicks"))
+ calculateGeometry();
// elif the componentOrientation changes (this is a bound property,
// just undocumented) we change leftToRightCache. In Sun's
@@ -304,14 +310,14 @@ public class BasicSliderUI extends SliderUI
{
if (! trackListener.shouldScroll(direction))
{
- scrollTimer.stop();
- return;
+ scrollTimer.stop();
+ return;
}
if (block)
- scrollByBlock(direction);
+ scrollByBlock(direction);
else
- scrollByUnit(direction);
+ scrollByUnit(direction);
}
/**
@@ -416,7 +422,8 @@ public class BasicSliderUI extends SliderUI
if (slider.getSnapToTicks())
value = findClosestTick(value);
- // If the thumb is hit, then we don't need to set the timers to move it.
+ // If the thumb is hit, then we don't need to set the timers to
+ // move it.
if (! thumbRect.contains(e.getPoint()))
{
// The mouse has hit some other part of the slider.
@@ -469,14 +476,14 @@ public class BasicSliderUI extends SliderUI
{
int value;
if (slider.getOrientation() == JSlider.HORIZONTAL)
- value = valueForXPosition(currentMouseX);
+ value = valueForXPosition(currentMouseX);
else
- value = valueForYPosition(currentMouseY);
+ value = valueForYPosition(currentMouseY);
if (direction == POSITIVE_SCROLL)
- return (value > slider.getValue());
+ return (value > slider.getValue());
else
- return (value < slider.getValue());
+ return (value < slider.getValue());
}
}
@@ -652,35 +659,35 @@ public class BasicSliderUI extends SliderUI
super.installUI(c);
if (c instanceof JSlider)
{
- slider = (JSlider) c;
+ slider = (JSlider) c;
- focusRect = new Rectangle();
- contentRect = new Rectangle();
- thumbRect = new Rectangle();
- trackRect = new Rectangle();
- tickRect = new Rectangle();
- labelRect = new Rectangle();
+ focusRect = new Rectangle();
+ contentRect = new Rectangle();
+ thumbRect = new Rectangle();
+ trackRect = new Rectangle();
+ tickRect = new Rectangle();
+ labelRect = new Rectangle();
- insetCache = slider.getInsets();
- leftToRightCache = ! slider.getInverted();
+ insetCache = slider.getInsets();
+ leftToRightCache = ! slider.getInverted();
- scrollTimer = new Timer(200, null);
- scrollTimer.setRepeats(true);
+ scrollTimer = new Timer(200, null);
+ scrollTimer.setRepeats(true);
- installDefaults(slider);
- installListeners(slider);
- installKeyboardActions(slider);
+ installDefaults(slider);
+ installListeners(slider);
+ installKeyboardActions(slider);
- calculateFocusRect();
+ calculateFocusRect();
- calculateContentRect();
- calculateThumbSize();
- calculateTrackBuffer();
- calculateTrackRect();
- calculateThumbLocation();
+ calculateContentRect();
+ calculateThumbSize();
+ calculateTrackBuffer();
+ calculateTrackRect();
+ calculateThumbLocation();
- calculateTickRect();
- calculateLabelRect();
+ calculateTickRect();
+ calculateLabelRect();
}
}
@@ -864,6 +871,7 @@ public class BasicSliderUI extends SliderUI
* installed.
*/
protected void installKeyboardActions(JSlider slider)
+ throws NotImplementedException
{
// FIXME: implement.
}
@@ -876,6 +884,7 @@ public class BasicSliderUI extends SliderUI
* uninstalled.
*/
protected void uninstallKeyboardActions(JSlider slider)
+ throws NotImplementedException
{
// FIXME: implement.
}
@@ -908,8 +917,7 @@ public class BasicSliderUI extends SliderUI
// The width should cover all the labels (which are usually the
// deciding factor of the width)
int width = getWidthOfWidestLabel() * (slider.getLabelTable() == null ? 0
- : slider.getLabelTable()
- .size());
+ : slider.getLabelTable().size());
// If there are not enough labels.
// This number is pretty much arbitrary, but it looks nice.
@@ -1129,8 +1137,8 @@ public class BasicSliderUI extends SliderUI
}
/**
- * This method calculates the size but not the position of the thumbRect. It
- * must take into account the orientation of the slider.
+ * Sets the width and height of the <code>thumbRect</code> field, using the
+ * dimensions returned by {@link #getThumbSize()}.
*/
protected void calculateThumbSize()
{
@@ -1144,8 +1152,9 @@ public class BasicSliderUI extends SliderUI
}
/**
- * This method calculates the size and position of the contentRect. This
- * method does not need to be called if the orientation changes.
+ * Updates the <code>contentRect</code> field to an area inside the
+ * <code>focusRect</code>. This method does not need to be called if the
+ * orientation changes.
*/
protected void calculateContentRect()
{
@@ -1172,36 +1181,50 @@ public class BasicSliderUI extends SliderUI
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
- thumbRect.y = trackRect.y;
+ thumbRect.x = xPositionForValue(value) - thumbRect.width / 2;
+ thumbRect.y = trackRect.y;
}
else
{
- thumbRect.x = trackRect.x;
- thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
+ thumbRect.x = trackRect.x;
+ thumbRect.y = yPositionForValue(value) - thumbRect.height / 2;
}
}
/**
- * Calculates the gap size between the left edge of the contentRect and the
- * left edge of the trackRect.
+ * Calculates the gap size between the edge of the <code>contentRect</code>
+ * and the edge of the <code>trackRect</code>, storing the result in the
+ * <code>trackBuffer</code> field. Sufficient space needs to be reserved
+ * for the slider thumb and/or the labels at each end of the slider track.
*/
protected void calculateTrackBuffer()
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
- trackBuffer = thumbRect.width / 2;
+ {
+ int w = Math.max(getWidthOfLowValueLabel(), getWidthOfHighValueLabel());
+ trackBuffer = Math.max(thumbRect.width / 2, w / 2);
+
+ }
else
- trackBuffer = thumbRect.height / 2;
+ {
+ int h = Math.max(getHeightOfLowValueLabel(),
+ getHeightOfHighValueLabel());
+ trackBuffer = Math.max(thumbRect.height / 2, h / 2);
+ }
}
/**
- * This method returns the size of the thumbRect.
+ * Returns the size of the slider's thumb. The size is hard coded to
+ * <code>11 x 20</code> for horizontal sliders, and <code>20 x 11</code> for
+ * vertical sliders. Note that a new instance of {@link Dimension} is
+ * returned for every call to this method (this seems wasteful, but
+ * {@link Dimension} instances are not immutable, so this is probably
+ * unavoidable).
*
- * @return The dimensions of the thumb.
+ * @return The size of the slider's thumb.
*/
protected Dimension getThumbSize()
{
- // TODO: shouldn't create new objects every time
if (slider.getOrientation() == JSlider.HORIZONTAL)
return new Dimension(11, 20);
else
@@ -1216,14 +1239,16 @@ public class BasicSliderUI extends SliderUI
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- trackRect.x = contentRect.x + trackBuffer;
+ trackRect.x = contentRect.x + trackBuffer;
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;
+ if (slider.getPaintLabels())
+ h += getHeightOfTallestLabel();
+ trackRect.y = contentRect.y + (contentRect.height - h) / 2 - 1;
+ trackRect.width = contentRect.width - 2 * trackBuffer;
+ trackRect.height = thumbRect.height;
}
else
{
@@ -1231,10 +1256,12 @@ public class BasicSliderUI extends SliderUI
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;
+ if (slider.getPaintLabels())
+ w += getWidthOfWidestLabel();
+ trackRect.x = contentRect.x + (contentRect.width - w) / 2 - 1;
+ trackRect.y = contentRect.y + trackBuffer;
+ trackRect.width = thumbRect.width;
+ trackRect.height = contentRect.height - 2 * trackBuffer;
}
}
@@ -1261,23 +1288,23 @@ public class BasicSliderUI extends SliderUI
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- tickRect.x = trackRect.x;
- tickRect.y = trackRect.y + trackRect.height;
- tickRect.width = trackRect.width;
- tickRect.height = getTickLength();
+ tickRect.x = trackRect.x;
+ tickRect.y = trackRect.y + trackRect.height;
+ tickRect.width = trackRect.width;
+ tickRect.height = (slider.getPaintTicks() ? getTickLength() : 0);
- if (tickRect.y + tickRect.height > contentRect.y + contentRect.height)
- tickRect.height = contentRect.y + contentRect.height - tickRect.y;
+ if (tickRect.y + tickRect.height > contentRect.y + contentRect.height)
+ tickRect.height = contentRect.y + contentRect.height - tickRect.y;
}
else
{
- tickRect.x = trackRect.x + trackRect.width;
- tickRect.y = trackRect.y;
- tickRect.width = getTickLength();
- tickRect.height = trackRect.height;
+ tickRect.x = trackRect.x + trackRect.width;
+ tickRect.y = trackRect.y;
+ tickRect.width = (slider.getPaintTicks() ? getTickLength() : 0);
+ tickRect.height = trackRect.height;
- if (tickRect.x + tickRect.width > contentRect.x + contentRect.width)
- tickRect.width = contentRect.x + contentRect.width - tickRect.x;
+ if (tickRect.x + tickRect.width > contentRect.x + contentRect.width)
+ tickRect.width = contentRect.x + contentRect.width - tickRect.x;
}
}
@@ -1289,17 +1316,17 @@ public class BasicSliderUI extends SliderUI
{
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- labelRect.x = contentRect.x;
- labelRect.y = tickRect.y + tickRect.height;
- labelRect.width = contentRect.width;
- labelRect.height = contentRect.height - labelRect.y;
+ labelRect.x = contentRect.x;
+ labelRect.y = tickRect.y + tickRect.height;
+ labelRect.width = contentRect.width;
+ labelRect.height = getHeightOfTallestLabel();
}
else
{
- labelRect.x = tickRect.x + tickRect.width;
- labelRect.y = contentRect.y;
- labelRect.width = contentRect.width - labelRect.x;
- labelRect.height = contentRect.height;
+ labelRect.x = tickRect.x + tickRect.width;
+ labelRect.y = contentRect.y;
+ labelRect.width = getWidthOfWidestLabel();
+ labelRect.height = contentRect.height;
}
}
@@ -1321,13 +1348,13 @@ public class BasicSliderUI extends SliderUI
for (Enumeration list = slider.getLabelTable().elements();
list.hasMoreElements();)
{
- Object comp = list.nextElement();
- if (! (comp instanceof Component))
- continue;
- label = (Component) comp;
- pref = label.getPreferredSize();
- if (pref != null && pref.width > widest)
- widest = pref.width;
+ Object comp = list.nextElement();
+ if (! (comp instanceof Component))
+ continue;
+ label = (Component) comp;
+ pref = label.getPreferredSize();
+ if (pref != null && pref.width > widest)
+ widest = pref.width;
}
return widest;
}
@@ -1349,50 +1376,54 @@ public class BasicSliderUI extends SliderUI
for (Enumeration list = slider.getLabelTable().elements();
list.hasMoreElements();)
{
- Object comp = list.nextElement();
- if (! (comp instanceof Component))
- continue;
- label = (Component) comp;
- pref = label.getPreferredSize();
- if (pref != null && pref.height > tallest)
- tallest = pref.height;
+ Object comp = list.nextElement();
+ if (! (comp instanceof Component))
+ continue;
+ label = (Component) comp;
+ pref = label.getPreferredSize();
+ if (pref != null && pref.height > tallest)
+ tallest = pref.height;
}
return tallest;
}
/**
- * This method returns the width of the label whose key has the highest
- * value.
+ * Returns the width of the label whose key has the highest value, or 0 if
+ * there are no labels.
*
- * @return The width of the high value label or 0 if no label table exists.
+ * @return The width of the label whose key has the highest value.
+ *
+ * @see #getHighestValueLabel()
*/
protected int getWidthOfHighValueLabel()
{
Component highValueLabel = getHighestValueLabel();
if (highValueLabel != null)
- return highValueLabel.getWidth();
+ return highValueLabel.getPreferredSize().width;
else
return 0;
}
/**
- * This method returns the width of the label whose key has the lowest
- * value.
+ * Returns the width of the label whose key has the lowest value, or 0 if
+ * there are no labels.
*
- * @return The width of the low value label or 0 if no label table exists.
+ * @return The width of the label whose key has the lowest value.
+ *
+ * @see #getLowestValueLabel()
*/
protected int getWidthOfLowValueLabel()
{
Component lowValueLabel = getLowestValueLabel();
if (lowValueLabel != null)
- return lowValueLabel.getWidth();
+ return lowValueLabel.getPreferredSize().width;
else
return 0;
}
/**
- * This method returns the height of the label whose key has the highest
- * value.
+ * Returns the height of the label whose key has the highest value, or 0 if
+ * there are no labels.
*
* @return The height of the high value label or 0 if no label table exists.
*/
@@ -1400,14 +1431,14 @@ public class BasicSliderUI extends SliderUI
{
Component highValueLabel = getHighestValueLabel();
if (highValueLabel != null)
- return highValueLabel.getHeight();
+ return highValueLabel.getPreferredSize().height;
else
return 0;
}
/**
- * This method returns the height of the label whose key has the lowest
- * value.
+ * Returns the height of the label whose key has the lowest value, or 0 if
+ * there are no labels.
*
* @return The height of the low value label or 0 if no label table exists.
*/
@@ -1415,19 +1446,20 @@ public class BasicSliderUI extends SliderUI
{
Component lowValueLabel = getLowestValueLabel();
if (lowValueLabel != null)
- return lowValueLabel.getHeight();
+ return lowValueLabel.getPreferredSize().height;
else
return 0;
}
/**
- * This method returns whether the slider is to be drawn inverted.
+ * Returns <code>true</code> if the slider scale is to be drawn inverted,
+ * and <code>false</code> if not.
*
- * @return True is the slider is to be drawn inverted.
+ * @return <code>true</code> if the slider is to be drawn inverted.
*/
protected boolean drawInverted()
{
- return ! (slider.getInverted() ^ leftToRightCache);
+ return slider.getInverted();
}
/**
@@ -1446,12 +1478,12 @@ public class BasicSliderUI extends SliderUI
for (Enumeration list = labelTable.keys(); list.hasMoreElements();)
{
- Object value = list.nextElement();
- if (! (value instanceof Integer))
- continue;
- tmpKey = (Integer) value;
- if (tmpKey.intValue() < key.intValue())
- key = tmpKey;
+ Object value = list.nextElement();
+ if (! (value instanceof Integer))
+ continue;
+ tmpKey = (Integer) value;
+ if (tmpKey.intValue() < key.intValue())
+ key = tmpKey;
}
Object comp = labelTable.get(key);
if (! (comp instanceof Component))
@@ -1460,9 +1492,10 @@ public class BasicSliderUI extends SliderUI
}
/**
- * This method returns the label whose key has the highest value.
+ * Returns the label whose key has the highest value.
*
- * @return The high value label or null if no label table exists.
+ * @return The label whose key has the highest value or <code>null</code> if
+ * no label table exists.
*/
protected Component getHighestValueLabel()
{
@@ -1475,12 +1508,12 @@ public class BasicSliderUI extends SliderUI
for (Enumeration list = labelTable.keys(); list.hasMoreElements();)
{
- Object value = list.nextElement();
- if (! (value instanceof Integer))
- continue;
- tmpKey = (Integer) value;
- if (tmpKey.intValue() > key.intValue())
- key = tmpKey;
+ Object value = list.nextElement();
+ if (! (value instanceof Integer))
+ continue;
+ tmpKey = (Integer) value;
+ if (tmpKey.intValue() > key.intValue())
+ key = tmpKey;
}
Object comp = labelTable.get(key);
if (! (comp instanceof Component))
@@ -1499,7 +1532,8 @@ public class BasicSliderUI extends SliderUI
public void paint(Graphics g, JComponent c)
{
// FIXME: Move this to propertyChangeEvent handler, when we get those.
- leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT;
+ leftToRightCache = slider.getComponentOrientation()
+ != ComponentOrientation.RIGHT_TO_LEFT;
// FIXME: This next line is only here because the above line is here.
calculateGeometry();
@@ -1608,23 +1642,23 @@ public class BasicSliderUI extends SliderUI
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- width = trackRect.width;
- height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4;
+ width = trackRect.width;
+ height = (thumbRect.height / 4 == 0) ? 1 : thumbRect.height / 4;
- a.translate(0, (trackRect.height / 2) - (height / 2));
- b.translate(0, (trackRect.height / 2) + (height / 2));
- c.translate(trackRect.width, (trackRect.height / 2) + (height / 2));
- d.translate(trackRect.width, (trackRect.height / 2) - (height / 2));
+ a.translate(0, (trackRect.height / 2) - (height / 2));
+ b.translate(0, (trackRect.height / 2) + (height / 2));
+ c.translate(trackRect.width, (trackRect.height / 2) + (height / 2));
+ d.translate(trackRect.width, (trackRect.height / 2) - (height / 2));
}
else
{
- width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4;
- height = trackRect.height;
+ width = (thumbRect.width / 4 == 0) ? 1 : thumbRect.width / 4;
+ height = trackRect.height;
- a.translate((trackRect.width / 2) - (width / 2), 0);
- b.translate((trackRect.width / 2) - (width / 2), trackRect.height);
- c.translate((trackRect.width / 2) + (width / 2), trackRect.height);
- d.translate((trackRect.width / 2) + (width / 2), 0);
+ a.translate((trackRect.width / 2) - (width / 2), 0);
+ b.translate((trackRect.width / 2) - (width / 2), trackRect.height);
+ c.translate((trackRect.width / 2) + (width / 2), trackRect.height);
+ d.translate((trackRect.width / 2) + (width / 2), 0);
}
g.setColor(Color.GRAY);
g.fillRect(a.x, a.y, width, height);
@@ -1656,86 +1690,42 @@ public class BasicSliderUI extends SliderUI
if (majorSpace > 0)
{
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- double loc = tickRect.x + 0.5;
- double increment = (max == min) ? 0
- : majorSpace * (double) (tickRect.width - 1) / (max - min);
- if (drawInverted())
- {
- loc += tickRect.width;
- increment *= -1;
- }
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
g.translate(0, tickRect.y);
- for (int i = min; i <= max; i += majorSpace)
- {
- paintMajorTickForHorizSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += majorSpace)
+ paintMajorTickForHorizSlider(g, tickRect, xPositionForValue(i));
g.translate(0, -tickRect.y);
- }
- else
- {
- double loc = tickRect.height + tickRect.y + 0.5;
- double increment = (max == min) ? 0
- : -majorSpace * (double) (tickRect.height - 1) / (max - min);
- if (drawInverted())
- {
- loc = tickRect.y + 0.5;
- increment *= -1;
- }
+ }
+ else // JSlider.VERTICAL
+ {
g.translate(tickRect.x, 0);
- for (int i = min; i <= max; i += majorSpace)
- {
- paintMajorTickForVertSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += majorSpace)
+ paintMajorTickForVertSlider(g, tickRect, yPositionForValue(i));
g.translate(-tickRect.x, 0);
- }
+ }
}
if (minorSpace > 0)
{
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- double loc = tickRect.x + 0.5;
- double increment = (max == min) ? 0
- : minorSpace * (double) (tickRect.width - 1) / (max - min);
- if (drawInverted())
- {
- loc += tickRect.width;
- increment *= -1;
- }
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
g.translate(0, tickRect.y);
- for (int i = min; i <= max; i += minorSpace)
- {
- paintMinorTickForHorizSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += minorSpace)
+ paintMinorTickForHorizSlider(g, tickRect, xPositionForValue(i));
g.translate(0, -tickRect.y);
- }
- else
- {
- double loc = tickRect.height + tickRect.y + 0.5;
- double increment = (max == min) ? 0
- : -minorSpace * (double) (tickRect.height - 1) / (max - min);
- if (drawInverted())
- {
- loc = tickRect.y + 0.5;
- increment *= -1;
- }
+ }
+ else
+ {
g.translate(tickRect.x, 0);
- for (int i = min; i <= max; i += minorSpace)
- {
- paintMinorTickForVertSlider(g, tickRect, (int) loc);
- loc += increment;
- }
+ for (int i = min; i <= max; i += minorSpace)
+ paintMinorTickForVertSlider(g, tickRect, yPositionForValue(i));
g.translate(-tickRect.x, 0);
- }
+ }
}
}
- /* Minor ticks start at 1/4 of the height (or width) of the tickRect and extend
- to 1/2 of the tickRect.
+ /* Minor ticks start at 1/4 of the height (or width) of the tickRect and
+ extend to 1/2 of the tickRect.
Major ticks start at 1/4 of the height and extend to 3/4.
*/
@@ -1828,45 +1818,45 @@ public class BasicSliderUI extends SliderUI
{
if (slider.getLabelTable() != null)
{
- Dictionary table = slider.getLabelTable();
- Integer tmpKey;
- Object key;
- Object element;
- Component label;
- if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- for (Enumeration list = table.keys(); list.hasMoreElements();)
- {
- key = list.nextElement();
- if (! (key instanceof Integer))
- continue;
- tmpKey = (Integer) key;
- element = table.get(tmpKey);
- // We won't paint them if they're not
- // JLabels so continue anyway
- if (! (element instanceof JLabel))
- continue;
- label = (Component) element;
- paintHorizontalLabel(g, tmpKey.intValue(), label);
- }
- }
- else
- {
- for (Enumeration list = table.keys(); list.hasMoreElements();)
- {
- key = list.nextElement();
- if (! (key instanceof Integer))
- continue;
- tmpKey = (Integer) key;
- element = table.get(tmpKey);
- // We won't paint them if they're not
- // JLabels so continue anyway
- if (! (element instanceof JLabel))
- continue;
- label = (Component) element;
- paintVerticalLabel(g, tmpKey.intValue(), label);
- }
- }
+ Dictionary table = slider.getLabelTable();
+ Integer tmpKey;
+ Object key;
+ Object element;
+ Component label;
+ if (slider.getOrientation() == JSlider.HORIZONTAL)
+ {
+ for (Enumeration list = table.keys(); list.hasMoreElements();)
+ {
+ key = list.nextElement();
+ if (! (key instanceof Integer))
+ continue;
+ tmpKey = (Integer) key;
+ element = table.get(tmpKey);
+ // We won't paint them if they're not
+ // JLabels so continue anyway
+ if (! (element instanceof JLabel))
+ continue;
+ label = (Component) element;
+ paintHorizontalLabel(g, tmpKey.intValue(), label);
+ }
+ }
+ else
+ {
+ for (Enumeration list = table.keys(); list.hasMoreElements();)
+ {
+ key = list.nextElement();
+ if (! (key instanceof Integer))
+ continue;
+ tmpKey = (Integer) key;
+ element = table.get(tmpKey);
+ // We won't paint them if they're not
+ // JLabels so continue anyway
+ if (! (element instanceof JLabel))
+ continue;
+ label = (Component) element;
+ paintVerticalLabel(g, tmpKey.intValue(), label);
+ }
+ }
}
}
@@ -1927,7 +1917,7 @@ public class BasicSliderUI extends SliderUI
h = labelRect.height;
label.setBounds(xpos, ypos, w, h);
- javax.swing.SwingUtilities.paintComponent(g, label, null, label.getBounds());
+ SwingUtilities.paintComponent(g, label, null, label.getBounds());
}
/**
@@ -1966,7 +1956,7 @@ public class BasicSliderUI extends SliderUI
w = labelRect.width;
label.setBounds(xpos, ypos, w, h);
- javax.swing.SwingUtilities.paintComponent(g, label, null, label.getBounds());
+ SwingUtilities.paintComponent(g, label, null, label.getBounds());
}
/**
@@ -2006,49 +1996,52 @@ public class BasicSliderUI extends SliderUI
Polygon dark; // dark shadow
Polygon all;
- // This will be in X-dimension if the slider is inverted and y if it isn't.
+ // This will be in X-dimension if the slider is inverted and y if it isn't.
int turnPoint;
if (slider.getOrientation() == JSlider.HORIZONTAL)
{
- turnPoint = thumbRect.height * 3 / 4;
+ turnPoint = thumbRect.height * 3 / 4;
- 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);
+ 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 - 1, a.x, e.x, d.x },
- new int[] { b.y, a.y, e.y, d.y }, 4);
+ 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 + 1 },
- new int[] { b.y, c.y - 1, d.y }, 3);
+ 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);
+ 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 - 1;
+ turnPoint = thumbRect.width * 3 / 4 - 1;
- b.translate(turnPoint, 0);
- c.translate(thumbRect.width - 1, thumbRect.height / 2);
- d.translate(turnPoint, thumbRect.height - 1);
- e.translate(0, thumbRect.height - 1);
+ b.translate(turnPoint, 0);
+ 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 - 1, b.x, a.x, e.x },
- new int[] { c.y - 1, b.y, a.y, e.y - 1 }, 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 },
- new int[] { c.y, d.y, e.y }, 3);
+ dark = new Polygon(new int[] { c.x, d.x, e.x },
+ new int[] { c.y, d.y, e.y }, 3);
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);
+ 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);
@@ -2135,53 +2128,60 @@ public class BasicSliderUI extends SliderUI
}
/**
- * This method returns the X coordinate for the value passed in.
+ * Returns the x-coordinate (relative to the component) for the given slider
+ * value. This method assumes that the <code>trackRect</code> field is
+ * set up.
*
- * @param value The value to calculate an x coordinate for.
+ * @param value the slider value.
*
- * @return The x coordinate for the value.
+ * @return The x-coordinate.
*/
protected int xPositionForValue(int value)
{
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int len = trackRect.width - 1;
-
- int xPos = (max == min) ? 0 : (value - min) * len / (max - min);
+ double min = slider.getMinimum();
+ if (value < min)
+ value = (int) min;
+ double max = slider.getMaximum();
+ if (value > max)
+ value = (int) max;
+ double len = trackRect.width;
+ if ((max - min) <= 0.0)
+ return 0;
+ int xPos = (int) ((value - min) / (max - min) * len + 0.5);
- if (! drawInverted())
- xPos += trackRect.x;
+ if (drawInverted())
+ return trackRect.x + Math.max(trackRect.width - xPos - 1, 0);
else
- {
- xPos = len - xPos;
- xPos += trackRect.x;
- }
- return xPos;
+ return trackRect.x + Math.min(xPos, trackRect.width - 1);
}
/**
- * This method returns the y coordinate for the value passed in.
+ * Returns the y-coordinate (relative to the component) for the given slider
+ * value. This method assumes that the <code>trackRect</code> field is
+ * set up.
*
- * @param value The value to calculate a y coordinate for.
+ * @param value the slider value.
*
- * @return The y coordinate for the value.
+ * @return The y-coordinate.
*/
protected int yPositionForValue(int value)
{
- int min = slider.getMinimum();
- int max = slider.getMaximum();
- int len = trackRect.height - 1;
+ double min = slider.getMinimum();
+ if (value < min)
+ value = (int) min;
+ double max = slider.getMaximum();
+ if (value > max)
+ value = (int) max;
+ int len = trackRect.height;
+ if ((max - min) <= 0.0)
+ return 0;
- int yPos = (max == min) ? 0 : (value - min) * len / (max - min);
+ int yPos = (int) ((value - min) / (max - min) * len + 0.5);
if (! drawInverted())
- {
- yPos = len - yPos;
- yPos += trackRect.y;
- }
+ return trackRect.y + trackRect.height - Math.max(yPos, 1);
else
- yPos += trackRect.y;
- return yPos;
+ return trackRect.y + Math.min(yPos, trackRect.height - 1);
}
/**
@@ -2288,26 +2288,26 @@ public class BasicSliderUI extends SliderUI
// First check the major ticks.
if (majorSpace > 0)
{
- int lowerBound = (value - min) / majorSpace;
- int majLower = majorSpace * lowerBound + min;
- int majHigher = majorSpace * (lowerBound + 1) + min;
-
- if (majHigher <= max && majHigher - value <= value - majLower)
- major = majHigher - value;
- else
- major = majLower - value;
+ int lowerBound = (value - min) / majorSpace;
+ int majLower = majorSpace * lowerBound + min;
+ int majHigher = majorSpace * (lowerBound + 1) + min;
+
+ if (majHigher <= max && majHigher - value <= value - majLower)
+ major = majHigher - value;
+ else
+ major = majLower - value;
}
if (minorSpace > 0)
{
- int lowerBound = value / minorSpace;
- int minLower = minorSpace * lowerBound;
- int minHigher = minorSpace * (lowerBound + 1);
-
- if (minHigher <= max && minHigher - value <= value - minLower)
- minor = minHigher - value;
- else
- minor = minLower - value;
+ int lowerBound = value / minorSpace;
+ int minLower = minorSpace * lowerBound;
+ int minHigher = minorSpace * (lowerBound + 1);
+
+ if (minHigher <= max && minHigher - value <= value - minLower)
+ minor = minHigher - value;
+ else
+ minor = minLower - value;
}
// Give preference to minor ticks
diff --git a/javax/swing/plaf/basic/BasicTableUI.java b/javax/swing/plaf/basic/BasicTableUI.java
index 00cebc948..9ddaeb2e9 100644
--- a/javax/swing/plaf/basic/BasicTableUI.java
+++ b/javax/swing/plaf/basic/BasicTableUI.java
@@ -521,11 +521,9 @@ public class BasicTableUI extends TableUI
if (command.equals("selectPreviousRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0));
- colModel.setLeadSelectionIndex(colLead);
}
else if (command.equals("selectLastColumn"))
{
- rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(colMax, colMax);
}
else if (command.equals("startEditing"))
@@ -536,53 +534,43 @@ public class BasicTableUI extends TableUI
else if (command.equals("selectFirstRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(0);
- colModel.setLeadSelectionIndex(colLead);
}
else if (command.equals("selectFirstColumn"))
{
- rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(0, 0);
}
else if (command.equals("selectFirstColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(0);
- rowModel.setLeadSelectionIndex(rowLead);
}
else if (command.equals("selectLastRow"))
{
rowModel.setSelectionInterval(rowMax,rowMax);
- colModel.setSelectionInterval(colLead, colLead);
}
else if (command.equals("selectNextRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
- colModel.setLeadSelectionIndex(colLead);
}
else if (command.equals("selectFirstRow"))
{
rowModel.setSelectionInterval(0,0);
- colModel.setSelectionInterval(colLead, colLead);
}
else if (command.equals("selectNextColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax));
- rowModel.setLeadSelectionIndex(rowLead);
}
else if (command.equals("selectLastColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(colMax);
- rowModel.setLeadSelectionIndex(rowLead);
}
else if (command.equals("selectPreviousColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0));
- rowModel.setLeadSelectionIndex(rowLead);
}
else if (command.equals("selectNextRow"))
{
rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
Math.min(rowLead + 1, rowMax));
- colModel.setSelectionInterval(colLead,colLead);
}
else if (command.equals("scrollUpExtendSelection"))
{
@@ -601,7 +589,6 @@ public class BasicTableUI extends TableUI
{
rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
Math.max(rowLead - 1, 0));
- colModel.setSelectionInterval(colLead,colLead);
}
else if (command.equals("scrollRightChangeSelection"))
{
@@ -618,7 +605,6 @@ public class BasicTableUI extends TableUI
}
else if (command.equals("selectPreviousColumn"))
{
- rowModel.setSelectionInterval(rowLead,rowLead);
colModel.setSelectionInterval(Math.max(colLead - 1, 0),
Math.max(colLead - 1, 0));
}
@@ -727,7 +713,6 @@ public class BasicTableUI extends TableUI
}
else if (command.equals("selectNextColumn"))
{
- rowModel.setSelectionInterval(rowLead,rowLead);
colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
Math.min(colLead + 1, colMax));
}
@@ -915,7 +900,6 @@ public class BasicTableUI extends TableUI
table.scrollRectToVisible
(table.getCellRect(rowModel.getLeadSelectionIndex(),
colModel.getLeadSelectionIndex(), false));
- table.repaint();
}
/**
@@ -1258,7 +1242,7 @@ public class BasicTableUI extends TableUI
int rn = table.rowAtPoint(p2);
if (rn == -1)
rn = table.getRowCount() - 1;
-
+
TableColumnModel cmodel = table.getColumnModel();
int [] widths = new int[cn+1];
for (int i = c0; i <=cn ; i++)
diff --git a/javax/swing/plaf/basic/BasicTextAreaUI.java b/javax/swing/plaf/basic/BasicTextAreaUI.java
index 36854e07f..e9f566e9a 100644
--- a/javax/swing/plaf/basic/BasicTextAreaUI.java
+++ b/javax/swing/plaf/basic/BasicTextAreaUI.java
@@ -45,9 +45,11 @@ import javax.swing.JComponent;
import javax.swing.JTextArea;
import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
+import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.PlainView;
import javax.swing.text.View;
+import javax.swing.text.ViewFactory;
import javax.swing.text.WrappedPlainView;
public class BasicTextAreaUI extends BasicTextUI
@@ -108,6 +110,9 @@ public class BasicTextAreaUI extends BasicTextUI
JTextArea comp = (JTextArea)getComponent();
if (ev.getPropertyName() == "lineWrap"
|| ev.getPropertyName() == "wrapStyleWord")
- modelChanged();
+ {
+ // Changes the View (without modifying the document or it's listeners).
+ setView(create(textComponent.getDocument().getDefaultRootElement()));
+ }
}
}
diff --git a/javax/swing/plaf/basic/BasicTextUI.java b/javax/swing/plaf/basic/BasicTextUI.java
index 69f4e19fd..6a45969cc 100644
--- a/javax/swing/plaf/basic/BasicTextUI.java
+++ b/javax/swing/plaf/basic/BasicTextUI.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import gnu.classpath.NotImplementedException;
+
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
@@ -696,33 +698,23 @@ public abstract class BasicTextUI extends TextUI
*/
protected Keymap createKeymap()
{
- // FIXME: It seems to me that this method implementation is wrong. It seems
- // to fetch the focusInputMap and transform it to the KeyBinding/Keymap
- // implemenation. I would think that it should be done the other way,
- // fetching the keybindings (from prefix + ".bindings") and transform
- // it to the newer InputMap/ActionMap implementation.
- JTextComponent.KeyBinding[] bindings = null;
- String prefix = getPropertyPrefix();
- InputMapUIResource m = (InputMapUIResource) UIManager.get(prefix + ".focusInputMap");
- if (m != null)
+ String keymapName = getKeymapName();
+ Keymap keymap = JTextComponent.getKeymap(keymapName);
+ if (keymap == null)
{
- KeyStroke[] keys = m.keys();
- int len = keys.length;
- bindings = new JTextComponent.KeyBinding[len];
- for (int i = 0; i < len; i++)
+ Keymap parentMap =
+ JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP);
+ keymap = JTextComponent.addKeymap(keymapName, parentMap);
+ Object val = UIManager.get(getPropertyPrefix() + ".keyBindings");
+ if (val != null && val instanceof JTextComponent.KeyBinding[])
{
- KeyStroke curr = keys[i];
- bindings[i] = new JTextComponent.KeyBinding(curr,
- (String) m.get(curr));
+ JTextComponent.KeyBinding[] bindings =
+ (JTextComponent.KeyBinding[]) val;
+ JTextComponent.loadKeymap(keymap, bindings,
+ getComponent().getActions());
}
}
- if (bindings == null)
- bindings = new JTextComponent.KeyBinding[0];
-
- Keymap km = JTextComponent.addKeymap(getKeymapName(),
- JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP));
- JTextComponent.loadKeymap(km, bindings, textComponent.getActions());
- return km;
+ return keymap;
}
/**
@@ -730,11 +722,8 @@ public abstract class BasicTextUI extends TextUI
*/
protected void installKeyboardActions()
{
- // load key bindings for the older interface
- Keymap km = JTextComponent.getKeymap(getKeymapName());
- if (km == null)
- km = createKeymap();
- textComponent.setKeymap(km);
+ // This is only there for backwards compatibility.
+ textComponent.setKeymap(createKeymap());
// load any bindings for the newer InputMap / ActionMap interface
SwingUtilities.replaceUIInputMap(textComponent, JComponent.WHEN_FOCUSED,
@@ -1041,7 +1030,10 @@ public abstract class BasicTextUI extends TextUI
Rectangle l1 = modelToView(t, p0, firstBias);
Rectangle l2 = modelToView(t, p1, secondBias);
if (l1.y == l2.y)
- t.repaint(l1.union(l2));
+ {
+ SwingUtilities.computeUnion(l2.x, l2.y, l2.width, l2.height, l1);
+ t.repaint(l1);
+ }
else
{
// The two rectangles lie on different lines and we need a
@@ -1147,7 +1139,7 @@ public abstract class BasicTextUI extends TextUI
public int getNextVisualPositionFrom(JTextComponent t, int pos,
Position.Bias b, int direction,
Position.Bias[] biasRet)
- throws BadLocationException
+ throws BadLocationException, NotImplementedException
{
return 0; // TODO: Implement me.
}
diff --git a/javax/swing/plaf/basic/BasicTreeUI.java b/javax/swing/plaf/basic/BasicTreeUI.java
index b7913e0a1..78d0a586a 100644
--- a/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/javax/swing/plaf/basic/BasicTreeUI.java
@@ -38,6 +38,8 @@
package javax.swing.plaf.basic;
+import gnu.javax.swing.tree.GnuPath;
+
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@@ -76,7 +78,6 @@ 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.LookAndFeel;
@@ -96,17 +97,16 @@ import javax.swing.plaf.ActionMapUIResource;
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.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.FixedHeightLayoutCache;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
+import javax.swing.tree.VariableHeightLayoutCache;
/**
* A delegate providing the user interface for <code>JTree</code> according to
@@ -117,16 +117,17 @@ import javax.swing.tree.TreeSelectionModel;
* @author Sascha Brawer (brawer@dandelis.ch)
* @author Audrius Meskauskas (audriusa@bioinformatics.org)
*/
-public class BasicTreeUI extends TreeUI
+public class BasicTreeUI
+ extends TreeUI
{
/**
* The tree cell editing may be started by the single mouse click on the
* selected cell. To separate it from the double mouse click, the editing
- * session starts after this time (in ms) after that single click, and only
- * no other clicks were performed during that time.
+ * session starts after this time (in ms) after that single click, and only no
+ * other clicks were performed during that time.
*/
- static int WAIT_TILL_EDITING = 900;
-
+ static int WAIT_TILL_EDITING = 900;
+
/** Collapse Icon for the tree. */
protected transient Icon collapsedIcon;
@@ -270,20 +271,21 @@ public class BasicTreeUI extends TreeUI
private TreeExpansionListener treeExpansionListener;
private TreeModelListener treeModelListener;
-
+
/**
* This timer fires the editing action after about 1200 ms if not reset during
- * that time. It handles the editing start with the single mouse click
- * (and not the double mouse click) on the selected tree node.
+ * that time. It handles the editing start with the single mouse click (and
+ * not the double mouse click) on the selected tree node.
*/
Timer startEditTimer;
-
+
/**
* The special value of the mouse event is sent indicating that this is not
* just the mouse click, but the mouse click on the selected node. Sending
* such event forces to start the cell editing session.
*/
- static final MouseEvent EDIT = new MouseEvent(new Label(), 7,7,7,7,7,7, false);
+ static final MouseEvent EDIT = new MouseEvent(new Label(), 7, 7, 7, 7, 7, 7,
+ false);
/**
* Creates a new BasicTreeUI object.
@@ -306,22 +308,21 @@ public class BasicTreeUI extends TreeUI
treeExpansionListener = createTreeExpansionListener();
treeModelListener = createTreeModelListener();
- editingRow = -1;
- lastSelectedRow = -1;
+ 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.
+ * @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.
*
@@ -335,8 +336,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the Hash color.
*
- * @param color
- * the <code>Color</code> to set the Hash to.
+ * @param color the <code>Color</code> to set the Hash to.
*/
protected void setHashColor(Color color)
{
@@ -347,8 +347,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the left child's indent value.
*
- * @param newAmount
- * is the new indent value for the left child.
+ * @param newAmount is the new indent value for the left child.
*/
public void setLeftChildIndent(int newAmount)
{
@@ -368,8 +367,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the right child's indent value.
*
- * @param newAmount
- * is the new indent value for the right child.
+ * @param newAmount is the new indent value for the right child.
*/
public void setRightChildIndent(int newAmount)
{
@@ -389,8 +387,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the expanded icon.
*
- * @param newG
- * is the new expanded icon.
+ * @param newG is the new expanded icon.
*/
public void setExpandedIcon(Icon newG)
{
@@ -410,8 +407,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the collapsed icon.
*
- * @param newG
- * is the new collapsed icon.
+ * @param newG is the new collapsed icon.
*/
public void setCollapsedIcon(Icon newG)
{
@@ -431,8 +427,7 @@ public class BasicTreeUI extends TreeUI
/**
* Updates the componentListener, if necessary.
*
- * @param largeModel
- * sets this.largeModel to it.
+ * @param largeModel sets this.largeModel to it.
*/
protected void setLargeModel(boolean largeModel)
{
@@ -457,13 +452,12 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the row height.
*
- * @param rowHeight
- * is the height to set this.rowHeight to.
+ * @param rowHeight is the height to set this.rowHeight to.
*/
protected void setRowHeight(int rowHeight)
{
if (rowHeight == 0)
- rowHeight = Math.max(getMaxHeight(tree), 20);
+ rowHeight = getMaxHeight(tree);
treeState.setRowHeight(rowHeight);
}
@@ -474,15 +468,14 @@ public class BasicTreeUI extends TreeUI
*/
protected int getRowHeight()
{
- return treeState.getRowHeight();
+ return tree.getRowHeight();
}
/**
* Sets the TreeCellRenderer to <code>tcr</code>. This invokes
* <code>updateRenderer</code>.
*
- * @param tcr
- * is the new TreeCellRenderer.
+ * @param tcr is the new TreeCellRenderer.
*/
protected void setCellRenderer(TreeCellRenderer tcr)
{
@@ -507,13 +500,13 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the tree's model.
*
- * @param model
- * to set the treeModel to.
+ * @param model to set the treeModel to.
*/
protected void setModel(TreeModel model)
{
tree.setModel(model);
treeModel = tree.getModel();
+ treeState.setModel(treeModel);
}
/**
@@ -529,8 +522,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the root to being visible.
*
- * @param newValue
- * sets the visibility of the root
+ * @param newValue sets the visibility of the root
*/
protected void setRootVisible(boolean newValue)
{
@@ -550,8 +542,7 @@ public class BasicTreeUI extends TreeUI
/**
* Determines whether the node handles are to be displayed.
*
- * @param newValue
- * sets whether or not node handles should be displayed.
+ * @param newValue sets whether or not node handles should be displayed.
*/
protected void setShowsRootHandles(boolean newValue)
{
@@ -571,8 +562,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the cell editor.
*
- * @param editor
- * to set the cellEditor to.
+ * @param editor to set the cellEditor to.
*/
protected void setCellEditor(TreeCellEditor editor)
{
@@ -593,8 +583,7 @@ public class BasicTreeUI extends TreeUI
/**
* Configures the receiver to allow, or not allow, editing.
*
- * @param newValue
- * sets the receiver to allow editing if true.
+ * @param newValue sets the receiver to allow editing if true.
*/
protected void setEditable(boolean newValue)
{
@@ -615,8 +604,7 @@ public class BasicTreeUI extends TreeUI
* Resets the selection model. The appropriate listeners are installed on the
* model.
*
- * @param newLSM
- * resets the selection model.
+ * @param newLSM resets the selection model.
*/
protected void setSelectionModel(TreeSelectionModel newLSM)
{
@@ -642,35 +630,23 @@ public class BasicTreeUI extends TreeUI
* 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.
+ * @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)
{
- int row = -1;
- Object cell = null;
- if (path != null)
- {
- row = getRowForPath(tree, path);
- cell = path.getLastPathComponent();
- }
- return nodeDimensions.getNodeDimensions(cell, row, getLevel(cell),
- tree.isExpanded(path),
- new Rectangle());
+ return treeState.getBounds(path, new Rectangle());
}
/**
* Returns the max height of all the nodes in the tree.
*
- * @param tree -
- * the current tree
+ * @param tree - the current tree
* @return the max height.
*/
- private int getMaxHeight(JTree tree)
+ int getMaxHeight(JTree tree)
{
if (maxHeight != 0)
return maxHeight;
@@ -699,65 +675,39 @@ public class BasicTreeUI extends TreeUI
/**
* 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.
+ * @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)
{
- if (treeModel != null && currentVisiblePath != null)
- {
- Object[] nodes = currentVisiblePath.getPath();
- if (row < nodes.length)
- return new TreePath(getPathToRoot(nodes[row], 0));
- }
- return null;
+ return treeState.getPathForRow(row);
}
/**
* 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.
+ * @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 = 0;
- Object dest = path.getLastPathComponent();
- int rowCount = getRowCount(tree);
- if (currentVisiblePath != null)
- {
- Object[] nodes = currentVisiblePath.getPath();
- while (row < rowCount)
- {
- if (dest.equals(nodes[row]))
- return row;
- row++;
- }
- }
- return -1;
+ return treeState.getRowForPath(path);
}
/**
* Returns the number of rows that are being displayed.
*
- * @param tree
- * is the current tree to return the number of rows for.
+ * @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)
{
- if (currentVisiblePath != null)
- return currentVisiblePath.getPathCount();
- return 0;
+ return treeState.getRowCount();
}
/**
@@ -766,35 +716,21 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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)
{
- int row = Math.round(y / getMaxHeight(tree));
- TreePath path = getPathForRow(tree, row);
-
- // no row is visible at this node
- while (row > 0 && path == null)
- {
- --row;
- path = getPathForRow(tree, row);
- }
-
- return path;
+ 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.
+ * @param tree is the tree to check for editing.
* @return true if the tree is being edited.
*/
public boolean isEditing(JTree tree)
@@ -807,8 +743,7 @@ public class BasicTreeUI extends TreeUI
* being edited. Returns true if the editor allows the editing session to
* stop.
*
- * @param tree
- * is the tree to stop the editing on
+ * @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)
@@ -818,32 +753,29 @@ public class BasicTreeUI extends TreeUI
completeEditing(false, false, true);
finish();
}
- return !isEditing(tree);
+ return ! isEditing(tree);
}
/**
* Cancels the current editing session.
*
- * @param tree
- * is the tree to cancel the editing session on.
+ * @param tree is the tree to cancel the editing session on.
*/
public void cancelEditing(JTree tree)
- {
- // There is no need to send the cancel message to the editor,
- // as the cancellation event itself arrives from it. This would
- // only be necessary when cancelling the editing programatically.
- completeEditing(false, false, false);
- finish();
+ {
+ // There is no need to send the cancel message to the editor,
+ // as the cancellation event itself arrives from it. This would
+ // only be necessary when cancelling the editing programatically.
+ completeEditing(false, false, false);
+ finish();
}
/**
* 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.
+ * @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)
{
@@ -853,8 +785,7 @@ public class BasicTreeUI extends TreeUI
/**
* Returns the path to the element that is being editted.
*
- * @param tree
- * is the tree to get the editing path from.
+ * @param tree is the tree to get the editing path from.
* @return the path that is being edited.
*/
public TreePath getEditingPath(JTree tree)
@@ -902,7 +833,8 @@ public class BasicTreeUI extends TreeUI
/**
* Creates an instance of NodeDimensions that is able to determine the size of
- * a given node in the tree.
+ * a given node in the tree. The node dimensions must be created before
+ * configuring the layout cache.
*
* @return the NodeDimensions of a given node in the tree
*/
@@ -1018,7 +950,7 @@ public class BasicTreeUI extends TreeUI
*/
protected AbstractLayoutCache createLayoutCache()
{
- return new FixedHeightLayoutCache();
+ return new VariableHeightLayoutCache();
}
/**
@@ -1152,8 +1084,7 @@ public class BasicTreeUI extends TreeUI
* by getting the expanded descendants from the tree and forwarding to the
* tree state.
*
- * @param path
- * the path used to update the expanded states
+ * @param path the path used to update the expanded states
*/
protected void updateExpandedDescendants(TreePath path)
{
@@ -1165,8 +1096,7 @@ public class BasicTreeUI extends TreeUI
/**
* Returns a path to the last child of <code>parent</code>
*
- * @param parent
- * is the topmost path to specified
+ * @param parent is the topmost path to specified
* @return a path to the last child of parent
*/
protected TreePath getLastChildPath(TreePath parent)
@@ -1212,11 +1142,13 @@ public class BasicTreeUI extends TreeUI
/**
* Resets the treeState instance based on the tree we're providing the look
- * and feel for.
+ * and feel for. The node dimensions handler is required and must be created
+ * in advance.
*/
protected void configureLayoutCache()
{
treeState = createLayoutCache();
+ treeState.setNodeDimensions(nodeDimensions);
}
/**
@@ -1236,42 +1168,19 @@ public class BasicTreeUI extends TreeUI
*/
protected void updateCachedPreferredSize()
{
- int maxWidth = 0;
- updateCurrentVisiblePath();
- boolean isLeaf = false;
- if (currentVisiblePath != null)
- {
- Object[] path = currentVisiblePath.getPath();
- for (int i = 0; i < path.length; i++)
- {
- TreePath curr = new TreePath(getPathToRoot(path[i], 0));
- Rectangle bounds = getPathBounds(tree, curr);
- if (treeModel != null)
- isLeaf = treeModel.isLeaf(path[i]);
- if (!isLeaf && hasControlIcons())
- bounds.width += getCurrentControlIcon(curr).getIconWidth();
- maxWidth = Math.max(maxWidth, bounds.x + bounds.width);
- }
-
- maxHeight = 0;
- maxHeight = getMaxHeight(tree);
- preferredSize = new Dimension(maxWidth, (maxHeight * path.length));
- }
- else
- preferredSize = new Dimension(0, 0);
- validCachedPreferredSize = true;
+ validCachedPreferredSize = false;
}
/**
* Messaged from the VisibleTreeNode after it has been expanded.
*
- * @param path
- * is the path that has been expanded.
+ * @param path is the path that has been expanded.
*/
protected void pathWasExpanded(TreePath path)
{
validCachedPreferredSize = false;
- tree.repaint();
+ treeState.setExpandedState(path, true);
+ tree.repaint();
}
/**
@@ -1280,6 +1189,7 @@ public class BasicTreeUI extends TreeUI
protected void pathWasCollapsed(TreePath path)
{
validCachedPreferredSize = false;
+ treeState.setExpandedState(path, false);
tree.repaint();
}
@@ -1345,8 +1255,7 @@ public class BasicTreeUI extends TreeUI
/**
* Converts the modifiers.
*
- * @param mod -
- * modifier to convert
+ * @param mod - modifier to convert
* @returns the new modifier
*/
private int convertModifiers(int mod)
@@ -1354,27 +1263,27 @@ public class BasicTreeUI extends TreeUI
if ((mod & KeyEvent.SHIFT_DOWN_MASK) != 0)
{
mod |= KeyEvent.SHIFT_MASK;
- mod &= ~KeyEvent.SHIFT_DOWN_MASK;
+ mod &= ~ KeyEvent.SHIFT_DOWN_MASK;
}
if ((mod & KeyEvent.CTRL_DOWN_MASK) != 0)
{
mod |= KeyEvent.CTRL_MASK;
- mod &= ~KeyEvent.CTRL_DOWN_MASK;
+ mod &= ~ KeyEvent.CTRL_DOWN_MASK;
}
if ((mod & KeyEvent.META_DOWN_MASK) != 0)
{
mod |= KeyEvent.META_MASK;
- mod &= ~KeyEvent.META_DOWN_MASK;
+ mod &= ~ KeyEvent.META_DOWN_MASK;
}
if ((mod & KeyEvent.ALT_DOWN_MASK) != 0)
{
mod |= KeyEvent.ALT_MASK;
- mod &= ~KeyEvent.ALT_DOWN_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;
+ mod &= ~ KeyEvent.ALT_GRAPH_DOWN_MASK;
}
return mod;
}
@@ -1399,8 +1308,7 @@ public class BasicTreeUI extends TreeUI
/**
* Install the UI for the component
*
- * @param c
- * the component to install UI for
+ * @param c the component to install UI for
*/
public void installUI(JComponent c)
{
@@ -1419,6 +1327,8 @@ public class BasicTreeUI extends TreeUI
setModel(tree.getModel());
treeSelectionModel = tree.getSelectionModel();
+ setRootVisible(tree.isRootVisible());
+ treeState.setRootVisible(tree.isRootVisible());
completeUIInstall();
}
@@ -1436,8 +1346,7 @@ public class BasicTreeUI extends TreeUI
/**
* Uninstall the UI for the component
*
- * @param c
- * the component to uninstall UI for
+ * @param c the component to uninstall UI for
*/
public void uninstallUI(JComponent c)
{
@@ -1456,51 +1365,82 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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;
- updateCurrentVisiblePath();
Rectangle clip = g.getClipBounds();
+
Insets insets = tree.getInsets();
- if (clip != null && treeModel != null && currentVisiblePath != null)
+ if (clip != null && treeModel != null)
{
int startIndex = tree.getClosestRowForLocation(clip.x, clip.y);
int endIndex = tree.getClosestRowForLocation(clip.x + clip.width,
clip.y + clip.height);
- paintVerticalPartOfLeg(g, clip, insets, currentVisiblePath);
for (int i = startIndex; i <= endIndex; i++)
{
- Object curr = currentVisiblePath.getPathComponent(i);
- boolean isLeaf = treeModel.isLeaf(curr);
- TreePath path = new TreePath(getPathToRoot(curr, 0));
-
+ TreePath path = treeState.getPathForRow(i);
+ boolean isLeaf = treeModel.isLeaf(path.getLastPathComponent());
boolean isExpanded = tree.isExpanded(path);
+
Rectangle bounds = getPathBounds(tree, path);
+
paintHorizontalPartOfLeg(g, clip, insets, bounds, path, i,
isExpanded, false, isLeaf);
paintRow(g, clip, insets, bounds, path, i, isExpanded, false,
isLeaf);
+ if (isLastChild(path))
+ paintVerticalPartOfLeg(g, clip, insets, path);
}
+
+ // Also paint dashes to the invisible nodes below:
+ int rows = treeState.getRowCount();
+
+ if (endIndex < rows)
+ for (int i = endIndex + 1; i < rows; i++)
+ {
+ TreePath path = treeState.getPathForRow(i);
+ if (isLastChild(path))
+ paintVerticalPartOfLeg(g, clip, insets, path);
+ }
+ }
+ }
+
+ /**
+ * Check if the path is referring to the last child of some parent.
+ */
+ private boolean isLastChild(TreePath path)
+ {
+ if (path instanceof GnuPath)
+ {
+ // Except the seldom case when the layout cache is changed, this
+ // optimized code will be executed.
+ return ((GnuPath) path).isLastChild;
+ }
+ else
+ {
+ // Non optimized general case.
+ TreePath parent = path.getParentPath();
+ if (parent == null)
+ return false;
+ int childCount = treeState.getVisibleChildCount(parent);
+ int p = treeModel.getIndexOfChild(parent, path.getLastPathComponent());
+ return p == childCount - 1;
}
}
/**
* Ensures that the rows identified by beginRow through endRow are visible.
*
- * @param beginRow
- * is the first row
- * @param endRow
- * is the last row
+ * @param beginRow is the first row
+ * @param endRow is the last row
*/
protected void ensureRowsAreVisible(int beginRow, int endRow)
{
@@ -1514,7 +1454,7 @@ public class BasicTreeUI extends TreeUI
for (int i = beginRow; i < endRow; i++)
{
TreePath path = getPathForRow(tree, i);
- if (!tree.isVisible(path))
+ if (! tree.isVisible(path))
tree.makeVisible(path);
}
}
@@ -1522,8 +1462,7 @@ public class BasicTreeUI extends TreeUI
/**
* Sets the preferred minimum size.
*
- * @param newSize
- * is the new preferred minimum size.
+ * @param newSize is the new preferred minimum size.
*/
public void setPreferredMinSize(Dimension newSize)
{
@@ -1537,15 +1476,17 @@ public class BasicTreeUI extends TreeUI
*/
public Dimension getPreferredMinSize()
{
- return preferredMinSize;
+ if (preferredMinSize == null)
+ return getPreferredSize(tree);
+ else
+ return preferredMinSize;
}
/**
* 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
+ * @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
@@ -1559,17 +1500,19 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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
- if (!validCachedPreferredSize)
- updateCachedPreferredSize();
+ if (! validCachedPreferredSize)
+ {
+ // Add the scrollbar dimensions to the preferred size.
+ preferredSize = new Dimension(treeState.getPreferredWidth(null),
+ treeState.getPreferredHeight());
+ validCachedPreferredSize = true;
+ }
return preferredSize;
}
@@ -1577,31 +1520,24 @@ public class BasicTreeUI extends TreeUI
* 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.
+ * @param c the component whose min size is being queried.
* @returns the preferred size or null
*/
public Dimension getMinimumSize(JComponent c)
{
- Dimension min = getPreferredMinSize();
- if (min == null)
- return new Dimension();
- return min;
+ return preferredMinSize = 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
+ * @param c the component whose preferred size is being queried
* @return the max size or null
*/
public Dimension getMaximumSize(JComponent c)
{
- if (c instanceof JTree)
- return ((JTree) c).getPreferredSize();
- return new Dimension();
+ return getPreferredSize(c);
}
/**
@@ -1622,12 +1558,9 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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)
@@ -1659,10 +1592,8 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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)
@@ -1676,8 +1607,7 @@ public class BasicTreeUI extends TreeUI
updateCellEditor();
TreeCellEditor ed = getCellEditor();
- if (ed != null
- && (event == EDIT || ed.shouldSelectCell(event))
+ if (ed != null && (event == EDIT || ed.shouldSelectCell(event))
&& ed.isCellEditable(event))
{
Rectangle bounds = getPathBounds(tree, path);
@@ -1718,12 +1648,9 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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)
@@ -1737,12 +1664,9 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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.
@@ -1753,7 +1677,7 @@ public class BasicTreeUI extends TreeUI
boolean cntlClick = false;
int row = getRowForPath(tree, path);
- if (!isLeaf(row))
+ if (! isLeaf(row))
{
Rectangle bounds = getPathBounds(tree, path);
@@ -1769,12 +1693,9 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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)
{
@@ -1787,8 +1708,7 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param path the path we are concerned with
*/
protected void toggleExpandState(TreePath path)
{
@@ -1802,8 +1722,7 @@ public class BasicTreeUI extends TreeUI
* 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.
+ * @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.
*/
@@ -1816,8 +1735,7 @@ public class BasicTreeUI extends TreeUI
* Returning true signifies a mouse event on the node should select from the
* anchor point.
*
- * @param event
- * is the MouseEvent performed on the node.
+ * @param event is the MouseEvent performed on the node.
* @return true signifies a mouse event on the node should select from the
* anchor point.
*/
@@ -1831,8 +1749,7 @@ public class BasicTreeUI extends TreeUI
* 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.
+ * @param event is the MouseEvent performed on the row.
* @return true indicates the row under the mouse should be toggled based on
* the event.
*/
@@ -1848,10 +1765,8 @@ public class BasicTreeUI extends TreeUI
* 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.
+ * @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)
{
@@ -1883,8 +1798,7 @@ public class BasicTreeUI extends TreeUI
/**
* Returns true if the node at <code>row</code> is a leaf.
*
- * @param row
- * is the row we are concerned with.
+ * @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)
@@ -1902,46 +1816,38 @@ public class BasicTreeUI extends TreeUI
* 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
+ class TreeAction
+ extends AbstractAction
{
/**
* What to do when this action is called.
*
- * @param e
- * the ActionEvent that caused this action.
+ * @param e the ActionEvent that caused this action.
*/
public void actionPerformed(ActionEvent e)
{
+ String command = e.getActionCommand();
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"))
+ if (command.equals("selectPreviousChangeLead")
+ || command.equals("selectPreviousExtendSelection")
+ || command.equals("selectPrevious") || command.equals("selectNext")
+ || command.equals("selectNextExtendSelection")
+ || command.equals("selectNextChangeLead"))
(new TreeIncrementAction(0, "")).actionPerformed(e);
- else if (e.getActionCommand().equals("selectParent")
- || e.getActionCommand().equals("selectChild"))
+ else if (command.equals("selectParent") || command.equals("selectChild"))
(new TreeTraverseAction(0, "")).actionPerformed(e);
- else if (e.getActionCommand().equals("selectAll"))
+ else if (command.equals("selectAll"))
{
- TreePath[] paths = new TreePath[tree.getVisibleRowCount()];
-
- Object curr = getNextVisibleNode(treeModel.getRoot());
- int i = 0;
- while (curr != null && i < paths.length)
- {
- paths[i] = new TreePath(getPathToRoot(curr, 0));
- i++;
- }
-
+ TreePath[] paths = new TreePath[treeState.getRowCount()];
+ for (int i = 0; i < paths.length; i++)
+ paths[i] = treeState.getPathForRow(i);
tree.addSelectionPaths(paths);
}
- else if (e.getActionCommand().equals("startEditing"))
+ else if (command.equals("startEditing"))
tree.startEditingAtPath(lead);
- else if (e.getActionCommand().equals("toggle"))
+ else if (command.equals("toggle"))
{
if (tree.isEditing())
tree.stopEditing();
@@ -1949,14 +1855,14 @@ public class BasicTreeUI extends TreeUI
{
Object last = lead.getLastPathComponent();
TreePath path = new TreePath(getPathToRoot(last, 0));
- if (!treeModel.isLeaf(last))
+ if (! treeModel.isLeaf(last))
toggleExpandState(path);
}
}
- else if (e.getActionCommand().equals("clearSelection"))
+ else if (command.equals("clearSelection"))
tree.clearSelection();
- if (tree.isEditing() && !e.getActionCommand().equals("startEditing"))
+ if (tree.isEditing() && ! command.equals("startEditing"))
tree.stopEditing();
tree.scrollPathToVisible(lead);
@@ -1970,7 +1876,8 @@ public class BasicTreeUI extends TreeUI
* to the true receiver after altering the actionCommand property of the
* event.
*/
- private static class ActionListenerProxy extends AbstractAction
+ private static class ActionListenerProxy
+ extends AbstractAction
{
ActionListener target;
@@ -1992,11 +1899,12 @@ public class BasicTreeUI extends TreeUI
}
}
- /**
+ /**
* Updates the preferred size when scrolling, if necessary.
*/
- public class ComponentHandler extends ComponentAdapter implements
- ActionListener
+ public class ComponentHandler
+ extends ComponentAdapter
+ implements ActionListener
{
/**
* Timer used when inside a scrollpane and the scrollbar is adjusting
@@ -2017,8 +1925,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when the component's position changes.
*
- * @param e
- * the event that occurs when moving the component
+ * @param e the event that occurs when moving the component
*/
public void componentMoved(ComponentEvent e)
{
@@ -2048,8 +1955,7 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param ae is the action performed
*/
public void actionPerformed(ActionEvent ae)
{
@@ -2061,7 +1967,8 @@ public class BasicTreeUI extends TreeUI
* Listener responsible for getting cell editing events and updating the tree
* accordingly.
*/
- public class CellEditorHandler implements CellEditorListener
+ public class CellEditorHandler
+ implements CellEditorListener
{
/**
* Constructor
@@ -2075,8 +1982,7 @@ public class BasicTreeUI extends TreeUI
* Messaged when editing has stopped in the tree. Tells the listeners
* editing has stopped.
*
- * @param e
- * is the notification event
+ * @param e is the notification event
*/
public void editingStopped(ChangeEvent e)
{
@@ -2087,8 +1993,7 @@ public class BasicTreeUI extends TreeUI
* Messaged when editing has been canceled in the tree. This tells the
* listeners the editor has canceled editing.
*
- * @param e
- * is the notification event
+ * @param e is the notification event
*/
public void editingCanceled(ChangeEvent e)
{
@@ -2099,7 +2004,8 @@ public class BasicTreeUI extends TreeUI
/**
* Repaints the lead selection row when focus is lost/grained.
*/
- public class FocusHandler implements FocusListener
+ public class FocusHandler
+ implements FocusListener
{
/**
* Constructor
@@ -2113,8 +2019,7 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e is the focus event that is activated
*/
public void focusGained(FocusEvent e)
{
@@ -2125,8 +2030,7 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e is the focus event that is deactivated
*/
public void focusLost(FocusEvent e)
{
@@ -2138,7 +2042,8 @@ public class BasicTreeUI extends TreeUI
* This is used to get multiple key down events to appropriately genereate
* events.
*/
- public class KeyHandler extends KeyAdapter
+ public class KeyHandler
+ extends KeyAdapter
{
/** Key code that is being generated for. */
protected Action repeatKeyAction;
@@ -2160,8 +2065,7 @@ public class BasicTreeUI extends TreeUI
* user. Subsequent same key presses move the keyboard focus to the next
* object that starts with the same letter.
*
- * @param e
- * the key typed
+ * @param e the key typed
*/
public void keyTyped(KeyEvent e)
{
@@ -2171,8 +2075,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when a key has been pressed.
*
- * @param e
- * the key pressed
+ * @param e the key pressed
*/
public void keyPressed(KeyEvent e)
{
@@ -2182,8 +2085,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when a key has been released
*
- * @param e
- * the key released
+ * @param e the key released
*/
public void keyReleased(KeyEvent e)
{
@@ -2195,7 +2097,9 @@ public class BasicTreeUI extends TreeUI
* MouseListener is responsible for updating the selection based on mouse
* events.
*/
- public class MouseHandler extends MouseAdapter implements MouseMotionListener
+ public class MouseHandler
+ extends MouseAdapter
+ implements MouseMotionListener
{
/**
* Constructor
@@ -2208,11 +2112,10 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when a mouse button has been pressed on a component.
*
- * @param e
- * is the mouse event that occured
+ * @param e is the mouse event that occured
*/
public void mousePressed(MouseEvent e)
- {
+ {
// Any mouse click cancels the previous waiting edit action, initiated
// by the single click on the selected node.
if (startEditTimer != null)
@@ -2220,7 +2123,7 @@ public class BasicTreeUI extends TreeUI
startEditTimer.stop();
startEditTimer = null;
}
-
+
Point click = e.getPoint();
TreePath path = getClosestPathForLocation(tree, click.x, click.y);
@@ -2258,34 +2161,32 @@ public class BasicTreeUI extends TreeUI
if (inBounds)
{
TreePath currentLead = tree.getLeadSelectionPath();
- if (
- currentLead != null &&
- currentLead.equals(path) &&
- e.getClickCount() == 1 &&
- tree.isEditable()
- )
+ if (currentLead != null && currentLead.equals(path)
+ && e.getClickCount() == 1 && tree.isEditable())
{
// Schedule the editing session.
final TreePath editPath = path;
-
+
if (startEditTimer != null)
startEditTimer.stop();
-
- startEditTimer = new Timer(WAIT_TILL_EDITING,
- new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- startEditing(editPath, EDIT);
- }
- });
- startEditTimer.setRepeats(false);
- startEditTimer.start();
+
+ startEditTimer = new Timer(WAIT_TILL_EDITING,
+ new ActionListener()
+ {
+ public void actionPerformed(
+ ActionEvent e)
+ {
+ startEditing(editPath,
+ EDIT);
+ }
+ });
+ startEditTimer.setRepeats(false);
+ startEditTimer.start();
}
else
{
selectPath(tree, path);
- if (e.getClickCount() == 2 && !isLeaf(row))
+ if (e.getClickCount() == 2 && ! isLeaf(row))
toggleExpandState(path);
}
}
@@ -2309,8 +2210,7 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e is the mouse event that occured
*/
public void mouseDragged(MouseEvent e)
{
@@ -2321,8 +2221,7 @@ public class BasicTreeUI extends TreeUI
* Invoked when the mouse button has been moved on a component (with no
* buttons no down).
*
- * @param e
- * the mouse event that occured
+ * @param e the mouse event that occured
*/
public void mouseMoved(MouseEvent e)
{
@@ -2332,8 +2231,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when a mouse button has been released on a component.
*
- * @param e
- * is the mouse event that occured
+ * @param e is the mouse event that occured
*/
public void mouseReleased(MouseEvent e)
{
@@ -2346,7 +2244,8 @@ public class BasicTreeUI extends TreeUI
* events, until the mouse is released to the destination it is constructed
* with.
*/
- public class MouseInputHandler implements MouseInputListener
+ public class MouseInputHandler
+ implements MouseInputListener
{
/** Source that events are coming from */
protected Component source;
@@ -2357,12 +2256,9 @@ public class BasicTreeUI extends TreeUI
/**
* Constructor
*
- * @param source
- * that events are coming from
- * @param destination
- * that receives all events
- * @param e
- * is the event received
+ * @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)
@@ -2375,8 +2271,7 @@ public class BasicTreeUI extends TreeUI
* Invoked when the mouse button has been clicked (pressed and released) on
* a component.
*
- * @param e
- * mouse event that occured
+ * @param e mouse event that occured
*/
public void mouseClicked(MouseEvent e)
{
@@ -2386,8 +2281,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when a mouse button has been pressed on a component.
*
- * @param e
- * mouse event that occured
+ * @param e mouse event that occured
*/
public void mousePressed(MouseEvent e)
{
@@ -2397,8 +2291,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when a mouse button has been released on a component.
*
- * @param e
- * mouse event that occured
+ * @param e mouse event that occured
*/
public void mouseReleased(MouseEvent e)
{
@@ -2408,8 +2301,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when the mouse enters a component.
*
- * @param e
- * mouse event that occured
+ * @param e mouse event that occured
*/
public void mouseEntered(MouseEvent e)
{
@@ -2419,8 +2311,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when the mouse exits a component.
*
- * @param e
- * mouse event that occured
+ * @param e mouse event that occured
*/
public void mouseExited(MouseEvent e)
{
@@ -2433,8 +2324,7 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e mouse event that occured
*/
public void mouseDragged(MouseEvent e)
{
@@ -2445,8 +2335,7 @@ public class BasicTreeUI extends TreeUI
* Invoked when the mouse cursor has been moved onto a component but no
* buttons have been pushed.
*
- * @param e
- * mouse event that occured
+ * @param e mouse event that occured
*/
public void mouseMoved(MouseEvent e)
{
@@ -2467,7 +2356,8 @@ public class BasicTreeUI extends TreeUI
* BasicTreeUI method. X location does not include insets, that is handled in
* getPathBounds.
*/
- public class NodeDimensionsHandler extends AbstractLayoutCache.NodeDimensions
+ public class NodeDimensionsHandler
+ extends AbstractLayoutCache.NodeDimensions
{
/**
* Constructor
@@ -2483,16 +2373,11 @@ public class BasicTreeUI extends TreeUI
* bounds is null, a newly created Rectangle should be returned, otherwise
* the value should be placed in bounds and returned.
*
- * @param cell
- * 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
+ * @param cell 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 cell, int row, int depth,
@@ -2509,6 +2394,8 @@ public class BasicTreeUI extends TreeUI
{
size.x = getRowX(row, depth);
size.width = SwingUtilities.computeStringWidth(fm, s);
+ size.width = size.width + getCurrentControlIcon(null).getIconWidth()
+ + gap;
size.height = getMaxHeight(tree);
size.y = size.height * row;
}
@@ -2523,8 +2410,6 @@ public class BasicTreeUI extends TreeUI
*/
protected int getRowX(int row, int depth)
{
- if (row == 0)
- return 0;
return depth * rightChildIndent;
}
}// NodeDimensionsHandler
@@ -2533,7 +2418,8 @@ public class BasicTreeUI extends TreeUI
* PropertyChangeListener for the tree. Updates the appropriate varaible, or
* TreeState, based on what changes.
*/
- public class PropertyChangeHandler implements PropertyChangeListener
+ public class PropertyChangeHandler
+ implements PropertyChangeListener
{
/**
@@ -2547,15 +2433,15 @@ public class BasicTreeUI extends TreeUI
/**
* 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.
+ * @param event A PropertyChangeEvent object describing the event source and
+ * the property that has changed.
*/
public void propertyChange(PropertyChangeEvent event)
{
if ((event.getPropertyName()).equals("rootVisible"))
{
validCachedPreferredSize = false;
+ treeState.setRootVisible(tree.isRootVisible());
tree.repaint();
}
}
@@ -2565,8 +2451,8 @@ public class BasicTreeUI extends TreeUI
* Listener on the TreeSelectionModel, resets the row selection if any of the
* properties of the model change.
*/
- public class SelectionModelPropertyChangeHandler implements
- PropertyChangeListener
+ public class SelectionModelPropertyChangeHandler
+ implements PropertyChangeListener
{
/**
@@ -2580,9 +2466,8 @@ public class BasicTreeUI extends TreeUI
/**
* 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.
+ * @param event A PropertyChangeEvent object describing the event source and
+ * the property that has changed.
*/
public void propertyChange(PropertyChangeEvent event)
{
@@ -2593,7 +2478,8 @@ public class BasicTreeUI extends TreeUI
/**
* ActionListener that invokes cancelEditing when action performed.
*/
- public class TreeCancelEditingAction extends AbstractAction
+ public class TreeCancelEditingAction
+ extends AbstractAction
{
/**
@@ -2607,8 +2493,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when an action occurs.
*
- * @param e
- * event that occured
+ * @param e event that occured
*/
public void actionPerformed(ActionEvent e)
{
@@ -2630,7 +2515,8 @@ public class BasicTreeUI extends TreeUI
/**
* Updates the TreeState in response to nodes expanding/collapsing.
*/
- public class TreeExpansionHandler implements TreeExpansionListener
+ public class TreeExpansionHandler
+ implements TreeExpansionListener
{
/**
@@ -2644,25 +2530,23 @@ public class BasicTreeUI extends TreeUI
/**
* Called whenever an item in the tree has been expanded.
*
- * @param event
- * is the event that occured
+ * @param event is the event that occured
*/
public void treeExpanded(TreeExpansionEvent event)
{
validCachedPreferredSize = false;
- tree.repaint();
+ treeState.setExpandedState(event.getPath(), true);
}
/**
* Called whenever an item in the tree has been collapsed.
*
- * @param event
- * is the event that occured
+ * @param event is the event that occured
*/
public void treeCollapsed(TreeExpansionEvent event)
{
validCachedPreferredSize = false;
- tree.repaint();
+ treeState.setExpandedState(event.getPath(), false);
}
}// TreeExpansionHandler
@@ -2670,7 +2554,8 @@ public class BasicTreeUI extends TreeUI
* 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
+ public class TreeHomeAction
+ extends AbstractAction
{
/** The direction, either home or end */
@@ -2679,10 +2564,8 @@ public class BasicTreeUI extends TreeUI
/**
* Constructor
*
- * @param direction -
- * it is home or end
- * @param name
- * is the name of the direction
+ * @param direction - it is home or end
+ * @param name is the name of the direction
*/
public TreeHomeAction(int direction, String name)
{
@@ -2692,8 +2575,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when an action occurs.
*
- * @param e
- * is the event that occured
+ * @param e is the event that occured
*/
public void actionPerformed(ActionEvent e)
{
@@ -2716,7 +2598,8 @@ public class BasicTreeUI extends TreeUI
* TreeIncrementAction is used to handle up/down actions. Selection is moved
* up or down based on direction.
*/
- public class TreeIncrementAction extends AbstractAction
+ public class TreeIncrementAction
+ extends AbstractAction
{
/** Specifies the direction to adjust the selection by. */
@@ -2725,10 +2608,8 @@ public class BasicTreeUI extends TreeUI
/**
* Constructor
*
- * @param direction
- * up or down
- * @param name
- * is the name of the direction
+ * @param direction up or down
+ * @param name is the name of the direction
*/
public TreeIncrementAction(int direction, String name)
{
@@ -2738,73 +2619,60 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when an action occurs.
*
- * @param e
- * is the event that occured
+ * @param e is the event that occured
*/
public void actionPerformed(ActionEvent e)
{
- Object last = tree.getLeadSelectionPath().getLastPathComponent();
+ TreePath currentPath = tree.getLeadSelectionPath();
+ int currentRow;
- if (e.getActionCommand().equals("selectPreviousChangeLead"))
- {
- Object prev = getPreviousVisibleNode(last);
+ if (currentPath != null)
+ currentRow = treeState.getRowForPath(currentPath);
+ else
+ currentRow = 0;
- if (prev != null)
- {
- TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- selectPath(tree, newPath);
- tree.setLeadSelectionPath(newPath);
- }
+ int rows = treeState.getRowCount();
+
+ int nextRow = currentRow + 1;
+ int prevRow = currentRow - 1;
+ boolean hasNext = nextRow < rows;
+ boolean hasPrev = prevRow >= 0 && rows > 0;
+ TreePath newPath;
+ String command = e.getActionCommand();
+
+ if (command.equals("selectPreviousChangeLead") && hasPrev)
+ {
+ newPath = treeState.getPathForRow(prevRow);
+ selectPath(tree, newPath);
+ tree.setLeadSelectionPath(newPath);
}
- else if (e.getActionCommand().equals("selectPreviousExtendSelection"))
+ else if (command.equals("selectPreviousExtendSelection") && hasPrev)
{
- Object prev = getPreviousVisibleNode(last);
- if (prev != null)
- {
- TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- tree.addSelectionPath(newPath);
- tree.setLeadSelectionPath(newPath);
- }
+ newPath = treeState.getPathForRow(prevRow);
+ tree.addSelectionPath(newPath);
+ tree.setLeadSelectionPath(newPath);
}
- else if (e.getActionCommand().equals("selectPrevious"))
+ else if (command.equals("selectPrevious") && hasPrev)
{
- Object prev = getPreviousVisibleNode(last);
-
- if (prev != null)
- {
- TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- selectPath(tree, newPath);
- }
+ newPath = treeState.getPathForRow(prevRow);
+ selectPath(tree, newPath);
}
- else if (e.getActionCommand().equals("selectNext"))
+ else if (command.equals("selectNext") && hasNext)
{
- Object next = getNextVisibleNode(last);
-
- if (next != null)
- {
- TreePath newPath = new TreePath(getPathToRoot(next, 0));
- selectPath(tree, newPath);
- }
+ newPath = treeState.getPathForRow(nextRow);
+ selectPath(tree, newPath);
}
- else if (e.getActionCommand().equals("selectNextExtendSelection"))
+ else if (command.equals("selectNextExtendSelection") && hasNext)
{
- Object next = getNextVisibleNode(last);
- if (next != null)
- {
- TreePath newPath = new TreePath(getPathToRoot(next, 0));
- tree.addSelectionPath(newPath);
- tree.setLeadSelectionPath(newPath);
- }
+ newPath = treeState.getPathForRow(nextRow);
+ tree.addSelectionPath(newPath);
+ tree.setLeadSelectionPath(newPath);
}
- else if (e.getActionCommand().equals("selectNextChangeLead"))
+ else if (command.equals("selectNextChangeLead") && hasNext)
{
- Object next = getNextVisibleNode(last);
- if (next != null)
- {
- TreePath newPath = new TreePath(getPathToRoot(next, 0));
- selectPath(tree, newPath);
- tree.setLeadSelectionPath(newPath);
- }
+ newPath = treeState.getPathForRow(nextRow);
+ selectPath(tree, newPath);
+ tree.setLeadSelectionPath(newPath);
}
}
@@ -2823,7 +2691,8 @@ public class BasicTreeUI extends TreeUI
/**
* Forwards all TreeModel events to the TreeState.
*/
- public class TreeModelHandler implements TreeModelListener
+ public class TreeModelHandler
+ implements TreeModelListener
{
/**
* Constructor
@@ -2843,12 +2712,12 @@ public class BasicTreeUI extends TreeUI
* node(s). e.getChildIndices() returns the index(es) of the changed
* node(s).
*
- * @param e
- * is the event that occured
+ * @param e is the event that occured
*/
public void treeNodesChanged(TreeModelEvent e)
{
validCachedPreferredSize = false;
+ treeState.treeNodesChanged(e);
tree.repaint();
}
@@ -2857,12 +2726,12 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e is the event that occured
*/
public void treeNodesInserted(TreeModelEvent e)
{
validCachedPreferredSize = false;
+ treeState.treeNodesInserted(e);
tree.repaint();
}
@@ -2874,12 +2743,12 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e is the event that occured
*/
public void treeNodesRemoved(TreeModelEvent e)
{
validCachedPreferredSize = false;
+ treeState.treeNodesRemoved(e);
tree.repaint();
}
@@ -2890,15 +2759,15 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @param e is the event that occured
*/
public void treeStructureChanged(TreeModelEvent e)
{
if (e.getPath().length == 1
- && !e.getPath()[0].equals(treeModel.getRoot()))
+ && ! e.getPath()[0].equals(treeModel.getRoot()))
tree.expandPath(new TreePath(treeModel.getRoot()));
validCachedPreferredSize = false;
+ treeState.treeStructureChanged(e);
tree.repaint();
}
}// TreeModelHandler
@@ -2906,7 +2775,8 @@ public class BasicTreeUI extends TreeUI
/**
* TreePageAction handles page up and page down events.
*/
- public class TreePageAction extends AbstractAction
+ public class TreePageAction
+ extends AbstractAction
{
/** Specifies the direction to adjust the selection by. */
protected int direction;
@@ -2914,10 +2784,8 @@ public class BasicTreeUI extends TreeUI
/**
* Constructor
*
- * @param direction
- * up or down
- * @param name
- * is the name of the direction
+ * @param direction up or down
+ * @param name is the name of the direction
*/
public TreePageAction(int direction, String name)
{
@@ -2927,8 +2795,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when an action occurs.
*
- * @param e
- * is the event that occured
+ * @param e is the event that occured
*/
public void actionPerformed(ActionEvent e)
{
@@ -2950,7 +2817,8 @@ public class BasicTreeUI extends TreeUI
* Listens for changes in the selection model and updates the display
* accordingly.
*/
- public class TreeSelectionHandler implements TreeSelectionListener
+ public class TreeSelectionHandler
+ implements TreeSelectionListener
{
/**
* Constructor
@@ -2964,8 +2832,7 @@ public class BasicTreeUI extends TreeUI
* 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.
+ * @param event the event that characterizes the change.
*/
public void valueChanged(TreeSelectionEvent event)
{
@@ -2977,13 +2844,13 @@ public class BasicTreeUI extends TreeUI
/**
* For the first selected row expandedness will be toggled.
*/
- public class TreeToggleAction extends AbstractAction
+ public class TreeToggleAction
+ extends AbstractAction
{
/**
* Constructor
*
- * @param name
- * is the name of <code>Action</code> field
+ * @param name is the name of <code>Action</code> field
*/
public TreeToggleAction(String name)
{
@@ -2993,8 +2860,7 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when an action occurs.
*
- * @param e
- * the event that occured
+ * @param e the event that occured
*/
public void actionPerformed(ActionEvent e)
{
@@ -3016,7 +2882,8 @@ public class BasicTreeUI extends TreeUI
* 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
+ public class TreeTraverseAction
+ extends AbstractAction
{
/**
* Determines direction to traverse, 1 means expand, -1 means collapse.
@@ -3026,10 +2893,8 @@ public class BasicTreeUI extends TreeUI
/**
* Constructor
*
- * @param direction
- * to traverse
- * @param name
- * is the name of the direction
+ * @param direction to traverse
+ * @param name is the name of the direction
*/
public TreeTraverseAction(int direction, String name)
{
@@ -3039,36 +2904,25 @@ public class BasicTreeUI extends TreeUI
/**
* Invoked when an action occurs.
*
- * @param e
- * the event that occured
+ * @param e the event that occured
*/
public void actionPerformed(ActionEvent e)
{
- Object last = tree.getLeadSelectionPath().getLastPathComponent();
+ TreePath current = tree.getLeadSelectionPath();
+ if (current == null)
+ return;
if (e.getActionCommand().equals("selectParent"))
- {
- TreePath path = new TreePath(getPathToRoot(last, 0));
- Object p = getParent(treeModel.getRoot(), last);
-
- if (!treeModel.isLeaf(last))
- toggleExpandState(path);
- else if (p != null)
- selectPath(tree, new TreePath(getPathToRoot(p, 0)));
- }
+ selectPath(tree, current.getParentPath());
else if (e.getActionCommand().equals("selectChild"))
{
- TreePath path = new TreePath(getPathToRoot(last, 0));
-
- if (!treeModel.isLeaf(last))
- toggleExpandState(path);
- else
- {
- Object next = getNextVisibleNode(last);
+ Object node = current.getLastPathComponent();
+ int nc = treeModel.getChildCount(node);
+ if (nc > 0)
+ node = treeModel.getChild(node, 0);
- if (next != null)
- selectPath(tree, new TreePath(getPathToRoot(next, 0)));
- }
+ TreePath path = current.pathByAddingChild(node);
+ selectPath(tree, path);
}
}
@@ -3113,10 +2967,8 @@ public class BasicTreeUI extends TreeUI
/**
* Returns the parent of the current node
*
- * @param root
- * is the root of the tree
- * @param node
- * is 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)
@@ -3132,15 +2984,13 @@ public class BasicTreeUI extends TreeUI
/**
* 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
+ * @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)
{
- if (!treeModel.isLeaf(root) && !root.equals(node))
+ if (! treeModel.isLeaf(root) && ! root.equals(node))
{
int size = treeModel.getChildCount(root);
for (int j = 0; j < size; j++)
@@ -3158,145 +3008,11 @@ public class BasicTreeUI extends TreeUI
}
/**
- * Get previous visible node in the tree. Package private for use in inner
- * classes.
- *
- * @param node -
- * current node
- * @return the next visible node in the JTree. Return null if there are no
- * more.
- */
- Object getPreviousVisibleNode(Object node)
- {
- if (currentVisiblePath != null)
- {
- Object[] nodes = currentVisiblePath.getPath();
- int i = 0;
- while (i < nodes.length && !node.equals(nodes[i]))
- i++;
- // return the next node
- if (i - 1 >= 0)
- return nodes[i - 1];
- }
- return null;
- }
-
- /**
- * Returns the next node in the tree Package private for use in inner classes.
- *
- * @param curr -
- * current node
- * @return the next node in the tree
- */
- Object getNextNode(Object curr)
- {
- if (!treeModel.isLeaf(curr) && treeModel.getChildCount(curr) > 0)
- return treeModel.getChild(curr, 0);
-
- Object node = curr;
- Object sibling = null;
- do
- {
- sibling = getNextSibling(node);
- node = getParent(treeModel.getRoot(), node);
- }
- while (sibling == null && node != null);
-
- return sibling;
- }
-
- /**
- * Returns the previous node in the tree Package private for use in inner
- * classes.
- *
- * @param node
- * current node
- * @return the previous node in the tree
- */
- Object getPreviousNode(Object node)
- {
- Object parent = getParent(treeModel.getRoot(), node);
- if (parent == null)
- return null;
-
- Object sibling = getPreviousSibling(node);
-
- if (sibling == null)
- return parent;
-
- int size = 0;
- if (!treeModel.isLeaf(sibling))
- size = treeModel.getChildCount(sibling);
- while (size > 0)
- {
- sibling = treeModel.getChild(sibling, size - 1);
- if (!treeModel.isLeaf(sibling))
- size = treeModel.getChildCount(sibling);
- else
- size = 0;
- }
-
- return sibling;
- }
-
- /**
- * Returns the next sibling in the tree Package private for use in inner
- * classes.
- *
- * @param node -
- * current node
- * @return the next sibling in the tree
- */
- Object getNextSibling(Object node)
- {
- Object parent = getParent(treeModel.getRoot(), node);
- if (parent == null)
- return null;
-
- int index = treeModel.getIndexOfChild(parent, node) + 1;
-
- int size = 0;
- if (!treeModel.isLeaf(parent))
- size = treeModel.getChildCount(parent);
- if (index == 0 || index >= size)
- return null;
-
- return treeModel.getChild(parent, index);
- }
-
- /**
- * Returns the previous sibling in the tree Package private for use in inner
- * classes.
- *
- * @param node -
- * current node
- * @return the previous sibling in the tree
- */
- Object getPreviousSibling(Object node)
- {
- Object parent = getParent(treeModel.getRoot(), node);
- if (parent == null)
- return null;
-
- int index = treeModel.getIndexOfChild(parent, node) - 1;
-
- int size = 0;
- if (!treeModel.isLeaf(parent))
- size = treeModel.getChildCount(parent);
- if (index < 0 || index >= size)
- return null;
-
- return treeModel.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
+ * @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)
{
@@ -3319,6 +3035,7 @@ public class BasicTreeUI extends TreeUI
tree.getSelectionModel().setSelectionMode(
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
+ tree.scrollPathToVisible(path);
}
}
@@ -3326,10 +3043,8 @@ public class BasicTreeUI extends TreeUI
* 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
+ * @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)
@@ -3349,47 +3064,13 @@ public class BasicTreeUI extends TreeUI
}
/**
- * Returns the level of the node in the tree.
- *
- * @param node -
- * current node
- * @return the number of the level
- */
- int getLevel(Object node)
- {
- int count = -1;
-
- Object current = node;
-
- if (treeModel != null)
- {
- Object root = treeModel.getRoot();
- if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root)))
- count--;
-
- do
- {
- current = getParent(root, 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
+ * @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)
@@ -3402,16 +3083,11 @@ public class BasicTreeUI extends TreeUI
/**
* 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
+ * @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)
@@ -3424,16 +3100,11 @@ public class BasicTreeUI extends TreeUI
/**
* 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
+ * @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
*/
protected void drawCentered(Component c, Graphics g, Icon icon, int x, int y)
{
@@ -3451,14 +3122,10 @@ public class BasicTreeUI extends TreeUI
/**
* Draws a dashed horizontal line.
*
- * @param g -
- * the graphics configuration.
- * @param y -
- * the y location to start drawing at
- * @param x1 -
- * the x location to start drawing at
- * @param x2 -
- * the x location to finish drawing at
+ * @param g - the graphics configuration.
+ * @param y - the y location to start drawing at
+ * @param x1 - the x location to start drawing at
+ * @param x2 - the x location to finish drawing at
*/
protected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
{
@@ -3470,14 +3137,10 @@ public class BasicTreeUI extends TreeUI
/**
* Draws a dashed vertical line.
*
- * @param g -
- * the graphics configuration.
- * @param x -
- * the x location to start drawing at
- * @param y1 -
- * the y location to start drawing at
- * @param y2 -
- * the y location to finish drawing at
+ * @param g - the graphics configuration.
+ * @param x - the x location to start drawing at
+ * @param y1 - the y location to start drawing at
+ * @param y2 - the y location to finish drawing at
*/
protected void drawDashedVerticalLine(Graphics g, int x, int y1, int y2)
{
@@ -3490,22 +3153,15 @@ public class BasicTreeUI extends TreeUI
* Paints the expand (toggle) part of a row. The receiver should NOT modify
* clipBounds, or insets.
*
- * @param g -
- * the graphics configuration
+ * @param g - the graphics configuration
* @param clipBounds -
* @param insets -
- * @param bounds -
- * bounds of expand control
- * @param path -
- * path to draw control for
- * @param row -
- * row to draw control for
- * @param isExpanded -
- * is the row expanded
- * @param hasBeenExpanded -
- * has the row already been expanded
- * @param isLeaf -
- * is the path a leaf
+ * @param bounds - bounds of expand control
+ * @param path - path to draw control for
+ * @param row - row to draw control for
+ * @param isExpanded - is the row expanded
+ * @param hasBeenExpanded - has the row already been expanded
+ * @param isLeaf - is the path a leaf
*/
protected void paintExpandControl(Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds,
@@ -3529,22 +3185,15 @@ public class BasicTreeUI extends TreeUI
* clipBounds, or insets. NOTE: parentRow can be -1 if the root is not
* visible.
*
- * @param g -
- * the graphics configuration
+ * @param g - the graphics configuration
* @param clipBounds -
* @param insets -
- * @param bounds -
- * bounds of the cell
- * @param path -
- * path to draw leg for
- * @param row -
- * row to start drawing at
- * @param isExpanded -
- * is the row expanded
- * @param hasBeenExpanded -
- * has the row already been expanded
- * @param isLeaf -
- * is the path a leaf
+ * @param bounds - bounds of the cell
+ * @param path - path to draw leg for
+ * @param row - row to start drawing at
+ * @param isExpanded - is the row expanded
+ * @param hasBeenExpanded - has the row already been expanded
+ * @param isLeaf - is the path a leaf
*/
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds,
@@ -3562,37 +3211,22 @@ public class BasicTreeUI extends TreeUI
* Paints the vertical part of the leg. The receiver should NOT modify
* clipBounds, insets.
*
- * @param g -
- * the graphics configuration.
+ * @param g - the graphics configuration.
* @param clipBounds -
* @param insets -
- * @param path -
- * the path to draw the vertical part for.
+ * @param path - the path to draw the vertical part for.
*/
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
Insets insets, TreePath path)
{
- int max = tree.getVisibleRowCount();
- for (int i = 0; i < max; i++)
+ Rectangle bounds = getPathBounds(tree, path);
+ TreePath parent = path.getParentPath();
+ if (parent != null)
{
- Object curr = path.getPathComponent(i);
- TreePath currPath = new TreePath(getPathToRoot(curr, 0));
- int numChild = treeModel.getChildCount(curr);
- if (numChild > 0 && tree.isExpanded(currPath))
- {
- Rectangle bounds = getPathBounds(tree, currPath);
- Rectangle lastChildBounds = getPathBounds(
- tree,
- new TreePath(
- getPathToRoot(
- treeModel.getChild(
- curr,
- numChild - 1),
- 0)));
- paintVerticalLine(g, tree, bounds.x + gap + 2, bounds.y
- + bounds.height - 2,
- lastChildBounds.y + lastChildBounds.height / 2);
- }
+ Rectangle parentBounds = getPathBounds(tree, parent);
+ paintVerticalLine(g, tree, parentBounds.x + gap + 2,
+ parentBounds.y + parentBounds.height / 2,
+ bounds.y + bounds.height / 2);
}
}
@@ -3600,22 +3234,15 @@ public class BasicTreeUI extends TreeUI
* Paints the renderer part of a row. The receiver should NOT modify
* clipBounds, or insets.
*
- * @param g -
- * the graphics configuration
+ * @param g - the graphics configuration
* @param clipBounds -
* @param insets -
- * @param bounds -
- * bounds of expand control
- * @param path -
- * path to draw control for
- * @param row -
- * row to draw control for
- * @param isExpanded -
- * is the row expanded
- * @param hasBeenExpanded -
- * has the row already been expanded
- * @param isLeaf -
- * is the path a leaf
+ * @param bounds - bounds of expand control
+ * @param path - path to draw control for
+ * @param row - row to draw control for
+ * @param isExpanded - is the row expanded
+ * @param hasBeenExpanded - has the row already been expanded
+ * @param isLeaf - is the path a leaf
*/
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets,
Rectangle bounds, TreePath path, int row,
@@ -3626,26 +3253,17 @@ public class BasicTreeUI extends TreeUI
boolean hasIcons = false;
Object node = path.getLastPathComponent();
- if (tree.isVisible(path))
- {
- if (!validCachedPreferredSize)
- updateCachedPreferredSize();
-
- paintExpandControl(g, clipBounds, insets, bounds, path, row,
- isExpanded, hasBeenExpanded, isLeaf);
-
- if (row != 0)
- bounds.x += gap;
- bounds.width = preferredSize.width + bounds.x;
- TreeCellRenderer dtcr = tree.getCellRenderer();
- if (dtcr == null)
- dtcr = createDefaultCellRenderer();
-
- Component c = dtcr.getTreeCellRendererComponent(tree, node, selected,
- isExpanded, isLeaf,
- row, tree.hasFocus());
- rendererPane.paintComponent(g, c, c.getParent(), bounds);
- }
+ paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded,
+ hasBeenExpanded, isLeaf);
+
+ TreeCellRenderer dtcr = tree.getCellRenderer();
+ if (dtcr == null)
+ dtcr = createDefaultCellRenderer();
+
+ Component c = dtcr.getTreeCellRendererComponent(tree, node, selected,
+ isExpanded, isLeaf, row,
+ tree.hasFocus());
+ rendererPane.paintComponent(g, c, c.getParent(), bounds);
}
/**
@@ -3660,16 +3278,11 @@ public class BasicTreeUI extends TreeUI
* Returns true if the expand (toggle) control should be drawn for the
* specified row.
*
- * @param path -
- * current path to check for.
- * @param row -
- * current row to check for.
- * @param isExpanded -
- * true if the path is expanded
- * @param hasBeenExpanded -
- * true if the path has been expanded already
- * @param isLeaf -
- * true if the row is a lead
+ * @param path - current path to check for.
+ * @param row - current row to check for.
+ * @param isExpanded - true if the path is expanded
+ * @param hasBeenExpanded - true if the path has been expanded already
+ * @param isLeaf - true if the row is a lead
*/
protected boolean shouldPaintExpandControl(TreePath path, int row,
boolean isExpanded,
@@ -3677,119 +3290,21 @@ public class BasicTreeUI extends TreeUI
boolean isLeaf)
{
Object node = path.getLastPathComponent();
- return (!isLeaf && getLevel(node) != 0 && hasControlIcons());
- }
-
- /**
- * Updates the cached current TreePath of all visible nodes in the tree.
- */
- void updateCurrentVisiblePath()
- {
- if (treeModel == null)
- return;
-
- Object next = treeModel.getRoot();
- if (next == null)
- return;
-
- TreePath rootPath = new TreePath(next);
- Rectangle bounds = getPathBounds(tree, rootPath);
-
- // If root is not a valid size to be visible, or is
- // not visible and the tree is expanded, then the next node acts
- // as the root
- if ((bounds.width == 0 && bounds.height == 0)
- || (!isRootVisible() && tree.isExpanded(new TreePath(next))))
- {
- next = getNextNode(next);
- rootPath = new TreePath(next);
- }
-
- Object root = next;
- TreePath current = null;
- while (next != null)
- {
- if (current == null)
- current = rootPath;
- else
- current = current.pathByAddingChild(next);
-
- do
- {
- TreePath path = new TreePath(getPathToRoot(next, 0));
- if ((tree.isVisible(path) && tree.isExpanded(path))
- || treeModel.isLeaf(next))
- next = getNextNode(next);
- else
- {
- Object pNext = next;
- next = getNextSibling(pNext);
- // if no next sibling, check parent's next sibling.
- if (next == null)
- {
- Object parent = getParent(root, pNext);
- while (next == null && parent != null)
- {
- next = getNextSibling(parent);
- if (next == null)
- parent = getParent(root, parent);
- }
- }
- }
- }
- while (next != null
- && !tree.isVisible(new TreePath(getPathToRoot(next, 0))));
- }
-
- currentVisiblePath = current;
- tree.setVisibleRowCount(getRowCount(tree));
-
- if (tree.getSelectionModel() != null && tree.getSelectionCount() == 0
- && currentVisiblePath != null)
- selectPath(
- tree,
- new TreePath(
- getPathToRoot(
- currentVisiblePath.getPathComponent(0),
- 0)));
+ return (! isLeaf && hasControlIcons());
}
/**
- * Get next visible node in the currentVisiblePath. Package private for use in
- * inner classes.
- *
- * @param node
- * current node
- * @return the next visible node in the JTree. Return null if there are no
- * more.
+ * Finish the editing session.
*/
- Object getNextVisibleNode(Object node)
- {
- if (currentVisiblePath != null)
- {
- Object[] nodes = currentVisiblePath.getPath();
- int i = 0;
- while (i < nodes.length && !node.equals(nodes[i]))
- i++;
- // return the next node
- if (i + 1 < nodes.length)
- return nodes[i + 1];
- }
- return null;
- }
-
- /**
- * Finish the editing session.
- */
void finish()
{
editingPath = null;
- editingRow = -1;
+ editingRow = - 1;
stopEditingInCompleteEditing = false;
isEditing = false;
tree.removeAll();
validCachedPreferredSize = false;
-
+
// Repaint the region, where was the editing component.
tree.repaint(editingComponent.getParent().getBounds());
editingComponent = null;
diff --git a/javax/swing/plaf/metal/MetalButtonUI.java b/javax/swing/plaf/metal/MetalButtonUI.java
index 255669365..83cd33662 100644
--- a/javax/swing/plaf/metal/MetalButtonUI.java
+++ b/javax/swing/plaf/metal/MetalButtonUI.java
@@ -45,11 +45,13 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
+import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicButtonUI;
@@ -233,11 +235,12 @@ public class MetalButtonUI
public void update(Graphics g, JComponent c)
{
AbstractButton b = (AbstractButton) c;
+ ButtonModel m = b.getModel();
if (b.isContentAreaFilled()
- && MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme
- && UIManager.get(getPropertyPrefix() + "gradient") != null
- && ! b.getModel().isPressed() && ! b.getModel().isArmed()
- && b.isEnabled())
+ && (UIManager.get(getPropertyPrefix() + "gradient") != null)
+ && ! m.isPressed() && ! m.isArmed()
+ && b.isEnabled()
+ && (b.getBackground() instanceof UIResource))
{
MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
SwingConstants.VERTICAL,
diff --git a/javax/swing/plaf/metal/MetalDesktopIconUI.java b/javax/swing/plaf/metal/MetalDesktopIconUI.java
index ecbb76e6e..0c1163a8e 100644
--- a/javax/swing/plaf/metal/MetalDesktopIconUI.java
+++ b/javax/swing/plaf/metal/MetalDesktopIconUI.java
@@ -1,5 +1,5 @@
/* MetalDesktopIconUI.java
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,10 +50,6 @@ public class MetalDesktopIconUI
extends BasicDesktopIconUI
{
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalDesktopIcons */
- private static MetalDesktopIconUI instance = null;
-
/**
* Constructs a new instance of <code>MetalDesktopIconUI</code>.
*/
@@ -63,16 +59,14 @@ public class MetalDesktopIconUI
}
/**
- * Returns a shared instance of <code>MetalDesktopIconUI</code>.
+ * Returns a new <code>MetalDesktopIconUI</code> instance.
*
- * @param component the component for which we return an UI instance
+ * @param component the component (ignored).
*
- * @return A shared instance of <code>MetalDesktopIconUI</code>.
+ * @return A new <code>MetalDesktopIconUI</code> instance.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalDesktopIconUI();
- return instance;
+ return new MetalDesktopIconUI();
}
}
diff --git a/javax/swing/plaf/metal/MetalRootPaneUI.java b/javax/swing/plaf/metal/MetalRootPaneUI.java
index 38dfa3717..6cabc7e86 100644
--- a/javax/swing/plaf/metal/MetalRootPaneUI.java
+++ b/javax/swing/plaf/metal/MetalRootPaneUI.java
@@ -47,11 +47,11 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.LayoutManager2;
+import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.ActionEvent;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowFocusListener;
+import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import javax.swing.AbstractAction;
@@ -70,6 +70,7 @@ import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
+import javax.swing.event.MouseInputAdapter;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRootPaneUI;
@@ -191,6 +192,50 @@ public class MetalRootPaneUI
*/
private static class MetalTitlePane extends JComponent
{
+
+ /**
+ * Handles dragging of the title pane and moves the window accordingly.
+ */
+ private class MouseHandler
+ extends MouseInputAdapter
+ {
+ /**
+ * The point where the dragging started.
+ */
+ Point lastDragLocation;
+
+ /**
+ * Receives notification when the mouse gets pressed on the title pane.
+ * This updates the lastDragLocation.
+ *
+ * @param ev the mouse event
+ */
+ public void mousePressed(MouseEvent ev)
+ {
+ lastDragLocation = ev.getPoint();
+ }
+
+ /**
+ * Receives notification when the mouse is dragged on the title pane.
+ * This will move the nearest window accordingly.
+ *
+ * @param ev the mouse event
+ */
+ public void mouseDragged(MouseEvent ev)
+ {
+ Point dragLocation = ev.getPoint();
+ int deltaX = dragLocation.x - lastDragLocation.x;
+ int deltaY = dragLocation.y - lastDragLocation.y;
+ Window window = SwingUtilities.getWindowAncestor(rootPane);
+ Point loc = window.getLocation();
+ window.setLocation(loc.x + deltaX, loc.y + deltaY);
+ // Note that we do not update the lastDragLocation. This is because
+ // we move the underlying window while dragging the component, which
+ // results in having the same lastDragLocation under the mouse while
+ // dragging.
+ }
+ }
+
/**
* The Action responsible for closing the JInternalFrame.
*/
@@ -255,6 +300,45 @@ public class MetalRootPaneUI
}
/**
+ * This action is performed when the iconify button is pressed.
+ */
+ private class IconifyAction
+ extends AbstractAction
+ {
+
+ public void actionPerformed(ActionEvent event)
+ {
+ Window w = SwingUtilities.getWindowAncestor(rootPane);
+ if (w instanceof Frame)
+ {
+ Frame f = (Frame) w;
+ int state = f.getExtendedState();
+ f.setExtendedState(Frame.ICONIFIED);
+ }
+ }
+
+ }
+
+ /**
+ * This action is performed when the maximize button is pressed.
+ */
+ private class MaximizeAction
+ extends AbstractAction
+ {
+
+ public void actionPerformed(ActionEvent event)
+ {
+ Window w = SwingUtilities.getWindowAncestor(rootPane);
+ if (w instanceof Frame)
+ {
+ Frame f = (Frame) w;
+ int state = f.getExtendedState();
+ f.setExtendedState(Frame.MAXIMIZED_BOTH);
+ }
+ }
+ }
+
+ /**
* This helper class is used to create the minimize, maximize and close
* buttons in the top right corner of the Title Pane. These buttons are
* special since they cannot be given focus and have no border.
@@ -499,23 +583,16 @@ public class MetalRootPaneUI
private void installListeners()
{
- Window window = SwingUtilities.getWindowAncestor(rootPane);
- window.addWindowFocusListener(new WindowFocusListener()
- {
- public void windowGainedFocus(WindowEvent ev)
- {
- repaint();
- }
- public void windowLostFocus(WindowEvent ev)
- {
- repaint();
- }
- });
+ MouseInputAdapter mouseHandler = new MouseHandler();
+ addMouseListener(mouseHandler);
+ addMouseMotionListener(mouseHandler);
}
private void createActions()
{
closeAction = new CloseAction();
+ iconifyAction = new IconifyAction();
+ maximizeAction = new MaximizeAction();
}
private void assembleSystemMenu()
@@ -699,6 +776,21 @@ public class MetalRootPaneUI
*/
private Dimension prefSize;
+ /**
+ * The title pane for l&f decorated frames.
+ */
+ private MetalTitlePane titlePane;
+
+ /**
+ * Creates a new MetalRootLayout.
+ *
+ * @param tp the title pane
+ */
+ MetalRootLayout(MetalTitlePane tp)
+ {
+ titlePane = tp;
+ }
+
public void addLayoutComponent(Component component, Object constraints)
{
// Nothing to do here.
@@ -747,12 +839,8 @@ public class MetalRootPaneUI
{
JRootPane rp = (JRootPane) parent;
JLayeredPane layeredPane = rp.getLayeredPane();
- Component contentPane = layeredPane.getComponent(0);
- Component titlePane = layeredPane.getComponent(1);
- Component menuBar = null;
- if (layeredPane.getComponentCount() > 2
- && layeredPane.getComponent(2) instanceof JMenuBar)
- menuBar = layeredPane.getComponent(2);
+ Component contentPane = rp.getContentPane();
+ Component menuBar = rp.getJMenuBar();
// We must synchronize here, otherwise we cannot guarantee that the
// prefSize is still non-null when returning.
@@ -789,12 +877,8 @@ public class MetalRootPaneUI
{
JRootPane rp = (JRootPane) parent;
JLayeredPane layeredPane = rp.getLayeredPane();
- Component contentPane = layeredPane.getComponent(0);
- Component titlePane = layeredPane.getComponent(1);
- Component menuBar = null;
- if (layeredPane.getComponentCount() > 2
- && layeredPane.getComponent(2) instanceof JMenuBar)
- menuBar = layeredPane.getComponent(2);
+ Component contentPane = rp.getContentPane();
+ Component menuBar = rp.getJMenuBar();
Component glassPane = rp.getGlassPane();
if (glassPaneBounds == null || layeredPaneBounds == null
@@ -959,12 +1043,14 @@ public class MetalRootPaneUI
private void installWindowDecorations(JRootPane rp)
{
rp.setBorder(new MetalFrameBorder());
- rp.setLayout(new MetalRootLayout());
+ MetalTitlePane titlePane = new MetalTitlePane(rp);
+ rp.setLayout(new MetalRootLayout(titlePane));
// We should have a contentPane already.
- assert rp.getLayeredPane().getComponentCount() == 1
+ assert rp.getLayeredPane().getComponentCount() > 0
: "We should have a contentPane already";
- rp.getLayeredPane().add(new MetalTitlePane(rp),
- JLayeredPane.FRAME_CONTENT_LAYER);
+
+ rp.getLayeredPane().add(titlePane,
+ JLayeredPane.FRAME_CONTENT_LAYER, 1);
}
/**
@@ -976,6 +1062,14 @@ public class MetalRootPaneUI
private void uninstallWindowDecorations(JRootPane rp)
{
rp.setBorder(null);
- rp.getLayeredPane().remove(1);
+ JLayeredPane lp = rp.getLayeredPane();
+ for (int i = lp.getComponentCount() - 1; i >= 0; --i)
+ {
+ if (lp.getComponent(i) instanceof MetalTitlePane)
+ {
+ lp.remove(i);
+ break;
+ }
+ }
}
}
diff --git a/javax/swing/plaf/metal/MetalSliderUI.java b/javax/swing/plaf/metal/MetalSliderUI.java
index 9b2f45cc7..f97717f31 100644
--- a/javax/swing/plaf/metal/MetalSliderUI.java
+++ b/javax/swing/plaf/metal/MetalSliderUI.java
@@ -1,5 +1,5 @@
/* MetalSliderUI.java
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -210,7 +210,7 @@ public class MetalSliderUI extends BasicSliderUI
{
int trackX = trackRect.x;
int trackY = trackRect.y + (trackRect.height - getTrackWidth()) / 2;
- int trackW = trackRect.width - 1;
+ int trackW = trackRect.width;
int trackH = getTrackWidth();
// draw border
@@ -264,7 +264,7 @@ public class MetalSliderUI extends BasicSliderUI
int trackX = trackRect.x + (trackRect.width - getTrackWidth()) / 2;
int trackY = trackRect.y;
int trackW = getTrackWidth();
- int trackH = trackRect.height - 1;
+ int trackH = trackRect.height;
if (slider.isEnabled())
BasicGraphicsUtils.drawEtchedRect(g, trackX, trackY, trackW, trackH,
darkShadowColor, shadowColor, darkShadowColor, highlightColor);
diff --git a/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index 9e63aa2e3..39dec3d66 100644
--- a/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -137,7 +137,12 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI
/** The graphics to draw the highlight below the tab. */
private Graphics hg;
-
+
+ /**
+ * Indicates if the tabs are having their background filled.
+ */
+ private boolean tabsOpaque;
+
/**
* Constructs a new instance of MetalTabbedPaneUI.
*/
@@ -327,13 +332,13 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI
int firstIndex = tabRuns[currentRun];
// Paint the part of the above tab.
- if (tabIndex != firstIndex)
+ if (tabIndex != firstIndex && tabIndex > 0 && tabsOpaque)
{
Color c;
if (tabPane.getSelectedIndex() == tabIndex - 1)
c = selectColor;
else
- c = UIManager.getColor("TabbedPane.unselectedBackground");
+ c = getUnselectedBackground(tabIndex - 1);
g.setColor(c);
g.fillRect(2, 0, 4, 3);
g.drawLine(2, 3, 2, 3);
@@ -454,13 +459,13 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI
int firstIndex = tabRuns[currentRun];
// Paint part of the above tab.
- if (tabIndex != firstIndex)
+ if (tabIndex != firstIndex && tabIndex > 0 && tabsOpaque)
{
Color c;
if (tabPane.getSelectedIndex() == tabIndex - 1)
c = UIManager.getColor("TabbedPane.tabAreaBackground");
else
- c = UIManager.getColor("TabbedPane.unselectedBackground");
+ c = getUnselectedBackground(tabIndex - 1);
g.fillRect(right - 5, 0, 5, 3);
g.fillRect(right - 2, 3, 2, 2);
}
@@ -709,6 +714,7 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI
selectColor = UIManager.getColor("TabbedPane.selected");
selectHighlight = UIManager.getColor("TabbedPane.selectHighlight");
tabAreaBackground = UIManager.getColor("TabbedPane.tabAreaBackground");
+ tabsOpaque = UIManager.getBoolean("TabbedPane.tabsOpaque");
minTabWidth = 0;
}
diff --git a/javax/swing/plaf/metal/MetalToggleButtonUI.java b/javax/swing/plaf/metal/MetalToggleButtonUI.java
index b1ed33236..8c7a46e3a 100644
--- a/javax/swing/plaf/metal/MetalToggleButtonUI.java
+++ b/javax/swing/plaf/metal/MetalToggleButtonUI.java
@@ -45,12 +45,14 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.AbstractButton;
+import javax.swing.ButtonModel;
import javax.swing.JComponent;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicButtonUI;
import javax.swing.plaf.basic.BasicToggleButtonUI;
@@ -209,7 +211,12 @@ public class MetalToggleButtonUI
*/
public void update(Graphics g, JComponent c)
{
- if (c.isOpaque() && UIManager.get(getPropertyPrefix() + "gradient") != null)
+ AbstractButton b = (AbstractButton) c;
+ ButtonModel m = b.getModel();
+ if (b.getBackground() instanceof UIResource
+ && b.isContentAreaFilled()
+ && b.isEnabled() && ! m.isArmed() && ! m.isPressed()
+ && UIManager.get(getPropertyPrefix() + "gradient") != null)
{
MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
SwingConstants.VERTICAL,
diff --git a/javax/swing/plaf/synth/SynthPainter.java b/javax/swing/plaf/synth/SynthPainter.java
index b36a6bdd4..fa1f6f572 100644
--- a/javax/swing/plaf/synth/SynthPainter.java
+++ b/javax/swing/plaf/synth/SynthPainter.java
@@ -1418,23 +1418,6 @@ public abstract class SynthPainter
}
/**
- * Paints the border of a split pane's divider.
- *
- * @param ctx the synth context identifying the component and region for
- * painting
- * @param g the graphics context to use for painting
- * @param x the X coordinate of the area to paint
- * @param y the Y coordinate of the area to paint
- * @param w the width of the area to paint
- * @param h the height of the area to paint
- */
- public void paintSplitPaneDividerBorder(SynthContext ctx, Graphics g, int x,
- int y, int w, int h)
- {
- // Nothing to do here.
- }
-
- /**
* Paints the background of a tabbed pane.
*
* @param ctx the synth context identifying the component and region for
diff --git a/javax/swing/text/AsyncBoxView.java b/javax/swing/text/AsyncBoxView.java
index 1988bbadc..863c409ed 100644
--- a/javax/swing/text/AsyncBoxView.java
+++ b/javax/swing/text/AsyncBoxView.java
@@ -1030,7 +1030,7 @@ public class AsyncBoxView
*
* @since 1.4
*/
- public void setEstimatedMajorSpan(boolean estimated)
+ protected void setEstimatedMajorSpan(boolean estimated)
{
estimatedMajorSpan = estimated;
}
@@ -1045,7 +1045,7 @@ public class AsyncBoxView
*
* @since 1.4
*/
- public boolean getEstimatedMajorSpan()
+ protected boolean getEstimatedMajorSpan()
{
return estimatedMajorSpan;
}
diff --git a/javax/swing/text/BoxView.java b/javax/swing/text/BoxView.java
index b5907dcbb..a184a8131 100644
--- a/javax/swing/text/BoxView.java
+++ b/javax/swing/text/BoxView.java
@@ -1,5 +1,5 @@
/* BoxView.java -- An composite view
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -591,9 +591,12 @@ public class BoxView
for (int i = 0; i < count; ++i)
{
copy.setBounds(r);
- childAllocation(i, r);
+ // The next call modifies copy.
+ childAllocation(i, copy);
if (copy.contains(x, y))
{
+ // Modify r on success.
+ r.setBounds(copy);
result = getView(i);
break;
}
@@ -919,7 +922,7 @@ public class BoxView
return super.viewToModel(x, y, a, bias);
}
- protected boolean flipEastAndWestEnds(int position, Position.Bias bias)
+ protected boolean flipEastAndWestAtEnds(int position, Position.Bias bias)
{
// FIXME: What to do here?
return super.flipEastAndWestAtEnds(position, bias);
diff --git a/javax/swing/text/CompositeView.java b/javax/swing/text/CompositeView.java
index a10aca7e6..9195602ce 100644
--- a/javax/swing/text/CompositeView.java
+++ b/javax/swing/text/CompositeView.java
@@ -1,5 +1,5 @@
/* CompositeView.java -- An abstract view that manages child views
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -218,21 +218,24 @@ public abstract class CompositeView
throws BadLocationException
{
int childIndex = getViewIndex(pos, bias);
+ if (childIndex == -1)
+ throw new BadLocationException("Position " + pos + " is not represented by view.", pos);
+
Shape ret = null;
- if (childIndex != -1)
- {
- View child = getView(childIndex);
- Shape childAlloc = getChildAllocation(childIndex, a);
- if (childAlloc == null)
- ret = createDefaultLocation(a, bias);
- Shape result = child.modelToView(pos, childAlloc, bias);
- if (result != null)
- ret = result;
- else
- ret = createDefaultLocation(a, bias);
- }
- else
+
+ View child = getView(childIndex);
+ Shape childAlloc = getChildAllocation(childIndex, a);
+
+ if (childAlloc == null)
ret = createDefaultLocation(a, bias);
+
+ Shape result = child.modelToView(pos, childAlloc, bias);
+
+ if (result != null)
+ ret = result;
+ else
+ ret = createDefaultLocation(a, bias);
+
return ret;
}
@@ -301,7 +304,7 @@ public abstract class CompositeView
{
Rectangle r = getInsideAllocation(a);
View view = getViewAtPoint((int) x, (int) y, r);
- return view.viewToModel(x, y, a, b);
+ return view.viewToModel(x, y, r, b);
}
return 0;
}
diff --git a/javax/swing/text/DefaultCaret.java b/javax/swing/text/DefaultCaret.java
index a486166a6..9b6cd6b07 100644
--- a/javax/swing/text/DefaultCaret.java
+++ b/javax/swing/text/DefaultCaret.java
@@ -399,19 +399,20 @@ public class DefaultCaret extends Rectangle
}
else
{
- int nextWord = Utilities.getNextWord(t, newDot);
+ int wordStart = Utilities.getWordStart(t, newDot);
// When the mouse points at the offset of the first character
// in a word Utilities().getPreviousWord will not return that
// word but we want to select that. We have to use
- // Utilities.nextWord() to get it.
- if (newDot == nextWord)
+ // Utilities.getWordStart() to get it.
+ if (newDot == wordStart)
{
- setDot(nextWord);
- moveDot(Utilities.getNextWord(t, nextWord));
+ setDot(wordStart);
+ moveDot(Utilities.getWordEnd(t, wordStart));
}
else
{
+ int nextWord = Utilities.getNextWord(t, newDot);
int previousWord = Utilities.getPreviousWord(t, newDot);
int previousWordEnd = Utilities.getWordEnd(t, previousWord);
@@ -833,7 +834,7 @@ public class DefaultCaret extends Rectangle
if (visible)
{
g.setColor(textComponent.getCaretColor());
- g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height);
+ g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height - 1);
}
}
@@ -1100,7 +1101,16 @@ public class DefaultCaret extends Rectangle
// must set a valid value here, since otherwise the painting mechanism
// sets a zero clip and never calls paint.
if (height <= 0)
- height = getComponent().getHeight();
+ try
+ {
+ height = textComponent.modelToView(dot).height;
+ }
+ catch (BadLocationException ble)
+ {
+ // Should not happen.
+ throw new InternalError("Caret location not within document range.");
+ }
+
repaint();
}
diff --git a/javax/swing/text/FieldView.java b/javax/swing/text/FieldView.java
index b5b6f5214..928949b56 100644
--- a/javax/swing/text/FieldView.java
+++ b/javax/swing/text/FieldView.java
@@ -1,5 +1,5 @@
/* FieldView.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,20 +39,86 @@ exception statement from your version. */
package javax.swing.text;
import java.awt.Component;
-import java.awt.ComponentOrientation;
+import java.awt.Container;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.BoundedRangeModel;
import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
public class FieldView extends PlainView
{
+ BoundedRangeModel horizontalVisibility;
+
+ /** Caches the preferred span of the X axis. It is invalidated by
+ * setting it to -1f. This is done when text in the document
+ * is inserted, removed or changed. The value is corrected as
+ * soon as calculateHorizontalSpan() is called.
+ */
+ float cachedSpan = -1f;
+
public FieldView(Element elem)
{
super(elem);
+
+ }
+
+ /** Checks whether the given container is a JTextField. If so
+ * it retrieves the textfield's horizontalVisibility instance.
+ *
+ * <p>This method should be only called when the view's container
+ * is valid. Naturally that would be the setParent() method however
+ * that method is not overridden in the RI and that is why we chose
+ * paint() instead.</p>
+ */
+ private void checkContainer()
+ {
+ Container c = getContainer();
+
+ if (c instanceof JTextField)
+ {
+ horizontalVisibility = ((JTextField) c).getHorizontalVisibility();
+
+ // Provokes a repaint when the BoundedRangeModel's values change
+ // (which is what the RI does).
+ horizontalVisibility.addChangeListener(new ChangeListener(){
+ public void stateChanged(ChangeEvent event) {
+ getContainer().repaint();
+ };
+ });
+
+ // It turned out that the span calculated at this point is wrong
+ // and needs to be recalculated (e.g. a different font setting is
+ // not taken into account).
+ calculateHorizontalSpan();
+
+ // Initializes the BoundedRangeModel properly.
+ updateVisibility();
+ }
+
+ }
+
+ private void updateVisibility()
+ {
+ JTextField tf = (JTextField) getContainer();
+ Insets insets = tf.getInsets();
+
+ int width = tf.getWidth() - insets.left - insets.right;
+
+ horizontalVisibility.setMaximum(Math.max((int) ((cachedSpan != -1f)
+ ? cachedSpan
+ : calculateHorizontalSpan()),
+ width));
+
+ horizontalVisibility.setExtent(width - 1);
}
protected FontMetrics getFontMetrics()
@@ -78,35 +144,37 @@ public class FieldView extends PlainView
int y = rectIn.y + (rectIn.height - height) / 2;
// horizontal adjustment
JTextField textField = (JTextField) getContainer();
- int halign = textField.getHorizontalAlignment();
- int width = (int) getPreferredSpan(X_AXIS);
+ int width = (int) ((cachedSpan != -1f) ? cachedSpan : calculateHorizontalSpan());
int x;
- ComponentOrientation orientation = textField.getComponentOrientation();
- switch (halign)
- {
- case JTextField.CENTER:
- x = rectIn.x + (rectIn.width - width) / 2;
- break;
- case JTextField.RIGHT:
- x = rectIn.x + (rectIn.width - width);
- break;
- case JTextField.TRAILING:
- if (orientation.isLeftToRight())
- x = rectIn.x + (rectIn.width - width);
- else
- x = rectIn.x;
- break;
- case JTextField.LEADING:
- if (orientation.isLeftToRight())
+ if (horizontalVisibility != null && horizontalVisibility.getExtent() < width)
+ x = rectIn.x - horizontalVisibility.getValue();
+ else
+ switch (textField.getHorizontalAlignment())
+ {
+ case JTextField.CENTER:
+ x = rectIn.x + (rectIn.width - width) / 2;
+ break;
+ case JTextField.RIGHT:
+ x = rectIn.x + (rectIn.width - width - 1);
+ break;
+ case JTextField.TRAILING:
+ if (textField.getComponentOrientation().isLeftToRight())
+ x = rectIn.x + (rectIn.width - width - 1);
+ else
+ x = rectIn.x;
+ break;
+ case JTextField.LEADING:
+ if (textField.getComponentOrientation().isLeftToRight())
+ x = rectIn.x;
+ else
+ x = rectIn.x + (rectIn.width - width - 1);
+ break;
+ case JTextField.LEFT:
+ default:
x = rectIn.x;
- else
- x = rectIn.x + (rectIn.width - width);
- break;
- case JTextField.LEFT:
- default:
- x = rectIn.x;
- break;
- }
+ break;
+ }
+
return new Rectangle(x, y, width, height);
}
@@ -115,18 +183,31 @@ public class FieldView extends PlainView
if (axis != X_AXIS && axis != Y_AXIS)
throw new IllegalArgumentException();
- FontMetrics fm = getFontMetrics();
if (axis == Y_AXIS)
return super.getPreferredSpan(axis);
- String text;
+ if (cachedSpan != -1f)
+ return cachedSpan;
+
+ return calculateHorizontalSpan();
+ }
+
+ /** Calculates and sets the horizontal span and stores the value
+ * in cachedSpan.
+ */
+ private float calculateHorizontalSpan()
+ {
+ Segment s = getLineBuffer();
Element elem = getElement();
try
{
- text = elem.getDocument().getText(elem.getStartOffset(),
- elem.getEndOffset());
+ elem.getDocument().getText(elem.getStartOffset(),
+ elem.getEndOffset() - 1,
+ s);
+
+ return cachedSpan = Utilities.getTabbedTextWidth(s, getFontMetrics(), 0, this, s.offset);
}
catch (BadLocationException e)
{
@@ -135,8 +216,6 @@ public class FieldView extends PlainView
ae.initCause(e);
throw ae;
}
-
- return fm.stringWidth(text);
}
public int getResizeWeight(int axis)
@@ -153,19 +232,34 @@ public class FieldView extends PlainView
public void paint(Graphics g, Shape s)
{
+ if (horizontalVisibility == null)
+ checkContainer();
+
Shape newAlloc = adjustAllocation(s);
+
super.paint(g, newAlloc);
}
public void insertUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
+ cachedSpan = -1f;
+
+ if (horizontalVisibility != null)
+ updateVisibility();
+
Shape newAlloc = adjustAllocation(shape);
+
super.insertUpdate(ev, newAlloc, vf);
getContainer().repaint();
}
public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
+ cachedSpan = -1f;
+
+ if (horizontalVisibility != null)
+ updateVisibility();
+
Shape newAlloc = adjustAllocation(shape);
super.removeUpdate(ev, newAlloc, vf);
getContainer().repaint();
@@ -173,8 +267,13 @@ public class FieldView extends PlainView
public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
+ cachedSpan = -1f;
+
+ if (horizontalVisibility != null)
+ updateVisibility();
+
Shape newAlloc = adjustAllocation(shape);
- super.removeUpdate(ev, newAlloc, vf);
+ super.changedUpdate(ev, newAlloc, vf);
getContainer().repaint();
}
diff --git a/javax/swing/text/GapContent.java b/javax/swing/text/GapContent.java
index 28d1d6ee0..bad7c0a01 100644
--- a/javax/swing/text/GapContent.java
+++ b/javax/swing/text/GapContent.java
@@ -642,6 +642,14 @@ public class GapContent
if (addItems != null)
{
System.arraycopy(addItems, 0, buffer, gapStart, addSize);
+
+ // Position objects having their mark at the end of the gap
+ // (results in an offset equal to gapStart) should be moved down
+ // because the size of the gap will decrease by addSize and the
+ // offsets will increase by the same amount and the latter should
+ // not happen.
+ setPositionsInRange(gapEnd, 0, gapStart);
+
gapStart += addSize;
}
}
diff --git a/javax/swing/text/InternationalFormatter.java b/javax/swing/text/InternationalFormatter.java
index ba3cffaba..8db435c18 100644
--- a/javax/swing/text/InternationalFormatter.java
+++ b/javax/swing/text/InternationalFormatter.java
@@ -350,7 +350,7 @@ public class InternationalFormatter
* There is no such method in the whole API! So we just call
* super.getActions here.
*/
- public Action[] getActions()
+ protected Action[] getActions()
{
return super.getActions();
}
diff --git a/javax/swing/text/PlainView.java b/javax/swing/text/PlainView.java
index 61bdb5dc8..5f2f57705 100644
--- a/javax/swing/text/PlainView.java
+++ b/javax/swing/text/PlainView.java
@@ -164,7 +164,7 @@ public class PlainView extends View implements TabExpander
{
Element line = getElement().getElement(lineIndex);
int startOffset = line.getStartOffset();
- int endOffset = line.getEndOffset();
+ int endOffset = line.getEndOffset() - 1;
if (selectionStart <= startOffset)
// Selection starts before the line ...
@@ -198,7 +198,7 @@ public class PlainView extends View implements TabExpander
// and ends behind the line: First part unselected, second
// part selected.
x = drawUnselectedText(g, x, y, startOffset, selectionStart);
- drawSelectedText(g, x, y, selectionStart, selectionEnd);
+ drawSelectedText(g, x, y, selectionStart, endOffset);
}
else
// Selection is behind this line: Draw completely unselected text.
@@ -325,7 +325,7 @@ public class PlainView extends View implements TabExpander
{
Element child = el.getElement(i);
int start = child.getStartOffset();
- int end = child.getEndOffset();
+ int end = child.getEndOffset() - 1;
try
{
el.getDocument().getText(start, end - start, seg);
@@ -518,7 +518,7 @@ public class PlainView extends View implements TabExpander
{
Element child = newElements[i];
int start = child.getStartOffset();
- int end = child.getEndOffset();
+ int end = child.getEndOffset() - 1;
try
{
el.getDocument().getText(start, end - start, seg);
@@ -637,7 +637,7 @@ public class PlainView extends View implements TabExpander
* @returna {@link Segment} object, that can be used to fetch text from
* the document
*/
- protected Segment getLineBuffer()
+ protected final Segment getLineBuffer()
{
if (lineBuffer == null)
lineBuffer = new Segment();
diff --git a/javax/swing/text/Position.java b/javax/swing/text/Position.java
index a9d3d09d7..bb1449e18 100644
--- a/javax/swing/text/Position.java
+++ b/javax/swing/text/Position.java
@@ -40,7 +40,7 @@ package javax.swing.text;
public interface Position
{
- static class Bias
+ static final class Bias
{
public static final Bias Backward = new Bias("backward");
public static final Bias Forward = new Bias("forward");
diff --git a/javax/swing/text/Segment.java b/javax/swing/text/Segment.java
index 875d9966c..d2364e05a 100644
--- a/javax/swing/text/Segment.java
+++ b/javax/swing/text/Segment.java
@@ -245,7 +245,8 @@ public class Segment implements Cloneable, CharacterIterator
|| position > getEndIndex())
throw new IllegalArgumentException("position: " + position
+ ", beginIndex: " + getBeginIndex()
- + ", endIndex: " + getEndIndex());
+ + ", endIndex: " + getEndIndex()
+ + ", text: " + toString());
current = position;
@@ -264,7 +265,7 @@ public class Segment implements Cloneable, CharacterIterator
*/
public String toString()
{
- return new String(array, offset, count);
+ return (array != null) ? new String(array, offset, count) : "";
}
/**
diff --git a/javax/swing/text/Utilities.java b/javax/swing/text/Utilities.java
index da1ccdd4c..3149048f7 100644
--- a/javax/swing/text/Utilities.java
+++ b/javax/swing/text/Utilities.java
@@ -1,5 +1,5 @@
/* Utilities.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -238,14 +238,14 @@ public class Utilities
// At the end of the for loop, this holds the requested model location
int pos;
int currentX = x0;
-
+
for (pos = 0; pos < s.count; pos++)
{
char nextChar = s.array[s.offset+pos];
if (nextChar == 0)
{
- if (! round)
+ if (! round && pos > 0)
pos--;
break;
}
@@ -259,14 +259,13 @@ public class Utilities
currentX = (int) te.nextTabStop(currentX, pos);
}
- if (currentX > x)
+ if (currentX >= x)
{
- if (! round)
+ if (! round && pos > 0)
pos--;
break;
}
}
-
return pos + p0;
}
@@ -621,8 +620,22 @@ public class Utilities
if(offs == -1)
return -1;
- // Effectively calculates the y value of the previous line.
- Point pt = c.modelToView(offs+1).getLocation();
+ Point pt = null;
+
+ // Note: Some views represent the position after the last
+ // typed character others do not. Converting offset 3 in "a\nb"
+ // in a PlainView will return a valid rectangle while in a
+ // WrappedPlainView this will throw a BadLocationException.
+ // This behavior has been observed in the RI.
+ try
+ {
+ // Effectively calculates the y value of the next line.
+ pt = c.modelToView(offs+1).getLocation();
+ }
+ catch(BadLocationException ble)
+ {
+ return offset;
+ }
pt.x = x;
diff --git a/javax/swing/text/WrappedPlainView.java b/javax/swing/text/WrappedPlainView.java
index 3f65dd407..9477f23f7 100644
--- a/javax/swing/text/WrappedPlainView.java
+++ b/javax/swing/text/WrappedPlainView.java
@@ -1,5 +1,5 @@
/* WrappedPlainView.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -81,6 +81,9 @@ public class WrappedPlainView extends BoxView implements TabExpander
/** The end of the selected text **/
int selectionEnd;
+ /** The height of the line (used while painting) **/
+ int lineHeight;
+
/**
* The instance returned by {@link #getLineBuffer()}.
*/
@@ -273,7 +276,9 @@ public class WrappedPlainView extends BoxView implements TabExpander
{
Container c = getContainer();
Rectangle alloc = new Rectangle(0, 0, getWidth(), getHeight());
+
updateMetrics();
+
try
{
getDocument().getText(p0, p1 - p0, getLineBuffer());
@@ -281,18 +286,16 @@ public class WrappedPlainView extends BoxView implements TabExpander
catch (BadLocationException ble)
{
// this shouldn't happen
+ throw new InternalError("Invalid offsets p0: " + p0 + " - p1: " + p1);
}
// FIXME: Should we account for the insets of the container?
if (wordWrap)
- return p0
- + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x,
+ return p0 + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x,
alloc.x + alloc.width, this, 0);
else
- {
- return p0
- + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x,
- alloc.x + alloc.width, this, 0);
- }
+ return p0 + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x,
+ alloc.x + alloc.width, this, 0,
+ true);
}
void updateMetrics()
@@ -338,8 +341,8 @@ public class WrappedPlainView extends BoxView implements TabExpander
public void insertUpdate (DocumentEvent e, Shape a, ViewFactory f)
{
super.insertUpdate(e, a, viewFactory);
- // FIXME: could improve performance by repainting only the necessary area
- getContainer().repaint();
+
+ // No repaint needed, as this is done by the WrappedLine instances.
}
/**
@@ -349,8 +352,8 @@ public class WrappedPlainView extends BoxView implements TabExpander
public void removeUpdate (DocumentEvent e, Shape a, ViewFactory f)
{
super.removeUpdate(e, a, viewFactory);
- // FIXME: could improve performance by repainting only the necessary area
- getContainer().repaint();
+
+ // No repaint needed, as this is done by the WrappedLine instances.
}
/**
@@ -361,8 +364,8 @@ public class WrappedPlainView extends BoxView implements TabExpander
public void changedUpdate (DocumentEvent e, Shape a, ViewFactory f)
{
super.changedUpdate(e, a, viewFactory);
- // FIXME: could improve performance by repainting only the necessary area
- getContainer().repaint();
+
+ // No repaint needed, as this is done by the WrappedLine instances.
}
class WrappedLineCreator implements ViewFactory
@@ -385,9 +388,19 @@ public class WrappedPlainView extends BoxView implements TabExpander
public void paint(Graphics g, Shape a)
{
JTextComponent comp = (JTextComponent)getContainer();
+ // Ensure metrics are up-to-date.
+ updateMetrics();
+
selectionStart = comp.getSelectionStart();
selectionEnd = comp.getSelectionEnd();
- updateMetrics();
+
+ selectedColor = comp.getSelectedTextColor();
+ unselectedColor = comp.getForeground();
+ disabledColor = comp.getDisabledTextColor();
+ selectedColor = comp.getSelectedTextColor();
+ lineHeight = metrics.getHeight();
+ g.setFont(comp.getFont());
+
super.paint(g, a);
}
@@ -420,21 +433,7 @@ public class WrappedPlainView extends BoxView implements TabExpander
*/
public void paint(Graphics g, Shape s)
{
- // Ensure metrics are up-to-date.
- updateMetrics();
- JTextComponent textComponent = (JTextComponent) getContainer();
-
- g.setFont(textComponent.getFont());
- selectedColor = textComponent.getSelectedTextColor();
- unselectedColor = textComponent.getForeground();
- disabledColor = textComponent.getDisabledTextColor();
-
- // FIXME: this is a hack, for some reason textComponent.getSelectedColor
- // was returning black, which is not visible against a black background
- selectedColor = Color.WHITE;
-
Rectangle rect = s.getBounds();
- int lineHeight = metrics.getHeight();
int end = getEndOffset();
int currStart = getStartOffset();
@@ -452,16 +451,16 @@ public class WrappedPlainView extends BoxView implements TabExpander
}
/**
- * Determines the number of logical lines that the Element
- * needs to be displayed
- * @return the number of lines needed to display the Element
+ * Calculates the number of logical lines that the Element
+ * needs to be displayed and updates the variable numLines
+ * accordingly.
*/
- int determineNumLines()
+ void determineNumLines()
{
numLines = 0;
int end = getEndOffset();
if (end == 0)
- return 0;
+ return;
int breakPoint;
for (int i = getStartOffset(); i < end;)
@@ -470,12 +469,14 @@ public class WrappedPlainView extends BoxView implements TabExpander
// careful: check that there's no off-by-one problem here
// depending on which position calculateBreakPosition returns
breakPoint = calculateBreakPosition(i, end);
+
+ // If breakPoint is equal to the current index no further
+ // line is needed and we can end the loop.
if (breakPoint == i)
- i ++;
+ break;
else
i = breakPoint;
}
- return numLines;
}
/**
@@ -532,7 +533,7 @@ public class WrappedPlainView extends BoxView implements TabExpander
// If pos is between currLineStart and currLineEnd then just find
// the width of the text from currLineStart to pos and add that
// to rect.x
- if (pos >= currLineStart && pos < currLineEnd || pos == end - 1)
+ if (pos >= currLineStart && pos < currLineEnd)
{
try
{
@@ -576,12 +577,20 @@ public class WrappedPlainView extends BoxView implements TabExpander
Segment s = getLineBuffer();
Rectangle rect = a.getBounds();
int currLineStart = getStartOffset();
- int end = getEndOffset();
+
+ // WrappedLine does not represent the last possible offset in a line.
+ // So we should never return that offset. Behavior observed in the RI.
+ int end = getEndOffset() - 1;
+
int lineHeight = metrics.getHeight();
if (y < rect.y)
return currLineStart;
if (y > rect.y + rect.height)
- return end - 1;
+ return end;
+
+ // Note: rect.x and rect.width do not represent the width of painted
+ // text but the area where text *may* be painted. This means the width
+ // is most of the time identical to the component's width.
while (true)
{
@@ -590,35 +599,26 @@ public class WrappedPlainView extends BoxView implements TabExpander
// logical line and we should look for the character
if (y >= rect.y && y < rect.y + lineHeight)
{
- // Check if the x position is to the left or right of the text
- if (x < rect.x)
- return currLineStart;
- if (x > rect.x + rect.width)
- return currLineEnd - 1;
-
try
{
- getDocument().getText(currLineStart, end - currLineStart, s);
+ getDocument().getText(currLineStart, currLineEnd - currLineStart, s);
}
catch (BadLocationException ble)
{
// Shouldn't happen
}
- int mark = Utilities.getTabbedTextOffset(s, metrics, rect.x,
- (int) x,
- WrappedPlainView.this,
- currLineStart);
- return currLineStart + mark;
+
+ return Utilities.getTabbedTextOffset(s, metrics, rect.x,
+ (int) x,
+ WrappedPlainView.this,
+ currLineStart);
}
// Increment rect.y so we're checking the next logical line
rect.y += lineHeight;
// Increment currLineStart to the model position of the start
// of the next logical line
- if (currLineEnd == currLineStart)
- currLineStart = end;
- else
- currLineStart = currLineEnd;
+ currLineStart = currLineEnd;
}
}
@@ -632,12 +632,11 @@ public class WrappedPlainView extends BoxView implements TabExpander
*/
void updateDamage (Rectangle a)
{
- int newNumLines = determineNumLines();
- if (numLines != newNumLines)
- {
- numLines = newNumLines;
- getContainer().repaint();
- }
+ int oldNumLines = numLines;
+ determineNumLines();
+
+ if (numLines != oldNumLines)
+ preferenceChanged(this, false, true);
else
getContainer().repaint(a.x, a.y, a.width, a.height);
}
@@ -665,6 +664,15 @@ public class WrappedPlainView extends BoxView implements TabExpander
*/
public void removeUpdate (DocumentEvent changes, Shape a, ViewFactory f)
{
+ // Note: This method is not called when characters from the
+ // end of the document are removed. The reason for this
+ // can be found in the implementation of View.forwardUpdate:
+ // The document event will denote offsets which do not exist
+ // any more, getViewIndex() will therefore return -1 and this
+ // makes View.forwardUpdate() skip this method call.
+ // However this seems to cause no trouble and as it reduces the
+ // number of method calls it can stay this way.
+
updateDamage((Rectangle)a);
}
}
diff --git a/javax/swing/text/html/HTML.java b/javax/swing/text/html/HTML.java
index 775bd3bc3..b803e9637 100644
--- a/javax/swing/text/html/HTML.java
+++ b/javax/swing/text/html/HTML.java
@@ -292,7 +292,7 @@ public class HTML
/**
* The media attribute
*/
- public static final Attribute MEDIA = new Attribute("media");
+ static final Attribute MEDIA = new Attribute("media");
/**
* The method attribute
@@ -758,7 +758,7 @@ public class HTML
/**
* The &lt;nobr&gt; tag
*/
- public static final Tag NOBR = new Tag("nobr");
+ static final Tag NOBR = new Tag("nobr");
/**
* The &lt;noframes&gt; tag , breaks flow, block tag.
diff --git a/javax/swing/text/html/NullView.java b/javax/swing/text/html/NullView.java
index 4b66c5ad8..86ce0c10f 100644
--- a/javax/swing/text/html/NullView.java
+++ b/javax/swing/text/html/NullView.java
@@ -52,8 +52,8 @@ import javax.swing.text.Position.Bias;
*
* @author Roman Kennke (kennke@aicas.com)
*/
-public class NullView
- extends View
+class NullView
+ extends View
{
/**
diff --git a/javax/swing/text/html/parser/Entity.java b/javax/swing/text/html/parser/Entity.java
index 766984f9c..cf294c748 100644
--- a/javax/swing/text/html/parser/Entity.java
+++ b/javax/swing/text/html/parser/Entity.java
@@ -54,7 +54,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public final class Entity
- implements DTDConstants, Serializable
+ implements DTDConstants
{
/**
* Package level mapper between type names and they string values.
diff --git a/javax/swing/tree/AbstractLayoutCache.java b/javax/swing/tree/AbstractLayoutCache.java
index 149b908b3..48c0dff8e 100644
--- a/javax/swing/tree/AbstractLayoutCache.java
+++ b/javax/swing/tree/AbstractLayoutCache.java
@@ -51,366 +51,371 @@ import javax.swing.event.TreeModelEvent;
* @author Andrew Selkirk
*/
public abstract class AbstractLayoutCache
- implements RowMapper
+ implements RowMapper
{
- /**
- * class NodeDimensions
- */
- public abstract static class NodeDimensions
- {
- /**
- * Creates <code>NodeDimensions</code> object.
- */
- public NodeDimensions()
- {
- // Do nothing here.
- }
-
- /**
- * getNodeDimensions
- *
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- * @param value4 TODO
- * @return Rectangle
- */
- public abstract Rectangle getNodeDimensions(Object value0, int value1,
- int value2, boolean value3, Rectangle value4);
- }
-
- /**
- * nodeDimensions
- */
- protected NodeDimensions nodeDimensions;
-
- /**
- * treeModel
- */
- protected TreeModel treeModel;
-
- /**
- * treeSelectionModel
- */
- protected TreeSelectionModel treeSelectionModel;
-
- /**
- * rootVisible
- */
- protected boolean rootVisible;
-
- /**
- * rowHeight
- */
- protected int rowHeight;
-
- /**
- * Constructor AbstractLayoutCache
- */
- public AbstractLayoutCache()
- {
- // Do nothing here.
- }
-
- /**
- * setNodeDimensions
- *
- * @param dimensions TODO
- */
- public void setNodeDimensions(NodeDimensions dimensions)
- {
- nodeDimensions = dimensions;
- }
-
- /**
- * getNodeDimensions
- *
- * @return NodeDimensions
- */
- public NodeDimensions getNodeDimensions()
- {
- return nodeDimensions;
- }
-
- /**
- * getNodeDimensions
- *
- * @param value TODO
- * @param row TODO
- * @param depth TODO
- * @param expanded TODO
- * @param bounds TODO
- *
- * @return Rectangle
- */
- protected Rectangle getNodeDimensions(Object value, int row, int depth,
- boolean expanded, Rectangle bounds)
+ /**
+ * class NodeDimensions
+ */
+ public abstract static class NodeDimensions
+ {
+ /**
+ * Creates <code>NodeDimensions</code> object.
+ */
+ public NodeDimensions()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * getNodeDimensions
+ *
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ * @param value3 TODO
+ * @param value4 TODO
+ * @return Rectangle
+ */
+ public abstract Rectangle getNodeDimensions(Object value0, int value1,
+ int value2, boolean value3,
+ Rectangle value4);
+ }
+
+ /**
+ * nodeDimensions
+ */
+ protected NodeDimensions nodeDimensions;
+
+ /**
+ * treeModel
+ */
+ protected TreeModel treeModel;
+
+ /**
+ * treeSelectionModel
+ */
+ protected TreeSelectionModel treeSelectionModel;
+
+ /**
+ * rootVisible
+ */
+ protected boolean rootVisible;
+
+ /**
+ * rowHeight
+ */
+ protected int rowHeight;
+
+ /**
+ * Constructor AbstractLayoutCache
+ */
+ public AbstractLayoutCache()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * setNodeDimensions
+ *
+ * @param dimensions TODO
+ */
+ public void setNodeDimensions(NodeDimensions dimensions)
+ {
+ nodeDimensions = dimensions;
+ }
+
+ /**
+ * getNodeDimensions
+ *
+ * @return NodeDimensions
+ */
+ public NodeDimensions getNodeDimensions()
+ {
+ return nodeDimensions;
+ }
+
+ /**
+ * Get the node dimensions. The NodeDimensions property must be set
+ * (unless the method is overridden, like if
+ * {@link FixedHeightLayoutCache}. If the method is not overridden and
+ * the property is not set, the InternalError is thrown.
+ *
+ * @param value the last node in the path
+ * @param row the node row
+ * @param depth the indentation depth
+ * @param expanded true if this node is expanded, false otherwise
+ * @param bounds the area where the tree is displayed
+ */
+ protected Rectangle getNodeDimensions(Object value, int row, int depth,
+ boolean expanded, Rectangle bounds)
+ {
+ if (nodeDimensions == null)
+ throw new InternalError("The NodeDimensions are not set");
+ return nodeDimensions.getNodeDimensions(value, row, depth, expanded, bounds);
+ }
+
+ /**
+ * Sets the model that provides the tree data.
+ *
+ * @param model the model
+ */
+ public void setModel(TreeModel model)
+ {
+ treeModel = model;
+ }
+
+ /**
+ * Returns the model that provides the tree data.
+ *
+ * @return the model
+ */
+ public TreeModel getModel()
+ {
+ return treeModel;
+ }
+
+ /**
+ * setRootVisible
+ *
+ * @param visible <code>true</code> if root should be visible,
+ * <code>false</code> otherwise
+ */
+ public void setRootVisible(boolean visible)
+ {
+ rootVisible = visible;
+ }
+
+ /**
+ * isRootVisible
+ *
+ * @return <code>true</code> if root is visible,
+ * <code>false</code> otherwise
+ */
+ public boolean isRootVisible()
+ {
+ return rootVisible;
+ }
+
+ /**
+ * setRowHeight
+ *
+ * @param height the row height
+ */
+ public void setRowHeight(int height)
+ {
+ rowHeight = height;
+ }
+
+ /**
+ * getRowHeight
+ *
+ * @return the row height
+ */
+ public int getRowHeight()
+ {
+ return rowHeight;
+ }
+
+ /**
+ * setSelectionModel
+ *
+ * @param model the model
+ */
+ public void setSelectionModel(TreeSelectionModel model)
+ {
+ treeSelectionModel = model;
+ }
+
+ /**
+ * getSelectionModel
+ *
+ * @return the model
+ */
+ public TreeSelectionModel getSelectionModel()
+ {
+ return treeSelectionModel;
+ }
+
+ /**
+ * getPreferredHeight
+ *
+ * @return int
+ */
+ public int getPreferredHeight()
throws NotImplementedException
- {
- if (bounds == null)
- return new Rectangle();
- return null;
- // TODO
- }
-
- /**
- * Sets the model that provides the tree data.
- *
- * @param model the model
- */
- public void setModel(TreeModel model)
- {
- treeModel = model;
- }
-
- /**
- * Returns the model that provides the tree data.
- *
- * @return the model
- */
- public TreeModel getModel()
- {
- return treeModel;
- }
-
- /**
- * setRootVisible
- *
- * @param visible <code>true</code> if root should be visible,
- * <code>false</code> otherwise
- */
- public void setRootVisible(boolean visible)
- {
- rootVisible = visible;
- }
-
- /**
- * isRootVisible
- *
- * @return <code>true</code> if root is visible,
- * <code>false</code> otherwise
- */
- public boolean isRootVisible()
- {
- return rootVisible;
- }
-
- /**
- * setRowHeight
- *
- * @param height the row height
- */
- public void setRowHeight(int height)
- {
- rowHeight = height;
- }
-
- /**
- * getRowHeight
- *
- * @return the row height
- */
- public int getRowHeight()
- {
- return rowHeight;
- }
-
- /**
- * setSelectionModel
- *
- * @param model the model
- */
- public void setSelectionModel(TreeSelectionModel model)
- {
- treeSelectionModel = model;
- }
-
- /**
- * getSelectionModel
- *
- * @return the model
- */
- public TreeSelectionModel getSelectionModel()
- {
- return treeSelectionModel;
- }
-
- /**
- * getPreferredHeight
- *
- * @return int
- */
- public int getPreferredHeight()
- throws NotImplementedException
- {
- return 0; // TODO
- }
-
- /**
- * getPreferredWidth
- *
- * @param value0 TODO
- *
- * @return int
- */
- public int getPreferredWidth(Rectangle value0)
- throws NotImplementedException
- {
- return 0; // TODO
- }
-
- /**
- * isExpanded
- *
- * @param value0 TODO
- *
- * @return boolean
- */
- public abstract boolean isExpanded(TreePath value0);
-
- /**
- * getBounds
- *
- * @param value0 TODO
- * @param value1 TODO
- *
- * @return Rectangle
- */
- public abstract Rectangle getBounds(TreePath value0, Rectangle value1);
-
- /**
- * getPathForRow
- *
- * @param row the row
- *
- * @return the tree path
- */
- public abstract TreePath getPathForRow(int row);
-
- /**
- * getRowForPath
- *
- * @param path the tree path
- *
- * @return the row
- */
- public abstract int getRowForPath(TreePath path);
-
- /**
- * getPathClosestTo
- *
- * @param value0 TODO
- * @param value1 TODO
- *
- * @return the tree path
- */
- public abstract TreePath getPathClosestTo(int value0, int value1);
-
- /**
- * getVisiblePathsFrom
- *
- * @param path the tree path
- *
- * @return Enumeration
- */
- public abstract Enumeration<TreePath> getVisiblePathsFrom(TreePath path);
-
- /**
- * getVisibleChildCount
- *
- * @param path the tree path
- *
- * @return int
- */
- public abstract int getVisibleChildCount(TreePath path);
-
- /**
- * setExpandedState
- *
- * @param value0 TODO
- *
- * @param value1 TODO
- */
- public abstract void setExpandedState(TreePath value0, boolean value1);
-
- /**
- * getExpandedState
- *
- * @param path the tree path
- *
- * @return boolean
- */
- public abstract boolean getExpandedState(TreePath path);
-
- /**
- * getRowCount
- *
- * @return the number of rows
- */
- public abstract int getRowCount();
-
- /**
- * invalidateSizes
- */
- public abstract void invalidateSizes();
-
- /**
- * invalidatePathBounds
- *
- * @param path the tree path
- */
- public abstract void invalidatePathBounds(TreePath path);
-
- /**
- * treeNodesChanged
- *
- * @param event the event to send
- */
- public abstract void treeNodesChanged(TreeModelEvent event);
-
- /**
- * treeNodesInserted
- *
- * @param event the event to send
- */
- public abstract void treeNodesInserted(TreeModelEvent event);
-
- /**
- * treeNodesRemoved
- *
- * @param event the event to send
- */
- public abstract void treeNodesRemoved(TreeModelEvent event);
-
- /**
- * treeStructureChanged
- *
- * @param event the event to send
- */
- public abstract void treeStructureChanged(TreeModelEvent event);
-
- /**
- * getRowsForPaths
- *
- * @param paths the tree paths
- *
- * @return an array of rows
- */
- public int[] getRowsForPaths(TreePath[] paths)
- throws NotImplementedException
- {
- return null; // TODO
- }
-
- /**
- * isFixedRowHeight
- *
- * @return boolean
- */
- protected boolean isFixedRowHeight()
- throws NotImplementedException
- {
- return false; // TODO
- }
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * getPreferredWidth
+ *
+ * @param value0 TODO
+ *
+ * @return int
+ */
+ public int getPreferredWidth(Rectangle value0)
+ throws NotImplementedException
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * isExpanded
+ *
+ * @param value0 TODO
+ *
+ * @return boolean
+ */
+ public abstract boolean isExpanded(TreePath value0);
+
+ /**
+ * getBounds
+ *
+ * @param value0 TODO
+ * @param value1 TODO
+ *
+ * @return Rectangle
+ */
+ public abstract Rectangle getBounds(TreePath value0, Rectangle value1);
+
+ /**
+ * getPathForRow
+ *
+ * @param row the row
+ *
+ * @return the tree path
+ */
+ public abstract TreePath getPathForRow(int row);
+
+ /**
+ * getRowForPath
+ *
+ * @param path the tree path
+ *
+ * @return the row
+ */
+ public abstract int getRowForPath(TreePath path);
+
+ /**
+ * getPathClosestTo
+ *
+ * @param value0 TODO
+ * @param value1 TODO
+ *
+ * @return the tree path
+ */
+ public abstract TreePath getPathClosestTo(int value0, int value1);
+
+ /**
+ * getVisiblePathsFrom
+ *
+ * @param path the tree path
+ *
+ * @return Enumeration
+ */
+ public abstract Enumeration getVisiblePathsFrom(TreePath path);
+
+ /**
+ * getVisibleChildCount
+ *
+ * @param path the tree path
+ *
+ * @return int
+ */
+ public abstract int getVisibleChildCount(TreePath path);
+
+ /**
+ * setExpandedState
+ *
+ * @param value0 TODO
+ *
+ * @param value1 TODO
+ */
+ public abstract void setExpandedState(TreePath value0, boolean value1);
+
+ /**
+ * getExpandedState
+ *
+ * @param path the tree path
+ *
+ * @return boolean
+ */
+ public abstract boolean getExpandedState(TreePath path);
+
+ /**
+ * getRowCount
+ *
+ * @return the number of rows
+ */
+ public abstract int getRowCount();
+
+ /**
+ * invalidateSizes
+ */
+ public abstract void invalidateSizes();
+
+ /**
+ * invalidatePathBounds
+ *
+ * @param path the tree path
+ */
+ public abstract void invalidatePathBounds(TreePath path);
+
+ /**
+ * treeNodesChanged
+ *
+ * @param event the event to send
+ */
+ public abstract void treeNodesChanged(TreeModelEvent event);
+
+ /**
+ * treeNodesInserted
+ *
+ * @param event the event to send
+ */
+ public abstract void treeNodesInserted(TreeModelEvent event);
+
+ /**
+ * treeNodesRemoved
+ *
+ * @param event the event to send
+ */
+ public abstract void treeNodesRemoved(TreeModelEvent event);
+
+ /**
+ * treeStructureChanged
+ *
+ * @param event the event to send
+ */
+ public abstract void treeStructureChanged(TreeModelEvent event);
+
+ /**
+ * Get the tree row numbers for the given pathes. This method performs
+ * the "bulk" conversion that may be faster than mapping pathes one by
+ * one. To have the benefit from the bulk conversion, the method must be
+ * overridden in the derived classes. The default method delegates work
+ * to the {@link #getRowForPath(TreePath)}.
+ *
+ * @param paths the tree paths the array of the tree pathes.
+ * @return the array of the matching tree rows.
+ */
+ public int[] getRowsForPaths(TreePath[] paths)
+ {
+ int[] rows = new int[paths.length];
+ for (int i = 0; i < rows.length; i++)
+ rows[i] = getRowForPath(paths[i]);
+ return rows;
+ }
+
+ /**
+ * isFixedRowHeight
+ *
+ * @return boolean
+ */
+ protected boolean isFixedRowHeight()
+ throws NotImplementedException
+ {
+ return false; // TODO
+ }
}
diff --git a/javax/swing/tree/DefaultTreeSelectionModel.java b/javax/swing/tree/DefaultTreeSelectionModel.java
index f4ce8e195..884ce6cbc 100644
--- a/javax/swing/tree/DefaultTreeSelectionModel.java
+++ b/javax/swing/tree/DefaultTreeSelectionModel.java
@@ -1,5 +1,5 @@
/* DefaultTreeSelectionModel.java
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -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. */
+
package javax.swing.tree;
import gnu.classpath.NotImplementedException;
@@ -54,716 +55,697 @@ import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
/**
- * DefaultTreeSelectionModel
+ * The implementation of the default tree selection model. The installed
+ * listeners are notified about the path and not the row changes. If you
+ * specifically need to track the row changes, register the listener for the
+ * expansion events.
*
* @author Andrew Selkirk
*/
public class DefaultTreeSelectionModel
- implements Cloneable, Serializable, TreeSelectionModel
+ implements Cloneable, Serializable, TreeSelectionModel
{
- static final long serialVersionUID = 3288129636638950196L;
-
- /**
- * SELECTION_MODE_PROPERTY
- */
- public static final String SELECTION_MODE_PROPERTY = "selectionMode";
-
- /**
- * Our Swing property change support.
- */
- protected SwingPropertyChangeSupport changeSupport;
-
- /**
- * The current selection.
- */
- protected TreePath[] selection;
-
- /**
- * Our TreeSelectionListeners.
- */
- protected EventListenerList listenerList;
-
- /**
- * The current RowMapper.
- */
- protected transient RowMapper rowMapper;
-
- /**
- * The current listSelectionModel.
- */
- protected DefaultListSelectionModel listSelectionModel;
-
- /**
- * The current selection mode.
- */
- protected int selectionMode;
-
- /**
- * The path that has been added last.
- */
- protected TreePath leadPath;
-
- /**
- * The index of the last added path.
- */
- protected int leadIndex;
-
- /**
- * The row of the last added path according to the RowMapper.
- */
- protected int leadRow;
-
- /**
- * Constructs a new DefaultTreeSelectionModel.
- */
- public DefaultTreeSelectionModel()
- {
- setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
- listenerList = new EventListenerList();
- }
-
- /**
- * Creates a clone of this DefaultTreeSelectionModel with the same
- * selection.
- *
- * @exception CloneNotSupportedException should not be thrown here
- *
- * @return a clone of this DefaultTreeSelectionModel
- */
- public Object clone()
- throws CloneNotSupportedException, NotImplementedException
- {
- return null; // TODO
- }
-
- /**
- * Returns a string that shows this object's properties.
- *
- * @return a string that shows this object's properties
- */
- public String toString()
- throws NotImplementedException
- {
- return null; // TODO
- }
-
- /**
- * 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
- }
-
- /**
- * Sets the RowMapper that should be used to map between paths and their
- * rows.
- *
- * @param rowMapper the RowMapper to set
- *
- * @see RowMapper
- */
- public void setRowMapper(RowMapper rowMapper)
- throws NotImplementedException
- {
- // TODO
- }
-
- /**
- * Returns the RowMapper that is currently used to map between paths and
- * their rows.
- *
- * @return the current RowMapper
- *
- * @see RowMapper
- */
- public RowMapper getRowMapper()
- {
- return rowMapper;
- }
-
- /**
- * Sets the current selection mode. Possible values are
- * {@link #SINGLE_TREE_SELECTION}, {@link #CONTIGUOUS_TREE_SELECTION} and
- * {@link #DISCONTIGUOUS_TREE_SELECTION}.
- *
- * @param mode the selection mode to be set
- *
- * @see #getSelectionMode
- * @see #SINGLE_TREE_SELECTION
- * @see #CONTIGUOUS_TREE_SELECTION
- * @see #DISCONTIGUOUS_TREE_SELECTION
- */
- public void setSelectionMode(int mode)
- {
- selectionMode = mode;
- }
-
- /**
- * Returns the current selection mode.
- *
- * @return the current selection mode
- *
- * @see #setSelectionMode
- * @see #SINGLE_TREE_SELECTION
- * @see #CONTIGUOUS_TREE_SELECTION
- * @see #DISCONTIGUOUS_TREE_SELECTION
- */
- public int getSelectionMode()
- {
- return selectionMode;
- }
-
- /**
- * Sets this path as the only selection.
- *
- * If this changes the selection the registered TreeSelectionListeners are
- * notified.
- *
- * @param path the path to set as selection
- */
- public void setSelectionPath(TreePath path)
- {
- selection = new TreePath[] {
- path };
- }
-
- /**
- * Sets the paths as selection. This method checks for duplicates and
- * removes them.
- *
- * If this changes the selection the registered TreeSelectionListeners are
- * notified.
- *
- * @param paths the paths to set as selection
- */
- public void setSelectionPaths(TreePath[] paths)
- throws NotImplementedException
- {
- // TODO
- }
-
- /**
- * Adds a path to the list of selected paths. This method checks if the path
- * is already selected and doesn't add the same path twice.
- *
- * If this changes the selection the registered TreeSelectionListeners are
- * notified.
- *
- * @param path the path to add to the selection
- */
- public void addSelectionPath(TreePath path)
- {
- if (!isPathSelected(path))
- {
- if (isSelectionEmpty())
- setSelectionPath(path);
- else
- {
- TreePath[] temp = new TreePath[selection.length + 1];
- System.arraycopy(selection, 0, temp, 0, selection.length);
- temp[temp.length - 1] = path;
- selection = new TreePath[temp.length];
- System.arraycopy(temp, 0, selection, 0, temp.length);
- }
- leadPath = path;
- fireValueChanged(new TreeSelectionEvent(this, path, true,
- leadPath, path));
- }
- }
-
- /**
- * Adds the paths to the list of selected paths. This method checks if the
- * paths are already selected and doesn't add the same path twice.
- *
- * If this changes the selection the registered TreeSelectionListeners are
- * notified.
- *
- * @param paths the paths to add to the selection
- */
- public void addSelectionPaths(TreePath[] paths)
- {
- if (paths != null)
- {
- TreePath v0 = null;
- for (int i = 0; i < paths.length; i++)
- {
- v0 = paths[i];
- if (!isPathSelected(v0))
- {
- if (isSelectionEmpty())
- setSelectionPath(v0);
- else
- {
- TreePath[] temp = new TreePath[selection.length + 1];
- System.arraycopy(selection, 0, temp, 0,
- selection.length);
- temp[temp.length - 1] = v0;
- selection = new TreePath[temp.length];
- System.arraycopy(temp, 0, selection, 0, temp.length);
- }
- leadPath = paths[paths.length - 1];
- fireValueChanged(new TreeSelectionEvent(this, v0, true,
- leadPath, paths[0]));
- }
- }
- }
- }
-
- /**
- * Removes the path from the selection.
- *
- * If this changes the selection the registered TreeSelectionListeners are
- * notified.
- *
- * @param path the path to remove
- */
- public void removeSelectionPath(TreePath path)
- {
- int index = -1;
- if (isPathSelected(path))
- {
- for (int i = 0; i < selection.length; i++)
- {
- if (selection[i].equals(path))
- {
- index = i;
- break;
- }
- }
- TreePath[] temp = new TreePath[selection.length - 1];
- System.arraycopy(selection, 0, temp, 0, index);
- System.arraycopy(selection, index + 1, temp, index,
- selection.length - index - 1);
- selection = new TreePath[temp.length];
- System.arraycopy(temp, 0, selection, 0, temp.length);
-
- fireValueChanged(new TreeSelectionEvent(this, path, false,
- leadPath, path));
- }
- }
-
- /**
- * Removes the paths from the selection.
- *
- * If this changes the selection the registered TreeSelectionListeners are
- * notified.
- *
- * @param paths the paths to remove
- */
- public void removeSelectionPaths(TreePath[] paths)
- {
- if (paths != null)
- {
- int index = -1;
- TreePath v0 = null;
- for (int i = 0; i < paths.length; i++)
- {
- v0 = paths[i];
- if (isPathSelected(v0))
- {
- for (int x = 0; x < selection.length; x++)
- {
- if (selection[i].equals(v0))
- {
- index = x;
- break;
- }
- }
- TreePath[] temp = new TreePath[selection.length - 1];
- System.arraycopy(selection, 0, temp, 0, index);
- System.arraycopy(selection, index + 1, temp, index,
- selection.length - index - 1);
- selection = new TreePath[temp.length];
- System.arraycopy(temp, 0, selection, 0, temp.length);
-
- fireValueChanged(new TreeSelectionEvent(this, v0, false,
- leadPath, paths[0]));
- }
- }
- }
- }
-
- /**
- * Returns the first path in the selection. This is especially useful when
- * the selectionMode is {@link #SINGLE_TREE_SELECTION}.
- *
- * @return the first path in the selection
- */
- public TreePath getSelectionPath()
- {
- if ((selection == null) || (selection.length == 0))
- return null;
- else
- return selection[0];
- }
-
- /**
- * Returns the complete selection.
- *
- * @return the complete selection
- */
- public TreePath[] getSelectionPaths()
- {
- return selection;
- }
-
- /**
- * Returns the number of paths in the selection.
- *
- * @return the number of paths in the selection
- */
- public int getSelectionCount()
- {
- if (selection == null)
- return 0;
- else
- return selection.length;
- }
-
- /**
- * Checks if a given path is in the selection.
- *
- * @param path the path to check
- *
- * @return <code>true</code> if the path is in the selection,
- * <code>false</code> otherwise
- */
- public boolean isPathSelected(TreePath path)
- {
- if (selection == null)
- return false;
-
- for (int i = 0; i < selection.length; i++)
- {
- if (selection[i].equals(path))
- return true;
- }
- return false;
- }
-
- /**
- * Checks if the selection is empty.
- *
- * @return <code>true</code> if the selection is empty, <code>false</code>
- * otherwise
- */
- public boolean isSelectionEmpty()
- {
- return ((selection == null) || (selection.length == 0));
- }
-
- /**
- * Removes all paths from the selection.
- */
- public void clearSelection()
- {
- leadPath = null;
- selection = null;
- }
-
- /**
- * Adds a <code>TreeSelectionListener</code> object to this model.
- *
- * @param listener the listener to add
- */
- public void addTreeSelectionListener(TreeSelectionListener listener)
- {
- listenerList.add(TreeSelectionListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeSelectionListener</code> object from this model.
- *
- * @param listener the listener to remove
- */
- public void removeTreeSelectionListener(TreeSelectionListener listener)
- {
- listenerList.remove(TreeSelectionListener.class, listener);
- }
-
- /**
- * Returns all <code>TreeSelectionListener</code> added to this model.
- *
- * @return an array of listeners
- *
- * @since 1.4
- */
- public TreeSelectionListener[] getTreeSelectionListeners()
- {
- return (TreeSelectionListener[])
- getListeners(TreeSelectionListener.class);
- }
-
- /**
- * fireValueChanged
- *
- * @param event the event to fire.
- */
- protected void fireValueChanged(TreeSelectionEvent event)
- {
- TreeSelectionListener[] listeners = getTreeSelectionListeners();
-
- for (int i = 0; i < listeners.length; ++i)
- listeners[i].valueChanged(event);
- }
-
- /**
- * Returns all added listeners of a special type.
- *
- * @param listenerType the listener type
- *
- * @return an array of listeners
- *
- * @since 1.3
- */
- public <T extends EventListener> T[] getListeners(Class<T> listenerType)
- {
- return listenerList.getListeners(listenerType);
- }
-
- /**
- * Returns the currently selected rows.
- *
- * @return the currently selected rows
- */
- public int[] getSelectionRows()
- {
- if (rowMapper == null)
- return null;
- else
- return rowMapper.getRowsForPaths(selection);
- }
-
- /**
- * Returns the smallest row index from the selection.
- *
- * @return the smallest row index from the selection
- */
- public int getMinSelectionRow()
- {
- if ((rowMapper == null) || (selection == null)
- || (selection.length == 0))
- return -1;
- else
- {
- int[] rows = rowMapper.getRowsForPaths(selection);
- int minRow = Integer.MAX_VALUE;
- for (int index = 0; index < rows.length; index++)
- minRow = Math.min(minRow, rows[index]);
- return minRow;
- }
- }
-
- /**
- * Returns the largest row index from the selection.
- *
- * @return the largest row index from the selection
- */
- public int getMaxSelectionRow()
- {
- if ((rowMapper == null) || (selection == null)
- || (selection.length == 0))
- return -1;
- else
- {
- int[] rows = rowMapper.getRowsForPaths(selection);
- int maxRow = -1;
- for (int index = 0; index < rows.length; index++)
- maxRow = Math.max(maxRow, rows[index]);
- return maxRow;
- }
- }
-
- /**
- * Checks if a particular row is selected.
- *
- * @param row the index of the row to check
- *
- * @return <code>true</code> if the row is in this selection,
- * <code>false</code> otherwise
- */
- public boolean isRowSelected(int row)
- throws NotImplementedException
- {
- return false; // TODO
- }
-
- /**
- * Updates the mappings from TreePaths to row indices.
- */
- public void resetRowSelection()
- throws NotImplementedException
- {
- // TODO
- }
-
- /**
- * getLeadSelectionRow
- *
- * @return int
- */
- public int getLeadSelectionRow()
- {
- if ((rowMapper == null) || (leadPath == null))
- return -1;
- else
- return rowMapper.getRowsForPaths(new TreePath[] {
- leadPath })[0];
- }
-
- /**
- * getLeadSelectionPath
- *
- * @return TreePath
- */
- public TreePath getLeadSelectionPath()
- {
- return leadPath;
- }
-
- /**
- * Adds a <code>PropertyChangeListener</code> object to this model.
- *
- * @param listener the listener to add.
- */
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- /**
- * Removes a <code>PropertyChangeListener</code> object from this model.
- *
- * @param listener the listener to remove.
- */
- public void removePropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.removePropertyChangeListener(listener);
- }
-
- /**
- * Returns all added <code>PropertyChangeListener</code> objects.
- *
- * @return an array of listeners.
- *
- * @since 1.4
- */
- public PropertyChangeListener[] getPropertyChangeListeners()
- {
- return changeSupport.getPropertyChangeListeners();
- }
-
- /**
- * Makes sure the currently selected paths are valid according to the
- * current selectionMode.
- *
- * If the selectionMode is set to {@link #CONTIGUOUS_TREE_SELECTION} and the
- * selection isn't contiguous then the selection is reset to the first set
- * of contguous paths.
- *
- * If the selectionMode is set to {@link #SINGLE_TREE_SELECTION} and the
- * selection has more than one path, the selection is reset to the contain
- * only the first path.
- */
- protected void insureRowContinuity()
- throws NotImplementedException
- {
- // TODO
- }
-
- /**
- * Returns <code>true</code> if the paths are contiguous or we have no
- * RowMapper assigned.
- *
- * @param paths the paths to check for continuity
- * @return <code>true</code> if the paths are contiguous or we have no
- * RowMapper assigned
- */
- protected boolean arePathsContiguous(TreePath[] paths)
- throws NotImplementedException
- {
- return false; // STUB
- }
-
- /**
- * Checks if the paths can be added. This returns <code>true</code> if:
- * <ul>
- * <li><code>paths</code> is <code>null</code> or empty</li>
- * <li>we have no RowMapper assigned</li>
- * <li>nothing is currently selected</li>
- * <li>selectionMode is {@link #DISCONTIGUOUS_TREE_SELECTION}</li>
- * <li>adding the paths to the selection still results in a contiguous set
- * of paths</li>
- *
- * @param paths the paths to check
- *
- * @return <code>true</code> if the paths can be added with respect to the
- * selectionMode
- */
- protected boolean canPathsBeAdded(TreePath[] paths)
+
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ static final long serialVersionUID = 3288129636638950196L;
+
+ /**
+ * The name of the selection mode property.
+ */
+ public static final String SELECTION_MODE_PROPERTY = "selectionMode";
+
+ /**
+ * Our Swing property change support.
+ */
+ protected SwingPropertyChangeSupport changeSupport;
+
+ /**
+ * The current selection.
+ */
+ protected TreePath[] selection;
+
+ /**
+ * Our TreeSelectionListeners.
+ */
+ protected EventListenerList listenerList;
+
+ /**
+ * The current RowMapper.
+ */
+ protected transient RowMapper rowMapper;
+
+ /**
+ * The current listSelectionModel.
+ */
+ protected DefaultListSelectionModel listSelectionModel;
+
+ /**
+ * The current selection mode.
+ */
+ protected int selectionMode;
+
+ /**
+ * The path that has been added last.
+ */
+ protected TreePath leadPath;
+
+ /**
+ * The index of the last added path.
+ */
+ protected int leadIndex;
+
+ /**
+ * The row of the last added path according to the RowMapper.
+ */
+ protected int leadRow;
+
+ /**
+ * Constructs a new DefaultTreeSelectionModel.
+ */
+ public DefaultTreeSelectionModel()
+ {
+ setSelectionMode(DISCONTIGUOUS_TREE_SELECTION);
+ listenerList = new EventListenerList();
+ }
+
+ /**
+ * Creates a clone of this DefaultTreeSelectionModel with the same selection.
+ * The cloned instance will have the same registered listeners, the listeners
+ * themselves will not be cloned. The selection will be cloned.
+ *
+ * @exception CloneNotSupportedException should not be thrown here
+ * @return a copy of this DefaultTreeSelectionModel
+ */
+ public Object clone() throws CloneNotSupportedException
+ {
+ DefaultTreeSelectionModel cloned =
+ (DefaultTreeSelectionModel) super.clone();
+
+ // Clone the selection and the list selection model.
+ cloned.selection = (TreePath[]) selection.clone();
+ cloned.listSelectionModel =
+ (DefaultListSelectionModel) listSelectionModel.clone();
+ return cloned;
+ }
+
+ /**
+ * Returns a string that shows this object's properties.
+ *
+ * @return a string that shows this object's properties
+ */
+ public String toString() throws NotImplementedException
+ {
+ return null; // TODO
+ }
+
+ /**
+ * 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
+ }
+
+ /**
+ * Sets the RowMapper that should be used to map between paths and their rows.
+ *
+ * @param mapper the RowMapper to set
+ * @see RowMapper
+ */
+ public void setRowMapper(RowMapper mapper)
+ {
+ rowMapper = mapper;
+ }
+
+ /**
+ * Returns the RowMapper that is currently used to map between paths and their
+ * rows.
+ *
+ * @return the current RowMapper
+ * @see RowMapper
+ */
+ public RowMapper getRowMapper()
+ {
+ return rowMapper;
+ }
+
+ /**
+ * Sets the current selection mode. Possible values are
+ * {@link #SINGLE_TREE_SELECTION}, {@link #CONTIGUOUS_TREE_SELECTION} and
+ * {@link #DISCONTIGUOUS_TREE_SELECTION}.
+ *
+ * @param mode the selection mode to be set
+ * @see #getSelectionMode
+ * @see #SINGLE_TREE_SELECTION
+ * @see #CONTIGUOUS_TREE_SELECTION
+ * @see #DISCONTIGUOUS_TREE_SELECTION
+ */
+ public void setSelectionMode(int mode)
+ {
+ selectionMode = mode;
+ }
+
+ /**
+ * Returns the current selection mode.
+ *
+ * @return the current selection mode
+ * @see #setSelectionMode
+ * @see #SINGLE_TREE_SELECTION
+ * @see #CONTIGUOUS_TREE_SELECTION
+ * @see #DISCONTIGUOUS_TREE_SELECTION
+ */
+ public int getSelectionMode()
+ {
+ return selectionMode;
+ }
+
+ /**
+ * Sets this path as the only selection. If this changes the selection the
+ * registered TreeSelectionListeners are notified.
+ *
+ * @param path the path to set as selection
+ */
+ public void setSelectionPath(TreePath path)
+ {
+ selection = new TreePath[] { path };
+ }
+
+ /**
+ * Sets the paths as selection. This method checks for duplicates and removes
+ * them. If this changes the selection the registered TreeSelectionListeners
+ * are notified.
+ *
+ * @param paths the paths to set as selection
+ */
+ public void setSelectionPaths(TreePath[] paths)
throws NotImplementedException
- {
- return false; // STUB
- }
-
- /**
- * Checks if the paths can be removed without breaking the continuity of the
- * selection according to selectionMode.
- *
- * @param paths the paths to check
- * @return <code>true</code> if the paths can be removed with respect to
- * the selectionMode
- */
- protected boolean canPathsBeRemoved(TreePath[] paths)
+ {
+ // Must be called, as defined in JDK API 1.4.
+ insureUniqueness();
+ // TODO
+ }
+
+ /**
+ * Adds a path to the list of selected paths. This method checks if the path
+ * is already selected and doesn't add the same path twice. If this changes
+ * the selection the registered TreeSelectionListeners are notified.
+ *
+ * @param path the path to add to the selection
+ */
+ public void addSelectionPath(TreePath path)
+ {
+ if (! isPathSelected(path))
+ {
+ if (isSelectionEmpty())
+ setSelectionPath(path);
+ else
+ {
+ TreePath[] temp = new TreePath[selection.length + 1];
+ System.arraycopy(selection, 0, temp, 0, selection.length);
+ temp[temp.length - 1] = path;
+ selection = new TreePath[temp.length];
+ System.arraycopy(temp, 0, selection, 0, temp.length);
+ }
+ leadPath = path;
+ fireValueChanged(new TreeSelectionEvent(this, path, true, leadPath,
+ path));
+ }
+ }
+
+ /**
+ * Adds the paths to the list of selected paths. This method checks if the
+ * paths are already selected and doesn't add the same path twice. If this
+ * changes the selection the registered TreeSelectionListeners are notified.
+ *
+ * @param paths the paths to add to the selection
+ */
+ public void addSelectionPaths(TreePath[] paths)
+ {
+ // Must be called, as defined in JDK API 1.4.
+ insureUniqueness();
+
+ if (paths != null)
+ {
+ TreePath v0 = null;
+ for (int i = 0; i < paths.length; i++)
+ {
+ v0 = paths[i];
+ if (! isPathSelected(v0))
+ {
+ if (isSelectionEmpty())
+ setSelectionPath(v0);
+ else
+ {
+ TreePath[] temp = new TreePath[selection.length + 1];
+ System.arraycopy(selection, 0, temp, 0, selection.length);
+ temp[temp.length - 1] = v0;
+ selection = new TreePath[temp.length];
+ System.arraycopy(temp, 0, selection, 0, temp.length);
+ }
+ leadPath = paths[paths.length - 1];
+ fireValueChanged(new TreeSelectionEvent(this, v0, true,
+ leadPath, paths[0]));
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes the path from the selection. If this changes the selection the
+ * registered TreeSelectionListeners are notified.
+ *
+ * @param path the path to remove
+ */
+ public void removeSelectionPath(TreePath path)
+ {
+ int index = - 1;
+ if (isPathSelected(path))
+ {
+ for (int i = 0; i < selection.length; i++)
+ {
+ if (selection[i].equals(path))
+ {
+ index = i;
+ break;
+ }
+ }
+ TreePath[] temp = new TreePath[selection.length - 1];
+ System.arraycopy(selection, 0, temp, 0, index);
+ System.arraycopy(selection, index + 1, temp, index, selection.length
+ - index - 1);
+ selection = new TreePath[temp.length];
+ System.arraycopy(temp, 0, selection, 0, temp.length);
+
+ fireValueChanged(new TreeSelectionEvent(this, path, false, leadPath,
+ path));
+ }
+ }
+
+ /**
+ * Removes the paths from the selection. If this changes the selection the
+ * registered TreeSelectionListeners are notified.
+ *
+ * @param paths the paths to remove
+ */
+ public void removeSelectionPaths(TreePath[] paths)
+ {
+ if (paths != null)
+ {
+ int index = - 1;
+ TreePath v0 = null;
+ for (int i = 0; i < paths.length; i++)
+ {
+ v0 = paths[i];
+ if (isPathSelected(v0))
+ {
+ for (int x = 0; x < selection.length; x++)
+ {
+ if (selection[i].equals(v0))
+ {
+ index = x;
+ break;
+ }
+ }
+ TreePath[] temp = new TreePath[selection.length - 1];
+ System.arraycopy(selection, 0, temp, 0, index);
+ System.arraycopy(selection, index + 1, temp, index,
+ selection.length - index - 1);
+ selection = new TreePath[temp.length];
+ System.arraycopy(temp, 0, selection, 0, temp.length);
+
+ fireValueChanged(new TreeSelectionEvent(this, v0, false,
+ leadPath, paths[0]));
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the first path in the selection. This is especially useful when the
+ * selectionMode is {@link #SINGLE_TREE_SELECTION}.
+ *
+ * @return the first path in the selection
+ */
+ public TreePath getSelectionPath()
+ {
+ if ((selection == null) || (selection.length == 0))
+ return null;
+ else
+ return selection[0];
+ }
+
+ /**
+ * Returns the complete selection.
+ *
+ * @return the complete selection
+ */
+ public TreePath[] getSelectionPaths()
+ {
+ return selection;
+ }
+
+ /**
+ * Returns the number of paths in the selection.
+ *
+ * @return the number of paths in the selection
+ */
+ public int getSelectionCount()
+ {
+ if (selection == null)
+ return 0;
+ else
+ return selection.length;
+ }
+
+ /**
+ * Checks if a given path is in the selection.
+ *
+ * @param path the path to check
+ * @return <code>true</code> if the path is in the selection,
+ * <code>false</code> otherwise
+ */
+ public boolean isPathSelected(TreePath path)
+ {
+ if (selection == null)
+ return false;
+
+ for (int i = 0; i < selection.length; i++)
+ {
+ if (selection[i].equals(path))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the selection is empty.
+ *
+ * @return <code>true</code> if the selection is empty, <code>false</code>
+ * otherwise
+ */
+ public boolean isSelectionEmpty()
+ {
+ return ((selection == null) || (selection.length == 0));
+ }
+
+ /**
+ * Removes all paths from the selection.
+ */
+ public void clearSelection()
+ {
+ leadPath = null;
+ selection = null;
+ }
+
+ /**
+ * Adds a <code>TreeSelectionListener</code> object to this model.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.add(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeSelectionListener</code> object from this model.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.remove(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Returns all <code>TreeSelectionListener</code> added to this model.
+ *
+ * @return an array of listeners
+ * @since 1.4
+ */
+ public TreeSelectionListener[] getTreeSelectionListeners()
+ {
+ return (TreeSelectionListener[]) getListeners(TreeSelectionListener.class);
+ }
+
+ /**
+ * fireValueChanged
+ *
+ * @param event the event to fire.
+ */
+ protected void fireValueChanged(TreeSelectionEvent event)
+ {
+ TreeSelectionListener[] listeners = getTreeSelectionListeners();
+
+ for (int i = 0; i < listeners.length; ++i)
+ listeners[i].valueChanged(event);
+ }
+
+ /**
+ * Returns all added listeners of a special type.
+ *
+ * @param listenerType the listener type
+ * @return an array of listeners
+ * @since 1.3
+ */
+ public EventListener[] getListeners(Class listenerType)
+ {
+ return listenerList.getListeners(listenerType);
+ }
+
+ /**
+ * Returns the currently selected rows.
+ *
+ * @return the currently selected rows
+ */
+ public int[] getSelectionRows()
+ {
+ if (rowMapper == null)
+ return null;
+ else
+ return rowMapper.getRowsForPaths(selection);
+ }
+
+ /**
+ * Returns the smallest row index from the selection.
+ *
+ * @return the smallest row index from the selection
+ */
+ public int getMinSelectionRow()
+ {
+ if ((rowMapper == null) || (selection == null) || (selection.length == 0))
+ return - 1;
+ else
+ {
+ int[] rows = rowMapper.getRowsForPaths(selection);
+ int minRow = Integer.MAX_VALUE;
+ for (int index = 0; index < rows.length; index++)
+ minRow = Math.min(minRow, rows[index]);
+ return minRow;
+ }
+ }
+
+ /**
+ * Returns the largest row index from the selection.
+ *
+ * @return the largest row index from the selection
+ */
+ public int getMaxSelectionRow()
+ {
+ if ((rowMapper == null) || (selection == null) || (selection.length == 0))
+ return - 1;
+ else
+ {
+ int[] rows = rowMapper.getRowsForPaths(selection);
+ int maxRow = - 1;
+ for (int index = 0; index < rows.length; index++)
+ maxRow = Math.max(maxRow, rows[index]);
+ return maxRow;
+ }
+ }
+
+ /**
+ * Checks if a particular row is selected.
+ *
+ * @param row the index of the row to check
+ * @return <code>true</code> if the row is in this selection,
+ * <code>false</code> otherwise
+ */
+ public boolean isRowSelected(int row) throws NotImplementedException
+ {
+ return false; // TODO
+ }
+
+ /**
+ * Updates the mappings from TreePaths to row indices.
+ */
+ public void resetRowSelection() throws NotImplementedException
+ {
+ // TODO
+ }
+
+ /**
+ * getLeadSelectionRow
+ *
+ * @return int
+ */
+ public int getLeadSelectionRow()
+ {
+ if ((rowMapper == null) || (leadPath == null))
+ return - 1;
+ else
+ return rowMapper.getRowsForPaths(new TreePath[] { leadPath })[0];
+ }
+
+ /**
+ * getLeadSelectionPath
+ *
+ * @return TreePath
+ */
+ public TreePath getLeadSelectionPath()
+ {
+ return leadPath;
+ }
+
+ /**
+ * Adds a <code>PropertyChangeListener</code> object to this model.
+ *
+ * @param listener the listener to add.
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes a <code>PropertyChangeListener</code> object from this model.
+ *
+ * @param listener the listener to remove.
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns all added <code>PropertyChangeListener</code> objects.
+ *
+ * @return an array of listeners.
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ /**
+ * Makes sure the currently selected paths are valid according to the current
+ * selectionMode. If the selectionMode is set to
+ * {@link #CONTIGUOUS_TREE_SELECTION} and the selection isn't contiguous then
+ * the selection is reset to the first set of contguous paths. If the
+ * selectionMode is set to {@link #SINGLE_TREE_SELECTION} and the selection
+ * has more than one path, the selection is reset to the contain only the
+ * first path.
+ */
+ protected void insureRowContinuity() throws NotImplementedException
+ {
+ // TODO
+ }
+
+ /**
+ * Returns <code>true</code> if the paths are contiguous or we have no
+ * RowMapper assigned.
+ *
+ * @param paths the paths to check for continuity
+ * @return <code>true</code> if the paths are contiguous or we have no
+ * RowMapper assigned
+ */
+ protected boolean arePathsContiguous(TreePath[] paths)
throws NotImplementedException
- {
- return false; // STUB
- }
-
- /**
- * notifyPathChange
- *
- * @param value0 TODO
- * @param value1 TODO
- */
- protected void notifyPathChange(Vector value0, TreePath value1)
+ {
+ return false; // STUB
+ }
+
+ /**
+ * Checks if the paths can be added. This returns <code>true</code> if:
+ * <ul>
+ * <li><code>paths</code> is <code>null</code> or empty</li>
+ * <li>we have no RowMapper assigned</li>
+ * <li>nothing is currently selected</li>
+ * <li>selectionMode is {@link #DISCONTIGUOUS_TREE_SELECTION}</li>
+ * <li>adding the paths to the selection still results in a contiguous set of
+ * paths</li>
+ *
+ * @param paths the paths to check
+ * @return <code>true</code> if the paths can be added with respect to the
+ * selectionMode
+ */
+ protected boolean canPathsBeAdded(TreePath[] paths)
throws NotImplementedException
- {
- // STUB
- }
-
- /**
- * Updates the lead index instance field.
- */
- protected void updateLeadIndex()
+ {
+ return false; // STUB
+ }
+
+ /**
+ * Checks if the paths can be removed without breaking the continuity of the
+ * selection according to selectionMode.
+ *
+ * @param paths the paths to check
+ * @return <code>true</code> if the paths can be removed with respect to the
+ * selectionMode
+ */
+ protected boolean canPathsBeRemoved(TreePath[] paths)
throws NotImplementedException
- {
- // STUB
- }
-
- /**
- * Deprecated and not used.
- */
- protected void insureUniqueness()
+ {
+ return false; // STUB
+ }
+
+ /**
+ * notifyPathChange
+ *
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ protected void notifyPathChange(Vector value0, TreePath value1)
throws NotImplementedException
- {
- // TODO
- }
+ {
+ // STUB
+ }
+
+ /**
+ * Updates the lead index instance field.
+ */
+ protected void updateLeadIndex() throws NotImplementedException
+ {
+ // STUB
+ }
+
+ /**
+ * This method exists due historical reasons and returns without action
+ * (unless overridden). For compatibility with the applications that override
+ * it, it is still called from the {@link #setSelectionPaths(TreePath[])} and
+ * {@link #addSelectionPaths(TreePath[])}.
+ */
+ protected void insureUniqueness()
+ {
+ // Following the API 1.4, the method should return without action.
+ }
}
diff --git a/javax/swing/tree/FixedHeightLayoutCache.java b/javax/swing/tree/FixedHeightLayoutCache.java
index f87cd8b36..cb637c0df 100644
--- a/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/javax/swing/tree/FixedHeightLayoutCache.java
@@ -1,4 +1,4 @@
-/* FixedHeightLayoutCache.java --
+/* FixedHeightLayoutCache.java -- Fixed cell height tree layout cache
Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,215 +37,479 @@ exception statement from your version. */
package javax.swing.tree;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Rectangle;
import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.Vector;
+import javax.swing.UIManager;
import javax.swing.event.TreeModelEvent;
/**
- * FixedHeightLayoutCache
+ * The fixed height tree layout. This class assumes that all cells in the tree
+ * have the same fixed height. This may be not the case, for instance, if leaves
+ * and branches have different height, of if the tree rows may have arbitrary
+ * variable height. This class will also work if the NodeDimensions are not
+ * set. If they are set, the size calculations are just forwarded to the set
+ * instance.
*
- * @author Andrew Selkirk
+ * @author Audrius Meskauskas
+ * @author Andrew Selkirk
*/
public class FixedHeightLayoutCache
extends AbstractLayoutCache
{
+ /**
+ * The cached node record.
+ */
+ class NodeRecord
+ {
+ NodeRecord(int aRow, int aDepth, Object aNode, Object aParent)
+ {
+ row = aRow;
+ depth = aDepth;
+ parent = aParent;
+ node = aNode;
+
+ isExpanded = expanded.contains(aNode);
+ }
+
+ /**
+ * The row, where the tree node is displayed.
+ */
+ final int row;
+
+ /**
+ * The nesting depth
+ */
+ final int depth;
+
+ /**
+ * The parent of the given node, null for the root node.
+ */
+ final Object parent;
+
+ /**
+ * This node.
+ */
+ final Object node;
+
+ /**
+ * True for the expanded nodes. The value is calculated in constructor.
+ * Using this field saves one hashtable access operation.
+ */
+ final boolean isExpanded;
+
+ /**
+ * The cached bounds of the tree row.
+ */
+ Rectangle bounds;
+
+ /**
+ * The path from the tree top to the given node (computed under first
+ * demand)
+ */
+ private TreePath path;
+
+ TreePath getPath()
+ {
+ if (path == null)
+ {
+ LinkedList lpath = new LinkedList();
+ NodeRecord rp = this;
+ while (rp != null)
+ {
+ lpath.addFirst(rp.node);
+ if (rp.parent != null)
+ rp = (NodeRecord) nodes.get(rp.parent);
+ else
+ rp = null;
+ }
+ path = new TreePath(lpath.toArray());
+ }
+ return path;
+ }
+ }
+
+ /**
+ * The set of all expanded tree nodes.
+ */
+ Set expanded = new HashSet();
+
+ /**
+ * Maps nodes to the row numbers.
+ */
+ Hashtable nodes = new Hashtable();
+
+ /**
+ * Maps row numbers to nodes.
+ */
+ Hashtable row2node = new Hashtable();
+
+ /**
+ * If true, the row map must be recomputed before using.
+ */
+ boolean dirty;
/**
- * Constructor FixedHeightLayoutCache
+ * Creates the unitialised instance. Before using the class, the row height
+ * must be set with the {@link #setRowHeight(int)} and the model must be set
+ * with {@link #setModel(TreeModel)}. The node dimensions may not be set.
*/
public FixedHeightLayoutCache()
- throws NotImplementedException
{
- // TODO
+ // Nothing to do here.
}
/**
- * getRowCount
+ * Get the total number of rows in the tree. Every displayed node occupies the
+ * single row. The root node row is included if the root node is set as
+ * visible (false by default).
*
- * @return int
+ * @return int the number of the displayed rows.
+ */
+ public int getRowCount()
+ {
+ if (dirty) update();
+ return row2node.size();
+ }
+
+ /**
+ * Refresh the row map.
*/
- public int getRowCount()
- throws NotImplementedException
+ private final void update()
{
- return 0; // TODO
- }
+ nodes.clear();
+ row2node.clear();
+
+ Object root = treeModel.getRoot();
+ if (rootVisible)
+ {
+ countRows(root, null, 0);
+ }
+ else
+ {
+ int sc = treeModel.getChildCount(root);
+ for (int i = 0; i < sc; i++)
+ {
+ Object child = treeModel.getChild(root, i);
+ countRows(child, root, 1);
+ }
+ }
+ dirty = false;
+ }
+
/**
- * invalidatePathBounds
- *
- * @param value0 TODO
+ * Recursively counts all rows in the tree.
+ */
+ private final void countRows(Object node, Object parent, int depth)
+ {
+ Integer n = new Integer(row2node.size());
+ row2node.put(n, node);
+
+ nodes.put(node, new NodeRecord(n.intValue(), depth, node, parent));
+
+ if (expanded.contains(node) || parent == null)
+ {
+ int sc = treeModel.getChildCount(node);
+ int deeper = depth+1;
+ for (int i = 0; i < sc; i++)
+ {
+ Object child = treeModel.getChild(node, i);
+ countRows(child, node, deeper);
+ }
+ }
+ }
+
+ /**
+ * This should invalidate the width of the last path component, but
+ * following the JDK 1.4 API it is not cached and the method should return
+ * without action.
+ * @param path the path being invalidated, ignored.
*/
- public void invalidatePathBounds(TreePath value0)
- throws NotImplementedException
+ public void invalidatePathBounds(TreePath path)
{
- // TODO
+ // Following JDK 1.4 API, should return without action.
}
/**
- * invalidateSizes
+ * Mark all cached information as invalid.
*/
public void invalidateSizes()
- throws NotImplementedException
{
- // TODO
+ dirty = true;
}
/**
- * isExpanded
+ * Set the expanded state of the given path. The expansion states must be
+ * always updated when expanding and colapsing the tree nodes. Otherwise
+ * other methods will not work correctly after the nodes are collapsed or
+ * expanded.
+ *
+ * @param path the tree path, for that the state is being set.
+ * @param isExpanded the expanded state of the given path.
+ */
+ public void setExpandedState(TreePath path, boolean isExpanded)
+ {
+ if (isExpanded)
+ expanded.add(path.getLastPathComponent());
+ else
+ expanded.remove(path.getLastPathComponent());
+
+ dirty = true;
+ }
+
+ /**
+ * Get the expanded state for the given tree path.
*
- * @param value0 TODO
- * @return boolean
+ * @return true if the given path is expanded, false otherwise.
*/
- public boolean isExpanded(TreePath value0)
- throws NotImplementedException
+ public boolean isExpanded(TreePath path)
{
- return false; // TODO
+ return expanded.contains(path.getLastPathComponent());
}
/**
- * getBounds
+ * Get bounds for the given tree path.
*
- * @param value0 TODO
- * @param value1 TODO
- * @return Rectangle
+ * @param path the tree path
+ * @param rect the rectangle, specifying the area where the path should be
+ * displayed.
+ * @return Rectangle the bounds of the last line, defined by the given path.
*/
- public Rectangle getBounds(TreePath value0, Rectangle value1)
- throws NotImplementedException
+ public Rectangle getBounds(TreePath path, Rectangle rect)
{
- return null; // TODO
+ if (dirty)
+ update();
+ Object last = path.getLastPathComponent();
+ NodeRecord r = (NodeRecord) nodes.get(last);
+ if (r == null)
+ // This node is not visible.
+ return new Rectangle();
+ else
+ {
+ if (r.bounds == null)
+ {
+ Rectangle dim = getNodeDimensions(last, r.row, r.depth, r.isExpanded,
+ rect);
+ r.bounds = dim;
+ }
+ return r.bounds;
+ }
}
/**
- * getPathForRow
+ * Get the path, the last element of that is displayed in the given row.
*
- * @param row TODO
- * @return TreePath
+ * @param row the row
+ * @return TreePath the path
*/
public TreePath getPathForRow(int row)
- throws NotImplementedException
{
- //TODO
- return null;
+ if (dirty)
+ update();
+ Object last = row2node.get(new Integer(row));
+ if (last == null)
+ return null;
+ else
+ {
+ NodeRecord r = (NodeRecord) nodes.get(last);
+ return r.getPath();
+ }
}
/**
- * getRowForPath
+ * Get the row, displaying the last node of the given path.
*
- * @param value0 TODO
- * @return int
+ * @param path the path
+ * @return int the row number or -1 if the end of the path is not visible.
*/
- public int getRowForPath(TreePath value0)
- throws NotImplementedException
+ public int getRowForPath(TreePath path)
{
- return 0;
+ if (dirty) update();
+
+ NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
+ if (r == null)
+ return - 1;
+ else
+ return r.row;
}
/**
- * getPathClosestTo
+ * Get the path, closest to the given point.
*
- * @param value0 TODO
- * @param value1 TODO
- * @return TreePath
+ * @param x the point x coordinate
+ * @param y the point y coordinate
+ * @return the tree path, closest to the the given point
*/
- public TreePath getPathClosestTo(int value0, int value1)
- throws NotImplementedException
+ public TreePath getPathClosestTo(int x, int y)
{
- return null; // TODO
+ if (dirty)
+ update();
+
+ // We do not need to iterate because all rows have the same height.
+ int row = y / rowHeight;
+ if (row < 0)
+ row = 0;
+ if (row > getRowCount())
+ row = getRowCount() - 1;
+
+ if (row < 0)
+ return null; // Empty tree - nothing to return.
+
+ Object node = row2node.get(new Integer(row));
+ NodeRecord nr = (NodeRecord) nodes.get(node);
+ return nr.getPath();
}
/**
- * getVisibleChildCount
+ * Get the number of the visible childs for the given tree path. If the
+ * node is not expanded, 0 is returned. Otherwise, the number of children
+ * is obtained from the model as the number of children for the last path
+ * component.
*
- * @param value0 TODO
- * @return int
+ * @param path the tree path
+ * @return int the number of the visible childs (for row).
*/
- public int getVisibleChildCount(TreePath value0)
- throws NotImplementedException
+ public int getVisibleChildCount(TreePath path)
{
- return 0; // TODO
+ if (isExpanded(path))
+ return 0;
+ else
+ return treeModel.getChildCount(path.getLastPathComponent());
}
/**
- * getVisiblePathsFrom
+ * Get the enumeration over all visible pathes that start from the given
+ * parent path.
*
- * @param value0 TODO
- * @return Enumeration
+ * @param parentPath the parent path
+ * @return the enumeration over pathes
*/
- public Enumeration getVisiblePathsFrom(TreePath value0)
- throws NotImplementedException
+ public Enumeration getVisiblePathsFrom(TreePath parentPath)
{
- return null; // TODO
+ if (dirty)
+ update();
+ Vector p = new Vector(parentPath.getPathCount());
+ Object node;
+ NodeRecord nr;
+
+ for (int i = 0; i < parentPath.getPathCount(); i++)
+ {
+ node = parentPath.getPathComponent(i);
+ nr = (NodeRecord) nodes.get(node);
+ if (nr.row >= 0)
+ p.add(node);
+ }
+ return p.elements();
}
/**
- * setExpandedState
+ * Return the expansion state of the given tree path. The expansion state
+ * must be previously set with the
+ * {@link #setExpandedState(TreePath, boolean)}
*
- * @param value0 TODO
- * @param value1 TODO
+ * @param path the path being checked
+ * @return true if the last node of the path is expanded, false otherwise.
*/
- public void setExpandedState(TreePath value0, boolean value1)
- throws NotImplementedException
+ public boolean getExpandedState(TreePath path)
{
- // TODO
- }
+ return expanded.contains(path.getLastPathComponent());
+ }
/**
- * getExpandedState
+ * The listener method, called when the tree nodes are changed.
*
- * @param value0 TODO
- * @return boolean
+ * @param event the change event
*/
- public boolean getExpandedState(TreePath value0)
- throws NotImplementedException
+ public void treeNodesChanged(TreeModelEvent event)
{
- return false; // TODO
- }
+ dirty = true;
+ }
/**
- * treeNodesChanged
+ * The listener method, called when the tree nodes are inserted.
*
- * @param value0 TODO
+ * @param event the change event
*/
- public void treeNodesChanged(TreeModelEvent value0)
- throws NotImplementedException
+ public void treeNodesInserted(TreeModelEvent event)
{
- // TODO
+ dirty = true;
}
/**
- * treeNodesInserted
+ * The listener method, called when the tree nodes are removed.
*
- * @param value0 TODO
+ * @param event the change event
*/
- public void treeNodesInserted(TreeModelEvent value0)
- throws NotImplementedException
+ public void treeNodesRemoved(TreeModelEvent event)
{
- // TODO
+ dirty = true;
}
/**
- * treeNodesRemoved
+ * Called when the tree structure has been changed.
*
- * @param value0 TODO
+ * @param event the change event
*/
- public void treeNodesRemoved(TreeModelEvent value0)
- throws NotImplementedException
+ public void treeStructureChanged(TreeModelEvent event)
{
- // TODO
+ dirty = true;
}
+
+ /**
+ * Set the tree model that will provide the data.
+ */
+ public void setModel(TreeModel newModel)
+ {
+ super.setModel(newModel);
+ dirty = true;
+ }
+
+ /**
+ * Inform the instance if the tree root node is visible. If this method
+ * is not called, it is assumed that the tree root node is not visible.
+ *
+ * @param visible true if the tree root node is visible, false
+ * otherwise.
+ */
+ public void setRootVisible(boolean visible)
+ {
+ rootVisible = visible;
+ dirty = true;
+ }
/**
- * treeStructureChanged
+ * Get the node dimensions. If the NodeDimensions are not set, this method
+ * calculates dimensions assuming the fixed row height.
*
- * @param value0 TODO
+ * @param value the last node in the path
+ * @param row the node row
+ * @param depth the indentation depth
+ * @param expanded true if this node is expanded, false otherwise
+ * @param bounds the area where the tree is displayed
*/
- public void treeStructureChanged(TreeModelEvent value0)
- throws NotImplementedException
+ protected Rectangle getNodeDimensions(Object value, int row, int depth,
+ boolean expanded, Rectangle bounds)
{
- // TODO
- }
-
+ if (nodeDimensions != null)
+ return nodeDimensions.getNodeDimensions(value, row, depth, expanded,
+ bounds);
+ else
+ {
+ Rectangle r = new Rectangle(bounds);
+
+ int indent = depth * UIManager.getInt("Tree.rightChildIndent");
+
+ r.x = indent;
+ r.y = row * getRowHeight();
+ r.width = bounds.width = r.x;
+ r.height = getRowHeight();
+ return r;
+ }
+ }
}
diff --git a/javax/swing/tree/TreePath.java b/javax/swing/tree/TreePath.java
index 38344acee..89f36f0ff 100644
--- a/javax/swing/tree/TreePath.java
+++ b/javax/swing/tree/TreePath.java
@@ -53,9 +53,10 @@ public class TreePath implements Serializable
static final long serialVersionUID = 4380036194768077479L;
/**
- * path
+ * The actual patch. The {@link DefaultTreeSelectionModel#clone()}
+ * assumes that the TreePath is immutable, so it is marked final here.
*/
- private Object[] path = null;
+ private final Object[] path;
/**
diff --git a/javax/swing/tree/VariableHeightLayoutCache.java b/javax/swing/tree/VariableHeightLayoutCache.java
index 3f4818b32..a1d8ef853 100644
--- a/javax/swing/tree/VariableHeightLayoutCache.java
+++ b/javax/swing/tree/VariableHeightLayoutCache.java
@@ -35,252 +35,567 @@ 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;
-import gnu.classpath.NotImplementedException;
+import gnu.javax.swing.tree.GnuPath;
import java.awt.Rectangle;
import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.Vector;
import javax.swing.event.TreeModelEvent;
/**
- * VariableHeightLayoutCache
- * @author Andrew Selkirk
- *
+ * The fixed height tree layout. This class requires the NodeDimensions to be
+ * set and ignores the row height property.
+ *
+ * @specnote the methods, of this class, returning TreePath, actually returns
+ * the derived class GnuPath that provides additional information for optimized
+ * painting. See the GnuPath code for details.
+ *
+ * @author Audrius Meskauskas
*/
-public class VariableHeightLayoutCache extends AbstractLayoutCache
+public class VariableHeightLayoutCache
+ extends AbstractLayoutCache
{
-
/**
- * Constructor VariableHeightLayoutCache
+ * The cached node record.
*/
- public VariableHeightLayoutCache()
- throws NotImplementedException
+ class NodeRecord
{
- // TODO
- }
+ NodeRecord(int aRow, int aDepth, Object aNode, Object aParent)
+ {
+ row = aRow;
+ depth = aDepth;
+ parent = aParent;
+ node = aNode;
+
+ isExpanded = expanded.contains(aNode);
+ }
+
+ /**
+ * The row, where the tree node is displayed.
+ */
+ final int row;
+
+ /**
+ * The nesting depth
+ */
+ final int depth;
+
+ /**
+ * The parent of the given node, null for the root node.
+ */
+ final Object parent;
+
+ /**
+ * This node.
+ */
+ final Object node;
+
+ /**
+ * True for the expanded nodes. The value is calculated in constructor.
+ * Using this field saves one hashtable access operation.
+ */
+ final boolean isExpanded;
+
+ /**
+ * The cached bounds of the tree row.
+ */
+ Rectangle bounds;
+
+ /**
+ * The path from the tree top to the given node (computed under first
+ * demand)
+ */
+ private TreePath path;
+
+ /**
+ * Get the path for this node. The derived class is returned,
+ * making check for the last child of some parent easier.
+ */
+ TreePath getPath()
+ {
+ boolean lastChild = false;
+ if (parent!=null)
+ {
+ int nc = treeModel.getChildCount(parent);
+ if (nc > 0)
+ {
+ int n = treeModel.getIndexOfChild(parent, node);
+ if (n == nc-1)
+ lastChild = true;
+ }
+ }
+ if (path == null)
+ {
+ LinkedList lpath = new LinkedList();
+ NodeRecord rp = this;
+ while (rp != null)
+ {
+ lpath.addFirst(rp.node);
+ if (rp.parent != null)
+ rp = (NodeRecord) nodes.get(rp.parent);
+ else
+ rp = null;
+ }
+ path = new GnuPath(lpath.toArray(), lastChild);
+ }
+ return path;
+ }
+
+ /**
+ * Get the rectangle bounds (compute, if required).
+ */
+ Rectangle getBounds()
+ {
+ // This method may be called in the context when the tree rectangle is
+ // not known. To work around this, it is assumed near infinitely large.
+ if (bounds==null)
+ bounds = getNodeDimensions(node, row, depth, isExpanded,
+ new Rectangle(Integer.MAX_VALUE/2,
+ Integer.MAX_VALUE/2));
+ return bounds;
+ }
+ }
+
+ /**
+ * The set of all expanded tree nodes.
+ */
+ Set expanded = new HashSet();
+
+ /**
+ * Maps nodes to the row numbers.
+ */
+ Hashtable nodes = new Hashtable();
+
+ /**
+ * Maps row numbers to nodes.
+ */
+ Hashtable row2node = new Hashtable();
+
+ /**
+ * If true, the row map must be recomputed before using.
+ */
+ boolean dirty;
+
+ /**
+ * The cumulative height of all rows.
+ */
+ int totalHeight;
+
+ /**
+ * The maximal width.
+ */
+ int maximalWidth;
/**
- * setModel
- * @param value0 TODO
+ * Creates the unitialised instance. Before using the class, the row height
+ * must be set with the {@link #setRowHeight(int)} and the model must be set
+ * with {@link #setModel(TreeModel)}. The node dimensions may not be set.
*/
- public void setModel(TreeModel value0)
- throws NotImplementedException
+ public VariableHeightLayoutCache()
{
- // TODO
+ // Nothing to do here.
}
/**
- * setRootVisible
- * @param value0 TODO
+ * Get the total number of rows in the tree. Every displayed node occupies the
+ * single row. The root node row is included if the root node is set as
+ * visible (false by default).
+ *
+ * @return int the number of the displayed rows.
*/
- public void setRootVisible(boolean value0)
- throws NotImplementedException
+ public int getRowCount()
{
- // TODO
+ if (dirty) update();
+ return row2node.size();
}
-
+
/**
- * setNodeDimensions
- * @param value0 TODO
+ * Refresh the row map.
*/
- public void setNodeDimensions(NodeDimensions value0)
- throws NotImplementedException
+ private final void update()
{
- // TODO
- }
+ nodes.clear();
+ row2node.clear();
+
+ totalHeight = maximalWidth = 0;
+
+ Object root = treeModel.getRoot();
+
+ if (rootVisible)
+ {
+ countRows(root, null, 0);
+ }
+ else
+ {
+ int sc = treeModel.getChildCount(root);
+ for (int i = 0; i < sc; i++)
+ {
+ Object child = treeModel.getChild(root, i);
+ countRows(child, root, 1);
+ }
+ }
+ dirty = false;
+ }
+
+ /**
+ * Recursively counts all rows in the tree.
+ */
+ private final void countRows(Object node, Object parent, int depth)
+ {
+ Integer n = new Integer(row2node.size());
+ row2node.put(n, node);
+
+ NodeRecord nr = new NodeRecord(n.intValue(), depth, node, parent);
+ nodes.put(node, nr);
+
+ // For expanded nodes and for the root node.
+ if (expanded.contains(node) || parent == null)
+ {
+ int sc = treeModel.getChildCount(node);
+ int deeper = depth+1;
+ for (int i = 0; i < sc; i++)
+ {
+ Object child = treeModel.getChild(node, i);
+ countRows(child, node, deeper);
+ }
+ }
+ }
/**
- * setExpandedState
- * @param value0 TODO
- * @param value1 TODO
+ * Discard the bound information for the given path.
+ *
+ * @param path the path, for that the bound information must be recomputed.
*/
- public void setExpandedState(TreePath value0, boolean value1)
- throws NotImplementedException
+ public void invalidatePathBounds(TreePath path)
{
- // TODO
+ NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
+ if (r!=null)
+ r.bounds = null;
}
/**
- * getExpandedState
- * @param value0 TODO
- * @return boolean
+ * Mark all cached information as invalid.
*/
- public boolean getExpandedState(TreePath value0)
- throws NotImplementedException
+ public void invalidateSizes()
{
- return false; // TODO
+ dirty = true;
}
/**
- * getBounds
- * @param value0 TODO
- * @param value1 TODO
- * @return Rectangle
+ * Set the expanded state of the given path. The expansion states must be
+ * always updated when expanding and colapsing the tree nodes. Otherwise
+ * other methods will not work correctly after the nodes are collapsed or
+ * expanded.
+ *
+ * @param path the tree path, for that the state is being set.
+ * @param isExpanded the expanded state of the given path.
+ */
+ public void setExpandedState(TreePath path, boolean isExpanded)
+ {
+ if (isExpanded)
+ expanded.add(path.getLastPathComponent());
+ else
+ expanded.remove(path.getLastPathComponent());
+
+ dirty = true;
+ }
+
+ /**
+ * Get the expanded state for the given tree path.
+ *
+ * @return true if the given path is expanded, false otherwise.
*/
- public Rectangle getBounds(TreePath value0, Rectangle value1)
- throws NotImplementedException
+ public boolean isExpanded(TreePath path)
{
- return null; // TODO
+ return expanded.contains(path.getLastPathComponent());
}
/**
- * getPathForRow
- * @param value0 TODO
- * @return TreePath
+ * Get bounds for the given tree path.
+ *
+ * @param path the tree path
+ * @param rect the rectangle that will be reused to return the result.
+ * @return Rectangle the bounds of the last line, defined by the given path.
*/
- public TreePath getPathForRow(int value0)
- throws NotImplementedException
+ public Rectangle getBounds(TreePath path, Rectangle rect)
{
- return null; // TODO
+ if (dirty)
+ update();
+ Object last = path.getLastPathComponent();
+ NodeRecord r = (NodeRecord) nodes.get(last);
+ if (r == null)
+ // This node is not visible.
+ {
+ rect.x = rect.y = rect.width = rect.height = 0;
+ }
+ else
+ {
+ if (r.bounds == null)
+ {
+ Rectangle dim = getNodeDimensions(last, r.row, r.depth,
+ r.isExpanded, rect);
+ r.bounds = dim;
+ }
+
+ rect.setRect(r.bounds);
+ }
+ return rect;
}
/**
- * getRowForPath
- * @param value0 TODO
- * @return int
+ * Get the path, the last element of that is displayed in the given row.
+ *
+ * @param row the row
+ * @return TreePath the path
*/
- public int getRowForPath(TreePath value0)
- throws NotImplementedException
+ public TreePath getPathForRow(int row)
{
- return 0; // TODO
+ if (dirty)
+ update();
+ Object last = row2node.get(new Integer(row));
+ if (last == null)
+ return null;
+ else
+ {
+ NodeRecord r = (NodeRecord) nodes.get(last);
+ return r.getPath();
+ }
}
/**
- * getRowCount
- * @return int
+ * Get the row, displaying the last node of the given path.
+ *
+ * @param path the path
+ * @return int the row number or -1 if the end of the path is not visible.
*/
- public int getRowCount()
- throws NotImplementedException
+ public int getRowForPath(TreePath path)
{
- return 0; // TODO
+ if (dirty) update();
+
+ NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent());
+ if (r == null)
+ return - 1;
+ else
+ return r.row;
}
/**
- * invalidatePathBounds
- * @param value0 TODO
+ * Get the path, closest to the given point.
+ *
+ * @param x the point x coordinate
+ * @param y the point y coordinate
+ * @return the tree path, closest to the the given point
*/
- public void invalidatePathBounds(TreePath value0)
- throws NotImplementedException
+ public TreePath getPathClosestTo(int x, int y)
{
- // TODO
+ if (dirty)
+ update();
+
+ // As the rows have arbitrary height, we need to iterate.
+ NodeRecord best = null;
+ NodeRecord r;
+ Enumeration en = nodes.elements();
+
+ int dist = Integer.MAX_VALUE;
+
+ while (en.hasMoreElements() && dist > 0)
+ {
+ r = (NodeRecord) en.nextElement();
+ if (best == null)
+ {
+ best = r;
+ dist = distance(r.getBounds(), x, y);
+ }
+ else
+ {
+ int rr = distance(r.getBounds(), x, y);
+ if (rr < dist)
+ {
+ best = r;
+ dist = rr;
+ }
+ }
+ }
+
+ if (best == null)
+ return null;
+ else
+ return best.getPath();
}
-
+
/**
- * getPreferredHeight
- * @return int
+ * Get the closest distance from this point till the given rectangle. Only
+ * vertical distance is taken into consideration.
*/
- public int getPreferredHeight()
- throws NotImplementedException
+ int distance(Rectangle r, int x, int y)
{
- return 0; // TODO
+ if (y < r.y)
+ return r.y - y;
+ else if (y > r.y + r.height)
+ return y - (r.y + r.height);
+ else
+ return 0;
}
/**
- * getPreferredWidth
- * @param value0 TODO
- * @return int
+ * Get the number of the visible childs for the given tree path. If the node
+ * is not expanded, 0 is returned. Otherwise, the number of children is
+ * obtained from the model as the number of children for the last path
+ * component.
+ *
+ * @param path the tree path
+ * @return int the number of the visible childs (for row).
*/
- public int getPreferredWidth(Rectangle value0)
- throws NotImplementedException
+ public int getVisibleChildCount(TreePath path)
{
- return 0; // TODO
+ if (isExpanded(path))
+ return 0;
+ else
+ return treeModel.getChildCount(path.getLastPathComponent());
}
/**
- * getPathClosestTo
- * @param value0 TODO
- * @param value1 TODO
- * @return TreePath
+ * Get the enumeration over all visible pathes that start from the given
+ * parent path.
+ *
+ * @param parentPath the parent path
+ * @return the enumeration over pathes
*/
- public TreePath getPathClosestTo(int value0, int value1)
- throws NotImplementedException
+ public Enumeration getVisiblePathsFrom(TreePath parentPath)
{
- return null; // TODO
- }
+ if (dirty)
+ update();
+ Vector p = new Vector(parentPath.getPathCount());
+ Object node;
+ NodeRecord nr;
+
+ for (int i = 0; i < parentPath.getPathCount(); i++)
+ {
+ node = parentPath.getPathComponent(i);
+ nr = (NodeRecord) nodes.get(node);
+ if (nr.row >= 0)
+ p.add(node);
+ }
+ return p.elements();
+ }
/**
- * getVisiblePathsFrom
- * @param value0 TODO
- * @return Enumeration
+ * Return the expansion state of the given tree path. The expansion state
+ * must be previously set with the
+ * {@link #setExpandedState(TreePath, boolean)}
+ *
+ * @param path the path being checked
+ * @return true if the last node of the path is expanded, false otherwise.
*/
- public Enumeration getVisiblePathsFrom(TreePath value0)
- throws NotImplementedException
+ public boolean getExpandedState(TreePath path)
{
- return null; // TODO
- }
+ return expanded.contains(path.getLastPathComponent());
+ }
/**
- * getVisibleChildCount
- * @param value0 TODO
- * @return int
+ * The listener method, called when the tree nodes are changed.
+ *
+ * @param event the change event
*/
- public int getVisibleChildCount(TreePath value0)
- throws NotImplementedException
+ public void treeNodesChanged(TreeModelEvent event)
{
- return 0; // TODO
+ dirty = true;
}
/**
- * invalidateSizes
+ * The listener method, called when the tree nodes are inserted.
+ *
+ * @param event the change event
*/
- public void invalidateSizes()
- throws NotImplementedException
+ public void treeNodesInserted(TreeModelEvent event)
{
- // TODO
- }
+ dirty = true;
+ }
/**
- * isExpanded
- * @param value0 TODO
- * @return boolean
+ * The listener method, called when the tree nodes are removed.
+ *
+ * @param event the change event
*/
- public boolean isExpanded(TreePath value0)
- throws NotImplementedException
+ public void treeNodesRemoved(TreeModelEvent event)
{
- return false; // TODO
+ dirty = true;
}
/**
- * treeNodesChanged
- * @param value0 TODO
+ * Called when the tree structure has been changed.
+ *
+ * @param event the change event
*/
- public void treeNodesChanged(TreeModelEvent value0)
- throws NotImplementedException
+ public void treeStructureChanged(TreeModelEvent event)
{
- // TODO
+ dirty = true;
}
-
+
/**
- * treeNodesInserted
- * @param value0 TODO
+ * Set the tree model that will provide the data.
*/
- public void treeNodesInserted(TreeModelEvent value0)
- throws NotImplementedException
+ public void setModel(TreeModel newModel)
{
- // TODO
- }
+ treeModel = newModel;
+ dirty = true;
+ }
+
+ /**
+ * Inform the instance if the tree root node is visible. If this method
+ * is not called, it is assumed that the tree root node is not visible.
+ *
+ * @param visible true if the tree root node is visible, false
+ * otherwise.
+ */
+ public void setRootVisible(boolean visible)
+ {
+ rootVisible = visible;
+ dirty = true;
+ }
/**
- * treeNodesRemoved
- * @param value0 TODO
+ * Get the sum of heights for all rows.
*/
- public void treeNodesRemoved(TreeModelEvent value0)
- throws NotImplementedException
+ public int getPreferredHeight()
{
- // TODO
- }
+ if (dirty)
+ update();
+ totalHeight = 0;
+ Enumeration en = nodes.elements();
+ while (en.hasMoreElements())
+ {
+ NodeRecord nr = (NodeRecord) en.nextElement();
+ Rectangle r = nr.getBounds();
+ totalHeight += r.height;
+ }
+ return totalHeight;
+ }
/**
- * treeStructureChanged
- * @param value0 TODO
+ * Get the maximal width.
*/
- public void treeStructureChanged(TreeModelEvent value0)
- throws NotImplementedException
+ public int getPreferredWidth(Rectangle value)
{
- // TODO
- }
-
+ if (dirty)
+ update();
+
+ maximalWidth = 0;
+ Enumeration en = nodes.elements();
+ while (en.hasMoreElements())
+ {
+ NodeRecord nr = (NodeRecord) en.nextElement();
+ Rectangle r = nr.getBounds();
+ if (r.x + r.width > maximalWidth)
+ maximalWidth = r.x + r.width;
+ }
+ return maximalWidth;
+ }
}
diff --git a/javax/xml/XMLConstants.java b/javax/xml/XMLConstants.java
index 735620755..0d4a65ff9 100644
--- a/javax/xml/XMLConstants.java
+++ b/javax/xml/XMLConstants.java
@@ -1,5 +1,5 @@
/* XMLConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,10 +41,15 @@ package javax.xml;
* Repository for well-known XML constants.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public final class XMLConstants
{
+
+ private XMLConstants()
+ {
+ // to prevent instantiation
+ }
/**
* Dummy namespace URI indicating that there is no namespace.
diff --git a/javax/xml/datatype/DatatypeConstants.java b/javax/xml/datatype/DatatypeConstants.java
index 3919d03da..6098e084b 100644
--- a/javax/xml/datatype/DatatypeConstants.java
+++ b/javax/xml/datatype/DatatypeConstants.java
@@ -1,5 +1,5 @@
/* DatatypeConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,11 +43,16 @@ import javax.xml.namespace.QName;
* Basic data type constants.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public final class DatatypeConstants
{
+ private DatatypeConstants()
+ {
+ // to prevent instantiation
+ }
+
/**
* Typesafe enumerated class representing the six fields of the
* <a href='Duration.html'>Duration</a> class.
diff --git a/javax/xml/datatype/DatatypeFactory.java b/javax/xml/datatype/DatatypeFactory.java
index 98a5690e8..c5bc96ed2 100644
--- a/javax/xml/datatype/DatatypeFactory.java
+++ b/javax/xml/datatype/DatatypeFactory.java
@@ -1,5 +1,5 @@
/* DatatypeFactory.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import java.util.GregorianCalendar;
* objects.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public abstract class DatatypeFactory
{
@@ -172,7 +172,7 @@ public abstract class DatatypeFactory
BigInteger days,
BigInteger hours,
BigInteger minutes,
- BigDecimal seconds)
+ BigInteger seconds)
{
return newDuration(isPositive,
null,
@@ -180,7 +180,7 @@ public abstract class DatatypeFactory
days,
hours,
minutes,
- seconds);
+ new BigDecimal(seconds));
}
/**
diff --git a/javax/xml/datatype/Duration.java b/javax/xml/datatype/Duration.java
index fb1d65537..96390fde4 100644
--- a/javax/xml/datatype/Duration.java
+++ b/javax/xml/datatype/Duration.java
@@ -1,5 +1,5 @@
/* Duration.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import javax.xml.namespace.QName;
* An immutable time space as specified in XML Schema 1.0.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public abstract class Duration
{
@@ -240,11 +240,7 @@ public abstract class Duration
/**
* Returns the result of multiplying this duration by the given factor.
*/
- public Duration multiply(BigDecimal factor)
- {
- // TODO
- throw new UnsupportedOperationException();
- }
+ public abstract Duration multiply(BigDecimal factor);
/**
* Returns the unary negative of this duration.
diff --git a/javax/xml/validation/SchemaFactory.java b/javax/xml/validation/SchemaFactory.java
index f33c1c629..0042ea323 100644
--- a/javax/xml/validation/SchemaFactory.java
+++ b/javax/xml/validation/SchemaFactory.java
@@ -1,5 +1,5 @@
/* SchemaFactory.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,13 +52,10 @@ import org.xml.sax.SAXNotSupportedException;
* Factory for obtaining schemata.
*
* @author Chris Burdess (dog@gnu.org)
- * @since 1.3
+ * @since 1.5
*/
public abstract class SchemaFactory
{
-
- ErrorHandler errorHandler;
-
protected SchemaFactory()
{
}
@@ -109,15 +106,9 @@ public abstract class SchemaFactory
throw new SAXNotRecognizedException(name);
}
- public ErrorHandler getErrorHandler()
- {
- return errorHandler;
- }
+ public abstract ErrorHandler getErrorHandler();
- public void setErrorHandler(ErrorHandler errorHandler)
- {
- this.errorHandler = errorHandler;
- }
+ public abstract void setErrorHandler(ErrorHandler errorHandler);
public abstract LSResourceResolver getResourceResolver();
diff --git a/javax/xml/validation/SchemaFactoryLoader.java b/javax/xml/validation/SchemaFactoryLoader.java
new file mode 100644
index 000000000..dc80a33cc
--- /dev/null
+++ b/javax/xml/validation/SchemaFactoryLoader.java
@@ -0,0 +1,52 @@
+/* SchemaFactory.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.xml.validation;
+
+/**
+ * API compatibility class. Do not use.
+ */
+public abstract class SchemaFactoryLoader
+{
+
+ protected SchemaFactoryLoader()
+ {
+ }
+
+ public abstract SchemaFactory newFactory(String schemaLanguage);
+
+}
diff --git a/javax/xml/xpath/XPathConstants.java b/javax/xml/xpath/XPathConstants.java
index 3b2d5d2d9..fbfb99981 100644
--- a/javax/xml/xpath/XPathConstants.java
+++ b/javax/xml/xpath/XPathConstants.java
@@ -1,5 +1,5 @@
/* XPathConstants.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,10 +43,14 @@ import javax.xml.namespace.QName;
* XPath constants.
*
* @author (a href='mailto:dog@gnu.org'>Chris Burdess</a)
- * @since 1.3
+ * @since 1.5
*/
public class XPathConstants
{
+ private XPathConstants()
+ {
+ // to prevent instantiation
+ }
/**
* The XPath 1.0 number data type.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 00d4005c2..0d803c95b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -5,8 +5,8 @@ JAVA_DEPEND = java.dep
## this file and restart the make process again
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)
+propertydirs := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java javax org META-INF -type d ! -name CVS -print)
+propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java javax org -name \*\.properties -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)
@@ -87,10 +87,19 @@ endif # INSTALL_CLASS_FILES
.PHONY: genclasses
+if USE_PREBUILT_GLIBJ_ZIP
+
+glibj.zip:
+ cp $(PATH_TO_GLIBJ_ZIP) .
+
+else
+
glibj.zip: classes compile-classes resources
if test "$(ZIP)" != ""; then $(ZIP) -r -D glibj.zip gnu java javax org META-INF > /dev/null; fi
if test "$(FASTJAR)" != ""; then $(FASTJAR) cf glibj.zip gnu java javax org META-INF; fi
+endif # USE_PREBUILT_GLIBJ_ZIP
+
resources: copy-vmresources.sh
if ! [ -e gnu ]; then mkdir gnu; fi
if ! [ -e gnu/java ]; then mkdir gnu/java; fi
@@ -147,6 +156,7 @@ $(JAVA_DEPEND): genclasses
# GCJ='$(GCJ)' \
# compile_classpath='$(top_builddir):$(compile_classpath)' \
# top_srcdir=$(top_srcdir)
+# touch compile-classes
#else
compile-classes: classes $(JAVA_SRCS) Makefile
$(JAVAC)
@@ -155,7 +165,7 @@ compile-classes: classes $(JAVA_SRCS) Makefile
EXTRA_DIST = standard.omit mkcollections.pl.in Makefile.gcj split-for-gcj.sh
CLEANFILES = compile-classes resources classes \
- glibj.zip classes.1 \
+ glibj.zip classes.1 classes.2 \
$(top_builddir)/gnu/java/locale/LocaleData.java \
$(JAVA_DEPEND)
diff --git a/lib/gen-classlist.sh.in b/lib/gen-classlist.sh.in
index 4c3a836eb..5f7055ffd 100755
--- a/lib/gen-classlist.sh.in
+++ b/lib/gen-classlist.sh.in
@@ -7,16 +7,34 @@
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 \
- @top_srcdir@/external/w3c_dom @top_srcdir@/external/sax \
- @top_srcdir@/external/relaxngDatatype \
- -follow -type f -print | sort -r | grep '\.java$' \
- > ${top_builddir}/lib/classes.1
+# We construct 'classes.1' as a series of lines. Each line
+# has three fields, which are separated by spaces. The first
+# field is the package of this class (separated by "/"s).
+# The second field is the name of the top-level directory for
+# this file, relative to the build directory. E.g., it might
+# look like "../../classpath/vm/reference".
+# The third field is the file name, like "java/lang/Object.java".
+# We do this because it makes splitting for the gcj build much
+# cheaper.
+(cd @top_srcdir@
+ @FIND@ java javax gnu org -follow -name '*.java' -print |
+ sort -r | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg @top_srcdir@ $pkg/$file
+ done) > ${top_builddir}/lib/classes.1
+
+# The same, but for the external code.
+# Right now all external code is in org/.
+for dir in @top_srcdir@/external/w3c_dom \
+ @top_srcdir@/external/sax @top_srcdir@/external/relaxngDatatype; do
+ (cd $dir
+ @FIND@ org -follow -name '*.java' -print |
+ sort -r | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg $dir $pkg/$file
+ done)
+done >> ${top_builddir}/lib/classes.1
# Generate files for the VM classes.
: > vm.omit
@@ -29,18 +47,22 @@ for dir in $vm_dirlist; do
if test -d $subdir; then
@FIND@ $subdir -name '*.java' -print
fi
- done) |
- while read f; do
- echo $dir/$f >> vm.add
- echo $f >> vm.omit
+ done) | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg $dir $pkg/$file >> vm.add
+ echo $pkg/$file >> vm.omit
done
done
# Only include generated files once.
if test ! "${top_builddir}" -ef "@top_srcdir@"; then
echo "Adding generated files in builddir '${top_builddir}'."
- @FIND@ ${top_builddir}/gnu ${top_builddir}/java -follow -type f -print \
- | sort | grep '\.java$' >> ${top_builddir}/lib/classes.1
+ # Currently the only generated files are in gnu.*.
+ (cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
+ sort | sed -e 's,/\([^/]*\)$, \1,' |
+ while read pkg file; do
+ echo $pkg $top_builddir $pkg/$file
+ done >> ${top_builddir}/lib/classes.1
fi
@@ -51,9 +73,10 @@ for dir in $vm_dirlist; do
fi
done
+# FIXME: could be more efficient by constructing a series of greps.
for filexp in `cat tmp.omit`; do
- grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.2
- mv ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1
+ grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
+ mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
done
@@ -72,18 +95,20 @@ rm vm.add
rm tmp.omit
new=
-if test -e ${top_builddir}/lib/classes; then
- p=`diff ${top_builddir}/lib/classes ${top_builddir}/lib/classes.1`
+if test -e ${top_builddir}/lib/classes.2; then
+ p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
if test "$p" != ""; then
new="true"
- cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes
fi
else
new="true"
- cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes
fi
if test "$new" = "true"; then
+ cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes.2
+ # Strip the package part.
+ sed -e 's/^[^ ]* //' -e 's, ,/,' < ${top_builddir}/lib/classes.1 \
+ > ${top_builddir}/lib/classes
echo "JAVA_SRCS = \\" > ${top_builddir}/lib/java.dep
for i in `cat ${top_builddir}/lib/classes` ; do
echo $i "\\" >> ${top_builddir}/lib/java.dep
diff --git a/lib/split-for-gcj.sh b/lib/split-for-gcj.sh
index f69b79797..4130d5664 100755
--- a/lib/split-for-gcj.sh
+++ b/lib/split-for-gcj.sh
@@ -22,22 +22,24 @@
# 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.dtmp > /dev/null 2>&1
test -d lists || mkdir lists
-for dir in java javax gnu org; 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' | cut -f1-3 -d-`
- 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.dtmp
- echo "${list}.list: $file" >> Makefile.dtmp
- done
+# Much more efficient to do processing outside the loop...
+# The first expression computes the .class file name.
+# We only want the first three package components, and
+# we want them separated by '-'; this is the remaining expressions.
+sed -e 's, \(.*\)[.]java$, \1.java \1.class,' \
+ -e 's,^\([^/ ]*\)/\([^/ ]*\) ,\1-\2 ,' \
+ -e 's,^\([^/ ]*\)/\([^/ ]*\)/\([^/ ]*\) ,\1-\2-\3 ,' \
+ -e 's,^\([^/ ]*\)/\([^/ ]*\)/\([^/ ]*\)/[^ ]* ,\1-\2-\3 ,' \
+ classes.2 |
+while read pkg dir file f2; do
+ list=lists/$pkg
+ echo "$dir/$file" >> ${list}.list.1
+
+ echo "$f2: ${list}.stamp" >> Makefile.dtmp
+ echo "${list}.list: $dir/$file" >> Makefile.dtmp
done
# Only update a .list file if it changed.
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
index 9e89e03aa..77020f59d 100644
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -25,9 +25,7 @@ dnl AM_CONDITIONAL(FOUND_KJC, test "x${user_specified_javac}" = xkjc)
dnl if test "x${GCJ}" = x && test "x${JIKES}" = x && test "x${user_specified_javac}" != xkjc && test "x${user_specified_javac}" != xgcjx; then
if test "x${ECJ}" = x && test "x${user_specified_javac}" != xecj && test "x${user_specified_javac}" != xgcjx; then
- # FIXME: use autoconf error function
- echo "configure: cannot find javac, try -with-ecj or --with-gcjx" 1>&2
- exit 1
+ AC_MSG_ERROR([cannot find javac, try --with-ecj or --with-gcjx])
fi
])
diff --git a/native/fdlibm/fdlibm.h b/native/fdlibm/fdlibm.h
index 5dbcdb523..bf9f56991 100644
--- a/native/fdlibm/fdlibm.h
+++ b/native/fdlibm/fdlibm.h
@@ -158,7 +158,7 @@ extern double erfc __P((double));
extern double gamma __P((double));
extern double hypot __P((double, double));
-#if !defined(isnan) && !defined(HAVE_ISNAN)
+#if !defined(isnan)
#define isnan(x) ((x) != (x))
#endif
diff --git a/native/jni/classpath/jcl.c b/native/jni/classpath/jcl.c
index dd6ca06a7..e28c6631b 100644
--- a/native/jni/classpath/jcl.c
+++ b/native/jni/classpath/jcl.c
@@ -68,9 +68,9 @@ JCL_ThrowException (JNIEnv * env, const char *className, const char *errMsg)
if (errExcClass == NULL)
{
fprintf (stderr, "JCL: Utterly failed to throw exeption ");
- fprintf (stderr, className);
+ fprintf (stderr, "%s", className);
fprintf (stderr, " with message ");
- fprintf (stderr, errMsg);
+ fprintf (stderr, "%s", errMsg);
return;
}
}
diff --git a/native/jni/classpath/jcl.h b/native/jni/classpath/jcl.h
index 9a3756238..514b78262 100644
--- a/native/jni/classpath/jcl.h
+++ b/native/jni/classpath/jcl.h
@@ -71,7 +71,7 @@ JNIEXPORT void * JNICALL JCL_GetRawData (JNIEnv * env, jobject rawdata);
/* Simple debug macro */
#ifdef DEBUG
-#define DBG(x) fprintf(stderr, (x));
+#define DBG(x) fprintf(stderr, "%s", (x));
#else
#define DBG(x)
#endif
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 8910bf3ec..0726fb531 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -217,10 +217,10 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector
}
(*env)->ReleaseStringUTFChars (env, chars, str);
-
+
for (i = g_list_first (items); i != NULL; i = g_list_next (i))
- g_free (i->data);
-
+ pango_item_free(i->data);
+
g_list_free (items);
gdk_threads_leave ();
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index d23d7edc6..29bc1855b 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -160,7 +160,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeCopyState
else /* GDK_IS_WINDOW (g->drawable) */
g_object_ref (g->drawable);
- g_object_ref (g->cm);
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
NSA_SET_G_PTR (env, obj, g);
@@ -181,7 +182,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
gdk_rgb_get_visual ()->depth);
g->cm = gdk_rgb_get_colormap ();
- g_object_ref (g->cm);
+
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -208,7 +211,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
g->drawable = (GdkDrawable *)pixmap;
g->cm = gdk_drawable_get_colormap (g->drawable);
- g_object_ref (g->cm);
+
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -235,7 +240,10 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
g_object_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
- g_object_ref (g->cm);
+
+ if (g->cm != NULL)
+ g_object_ref (g->cm);
+
g->gc = gdk_gc_new (g->drawable);
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
color = widget->style->fg[GTK_STATE_NORMAL];
@@ -293,15 +301,17 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_nativeDispose
}
XFlush (GDK_DISPLAY ());
-
- g_object_unref (g->gc);
+
+ if (g->gc != NULL)
+ g_object_unref (g->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
g_object_unref (g->drawable);
- else /* GDK_IS_WINDOW (g->drawable) */
+ else if (g->drawable != NULL)
g_object_unref (g->drawable);
- g_object_unref (g->cm);
+ if (g->cm != NULL)
+ g_object_unref (g->cm);
g_free (g);
@@ -495,7 +505,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
else
{
gdk_gc_get_values (g->gc, &saved);
- gdk_gc_set_foreground (g->gc, &(saved.background));
+ gdk_gc_set_background (g->gc, &(saved.background));
gdk_draw_rectangle (g->drawable, g->gc, TRUE,
x + g->x_offset, y + g->y_offset, width, height);
gdk_gc_set_foreground (g->gc, &(saved.foreground));
@@ -536,10 +546,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
color.blue = blue << 8;
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
+
+ if (g->cm != NULL)
+ gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
+
gdk_gc_set_foreground (g->gc, &color);
-
+
gdk_threads_leave ();
}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
index ef9ac1207..f44361972 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
@@ -56,3 +56,17 @@ Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
gdk_threads_leave ();
}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_realize (JNIEnv *env, jobject obj)
+{
+ void *ptr;
+
+ gdk_threads_enter ();
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gtk_widget_realize (GTK_WIDGET (ptr));
+
+ gdk_threads_leave ();
+}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index fc6002255..b0d4ab9b0 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -80,7 +80,6 @@ static GtkWidget *get_widget (GtkWidget *widget);
static jmethodID postMouseEventID;
static jmethodID postMouseWheelEventID;
-static jmethodID setCursorID;
static jmethodID postExposeEventID;
static jmethodID postFocusEventID;
@@ -100,9 +99,6 @@ cp_gtk_component_init_jni (void)
"postMouseWheelEvent",
"(IJIIIIZIII)V");
- setCursorID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
- "setCursor", "()V");
-
postExposeEventID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gtkcomponentpeer,
"postExposeEvent", "(IIII)V");
@@ -270,6 +266,9 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
gdk_window_set_cursor (widget->window, gdk_cursor);
gdk_cursor_unref (gdk_cursor);
+
+ /* Make sure the cursor is replaced on screen. */
+ gdk_flush();
}
JNIEXPORT void JNICALL
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index a3cea8c4a..1c858faf5 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -1424,6 +1424,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
void *ptr;
+ gint current_width;
+ gint current_height;
ptr = NSA_GET_PTR (env, obj);
@@ -1447,12 +1449,19 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBoundsUnlocked
if (GTK_WIDGET (ptr)->window != NULL)
gdk_window_move (GTK_WIDGET (ptr)->window, x, y);
- /* Need to change the widget's request size. */
- gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
- /* Also need to call gtk_window_resize. If the resize is requested
- 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);
+ /* Only request resizing if the actual width or height change, otherwise
+ * we get unnecessary flickers because resizing causes GTK to clear the
+ * window content, even if the actual size doesn't change. */
+ gtk_window_get_size(GTK_WINDOW(ptr), &current_width, &current_height);
+ if (current_width != width || current_height != height)
+ {
+ /* Need to change the widget's request size. */
+ gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
+ /* Also need to call gtk_window_resize. If the resize is requested
+ 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);
+ }
}
static void
diff --git a/native/jni/java-net/javanet.h b/native/jni/java-net/javanet.h
index 785b0b082..030d41282 100644
--- a/native/jni/java-net/javanet.h
+++ b/native/jni/java-net/javanet.h
@@ -40,6 +40,7 @@ exception statement from your version. */
#define _JAVANET_LOADED
#include <jni.h>
+#include "jcl.h"
/*************************************************************************/
@@ -73,19 +74,6 @@ exception statement from your version. */
/*************************************************************************/
/*
- * Macros
- */
-
-/* Simple debug macro */
-#ifdef DEBUG
-#define DBG(x) fprintf(stderr, (x));
-#else
-#define DBG(x)
-#endif
-
-/*************************************************************************/
-
-/*
* Function Prototypes
*/
diff --git a/native/target/generic/target_generic.h b/native/target/generic/target_generic.h
index e4ddf5c3b..c2264330d 100644
--- a/native/target/generic/target_generic.h
+++ b/native/target/generic/target_generic.h
@@ -148,7 +148,7 @@ Systems : all
#include <errno.h>
#define TARGET_NATIVE_LAST_ERROR_STRING_FORMAT(buffer,bufferSize,format) \
do { \
- sprintf(buffer,format); \
+ sprintf(buffer, "%s", format); \
strcat(" (error: "); \
strcat(strerror(errno)); \
strcat(")"); \
diff --git a/native/target/generic/target_generic_misc.h b/native/target/generic/target_generic_misc.h
index 1174aa83c..d51be15a8 100644
--- a/native/target/generic/target_generic_misc.h
+++ b/native/target/generic/target_generic_misc.h
@@ -90,7 +90,7 @@ Systems : all
#include <stdarg.h>
#define TARGET_NATIVE_MISC_FORMAT_STRING0(buffer,bufferSize,format) \
do { \
- snprintf(buffer,bufferSize,format); \
+ snprintf(buffer,bufferSize, "%s", format); \
} while (0)
#endif
#ifndef TARGET_NATIVE_MISC_FORMAT_STRING1
diff --git a/org/omg/CORBA/ORB.java b/org/omg/CORBA/ORB.java
index 98c758445..1cf0e70a6 100644
--- a/org/omg/CORBA/ORB.java
+++ b/org/omg/CORBA/ORB.java
@@ -235,17 +235,7 @@ public abstract class ORB
* @see #create_recursive_tc(String)
* @see #create_sequence_tc(int, TypeCode)
*/
- public TypeCode create_recursive_sequence_tc(int bound, int offset)
- {
- RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
- for (int i = 0; i < offset; i++)
- r.add(new StructMember());
-
- TypeCode recurs = new PrimitiveTypeCode(TCKind.tk_sequence);
-
- r.add(new StructMember("", recurs, null));
- return r;
- }
+ public abstract TypeCode create_recursive_sequence_tc(int bound, int offset);
/**
* Create alias typecode for the given typecode.
@@ -790,10 +780,7 @@ public abstract class ORB
* @throws NO_IMPLEMENT for the Singleton ORB, returned by
* the parameterless {@link #init()}.
*/
- public Context get_default_context()
- {
- return new gnuContext("", null);
- }
+ public abstract Context get_default_context();
/**
* Return thg typecode, representing the given primitive object type.
diff --git a/org/omg/CORBA/ParameterMode.java b/org/omg/CORBA/ParameterMode.java
index 73c6f574f..931a2e927 100644
--- a/org/omg/CORBA/ParameterMode.java
+++ b/org/omg/CORBA/ParameterMode.java
@@ -1,5 +1,5 @@
/* ParameterMode.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,17 +78,17 @@ public class ParameterMode
/**
* This value means that the parameter is an IN parameter.
*/
- public static ParameterMode PARAM_IN = new ParameterMode(_PARAM_IN);
+ public static final ParameterMode PARAM_IN = new ParameterMode(_PARAM_IN);
/**
* This value means that the parameter is an OUT parameter.
*/
- public static ParameterMode PARAM_OUT = new ParameterMode(_PARAM_OUT);
+ public static final ParameterMode PARAM_OUT = new ParameterMode(_PARAM_OUT);
/**
* This value means that the parameter is an INOUT parameter.
*/
- public static ParameterMode PARAM_INOUT = new ParameterMode(_PARAM_INOUT);
+ public static final ParameterMode PARAM_INOUT = new ParameterMode(_PARAM_INOUT);
/**
* The value of this parameter mode instance.
diff --git a/org/omg/CosNaming/NamingContextOperations.java b/org/omg/CosNaming/NamingContextOperations.java
index dc25daaa3..cc93cb7ba 100644
--- a/org/omg/CosNaming/NamingContextOperations.java
+++ b/org/omg/CosNaming/NamingContextOperations.java
@@ -1,5 +1,5 @@
/* NamingContext.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package org.omg.CosNaming;
-import org.omg.CORBA.portable.IDLEntity;
import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.InvalidName;
@@ -55,7 +54,6 @@ import org.omg.CosNaming.NamingContextPackage.NotFound;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public interface NamingContextOperations
- extends IDLEntity
{
/**
* Gives the object a name, valid in this context.
diff --git a/org/omg/CosNaming/_BindingIteratorStub.java b/org/omg/CosNaming/_BindingIteratorStub.java
index 487b2efe3..b5400c4a1 100644
--- a/org/omg/CosNaming/_BindingIteratorStub.java
+++ b/org/omg/CosNaming/_BindingIteratorStub.java
@@ -1,5 +1,5 @@
/* _BindingIteratorStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,7 +77,7 @@ public class _BindingIteratorStub
/**
* Create the stub that used the given delegate.
*/
- public _BindingIteratorStub(Delegate delegate)
+ _BindingIteratorStub(Delegate delegate)
{
super();
_set_delegate(delegate);
diff --git a/org/omg/CosNaming/_NamingContextExtStub.java b/org/omg/CosNaming/_NamingContextExtStub.java
index a0bc80ac0..067b3cf3c 100644
--- a/org/omg/CosNaming/_NamingContextExtStub.java
+++ b/org/omg/CosNaming/_NamingContextExtStub.java
@@ -1,5 +1,5 @@
/* _NamingContextExtStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -99,7 +99,7 @@ public class _NamingContextExtStub
/**
* Create the naming context stub with the given delegate.
*/
- public _NamingContextExtStub(Delegate delegate)
+ _NamingContextExtStub(Delegate delegate)
{
super(delegate);
}
diff --git a/org/omg/CosNaming/_NamingContextStub.java b/org/omg/CosNaming/_NamingContextStub.java
index d561aeb48..2b21e71b6 100644
--- a/org/omg/CosNaming/_NamingContextStub.java
+++ b/org/omg/CosNaming/_NamingContextStub.java
@@ -1,5 +1,5 @@
/* _NamingContextStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,6 @@ exception statement from your version. */
package org.omg.CosNaming;
import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.ORB;
import org.omg.CORBA.ObjectHelper;
import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.Delegate;
@@ -85,7 +84,7 @@ public class _NamingContextStub
/**
* Create the naming context stub with the given delegate.
*/
- public _NamingContextStub(Delegate delegate)
+ _NamingContextStub(Delegate delegate)
{
super();
_set_delegate(delegate);
@@ -415,7 +414,7 @@ public class _NamingContextStub
* @throws NotFound if the id matches.
* @throws MARSHAL if the id does not match any of the previous 4 exceptions.
*/
- protected void throw4(InputStream in, String id)
+ void throw4(InputStream in, String id)
throws MARSHAL, InvalidName, CannotProceed, NotFound
{
if (id.equals(NotFoundHelper.id()))
@@ -443,7 +442,7 @@ public class _NamingContextStub
* @throws NotFound if the id matches.
* @throws MARSHAL if the id does not match any of the previous 4 exceptions.
*/
- protected void throw5(InputStream in, String id)
+ void throw5(InputStream in, String id)
throws MARSHAL, AlreadyBound, InvalidName, CannotProceed,
NotFound
{
diff --git a/org/omg/DynamicAny/_DynAnyFactoryStub.java b/org/omg/DynamicAny/_DynAnyFactoryStub.java
index 15f7c816b..d4b569069 100644
--- a/org/omg/DynamicAny/_DynAnyFactoryStub.java
+++ b/org/omg/DynamicAny/_DynAnyFactoryStub.java
@@ -1,5 +1,5 @@
/* _DynAnyFactoryStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,20 +40,19 @@ package org.omg.DynamicAny;
import gnu.CORBA.Minor;
+import java.io.Serializable;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on
* DynAnyFactory. As DynAny can never be remote at least till 1.5 inclusive,
* this class is not in use. DynAnyFactory should be obtained from the
- * {@link ORB#resolve_initial_references}.
+ * {@link org.omg.CORBA.ORB#resolve_initial_references}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
@@ -79,14 +78,6 @@ public class _DynAnyFactoryStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynAnyFactoryStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
diff --git a/org/omg/DynamicAny/_DynAnyStub.java b/org/omg/DynamicAny/_DynAnyStub.java
index af8d4e5ed..0e3e39058 100644
--- a/org/omg/DynamicAny/_DynAnyStub.java
+++ b/org/omg/DynamicAny/_DynAnyStub.java
@@ -1,5 +1,5 @@
/* _DynAnyStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,16 +38,15 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on DynAny. As
* DynAny can never be remote at least till 1.5 inclusive, this class is
@@ -77,14 +76,6 @@ public class _DynAnyStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynAnyStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
diff --git a/org/omg/DynamicAny/_DynArrayStub.java b/org/omg/DynamicAny/_DynArrayStub.java
index 4484f1655..869e269c3 100644
--- a/org/omg/DynamicAny/_DynArrayStub.java
+++ b/org/omg/DynamicAny/_DynArrayStub.java
@@ -1,5 +1,5 @@
/* _DynArrayStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,14 +38,15 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on DynArray. As
* DynArray can never be remote at least till 1.5 inclusive, this class is
@@ -54,7 +55,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynArrayStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynArray, Serializable
{
/**
@@ -75,14 +76,6 @@ public class _DynArrayStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynArrayStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -131,4 +124,543 @@ public class _DynArrayStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/_DynEnumStub.java b/org/omg/DynamicAny/_DynEnumStub.java
index ea7879be1..73e9fa72d 100644
--- a/org/omg/DynamicAny/_DynEnumStub.java
+++ b/org/omg/DynamicAny/_DynEnumStub.java
@@ -1,5 +1,5 @@
/* _DynEnumStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,14 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
-
-import java.io.Serializable;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
/**
* Should provide support for remote invocation of methods on DynEnum. As
@@ -52,7 +55,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynEnumStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynEnum, Serializable
{
/**
@@ -73,14 +76,6 @@ public class _DynEnumStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynEnumStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -129,4 +124,543 @@ public class _DynEnumStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/_DynFixedStub.java b/org/omg/DynamicAny/_DynFixedStub.java
index 8e2747e4f..97a3d94df 100644
--- a/org/omg/DynamicAny/_DynFixedStub.java
+++ b/org/omg/DynamicAny/_DynFixedStub.java
@@ -1,5 +1,5 @@
/* _DynFixedStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,13 +38,15 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on DynFixed. As
* DynFixed can never be remote at least till 1.5 inclusive, this class is
@@ -53,7 +55,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynFixedStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynFixed, Serializable
{
/**
@@ -74,14 +76,6 @@ public class _DynFixedStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynFixedStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -109,4 +103,543 @@ public class _DynFixedStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/_DynSequenceStub.java b/org/omg/DynamicAny/_DynSequenceStub.java
index 5f1f038ba..802ff2332 100644
--- a/org/omg/DynamicAny/_DynSequenceStub.java
+++ b/org/omg/DynamicAny/_DynSequenceStub.java
@@ -1,5 +1,5 @@
/* _DynSequenceStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,14 +38,16 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on DynSequence. As
* DynSequence can never be remote at least till 1.5 inclusive, this class is
@@ -54,7 +56,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynSequenceStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynSequence, Serializable
{
/**
@@ -77,14 +79,6 @@ public class _DynSequenceStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynSequenceStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -154,4 +148,543 @@ public class _DynSequenceStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/_DynStructStub.java b/org/omg/DynamicAny/_DynStructStub.java
index 0b8231b36..a48f2a633 100644
--- a/org/omg/DynamicAny/_DynStructStub.java
+++ b/org/omg/DynamicAny/_DynStructStub.java
@@ -1,5 +1,5 @@
/* _DynStructStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,14 +38,17 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on DynStruct. As
* DynStruct can never be remote at least till 1.5 inclusive, this class is
@@ -54,7 +57,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynStructStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynStruct, Serializable
{
/**
@@ -77,14 +80,6 @@ public class _DynStructStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynStructStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -155,4 +150,543 @@ public class _DynStructStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/_DynUnionStub.java b/org/omg/DynamicAny/_DynUnionStub.java
index 7f8eba778..b7ba74e00 100644
--- a/org/omg/DynamicAny/_DynUnionStub.java
+++ b/org/omg/DynamicAny/_DynUnionStub.java
@@ -1,5 +1,5 @@
/* _DynUnionStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,14 +38,17 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
-import java.io.Serializable;
-
/**
* Should provide support for remote invocation of methods on DynUnion. As
* DynUnion can never be remote at least till 1.5 inclusive, this class is
@@ -54,7 +57,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynUnionStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynUnion, Serializable
{
/**
@@ -77,14 +80,6 @@ public class _DynUnionStub
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynUnionStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -187,4 +182,543 @@ public class _DynUnionStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/_DynValueStub.java b/org/omg/DynamicAny/_DynValueStub.java
index 5319a7b63..5c6b7a209 100644
--- a/org/omg/DynamicAny/_DynValueStub.java
+++ b/org/omg/DynamicAny/_DynValueStub.java
@@ -1,5 +1,5 @@
/* _DynValueStub.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,12 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
@@ -54,7 +57,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class _DynValueStub
- extends _DynAnyStub
+ extends ObjectImpl
implements DynValue, Serializable
{
/**
@@ -70,21 +73,13 @@ public class _DynValueStub
/**
* Create the DynValue stub. To get the stub working,
* you must later set the delegate with
- * {@link ObjectImpl#_set_delegate(Delegate)}.
+ * {@link org.omg.CORBA.portable.ObjectImpl#_set_delegate(Delegate)}.
*/
public _DynValueStub()
{
}
/**
- * Create the naming context stub with the given delegate.
- */
- public _DynValueStub(Delegate delegate)
- {
- _set_delegate(delegate);
- }
-
- /**
* Return the array of repository ids for this object.
*/
public String[] _ids()
@@ -187,4 +182,543 @@ public class _DynValueStub
{
throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
}
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode type()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean next()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny copy()
+ {
+ return this;
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void rewind()
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void assign(DynAny _0)
+ throws TypeMismatch
+ {
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int component_count()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny current_component()
+ throws TypeMismatch
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean equal(DynAny _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void from_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any get_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean get_boolean()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_char()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public double get_double()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public DynAny get_dyn_any()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public float get_float()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_long()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_longlong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public byte get_octet()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_short()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_string()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public TypeCode get_typecode()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public int get_ulong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public long get_ulonglong()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public short get_ushort()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Serializable get_val()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public char get_wchar()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public String get_wstring()
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_any(Any _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_boolean(boolean _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_char(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_double(double _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_dyn_any(DynAny _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_float(float _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_long(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_longlong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_octet(byte _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_reference(org.omg.CORBA.Object _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_short(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_string(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_typecode(TypeCode _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulong(int _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ulonglong(long _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_ushort(short _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_val(Serializable _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wchar(char _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public void insert_wstring(String _0)
+ throws TypeMismatch, InvalidValue
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public boolean seek(int _0)
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
+ /**
+ * The remote call of DynAny methods is not possible.
+ *
+ * @throws MARSHAL, always.
+ */
+ public Any to_any()
+ {
+ throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE);
+ }
+
} \ No newline at end of file
diff --git a/org/omg/PortableInterceptor/ObjectReferenceFactory.java b/org/omg/PortableInterceptor/ObjectReferenceFactory.java
index 55cde585c..83f3da652 100644
--- a/org/omg/PortableInterceptor/ObjectReferenceFactory.java
+++ b/org/omg/PortableInterceptor/ObjectReferenceFactory.java
@@ -1,5 +1,5 @@
/* ObjectReferenceFactory.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,20 +38,38 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+import org.omg.CORBA.Object;
import org.omg.CORBA.portable.IDLEntity;
+import org.omg.CORBA.portable.ValueBase;
/**
* Provides the possibility to create the CORBA object reference.
* The reference is created from repository id (defining the type of the
* object) and the object id (defining the identity of the object).
- * The operation for creating reference is defined separately in
- * {@link ObjectReferenceFactoryOperations}.
*
* @since 1.5
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public interface ObjectReferenceFactory
- extends ObjectReferenceFactoryOperations, IDLEntity
+ extends ValueBase, IDLEntity
{
+ /**
+ * Create an object with the given repository and object ids. This interface
+ * does not specify where and how the returned object must be connected and
+ * activated. The derived {@link ObjectReferenceTemplate} interface assumes
+ * the object must be connected to the POA that is specific to that
+ * template (name can be obtained).
+ *
+ * If the object with this objectId already exists in the given context, it
+ * is found and returned; a new object is <i>not</i> created.
+ *
+ * @param repositoryId the repository id of the object being created, defines
+ * the type of the object.
+ *
+ * @param objectId the byte array, defining the identity of the object.
+ *
+ * @return The created corba object.
+ */
+ Object make_object(String repositoryId, byte[] objectId);
} \ No newline at end of file
diff --git a/org/omg/PortableServer/ServantActivatorPOA.java b/org/omg/PortableServer/ServantActivatorPOA.java
index 94e5b47ba..c94866ab2 100644
--- a/org/omg/PortableServer/ServantActivatorPOA.java
+++ b/org/omg/PortableServer/ServantActivatorPOA.java
@@ -98,42 +98,6 @@ public abstract class ServantActivatorPOA
}
/**
- * It is your responsibility to handle the incarnation event and
- * supply the servant.
- * The default method instructs POA that the servant cannot be
- * provided by activator. The OBJ_ADAPTER exception will be
- * thrown by POA, unless the servant is provided as one of the
- * parameters in the activation method, or the default servant is set.
- *
- * @see ServantActivatorOperations#incarnate
- *
- * @specnote in GNU Classpath, returning null means that the
- * activator does not supply the servant. The servant can still be supplied
- * as one of parameters in some POA activation methods or as a default
- * servant.
- *
- * @throws ForwardRequest
- */
- public Servant incarnate(byte[] Object_Id, POA poa)
- throws ForwardRequest
- {
- return null;
- }
-
- /**
- * It is your responsibility to handle the etherialization event.
- * Override this method if using the class. The default method
- * does nothing.
- *
- * @see ServantActivatorOperations#incarnate
- */
- public void etherealize(byte[] Object_Id, POA poa, Servant servant,
- boolean cleanup, boolean remains
- )
- {
- }
-
- /**
* Our implementation will not call this method. After setting your
* manager to POA, it will call incarnate and etherialize directly.
*/
diff --git a/org/omg/PortableServer/ServantLocatorPOA.java b/org/omg/PortableServer/ServantLocatorPOA.java
index ef3f743d2..8e9c7aeb5 100644
--- a/org/omg/PortableServer/ServantLocatorPOA.java
+++ b/org/omg/PortableServer/ServantLocatorPOA.java
@@ -74,40 +74,6 @@ public abstract class ServantLocatorPOA
final ServantLocatorPOA THIS = this;
/**
- * It is your responsibility to take the preinvoke actions, if any,
- * and also supply an appropriate servant for the current invocation.
- *
- * The default method instructs POA that the servant cannot be
- * provided by locator. The OBJ_ADAPTER exception will be
- * thrown by POA, unless it uses the available default servant for all
- * invocations.
- *
- * @specnote in GNU Classpath, returning null means that the
- * locator does not supply the servant.
- *
- * @see ServantLocatorOperations#preinvoke
- */
- public Servant preinvoke(byte[] Object_Id, POA poa, String method,
- CookieHolder cookie_holder
- )
- throws org.omg.PortableServer.ForwardRequest
- {
- return null;
- }
-
- /**
- * It is your responsibility to take the postinvoke actions, if any,
- * by overriding this method. The default method does nothing.
- *
- * @see ServantLocatorOperations#postinvoke
- */
- public void postinvoke(byte[] Object_Id, POA poa, String method,
- java.lang.Object cookie, Servant servant
- )
- {
- }
-
- /**
* Our implementation will not call this method. After setting your
* manager to POA, it will call incarnate and etherialize directly.
*/
diff --git a/resource/javax/imageio/plugins/jpeg/MessagesBundle.properties b/resource/javax/imageio/plugins/jpeg/MessagesBundle.properties
new file mode 100644
index 000000000..8141c2a9a
--- /dev/null
+++ b/resource/javax/imageio/plugins/jpeg/MessagesBundle.properties
@@ -0,0 +1,9 @@
+# Localized error messages for javax.imageio.plugins.jpeg
+
+# Compression types
+compression.types.jpeg=JPEG
+
+# Compression quality descriptions
+compression.minimum=Minimum useful
+compression.default=Visually lossless
+compression.maximum=Maximum useful
diff --git a/tools/.cvsignore b/tools/.cvsignore
index eaae7d326..ed63b49d8 100644
--- a/tools/.cvsignore
+++ b/tools/.cvsignore
@@ -1,3 +1,4 @@
+jarsigner.sh
Makefile.in
Makefile
tools.zip
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 57a22de88..5a47d18e4 100755
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,11 +1,13 @@
## Input file for automake to generate the Makefile.in used by configure
+GLIBJ_CLASSPATH='$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip'
+
# Setup the compiler to use the GNU Classpath library we just build
if FOUND_GCJX
-JCOMPILER = $(GCJX) -bootclasspath '' -sourcepath '' -classpath $(top_builddir)/lib:.
+JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
else
if FOUND_ECJ
-JCOMPILER = $(ECJ) -bootclasspath '$(top_builddir)/lib' -classpath .
+JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
else
error dunno how to setup the JCOMPILER and compile
endif
diff --git a/tools/README b/tools/README
index 54f682859..dc049d3b5 100644
--- a/tools/README
+++ b/tools/README
@@ -39,6 +39,9 @@ in gnu.classpath.tools.rmi package):
research and backward-compatibile applications, as
Classpath supports the 1.5 feature to replace such
stubs by proxy classes.
+* REGISTRY - The persistent RMI naming service.
+* RMID - The persistent RMI activation daemon, supports the
+ java.rmi.activation package.
== Security tools ==
diff --git a/tools/gnu/classpath/tools/giop/GRMIC.java b/tools/gnu/classpath/tools/giop/GRMIC.java
index bb0ef9cdc..a372cfd66 100644
--- a/tools/gnu/classpath/tools/giop/GRMIC.java
+++ b/tools/gnu/classpath/tools/giop/GRMIC.java
@@ -17,23 +17,7 @@ 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.tools.giop;
diff --git a/tools/gnu/classpath/tools/giop/IorParser.java b/tools/gnu/classpath/tools/giop/IorParser.java
index 7d70c8aca..411b8997d 100644
--- a/tools/gnu/classpath/tools/giop/IorParser.java
+++ b/tools/gnu/classpath/tools/giop/IorParser.java
@@ -17,23 +17,7 @@ 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.tools.giop;
diff --git a/tools/gnu/classpath/tools/giop/grmic/CompilationError.java b/tools/gnu/classpath/tools/giop/grmic/CompilationError.java
index c6b3e56e8..d1fa814ee 100644
--- a/tools/gnu/classpath/tools/giop/grmic/CompilationError.java
+++ b/tools/gnu/classpath/tools/giop/grmic/CompilationError.java
@@ -17,23 +17,7 @@ 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.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/Generator.java b/tools/gnu/classpath/tools/giop/grmic/Generator.java
index a45e8d398..17ab821ec 100644
--- a/tools/gnu/classpath/tools/giop/grmic/Generator.java
+++ b/tools/gnu/classpath/tools/giop/grmic/Generator.java
@@ -17,23 +17,7 @@ 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.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/GiopIo.java b/tools/gnu/classpath/tools/giop/grmic/GiopIo.java
index 3714c4ce4..0e0df7bc5 100644
--- a/tools/gnu/classpath/tools/giop/grmic/GiopIo.java
+++ b/tools/gnu/classpath/tools/giop/grmic/GiopIo.java
@@ -17,23 +17,7 @@ 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.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java b/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java
index 62456fd51..4beba1c9f 100644
--- a/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java
+++ b/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java
@@ -17,23 +17,7 @@ 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.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/HashFinder.java b/tools/gnu/classpath/tools/giop/grmic/HashFinder.java
index 216e73953..2efdb1e76 100644
--- a/tools/gnu/classpath/tools/giop/grmic/HashFinder.java
+++ b/tools/gnu/classpath/tools/giop/grmic/HashFinder.java
@@ -1,3 +1,25 @@
+/* HashFinder.java -- finds the hash character.
+ Copyright (C) 2006 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.
+*/
+
+
package gnu.classpath.tools.giop.grmic;
import java.util.HashSet;
diff --git a/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java b/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java
index 9a44fad79..80148d51a 100644
--- a/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java
+++ b/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java
@@ -17,23 +17,7 @@ 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.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/jarsigner/HashUtils.java b/tools/gnu/classpath/tools/jarsigner/HashUtils.java
index 7591b3c57..a81a0d34d 100644
--- a/tools/gnu/classpath/tools/jarsigner/HashUtils.java
+++ b/tools/gnu/classpath/tools/jarsigner/HashUtils.java
@@ -16,38 +16,21 @@ 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. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
+import gnu.java.security.hash.Sha160;
+import gnu.java.security.util.Base64;
+import gnu.java.util.jar.JarUtils;
+
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.logging.Logger;
-import gnu.java.security.hash.Sha160;
-import gnu.java.security.util.Base64;
-import gnu.java.util.jar.JarUtils;
-
/**
* Collection of utility methods used in JAR file signing and verification.
*/
diff --git a/tools/gnu/classpath/tools/jarsigner/JarSigner.java b/tools/gnu/classpath/tools/jarsigner/JarSigner.java
index 8babdcc30..1b58c5072 100644
--- a/tools/gnu/classpath/tools/jarsigner/JarSigner.java
+++ b/tools/gnu/classpath/tools/jarsigner/JarSigner.java
@@ -16,24 +16,7 @@ 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. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
@@ -45,8 +28,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.security.cert.CRLException;
-import java.security.cert.CertificateEncodingException;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -69,7 +50,7 @@ public class JarSigner
this.main = main;
}
- void start() throws IOException, CertificateEncodingException, CRLException
+ void start() throws Exception
{
log.entering("JarSigner", "start");
diff --git a/tools/gnu/classpath/tools/jarsigner/JarVerifier.java b/tools/gnu/classpath/tools/jarsigner/JarVerifier.java
index 06ebe64fe..8bca89270 100644
--- a/tools/gnu/classpath/tools/jarsigner/JarVerifier.java
+++ b/tools/gnu/classpath/tools/jarsigner/JarVerifier.java
@@ -16,24 +16,7 @@ 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. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
@@ -92,7 +75,7 @@ public class JarVerifier
this.main = main;
}
- void start() throws IOException, CRLException, CertificateException
+ void start() throws Exception
{
log.entering("JarVerifier", "start");
diff --git a/tools/gnu/classpath/tools/jarsigner/Main.java b/tools/gnu/classpath/tools/jarsigner/Main.java
index df5c3bb08..794055f45 100644
--- a/tools/gnu/classpath/tools/jarsigner/Main.java
+++ b/tools/gnu/classpath/tools/jarsigner/Main.java
@@ -16,41 +16,32 @@ 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. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.SystemProperties;
+import gnu.classpath.tools.HelpPrinter;
+import gnu.java.security.OID;
+import gnu.java.security.Registry;
+import gnu.javax.security.auth.callback.ConsoleCallbackHandler;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.AccessController;
import java.security.Key;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
+import java.security.PrivilegedAction;
import java.security.Provider;
+import java.security.Security;
import java.security.UnrecoverableKeyException;
-import java.security.cert.CRLException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.util.Locale;
@@ -62,11 +53,6 @@ import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
-import gnu.classpath.SystemProperties;
-import gnu.java.security.OID;
-import gnu.java.security.Registry;
-import gnu.javax.security.auth.callback.ConsoleCallbackHandler;
-
/**
* The GNU Classpath implementation of the <i>jarsigner</i> tool.
* <p>
@@ -103,32 +89,27 @@ public class Main
private String jarFileName;
private String alias;
- private Provider provider;
+ protected Provider provider;
+ private boolean providerInstalled;
private char[] ksPasswordChars;
private KeyStore store;
private char[] passwordChars;
private PrivateKey signerPrivateKey;
private Certificate[] signerCertificateChain;
- private Main(String[] args) throws KeyStoreException, InstantiationException,
- IllegalAccessException, ClassNotFoundException, NoSuchAlgorithmException,
- CertificateException, IOException, UnrecoverableKeyException,
- UnsupportedCallbackException
+ private Main()
{
super();
-
- processArgs(args);
}
- public static final void main(String[] args) throws IOException,
- CRLException, CertificateException
+ public static final void main(String[] args)
{
log.entering("Main", "main", args);
- Main tool;
+ Main tool = new Main();
try
{
- tool = new Main(args);
+ tool.processArgs(args);
tool.start();
}
catch (SecurityException x)
@@ -142,6 +123,8 @@ public class Main
System.err.println("jarsigner error: " + x);
}
+ tool.teardown();
+
log.exiting("Main", "main");
// System.exit(0);
}
@@ -149,24 +132,20 @@ public class Main
// helper methods -----------------------------------------------------------
/**
- * @param args
- * @throws KeyStoreException
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws IOException
- * @throws CertificateException
- * @throws NoSuchAlgorithmException
- * @throws UnsupportedCallbackException
- * @throws UnrecoverableKeyException
+ * Read the command line arguments setting the tool's parameters in
+ * preparation for the user desired action.
+ *
+ * @param args an array of options (strings).
+ * @throws Exception if an exceptio occurs during the process.
*/
- private void processArgs(String[] args) throws KeyStoreException,
- InstantiationException, IllegalAccessException, ClassNotFoundException,
- NoSuchAlgorithmException, CertificateException, IOException,
- UnrecoverableKeyException, UnsupportedCallbackException
+ private void processArgs(String[] args) throws Exception
{
log.entering("Main", "processArgs", args);
+ HelpPrinter.checkHelpKey(args, HELP_PATH);
+ if (args == null || args.length == 0)
+ HelpPrinter.printHelpAndExit(HELP_PATH);
+
int limit = args.length;
log.finest("args.length=" + limit);
int i = 0;
@@ -252,7 +231,15 @@ public class Main
log.exiting("Main", "processArgs");
}
- private void start() throws IOException, CRLException, CertificateException
+ /**
+ * Invokes the <code>start()</code> method of the concrete handler.
+ * <p>
+ * Depending on the result of processing the command line arguments, this
+ * handler may be one for signing the jar, or verifying it.
+ *
+ * @throws Exception if an exception occurs during the process.
+ */
+ private void start() throws Exception
{
log.entering("Main", "start");
@@ -270,11 +257,64 @@ public class Main
log.exiting("Main", "start");
}
+ /**
+ * Ensures that the underlying JVM is left in the same state as we found it
+ * when we first launched the tool. Specifically, if we have installed a new
+ * security provider then now is the time to remove it.
+ * <p>
+ * Note (rsn): this may not be necessary if we terminate the JVM; i.e. call
+ * {@link System#exit(int)} at the end of the tool's invocation. Nevertheless
+ * it's good practive to return the JVM to its initial state.
+ */
+ private void teardown()
+ {
+ log.entering("Main", "teardown");
+
+ if (providerInstalled)
+ {
+ final String providerName = provider.getName();
+ log.info("About to remove provider: " + providerName);
+ // remove it. again we need to override security checks
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ Security.removeProvider(providerName);
+ return null;
+ }
+ });
+ }
+
+ log.exiting("Main", "teardown");
+ }
+
+ /**
+ * After processing the command line arguments, this method is invoked to
+ * process the common parameters which may have been encountered among the
+ * actual arguments.
+ * <p>
+ * Common parameters are those which are allowed in both signing and
+ * verification modes.
+ *
+ * @throws InstantiationException if a security provider class name is
+ * specified but that class name is that of either an interface or
+ * an abstract class.
+ * @throws IllegalAccessException if a security provider class name is
+ * specified but no 0-arguments constructor is defined for that
+ * class.
+ * @throws ClassNotFoundException if a security provider class name is
+ * specified but no such class was found in the classpath.
+ * @throws IOException if the JAR file name for signing, or verifying, does
+ * not exist, exists but denotes a directory, or is not readable.
+ */
private void setupCommonParams() throws InstantiationException,
IllegalAccessException, ClassNotFoundException, IOException
{
log.entering("Main", "setupCommonParams");
+ if (jarFileName == null)
+ HelpPrinter.printHelpAndExit(HELP_PATH);
+
File jar = new File(jarFileName);
if (! jar.exists())
throw new FileNotFoundException(jarFileName);
@@ -286,7 +326,16 @@ public class Main
throw new IOException("JAR file [" + jarFileName + "] is NOT readable");
if (providerClassName != null && providerClassName.length() > 0)
- provider = (Provider) Class.forName(providerClassName).newInstance();
+ {
+ provider = (Provider) Class.forName(providerClassName).newInstance();
+ // is it already installed?
+ String providerName = provider.getName();
+ Provider installedProvider = Security.getProvider(providerName);
+ if (installedProvider != null)
+ log.info("Provider " + providerName + " is already installed");
+ else // install it
+ installNewProvider();
+ }
if (! verbose && certs)
{
@@ -297,6 +346,51 @@ public class Main
log.exiting("Main", "setupCommonParams");
}
+ /**
+ * Install the user defined security provider in the underlying JVM.
+ * <p>
+ * Also record this fact so we can remove it when we exit the tool.
+ */
+ private void installNewProvider()
+ {
+ log.entering("Main", "installNewProvider");
+
+ String providerName = provider.getName();
+ log.info("About to install new provider: " + providerName);
+ // we need to override security checks
+ Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ int actualPosition = Security.insertProviderAt(provider, 1);
+ return new Boolean(actualPosition != - 1);
+ }
+ });
+ log.info("Provider " + providerName + " installed successfully? " + result);
+ providerInstalled = result.booleanValue();
+
+ log.exiting("Main", "installNewProvider");
+ }
+
+ /**
+ * After processing the command line arguments, this method is invoked to
+ * process the parameters which may have been encountered among the actual
+ * arguments, and which are specific to the signing action of the tool.
+ *
+ * @throws KeyStoreException if no implementation of the designated (or
+ * default type) of a key store is availabe.
+ * @throws IOException if an I/O related exception occurs during the process.
+ * @throws NoSuchAlgorithmException if an implementation of an algorithm used
+ * by the key store is not available.
+ * @throws CertificateException if an exception occurs while reading a
+ * certificate from the key store.
+ * @throws UnsupportedCallbackException if no implementation of a password
+ * callback is available.
+ * @throws UnrecoverableKeyException if the wrong password was used to unlock
+ * the key store.
+ * @throws SecurityException if the designated alias is not known to the key
+ * store or is not an Alias of a Key Entry.
+ */
private void setupSigningParams() throws KeyStoreException, IOException,
NoSuchAlgorithmException, CertificateException,
UnsupportedCallbackException, UnrecoverableKeyException
@@ -324,10 +418,7 @@ public class Main
else
ksType = ksType.trim();
- if (provider != null)
- store = KeyStore.getInstance(ksType, provider);
- else
- store = KeyStore.getInstance(ksType);
+ store = KeyStore.getInstance(ksType);
if (ksPassword == null)
{
@@ -345,6 +436,9 @@ public class Main
InputStream stream = url.openStream();
store.load(stream, ksPasswordChars);
+ if (alias == null)
+ HelpPrinter.printHelpAndExit(HELP_PATH);
+
if (! store.containsAlias(alias))
throw new SecurityException("Designated alias [" + alias
+ "] MUST be known to the key store in use");
diff --git a/tools/gnu/classpath/tools/jarsigner/SFHelper.java b/tools/gnu/classpath/tools/jarsigner/SFHelper.java
index cbf5f356b..38caa44aa 100644
--- a/tools/gnu/classpath/tools/jarsigner/SFHelper.java
+++ b/tools/gnu/classpath/tools/jarsigner/SFHelper.java
@@ -16,24 +16,7 @@ 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. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
@@ -331,7 +314,7 @@ public class SFHelper
manifest.getEntries().put(name, mainfestAttributes);
}
- mainfestAttributes.putValue(Main.DIGEST_ATTR, hash);
+ mainfestAttributes.putValue(Main.DIGEST, hash);
// hash the newly added 2-header block and add it as an attribute to .SF
@@ -343,7 +326,7 @@ public class SFHelper
sfEntries.put(name, sfAttributes);
}
- sfAttributes.putValue(Main.DIGEST_ATTR, sfHash);
+ sfAttributes.putValue(Main.DIGEST, sfHash);
log.finest("Name: " + name);
log.finest(Main.DIGEST + ": " + sfHash);
log.finest("");
@@ -366,7 +349,7 @@ public class SFHelper
baos.flush();
String manifestHash = util.hashByteArray(baos.toByteArray());
log.fine("Hashed Manifest " + manifestHash);
- sfMainAttributes.putValue(Main.DIGEST_MANIFEST_ATTR, manifestHash);
+ sfMainAttributes.putValue(Main.DIGEST_MANIFEST, manifestHash);
this.state = FINISHED;
}
diff --git a/tools/gnu/classpath/tools/jarsigner/jarsigner.txt b/tools/gnu/classpath/tools/jarsigner/jarsigner.txt
index 167f6301e..a4e4c02ef 100644
--- a/tools/gnu/classpath/tools/jarsigner/jarsigner.txt
+++ b/tools/gnu/classpath/tools/jarsigner/jarsigner.txt
@@ -99,3 +99,5 @@ Usage:
implementation of the Security Provider capable of managing a
Key Store of the designated, or default, type.
+ -help Prints this help text.
+
diff --git a/tools/gnu/classpath/tools/rmi/Persistent.java b/tools/gnu/classpath/tools/rmi/Persistent.java
new file mode 100644
index 000000000..5cd1efe91
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/Persistent.java
@@ -0,0 +1,87 @@
+/* PersistentBidiHasthable.java -- Constants for the persistent tables.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * The static fields, shared by the multiple classes, implementing the
+ * persistent work.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public interface Persistent
+{
+ /**
+ * Sheduled termination task.
+ */
+ static class ExitTask extends TimerTask
+ {
+ public void run()
+ {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * The timer, sheduling all disk database update events, shared by all
+ * instances.
+ */
+ static Timer timer = new Timer(true);
+
+ /**
+ * The longest time, in ms, after that the database content on the disk must
+ * be updated. The algorithm is written to avoid the very frequent writings to
+ * the disk.
+ */
+ static long SAVE_AT_MOST_AFTER = 5000;
+
+ /**
+ * States how long the database may stay not updated during the intensive
+ * operations, in ms. Otherwise the intensively used structure may never
+ * be stored to the disk.
+ */
+ static long ALWAYS_UPDATE = 300000;
+
+ /**
+ * Write the database content to the disk.
+ */
+ void writeContent();
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java b/tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java
new file mode 100644
index 000000000..94b5bcbee
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java
@@ -0,0 +1,268 @@
+/* PersistentBidiHasthable.java -- Bidirectional persistent hash table.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import gnu.classpath.tools.rmi.rmid.ActivationSystemImpl;
+import gnu.java.rmi.activation.BidiTable;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TimerTask;
+
+/**
+ * The persistent bidirectional hash table, maps both a to b and b to a. The
+ * changes are written to dist after SAVE_AT_MOST_AFTER time from the latest
+ * database change or at most after ALWAYS_UPDATE, if the database is updated
+ * very frequently. To ensure that no information is lost, the shutdown method
+ * must be called before exit.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class PersistentBidiHashTable extends BidiTable implements
+ Persistent
+{
+ class WriteToDiskTask extends TimerTask
+ {
+ /**
+ * Save the database.
+ */
+ public void run()
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * Replaces instances of ActivationSystemImpl into the currently active
+ * instance of the ActivationSystemImpl
+ */
+ class AdaptedReader extends ObjectInputStream
+ {
+ AdaptedReader(InputStream in) throws IOException
+ {
+ super(in);
+ enableResolveObject(true);
+ }
+
+ protected Object resolveObject(Object obj) throws IOException
+ {
+ if (obj instanceof ActivationSystemImpl)
+ return ActivationSystemImpl.singleton2;
+ else
+ return obj;
+ }
+ }
+
+ /**
+ * The database file.
+ */
+ File database;
+
+ /**
+ * The currently sheduled write to disk task, null if none.
+ */
+ WriteToDiskTask sheduled = null;
+
+ /**
+ * The time, when the disk database was last updated.
+ */
+ long lastUpdated;
+
+ /**
+ * Create the unitialised instance that must be initalised when
+ * ActivationSystemImpl.singleton2 is assigned.
+ */
+ public PersistentBidiHashTable()
+ {
+ // Do not initalise the table fields - the initalise method must be
+ // called later.
+ super(0);
+ }
+
+ /**
+ * Create a new persistent table that stores its information into the given
+ * file. The ActivationSystemImpl.singleton2 must be assigned.
+ *
+ * @param file
+ * the file, where the table stores its information.
+ * @param coldStart
+ * if true, the existing file with this name will be erased and
+ * ignored. Otherwise, it will be assumed that the file contains the
+ * persistent table information.
+ */
+ public void init(File file, boolean coldStart)
+ {
+ try
+ {
+ database = file;
+ if (database.exists())
+ {
+ if (coldStart)
+ {
+ k2v = new Hashtable();
+ v2k = new Hashtable();
+ database.delete();
+ }
+ else
+ {
+ FileInputStream fi = new FileInputStream(file);
+ BufferedInputStream b = new BufferedInputStream(fi);
+ ObjectInputStream oin = new AdaptedReader(b);
+
+ k2v = (Map) oin.readObject();
+ oin.close();
+
+ v2k = new Hashtable(k2v.size());
+
+ // Reguild v2k from k2v:
+ Iterator en = k2v.keySet().iterator();
+ Object key;
+ while (en.hasNext())
+ {
+ key = en.next();
+ v2k.put(k2v.get(key), key);
+ }
+ }
+ }
+ else
+ {
+ k2v = new Hashtable();
+ v2k = new Hashtable();
+ }
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError("Unable to intialize with file "
+ + file);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+ /**
+ * Write the database content to the disk.
+ */
+ public synchronized void writeContent()
+ {
+ try
+ {
+ FileOutputStream fou = new FileOutputStream(database);
+ BufferedOutputStream b = new BufferedOutputStream(fou);
+ ObjectOutputStream oout = new ObjectOutputStream(b);
+ oout.writeObject(k2v);
+ oout.close();
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError(
+ "Failed to write database to disk: "
+ + database);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+ /**
+ * Mark the modified database as modified. The database will be written after
+ * several seconds, unless another modification occurs.
+ */
+ public void markDirty()
+ {
+ if (System.currentTimeMillis() - lastUpdated > ALWAYS_UPDATE)
+ {
+ // Force storing to disk under intensive operation.
+ writeContent();
+ lastUpdated = System.currentTimeMillis();
+ if (sheduled != null)
+ {
+ sheduled.cancel();
+ sheduled = null;
+ }
+ }
+ else
+ {
+ // Otherwise coalesce the disk database copy update events.
+ if (sheduled != null)
+ sheduled.cancel();
+ sheduled = new WriteToDiskTask();
+ timer.schedule(sheduled, SAVE_AT_MOST_AFTER);
+ }
+ }
+
+ /**
+ * Save the current database state to the disk before exit.
+ */
+ public void shutdown()
+ {
+ if (sheduled != null)
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public void put(Object key, Object value)
+ {
+ super.put(key, value);
+ markDirty();
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public void removeKey(Object key)
+ {
+ super.removeKey(key);
+ markDirty();
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/PersistentHashTable.java b/tools/gnu/classpath/tools/rmi/PersistentHashTable.java
new file mode 100644
index 000000000..925e829ff
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/PersistentHashTable.java
@@ -0,0 +1,246 @@
+/* PersistentHasthable.java -- Persistent hash table.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.TimerTask;
+
+/**
+ * The persistent hash table. The changes are written to dist after
+ * SAVE_AT_MOST_AFTER time from the latest database change or at most after
+ * ALWAYS_UPDATE, if the database is updated very frequently. To ensure that no
+ * information is lost, the shutdown method must be called before exit.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class PersistentHashTable
+ extends Hashtable
+ implements Serializable, Persistent
+{
+
+ /**
+ * Use serialVersionUID for interoperability
+ */
+ private static final long serialVersionUID = 1;
+
+ class WriteToDiskTask extends TimerTask
+ {
+ /**
+ * Save the database.
+ */
+ public void run()
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * The database file.
+ */
+ File database;
+
+ /**
+ * The currently sheduled write to disk task, null if none.
+ */
+ WriteToDiskTask sheduled = null;
+
+ /**
+ * The time, when the disk database was last updated.
+ */
+ long lastUpdated;
+
+ /**
+ * Setting to false prevents the automated disk update.
+ * The initial value is true to prevent writing while reading and is set
+ * to false in createInstance.
+ */
+ transient boolean ready;
+
+ /**
+ * Use static method to obtain the instance.
+ */
+ private PersistentHashTable(File file)
+ {
+ if (file == null)
+ throw new NullPointerException("Null file provided");
+ database = file;
+ }
+
+ /**
+ * Create a new persistent table that stores its information into the given
+ * file.
+ *
+ * @param file
+ * the file, where the table stores its information.
+ * @param coldStart
+ * if true, the existing file with this name will be erased and
+ * ignored. Otherwise, it will be assumed that the file contains the
+ * persistent table information.
+ */
+ public static Map createInstance(File file, boolean coldStart)
+ {
+ try
+ {
+ PersistentHashTable k2v;
+ if (file.exists())
+ {
+ if (coldStart)
+ {
+ file.delete();
+ k2v = new PersistentHashTable(file);
+ }
+ else
+ {
+ FileInputStream fi = new FileInputStream(file);
+ BufferedInputStream b = new BufferedInputStream(fi);
+ ObjectInputStream oin = new ObjectInputStream(b);
+
+ k2v = (PersistentHashTable) oin.readObject();
+ oin.close();
+ }
+ }
+ else
+ k2v = new PersistentHashTable(file);
+
+ k2v.ready = true;
+ return k2v;
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError("Unable to intialize with file "
+ + file);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+
+ /**
+ * Write the database content to the disk.
+ */
+ public synchronized void writeContent()
+ {
+ try
+ {
+ FileOutputStream fou = new FileOutputStream(database);
+ BufferedOutputStream b = new BufferedOutputStream(fou);
+ ObjectOutputStream oout = new ObjectOutputStream(b);
+ oout.writeObject(this);
+ oout.close();
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError(
+ "Failed to write database to disk: "+ database);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+ /**
+ * Mark the modified database as modified. The database will be written after
+ * several seconds, unless another modification occurs.
+ */
+ public void markDirty()
+ {
+ if (System.currentTimeMillis() - lastUpdated > ALWAYS_UPDATE)
+ {
+ // Force storing to disk under intensive operation.
+ writeContent();
+ lastUpdated = System.currentTimeMillis();
+ if (sheduled != null)
+ {
+ sheduled.cancel();
+ sheduled = null;
+ }
+ }
+ else
+ {
+ // Otherwise coalesce the disk database copy update events.
+ if (sheduled != null)
+ sheduled.cancel();
+ sheduled = new WriteToDiskTask();
+ timer.schedule(sheduled, SAVE_AT_MOST_AFTER);
+ }
+ }
+
+ /**
+ * Save the current database state to the disk before exit.
+ */
+ public void shutdown()
+ {
+ if (sheduled != null)
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public Object put(Object key, Object value)
+ {
+ super.put(key, value);
+ if (ready)
+ markDirty();
+ return value;
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public Object remove(Object key)
+ {
+ Object removed = super.remove(key);
+ if (ready)
+ markDirty();
+ return removed;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/REGISTRY.java b/tools/gnu/classpath/tools/rmi/REGISTRY.java
new file mode 100644
index 000000000..63f633f99
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/REGISTRY.java
@@ -0,0 +1,165 @@
+/* REGISTY.java -- RMI registry starter.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.tools.rmi;
+
+import gnu.classpath.tools.HelpPrinter;
+import gnu.classpath.tools.rmi.registry.RegistryImpl;
+import gnu.java.rmi.server.UnicastServerRef;
+
+import java.io.File;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.ObjID;
+import java.rmi.server.RMIServerSocketFactory;
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * The optionally persistent RMI registry implementation.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class REGISTRY
+{
+ /**
+ * The stop command.
+ */
+ public static String STOP = "gnu.classpath.tools.rmi.registry.command.STOP";
+
+ /**
+ * If true, the registry prints registration events to console.
+ */
+ public static boolean verbose = false;
+
+ /**
+ * The RMI registry implementation entry point.
+ */
+ public static void main(String[] args)
+ {
+ String HelpPath = "rmi/REGISTRY.txt";
+ HelpPrinter.checkHelpKey(args, HelpPath);
+
+ // Parse parameters:
+ String folder = ".";
+ boolean cold = false;
+ boolean trans = false;
+ boolean stop = false;
+
+ int port = Registry.REGISTRY_PORT;
+ RMIServerSocketFactory ssf = null;
+
+ for (int i = 0; i < args.length; i++)
+ {
+ String a = args[i];
+ if (a.equals("-restart"))
+ cold = true;
+ else if (a.equals("-transient"))
+ trans = true;
+ else if (a.equals("-verbose"))
+ verbose = true;
+ else if (a.equals("-stop"))
+ stop = true;
+ else if (i < args.length - 1)
+ {
+ // The additional key parameter is possible.
+ if (a.equals("-port"))
+ port = Integer.parseInt(args[++i]);
+ else if (a.equals("-folder"))
+ folder = args[++i];
+ }
+ }
+
+ if (!stop)
+ {
+ Map table;
+ if (trans)
+ table = new Hashtable();
+ else
+ {
+ // Start the system.
+ File dataFolder = new File(folder);
+ if (!dataFolder.exists())
+ dataFolder.mkdirs();
+ table = PersistentHashTable.createInstance(
+ new File(dataFolder, "rmiregistry.data"), cold);
+ }
+
+ RegistryImpl system = new RegistryImpl(table);
+
+ // We must export with the specific activation id that is only
+ // possible when going into the gnu.java.rmi
+ try
+ {
+ UnicastServerRef sref = new UnicastServerRef(
+ new ObjID(ObjID.REGISTRY_ID), port, ssf);
+
+ sref.exportObject(system);
+ System.out.println("The RMI naming service is listening at " + port);
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Failed to start RMI naming service at " + port);
+ }
+ }
+ else
+ {
+ // Stop the naming service.
+ try
+ {
+ Registry r = LocateRegistry.getRegistry(port);
+ // Search for this specific line will command to stop the registry.
+
+ // Our service returns null, but any other service will thrown
+ // NotBoundException.
+ r.unbind(STOP);
+ }
+ catch (RemoteException e)
+ {
+ System.out.println("Failed to stop RMI naming service at " + port);
+ }
+ catch (NotBoundException e)
+ {
+ System.out.println("The naming service at port "+port+" is not a "+
+ REGISTRY.class.getName());
+ }
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/REGISTRY.txt b/tools/gnu/classpath/tools/rmi/REGISTRY.txt
new file mode 100644
index 000000000..7d8e19232
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/REGISTRY.txt
@@ -0,0 +1,28 @@
+The persistent RMI naming service, required for the remote method invocations
+(packages java.rmi.*, java.rmi.Registry.*).
+
+Copyright 2006 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+
+Usage: rmiregistry <options>
+
+ where <options> includes:
+ -port N Start the registry on the given local port. If this key
+ is not specified, the service starts on the port 1099.
+ -verbose Log binding events to stdout.
+ -stop Stop the running naming service at the given port.
+
+ -transient Start transient registry service that does not write any
+ data to the disk. Such service looses the stored bindings if
+ restarted. If this key is not specified, the
+ persistent naming service is started.
+ -restart "Cold start:, clear the persistent naming database, if any.
+ -folder Folder Store the persistent binding file in the given folder. If this
+ key is not specified, the file with persistent bindings is
+ stored into the current folder.
+
+
+
diff --git a/tools/gnu/classpath/tools/rmi/RMIC.java b/tools/gnu/classpath/tools/rmi/RMIC.java
index ffcd0db0e..c44453011 100644
--- a/tools/gnu/classpath/tools/rmi/RMIC.java
+++ b/tools/gnu/classpath/tools/rmi/RMIC.java
@@ -17,30 +17,13 @@ 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.tools.rmi;
import gnu.classpath.tools.HelpPrinter;
import gnu.classpath.tools.giop.GRMIC;
-import gnu.classpath.tools.giop.grmic.GiopRmicCompiler;
import gnu.classpath.tools.rmi.rmic.RmicCompiler;
import java.io.File;
diff --git a/tools/gnu/classpath/tools/rmi/RMID.java b/tools/gnu/classpath/tools/rmi/RMID.java
new file mode 100644
index 000000000..81d09671a
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/RMID.java
@@ -0,0 +1,189 @@
+/* RMID.java -- the RMI activation daemon.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import gnu.classpath.tools.HelpPrinter;
+import gnu.classpath.tools.rmi.rmid.ActivationSystemImpl;
+import gnu.java.rmi.activation.ActivationSystemTransient;
+import gnu.java.rmi.server.UnicastServerRef;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.rmi.Remote;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.ObjID;
+import java.rmi.server.RMIServerSocketFactory;
+
+
+/**
+ * The persistent RMI activation daemon.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class RMID
+{
+ /**
+ * The RMI server socket factory.
+ */
+ static RMIServerSocketFactory ACTIVATION_REGISTY_SOCKET_FACTORY = null;
+
+ /**
+ * The activation registry port.
+ */
+ static int ACTIVATION_REGISTRY_PORT = ActivationSystem.SYSTEM_PORT;
+
+ /**
+ * The activation system name.
+ */
+ static String ACTIVATION_SYSTEM_NAME = "java.rmi.activation.ActivationSystem";
+
+ /**
+ * The RMI activation daemon entry point.
+ */
+ public static void main(String[] args)
+ {
+ String HelpPath = "rmi/RMID.txt";
+ HelpPrinter.checkHelpKey(args, HelpPath);
+
+ // Parse parameters:
+ boolean stop = false;
+ String folder = ".";
+ boolean cold = false;
+ boolean trans = false;
+
+ for (int i = 0; i < args.length; i++)
+ {
+ String a = args[i];
+ if (a.equals("-verbose"))
+ ActivationSystemTransient.debug = true;
+ else if (a.equals("-stop"))
+ stop = true;
+ else if (a.equals("-restart"))
+ cold = true;
+ else if (a.equals("-transient"))
+ trans = true;
+ else if (i < args.length - 1)
+ {
+ // The additional key parameter is possible.
+ if (a.equals("-port"))
+ ACTIVATION_REGISTRY_PORT = Integer.parseInt(args[++i]);
+ else if (a.equals("-folder"))
+ folder = args[++i];
+ }
+ }
+
+ try
+ {
+ if (!stop)
+ {
+ // Start the system.
+ File dataFolder = new File(folder);
+ if (!dataFolder.exists())
+ dataFolder.mkdirs();
+ ActivationSystem system;
+
+ if (trans)
+ system = ActivationSystemTransient.getInstance();
+ else
+ system = ActivationSystemImpl.getInstance(dataFolder, cold);
+
+ // We must export with the specific activation id that is only
+ // possible when going into the gnu.java.rmi.activation.
+ UnicastServerRef sref = new UnicastServerRef(
+ new ObjID(ObjID.ACTIVATOR_ID), ACTIVATION_REGISTRY_PORT,
+ ACTIVATION_REGISTY_SOCKET_FACTORY);
+ Remote systemStub = sref.exportObject(system);
+
+ // Start the naming system on the activation system port
+ // (if not already running).
+
+ Registry r;
+ try
+ {
+ // Expect the naming service running first.
+ // The local host may want to use the shared registry
+ r = LocateRegistry.getRegistry(ACTIVATION_REGISTRY_PORT);
+ r.rebind(ACTIVATION_SYSTEM_NAME, systemStub);
+ }
+ catch (Exception ex)
+ {
+ // The naming service is not running. Start it.
+ r = LocateRegistry.createRegistry(ACTIVATION_REGISTRY_PORT);
+ r.rebind(ACTIVATION_SYSTEM_NAME, systemStub);
+ }
+ String host = InetAddress.getLocalHost().getCanonicalHostName();
+ System.out.println("The RMI daemon is listening on " + host +
+ " (port "
+ + ACTIVATION_REGISTRY_PORT + ")");
+
+ }
+ else
+ {
+ // Stop the activation system.
+ Registry r;
+ try
+ {
+ System.out.print("Stopping RMI daemon at "
+ + ACTIVATION_REGISTRY_PORT+" ... ");
+ // Expect the naming service running first.
+ // The local host may want to use the shared registry
+ r = LocateRegistry.getRegistry(ACTIVATION_REGISTRY_PORT);
+ ActivationSystem asys =
+ (ActivationSystem) r.lookup(ACTIVATION_SYSTEM_NAME);
+ asys.shutdown();
+ System.out.println("OK.");
+ }
+ catch (Exception ex)
+ {
+ System.out.println("The RMI daemon seems not running at "
+ + ACTIVATION_REGISTRY_PORT);
+ if (ActivationSystemTransient.debug)
+ ex.printStackTrace();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println("Failed to start the RMI daemon.");
+ if (ActivationSystemTransient.debug)
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/RMID.txt b/tools/gnu/classpath/tools/rmi/RMID.txt
new file mode 100644
index 000000000..a62613fd4
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/RMID.txt
@@ -0,0 +1,30 @@
+The persistent RMI activation daemon, support RMI object activation
+(package java.rmi.activation.*).
+
+Copyright 2006 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+
+Usage: rmid <options>
+
+ where <options> includes:
+ -port N Start the service on the given local port. If this key
+ is not specified, the service starts on the port 1098.
+ -verbose Log registration events to stdout.
+ -stop Stop the running activation service at the given port.
+
+ -transient Start transient activation service that does not write any
+ data to the disk. Such service looses the stored activation
+ descriptors, if restarted. If this key is not specified, the
+ persistent naming service is started.
+ -restart "Cold start:, clear the activation descriptor database, if any.
+ -folder Folder Store the persistent descriptor file in the given folder. If this
+ key is not specified, the file with persistent activation
+ information is stored into the current folder.
+
+All activation groups are activated on the same virtual machine, where the
+daemon is running. For security reasons, all the classes, required for
+activation, must be available in the classpath of that machine.
+ \ No newline at end of file
diff --git a/tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java
new file mode 100644
index 000000000..90bd3a6bd
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java
@@ -0,0 +1,139 @@
+/* RegistryImpl.java -- the RMI registry implementation
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005, 2006
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi.registry;
+
+import gnu.classpath.tools.rmi.Persistent;
+import gnu.classpath.tools.rmi.REGISTRY;
+
+import java.rmi.AccessException;
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * The optionally persistent registry implementation.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class RegistryImpl implements Registry
+{
+ /**
+ * The binding table.
+ */
+ Map bindings;
+
+ /**
+ * Create the registry implementation that uses the given bidirectinal
+ * table to keep the data.
+ */
+ public RegistryImpl(Map aTable)
+ {
+ bindings = aTable;
+ }
+
+ /** @inheritDoc */
+ public Remote lookup(String name) throws RemoteException, NotBoundException,
+ AccessException
+ {
+ Object obj = bindings.get(name);
+ if (obj == null)
+ throw new NotBoundException(name);
+ return ((Remote) obj);
+ }
+
+ /** @inheritDoc */
+ public void bind(String name, Remote obj) throws RemoteException,
+ AlreadyBoundException, AccessException
+ {
+ if (REGISTRY.verbose)
+ System.out.println("Bind "+name);
+ if (bindings.containsKey(name))
+ throw new AlreadyBoundException(name);
+ bindings.put(name, obj);
+ }
+
+ /** @inheritDoc */
+ public void unbind(String name) throws RemoteException, NotBoundException,
+ AccessException
+ {
+ if (name.equals(REGISTRY.STOP))
+ {
+ if (bindings instanceof Persistent)
+ ((Persistent) bindings).writeContent();
+ // Terminate in 10 seconds.
+ System.out.println("Shutdown command received. Will terminate in 10 s");
+ Persistent.timer.schedule(new Persistent.ExitTask(), 10000);
+ }
+ else
+ {
+ if (REGISTRY.verbose)
+ System.out.println("Unbind "+name);
+
+ if (!bindings.containsKey(name))
+ throw new NotBoundException(name);
+ else
+ bindings.remove(name);
+ }
+ }
+
+ /** @inheritDoc */
+ public void rebind(String name, Remote obj) throws RemoteException,
+ AccessException
+ {
+ if (REGISTRY.verbose)
+ System.out.println("Rebind "+name);
+ bindings.put(name, obj);
+ }
+
+ /** @inheritDoc */
+ public String[] list() throws RemoteException, AccessException
+ {
+ // Create a separated array to prevent race conditions.
+ ArrayList keys = new ArrayList(bindings.keySet());
+ int n = keys.size();
+ String[] rt = new String[n];
+ for (int i = 0; i < n; i++)
+ rt[i] = (String) keys.get(i);
+ return rt;
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java
new file mode 100644
index 000000000..36b7d94a5
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java
@@ -0,0 +1,278 @@
+/* RegistryImpl_Skel.java
+ Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.tools.rmi.registry;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.rmi.MarshalException;
+import java.rmi.Remote;
+import java.rmi.UnmarshalException;
+import java.rmi.server.Operation;
+import java.rmi.server.RemoteCall;
+import java.rmi.server.SkeletonMismatchException;
+
+/**
+ * This skeleton supports unlikely cases when the naming service is
+ * contacted from other interoperable java implementation that still uses
+ * the old style skeleton-dependent invocations.
+ */
+public final class RegistryImpl_Skel
+ implements java.rmi.server.Skeleton
+{
+ private static final long interfaceHash = 4905912898345647071L;
+
+ /**
+ * Repeated multiple times.
+ */
+ static final String EUM = "error unmarshalling arguments for Registry";
+
+ /**
+ * Repeated multiple times.
+ */
+ static final String EMR = "error marshalling return from Registry";
+
+ private static final Operation[] operations =
+ {
+ new Operation("void bind(java.lang.String, Remote"),
+ new Operation("java.lang.String[] list("),
+ new Operation("Remote lookup(java.lang.String"),
+ new Operation("void rebind(java.lang.String, Remote"),
+ new Operation("void unbind(java.lang.String")
+ };
+
+ public Operation[] getOperations()
+ {
+ return ((Operation[]) operations.clone());
+ }
+
+ public void dispatch(Remote obj, RemoteCall call,
+ int opnum, long hash) throws java.lang.Exception
+ {
+ if (opnum < 0)
+ {
+ if (hash == 7583982177005850366L)
+ opnum = 0;
+ else if (hash == 2571371476350237748L)
+ opnum = 1;
+ else if (hash == -7538657168040752697L)
+ opnum = 2;
+ else if (hash == -8381844669958460146L)
+ opnum = 3;
+ else if (hash == 7305022919901907578L)
+ opnum = 4;
+ else
+ throw new SkeletonMismatchException("interface hash mismatch");
+ }
+ else if (hash != interfaceHash)
+ throw new SkeletonMismatchException("interface hash mismatch");
+
+ RegistryImpl server = (RegistryImpl) obj;
+ switch (opnum)
+ {
+ case 0:
+ {
+ java.lang.String $param_0;
+ Remote $param_1;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+ $param_1 = (Remote) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ server.bind($param_0, $param_1);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 1:
+ {
+ try
+ {
+ ObjectInput in = call.getInputStream();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ java.lang.String[] $result = server.list();
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ out.writeObject($result);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 2:
+ {
+ java.lang.String $param_0;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ Remote $result = server.lookup($param_0);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ out.writeObject($result);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 3:
+ {
+ java.lang.String $param_0;
+ Remote $param_1;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+ $param_1 = (Remote) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ server.rebind($param_0, $param_1);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 4:
+ {
+ java.lang.String $param_0;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ server.unbind($param_0);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ default:
+ throw new UnmarshalException("invalid method number");
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java
new file mode 100644
index 000000000..d8cac5bfc
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java
@@ -0,0 +1,263 @@
+/* RegistryImpl_Stub.java -- Registry stub.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi.registry;
+
+import java.rmi.AccessException;
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+
+import java.lang.reflect.Method;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+import java.rmi.UnexpectedException;
+
+/**
+ * This class delegates its method calls to the remote RMI object, referenced
+ * by {@link RemoteRef}.
+ *
+ * It is normally generated with rmic.
+ */
+public final class RegistryImpl_Stub
+ extends RemoteStub
+ implements Registry
+{
+ /**
+ * Use serialVersionUID for interoperability
+ */
+ private static final long serialVersionUID = 3;
+
+ /**
+ * The explaining message for {@ling UnexpectedException}.
+ */
+ private static final String exception_message =
+ "undeclared checked exception";
+
+ /* All remote methods, invoked by this stub: */
+ private static final Method met_list;
+ private static final Method met_rebind;
+ private static final Method met_unbind;
+ private static final Method met_lookup;
+ private static final Method met_bind;
+ private static final Object[] NO_ARGS = new Object[0];
+ static
+ {
+ final Class[] NO_ARGSc = new Class[0];
+ try
+ {
+ met_list =
+ Registry.class.getMethod("list", NO_ARGSc);
+ met_rebind =
+ Registry.class.getMethod("rebind", new Class[]
+ {
+ String.class, Remote.class
+ });
+ met_unbind =
+ Registry.class.getMethod("unbind", new Class[]
+ {
+ String.class
+ });
+ met_lookup =
+ Registry.class.getMethod("lookup", new Class[]
+ {
+ String.class
+ });
+ met_bind =
+ Registry.class.getMethod("bind", new Class[]
+ {
+ String.class, Remote.class
+ });
+
+ }
+ catch (NoSuchMethodException nex)
+ {
+ NoSuchMethodError err = new NoSuchMethodError(
+ "RegistryImpl_Stub class initialization failed");
+ err.initCause(nex);
+ throw err;
+ }
+ }
+
+ /**
+ * Create the instance for _RegistryImpl_Stub that forwards method calls to the
+ * remote object.
+ *
+ * @para the reference to the remote object.
+ */
+ public RegistryImpl_Stub(RemoteRef reference)
+ {
+ super(reference);
+ }
+
+ /* Methods */
+ /** @inheritDoc */
+ public String [] list()
+ throws RemoteException, AccessException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_list,
+ NO_ARGS,
+ 2571371476350237748L);
+ return (String []) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void rebind(String p0, Remote p1)
+ throws RemoteException, AccessException
+ {
+ try
+ {
+ ref.invoke(this, met_rebind,
+ new Object[] {p0, p1},
+ -8381844669958460146L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void unbind(String p0)
+ throws RemoteException, NotBoundException, AccessException
+ {
+ try
+ {
+ ref.invoke(this, met_unbind,
+ new Object[] {p0},
+ 7305022919901907578L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public Remote lookup(String p0)
+ throws RemoteException, NotBoundException, AccessException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_lookup,
+ new Object[] {p0},
+ -7538657168040752697L);
+ return (Remote) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void bind(String p0, Remote p1)
+ throws RemoteException, AlreadyBoundException, AccessException
+ {
+ try
+ {
+ ref.invoke(this, met_bind,
+ new Object[] {p0, p1},
+ 7583982177005850366L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/registry/package.html b/tools/gnu/classpath/tools/rmi/registry/package.html
new file mode 100644
index 000000000..71df83b61
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.rmi.registry package.
+ 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. -->
+
+<html>
+<head><title>GNU Classpath - gnu.classpath.tools.rmi.registry</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java b/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java
index 9b7f9358b..8da486571 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java
+++ b/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java
@@ -22,18 +22,7 @@
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.tools.rmi.rmic;
@@ -43,7 +32,6 @@ import gnu.java.rmi.server.RMIHashes;
import java.lang.reflect.Method;
import java.util.Properties;
-import java.util.zip.Adler32;
/**
* Keeps information about the single method and generates the code fragments,
diff --git a/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java b/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java
index 498dff7b2..bc51aad38 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java
+++ b/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java
@@ -22,18 +22,7 @@ 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.tools.rmi.rmic;
diff --git a/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java b/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java
index 6451a7074..8ee4fa5f2 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java
+++ b/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java
@@ -17,28 +17,11 @@ 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.tools.rmi.rmic;
-import java.lang.reflect.Method;
public class WrapUnWrapper
{
diff --git a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav
index 1069884b9..9aaf8f5ad 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav
+++ b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav
@@ -19,7 +19,7 @@
catch (Exception e)
{
UnexpectedException uex = new UnexpectedException(exception_message);
- uex.initCause(e);
+ uex.detail = e;
throw uex;
}
}
diff --git a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav
index f67098a4f..860a93c84 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav
+++ b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav
@@ -18,7 +18,7 @@
catch (Exception e)
{
UnexpectedException uex = new UnexpectedException(exception_message);
- uex.initCause(e);
+ uex.detail = e;
throw uex;
}
}
diff --git a/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java
new file mode 100644
index 000000000..dda40b06c
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java
@@ -0,0 +1,244 @@
+/* ActivationSystemImpl.java -- implementation of the activation system.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi.rmid;
+
+import gnu.classpath.tools.rmi.Persistent;
+import gnu.classpath.tools.rmi.PersistentBidiHashTable;
+import gnu.java.rmi.activation.ActivationSystemTransient;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.rmi.MarshalledObject;
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroupDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationID;
+import java.rmi.activation.ActivationInstantiator;
+import java.rmi.activation.ActivationMonitor;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.activation.Activator;
+import java.rmi.activation.UnknownGroupException;
+import java.rmi.activation.UnknownObjectException;
+
+/**
+ * Implements the rmid activation system.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class ActivationSystemImpl extends ActivationSystemTransient implements
+ ActivationSystem, Activator, ActivationMonitor, Serializable
+{
+ /**
+ * Use for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The singleton instance of this class.
+ */
+ public static ActivationSystemImpl singleton2;
+
+ /**
+ * Obtain the singleton instance of this class.
+ *
+ * @param folder the folder, where the activation system will keep its files.
+ * @param cold do the cold start if true, hot (usual) if false.
+ */
+ public static ActivationSystem getInstance(File folder, boolean cold)
+ {
+ if (singleton2 == null)
+ singleton2 = new ActivationSystemImpl(folder, cold);
+ return singleton2;
+ }
+
+ /**
+ * Creates the group with transient maps.
+ *
+ * @param folder
+ * the folder, where the activation system will keep its files.
+ * @param cold
+ * do the cold start if true, hot (usual) if false.
+ */
+ protected ActivationSystemImpl(File folder, boolean cold)
+ {
+ super(new PersistentBidiHashTable(), new PersistentBidiHashTable());
+ singleton2 = this;
+ ((PersistentBidiHashTable) groupDescs).init(
+ new File(folder, "asi_objects.data"), cold);
+ ((PersistentBidiHashTable) descriptions).init(
+ new File(folder, "asi_groups.data"), cold);
+ }
+
+ /** @inheritDoc */
+ public MarshalledObject activate(ActivationID id, boolean force)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ return super.activate(id, force);
+ }
+
+ /** @inheritDoc */
+ public ActivationMonitor activeGroup(ActivationGroupID id,
+ ActivationInstantiator group,
+ long incarnation)
+ throws UnknownGroupException, ActivationException, RemoteException
+ {
+ return super.activeGroup(id, group, incarnation);
+ }
+
+ /** @inheritDoc */
+ public void activeObject(ActivationID id, MarshalledObject obj)
+ throws UnknownObjectException, RemoteException
+ {
+ super.activeObject(id, obj);
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc getActivationDesc(ActivationID id)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ return super.getActivationDesc(id);
+ }
+
+ public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID groupId)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ return super.getActivationGroupDesc(groupId);
+ }
+
+ /** @inheritDoc */
+ public void inactiveGroup(ActivationGroupID groupId, long incarnation)
+ throws UnknownGroupException, RemoteException
+ {
+ super.inactiveGroup(groupId, incarnation);
+ }
+
+ /** @inheritDoc */
+ public void inactiveObject(ActivationID id) throws UnknownObjectException,
+ RemoteException
+ {
+ super.inactiveObject(id);
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupID registerGroup(ActivationGroupDesc groupDesc)
+ throws ActivationException, RemoteException
+ {
+ return super.registerGroup(groupDesc);
+ }
+
+ /** @inheritDoc */
+ public ActivationID registerObject(ActivationDesc desc)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ return super.registerObject(desc);
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc setActivationDesc(ActivationID id, ActivationDesc desc)
+ throws ActivationException, UnknownObjectException,
+ UnknownGroupException, RemoteException
+ {
+ return super.setActivationDesc(id, desc);
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupDesc setActivationGroupDesc(
+ ActivationGroupID groupId, ActivationGroupDesc groupDesc)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ return super.setActivationGroupDesc(groupId, groupDesc);
+ }
+
+ /**
+ * This method saves the state of the activation system and then
+ * terminates in 10 seconds.
+ */
+ public void shutdown() throws RemoteException
+ {
+ super.shutdown();
+ System.out.println("Shutdown command received. Will terminate in 10 s");
+ Persistent.timer.schedule(new Persistent.ExitTask(), 10000);
+ }
+
+ /** @inheritDoc */
+ public void unregisterGroup(ActivationGroupID groupId)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ super.unregisterGroup(groupId);
+ }
+
+ /** @inheritDoc */
+ public void unregisterObject(ActivationID id) throws ActivationException,
+ UnknownObjectException, RemoteException
+ {
+ super.unregisterObject(id);
+ }
+
+ /**
+ * Read the object from the input stream.
+ *
+ * @param in the stream to read from
+ *
+ * @throws IOException if thrown by the stream
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException,
+ ClassNotFoundException
+ {
+ // Read no fields.
+ }
+
+ /**
+ * Write the object to the output stream.
+ *
+ * @param out the stream to write int
+ * @throws IOException if thrown by the stream
+ * @throws ClassNotFoundException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException,
+ ClassNotFoundException
+ {
+ // Write no fields.
+ };
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java
new file mode 100644
index 000000000..22fa10e4b
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java
@@ -0,0 +1,556 @@
+/* ActivationSystemImpl.java -- implementation of the activation system.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.tools.rmi.rmid;
+
+import java.rmi.MarshalledObject;
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroupDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationID;
+import java.rmi.activation.ActivationInstantiator;
+import java.rmi.activation.ActivationMonitor;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.activation.Activator;
+import java.rmi.activation.UnknownGroupException;
+import java.rmi.activation.UnknownObjectException;
+
+import java.lang.reflect.Method;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+import java.rmi.UnexpectedException;
+
+/**
+ * This class delegates its method calls to the remote RMI object, referenced
+ * by {@link RemoteRef}.
+ *
+ * It is normally generated with rmic.
+ */
+public final class ActivationSystemImpl_Stub
+ extends RemoteStub
+ implements ActivationMonitor, Activator, ActivationSystem
+{
+ /**
+ * Use serialVersionUID for interoperability
+ */
+ private static final long serialVersionUID = 2;
+
+ /**
+ * The explaining message for {@ling UnexpectedException}.
+ */
+ private static final String exception_message =
+ "undeclared checked exception";
+
+ /* All remote methods, invoked by this stub: */
+ private static final Method met_setActivationGroupDesc;
+ private static final Method met_inactiveGroup;
+ private static final Method met_unregisterObject;
+ private static final Method met_getActivationDesc;
+ private static final Method met_setActivationDesc;
+ private static final Method met_shutdown;
+ private static final Method met_activate;
+ private static final Method met_activeGroup;
+ private static final Method met_registerGroup;
+ private static final Method met_getActivationGroupDesc;
+ private static final Method met_activeObject;
+ private static final Method met_registerObject;
+ private static final Method met_inactiveObject;
+ private static final Method met_unregisterGroup;
+ private static final Object[] NO_ARGS = new Object[0];
+ static
+ {
+ final Class[] NO_ARGSc = new Class[0];
+ try
+ {
+ met_setActivationGroupDesc =
+ ActivationSystem.class.getMethod("setActivationGroupDesc", new Class[]
+ {
+ ActivationGroupID.class, ActivationGroupDesc.class
+ });
+ met_inactiveGroup =
+ ActivationMonitor.class.getMethod("inactiveGroup", new Class[]
+ {
+ ActivationGroupID.class, long.class
+ });
+ met_unregisterObject =
+ ActivationSystem.class.getMethod("unregisterObject", new Class[]
+ {
+ ActivationID.class
+ });
+ met_getActivationDesc =
+ ActivationSystem.class.getMethod("getActivationDesc", new Class[]
+ {
+ ActivationID.class
+ });
+ met_setActivationDesc =
+ ActivationSystem.class.getMethod("setActivationDesc", new Class[]
+ {
+ ActivationID.class, ActivationDesc.class
+ });
+ met_shutdown =
+ ActivationSystem.class.getMethod("shutdown", NO_ARGSc);
+ met_activate =
+ Activator.class.getMethod("activate", new Class[]
+ {
+ ActivationID.class, boolean.class
+ });
+ met_activeGroup =
+ ActivationSystem.class.getMethod("activeGroup", new Class[]
+ {
+ ActivationGroupID.class, ActivationInstantiator.class, long.class
+ });
+ met_registerGroup =
+ ActivationSystem.class.getMethod("registerGroup", new Class[]
+ {
+ ActivationGroupDesc.class
+ });
+ met_getActivationGroupDesc =
+ ActivationSystem.class.getMethod("getActivationGroupDesc", new Class[]
+ {
+ ActivationGroupID.class
+ });
+ met_activeObject =
+ ActivationMonitor.class.getMethod("activeObject", new Class[]
+ {
+ ActivationID.class, MarshalledObject.class
+ });
+ met_registerObject =
+ ActivationSystem.class.getMethod("registerObject", new Class[]
+ {
+ ActivationDesc.class
+ });
+ met_inactiveObject =
+ ActivationMonitor.class.getMethod("inactiveObject", new Class[]
+ {
+ ActivationID.class
+ });
+ met_unregisterGroup =
+ ActivationSystem.class.getMethod("unregisterGroup", new Class[]
+ {
+ ActivationGroupID.class
+ });
+
+ }
+ catch (NoSuchMethodException nex)
+ {
+ NoSuchMethodError err = new NoSuchMethodError(
+ "ActivationSystemImpl_Stub class initialization failed");
+ err.initCause(nex);
+ throw err;
+ }
+ }
+
+ /**
+ * Create the instance for _ActivationSystemImpl_Stub that forwards method calls to the
+ * remote object.
+ *
+ * @para the reference to the remote object.
+ */
+ public ActivationSystemImpl_Stub(RemoteRef reference)
+ {
+ super(reference);
+ }
+
+ /* Methods */
+ /** @inheritDoc */
+ public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID p0,
+ ActivationGroupDesc p1)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_setActivationGroupDesc,
+ new Object[] { p0, p1 },
+ 1213918527826541191L);
+ return (ActivationGroupDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void inactiveGroup(ActivationGroupID p0, long p1)
+ throws UnknownGroupException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_inactiveGroup, new Object[] { p0, new Long(p1) },
+ -399287892768650944L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void unregisterObject(ActivationID p0) throws ActivationException,
+ UnknownObjectException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_unregisterObject, new Object[] { p0 },
+ -6843850585331411084L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc getActivationDesc(ActivationID p0)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_getActivationDesc,
+ new Object[] { p0 }, 4830055440982622087L);
+ return (ActivationDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc setActivationDesc(ActivationID p0, ActivationDesc p1)
+ throws ActivationException, UnknownObjectException,
+ UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_setActivationDesc,
+ new Object[] { p0, p1 },
+ 7128043237057180796L);
+ return (ActivationDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void shutdown() throws RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_shutdown, NO_ARGS, -7207851917985848402L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public MarshalledObject activate(ActivationID p0, boolean p1)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_activate,
+ new Object[] { p0, new Boolean(p1) },
+ -8767355154875805558L);
+ return (MarshalledObject) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationMonitor activeGroup(ActivationGroupID p0,
+ ActivationInstantiator p1, long p2)
+ throws UnknownGroupException, ActivationException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_activeGroup,
+ new Object[] { p0, p1, new Long(p2) },
+ -4575843150759415294L);
+ return (ActivationMonitor) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupID registerGroup(ActivationGroupDesc p0)
+ throws ActivationException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_registerGroup,
+ new Object[] { p0 }, 6921515268192657754L);
+ return (ActivationGroupID) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID p0)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_getActivationGroupDesc,
+ new Object[] { p0 }, -8701843806548736528L);
+ return (ActivationGroupDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void activeObject(ActivationID p0, MarshalledObject p1)
+ throws UnknownObjectException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_activeObject, new Object[] { p0, p1 },
+ 2543984342209939736L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationID registerObject(ActivationDesc p0)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_registerObject,
+ new Object[] { p0 }, -3006759798994351347L);
+ return (ActivationID) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void inactiveObject(ActivationID p0) throws UnknownObjectException,
+ RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_inactiveObject, new Object[] { p0 },
+ -4165404120701281807L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void unregisterGroup(ActivationGroupID p0) throws ActivationException,
+ UnknownGroupException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_unregisterGroup, new Object[] { p0 },
+ 3768097077835970701L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+
+}
diff --git a/tools/jarsigner.sh.in b/tools/jarsigner.sh.in
new file mode 100644
index 000000000..ced5c8cd0
--- /dev/null
+++ b/tools/jarsigner.sh.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+## Copyright 2006 Free Software Foundation, Inc.
+##
+## This file is a 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 of the License, 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; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+## USA.
+##
+##
+## A simple shell script to launch the GNU Classpath jarsigner tool.
+##
+
+prefix=@prefix@
+tools_dir=@datadir@/@PACKAGE@
+tools_cp=${tools_dir}/tools.zip
+
+# find the java executable...
+if [ -z "${JAVA}" ] ; then
+ if [ -n "${JAVA_HOME}" ] ; then
+ if [ -x "${JAVA_HOME}/jre/sh/java" ] ; then
+ JAVA="${JAVA_HOME}/jre/sh/java"
+ else
+ JAVA="${JAVA_HOME}/bin/java"
+ fi
+ else
+ JAVA=`which java 2> /dev/null `
+ if [ -z "${JAVA}" ] ; then
+ JAVA=java
+ fi
+ fi
+fi
+
+exec "${JAVA}" -cp "${tools_cp}" gnu.classpath.tools.jarsigner.Main $@
diff --git a/vm/reference/java/lang/VMClass.java b/vm/reference/java/lang/VMClass.java
index 98a17ee48..b68a4818e 100644
--- a/vm/reference/java/lang/VMClass.java
+++ b/vm/reference/java/lang/VMClass.java
@@ -285,11 +285,6 @@ final class VMClass
static native void throwException(Throwable t);
/**
- * Downcast object to the class' type.
- */
- static native <K> K cast(Object obj, Class<K> k);
-
- /**
* Returns true if this class is a synthetic class, generated by the
* compiler.
*
diff --git a/vm/reference/java/lang/reflect/Constructor.java b/vm/reference/java/lang/reflect/Constructor.java
index 73c971086..eebee5f5d 100644
--- a/vm/reference/java/lang/reflect/Constructor.java
+++ b/vm/reference/java/lang/reflect/Constructor.java
@@ -39,7 +39,9 @@ exception statement from your version. */
package java.lang.reflect;
import gnu.java.lang.ClassHelper;
+
import gnu.java.lang.reflect.MethodSignatureParser;
+
import java.util.Arrays;
/**
diff --git a/vm/reference/java/lang/reflect/Field.java b/vm/reference/java/lang/reflect/Field.java
index 6ac8272ea..5db1fa3ec 100644
--- a/vm/reference/java/lang/reflect/Field.java
+++ b/vm/reference/java/lang/reflect/Field.java
@@ -39,9 +39,8 @@ exception statement from your version. */
package java.lang.reflect;
import gnu.java.lang.ClassHelper;
-import gnu.java.lang.reflect.FieldSignatureParser;
-import gnu.java.lang.ClassHelper;
+import gnu.java.lang.reflect.FieldSignatureParser;
/**
* The Field class represents a member variable of a class. It also allows
diff --git a/vm/reference/java/lang/reflect/Method.java b/vm/reference/java/lang/reflect/Method.java
index 49e016b5a..c520f0570 100644
--- a/vm/reference/java/lang/reflect/Method.java
+++ b/vm/reference/java/lang/reflect/Method.java
@@ -39,7 +39,9 @@ exception statement from your version. */
package java.lang.reflect;
import gnu.java.lang.ClassHelper;
+
import gnu.java.lang.reflect.MethodSignatureParser;
+
import java.util.Arrays;
/**
@@ -353,6 +355,10 @@ extends AccessibleObject implements Member, GenericDeclaration
return invokeNative(o, args, declaringClass, slot);
}
+ /*
+ * NATIVE HELPERS
+ */
+
private native Object invokeNative(Object o, Object[] args,
Class declaringClass, int slot)
throws IllegalAccessException, InvocationTargetException;