aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2005-11-15 23:20:01 +0000
committerMark Wielaard <mark@klomp.org>2005-11-15 23:20:01 +0000
commit8079928c7ce26b013601b8ebf20c69c63181278f (patch)
treea5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8
parent7efc292acde3fb6dcc93984451ad21a109518417 (diff)
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@107049 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/Makefile.in523
-rw-r--r--libjava/classpath/.classpath4
-rw-r--r--libjava/classpath/.settings/org.eclipse.jdt.core.prefs18
-rw-r--r--libjava/classpath/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--libjava/classpath/AUTHORS6
-rw-r--r--libjava/classpath/BUGS2
-rw-r--r--libjava/classpath/ChangeLog9590
-rw-r--r--libjava/classpath/INSTALL35
-rw-r--r--libjava/classpath/LICENSE14
-rw-r--r--libjava/classpath/Makefile.am3
-rw-r--r--libjava/classpath/Makefile.in17
-rw-r--r--libjava/classpath/NEWS55
-rw-r--r--libjava/classpath/aclocal.m437
-rwxr-xr-xlibjava/classpath/autogen.sh2
-rwxr-xr-xlibjava/classpath/config.guess614
-rwxr-xr-xlibjava/classpath/config.sub185
-rwxr-xr-xlibjava/classpath/configure2635
-rw-r--r--libjava/classpath/configure.ac167
-rw-r--r--libjava/classpath/doc/Makefile.in12
-rw-r--r--libjava/classpath/doc/api/Makefile.in12
-rw-r--r--libjava/classpath/doc/www.gnu.org/announce/20050906.wml221
-rw-r--r--libjava/classpath/doc/www.gnu.org/announce/20051102.wml247
-rw-r--r--libjava/classpath/doc/www.gnu.org/corba.wml37
-rwxr-xr-xlibjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml9
-rw-r--r--libjava/classpath/doc/www.gnu.org/downloads/downloads.wml20
-rw-r--r--libjava/classpath/doc/www.gnu.org/home.wml2
-rw-r--r--libjava/classpath/doc/www.gnu.org/include/layout.wml2
-rw-r--r--libjava/classpath/doc/www.gnu.org/newsitems.txt10
-rwxr-xr-xlibjava/classpath/doc/www.gnu.org/tasks.wml338
-rw-r--r--libjava/classpath/examples/Makefile.in12
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java4
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java31
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java)10
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java)32
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java)16
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java40
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java56
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java)9
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java)19
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java)14
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java)9
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java)17
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java)14
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java)15
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java)44
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java)32
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java)11
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java)18
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java)31
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java)37
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java137
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java284
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch19
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java360
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java214
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java228
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java184
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java219
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java141
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java249
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java488
-rw-r--r--libjava/classpath/external/Makefile.in12
-rw-r--r--libjava/classpath/external/sax/Makefile.in12
-rw-r--r--libjava/classpath/external/w3c_dom/Makefile.in12
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrInput.java)704
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrOutput.java)162
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractDataInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/abstractDataInputStream.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractDataOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/abstractDataOutputStream.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AligningInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/aligningInputStream.java)39
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AligningOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/aligningOutputStream.java)37
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java254
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BufferedCdrOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrBufOutput.java)69
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BufferredCdrInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrBufInput.java)58
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/EncapsulationStream.java (renamed from libjava/classpath/gnu/CORBA/CDR/encapsulatedOutput.java)12
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java749
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java169
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java292
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/VMVio.java101
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/Vio.java1459
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java336
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java71
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java166
-rw-r--r--libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java (renamed from libjava/classpath/gnu/CORBA/cdrEncapsCodec.java)58
-rw-r--r--libjava/classpath/gnu/CORBA/Connected_objects.java11
-rw-r--r--libjava/classpath/gnu/CORBA/CorbaList.java (renamed from libjava/classpath/gnu/CORBA/corbaArrayList.java)8
-rw-r--r--libjava/classpath/gnu/CORBA/DefaultSocketFactory.java79
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/abstractDynAny.java)14
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/anyDivideable.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/RecordAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/abstractRecord.java)18
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/anyUndivideable.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java (renamed from libjava/classpath/gnu/CORBA/DynAn/valueChangedListener.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java28
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java8
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java14
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java2
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java2
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java4
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java10
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java14
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java6
-rw-r--r--libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java1
-rw-r--r--libjava/classpath/gnu/CORBA/ExceptionCreator.java245
-rw-r--r--libjava/classpath/gnu/CORBA/ForwardRequestHelper.java1
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java5
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java (renamed from libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java (renamed from libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java23
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java200
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java88
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java14
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java14
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java16
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java27
-rw-r--r--libjava/classpath/gnu/CORBA/GeneralHolder.java (renamed from libjava/classpath/gnu/CORBA/universalHolder.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/HolderLocator.java (renamed from libjava/classpath/gnu/CORBA/holderFactory.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/IOR.java96
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java83
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/Registrator.java8
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java4
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java44
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java20
-rw-r--r--libjava/classpath/gnu/CORBA/IorDelegate.java (renamed from libjava/classpath/gnu/CORBA/IOR_Delegate.java)92
-rw-r--r--libjava/classpath/gnu/CORBA/IorObject.java (renamed from libjava/classpath/gnu/CORBA/IOR_contructed_object.java)21
-rw-r--r--libjava/classpath/gnu/CORBA/IorProvider.java (renamed from libjava/classpath/org/omg/CORBA/IDLEntity.java)20
-rw-r--r--libjava/classpath/gnu/CORBA/Minor.java282
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/Ext.java2
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java (renamed from libjava/classpath/gnu/CORBA/NamingService/cmpNameComponent.java)10
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameParser.java197
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java (renamed from libjava/classpath/gnu/CORBA/NamingService/snConverter.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NamingMap.java2
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java10
-rw-r--r--libjava/classpath/gnu/CORBA/ObjectCreator.java397
-rw-r--r--libjava/classpath/gnu/CORBA/OctetHolder.java4
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFocused.java375
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFunctional.java (renamed from libjava/classpath/gnu/CORBA/Functional_ORB.java)469
-rw-r--r--libjava/classpath/gnu/CORBA/OrbRestricted.java (renamed from libjava/classpath/gnu/CORBA/Restricted_ORB.java)41
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/AOM.java (renamed from libjava/classpath/gnu/CORBA/Poa/activeObjectMap.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java (renamed from libjava/classpath/gnu/CORBA/Poa/vPolicy.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java (renamed from libjava/classpath/gnu/CORBA/Poa/dynImpHandler.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java16
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java79
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/LocalRequest.java42
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java51
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java (renamed from libjava/classpath/gnu/CORBA/Poa/servantDelegate.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java (renamed from libjava/classpath/gnu/CORBA/Poa/policySets.java)8
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOA.java471
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java60
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java60
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/RawReply.java (renamed from libjava/classpath/gnu/CORBA/binaryReply.java)12
-rw-r--r--libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java (renamed from libjava/classpath/gnu/CORBA/bufferedResponseHandler.java)18
-rw-r--r--libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java10
-rw-r--r--libjava/classpath/gnu/CORBA/SimpleDelegate.java (renamed from libjava/classpath/gnu/CORBA/Simple_delegate.java)48
-rw-r--r--libjava/classpath/gnu/CORBA/SocketRepository.java86
-rw-r--r--libjava/classpath/gnu/CORBA/StreamBasedRequest.java (renamed from libjava/classpath/gnu/CORBA/streamRequest.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/StreamHolder.java (renamed from libjava/classpath/gnu/CORBA/streamReadyHolder.java)11
-rw-r--r--libjava/classpath/gnu/CORBA/StubLocator.java (renamed from libjava/classpath/gnu/CORBA/stubFinder.java)8
-rw-r--r--libjava/classpath/gnu/CORBA/TypeCodeHelper.java35
-rw-r--r--libjava/classpath/gnu/CORBA/TypeKindNamer.java (renamed from libjava/classpath/gnu/CORBA/typeNamer.java)75
-rw-r--r--libjava/classpath/gnu/CORBA/Version.java26
-rw-r--r--libjava/classpath/gnu/CORBA/WCharHolder.java4
-rw-r--r--libjava/classpath/gnu/CORBA/WStringHolder.java6
-rw-r--r--libjava/classpath/gnu/CORBA/_PolicyImplBase.java3
-rw-r--r--libjava/classpath/gnu/CORBA/gnuAny.java139
-rw-r--r--libjava/classpath/gnu/CORBA/gnuCodecFactory.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuContextList.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuExceptionList.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuNVList.java6
-rw-r--r--libjava/classpath/gnu/CORBA/gnuRequest.java134
-rw-r--r--libjava/classpath/gnu/CORBA/gnuValueHolder.java2
-rw-r--r--libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java95
-rw-r--r--libjava/classpath/gnu/CORBA/interfaces/package.html49
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java (renamed from libjava/classpath/gnu/CORBA/aliasTypeCode.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java (renamed from libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java)21
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java (renamed from libjava/classpath/gnu/CORBA/fixedTypeCode.java)19
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java (renamed from libjava/classpath/gnu/CORBA/generalTypeCode.java)40
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java (renamed from libjava/classpath/gnu/CORBA/primitiveTypeCode.java)15
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java (renamed from libjava/classpath/gnu/CORBA/recordTypeCode.java)21
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java (renamed from libjava/classpath/gnu/CORBA/recursiveTypeCode.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java (renamed from libjava/classpath/gnu/CORBA/stringTypeCode.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/package.html (renamed from libjava/classpath/gnu/java/net/protocol/http/event/package.html)10
-rw-r--r--libjava/classpath/gnu/classpath/ByteArray.java109
-rw-r--r--libjava/classpath/gnu/classpath/SystemProperties.java6
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java85
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java13
-rw-r--r--libjava/classpath/gnu/java/awt/AWTUtilities.java9
-rw-r--r--libjava/classpath/gnu/java/awt/EmbeddedWindow.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java29
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java12
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java53
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java3
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java28
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java3
-rw-r--r--libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java4
-rw-r--r--libjava/classpath/gnu/java/beans/DummyAppletContext.java37
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java4
-rw-r--r--libjava/classpath/gnu/java/io/PlatformHelper.java5
-rw-r--r--libjava/classpath/gnu/java/net/LineInputStream.java13
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java123
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java2
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Cookie.java2
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java174
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java108
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Headers.java85
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java220
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Request.java191
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Response.java55
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java70
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java70
-rw-r--r--libjava/classpath/gnu/java/net/protocol/jar/Connection.java23
-rw-r--r--libjava/classpath/gnu/java/nio/SocketChannelImpl.java2
-rw-r--r--libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java3
-rw-r--r--libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java19
-rw-r--r--libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java2
-rw-r--r--libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java6
-rw-r--r--libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java2
-rw-r--r--libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java350
-rw-r--r--libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java2
-rw-r--r--libjava/classpath/gnu/java/rmi/server/UnicastServer.java5
-rw-r--r--libjava/classpath/gnu/java/security/PolicyFile.java6
-rw-r--r--libjava/classpath/gnu/java/security/der/BitString.java13
-rw-r--r--libjava/classpath/gnu/java/security/der/DERReader.java2
-rw-r--r--libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java123
-rw-r--r--libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java86
-rw-r--r--libjava/classpath/gnu/java/security/provider/Gnu.java15
-rw-r--r--libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java2
-rw-r--r--libjava/classpath/gnu/java/security/x509/ext/Extension.java10
-rw-r--r--libjava/classpath/gnu/java/text/BaseBreakIterator.java7
-rw-r--r--libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java159
-rw-r--r--libjava/classpath/gnu/javax/crypto/GnuDHPrivateKey.java (renamed from libjava/classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java)75
-rw-r--r--libjava/classpath/gnu/javax/crypto/RSACipherImpl.java311
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java169
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPException.java47
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java128
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java153
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java123
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java201
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java104
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java108
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java96
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java77
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java92
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB8.java (renamed from libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerImpl.java)88
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java176
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java143
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java297
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java219
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java85
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java76
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java352
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java946
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java262
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java93
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java714
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java163
-rw-r--r--libjava/classpath/gnu/javax/rmi/PortableServer.java141
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java130
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java216
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java519
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java131
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java153
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java173
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java745
-rw-r--r--libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java2
-rw-r--r--libjava/classpath/gnu/xml/aelfred2/SAXDriver.java4
-rw-r--r--libjava/classpath/gnu/xml/dom/DomDocument.java50
-rw-r--r--libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java48
-rw-r--r--libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java2
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java3
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java81
-rw-r--r--libjava/classpath/gnu/xml/transform/StreamSerializer.java6
-rw-r--r--libjava/classpath/gnu/xml/transform/TransformerImpl.java8
-rw-r--r--libjava/classpath/include/Makefile.am14
-rw-r--r--libjava/classpath/include/Makefile.in26
-rw-r--r--libjava/classpath/include/config.h.in9
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h1
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h1
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h21
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h20
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h19
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h25
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h29
-rw-r--r--libjava/classpath/java/applet/Applet.java76
-rw-r--r--libjava/classpath/java/awt/BorderLayout.java130
-rw-r--r--libjava/classpath/java/awt/Button.java2
-rw-r--r--libjava/classpath/java/awt/Canvas.java14
-rw-r--r--libjava/classpath/java/awt/Checkbox.java11
-rw-r--r--libjava/classpath/java/awt/CheckboxMenuItem.java2
-rw-r--r--libjava/classpath/java/awt/Choice.java4
-rw-r--r--libjava/classpath/java/awt/Color.java2
-rw-r--r--libjava/classpath/java/awt/ColorPaintContext.java4
-rw-r--r--libjava/classpath/java/awt/Component.java89
-rw-r--r--libjava/classpath/java/awt/Container.java132
-rw-r--r--libjava/classpath/java/awt/DefaultKeyboardFocusManager.java4
-rw-r--r--libjava/classpath/java/awt/Dialog.java2
-rw-r--r--libjava/classpath/java/awt/EventQueue.java1
-rw-r--r--libjava/classpath/java/awt/Font.java2070
-rw-r--r--libjava/classpath/java/awt/FontMetrics.java21
-rw-r--r--libjava/classpath/java/awt/Frame.java2
-rw-r--r--libjava/classpath/java/awt/Graphics.java1291
-rw-r--r--libjava/classpath/java/awt/GraphicsConfiguration.java5
-rw-r--r--libjava/classpath/java/awt/GridBagLayout.java23
-rw-r--r--libjava/classpath/java/awt/Image.java20
-rw-r--r--libjava/classpath/java/awt/KeyboardFocusManager.java75
-rw-r--r--libjava/classpath/java/awt/List.java15
-rw-r--r--libjava/classpath/java/awt/Menu.java2
-rw-r--r--libjava/classpath/java/awt/MenuComponent.java4
-rw-r--r--libjava/classpath/java/awt/MenuItem.java2
-rw-r--r--libjava/classpath/java/awt/Point.java4
-rw-r--r--libjava/classpath/java/awt/Polygon.java1
-rw-r--r--libjava/classpath/java/awt/PopupMenu.java2
-rw-r--r--libjava/classpath/java/awt/Rectangle.java4
-rw-r--r--libjava/classpath/java/awt/ScrollPane.java4
-rw-r--r--libjava/classpath/java/awt/ScrollPaneAdjustable.java8
-rw-r--r--libjava/classpath/java/awt/TextArea.java2
-rw-r--r--libjava/classpath/java/awt/TextComponent.java2
-rw-r--r--libjava/classpath/java/awt/TextField.java2
-rw-r--r--libjava/classpath/java/awt/Window.java110
-rw-r--r--libjava/classpath/java/awt/color/ICC_Profile.java18
-rw-r--r--libjava/classpath/java/awt/event/InputEvent.java41
-rw-r--r--libjava/classpath/java/awt/event/InvocationEvent.java25
-rw-r--r--libjava/classpath/java/awt/event/KeyEvent.java2
-rw-r--r--libjava/classpath/java/awt/event/MouseEvent.java23
-rw-r--r--libjava/classpath/java/awt/geom/Area.java2
-rw-r--r--libjava/classpath/java/awt/geom/GeneralPath.java3
-rw-r--r--libjava/classpath/java/awt/im/InputContext.java3
-rw-r--r--libjava/classpath/java/awt/im/InputMethodHighlight.java5
-rw-r--r--libjava/classpath/java/awt/im/InputMethodRequests.java2
-rw-r--r--libjava/classpath/java/awt/im/spi/InputMethod.java10
-rw-r--r--libjava/classpath/java/awt/im/spi/InputMethodContext.java4
-rw-r--r--libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java3
-rw-r--r--libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java2
-rw-r--r--libjava/classpath/java/awt/image/BufferedImage.java18
-rw-r--r--libjava/classpath/java/awt/image/ColorModel.java2
-rw-r--r--libjava/classpath/java/awt/image/ComponentSampleModel.java8
-rw-r--r--libjava/classpath/java/awt/image/ImageConsumer.java2
-rw-r--r--libjava/classpath/java/awt/image/PackedColorModel.java6
-rw-r--r--libjava/classpath/java/awt/image/SampleModel.java3
-rw-r--r--libjava/classpath/java/awt/print/PrinterJob.java7
-rw-r--r--libjava/classpath/java/beans/IndexedPropertyDescriptor.java610
-rw-r--r--libjava/classpath/java/beans/PropertyDescriptor.java17
-rw-r--r--libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java2
-rw-r--r--libjava/classpath/java/beans/beancontext/BeanContextSupport.java2
-rw-r--r--libjava/classpath/java/io/ByteArrayOutputStream.java5
-rw-r--r--libjava/classpath/java/io/DataOutputStream.java6
-rw-r--r--libjava/classpath/java/io/File.java39
-rw-r--r--libjava/classpath/java/io/FileWriter.java2
-rw-r--r--libjava/classpath/java/io/FilterReader.java2
-rw-r--r--libjava/classpath/java/io/InputStreamReader.java25
-rw-r--r--libjava/classpath/java/io/LineNumberReader.java6
-rw-r--r--libjava/classpath/java/io/ObjectInputStream.java588
-rw-r--r--libjava/classpath/java/io/ObjectOutputStream.java79
-rw-r--r--libjava/classpath/java/io/ObjectStreamField.java2
-rw-r--r--libjava/classpath/java/io/OutputStreamWriter.java160
-rw-r--r--libjava/classpath/java/io/PipedInputStream.java2
-rw-r--r--libjava/classpath/java/io/PrintWriter.java75
-rw-r--r--libjava/classpath/java/io/PushbackInputStream.java9
-rw-r--r--libjava/classpath/java/lang/Boolean.java32
-rw-r--r--libjava/classpath/java/lang/Byte.java32
-rw-r--r--libjava/classpath/java/lang/Character.java275
-rw-r--r--libjava/classpath/java/lang/Class.java11
-rw-r--r--libjava/classpath/java/lang/ClassLoader.java36
-rw-r--r--libjava/classpath/java/lang/Double.java23
-rw-r--r--libjava/classpath/java/lang/EnumConstantNotPresentException.java93
-rw-r--r--libjava/classpath/java/lang/Float.java22
-rw-r--r--libjava/classpath/java/lang/Integer.java4
-rw-r--r--libjava/classpath/java/lang/Long.java153
-rw-r--r--libjava/classpath/java/lang/Object.java4
-rw-r--r--libjava/classpath/java/lang/Process.java1
-rw-r--r--libjava/classpath/java/lang/Readable.java1
-rw-r--r--libjava/classpath/java/lang/RuntimePermission.java1
-rw-r--r--libjava/classpath/java/lang/SecurityManager.java30
-rw-r--r--libjava/classpath/java/lang/Short.java44
-rw-r--r--libjava/classpath/java/lang/StrictMath.java10
-rw-r--r--libjava/classpath/java/lang/String.java207
-rw-r--r--libjava/classpath/java/lang/StringBuffer.java259
-rw-r--r--libjava/classpath/java/lang/StringBuilder.java65
-rw-r--r--libjava/classpath/java/lang/System.java2
-rw-r--r--libjava/classpath/java/lang/Thread.java12
-rw-r--r--libjava/classpath/java/lang/ThreadLocal.java1
-rw-r--r--libjava/classpath/java/lang/ref/Reference.java6
-rw-r--r--libjava/classpath/java/lang/ref/WeakReference.java2
-rw-r--r--libjava/classpath/java/lang/reflect/Member.java4
-rw-r--r--libjava/classpath/java/lang/reflect/Proxy.java19
-rw-r--r--libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java2
-rw-r--r--libjava/classpath/java/math/BigDecimal.java19
-rw-r--r--libjava/classpath/java/math/BigInteger.java19
-rw-r--r--libjava/classpath/java/net/DatagramSocket.java1
-rw-r--r--libjava/classpath/java/net/Inet4Address.java2
-rw-r--r--libjava/classpath/java/net/InetSocketAddress.java2
-rw-r--r--libjava/classpath/java/net/ServerSocket.java4
-rw-r--r--libjava/classpath/java/net/Socket.java9
-rw-r--r--libjava/classpath/java/net/URLClassLoader.java110
-rw-r--r--libjava/classpath/java/net/URLConnection.java8
-rw-r--r--libjava/classpath/java/net/URLStreamHandler.java22
-rw-r--r--libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java6
-rw-r--r--libjava/classpath/java/nio/charset/Charset.java27
-rw-r--r--libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java110
-rw-r--r--libjava/classpath/java/rmi/server/LoaderHandler.java6
-rw-r--r--libjava/classpath/java/rmi/server/RMIClassLoader.java312
-rw-r--r--libjava/classpath/java/rmi/server/RemoteObject.java4
-rw-r--r--libjava/classpath/java/rmi/server/RemoteRef.java6
-rw-r--r--libjava/classpath/java/security/AccessControlContext.java34
-rw-r--r--libjava/classpath/java/security/AccessController.java16
-rw-r--r--libjava/classpath/java/security/Identity.java8
-rw-r--r--libjava/classpath/java/security/Security.java4
-rw-r--r--libjava/classpath/java/text/AttributedString.java48
-rw-r--r--libjava/classpath/java/text/AttributedStringIterator.java183
-rw-r--r--libjava/classpath/java/text/CharacterIterator.java2
-rw-r--r--libjava/classpath/java/text/DateFormat.java3
-rw-r--r--libjava/classpath/java/text/ParsePosition.java9
-rw-r--r--libjava/classpath/java/text/RuleBasedCollator.java2
-rw-r--r--libjava/classpath/java/text/StringCharacterIterator.java12
-rw-r--r--libjava/classpath/java/util/ArrayList.java4
-rw-r--r--libjava/classpath/java/util/Arrays.java180
-rw-r--r--libjava/classpath/java/util/Calendar.java23
-rw-r--r--libjava/classpath/java/util/Collections.java17
-rw-r--r--libjava/classpath/java/util/GregorianCalendar.java14
-rw-r--r--libjava/classpath/java/util/HashMap.java2
-rw-r--r--libjava/classpath/java/util/InvalidPropertiesFormatException.java57
-rw-r--r--libjava/classpath/java/util/Locale.java4
-rw-r--r--libjava/classpath/java/util/Map.java8
-rw-r--r--libjava/classpath/java/util/Properties.java348
-rw-r--r--libjava/classpath/java/util/Random.java2
-rw-r--r--libjava/classpath/java/util/ResourceBundle.java9
-rw-r--r--libjava/classpath/java/util/SimpleTimeZone.java3
-rw-r--r--libjava/classpath/java/util/Timer.java93
-rw-r--r--libjava/classpath/java/util/TreeMap.java2
-rw-r--r--libjava/classpath/java/util/WeakHashMap.java28
-rw-r--r--libjava/classpath/java/util/jar/Manifest.java8
-rw-r--r--libjava/classpath/java/util/logging/FileHandler.java4
-rw-r--r--libjava/classpath/java/util/logging/Handler.java6
-rw-r--r--libjava/classpath/java/util/logging/LogManager.java4
-rw-r--r--libjava/classpath/java/util/logging/LoggingPermission.java2
-rw-r--r--libjava/classpath/java/util/logging/SimpleFormatter.java2
-rw-r--r--libjava/classpath/java/util/logging/XMLFormatter.java2
-rw-r--r--libjava/classpath/java/util/prefs/Preferences.java28
-rw-r--r--libjava/classpath/java/util/regex/Matcher.java8
-rw-r--r--libjava/classpath/java/util/zip/PendingBuffer.java2
-rw-r--r--libjava/classpath/java/util/zip/ZipFile.java17
-rw-r--r--libjava/classpath/javax/imageio/IIOException.java3
-rw-r--r--libjava/classpath/javax/imageio/IIOImage.java137
-rw-r--r--libjava/classpath/javax/imageio/IIOParam.java364
-rw-r--r--libjava/classpath/javax/imageio/IIOParamController.java13
-rw-r--r--libjava/classpath/javax/imageio/ImageIO.java609
-rw-r--r--libjava/classpath/javax/imageio/ImageReadParam.java2
-rw-r--r--libjava/classpath/javax/imageio/ImageReader.java1724
-rw-r--r--libjava/classpath/javax/imageio/ImageTranscoder.java48
-rw-r--r--libjava/classpath/javax/imageio/ImageTypeSpecifier.java467
-rw-r--r--libjava/classpath/javax/imageio/ImageWriteParam.java3
-rw-r--r--libjava/classpath/javax/imageio/ImageWriter.java1125
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOAttr.java378
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadata.java114
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java842
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java157
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java138
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIONodeList.java72
-rw-r--r--libjava/classpath/javax/imageio/package.html45
-rw-r--r--libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java86
-rw-r--r--libjava/classpath/javax/naming/CompoundName.java25
-rw-r--r--libjava/classpath/javax/naming/Name.java4
-rw-r--r--libjava/classpath/javax/print/DocFlavor.java4
-rw-r--r--libjava/classpath/javax/print/attribute/Attribute.java20
-rw-r--r--libjava/classpath/javax/print/attribute/AttributeSet.java147
-rw-r--r--libjava/classpath/javax/print/attribute/AttributeSetUtilities.java87
-rw-r--r--libjava/classpath/javax/print/attribute/DateTimeSyntax.java16
-rw-r--r--libjava/classpath/javax/print/attribute/DocAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/DocAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/EnumSyntax.java122
-rw-r--r--libjava/classpath/javax/print/attribute/HashAttributeSet.java190
-rw-r--r--libjava/classpath/javax/print/attribute/HashDocAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/IntegerSyntax.java25
-rw-r--r--libjava/classpath/javax/print/attribute/PrintJobAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/PrintRequestAttribute.java14
-rw-r--r--libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/PrintServiceAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java186
-rw-r--r--libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java20
-rw-r--r--libjava/classpath/javax/print/attribute/URISyntax.java18
-rw-r--r--libjava/classpath/javax/print/attribute/UnmodifiableSetException.java12
-rw-r--r--libjava/classpath/javax/print/attribute/package.html9
-rw-r--r--libjava/classpath/javax/print/event/PrintEvent.java6
-rw-r--r--libjava/classpath/javax/print/event/PrintJobAdapter.java34
-rw-r--r--libjava/classpath/javax/print/event/PrintJobAttributeEvent.java10
-rw-r--r--libjava/classpath/javax/print/event/PrintJobAttributeListener.java6
-rw-r--r--libjava/classpath/javax/print/event/PrintJobEvent.java27
-rw-r--r--libjava/classpath/javax/print/event/PrintJobListener.java15
-rw-r--r--libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java10
-rw-r--r--libjava/classpath/javax/print/event/PrintServiceAttributeListener.java6
-rw-r--r--libjava/classpath/javax/print/event/package.html8
-rw-r--r--libjava/classpath/javax/rmi/BAD_OPERATION.java4
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ClassDesc.java33
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ObjectImpl.java9
-rw-r--r--libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java84
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Stub.java170
-rw-r--r--libjava/classpath/javax/rmi/CORBA/StubDelegate.java56
-rw-r--r--libjava/classpath/javax/rmi/CORBA/SystemException.java4
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Tie.java101
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Util.java413
-rw-r--r--libjava/classpath/javax/rmi/CORBA/UtilDelegate.java285
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandler.java101
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java94
-rw-r--r--libjava/classpath/javax/rmi/CORBA/package.html36
-rw-r--r--libjava/classpath/javax/rmi/ORB.java4
-rw-r--r--libjava/classpath/javax/rmi/PortableRemoteObject.java201
-rw-r--r--libjava/classpath/javax/rmi/package.html36
-rw-r--r--libjava/classpath/javax/security/auth/Subject.java12
-rw-r--r--libjava/classpath/javax/security/auth/SubjectDomainCombiner.java7
-rw-r--r--libjava/classpath/javax/security/auth/login/Configuration.java46
-rw-r--r--libjava/classpath/javax/security/auth/login/LoginContext.java4
-rw-r--r--libjava/classpath/javax/security/auth/x500/X500Principal.java16
-rw-r--r--libjava/classpath/javax/security/sasl/AuthenticationException.java4
-rw-r--r--libjava/classpath/javax/security/sasl/AuthorizeCallback.java10
-rw-r--r--libjava/classpath/javax/security/sasl/RealmCallback.java4
-rw-r--r--libjava/classpath/javax/security/sasl/RealmChoiceCallback.java4
-rw-r--r--libjava/classpath/javax/security/sasl/Sasl.java2
-rw-r--r--libjava/classpath/javax/security/sasl/SaslClient.java6
-rw-r--r--libjava/classpath/javax/security/sasl/SaslClientFactory.java4
-rw-r--r--libjava/classpath/javax/security/sasl/SaslException.java6
-rw-r--r--libjava/classpath/javax/security/sasl/SaslServer.java8
-rw-r--r--libjava/classpath/javax/security/sasl/SaslServerFactory.java4
-rw-r--r--libjava/classpath/javax/sound/midi/ControllerEventListener.java58
-rw-r--r--libjava/classpath/javax/sound/midi/Instrument.java77
-rw-r--r--libjava/classpath/javax/sound/midi/InvalidMidiDataException.java90
-rw-r--r--libjava/classpath/javax/sound/midi/MetaEventListener.java (renamed from libjava/classpath/gnu/java/awt/FocusManager.java)26
-rw-r--r--libjava/classpath/javax/sound/midi/MetaMessage.java176
-rw-r--r--libjava/classpath/javax/sound/midi/MidiChannel.java236
-rw-r--r--libjava/classpath/javax/sound/midi/MidiDevice.java220
-rw-r--r--libjava/classpath/javax/sound/midi/MidiEvent.java95
-rw-r--r--libjava/classpath/javax/sound/midi/MidiFileFormat.java158
-rw-r--r--libjava/classpath/javax/sound/midi/MidiMessage.java126
-rw-r--r--libjava/classpath/javax/sound/midi/MidiSystem.java566
-rw-r--r--libjava/classpath/javax/sound/midi/MidiUnavailableException.java90
-rw-r--r--libjava/classpath/javax/sound/midi/Patch.java86
-rw-r--r--libjava/classpath/javax/sound/midi/Receiver.java66
-rw-r--r--libjava/classpath/javax/sound/midi/Sequence.java248
-rw-r--r--libjava/classpath/javax/sound/midi/Sequencer.java402
-rw-r--r--libjava/classpath/javax/sound/midi/ShortMessage.java344
-rw-r--r--libjava/classpath/javax/sound/midi/Soundbank.java101
-rw-r--r--libjava/classpath/javax/sound/midi/SoundbankResource.java104
-rw-r--r--libjava/classpath/javax/sound/midi/Synthesizer.java173
-rw-r--r--libjava/classpath/javax/sound/midi/SysexMessage.java139
-rw-r--r--libjava/classpath/javax/sound/midi/Track.java160
-rw-r--r--libjava/classpath/javax/sound/midi/Transmitter.java70
-rw-r--r--libjava/classpath/javax/sound/midi/VoiceStatus.java79
-rw-r--r--libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java90
-rw-r--r--libjava/classpath/javax/sound/midi/spi/MidiFileReader.java125
-rw-r--r--libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java143
-rw-r--r--libjava/classpath/javax/sound/midi/spi/SoundbankReader.java97
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioFileFormat.java242
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioFormat.java345
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioInputStream.java258
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioPermission.java70
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioSystem.java744
-rw-r--r--libjava/classpath/javax/sound/sampled/BooleanControl.java145
-rw-r--r--libjava/classpath/javax/sound/sampled/Clip.java115
-rw-r--r--libjava/classpath/javax/sound/sampled/CompoundControl.java102
-rw-r--r--libjava/classpath/javax/sound/sampled/Control.java (renamed from libjava/classpath/gnu/java/net/protocol/http/event/RequestEvent.java)98
-rw-r--r--libjava/classpath/javax/sound/sampled/DataLine.java265
-rw-r--r--libjava/classpath/javax/sound/sampled/EnumControl.java126
-rw-r--r--libjava/classpath/javax/sound/sampled/FloatControl.java267
-rw-r--r--libjava/classpath/javax/sound/sampled/Line.java150
-rw-r--r--libjava/classpath/javax/sound/sampled/LineEvent.java150
-rw-r--r--libjava/classpath/javax/sound/sampled/LineListener.java (renamed from libjava/classpath/gnu/java/net/protocol/http/event/ConnectionListener.java)25
-rw-r--r--libjava/classpath/javax/sound/sampled/LineUnavailableException.java61
-rw-r--r--libjava/classpath/javax/sound/sampled/Mixer.java206
-rw-r--r--libjava/classpath/javax/sound/sampled/Port.java135
-rw-r--r--libjava/classpath/javax/sound/sampled/ReverbType.java144
-rw-r--r--libjava/classpath/javax/sound/sampled/SourceDataLine.java77
-rw-r--r--libjava/classpath/javax/sound/sampled/TargetDataLine.java79
-rw-r--r--libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java65
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java146
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java131
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java179
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/MixerProvider.java86
-rw-r--r--libjava/classpath/javax/swing/AbstractButton.java123
-rw-r--r--libjava/classpath/javax/swing/AbstractSpinnerModel.java1
-rw-r--r--libjava/classpath/javax/swing/ActionMap.java9
-rw-r--r--libjava/classpath/javax/swing/BorderFactory.java2
-rw-r--r--libjava/classpath/javax/swing/BoundedRangeModel.java4
-rw-r--r--libjava/classpath/javax/swing/Box.java21
-rw-r--r--libjava/classpath/javax/swing/BoxLayout.java693
-rw-r--r--libjava/classpath/javax/swing/ButtonGroup.java5
-rw-r--r--libjava/classpath/javax/swing/ButtonModel.java260
-rw-r--r--libjava/classpath/javax/swing/CellEditor.java2
-rw-r--r--libjava/classpath/javax/swing/CellRendererPane.java38
-rw-r--r--libjava/classpath/javax/swing/ComboBoxEditor.java2
-rw-r--r--libjava/classpath/javax/swing/ComponentInputMap.java26
-rw-r--r--libjava/classpath/javax/swing/DebugGraphics.java308
-rw-r--r--libjava/classpath/javax/swing/DefaultButtonModel.java1
-rw-r--r--libjava/classpath/javax/swing/DefaultCellEditor.java7
-rw-r--r--libjava/classpath/javax/swing/DefaultComboBoxModel.java172
-rw-r--r--libjava/classpath/javax/swing/DefaultDesktopManager.java4
-rw-r--r--libjava/classpath/javax/swing/DefaultListCellRenderer.java14
-rw-r--r--libjava/classpath/javax/swing/DefaultListSelectionModel.java60
-rw-r--r--libjava/classpath/javax/swing/DesktopManager.java2
-rw-r--r--libjava/classpath/javax/swing/FocusManager.java425
-rw-r--r--libjava/classpath/javax/swing/ImageIcon.java9
-rw-r--r--libjava/classpath/javax/swing/InputMap.java12
-rw-r--r--libjava/classpath/javax/swing/InputVerifier.java1
-rw-r--r--libjava/classpath/javax/swing/JApplet.java58
-rw-r--r--libjava/classpath/javax/swing/JButton.java7
-rw-r--r--libjava/classpath/javax/swing/JCheckBox.java70
-rw-r--r--libjava/classpath/javax/swing/JCheckBoxMenuItem.java13
-rw-r--r--libjava/classpath/javax/swing/JColorChooser.java2
-rw-r--r--libjava/classpath/javax/swing/JComboBox.java115
-rw-r--r--libjava/classpath/javax/swing/JComponent.java1053
-rw-r--r--libjava/classpath/javax/swing/JDesktopPane.java3
-rw-r--r--libjava/classpath/javax/swing/JDialog.java48
-rw-r--r--libjava/classpath/javax/swing/JEditorPane.java441
-rw-r--r--libjava/classpath/javax/swing/JFileChooser.java767
-rw-r--r--libjava/classpath/javax/swing/JFrame.java57
-rw-r--r--libjava/classpath/javax/swing/JInternalFrame.java45
-rw-r--r--libjava/classpath/javax/swing/JLabel.java18
-rw-r--r--libjava/classpath/javax/swing/JLayeredPane.java137
-rw-r--r--libjava/classpath/javax/swing/JList.java850
-rw-r--r--libjava/classpath/javax/swing/JMenu.java27
-rw-r--r--libjava/classpath/javax/swing/JMenuBar.java206
-rw-r--r--libjava/classpath/javax/swing/JMenuItem.java34
-rw-r--r--libjava/classpath/javax/swing/JOptionPane.java160
-rw-r--r--libjava/classpath/javax/swing/JPanel.java132
-rw-r--r--libjava/classpath/javax/swing/JPasswordField.java1
-rw-r--r--libjava/classpath/javax/swing/JPopupMenu.java343
-rw-r--r--libjava/classpath/javax/swing/JProgressBar.java5
-rw-r--r--libjava/classpath/javax/swing/JRadioButton.java4
-rw-r--r--libjava/classpath/javax/swing/JRadioButtonMenuItem.java8
-rw-r--r--libjava/classpath/javax/swing/JRootPane.java252
-rw-r--r--libjava/classpath/javax/swing/JScrollPane.java220
-rw-r--r--libjava/classpath/javax/swing/JSeparator.java2
-rw-r--r--libjava/classpath/javax/swing/JSlider.java3
-rw-r--r--libjava/classpath/javax/swing/JSpinner.java42
-rw-r--r--libjava/classpath/javax/swing/JSplitPane.java3
-rw-r--r--libjava/classpath/javax/swing/JTabbedPane.java130
-rw-r--r--libjava/classpath/javax/swing/JTable.java1012
-rw-r--r--libjava/classpath/javax/swing/JTextArea.java61
-rw-r--r--libjava/classpath/javax/swing/JTextField.java183
-rw-r--r--libjava/classpath/javax/swing/JTextPane.java11
-rw-r--r--libjava/classpath/javax/swing/JToggleButton.java24
-rw-r--r--libjava/classpath/javax/swing/JToolBar.java4
-rw-r--r--libjava/classpath/javax/swing/JToolTip.java3
-rw-r--r--libjava/classpath/javax/swing/JTree.java4337
-rw-r--r--libjava/classpath/javax/swing/JViewport.java579
-rw-r--r--libjava/classpath/javax/swing/JWindow.java48
-rw-r--r--libjava/classpath/javax/swing/KeyStroke.java1
-rw-r--r--libjava/classpath/javax/swing/KeyboardManager.java280
-rw-r--r--libjava/classpath/javax/swing/ListCellRenderer.java8
-rw-r--r--libjava/classpath/javax/swing/ListSelectionModel.java34
-rw-r--r--libjava/classpath/javax/swing/LookAndFeel.java115
-rw-r--r--libjava/classpath/javax/swing/MenuElement.java84
-rw-r--r--libjava/classpath/javax/swing/MenuSelectionManager.java9
-rw-r--r--libjava/classpath/javax/swing/MutableComboBoxModel.java4
-rw-r--r--libjava/classpath/javax/swing/OverlayLayout.java507
-rw-r--r--libjava/classpath/javax/swing/Popup.java112
-rw-r--r--libjava/classpath/javax/swing/PopupFactory.java33
-rw-r--r--libjava/classpath/javax/swing/ProgressMonitor.java567
-rw-r--r--libjava/classpath/javax/swing/ProgressMonitorInputStream.java291
-rw-r--r--libjava/classpath/javax/swing/Renderer.java32
-rw-r--r--libjava/classpath/javax/swing/RepaintManager.java292
-rw-r--r--libjava/classpath/javax/swing/RootPaneContainer.java96
-rw-r--r--libjava/classpath/javax/swing/ScrollPaneLayout.java426
-rw-r--r--libjava/classpath/javax/swing/Scrollable.java17
-rw-r--r--libjava/classpath/javax/swing/SingleSelectionModel.java81
-rw-r--r--libjava/classpath/javax/swing/SizeRequirements.java211
-rw-r--r--libjava/classpath/javax/swing/SizeSequence.java399
-rw-r--r--libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java2
-rw-r--r--libjava/classpath/javax/swing/SpinnerListModel.java415
-rw-r--r--libjava/classpath/javax/swing/Spring.java1
-rw-r--r--libjava/classpath/javax/swing/SpringLayout.java43
-rw-r--r--libjava/classpath/javax/swing/SwingUtilities.java26
-rw-r--r--libjava/classpath/javax/swing/Timer.java106
-rw-r--r--libjava/classpath/javax/swing/ToolTipManager.java219
-rw-r--r--libjava/classpath/javax/swing/TransferHandler.java57
-rw-r--r--libjava/classpath/javax/swing/UIDefaults.java10
-rw-r--r--libjava/classpath/javax/swing/UIManager.java22
-rw-r--r--libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java8
-rw-r--r--libjava/classpath/javax/swing/ViewportLayout.java5
-rw-r--r--libjava/classpath/javax/swing/WindowConstants.java43
-rw-r--r--libjava/classpath/javax/swing/border/AbstractBorder.java46
-rw-r--r--libjava/classpath/javax/swing/border/BevelBorder.java13
-rw-r--r--libjava/classpath/javax/swing/border/Border.java6
-rw-r--r--libjava/classpath/javax/swing/border/CompoundBorder.java57
-rw-r--r--libjava/classpath/javax/swing/border/EmptyBorder.java4
-rw-r--r--libjava/classpath/javax/swing/border/EtchedBorder.java45
-rw-r--r--libjava/classpath/javax/swing/border/LineBorder.java44
-rw-r--r--libjava/classpath/javax/swing/border/MatteBorder.java4
-rw-r--r--libjava/classpath/javax/swing/border/SoftBevelBorder.java12
-rw-r--r--libjava/classpath/javax/swing/border/TitledBorder.java112
-rw-r--r--libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java35
-rw-r--r--libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java3
-rw-r--r--libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java3
-rw-r--r--libjava/classpath/javax/swing/event/EventListenerList.java1
-rw-r--r--libjava/classpath/javax/swing/event/InternalFrameAdapter.java147
-rw-r--r--libjava/classpath/javax/swing/event/ListDataListener.java55
-rw-r--r--libjava/classpath/javax/swing/event/MouseInputListener.java13
-rw-r--r--libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java7
-rw-r--r--libjava/classpath/javax/swing/event/TreeModelEvent.java8
-rw-r--r--libjava/classpath/javax/swing/filechooser/FileFilter.java77
-rw-r--r--libjava/classpath/javax/swing/filechooser/FileSystemView.java181
-rw-r--r--libjava/classpath/javax/swing/filechooser/FileView.java152
-rw-r--r--libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/ActionMapUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/BorderUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ButtonUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ColorChooserUI.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/ColorUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ComboBoxUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/ComponentUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/DesktopIconUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/DesktopPaneUI.java5
-rw-r--r--libjava/classpath/javax/swing/plaf/DimensionUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/FileChooserUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/FontUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/IconUIResource.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/InputMapUIResource.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/InsetsUIResource.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/InternalFrameUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/LabelUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ListUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/MenuBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/MenuItemUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/PanelUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/PopupMenuUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ProgressBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/RootPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ScrollBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ScrollPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/SeparatorUI.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/SliderUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/SpinnerUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/SplitPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TabbedPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TableHeaderUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TableUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TextUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ToolBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ToolTipUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TreeUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/UIResource.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/ViewportUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java406
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicBorders.java13
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java11
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java146
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java23
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java20
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java45
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java72
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java778
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java60
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java80
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java875
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java9
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java26
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java155
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java691
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java18
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicListUI.java671
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java170
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java105
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java673
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java88
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java81
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java28
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java7
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java417
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java35
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java119
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java335
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java418
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java73
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java51
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java16
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java72
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java1524
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java63
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java586
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java22
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java32
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java167
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java65
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java5
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java56
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java99
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java1327
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java177
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalBorders.java799
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java86
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java158
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java7
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java241
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java143
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java9
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java264
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java430
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java1386
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java325
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java120
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java422
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java101
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java130
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java13
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java430
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java483
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java19
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java63
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java220
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java35
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java30
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java32
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java129
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java112
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java272
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java278
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalUtils.java103
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/OceanTheme.java209
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/package.html13
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java1
-rw-r--r--libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java49
-rw-r--r--libjava/classpath/javax/swing/table/JTableHeader.java109
-rw-r--r--libjava/classpath/javax/swing/table/TableColumn.java10
-rw-r--r--libjava/classpath/javax/swing/table/TableColumnModel.java4
-rw-r--r--libjava/classpath/javax/swing/text/AbstractDocument.java326
-rw-r--r--libjava/classpath/javax/swing/text/AttributeSet.java6
-rw-r--r--libjava/classpath/javax/swing/text/BoxView.java256
-rw-r--r--libjava/classpath/javax/swing/text/ComponentView.java200
-rw-r--r--libjava/classpath/javax/swing/text/CompositeView.java66
-rw-r--r--libjava/classpath/javax/swing/text/DefaultCaret.java409
-rw-r--r--libjava/classpath/javax/swing/text/DefaultEditorKit.java45
-rw-r--r--libjava/classpath/javax/swing/text/DefaultFormatter.java15
-rw-r--r--libjava/classpath/javax/swing/text/DefaultHighlighter.java2
-rw-r--r--libjava/classpath/javax/swing/text/DefaultStyledDocument.java1032
-rw-r--r--libjava/classpath/javax/swing/text/DefaultTextUI.java61
-rw-r--r--libjava/classpath/javax/swing/text/EditorKit.java10
-rw-r--r--libjava/classpath/javax/swing/text/FieldView.java17
-rw-r--r--libjava/classpath/javax/swing/text/FlowView.java70
-rw-r--r--libjava/classpath/javax/swing/text/GapContent.java382
-rw-r--r--libjava/classpath/javax/swing/text/GlyphView.java652
-rw-r--r--libjava/classpath/javax/swing/text/IconView.java32
-rw-r--r--libjava/classpath/javax/swing/text/InternationalFormatter.java5
-rw-r--r--libjava/classpath/javax/swing/text/JTextComponent.java211
-rw-r--r--libjava/classpath/javax/swing/text/LabelView.java242
-rw-r--r--libjava/classpath/javax/swing/text/LayoutQueue.java1
-rw-r--r--libjava/classpath/javax/swing/text/ParagraphView.java30
-rw-r--r--libjava/classpath/javax/swing/text/PlainDocument.java28
-rw-r--r--libjava/classpath/javax/swing/text/PlainView.java371
-rw-r--r--libjava/classpath/javax/swing/text/Segment.java4
-rw-r--r--libjava/classpath/javax/swing/text/SimpleAttributeSet.java57
-rw-r--r--libjava/classpath/javax/swing/text/StringContent.java3
-rw-r--r--libjava/classpath/javax/swing/text/StyleConstants.java6
-rw-r--r--libjava/classpath/javax/swing/text/StyleContext.java19
-rw-r--r--libjava/classpath/javax/swing/text/StyledDocument.java191
-rw-r--r--libjava/classpath/javax/swing/text/StyledEditorKit.java24
-rw-r--r--libjava/classpath/javax/swing/text/TabSet.java3
-rw-r--r--libjava/classpath/javax/swing/text/TabStop.java3
-rw-r--r--libjava/classpath/javax/swing/text/Utilities.java410
-rw-r--r--libjava/classpath/javax/swing/text/View.java76
-rw-r--r--libjava/classpath/javax/swing/text/WrappedPlainView.java700
-rw-r--r--libjava/classpath/javax/swing/text/html/CSS.java461
-rw-r--r--libjava/classpath/javax/swing/text/html/HTML.java13
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLDocument.java215
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLEditorKit.java38
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java4
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/ContentModel.java5
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DTD.java6
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DocumentParser.java7
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Element.java2
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Parser.java10
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java1
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java15
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java3
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeModel.java1
-rw-r--r--libjava/classpath/javax/swing/tree/TreeCellRenderer.java34
-rw-r--r--libjava/classpath/javax/swing/tree/TreeModel.java122
-rw-r--r--libjava/classpath/javax/swing/undo/CannotRedoException.java4
-rw-r--r--libjava/classpath/javax/swing/undo/CannotUndoException.java1
-rw-r--r--libjava/classpath/javax/xml/namespace/QName.java56
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerConfigurationException.java6
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerException.java22
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java2
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathException.java2
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathExpressionException.java1
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java1
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathFunctionException.java1
-rw-r--r--libjava/classpath/lib/Makefile.am8
-rw-r--r--libjava/classpath/lib/Makefile.in69
-rw-r--r--libjava/classpath/lib/copy-vmresources.sh.in41
-rwxr-xr-xlibjava/classpath/lib/gen-classlist.sh.in6
-rwxr-xr-xlibjava/classpath/lib/split-for-gcj.sh2
-rw-r--r--libjava/classpath/lib/standard.omit3
-rw-r--r--libjava/classpath/ltmain.sh52
-rw-r--r--libjava/classpath/m4/acattribute.m425
-rw-r--r--libjava/classpath/m4/acinclude.m453
-rw-r--r--libjava/classpath/native/Makefile.in12
-rw-r--r--libjava/classpath/native/fdlibm/Makefile.in12
-rw-r--r--libjava/classpath/native/fdlibm/java-assert.h6
-rw-r--r--libjava/classpath/native/fdlibm/mprec.h5
-rw-r--r--libjava/classpath/native/jawt/Makefile.in12
-rw-r--r--libjava/classpath/native/jawt/jawt.c4
-rw-r--r--libjava/classpath/native/jni/Makefile.am13
-rw-r--r--libjava/classpath/native/jni/Makefile.in20
-rw-r--r--libjava/classpath/native/jni/classpath/Makefile.am1
-rw-r--r--libjava/classpath/native/jni/classpath/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/classpath/jcl.c16
-rw-r--r--libjava/classpath/native/jni/classpath/primlib.c724
-rw-r--r--libjava/classpath/native/jni/classpath/primlib.h119
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.am6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.in19
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c5
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c42
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c59
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c234
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c8
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c76
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c97
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtkpeer.h11
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.in64
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c3
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c1
-rw-r--r--libjava/classpath/native/jni/java-net/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-net/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c3
-rw-r--r--libjava/classpath/native/jni/java-net/javanet.c14
-rw-r--r--libjava/classpath/native/jni/java-nio/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-nio/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c2
-rw-r--r--libjava/classpath/native/jni/java-util/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-util/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/midi-alsa/.cvsignore9
-rw-r--r--libjava/classpath/native/jni/midi-alsa/Makefile.am11
-rw-r--r--libjava/classpath/native/jni/midi-alsa/Makefile.in563
-rw-r--r--libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c148
-rw-r--r--libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c59
-rw-r--r--libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c150
-rw-r--r--libjava/classpath/native/jni/midi-dssi/.cvsignore9
-rw-r--r--libjava/classpath/native/jni/midi-dssi/Makefile.am11
-rw-r--r--libjava/classpath/native/jni/midi-dssi/Makefile.in562
-rw-r--r--libjava/classpath/native/jni/midi-dssi/README134
-rw-r--r--libjava/classpath/native/jni/midi-dssi/dssi_data.h121
-rw-r--r--libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c139
-rw-r--r--libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c584
-rw-r--r--libjava/classpath/native/jni/qt-peer/Makefile.in12
-rw-r--r--libjava/classpath/native/jni/qt-peer/componentevent.cpp1
-rw-r--r--libjava/classpath/native/jni/xmlj/Makefile.in12
-rw-r--r--libjava/classpath/native/target/Linux/Makefile.in12
-rw-r--r--libjava/classpath/native/target/Makefile.in12
-rw-r--r--libjava/classpath/native/target/generic/Makefile.in12
-rw-r--r--libjava/classpath/org/ietf/jgss/GSSCredential.java10
-rw-r--r--libjava/classpath/org/ietf/jgss/GSSException.java47
-rw-r--r--libjava/classpath/org/ietf/jgss/GSSName.java9
-rw-r--r--libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java102
-rw-r--r--libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java100
-rw-r--r--libjava/classpath/org/omg/CORBA/AnyHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/AnySeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/AnySeqHolder.java6
-rwxr-xr-xlibjava/classpath/org/omg/CORBA/BAD_OPERATION.java92
-rw-r--r--libjava/classpath/org/omg/CORBA/BAD_QOS.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/BooleanHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/ByteHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/CharHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/CharSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/CharSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/CompletionStatus.java10
-rw-r--r--libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java20
-rw-r--r--libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/DoubleHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/DynamicImplementation.java111
-rw-r--r--libjava/classpath/org/omg/CORBA/FieldNameHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/FixedHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/FloatHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/FloatSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/FloatSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/IDLTypeHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java100
-rw-r--r--libjava/classpath/org/omg/CORBA/IdentifierHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/IntHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LocalObject.java128
-rw-r--r--libjava/classpath/org/omg/CORBA/LongHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/LongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/MARSHAL.java260
-rw-r--r--libjava/classpath/org/omg/CORBA/NO_RESOURCES.java70
-rw-r--r--libjava/classpath/org/omg/CORBA/NameValuePairHelper.java15
-rw-r--r--libjava/classpath/org/omg/CORBA/OMGVMCID.java100
-rw-r--r--libjava/classpath/org/omg/CORBA/ORB.java274
-rw-r--r--libjava/classpath/org/omg/CORBA/ObjectHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/ObjectHolder.java8
-rw-r--r--libjava/classpath/org/omg/CORBA/OctetSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/OctetSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/PERSIST_STORE.java2
-rw-r--r--libjava/classpath/org/omg/CORBA/ParameterModeHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyError.java8
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java115
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java158
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyListHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/PrincipalHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/REBIND.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ShortHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ShortSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ShortSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/StringHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/StringSeqHelper.java4
-rwxr-xr-xlibjava/classpath/org/omg/CORBA/StringSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/StringValueHelper.java19
-rw-r--r--libjava/classpath/org/omg/CORBA/StructMemberHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/SystemException.java87
-rw-r--r--libjava/classpath/org/omg/CORBA/TIMEOUT.java98
-rw-r--r--libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCodeHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java2
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java2
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/UShortSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/UShortSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/UnionMemberHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java157
-rw-r--r--libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/ValueBaseHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ValueBaseHolder.java10
-rw-r--r--libjava/classpath/org/omg/CORBA/ValueMemberHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/VersionSpecHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/VisibilityHelper.java14
-rw-r--r--libjava/classpath/org/omg/CORBA/WCharSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/WCharSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/WStringSeqHelper.java4
-rwxr-xr-xlibjava/classpath/org/omg/CORBA/WStringSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/WStringValueHelper.java19
-rw-r--r--libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java151
-rw-r--r--libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/_IDLTypeStub.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java4
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/ORB.java8
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java18
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java66
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java32
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java5
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java3
-rw-r--r--libjava/classpath/org/omg/CosNaming/IstringHelper.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/NameComponent.java14
-rw-r--r--libjava/classpath/org/omg/CosNaming/NameComponentHelper.java3
-rw-r--r--libjava/classpath/org/omg/CosNaming/NameHelper.java3
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java32
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextHelper.java32
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPOA.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java5
-rw-r--r--libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java6
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java32
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynStructHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynValueHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java4
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java10
-rw-r--r--libjava/classpath/org/omg/IOP/CodecFactoryHelper.java19
-rw-r--r--libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java60
-rw-r--r--libjava/classpath/org/omg/IOP/IORHelper.java3
-rw-r--r--libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java3
-rw-r--r--libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java56
-rw-r--r--libjava/classpath/org/omg/IOP/ServiceContextHelper.java3
-rw-r--r--libjava/classpath/org/omg/IOP/ServiceContextListHelper.java7
-rw-r--r--libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java61
-rw-r--r--libjava/classpath/org/omg/IOP/TaggedComponentHelper.java5
-rw-r--r--libjava/classpath/org/omg/IOP/TaggedProfileHelper.java13
-rw-r--r--libjava/classpath/org/omg/Messaging/SyncScopeHelper.java8
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java55
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java144
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java30
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java55
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/HOLDING.java55
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java57
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java52
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java6
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java59
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java195
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java106
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java90
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java57
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java17
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java1
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java10
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java121
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java57
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java150
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java105
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java69
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java78
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java144
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java103
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java169
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java104
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java38
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java272
-rw-r--r--libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAHelper.java10
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java11
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/Servant.java4
-rw-r--r--libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java31
-rw-r--r--libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java30
-rw-r--r--libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java6
-rw-r--r--libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider3
-rw-r--r--libjava/classpath/resource/Makefile.in12
-rw-r--r--libjava/classpath/scripts/Makefile.in12
-rwxr-xr-xlibjava/classpath/scripts/loc44
-rw-r--r--libjava/classpath/test/native/lib/PrimlibInterface.c162
-rw-r--r--libjava/classpath/test/native/lib/PrimlibInterface.h141
-rw-r--r--libjava/classpath/test/native/lib/PrimlibTest.java88
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java16
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java3
-rw-r--r--libjava/classpath/vm/reference/java/io/VMObjectInputStream.java10
-rw-r--r--libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java11
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMClassLoader.java123
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMThread.java9
-rw-r--r--libjava/classpath/vm/reference/java/security/VMAccessController.java42
-rw-r--r--libjava/classpath/vm/reference/standard.omit1
-rwxr-xr-xlibjava/scripts/makemake.tcl2
-rw-r--r--libjava/sources.am523
1241 files changed, 97754 insertions, 25327 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index d534360f78e..c7b541a5dca 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-15 Mark Wielaard <mark@klomp.org>
+
+ Imported GNU Classpath 0.19 + gcj-import-20051115.
+ * sources.am: Regenerated.
+ * Makefile.in: Likewise.
+ * scripts/makemake.tcl: Use glob -nocomplain.
+
2005-11-15 Scott Gilbertson <scottg@mantatest.com>
* Makefile.in: Re-generated.
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index 561c4eb1abb..77f11cc2348 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -150,14 +150,18 @@ lib_gnu_java_awt_peer_qt_la_OBJECTS = \
@QT_AWT_TRUE@am_lib_gnu_java_awt_peer_qt_la_rpath = -rpath \
@QT_AWT_TRUE@ $(toolexeclibdir)
am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
- gnu/classpath/debug.lo gnu/gcj.lo gnu/gcj/convert.lo \
- gnu/gcj/io.lo gnu/gcj/runtime.lo gnu/gcj/util.lo \
- gnu/java/awt.lo gnu/java/awt/color.lo gnu/java/awt/image.lo \
- gnu/java/awt/peer.lo gnu/java/io.lo gnu/java/lang.lo \
- gnu/java/lang/reflect.lo gnu/java/locale.lo gnu/java/math.lo \
- gnu/java/net.lo gnu/java/net/protocol/file.lo \
+ gnu/classpath/debug.lo gnu/classpath/jdwp.lo \
+ gnu/classpath/jdwp/event.lo \
+ gnu/classpath/jdwp/event/filters.lo \
+ gnu/classpath/jdwp/exception.lo gnu/classpath/jdwp/id.lo \
+ gnu/classpath/jdwp/processor.lo \
+ gnu/classpath/jdwp/transport.lo gnu/classpath/jdwp/util.lo \
+ gnu/gcj.lo gnu/gcj/convert.lo gnu/gcj/io.lo gnu/gcj/runtime.lo \
+ gnu/gcj/util.lo gnu/java/awt.lo gnu/java/awt/color.lo \
+ gnu/java/awt/image.lo gnu/java/awt/peer.lo gnu/java/io.lo \
+ gnu/java/lang.lo gnu/java/lang/reflect.lo gnu/java/locale.lo \
+ gnu/java/math.lo gnu/java/net.lo gnu/java/net/protocol/file.lo \
gnu/java/net/protocol/ftp.lo gnu/java/net/protocol/http.lo \
- gnu/java/net/protocol/http/event.lo \
gnu/java/net/protocol/https.lo gnu/java/net/protocol/jar.lo \
gnu/java/nio.lo gnu/java/nio/channels.lo \
gnu/java/nio/charset.lo gnu/java/rmi.lo gnu/java/rmi/dgc.lo \
@@ -167,8 +171,8 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
gnu/java/security/pkcs.lo gnu/java/security/provider.lo \
gnu/java/security/util.lo gnu/java/security/x509.lo \
gnu/java/security/x509/ext.lo gnu/java/text.lo \
- gnu/java/util.lo gnu/java/util/prefs.lo \
- gnu/javax/swing/text/html/parser.lo \
+ gnu/java/util.lo gnu/java/util/prefs.lo gnu/javax/crypto.lo \
+ gnu/javax/imageio/bmp.lo gnu/javax/swing/text/html/parser.lo \
gnu/javax/swing/text/html/parser/models.lo \
gnu/javax/swing/text/html/parser/support.lo \
gnu/javax/swing/text/html/parser/support/low.lo gnu/regexp.lo \
@@ -196,7 +200,9 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
javax/print/event.lo javax/security/auth.lo \
javax/security/auth/callback.lo javax/security/auth/login.lo \
javax/security/auth/spi.lo javax/security/auth/x500.lo \
- javax/security/cert.lo javax/security/sasl.lo javax/sql.lo \
+ javax/security/cert.lo javax/security/sasl.lo \
+ javax/sound/midi.lo javax/sound/midi/spi.lo \
+ javax/sound/sampled.lo javax/sound/sampled/spi.lo javax/sql.lo \
javax/swing.lo javax/swing/border.lo \
javax/swing/colorchooser.lo javax/swing/event.lo \
javax/swing/filechooser.lo javax/swing/plaf.lo \
@@ -206,8 +212,8 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
javax/swing/text/html/parser.lo javax/swing/text/rtf.lo \
javax/swing/tree.lo javax/swing/undo.lo javax/transaction.lo \
javax/transaction/xa.lo org/ietf/jgss.lo
-am__DEPENDENCIES_3 = gnu-java-beans.lo gnu-xml.lo javax-imageio.lo \
- javax-xml.lo org-w3c.lo org-xml.lo
+am__DEPENDENCIES_3 = gnu-java-beans.lo gnu-javax-sound-midi.lo \
+ gnu-xml.lo javax-imageio.lo javax-xml.lo org-w3c.lo org-xml.lo
am__DEPENDENCIES_4 = $(patsubst classpath/resource/%,%,$(addsuffix \
.lo,$(property_files)))
am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
@@ -837,6 +843,7 @@ gnu/awt/xlib/XToolkit.java
gnu_awt_xlib_header_files = $(patsubst %.java,%.h,$(gnu_awt_xlib_source_files))
gnu_classpath_source_files = \
+classpath/gnu/classpath/ByteArray.java \
classpath/gnu/classpath/Configuration.java \
classpath/gnu/classpath/Pointer.java \
classpath/gnu/classpath/Pointer32.java \
@@ -852,6 +859,116 @@ classpath/gnu/classpath/debug/PreciseFilter.java \
classpath/gnu/classpath/debug/SystemLogger.java
gnu_classpath_debug_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_debug_source_files)))
+gnu_classpath_jdwp_source_files = \
+classpath/gnu/classpath/jdwp/Jdwp.java \
+classpath/gnu/classpath/jdwp/JdwpConstants.java \
+gnu/classpath/jdwp/VMFrame.java \
+gnu/classpath/jdwp/VMIdManager.java \
+gnu/classpath/jdwp/VMVirtualMachine.java
+
+gnu_classpath_jdwp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_source_files)))
+gnu_classpath_jdwp_event_source_files = \
+classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java \
+classpath/gnu/classpath/jdwp/event/Event.java \
+classpath/gnu/classpath/jdwp/event/EventManager.java \
+classpath/gnu/classpath/jdwp/event/EventRequest.java \
+classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java \
+classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java \
+classpath/gnu/classpath/jdwp/event/VmDeathEvent.java \
+classpath/gnu/classpath/jdwp/event/VmInitEvent.java
+
+gnu_classpath_jdwp_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_source_files)))
+gnu_classpath_jdwp_event_filters_source_files = \
+classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/CountFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/StepFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+
+gnu_classpath_jdwp_event_filters_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_filters_source_files)))
+gnu_classpath_jdwp_exception_source_files = \
+classpath/gnu/classpath/jdwp/exception/InvalidClassException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidEventTypeException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidFieldException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidLocationException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidMethodException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidObjectException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidStringException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpIllegalArgumentException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java \
+classpath/gnu/classpath/jdwp/exception/NotImplementedException.java \
+classpath/gnu/classpath/jdwp/exception/VmDeadException.java
+
+gnu_classpath_jdwp_exception_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_exception_source_files)))
+gnu_classpath_jdwp_id_source_files = \
+classpath/gnu/classpath/jdwp/id/ArrayId.java \
+classpath/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/ClassLoaderId.java \
+classpath/gnu/classpath/jdwp/id/ClassObjectId.java \
+classpath/gnu/classpath/jdwp/id/ClassReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/JdwpId.java \
+classpath/gnu/classpath/jdwp/id/ObjectId.java \
+classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/StringId.java \
+classpath/gnu/classpath/jdwp/id/ThreadGroupId.java \
+classpath/gnu/classpath/jdwp/id/ThreadId.java
+
+gnu_classpath_jdwp_id_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_id_source_files)))
+gnu_classpath_jdwp_processor_source_files = \
+classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/CommandSet.java \
+classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/PacketProcessor.java \
+classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+
+gnu_classpath_jdwp_processor_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_processor_source_files)))
+gnu_classpath_jdwp_transport_source_files = \
+classpath/gnu/classpath/jdwp/transport/ITransport.java \
+classpath/gnu/classpath/jdwp/transport/JdwpCommandPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpConnection.java \
+classpath/gnu/classpath/jdwp/transport/JdwpPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpReplyPacket.java \
+classpath/gnu/classpath/jdwp/transport/SocketTransport.java \
+classpath/gnu/classpath/jdwp/transport/TransportException.java \
+classpath/gnu/classpath/jdwp/transport/TransportFactory.java
+
+gnu_classpath_jdwp_transport_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_transport_source_files)))
+gnu_classpath_jdwp_util_source_files = \
+classpath/gnu/classpath/jdwp/util/JdwpString.java \
+classpath/gnu/classpath/jdwp/util/LineTable.java \
+classpath/gnu/classpath/jdwp/util/Location.java \
+classpath/gnu/classpath/jdwp/util/MethodResult.java \
+classpath/gnu/classpath/jdwp/util/Signature.java \
+classpath/gnu/classpath/jdwp/util/Value.java \
+classpath/gnu/classpath/jdwp/util/VariableTable.java
+
+gnu_classpath_jdwp_util_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_util_source_files)))
gnu_gcj_source_files = \
gnu/gcj/Core.java \
gnu/gcj/RawData.java \
@@ -942,7 +1059,6 @@ classpath/gnu/java/awt/ClasspathToolkit.java \
classpath/gnu/java/awt/ComponentDataBlitOp.java \
classpath/gnu/java/awt/EmbeddedWindow.java \
classpath/gnu/java/awt/EventModifier.java \
-classpath/gnu/java/awt/FocusManager.java \
classpath/gnu/java/awt/GradientPaintContext.java
gnu_java_awt_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_source_files)))
@@ -1335,7 +1451,6 @@ gnu_java_net_protocol_ftp_header_files = $(patsubst classpath/%,%,$(patsubst %.j
gnu_java_net_protocol_http_source_files = \
classpath/gnu/java/net/protocol/http/Authenticator.java \
classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java \
-classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ChunkedInputStream.java \
classpath/gnu/java/net/protocol/http/Cookie.java \
classpath/gnu/java/net/protocol/http/CookieManager.java \
@@ -1345,21 +1460,14 @@ classpath/gnu/java/net/protocol/http/HTTPDateFormat.java \
classpath/gnu/java/net/protocol/http/HTTPURLConnection.java \
classpath/gnu/java/net/protocol/http/Handler.java \
classpath/gnu/java/net/protocol/http/Headers.java \
+classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java \
classpath/gnu/java/net/protocol/http/Request.java \
classpath/gnu/java/net/protocol/http/RequestBodyWriter.java \
classpath/gnu/java/net/protocol/http/Response.java \
-classpath/gnu/java/net/protocol/http/ResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java \
classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
gnu_java_net_protocol_http_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_http_source_files)))
-gnu_java_net_protocol_http_event_source_files = \
-classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java \
-classpath/gnu/java/net/protocol/http/event/ConnectionListener.java \
-classpath/gnu/java/net/protocol/http/event/RequestEvent.java \
-classpath/gnu/java/net/protocol/http/event/RequestListener.java
-
-gnu_java_net_protocol_http_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_http_event_source_files)))
gnu_java_net_protocol_https_source_files = \
classpath/gnu/java/net/protocol/https/Handler.java
@@ -1490,6 +1598,7 @@ gnu_java_rmi_registry_header_files = $(patsubst classpath/%,%,$(patsubst %.java,
gnu_java_rmi_server_source_files = \
classpath/gnu/java/rmi/server/ConnectionRunnerPool.java \
classpath/gnu/java/rmi/server/ProtocolConstants.java \
+classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java \
classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java \
classpath/gnu/java/rmi/server/RMIHashes.java \
classpath/gnu/java/rmi/server/RMIIncomingThread.java \
@@ -1546,6 +1655,8 @@ classpath/gnu/java/security/provider/DSAParameterGenerator.java \
classpath/gnu/java/security/provider/DSAParameters.java \
classpath/gnu/java/security/provider/DSASignature.java \
classpath/gnu/java/security/provider/DefaultPolicy.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java \
classpath/gnu/java/security/provider/EncodedKeyFactory.java \
classpath/gnu/java/security/provider/Gnu.java \
classpath/gnu/java/security/provider/GnuDHPublicKey.java \
@@ -1626,6 +1737,38 @@ classpath/gnu/java/util/prefs/NodeReader.java \
classpath/gnu/java/util/prefs/NodeWriter.java
gnu_java_util_prefs_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_util_prefs_source_files)))
+gnu_javax_crypto_source_files = \
+classpath/gnu/javax/crypto/DiffieHellmanImpl.java \
+classpath/gnu/javax/crypto/GnuDHPrivateKey.java \
+classpath/gnu/javax/crypto/RSACipherImpl.java
+
+gnu_javax_crypto_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_crypto_source_files)))
+gnu_javax_imageio_bmp_source_files = \
+classpath/gnu/javax/imageio/bmp/BMPDecoder.java \
+classpath/gnu/javax/imageio/bmp/BMPException.java \
+classpath/gnu/javax/imageio/bmp/BMPFileHeader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java \
+classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF16.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF32.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB1.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB24.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB8.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
+
+gnu_javax_imageio_bmp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_imageio_bmp_source_files)))
+gnu_javax_sound_midi_source_files = \
+classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java \
+classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+
gnu_javax_swing_text_html_parser_source_files = \
classpath/gnu/javax/swing/text/html/parser/HTML_401F.java \
classpath/gnu/javax/swing/text/html/parser/gnuDTD.java \
@@ -1850,6 +1993,33 @@ classpath/gnu/xml/pipeline/ValidationConsumer.java \
classpath/gnu/xml/pipeline/WellFormednessFilter.java \
classpath/gnu/xml/pipeline/XIncludeFilter.java \
classpath/gnu/xml/pipeline/XsltFilter.java \
+classpath/gnu/xml/stream/AttributeImpl.java \
+classpath/gnu/xml/stream/CharactersImpl.java \
+classpath/gnu/xml/stream/CommentImpl.java \
+classpath/gnu/xml/stream/DTDImpl.java \
+classpath/gnu/xml/stream/EndDocumentImpl.java \
+classpath/gnu/xml/stream/EndElementImpl.java \
+classpath/gnu/xml/stream/EndEntityImpl.java \
+classpath/gnu/xml/stream/EntityDeclarationImpl.java \
+classpath/gnu/xml/stream/EntityReferenceImpl.java \
+classpath/gnu/xml/stream/FilteredEventReader.java \
+classpath/gnu/xml/stream/FilteredStreamReader.java \
+classpath/gnu/xml/stream/LocationImpl.java \
+classpath/gnu/xml/stream/NamespaceImpl.java \
+classpath/gnu/xml/stream/NotationDeclarationImpl.java \
+classpath/gnu/xml/stream/ProcessingInstructionImpl.java \
+classpath/gnu/xml/stream/StartDocumentImpl.java \
+classpath/gnu/xml/stream/StartElementImpl.java \
+classpath/gnu/xml/stream/StartEntityImpl.java \
+classpath/gnu/xml/stream/XMLEventAllocatorImpl.java \
+classpath/gnu/xml/stream/XMLEventFactoryImpl.java \
+classpath/gnu/xml/stream/XMLEventImpl.java \
+classpath/gnu/xml/stream/XMLEventReaderImpl.java \
+classpath/gnu/xml/stream/XMLEventWriterImpl.java \
+classpath/gnu/xml/stream/XMLInputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLOutputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLStreamReaderImpl.java \
+classpath/gnu/xml/stream/XMLStreamWriterImpl.java \
classpath/gnu/xml/transform/AbstractNumberNode.java \
classpath/gnu/xml/transform/ApplyImportsNode.java \
classpath/gnu/xml/transform/ApplyTemplatesNode.java \
@@ -2497,6 +2667,7 @@ classpath/java/lang/Comparable.java \
classpath/java/lang/Compiler.java \
java/lang/ConcreteProcess.java \
java/lang/Double.java \
+classpath/java/lang/EnumConstantNotPresentException.java \
classpath/java/lang/Error.java \
classpath/java/lang/Exception.java \
classpath/java/lang/ExceptionInInitializerError.java \
@@ -2782,6 +2953,7 @@ classpath/java/rmi/activation/ActivationException.java \
classpath/java/rmi/activation/ActivationGroup.java \
classpath/java/rmi/activation/ActivationGroupDesc.java \
classpath/java/rmi/activation/ActivationGroupID.java \
+classpath/java/rmi/activation/ActivationGroup_Stub.java \
classpath/java/rmi/activation/ActivationID.java \
classpath/java/rmi/activation/ActivationInstantiator.java \
classpath/java/rmi/activation/ActivationMonitor.java \
@@ -3076,6 +3248,7 @@ classpath/java/util/HashMap.java \
classpath/java/util/HashSet.java \
classpath/java/util/Hashtable.java \
classpath/java/util/IdentityHashMap.java \
+classpath/java/util/InvalidPropertiesFormatException.java \
classpath/java/util/Iterator.java \
classpath/java/util/LinkedHashMap.java \
classpath/java/util/LinkedHashSet.java \
@@ -3274,15 +3447,12 @@ classpath/javax/imageio/event/IIOReadUpdateListener.java \
classpath/javax/imageio/event/IIOReadWarningListener.java \
classpath/javax/imageio/event/IIOWriteProgressListener.java \
classpath/javax/imageio/event/IIOWriteWarningListener.java \
-classpath/javax/imageio/metadata/IIOAttr.java \
classpath/javax/imageio/metadata/IIOInvalidTreeException.java \
classpath/javax/imageio/metadata/IIOMetadata.java \
classpath/javax/imageio/metadata/IIOMetadataController.java \
classpath/javax/imageio/metadata/IIOMetadataFormat.java \
classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java \
classpath/javax/imageio/metadata/IIOMetadataNode.java \
-classpath/javax/imageio/metadata/IIONamedNodeMap.java \
-classpath/javax/imageio/metadata/IIONodeList.java \
classpath/javax/imageio/spi/IIORegistry.java \
classpath/javax/imageio/spi/IIOServiceProvider.java \
classpath/javax/imageio/spi/ImageInputStreamSpi.java \
@@ -3645,6 +3815,72 @@ classpath/javax/security/sasl/SaslServer.java \
classpath/javax/security/sasl/SaslServerFactory.java
javax_security_sasl_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_security_sasl_source_files)))
+javax_sound_midi_source_files = \
+classpath/javax/sound/midi/ControllerEventListener.java \
+classpath/javax/sound/midi/Instrument.java \
+classpath/javax/sound/midi/InvalidMidiDataException.java \
+classpath/javax/sound/midi/MetaEventListener.java \
+classpath/javax/sound/midi/MetaMessage.java \
+classpath/javax/sound/midi/MidiChannel.java \
+classpath/javax/sound/midi/MidiDevice.java \
+classpath/javax/sound/midi/MidiEvent.java \
+classpath/javax/sound/midi/MidiFileFormat.java \
+classpath/javax/sound/midi/MidiMessage.java \
+classpath/javax/sound/midi/MidiSystem.java \
+classpath/javax/sound/midi/MidiUnavailableException.java \
+classpath/javax/sound/midi/Patch.java \
+classpath/javax/sound/midi/Receiver.java \
+classpath/javax/sound/midi/Sequence.java \
+classpath/javax/sound/midi/Sequencer.java \
+classpath/javax/sound/midi/ShortMessage.java \
+classpath/javax/sound/midi/Soundbank.java \
+classpath/javax/sound/midi/SoundbankResource.java \
+classpath/javax/sound/midi/Synthesizer.java \
+classpath/javax/sound/midi/SysexMessage.java \
+classpath/javax/sound/midi/Track.java \
+classpath/javax/sound/midi/Transmitter.java \
+classpath/javax/sound/midi/VoiceStatus.java
+
+javax_sound_midi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_source_files)))
+javax_sound_midi_spi_source_files = \
+classpath/javax/sound/midi/spi/MidiDeviceProvider.java \
+classpath/javax/sound/midi/spi/MidiFileReader.java \
+classpath/javax/sound/midi/spi/MidiFileWriter.java \
+classpath/javax/sound/midi/spi/SoundbankReader.java
+
+javax_sound_midi_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_spi_source_files)))
+javax_sound_sampled_source_files = \
+classpath/javax/sound/sampled/AudioFileFormat.java \
+classpath/javax/sound/sampled/AudioFormat.java \
+classpath/javax/sound/sampled/AudioInputStream.java \
+classpath/javax/sound/sampled/AudioPermission.java \
+classpath/javax/sound/sampled/AudioSystem.java \
+classpath/javax/sound/sampled/BooleanControl.java \
+classpath/javax/sound/sampled/Clip.java \
+classpath/javax/sound/sampled/CompoundControl.java \
+classpath/javax/sound/sampled/Control.java \
+classpath/javax/sound/sampled/DataLine.java \
+classpath/javax/sound/sampled/EnumControl.java \
+classpath/javax/sound/sampled/FloatControl.java \
+classpath/javax/sound/sampled/Line.java \
+classpath/javax/sound/sampled/LineEvent.java \
+classpath/javax/sound/sampled/LineListener.java \
+classpath/javax/sound/sampled/LineUnavailableException.java \
+classpath/javax/sound/sampled/Mixer.java \
+classpath/javax/sound/sampled/Port.java \
+classpath/javax/sound/sampled/ReverbType.java \
+classpath/javax/sound/sampled/SourceDataLine.java \
+classpath/javax/sound/sampled/TargetDataLine.java \
+classpath/javax/sound/sampled/UnsupportedAudioFileException.java
+
+javax_sound_sampled_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_source_files)))
+javax_sound_sampled_spi_source_files = \
+classpath/javax/sound/sampled/spi/AudioFileReader.java \
+classpath/javax/sound/sampled/spi/AudioFileWriter.java \
+classpath/javax/sound/sampled/spi/FormatConversionProvider.java \
+classpath/javax/sound/sampled/spi/MixerProvider.java
+
+javax_sound_sampled_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_spi_source_files)))
javax_sql_source_files = \
classpath/javax/sql/ConnectionEvent.java \
classpath/javax/sql/ConnectionEventListener.java \
@@ -3746,6 +3982,7 @@ classpath/javax/swing/JTree.java \
classpath/javax/swing/JViewport.java \
classpath/javax/swing/JWindow.java \
classpath/javax/swing/KeyStroke.java \
+classpath/javax/swing/KeyboardManager.java \
classpath/javax/swing/LayoutFocusTraversalPolicy.java \
classpath/javax/swing/ListCellRenderer.java \
classpath/javax/swing/ListModel.java \
@@ -3972,12 +4209,16 @@ javax_swing_plaf_basic_header_files = $(patsubst classpath/%,%,$(patsubst %.java
javax_swing_plaf_metal_source_files = \
classpath/javax/swing/plaf/metal/DefaultMetalTheme.java \
classpath/javax/swing/plaf/metal/MetalBorders.java \
+classpath/javax/swing/plaf/metal/MetalButtonListener.java \
classpath/javax/swing/plaf/metal/MetalButtonUI.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxButton.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java \
classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalComboBoxUI.java \
classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java \
+classpath/javax/swing/plaf/metal/MetalFileChooserUI.java \
classpath/javax/swing/plaf/metal/MetalIconFactory.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java \
@@ -3988,6 +4229,7 @@ classpath/javax/swing/plaf/metal/MetalProgressBarUI.java \
classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java \
classpath/javax/swing/plaf/metal/MetalRootPaneUI.java \
classpath/javax/swing/plaf/metal/MetalScrollBarUI.java \
+classpath/javax/swing/plaf/metal/MetalScrollButton.java \
classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java \
classpath/javax/swing/plaf/metal/MetalSeparatorUI.java \
classpath/javax/swing/plaf/metal/MetalSliderUI.java \
@@ -4000,7 +4242,8 @@ classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java \
classpath/javax/swing/plaf/metal/MetalToolBarUI.java \
classpath/javax/swing/plaf/metal/MetalToolTipUI.java \
classpath/javax/swing/plaf/metal/MetalTreeUI.java \
-classpath/javax/swing/plaf/metal/MetalUtils.java
+classpath/javax/swing/plaf/metal/MetalUtils.java \
+classpath/javax/swing/plaf/metal/OceanTheme.java
javax_swing_plaf_metal_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_plaf_metal_source_files)))
javax_swing_plaf_multi_source_files = \
@@ -4066,6 +4309,7 @@ classpath/javax/swing/text/DefaultEditorKit.java \
classpath/javax/swing/text/DefaultFormatter.java \
classpath/javax/swing/text/DefaultHighlighter.java \
classpath/javax/swing/text/DefaultStyledDocument.java \
+classpath/javax/swing/text/DefaultTextUI.java \
classpath/javax/swing/text/Document.java \
classpath/javax/swing/text/DocumentFilter.java \
classpath/javax/swing/text/EditorKit.java \
@@ -4105,10 +4349,12 @@ classpath/javax/swing/text/TabableView.java \
classpath/javax/swing/text/TextAction.java \
classpath/javax/swing/text/Utilities.java \
classpath/javax/swing/text/View.java \
-classpath/javax/swing/text/ViewFactory.java
+classpath/javax/swing/text/ViewFactory.java \
+classpath/javax/swing/text/WrappedPlainView.java
javax_swing_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_text_source_files)))
javax_swing_text_html_source_files = \
+classpath/javax/swing/text/html/CSS.java \
classpath/javax/swing/text/html/HTML.java \
classpath/javax/swing/text/html/HTMLDocument.java \
classpath/javax/swing/text/html/HTMLEditorKit.java \
@@ -4208,6 +4454,43 @@ classpath/javax/xml/parsers/FactoryConfigurationError.java \
classpath/javax/xml/parsers/ParserConfigurationException.java \
classpath/javax/xml/parsers/SAXParser.java \
classpath/javax/xml/parsers/SAXParserFactory.java \
+classpath/javax/xml/stream/EventFilter.java \
+classpath/javax/xml/stream/FactoryConfigurationError.java \
+classpath/javax/xml/stream/Location.java \
+classpath/javax/xml/stream/StreamFilter.java \
+classpath/javax/xml/stream/XMLEventFactory.java \
+classpath/javax/xml/stream/XMLEventReader.java \
+classpath/javax/xml/stream/XMLEventWriter.java \
+classpath/javax/xml/stream/XMLFilter.java \
+classpath/javax/xml/stream/XMLInputFactory.java \
+classpath/javax/xml/stream/XMLIterator.java \
+classpath/javax/xml/stream/XMLOutputFactory.java \
+classpath/javax/xml/stream/XMLReporter.java \
+classpath/javax/xml/stream/XMLResolver.java \
+classpath/javax/xml/stream/XMLStreamConstants.java \
+classpath/javax/xml/stream/XMLStreamException.java \
+classpath/javax/xml/stream/XMLStreamReader.java \
+classpath/javax/xml/stream/XMLStreamWriter.java \
+classpath/javax/xml/stream/events/Attribute.java \
+classpath/javax/xml/stream/events/Characters.java \
+classpath/javax/xml/stream/events/Comment.java \
+classpath/javax/xml/stream/events/DTD.java \
+classpath/javax/xml/stream/events/EndDocument.java \
+classpath/javax/xml/stream/events/EndElement.java \
+classpath/javax/xml/stream/events/EndEntity.java \
+classpath/javax/xml/stream/events/EntityDeclaration.java \
+classpath/javax/xml/stream/events/EntityReference.java \
+classpath/javax/xml/stream/events/Namespace.java \
+classpath/javax/xml/stream/events/NotationDeclaration.java \
+classpath/javax/xml/stream/events/ProcessingInstruction.java \
+classpath/javax/xml/stream/events/StartDocument.java \
+classpath/javax/xml/stream/events/StartElement.java \
+classpath/javax/xml/stream/events/StartEntity.java \
+classpath/javax/xml/stream/events/XMLEvent.java \
+classpath/javax/xml/stream/util/EventReaderDelegate.java \
+classpath/javax/xml/stream/util/ReaderDelegate.java \
+classpath/javax/xml/stream/util/XMLEventAllocator.java \
+classpath/javax/xml/stream/util/XMLEventConsumer.java \
classpath/javax/xml/transform/ErrorListener.java \
classpath/javax/xml/transform/OutputKeys.java \
classpath/javax/xml/transform/Result.java \
@@ -4449,6 +4732,14 @@ all_packages_source_files = \
gnu/awt/j2d.list \
gnu/classpath.list \
gnu/classpath/debug.list \
+ gnu/classpath/jdwp.list \
+ gnu/classpath/jdwp/event.list \
+ gnu/classpath/jdwp/event/filters.list \
+ gnu/classpath/jdwp/exception.list \
+ gnu/classpath/jdwp/id.list \
+ gnu/classpath/jdwp/processor.list \
+ gnu/classpath/jdwp/transport.list \
+ gnu/classpath/jdwp/util.list \
gnu/gcj.list \
gnu/gcj/convert.list \
gnu/gcj/io.list \
@@ -4467,7 +4758,6 @@ all_packages_source_files = \
gnu/java/net/protocol/file.list \
gnu/java/net/protocol/ftp.list \
gnu/java/net/protocol/http.list \
- gnu/java/net/protocol/http/event.list \
gnu/java/net/protocol/https.list \
gnu/java/net/protocol/jar.list \
gnu/java/nio.list \
@@ -4489,6 +4779,8 @@ all_packages_source_files = \
gnu/java/text.list \
gnu/java/util.list \
gnu/java/util/prefs.list \
+ gnu/javax/crypto.list \
+ gnu/javax/imageio/bmp.list \
gnu/javax/swing/text/html/parser.list \
gnu/javax/swing/text/html/parser/models.list \
gnu/javax/swing/text/html/parser/support.list \
@@ -4563,6 +4855,10 @@ all_packages_source_files = \
javax/security/auth/x500.list \
javax/security/cert.list \
javax/security/sasl.list \
+ javax/sound/midi.list \
+ javax/sound/midi/spi.list \
+ javax/sound/sampled.list \
+ javax/sound/sampled/spi.list \
javax/sql.list \
javax/swing.list \
javax/swing/border.list \
@@ -4589,6 +4885,14 @@ ordinary_header_files = \
$(gnu_awt_j2d_header_files) \
$(gnu_classpath_header_files) \
$(gnu_classpath_debug_header_files) \
+ $(gnu_classpath_jdwp_header_files) \
+ $(gnu_classpath_jdwp_event_header_files) \
+ $(gnu_classpath_jdwp_event_filters_header_files) \
+ $(gnu_classpath_jdwp_exception_header_files) \
+ $(gnu_classpath_jdwp_id_header_files) \
+ $(gnu_classpath_jdwp_processor_header_files) \
+ $(gnu_classpath_jdwp_transport_header_files) \
+ $(gnu_classpath_jdwp_util_header_files) \
$(gnu_gcj_header_files) \
$(gnu_gcj_convert_header_files) \
$(gnu_gcj_io_header_files) \
@@ -4607,7 +4911,6 @@ ordinary_header_files = \
$(gnu_java_net_protocol_file_header_files) \
$(gnu_java_net_protocol_ftp_header_files) \
$(gnu_java_net_protocol_http_header_files) \
- $(gnu_java_net_protocol_http_event_header_files) \
$(gnu_java_net_protocol_https_header_files) \
$(gnu_java_net_protocol_jar_header_files) \
$(gnu_java_nio_header_files) \
@@ -4629,6 +4932,8 @@ ordinary_header_files = \
$(gnu_java_text_header_files) \
$(gnu_java_util_header_files) \
$(gnu_java_util_prefs_header_files) \
+ $(gnu_javax_crypto_header_files) \
+ $(gnu_javax_imageio_bmp_header_files) \
$(gnu_javax_swing_text_html_parser_header_files) \
$(gnu_javax_swing_text_html_parser_models_header_files) \
$(gnu_javax_swing_text_html_parser_support_header_files) \
@@ -4703,6 +5008,10 @@ ordinary_header_files = \
$(javax_security_auth_x500_header_files) \
$(javax_security_cert_header_files) \
$(javax_security_sasl_header_files) \
+ $(javax_sound_midi_header_files) \
+ $(javax_sound_midi_spi_header_files) \
+ $(javax_sound_sampled_header_files) \
+ $(javax_sound_sampled_spi_header_files) \
$(javax_sql_header_files) \
$(javax_swing_header_files) \
$(javax_swing_border_header_files) \
@@ -4726,6 +5035,7 @@ ordinary_header_files = \
bc_objects = \
gnu-java-beans.lo \
+ gnu-javax-sound-midi.lo \
gnu-xml.lo \
javax-imageio.lo \
javax-xml.lo \
@@ -6584,6 +6894,86 @@ gnu/classpath/debug.list: $(gnu_classpath_debug_source_files)
-include gnu/classpath/debug.deps
+gnu/classpath/jdwp.list: $(gnu_classpath_jdwp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp.list
+
+-include gnu/classpath/jdwp.deps
+
+gnu/classpath/jdwp/event.list: $(gnu_classpath_jdwp_event_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event.list
+
+-include gnu/classpath/jdwp/event.deps
+
+gnu/classpath/jdwp/event/filters.list: $(gnu_classpath_jdwp_event_filters_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_filters_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event/filters.list
+
+-include gnu/classpath/jdwp/event/filters.deps
+
+gnu/classpath/jdwp/exception.list: $(gnu_classpath_jdwp_exception_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_exception_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/exception.list
+
+-include gnu/classpath/jdwp/exception.deps
+
+gnu/classpath/jdwp/id.list: $(gnu_classpath_jdwp_id_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_id_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/id.list
+
+-include gnu/classpath/jdwp/id.deps
+
+gnu/classpath/jdwp/processor.list: $(gnu_classpath_jdwp_processor_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_processor_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/processor.list
+
+-include gnu/classpath/jdwp/processor.deps
+
+gnu/classpath/jdwp/transport.list: $(gnu_classpath_jdwp_transport_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_transport_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/transport.list
+
+-include gnu/classpath/jdwp/transport.deps
+
+gnu/classpath/jdwp/util.list: $(gnu_classpath_jdwp_util_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_util_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/util.list
+
+-include gnu/classpath/jdwp/util.deps
+
gnu/gcj.list: $(gnu_gcj_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(gnu_gcj_source_files); do \
@@ -6789,16 +7179,6 @@ gnu/java/net/protocol/http.list: $(gnu_java_net_protocol_http_source_files)
-include gnu/java/net/protocol/http.deps
-gnu/java/net/protocol/http/event.list: $(gnu_java_net_protocol_http_event_source_files)
- @$(mkinstalldirs) $(dir $@)
- @for file in $(gnu_java_net_protocol_http_event_source_files); do \
- if test -f $(srcdir)/$$file; then \
- echo $(srcdir)/$$file; \
- else echo $$file; fi; \
- done > gnu/java/net/protocol/http/event.list
-
--include gnu/java/net/protocol/http/event.deps
-
gnu/java/net/protocol/https.list: $(gnu_java_net_protocol_https_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(gnu_java_net_protocol_https_source_files); do \
@@ -7009,6 +7389,31 @@ gnu/java/util/prefs.list: $(gnu_java_util_prefs_source_files)
-include gnu/java/util/prefs.deps
+gnu/javax/crypto.list: $(gnu_javax_crypto_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_crypto_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/crypto.list
+
+-include gnu/javax/crypto.deps
+
+gnu/javax/imageio/bmp.list: $(gnu_javax_imageio_bmp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_imageio_bmp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/imageio/bmp.list
+
+-include gnu/javax/imageio/bmp.deps
+
+gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files)
+ @find classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list
+ $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list
+ @rm -f gnu-javax-sound-midi.list
+
gnu/javax/swing/text/html/parser.list: $(gnu_javax_swing_text_html_parser_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(gnu_javax_swing_text_html_parser_source_files); do \
@@ -7759,6 +8164,46 @@ javax/security/sasl.list: $(javax_security_sasl_source_files)
-include javax/security/sasl.deps
+javax/sound/midi.list: $(javax_sound_midi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi.list
+
+-include javax/sound/midi.deps
+
+javax/sound/midi/spi.list: $(javax_sound_midi_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi/spi.list
+
+-include javax/sound/midi/spi.deps
+
+javax/sound/sampled.list: $(javax_sound_sampled_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled.list
+
+-include javax/sound/sampled.deps
+
+javax/sound/sampled/spi.list: $(javax_sound_sampled_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled/spi.list
+
+-include javax/sound/sampled/spi.deps
+
javax/sql.list: $(javax_sql_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(javax_sql_source_files); do \
diff --git a/libjava/classpath/.classpath b/libjava/classpath/.classpath
index 51315366e6c..f170038598e 100644
--- a/libjava/classpath/.classpath
+++ b/libjava/classpath/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="compat/|examples/|external/|gnu/classpath/jdwp/|gnu/javax/swing/plaf/|test/|testsuite/|vm/reference/|resource/" kind="src" path=""/>
+ <classpathentry excluding=".externalToolBuilders/|.settings/|ChangeLog*|Makefile*|autom4te.cache/|compat/|config*|doc/|examples/|external/|gnu/javax/swing/plaf/|include/|install/|lib/|m4/|native/|resource/|scripts/|test/|testsuite/|vm/reference/" kind="src" path=""/>
<classpathentry kind="src" path="resource"/>
- <classpathentry excluding="gnu/classpath/jdwp/" kind="src" path="vm/reference"/>
+ <classpathentry kind="src" path="vm/reference"/>
<classpathentry kind="src" path="external/sax"/>
<classpathentry kind="src" path="external/w3c_dom"/>
<classpathentry kind="src" path="examples"/>
diff --git a/libjava/classpath/.settings/org.eclipse.jdt.core.prefs b/libjava/classpath/.settings/org.eclipse.jdt.core.prefs
index 6977f23851e..0c544bd829e 100644
--- a/libjava/classpath/.settings/org.eclipse.jdt.core.prefs
+++ b/libjava/classpath/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,13 @@
-#Mon Apr 25 22:37:20 MDT 2005
+#Tue Sep 13 16:15:04 MDT 2005
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -22,9 +23,20 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
@@ -50,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.4
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs b/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs
index 7fc356fd571..05d8922d3c0 100644
--- a/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs
+++ b/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,5 @@
-#Mon Apr 25 21:37:39 MDT 2005
+#Sat Sep 17 22:04:29 MDT 2005
eclipse.preferences.version=1
formatter_settings_version=8
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates><template id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment" description\="Comment for getter method" context\="gettercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @return Returns the ${bare_field_name}.\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment" description\="Comment for setter method" context\="settercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @param ${param} The ${bare_field_name} to set.\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment" description\="Comment for created constructors" context\="constructorcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment" description\="Comment for created Java files" context\="filecomment_context" enabled\="true" deleted\="false" autoinsert\="false">/* ${file_name} -- FIXME describe the file briefly\n Copyright (C) ${year} Free Software Foundation, Inc.\n\nThis file is part of GNU Classpath.\n\nGNU Classpath is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2, or (at your option)\nany later version.\n\nGNU Classpath is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GNU Classpath; see the file COPYING. If not, write to the\nFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301 USA.\n\nLinking this library statically or dynamically with other modules is\nmaking a combined work based on this library. Thus, the terms and\nconditions of the GNU General Public License cover the whole\ncombination.\n\nAs a special exception, the copyright holders of this library give you\npermission to link this library with independent modules to produce an\nexecutable, regardless of the license terms of these independent\nmodules, and to copy and distribute the resulting executable under\nterms of your choice, provided that you also meet, for each linked\nindependent module, the terms and conditions of the license of that\nmodule. An independent module is a module which is not derived from\nor based on this library. If you modify this library, you may extend\nthis exception to your version of the library, but you are not\nobligated to do so. If you do not wish to do so, delete this\nexception statement from your version. */\n\n\n</template><template id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment" description\="Comment for created types" context\="typecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment" description\="Comment for fields" context\="fieldcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * \n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment" description\="Comment for non-overriding methods" context\="methodcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment" description\="Comment for overriding methods" context\="overridecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype" description\="Newly created files" context\="newtype_context" enabled\="true" deleted\="false" autoinsert\="false">/* ${file_name} -- FIXME\: briefly describe file purpose\n Copyright (C) ${year} Free Software Foundation, Inc.\n\nThis file is part of GNU Classpath.\n\nGNU Classpath is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2, or (at your option)\nany later version.\n\nGNU Classpath is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GNU Classpath; see the file COPYING. If not, write to the\nFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301 USA.\n\nLinking this library statically or dynamically with other modules is\nmaking a combined work based on this library. Thus, the terms and\nconditions of the GNU General Public License cover the whole\ncombination.\n\nAs a special exception, the copyright holders of this library give you\npermission to link this library with independent modules to produce an\nexecutable, regardless of the license terms of these independent\nmodules, and to copy and distribute the resulting executable under\nterms of your choice, provided that you also meet, for each linked\nindependent module, the terms and conditions of the license of that\nmodule. An independent module is a module which is not derived from\nor based on this library. If you modify this library, you may extend\nthis exception to your version of the library, but you are not\nobligated to do so. If you do not wish to do so, delete this\nexception statement from your version. */\n\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock" description\="Code in new catch blocks" context\="catchblock_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody" description\="Code in created method stubs" context\="methodbody_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated method stub\n${body_statement}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody" description\="Code in created constructor stubs" context\="constructorbody_context" enabled\="true" deleted\="false" autoinsert\="true">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody" description\="Code in created getters" context\="getterbody_context" enabled\="true" deleted\="false" autoinsert\="true">return ${field};</template><template id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody" description\="Code in created setters" context\="setterbody_context" enabled\="true" deleted\="false" autoinsert\="true">${field} \= ${param};</template></templates>
diff --git a/libjava/classpath/AUTHORS b/libjava/classpath/AUTHORS
index 2f021ea0441..339138aef06 100644
--- a/libjava/classpath/AUTHORS
+++ b/libjava/classpath/AUTHORS
@@ -4,7 +4,8 @@ caught bugs or submitted minor patches. If your name does not appear
on either list, but should, let us know. Please keep this list in
alphabetic order.
-Stuart Ballard (stuart.ballard@mcmail.com)
+Lillian Angel (langel@redhat.com)
+Stuart Ballard (stuart.a.ballard@gmail.com)
Mark Benvenuto (mcb54@columbia.edu)
Geoff Berry (gcb@gnu.org)
James E. Blair (corvus@gnu.org)
@@ -12,8 +13,10 @@ Eric Blake (ebb9@email.byu.edu)
Sascha Brawer (brawer@acm.org)
Nic Ferrier (nferrier@tapsellferrier.co.uk)
Paul Fisher (rao@gnu.org)
+David Gilbert (david.gilbert@object-refinery.com)
Anthony Green (green@redhat.com)
Jochen Hoenicke (Jochen.Hoenicke@Informatik.Uni-Oldenburg.de)
+Andrew John Hughes (gnu_andrew@member.fsf.org)
Brian Jones (cbj@gnu.org)
Roman Kennke (roman@kennke.org)
Michael Koch (konqueror@gmx.de)
@@ -25,6 +28,7 @@ Bryce McKinlay (bryce@waitaki.otago.ac.nz)
Audrius Meskauskas (audriusa@Bioinformatics.org)
Aaron M. Renn (arenn@urbanophile.com)
Andrew Selkirk (aselkirk@sympatico.ca)
+Christian Thalinger (twisti@complang.tuwien.ac.at)
Tom Tromey (tromey@cygnus.com)
Ronald Veldema (rveldema@cs.vu.nl)
Mark Wielaard (mark@klomp.org)
diff --git a/libjava/classpath/BUGS b/libjava/classpath/BUGS
index abdb4e4d5e0..aa75439582c 100644
--- a/libjava/classpath/BUGS
+++ b/libjava/classpath/BUGS
@@ -2,4 +2,4 @@ This package is still in the early development phase. That means too
early to start listing bugs in a file like this one!
Report bugs to classpath@gnu.org or much better via Savannah at this
-URL: http://savannah.gnu.org/bugs/?group=classpath
+URL: http://www.gnu.org/software/classpath/bugs.html
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index e1868f26ea2..d40cc1a418c 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,7 +1,9593 @@
+2005-11-15 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/DateTimeSyntax.java,
+ * javax/print/attribute/EnumSyntax.java,
+ * javax/print/attribute/IntegerSyntax.java,
+ * javax/print/attribute/URISyntax.java:
+ Added and enhances some api docs.
+
+2005-11-15 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (gtkWindowGetLocationOnScreen): Added declaration
+ for native function.
+ (getLocationOnScreen): Changed to handle 2 different cases.
+ If the component is a window, gtkWindowGetLocationOnScreen is
+ called; otherwise, gtkWidetGetLocationOnScreen.
+ * include/gnu_java_awt_peer_gtk_GtkComponentPeer.h:
+ Added signature for new function Java_gnu_java_awt_peer_
+ gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen):
+ Implemented.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (JViewport): Recognize setting of a system property
+ gnu.javax.swing.JViewport for the scrollMode.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalUtils.java
+ (fillMetalPattern2D): Fixed the texture width.
+ (initializePattern): Made texture transparent.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (createDefaultModel): Set the filterNewlines property on the created
+ model.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ Fixed API docs all over to better explain the changed (but correct)
+ behaviour.
+ (convertYToRow): Added some short-circuits for special cases. Update
+ the layout state if necessary. Fixed to match the JDK behaviour.
+ Added API docs to better explain the behaviour.
+ (updateLayoutState): When a fixedCellHeight is set, then use the
+ cellHeight field, otherwise use the cellHeights array.
+ (uninstallDefaults): Removed unnecessary statement.
+ (paintBackground): Removed unnecessary method.
+ (paintCell): Removed some commented-out code.
+ (paint): Removed call to paintBackground().
+ (locationToIndex): Removed unused statement.
+
+2005-11-14 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/AttributeSetUtilities.java:
+ Added api docs and enhanced api docs all over the place.
+ (verifyCategoryForValue): Throw exception when arguments
+ are _not_ equal and throw NPE also if attribute is null.
+
+2005-11-14 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (getLocationOnScreen): The insets should be taken into account
+ when returning the location of an object on the screen.
+
+2005-11-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JMenuBar.java:
+ (removeNotify): Unregister this JMenuBar from the KeyboardManager.
+ * javax/swing/KeyboardManager.java:
+ (unregisterJMenuBar): New implementation method.
+
+2005-11-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (removeNotify): Removed unncessary InputMap and ActionMap inheritance
+ code. Added FIXME to remove the WHEN_IN_FOCUSED_WINDOW bindings from
+ the KeyboardManager.
+ * javax/swing/JMenuBar.java:
+ (removeNotify): Added FIXME to unregister this JMenuBar from the
+ KeyboardManager.
+
+2005-11-14 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/HashAttributeSet.java:
+ Added api docs to class and clarified method documentation.
+ (toArray): Get iterator from values instead of entries.
+ (hashCode): Compute hashcode according to specification.
+ (get): Throw NullPointerException if category is null.
+ (HashAttributeSet(Attribute[],Class)): Changed to allow
+ Attribute[] to be null.
+
+2005-11-14 Mark Wielaard <mark@klomp.org>
+
+ As suggested by Joao Victor <jvital@gmail.com>:
+ * javax/swing/Timer.java (Waker): Removed class.
+ (Task): New class.
+ (timer): New field.
+ (running): Removed field.
+ (waker): Likewise.
+ (task): New field.
+ (isRunning): Check whether task is null.
+ (start): Create task and schedule it with timer.
+ (stop): Cancel task and clear field.
+ (queueEvent): Synchronized on queueLock.
+
+2005-11-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (expandPath): No need to get the parent path.
+ * javax/swing/event/TreeModelEvent.java:
+ Variables should be initialized to null.
+ (toString): Implemented.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (treeStructureChanged): Implemented.
+ (getParent): Added check to avoid infinite loop.
+ (findNode): Fixed check to use getChild, instead of
+ getIndexOfChild.
+ (updateCurrentVisiblePath): Added a loop to check
+ the parent's sibling, if the current node has no
+ other siblings.
+
+2005-11-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ActionMap.java:
+ (keys): Return null if the map is empty.
+ (allKeys): Likewise.
+ * javax/swing/InputMap.java:
+ (keys): Return null if the map is empty.
+ (allKeys): Likewise.
+ * javax/swing/JMenuBar:
+ (addNotify): Register the menu with the KeyboardManager.
+ (processKeyBinding): New API method.
+ (processKeyBindingHelper): New implementation method.
+ * javax/swing/JMenuItem.java:
+ (setAccelerator): Fire a PropertyChangeEvent after changing the
+ accelerator.
+ * javax/swing/KeyboardManager.java:
+ (menuBarLookup): New field, Hashtable mapping between top-level
+ containers and a Vector of the JMenuBars contained in them.
+ (getHashtableForTopLevel): Changed this public method to package
+ private.
+ (registerEntireMap): Avoid NPE by returning early if the parameter
+ is null or contains no mappings.
+ (processKeyStroke): If the mapped component doesn't consume the event,
+ let all JMenuBars in the top-level container have a chance at it.
+ (getVectorForTopLevel): New implementation method.
+ (registerJMenuBar): Likewise.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ (propertyChangeListener): New field.
+ (PropertyChangeHandler): New class to handle PropertyChangeEvents on
+ the JMenuItem.
+ (ClickAction): New class to implement accelerator key handling.
+ (BasicMenuItemUI<init>): Instantiate the propertyChangeListener field.
+ (installKeyboardActions): Implemented.
+ (installListeners): Install the propertyChangeListener.
+ (installUI): Call installKeyboardAcions after installing the listeners.
+ (uninstallKeyboardActions): Implemented.
+ (uninstallListeners): Remove the propertyChangeListener.
+
+2005-11-14 Tom Tromey <tromey@redhat.com>
+
+ * java/applet/Applet.java (URLAudioClip): New class.
+ (newAudioClip): Implemented.
+ * gnu/java/beans/DummyAppletContext.java (getAudioClip): Use
+ Applet.newAudioClip.
+ (DUMMY_CLIP): Removed.
+ (DummyAudioClip): Removed.
+
+2005-11-14 Tom Tromey <tromey@redhat.com>
+
+ * javax/sound/sampled/Line.java (open): Throws
+ LineUnavailableException.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ Reported by Ingo Proetel <proetel@aicas.com>
+ * gnu/java/io/PlatformHelper.java
+ (toCanonicalForm): Remove lowercasing of paths in Windows. This
+ breaks working with URLs, like when accessing files withing JAR
+ files.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (paint): Only clear the background if the layeredPane is opaque.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/RepaintManager.java
+ (globalManager): Removed obsolete field.
+ (currentRepaintManagers): New field.
+ (RepaintWorker.run): Fetch current RepaintManager for the current
+ thread group.
+ (currentManager): Return the current manager for the current thread
+ group.
+ (setCurrentManager): Set the repaint manager for the current thread
+ group.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (show): Instead of fiddling with the list size, set the preferredSize
+ of the scroller.
+ (configureScroller): Set border to null.
+ (configurePopup): Set border correctly.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (setButtonIcons): Only set icons if buttons are != null.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed some UI defaults used by ProgressBar.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextFieldUI.java
+ (propertyChange): Get new value from the PropertyChangeEvent and
+ not from the component itself (since when it receives the event,
+ the component still has the old state).
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (uninstallListeners): Uninstall the document listener here.
+ (getVisibleEditorRect): Fetch the textComponent via getComponent().
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (paint): Only paint child if it is inside the current clip.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (setEnabled): Also set focusable flag on the button when the enabled
+ property changes.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicProgressBarUI.java
+ (boxRect): New protected field.
+ (PropertyChangeHandler.propertyChange): Fixed typo in 'indeterminate'.
+ Only start animation when progressBar is actually showing. Removed
+ repaint call.
+ (AncestorHandler): New inner class. Helps starting/stopping the
+ animation when progressBar becomes showing/hidden.
+ (ComponentHandler): New inner class. Recalculates box sizes for
+ indeterminate progress bars when the size of the progress bar
+ changes.
+ (boxRect): New protected field.
+ (boxDependent): New transient field.
+ (boxIndependent): New transient field.
+ (incr): New transient field.
+ (ancestorListener): New private field.
+ (componentListener): New private field.
+ (getBox): Fixed calculation of the indeterminate progress bar box
+ to match the JDK behaviour.
+ (getMaximumSize): Implemented the maximumSize for progressBars.
+ (getMinimumSize): Implemented the minimumSize for progressBars.
+ (getPreferredInnerHorizontal): Implemented correctly.
+ (getPreferredInnerVertical): Implemented correctly.
+ (getPreferredSize): Implemented correctly using the getPreferredXXX()
+ helper methods.
+ (paintDeterminate): Fixed painting to better match the JDK behaviour.
+ (paintIndeterminate): Fixed painting to better match the JDK behaviour.
+ (paintString): Implemented 'half-dark-half-light' painted text.
+ (installListeners): Install new listeners.
+ (uninstallListeners): Uninstall new listeners.
+ * javax/swing/plaf/basic/MetalProgressBarUI.java
+ (paintDeterminate): New method.
+ (paintIndeterminate): New method.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (static_initializer): Set the L&F and theme explicitly for the
+ default option, because JDK1.4 and JDK1.5 have different defaults.
+ (mkMenuBar): For the slider demo, trigger the new SliderDemo
+ class. Added ProgressBarDemo to menu.
+ (mkSliders): Removed obsolete slider demo.
+ (mkButtonBar): Added ProgressBar demo.
+ * examples/gnu/classpath/examples/swing/ProgressBarDemo.java:
+ New file. Demonstrates the JProgressBar.
+
+2005-11-13 Archie Cobbs <archie@dellroad.org>
+
+ * vm/reference/gnu/classpath/VMStackWalker.java (getClassLoader()):
+ added to fix an infinite loop bug.
+ * NEWS: note VM interface change.
+
+2005-11-13 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #23008
+ * gnu/java/nio/charset/UTF_16Decoder.java
+ MAYBE_BIG_ENDIAN, MAYBE_LITTLE_ENDIAN: New constants representing
+ such endianness which is similar to UNKNOWN_ENDIAN but defaults
+ to big/little endian without a byte order mark.
+ (decodeLoop): Handle MAYBE_BIG_ENDIAN and MAYBE_LITTLE_ENDIAN.
+ * gnu/java/nio/charset/UnicodeLittle.java
+ (newDecoder): Set the endianness to MAYBE_LITTLE_ENDIAN.
+
+2005-11-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR 24733
+ * javax/swing/TransferHandler.java (getClipboard): Rewritten.
+
+2005-11-13 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/HashDocAttributeSet.java,
+ * javax/print/attribute/HashPrintJobAttributeSet.java,
+ * javax/print/attribute/HashPrintRequestAttributeSet.java,
+ * javax/print/attribute/HashPrintServiceAttributeSet.java,
+ Added class api docs and enhanced method api docs.
+
+2005-11-13 Tom Tromey <tromey@redhat.com>
+
+ * native/jni/midi-dssi/.cvsignore: Updated.
+ * native/jni/midi-alsa/.cvsignore: New file.
+ * lib/.cvsignore: Updated.
+
+2005-11-13 Tom Tromey <tromey@redhat.com>
+
+ * javax/sound/sampled/AudioFileFormat.java: New file.
+ * javax/sound/sampled/AudioFormat.java: New file.
+ * javax/sound/sampled/AudioInputStream.java: New file.
+ * javax/sound/sampled/AudioPermission.java: New file.
+ * javax/sound/sampled/AudioSystem.java: New file.
+ * javax/sound/sampled/BooleanControl.java: New file.
+ * javax/sound/sampled/Clip.java: New file.
+ * javax/sound/sampled/CompoundControl.java: New file.
+ * javax/sound/sampled/Control.java: New file.
+ * javax/sound/sampled/DataLine.java: New file.
+ * javax/sound/sampled/EnumControl.java: New file.
+ * javax/sound/sampled/FloatControl.java: New file.
+ * javax/sound/sampled/LineEvent.java: New file.
+ * javax/sound/sampled/Line.java: New file.
+ * javax/sound/sampled/LineListener.java: New file.
+ * javax/sound/sampled/LineUnavailableException.java: New file.
+ * javax/sound/sampled/Mixer.java: New file.
+ * javax/sound/sampled/Port.java: New file.
+ * javax/sound/sampled/ReverbType.java: New file.
+ * javax/sound/sampled/SourceDataLine.java: New file.
+ * javax/sound/sampled/spi/AudioFileReader.java: New file.
+ * javax/sound/sampled/spi/AudioFileWriter.java: New file.
+ * javax/sound/sampled/spi/FormatConversionProvider.java: New file.
+ * javax/sound/sampled/spi/MixerProvider.java: New file.
+ * javax/sound/sampled/TargetDataLine.java: New file.
+ * javax/sound/sampled/UnsupportedAudioFileException.java: New file.
+
+2005-11-13 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/EnumSyntax.java:
+ API docs added and enhanced for class and methods.
+ (readResolve): New method.
+
+2005-11-13 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/Attribute.java,
+ javax/print/attribute/AttributeSet.java,
+ javax/print/attribute/DocAttribute.java,
+ javax/print/attribute/DocAttributeSet.java,
+ javax/print/attribute/PrintJobAttribute.java,
+ javax/print/attribute/PrintJobAttributeSet.java,
+ javax/print/attribute/PrintRequestAttribute.java,
+ javax/print/attribute/PrintRequestAttributeSet.java,
+ javax/print/attribute/PrintServiceAttribute.java,
+ javax/print/attribute/PrintServiceAttributeSet.java,
+ javax/print/attribute/SupportedValuesAttribute.java,
+ javax/print/attribute/UnmodifiableSetException.java:
+ Added api documentation to class and method definitions.
+ * javax/print/attribute/package.html: Included a package description.
+
+2005-11-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/gnuIorInfo.java (state): Made public.
+ * gnu/CORBA/Interceptor/gnuServerRequestInfo.java
+ (adapter_name, orb_id, server_id): New methods.
+ * org/omg/PortableInterceptor/IORInfoOperations.java
+ (state): New method.
+ * org/omg/PortableInterceptor/ServerRequestInfoOperations.java
+ (adapter_name, orb_id, server_id): New methods.
+
+2005-11-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR 24749
+ * javax/swing/plaf/basic/BasicTextUI.java (installDefaults):
+ Call setSelectionColor.
+
+2005-11-12 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/io/ObjectInputStream.java
+ (processResolution): Pass Error, RuntimeException and
+ ObjectStreamException through to the caller.
+ (readObject): Documentation update.
+
+2005-11-11 Mark Wielaard <mark@klomp.org>
+ Anthony Green <green@redhat.com>
+
+ * java/util/Properties.java (load): Short-circuit parsing when key or
+ value doesn't contain escape character. Use StringBuilder instead of
+ StringBuffer.
+ (store): Use StringBuilder instead of StringBuffer.
+ (formatForOutput): Likewise.
+
+2005-11-11 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (getMinimumDividerLocation): Fixed to use the minimum size
+ of the correct component. Also, removed call to getAvailableSize,
+ this is not needed for the minimum location.
+
+2005-11-11 Archie Cobbs <archie@dellroad.org>
+
+ * autogen.sh: Fix broken libtool version detection on FreeBSD.
+
+2005-11-11 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Container.java
+ (LightweightDispatcher.acquireComponentForMouseEvent): If the
+ event is not being dispatched, the pressCount should be reset.
+
+2005-11-11 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/FieldView.java (getPreferredSpan): Chain
+ BadLocationException when throwing assertion.
+
+2005-11-11 Mark Wielaard <mark@klomp.org>
+
+ Reported by john.zigman@anu.edu.au as bug #24608.
+ * gnu/java/nio/SocketChannelImpl.java (read): Put readBytes in
+ destination ByteBuffer when it doesn't have an array instead of len
+ bytes.
+
+2005-11-11 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/IORInterceptor_3_0.java,
+ org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java,
+ org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java,
+ org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java,
+ org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java: New files.
+ * gnu/CORBA/Interceptor/IORInterceptors.java,
+ gnu/CORBA/Interceptor/gnuIorInfo.java,
+ gnu/CORBA/OrbRestricted.java,
+ gnu/CORBA/Poa/AOM.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuPOAManager.java,
+ org/omg/PortableInterceptor/IORInfoOperations.java,
+ org/omg/PortableInterceptor/IORInterceptorOperations.java,
+ org/omg/PortableInterceptor/ORBInitInfoOperations.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java:
+ Rewritten to support the IORInterceptor_3_0.
+
+2005-11-10 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (paintFocus): Centered border around rectangle. It seemed
+ a bit offset and too small at times.
+
+2005-11-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ (valueChanged): Repaint list when selection changed.
+ (updateLayoutState): Reworked to correctly respect fixed cell sizes.
+ (installListeners): Create component listener before adding it.
+ (paint): Optimized to only draw the cells in the clip.
+
+2005-11-10 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (processKeyEvent): Reworked this method to improve performance. Return
+ early if the event has already been handled. Don't stop climbing when
+ we hit a JInternalFrame, only stop at Applets or Windows (this fixes
+ PR 24781). Don't check WHEN_IN_FOCUSED_WINDOW bindings if there is no
+ top-level container present. If there is a top-level container, pass
+ it to KeyboardManager.processKeyStroke rather than the JComponent that
+ actually received the event, to save time in finding the top-level
+ container within KeyboardManager.
+ * javax/swing/KeyboardManager.java:
+ (findTopLevel): Changed parameter from JComponent to Component to allow
+ generality and to allow passing in of already-determined top-level
+ containers to save time.
+ (processKeyStroke): Likewise.
+
+2005-11-10 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #24731 reported by freebeans@xqb.biglobe.ne.jp.
+ * java/awt/ScrollPane.java (addNotify): Return immediately when peer
+ already set.
+
+2005-11-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installListeners): Also install focusListener on the listBox.
+ (uninstallListeners): Also uninstall focusListener from the listBox.
+ (setPopupVisible): Request focus on the listbox when making the
+ popup visible.
+
+2005-11-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintingTile): New field.
+ (isPaintingTile): Implemented.
+ (paintChildren): Optimized painting of overlapping children.
+
+2005-11-10 Mark Wielaard <mark@klomp.org>
+
+ Reported by Petteri <betelgeuse@gentoo.org> bug #24768 and bug #24769.
+ * configure.ac (dssi): Change accidental alsa reference to dssi.
+ * native/jni/midi-dssi/Makefile.am (libgjsmdssi_la_SOURCES): Add
+ dssi_data.h.
+
+2005-11-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/OrbFunctional.java (use_properties, set_parameters):
+ Rewritten to support orb and server ids.
+ * org/omg/CORBA/ORB.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplate.java:
+ Documentation update.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (addNotify): Unregister all WHEN_IN_FOCUSED_WINDOW bindings for this
+ JComponent and then register them with its (potentially) new top level
+ ancestor. Removed unncessary code that copied regular (WHEN_FOCUSED)
+ key bindings up the parent hierarchy.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ Reported by Friedjof Siebert <siebert@aicas.com>
+ * java/util/WeakHashMap.java
+ (WeakEntrySet.Iterator.checkMod): Improved exception message.
+ (internalRemove): Removed redundant reads of buckets[slot] and
+ prev.next and added checks to ensure that no null pointer
+ exception may occur and that this can be proved automatically.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ Reported by Friedjof Siebert <siebert@aicas.com>
+ * java/io/PrintWriter.java
+ (line_separator): Added default value for property to ensure
+ absence of null pointer exception even if property is not set.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * java/io/InputStreamReader.java
+ (InputStreamReader(InputStream, CharsetDecoder)): Catch the case
+ when the CharsetDecoder returns a null charset and handle it like
+ US-ASCII.
+
+2005-11-09 Mark Wielaard <mark@klomp.org>
+
+ Reported by Petteri Räty <betelgeuse@gentoo.org>
+ * INSTALL: Remove double --enable-xmlj entry.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (processKeyEvent): Use local variables for boolean pressed and for
+ the KeyStroke. Implemented the code for WHEN_IN_FOCUSED_WINDOW
+ bindings.
+ (updateComponentInputMap): Implemented and fixed typo in docs.
+ * javax/swing/KeyboardManager.java: New class.
+
+2005-11-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTabbedPane.java
+ (setComponent): Tab should be inserted with a title, and removed from
+ the vector once set.
+ (removeTabAt): Tab should only be removed from vector.
+ remove(Component) is called to remove the tab from the JTabbedPane.
+ (remove): Added call to the component. This function should remove
+ the component as well as the tab.
+
+2005-11-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTabbedPane.java
+ (setComponent): No need to remove and add tab.
+ (remove): Fixed API documentation.
+ (remove): Fixed API documentation. Re-implemented according to API.
+
+2005-11-09 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/cp-tools/cp-tools.wml: Add gjdoc download link.
+
+2005-11-09 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/aelfred2/SAXDriver.java: Ensure that absolutize does not
+ throw exception when custom entity resolver is set.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/event/InvocationEvent.java:
+ (exception): Replaced this field (removed yesterday) because it is
+ needed for serialization.
+ (dispatch): Save thrown exception.
+ (getException): Directly return exception, no need to cast throwable.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ComponentInputMap.java:
+ (put): Notify the component.
+ (clear): Likewise.
+ (remove): Likewise.
+ (setParent): Notify the parent. Improved the exception messages.
+ * javax/swing/JComponent.java:
+ (inputMap_whenInFocusedWindow): Changed type from InputMap to
+ ComponentInputMap.
+ (setInputMap): If we're setting the WHEN_IN_FOCUSED_WINDOW map and
+ the parameter is not a ComponentInputMap or is not associated with
+ the same Component, throw an IllegalArgumentException.
+ (getInputMap): Create a new ComponentInputMap instead of a new
+ InputMap when the WHEN_IN_FOCUSED_WINDOW map doesn't yet exist.
+ (udpateComponentInputMap): New method. This is the method that
+ ComponentInputMap calls when it is updated. Not yet completely
+ implemented.
+
+2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java:
+ New files.
+
+2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceTemplate.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java:
+ New files.
+
+2005-11-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTabbedPane.java
+ (setComponent): Added check to prevent infinite loops.
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ (createLayoutManager): Should call super here, so the layout
+ is set properly depending on the layout mode.
+
+2005-11-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkMenuBar): added file chooser item,
+ (mkButtonBar): split buttons into two rows, added 'FileChooser' button,
+ * examples/gnu/classpath/examples/swing/FileChooserDemo.java: New file.
+
+2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceFactory.java: Do not
+ inherit from org.omg.CORBA.Object.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ComponentUI.java
+ (update): Restore the foreground color after filling the background.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Fetch a new componentGraphics here instead of
+ paintComponent.
+ (paintComponent): Don't fetch the componentGraphics here. This
+ must be done in paint.
+
+2005-11-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JList.java
+ (setModel): throw IllegalArgumentException for null model.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (getVisibleEditorRect): Correctly calculate the inner rectangle.
+
+2005-11-09 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (initStaticState): Register global variable glyphVector_class
+ as global reference.
+
+2005-11-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/text/DefaultCaret.java (BlinkTimerListener):
+ Added ignoreNextEvent flag and its handling.
+ (blinkListener): New field. (initBlinkTimer):
+ Initialise blinkListener field.
+ (setDot, moveDot): Call appear() instead of repaint().
+ (appear): new method.
+
+2005-11-08 Lillian Angel <langel@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/GNULookAndFeel.java
+ (getDefaults): Added icons for checkboxes and radiobutton.
+ (CheckBoxIcon): New class, implemented.
+ (RadioButtonIcon): New class, implemented.
+
+2005-11-08 Tom Tromey <tromey@redhat.com>
+
+ * gnu/classpath/SystemProperties.java: Don't mention
+ gnu.java.awt.FocusManager.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/CompositeView.java
+ (modelToView): Adjust the allocation to the child allocation before
+ forwarding to the child's modelToView. Replaced AssertionError by
+ BadLocationException, because that is the right thing to do here.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (GlassPaneDispatcher.acquireComponentForMouseEvent): Use the
+ frame's layeredPane as parent instead of the content pane
+ when searching for the event target. This way a possibly set menubar
+ is also included in the search.
+
+2005-11-08 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (setLocationRelativeTo): Changed x and y to use getLocationOnScreen
+ and moved setLocation call outside of check.
+ * javax/swing/JOptionPane.java
+ (createDialog): Moved pack call and setLocationRelativeTo call here
+ and removed these calls from all other functions that call
+ createDialog. Also, removed FIXME, since call to setLocationRelativeTo
+ fixes this.
+ (showConfirmDialog): Removed pack and setLocationRelativeTo calls.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showOptionDialog): Likewise.
+ * javax/swing/JTree.java
+ (JTree): Should not use a shared instance of the selection model. It
+ is a problem when one application has two different trees.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintRow): Changed parameter to be the focus of the tree.
+ (updateCurrentVisiblePath): Adjusted root path incase the root is hidden.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/event/InvocationEvent.java:
+ (exception): Removed unnecessary field.
+ (dispatch): Removed reference to field exception.
+ (getException): If throwable is an Exception, return a casted version,
+ otherwise return null.
+ (getThrowable): Improved docs.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/SwingUtilities.java:
+ (replaceUIActionMap): Stop climbing hierarchy once we've found an
+ ActionMapUIResource, don't keep looking until parent is null. No need
+ to check if child is null.
+ (replaceUIInputMap): Use a local variable for the parent rather than
+ 3 calls to get parent. No need to check if child is null.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ (installKeyboardActions): UI ActionMap should be of type
+ ActionMapUIResource, not just ActionMap.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultStyledDocument.java:
+ (ElementBuffer.clone): New API method.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/String.java:
+ (replace): Use a StringBuilder instead of a StringBuffer because this
+ is faster and we don't need thread-safety.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Initialize background field correctly.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/BorderLayout.java
+ (getAlignmentX): Return 0.5F here.
+ (getAlignmentY): Return 0.5F here.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JRootPane.java
+ (RootLayout.glassPaneBounds): New field.
+ (RootLayout.layeredPaneBounds): New field.
+ (RootLayout.contentPaneBounds): New field.
+ (RootLayout.menuBarBounds): New field.
+ (RootLayout.prefSize): New field.
+ (getLayoutAlignmentX): Return 0.0F here.
+ (getLayoutAlignmentY): Return 0.0F here.
+ (invalidateLayout): Throw away cached layout information.
+ (layoutContainer): Simplified and fixed the layout. Use cache if
+ possible.
+ (preferredLayoutSize): Simplified and fixed the layout. Use cache if
+ possible.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (alignmentX): Changed default value to -1.0.
+ (alignmentY): Changed default value to -1.0.
+ (getAlignmentX): If no value has been set, refer to the superclass
+ behaviour.
+ (getAlignmentY): If no value has been set, refer to the superclass
+ behaviour.
+ (setAlignmentX): Catch invalid values and adjust them to the nearest
+ valid value.
+ (setAlignmentY): Catch invalid values and adjust them to the nearest
+ valid value.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Container.java
+ (getAlignmentX): Refer to the layout managers layoutAlignmentX
+ property if layout manager is a LayoutManager2.
+ (getAlignmentY): Refer to the layout managers layoutAlignmentY
+ property if layout manager is a LayoutManager2.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (layerToRange): Return empty array for unknown layer instead of
+ throwing an exception.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (invalidate): Don't invalidate invalid parents.
+
+2005-11-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/JComponent.java (setMaximumSize,
+ setMinimumSize, setPreferredSize): Clone the passed parameter.
+
+2005-11-07 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (invalidate): Invalidate up the whole tree, regardless if some
+ parent is already marked invalid. This is needed in some situations
+ for layout managers to throw away their cache.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (tableChanged): Cleared selection if there are no more rows. Prevents a
+ NPE.
+ * javax/swing/JTree.java
+ (scrollRectToVisible): No need to set the selection path here.
+ (expandPath): Sometimes it is required to set the state of a leaf,
+ especially if the leaf is the root node.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getRowCount): Added call to updateCurrentVisiblePath, so the
+ correct value is always returned.
+ (paint): No need to paint if the visible path is null.
+ (propertyChange): Implemented.
+ (paintRecursive): Added check for visibility of child. If it is
+ not visible because it was explicitly set to be hidden, no lines
+ should be drawn.
+ (paintControlIcons): Likewise.
+ (getPreviousNode): Fixed check to include root.
+ (paintRow): Set focus to be true (this will change in the future).
+ (updateCurrentVisiblePath): Fixed check to call getNextNode if
+ the current node is a leaf (more efficent than calling getNextSibling).
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (getTreeCellRendererComponent): Changed to draw border if node has focus.
+
+2005-11-07 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #24467
+ * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
+ (Java_gnu_java_nio_charset_iconv_IconvDecoder_decode):
+ Do not check errno == EINVAL, which is a normal case.
+
+2005-11-07 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #22968
+ * gnu/java/nio/charset/iconv/IconvProvider.java
+ (IconvProvider): Declare the constructor public.
+
+2005-11-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JApplet.java
+ (initStageDone): Removed unnecessary field.
+ (JApplet): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JDialog.java
+ (initStageDone): Removed unnecessary field.
+ (dialogInit): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JFrame.java
+ (initStageDone): Removed unnecessary field.
+ (frameInit): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JWindow.java
+ (initStageDone): Removed unnecessary field.
+ (windowInit): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JInternalFrame.java
+ (initStageDone): Removed unnecessary field.
+ (JInternalFrame): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ (paramString): Return superclass paramstring.
+ (reshape): Call revalidate() instead of invalidate() and doLayout().
+ (setUI): Temporarily go into init mode, so that the UI can
+ manipulate the frame directly.
+ (updateUI): Likewise.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/String.java:
+ (replace): Use a StringBuffer instead of String. Only search for new
+ occurrences of the target that occur AFTER the text just inserted, so
+ if the replacement string contains the target string we won't go into
+ an infinite loop. Use local variables instead of repeated calls to
+ length() and toString().
+
+2005-11-07 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
+ Use long for 64-bit architectures.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/util/Arrays.java:
+ (toString(long[])): New API method.
+ (toString(int[])): Likewise.
+ (toString(short[])): Likewise.
+ (toString(char[])): Likewise.
+ (toString(byte[])): Likewise.
+ (toString(boolean[])): Likewise.
+ (toString(float[])): Likewise.
+ (toString(double[])): Likewise.
+ (toString(Object[])): Likewise.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/event/InvocationEvent.java:
+ (throwable): New field.
+ (getThrowable): New API method.
+ (dispatch()): Catch Throwable, not Exception. Save the Throwable. If
+ it is an Exception, save the Exception.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/Popup.java
+ (show): Set layout for panel. Otherwise, contents are
+ displayed at an arbitrary location.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPreferredMenuItemSize): Took into account insets.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (paintFocus): Don't paint focus if not enabled.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/String.java:
+ (contains): New API method.
+ (replace): New API method.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/Boolean.java:
+ (compareTo(Boolean)): New API method.
+
+2005-11-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): update local reference to editor component always,
+ (getDisplaySize): implement new calculation for editable combo boxes,
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ (editorBorderInsets): initialise with correct value,
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (getMinimumSize): implemented different calculation for editable combo
+ boxes.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JOptionPane.java
+ (showConfirmDialog): Added call to set the location of the
+ dialog relative to its parent.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showOptionDialog): Likewise.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPreferredMenuItemSize): Adjusted width of menu item with
+ arrow icon. If the menu item can fit in the current width of
+ the top level menu, then the width of the menu item is set to
+ the width of the popup menu. Otherwise, the width of the
+ menu item is adjusted so that the width of the popup menu
+ is increased.
+
+2005-11-07 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Don't check or replace FREETYPE2.
+ * native/jni/gtk-peer/Makefile.am: Remove FREETYPE2_LIBS and
+ FREETYPE2_CFLAGS.
+
+2005-11-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ (MetalComboBoxEditor): don't create new editor.
+
+2005-11-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxEditor.java: API docs plus
+ (BasicComboBoxEditor): set border to null and columns to 9,
+ (addActionListener): implemented,
+ (removeActionListener): implemented.
+
+2005-11-07 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/IOR.java (equals, hasCode): Compare port number as well
+ and do not crash on IOR.Internet==null.
+
+2005-11-06 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/Timer.java (Waker.run): Test and set running while
+ holding queueLock.
+ (start): Set running to true.
+ (stop): Unconditionally notify queueLock.
+ (queueEvent): Only called when queueLock already held.
+
+2005-11-06 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked): Update
+ debug output to reflect actual situation.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels): Adjust
+ formatting.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked):
+ Update debug output to reflect actual situation.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo): Adjust
+ formatting.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked):
+ Update debug output to reflect actual situation.
+
+2005-11-06 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/image/AreaAveragingScaleFilter.java: Add FIXME
+ * java/awt/Image.java (getScaledInstance): In case of
+ SCALE_AREA_AVERAGING use AreaAveragingScaleFilter.
+
+2005-11-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/event/PrintEvent.java,
+ * javax/print/event/PrintJobAdapter.java,
+ * javax/print/event/PrintJobAttributeEvent.java,
+ * javax/print/event/PrintJobAttributeListener.java,
+ * javax/print/event/PrintJobEvent.java,
+ * javax/print/event/PrintJobListener.java,
+ * javax/print/event/PrintServiceAttributeEvent.java,
+ * javax/print/event/PrintServiceAttributeListener.java,
+ * javax/print/event/package.html: Added API docs all over.
+
+2005-11-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/io/File.java
+ (getParent): If pathname is "" return null.
+ (toURI): Also append separatorChar if path equals "".
+ (getAbsolutePath): If path equals "" only return the value
+ of the user.dir system property.
+
+2005-11-06 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream/XMLStreamWriterImpl.java: Ensure that generated
+ prefixes do not accidentally clash, and provide documentation for
+ new virtual methods. createPrefix (new method) signature changed to
+ provide namespace URI for the benefit of subclasses.
+
+2005-11-06 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/transform/StreamSerializer.java: Avoid undeclared apos
+ entity when output mode is HTML.
+
+2005-11-06 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/IOR.java (equals, hashCode): New metods.
+ * gnu/CORBA/SimpleDelegate.java (is_equivalent): Compare IORs when applicable.
+
+2005-11-06 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Minor.java (IOR_missing): New minor code.
+ * gnu/CORBA/NamingService/NameParser.java (corbaloc): Implemented
+ file//, ftp:// and http:// support.
+ * gnu/javax/rmi/CORBA/UtilDelegateImpl.java (mapSystemException):
+ Set the cause directly.
+ * org/omg/CORBA/DATA_CONVERSION.java,
+ org/omg/CORBA/ORB.java (string_to_object): Documentation update.
+
+2005-11-06 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream/XMLStreamWriterImpl.java: Fixed handling of
+ namespaces when isPrefixDefaulting is set.
+
+2005-11-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultStyledDocument.java: Reformatted.
+
+2005-11-04 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (setLocationRelativeTo): Implemented case when
+ component is not null.
+
+2005-11-04 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/image/BufferedImage.java (BufferedImage): Implement
+ Transparency.
+ (getTransparency): New method.
+
+2005-11-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/SocketRepository.java (sockets): Changed type to
+ HashMap. (put_socket, get_socket, gc):
+ Always synchronize on 'sockets'.
+
+2005-11-04 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.20-pre.
+
+2005-11-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/StyleConstants.java:
+ (Family): New API field.
+ (Size): New API field.
+
+2005-11-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): Changed to use isTopLevelMenu rather than checking
+ instance of parent.
+ * javax/swing/plaf/basic/BasicPopupMenuUI.java
+ (popupMenuWillBecomeInvisible): Added check to prevent NPE.
+ * javax/swing/Popup.java:
+ Added new private field.
+ (LightweightPopup): Initialized layeredPane.
+ (show): Removed unneeded code.
+ (hide): Likewise.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (updateUI): Set the background and foreground color fields to null
+ here so that installing the LabelUI does not interfere with our
+ custom set colors.
+ (getTableCellRendererComponent): Only set UI focus colors when
+ cell is actually editable. Added optimization for the case
+ when background is equal to table background.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Call super.setBackground() or
+ super.setForeground() to avoid overriding custom set background or
+ foreground colors. Set the UI focus colors when focused.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * examples/gnu/classpath/examples/swing/TextFieldDemo.java: New file.
+ Demonstrates the JTextFields in various states.
+ * examples/gnu/classpath/examples/swing/Demo.java: Replaced the
+ old textfield demo with the new one.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (getMinimumSize): New method.
+ * javax/swing/text/FieldView.java
+ (getPreferredSpan): Added assert that replaces a 'should never happen'
+ comment.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (getTiledSizeRequirements): Added check for overflows.
+ (adjustGreater): Fixed overflow handling through usage of long
+ instead of int.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (positionCaret): Call setDot instead of moveDot.
+ * javax/swing/text/PlainView.java
+ (viewToModel): Exclude the final newline character from calculation.
+
+2005-11-03 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/announce/20051102.wml: New file.
+ * doc/www.gnu.org/newsitems.txt: Add 0.19 release announcement.
+ * doc/www.gnu.org/downloads/downloads.wml: Add 0.19.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (background): New field.
+ (foreground): New field.
+ (setBackground): Store the color that is set here.
+ (setForeground): Store the color that is set here.
+ (getTableCellRendererComponent): For the unselected color, set the
+ value of the foreground or background fields if not null, otherwise
+ the value of the according table properties. Don't change
+ the color in the focused clause.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mousePressed): If the control icon is clicked, the
+ path selected should not be changed.
+ (paintRecursively): Moved call to getChildCount before
+ loop.
+ (paintRow): Added a check to prevent NPE.
+ (updateCurrentVisiblePath): Made this slightly more efficent.
+ Instead of checking each path, we can check the siblings if the
+ current node is not expanded.
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Fixed indentation, and changed
+ to set the background color if it is not an instance of
+ ColorUIResource. Prevents overriding a user-set color.
+
+2005-11-03 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java: Fixed some > 80 chars lines.
+ (drawSelectedText): Fixed startOffset for call to
+ Utilities.drawTabbedText to make sure tabs are properly expanded.
+ (drawUnselectedText): Likewise.
+ (getMinimumSpan): New API method.
+ (getMaximumSpan): New API method.
+ (setSize): Call preferenceChanged if the width has changed.
+ (WrappedLine.determineNumLines): Move numLines=0 to the top in case
+ the early return happens, numLines will still be correct.
+ (WrappedLine.updateDamage): New implementation method called by
+ insertUpdate and removeUpdate to repaint the appropriate part of the
+ JTextArea.
+ (WrappedLine.insertUpdate): New method.
+ (WrappedLine.removeUpdate): New method.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Fixed so that the label is
+ painted with the correct background color. Does not depend on
+ type of border. Removed this code.
+
+2005-11-03 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/JTextComponent.java:
+ (select): The end index cannot be smaller than the start index, changed
+ Math.max(end, 0) to Math.max(end, start).
+ * javax/swing/text/WrappedPlainView.java:
+ (selectionStart): New package private field.
+ (selectionEnd): Likewise.
+ (drawLine): Implemented to call drawUnselectedText and drawSelectedText
+ on the appropriate parts of the line. Before it just drew the whole
+ line with drawUnselectedText.
+ (paint): Store the start and end of the selection.
+ (WrappedLine.paint): Set the selected color to Color.WHITE.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Should only draw focus if the border
+ is not an empty border.
+
+2005-11-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR swing/24650
+ * javax/swing/text/PlainView.java (viewToModel)):
+ The end of line symbol (0xA), if being the last member in the
+ obtained text, should not be counted.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Changed field to be the gap between the different
+ menu's instead. defaultTextArrowGap is not needed.
+ (getPreferredMenuItemSize): Adjusted preferred size of
+ Menu Item with an arrowIcon to be the size of the
+ popupMenu. If its parent is not a popupMenu, then
+ it is a new Menu on a MenuBar.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (paintFocus): Height of focus border should not be
+ adjusted. It was being cutoff.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.getNextVisualPositionFrom): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (AttributeUndoableEdit): New inner class.
+ (StyleChangeListener): New inner class.
+ (styleChangeListener): New field.
+ (addStyle): Add styleChangeListener to new style.
+ (getStyleNames): New method.
+ (styleChanged): New method.
+ (insert): New method.
+ (create): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultTextUI.java: New file.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (mouseDragged): Call moveCaret.
+ (mouseClicked): Made TODO comment more precise.
+ (mouseExited): Replaced TODO comment with Nothing to do comment.
+ (mousePressed): Call positionCaret.
+ (moveCaret): Implemented.
+ (positionCaret): Implemented.
+ (moveDot): Call adjustVisibility.
+ (setDot): Call adjustVisibility.
+ (adjustVisibility): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/Utilities.java
+ (getPositionAbove): New utility method.
+ (getPositionBelow): New utility method.
+ (getParagraphElement): Special case for StyledDocuments.
+ * javax/swing/text/View.java
+ (getNextVisualPositionFrom): New abstract method.
+ * javax/swing/text/ComponentView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/CompositeView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/FlowView.java
+ (LogicalView.getNextVisualPositionFrom): New method.
+ * javax/swing/text/GlyphView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/IconView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/PlainView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/WrappedPlainView.java
+ (WrappedLine.getNextVisualPositionFrom): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (BlinkTimerListener): New inner class. Listens for when the
+ blink timer fires and updates the visible flag accordingly.
+ (visible): Default value for visible should be false.
+ (blinkTimer): New field.
+ (Caret): New constructor.
+ (focusGained): Make the caret visible.
+ (focusLost): Make caret invisible if the focus lost is permanent.
+ (deinstall): Deinstall the blink timer.
+ (repaint): Call getComponent() instead of directly accessing the
+ textComponent field.
+ (paint): Call getComponent() instead of directly accessing the
+ textComponent field. Added an assert for the 'this should never
+ happen' comment. Update the caret rectangle if damage hasn't been
+ called before.
+ (setBlinkRate): Set the blink rate in the timer if there is already
+ a timer present.
+ (setVisible): Call damage on the caret's location. Start/Stop blink
+ timer.
+ (damage): New method. Updates the caret's bounds.
+ * javax/swing/text/JTextComponent.java
+ (CaretBlinkTimer): Removed unneeded inner class.
+ (caretBlinkTimer): Removed unneeded field.
+ (JTextComponent): Removed initialization of blink timer.
+ (setEditable): Removed starting of blink timer.
+ (setCaret): Likewise.
+ * javax/swing/text/Utilities.java
+ (getParagraphElement): New utility method.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (initComponentGraphics): Set
+ color to BLACK when getForeground() returns null.
+ (initComponentGraphicsUnlocked): Likewise.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/Timer.java (Waker.run): Synchronize on queueLock and use
+ queueLock.wait(), not Thread.sleep().
+ (start): Synchronize on queueLock and check whether waker is null.
+ (stop): Synchronize on queueLock and notifyAll().
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.19.
+ * NEWS: Add date of release.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Dialog.java
+ (show): Do not call pack() here.
+
+2005-11-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * AUTHORS: Added myself.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/Timer.java (Waker.run): Only break out when !running.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/UIManager.java (static): Print complete exception.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * lib/Makefile.am: Add typeHiding, unchecked, unused and varargsCast
+ to ECJ compile warning rule.
+
+2005-11-02 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * lib/copy-vmresources.sh.in: Added definition for top_srcdir.
+
+2005-11-02 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * NEWS: Mention Qt4 configury for OS-X.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * NEWS: Added some news items regarding my Swing work.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (findOverlapFreeParent): Don't search beyond the components
+ containing window (important when in a Dialog).
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * AUTHORS: Added myself to the cool gang.
+
+2005-11-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java:
+ (calculateBreakPosition): If the component is not valid use it's
+ preferredSize instead of getBounds().
+
+2005-11-02 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Dialog.java
+ (show): pack should always be called before show, so Dialog is
+ set to the correct size and validated.
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * configure.ac: Check for cairo, pangoft2 and freetype2 only
+ when gtk peers are enabled.
+
+2005-11-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * AUTHORS (Stuart Ballard): Address update.
+
+2005-11-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * AUTHORS: Added Lillian Angel.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JToolBar.java
+ (addImpl): Don't call updateUI here. This is really not necessary.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): Call setRolloverBorders() here in order to
+ initialize the button borders.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (PropertyChangeHandler.propertyChange): Re-setup listeners on
+ the scrollbars if the scrollbars change.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Container.java
+ (addImpl): Notify registered ContainerListeners even when the
+ Container is not showing. Notify the listeners directly, not
+ via the event queue.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed the defaults for EditorPane.border,
+ TextArea.font and TextPane.border.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getForeground): Return null as default color, instead of some
+ system color.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (BoxLayout): Throw AWTError when the axis is invalid.
+ (minimumLayoutSize): Respect the insets of the container.
+ (maximumLayoutSize): Likewise.
+ (invalidateLayout): Throw AWTError if the managed container is
+ not the same as the parent parameter.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getMaximumSize): Return (Short.MAX_VALUE, Short.MAX_VALUE) instead
+ of (Integer.MAX_VALUE, Integer.MAX_VALUE) as shown by the
+ Mauve test.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (AccessibleJTable.AccessibleJTableCell): New inner class.
+
+2005-11-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileSystemView.java: Added API docs all over,
+ * javax/swing/filechooser/UnixFileSystemView.java: Likewise.
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * java/lang/String.java (String): Added
+ StringIndexOutOfBoundsException check (overflow) and a message
+ to the exceptions.
+
+2005-11-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * NEWS: added entries for javax.swing.plaf.metal.* package and updates
+ to the gnu.classpath.examples.swing.Demo application,
+ * AUTHORS: Added my name to bring honour and glory to myself and all
+ my descendants.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.changeSupport): New field.
+ (AccessibleJComponent.AccessibleJComponent): Initialize changeSupport.
+ (AccessibleJComponent.addPropertyChangeListener): Implemented this
+ method.
+ (AccessibleJComponent.removePropertyChangeListener): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleChildrenCount): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleChild): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleName): Added API comment and
+ TODO tag.
+ (AccessibleJComponent.getAccessibleDescription): Added API comment
+ and TODO tag.
+ (AccessibleJComponent.getAccessibleRole): Implemented this method.
+ (AccessibleJComponent.getBorderTitle): Implemented this method.
+ (AccessibleJComponent.getToolTipText): Implemented this method.
+ (AccessibleJComponent.getTitledBorderText): Implemented this method.
+ (AccessibleJComponent.getAccessibleKeyBinding): Added API comment
+ and TODO tag.
+
+2005-11-01 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (init): Use
+ JOptionPane to select the laf if not explicitly set.
+
+2005-11-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/io/ObjectInputStream.java:
+ (parseContent(byte)): Remove weird exception
+ throwing.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Window.java
+ (show): Don't set size of the window here.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalScrollPaneUI.java
+ (instance): Removed unnecessary field.
+ (createUI): Always return a new instance instead of returning a
+ shared instance.
+
+2005-11-01 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (show): If pack is not called before show, the size of the
+ window is often set to 0. This is now fixed.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): Pack the JPopupMenu before fetching the Popup
+ instance. Otherwise the PopupFactory has the wrong size for
+ its size check.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (JTable(TableModel, TableColumnModel, ListSelectionModel)): Call
+ updateUI after initializeLocalVars. Manually set the lead selection
+ indices.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ (getApproveButtonText): First use the JFileChooser's approve button
+ text, but if it is null, then try otherwise.
+
+2005-11-01 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * vm/reference/java/lang/VMThread.java (sleep): Don't round
+ ms and pass ns to Object.wait, fixes mauve test.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JFileChooser.java:
+ (getDialogTitle): Allow return of null.
+ (getApproveButtonText): Likewise.
+ (getFileView): Likewise.
+ (getName): First try using the JFileChooser's FileView, if null, then
+ pass call to UI.
+ (getDescription): Likewise.
+ (getTypeDescription): Likewise.
+ (getIcon): Likewise.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (JTable(TableModel, TableColumnModel, ListSelectionModel)): Set the
+ model before calling initializeLocalVars.
+
+2005-11-01 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (BasicCheckBoxMenuItem): Moved code to BasicMenuItemUI.installDefaults
+ (processMouseEvent): Added TODO comment. Not sure about the
+ correct implementation yet.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Removed MenuItem.checkIcon default. Only
+ RadioButtonMenuItem's and CheckBoxMenuItem's have checkIcons.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (installDefaults): Fixed to initialized checkIcon. If the menuItem is
+ not a RadioButtonMenuItem or CheckBoxMenuItem, then checkIcon is null.
+ Also, fixed defaults to use prefix.
+
+2005-11-01 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectOutputStream.java
+ (writeObject): Fixed NPE.
+
+2005-10-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextAreaUI.java:
+ (create): Added docs. Create WrappedPlainView instead of PlainView if
+ the text area has line wrapping turned on.
+ (propertyChange): New API method. If line wrapping is turned on or off
+ or if the style of wrapping (character or word) is changed, call
+ modelChanged().
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (setView): Call revalidate and repaint after setting the View.
+ * javax/swing/text/WrappedPlainView.java:
+ (insertUpdate): Repaint the container.
+ (removeUpdate): Likewise.
+ (changedUpdate): Likewise.
+
+2005-10-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java:
+ (viewFactory): New field.
+ (drawLine): New API method.
+ (calculateBreakPosition): Update the metrics before calling Utilities
+ methods. Fixed error in offset argument passed to the Utilities
+ methods.
+ (updateMetrics): New implementation method.
+ (getPreferredSpan): New API method.
+ (insertUpdate): Likewise.
+ (removeUpdate): Likewise.
+ (changedUpdate): Likewise.
+ (WrappedLineCreator): New class.
+ (paint): New API method.
+ (setSize): New API method.
+ (WrappedLine.paint): Implemented.
+ (WrappedLine.getPreferredSpan): Don't update the metrics, this is now
+ done in WrappedPlainView.paint.
+ (WrappedLine.modelToView): Likewise.
+ (WrappedLine.viewToModel): Likewise.
+
+2005-10-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getTabbedTextOffset): Adjusted for loop bound down by s.offset and
+ adjusted array index up by s.offset. This fixes the second part of
+ PR 24316. Expand tabs, not newlines. Allow the x-position to reach
+ the end specified position (use < instead of <=).
+
+2005-10-31 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (horizontalVisibility): New field.
+ (JTextField): Initialize horizontalVisibility field.
+ (getHorizontalVisibility): New method.
+
+2005-10-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/SocketRepository.java (not_reusable, gc): New methods.
+ (sockets): Use hashtable. (get_socket): Rewritten.
+
+2005-10-31 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (AccessibleJTable.tableChanged): Implemented.
+ (AccessibleJTable.tableRowsInserted): Implemented.
+ (AccessibleJTable.tableRowsDeleted): Implemented.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (updateCurrentVisiblePath): Check whether treeModel is null.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (static): Set look
+ and feel before showing dialog. Clean up message text.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/PlainView.java (determineMaxLineLength): Get
+ correct lenght of text.
+ (drawLine): Throw AssertionError on unexpected bad location.
+ (viewToModel): Likewise.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/AbstractDocument.java (dump): Actually throw
+ AssertionError when constructed.
+ * javax/swing/text/DefaultFormatter.java (checkValidInput): Add cause
+ to AssertionError.
+ * javax/swing/text/DefaultStyledDocument.java (insertUpdate):
+ Likewise.
+ * javax/swing/text/GlyphView.java (getPartialSpan): Likewise.
+ (getText): Likewise.
+ * javax/swing/text/PlainView.java (determineMaxLineLength): Likewise.
+ (updateDamage): Likewise.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/rmi/server/UnicastServer.java (refcache): Make it a
+ synchronized IdentityHashMap.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (GdkGraphics2D(GdkGraphics2D,int, int, int,int)): New constructor.
+ (create(int,int,int,int)): Use new constructor.
+ (copyArea): Implement through create() and gdkDrawDrawable().
+
+2005-10-29 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (register): Throw IllegalBlockingModeException if the channel is
+ not in blocking mode.
+
+2005-10-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): don't add closePanel here,
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): don't add closePanel here,
+ * examples/gnu/classpath/examples/swing/ScrollBarDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): don't add closePanel here,
+ * examples/gnu/classpath/examples/swing/SliderDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): add separate checkBoxPanel but don't add closePanel
+ here.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/KeyboardFocusManager.java
+ (setCurrentKeyboardFocusManager): Create a DefaultKeyboardFocusManager
+ directly.
+ (createFocusManager): Removed.
+ * gnu/java/awt/FocusManager.java: Removed.
+ * javax/swing/FocusManager.java
+ (DisabledFocusManager): Removed inner class.
+ (WrappingFocusManager): New inner class.
+ (getCurrentManager): Return WrappingKeyboardFocusManager instance.
+
+2005-10-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Component.java:
+ (requestFocus): If this component is a Container, start here, not at
+ its parent when looking for the top-level ancestor. If no top-level
+ ancestor is found (parent == null), return.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaulTableCellRenderer.java
+ (getTableCellRenderer): Correctly configure the cell renderer for
+ selected and / or focused cells.
+ * javax/swing/table/JTableHeader.java
+ (getHeaderRect): Don't include the intercellSpacing in the
+ header rectangle.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (MouseInputHandler.mouseDragged): Only react if table is enabled.
+ (MouseInputHandler.mousePressed): Only react if table is enabled.
+ (MouseInputHandler.mouseReleased): Only react if table is enabled.
+ (PropertyChangeHandler): New inner class. Updates the state of
+ the table if the model property changes.
+ (installDefaults): Don't load the highlightCellBorder here. This
+ is done in the cell renderer now.
+ (installListeners): Install the new PropertyChangeListener.
+ (uninstallListeners): Uninstall the new PropertyChangeListener.
+ (paintCell): Fixed determination of the selected and focused state
+ of the cell. Removed handling of the border (this is moved into
+ the cell renderer).
+ (paint): Fixed the rectangle calculation of the cell. Fixed painting
+ of the grid.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/DefaultListSelectionModel.java
+ (setLeadSelectionIndex): Forbit some changes to leadSelectionIndex
+ when the anchorSelectionIndex is not set properly.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Poa/AOM.java,
+ gnu/CORBA/Poa/AccessiblePolicy.java,
+ gnu/CORBA/Poa/DynamicImpHandler.java,
+ gnu/CORBA/Poa/StandardPolicies.java,
+ gnu/CORBA/Poa/ServantDelegateImpl.java,
+ gnu/CORBA/Poa/NamingService/NameComponentComparator.java
+ gnu/CORBA/Poa/NamingService/NameTransformer.java
+ gnu/CORBA/GIOP/ContextHandler.java,
+ gnu/CORBA/GIOP/CodeSetServiceContext.java: New files.
+ * gnu/CORBA/GIOP/contextSupportingHeader.java,
+ gnu/CORBA/GIOP/cxCodeSet.java,
+ gnu/CORBA/NamingService/cmpNameComponent.java,
+ gnu/CORBA/NamingService/snConverter.java,
+ gnu/CORBA/Poa/activeObjectMap.java,
+ gnu/CORBA/Poa/dynImpHandler.java,
+ gnu/CORBA/Poa/policySets.java,
+ gnu/CORBA/Poa/servantDelegate.java,
+ gnu/CORBA/Poa/vPolicy.java: Removed.
+ * gnu/CORBA/GIOP/CharSets_OSF:
+ Explaining the reason of setting "_OSF" apart.
+ * gnu/CORBA/CDR/AbstractCdrInput.java,
+ gnu/CORBA/CDR/AbstractCdrOutput.java,
+ gnu/CORBA/GIOP/CharSets_OSF.java,
+ gnu/CORBA/GIOP/ReplyHeader.java,
+ gnu/CORBA/GIOP/RequestHeader.java,
+ gnu/CORBA/GIOP/ServiceContext.java,
+ gnu/CORBA/GIOP/v1_0/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_0/RequestHeader.java,
+ gnu/CORBA/GIOP/v1_2/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_2/RequestHeader.java,
+ gnu/CORBA/IOR.java,
+ gnu/CORBA/NamingService/Ext.java,
+ gnu/CORBA/NamingService/NameParser.java,
+ gnu/CORBA/NamingService/NamingMap.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuAdapterActivator.java,
+ gnu/CORBA/Poa/gnuIdAssignmentPolicy.java,
+ gnu/CORBA/Poa/gnuIdUniquenessPolicy.java,
+ gnu/CORBA/Poa/gnuImplicitActivationPolicy.java,
+ gnu/CORBA/Poa/gnuLifespanPolicy.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuRequestProcessingPolicy.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Poa/gnuServantRetentionPolicy.java,
+ gnu/CORBA/Poa/gnuThreadPolicy.java,
+ gnu/CORBA/ResponseHandlerImpl.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ org/omg/CosNaming/_NamingContextExtStub.java:
+ References updated.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (JTable): Changed order of initialization (UI first, then the model
+ etc), so that the UI gets notified of the initial model change.
+ (rowAtPoint): Don't add the intercellSpacing in the calculation
+ of the row-at-Point.
+ (setModel): Throw a PropertyChangeEvent here if the model changes.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/DynAn/ValueChangeListener.java
+ gnu/CORBA/DynAn/AbstractAny.java
+ gnu/CORBA/DynAn/RecordAny.java
+ gnu/CORBA/DynAn/DivideableAny.java
+ gnu/CORBA/DynAn/UndivideableAny.java: New files.
+ * gnu/CORBA/DynAn/abstractDynAny.java,
+ gnu/CORBA/DynAn/recordAny.java,
+ gnu/CORBA/DynAn/anyDivideable.java,
+ gnu/CORBA/DynAn/anyUndivideable.java,
+ gnu/CORBA/DynAn/valueChangedListener.java: Removed.
+ * gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynArray.java,
+ gnu/CORBA/DynAn/gnuDynEnum.java,
+ gnu/CORBA/DynAn/gnuDynFixed.java,
+ gnu/CORBA/DynAn/gnuDynStruct.java,
+ gnu/CORBA/DynAn/gnuDynUnion.java,
+ gnu/CORBA/DynAn/gnuDynValue.java,
+ gnu/CORBA/DynAn/gnuDynValueBox.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/abstractDataInputStream.java,
+ gnu/CORBA/CDR/abstractDataOutputStream.java,
+ gnu/CORBA/CDR/aligningInputStream.java,
+ gnu/CORBA/CDR/aligningOutputStream.java,
+ gnu/CORBA/CDR/cdrBufInput.java.java,
+ gnu/CORBA/CDR/cdrBufOutput.java
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/CDR/encapsulatedOutput.java,
+ gnu/CORBA/CDR/noHeaderInput.java: Removed.
+ * gnu/CORBA/CDR/HeadlessInput.java
+ gnu/CORBA/CDR/AbstractCdrInput.java
+ gnu/CORBA/CDR/AbstractCdrOutput.java
+ gnu/CORBA/CDR/AbstractDataInput.java
+ gnu/CORBA/CDR/AbstractDataOutput.java
+ gnu/CORBA/CDR/AligningInput.java
+ gnu/CORBA/CDR/AligningOutput.java
+ gnu/CORBA/CDR/BufferedCdrOutput.java
+ gnu/CORBA/CDR/BufferredCdrInput.java
+ gnu/CORBA/CDR/EncapsulationStream.java: New files.
+ * gnu/CORBA/CDR/ArrayValueHelper.java,
+ gnu/CORBA/CDR/BigEndianInputStream.java,
+ gnu/CORBA/CDR/BigEndianOutputStream.java,
+ gnu/CORBA/CDR/LittleEndianInputStream.java,
+ gnu/CORBA/CDR/LittleEndianOutputStream.java,
+ gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CdrEncapsCodecImpl.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/GIOP/MessageHeader.java,
+ gnu/CORBA/GIOP/ReplyHeader.java,
+ gnu/CORBA/GIOP/RequestHeader.java,
+ gnu/CORBA/GIOP/ServiceContext.java,
+ gnu/CORBA/GIOP/cxCodeSet.java,
+ gnu/CORBA/GIOP/v1_0/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_0/RequestHeader.java,
+ gnu/CORBA/GIOP/v1_2/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_2/RequestHeader.java,
+ gnu/CORBA/GeneralHolder.java,
+ gnu/CORBA/IOR.java,
+ gnu/CORBA/Interceptor/gnuIcCurrent.java,
+ gnu/CORBA/IorDelegate.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/OrbFunctional.java,
+ gnu/CORBA/OrbRestricted.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/RawReply.java,
+ gnu/CORBA/ResponseHandlerImpl.java,
+ gnu/CORBA/ServiceRequestAdapter.java,
+ gnu/CORBA/StreamBasedRequest.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/CORBA/typecodes/GeneralTypeCode.java,
+ gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java,
+ gnu/javax/rmi/CORBA/RmiUtilities.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ org/omg/IOP/TaggedProfileHelper.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/CORBA/corbaObjectInput.java,
+ gnu/javax/rmi/CORBA/corbaObjectOutput.java,
+ gnu/javax/rmi/CORBA/dwoTester.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil: Deleted.
+ * gnu/javax/rmi/CORBA/CorbaInput.java,
+ gnu/javax/rmi/CORBA/CorbaOutput.java,
+ gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java,
+ gnu/javax/rmi/CORBA/RmiUtilities.java: New files.
+ * gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/holderFactory.java,
+ gnu/CORBA/IOR_contructed_object.java,
+ gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/Simple_delegate.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/Focused_ORB.java: Removed.
+ * gnu/CORBA/HolderLocator.java
+ gnu/CORBA/IorDelegate.java
+ gnu/CORBA/IorObject.java
+ gnu/CORBA/OrbFocused.java
+ gnu/CORBA/OrbFunctional.java
+ gnu/CORBA/OrbRestricted.java
+ gnu/CORBA/SimpleDelegate.java: New files.
+ * gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/DynAn/abstractRecord.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynAnyFactory.java,
+ gnu/CORBA/DynAn/gnuDynArray.java,
+ gnu/CORBA/DynAn/gnuDynValueBox.java,
+ gnu/CORBA/GIOP/ErrorMessage.java,
+ gnu/CORBA/NamingService/NameParser.java,
+ gnu/CORBA/NamingService/NamingServiceTransient.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/StubLocator.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java,
+ org/omg/CORBA/CompletionStatusHelper.java,
+ org/omg/CORBA/DefinitionKindHelper.java,
+ org/omg/CORBA/FieldNameHelper.java,
+ org/omg/CORBA/IDLTypeHelper.java,
+ org/omg/CORBA/IdentifierHelper.java,
+ org/omg/CORBA/ORB.java,
+ org/omg/CORBA/ParameterModeHelper.java,
+ org/omg/CORBA/RepositoryIdHelper.java,
+ org/omg/CORBA/SetOverrideTypeHelper.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/StructMemberHelper.java,
+ org/omg/CORBA/UnionMemberHelper.java,
+ org/omg/CORBA/ValueMemberHelper.java,
+ org/omg/CORBA/VersionSpecHelper.java,
+ org/omg/CORBA/VisibilityHelper.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CORBA/_IDLTypeStub.java,
+ org/omg/CosNaming/IstringHelper.java,
+ org/omg/DynamicAny/FieldNameHelper.java,
+ org/omg/PortableInterceptor/AdapterNameHelper.java,
+ org/omg/PortableInterceptor/ORBIdHelper.java,
+ org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java,
+ org/omg/PortableInterceptor/ObjectIdHelper.java,
+ org/omg/PortableInterceptor/ServerIdHelper.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/universalHolder.java
+ gnu/CORBA/stubFinder.java
+ gnu/CORBA/typeNamer.java
+ gnu/CORBA/streamRequest.java
+ gnu/CORBA/streamReadyHolder.java
+ gnu/CORBA/binaryReply.java
+ gnu/CORBA/bufferedResponseHandler.java
+ gnu/CORBA/cdrEncapsCodec.java
+ gnu/CORBA/corbaArrayList.java: Removed.
+ * gnu/CORBA/CdrEncapsCodecImpl.java,
+ gnu/CORBA/CorbaList.java,
+ gnu/CORBA/GeneralHolder.java,
+ gnu/CORBA/RawReply.java,
+ gnu/CORBA/ResponseHandlerImpl.java,
+ gnu/CORBA/StreamBasedRequest.java,
+ gnu/CORBA/StreamHolder.java,
+ gnu/CORBA/StubLocator.java,
+ gnu/CORBA/TypeKindNamer.java: New files.
+ * gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/DynAn/abstractDynAny.java,
+ gnu/CORBA/DynAn/anyDivideable.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynAnyFactory.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/ServiceRequestAdapter.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuCodecFactory.java,
+ gnu/CORBA/gnuContextList.java,
+ gnu/CORBA/gnuExceptionList.java,
+ gnu/CORBA/gnuNVList.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/CORBA/typecodes/RecordTypeCode.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/typecodes/AliasTypeCode.java,
+ gnu/CORBA/typecodes/ArrayTypeCode.java,
+ gnu/CORBA/typecodes/FixedTypeCode.java,
+ gnu/CORBA/typecodes/GeneralTypeCode.java,
+ gnu/CORBA/typecodes/PrimitiveTypeCode.java,
+ gnu/CORBA/typecodes/RecordTypeCode.java,
+ gnu/CORBA/typecodes/RecursiveTypeCode.java,
+ gnu/CORBA/typecodes/StringTypeCode.java,
+ gnu/CORBA/typecodes/package.html: New files.
+ * gnu/CORBA/aliasTypeCode.java,
+ gnu/CORBA/primitiveArrayTypeCode.java,
+ gnu/CORBA/fixedTypeCode.java,
+ gnu/CORBA/generalTypeCode.java,
+ gnu/CORBA/primitiveTypeCode.java,
+ gnu/CORBA/recordTypeCode.java,
+ gnu/CORBA/recursiveTypeCode.java,
+ gnu/CORBA/stringTypeCode.java: Deleted.
+ * gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/OctetHolder.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/TypeCodeHelper.java,
+ gnu/CORBA/WCharHolder.java,
+ gnu/CORBA/WStringHolder.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/typeNamer.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ org/omg/CORBA/AnyHolder.java,
+ org/omg/CORBA/AnySeqHelper.java,
+ org/omg/CORBA/AnySeqHolder.java,
+ org/omg/CORBA/BooleanHolder.java,
+ org/omg/CORBA/BooleanSeqHelper.java,
+ org/omg/CORBA/BooleanSeqHolder.java,
+ org/omg/CORBA/ByteHolder.java,
+ org/omg/CORBA/CharHolder.java,
+ org/omg/CORBA/CharSeqHelper.java,
+ org/omg/CORBA/CharSeqHolder.java,
+ org/omg/CORBA/DefinitionKindHelper.java,
+ org/omg/CORBA/DoubleHolder.java,
+ org/omg/CORBA/DoubleSeqHelper.java,
+ org/omg/CORBA/DoubleSeqHolder.java,
+ org/omg/CORBA/FixedHolder.java,
+ org/omg/CORBA/FloatHolder.java,
+ org/omg/CORBA/FloatSeqHelper.java,
+ org/omg/CORBA/FloatSeqHolder.java,
+ org/omg/CORBA/IntHolder.java,
+ org/omg/CORBA/LongHolder.java,
+ org/omg/CORBA/LongLongSeqHelper.java,
+ org/omg/CORBA/LongLongSeqHolder.java,
+ org/omg/CORBA/LongSeqHelper.java,
+ org/omg/CORBA/LongSeqHolder.java,
+ org/omg/CORBA/NameValuePairHelper.java,
+ org/omg/CORBA/ORB.java,
+ org/omg/CORBA/ObjectHelper.java,
+ org/omg/CORBA/ObjectHolder.java,
+ org/omg/CORBA/OctetSeqHelper.java,
+ org/omg/CORBA/OctetSeqHolder.java,
+ org/omg/CORBA/PolicyErrorCodeHelper.java,
+ org/omg/CORBA/PrincipalHolder.java,
+ org/omg/CORBA/ShortHolder.java,
+ org/omg/CORBA/ShortSeqHelper.java,
+ org/omg/CORBA/ShortSeqHolder.java,
+ org/omg/CORBA/StringHolder.java,
+ org/omg/CORBA/StringSeqHelper.java,
+ org/omg/CORBA/StringSeqHolder.java,
+ org/omg/CORBA/TypeCodeHolder.java,
+ org/omg/CORBA/ULongLongSeqHelper.java,
+ org/omg/CORBA/ULongLongSeqHolder.java,
+ org/omg/CORBA/ULongSeqHelper.java,
+ org/omg/CORBA/ULongSeqHolder.java,
+ org/omg/CORBA/UShortSeqHelper.java,
+ org/omg/CORBA/UShortSeqHolder.java,
+ org/omg/CORBA/ValueBaseHelper.java,
+ org/omg/CORBA/WCharSeqHelper.java,
+ org/omg/CORBA/WCharSeqHolder.java,
+ org/omg/CORBA/WStringSeqHelper.java,
+ org/omg/CORBA/WStringSeqHolder.java,
+ org/omg/Messaging/SyncScopeHelper.java: References modified.
+
+2005-10-28 Nicolas Geoffray <nicolas.geoffray@menlina.com>
+
+ Reported by: Gael Thomas <gael.thomas@imag.fr>
+ * NEWS : added entry about new implementation of
+ VMClassLoader.getPackage(s), and new method
+ VMClassLoader.getBootPackages
+ * vm/reference/java/lang/VMClassLoader.java:
+ Added new definedPackages field to store packages
+ loaded by the bootstrap classloader.
+ Added new static initializer to create all packages
+ which names are returned by getBootPackages
+ (getBootPackages): new private method. Helper
+ to get as a String[] the native package names
+ (getPackage): uses the new definedPackages field
+ (getPackages): uses the new definedPackages field
+ * java/lang/Class.java:
+ (getPackage): if the classloader of the class is null
+ then call VMClassLoader.getPackage
+
+2005-10-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JEditorPane.java:
+ (getScrollableTracksViewportWidth): Return true if the component is
+ valid.
+ (getScrollableTracksViewportHeight): Likewise.
+
+2005-10-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ScrollPaneLayout.java:
+ (preferredLayoutSize): Fixed the conditions for allocating space for
+ the scrollbars. Should allocate space if the View's dimension is
+ larger than the Viewport's dimension. This fixes the problem in
+ comment 1) for PR 23530.
+
+2005-10-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): Use the viewport bounds instead of the view
+ bounds when scrolling up and scrolling left.
+
+2005-10-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/FieldView.java
+ (getPreferredSpan): For the Y_AXIS call the superclass behaviour as
+ described in the Swing book by OReilly.
+
+2005-10-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectIdHelper.java:
+ Assuming ObjectId as alias of byte[], not alias of String.
+
+2005-10-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (createDefaultModel): Return a normal PlainDocument here.
+ * javax/swing/text/AbstractDocument.java
+ (insertString): Correctly placed locking so that insertUpdate() is
+ called within a lock as specified. Do not setup any ElementChanges
+ here, this must be done in subclasses in insertUpdate() method.
+ Fire an UndoableEditEvent.
+ * javax/swing/text/PlainDocument.java
+ (insertString): New method. Replaces newlines with whitespace
+ when document property 'filterNewlines' is set.
+
+2005-10-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (PropertyChangeHandler.propertyChange): If orientation property
+ changes, re-setup the UI.
+ (TrackListener.mouseReleased): Removed unused code.
+ (createIncreaseButton): Simply return a new instance without any
+ hacks.
+ (createDecreaseButton): Likewise.
+ (installComponents): Do not create the incrButton and decrButton
+ here, only install them on the ScrollBar.
+ (installDefaults): Also initialize the incrButton and decrButton
+ fields here.
+ (uninstallComponents): Added some null checks.
+ (uninstallDefaults): Uninstall border using the LookAndFeel utility
+ method. Set incrButton and decrButton to null here.
+ (uninstallListeners): Added null checks.
+ (uninstallUI): Changed order of method calls. First uninstall
+ listeners then uninstallDefaults, because uninstallDefaults sets
+ the incrButton and decrButton fields to null, and uninstallListeners
+ removes a listener from them. Avoids NPE.
+
+2005-10-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java: API doc updates,
+ * javax/swing/plaf/metal/MetalButtonUI.java: likewise,
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java: likewise,
+ * javax/swing/plaf/metal/MetalCheckBoxUI.java: likewise,
+ * javax/swing/plaf/metal/MetalDesktopIconUI.java: likewise,
+ * javax/swing/plaf/metal/MetalIconFactory.java: likewise,
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java: likewise,
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java: likewise,
+ * javax/swing/plaf/metal/MetalLabelUI.java: likewise,
+ * javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java: likewise,
+ * javax/swing/plaf/metal/MetalProgressBarUI.java: likewise,
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java: likewise,
+ * javax/swing/plaf/metal/MetalRootPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalScrollBarUI.java: likewise,
+ * javax/swing/plaf/metal/MetalScrollPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalSeparatorUI.java: likewise,
+ * javax/swing/plaf/metal/MetalSliderUI.java: likewise,
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalTextFieldUI.java: likewise,
+ * javax/swing/plaf/metal/MetalToolBarUI.java: likewise,
+ * javax/swing/plaf/metal/MetalToolTipUI.java: likewise,
+ * javax/swing/plaf/metal/MetalTreeUI.java: likewise,
+ * javax/swing/plaf/metal/package.html: likewise.
+
+2005-10-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java:
+ (MetalToggleButtonUI): removed color field initialisation,
+ (installDefaults): added color field initialisation formerly in
+ the constructor.
+
+2005-10-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/RepaintManager.java
+ (paintDirtyRegions): replaced characters in comment that caused
+ warnings in gjdoc and Eclipse.
+
+2005-10-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * BUGS: URL refreshed.
+
+2005-10-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/ExceptionCreator.java: Deleted.
+
+2005-10-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceFactory.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java:
+ New files.
+
+2005-10-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ViewportLayout.java:
+ (layoutContainer): Fixed incorrect boundary checks, should have been
+ checking for viewport being smaller than minimum size, not smaller
+ than preferred size.
+
+2005-10-26 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * configure.ac: Rename --with-qtdir to --with-qt4dir to make clear
+ which Qt version is meant.
+
+2005-10-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JList.java:
+ (getPreferredScrollableViewportSize): Use the preferred width instead
+ of the width of the widest element. This allows us to use the
+ user-specified preferred width if setPreferredSize was called. Use
+ the height of the first row, not the first visible row, when
+ calculating the preferred height. Added comments and made code cleaner
+ and more readable.
+
+2005-10-26 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/spi/ImageReaderWriterSpi.java
+ (getStreamMetadataFormat): Implement.
+ (getImageMetadataFormat): Likewise.
+
+2005-10-26 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/colorchooser/AbstractColorChooserPanel.java
+ (getMnemonic): implemented,
+ (getDisplayedMnemonicIndex): implemented.
+
+2005-10-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/AdapterManagerIdHelper.java,
+ org/omg/PortableInterceptor/AdapterNameHelper.java,
+ org/omg/PortableInterceptor/AdapterStateHelper.java,
+ org/omg/PortableInterceptor/ORBIdHelper.java,
+ org/omg/PortableInterceptor/ObjectIdHelper.java,
+ org/omg/PortableInterceptor/ServerIdHelper.java: New files.
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
+ (type): Fixed typo in typecode name.
+
+2005-10-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView: New class.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Removed initialization of unnecessary focusColor
+ field.
+ (paintButtonPressed): Only paint if button is opaque.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (paintButtonPressed): Only paint if button is opaque and
+ contentAreaFilled.
+
+2005-10-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/CompositeView.java:
+ (getViewIndexAtPosition): Fixed boundary conditions (less than and
+ greater than signs were backward).
+
+2005-10-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getBreakLocation): New API method.
+
+2005-10-25 Tom Tromey <tromey@redhat.com>
+
+ * java/io/ObjectOutputStream.java (useProtocolVersion): Typo fix.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): Changed classname for the heavyweight testclass to match
+ the new classes introduced by my popup patch earlier this day.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkMenuBar): Replaced some demos with new external demo programs,
+ namely the button demo, the scrollbar demo, the combobox demo and
+ the slider demo.
+ (mkButtonBar): Likewise.
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+ * examples/gnu/classpath/examples/swing/ScrollBarDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+ * examples/gnu/classpath/examples/swing/SliderDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (addImpl): Removed unnecessary repaint() and revalidate() calls.
+ * javax/swing/JPopupMenu.java
+ (remove): Removed unnecessary revalidate() call.
+ (insert): Removed code that installs GridBagConstraints. JPopupMenu
+ uses a BoxLayout and this is not needed anymore.
+ (pack): Send this method call to the event queue to avoid
+ synchronization problems. Set size to preferredSize of this menu.
+ (setVisible): Send this method call to the event queue to avoid
+ synchronization problems. Use PopupFactory for creating a popup.
+ (setLocation): Use int fields instead of a Point field.
+ (Popup): Removed inner interface. We use javax.swing.Popup now.
+ (LightweightPopup): Likewise.
+ (MediumWeightPopup): Likewise.
+ (HeavyWeightPopup): Likewise.
+ * javax/swing/Popup.java
+ (JWindowPopup.JWindowPopup): Add contents to contentPane of window.
+ Set focusableWindowState to false.
+ (JWindowPopup.show): Set size of window here.
+ (LightweightPopup): New inner class.
+ * javax/swing/PopupFactory.java
+ (getPopup): Return heavyweight or lightweight popup depending on
+ the parameters.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (PropertyChangeHandler): Removed unneeded inner class.
+ (BasicMenuItemUI): Removed instantiation of PropertyChangeHandler.
+ (installListeners): Removed handling of the PropertyChangeHandler.
+ (uninstallListeners): Removed handling of the PropertyChangeHandler.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (getMaximumSize): Don't treat popup menus different.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/classpath/examples/CORBA/NamingService/Demo.java (main):
+ Make arguments not final.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/IDLEntity.java: Deleted.
+ * gnu/CORBA/primitiveTypeCode.java,
+ org/omg/CORBA/PolicyError.java,
+ org/omg/CORBA/TypeCodePackage/BadKind.java,
+ org/omg/CORBA/TypeCodePackage/Bounds.java:
+ Use org.omg.CORBA.portable.IDLEntity.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/interfaces/SocketFactory.java: New file.
+ * gnu/CORBA/interfaces/gnuSocketFactory.java: Deleted.
+ * gnu/CORBA/DefaultSocketFactory.java,
+ gnu/CORBA/Functional_ORB.java,
+ org/omg/CORBA/ORB.java: Replacing gnuSocketFactory into SocketFactory.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CosNaming/BindingIteratorHelper.java,
+ org/omg/CosNaming/NamingContextExtHelper.java,
+ org/omg/CosNaming/NamingContextHelper.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ org/omg/DynamicAny/DynAnyHelper.java,
+ org/omg/DynamicAny/DynArrayHelper.java,
+ org/omg/DynamicAny/DynEnumHelper.java,
+ org/omg/DynamicAny/DynFixedHelper.java,
+ org/omg/DynamicAny/DynSequenceHelper.java,
+ org/omg/DynamicAny/DynStructHelper.java,
+ org/omg/DynamicAny/DynUnionHelper.java,
+ org/omg/DynamicAny/DynValueHelper.java,
+ org/omg/IOP/CodecFactoryHelper.java,
+ org/omg/PortableInterceptor/CurrentHelper.java,
+ org/omg/PortableServer/ServantActivatorHelper.java,
+ org/omg/PortableServer/ServantLocatorHelper.java: Added
+ unchecked_narrow method.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen):
+ Call gdk_window_get_root_origin instead of gdk_window_get_origin
+ so that the window decorations are correctly respected.
+
+2005-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/io/ObjectOutputStream.java (useProtocolVersion): Fixed typo
+ in javadoc.
+
+2005-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/StringBuffer.java (appendCodePoint): Added @since.
+ * java/lang/StringBuilder.java (insert): New overloads.
+ (appendCodePoint): New method.
+
+2005-10-24 Dalibor Topic <robilad@kaffe.org>
+
+ * test/native/lib/PrimlibInterface.c,
+ * test/native/lib/PrimlibInterface.h,
+ * test/native/lib/PrimlibTest.java:
+ Removed unused test.
+
+2005-10-24 Dalibor Topic <robilad@kaffe.org>
+
+ * native/jni/classpath/primlib.c,
+ native/jni/classpath/primlib.h: Removed since unused.
+
+ * native/jni/classpath/Makefile.am: (libclasspath_la_SOURCES)
+ Removed primlib.c and primlib.h.
+
+2005-10-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ScrollBarDemo.java: New file.
+
+2005-10-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (ModelListener.stateChanged): changed call to getThumbBounds() to
+ updateThumbRect(),
+ (PropertyChangeHandler.propertyChange): likewise, plus added handling
+ for 'enabled' property,
+ (getMaximumSize): return maximum dimension,
+ (getThumbBounds): just return field value,
+ (getTrackBounds): just return field value,
+ (installUI): switch order of calls to installDefaults() and
+ installComponents(),
+ (layoutHScrollBar): reimplemented using new updateThumbRect() method,
+ (layoutVScrollBar): likewise,
+ (updateThumbRect): new method,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added 'ScrollBar.width' default,
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (MIN_THUMB_SIZE): changed value,
+ (MIN_THUMB_SIZE_FREE_STANDING): new field,
+ (isFreeStanding): set default to true,
+ (scrollBarShadowColor): new field,
+ (installDefaults): initialise scrollBarShadowColor,
+ (createDecreaseButton): retain reference in decreaseButton field,
+ (createIncreaseButton): retain reference in increaseButton field,
+ (paintTrackHorizontal): use scrollBarShadowColor, add special handling
+ for free standing scroll bar in disabled state,
+ (paintTrackVertical): likewise,
+ (paintThumb): separate horizontal and vertical cases,
+ (paintThumbHorizontal): new method,
+ (paintThumbVertical): new method,
+ (getMinimumThumbSize): return different size depending on whether or
+ not the scroll bar is free standing,
+ * javax/swing/plaf/metal/MetalScrollButton.java
+ (paintNorthBorderFreeStanding): modified drawing.
+
+2005-10-24 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/metadata/IIOMetadataFormatImpl.java: Complete.
+ * javax/imageio/metadata/IIOMetadataNode.java: Complete stubs.
+ * javax/imageio/metadata/IIOAttr.java: Replace with
+ IIOMetadataFormatImpl.IIOMetadataNodeAttr. Remove file.
+ * javax/imageio/metadata/IIONamedNodeMap.java: Replace with
+ IIOMetadataNode.IIONamedNodeMap. Remove file.
+ * javax/imageio/metadata/IIONodeList.java: Replace with
+ IIOMetadataNode.IIONodeList. Remove file.
+
+2005-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/text/AttributedStringIterator.java (getRunLimit): Add
+ explicit qualification.
+ (getRunStart): Likewise.
+
+2005-10-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedString.java
+ (AttributedString(AttributedCharacterIterator, int, int,
+ AttributedCharacterIterator.Attribute[])): renamed arguments, and
+ updated IllegalArgumentException check,
+ (addAttribute(AttributedCharacterIterator.Attribute, Object, int,
+ int)): likewise,
+ (addAttributes(Map, int, int)): changed IllegalArgumentException to
+ NullPointerException, and modified check for illegal range,
+ * java/text/AttributedStringIterator.java
+ (getRunLimit(Set)): reimplemented,
+ (getRunStart): added API docs,
+ (getRunStart(AttributedCharacterIterator.Attribute)): handle null
+ argument as a special case,
+ (getRunStart(Set)): reimplemented,
+ (getAttribute(AttributedCharacterIterator.Attribute, int)): new
+ private method,
+ (getAttribute(AttributedCharacterIterator.Attribute)): reimplemented
+ using new private method.
+ * java/text/CharacterIterator.java: minor API doc fix.
+
+2005-10-24 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24359
+ * javax/swing/BoxLayout.java:
+ Made class thread safe.
+
+2005-10-23 Tom Tromey <tromey@redhat.com>
+
+ * java/util/InvalidPropertiesFormatException.java: New file.
+
+2005-10-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/util/Properties.java
+ (storeToXML(OutputStream,String,String)): Added null pointer checks.
+ (loadFromXML(InputStream)): Implemented.
+ (PropertiesHandler): New class to handle parsing events.
+ (PropertiesHandler()): New constructor.
+ (startDTD(String,String,String)): Implemented.
+ (startElement(String,String,String,Attributes)): Implemented.
+ (characters(char[],int,int)): Implemented.
+ (endElement(String,String,String)): Implemented.
+ (endDocument()): Implemented.
+
+2005-10-23 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/lang/Thread.java
+ (sleep): Better exception message.
+
+ * java/security/AccessControlContext.java
+ (checkPermission): Likewise.
+
+ * java/util/ResourceBundle.java
+ (getBundle): Likewise.
+
+ * java/util/SimpleTimeZone.java
+ (setStartRule): Added some documentation.
+
+2005-10-23 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * configure.ac: Added support for "--with-native-libdir" and
+ "--with-glibj-dir". Generate copy-vmresources.sh
+
+ * lib/Makefile.am: Call copy-vmresources.sh to fetch possible vm
+ resources from the vmdirs.
+
+ * lib/copy-vmresources.sh.in: New script file.
+
+ * lib/gen-classlist.sh.in: Include com/ as base package for the
+ vm directories.
+
+ * native/jawt/Makefile.am,
+ native/jni/gtk-peer/Makefile.am,
+ native/jni/java-io/Makefile.am,
+ native/jni/java-lang/Makefile.am,
+ native/jni/java-net/Makefile.am,
+ native/jni/java-nio/Makefile.am,
+ native/jni/java-util/Makefile.am,
+ native/jni/midi-alsa/Makefile.am,
+ native/jni/midi-dssi/Makefile.am,
+ native/jni/qt-peer/Makefile.am,
+ native/jni/xmlj/Makefile.am: Install libraries in nativelibdir
+ and not pkglib.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR classpath/22972
+ * java/io/File (createTempFile): Rewritten.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/IOP/RMICustomMaxStreamFormat.java,
+ * org/omg/IOP/ExceptionDetailMessage.java: New files.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/Registrator.java (m_prefix): Made static.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/CORBA/gnuRmiUtil.java (readValue):
+ Do not read fields of the ObjectImpl.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT,
+ * org/omg/PortableInterceptor/ACTIVE.java,
+ * org/omg/PortableInterceptor/DISCARDING.java,
+ * org/omg/PortableInterceptor/HOLDING.java,
+ * org/omg/PortableInterceptor/INACTIVE.java,
+ * org/omg/PortableInterceptor/NON_EXISTENT.java: New files.
+
+2005-10-22 Julian Scheid <julian@sektor37.de>
+
+ * java/util/Map.java (Entry.equals): Fixed invalid example code
+ in documentation.
+
+2005-10-22 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/ACTIVITY_COMPLETED.java,
+ * org/omg/CORBA/ACTIVITY_REQUIRED.java,
+ * org/omg/CORBA/BAD_QOS.java,
+ * org/omg/CORBA/CODESET_INCOMPATIBLE.java,
+ * org/omg/CORBA/INVALID_ACTIVITY.java,
+ * org/omg/CORBA/REBIND.java,
+ * org/omg/CORBA/TIMEOUT.java,
+ * org/omg/CORBA/TRANSACTION_MODE.java,
+ * org/omg/CORBA/TRANSACTION_UNAVAILABLE.java: New exceptions.
+
+2005-10-22 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/rmi/CORBA/ValueHandlerMultiFormat.java: New interface.
+ * gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
+ (getMaximumStreamFormatVersion, writeValue): New methods.
+
+2005-10-22 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassloader.java (addURLs): Add comment about jboss.
+
+2005-10-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (BasicCheckBoxMenuItem): Implemented.
+ (installDefaults): Removed method, not in API.
+ (processMouseEvent): Implemented.
+ * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+ (processMouseEvent): Implemented.
+
+2005-10-21 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * configure.ac: Also check for pangoft2 without cairo and
+ additionally check for freetype2.
+ * native/jni/gtk-peer/Makefile.am: Added X, pangoft2 and
+ freetype2 CFLAGS and LDFLAGS.
+
+2005-10-21 Nicolas Geoffray <nicolas.geoffray@menlina.com>
+
+ * vm/reference/java/lang/VMClassLoader.java
+ (getResources): uses a new static field HashMap to
+ store opened zip files from property java.boot.class.path.
+
+2005-10-21 Nicolas Geoffray <nicolas.geoffray@menlina.com>
+
+ * vm/reference/java/lang/VMClassLoader.java
+ (getRessources): In case the property java.boot.class.path
+ contains directories, tests if the ressource exists before adding
+ it to the vector result.
+
+2005-10-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Only paint focus if enabled.
+
+2005-10-21 David Daney <ddaney@avtrex.com>
+
+ * NEWS: Added entry about HttpURLConnection improvements.
+
+2005-10-21 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/DefaultSocketFactory.java,
+ * gnu/CORBA/interfaces/gnuSocketFactory.java,
+ * gnu/CORBA/interfaces/package.html: New files.
+ * gnu/CORBA/Functional_ORB.java,
+ * gnu/CORBA/Focused_ORB.java (getPortServer),
+ * gnu/CORBA/GIOP/ErrorMessage.java (send),
+ * gnu/CORBA/gnuRequest.java (submit): Rewritten to support
+ gnu.Corba.SocketFactory property.
+ * org/omg/CORBA/ORB.java: Documentation update.
+
+2005-10-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPopupMenu.java
+ (show): Fixed to set the size if it was never set.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (menuDeselected): Added check to prevent NPE.
+ * javax/swing/plaf/basic/BasicSeparatorUI.java:
+ Removed minSize, horizontalPrefSize, verticalPrefSize and
+ maxSize fields. They were causing problems when other classes
+ were setting this variables to something else. More reliable if
+ actual value is returned.
+ (getPreferredSize): Returned appropriate values.
+ (getMinimumSize): Likewise.
+ (getMaximumSize): Likewise.
+
+2005-10-21 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/reflect/Proxy.java
+ (ProxyType.ProxyType): Don't replace null with system class loader.
+ (ProxyType.hashCode): Handle null loader.
+
+2005-10-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/DefaultListSelectionModel.java:
+ (setLeadSelectionIndex): If the selection mode is SINGLE_SELECTION then
+ pass this call to setSelectionInterval.
+ (addSelectionInterval): If the selection mode is SINGLE_SELECTION then
+ pass the call to setSelectionInterval and avoid the lengthy checks
+ that don't apply to this mode.
+ * javax/swing/JList.java:
+ (getSelectedIndices): Changed bounds of for loop to include the
+ maxSelectionIndex.
+
+2005-10-20 Lillian Angel <langel@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkRadio): Changed to create a panel that contains
+ 2 buttons in a ButtonGroup.
+ * javax/swing/ButtonGroup.java
+ (add): Fixed to initialize sel if the newly added
+ button is already selected.
+ * javax/swing/JToggleButton.java
+ (isSelected): Implemented.
+ (setSelected): Implemented.
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (paintFocus): Fixed size of border drawn around the
+ radio button.
+
+2005-10-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/ScrollPaneAdjustable.java:
+ (addAdjustmentListener): If parameter is null take no action and throw
+ no exception. Store the resulting listener chain from call to
+ AWTEventMulticaster.add.
+ (removeAdjustmentListener): If parameter is null take no action and
+ throw no exception. Store the resulting listener chain from call to
+ AWTEventMulticaster.remove.
+
+2005-10-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/LookAndFeel.java:
+ (loadKeyBindings): Implemented and added docs.
+ (makeComponentInputMap): Likewise.
+ (makeInputMap): Likewise.
+ (makeKeyBindings): Likewise.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (convertModifiers): Removed this no longer needed private method.
+ (installKeyboardActions): Removed the code relating to modifier
+ conversion and made code more readable by using local variables.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (convertModifiers): Removed this no longer needed private method.
+ (installKeyboardActions): Removed the code relating to modifier
+ conversion and made code more readbale by using local variables.
+
+2005-10-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Added new ItemListener field.
+ (BasicMenuItemUI): Initialized new field.
+ (installListeners): Installed new listener.
+ (removeListeners): Removed new listener.
+ (MenuDragMouseHandler): Class should be private, not
+ in API.
+ (MenuKeyHandler): Likewise.
+ (PropertyChangeHandler): Likewise.
+ (ItemHandler): New class implemented to change the
+ state of the menu item if it is a checkbox menu item.
+
+2005-10-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (layoutMinorAxis): Calculate total requirements before calling
+ the SizeRequirements utility method. Avoids an NPE.
+
+2005-10-20 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java: Updated API docs all
+ over, plus:
+ (defaultSize): removed field,
+ (upIcon): removed field,
+ (downIcon): removed field,
+ (leftIcon): removed field,
+ (rightIcon): removed field,
+ (darkShadow): changed color value,
+ (paint): ignore insets for triangle positioning, but check 'armed'
+ state,
+ (paintTriangle): delegate to new private methods depending on
+ direction,
+ (paintTriangleNorth): new private method,
+ (paintTriangleSouth): new private method,
+ (paintTriangleEast): new private method,
+ (paintTriangleWest): new private method.
+
+2005-10-20 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/ietf/jgss/GSSCredential.java (hashCode),
+ * org/ietf/jgss/GSSName.java (hashCode): New declarations.
+
+2005-10-19 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassLoader.java (addURLs): Don't call addURL(), but
+ call urls.add() and addURLImpl() directly on each URL.
+
+2005-10-19 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * javax/swing/text/html/HTMLEditorKit.java: Add missing import.
+
+2005-10-19 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/text/html/HTMLEditorKit.java (getParser): New method.
+
+2005-10-19 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/text/html/parser/ContentModel.java: Fixed comments for
+ parameterless constructor.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (getDebugGraphicsOptions): Removed debug output.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (isShowing): Fixed condition.
+ (show): Only repaint if component is showing.
+ (hide): Only repaint if component was showing.
+
+2005-10-19 Mark Wielaard <mark@klomp.org>
+
+ * javax/security/auth/login/LoginContext.java (lookupModule):
+ Load LoginModule through Thread context class loader.
+
+2005-10-19 Mark Wielaard <mark@klomp.org>
+
+ * java/net/Socket.java (getImpl): Chain exception before throwing.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractSpinnerModel.java
+ * javax/swing/ActionMap.java
+ * javax/swing/BoundedRangeModel.java
+ * javax/swing/Box.java
+ * javax/swing/BoxLayout.java
+ * javax/swing/ButtonGroup.java
+ * javax/swing/CellEditor.java
+ * javax/swing/CellRendererPane.java
+ * javax/swing/ComboBoxEditor.java
+ * javax/swing/DefaultButtonModel.java
+ * javax/swing/DefaultCellEditor.java
+ * javax/swing/DefaultDesktopManager.java
+ * javax/swing/DefaultListCellRenderer.java
+ * javax/swing/DesktopManager.java
+ * javax/swing/ImageIcon.java
+ * javax/swing/InputVerifier.java
+ * javax/swing/JCheckBoxMenuItem.java
+ * javax/swing/JColorChooser.java
+ * javax/swing/JDesktopPane.java
+ * javax/swing/JFileChooser.java
+ * javax/swing/JLayeredPane.java
+ * javax/swing/JList.java
+ * javax/swing/JMenu.java
+ * javax/swing/JMenuBar.java
+ * javax/swing/JMenuItem.java
+ * javax/swing/JOptionPane.java
+ * javax/swing/JPasswordField.java
+ * javax/swing/JPopupMenu.java
+ * javax/swing/JProgressBar.java
+ * javax/swing/JRadioButtonMenuItem.java
+ * javax/swing/JRootPane.java
+ * javax/swing/JSeparator.java
+ * javax/swing/JSlider.java
+ * javax/swing/JSpinner.java
+ * javax/swing/JSplitPane.java
+ * javax/swing/JTabbedPane.java
+ * javax/swing/JTable.java
+ * javax/swing/JTextPane.java
+ * javax/swing/JToolBar.java
+ * javax/swing/JToolTip.java
+ * javax/swing/JTree.java
+ * javax/swing/KeyStroke.java
+ * javax/swing/LookAndFeel.java
+ * javax/swing/MutableComboBoxModel.java
+ * javax/swing/Popup.java
+ * javax/swing/PopupFactory.java
+ * javax/swing/RepaintManager.java
+ * javax/swing/SortingFocusTraversalPolicy.java
+ * javax/swing/Spring.java
+ * javax/swing/SwingUtilities.java
+ * javax/swing/ToolTipManager.java
+ * javax/swing/TransferHandler.java
+ * javax/swing/ViewportLayout.java
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports. Removed
+ unneeded serialization methods.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/OverlayLayout.java
+ (checkLayout): Respect the container's insets correctly.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLabel.java
+ (setText): Call revalidate() and repaint().
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ Added comments to empty blocks.
+ (read): Implemented this previously stubbed method.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComboBox.java
+ Added comments to empty blocks.
+ (writeObject): Removed unnecessary serialization method.
+ (processKeyEvent): Implemented this previously stubbed method.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JButton.java
+ (removeNotify): Implemented this previously stubbed method.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/undo/CannotRedoException.java
+ * javax/swing/undo/CannotUndoException.java
+ Put super() call in empty constructors.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/tree/DefaultMutableTreeNode.java
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ * javax/swing/tree/TreeCellRenderer.java
+ * javax/swing/tree/TreeModel.java
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/AbstractDocument.java
+ * javax/swing/text/AttributeSet.java
+ * javax/swing/text/ComponentView.java
+ * javax/swing/text/DefaultCaret.java
+ * javax/swing/text/DefaultEditorKit.java
+ * javax/swing/text/DefaultHighlighter.java
+ * javax/swing/text/EditorKit.java
+ * javax/swing/text/FieldView.java
+ * javax/swing/text/FlowView.java
+ * javax/swing/text/GlyphView.java
+ * javax/swing/text/JTextComponent.java
+ * javax/swing/text/LayoutQueue.java
+ * javax/swing/text/PlainView.java
+ * javax/swing/text/Segment.java
+ * javax/swing/text/StyledDocument.java
+ * javax/swing/text/html/HTMLEditorKit.java
+ * javax/swing/text/html/HTMLFrameHyperlinkEvent.java
+ * javax/swing/text/html/parser/DocumentParser.java
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports.
+
+2005-10-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java
+ (buttonBorder): removed,
+ (BasicArrowButton): don't set border, use default border,
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (configureArrowButton): don't set margin here,
+ (getPreferredSize): added comment,
+ (getMinimumSize): icon width is the same as the display area height,
+ (getDefaultSize): return size of space char plus 1 pixel margin,
+ (getDisplaySize): take into account the prototype display value, if
+ there is one,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): updated 'Button.margin' default,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (MetalComboBoxButton(JComboBox, Icon, boolean, CellRendererPane,
+ JList)): check for null JComboBox, don't set margin here,
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (createArrowButton): set margin,
+ (getMinimumSize): reimplemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): changed 'Button.margin' default to from Insets
+ to InsetsUIResource.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/html/HTML.java
+ * javax/swing/text/html/HTMLDocument.java
+ Filled emtpy blocks with comments.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/html/parser/ContentModel.java
+ * javax/swing/text/html/parser/DTD.java
+ * javax/swing/text/html/parser/DocumentParser.java
+ * javax/swing/text/html/parser/Element.java
+ * javax/swing/text/html/parser/Parser.java
+ Filled emtpy blocks with comments.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/TableColumnModel.java:
+ Fixed some minor API doc errors.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ActionMapUIResource.java
+ * javax/swing/plaf/BorderUIResource.java
+ * javax/swing/plaf/ButtonUI.java
+ * javax/swing/plaf/ColorChooserUI.java
+ * javax/swing/plaf/ColorUIResource.java
+ * javax/swing/plaf/ComboBoxUI.java
+ * javax/swing/plaf/ComponentInputMapUIResource.java
+ * javax/swing/plaf/DesktopIconUI.java
+ * javax/swing/plaf/DesktopPaneUI.java
+ * javax/swing/plaf/DimensionUIResource.java
+ * javax/swing/plaf/FileChooserUI.java
+ * javax/swing/plaf/FontUIResource.java
+ * javax/swing/plaf/IconUIResource.java
+ * javax/swing/plaf/InputMapUIResource.java
+ * javax/swing/plaf/InsetsUIResource.java
+ * javax/swing/plaf/InternalFrameUI.java
+ * javax/swing/plaf/LabelUI.java
+ * javax/swing/plaf/ListUI.java
+ * javax/swing/plaf/MenuBarUI.java
+ * javax/swing/plaf/MenuItemUI.java
+ * javax/swing/plaf/PanelUI.java
+ * javax/swing/plaf/PopupMenuUI.java
+ * javax/swing/plaf/ProgressBarUI.java
+ * javax/swing/plaf/RootPaneUI.java
+ * javax/swing/plaf/ScrollBarUI.java
+ * javax/swing/plaf/ScrollPaneUI.java
+ * javax/swing/plaf/SeparatorUI.java
+ * javax/swing/plaf/SliderUI.java
+ * javax/swing/plaf/SpinnerUI.java
+ * javax/swing/plaf/SplitPaneUI.java
+ * javax/swing/plaf/TabbedPaneUI.java
+ * javax/swing/plaf/TableHeaderUI.java
+ * javax/swing/plaf/TableUI.java
+ * javax/swing/plaf/TextUI.java
+ * javax/swing/plaf/ToolBarUI.java
+ * javax/swing/plaf/ToolTipUI.java
+ * javax/swing/plaf/TreeUI.java
+ * javax/swing/plaf/UIResource.java
+ * javax/swing/plaf/ViewportUI.java
+ Reformatted slightly. Filled emtpy blocks with comments.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ComponentUI.java
+ Filled empty blocks with comments.
+ (update): Reverted my patch from 2005-10-12. This is wrong. If there
+ are still clipping problems, then certainly in another area.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/multi/MultiLookAndFeel.java
+ Filled empty block with comment.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ * javax/swing/plaf/metal/MetalButtonListener.java
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ * javax/swing/plaf/metal/MetalFileChooserUI.java
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ * javax/swing/plaf/metal/MetalProgressBarUI.java
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ * javax/swing/plaf/metal/MetalSliderUI.java
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ * javax/swing/plaf/metal/MetalTextFieldUI.java
+ * javax/swing/plaf/metal/MetalToolBarUI.java
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ * javax/swing/plaf/metal/MetalUtils.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (getDebugGraphicsOptions): Fixed to load system property if present.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/DebugGraphics.java
+ (counter): New field.
+ (color): Removed unneeded field.
+ (DebugGraphics()): Count up.
+ (DebugGraphics(Graphics,JComponent)): Call this(Graphics).
+ (DebugGraphics(Graphics)): Call this().
+ (setColor): Implemented logging facility.
+ (create): Copy debugOptions over to new DebugGraphics instance.
+ (create(int,int,int,int)): Likewise.
+ (setFont): Implemented logging facility.
+ (getColor): Return graphics.getColor().
+ (translate): Implemented logging facility.
+ (setPaintMode): Likewise.
+ (setXORMode): Likewise.
+ (clipRect): Likewise.
+ (setClip(int,int,int,int)): Likewise.
+ (setClip(Shape)): Likewise.
+ (drawRect): Likewise. Only flash when FLASH_OPTION is set.
+ (fillRect): Likewise.
+ (clearRect): Implemented logging facility.
+ (drawRoundRect): Likewise.
+ (fillRoundRect): Likewise.
+ (drawLine): Likewise.
+ (draw3DRect): Likewise.
+ (fill3DRect): Likewise.
+ (drawOval): Likewise.
+ (fillOval): Likewise.
+ (drawArc): Likewise.
+ (fillArc): Likewise.
+ (drawPolyline): Likewise.
+ (drawPolygon): Likewise.
+ (fillPolygon): Likewise.
+ (drawString(String,int,int)): Likewise.
+ (drawString(AttributedCharacterIterator,int,int)): Likewise.
+ (drawByted): Likewise.
+ (drawChars): Likewise. Only flash if FLASH_OPTION is set.
+ (drawImage): Implemented logging facility. (Also applies to all
+ overloaded versions of this method).
+ (copyArea): Likewise.
+ (setDebugOptions): Likewise.
+ (prefix): New helper method.
+ * javax/swing/JComponent.java
+ (getComponentGraphics): Implemented to return DebugGraphics when
+ needed.
+ (getDebugGraphicsOptions): Implemented to return the correct options.
+ Also, this loads a system property gnu.javax.swing.DebugGraphics
+ if present and evaluates it.
+
+2005-10-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JList.java
+ (getAccessibleContext): Returned an instance of
+ AccessibleJList. Should never return null.
+
+2005-10-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added MouseListener and removed MouseInputListener.
+ (BasicTreeUI): Initialized mouseListener and removed
+ mouseInputListener.
+ (removeListeners): Removed mouseListener and removed
+ mouseInputListener code.
+ (installListeners): Likewise.
+ (MouseInputHandler.mousePressed): Moved code to MouseHandler.
+ (MouseHandler.mousePressed): Likewise.
+ * javax/swing/plaf/metal/MetalTreeUI.java:
+ Added MouseListener and removed MouseInputListener.
+ (installUI): Initialized mouseListener and removed
+ mouseInputListener.
+ (uninstallUI): Removed mouseListener and removed
+ mouseInputListener code.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicBorders.java
+ * javax/swing/plaf/basic/BasicButtonListener.java
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ * javax/swing/plaf/basic/BasicComboBoxEditor.java
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+ * javax/swing/plaf/basic/BasicDesktopIconUI.java
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ * javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ * javax/swing/plaf/basic/BasicListUI.java
+ * javax/swing/plaf/basic/BasicMenuBarUI.java
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ * javax/swing/plaf/basic/BasicPasswordFieldUI.java
+ * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+ * javax/swing/plaf/basic/BasicRootPaneUI.java
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ * javax/swing/plaf/basic/BasicSplitPaneDivider.java
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java
+ * javax/swing/plaf/basic/BasicTableUI.java
+ * javax/swing/plaf/basic/BasicTextAreaUI.java
+ * javax/swing/plaf/basic/BasicTextUI.java
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ * javax/swing/plaf/basic/BasicViewportUI.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/filechooser/FileFilter.java:
+ * javax/swing/filechooser/FileView.java:
+ Filled empty blocks with comments.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/event/EventListenerList.java:
+ * javax/swing/event/InternalFrameAdapter.java:
+ * javax/swing/event/MouseInputListener.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/colorchooser/AbstractColorChooserPanel.java:
+ * javax/swing/colorchooser/ColorChooserComponentFactory.java:
+ * javax/swing/colorchooser/DefaultSwatchChooserPanel.java:
+ Filled empty blocks with comments.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/border/AbstractBorder.java:
+ * javax/swing/border/BevelBorder.java:
+ * javax/swing/border/Border.java:
+ * javax/swing/border/CompoundBorder.java:
+ * javax/swing/border/EmptyBorder.java:
+ * javax/swing/border/EtchedBorder.java:
+ * javax/swing/border/LineBorder.java:
+ * javax/swing/border/MatteBorder.java:
+ * javax/swing/border/SoftBevelBorder.java:
+ * javax/swing/border/TitledBorder.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * java/awt/GridBagLayout.java
+ (GetLayoutInfo): Added a null check for lastComponent. Prevents
+ NPE.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (JTable): Moved code around so all models are set before
+ any other function is called. Prevents all NPEs with
+ models.
+
+2005-10-18 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/DefaultListSelectionModel.java:
+ (setLeadSelectionIndex): Avoid index out of bounds error on initial
+ call of this method by checking explicitly for oldLeadIndex being -1.
+ Also remove unused BitSet newRange and oldRange.
+ (moveLeadSelectionIndex): New API method implemented (@since 1.5).
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (ListAction.actionPerformed): Make code more readable by declaring
+ local variables for the actionCommand and for the list's
+ selectionModel. Implemented the following bindings:
+ selectLastRowChangeLead, scrollDownChangeLead, scrollUpChangeLead,
+ selectFirstRowChangeLead, selectNextRowChangeLead,
+ selectPreviousRowChangeLead, addToSelection, toggleAndAnchor,
+ extendTo.
+ (MouseInputHandler.mousePressed): Made code more readable by removing
+ unnecessary full qualification from variable 'list'. Change
+ behaviour of shift-click based on whether or not the anchor index is
+ selected.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Added remaining bindings for
+ Table.ancestorMap.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (TableAction.actionPerformed): Made type of variables rowModel and
+ colModel more specific to avoid many casts later on (makes code more
+ readable). Also declare local variable to store the action command to
+ make the code more readable. Implemented the following bindings:
+ selectNextRowChangeLead, selectPreviousRowChangeLead,
+ selectNextColumnChangeLead, selectPreviousColumnChangeLead,
+ addToSelection, extendTo, toggleAndAnchor. Added commented-out debug
+ statement to print unimplemented bindings when used. Added check for
+ the SPACE character to make sure it doesn't stop editing.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Removed leafIcon field.
+ (BasicTreeUI): Removed leafIcon initialization.
+ (installDefaults): Icon defaults were wrong, fixed.
+ (isLocationInExpandControl): Fixed to incorporated gap.
+ (mousePressed): Fixed to include correct icon widths. Sometimes
+ the labels icon is different from what the tree's default icon is
+ set to. Added a check for this.
+ (getCellBounds): No need to include gap here.
+ (getCurrentControlIcon): Fixed to use expandedIcon and collapsedIcon.
+ (paintRow): No need paint beyond preferred width of tree here.
+ (updateCurrentVisiblePath): If nothing is selected, the root should
+ be selected without focus.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installDefaults): Fixed defaults for the expanded/collapsed icons.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComboBox.java
+ (setModel): update the selectedItemReminder field,
+ (selectedItemChanged): only send ItemEvent.SELECTED event if the new
+ selection is non-null.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): only set default editor if the current editor is
+ null or implements UIResource,
+ (uninstallComponents): only clear editor if it implements UIResource.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Set the selected text color for the
+ text component.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (scrollPathToVisible): Reimplemented to make the path visible if its
+ parent is not expanded.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installDefaults): Initialized row height for the tree.
+ (updateCurrentVisiblePath): Updated the visible row count.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Initialized row height for the tree.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (editablePropertyChanged): handle null selected item.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (PropertyChangeHandler.propertyChange): Removed repaint call.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ Filled empty blocks with comments.
+ (ButtonChangeListener.stateChanged): Moved implementation from
+ inner class in createChangeListener to this protected class.
+ (setEnabled): Do nothing if actual state does not change.
+ (createChangeListener): Return instance of ButtonChangeListener
+ here.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (buttonBackground): new field,
+ (shadow): renamed buttonShadow,
+ (darkShadow): renamed buttonDarkShadow,
+ (highlight): renamed buttonHighlight,
+ (installDefaults): initialise buttonBackground, plus updates for
+ renamed fields,
+ (uninstallDefaults): clear buttonBackground, plus updates for renamed
+ fields,
+ (createEditor): return subclass that implements UIResource,
+ (createArrowButton): use constructor that accepts colors,
+ (getMaximumSize): fix API doc error,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): correct 'ComboBox.buttonDarkShadow' default.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (setView): Added repaint() call.
+ (revalidate): Removed unnecessary and unspecified method.
+ (reshape): Fire stateChanged if only the size changes. Do not fire
+ stateChanged if only the location changes.
+ (scrollRectToVisible): Reworked most of this method to correctly
+ determine the scroll offsets. Added validation of view as specified.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (preferredLayoutSize): Removed check for JScrollPane argument.
+ Added code to respect the insets of the JScrollPane.
+ (minimumLayoutSize): Likewise.
+ (layoutContainer): Removed check for JScrollPane argument.
+
+2005-10-18 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (parseContent): Removed bogus println and fixed bug #24422.
+
+2005-10-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (setDividerLocation): Added a check for the size
+ of the splitpane, in some cases the divider's
+ initial location was being set to 0.
+
+2005-10-17 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): Return immediately if the View is null. Check
+ for contentRect being bigger than the port bounds separately in each
+ direction, rather than together.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (KeyHandler): Removed this private class that listened directly for
+ key presses. This is now handled through InputMap-ActionMap pairs.
+ (ActionListenerProxy): New class to wrap the Actions for this lists
+ ActionMap.
+ (ListAction): New class, the actions for keypresses on this list.
+ (convertModifiers): New private method converts key press modifiers to
+ the old style (CTRL_MASK instead of CTRL_DOWN_MASK, etc.).
+ (installKeyboardActions): Get the InputMap from the UIManager and
+ register new InputMap-ActionMap pairs, then set these as the parents
+ of the list's InputMap and ActionMap.
+ (selectNextIndex): Avoid NPE by checking if we're already at the last
+ index.
+ (selectPreviousIndex): Check if we're already at the first index.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Added bindings for List.focusInputMap.
+
+2005-10-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Moved call to installKeyboardActions and Listeners
+ to before expansion of root.
+ (paint): Added check to make sure the cached visible path is updated.
+ (treeExpanded): Added call to update visible path.
+ (treeCollapsed): Likewise.
+ (treeNodesChanged): Likewise.
+ (treeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+ (paintRecursive): Moved code to paintRow.
+ (paintControlIcons): Fixed to paint custom control icons properly.
+ (paintExpandControl): Removed unneeded parameter.
+ (paintRow): Added code to paint the row with the correct width.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Moved code to expand the root after all the listeners
+ have been initialized.
+
+2005-10-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (ItemHandler.itemStateChanged): if combo box is editable, update edit
+ text field with new selection.
+
+2005-10-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/ListDataListener:
+ reformatted and added API docs.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): Set size according to the size property instead of
+ the preferredSize property.
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (ListMouseHandler.mouseReleased): Set comboBox selected index before
+ closing the popup.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Setup colors (more) correctly.
+ * javax/swing/DefaultListSelectionModel.java
+ (isSelectedIndex): Check for an illegal index argument.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ Filled empty blocks with comments.
+ (setVisible): Notify AncestorListeners when visibility state is
+ changed.
+ (removeNotifiy): Notify AncestorListeners via fireAncestorEvent
+ method.
+ (addNotifiy): Notify AncestorListeners via fireAncestorEvent
+ method.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (setView): Removed unnecessary loop. We only have on component.
+ (isOptimizedDrawingEnabled): Added comment explaining why this
+ method is necessary.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ Filled empty blocks with comments.
+ (FocusHandler.focusLost): Close popup when the combobox loses focus.
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ Filled empty blocks with comments.
+ (updateListBoxSelectionForEvent): Implemented partly.
+ (ListMouseHandler.mouseReleased): Call updateListBoxSelectionForEvent.
+ (ListMouseMotionHandler.mouseReleased): Likewise.
+
+2005-10-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java:
+ (CustomCellRenderer): new inner class,
+ (comboState6): new field,
+ (combo11): new field,
+ (combo12): new field,
+ (createContent): add panel from createPanel6(),
+ (createPanel6): new method,
+ (actionPerformed): update state for new JComboBoxes,
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): don't create arrowButton until after listBox is
+ created, set listBox to the JList created by the popup,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java:
+ (MetalComboBoxButton(JComboBox, Icon, boolean, CellRendererPane,
+ JList)): set margins to zero,
+ (paintComponent): use list cell renderer to paint button content,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): add 'List.font' default.
+
+2005-10-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/util/Properties.java:
+ (storeToXML(OutputStream,String)): Implemented.
+ (storeToXml(OutputStream,String,String)): Likewise.
+
+2005-10-17 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Focused_ORB.java: New file.
+ * gnu/CORBA/Functional_ORB.java,
+ org/omg/CORBA/ORB.java: Adapted to support the
+ gnu.CORBA.ListenerPort property.
+
+2005-10-15 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/DynamicImplementation.java: Made concrete.
+ (invoke): Implemented.
+ gnu/CORBA/Simple_delegate.java (request): Implemented.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (treeNodesChanged): Added call to revalidate and resize tree.
+ * javax/swing/tree/DefaultTreeModel.java
+ (insertNodeInto): Needed to set parent for new node.
+
+2005-10-14 Robert Schuster <robertschuster@fsfe.org>
+
+ * java/net/URLStreamHandler.java:
+ (toExternalForm): Use "//" + authority format when file part starts
+ with two slashes.
+
+2005-10-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintLock): Removed unneeded field.
+ (isCompletelyDirty): New field.
+ (setBorder): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint.
+ (paint): Mark this component as clean after painting when the clip
+ covered the whole component.
+ (paintImmediately): Find more sensible paint root via new helper
+ methods.
+ (paintDoubleBuffered): Don't synchronize here.
+ (setFont): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint and revalidate.
+ (setBackground): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint.
+ (setForeground): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint.
+ (setUI): Trigger a repaint.
+ (findPaintRoot): New helper method.
+ (findOverlapFreeParent): New helper method.
+ (findOpaqueParent): New helper method.
+ * javax/swing/RepaintManager.java
+ (ComponentComparator): New inner class. Used to sort components
+ according to their depth in the containment hierarchy.
+ (dirtyComponents): Use HashMap instead of Hashtable.
+ (workDirtyComponents): New field.
+ (repaintOrder): New field.
+ (workRepaintOrder): New field.
+ (comparator): New field.
+ (invalidComponents): Use ArrayList instead of Vector.
+ (workInvalidComponents): New field.
+ (RepaintManager): Initialize new fields.
+ (removeInvalidComponent): Adjusted for ArrayList.
+ (addDirtyRegion): Return if component in question is not showing.
+ Insert the new component in the repaintOrder list.
+ (insertRepaintOrder): New method. Maintains a sorted list of
+ components.
+ (getDirtyRegion): Return empty Rectangle instead of null when
+ component is not dirty, as specified.
+ (markCompletelyDirty): Set flag in JComponent.
+ (markCompletelyClean): Synchronize access to fields.
+ (isCompletelyDirty): Use flag in JComponent to determine this
+ property.
+ (validateInvalidComponents): Use workInvalidComponents when
+ revalidating. This avoids blocking of application threads
+ in revalidate() calls.
+ (paintDirtyRegion): Use work* fields when
+ repainting. This avoids blocking of application threads
+ in repaint() calls. Simplify actual work, now we simply call
+ paintImmediatly() on the dirty components.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/LookAndFeel.java
+ (makeIcon): Implemented.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (updateCachedPreferredSize): Should only add with of control icon if
+ not a leaf.
+ (mousePressed): Fixed to use new gap field.
+ (paintRecursive): Likewise.
+ (paintRow): Likewise.
+ (updateCurrentVisiblePath): Shouldn't include root if it is
+ not of a valid size to be painted.
+
+2005-10-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (isOptimizedDrawingEnabled): New method.
+
+2005-10-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/PolicyErrorHelper.java,
+ org/omg/CORBA/PolicyErrorHolder.java,
+ org/omg/CORBA/UnknownUserExceptionHelper.java,
+ org/omg/CORBA/UnknownUserExceptionHolder.java,
+ org/omg/CORBA/WrongTransactionHelper.java,
+ org/omg/CORBA/WrongTransactionHolder.java: New files.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (nextTabStop): Tab size should be multiplied by the width of 'm', not
+ added to it.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (getTabSize): Check the Document's properties for
+ PlainDocument.tabSizeAttribute before defaulting to 8.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/BoxView.java:
+ (preferenceChanged): New method (overrides method in View). Set flag
+ indicating that cached layout information is invalid, then call super
+ implementation.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/CompositeView.java: Minor doc fixes.
+ * javax/swing/text/BoxView.java: Minor doc fixes.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (getAccessibleContext): Fixed API docs, and returned the correct value.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (updateCachedPreferredSize): Fixed parameter passed to isLeaf, node
+ should be passed in and not a path.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultCaret.java:
+ (ALWAYS_UPDATE): New field.
+ (NEVER_UPDATE): New field.
+ (UPDATE_WHEN_ON_EDIT): New field.
+ (insertUpdate): Fixed docs. Only update the dot if the policy is
+ ALWAYS_UPDATE or if the policy is UPDATE_WHEN_ON_EDT and the event
+ was generated on the Event Dispatch thread.
+ (removeUpdate): Fixed docs. Only update the dot if the policy is
+ ALWAYS_UPDATE, if the policy is UPDATE_WHEN_ON_EDT and the event was
+ generated on the Event Dispatch thread, or if the document length
+ has become less than the current dot position.
+ (setUpdatePolicy): New method.
+ (getUpdatePolicy): New method.
+
+2005-10-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (layoutContainer): Perform layout inside the container's treeLock.
+ Respect the insets of the container.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (getAccessibleSelectionCount): Fixed API documentation.
+ (getScrollableTracksViewportWidth): Was using height instead of
+ width, fixed this.
+ (getScrollableTracksViewportHeight): Likewise.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (BasicTreeUI): Initialized validCachedPreferredSize.
+ (updateCachedPreferredSize): Implemented.
+ (pathWasExpanded): Implemented.
+ (pathWasCollapsed): Implemented.
+ (installDefaults): Fixed API documentation.
+ (uninstallDefaults): Likewise.
+ (setPreferredMinSize): Likewise.
+ (getPreferredMinSize): Likewise.
+ (getPreferredSize): Reimplemented to use updateCachedPreferredSize.
+ (startEditing): set validCachedPreferredSize.
+ (editingStopped): Likewise.
+ (editingCanceled): Likewise.
+ (treeExpanded): Likewise.
+ (treeCollaped): Likewise.
+ (treeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+ (getNextVisibleNode): Fixed API documentation.
+ (getNextNode): Likewise.
+ (getNextSibling): Likewise.
+ (getPreviousSibling): Likewise.
+ (getLevel): Likewise.
+ (paintVerticalPartOfLeg): Likewise.
+
+2005-10-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/PolicyErrorCodeHelper.java: New class.
+
+2005-10-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/LocalObject.java (_get_interface, _invoke, _is_local,
+ _orb, _releaseReply, _request, _servant_postinvoke, _servant_preinvoke,
+ validate_connection): New methods.
+
+2005-10-14 Michael Koch <konqueror@gmx.de>
+
+ * native/jni/midi-alsa/.cvsignore,
+ native/jni/midi-dssi/.cvsignore: New files
+
+2005-10-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/ObjectCreator.java (forName):
+ Use gnu.classpath.VMStackWalker.
+ * gnu/CORBA/Interceptor/Registrator.java,
+ gnu/CORBA/gnuValueHolder.java,
+ gnu/CORBA/stubFinder.java,
+ gnu/javax/rmi/CORBA/DelegateFactory.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ org/omg/CORBA/ORB.java: Load class via ObjectCreator.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (updateDamage): Made this method protected, not package-private.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (xChildren): New field.
+ (yChildren): New field.
+ (xTotal): New field.
+ (yTotal): New field.
+ (offsetsX): New field.
+ (offsetsY): New field.
+ (spansX): New field.
+ (spansY): New field.
+ (preferredLayoutSize): Rewritted to use cached values if available.
+ (minimumLayoutSize): Rewritted to use cached values if available.
+ (maximumLayoutSize): Rewritted to use cached values if available.
+ (layoutContainer): Rewritted to use cached values if available.
+ (getAlignmentX): Implemented.
+ (getAlignmentY): Implemented.
+ (invalidateLayout): Clear the cache.
+ (getSizeRequirements): Removed unneeded method. Replaced by
+ checkRequirements().
+ (checkTotalRequirements): New helper method.
+ (checkRequirements): New helper method.
+ (checkLayout): New helper method.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateAlignedPositions): Determine baseline using the total
+ requirements argument.
+ (adjustFromRight): Use float instead of int for baseline argument.
+ Don't handle the <minimum case.
+ (adjustFromLeft): Likewise.
+
+2005-10-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added leafIcon field.
+ (BasicTreeUI): Initialized leafIcon field.
+ (installDefaults): Fixed icon defaults.
+ (getPreferredSize): Fixed up code slightly.
+ (startEditing): Called revalidate because size of
+ view may change.
+ (EditingStopped): Likewise.
+ (EditingCanceled): Likewise.
+ (mousePressed): Fixed up icon sizes.
+ (paintRecursive): Fixed up width painted.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installDefaults): Fixed icon defaults.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java:
+ (paint): Reset the clip of the Graphics object after each iteration.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (installDefaults): Initialize rendererPane.
+ (paintCell): New method to paint an individual cell using a
+ CellRendererPane, taking borders and highlighting into account.
+ (paint): Removed direct painting code, let paintCell handle this.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (preferredLayoutSize): Added some more null checks to avoid NPEs.
+ (minimumLayoutSize): Added some more null checks to avoid NPEs.
+
+2005-10-13 Jan Roehrich <jan@roehrich.info>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Fixed setting of local JTree reference
+
+2005-10-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPreferredSize): Added check to prevent NPE.
+ (mousePressed): Likewise.
+ (paintRecursive): Likewise.
+ (paintExpandedControlIcons): Likewise.
+ (paintRow): Fixed painting location of textarea.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (updateDamage): Repaint the container if a new line is added.
+
+2005-10-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathForRow): Added check to prevent NPE.
+ (getRowCount): Likewise.
+ (getRowForPath): Likewise.
+ (getPreferredSize): Adjusted width depending on x location and
+ icon.
+ (paintRecursive): Likewise.
+ (getPreviousNode): Added check to prevent NPE.
+ (getNextVisibleNode): Likewise.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/PlainView.java
+ (lineBuffer): New field used as buffer to fetch text from a
+ document.
+ (getLineBuffer): New method, provides access to the new field
+ above.
+ (modelToView): Use new lineBuffer.
+ (drawSelectedText): Likewise.
+ (drawUnselectedText): Likewise.
+ (determineMaxLineLength): Likewise.
+ (viewToModel): Likewise.
+ (updateDamage): Likewise.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/JTextComponent.java
+ (replaceSelection): Removed debug statement.
+ * javax/swing/text/PlainView.java
+ (updateDamage): Removed unnecessary repaint call.
+ (damageLineRange): Trigger repaint over the whole width of the
+ text component at the requested line range. Otherwise we might
+ not clear deleted text.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (DocumentHandler.changedUpdate): Use visibleEditorRect as
+ initial allocation.
+ (DocumentHandler.removeUpdate): Use visibleEditorRect as
+ initial allocation.
+ (DocumentHandler.insertUpdate): Use visibleEditorRect as
+ initial allocation.
+ (getVisibleEditorRect): If component width and height values are
+ invalid (==uninitialized), return a Rectangle of (0,0,0,0) instead
+ of null.
+
+2005-10-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalFileChooserUI.java
+ (DirectoryComboBoxAction): new inner class,
+ (FileRenderer): new inner class,
+ (directoryModel): new private field.
+
+2005-10-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added default value for
+ 'List.focusCellHighlightBorder'.
+
+2005-10-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/UIDefaults.java
+ (getUIClass): Fixed to use the system class loader if
+ the loader is null.
+
+2005-10-12 David Daney <ddaney@avtrex.com>
+
+ PR classpath/24259
+ * gnu/java/net/LineInputStream.java: Import BufferedInputStream.
+ (Constructor): Don't do blockReads on BufferedInputStreams.
+ (readLine): Rename MIN_LENGTH to MAX_LENGTH. Limit buffer size to
+ MAX_LENGTH.
+
+2005-10-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java: Fixed some API docs and unused imports.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintImmediately): Find the paint root more cleverly, instead of
+ going up to the root.
+ (findPaintRoot): New helper method.
+ (findOverlapFreeParent): New helper method.
+ (findOpaqueParent): New helper method.
+ * javax/swing/RepaintManager.java
+ (addDirtyRegion): Collapse overlapping dirty regions into single
+ regions.
+ (paintDirtyRegions): Simple iterator over dirty regions and
+ paint them. The optimizations are done in JComponent and
+ addDirtyRegion.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (minimumLayoutSize): Added checks to avoid NPEs.
+
+2005-10-12 David Daney <ddaney@avtrex.com>
+
+ PR classpath/24086, PR classpath/24091, PR classpath/24104
+ * gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java: Removed.
+ * gnu/java/net/protocol/http/ResponseBodyReader.java: Removed.
+ * gnu/java/net/protocol/http/event/ConnectionEvent.java: Removed.
+ * gnu/java/net/protocol/http/event/ConnectionListener.java: Removed.
+ * gnu/java/net/protocol/http/event/RequestEvent.java: Removed.
+ * gnu/java/net/protocol/http/event/RequestListener.java: Removed.
+ * gnu/java/net/protocol/http/event/package.html: Removed.
+ * gnu/java/net/protocol/http/HTTPConnection.java: Cleaned up imports.
+ (connectionListeners): Removed.
+ (requestListeners): Removed.
+ (pool): New field.
+ (Constructor): Don't initialize connectionListeners or
+ requestListeners.
+ (useCount): New field.
+ (getPoolKey): New method.
+ (setPool): New method.
+ (release): New method.
+ (newRequest): Don't call fireRequestEvent. Use StringBuilder instead
+ of StringBuffer.
+ (close): Don't call fireConnectionEvent.
+ (getURI):Use StringBuilder instead of StringBuffer.
+ (addConnectionListener): Removed.
+ (removeConnectionListener): Removed.
+ (fireConnectionEvent): Removed.
+ (addRequestListener): Removed.
+ (removeRequestListener): Removed.
+ (fireRequestEvent): Removed.
+ * gnu/java/net/protocol/http/HTTPURLConnection.java:Cleaned up imports.
+ (connectionPool): Changed type to LinkedHashMap.
+ (maxConnections): Made static.
+ (responseSink): Changed type to InputStream.
+ (errorSink): Likewise.
+ (connect): Eliminate reader. Get responseSink from response.
+ (getConnection): Rewrote.
+ (getHeaderFields): Use null as key for status line. Return
+ unmodifiable Map.
+ * gnu/java/net/protocol/http/Headers.java: Extend LinkedHashMap,
+ instead of implement Map.
+ (headers): Removed.
+ (Constructor): Do not initialize headers.
+ (size): Removed.
+ (isEmpth): Removed.
+ (containsKey): Rewrote.
+ (containsValue): Removed.
+ (get): Call super.get().
+ (getValue): Likewise.
+ (getLongValue): New method.
+ (put): Call super.put().
+ (remove): Call super.remove().
+ (putAll): Rewrote.
+ (clear): Removed.
+ (keySet): Call super.keySet().
+ (values): Removed.
+ (entrySet): Call super.entrySet().
+ (equals): Removed.
+ (hashCode): Removed.
+ (parse): Use StringBuilder instead of StringBuffer.
+ (addValue): Call super.* instead of headers.*.
+ * gnu/java/net/protocol/http/LimitedLengthInputStream.java: New class.
+ * gnu/java/net/protocol/http/Request.java: Cleaned up imports.
+ (responseBodyReader): Removed.
+ (setResponseBodyReader): Removed.
+ (dispatch): Don't create LineInputStream. Don't call fireRequestEvent.
+ Don't append CRLF to Request body. Handle unsolicited 100 Continue
+ response.
+ (readResponse): Rewrote.
+ (readResponseBody): Renamed to ...
+ (createResponseBodyStream): ... And rewritten.
+ (parseAuthParams): Use StringBuilder instead of StringBuffer.
+ (getNonceCount): Likewise.
+ (handleSetCookie): Likewise.
+ * gnu/java/net/protocol/http/Response.java: Cleaned up imports.
+ (codeClass): Removed.
+ (body): New field.
+ (Constructor): Don't initialize codeClass. Initialize body.
+ (getCodeClass): Rewrote.
+ (getLongHeader): New method.
+ (getBody): New method.
+ * gnu/java/net/protocol/http/ChunkedInputStream.java (read): Use
+ StringBuilder instead of StringBuffer.
+ * gnu/java/net/protocol/http/Cookie.java (toString): Use StringBuilder
+ instead of StringBuffer.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ (getFileView): Don't call back into the JFileChooser, avoids
+ a StackOverflow.
+ (getApproveButtonText): Likewise.
+
+2005-10-12 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #22841
+ * java/io/ObjectInputStream (validators): Removed field.
+ (isDeserializing): Removed field.
+ (currentObjectValidators): New field.
+ (ObjectInputStream): Remove validators and isDeserializing
+ initialization.
+ (readObject): Remove isDeserializing logic. Don't call
+ invokeValidators() here.
+ (parseContent): Call invokeValidators() after TC_OBJECT done.
+ (registerValidation): Create currentObjectValidators if needed.
+ (invokeValidators): Rewritten.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/CellRendererPane.java
+ (paintComponent): Fix clipping of cells.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (paint): Fix clipping of cells.
+
+2005-10-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (insertString): Don't include an ElementChange if no children were
+ added.
+ (remove): Don't include an ElementChange if no children were removed.
+
+2005-10-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (insertOrRemoveUpdate): Renamed this method to udpateDamage because
+ changedUpdate calls it as well.
+ (updateDamage): This method used to be named insertOrRemoveDamage.
+ Changes are: If no children were added or removed, repaint only the
+ area containing the line that was changed. Also, if children were
+ added or removed, call repaint on the entire container. Also fixed a
+ serious logic error in the bounds for Document.getText().
+ (insertUpdate): Changed call from insertOrRemoveUpdate to updateDamage
+ and removed repaint call (this is done in updateDamage).
+ (removeUpdate): Likewise.
+ (changedUpdate): Implemented.
+ (damageLineRange): Implemented.
+
+2005-10-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (treeExpanded): Added revalidate call.
+ (treeCollapsed): Likewise.
+ (treeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+
+2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added defaults for FileView.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (sizeChanged): A new flag, indicating when the size of the
+ viewport has changed relative to the last painting operation.
+ (reshape): Set sizeChanged flag if size has changed.
+ (paintBackingStore): Only create new backingstore image when
+ the size has changed.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (reshape): Fixed calculation of newBounds and oldBounds to create
+ rectangles relative to the parent, and not to the parent's parent.
+ Solves a painting problem in an app here.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ComponentUI.java
+ (update): Only fill the current clip. This solves a problem with
+ components in JViewport and should also optimize drawing a little.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (preferredLayoutSize): Reworked. The old impl used to actually
+ modify the layout, which is not allowed.
+ (minimumLayoutSize): Reworked. The old impl used to actually
+ modify the layout, which is not allowed.
+ (layoutContainer): Reworked. The old impl did not properly determine
+ when the scrollbars should be visible and when not.
+
+2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (FileIcon16.getIconHeight): add result of getAdditionalHeight(),
+ (FolderIcon16.getIconHeight): add result of getAdditionalHeight(),
+ (checkBoxIcon): new private field,
+ (checkBoxMenuItemIcon): likewise,
+ (fileChooserDetailViewIcon): likewise,
+ (fileChooserHomeFolderIcon): likewise,
+ (fileChooserListViewIcon): likewise,
+ (fileChooserNewFolderIcon): likewise,
+ (fileChooserUpFolderIcon): likewise,
+ (radioButtonMenuItemIcon): likewise,
+ (internalFrameDefaultMenuIcon): likewise,
+ (treeComputerIcon): likewise,
+ (treeFloppyDriveIcon): likewise,
+ (treeHardDriveIcon): likewise,
+ (getCheckBoxIcon): return single instance,
+ (getCheckBoxMenuItemIcon): likewise,
+ (getFileChooserDetailViewIcon): likewise,
+ (getFileChooserHomeFolderIcon): likewise,
+ (getFileChooserListViewIcon): likewise,
+ (getFileChooserNewFolderIcon): likewise,
+ (getFileChooserUpFolderIcon): likewise,
+ (getRadioButtonMenuItemIcon): likewise,
+ (getInternalFrameDefaultMenuIcon): likewise,
+ (getTreeComputerIcon): likewise,
+ (getTreeFloppyDriveIcon): likewise,
+ (getTreeHardDriveIcon): likewise.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AbstractButton): Set button to be opaque.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JList.java
+ (locationToIndex): Put opening brace on next line.
+ (indexToLocation): Call UI's indexToLocation.
+ (getCellBounds): Replaced cast with getUI() call.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JFileChooser.java
+ (getDialogTitle): If no dialog title has been set, forward this
+ call to the UI.
+ (getApproveButtonText): If no text has been set, forward this
+ call to the UI.
+ (getFileView): If no file view has been set, forward this call
+ to the UI.
+ (getInternalFileView): Removed unneeded method.
+ (getName): Call getFileView instead of getInternalFileView.
+ (getDescription): Call getFileView instead of getInternalFileView.
+ (getTypeDescription): Call getFileView instead of
+ getInternalFileView.
+ (getIcon): Call getFileView instead of getInternalFileView.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (setFont): Only get active if the new font differs from the old one.
+ Call revalidate when font changes.
+ (setUI): Call revalidate when UI changes.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComboBox.java
+ (isFocusTraversable): Removed unneeded and unspecified method.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (ViewListener.componentResized): Only call revalidate instead of
+ going through weird reverting code.
+ (JViewport): First call updateUI, then set layout.
+ (setViewPosition): Don't do anything if there is no real
+ change.
+ (setView): Don't remove the old component. This is handled by
+ addImpl. Call revalidate().
+ * javax/swing/ViewportLayout.java
+ (layoutContainer): Preferably set view size to it's preferredSize
+ instead of its minimumSize.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/JTextComponent.java
+ (getToolTipText): New method.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Fixed value for
+ Table.focusCellHighlightBorder.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (installDefaults): Use UIManager.get* methods instead of
+ UIManager.getDefaults().get* methods.
+ * javax/swing/plaf/basic/BasicColorChooserUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (installDefaults): Only install background color, if installed
+ color is null or an UIResource instance.
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicListUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Added default for List.font.
+ * javax/swing/plaf/basic/BasicMenuBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicPanelUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicPopupMenuUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicProgressBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicSeparatorUI.java
+ (installDefaults): Use UIManager.get* methods instead of
+ UIManager.getDefaults().get* methods.
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicSpinnerUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
+ (installDefaults): Use UIManager.get* methods instead of
+ UIManager.getDefaults().get* methods.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/LookAndFeel.java
+ (installBorder): Implemented.
+ (installColors): Implemented.
+ (installColorsAndFont): Implemented.
+
+2005-10-12 Mark Wielaard <mark@klomp.org>
+
+ Reported by Christian Thalinger <twisti@complang.tuwien.ac.at>
+ * native/jni/java-lang/java_lang_VMProcess.c
+ (Java_java_lang_VMProcess_nativeSpawn): Don't delete clazz local
+ reference twice.
+
+2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/SwingPropertyChangeSupport.java
+ (firePropertyChange(PropertyChangeEvent)): if old and new values are
+ both null, listeners should be notified.
+
+2005-10-11 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java
+ (setSelectedItem): allow values not in list, and don't fire an event
+ if the value is unchanged.
+
+2005-10-11 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ (getPositionsInRange): Corrected interval check. This mirrors Roman's
+ change in GapContent from 2005-10-05 for adjustPositionsInRange and
+ setPositionsInRange.
+
+2005-10-11 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (viewToModel): Implemented.
+ * javax/swing/text/DefaultCaret.java:
+ (mousePressed): Implemented.
+ * javax/swing/text/PlainView.java:
+ (viewToModel): Implemented.
+
+2005-10-11 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (insertUpdate): Repaint the JTextComponent after the update.
+ (removeUpdate): Likewise.
+
+2005-10-11 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JFileChooser.java: Added API docs all over.
+
+2005-10-11 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ (AccessibleJEditorPaneHTML): New inner class.
+ (JEditorPaneAccessibleHypertextSupport): New inner class.
+ (getAccessibleContext): Handle special case when we have
+ a HTMLEditorKit.
+ (setEditorKit): Reset the accessibleContext.
+
+2005-10-11 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileSystemView.java
+ (defaultFileSystemView): new private field,
+ (getFileSystemView): initialise (if necessary) and return
+ defaultFileSystemView.
+
+2005-10-11 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
+ (main): Message removed from the loop.
+
+2005-10-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
+ (main): 3 sec pause replaced by while(..) loop.
+
+2005-10-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/Registrator.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/gnuValueHolder.java,
+ gnu/CORBA/stubFinder.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ org/omg/CORBA/ORB.java: Use context class loader.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/View.java
+ (modelToView(pos, Shape)): New method.
+ (viewToModel(float, float, Shape)): New method.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ (AccessibleJEditorPane): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJEditorPane.
+ * javax/swing/JScrollPane.java
+ (AccessibleJScrollPane): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJScrollPane.
+ (setViewport): Call accessibleContext's resetViewPort() method.
+ * javax/swing/JTextArea.java
+ (AccessibleJTextArea): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJTextArea.
+ * javax/swing/JTextField.java
+ (AccessibleJTextField): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJTextField.
+ * javax/swing/JRootPane.java
+ (defaultPressAction): New field.
+ (defaultReleaseAction): New field.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JMenuBar.java
+ (AccessibleJMenuBar): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJMenuBar.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintChildren): Skip children if their clip _doesn't_ hit the
+ current clip.
+ (setVisible): Do nothing if the actual value didn't change.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Graphics.java
+ (hitClip): Implemented this method.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Graphics.java: Reformatted file.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * java/beans/IndexedPropertyDescriptor.java
+ (setIndexedReadMethod): Changed signature to throw
+ IntrospectionException as specified.
+ (setIndexedWriteMethod): Changed signature to throw
+ IntrospectionException as specified.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (rectCache): New field. Caches Rectangle objects for reuse.
+ (paintChildren): Changed to reuse cached Rectangle object.
+
+2005-10-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/border/TitledBorder.java
+ (TitledBorder(String)): Changed default justification and position,
+ (TitledBorder(Border)): Likewise,
+ (TitledBorder(Border, String)): Likewise,
+ (BorderPainter.paint(Graphics)): Use full width and height,
+ (BorderPainter.paintExcept): Fixed bounds for region 3,
+ (paintBorder): indented left justified title further, adjusted
+ ABOVE_TOP text position, adjusted bounds for call to paintExcept(),
+ updated for renamed fields in Measurements class,
+ (getMeasurements): added special handling for null text, increased
+ outer spacing, adjusted spacing for TOP, BOTTOM and BELOW_BOTTOM title
+ positions,
+ (Measurements.borderSpacing): renamed outerSpacing,
+ (Measurements.edgeSpacing): renamed innerSpacing,
+ (Measurements.getContentInsets): updated for renamed fields,
+ (Measurements.getMinimumSize): wrap at 80 columns.
+
+2005-10-09 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #24006
+ * java/net/Socket.java (bound): Make package private.
+ * java/net/ServerSocket.java (implAccept): Set Socket.bound to true.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (process): call run_multiple_synths if required.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Attempt
+ to connect to the jack server automatically. Fail gracefully.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * gnu/javax/sound/midi/dssi/DSSISynthesizer.java (loadInstrument):
+ Implement.
+ (selectProgram_): New native method.
+ * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (selectProgram_): New function.
+
+2005-10-07 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkChoicePeer.java (postChoiceItemEvent):
+ Don't call select on the AWT Choice component.
+ * java/awt/Choice.java (processItemEvent): Set the selected index
+ without calling into the peers.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+ Doc cleanups.
+ (DSSISynthesizer.DSSISoundbank): New class.
+ (DSSISynthesizer.DSSIInstrument): New class.
+ (soundbanks, defaultSoundbank): New fields.
+ (getDefaultSoundbank): Implemented.
+ (getAvailableInstruments): Implemented.
+ (getProgramName_, getProgramBank_, getProgramProgram_): New native
+ methods.
+ (DSSISynthesizer): Create default soundbank.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1,
+ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1,
+ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1):
+ New functions.
+ * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (tableChanged): Revalidate table if its structure changes.
+
+2005-10-07 Jan Roehrich <jan@roehrich.info>
+
+ * javax/swing/JTree.java: (JTree):
+ * javax/swing/plaf/basic/BasicTreeUI.java: (updateRenderer):
+ moved setting of TreeCellRenderer from JTree to BasicTreeUI.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * java/beans/IndexedPropertyDescriptor.java
+ (setIndexedReadMethod): New method.
+ (setIndexedWriteMethod): New method.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * java/beans/IndexedPropertyDescriptor.java: Reformatted.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (currentIcon): Fix icon for disabled selected buttons.
+ (paint): Only paint focus indicator if button is actually
+ focusPainted.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (installDefaults): Install icons for disabledIcon and
+ disabledSelectedIcon.
+ (paint): Paint the correct icon. Only paint focus indicator
+ if button is actually focusPainted.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (paint): Only paint focus indicator if button is actually
+ focusPainted.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Call paintBorder before paintChildren.
+ (reshape): Fire AncestorEvent if position has changed.
+ (fireAncestorMoved): New method. Fires AncestorEvents to this
+ component and all of it's children.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BorderFactory.java
+ (createLineBorder(Color)): Forward call to
+ createLineBorder(Color, int) with thickness of 1.
+
+2005-10-06 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Ignore
+ controllers that aren't mapped to MIDI controls.
+
+2005-10-06 Anthony Green <green@redhat.com>
+
+ * INSTALL: Describe midi provider dependencies.
+
+ * native/jni/midi-dssi/README: New file.
+ * LICENSE (terms): Add notice about code copied from the DSSI
+ distribution.
+
+ * examples/gnu/classpath/examples/midi/Demo.java: New file.
+
+ * native/jni/midi-dssi/dssi_data.h (dssi_data): Add control_count,
+ control_port_map, control_value_map, sample_rate, and
+ control_values fields.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (DEBUG_DSSI_PROVIDER): New macro.
+ (get_port_default): New function.
+ (set_control): New function.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Remove
+ debug output. Reformat. Allocate the control ports and assign
+ proper default values.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1): Use
+ JLONG_TO_PTR.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1): Ditto.
+ * gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+ (Channel.controlChange): Implement.
+ (controlChange_): New native method.
+ * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt.
+
+ * gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java: Make
+ instance final.
+
+2005-10-06 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (determineMaxLength): Avoid NPE by checking the Segment that getText
+ returns. No need to return Math.max (0, maxLineLength) because
+ maxLineLength is guaranteed to be 0 or greater.
+
+2005-10-06 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (determineMaxLength): If maxLineLength is -1 we should return 0.
+ (insertOrRemoveUpdate): Avoid NPE by checking the Segment that
+ getText returns.
+
+2005-10-06 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/metadata/IIOMetadata.java: Complete.
+
+2005-10-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (paint): Only call paintChild if child allocation is not empty.
+ (layout): Don't store the width and height fields here.
+ (setSize): Store the width and height fields here.
+ * javax/swing/text/CompositeView.java
+ (getViewIndexAtPosition): Reworked child view searching.
+ (getInsideAllocation): Fixed insets calculation.
+ * javax/swing/text/FlowView.java
+ (FlowStrategy.layoutRow): Return an offset of -1 if no more child
+ views are in the logical view.
+ (FlowStrategy.createView): If there are no more child views,
+ then return null.
+ (LogicalView.getViewIndex): New method. Implements child view
+ searching for the LogicalView.
+ * javax/swing/text/GlyphView.java
+ (DefaultGlyphPainter.getHeight): Use Toolkit FontMetrics instead
+ of parent containers FontMetrics.
+ (DefaultGlyphPainter.getSpan): Use Toolkit FontMetrics instead
+ of parent containers FontMetrics.
+ * javax/swing/text/Utilities.java
+ (getTabbedTextOffset): Check for 0 in the char array and stop
+ there.
+ * javax/swing/text/View.java
+ (getContainer): If there's no parent, don't throw an Error, instead
+ return null as specified.
+
+2005-10-06 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java: Implemeted locking.
+ (insertString): Obtain write lock before altering document.
+ (readLock): Implemented.
+ (readUnlock): Implemented.
+ (remove): Obtain write lock before altering document.
+ (render): Implemented.
+ (writeLock): Implemented.
+ (writeUnlock): Implemented.
+ (getCurrentWriter): Implemented.
+
+2005-10-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLabel.java
+ (JLabel): Set alignmentX value to 0.0F.
+
+2005-10-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (startEditing): Should always change the bounds, whenever
+ we start editing.
+ (paintRow): Fixed location where editing component should
+ be drawn. The constant takes care of the space around the
+ icon.
+ * javax/swing/JTree.java
+ (JTree): Called updateUI first so currentVisiblePath is
+ cached right away. Prevents NPEs.
+
+2005-10-06 Tom Tromey <tromey@redhat.com>
+
+ * javax/print/attribute/SetOfIntegerSyntax.java (toString): Wrote.
+ (hashCode): Likewise.
+ (equals): Likewise.
+ (getMembers): Likewise.
+ (contains): Fixed boundary condition check.
+ (next): Wrote.
+ (normalize): Rewrote.
+ (SetOfIntegerSyntax): Updated.
+ (SetOfIntegerSyntax(String)): New constructor.
+ (skipNumber): New method.
+ (skipWhitespace): Likewise.
+
+2005-10-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicRootPaneUI.java
+ (installUI): Call new hook methods.
+ (installDefaults): New hook method.
+ (installComponents): New hook method.
+ (installListeners): New hook method.
+ (installKeyboardActions): New hook method.
+ (uninstallUI): New method.
+ (uninstallDefaults): New hook method.
+ (uninstallComponents): New hook method.
+ (uninstallListeners): New hook method.
+ (uninstallKeyboardActions): New hook method.
+
+2005-10-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mousePressed): Shouldn't change x location for leaf.
+
+2005-10-06 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * configure.ac: Add Qt4 configury bits for OS-X.
+
+2005-10-05 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintRow): Fixed indentation.
+ (updateCurrentVisiblePath): Added FIXME
+ comment.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (baselineLayout): New method.
+ (calculateMajorAxisRequirements): Reimplemented to use the
+ SizeRequirements utility methods.
+ (calculateMinorAxisRequirements): Reimplemented to use the
+ SizeRequirements utility methods.
+ (layout): Use the new baselineLayout method.
+ (layoutMajorAxis): Reimplemented to use the new
+ getChildRequirements method.
+ (layoutMinorAxis): Reimplemented to use the new
+ getChildRequirements method.
+ (getChildRequirements): New method.
+ (getSpan): New method.
+ (getOffset): New method.
+ (getAlignment): New method.
+ * javax/swing/text/ParagraphView.java
+ (Row.getAlignment): New method.
+ (getAlignment): New method.
+ * javax/swing/text/View.java
+ (getContainer): Improved error message in assertion a little.
+
+2005-10-05 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Fixed to call toggleExpandState instead.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathForRow): Used currentVisiblePath to get Path.
+ (getRowForPath): Used currentVisiblePath to get row.
+ (getRowCount): Returned currentVisiblePath length.
+ (updateLayoutCacheExpandedNodes): Took out unneeded code.
+ (installUI): Fixed to call toggleExpandState instead.
+ (getPreferredSize): Made more efficent by using currentVisiblePath.
+ (toggleExpandState): Called updateCurrentVisiblePath.
+ (getCellLocation): Made more efficent.
+ (paintNode): Removed.
+ (paintRecursive): Made more efficent, changed paintNode calls to
+ paintRow.
+ (getNextVisibleNode): Reimplemented to use currentVisiblePath.
+ (getPreviousVisibleNode): Likewise.
+ (paintRow): Implemented.
+ (updateCurrentVisiblePath): New helper used to cache the current
+ visible path.
+
+2005-10-05 Mark Wielaard <mark@klomp.org>
+
+ Reported by Nicolas Geoffray <nicolas.geoffray@lip6.fr>
+ * java/security/AccessController.java
+ (doPrivileged(PrivilegedExceptionAction)): If the Exception is a
+ Runtime exception, then throw the exception directly, otherwise
+ wrap it.
+ (doPrivileged(PrivilegedExceptionAction,AccessControlContext)):
+ Likewise.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GapContent.java
+ (setPositionsInRange): Changed check for interval end to actually
+ check for the position offsets.
+ (adjustPositionsInRange): Changed check for interval end to actually
+ check for the position offsets.
+ (dump): New method for debugging.
+ (dumpPositions): New method for debugging.
+
+2005-10-05 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * m4/acattribute.m4: Added.
+ * configure.ac: Added AC_C_ATTRIBUTE.
+ * native/fdlibm/java-assert.h: Added missing config.h include,
+ changed comments to C comments.
+ * native/jni/java-lang/java_lang_reflect_Array.c: Added missing
+ config.h include.
+
+2005-10-05 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (insertOrRemoveUpdate): New method.
+ (insertUpdate): New method.
+ (removeUpdate): New method.
+
+2005-10-05 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/JOptionPane.java
+ (showInputDialog(Component,Object,String,int,Icon,Object[],Object)):
+ Don't cast return value.
+ (internalShowInputDialog(Component,Object,String,int,Icon,Object[],
+ Object)): Likewise.
+
+2005-10-05 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/EmptyExceptionHolder.java,
+ gnu/CORBA/ForwardRequestHelper.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/_PolicyImplBase.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/universalHolder.java,
+ org/omg/CORBA/CompletionStatus.java,
+ org/omg/CORBA/NameValuePairHelper.java,
+ org/omg/CORBA/ObjectHelper.java,
+ org/omg/CORBA/PolicyHelper.java,
+ org/omg/CORBA/PolicyListHelper.java,
+ org/omg/CORBA/ServiceDetailHelper.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CosNaming/BindingHelper.java,
+ org/omg/CosNaming/BindingIteratorHelper.java,
+ org/omg/CosNaming/BindingIteratorPOA.java,
+ org/omg/CosNaming/BindingTypeHelper.java,
+ org/omg/CosNaming/NameComponentHelper.java,
+ org/omg/CosNaming/NameHelper.java,
+ org/omg/CosNaming/NamingContextExtHelper.java,
+ org/omg/CosNaming/NamingContextExtPOA.java,
+ org/omg/CosNaming/NamingContextHelper.java,
+ org/omg/CosNaming/NamingContextPOA.java,
+ org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java,
+ org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java,
+ org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java,
+ org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java,
+ org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java,
+ org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java,
+ org/omg/CosNaming/_BindingIteratorImplBase.java,
+ org/omg/CosNaming/_NamingContextImplBase.java,
+ org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java,
+ org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java,
+ org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java,
+ org/omg/DynamicAny/DynAnySeqHelper.java,
+ org/omg/DynamicAny/NameDynAnyPairHelper.java,
+ org/omg/DynamicAny/NameDynAnyPairSeqHelper.java,
+ org/omg/DynamicAny/NameValuePairHelper.java,
+ org/omg/DynamicAny/NameValuePairSeqHelper.java,
+ org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java,
+ org/omg/IOP/CodecPackage/FormatMismatchHelper.java,
+ org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java,
+ org/omg/IOP/CodecPackage/TypeMismatchHelper.java,
+ org/omg/IOP/IORHelper.java,
+ org/omg/IOP/MultipleComponentProfileHelper.java,
+ org/omg/IOP/ServiceContextHelper.java,
+ org/omg/IOP/ServiceContextListHelper.java,
+ org/omg/IOP/TaggedComponentHelper.java,
+ org/omg/IOP/TaggedProfileHelper.java,
+ org/omg/PortableInterceptor/ForwardRequestHelper.java,
+ org/omg/PortableInterceptor/InvalidSlotHelper.java,
+ org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java,
+ org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java,
+ org/omg/PortableServer/CurrentPackage/NoContextHelper.java,
+ org/omg/PortableServer/ForwardRequestHelper.java,
+ org/omg/PortableServer/IdAssignmentPolicyValue.java,
+ org/omg/PortableServer/IdUniquenessPolicyValue.java,
+ org/omg/PortableServer/ImplicitActivationPolicyValue.java,
+ org/omg/PortableServer/LifespanPolicyValue.java,
+ org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java,
+ org/omg/PortableServer/POAManagerPackage/State.java,
+ org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java,
+ org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java,
+ org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java,
+ org/omg/PortableServer/POAPackage/NoServantHelper.java,
+ org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java,
+ org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java,
+ org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java,
+ org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java,
+ org/omg/PortableServer/POAPackage/WrongAdapterHelper.java,
+ org/omg/PortableServer/POAPackage/WrongPolicyHelper.java,
+ org/omg/PortableServer/RequestProcessingPolicyValue.java,
+ org/omg/PortableServer/Servant.java,
+ org/omg/PortableServer/ServantLocatorHelper.java,
+ org/omg/PortableServer/ServantRetentionPolicyValue.java,
+ org/omg/PortableServer/ThreadPolicyValue.java: Added minor codes for BAD_PARAM and NO_RESOURCES.
+ * gnu/CORBA/Minor.java: Introduces new minor codes.
+ * org/omg/CORBA/BAD_OPERATION.java,
+ org/omg/CORBA/MARSHAL.java,
+ org/omg/CORBA/NO_RESOURCES.java: Documentation update.
+
+2005-10-05 Stuart Ballard <stuart.a.ballard@gmail.com>
+
+ * java/rmi/LoaderHandler.java (packagePrefix): Match Sun's value.
+ * java/rmi/RemoteRef.java (packagePrefix): Likewise.
+ * java/rmi/RemoteObject.java (readObject): Hardcode the GNU package
+ prefix.
+
+2005-10-05 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (remove): If removing content returns an UndoableEdit, then add an
+ ElementEdit to the DocumentEvent before firing.
+ * javax/swing/text/GapContent.java:
+ (UndoRemove): New class to implement UndoableEdit for remove operation.
+ (remove): Return an UndoableEdit instead of null.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/LabelView.java
+ (LabelView): Implemented the constructor.
+ (setPropertiesFromAttributes): New method.
+ (changedUpdate): New method.
+ (getBackground): New method.
+ (setBackground): New method.
+ (getForeground): New method.
+ (getFont): New method.
+ (getFontMetrics): New method.
+ (isUnderline): New method.
+ (setUnderline): New method.
+ (isSubscript): New method.
+ (setSubscript): New method.
+ (isSuperscript): New method.
+ (setSuperscript): New method.
+ (isStrikeThrough): New method.
+ (setStrikeThrough): New method.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/JTableHeader.java
+ (accessibleContext): Removed unneeded field. The protected
+ field with the same name should be used instead.
+ (JTableHeader): Moved field initialization to new method
+ initializeLocalVars().
+ (setColumnModel): Add and remove this to the old and new model.
+ (columnAdded): New listener method.
+ (columnMarginChanged): New listener method.
+ (columnMoved): New listener method.
+ (columnRemoved): New listener method.
+ (columnSelectionChanged): New listener method.
+ (resizeAndRepaint): New method.
+ (initializeLocalVars): New method.
+
+2005-10-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java: Added API docs all
+ over.
+
+2005-10-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (insertString): If inserting a string into the Content returns an
+ UndoableEdit, then add an ElementEdit to the DocumentEvent before
+ firing.
+ (remove): Don't fire a removeUpdate unless some content was actually
+ removed.
+ * javax/swing/text/GapContent.java:
+ (UndoInsertString): New class to implement UndoableEdit functions.
+ (insertString): Return an UndoableEdit instead of null. Also use
+ locally calculated length of String rather than calculating again.
+ * javax/swing/text/JTextComponent.java:
+ (setText): If the Document is an AbstractDocument this should pass
+ through AbstractDocument.replace rather than calling remove and insert.
+ * javax/swing/text/PlainView.java:
+ (determineMaxLength): Keep track of which line was the longest as well
+ as the length of it. We'll need this to know when the longest line is
+ removed and we need to redetermine the longest line.
+
+2005-10-04 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/ImageWriter.java
+ (processWarningOccurred(int,String,String)): New method.
+ * javax/imageio/ImageReader.java
+ (processWarningOccurred(String,String)): New method.
+
+2005-10-04 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/ImageReader.java (getDestination): Throw
+ IIOException, not IOException.
+ * javax/imageio/ImageTypeSpecifier.java
+ (createGrayscale(int,int,boolean)): Rename from createGrayScale.
+ (createGrayscale(int,int,boolean,boolean)): Likewise.
+ (createIndexed): Rename from createIndex.
+
+2005-10-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * doc/www.gnu.org/corba.wml:
+ Link to http://doc.omg.org/vendor-tags.
+
+2005-10-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Minor.java: New file.
+ * gnu/CORBA/CDR/IDLTypeHelper.java,
+ gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/CDR/gnuRuntime.java,
+ gnu/CORBA/CDR/noHeaderInput.java,
+ gnu/CORBA/DynAn/gnuDynValue.java,
+ gnu/CORBA/GIOP/CloseMessage.java,
+ gnu/CORBA/GIOP/ErrorMessage.java,
+ gnu/CORBA/GIOP/MessageHeader.java,
+ gnu/CORBA/GIOP/v1_2/RequestHeader.java,
+ gnu/CORBA/IOR.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Version.java,
+ gnu/CORBA/cdrEncapsCodec.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/CORBA/streamReadyHolder.java,
+ gnu/CORBA/universalHolder.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ gnu/javax/rmi/CORBA/corbaObjectOutput.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/StructMemberHelper.java,
+ org/omg/CORBA/UnionMemberHelper.java,
+ org/omg/CORBA/ValueMemberHelper.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CORBA/_IDLTypeStub.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ org/omg/DynamicAny/_DynAnyFactoryStub.java,
+ org/omg/IOP/TaggedComponentHelper.java,
+ org/omg/IOP/TaggedProfileHelper.java,
+ org/omg/PortableInterceptor/CurrentHelper.java,
+ org/omg/PortableServer/POAHelper.java,
+ org/omg/PortableServer/ServantActivatorHelper.java,
+ org/omg/PortableServer/ServantLocatorHelper.java:
+ Initialising minor codes for MARSHAL.
+ * org/omg/CORBA/SystemException.java: Documentation update and
+ add minor code to the exception message.
+ * org/omg/CORBA/MARSHAL.java: Documentation update.
+
+2005-10-04 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/metal/MetalBorders.java (paintBorder): Check
+ whether Component is JTextComponent.
+
+2005-10-04 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * javax/imageio/ImageWriter.java (availableLocales, locale,
+ originatingProvider, output, progressListeners, warningListeners,
+ warningLocales): Initialize.
+ (addIIOWriteProgressListener): Check progressListeners against null
+ to avoid NPE. Create new ArrayList if progressListeners is null.
+ (addIIOWriteWarningListener): Likewise for warningListeners.
+ (processImageComplete): Check progressListeners against null to
+ avoid NPE.
+ (processImageProgress): Likewise.
+ (processImageStarted): Likewise.
+ (processThumbnailComplete): Likewise.
+ (processThumbnailProgress): Likewise.
+ (processThumbnailStarted): Likewise.
+ (processWarningOccurred): Likewise for warningListeners.
+ (processWriteAborted): Likewise for progressListeners.
+ (removeAllIIOWriteProgressListeners): Likewise.
+ (removeAllIIOWriteWarningListeners): Likewise.
+ (removeIIOWriteProgressListener): Likewise.
+ (removeIIOWriteWarningListener): Likewise for warningListeners.
+
+ * javax/imageio/ImageReader.java (addIIOReadProgressListener): Check
+ progressListeners against null to avoid NPE. Create new ArrayList
+ if progressListeners is null.
+ (addIIOReadUpdateListener): Likewise for updateListeners.
+ (addIIOReadWarningListener): Likewise for warningListeners.
+ (processImageComplete): Check progressListeners against null to
+ avoid NPE.
+ (processImageProgress): Likewise.
+ (processImageStarted): Likewise.
+ (processImageUpdate): Likewise for updateListeners.
+ (processPassComplete): Likewise.
+ (processPassStarted): Likewise.
+ (processReadAborted): Likewise for progressListeners.
+ (processSequenceComplete): Likewise.
+ (processSequenceStarted): Likewise.
+ (processThumbnailComplete): Likewise.
+ (processThumbnailPassComplete): Likewise for updateListeners.
+ (processThumbnailPassStarted): Likewise.
+ (processThumbnailProgress): Likewise for progressListeners.
+ (processThumbnailStarted): Likewise.
+ (processThumbnailUpdate): Likewise for updateListeners.
+ (processWarningOccurred): Likewise for warningListeners.
+ (removeIIOReadProgressListener): Likewise for progressListeners.
+ (removeIIOReadUpdateListener): Likewise for updateListeners.
+ (removeIIOReadWarningListener): Likewise for warningListeners.
+
+2005-10-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/metal/MetalToolTipUI.java
+ (paint): Added space around the toolTip's accelerator.
+ (fetchAcceleratorString): Added code to get mnemonic for
+ JMenuItem if it does not have an accelerator.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (repaint): Adjust repaint rectangle.
+ (setVisible): Only repaint if the visible property actually changed.
+
+2005-10-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/JTextComponent.java: Reformatted file.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24080
+ * javax/swing/SizeRequirements.java
+ (adjustGreater): Added check to prevent overflow.
+
+2005-10-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (accText): removed,
+ (accDeliminator): removed,
+ (accFont): removed,
+ (accFore): removed,
+ (getPreferredSize): removed accelerator code (now in MetalToolTipUI),
+ (getAcceleratorText): removed (equivalent is now in MetalToolTipUI),
+ (paint): removed accelerator painting,
+ * javax/swing/plaf/metal/MetalToolTipUI.java
+ (padSpaceBetweenStrings): new field,
+ (MetalToolTipUI): initialise defaults,
+ (getAcceleratorString): new method,
+ (installUI): new method,
+ (uninstallUI): new method,
+ (isAcceleratorHidden): new method,
+ (getPreferredSize): new method,
+ (paint): new method,
+ (fetchAcceleratorString): new private method,
+ (acceleratorToString): new private method,
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkButton): set tool tip.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getFont): Fall back to peer.getGraphics().getFont() if no font
+ is found.
+ (getGraphics): Set font here. This avoids a loop in the above
+ fallback.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (GdkGraphics): Don't initialize font here. This would cause a
+ loop in the above fallback.
+
+2005-10-04 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (process): Add comments. Remove unused gettimeofday call.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Remove
+ debug output. Add comments.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1,
+ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1): Add
+ comments. Remove bogus __attribute__((unused)).
+ * native/jni/midi-dssi/dssi_data.h (JLONG_TO_PTR, PTR_TO_JLONG):
+ Document helper macros.
+ (dssi_data): Document.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c:
+ Formatting fixes.
+ * native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
+ (Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1):
+ Remove debugging output.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AbstractButton): Set text to "" here.
+
+2005-10-04 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (clearRect): Check bg
+ against null to avoid NPE.
+
+2005-10-03 Tom Tromey <tromey@redhat.com>
+
+ * gnu/java/awt/peer/qt/QtToolkit.java (initToolkit): Use Configuration
+ to see if library should be loaded.
+
+2005-10-03 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (maxLineLength): New variable to cache the length of the longest line.
+ (determineMaxLength): New implementation method.
+ (getPreferredSpan): Call determine max length instead of calculating
+ it here.
+
+2005-10-03 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/image/ComponentSampleModel.java (numBands): Updated
+ javadoc.
+ (ComponentSampleModel): Set numBands.
+ * java/awt/image/SampleModel.java (numBands): Now protected.
+
+2005-10-03 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/Polygon.java (evaluateCrossings): Removed @see.
+ * java/awt/image/ImageConsumer.java (SINGLEPASS): Javadoc fix.
+ * java/awt/Image.java (getGraphics): Removed @see.
+ * java/awt/MenuComponent.java (setEnabled): Javadoc fix.
+ (setBackground): Likewise.
+ * java/awt/event/MouseEvent.java: Added import for javadoc.
+ * java/awt/im/spi/InputMethodDescriptor.java: Added import for javadoc.
+ (getAvailableLocales): Javadoc fix.
+ * java/awt/KeyboardFocusManager.java: Added import for javadoc.
+ (defaultPolicy): Javadoc fix.
+ (setGlobalObject): Javadoc fixes.
+ (getObject): Likewise.
+ (getGlobalObject): Likewise.
+ * java/awt/im/InputMethodRequests.java: Added imports for javadoc.
+ * java/awt/im/spi/InputMethodContext.java: Added imports for javadoc.
+ (enableClientWindowNotification): Javadoc fix.
+ * java/awt/im/spi/InputMethod.java: Added imports for javadoc.
+ (removeNotify): Javadoc fix.
+ (notifyClientWindowChange): Likewise.
+ * java/awt/im/InputContext.java: Added import for javadoc.
+ * java/awt/image/ColorModel.java (getDataElements): Javadoc fix.
+ * java/awt/geom/Area.java (recursiveSubdivide): Javadoc fix.
+ * java/awt/geom/GeneralPath.java (GeneralPathIterator): Javadoc fix.
+ * java/awt/im/InputMethodHighlight.java: Javadoc fixes. Added
+ imports.
+ * java/awt/color/ICC_Profile.java (getInstance): Javadoc fix.
+ (getInstance): Likewise.
+ * java/awt/EventQueue.java: Organized imports.
+ * java/awt/image/BufferedImage.java: Organized imports.
+ * java/awt/image/PackedColorModel.java (initMasks): Javadoc fix.
+ * java/awt/GraphicsConfiguration.java (createCompatibleVolatileImage):
+ Javadoc fixes.
+ * java/awt/DefaultKeyboardFocusManager.java (delayRequests): Javadoc
+ fix.
+ * java/awt/ColorPaintContext.java (ColorPaintContext): Javadoc fix.
+
+2005-10-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JOptionPane.java
+ (getInputValue): If the option selected is 'Cancel', then
+ the input value is set to null.
+ (showInternalConfirmDialog): Added check to prevent NPE.
+ (showInternalConfirmDialog): Likewise.
+ (showInternalConfirmDialog): Likewise.
+ (showInternalConfirmDialog): Likewise.
+ (showInternalOptionDialog): Likewise.
+ (showOptionDialog): Likewise.
+
+2005-10-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/rmi/CORBA/ValueHandler.java (getRunTimeCodeBase):
+ Fixed return type.
+ * gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
+ (getRunTimeCodeBase): Implemented.
+
+2005-10-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JMenuItem.java
+ (init): Set horizontalTextPosition to TRAILING, instead of
+ LEFT. Icons are drawn in the correct spot now.
+
+2005-10-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * doc/www.gnu.org/corba.wml: New file.
+
+2005-10-03 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (layoutLabel): place text to the right of the icon, if there is one.
+
+2005-10-03 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (paintComponent): reposition text and truncate if necessary,
+ (truncateText): private utility method.
+
+2005-10-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * NEWS: Added entry about Classpath VMCID and IIOP.
+
+2005-10-02 Anthony Green <green@redhat.com>
+
+ * native/jni/Makefile.am: Maybe build ALSA code.
+ Maybe build DSSI code.
+
+ * gnu/javax/sound/midi/alsa/AlsaPortDevice.java,
+ gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java
+ gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java
+ gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java
+ gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java: Rebuilt.
+ native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c,
+ native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c,
+ native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaSequencerDevice.c,
+ native/jni/midi-dssi/dssi_data.h, native/jni/midi-dssi/Makefile.am,
+ native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
+ native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c,
+ native/jni/midi-alsa/Makefile.am: New files.
+
+ * include/Makefile.am: Add sound header files.
+ * include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h,
+ include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h
+ include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
+ include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h,
+ include/gnu_javax_sound_midi_alsa_AlsaSequencerDevice.h: New
+ files.
+
+ * configure.ac (AC_CONFIG_FILES): Add
+ native/jni/midi-alsa/Makefile, native/jni/midi-dssi/Makefile.
+
+2005-10-02 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/Font.java (peer): Make field transient.
+ (Font(String,int,int)): Explicitly set name field.
+ (Font(String,Map)): Likewise.
+ (readObject): New private method.
+
+2005-10-02 Mark Wielaard <mark@klomp.org>
+
+ * java/io/ObjectOutputStream.java (writeObject): Add defining class
+ to NotSerializableException.
+
+2005-10-02 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLStreamHandler.java (hostsEqual): Javadoc fix.
+ * java/net/URLClassLoader.java (definePackage): Javadoc fixes.
+ * java/net/Inet4Address.java (Inet4Address): Javadoc fix.
+ * java/net/Socket.java (getLocalAddress): Javadoc fix.
+ * java/net/DatagramSocket.java (connect): Javadoc fix.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/PortableServer.java,
+ gnu/javax/rmi/CORBA/ValueHandlerImpl.java,
+ javax/rmi/BAD_OPERATION.java,
+ javax/rmi/ORB.java,
+ javax/rmi/CORBA/ObjectImpl.java,
+ javax/rmi/CORBA/SystemException.java: Deleted.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/CORBA/corbaObjectOutput.java (main):
+ Removed method.
+
+2005-10-02 Casey Marshall <csm@gnu.org>
+
+ * gnu/javax/crypto/DiffieHellmanImpl.java (random): removed.
+ (<init>): removed 'random' initialization.
+ (engineDoPhase): use params from the incoming key; generate the
+ intermediate result from the incoming key, not a random one; only
+ support one-phase DH, for now.
+ (engineInit): removed 'random' initialization.
+
+2005-10-02 Robert Schuster <robertschuster@fsfe.org>
+
+ * gnu/xml/stream/XMLOutputFactoryImpl.java:
+ (setProperty): Added 'else'.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrBufOutput.java,
+ gnu/CORBA/CDR/gnuRuntime.java,
+ gnu/javax/rmi/CORBA/corbaObjectInput.java,
+ gnu/javax/rmi/CORBA/dwoTester.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java: Corrected copyright
+ header identation.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/ArrayValueHelper.java,
+ gnu/CORBA/CDR/IDLTypeHelper.java,
+ gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
+ gnu/CORBA/CDR/gnuRuntime.java,
+ gnu/CORBA/CDR/gnuValueStream.java,
+ gnu/CORBA/CDR/VMVio.java,
+ gnu/CORBA/IorProvider.java,
+ gnu/javax/rmi/CORBA/TieTargetRecord.java,
+ gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java,
+ gnu/javax/rmi/CORBA/corbaObjectInput.java,
+ gnu/javax/rmi/CORBA/corbaObjectOutput.java,
+ gnu/javax/rmi/CORBA/dwoTester.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java: New files.
+ * gnu/CORBA/CDR/aligningInputStream.java,
+ gnu/CORBA/CDR/aligningOutputStream.java:
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrBufInput.java,
+ gnu/CORBA/CDR/cdrBufOutput.java,
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/CDR/noHeaderInput.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/GIOP/MessageHeader.java,
+ gnu/CORBA/GIOP/ServiceContext.java,
+ gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/IOR_contructed_object.java,
+ gnu/CORBA/Interceptor/Registrator.java,
+ gnu/CORBA/NamingService/NameParser.java,
+ gnu/CORBA/NamingService/NamingServiceTransient.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Simple_delegate.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ org/omg/CORBA/OMGVMCID.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/SystemException.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CORBA/portable/ObjectImpl.java,
+ org/omg/CORBA_2_3/ORB.java,
+ org/omg/CORBA_2_3/portable/InputStream.java,
+ org/omg/CORBA_2_3/portable/OutputStream.java: Modified to support
+ RMI over CORBA mechanism.
+ * gnu/javax/rmi/CORBA/DelegateFactory.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ javax/rmi/CORBA/ClassDesc.java,
+ javax/rmi/CORBA/PortableRemoteObjectDelegate.java,
+ javax/rmi/CORBA/Stub.java,
+ javax/rmi/CORBA/StubDelegate.java,
+ javax/rmi/CORBA/Tie.java,
+ javax/rmi/CORBA/Util.java,
+ javax/rmi/CORBA/UtilDelegate.java,
+ javax/rmi/CORBA/ValueHandler.java,
+ javax/rmi/CORBA/package.html,
+ javax/rmi/PortableRemoteObject.java,
+ javax/rmi/package.html: New files (replacing).
+ * gnu/javax/rmi/CORBA/ValueHandlerImpl.java,
+ gnu/javax/rmi/PortableServer.java: Modified to keep the code
+ compileable between subsequent patches.
+
+2005-10-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/ImageIO.java: Fix compilation problems.
+
+2005-10-01 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (MetalScrollBarPropertyChangeHandler.propertyChange):
+ Only set free standing when increase or decrease button isn't null.
+ If not FREE_STANDING_PROP pass up event to super class.
+
+2005-10-02 Mark Wielaard <mark@klomp.org>
+
+ Workarounds for bug #24166
+ * javax/imageio/ImageIO.java (filter): Catch IOException in
+ canDecodeInput().
+ (TranscoderFilter.WriterObjectFilter): Renamed to TranscoderFilter.
+ (getImageReadersBySuffix): Use ReaderObjectFilter, not the nonexisting
+ ReaderSuffixFilter.
+ (createImageInputStream): Test with Class.isAssignableFrom() and for
+ foundSpi == null.
+ (createImageOutputStream): Likewise and use output, not input.
+ (getImageReader): Always return null for now.
+ (getImageReaders): Use input, not object.
+ (getImageWriters): Rename formatName to format and create a
+ WriterObjectFilter with type and format not just object.
+ (getImageWriter): Always return null for now.
+ (getImageTranscoders): Create TranscoderFilter not ImageTranscoderSpi
+ instance.
+
+2005-10-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java: API doc updates.
+
+2005-10-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/IIOException.java: Document.
+ * javax/imageio/IIOImage.java: Document.
+ * javax/imageio/IIOParam.java: Complete and document.
+ * javax/imageio/IIOParamController.java: Document.
+ * javax/imageio/ImageIO.java: Complete and document.
+ * javax/imageio/ImageReader.java: Complete and document.
+ * javax/imageio/ImageTranscoder.java: Document.
+ * javax/imageio/ImageTypeSpecifier.java: Complete and document.
+ * javax/imageio/ImageWriter.java: Complete and document.
+ * javax/imageio/package.html: Write.
+
+2005-10-01 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23890:
+ * java/util/Calendar.java (equals): Include other calendar
+ attributes.
+ (hashCode): Updated.
+ * java/util/GregorianCalendar.java (hashCode): New method.
+ (equals): Use super.equals().
+
+2005-10-01 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/image/ComponentSampleModel.java (numBands): Shadow
+ package-private field in parent class with this protected field.
+ * java/awt/image/SampleModel.java (numBands): Make field
+ package-private.
+
+2005-10-01 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23880:
+ * gnu/java/security/x509/ext/Extension.java (Value.hashCode): New
+ method.
+ * gnu/java/security/der/BitString.java (hashCode): New method.
+ * javax/security/auth/x500/X500Principal.java (hashCode): New method.
+
+2005-10-01 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/net/URLClassLoader.java
+ (Resource.name): Removed field.
+ (JarURLResource.name): Added field.
+ (FileResource.getURL): Use File.toURL() instead of doing it in
+ a way that breaks on Windows.
+
+2005-10-01 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/include/layout.wml: Point Tasks menu item to
+ mediation wiki.
+ * doc/www.gnu.org/tasks.wml: Redirect to mediation wiki.
+
+2005-10-01 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked):
+ Call cairo_pattern_set_extend after gr->pattern has been set and checked
+ versus NULL.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextPane.java
+ (replaceSelection): Don't update the caret position here.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (DocumentHandler.insertUpdate): Likewise.
+ (DocumentHandler.removeUpdate): Likewise.
+ * javax/swing/text/DefaultCaret.java
+ (DocumentHandler): New inner class. Handles caret position updates.
+ (PropertyChangeHandler): New inner class. (Un)installs document
+ listener when the text component's document changes.
+ (install): Install the new listeners on the text component.
+ (deinstall): Deinstall the new listeners on the text component.
+ * javax/swing/text/DefaultEditorKit.java
+ (DefaultKeyTypedAction.actionPerformed): Don't update the caret
+ position here.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/AbstractButton.java
+ (AbstractButton): updateUI should be called after
+ everything is initialized, so everything is revalidated.
+ * javax/swing/JMenuItem.java
+ (JMenuItem): Added call to init so model is set.
+ (JMenuItem): Likewise.
+ * javax/swing/JOptionPane.java
+ (createDialog): Removed invalidate and repaint calls.
+ (JOptionPane): Likewise.
+ * javax/swing/JPopupMenu.java
+ (setVisible): Changed size to be the preferred size.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (paintTabArea): Added check to adjust runCount if
+ it is less that tabCount.
+
+2005-09-30 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainDocument.java:
+ (removeUpdate): Fixed length of new LeafElement and off-by-one error
+ in call to rootElement.replace().
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (propertyChange): No reason to reset the layout manager here.
+ (setDividerLocation): Changed to check right component, not left.
+ Also, updated the location to a valid spot.
+
+2005-09-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/SliderDemo.java:
+ New file.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/AbstractButton.java
+ (setActionCommand): Added check to prevent NPE.
+ (getMnemonic): Likewise.
+ (setMnemonic): Likewise.
+ (setSelected): Likewise.
+ (isSelected): Likewise.
+ (setEnabled): Likewise.
+ (doClick): Likewise.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): Added check to prevent NPE.
+ (paintText): Likewise.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (propertyChange): Added call to reset the layout manager
+ whenever the size of the divider is changed.
+ (setDividerLocation): Added adjustment to container
+ sizes if the divider goes over the bottom/right side.
+ Also, fixed the size of the right/top component.
+ (validLocation): Added check for min/max location returned.
+
+2005-09-30 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/StyleContext.java:
+ (SmallAttributeSet.getAttribute): If the attribute we're looking for is
+ ResolveAttribute, don't try to check the resolve parent, because this
+ will cause an infinite loop.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (accessibleContext): Removed unneeded field. This is already
+ declared in JComponent.
+ * javax/swing/Box.java
+ (accessibleContext): Removed unneeded field. This is already
+ declared in JComponent.
+ * javax/swing/JFrame.java
+ (EXIT_ON_CLOSE): New constant field.
+
+2005-09-30 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ (shiftEnd): Call adjustPositionsInRange rather than getPositionsInRange
+ and then iterating over the set and adjusting them.
+ (shiftGap): Likewise.
+ (shiftGapStartDown): Call setPositionsInRange rather than
+ getPositionsInRange and then iterating over the set to set each
+ Position.
+ (shiftGapEndUp): Likewise.
+ (setPositionsInRange): New implementation method.
+ (adjustPositionsInRange): New implementation method.
+ (resetMarksAtZero): Call setPositionsInRange rather than
+ getPositionsInRange and then iterating over the set to set each
+ Position.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (getScrollableUnitIncrement): Respect the direction argument.
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (VSBChangeListener.stateChanged): Compare ypos with viewPosition.y
+ instead of viewPosition.x.
+ (ViewportChangeHandler.stateChanged): Call
+ syncScrollPaneWithViewport in all cases, not only when the
+ extents have changed.
+ (syncScrollPaneWithViewport): Also sync the maximum and value
+ properties of the scrollbar models with the viewport.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Only call paintFocus if button is actually focused.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24115
+ * javax/swing/AbstractButton.java
+ (AbstractButton): Don't call init() from here. Moved some
+ initialization code from init() to the constructor.
+ (init): Moved most of the initialization code to the constructor.
+ * javax/swing/JCheckBox.java
+ (JCheckBox()): call this(..) instead of super(..). Don't call init()
+ here, this is already performed by the JToggleButton constructor.
+ (JCheckBox(Action)): Don't call init() here, this is already
+ performed by the JToggleButton constructor.
+ (JCheckBox(Icon)): call this(..) instead of super(..). Don't call
+ init() here, this is already performed by the JToggleButton
+ constructor.
+ (JCheckBox(Icon, boolean)): Likewise.
+ (JCheckBox(String)): Likewise.
+ (JCheckBox(String, boolean)): Likewise.
+ (JCheckBox(String, Icon)): Likewise.
+ (JCheckBox(String, Icon, boolean)): Don' call init here. This is
+ already performed by the JToggleButton constructor. Set the
+ correct defaults for horizontalAlignment and borderPainted
+ properties here.
+ * javax/swing/JRadioButton.java
+ (JRadioButton(String, Icon, boolean)): Use acccessor methods
+ instead of directly manipulating package private fields of
+ AbstractButton.
+ * javax/swing/JToggleButton.java
+ (JToggleButton(String, Icon, boolean)): Set correct value for the
+ alignmentX property.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/JFileChooser.java: Import AccessibleRole.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (cp_gtk_graphics2d_init_jni): Check ExceptionOccured after running
+ class initializer.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkFontMetrics.java (initFont): New static
+ method.
+ (GdkFontMetrics): Use initFont() in super() call.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+ (Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline): Initialize all
+ fields of the FT_Outline_Funcs ftCallbacks struct.
+ (_moveTo): Takes an void * as argument.
+ (_lineTo): Likewise.
+ (_quadTo): Likewise.
+ (_curveTo): Likewise.
+
+2005-09-30 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/JFileChooser.java:
+ (getAccessibleContext): Implement.
+ (AccessibleJFileChooser): Inner class implemented.
+
+2005-09-30 Jeroen Frijters <jeroen@frijters.net>
+
+ Fixes Bug 24122
+ * gnu/xml/transform/TransformerImpl.java
+ (writeStreamResult): Added call to connection.setDoInput(false).
+
+2005-09-29 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLConnection.java (setDoInput): Javadoc fix.
+ (setDoOutput): Likewise.
+ (setContentHandlerFactory): Likewise.
+ (setFileNameMap): Likewise.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (installUI): Call the new installKeyboardActions hook.
+ (uninstallUI): Call the new uninstallKeyboardActions hook.
+ (installKeyboardActions): New hook method.
+ (uninstallKeyboardActions): New hook method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (ActionScroller.ActionScroller): Added constructor.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (KeyHandler): New inner class.
+ (createKeyListener): New method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getLeftChildIndent): Fixed method signature.
+ (drawCentered): Fixed method signature.
+
+2005-09-29 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23381:
+ * java/beans/PropertyDescriptor.java (hashCode): New method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/OverlayLayout.java: Added API docs all over.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java
+ (createContent): add a close button,
+ (actionPerformed): perform close action,
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java
+ (createContent): add a close button,
+ (actionPerformed): perform close action.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (getAlignedSizeRequirements): Fixed calculation of preferred and
+ maximum size as well as the alignment.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #23851
+ * javax/swing/OverlayLayout.java
+ (OverlayLayout): Implemented.
+ (invalidateLayout): Implemented.
+ (addLayoutComponent(Component, Object)): Implemented.
+ (addLayoutComponent(String, Component)): Implemented.
+ (removeLayoutComponent): Implemented.
+ (preferredLayoutSize): Implemented.
+ (minimumLayoutSize): Implemented.
+ (maximumLayoutSize): Implemented.
+ (getLayoutAlignmentX): Implemented.
+ (getLayoutAlignmentY): Implemented.
+ (layoutContainer): Implemented.
+ (checkRequirements): New private helper method.
+ (checkTotalRequirements): New private helper method.
+ (checkLayout): New private helper method.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java: new demo.
+
+2005-09-29 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/print/PrinterJob.java
+ (print(PrintRequestAttributeSet)): Remove abstract modifier and
+ implement.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): use current size, not preferred size, when checking for
+ screen edge,
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (show): include top and bottom insets in preferred size,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (MetalComboBoxButton): don't pass icon to super class,
+ (paintComponent): call super.paintComponent() and reworked label
+ drawing.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24105
+ * javax/swing/text/GapContent.java
+ (GapContentPosition.getOffset): Adjusted assert statement.
+ (shiftGap): Adjusted index in getPositionsInRange call. Call
+ resetMarksAtZero if gapStart has moved to 0.
+ (replace): Call shiftGap and shiftGapEndUp only if necessary.
+ (resetMarksAtZero): New method.
+
+2005-09-29 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Added a new field for the gap between the icon and text.
+ (setPreferredMenuItemSize): Changed gap from defaultTextIconGap
+ to defaultTextArrowIconGap
+
+2005-09-29 Tom Tromey <tromey@redhat.com>
+
+ * java/rmi/activation/ActivationGroup_Stub.java (serialVersionUID):
+ New field.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24080
+ * java/awt/Window.java
+ (show): Fixed the synchronized block to fix deadlock
+ problem.
+
+2005-09-29 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/gtk/GdkTextLayout.java
+ (getOutline): Implement as native
+ * include/gnu_java_awt_peer_gtk_GdkTextLayout.h
+ Add declaration
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+ (getOutline): Implement.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * java/rmi/server/RMIClassLoader.java
+ (loadClass(URL, String)): New method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24114
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Set the background color correctly.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicIconFactory.java
+ (getMenuArrowIcon): adjusted the size and painting of the returned
+ icon,
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): adjusted arrow icon position.
+
+2005-09-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (BranchElement.getElementIndex): If there are no children, don't return
+ -1, instead getStartOffset() will throw NPE. Also, if no child Element
+ contains the specified offset, return the closest one.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Added check to prevent NPE.
+ (adjustLocation): Changed else if to if, to
+ check final y position of tooltip incase
+ it is still cut off.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/rmi/server/RMIClassLoader.java:
+ Moved all implementation code to
+ gnu.java.rmi.server.RMIClassLoaderImpl.
+ (getProviderInstance): New helper method to find a provider.
+ (getDefaultProviderInstance): New helper method to find a provider.
+ (loadClass(String, String, Class)): New method.
+ * gnu/java/rmi/server/RMIClassLoaderImpl.java:
+ New class. The implementation is moved from
+ java.rmi.server.RMIClassLoader.
+
+2005-09-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (AbstractElement.getResolveParent): If the AttributeSet's
+ getResolveParent returns null, use the Element's parent's AttributeSet.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/rmi/activation/ActivationGroup_Stub.java:
+ New class.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (paint): No need to call calculateThumbLocation, called
+ by calculateGeometry.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23934
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (paint): Called calculateGeometry, so the slider is
+ initially set up.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24080
+ * java/awt/Window.java
+ (show): Added a synchronized block to fix deadlock
+ problem.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (ActionScroller): Added unused class for binary compatibility.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java
+ (MouseInputHandler): Made inner class public as specified.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (FocusHandler): Made inner class public as specified.
+ (MouseInputHandler): Made inner class public as specified.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (currentIcon): Made method package private, so that other button
+ UIs can access it.
+ (paint): Removed unnecessary call to paintButtonNormal().
+ (paintButtonNormal): Removed unnecessary method. The background
+ is already filled correctly when paint() is entered.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Call the new paintFocus() method instead of the inherited
+ from BasicButtonUI.
+ (paintFocus): New method. Paints the focus indicator for
+ JRadioButtons and subclasses.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (paint): New method. Implements custom painting. Mostly, this
+ is needed in order to call the new paintIcon() method.
+ (paintIcon): New method. Narrows the types from the super-class
+ method.
+
+2005-09-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getRowEnd): Call getText() rather than trying to get the Element-
+ specific portion to avoid GapContent errors.
+ (getRowStart): Likewise.
+
+2005-09-28 Tom Tromey <tromey@redhat.com>
+
+ * javax/sound/midi/MidiUnavailableException.java (serialVersionUID):
+ New field.
+ * javax/sound/midi/InvalidMidiDataException.java (serialVersionUID):
+ New field.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIDefaults.java
+ (getBoolean(Object)): API doc correction.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalButtonListener.java
+ (propertyChange): check new value of property to determine which
+ border to set.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installDefaults): Fixed checks for setting defaults.
+ Should check if default is null also.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24077
+ * gnu/java/awt/peer/gtk/GdkFontMetrics.java
+ (GdkFontMetrics): Added a check for the font
+ being null. Fixed a NPE.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (GdkGraphics): Added check if the font is null.
+ If it is, the font should be set to the default.
+ (setFont): If font parameter is null, this.font should not
+ be changed.
+ * javax/swing/JPopupMenu.java:
+ Fixed API documentation to say 'JDialog' rather than
+ 'JWindow'.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (currentIcon): Made method package private, so that other button
+ UIs can access it.
+ (paint): Removed unnecessary call to paintButtonNormal().
+ (paintButtonNormal): Removed unnecessary method. The background
+ is already filled correctly when paint() is entered.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Call the new paintFocus() method instead of the inherited
+ from BasicButtonUI.
+ (paintFocus): New method. Paints the focus indicator for
+ JRadioButtons and subclasses.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (paint): New method. Implements custom painting. Mostly, this
+ is needed in order to call the new paintIcon() method.
+ (paintIcon): New method. Narrows the types from the super-class
+ method.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (createDefaultTheme): Change default back to DefaultMetalTheme.
+ The Ocean theme is too inconsistent.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Font.java
+ (tk): Made method package private. Must not be protected.
+ (getFontFromToolkit): Made method package private. Must not
+ be protected.
+ (getPeerFromToolkit): Made method package private. Must not
+ be protected.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (createMouseWheelListener): New hook method for creating
+ mouse wheel listeners.
+ (installListeners): Use new hook method to create mouse wheel
+ listeners.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalProgressBarUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalSeparatorUI.java
+ (paint): New method. Uses the metal colors for drawing separators.
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalTextFieldUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/Ocean.java
+ (addCustomEntriesToTable): New method. Adds some custom UI defaults
+ for the Ocean theme.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (paintThumb): Use new MetalUtils.fillMetalPattern signature.
+ * javax/swing/plaf/metal/MetalSplitPaneDivider.java
+ (paint): Use new MetalUtils.fillMetalPattern signature.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ (paintPalette): Use new MetalUtils.fillMetalPattern signature.
+ (paintComponent): Use new MetalUtils.fillMetalPattern signature.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (MenuItemBorder.paintBorder): Fixed painting so that a thin white
+ line is drawn on the left of unarmed items. Fixed color handling.
+ (PopupMenuBorder.borderInsets): Fixed insets.
+ (PopupMenuBorder.paintBorder): Removed left white line. This is
+ drawn now in the MenuItemBorder.
+ (ToolBarBorder.paintBorder): Use correct call to new MetalUtils
+ fillMetalPattern method signature.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalUtils.java
+ (fillMetalPattern): If we have a Graphics2D, then go into
+ optimized drawing mode.
+ (fillMetalPattern2D): New method. Implements pattern drawing using
+ textures.
+ (initializePattern): New method. Initializes the texture.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Font.java: Reformatted file.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (TreeHardDriveIcon): new private class,
+ (TreeFloppyDriveIcon): new private class,
+ (TreeComputerIcon): new private class,
+ (getTreeControlIcon): implemented,
+ (getTreeComputerIcon): implemented,
+ (getTreeHardDriveIcon): implemented.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ToolBarBorder): now implements SwingConstants.
+
+2005-09-27 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/MidiSystem.java (getSequence): Add
+ missing methods.
+ * javax/sound/midi/Sequencer.java (stopRecording): Ditto.
+ * javax/sound/midi/ShortMessage.java (ShortMessage): Ditto.
+ (setMessage): Fix visibility. Add missing implementations.
+ * javax/sound/midi/ShoundbankResouce.java: Rename "soundBank" to
+ "soundbank", and "getSoundBank" to "getSoundbank".
+
+2005-09-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (rolloverBorder): new field,
+ (getRolloverBorder): new method,
+ * javax/swing/plaf/metal/MetalButtonListener.java: new class,
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (instance): removed field,
+ (constructor): initialise fields from UI defaults,
+ (getFocusColor): just return field value,
+ (getSelectColor): just return field value,
+ (getDisabledTextColor): just return field value,
+ (createUI): return a new instance every time,
+ (installDefaults): check for isRolloverEnabled and install rollover
+ border if necessary,
+ (uninstallDefaults): implemented,
+ (createButtonListener): implemented,
+ (paintButtonPressed): implemented,
+ (paintFocus): implemented,
+ (paintText): implemented.
+
+2005-09-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/SimpleAttributeSet.java:
+ (containsAttribute): Check the resolve parent if the attribute is not
+ found locally.
+ (containsAttributeLocally): New package-private method.
+ (isEqual): Re-implemented. Return true if the two sets have the same
+ size and this set contains the given set.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JSeparator.java
+ (updateUI): Removed invalidate call. This is unnecessary.
+ * javax/swing/plaf/basic/BasicSeparatorUI.java
+ (paint): Reworked painting so that it paints the separator
+ correctly.
+ (getPreferredSize): Fixed to return the correct values according
+ to the JDK.
+ (getMinimumSize): Likewise.
+ (getMaximumSize): Likewise.
+
+2005-09-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (RolloverButtonBorder): new class.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (preferredLayoutSize): Fixed to respect the containers insets.
+ (layoutComponent): Likewise.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateTiledPositions): Only adjust sizes if the allocated
+ span is actually different from the used span.
+ (calculateAlignedPositions): Call adjustFromRight also if
+ baseline == 0, otherwise we get strange results because 0 * x = 0.
+
+2005-09-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/SimpleAttributeSet.java:
+ (removeAttributes(AttributeSet)): Only remove attributes from the
+ current set if their keys AND values are found in the given set
+
+2005-09-27 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24067
+ * java/awt/Component.java
+ (removeNotify): Should call hide on the peer before
+ disposing of it. This stops the flashing when the
+ tooltips are removed from the component.
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (getPreferredSize): If the accelerator is null, we should
+ paint the mnenomic if it is available.
+
+2005-09-27 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/Window.java (createBufferStrategy): Can throw AWTException.
+ * java/awt/Canvas.java (createBufferStrategy): Can throw AWTException.
+
+2005-09-27 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24044
+ * javax/swing/ToolTipManager.java
+ (showTip): currentTip needs to be revalidated on HeavyWeightPopups
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (getPreferredSize): Fixed to get the preferred size of the
+ tooltip including the accelerator, if it has one.
+ (paint): Fixed to paint the accelerator in its font
+ and color, if it has one.
+
+2005-09-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getRowEnd): New method.
+ (getRowStart): New method.
+
+2005-09-27 Tom Tromey <tromey@redhat.com>
+
+ * java/beans/beancontext/BeanContextServicesSupport.java
+ (BCSSChild.serialVersionUID): Fixed.
+ * java/beans/beancontext/BeanContextSupport.java
+ (BCSChild.serialVersionUID): Fixed.
+
+2005-09-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): get border from UI defaults,
+ * javax/swing/plaf/metal/MetalBorders.java:
+ (ToolBarBorder): new class,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added tool bar border default,
+ * javax/swing/plaf/metal/MetalToolBarUI.java
+ (MetalContainerListener): new class,
+ (instance): removed field,
+ (MetalRolloverListener): new class,
+ (contListener): new field,
+ (rolloverListener): new field,
+ (createUI): return a new instance every time,
+ (createRolloverListener): implemented,
+ (createContainerListener): implemented,
+ (createNonRolloverBorder): implemented.
+
+2005-09-27 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/MidiFileFormat.java (bytes, microseconds):
+ Rename to byteLength and microsecondLength respectively.
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): validating of toolTipWindow should not have been
+ removed.
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Removed validating of currentTip. setVisible(true)
+ does this. Also, removed validating of toolTipWindow because
+ show() does this.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (adjustGreater): Special handle the case when the components have
+ no spare room for adjustment.
+ (adjustSmaller): Special handle the case when the components have
+ no spare room for adjustment.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (hide): Repaint component before invalidating the parent.
+ (show): Repaint component before invalidating the parent.
+ * javax/swing/JComponent.java
+ (revalidate): Check if we are in the event thread, and if not,
+ then queue a self-request in the event thread.
+ (setVisible): Repaint the parent and queue a revalidate.
+
+2005-09-27 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/JComboBox.java
+ (firePopupMenuCanceled): Implement
+ (firePopupMenuWillBecomeInvisible): Implement
+ (firePopupMenuWillBecomeVisible): Implement
+
+2005-09-27 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/text/html/CSS.java
+ (getAttribute,getAllAttributeKeys): Implement
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (JTree): Root should be visible by default.
+ * javax/swing/ToolTipManager.java
+ (showTip): Added check for validity of currentTip. Prevents
+ over-validating.
+ (hideTip): currentTip should be reset.
+ * javax/swing/JMenuItem.java
+ (setAccelerator): Registered accelerator as a keyboard action.
+
+2005-09-26 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/reflect/Proxy.java: Javadoc fix.
+ * java/io/OutputStreamWriter.java (OutputStreamWriter): Javadoc fix.
+
+2005-09-26 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/Synthesizer.java (loadInstrument,
+ unloadInstrument, remapInstrument, loadAllInstruments,
+ unloadAllInstruments, unloadInstrument, loadInstrument): Don't
+ declare the unchecked IllegalArgumentException.
+ * javax/sound/midi/MidiSystem.java (getMidiDevice, write): Ditto.
+ * javax/sound/midi/ShortMessage.java: Fix 80-column formatting
+ problem.
+ * javax/sound/midi/Sequence.java: Ditto.
+ * javax/sound/midi/MidiMessage.java: Ditto.
+ * javax/sound/midi/MidiSystem.java: Ditto.
+ * javax/sound/midi/MidiFileFormat.java: Ditto.
+
+2005-09-26 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/InvalidMidiDataException.java
+ * javax/sound/midi/MidiFileFormat.java
+ * javax/sound/midi/ControllerEventListener.java
+ * javax/sound/midi/Patch.java javax/sound/midi/Sequence.java
+ * javax/sound/midi/SysexMessage.java javax/sound/midi/Sequencer.java
+ * javax/sound/midi/spi/MidiFileReader.java
+ * javax/sound/midi/spi/MidiFileWriter.java
+ * javax/sound/midi/spi/SoundbankReader.java
+ * javax/sound/midi/spi/MidiDeviceProvider.java
+ * javax/sound/midi/Track.java javax/sound/midi/MidiChannel.java
+ * javax/sound/midi/MetaMessage.java javax/sound/midi/Instrument.java
+ * javax/sound/midi/MidiMessage.java
+ * javax/sound/midi/MidiUnavailableException.java
+ * javax/sound/midi/Transmitter.java javax/sound/midi/MidiEvent.java
+ * javax/sound/midi/VoiceStatus.java javax/sound/midi/MidiDevice.java
+ * javax/sound/midi/SoundbankResource.java
+ * javax/sound/midi/Soundbank.java javax/sound/midi/Receiver.java
+ * javax/sound/midi/MetaEventListener.java
+ * javax/sound/midi/ShortMessage.java
+ * javax/sound/midi/Synthesizer.java
+ * javax/sound/midi/MidiSystem.java: New files.
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): If the dialog is a toolTip or a
+ PopupMenu, its type should be set to:
+ GDK_WINDOW_TYPE_HINT_MENU, so the parent
+ window does not lose focus.
+ * javax/swing/JTree.java
+ (setModel): Should update the UI everytime the
+ model is changed.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Should not set the root to be visible.
+ (paintControlIcons): changed to use getVisibleRect.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Should not set the root to be visible.
+
+2005-09-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * gnu/java/text/BaseBreakIterator.java:
+ (following): Removed unused local variable.
+
+2005-09-26 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateTiledPositions): Improved to also take minimum and maximum
+ sizes into account and better use the allocated space.
+ (adjustGreater): New helper function.
+ (adjustSmaller): New helper function.
+
+2005-09-25 Casey Marshall <csm@gnu.org>
+
+ Fixes PR classpath/23916. Fix suggested by Santiago Gala
+ <sgala@apache.org>.
+ * java/security/AccessControlContext.java
+ (<init>): update javadoc; check SecurityPermission
+ "createAccessControlContext" if a security manager is set.
+ (getProtectionDomains): new method.
+ * vm/reference/java/security/VMAccessController.java
+ (DEBUG): set to 'gnu.classpath.Configuration.DEBUG.'
+ (pushContext, popContext): add debug statement.
+ (getContext): debug output changes; include the DomainCombiner
+ specified in the AccessControlContext, if any.
+
+2005-09-25 Tom Tromey <tromey@redhat.com>
+
+ * javax/security/sasl/SaslServerFactory.java: Updated javadoc.
+ * javax/security/sasl/Sasl.java: Updated javadoc.
+ * javax/security/sasl/SaslClientFactory.java: Updated javadoc.
+ * javax/security/sasl/RealmChoiceCallback.java: Updated javadoc.
+ * javax/security/sasl/RealmCallback.java: Updated javadoc.
+ * javax/security/sasl/AuthenticationException.java: Updated
+ javadoc.
+ * javax/security/sasl/SaslServer.java (getNegotiatedProperty):
+ Don't throw SaslException.
+ * javax/security/sasl/SaslClient.java (getNegotiatedProperty):
+ Don't throw SaslException.
+ * javax/security/sasl/SaslException.java (serialVersionUID): New
+ field.
+ * javax/security/sasl/AuthorizeCallback.java (AuthorizeCallback):
+ Implements Serializable.
+ (serialVersionUID): New field.
+
+2005-09-25 Casey Marshall <csm@gnu.org>
+
+ * gnu/java/security/provider/Gnu.java
+ (<init>): add Diffie-Hellman key factory and key pair generator.
+ * gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java,
+ * gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java:
+ new files.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateAlignedPositions): Improved algorithm to better respect
+ the minimum and maximum size and to better use the available space.
+ (adjustFromRight): New helper method.
+ (adjustFromLeft): New helper method.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (layoutContainer): Respect the insets of the container.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ Fixed some API comments.
+ (paintChildren): Set clip to exclude the border area.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Paint border after the children are painted. Otherwise the
+ children could draw over the border.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (getAlignedRequirements): Implemented this method.
+ (calculateAlignedPositions): Implemented this method.
+ * javax/swing/BoxLayout.java
+ (Direction): Removed unneeded inner interface.
+ (Horizontal): Removed unneeded inner class.
+ (Vertical): Removed unneeded inner class.
+ (SizeReq): Removed unneeded inner class.
+ (preferredLayoutSize): Reimplemented to use SizeRequirements.
+ (minimumLayoutSize): Reimplemented to use SizeRequirements.
+ (maximumLayoutSize): Reimplemented to use SizeRequirements.
+ (layoutContainer): Reimplemented to use SizeRequirements.
+ (layoutAlgorithm): Removed unneeded package private method.
+ (distributeSpace): Removed unneeded package private method.
+ (getSizeRequirements): New private helper method.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * gnu/javax/imageio/bmp/BMPDecoder.java
+ (BMPDecoder): Fix static field references.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * java/awt/Font.java
+ Fixed comments.
+ (pointSize): New field.
+ (Font): Set size fields.
+ (getSize, getSize2D): Return size fields.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Check if clip == null and if so set it to the component's
+ bounds.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (getClipBounds): Added null check so that null is returned when
+ clip == null, instead of throwing an NPE while accessing
+ null.getBounds2D().
+
+2005-09-24 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+ (Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit): Replace deprecated
+ gtk colormap stuff.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Activate double buffering if it is not already activated.
+ (paintImmediately2): Prepare a component graphics object here and
+ call paintDoubleBuffered with this.
+ (paintDoubleBuffered): Changed to work nicely with the new paint()
+ and paintImmediately2() methods.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Added font default for
+ FormattedTextField.font. Solves an NPE that was caused by a null
+ font on a JFormattedTextField.
+
+2005-09-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java
+ (addElement): always fire event for interval added, and call
+ setSelectedItem() if this is the first item.
+
+2005-09-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java: updated API docs all over.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * java/awt/FontMetrics.java
+ (getMaxCharBounds, hasUniformLineMetrics): New methods.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * gnu/javax/imageio/bmp/BMPDecoder.java,
+ * gnu/javax/imageio/bmp/BMPImageReaderSpi.java,
+ * gnu/javax/imageio/bmp/DecodeBF32.java,
+ * gnu/javax/imageio/bmp/DecodeRGB8.java,
+ * gnu/javax/imageio/bmp/BMPException.java,
+ * gnu/javax/imageio/bmp/BMPInfoHeader.java,
+ * gnu/javax/imageio/bmp/DecodeRGB1.java,
+ * gnu/javax/imageio/bmp/DecodeRLE4.java,
+ * gnu/javax/imageio/bmp/BMPFileHeader.java,
+ * gnu/javax/imageio/bmp/DecodeRGB24.java,
+ * gnu/javax/imageio/bmp/DecodeRLE8.java,
+ * gnu/javax/imageio/bmp/BMPImageReader.java,
+ * gnu/javax/imageio/bmp/DecodeBF16.java,
+ * gnu/javax/imageio/bmp/DecodeRGB4.java:
+ New files.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (setFont): If font == null, simply return. Avoids a NPE.
+
+2005-09-23 Sven de Marothy <sven@physto.se>
+
+ * java/io/OutputStreamWriter.java:
+ (OutputStreamWriter): Added missing constructors.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Component.java
+ (getFont): Should return null, not a default font.
+ * javax/swing/ToolTipManager.java
+ (showTip): Called revalidate currentTip before painted, and
+ called validate on JDialog toolTip.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SwingUtilities.java
+ (layoutCompoundLabel): Removed debug code.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JScrollPane.java
+ (setHorizontalScrollBar): Removed handling of listeners on the model.
+ This is now done in the BasicScrollPaneUI.
+ (setHorizontalScrollBarPolicy): Added revalidate call.
+ (setVerticalScrollBar): Removed handling of listeners on the model.
+ This is now done in the BasicScrollPaneUI.
+ (setVerticalScrollBarPolicy): Added revalidate call.
+ (setViewport): Removed handling of listeners on the viewport.
+ This is now done in the BasicScrollPaneUI.
+ (createScrollListener): Removed unnecessary and undocumented method.
+ The functionality of this method is moved to BasicScrollPaneUI
+ as specified.
+ (JScrollPane): Removed initialization of removed listener.
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (HSBChangeListener): New inner class.
+ (VSBChangeListener): New inner class.
+ (ViewportChangeHandler): New inner class.
+ (PropertyChangeHandler): New inner class.
+ (MouseWheelHandler): New inner class.
+ (installUI): Also call installListeners.
+ (installListeners): New method. Initializes the listeners on the
+ scrollpane.
+ (createHSBChangeListener): New method.
+ (createVSBChangeListener): New method.
+ (createViewport): New method.
+ (createPropertyChangeListener): New method.
+ (uninstallUI): Also call uninstallListeners.
+ (uninstallListeners): New method.
+ (syncScrollPaneWithViewport): New method.
+ (updateColumnHeader): New method.
+ (updateRowHeader): New method.
+ (updateScrollBarDisplayPolicy): New method.
+ (updateViewport): New method.
+
+2005-09-23 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTextField.java: Reformatted and added API docs.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Set lightWeightPopupEnabled to default.
+ Validated and repainted new containerPanel and
+ repainted toolTipWindow and repainted currentTip. The
+ toolTips paint well now.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintRecursive): Changed clip to be the visible
+ rectangle of the view.
+
+2005-09-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java
+ (DefaultComboBoxModel(Object[])): set selected item,
+ (DefaultComboBoxModel(Vector): likewise,
+ (addElement): reimplemented,
+ (removeElementAt): update selected item,
+ (removeAllElements): clear selected item and fire correct event,
+ (setSelectedItem): update item always,
+ (getElementAt): return null for index out of bounds,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (paintComponent): check for null selection.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ Added some deprecated and unused fields for binary compatibility.
+ (installListeners): Fixed method parameters.
+ (installUI): Call installListeners with fixed method parameters.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicPanelUI.java
+ (uninstallUI): New method.
+ (uninstallDefaults): New method.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (MinimumHeight): New constant field.
+ (MinimumWidth): New constant field.
+ (minimumWidth): Removed unused field.
+ (minimumHeight): Removed unused field.
+ (installDefaults): Removed initializing of minimumSize and
+ minimumHeight.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Initialize OptionPane.minimumSize from
+ constant fields in BasicOptionPaneUI.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (ChangeHandler): Added some deprecated and unused fields for
+ binary compatibility.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (deactivateFrame): New method.
+ (InternalFramePropertyChangeListener.propertyChange): Call
+ new deactivate() method instead of getDesktopManager.deactivate()
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24022
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): Took out unneeded code.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23529
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (mousepressed): Made delay shorted while pressing the arrow
+ button. This makes the scrollbar move more smoothly.
+ (mouseReleased): Reset the delay to the default, so single
+ clicks only move the scrollbar 1 unit. Also, when the
+ mouse is released, the scrollbar should move 1 unit.
+ (shouldScroll): Should not be able to scroll by block
+ when the mouse is in the thumbRect.
+ (mousePressed): Made delay shorted while pressing in the
+ scroll area. This makes the scrollbar move more smoothly.
+ (mouseReleased): Should move the scrollbar 1 block when the
+ mouse is released. Also, reset the timer to default delay.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (installKeyboardActions): Call renamed method registerKeyboardActions.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (registerKeyboardAction): Renamed this method to
+ registerKeyboardActions as specifie.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ (FocusHandler.repaintCellFocus): Marked protected instead of
+ package private as specified.
+ (KeyHandler.keyPressed): Call new methods selectNextIndex and
+ selectPreviousIndex instead of doing the work here.
+ (PropertyChangeHandler.propertyChange): Update the
+ updateLayoutStateNeeded field correctly.
+ (BasicListUI): Removed listener initialization. Moved this
+ to installListeners.
+ (installListeners): Initialize listeners here instead in the
+ constructor. Use the createXXXListener hooks instead of creating
+ the listeners directly.
+ (createFocusListener): New hook method for creating a focus listener.
+ (createListDataListener): New hook method for creating a list
+ data listener.
+ (createListSelectionListener): New hook method for creating a list
+ selection listener.
+ (createMouseInputListener): New hook method for creating a mouse
+ input listener.
+ (createPropertyChangeListener): New hook method for creating a
+ property change listener.
+
+2005-09-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (OptionDialogBorder): new class.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicColorChooserUI.java
+ (uninstallDefaultChoosers): New method.
+ (uninstallUI): Call uninstallDefaultChoosers.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SwingUtilities.java
+ (layoutCompoundLabel): Fix the case when verticalTextPosition=BOTTOM
+ and without icon. The label text slipped out of the view rectangle
+ in this case.
+
+2005-09-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (setCurrentTheme): throw exception if argument is null, improved API
+ docs.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JPanel.java
+ (accessibleContext): Removed this unnecessary field. Use the
+ inherited field of the same name from JComponent instead.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/UIManager.java
+ (static_initializer): Load MetalLookAndFeel only as fallback, if
+ the system property 'swing.defaultlaf' is not defined. Before
+ it has accidentally loaded the MetalLookAndFeel in all cases,
+ regardless of the property setting.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintChildren): If a child component is invisible, skip it.
+ Handle the (rare) case when no clip is set as if it's set to the
+ child component's bounds. These fixes should make Swing working
+ again as before.
+
+2005-09-22 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable):
+ Replace deprecated gtk_window_set_policy with gtk_window_set_resizable.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem): Replace deprecated
+ gtk_container_children with gtk_container_get_children.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu): Likewise.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+ (Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap): Replace deprecated
+ gdk_pixmap_unref with g_object_unref.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked):
+ Replace deprecated gdk_cursor_destroy with gdk_cursor_unref.
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent):
+ Replace deprecated gtk_container_children with
+ gtk_container_get_children.
+ (find_fg_color_widget): Replace deprecated macro GTK_IS_OPTION_MENU with
+ GTK_IS_COMBO_BOX.
+ (component_button_release_cb): Replace deprecated gdk_window_get_size
+ with gdk_drawable_get_size.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup):
+ Replace deprecated gtk_radio_button_group with
+ gtk_radio_button_get_group.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove): Likewise.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create): Replace deprecated
+ gtk_type_new with gtk_drawing_area_new.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState): Replace deprecated
+ gdk_*_ref with g_object_ref.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II): Likewise.
+ Replace deprecated gdk_rgb_get_cmap with gdk_rgb_get_colormap.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage): Replace
+ deprecated gdk_*_ref with g_object_ref.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose): Replace deprecated
+ gdk_*_unref with g_object_unref.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea): Replace deprecated
+ gdk_window_copy_area with gdk_draw_drawable.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor): Replace deprecated
+ gdk_color_alloc with gdk_colormap_alloc_color.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getWordEnd): Implemented.
+ (getWordStart): Implemented.
+
+2005-09-22 Keith SEitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/filters/StepFilter.java (StepFilter): Do not test
+ for null thread ID -- just test if it has not been garbage collected.
+ * gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java (ThreadOnlyFilter):
+ Likewise.
+
+2005-09-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): Size of menu should always be the preferred
+ size. It was sometimes cutting of the accelerator.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Increased defaultAcceleratorLabelGap field to 10, to
+ make menuItem more readable.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getPreviousWord): Fixed incorrect logic. Use preceding() instead of
+ following(), previous() instead of next().
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * gnu/java/text/BaseBreakIterator.java:
+ (following): Don't restore old CharacterIterator index.
+
+2005-09-22 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/JList.java (AccessibleJList): New constructor.
+
+2005-09-22 Tom Tromey <tromey@redhat.com>
+
+ * java/net/ServerSocket.java (accept): Use correct security manager
+ call.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getNextWord): Implemented.
+ (getPreviousWord): Implemented.
+
+2005-09-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/MetalLookAndFeel.java
+ (initComponentDefaults): Changed back to original
+ values.
+
+2005-09-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Moved tooltip location adjustments to a
+ helper method.
+ (adjustLocation): New helper method.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed defaults for Table,
+ TableHeader, Tree to match JDK.
+ * javax/swing/plaf/MetalLookAndFeel.java
+ (initComponentDefaults): Fixed defaults for Table and
+ TableHeader to match JDK.
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (defaultBorder): Removed, along with inner class. Not needed.
+ (installDefaults): Changed border to be the default border in
+ L&F.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JSpinner.java
+ (ListEditor): New inner class. Provides an editor for the
+ SpinnerListModel.
+
+2005-09-22 Tom Tromey <tromey@redhat.com>
+
+ * java/io/FileWriter.java (FileWriter): Typo fix.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JApplet.java
+ (accessibleContext): Made field protected as specified.
+ * javax/swing/JButton.java
+ (accessibleContext): Removed field. The inherited JComponents
+ accessibleContext field should be used instead.
+ * javax/swing/JLabel.java
+ (accessibleContext): Removed field. The inherited JComponents
+ accessibleContext field should be used instead.
+ * javax/swing/JRootPane.java
+ (JRootPane): Removed unnecessary setDoubleBuffered() call.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTML.java:
+ (SYNTHETIC): Renamed variable SYNTETIC to SYNTHETIC.
+ (Tag): Changed comment for static Tag IMPLIED.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (JViewport): Initialize cached fields for blitting.
+ (setViewPosition): Repaint viewport.
+ (revalidate): Set damaged flag. Used for blitting.
+ (reshape): Likewise.
+ (paint): New method. Decide which paint method to use.
+ (computeBlit): New method. Computes the parameters for blitting.
+ (paintSimple): New method. Performs painting in simple mode.
+ (paintBackingStore): New method. Performs painting in backingstore
+ mode.
+ (paintBlit): New method. Performs painting in blit mode. For
+ now this falls back to backing store mode.
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (ChangeListener): Removed inner class.
+ (installDefaults): Load default for background color. Changed
+ signature to protected.
+ (installListeners): Removed method.
+ (uninstallDefaults): Changed signature to protected.
+ (installUI): Call installDefaults().
+ (uninstallUI): Call uninstallDefaults().
+ (getPreferredSize): Removed.
+ (paint): Removed.
+ (paintSimple): Removed.
+ (paintBackingStore): Removed.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.addPropertyChangeListener): Partly omplemented.
+ (AccessibleJComponent.getAccessibleStateSet): Partly implemented.
+ (doubleBuffered): Default value of this field is true.
+ (paint): Moved double buffer painting stuff to separate method.
+ (paintChildren): Don't call into AWT painting code here. This allows
+ for a small optimization.
+ (paintImmediately): Don't go up to the parent window, try to start
+ painting on the nearest JRootPane if possible.
+ (paintImmediately2): New method. Actually performs repainting
+ on the repaint root.
+ (paintDoubleBuffered): New method. Performs painting using
+ a double buffer.
+ (paintSimple): New method. Performs painting without buffer.
+
+2005-09-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileFilter.java: reformatted and added API
+ docs.
+
+2004-10-09 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java
+ (defineClass(String,ByteBuffer,ProtectionDomain)): New method.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Fixed location of tooltip. Sometimes
+ the ToolTip was being cut off.
+
+2005-09-21 Mark Wielaard <mark@klomp.org>
+
+ * gnu/classpath/ByteArray.java: Reindent boilerplate.
+
+2005-09-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * gnu/classpath/ByteArray.java,
+ * gnu/javax/crypto/DiffieHellmanImpl.java,
+ * gnu/javax/crypto/GnuDHPrivateKey.java,
+ * gnu/javax/crypto/RSACipherImpl.java:
+ Fixed address within GPL license.
+
+2005-09-21 Mark Wielaard <mark@klomp.org>
+
+ * lib/split-for-gcj.sh: Cut list to 3 package levels deep.
+
+2005-09-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTML.java:
+ (Tag): Changed name of IMPLIED Tag from "implied" to "p-implied" to
+ match the JDK.
+ * javax/swing/text/html/HTMLDocument.java:
+ (AdditionalComments): New field.
+
+2005-09-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTMLDocument.java:
+ (getBase): Implemented.
+ (setBase): Implemented.
+ (getPreservesUnknownTags): Implemented.
+ (setPreservesUnknownTags): Implemented.
+ (BlockElement): New class partially implemented.
+
+2005-09-21 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/BorderLayout.java: Reverted field reordering.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (distributeSpill): Fixed a NPE.
+ * javax/swing/ToolTipManager.java
+ (mouseExited): No need to do this stuff, removed code.
+ (showTip): Revalidating and repainting too much, removed.
+ (hideTip): Likewise.
+
+2005-09-21 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/BorderLayout.java (invalidateLayout): Updated comment.
+ (setBounds): Likewise.
+ (MIN, MAX, PREF): Moved nearer top of file.
+ (getLayoutComponent): New methods.
+ (getConstraints): New method.
+ (vgap, hgap, north, south, east, west): Reordered fields to conform
+ to serialization spec.
+
+2005-09-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTMLDocument.java:
+ (LeafIterator): New class.
+ (getIterator): Implemented.
+ (Iterator): New abstract class.
+
+2005-09-21 Tom Tromey <tromey@redhat.com>
+
+ * java/math/BigDecimal.java (ZERO, ONE): Now public. Updated
+ javadoc.
+ (TEN): New constant.
+ * java/math/BigInteger.java (ZERO): Updated javadoc.
+ (ONE): Likewise.
+ (TEN): New constant.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23937
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (propertyChange): When WANTS_INPUT_PROPERTY is changed,
+ the buttons should be updated.
+ (getButtons): Applied patch in bug report. Sets default
+ buttons.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Added code to move currentPoint to a new place.
+ (getGoodPoint): Removed, not needed.
+
+2005-09-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalFileChooserUI.java: new file (partial
+ implementation).
+
+2005-09-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): If HeavyWeightPopup, setLightWeightPopupEnabled
+ is false.
+ * javax/swing/ToolTipManager.java
+ (showTip): Change so toolTips on lightWeightPopups are
+ added different than those on heavyWeightPopups.
+ (canToolTipFit): Removed. This is not needed/used.
+
+2005-09-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (mouseMoved): Removed unneeded code. If the mouse
+ moves into another component, then mouseEntered would
+ do the same thing. Otherwise, it is not needed.
+ (showTip): Fixed so that the containerPanel is an
+ instance of Panel. Made code more efficent.
+ Tooltips were causing weird problems with the
+ JMenus.
+ (getGoodPoint): Fixed to return a better location.
+ * javax/swing/plaf/basic/BasicMenuBarUI.java
+ (mouseClicked): Fixed to prevent a NPE.
+
+2005-09-20 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22906:
+ * gnu/java/net/protocol/jar/Connection.java (get): Added useCaches
+ argument.
+ (connect): Updated.
+
+2005-09-20 Tom Tromey <tromey@redhat.com>
+
+ * javax/print/DocFlavor.java (serialVersionUID): Fixed typo.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultEditorKit.java:
+ (write): Partially Implemented and made slight correction to API docs.
+ * javax/swing/text/html/HTMLEditorKit.java:
+ (createDefaultDocument): Override parent method because we need to
+ return an HTMLDocument not a DefaultStyledDocument.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ Fixes PR #23900.
+ * javax/swing/JLayeredPane.java
+ (remove(int)): Removed repaint() call. This is unnecessary because
+ already triggered by Container.remove().
+ (remove(Component)): Removed this superfluous method. It's not
+ in the specs and the functionality is already in Container.
+ (paint): New method. Overridden in order to provide reasonable
+ painting for JLayeredPanes.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler): Renamed to PropertyChangeHandler. This name is
+ closer to the purpose of this class.
+ (PropertyChangeHandler.propertyChange): Delegate property change
+ to propertyChange hook method in the enclosing BasicTextUI.
+ (propertyChange): New protected method. This serves as a hook
+ for subclasses to handle property changes in the text component.
+ * javax/swing/plaf/basic/BasicTextFieldUI.java
+ (properyChange): Handle editable property here and adjust background
+ accordingly.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (getParagraphElement): If the position argument is out of the
+ document's bounds, then the closest paragraph element must be
+ returned. This is fixed.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (resizeAndRepaint): New protected method.
+
+2005-09-20 Tom Tromey <tromey@redhat.com>
+
+ * javax/xml/namespace/QName.java: Now Serializable.
+ (serialVersionUID): New field.
+ (qName, hashCode): Now transient.
+ (QName): Don't compute qName here.
+ (equals): Now final.
+ (hashCode): Simplified.
+ (toString): Compute qName here.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (getTextFieldBorder): This method must return an BorderUIResource
+ instance. Fixed.
+
+2005-09-20 Mark Wielaard <mark@klomp.org>
+
+ Reported by Martin Cordova <martin.cordova@gmail.com>
+ * native/jni/java-net/javanet.c (_javanet_accept): Throw
+ SocketTimeoutException on EAGAIN timeout.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Handle the rollover UIDefaults property.
+ (paintText): Correctly paint disabled button label text.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fix some text component border defaults.
+ * javax/swing/plaf/basic/BasicTextPaneUI.java
+ (installUI): New method. This sets up some style attributes
+ for the JTextPane.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefault): Added and fixed some UI defaults.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ButtonBorder.paintBorder): Fetch correct color for disabled
+ button border.
+ (getTextFieldBorder): Correctly initialize text field border. This
+ should be a compound border with a MarginBorder and TextFieldBorder
+ instead of a plain TextFieldBorder.
+ (getTextBorder): New method.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (setParagraphAttributes): Implemented this method.
+ (insertUpdate): Fixed attribute comparison to avoid NPE.
+
+2005-09-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/23951
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (isRealized): Leave GDK critical region when exiting early.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/PopupMenu.java (AccessibleAWTPopupMenu.serialVersionUID):
+ New field.
+ * java/awt/TextField.java (AccessibleAWTTextField.serialVersionUID):
+ New field.
+ * java/awt/TextArea.java (AccessibleAWTTextArea.serialVersionUID):
+ New field.
+ * java/awt/Menu.java (AccessibleAWTMenu.serialVersionUID): New field.
+ * java/awt/CheckboxMenuItem.java (AccessibleAWTCheckboxMenuItem.serialVersionUID):
+ New field.
+ * java/awt/TextComponent.java (AccessibleAWTTextComponent.serialVersionUID):
+ New field.
+ * java/awt/MenuItem.java (AccessibleAWTMenuItem.serialVersionUID):
+ New field.
+ * java/awt/Frame.java (AccessibleAWTFrame.serialVersionUID): New
+ field.
+ * java/awt/Dialog.java (AccessibleAWTDialog.serialVersionUID): New
+ field.
+ * java/awt/Button.java (AccessibleAWTButton.serialVersionUID): New
+ field.
+ * java/awt/Window.java (AccessibleAWTWindow.serialVersionUID): New
+ field.
+ * java/awt/ScrollPane.java (AccessibleAWTScrollPane.serialVersionUID):
+ New field.
+ * java/awt/List.java (AccessibleAWTList.serialVersionUID): New field.
+ (AccessibleAWTListChild.serialVersionUID): Likewise.
+ (AccessibleAWTListChild.parent): Moved earlier.
+ (AccessibleAWTListChild.indexInParent): Renamed.
+
+2005-09-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileView.java:
+ Reformatted and added API doc comments.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JRootPane.java:
+ (createGlassPane): Don't set the layout manager to BorderLayout. Leave
+ it as JPanel's default FlowLayout.
+
+2005-09-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java:
+ Changed tooltip to be JDialog (no entry in taskbar),
+ instead of JWindow.
+ (actionPerformed): No need to start timer here.
+ (mouseEntered): No need to call showTip here, it is called
+ when the timer fires.
+ (showTip): Shouldn't show tip if it is already visible or
+ the current component is not showing.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getRowForPath): Re-implemented.
+ (mousePressed): Call getRowForPath instead, also
+ added a check in for leaf icons.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JLayeredPane.java:
+ (<init>): Set layout manager to null.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java:
+ (GlassPaneDispatcher.handleEvent): Added check for mouseEventTarget
+ being null to avoid NPE.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JRootPane.java:
+ (RootLayout.layoutContainer): Added comment about how the
+ components should be sized. Fixed size of glassPane which fills the
+ entire viewable region, including overtop the menuBar. Used bounds
+ minus insets for containerSize, as indicated in comment, rather than
+ getSize(). Used setBounds instead of setSize for layeredPane because
+ its relation to the other components' sizes is more obvious that way.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java:
+ (GlassPaneDispatcher.handleEvent): Replaced call to SwingUtilities'
+ convertMouseEvent (with identical source and desination) with a simple
+ cast. If acquireComponentForMouseEvent reveals we're going to
+ re-dispatch this event to ourselves (and loop infinitely), return. Also
+ replaced contentPane by glassPane as the source argument to
+ SwingUtilities.convertMouseEvent since the glassPane is the real
+ source.
+
+2005-09-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java
+ (paintTriangle): minor correction to highlight on triangle for disabled
+ buttons.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * javax/print/DocFlavor.java (BYTE_ARRAY.serialVersionUID): New field.
+ (INPUT_STREAM.serialVersionUID): Likewise.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * java/text/DateFormat.java (serialVersionUID): New field.
+
+2005-19-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (selectPath): Changed so DISCONTIGUOUS_TREE_SELECTION is the
+ default.
+ * javax/swing/JTree.java
+ (AccessibleJTreeNode): Initialized all fields.
+ (addAccessibleSelection): Implemented.
+ (clearAccessibleSelection): Implemented.
+ (doAccessibleAction): Implemented.
+ (getAccessibleAction): Implemented.
+ (getAccessibleActionCount): Implemented.
+ (getAccessibleActionDescription): Implemented.
+ (getAccesssibleChild): Remove mod variable, made global.
+ (getAccessibleComponent): Changed to return this, since this
+ class implements AccessibleComponent.
+ (getAccessibleSelection): Likewise.
+ (getAccessibleSelection): Implemented.
+ (getAccessibleSelectionCount): Implemented.
+ (getAccessibleStateSet): Remove mod variable, made global.
+ (getCursor): Implemented.
+ (isAccessibleChildSelected): Remove mod variable, made global.
+ (removeAccessibleSelection): Implemented.
+ (selectAllAccessibleSelection): Implemented.
+ (setCursor): Implemented.
+ (AccessibleJTree): Nothing to do.
+ (getAccessibleAt): Implemented.
+ (getAccessibleSelection): Implemented.
+ (getAccessibleSelection): Implemented.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * javax/xml/xpath/XPathFunctionException.java (serialVersionUID): New
+ field.
+ * javax/xml/xpath/XPathFactoryConfigurationException.java
+ (serialVersionUID): New field.
+ * javax/xml/xpath/XPathExpressionException.java (serialVersionUID): New
+ field.
+ * javax/xml/xpath/XPathException.java (serialVersionUID): New field.
+ * javax/xml/transform/TransformerConfigurationException.java (locator):
+ Removed.
+ (TransformerConfigurationException): Pass locator to super constructor.
+ (serialVersionUID): New field.
+ * javax/xml/transform/TransformerFactoryConfigurationError.java
+ (serialVersionUID): New field.
+ * javax/xml/transform/TransformerException.java (containedException):
+ Renamed field.
+ (serialVersionUID): New field.
+
+2005-09-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler.propertyChange): Handle changes of the editable
+ property.
+ (paintBackground): Moved implementation to
+ UpdateHandler.propertyChange. This method itself should not fill
+ the background.
+
+2005-09-19 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/java-net/java_net_VMInetAddress.c
+ (Java_java_net_VMInetAddress_getHostByAddr): Add error string as
+ exception message.
+ * native/jni/java-net/javanet.c (_javanet_accept): Likewise.
+ (_javanet_shutdownInput): Likewise.
+ (_javanet_shutdownOutput): Likewise.
+
+2005-09-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/border/TitledBorder.java
+ (paintBorder): Correctly set the Y offset for the border title.
+ (getMeasurements): Determine the correct Y offset for the border
+ title.
+
+2005-09-19 Robert Schuster <robertschuster@fsfe.org>
+
+ * java/awt/Checkbox.java:
+ (Checkbox): Properly set as selected checkbox in corresponding
+ checkbox group.
+ (paramString): Removed checkbox group information.
+ * java/awt/Component.java:
+ (paramString): Removed redundant "=".
+
+2005-09-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): call configureArrowButton after creating button,
+ (configureEditor): set the selected item,
+ (configureArrowButton): set a zero margin,
+ (getPreferredSize): delegate to getMinimumSize(),
+ (getMinimumSize): now uses code that was in getPreferredSize(),
+ (getDefaultSize): reduce default height,
+ (ComboBoxLayoutManager.layoutComponent): use comboBox height as button
+ width,
+ (PropertyChangeHandler.propertyChange): set font on arrow button,
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (instances): deleted field,
+ (MetalComboBoxLayoutManager): new class,
+ (MetalPropertyChangeListener): new class,
+ (MetalComboPopup): new class,
+ (createUI): just return new instance,
+ (createEditor): implemented,
+ (createPopup): implemented,
+ (createArrowButton): implemented,
+ (createPropertyChangeListener): implemented,
+ (paint): implemented,
+ (editablePropertyChanged): implemented,
+ (createLayoutManager): implemented,
+ (removeListeners): implemented,
+ (getMinimumSize): implemented.
+
+2005-09-19 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose): Fix double
+ unreferencing pfont->font. Unref pfont->layout instead.
+
+2005-09-18 Tom Tromey <tromey@redhat.com>
+
+ * java/util/Timer.java (TaskQueue.purge): New method.
+ (Timer(String)): New constructor.
+ (Timer(String,boolean)): Likewise.
+ (purge): New method.
+
+2005-09-18 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Short.java (valueOf): New method.
+ * java/lang/Double.java (valueOf): New method.
+ * java/lang/Float.java (valueOf): New method.
+
+2005-09-18 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Long.java (reverse): Correctly handle sign extension.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): remove listBox color settings,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): corrected ComboBox and ListBox defaults.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+ (BasicComboBoxRenderer): set no focus border,
+ (getListCellRendererComponent): set background color if cell has focus,
+ removed border switching code.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (borderInsets): deleted,
+ (arrowButtonWidth): deleted,
+ (configureEditor): set font,
+ (isFocusTraversable): set to true for non-editable combobox,
+ (paint): deleted border painting code,
+ (paintBorder): deleted,
+ (getPreferredSize): returns a value, not null,
+ (getMinimumSize): likewise,
+ (getMaximumSize): likewise,
+ (rectangleForCurrentValue): reimplemented,
+ (paintCurrentValue): no longer adjusts for border insets,
+ (getDisplaySize): update maximum width and height independently,
+ (ComboBoxLayoutManager): removed redundant 'extends Object',
+ (ComboBoxLayoutManager.preferredLayoutSize): call getPreferredSize(),
+ (ComboBoxLayoutManager.minimumLayoutSize): delegate to
+ preferredLayoutSize(),
+ (ComboBoxLayoutManager.layoutContainer): use arrow button preferred
+ size in layout,
+ (PropertyChangeHandler.propertyChange): added 'font' handling.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installListeners): add listener to arrowButton instead of comboBox,
+ deleted call to configureArrowButton(),
+ (uninstallListeners): remove listener from arrowButton instead of
+ comboBox, and deleted call to unconfigureArrowButton(),
+ (configureArrowButton): set font and enabled state, deleted
+ addMouseListener() call,
+ (unconfigureArrowButton): deleted removeMouseListener() call,
+ (MouseHandler.mousePressed): just toggle display status of popup,
+ (MouseHandler.mouseReleased): deleted.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (largestItemSize): renamed displaySize,
+ (getLargestItemSize): renamed getDisplaySize and changed to protected,
+ (ComboBoxLayoutManager.preferredLayoutSize): updated for renamed field
+ and method,
+ (ListDataHandler.intervalAdded): likewise,
+ (ListDataHandler.intervalRemoved): likewise.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java:
+ Updated API docs all over.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/RuleBasedCollator.java:
+ Fixed spelling error in comment.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.jdt.ui.prefs: Add file template.
+
+2005-09-17 Anthony Green <green@redhat.com>
+
+ * java/security/Security.java (getProviders): Pre-allocate the
+ target array for Collection.toArray call.
+ * gnu/java/security/PolicyFile.java (parse): Ditto.
+ * javax/swing/filechooser/FileSystemView.java: Ditto.
+ * javax/swing/JFileChooser.java (getChoosableFileFilters): Ditto.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22963:
+ * java/nio/charset/Charset.java (forName): Javadoc fix.
+ (providers2): Use ServiceFactory.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ * org/ietf/jgss/GSSException.java (BAD_BINDINGS, BAD_MECH,
+ BAD_NAME, BAD_NAMETYPE, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED,
+ DEFECTIVE_CREDENTIAL, DEFECTIVE_TOKEN, DUPLICATE_TOKEN, FAILURE,
+ NO_CONTEXT, NO_CRED, OLD_TOKEN): Document official RFC values.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Short.java (SIZE): New constant.
+ (MIN_CACHE, MAX_CACHE): Likewise.
+ (shortCache): New field.
+ (reverseBytes): New method.
+ * java/lang/Long.java (SIZE): New constant.
+ (valueOf): New method.
+ (bitCount): New method.
+ (rotateLeft): New method.
+ (rotateRight): New method.
+ (highestOneBit): New method.
+ (numberOfLeadingZeros): New method.
+ (lowestOneBit): New method.
+ (numberOfTrailingZeros): New method.
+ (signum): New method.
+ (reverseBytes): New method.
+ (reverse): New method.
+ * java/lang/Float.java (SIZE): New constant.
+ * java/lang/Double.java (SIZE): New constant.
+ * java/lang/Character.java (SIZE): New constant.
+ (MAX_CACHE): Likewise.
+ (charCache): New field.
+ (valueOf): New method.
+ (reverseBytes): Likewise.
+ * java/lang/Byte.java (SIZE): New constant.
+ (byteCache): New field.
+ (valueOf): New method.
+ * java/lang/Boolean.java (parseBoolean): New method.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ Reported by David Lichteblau <david@lichteblau.com>
+ * native/jni/classpath/jcl.c (JCL_NewRawDataObject): Create
+ NewGlobalRef before calling DeleteLocalRef.
+
+2005-09-17 Paul Jenner <psj@harker.dyndns.org>
+
+ * configure.ac: Clarify that Werror configure option is
+ disabled by default.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java: Reindent boilerplate.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ * java/util/prefs/Preferences.java (systemNodeForPackage):
+ Javadoc fix.
+ (userNodeForPackage): Likewise.
+ * java/util/logging/LoggingPermission.java (serialVersionUID):
+ New field.
+ * java/io/ObjectInputStream.java (parseContent): Javadoc fix.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/home.wml: Update mauve link.
+
+2005-09-16 Anthony Green <green@redhat.com>
+
+ PR libgcj/20198
+ * java/net/URLClassLoader.java (FileURLLoader.getResource): File
+ resources should all have canonicalized names.
+
+2005-09-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (AccessibleJTreeNode): Fixed documentation.
+ (addAccessibleSelection): Likewise, still needs to
+ be implemented.
+ (addFocusListener): Implemented.
+ (addPropertyChangeListener): Implemented.
+ (clearAccessibleSelection): Implemented.
+ (contains): Implemented.
+ (doAccessibleAction): Fixed documentation, still
+ needs to be implemented.
+ (getAccessibleAction): Likewise.
+ (getAccessibleActionCount): Likewise.
+ (getAccessibleActionDescription): Implemented.
+ (getAccessibleAt): Implemented.
+ (getAccessibleChild): Implemented.
+ (getAccessibleChildrenCount): Implemented.
+ (getAccessibleComponent): Fixed documentation.
+ (getAccessibleContext): Implemented.
+ (getAccessibleDescription): Implemented.
+ (getAccessibleIndexInParent): Implemented.
+ (getAccessibleName): Implemented.
+ (getAccessibleParent): Fixed documentation.
+ (getAccessibleRole): Likewise.
+ (getAccessibleSelection): Likewise, still needs to
+ be implemented.
+ (getAccessibleSelection): Likewise.
+ (getAccessibleSelectionCount): Implemented.
+ (getAccessibleStateSet): Implemented.
+ (getAccessibleText): Fixed documentation.
+ (getAccessibleValue): Likewise.
+ (getBackground): Implemented.
+ (getBounds): Implemented.
+ (getCursor): Fixed documentation, still needs to be
+ implemented.
+ (getFont): Implemented.
+ (getFontMetrics): Implemented.
+ (getForeground): Implemented.
+ (getLocale): Implemented.
+ (getLocation): Implemented.
+ (getLocationInJTree): Implemented.
+ (getLocationOnScreen): Implemented.
+ (getSize): Implemented.
+ (isAccessibleChildSelected): Implemented.
+ (isEnabled): Implemented.
+ (isFocusTraversable): Implemented.
+ (isShowing): Implemented.
+ (isVisible): Implemented.
+ (removeAccessibleSelection): Fixed documentation, need to
+ fix current implementation.
+ (removeFocusListener): Implemented.
+ (removePropertyChangeListener): Implemented.
+ (requestFocus): Implemented.
+ (selectAllAccessibleSelection): Need to implement. Added FIXME.
+ (setAccessibleDescription): Implemented.
+ (setAccessibleName): Implemented.
+ (setBackground): Implemented.
+ (setBounds): Implemented.
+ (setCursor): Fixed documentation, still need to implement.
+ (setEnabled): Implemented.
+ (setFont): Implemented.
+ (setForeground): Implemented.
+ (setLocation): Implemented.
+ (setSize): Implemented.
+ (setVisible): Implemented.
+ (AccessibleJTree): Fixed documentation, still need
+ to implement.
+ (addAccessibleSelection): Implemented.
+ (clearAccessibleSelection): Implemented.
+ (fireVisibleDataPropertyChange): Implemented.
+ (getAccessibleAt): Fixed documentation, need to implement.
+ (getAccessibleChild): Implemented.
+ (getAccessibleChildrenCount): Implemented.
+ (getAccessibleIndexInParent): Fixed documentation.
+ (getAccessibleRole): Likewise.
+ (getAccessibleSelection): Likewise, still need to implement.
+ (getAccessibleSelection): Likewise.
+ (getAccessibleSelectionCount): Implemented.
+ (isAccessibleChildSelected): Implemented.
+ (removeAccessibleSelection): Implemented.
+ (selectAllAccessibleSelection): Implemented.
+ (treeCollapsed): Implemented.
+ (treeExpanded): Implemented.
+ (treeNodesChanged): Implemented.
+ (treeNodesInserted): Implemented.
+ (treeNodesRemoved): Implemented.
+ (treeStructureChanged): Implemented.
+ (valueChanged): Implemented.
+ (TreeModelListener): Fixed documentation.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ * java/io/PrintWriter.java (PrintWriter): New constructors.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22689:
+ * java/io/PrintWriter.java (closed): New field.
+ (checkError): Only flush if stream not closed.
+ (close): Set 'closed'.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Character.java (MIN_SURROGATE, MAX_SURROGATE): New
+ constants.
+ (isHighSurrogate): New method.
+ (isLowSurrogate): Likewise.
+ (isSurrogatePair): Likewise.
+ (toCodePoint): Likewise.
+ (codePointAt): Likewise.
+ (codePointBefore): Likewise.
+ * java/lang/StringBuffer.java (codePointCount): Check bounds.
+ (codePointAt): Rewrote.
+ (codePointBefore): Likewise.
+ * java/lang/String.java (codePointAt): New method.
+ (codePointBefore): Likewise.
+ (codePointCount): Likewise.
+ (contentEquals): New overload.
+
+2005-09-16 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/ProgressMonitor: Implemented the former stubbed
+ class and added documentation.
+ (close): Implemented and added documentation.
+ (setProgress): Dito.
+ (isCanceled): Dito.
+ (setMinimum): Added documentation.
+ (getMinimum): Dito.
+ (setMaximum): Dito.
+ (getMaximum): Dito.
+ (setNote): Dito.
+ (getMillisToDecideToPopup): Dito.
+ (setMillisToDecideToPopup): Dito.
+ (getMillisToPopup): Dito.
+ (setMillisToPopup): Dito.
+ (getNote): Dito.
+ * javax/swing/ProgressMonitorInputStream: Implemented stub
+ methods.
+ (close): Implemented.
+ (read): Dito.
+ (reset): Dito.
+ (skip): Dito.
+ (getProgressMonitor): Dito.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23882:
+ * java/text/StringCharacterIterator.java (StringCharacterIterator):
+ Javadoc fix.
+ (hashCode): New method.
+ * java/text/ParsePosition.java (hashCode): New method
+
+2005-09-16 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/Timer.java (Waker.run): Do not enter loop on
+ repeats = false (fixes #23918).
+
2005-09-16 Andrew Haley <aph@redhat.com>
- * java/io/ObjectStreamClass.java (findAccessibleMethod): Allow
- protected readResolve(). Rewrite accessibility check.
+ * java/io/ObjectStreamClass.java (findAccessibleMethod): Allow
+ protected readResolve(). Rewrite accessibility check.
+
+2005-09-16 Andrew Haley <aph@redhat.com>
+
+ * scripts/loc: New file.
+
+2005-09-16 Anthony Green <green@redhat.com>
+
+ * java/lang/String.java (getBytes): Throw an InternalError instead
+ of silently returning null.
+
+2005-09-16 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #22610
+ * java/awt/Container.java
+ (remove): Removed component listeners from the component
+ being removed. This was a problem if that same component
+ that was removed was added to a new component.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ (MetalComboBoxEditorBorder.paintBorder): modified border appearance.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java: updated API docs
+ and minor reformatting.
+
+2005-09-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JList.java
+ (AccessibleJList): New inner class.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java: new file.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonIcon.paintIcon): change color of selection indicator
+ according to component state.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java
+ (drawCheck): change color according to component state.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ButtonBorder.paintBorder): draw a different border for a disabled
+ button.
+
+2005-09-15 Anthony Green <green@redhat.com>
+
+ * java/awt/Color.java (RGBtoHSB): Don't use integer division when
+ calculating saturation.
+ * java/awt/Rectangle.java (equals): Explain why hashCode() isn't
+ required.
+ * java/awt/Point.java (equals): Ditto.
+
+ * java/util/zip/ZipFile.java (checkZipFile): Make sure we read the
+ 4 byte magic number.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/text/html/parser/DTD.java (FILE_VERSION): Now
+ final.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ * javax/naming/Name.java: Extends Comparable.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Component.java:
+ (isDisplayable): Don't check the parent's displayability, only return
+ true if peer is non-null and false if peer is null.
+
+2005-09-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/SwingUtilities.java
+ (layoutCompoundLabel): check for empty text string,
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (paint): check isBorderPainted() when calculating view rect,
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (CloseAction): new constructor,
+ (IconifyAction): new constructor,
+ (MaximizeAction): new constructor,
+ (MoveAction): new constructor,
+ (RestoreAction): new constructor,
+ (SizeAction): new constructor,
+ (TitlePaneLayout.layoutContainer): calculate button widths from icon
+ widths,
+ (installDefaults): initialise icon fields,
+ (uninstallDefaults): clear icon fields,
+ (createButtons): set button text to null,
+ (setButtonIcons): use icon fields.
+
+2005-09-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+ (getListCellRendererComponent): Added code in to check if string
+ is larger than comboBox. If it is, the string is truncated and
+ '...' is drawn at the end of it.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (getDefaultSize): Initially too small, still not fully implemented.
+ (getLargestItemSize): Made private, not in API.
+ (minimumLayoutSize): Implemented properly.
+ (intervalAdded): ComboBox should not be resized with every new
+ component. This is fixed.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/EnumConstantNotPresentException.java: New file.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java:
+ Reformatted file.
+
+2005-09-15 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23678
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ (CBLabelRenderer): Removed. Not in API, and it is really
+ redundant to have.
+ (installComponents): Changed the renderer set for the combo box.
+ Also, added the buttonPanel to the parentsPanel, so they are
+ always painted correctly. Set the FlowLayout to LEFT
+ instead of default being CENTER.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JRootPane.java:
+ (setContentPane): Remove the old content pane first. Throw
+ IllegalComponentStateException if the parameter is null. Added docs.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ Workaround for PR classpath/23863:
+ * native/fdlibm/mprec.h (MAX_BIGNUM_WDS): Define as 128 on
+ non-Pack_32 platforms.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Component.java:
+ (isDisplayable): Return true if peer != null.
+ * java/awt/Window.java:
+ (isDisplayable): Removed this method. Now inherits from Component.
+
+2005-09-15 Anthony Green <green@redhat.com>
+
+ * java/io/PushbackInputStream.java (available, read, skip): Handle
+ closed stream operations gracefully.
+
+2005-09-15 Anthony Green <green@redhat.com>
+
+ * java/nio/charset/Charset.java: close() each stream we open.
+ * java/net/URLStreamHandler.java: Remove redundant null pointer
+ check.
+ * java/security/Identity.java (equals, identityEquals): Don't use
+ `==' to compare uninterned Strings. Use String.equals().
+ * java/lang/Class.java (pd): Mark this field as transient for
+ FindBugs won't complain (although not strictly necessary).
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTextArea.java:
+ (append): Changed invalidate call to revalidate call.
+ (setRows): Likewise.
+ (setColumns): Likewise.
+
+2005-09-15 Lillian Angel <langel@redhat.com>
+
+ Fixes #23873
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (createMessageArea): Changed orientation of message from EAST to
+ CENTER. Also, fixed empty border values to make message more centered.
+ * javax/swing/JOptionPane.java
+ (showConfirmDialog): Added check for pane.getValue, since clicking on
+ 'x' of window does not have an initialized value. Was causing a
+ ClassCastException.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+
+2005-09-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): set font,
+ (uninstallDefaults): clear font,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): update ToggleButton defaults,
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java
+ (instance): removed field,
+ (createUI): just return new instance every time,
+ (MetalToggleButtonUI): look up defaults directly,
+ (getFocusColor): return value from field initialised in constructor,
+ (getSelectColor): likewise,
+ (getDisabledTextColor): likewise,
+ (installDefaults): override to make public,
+ (paintButtonPressed): implemented,
+ (paintText): implemented,
+ (paintFocus): implemented.
+
+2005-09-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (toggleButtonBorder): new private field,
+ (ToggleButtonBorder): new class,
+ (getToggleButtonBorder): new method.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (insertUpdate): Tweaked attribute comparison to avoid NPE.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (insertUpdate): Tweaked attribute comparison to avoid NPE.
+ * javax/swing/text/GlyphView.java
+ (DefaultGlyphPainter.getBoundedPosition): Implemented.
+ (DefaultGlyphPainter.viewToModel): Implemented.
+ (getTabExpander): Don't be specific to ParagraphView here. All
+ parents that implement TabExpander can be accepted.
+ (getBeginIndex): Removed. This method is not documented in the
+ specs.
+ (getBreakWeight): Implemented.
+ (changedUpdate): Implemented.
+ (insertUpdate): Implemented.
+ (removeUpdate): Implemented.
+ (createFragment): Implemented.
+ (breakView): Use createFragment.
+ * javax/swing/text/Utilities.java
+ (getTabbedTextOffset): Implemented both variants of this method.
+
+2005-09-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Connected_objects.java (equals),
+ * gnu/CORBA/Poa/activeObjectMap.java (equals): Removed, fixes
+ #23879.
+ * gnu/CORBA/Version.java (hashCode),
+ * gnu/CORBA/gnuAny.java (hashCode): New method, fixes #23879.
+
+2005-09-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JProgressBar.java
+ (JProgressBar): Fixed to use setOrientation function.
+ * javax/swing/plaf/metal/MetalProgressBarUI.java
+ (createUI): Was using the same instance of the UI for
+ each new JProgressBar. Fixed this.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Added call to prepareForUIInstall.
+ (uninstallUI): Added call to prepareForUIUninstall.
+
+2005-09-14 Anthony Balkisoon <abalkiss@redhat.com>
+
+ * javax/swing/text/ComponentView.java:
+ (createComponent): Implemented.
+
+2005-09-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CosNaming/NameComponent (hashCode): New method,
+ fixes #23883).
+
+2005-09-14 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23795
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Made private fields package private.
+ (setCellRenderer): Took out code that updateRenderer takes
+ care of.
+ (getPathBounds): Fixed to use treeModel field.
+ (getPathForRow): Likewise.
+ (getRowCount): Likewise.
+ (installComponents): Implemented.
+ (createNodeDimensions): Implemented.
+ (uninstallComponents): Implemented.
+ (getVerticalLegBuffer): Implemented.
+ (getHorizontalLegBuffer): Implemented.
+ (updateLayoutCacheExpandedNodes): Implemented.
+ (updateExpandedDescendants): Implemented.
+ (updateDepthOffset): Implemented.
+ (updateRenderer): Implemented.
+ (updateSize): Implemented.
+ (installDefaults): Added some more defaults.
+ (installUI): Moved code to installComponents.
+ (paint): Fixed to use treeModel field.
+ (ensureRowsAreVisible): Implemented.
+ (getMinimumSize): Implemented.
+ (getMaximumSize): Implemented.
+ (checkForClickInExpandControl): Implemented.
+ (isLocationInExpandControl): Implemented.
+ (handleExpandControlClick): Implemented.
+ (toggleExpandState): Implemented.
+ (isToggleSelectionEvent): Implemented.
+ (isMultiSelectEvent): Implemented.
+ (isToggleEvent): Implemented.
+ (selectPathForEvent): Implemented.
+ (actionPerformed): Changed to use toggleExpandState.
+ (mousePressed): Fixed code to use helper methods. Made
+ more efficent.
+ (TreeCancelEditingAction): Fixed Constructor signature.
+ (actionPerformed): Fixed to use treeModel field.
+ (paintRecursive): Fixed to use line drawing helper methods.
+ (paintControlIcons): Fixed to use control icons helper methods.
+ (getCurrentControlIcon): New method.
+ (findNode): Changed to use treeModel field.
+ (getNextNode): Likewise.
+ (getPreviousNode): Likewise.
+ (getNextSibling): Likewise.
+ (getPreviousSibling): Likewise.
+ (getPathToRoot): Likewise.
+ (drawDashedHorizontalLine): Implemented.
+ (drawDashedVerticalLine): Implemented.
+ (paintExpandControl): Implemented.
+ (paintHorizontalPartOfLeg): New method.
+ (paintVerticalPartOfLeg): New method.
+ (paintRow): New method.
+ (shouldPaintExpandControl): New Method.
+ * javax/swing/plaf/metal/MetalTreeUI.java:
+ Added private fields for listeners.
+ (getHorizontalLegBuffer): Implemented.
+ (installUI): Implemented.
+ (uninstallUI): Implemented.
+ (decodeLineStyle): New method.
+ (isLocationInExpandControl): Implemented.
+ (paint): Implemented.
+ (paintHorizontalSeparators): New method.
+ (paintVerticalPartOfLeg): Implemented.
+ (paintHorizontalPartOfLeg): Implemented.
+
+2005-09-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTextArea.java:
+ (append): After non-empty append, invalidate.
+ (setRows): If number of rows changes, invalidate.
+ (setColumns): If number of columns changes, invalidate.
+
+2005-09-14 Anthony Green <green@redhat.com>
+
+ * java/net/InetSocketAddress.java (toString): Adjust to match Sun
+ JRE output, which is [HOSTNAME]/[IPADDRESS]:[PORT].
+ * gnu/java/security/der/DERReader.java: Remove stray semicolon.
+ * gnu/xml/pipeline/ValidationConsumer.java: Fix flags test (was
+ constant expression).
+ * javax/swing/plaf/basic/BasicFileChooserUI.java,
+ * javax/swing/filechooser/FileSystemView.java,
+ * java/util/logging/LogManager.java,
+ * gnu/xml/libxmlj/dom/GnomeDocument.java,
+ * gnu/xml/aelfred2/JAXPFactory.java,
+ * gnu/java/security/x509/ext/Extension.java,
+ * gnu/java/security/x509/ext/BasicConstraints.java,
+ * gnu/java/rmi/server/RMIObjectInputStream.java,
+ * gnu/java/rmi/dgc/DGCImpl_Stub.java,
+ * gnu/java/beans/decoder/BooleanHandler.java: Use
+ Boolean.valueOf() instead of new Boolean.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/StringBuffer.java (StringBuffer): New constructor.
+ (trimToSize): New method.
+ (codePointAt): Likewise.
+ (codePointBefore): Likewise.
+ (codePointCount): Likewise.
+ (appendCodePoint): Likewise.
+ (append): New overloads.
+ (insert): Likewise.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Character.java: Typo fixes in javadoc.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (calculateTabWidth): Don't use the calcRect here. This lead to an
+ inconsistent state when this method is called from another method
+ that also uses calcRect.
+ (calculateTabHeight): Don't use the calcRect here. This lead to an
+ inconsistent state when this method is called from another method
+ that also uses calcRect.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java:
+ Reformatted file.
+
+2005-09-14 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/io/ObjectInputStream.java:
+ (readObject()): Moved marker parsing to its own method.
+ (parseContent(byte)): Fixed TC_OBJECT handling to loop on
+ blockdata written manually by the class.
+
+2005-09-14 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/classpath/jcl.c: Replaced undefined
+ POINTERS_ARE_64BIT with SIZEOF_VOID_P == 8.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (PaletteCloseIcon): now implements UIResource.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ButtonModel.java: Added API docs all over.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTabbedPane.java: Added API comments to make clear
+ that null values for tab titles are allowed.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug#23859.
+ * javax/swing/JTabbedPane.java
+ (insertTab): Check if title == null and if so, then set it
+ to "". Otherwise the null string would cause a segfault or
+ an assertion failure in font metrics calculation as reported
+ in bug#23859.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * gnu/CORBA/ExceptionCreator.java: minor API doc fixes,
+ * gnu/CORBA/Version.java: likewise.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicFormattedTextFieldUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicPasswordFieldUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicTextAreaUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicTextFieldUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicTextPaneUI.java:
+ (getPropertyPrefix): added API docs.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * org/omg/CORBA/ORB.java: minor API doc fixes,
+ * org/omg/CORBA/PERSIST_STORE.java: likewise,
+ * org/omg/CORBA/PolicyError.java: likewise,
+ * org/omg/CORBA/ValueBaseHolder.java: likewise,
+ * org/omg/CORBA/VisibilityHelper.java: likewise.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxIcon.java: fixed header,
+ (paintIcon): change color to reflect component state.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.jdt.core.prefs: Ignore javadoc warnings
+ for hidden or deprecated members.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/AbstractDocument.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ (getContent): Made method final.
+ (AbstractElement.dumpElement): Removed superfluous private method.
+ (AbstractElement.dump): Made diagnostic output more speaking.
+ * javax/swing/text/BoxView.java
+ (paintChild): Don't allocate the child region here.
+ (paint): Allocate the child region here instead.
+ * javax/swing/text/ComponentView.java:
+ Added API doc comments.
+ * javax/swing/text/CompositeView.java
+ (getNextVisualPositionFrom): Declared to throw BadLocationException.
+ (getNextNorthSouthVisualPositionFrom): Likewise.
+ (getNextEastWestVisualPositionFrom): Likewise.
+ * javax/swing/text/DefaultCaret.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/DefaultEditorKit.java
+ Slight reformatting.
+ * javax/swing/text/DefaultFormatter.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/DefaultStyledEditorKit.java
+ (ElementBuffer.insertUpdate): Removed unneeded statement.
+ (ElementBuffer.insertStartTag): Attach a resolve parent to new
+ paragraph elements.
+ (createDefaultRoot): Attach a resolve parent to new paragraph
+ elements.
+ * javax/swing/text/InternationalFormatter.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/JTextComponent.java
+ Slight reformatting.
+ (paramString): Added TODO comment.
+ * javax/swing/text/SimpleAttributeSet.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ (equals): Don't require object to be SimpleAttributeSet. Allows
+ comparing to all kinds of AttributeSets.
+ (isEqual): Likewise.
+ * javax/swing/text/StringContent.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/StyleConstants.java
+ (getBackground): Return white as default background instead of black.
+ * javax/swing/text/StyleConstext.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ (SmallAttributeSet.equals): Don't require object to be
+ SmallAttributeSet. Allows comparing to all kinds of AttributeSets.
+ * javax/swing/text/StyledEditorKit.java
+ Fixed some comments.
+ * javax/swing/text/TabSet.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/TabStop.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/View.java
+ Removed unneeded import.
+
+2005-09-14 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/JOptionPane.java:
+ (showConfirmDialog): Changed QUESTION_MESSAGE like the JDK
+ does.
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java:
+ (getButtons): Treat DEFAULT_OPTION like
+ YES_NO_CANCEL_OPTION like the JDK.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GapContent.java
+ (GapContentPosition.getOffset): Made assertion more speaking.
+ (GapContent): Modified initialization for compatibility with JDK.
+ (shiftEnd): Update marks prior to modification of the content.
+ Use new getPositionsInRange method.
+ (shiftGap): Use new getPositionsInRange method. Tweaked to corectly
+ update the marks.
+ (shiftGapStartDown): New method.
+ (shiftGapEndUp): New method.
+ (replace): Use shiftGapEndUp. Modified resizing offset.
+ (getGapStart): New method.
+ (getGapEnd): New method.
+ (getPositionsInRange): New method.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GlyphView.java
+ (AbstractGlyphPainter.getAscent): New abstract method.
+ (AbstractGlyphPainter.getDescent): New abstract method.
+ (AbstractGlyphPainter.getBoundedPosition): New abstract method.
+ (AbstractGlyphPainter.viewToModel): New abstract method.
+ (AbstractGlyphPainter.getNextVisualPositionFrom): New method.
+ (AbstractGlyphPainter.getPainter): New method.
+ (DefaultGlyphPainter.paint): Add support for more text attributes.
+ (DefaultGlyphPainter.getAscent): New method.
+ (DefaultGlyphPainter.getDescent): New method.
+ (DefaultGlyphPainter.getBoundedPosition): New method.
+ (DefaultGlyphPainter.viewToModel): New method.
+ (GlyphView): Store start and end offset in the GlyphView.
+ (getPreferredSpan): Differentiate the axis parameter.
+ (viewToModel): Implemented this method.
+ (getStartOffset): Return value of private field instead of the
+ element value.
+ (getEndOffset): Return value of private field instead of the
+ element value.
+ (getBackground): New method.
+ (isStrikeThrough): New method.
+ (isSubscript): New method.
+ (isSuperscript): New method.
+ (isUnderline): New method.
+ (clone): New method.
+ (breakView): New method.
+ (getBreakWeight): New method.
+ (changedUpdate): New method.
+ (insertUpdate): New method.
+ (removeUpdate): New method.
+ (createFragment): New method.
+ (getAlignment): New method.
+ (getNextVisualPositionFrom): New method.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/util/regex/Matcher.java (matches): Javadoc fix.
+ (start): Likewise.
+ * java/lang/reflect/Proxy.java (equals): Javadoc fix.
+ * java/io/ObjectInputStream.java (inputGetObjectStreamClasses): Javadoc
+ fix.
+ * java/util/zip/ZipFile.java (getEntry): Javadoc fix.
+ * java/util/logging/XMLFormatter.java (getHead): Javadoc fix.
+ * java/util/logging/LogManager.java (getLevelProperty): Javadoc fix.
+ * java/util/logging/Handler.java (getEncoding): Javadoc fix.
+ (setFilter): Likewise.
+ * java/util/logging/FileHandler.java: Organized imports.
+ * java/util/jar/Manifest.java (Manifest): Javadoc fix.
+ * java/util/TreeMap.java (putFromObjStream): Javadoc fix.
+ * java/util/SimpleTimeZone.java (isBefore): Javadoc fix.
+ * java/util/ResourceBundle.java (tryBundle): Javadoc fix.
+ * java/util/Random.java (seed): Javadoc fix.
+ * java/util/Collections.java (SynchronizedSortedSet): Javadoc fix.
+ (SingletonMap): Likewise.
+ (addAll): Javadoc fix.
+ * java/lang/reflect/UndeclaredThrowableException.java: Javadoc fix.
+ * java/lang/reflect/Member.java (DECLARED, PUBLIC): Javadoc fix.
+ * java/lang/ref/WeakReference.java: Javadoc fix.
+ * java/lang/ref/Reference.java: Javadoc fix.
+ (Reference): Likewise.
+ * java/lang/Thread.java (setContextClassLoader): Javadoc fix.
+ (getContextClassLoader): Likewise.
+ (stop): Likewise.
+ * java/lang/System.java (runFinalizersOnExit): Javadoc fix.
+ * java/lang/String.java (upperExpand): Javadoc fix.
+ * java/lang/StrictMath.java: Javadoc fixes.
+ * java/lang/SecurityManager.java: Added imports for javadoc.
+ (currentClassLoader): Javadoc fix.
+ (classLoaderDepth): Likewise.
+ (currentLoadedClass): Likewise.
+ (checkRead): Likewise.
+ (checkWrite): Likewise.
+ (checkAccess): Likewise.
+ * java/lang/RuntimePermission.java: Added import for javadoc.
+ * java/lang/Readable.java (read): Added import for javadoc.
+
+2005-09-13 Casey Marshall <csm@gnu.org>
+
+ * gnu/classpath/ByteArray.java: new file.
+ * gnu/java/security/provider/Gnu.java
+ (<init>): add Diffie Hellman and RSA algorithms.
+ * gnu/javax/crypto/DiffieHellmanImpl.java: new file.
+ * gnu/javax/crypto/GnuDHPrivateKey.java: new file.
+ * gnu/javax/crypto/RSACipherImpl.java: new file.
+
+2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxButton.java: new file,
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java: likewise.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Process.java: Added import for javadoc.
+ * java/lang/Object.java (notify): Javadoc fix.
+ (notifyAll): Likewise.
+ * java/io/PipedInputStream.java (connect): Javadoc fix.
+ * java/io/OutputStreamWriter.java: Organized imports.
+ * java/io/ObjectStreamField.java (setOffset): Javadoc fix.
+ * java/io/ObjectInputStream.java (readFields): Javadoc fix.
+ * java/io/DataOutputStream.java (writeChars): Javadoc fix.
+ (writeFloat): Likewise.
+ (writeDouble): Likewise.
+ * java/util/Locale.java (readObject): Javadoc fix.
+ (writeObject): Likewise.
+ * java/io/LineNumberReader.java (read): Javadoc fix.
+ (setLineNumber): Likewise.
+ (mark): Likewise.
+ * java/io/InputStreamReader.java: Updated imports.
+ * java/lang/Integer.java (parseInt): Javadoc fix.
+ * java/io/FilterReader.java (skip): Javadoc fix.
+ * java/util/HashMap.java (containsValue): Javadoc fix.
+ * java/lang/ClassLoader.java (findLibrary): Javadoc fix.
+ (setPackageAssertionStatus): Likewise.
+ (setClassAssertionStatus): Likewise.
+ * java/lang/Class.java: Added imports for javadoc.
+ (matchMethod): Javadoc fix.
+ * java/util/ArrayList.java (readObject): Javadoc fix.
+ (writeObject): Likewise.
+ * java/lang/String.java (CaseInsensitiveComparator): Javadoc fix.
+ * java/util/zip/PendingBuffer.java (toByteArray): Javadoc fix.
+ * javax/swing/plaf/metal/OceanTheme.java: Mark as 1.5.
+ * java/util/logging/SimpleFormatter.java (format): Javadoc fix.
+ * java/util/zip/ZipFile.java (getEntries): Javadoc fix.
+
+2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (lightHighlight): removed,
+ (installDefaults): only update component attributes if they are tagged
+ with UIResource, initialise button colors from correct defaults,
+ (uninstallDefaults): only clear attributes that are tagged with
+ UIResource.
+
+2005-09-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (AccessibleJTree): Added new Inner class.
+ (AccessibleJTree.addAccessibleSelection): New method.
+ (AccessibleJTree.clearAccessibleSelection): New method.
+ (AccessibleJTree.fireVisibleDataPropertyChange): New method.
+ (AccessibleJTree.getAccessibleAt): New method.
+ (AccessibleJTree.getAccessibleChild): New method.
+ (AccessibleJTree.getAccessibleChildrenCount): New method.
+ (AccessibleJTree.getAccessibleIndexInParent): New method.
+ (AccessibleJTree.getAccessibleRole): New method.
+ (AccessibleJTree.getAccessibleSelection): New method.
+ (AccessibleJTree.getAccessibleSelection): New method.
+ (AccessibleJTree.getAccessibleSelectionCount): New method.
+ (AccessibleJTree.isAccessibleChildSelected): New method.
+ (AccessibleJTree.removeAccessibleSelection): New method.
+ (AccessibleJTree.selectAllAccessibleSelection): New method.
+ (AccessibleJTree.treeCollapsed): New method.
+ (AccessibleJTree.treeExpanded): New method.
+ (AccessibleJTree.treeNodesChanged): New method.
+ (AccessibleJTree.treeNodesInserted): New method.
+ (AccessibleJTree.treeNodesRemoved): New method.
+ (AccessibleJTree.treeStructureChanged): New method.
+ (AccessibleJTree.valueChanged): New method.
+ (AccessibleJTreeNode): Likewise.
+ (AccessibleJTreeNode.addAccessibleSelection): New method.
+ (AccessibleJTreeNode.addFocusListener): New method.
+ (AccessibleJTreeNode.addPropertyChangeListener): New method.
+ (AccessibleJTreeNode.clearAccessibleSelection): New method.
+ (AccessibleJTreeNode.contains): New method.
+ (AccessibleJTreeNode.doAccessibleAction): New method.
+ (AccessibleJTreeNode.getAccessibleAction): New method.
+ (AccessibleJTreeNode.getAccessibleActionCount): New method.
+ (AccessibleJTreeNode.getAccessibleActionDescription): New method.
+ (AccessibleJTreeNode.getAccessibleAt): New method.
+ (AccessibleJTreeNode.getAccessibleChild): New method.
+ (AccessibleJTreeNode.getAccessibleChildrenCount): New method.
+ (AccessibleJTreeNode.getAccessibleComponent): New method.
+ (AccessibleJTreeNode.getAccessibleContext): New method.
+ (AccessibleJTreeNode.getAccessibleDescription): New method.
+ (AccessibleJTreeNode.getAccessibleIndexInParent): New method.
+ (AccessibleJTreeNode.getAccessibleName): New method.
+ (AccessibleJTreeNode.getAccessibleParent): New method.
+ (AccessibleJTreeNode.getAccessibleRole): New method.
+ (AccessibleJTreeNode.getAccessibleSelection): New method.
+ (AccessibleJTreeNode.getAccessibleSelectionCount): New method.
+ (AccessibleJTreeNode.getAccessibleStateSet): New method.
+ (AccessibleJTreeNode.getAccessibleText): New method.
+ (AccessibleJTreeNode.getAccessibleValue): New method.
+ (AccessibleJTreeNode.getBackground): New method.
+ (AccessibleJTreeNode.getBounds): New method.
+ (AccessibleJTreeNode.getCursor): New method.
+ (AccessibleJTreeNode.getFont): New method.
+ (AccessibleJTreeNode.getFontMetrics): New method.
+ (AccessibleJTreeNode.getForeground): New method.
+ (AccessibleJTreeNode.getLocale): New method.
+ (AccessibleJTreeNode.getLocation): New method.
+ (AccessibleJTreeNode.getLocationInJTree): New method.
+ (AccessibleJTreeNode.getLocationOnScreen): New method.
+ (AccessibleJTreeNode.getSize): New method.
+ (AccessibleJTreeNode.isAccessibleChildSelected): New method.
+ (AccessibleJTreeNode.isEnabled): New method.
+ (AccessibleJTreeNode.isVisible): New method.
+ (AccessibleJTreeNode.removeAccessibleSelection): New method.
+ (AccessibleJTreeNode.removeFocusListener): New method.
+ (AccessibleJTreeNode.removePropertyChangeListener): New method.
+ (AccessibleJTreeNode.requestFocus): New method.
+ (AccessibleJTreeNode.selectAllAccessibleSelection): New method.
+ (AccessibleJTreeNode.setAccessibleDescription): New method.
+ (AccessibleJTreeNode.setAccessibleName): New method.
+ (AccessibleJTreeNode.setBackground): New method.
+ (AccessibleJTreeNode.setBounds): New method.
+ (AccessibleJTreeNode.setCursor): New method.
+ (AccessibleJTreeNode.setEnabled): New method.
+ (AccessibleJTreeNode.setFont): New method.
+ (AccessibleJTreeNode.setForeground): New method.
+ (AccessibleJTreeNode.setLocation): New method.
+ (AccessibleJTreeNode.setVisible): New method.
+ (removeDescendantToggledPaths): Implemented.
+ (treeDidChange): Implemented.
+
+2005-09-13 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jawt/jawt.c (_Jv_AWTLock): Do nothing.
+ (_Jv_AWTUnlock): Likewise.
+
+2005-09-13 David Daney <ddaney@avtrex.com>
+
+ * java/io/ByteArrayOutputStream.java: Reformated copyright notice.
+ (toString(int)): Pass correct parameters to String constructor.
+
+2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComboBox.java
+ (getPrototypeDisplayValue): added API docs,
+ (setPrototypeDisplayValue): fire property change event.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (ElementSpec): New inner class.
+ (ElementBuffer.change): Also store the DefaultDocumentEvent.
+ (ElementBuffer.split): Also update the document event.
+ (ElementBuffer.insert): New method.
+ (ElementBuffer.insertUpdate): New method.
+ (ElementBuffer.insertStartTag): New method.
+ (ElementBuffer.insertEndTag): New method.
+ (ElementBuffer.insertContentTag): New method.
+ (SectionElement): New inner class.
+ (createDefaultRoot): Return SectionElement instead of BranchElement.
+ (getParagraphElement): Optimized access to paragraph element.
+ (setCharacterAttributes): Fire changedUpdate after modification.
+ (insertUpdate): New method.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (toString): Implemented this method.
+ (calculateAlignedPositions): Partly implemented this method.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTabbedPane.java: Added API comments all over.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTree.java: Reformatted file.
+ * javax/swing/ListCellRenderer.java: Likewise.
+ * javax/swing/ListSelectionModel.java: Likewise.
+ * javax/swing/MenuElement.java: Likewise.
+ * javax/swing/OverlayLayout.java: Likewise.
+ * javax/swing/ProgressMonitor.java: Likewise.
+ * javax/swing/ProgressMonitorInputStream.java: Likewise.
+ * javax/swing/Renderer.java: Likewise.
+ * javax/swing/RepaintManager.java: Likewise.
+ * javax/swing/RootPaneContainer.java: Likewise.
+ * javax/swing/Scrollable.java: Likewise.
+ * javax/swing/SingleSelectionModel.java: Likewise.
+ * javax/swing/SizeSequence.java: Likewise.
+ * javax/swing/SpinnerListModel.java: Likewise.
+ * javax/swing/UnsupportedLookAndFeelException.java: Likewise.
+ * javax/swing/ViewportLayout.java: Likewise.
+ * javax/swing/WindowConstants.java: Likewise.
+
+2005-09-12 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.jdt.core.prefs: Enable javadoc warnings.
+
+2005-09-12 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ThreadLocal.java: Organized imports.
+ * java/lang/Double.java: Organized imports.
+
+2005-09-12 Casey Marshall <csm@gnu.org>
+
+ PR 23819
+ * javax/security/auth/Subject.java (SecureSet.<init>): rename
+ input paremeter to 'inElements.'
+ (SecureSet.contains): return 'elements.contains,' not
+ 'elements.remove.'
+
+ PR 23822
+ * javax/security/auth/SubjectDomainCombiner.java
+ (combine): don't access 'subject' if null.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkDesktopWorld): add palette style frame,
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (closeIcon): new field,
+ (installListeners): call createPropertyChangeListener() to create the
+ new listener to allow for overriding,
+ (installDefaults): set the font in the title, read closeIcon from
+ defaults,
+ (uninstallDefaults): clear closeIcon,
+ (setButtonIcons): set icon for closeButton,
+ (paintComponent): set font for title,
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ (MetalInternalFrameTitlePanePropertyChangeHandler): new support class,
+ (MetalTitlePaneLayout): likewise,
+ (paletteTitleHeight): initialise from defaults elsewhere,
+ (title): new private field,
+ (installDefaults): initialise various defaults,
+ (uninstallDefaults): clear defaults,
+ (addSubComponents): add sub-components used in this look and feel,
+ (createLayout): return new instance of MetalTitlePaneLayout,
+ (paintPalette): renders the title pane using the palette style,
+ (paintComponent): call paintPalette() if the internal frame uses the
+ palette style, otherwise handle painting without calling superclass
+ anymore,
+ (setPalette): update the icon visibility,
+ (createPropertyChangeListener): return a new change handler,
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java
+ (IS_PALETTE): new static field,
+ (installUI): check IS_PALETTE property,
+ (createNorthPane): removed empty border,
+ (setPalette): update border as appropriate,
+ (paletteListener): new private field,
+ (installListeners): install a listener to handle changes in the
+ IS_PALETTE property,
+ (uninstallListeners): clear the listener from installListeners(),
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added defaults for 'DesktopIcon.border',
+ 'InternalFrame.paletteBorder', 'InternalFrame.paletteCloseIcon', and
+ 'InternalFrame.paletteTitleHeight'.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComponent.java
+ (putClientProperty): fire property change event.
+
+2005-09-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JScrollPane.java:
+ (addNonNull): Changed from adding to container with no constraints to
+ adding to container with the appropriate ScrollPaneConstant as a
+ constraint. This avoids IllegalArgumentExceptions in ScrollPaneLayout.
+ (setColumnHeader): Added constraint to addNonNull call.
+ (setCorner): Likewise.
+ (setHorizontalScrollBar): Likewise.
+ (setRowHeader): Likewise.
+ (setVerticalScrollBar): Likewise.
+ (setViewport): Likewise.
+ * javax/swing/JViewport.java:
+ (setViewSize): Don't set the size or fireStateChanged unless the new
+ size is different from the old size.
+ (setView): Reset isViewSizeSet to false.
+ * javax/swing/ScrollPaneLayout:
+ (addSingletonComponent): Implemented and documented.
+ (addLayoutComponent): Throw an IllegalArgumentException if key is
+ not one of the appropriate ScrollPaneConstants constants. Added docs.
+ (setVerticalScrollBarPolicy): Likewise.
+ (setHorizontalScrollBarPolicy): Likewise.
+ (getCorner): Added docs.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JCheckBox.java
+ (AccessibleJCheckBox): New inner class.
+ (getAccessibleContext): Implemented this method.
+ * javax/swing/JLayeredPane.java
+ (AccessibleJLayeredPane): New inner class.
+ (getAccessibleContext): Implemented this method.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (getCellRect): Don't include cell gap in cell rectangle
+ calculation. It's already included in TableColumnModel.getWidth().
+ (createDefaultColumnsFromModel): Initialize table header values.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (paint): Don't include cell gap in cell rectangle
+ calculation. It's already included in TableColumnModel.getWidth().
+
+2005-09-12 Tom Tromey <tromey@redhat.com>
+
+ * org/ietf/jgss/GSSException.java (BAD_BINDINGS, BAD_MECH,
+ BAD_NAME, BAD_NAMETYPE, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED,
+ DEFECTIVE_CREDENTIAL, DEFECTIVE_TOKEN, DUPLICATE_TOKEN, FAILURE,
+ NO_CONTEXT, NO_CRED, OLD_TOKEN): Use values from JDK, not RFC.
+
+2005-09-12 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * lib/Makefile.am (JAVAC): Specify -source 1.4 to ecj.
+
+2005-09-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (isCellEditable): Stopped the timer if it is started and
+ should not be restarted. This is a fix for the 'click-pause-
+ click' method to start editing.
+
+2005-09-12 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/AWTUtilities.java
+ (convertPoint): Added a check to determine if source and
+ destination components are showing.
+ * javax/swing/JPopupMenu.java
+ (setVisible): Added check to determine if component is showing.
+ (show): Likewise.
+ * javax/swing/MenuSelectionManager.java
+ (componentForPoint): Added check to determine if component is showing.
+ * javax/swing/ToolTipManager.java
+ (showTip): Added check to determine if component is showing.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (mousePressed): Added check to determine if component is showing.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (InternalFrameCloseIcon.paintIcon): change colors according to button
+ state,
+ (InternalFrameAltMaximizeIcon.paintIcon): likewise,
+ (InternalFrameMaximizeIcon.paintIcon): likewise,
+ (InternalFrameMinimizeIcon.paintIcon): likewise.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (TableHeaderBorder): New inner class.
+ (TextFieldBorder.paintBorder): Only paint the active border
+ if the text field is enabled _and_ editable.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added default to use the new
+ TableHeaderBorder for table headers.
+
+2005-09-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (findComponentForMouseEventAt): Reduced visibility to package-private.
+ (getDeepestComponentForMouseEventAt): Reduced visibility to
+ package-private and removed static modifier.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (desktopIconBorder): new private field,
+ (DesktopIconBorder): new support class,
+ (getDesktopIconBorder): implemented,
+ (InternalFrameBorder.paintBorder): change color of line highlights if
+ the internal frame is selected.
+
+2005-09-12 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/dom/DomDocument.java: Implementation of xml:id W3C
+ Recommendation.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (TableColumnPropertyChangeHandler): New inner class. Handles
+ changes of column widths.
+ (JTable(TableModel, TableColumnModel, ListSelectionModel)):
+ Check if column model == null and if so, create a default model.
+ (initializeLocalVars): Changed to use createDefaultColumnsFromModel
+ instead of createColumnsFromModel.
+ (addColumn): Add property change handler to new column.
+ (createColumnsFromModel): Removed redundant private method.
+ Use the public createDefaultColumnsFromModel instead.
+ (tableChanged): Use createDefaultColumnsFromModel instead of
+ createColumnsFromModel.
+ (setModel): Use createDefaultColumnsFromModel instead of
+ createColumnsFromModel.
+ (doLayout): When handling AUTO_RESIZE_OFF, then adjust the
+ size of the resizing column to it's (new) preferred size.
+ (createDefaultColumnsFromModel): Added assertion to make sure
+ that the column model is not null. Add property change handler
+ to new columns.
+ * javax/swing/table/TableColumn.java
+ (setWidth): Fire property change with name 'width' instead
+ of using the (obsolete) constant field COLUMN_WIDTH_PROPERTY.
+ (setPreferredWidth): Make this property a bound property.
+
+2005-09-11 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/22922
+ * java/awt/event/InputEvent.java (modifiersEx): New field.
+ (InputEvent): Assume modifiers parameter contains both new- and
+ old-style masks.
+ (isShiftDown): Check modifiers for old-style shift mask and
+ modifiersEx for new-style shift mask.
+ (isControlDown): Likewise for control mask.
+ (isMetaDown): Likewise for meta mask.
+ (isAltDown): Likewise for alt mask.
+ (isAltGraphDown): Likewise for alt-graph mask.
+ (getModifiers): Return value of modifiers field.
+ (getModifiersEx): Return value of modifiersEx field.
+ * java/awt/event/MouseEvent.java
+ (MouseEvent(Component,int,long,int,int,int,int,boolean,int)):
+ Clear button new-style mask for mouse released events.
+ (paramString): Remove old-style modifier handling.
+ (readObject): Extend modifiers and assign to modifiersEx.
+ * java/awt/event/KeyEvent.java (readObject): Extend modifiers and
+ assign to modifiersEx.
+ * native/jni/gtk-peer/gtkpeer.h: Define macros for new-style mouse
+ masks. Define macros for old-style key masks.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
+ Remove macros for old-style key masks.
+ (button_to_awt_mods): Always return bitwise OR of new- and
+ old-style modifiers.
+ (cp_gtk_state_to_awt_mods): Likewise.
+ (state_to_awt_mods_with_button_states): Likewise.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (keyevent_state_to_awt_mods): Likewise.
+
+2005-09-11 Mark Wielaard <mark@klomp.org>
+
+ * m4/acinclude.m4 (CLASSPATH_CHECK_GCJ): Check for gcj 4 with
+ #if __GNUC__ <= 3.
+
+2005-09-11 Mark Wielaard <mark@klomp.org>
+
+ * lib/gen-classlist.sh.in: Use sort -r to work around bug #21418.
+
+2005-09-11 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/nio/channels/FileChannelImpl.java (finalize): Check whether
+ fd != -1 before calling close().
+
+2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (PaletteBorder): new class.
+
+2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (PaletteCloseIcon): new class.
+
+2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java:
+ (instances): removed,
+ (createUI): just return new instance,
+ API docs all over.
+
+2005-09-10 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (fail_g2d): New method.
+ (GdkGraphics2D(GdkGraphics2D)): Call fail_g2d if Graphics2D not
+ specified.
+ (GdkGraphics2D(int,int)): Likewise.
+ (GdkGraphics2D(GtkComponentPeer)): Likewise.
+
+2005-09-10 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/EmbeddedWindow.java (addNotify): Throw
+ AssertionError if field access fails.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Reindent
+ second error message.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/23692
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Only call
+ initStaticState if using Graphics2D. Otherwise print error and
+ exit.
+ (setClip(Shape)): If clip == null and component == null, do
+ nothing.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (GdkGraphics(GtkComponentPeer)): Set font field to a sensible
+ default if component font is null.
+
+2005-09-09 Keith Seitz <keiths@redhat.com>
+
+ * vm/reference/gnu/classpath/jdwp/VMIdManager.java (newObjectId):
+ Set the reference for the ID.
+
+2005-09-09 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/VmDeathEvent.java: New file.
+
+2005-09-09 Tom Tromey <tromey@redhat.com>
+
+ For PR libgcj/23288:
+ * java/net/URLClassLoader.java (definePackage): Correctly order
+ arguments to definePackage. Look up per-entry Attributes.
+ (getAttributeValue): New method.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java (installUI): Install
+ defaults after initializing tree.
+
+2005-09-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/html/CSS.java
+ New file. Defines standard CSS attributes.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Window.java (isDisplayable): Do not call super's
+ isDisplayable.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23796
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): Respect dialog's decorated flag.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23558
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (window_get_new_state): Remove function.
+ (window_get_new_state): Mark widget parameter as unused. Remove
+ call to window_get_new_state.
+ (window_active_state_change_cb): Remove function.
+ (connectSignals): Do not connect window_active_state_change_cb
+ callback.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23796
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (create): Respect
+ frame's decorated flag.
+
+2005-09-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installDefaults): Fixed method signature.
+ (uninstallDefaults): Likewise.
+ (uninstallUI): Fixed call to uninstallDefaults.
+ (installUI): Fixed call to installDefaults.
+ * javax/swing/JPopupMenu.java
+ (HeavyWeightPopup): Fixed to extend JDialog, since
+ nothing is added to the taskbar with JDialog. Also,
+ fixed so the popup menu is undecorated. Frames and
+ title bars should not be drawn, when popup is a
+ HeavyWeightPopup. A new bug was filed since the
+ decorated and undecorated frames are all drawn
+ alike.
+ * javax/swing/JRootPane.java
+ (setWindowDecorationStyle): Added check for
+ PLAIN_DIALOG.
+
+2005-09-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added the remaining color defaults.
+
+2005-09-09 Andrew Haley <aph@redhat.com>
+
+ * java/net/URLClassLoader.java (addURLImpl): Synchronize on the
+ loader.
+ (toString): Likewise.
+
+2005-09-09 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/security/auth/login/Configuration.java
+ (getConfiguration): Call getConfig() instead of doing the work.
+ (getConfig): Instantiate the configuration provider.
+
+2005-09-09 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/reflect/Proxy.java
+ (pack): Initialize field.
+
+2005-09-09 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java: Removed static initializer.
+ * java/io/ObjectOutputStream.java: Removed static initializer.
+ * vm/reference/java/io/VMObjectInputStream.java: Added static
+ initializer.
+ (oisClass, vmoisClass): Removed unused fields.
+ * vm/reference/java/io/VMObjectStreamClass.java: Added static
+ initializer.
+
+2005-09-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): re-added 'ScrollBar.width' default.
+
+2005-09-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java
+ (buttonBorder.paintBorder): fixed drawing issues,
+ (getMaximumSize): return constant value,
+ (getMinimumSize): likewise,
+ (getPreferredSize): likewise.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23558
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (FocusHandler.focusLost): Do not call popup.hide.
+
+2005-09-08 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Fix typo
+ (Grahics -> Graphics).
+
+2005-09-08 Tom Tromey <tromey@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch:
+ New file.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (MetalLookAndFeel): Only load default theme if no theme has been
+ set before.
+ (initComponentDefaults): Fixed and added color default values
+ for various components.
+
+2005-09-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (findComponentForMouseEventAt): Removed check for opacity.
+
+2005-09-08 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (executeVersion): Major and minor version are integers, not bytes.
+
+2005-09-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (findComponentForMouseEventAt): New implementation method.
+ (getDeepestComponentForMouseEventAt): New implementation method.
+ (acquireComponentForMouseEvent): Replaced call to
+ AWTUtilities.getDeepestComponentAt with call to new implementation
+ method getDeepestComponentAt to appropriately handle transparent
+ components with no MouseListeners attached.
+
+2005-09-08 Tom Tromey <tromey@redhat.com>
+
+ * .classpath: Enable compilation of jdwp.
+
+2005-09-08 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
+ (runCommand): Return value is true to indicate that the back-end
+ should shutdown; not whether it should stay alive.
+ * gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/MethodCommandSet.java (runCommand):
+ Likewise
+ * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (runCommand): Likewise.
+
+2005-09-08 Lillian Angel <langel@gmail.com>
+
+ * javax/swing/JPopupMenu.java:
+ Fixes Bug #PR23533
+ (setVisible): Adjusted popup menu's location
+ depending on the size of the screen.
+
+2005-09-08 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (EXTRA_DIST): Add autogen.sh
+ * lib/standard.omit: Remove gnu/classpath/jdwp, gnu/xml/stream and
+ javax/xml/stream.
+ * vm/reference/standard.omit: Removed.
+
+2005-09-08 Tom Tromey <tromey@redhat.com>
+
+ * .classpath: Omit more directories and files.
+ * .settings/org.eclipse.jdt.core.prefs: Compile to 1.4 platform.
+ * .settings/org.eclipse.jdt.ui.prefs: Likewise.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/OceanTheme.java
+ New class. Implements the ocean theme for Metal.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (createDefaultTheme): Made Ocean the default theme as in JDK1.5.
+
+2005-09-08 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (FileChooserDetailViewIcon): new private class,
+ (FileChooserHomeFolderIcon): likewise,
+ (FileChooserListViewIcon): likewise,
+ (FileChooserNewFolderIcon): likewise,
+ (FileChooserUpFolderIcon): likewise,
+ (getFileChooserDetailViewIcon): implemented,
+ (getFileChooserHomeFolderIcon): implemented,
+ (getFileChooserListViewIcon): implemented,
+ (getFileChooserNewFolderIcon): implemented,
+ (getFileChooserUpFolderIcon): implemented.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (foreground): Removed this field. This is better stored
+ in the text component itself.
+ (inactiveForeground): Removed this field. This is stored
+ in the disabledTextColor property of the text component.
+ (installDefaults): Load foreground and disabledTextColor
+ properties from UIDefaults. Remove call to updateComponentColors.
+ (paintBackground): Set the correct background color here.
+ (updateComponentColor): Removed this method.
+ * javax/swing/text/PlainView.java
+ (disabledColor): New field. Stores the text color for disabled
+ text fields.
+ (drawUnselectedText): Respect the 'enabled' property of
+ the text component.
+ (paint): Fetch the disabled color of the text component.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler.propertyChanged): Also update colors if the
+ 'editable' property is changed.
+ (updateComponentColors): Correctly handle editable vs. enabled
+ changes.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Fixed color defaults for TextFields
+ to use the current theme.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler.propertyChanged): Update the components colors
+ when the state of the 'enabled' property changes.
+ (foreground): New field that stores the foreground color.
+ (background): New field that stores the background color.
+ (inactiveForeground): New field that stores the inactive
+ foreground color.
+ (inactiveBackground): New field that stores the inactive
+ background color.
+ (updateComponentColors): New method. Updates the text
+ components' colors according to the state of the 'enabled'
+ property.
+ (installDefaults): Load the defaults for the component colors.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added defaults for TextField colors
+ and border.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GapContent.java
+ Fixes Bug #22966.
+ (GapContentPosition.getOffset): Added assertion to check for
+ consistent state of the Position. Fixed condition in if-statement.
+ (serialVersionUID): Updated serialVersionUID to match JDK1.5.
+ (shiftGap): If gapStart == newGapStart, then return immediatly.
+
+2005-09-08 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): added 'ScrollBar.width' default,
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (MetalScrollBarPropertyChangeHandler): new class,
+ (FREE_STANDING_PROP): added,
+ (MIN_THUMB_SIZE): modified dimensions,
+ (increaseButton): new field,
+ (decreaseButton): new field,
+ (scrollBarWidth): new field,
+ (isFreeStanding): new field,
+ (createUI): just return a new instance,
+ (installDefaults): implemented,
+ (createPropertyChangeListener): implemented,
+ (createDecreaseButton): implemented,
+ (createIncreaseButton): implemented,
+ (paintTrack): implemented,
+ (paintTrackHorizontal): new private method,
+ (paintTrackVertical): new private method,
+ (paintThumb): updated,
+ * javax/swing/plaf/metal/MetalScrollButton.java: implemented,
+ * javax/swing/plaf/metal/MetalUtils.java
+ (fillMetalPattern): modified alternating color calculation.
+
+2005-09-08 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (readObject): Removed println and fixed Proxy class descriptor
+ deserialization.
+ (resolveProxyClass): Use Class.forName() instead of calling
+ ClassLoader.loadClass() directly.
+ * java/io/ObjectOutputStream.java
+ (writeClassDescriptor): Added support for serializing Proxy
+ class descriptor.
+
+2005-09-08 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/naming/CompoundName.java
+ (readObject, writeObject): New methods.
+
+2005-09-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/SpringLayout.java:
+ Fixes Bug #PR23003
+ (getConstraints): Width and height should always
+ be reset, even if constraints is not null. Constraints
+ deal with the location of the component.
+
+2005-09-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ Fixes Bug #PR22966
+ (getOffset): Fixed check, was redundant.
+
+2005-09-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ Fixes Bug #PR22966
+ (getOffset): Added check for mark <= gapEnd
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JApplet.java
+ (AccessibleJApplet): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+ * javax/swing/JDialog.java
+ (AccessibleJDialog): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+ * javax/swing/JFrame.java
+ (AccessibleJFrame): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+ * javax/swing/JWindow.java
+ (AccessibleJWindow): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JPanel.java
+ (AccessibleJPanel): New inner class.
+ (getAccessibleContext): Implemented this method.
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JPanel.java: Reformatted to match our coding
+ standards.
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JViewport.java
+ (AccessibleJViewport): New inner class.
+ (getAccessibleContext): New method. Implements the Accessible
+ interface for JViewport.
+
+2005-09-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (HorizontalSliderThumbIcon.paintIcon): handle disabled component state,
+ and fetch colors from the look and feel,
+ (VerticalSliderThumbIcon.paintIcon): likewise,
+ * javax/swing/plaf/metal/MetalSliderUI.java
+ (MetalPropertyListener): implemented,
+ (constructor): added color initialisation,
+ (createUI): reimplemented to return a new instance every time,
+ (createPropertyChangeListener): return a new instance of
+ MetalPropertyListener,
+ (paintTrack): reimplemented to handle track fill option, and the
+ disabled component state,
+ (paintMinorTickForHorizSlider): fetch colors from look and feel,
+ (paintMajorTickForHorizSlider): likewise,
+ (paintMinorTickForVertSlider): likewise,
+ (paintMajorTickForVertSlider): likewise.
+
+2005-09-07 Robert Schuster <robertschuster@fsfe.org>
+
+ * native/jni/qt-peer/componentevent.cpp: Added inclusion
+ of assert.h
+
+2005-09-07 Robert Schuster <robertschuster@fsfe.org>
+
+ * INSTALL: Mention that GCJ4 is now mandatory.
+
+2005-09-07 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/Box.java: Added java.awt.Container import statement.
+
+2005-09-06 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added some RadioButton defaults,
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (instance): removed,
+ (focusColor): added,
+ (selectColor): added,
+ (disabledTextColor): added,
+ (createUI): return a new instance for every component,
+ (installDefaults): implemented,
+ (uninstallDefaults): implemented,
+ (getSelectColor): implemented,
+ (getDisabledTextColor): implemented,
+ (getFocusColor): implemented,
+ (paint): added FIXME note,
+ (paintFocus): implemented.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #PR23023
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ Added 2 fields and reformatted copyright.
+ (actionPerformed): Should be able to open directories.
+ (mouseClicked): Set text in text field.
+ (installUI): Initialized the current parent path.
+ (installComponents): Fixed initialization for text field.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ Formatted entire class.
+
+2005-09-06 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.19-pre.
+
+ * doc/www.gnu.org/announce/20050906.wml: New file.
+ * doc/www.gnu.org/newsitems.txt: Add 0.18 release announcement.
+ * doc/www.gnu.org/downloads/downloads.wml: Add 0.18.
+
+2005-09-06 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/Box.java
+ (AccessibleBox): Extend Container.AccessibleAWTContainer.
+ (Filler.AccessibleBoxFiller): Extend Component.AccessibleAWTComponent.
+ (Filler.getAccessibleContext): Uncomment disabled code.
+ (getAccessibleContext): Uncomment disabled code.
+ * javax/swing/JRootPane.java:
+ JRootPane implements Accessible.
+ (AccessibleJRootPane): Extend AccessibleJComponent.
+
+2005-09-06 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonIcon.drawCheck): removed,
+ (RadioButtonIcon.paintIcon): reimplemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added defaults for JRadioButton.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #PR20015
+ * javax/swing/JMenuBar.java
+ (getUIClassID): Fixed API documentation.
+ * javax/swing/plaf/basic/BasicMenuBarUI.java:
+ Added a private field for the mouse listener.
+ (BasicMenuBarUI): Initialized mouseListener.
+ (installListeners): Added mouseListener.
+ (uninstallListeners): Removed mouseListener.
+ (MouseInputHandler): New class added.
+ (mouseClicked): Added code to deselect menu items
+ when menu bar is clicked.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Fixes Bug #PR23527
+ (paintMenuItem): Moved view rectangle over to the
+ left the same amount as defaultTextIconGap so the
+ accelerator is painted with some space on the right.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Formatted class.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI:
+ Fixes Bug PR23529.
+ (installUI): Changed delay for Timer. Was set too
+ long and actionPerformed was not being called fast
+ enough when the user clicks on the scroll bar. This
+ is because the timer is stopped after the mouse is
+ released.
2005-09-06 Mark Wielaard <mark@klomp.org>
diff --git a/libjava/classpath/INSTALL b/libjava/classpath/INSTALL
index 91515076cd3..7da23666937 100644
--- a/libjava/classpath/INSTALL
+++ b/libjava/classpath/INSTALL
@@ -1,4 +1,4 @@
-Installing GNU Classpath - Last updated: August 31, 2005
+Installing GNU Classpath - Last updated: September 7, 2005
First, this is a development release only! Unless you are interested in
active development and debugging, or just like running random alpha code,
@@ -31,12 +31,17 @@ Suggested Software
--with-jikes, --with-gcj, --with-ecj or --with-kjc as argument to
configure; the present default is gcj.
- - GCJ 3.3+ (part of the GNU GCC package).
+ - GCJ 4.0+ (part of the GNU GCC package).
- IBM jikes 1.19+.
- Eclipse Compiler for Java 3.1+
- The kjc compiler is supported with configure but we have
been unable to successfully compile with it.
+ IMPORTANT: Versions of GCJ which are earlier than 4.0 contain
+ bugs which make it impossible to compile the class library and
+ are *not* supported any more. If you are stuck on a system where
+ GCC 3.x is the system compiler we recommend using Jikes.
+
For building the gtk+ AWT peer JNI native libraries, the following
are required unless --disable-gtk-peer is used as an argument to
configure.
@@ -74,6 +79,29 @@ Suggested Software
- texinfo 4.2 or higher.
+ For building the ALSA midi provider code you will need
+ ALSA. http://www.alsa-project.org.
+
+ For building the DSSI midi synthesizer provider code you will
+ need DSSI from http://dssi.sourceforge.net. This, in turn,
+ introduces many dependencies, including:
+
+ - liblo: the Lightweight OSC implementation
+ http://plugin.org.uk/liblo/
+
+ - LADSPA: Linux Audio Developer's Simple Plugin API
+ http://www.ladspa.org
+
+ - the JACK Audio Connection Kit: A low latency audio server
+ http://jackit.sourceforge.net
+
+ - libsndfile: an audio file I/O library
+ http://www.mega-nerd.com/libsndfile/
+
+ - fluidsynth: a real-time SoundFont 2 based soft-synth
+ http://www.fluidsynth.org/
+
+
This package was designed to use the GNU standard for configuration
and makefiles. To build and install do the following:
@@ -99,8 +127,7 @@ gives a complete list.
--enable-Werror whether to compile C code with -Werror which turns
any compiler warning into a compilation failure
default=no
- --enable-xmlj compile native libxml/xslt library default=no
- --with-gjdoc generate documentation using gjdoc default=no
+ --with-gjdoc generate documentation using gjdoc default=no
--with-jay Regenerate the parsers with jay must be given the
path to the jay executable
diff --git a/libjava/classpath/LICENSE b/libjava/classpath/LICENSE
index 240f834ddff..273623b2c48 100644
--- a/libjava/classpath/LICENSE
+++ b/libjava/classpath/LICENSE
@@ -284,3 +284,17 @@ All these files are distributed under the following terms:
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
+
+
+The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+contains two functions (get_port_default and set_control) derived from
+example code in the DSSI distribution (http://dssi.sourceforge.net).
+The original DSSI example code is distributed under the following
+terms:
+
+ Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+
+ Permission to use, copy, modify, distribute, and sell this software
+ for any purpose is hereby granted without fee, provided that the
+ above copyright notice and this permission notice are included in
+ all copies or substantial portions of the software.
diff --git a/libjava/classpath/Makefile.am b/libjava/classpath/Makefile.am
index 63b26c197d1..69bdb4aa431 100644
--- a/libjava/classpath/Makefile.am
+++ b/libjava/classpath/Makefile.am
@@ -11,7 +11,8 @@ native: lib
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 \
- ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj
+ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
+ autogen.sh
#DISTCHECK_CONFIGURE_FLAGS = --enable-gjdoc
diff --git a/libjava/classpath/Makefile.in b/libjava/classpath/Makefile.in
index 957fc5325a4..410171efc59 100644
--- a/libjava/classpath/Makefile.in
+++ b/libjava/classpath/Makefile.in
@@ -44,10 +44,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
ltmain.sh missing mkinstalldirs
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -100,10 +98,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -240,6 +242,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -253,6 +256,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -272,7 +276,8 @@ DIST_SUBDIRS = lib doc external include native resource scripts examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 \
- ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj
+ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
+ autogen.sh
all: all-recursive
@@ -446,7 +451,7 @@ distclean-tags:
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/../.. $(distdir)/../../config $(distdir)/examples $(distdir)/gnu/classpath $(distdir)/lib $(distdir)/m4 $(distdir)/scripts
+ $(mkdir_p) $(distdir)/../.. $(distdir)/examples $(distdir)/gnu/classpath $(distdir)/lib $(distdir)/m4 $(distdir)/scripts
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
diff --git a/libjava/classpath/NEWS b/libjava/classpath/NEWS
index 4d918525963..778369385b7 100644
--- a/libjava/classpath/NEWS
+++ b/libjava/classpath/NEWS
@@ -1,3 +1,58 @@
+New in release 0.20
+
+Runtime interface changes:
+
+* New method VMStackWalker.getClassLoader() was added to avoid an infinite
+ loop between getCallingClassLoader() and Class.getClassLoader().
+
+New in release 0.19 (Nov 2, 2005)
+
+* The Swing RepaintManager has been reworked for more efficient painting,
+ especially for large GUIs.
+
+* The Swing layout manager OverlayLayout has been implemented, the BoxLayout
+ has been rewritten to make use of the SizeRequirements utility class and
+ caching for more efficient layout.
+
+* Improved accessibility support for Swing.
+
+* The java.net.HttpURLConnection implementation no longer buffers the
+ entire response body in memory. This means that response bodies
+ larger than available memory can now be handled.
+
+* The Andrew Watson, Vice President and Technical Director of the Object
+ Management Group, has officially assigned us 20 bit Vendor Minor Code Id:
+ 0x47430 ("GC") that will mark remote Classpath - specific system exceptions.
+ Obtaining the VMCID means that GNU Classpath now is a recogniseable type of
+ node in a highly interoperable CORBA world.
+
+* Classpath now includes the first working draft to support the RMI over
+ IIOP protocol. The current implementation is capable for remote invocations,
+ transferring various Serializables and Externalizables via RMI-IIOP protocol.
+ It can flatten graphs and, at least for the simple cases, is interoperable
+ with Sun's jdk 1.5.
+
+* Qt4 configury switches for OS-X. Additional to the --enable-qt-peer, OS-X
+ users with a Qt4 installation can build the qt-peers with the argument
+ --with-qt4dir=<Qt4-installation-dir>.
+
+* Significant progress has been made in the implementation of the
+ javax.swing.plaf.metal.* package, with most UI delegates in a working state
+ now. Please test this with your own applications and provide feedback that
+ will help us to improve this package.
+
+* The GUI demo (gnu.classpath.examples.swing.Demo) has been extended to
+ highlight various features in our free-swing implementation. And includes
+ a look and feel switcher (Metal default, Ocean or GNU).
+
+Runtime interface changes:
+
+* Changed implementation of VMClassLoader.getPackage(s) : new method
+ VMClassLoader.getBootPackages should be implemented by the vm, and sould
+ return a string array of boot package names ("java.lang", "java.net", ...).
+ Feedback from vm implementors for usability and relevance of the
+ getBootPackages method would be greatly appreciated.
+
New in release 0.18 (Sep 6, 2005)
* GNU JAWT implementation, the AWT Native Interface, which allows direct
diff --git a/libjava/classpath/aclocal.m4 b/libjava/classpath/aclocal.m4
index fbe1f32dd7a..7f4f5c62f22 100644
--- a/libjava/classpath/aclocal.m4
+++ b/libjava/classpath/aclocal.m4
@@ -547,6 +547,39 @@ AC_DEFUN([AM_PROG_INSTALL_SH],
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
@@ -1053,10 +1086,8 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../../config/depstand.m4])
-m4_include([../../config/lead-dot.m4])
-m4_include([../../config/no-executables.m4])
m4_include([../../libtool.m4])
+m4_include([m4/acattribute.m4])
m4_include([m4/accross.m4])
m4_include([m4/acinclude.m4])
m4_include([m4/iconv.m4])
diff --git a/libjava/classpath/autogen.sh b/libjava/classpath/autogen.sh
index e20cc38695a..babfa4e5d83 100755
--- a/libjava/classpath/autogen.sh
+++ b/libjava/classpath/autogen.sh
@@ -16,7 +16,7 @@ LIBTOOLIZE=libtoolize
have_libtool=false
if ${LIBTOOLIZE} --version < /dev/null > /dev/null 2>&1 ; then
- libtool_version=`${LIBTOOLIZE} --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+ libtool_version=`${LIBTOOLIZE} --version | sed 's/^.*[^0-9.]\([0-9]\{1,\}\.[0-9.]\{1,\}\).*/\1/'`
case $libtool_version in
1.5*)
have_libtool=true
diff --git a/libjava/classpath/config.guess b/libjava/classpath/config.guess
index 2fc3acce2ea..917bbc50f36 100755
--- a/libjava/classpath/config.guess
+++ b/libjava/classpath/config.guess
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2003-06-17'
+timestamp='2005-07-08'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -17,13 +17,15 @@ timestamp='2003-06-17'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
@@ -53,7 +55,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -66,11 +68,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
+esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
@@ -136,13 +138,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-## for Red Hat Linux
-if test -f /etc/redhat-release ; then
- VENDOR=redhat ;
-else
- VENDOR= ;
-fi
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -203,50 +198,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- macppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvmeppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mipseb-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
+ case $UNAME_RELEASE in
+ *4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
@@ -284,42 +258,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
+ # A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
- Alpha*:OpenVMS:*:*)
- echo alpha-hp-vms
- exit 0 ;;
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
- exit 0 ;;
+ exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
- exit 0 ;;
+ exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
- exit 0;;
+ exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
+ exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
- exit 0 ;;
+ exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
- exit 0 ;;
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
+ exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
@@ -327,32 +308,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
else
echo pyramid-pyramid-bsd
fi
- exit 0 ;;
+ exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
- exit 0 ;;
+ exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
- exit 0 ;;
- DRS?6000:UNIX_SV:4.2*:7*)
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7 && exit 0 ;;
+ sparc) echo sparc-icl-nx7; exit ;;
esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
@@ -361,10 +342,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
+ exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
@@ -376,10 +357,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
- exit 0 ;;
+ exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -390,37 +371,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
- exit 0 ;;
+ exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -444,32 +428,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit (-1);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c \
- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
- exit 0 ;;
+ exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
- exit 0 ;;
+ exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
- exit 0 ;;
+ exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
- exit 0 ;;
+ exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
@@ -485,29 +470,29 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
- exit 0 ;;
+ exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
- exit 0 ;;
+ exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
- exit 0 ;;
+ exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
+ exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
- exit 0 ;;
+ exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
@@ -515,7 +500,7 @@ EOF
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
@@ -530,14 +515,18 @@ EOF
exit(0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
- echo rs6000-ibm-aix3.2.5
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
- exit 0 ;;
+ exit ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
@@ -551,28 +540,28 @@ EOF
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
- exit 0 ;;
+ exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
- exit 0 ;;
+ exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
+ exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
- exit 0 ;;
+ exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
- exit 0 ;;
+ exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
- exit 0 ;;
+ exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
- exit 0 ;;
+ exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
@@ -634,9 +623,19 @@ EOF
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
- # avoid double evaluation of $set_cc_for_build
- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
@@ -644,11 +643,11 @@ EOF
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -676,150 +675,166 @@ EOF
exit (0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
- exit 0 ;;
+ exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
- exit 0 ;;
+ exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
- exit 0 ;;
+ exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
- exit 0 ;;
+ exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
- exit 0 ;;
+ exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
- exit 0 ;;
+ exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
- exit 0 ;;
+ exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
- exit 0 ;;
+ exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
*:UNICOS/mp:*:*)
- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
- # Determine whether the default compiler uses glibc.
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #if __GLIBC__ >= 2
- LIBC=gnu
- #else
- LIBC=
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
- exit 0 ;;
+ exit ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
+ exit ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
+ exit ;;
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit 0 ;;
+ exit ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
- exit 0 ;;
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
- exit 0 ;;
+ exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
+ exit ;;
+ amd64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
- exit 0 ;;
+ exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
*:GNU:*:*)
+ # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
+ exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
- exit 0 ;;
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -837,7 +852,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
@@ -856,14 +871,14 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
ppc:Linux:*:*)
- echo powerpc-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo powerpc-unknown-linux-gnu
+ exit ;;
ppc64:Linux:*:*)
- echo powerpc64-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -877,7 +892,7 @@ EOF
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit 0 ;;
+ exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -885,25 +900,25 @@ EOF
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
- exit 0 ;;
+ exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu
- exit 0 ;;
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
x86_64:Linux:*:*)
- echo x86_64-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo x86_64-unknown-linux-gnu
+ exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
@@ -921,15 +936,15 @@ EOF
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0 ;;
+ exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0 ;;
+ exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit 0 ;;
+ exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
@@ -952,17 +967,23 @@ EOF
LIBC=gnuaout
#endif
#endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
- exit 0 ;;
+ exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
@@ -970,24 +991,27 @@ EOF
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
+ exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
- exit 0 ;;
+ exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
- exit 0 ;;
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -995,15 +1019,16 @@ EOF
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
- exit 0 ;;
- i*86:*:5:[78]*)
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -1021,73 +1046,73 @@ EOF
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
- exit 0 ;;
+ exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
- exit 0 ;;
+ exit ;;
paragon:*:*:*)
echo i860-intel-osf1
- exit 0 ;;
+ exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
- exit 0 ;;
+ exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
- exit 0 ;;
+ exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
- exit 0 ;;
+ exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
+ && { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
- exit 0 ;;
+ exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1095,68 +1120,73 @@ EOF
else
echo ns32k-sni-sysv
fi
- exit 0 ;;
+ exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
- exit 0 ;;
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
- exit 0 ;;
+ exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
- exit 0 ;;
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
- exit 0 ;;
+ exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
- exit 0 ;;
+ exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
- exit 0 ;;
+ exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
- exit 0 ;;
+ exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
- exit 0 ;;
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Darwin:*:*)
- case `uname -p` in
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
- powerpc) UNAME_PROCESSOR=powerpc ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
@@ -1164,22 +1194,25 @@ EOF
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
- exit 0 ;;
- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
- exit 0 ;;
+ exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
- exit 0 ;;
+ exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
@@ -1190,28 +1223,44 @@ EOF
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
- exit 0 ;;
+ exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
- exit 0 ;;
+ exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
- exit 0 ;;
+ exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
- exit 0 ;;
+ exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
- exit 0 ;;
+ exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
- exit 0 ;;
+ exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
- exit 0 ;;
+ exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1243,7 +1292,7 @@ main ()
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
+ printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
@@ -1332,11 +1381,12 @@ main ()
}
EOF
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
@@ -1345,22 +1395,22 @@ then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
c34*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
c38*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
c4*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
esac
fi
@@ -1371,7 +1421,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
- ftp://ftp.gnu.org/pub/gnu/config/
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
diff --git a/libjava/classpath/config.sub b/libjava/classpath/config.sub
index 6b2ff9f6a7a..1c366dfde9a 100755
--- a/libjava/classpath/config.sub
+++ b/libjava/classpath/config.sub
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2003-06-18'
+timestamp='2005-07-08'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,14 +21,15 @@ timestamp='2003-06-18'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@@ -70,7 +71,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -83,11 +84,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -99,7 +100,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
- exit 0;;
+ exit ;;
* )
break ;;
@@ -118,7 +119,8 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -144,7 +146,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis)
+ -apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@@ -228,14 +230,16 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
- | ip2k \
- | m32r | m68000 | m68k | m88k | mcore \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -244,31 +248,37 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | ms1 \
| msp430 \
| ns16k | ns32k \
- | openrisc | or32 \
+ | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | s390 | s390x \
- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
- | x86 | xscale | xstormy16 | xtensa \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@@ -296,19 +306,19 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
- | bs2000-* \
+ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | cydra-* \
+ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* \
- | m32r-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -317,34 +327,40 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | ms1-* \
| msp430-* \
- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | s390-* | s390x-* \
- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
- | xtensa-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
+ m32c-*)
+ ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@@ -361,6 +377,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@@ -378,6 +397,9 @@ case $basic_machine in
amd64)
basic_machine=x86_64-pc
;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@@ -437,12 +459,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
crds | unos)
basic_machine=m68k-crds
;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@@ -465,6 +502,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@@ -643,10 +684,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@@ -727,10 +764,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
- nv1)
- basic_machine=nv1-cray
- os=-unicosmp
- ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -738,9 +771,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
- or32 | or32-*)
+ openrisc | openrisc-*)
basic_machine=or32-unknown
- os=-coff
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@@ -833,6 +869,12 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
sa29200)
basic_machine=a29k-amd
os=-udi
@@ -956,6 +998,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
udi29k)
basic_machine=a29k-amd
os=-udi
@@ -999,6 +1045,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@@ -1029,6 +1079,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
rs6000)
basic_machine=rs6000-ibm
;;
@@ -1045,12 +1098,9 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
- sh64)
- basic_machine=sh64-unknown
- ;;
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
@@ -1124,19 +1174,21 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1154,12 +1206,15 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@@ -1172,6 +1227,9 @@ case $os in
-opened*)
os=-openedition
;;
+ -os400*)
+ os=-os400
+ ;;
-wince*)
os=-wince
;;
@@ -1193,6 +1251,9 @@ case $os in
-atheos*)
os=-atheos
;;
+ -syllable*)
+ os=-syllable
+ ;;
-386bsd)
os=-bsd
;;
@@ -1215,6 +1276,9 @@ case $os in
-sinix*)
os=-sysv4
;;
+ -tpf*)
+ os=-tpf
+ ;;
-triton*)
os=-sysv3
;;
@@ -1251,6 +1315,9 @@ case $os in
-kaos*)
os=-kaos
;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
-none)
;;
*)
@@ -1282,9 +1349,9 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1328,9 +1395,15 @@ case $basic_machine in
*-be)
os=-beos
;;
+ *-haiku)
+ os=-haiku
+ ;;
*-ibm)
os=-aix
;;
+ *-knuth)
+ os=-mmixware
+ ;;
*-wec)
os=-proelf
;;
@@ -1463,9 +1536,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
+ -os400*)
+ vendor=ibm
+ ;;
-ptx*)
vendor=sequent
;;
+ -tpf*)
+ vendor=ibm
+ ;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@@ -1490,7 +1569,7 @@ case $basic_machine in
esac
echo $basic_machine$os
-exit 0
+exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index 0c6781a815a..203822ddd78 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for GNU Classpath 0.18.
+# Generated by GNU Autoconf 2.59 for GNU Classpath 0.20-pre.
#
# Report bugs to <classpath@gnu.org>.
#
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='GNU Classpath'
PACKAGE_TARNAME='classpath'
-PACKAGE_VERSION='0.18'
-PACKAGE_STRING='GNU Classpath 0.18'
+PACKAGE_VERSION='0.20-pre'
+PACKAGE_STRING='GNU Classpath 0.20-pre'
PACKAGE_BUGREPORT='classpath@gnu.org'
ac_unique_file="java/lang/System.java"
@@ -312,7 +312,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIBVERSION CLASSPATH_MODULE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CREATE_JNI_LIBRARIES_TRUE CREATE_JNI_LIBRARIES_FALSE CREATE_CORE_JNI_LIBRARIES_TRUE CREATE_CORE_JNI_LIBRARIES_FALSE default_toolkit CREATE_XMLJ_LIBRARY_TRUE CREATE_XMLJ_LIBRARY_FALSE CREATE_GTK_PEER_LIBRARIES_TRUE CREATE_GTK_PEER_LIBRARIES_FALSE GTK_CAIRO_ENABLED GTK_CAIRO_TRUE GTK_CAIRO_FALSE CREATE_QT_PEER_LIBRARIES_TRUE CREATE_QT_PEER_LIBRARIES_FALSE CREATE_JNI_HEADERS_TRUE CREATE_JNI_HEADERS_FALSE LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB LIBTOOL CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP EGREP LIBICONV LTLIBICONV WARNING_CFLAGS STRICT_WARNING_CFLAGS ERROR_CFLAGS PKG_CONFIG XML_CFLAGS XML_LIBS XSLT_CFLAGS XSLT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CFLAGS GTK_LIBS QT_CFLAGS QT_LIBS MOC CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS USER_JAVAH USER_SPECIFIED_JAVAH_TRUE USER_SPECIFIED_JAVAH_FALSE CLASSPATH_INCLUDES GCJ JIKES JIKESENCODING KJC GCJX ECJ FOUND_GCJ_TRUE FOUND_GCJ_FALSE FOUND_JIKES_TRUE FOUND_JIKES_FALSE FOUND_ECJ_TRUE FOUND_ECJ_FALSE FOUND_KJC_TRUE FOUND_KJC_FALSE FOUND_GCJX_TRUE FOUND_GCJX_FALSE USER_CLASSLIB USER_SPECIFIED_CLASSLIB_TRUE USER_SPECIFIED_CLASSLIB_FALSE vm_classes MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBDEBUG INIT_LOAD_LIBRARY JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION REMOVE MKDIR CP DATE FIND ZIP INSTALL_GLIBJ_ZIP_TRUE INSTALL_GLIBJ_ZIP_FALSE INSTALL_CLASS_FILES_TRUE INSTALL_CLASS_FILES_FALSE BUILD_CLASS_FILES_TRUE BUILD_CLASS_FILES_FALSE EXAMPLESDIR GJDOC CREATE_API_DOCS_TRUE CREATE_API_DOCS_FALSE JAY JAY_SKELETON REGEN_PARSERS_TRUE REGEN_PARSERS_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIBVERSION CLASSPATH_MODULE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CREATE_JNI_LIBRARIES_TRUE CREATE_JNI_LIBRARIES_FALSE CREATE_CORE_JNI_LIBRARIES_TRUE CREATE_CORE_JNI_LIBRARIES_FALSE default_toolkit CREATE_XMLJ_LIBRARY_TRUE CREATE_XMLJ_LIBRARY_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP CREATE_ALSA_LIBRARIES_TRUE CREATE_ALSA_LIBRARIES_FALSE CREATE_DSSI_LIBRARIES_TRUE CREATE_DSSI_LIBRARIES_FALSE CREATE_GTK_PEER_LIBRARIES_TRUE CREATE_GTK_PEER_LIBRARIES_FALSE GTK_CAIRO_ENABLED GTK_CAIRO_TRUE GTK_CAIRO_FALSE CREATE_QT_PEER_LIBRARIES_TRUE CREATE_QT_PEER_LIBRARIES_FALSE nativelibdir glibjdir CREATE_JNI_HEADERS_TRUE CREATE_JNI_HEADERS_FALSE LN_S RANLIB ac_ct_RANLIB LIBTOOL CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP LIBICONV LTLIBICONV WARNING_CFLAGS STRICT_WARNING_CFLAGS ERROR_CFLAGS PKG_CONFIG XML_CFLAGS XML_LIBS XSLT_CFLAGS XSLT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CFLAGS GTK_LIBS CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS QT_CFLAGS QT_LIBS MOC USER_JAVAH USER_SPECIFIED_JAVAH_TRUE USER_SPECIFIED_JAVAH_FALSE CLASSPATH_INCLUDES GCJ JIKES JIKESENCODING KJC GCJX ECJ FOUND_GCJ_TRUE FOUND_GCJ_FALSE FOUND_JIKES_TRUE FOUND_JIKES_FALSE FOUND_ECJ_TRUE FOUND_ECJ_FALSE FOUND_KJC_TRUE FOUND_KJC_FALSE FOUND_GCJX_TRUE FOUND_GCJX_FALSE USER_CLASSLIB USER_SPECIFIED_CLASSLIB_TRUE USER_SPECIFIED_CLASSLIB_FALSE vm_classes MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBDEBUG INIT_LOAD_LIBRARY JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION REMOVE MKDIR CP DATE FIND ZIP INSTALL_GLIBJ_ZIP_TRUE INSTALL_GLIBJ_ZIP_FALSE INSTALL_CLASS_FILES_TRUE INSTALL_CLASS_FILES_FALSE BUILD_CLASS_FILES_TRUE BUILD_CLASS_FILES_FALSE EXAMPLESDIR GJDOC CREATE_API_DOCS_TRUE CREATE_API_DOCS_FALSE JAY JAY_SKELETON REGEN_PARSERS_TRUE REGEN_PARSERS_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -793,7 +793,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU Classpath 0.18 to adapt to many kinds of systems.
+\`configure' configures GNU Classpath 0.20-pre to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -864,7 +864,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU Classpath 0.18:";;
+ short | recursive ) echo "Configuration of GNU Classpath 0.20-pre:";;
esac
cat <<\_ACEOF
@@ -873,12 +873,18 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-jni compile JNI source default=yes
--enable-core-jni compile JNI sources for core default=yes
- --disable-Werror whether to compile C code with -Werror which turns
+ --enable-Werror whether to compile C code with -Werror which turns
any compiler warning into a compilation failure
default=no
--enable-default-toolkit
fully qualified class name of default AWT toolkit
--enable-xmlj compile native libxml/xslt library default=no
+ --disable-alsa compile ALSA providers (enable by --enable-alsa)
+ default=yes
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --disable-dssi compile DSSI providers (enable by --enable-dssi)
+ default=yes
--disable-gtk-peer compile GTK native peers (disabled by --disable-jni)
default=yes
@@ -890,8 +896,6 @@ Optional Features:
--enable-static=PKGS build static libraries default=no
--enable-shared=PKGS build shared libraries default=yes
--enable-fast-install=PKGS optimize for fast installation default=yes
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-rpath do not hardcode runtime library paths
--enable-maintainer-mode enable make rules and dependencies not useful
@@ -908,11 +912,17 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-native-libdir sets the installation directore for native libraries
+ default='${libdir}/${PACKAGE}'
+ --with-glibj-dir sets the installation directory for glibj.zip
+ default='${libdir}/${PACKAGE}'
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-pic try to use only PIC/non-PIC objects default=use both
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
--with-x use the X Window System
+ --with-qt4dir=DIR Qt4 installation directory used for OS-X. For other
+ systems use pkg-config.
--with-javah specify path or name of a javah-like program
--with-gcj bytecode compilation with gcj
--with-jikes bytecode compilation with jikes
@@ -1031,14 +1041,14 @@ esac
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd $ac_popdir
+ cd "$ac_popdir"
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-GNU Classpath configure 0.18
+GNU Classpath configure 0.20-pre
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1052,7 +1062,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU Classpath $as_me 0.18, which was
+It was created by GNU Classpath $as_me 0.20-pre, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1797,7 +1807,7 @@ fi
# Define the identity of the package.
PACKAGE='classpath'
- VERSION='0.18'
+ VERSION='0.20-pre'
cat >>confdefs.h <<_ACEOF
@@ -2062,7 +2072,7 @@ if test "${enable_Werror+set}" = set; then
case "${enableval}" in
yes) ENABLE_WERROR=yes ;;
no) ENABLE_WERROR=no ;;
- *) ENABLE_WERROR=yes ;;
+ *) ENABLE_WERROR=no ;;
esac
else
ENABLE_WERROR=no
@@ -2101,270 +2111,6 @@ else
fi
-# Check whether --enable-gtk-peer or --disable-gtk-peer was given.
-if test "${enable_gtk_peer+set}" = set; then
- enableval="$enable_gtk_peer"
- case "${enableval}" in
- yes) COMPILE_GTK_PEER=yes ;;
- no) COMPILE_GTK_PEER=no ;;
- *) COMPILE_GTK_PEER=yes ;;
- esac
-else
- COMPILE_GTK_PEER=yes
-fi;
-
-
-if test "x${COMPILE_GTK_PEER}" = xyes; then
- CREATE_GTK_PEER_LIBRARIES_TRUE=
- CREATE_GTK_PEER_LIBRARIES_FALSE='#'
-else
- CREATE_GTK_PEER_LIBRARIES_TRUE='#'
- CREATE_GTK_PEER_LIBRARIES_FALSE=
-fi
-
-
-# Check whether --enable-gtk-peers or --disable-gtk-peers was given.
-if test "${enable_gtk_peers+set}" = set; then
- enableval="$enable_gtk_peers"
- { { echo "$as_me:$LINENO: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&5
-echo "$as_me: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&2;}
- { (exit 1); exit 1; }; }
-fi;
-
-# Check whether --enable-gtk-cairo or --disable-gtk-cairo was given.
-if test "${enable_gtk_cairo+set}" = set; then
- enableval="$enable_gtk_cairo"
- case "${enableval}" in
- yes) GTK_CAIRO_ENABLED=true ;;
- no) GTK_CAIRO_ENABLED=false ;;
- *) GTK_CAIRO_ENABLED=true ;;
- esac
-else
- GTK_CAIRO_ENABLED=false
-fi;
-
-if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
-
-cat >>confdefs.h <<\_ACEOF
-#define GTK_CAIRO 1
-_ACEOF
-
-fi
-
-
-if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
- GTK_CAIRO_TRUE=
- GTK_CAIRO_FALSE='#'
-else
- GTK_CAIRO_TRUE='#'
- GTK_CAIRO_FALSE=
-fi
-
-
-# Check whether --enable-qt-peer or --disable-qt-peer was given.
-if test "${enable_qt_peer+set}" = set; then
- enableval="$enable_qt_peer"
- case "${enableval}" in
- yes) COMPILE_QT_PEER=yes ;;
- no) COMPILE_QT_PEER=no ;;
- *) COMPILE_QT_PEER=yes ;;
- esac
-else
- COMPILE_QT_PEER=no
-fi;
-
-
-if test "x${COMPILE_QT_PEER}" = xyes; then
- CREATE_QT_PEER_LIBRARIES_TRUE=
- CREATE_QT_PEER_LIBRARIES_FALSE='#'
-else
- CREATE_QT_PEER_LIBRARIES_TRUE='#'
- CREATE_QT_PEER_LIBRARIES_FALSE=
-fi
-
-
-# Check whether --enable-regen-headers or --disable-regen-headers was given.
-if test "${enable_regen_headers+set}" = set; then
- enableval="$enable_regen_headers"
- case "${enableval}" in
- yes) REGENERATE_JNI_HEADERS=yes ;;
- no) REGENERATE_JNI_HEADERS=no ;;
- *) REGENERATE_JNI_HEADERS=no ;;
- esac
-else
- REGENERATE_JNI_HEADERS=no
-fi;
-
-
-if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
- CREATE_JNI_HEADERS_TRUE=
- CREATE_JNI_HEADERS_FALSE='#'
-else
- CREATE_JNI_HEADERS_TRUE='#'
- CREATE_JNI_HEADERS_FALSE=
-fi
-
-
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
- echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6
-fi
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- done
- done
- ;;
-esac
-done
-
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL=$ac_install_sh
- fi
-fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-
-
-
-# Check whether --enable-static or --disable-static was given.
-if test "${enable_static+set}" = set; then
- enableval="$enable_static"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_static=no
-fi;
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_shared=yes
-fi;
-# Check whether --enable-fast-install or --disable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
- enableval="$enable_fast_install"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_fast_install=yes
-fi;
DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
@@ -2780,39 +2526,6 @@ main ()
return 0;
}
_ACEOF
-# FIXME: Cleanup?
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- gcc_no_link=no
-else
- gcc_no_link=yes
-fi
-
-if test x$gcc_no_link = xyes; then
- # Setting cross_compile will disable run tests; it will
- # also disable AC_CHECK_FILE but that's generally
- # correct if we can't link.
- cross_compiling=yes
- EXEEXT=
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
@@ -2949,7 +2662,6 @@ echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-fi
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
@@ -3032,8 +2744,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3091,8 +2802,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3208,8 +2918,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3263,8 +2972,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3309,8 +3017,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3354,8 +3061,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3504,6 +3210,1132 @@ fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Check whether --enable-alsa or --disable-alsa was given.
+if test "${enable_alsa+set}" = set; then
+ enableval="$enable_alsa"
+ case "${enableval}" in
+ yes) COMPILE_ALSA=yes ;;
+ no) COMPILE_ALSA=no ;;
+ *) COMPILE_ALSA=yes ;;
+ esac
+else
+
+for ac_header in alsa/asoundlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to classpath@gnu.org ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ COMPILE_ALSA=yes
+else
+ COMPILE_ALSA=no
+fi
+
+done
+
+fi;
+
+
+if test "x${COMPILE_ALSA}" = xyes; then
+ CREATE_ALSA_LIBRARIES_TRUE=
+ CREATE_ALSA_LIBRARIES_FALSE='#'
+else
+ CREATE_ALSA_LIBRARIES_TRUE='#'
+ CREATE_ALSA_LIBRARIES_FALSE=
+fi
+
+
+# Check whether --enable-dssi or --disable-dssi was given.
+if test "${enable_dssi+set}" = set; then
+ enableval="$enable_dssi"
+ case "${enableval}" in
+ yes) COMPILE_DSSI=yes ;;
+ no) COMPILE_DSSI=no ;;
+ *) COMPILE_DSSI=yes ;;
+ esac
+else
+
+for ac_header in dssi.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to classpath@gnu.org ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ COMPILE_DSSI=yes
+else
+ COMPILE_DSSI=no
+fi
+
+done
+
+fi;
+
+
+if test "x${COMPILE_DSSI}" = xyes; then
+ CREATE_DSSI_LIBRARIES_TRUE=
+ CREATE_DSSI_LIBRARIES_FALSE='#'
+else
+ CREATE_DSSI_LIBRARIES_TRUE='#'
+ CREATE_DSSI_LIBRARIES_FALSE=
+fi
+
+
+# Check whether --enable-gtk-peer or --disable-gtk-peer was given.
+if test "${enable_gtk_peer+set}" = set; then
+ enableval="$enable_gtk_peer"
+ case "${enableval}" in
+ yes) COMPILE_GTK_PEER=yes ;;
+ no) COMPILE_GTK_PEER=no ;;
+ *) COMPILE_GTK_PEER=yes ;;
+ esac
+else
+ COMPILE_GTK_PEER=yes
+fi;
+
+
+if test "x${COMPILE_GTK_PEER}" = xyes; then
+ CREATE_GTK_PEER_LIBRARIES_TRUE=
+ CREATE_GTK_PEER_LIBRARIES_FALSE='#'
+else
+ CREATE_GTK_PEER_LIBRARIES_TRUE='#'
+ CREATE_GTK_PEER_LIBRARIES_FALSE=
+fi
+
+
+# Check whether --enable-gtk-peers or --disable-gtk-peers was given.
+if test "${enable_gtk_peers+set}" = set; then
+ enableval="$enable_gtk_peers"
+ { { echo "$as_me:$LINENO: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&5
+echo "$as_me: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&2;}
+ { (exit 1); exit 1; }; }
+fi;
+
+# Check whether --enable-gtk-cairo or --disable-gtk-cairo was given.
+if test "${enable_gtk_cairo+set}" = set; then
+ enableval="$enable_gtk_cairo"
+ case "${enableval}" in
+ yes) GTK_CAIRO_ENABLED=true ;;
+ no) GTK_CAIRO_ENABLED=false ;;
+ *) GTK_CAIRO_ENABLED=true ;;
+ esac
+else
+ GTK_CAIRO_ENABLED=false
+fi;
+
+if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
+
+cat >>confdefs.h <<\_ACEOF
+#define GTK_CAIRO 1
+_ACEOF
+
+fi
+
+
+if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
+ GTK_CAIRO_TRUE=
+ GTK_CAIRO_FALSE='#'
+else
+ GTK_CAIRO_TRUE='#'
+ GTK_CAIRO_FALSE=
+fi
+
+
+# Check whether --enable-qt-peer or --disable-qt-peer was given.
+if test "${enable_qt_peer+set}" = set; then
+ enableval="$enable_qt_peer"
+ case "${enableval}" in
+ yes) COMPILE_QT_PEER=yes ;;
+ no) COMPILE_QT_PEER=no ;;
+ *) COMPILE_QT_PEER=yes ;;
+ esac
+else
+ COMPILE_QT_PEER=no
+fi;
+
+
+if test "x${COMPILE_QT_PEER}" = xyes; then
+ CREATE_QT_PEER_LIBRARIES_TRUE=
+ CREATE_QT_PEER_LIBRARIES_FALSE='#'
+else
+ CREATE_QT_PEER_LIBRARIES_TRUE='#'
+ CREATE_QT_PEER_LIBRARIES_FALSE=
+fi
+
+
+
+
+# Check whether --with-native-libdir or --without-native-libdir was given.
+if test "${with_native_libdir+set}" = set; then
+ withval="$with_native_libdir"
+
+ nativelibdir=${withval}
+
+else
+
+ nativelibdir='${libdir}/${PACKAGE}'
+
+fi;
+
+
+
+
+# Check whether --with-glibj-dir or --without-glibj-dir was given.
+if test "${with_glibj_dir+set}" = set; then
+ withval="$with_glibj_dir"
+
+ glibjdir=${withval}
+
+else
+
+ glibjdir='${datadir}/${PACKAGE}'
+
+fi;
+
+
+
+# Check whether --enable-regen-headers or --disable-regen-headers was given.
+if test "${enable_regen_headers+set}" = set; then
+ enableval="$enable_regen_headers"
+ case "${enableval}" in
+ yes) REGENERATE_JNI_HEADERS=yes ;;
+ no) REGENERATE_JNI_HEADERS=no ;;
+ *) REGENERATE_JNI_HEADERS=no ;;
+ esac
+else
+ REGENERATE_JNI_HEADERS=no
+fi;
+
+
+if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
+ CREATE_JNI_HEADERS_TRUE=
+ CREATE_JNI_HEADERS_FALSE='#'
+else
+ CREATE_JNI_HEADERS_TRUE='#'
+ CREATE_JNI_HEADERS_FALSE=
+fi
+
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+GCC_NO_EXECUTABLES
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=no
+fi;
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi;
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi;
+
# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
withval="$with_gnu_ld"
@@ -3825,7 +4657,6 @@ deplibs_check_method=$lt_cv_deplibs_check_method
-
# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
# find the maximum length of command line arguments
@@ -4222,7 +5053,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4225 "configure"' > conftest.$ac_ext
+ echo '#line 5056 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -4340,12 +5171,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -4369,8 +5195,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4880,8 +5705,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4939,8 +5763,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5056,8 +5879,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5111,8 +5933,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5157,8 +5978,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5202,8 +6022,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5730,8 +6549,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5789,8 +6607,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5861,8 +6678,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5906,8 +6722,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6306,23 +7121,7 @@ exec 5>>./config.log
if test "x${COMPILE_JNI}" = xyes; then
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6355,8 +7154,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6522,8 +7320,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6596,8 +7393,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6638,8 +7434,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6772,78 +7567,6 @@ echo "$as_me: error: unknown endianess - sorry, please pre-set ac_cv_c_bigendian
fi
- # On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
@@ -6899,8 +7622,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7150,12 +7872,7 @@ echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -7215,8 +7932,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7282,8 +7998,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7345,8 +8060,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7411,8 +8125,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7458,8 +8171,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7505,12 +8217,7 @@ echo $ECHO_N "checking for tzname... $ECHO_C" >&6
if test "${ac_cv_var_tzname+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -7538,8 +8245,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7599,8 +8305,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7651,8 +8356,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7703,8 +8407,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7811,8 +8514,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7843,6 +8545,66 @@ _ACEOF
fi
+ echo "$as_me:$LINENO: checking for __attribute__" >&5
+echo $ECHO_N "checking for __attribute__... $ECHO_C" >&6
+if test "${ac_cv_c_attribute+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+void foo(void) __attribute__ ((__noreturn__));
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_attribute=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_attribute=no
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_attribute" >&5
+echo "${ECHO_T}$ac_cv_c_attribute" >&6
+
+
+case $ac_cv_c_attribute in
+ yes) ;;
+ no)
+ cat >>confdefs.h <<_ACEOF
+#define __attribute__(x) /* nothing */
+_ACEOF
+ ;;
+esac
+
if test "X$prefix" = "XNONE"; then
@@ -8425,12 +9187,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -8457,8 +9214,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8481,12 +9237,7 @@ rm -f conftest.err conftest.$ac_objext \
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -8513,8 +9264,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8604,8 +9354,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8860,9 +9609,12 @@ echo "$as_me: error: Library requirements (libxslt >= 1.1.11) not met; consider
fi
if test "x${COMPILE_GTK_PEER}" = xyes; then
- echo "$as_me:$LINENO: checking for X" >&5
+
+if test "x$ac_path_x_has_been_run" != xyes; then
+ echo "$as_me:$LINENO: checking for X" >&5
echo $ECHO_N "checking for X... $ECHO_C" >&6
+ac_path_x_has_been_run=yes
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -8955,7 +9707,7 @@ ac_x_header_dirs='
/usr/openwin/share/include'
if test "$ac_x_includes" = no; then
- # Guess where to find include files, by looking for Intrinsic.h.
+ # Guess where to find include files, by looking for a specified header file.
# First, try using that file with no special directory specified.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -8963,7 +9715,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -8990,7 +9742,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in $ac_x_header_dirs; do
- if test -r "$ac_dir/X11/Intrinsic.h"; then
+ if test -r "$ac_dir/X11/Xlib.h"; then
ac_x_includes=$ac_dir
break
fi
@@ -9004,23 +9756,18 @@ if test "$ac_x_libraries" = no; then
# See if we find them without any special options.
# Don't add to $LIBS permanently.
ac_save_LIBS=$LIBS
- LIBS="-lXt $LIBS"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ LIBS="-lX11 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
int
main ()
{
-XtMalloc (0)
+XrmInitialize ()
;
return 0;
}
@@ -9034,8 +9781,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9059,7 +9805,7 @@ for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
- if test -r $ac_dir/libXt.$ac_extension; then
+ if test -r $ac_dir/libX11.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
@@ -9095,10 +9841,15 @@ else
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
- echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+ # It might be that x_includes is empty (headers are found in the
+ # standard search path. Then output the corresponding message
+ ac_out_x_includes=$x_includes
+ test "x$x_includes" = x && ac_out_x_includes="in standard search path"
+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
fi
+fi
if test "$no_x" = yes; then
# Not all programs may use this symbol, but it does not hurt to define it.
@@ -9122,12 +9873,7 @@ else
echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9151,8 +9897,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9179,12 +9924,7 @@ echo "${ECHO_T}no" >&6
X_LIBS="$X_LIBS -R$x_libraries"
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9208,8 +9948,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9254,12 +9993,7 @@ echo "${ECHO_T}neither works" >&6
# libraries were built with DECnet support. And Karl Berry says
# the Alpha needs dnet_stub (dnet does not exist).
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9290,8 +10024,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9315,11 +10048,6 @@ if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldnet $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9351,8 +10079,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9389,11 +10116,6 @@ if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldnet_stub $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9425,8 +10147,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9474,12 +10195,7 @@ echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
if test "${ac_cv_func_gethostbyname+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9539,8 +10255,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9573,11 +10288,6 @@ if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnsl $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9609,8 +10319,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9647,11 +10356,6 @@ if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbsd $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9683,8 +10387,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9728,12 +10431,7 @@ echo $ECHO_N "checking for connect... $ECHO_C" >&6
if test "${ac_cv_func_connect+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9793,8 +10491,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9827,11 +10524,6 @@ if test "${ac_cv_lib_socket_connect+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9863,8 +10555,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9901,12 +10592,7 @@ echo $ECHO_N "checking for remove... $ECHO_C" >&6
if test "${ac_cv_func_remove+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9966,8 +10652,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10000,11 +10685,6 @@ if test "${ac_cv_lib_posix_remove+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lposix $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10036,8 +10716,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10074,12 +10753,7 @@ echo $ECHO_N "checking for shmat... $ECHO_C" >&6
if test "${ac_cv_func_shmat+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -10139,8 +10813,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10173,11 +10846,6 @@ if test "${ac_cv_lib_ipc_shmat+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lipc $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10209,8 +10877,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10258,11 +10925,6 @@ if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10294,8 +10956,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10328,23 +10989,18 @@ fi
fi
- if test "$no_x" = yes; then
- { { echo "$as_me:$LINENO: error: GTK+ peers requested but no X library available" >&5
+ if test "$no_x" = yes; then
+ { { echo "$as_me:$LINENO: error: GTK+ peers requested but no X library available" >&5
echo "$as_me: error: GTK+ peers requested but no X library available" >&2;}
{ (exit 1); exit 1; }; }
- fi
- echo "$as_me:$LINENO: checking for XTestQueryExtension in -lXtst" >&5
+ fi
+ echo "$as_me:$LINENO: checking for XTestQueryExtension in -lXtst" >&5
echo $ECHO_N "checking for XTestQueryExtension in -lXtst... $ECHO_C" >&6
if test "${ac_cv_lib_Xtst_XTestQueryExtension+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXtst ${X_LIBS} $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10376,8 +11032,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10509,10 +11164,7 @@ echo "$as_me: error: Library requirements (gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gd
fi
-
- fi
-
- if test "x${COMPILE_QT_PEER}" = xyes; then
+ if test "x${enable_gtk_cairo}" = xyes; then
succeeded=no
@@ -10567,32 +11219,32 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- echo "$as_me:$LINENO: checking for QtGui >= 4.0.1" >&5
-echo $ECHO_N "checking for QtGui >= 4.0.1... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for cairo >= 0.5.0" >&5
+echo $ECHO_N "checking for cairo >= 0.5.0... $ECHO_C" >&6
- if $PKG_CONFIG --exists "QtGui >= 4.0.1" ; then
+ if $PKG_CONFIG --exists "cairo >= 0.5.0" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
- echo "$as_me:$LINENO: checking QT_CFLAGS" >&5
-echo $ECHO_N "checking QT_CFLAGS... $ECHO_C" >&6
- QT_CFLAGS=`$PKG_CONFIG --cflags "QtGui >= 4.0.1"`
- echo "$as_me:$LINENO: result: $QT_CFLAGS" >&5
-echo "${ECHO_T}$QT_CFLAGS" >&6
+ echo "$as_me:$LINENO: checking CAIRO_CFLAGS" >&5
+echo $ECHO_N "checking CAIRO_CFLAGS... $ECHO_C" >&6
+ CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 0.5.0"`
+ echo "$as_me:$LINENO: result: $CAIRO_CFLAGS" >&5
+echo "${ECHO_T}$CAIRO_CFLAGS" >&6
- echo "$as_me:$LINENO: checking QT_LIBS" >&5
-echo $ECHO_N "checking QT_LIBS... $ECHO_C" >&6
- QT_LIBS=`$PKG_CONFIG --libs "QtGui >= 4.0.1"`
- echo "$as_me:$LINENO: result: $QT_LIBS" >&5
-echo "${ECHO_T}$QT_LIBS" >&6
+ echo "$as_me:$LINENO: checking CAIRO_LIBS" >&5
+echo $ECHO_N "checking CAIRO_LIBS... $ECHO_C" >&6
+ CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 0.5.0"`
+ echo "$as_me:$LINENO: result: $CAIRO_LIBS" >&5
+echo "${ECHO_T}$CAIRO_LIBS" >&6
else
- QT_CFLAGS=""
- QT_LIBS=""
+ CAIRO_CFLAGS=""
+ CAIRO_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- QT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "QtGui >= 4.0.1"`
- echo $QT_PKG_ERRORS
+ CAIRO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cairo >= 0.5.0"`
+ echo $CAIRO_PKG_ERRORS
fi
@@ -10606,104 +11258,13 @@ echo "${ECHO_T}$QT_LIBS" >&6
if test $succeeded = yes; then
:
else
- { { echo "$as_me:$LINENO: error: Library requirements (QtGui >= 4.0.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (QtGui >= 4.0.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { { echo "$as_me:$LINENO: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
- QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
- EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
- as_ac_File=`echo "ac_cv_file_$QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $QT_INCLUDE_DIR/QWidget" >&5
-echo $ECHO_N "checking for $QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- test "$cross_compiling" = yes &&
- { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-if test -r "$QT_INCLUDE_DIR/QWidget"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
-if test `eval echo '${'$as_ac_File'}'` = yes; then
- { echo "$as_me:$LINENO: No extra QT_INCLUDE_DIR needed" >&5
-echo "$as_me: No extra QT_INCLUDE_DIR needed" >&6;}
-else
- as_ac_File=`echo "ac_cv_file_$EXTRA_QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $EXTRA_QT_INCLUDE_DIR/QWidget" >&5
-echo $ECHO_N "checking for $EXTRA_QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- test "$cross_compiling" = yes &&
- { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-if test -r "$EXTRA_QT_INCLUDE_DIR/QWidget"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
-if test `eval echo '${'$as_ac_File'}'` = yes; then
- QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR"
-else
- { echo "$as_me:$LINENO: WARNING: QWidget not found" >&5
-echo "$as_me: WARNING: QWidget not found" >&2;}
-fi
-
-fi
-
- { echo "$as_me:$LINENO: Set QT_CFLAGS... $QT_CFLAGS" >&5
-echo "$as_me: Set QT_CFLAGS... $QT_CFLAGS" >&6;}
- # Extract the first word of "moc", so it can be a program name with args.
-set dummy moc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_MOC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$MOC"; then
- ac_cv_prog_MOC="$MOC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_MOC="moc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-MOC=$ac_cv_prog_MOC
-if test -n "$MOC"; then
- echo "$as_me:$LINENO: result: $MOC" >&5
-echo "${ECHO_T}$MOC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-
-
- fi
+ fi
- if test "x${enable_gtk_cairo}" = xyes; then
succeeded=no
@@ -10758,32 +11319,32 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- echo "$as_me:$LINENO: checking for cairo >= 0.5.0" >&5
-echo $ECHO_N "checking for cairo >= 0.5.0... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for pangoft2" >&5
+echo $ECHO_N "checking for pangoft2... $ECHO_C" >&6
- if $PKG_CONFIG --exists "cairo >= 0.5.0" ; then
+ if $PKG_CONFIG --exists "pangoft2" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
- echo "$as_me:$LINENO: checking CAIRO_CFLAGS" >&5
-echo $ECHO_N "checking CAIRO_CFLAGS... $ECHO_C" >&6
- CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 0.5.0"`
- echo "$as_me:$LINENO: result: $CAIRO_CFLAGS" >&5
-echo "${ECHO_T}$CAIRO_CFLAGS" >&6
+ echo "$as_me:$LINENO: checking PANGOFT2_CFLAGS" >&5
+echo $ECHO_N "checking PANGOFT2_CFLAGS... $ECHO_C" >&6
+ PANGOFT2_CFLAGS=`$PKG_CONFIG --cflags "pangoft2"`
+ echo "$as_me:$LINENO: result: $PANGOFT2_CFLAGS" >&5
+echo "${ECHO_T}$PANGOFT2_CFLAGS" >&6
- echo "$as_me:$LINENO: checking CAIRO_LIBS" >&5
-echo $ECHO_N "checking CAIRO_LIBS... $ECHO_C" >&6
- CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 0.5.0"`
- echo "$as_me:$LINENO: result: $CAIRO_LIBS" >&5
-echo "${ECHO_T}$CAIRO_LIBS" >&6
+ echo "$as_me:$LINENO: checking PANGOFT2_LIBS" >&5
+echo $ECHO_N "checking PANGOFT2_LIBS... $ECHO_C" >&6
+ PANGOFT2_LIBS=`$PKG_CONFIG --libs "pangoft2"`
+ echo "$as_me:$LINENO: result: $PANGOFT2_LIBS" >&5
+echo "${ECHO_T}$PANGOFT2_LIBS" >&6
else
- CAIRO_CFLAGS=""
- CAIRO_LIBS=""
+ PANGOFT2_CFLAGS=""
+ PANGOFT2_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- CAIRO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cairo >= 0.5.0"`
- echo $CAIRO_PKG_ERRORS
+ PANGOFT2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pangoft2"`
+ echo $PANGOFT2_PKG_ERRORS
fi
@@ -10797,12 +11358,22 @@ echo "${ECHO_T}$CAIRO_LIBS" >&6
if test $succeeded = yes; then
:
else
- { { echo "$as_me:$LINENO: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { { echo "$as_me:$LINENO: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
+
+
+
+
+
+
+ fi
+
+ if test "x${COMPILE_QT_PEER}" = xyes; then
+
succeeded=no
if test -z "$PKG_CONFIG"; then
@@ -10856,32 +11427,32 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- echo "$as_me:$LINENO: checking for pangoft2" >&5
-echo $ECHO_N "checking for pangoft2... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for QtGui >= 4.0.1" >&5
+echo $ECHO_N "checking for QtGui >= 4.0.1... $ECHO_C" >&6
- if $PKG_CONFIG --exists "pangoft2" ; then
+ if $PKG_CONFIG --exists "QtGui >= 4.0.1" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
- echo "$as_me:$LINENO: checking PANGOFT2_CFLAGS" >&5
-echo $ECHO_N "checking PANGOFT2_CFLAGS... $ECHO_C" >&6
- PANGOFT2_CFLAGS=`$PKG_CONFIG --cflags "pangoft2"`
- echo "$as_me:$LINENO: result: $PANGOFT2_CFLAGS" >&5
-echo "${ECHO_T}$PANGOFT2_CFLAGS" >&6
+ echo "$as_me:$LINENO: checking QT_CFLAGS" >&5
+echo $ECHO_N "checking QT_CFLAGS... $ECHO_C" >&6
+ QT_CFLAGS=`$PKG_CONFIG --cflags "QtGui >= 4.0.1"`
+ echo "$as_me:$LINENO: result: $QT_CFLAGS" >&5
+echo "${ECHO_T}$QT_CFLAGS" >&6
- echo "$as_me:$LINENO: checking PANGOFT2_LIBS" >&5
-echo $ECHO_N "checking PANGOFT2_LIBS... $ECHO_C" >&6
- PANGOFT2_LIBS=`$PKG_CONFIG --libs "pangoft2"`
- echo "$as_me:$LINENO: result: $PANGOFT2_LIBS" >&5
-echo "${ECHO_T}$PANGOFT2_LIBS" >&6
+ echo "$as_me:$LINENO: checking QT_LIBS" >&5
+echo $ECHO_N "checking QT_LIBS... $ECHO_C" >&6
+ QT_LIBS=`$PKG_CONFIG --libs "QtGui >= 4.0.1"`
+ echo "$as_me:$LINENO: result: $QT_LIBS" >&5
+echo "${ECHO_T}$QT_LIBS" >&6
else
- PANGOFT2_CFLAGS=""
- PANGOFT2_LIBS=""
+ QT_CFLAGS=""
+ QT_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- PANGOFT2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pangoft2"`
- echo $PANGOFT2_PKG_ERRORS
+ QT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "QtGui >= 4.0.1"`
+
fi
@@ -10893,18 +11464,177 @@ echo "${ECHO_T}$PANGOFT2_LIBS" >&6
fi
if test $succeeded = yes; then
- :
+ HAVE_QT4="yes"
else
- { { echo "$as_me:$LINENO: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ HAVE_QT4="no"
+ fi
+
+ if test "x$HAVE_QT4" = "xyes"; then
+ QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
+ EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+ as_ac_File=`echo "ac_cv_file_$QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $QT_INCLUDE_DIR/QWidget" >&5
+echo $ECHO_N "checking for $QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "$QT_INCLUDE_DIR/QWidget"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ { echo "$as_me:$LINENO: No extra QT_INCLUDE_DIR needed" >&5
+echo "$as_me: No extra QT_INCLUDE_DIR needed" >&6;}
+else
+ as_ac_File=`echo "ac_cv_file_$EXTRA_QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $EXTRA_QT_INCLUDE_DIR/QWidget" >&5
+echo $ECHO_N "checking for $EXTRA_QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
{ (exit 1); exit 1; }; }
+if test -r "$EXTRA_QT_INCLUDE_DIR/QWidget"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR"
+else
+ { echo "$as_me:$LINENO: WARNING: QWidget not found" >&5
+echo "$as_me: WARNING: QWidget not found" >&2;}
+fi
+
+fi
+
+ # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_MOC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$MOC"; then
+ ac_cv_prog_MOC="$MOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MOC="moc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
+done
+done
+
+fi
+fi
+MOC=$ac_cv_prog_MOC
+if test -n "$MOC"; then
+ echo "$as_me:$LINENO: result: $MOC" >&5
+echo "${ECHO_T}$MOC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ fi
+ if test "x$HAVE_QT4" = "xno"; then
+ { echo "$as_me:$LINENO: Looking for QT_CFLAGS and QT_LIBS without pkg-config" >&5
+echo "$as_me: Looking for QT_CFLAGS and QT_LIBS without pkg-config" >&6;}
+ case "$host_os" in
+ darwin*)
+
+# Check whether --with-qt4dir or --without-qt4dir was given.
+if test "${with_qt4dir+set}" = set; then
+ withval="$with_qt4dir"
+ QT4DIR=$withval
+fi;
+ if test x"$QT4DIR" = x ; then
+ { { echo "$as_me:$LINENO: error: *** No path for Qt4 --with-qt4dir option given" >&5
+echo "$as_me: error: *** No path for Qt4 --with-qt4dir option given" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ echo "$as_me:$LINENO: result: QT4DIR... $QT4DIR" >&5
+echo "${ECHO_T}QT4DIR... $QT4DIR" >&6
+ # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_MOC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$MOC"; then
+ ac_cv_prog_MOC="$MOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $QT4DIR/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MOC="$QT4DIR/bin/moc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
+done
+done
+fi
+fi
+MOC=$ac_cv_prog_MOC
+if test -n "$MOC"; then
+ echo "$as_me:$LINENO: result: $MOC" >&5
+echo "${ECHO_T}$MOC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+ if test x"$MOC" = x; then
+ { { echo "$as_me:$LINENO: error: *** This is not the right Qt installation" >&5
+echo "$as_me: error: *** This is not the right Qt installation" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
+ QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
+ QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
+ QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: *** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation." >&5
+echo "$as_me: error: *** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation." >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+ fi
+ { echo "$as_me:$LINENO: Set QT_CFLAGS... $QT_CFLAGS" >&5
+echo "$as_me: Set QT_CFLAGS... $QT_CFLAGS" >&6;}
+ fi
fi
@@ -11347,51 +12077,36 @@ echo "${ECHO_T}no" >&6
fi
fi
-
- if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 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.
- echo "$as_me:$LINENO: checking gcj version" >&5
-echo $ECHO_N "checking gcj version... $ECHO_C" >&6
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^[^0-9]*//' -e 's/[^.0-9][^.0-9]*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
if test "x$GCJ" != x; then
- echo "$as_me:$LINENO: result: $GCJ_VERSION" >&5
-echo "${ECHO_T}$GCJ_VERSION" >&6
+ echo "$as_me:$LINENO: checking gcj version 4.0" >&5
+echo $ECHO_N "checking gcj version 4.0... $ECHO_C" >&6
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+
+_ACEOF
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ echo "$as_me:$LINENO: result: 4.0 or higher found" >&5
+echo "${ECHO_T}4.0 or higher found" >&6
else
- { echo "$as_me:$LINENO: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&5
-echo "$as_me: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&2;}
+ { echo "$as_me:$LINENO: WARNING: 4.0 or higher required" >&5
+echo "$as_me: WARNING: 4.0 or higher required" >&2;}
fi
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
fi
else
@@ -11482,51 +12197,36 @@ echo "${ECHO_T}no" >&6
fi
fi
-
- if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 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.
- echo "$as_me:$LINENO: checking gcj version" >&5
-echo $ECHO_N "checking gcj version... $ECHO_C" >&6
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^[^0-9]*//' -e 's/[^.0-9][^.0-9]*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
if test "x$GCJ" != x; then
- echo "$as_me:$LINENO: result: $GCJ_VERSION" >&5
-echo "${ECHO_T}$GCJ_VERSION" >&6
+ echo "$as_me:$LINENO: checking gcj version 4.0" >&5
+echo $ECHO_N "checking gcj version 4.0... $ECHO_C" >&6
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+
+_ACEOF
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ echo "$as_me:$LINENO: result: 4.0 or higher found" >&5
+echo "${ECHO_T}4.0 or higher found" >&6
else
- { echo "$as_me:$LINENO: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&5
-echo "$as_me: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&2;}
+ { echo "$as_me:$LINENO: WARNING: 4.0 or higher required" >&5
+echo "$as_me: WARNING: 4.0 or higher required" >&2;}
fi
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
fi
fi
@@ -11621,51 +12321,36 @@ echo "${ECHO_T}no" >&6
fi
fi
-
- if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 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.
- echo "$as_me:$LINENO: checking gcj version" >&5
-echo $ECHO_N "checking gcj version... $ECHO_C" >&6
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^[^0-9]*//' -e 's/[^.0-9][^.0-9]*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
if test "x$GCJ" != x; then
- echo "$as_me:$LINENO: result: $GCJ_VERSION" >&5
-echo "${ECHO_T}$GCJ_VERSION" >&6
+ echo "$as_me:$LINENO: checking gcj version 4.0" >&5
+echo $ECHO_N "checking gcj version 4.0... $ECHO_C" >&6
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+
+_ACEOF
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ echo "$as_me:$LINENO: result: 4.0 or higher found" >&5
+echo "${ECHO_T}4.0 or higher found" >&6
else
- { echo "$as_me:$LINENO: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&5
-echo "$as_me: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&2;}
+ { echo "$as_me:$LINENO: WARNING: 4.0 or higher required" >&5
+echo "$as_me: WARNING: 4.0 or higher required" >&2;}
fi
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
fi
@@ -13601,10 +14286,12 @@ echo "$as_me: error: bad value ${enableval} for --enable-portable-native-sync" >
esac
fi;
- ac_config_files="$ac_config_files Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile gnu/classpath/Configuration.java include/Makefile native/Makefile native/fdlibm/Makefile native/jawt/Makefile native/jni/Makefile native/jni/classpath/Makefile native/jni/java-io/Makefile native/jni/java-lang/Makefile native/jni/java-net/Makefile native/jni/java-nio/Makefile native/jni/java-util/Makefile native/jni/gtk-peer/Makefile native/jni/qt-peer/Makefile native/jni/xmlj/Makefile native/target/Makefile native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile scripts/Makefile scripts/classpath.spec lib/Makefile lib/gen-classlist.sh examples/Makefile examples/Makefile.jawt"
+ ac_config_files="$ac_config_files Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile gnu/classpath/Configuration.java include/Makefile native/Makefile native/fdlibm/Makefile native/jawt/Makefile native/jni/Makefile native/jni/classpath/Makefile native/jni/java-io/Makefile native/jni/java-lang/Makefile native/jni/java-net/Makefile native/jni/java-nio/Makefile native/jni/java-util/Makefile native/jni/gtk-peer/Makefile native/jni/qt-peer/Makefile native/jni/xmlj/Makefile native/jni/midi-alsa/Makefile native/jni/midi-dssi/Makefile native/target/Makefile native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile scripts/Makefile scripts/classpath.spec lib/Makefile lib/gen-classlist.sh lib/copy-vmresources.sh examples/Makefile examples/Makefile.jawt"
ac_config_commands="$ac_config_commands gen-classlist"
+ ac_config_commands="$ac_config_commands copy-vmresources"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -13717,6 +14404,34 @@ echo "$as_me: error: conditional \"CREATE_XMLJ_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${CREATE_ALSA_LIBRARIES_TRUE}" && test -z "${CREATE_ALSA_LIBRARIES_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CREATE_ALSA_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CREATE_ALSA_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${CREATE_DSSI_LIBRARIES_TRUE}" && test -z "${CREATE_DSSI_LIBRARIES_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CREATE_DSSI_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CREATE_DSSI_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${CREATE_GTK_PEER_LIBRARIES_TRUE}" && test -z "${CREATE_GTK_PEER_LIBRARIES_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CREATE_GTK_PEER_LIBRARIES\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -13745,20 +14460,6 @@ echo "$as_me: error: conditional \"CREATE_JNI_HEADERS\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -14156,7 +14857,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by GNU Classpath $as_me 0.18, which was
+This file was extended by GNU Classpath $as_me 0.20-pre, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14222,7 +14923,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-GNU Classpath config.status 0.18
+GNU Classpath config.status 0.20-pre
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -14353,6 +15054,8 @@ do
"native/jni/gtk-peer/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/gtk-peer/Makefile" ;;
"native/jni/qt-peer/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/qt-peer/Makefile" ;;
"native/jni/xmlj/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/xmlj/Makefile" ;;
+ "native/jni/midi-alsa/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/midi-alsa/Makefile" ;;
+ "native/jni/midi-dssi/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/midi-dssi/Makefile" ;;
"native/target/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/Makefile" ;;
"native/target/Linux/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/Linux/Makefile" ;;
"native/target/generic/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/generic/Makefile" ;;
@@ -14361,11 +15064,13 @@ do
"scripts/classpath.spec" ) CONFIG_FILES="$CONFIG_FILES scripts/classpath.spec" ;;
"lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"lib/gen-classlist.sh" ) CONFIG_FILES="$CONFIG_FILES lib/gen-classlist.sh" ;;
+ "lib/copy-vmresources.sh" ) CONFIG_FILES="$CONFIG_FILES lib/copy-vmresources.sh" ;;
"examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
"examples/Makefile.jawt" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile.jawt" ;;
"$ac_config_links_1" ) CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"gen-classlist" ) CONFIG_COMMANDS="$CONFIG_COMMANDS gen-classlist" ;;
+ "copy-vmresources" ) CONFIG_COMMANDS="$CONFIG_COMMANDS copy-vmresources" ;;
"include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -14496,16 +15201,6 @@ s,@CREATE_CORE_JNI_LIBRARIES_FALSE@,$CREATE_CORE_JNI_LIBRARIES_FALSE,;t t
s,@default_toolkit@,$default_toolkit,;t t
s,@CREATE_XMLJ_LIBRARY_TRUE@,$CREATE_XMLJ_LIBRARY_TRUE,;t t
s,@CREATE_XMLJ_LIBRARY_FALSE@,$CREATE_XMLJ_LIBRARY_FALSE,;t t
-s,@CREATE_GTK_PEER_LIBRARIES_TRUE@,$CREATE_GTK_PEER_LIBRARIES_TRUE,;t t
-s,@CREATE_GTK_PEER_LIBRARIES_FALSE@,$CREATE_GTK_PEER_LIBRARIES_FALSE,;t t
-s,@GTK_CAIRO_ENABLED@,$GTK_CAIRO_ENABLED,;t t
-s,@GTK_CAIRO_TRUE@,$GTK_CAIRO_TRUE,;t t
-s,@GTK_CAIRO_FALSE@,$GTK_CAIRO_FALSE,;t t
-s,@CREATE_QT_PEER_LIBRARIES_TRUE@,$CREATE_QT_PEER_LIBRARIES_TRUE,;t t
-s,@CREATE_QT_PEER_LIBRARIES_FALSE@,$CREATE_QT_PEER_LIBRARIES_FALSE,;t t
-s,@CREATE_JNI_HEADERS_TRUE@,$CREATE_JNI_HEADERS_TRUE,;t t
-s,@CREATE_JNI_HEADERS_FALSE@,$CREATE_JNI_HEADERS_FALSE,;t t
-s,@LN_S@,$LN_S,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
@@ -14522,10 +15217,27 @@ s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
s,@CCDEPMODE@,$CCDEPMODE,;t t
s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@CREATE_ALSA_LIBRARIES_TRUE@,$CREATE_ALSA_LIBRARIES_TRUE,;t t
+s,@CREATE_ALSA_LIBRARIES_FALSE@,$CREATE_ALSA_LIBRARIES_FALSE,;t t
+s,@CREATE_DSSI_LIBRARIES_TRUE@,$CREATE_DSSI_LIBRARIES_TRUE,;t t
+s,@CREATE_DSSI_LIBRARIES_FALSE@,$CREATE_DSSI_LIBRARIES_FALSE,;t t
+s,@CREATE_GTK_PEER_LIBRARIES_TRUE@,$CREATE_GTK_PEER_LIBRARIES_TRUE,;t t
+s,@CREATE_GTK_PEER_LIBRARIES_FALSE@,$CREATE_GTK_PEER_LIBRARIES_FALSE,;t t
+s,@GTK_CAIRO_ENABLED@,$GTK_CAIRO_ENABLED,;t t
+s,@GTK_CAIRO_TRUE@,$GTK_CAIRO_TRUE,;t t
+s,@GTK_CAIRO_FALSE@,$GTK_CAIRO_FALSE,;t t
+s,@CREATE_QT_PEER_LIBRARIES_TRUE@,$CREATE_QT_PEER_LIBRARIES_TRUE,;t t
+s,@CREATE_QT_PEER_LIBRARIES_FALSE@,$CREATE_QT_PEER_LIBRARIES_FALSE,;t t
+s,@nativelibdir@,$nativelibdir,;t t
+s,@glibjdir@,$glibjdir,;t t
+s,@CREATE_JNI_HEADERS_TRUE@,$CREATE_JNI_HEADERS_TRUE,;t t
+s,@CREATE_JNI_HEADERS_FALSE@,$CREATE_JNI_HEADERS_FALSE,;t t
+s,@LN_S@,$LN_S,;t t
s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@LIBTOOL@,$LIBTOOL,;t t
-s,@CPP@,$CPP,;t t
s,@CXX@,$CXX,;t t
s,@CXXFLAGS@,$CXXFLAGS,;t t
s,@ac_ct_CXX@,$ac_ct_CXX,;t t
@@ -14533,7 +15245,6 @@ s,@CXXDEPMODE@,$CXXDEPMODE,;t t
s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
s,@CXXCPP@,$CXXCPP,;t t
-s,@EGREP@,$EGREP,;t t
s,@LIBICONV@,$LIBICONV,;t t
s,@LTLIBICONV@,$LTLIBICONV,;t t
s,@WARNING_CFLAGS@,$WARNING_CFLAGS,;t t
@@ -14550,13 +15261,13 @@ s,@X_LIBS@,$X_LIBS,;t t
s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
s,@GTK_LIBS@,$GTK_LIBS,;t t
-s,@QT_CFLAGS@,$QT_CFLAGS,;t t
-s,@QT_LIBS@,$QT_LIBS,;t t
-s,@MOC@,$MOC,;t t
s,@CAIRO_CFLAGS@,$CAIRO_CFLAGS,;t t
s,@CAIRO_LIBS@,$CAIRO_LIBS,;t t
s,@PANGOFT2_CFLAGS@,$PANGOFT2_CFLAGS,;t t
s,@PANGOFT2_LIBS@,$PANGOFT2_LIBS,;t t
+s,@QT_CFLAGS@,$QT_CFLAGS,;t t
+s,@QT_LIBS@,$QT_LIBS,;t t
+s,@MOC@,$MOC,;t t
s,@USER_JAVAH@,$USER_JAVAH,;t t
s,@USER_SPECIFIED_JAVAH_TRUE@,$USER_SPECIFIED_JAVAH_TRUE,;t t
s,@USER_SPECIFIED_JAVAH_FALSE@,$USER_SPECIFIED_JAVAH_FALSE,;t t
@@ -14775,11 +15486,6 @@ esac
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -14818,6 +15524,12 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
fi;;
esac
done` || { (exit 1); exit 1; }
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
@@ -15430,6 +16142,7 @@ echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
done
;;
gen-classlist ) chmod 755 lib/gen-classlist.sh ;;
+ copy-vmresources ) chmod 755 lib/copy-vmresources.sh ;;
esac
done
_ACEOF
diff --git a/libjava/classpath/configure.ac b/libjava/classpath/configure.ac
index 8a39cb037db..d13526b5b9b 100644
--- a/libjava/classpath/configure.ac
+++ b/libjava/classpath/configure.ac
@@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
-AC_INIT([GNU Classpath],[0.18],[classpath@gnu.org],[classpath])
+AC_INIT([GNU Classpath],[0.20-pre],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
AC_CANONICAL_TARGET
@@ -65,15 +65,15 @@ AC_ARG_ENABLE([core-jni],
[COMPILE_CORE_JNI=yes])
AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
-dnl -----------------------------------------------------------
-dnl Whether to compile with -Werror or not (enabled by default)
-dnl -----------------------------------------------------------
+dnl ------------------------------------------------------------
+dnl Whether to compile with -Werror or not (disabled by default)
+dnl ------------------------------------------------------------
AC_ARG_ENABLE([Werror],
- [AS_HELP_STRING(--disable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
+ [AS_HELP_STRING(--enable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
[case "${enableval}" in
yes) ENABLE_WERROR=yes ;;
no) ENABLE_WERROR=no ;;
- *) ENABLE_WERROR=yes ;;
+ *) ENABLE_WERROR=no ;;
esac],
[ENABLE_WERROR=no])
@@ -103,6 +103,32 @@ AC_ARG_ENABLE([xmlj],
AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
dnl -----------------------------------------------------------
+dnl ALSA code (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([alsa],
+ [AS_HELP_STRING(--disable-alsa,compile ALSA providers (enable by --enable-alsa) [default=yes])],
+ [case "${enableval}" in
+ yes) COMPILE_ALSA=yes ;;
+ no) COMPILE_ALSA=no ;;
+ *) COMPILE_ALSA=yes ;;
+ esac],
+ [AC_CHECK_HEADERS([alsa/asoundlib.h],COMPILE_ALSA=yes,COMPILE_ALSA=no)])
+AM_CONDITIONAL(CREATE_ALSA_LIBRARIES, test "x${COMPILE_ALSA}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl DSSI code (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([dssi],
+ [AS_HELP_STRING(--disable-dssi,compile DSSI providers (enable by --enable-dssi) [default=yes])],
+ [case "${enableval}" in
+ yes) COMPILE_DSSI=yes ;;
+ no) COMPILE_DSSI=no ;;
+ *) COMPILE_DSSI=yes ;;
+ esac],
+ [AC_CHECK_HEADERS([dssi.h],COMPILE_DSSI=yes,COMPILE_DSSI=no)])
+AM_CONDITIONAL(CREATE_DSSI_LIBRARIES, test "x${COMPILE_DSSI}" = xyes)
+
+dnl -----------------------------------------------------------
dnl GTK native peer (enabled by default)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([gtk-peer],
@@ -150,6 +176,35 @@ AC_ARG_ENABLE([qt-peer],
[COMPILE_QT_PEER=no])
AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Sets the native libraries installation dir
+dnl -----------------------------------------------------------
+AC_ARG_WITH([native-libdir],
+ [AS_HELP_STRING(--with-native-libdir,sets the installation directore for native libraries [default='${libdir}/${PACKAGE}'])],
+ [
+ nativelibdir=${withval}
+ ],
+ [
+ nativelibdir='${libdir}/${PACKAGE}'
+ ])
+
+AC_SUBST(nativelibdir)
+
+dnl -----------------------------------------------------------
+dnl Sets the Java library installation dir.
+dnl -----------------------------------------------------------
+AC_ARG_WITH([glibj-dir],
+ [AS_HELP_STRING(--with-glibj-dir,sets the installation directory for glibj.zip [default='${libdir}/${PACKAGE}'])],
+ [
+ glibjdir=${withval}
+ ],
+ [
+ glibjdir='${datadir}/${PACKAGE}'
+ ])
+
+AC_SUBST(glibjdir)
+
dnl -----------------------------------------------------------
dnl Regenerate headers at build time (disabled by default)
dnl -----------------------------------------------------------
@@ -246,6 +301,7 @@ if test "x${COMPILE_JNI}" = xyes; then
[AC_MSG_RESULT(no)])])])
AC_C_CONST
+ AC_C_ATTRIBUTE
dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
AM_ICONV
@@ -286,45 +342,78 @@ if test "x${COMPILE_JNI}" = xyes; then
dnl Check for AWT related gthread/gtk
if test "x${COMPILE_GTK_PEER}" = xyes; then
- AC_PATH_XTRA
- if test "$no_x" = yes; then
- AC_MSG_ERROR([GTK+ peers requested but no X library available])
- fi
- dnl We explicitly want the XTest Extension for Robot support.
- AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
- [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
- [${X_LIBS}])
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
- AC_SUBST(GTK_CFLAGS)
- AC_SUBST(GTK_LIBS)
+ AC_PATH_XTRA
+ if test "$no_x" = yes; then
+ AC_MSG_ERROR([GTK+ peers requested but no X library available])
+ fi
+ dnl We explicitly want the XTest Extension for Robot support.
+ AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
+ [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
+ [${X_LIBS}])
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
+
+ if test "x${enable_gtk_cairo}" = xyes; then
+ PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
+ fi
+
+ PKG_CHECK_MODULES(PANGOFT2, pangoft2)
+
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ AC_SUBST(CAIRO_LIBS)
+ AC_SUBST(CAIRO_CFLAGS)
+ AC_SUBST(PANGOFT2_LIBS)
+ AC_SUBST(PANGOFT2_CFLAGS)
fi
dnl Check for AWT related Qt4
if test "x${COMPILE_QT_PEER}" = xyes; then
- PKG_CHECK_MODULES(QT, QtGui >= 4.0.1)
- dnl Check needed because in some cases the QtGui includedir
- dnl doesn't contain the subsystem dir.
- QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
- EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
- AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
- AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
- AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
- QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
- AC_MSG_WARN([QWidget not found])))
+ PKG_CHECK_MODULES(QT, QtGui >= 4.0.1, HAVE_QT4="yes", HAVE_QT4="no")
+ if test "x$HAVE_QT4" = "xyes"; then
+ dnl Check needed because in some cases the QtGui includedir
+ dnl doesn't contain the subsystem dir.
+ QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
+ EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+ AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
+ AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
+ AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
+ QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
+ AC_MSG_WARN([QWidget not found])))
+ AC_CHECK_PROG(MOC, [moc], [moc])
+ fi
+ if test "x$HAVE_QT4" = "xno"; then
+ AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
+ case "$host_os" in
+ darwin*)
+ AC_ARG_WITH([qt4dir],
+ [AS_HELP_STRING([--with-qt4dir=DIR],
+ [Qt4 installation directory used for OS-X.
+ For other systems use pkg-config.])],
+ [QT4DIR=$withval]
+ )
+ if test x"$QT4DIR" = x ; then
+ AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
+ fi
+ AC_MSG_RESULT([QT4DIR... $QT4DIR])
+ AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
+ if test x"$MOC" = x; then
+ AC_MSG_ERROR([*** This is not the right Qt installation])
+ fi
+ QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
+ QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
+ QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
+ QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
+ ;;
+ *)
+ AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation.])
+ ;;
+ esac
+ fi
AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
- AC_CHECK_PROG(MOC, [moc], [moc])
AC_SUBST(QT_CFLAGS)
AC_SUBST(QT_LIBS)
fi
-
- if test "x${enable_gtk_cairo}" = xyes; then
- PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
- PKG_CHECK_MODULES(PANGOFT2, pangoft2)
- fi
- AC_SUBST(CAIRO_LIBS)
- AC_SUBST(CAIRO_CFLAGS)
- AC_SUBST(PANGOFT2_LIBS)
- AC_SUBST(PANGOFT2_CFLAGS)
fi
CLASSPATH_WITH_JAVAH
@@ -493,6 +582,8 @@ native/jni/java-util/Makefile
native/jni/gtk-peer/Makefile
native/jni/qt-peer/Makefile
native/jni/xmlj/Makefile
+native/jni/midi-alsa/Makefile
+native/jni/midi-dssi/Makefile
native/target/Makefile
native/target/Linux/Makefile
native/target/generic/Makefile
@@ -501,7 +592,9 @@ scripts/Makefile
scripts/classpath.spec
lib/Makefile
lib/gen-classlist.sh
+lib/copy-vmresources.sh
examples/Makefile
examples/Makefile.jawt])
AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
+AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
AC_OUTPUT
diff --git a/libjava/classpath/doc/Makefile.in b/libjava/classpath/doc/Makefile.in
index fe23b3a65e4..34bdbb19c16 100644
--- a/libjava/classpath/doc/Makefile.in
+++ b/libjava/classpath/doc/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in texinfo.tex
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -84,10 +82,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -224,6 +226,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -237,6 +240,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/doc/api/Makefile.in b/libjava/classpath/doc/api/Makefile.in
index c0b6e87312d..dafdd41f5b5 100644
--- a/libjava/classpath/doc/api/Makefile.in
+++ b/libjava/classpath/doc/api/Makefile.in
@@ -40,10 +40,8 @@ target_triplet = @target@
subdir = doc/api
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -77,10 +75,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -217,6 +219,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -230,6 +233,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/doc/www.gnu.org/announce/20050906.wml b/libjava/classpath/doc/www.gnu.org/announce/20050906.wml
new file mode 100644
index 00000000000..2f95d58b3b9
--- /dev/null
+++ b/libjava/classpath/doc/www.gnu.org/announce/20050906.wml
@@ -0,0 +1,221 @@
+#!wml --include=..
+
+#use wml::std::page
+#use wml::std::lang
+#use wml::fmt::isolatin
+#use wml::std::case global=upper
+
+<lang:star:slice:>
+
+<set-var last-modified-author="mjw">
+
+#include <include/macros.wml>
+
+<header title="GNU Classpath 0.18 Announcement (2005-09-06)">
+<pre>
+GNU Classpath 0.18 released.
+
+We are pleased to announce a new developer snapshot of GNU Classpath.
+
+GNU Classpath, essential libraries for java, is a project to create free
+core class libraries for use with runtimes, compilers and tools for the
+java programming language.
+
+The GNU Classpath developer snapshot releases are not directly aimed
+at the end user but are meant to be integrated into larger development
+platforms. For example the GCC (gcj) and Kaffe projects will use the
+developer snapshots as a base for future versions.
+
+This is our first release after "The Big Merge" with GCC/GCJ. GNU
+Classpath can now be used as a subdirectory of libgcj inside the GCC
+tree so it will be much easier to keep GCC up-to-date with the latest
+GNU Classpath developer release snapshots.
+
+Some highlights of changes in this release (more extensive list below):
+
+ Added GNU JAWT for awt native interface support. Datatransfer
+ clipboard updated to 1.5 including support for copy/paste of
+ serialized objects, images and files. Completed the org.omg
+ PortableInterceptor, DynamicAny and Portable Object Adapter
+ packages. Multi plaf support for Free Swing. Editing support for
+ JTree and JTable. Lots of icons and look and feel improvements for
+ Free Swing basic and metal themes. NIO FileChannel.map implemented
+ and DirectByteBuffer put method speedups. Image loading speedups for
+ awt. Support for darwin and solaris out of the box.
+
+29 people actively contributed to this release and made 535 CVS
+commits during the two months of development. diffstat since 0.17:
+ 994 files changed, 114744 insertions(+), 13663 deletions(-)
+
+More details about the various changes and contributions below.
+
+A full list of bug reports fixed for this release can be found at:
+http://gcc.gnu.org/bugzilla/buglist.cgi?product=classpath&target_milestone=0.18
+
+This release depends on gtk+ 2.4 for AWT support. But gtk+ 2.6 or
+higher is recommended. Included, but not activated by default in this
+release is a Graphics2D implementation based on the Cairo Graphics
+framework (http://www.cairographics.org). Enabling this makes programs
+like JFreeChart and JEdit start up on GNU Classpath based runtimes.
+To enable this support install the cairo 0.5.x snapshot, configure GNU
+Classpath with --enable-gtk-cairo.
+
+One of the major focuses of the GNU Classpath project is expanding
+and using the Mauve test suite for Compatibility, Completeness and
+Correctness checking. Various groups around GNU Classpath collaborate
+on the free software Mauve test suite which contains 32.000+ core
+library tests. Mauve has various modules for testing core class
+library implementations, byte code verifiers, source to byte code and
+native code compiler tests. Mauve also contains the Wonka visual test
+suite and the Jacks Compiler Killer Suite.
+See for more information: http://www.sourceware.org/mauve/
+This release passes 31194 out of 32253 Mauve core library tests.
+
+Conformance reports for the included jaxp support can be found in the
+doc/README.jaxp file.
+
+GNU Classpath 0.18 can be downloaded from
+ftp://ftp.gnu.org/pub/gnu/classpath/
+or one of the ftp.gnu.org mirrors
+http://www.gnu.org/order/ftp.html
+
+File: classpath-0.18.tar.gz
+MD5sum: c0650c257aa93eafb709553f172f0bbb
+SHA1sum: 28061c750244cac4ff0151da6aba183b94b98b25
+
+The GNU Classpath developers site http://developer.classpath.org/
+provides detailed information on how to start with helping the GNU
+Classpath project and gives an overview of the core class library
+packages currently provided. For each snapshot release generated
+documentation is provided through the GNU Classpath Tools gjdoc
+project. A documentation generation framework for java source
+files used by the GNU project. Full documentation on the currently
+implementated packages and classes can be found at:
+http://developer.classpath.org/doc/
+
+New in release 0.18 (Sep 6, 2005)
+(See the ChangeLog file for a full list of changes.)
+
+* GNU JAWT implementation, the AWT Native Interface, which allows
+ direct access to native screen resources from within a Canvas's
+ paint method. GNU Classpath Examples comes with a Demo, see
+ examples/README.
+* awt.datatransfer updated to 1.5 with supports for FlavorEvents.
+ The gtk+ awt peers now allow copy/paste of text, images, uris/files
+ and serialized objects with other applications and tracking
+ clipboard change events with gtk+ 2.6 (for gtk+ 2.4 only text and
+ serialized objects are supported). A GNU Classpath Examples
+ datatransfer Demo was added to show the new functionality.
+* org.omg.PortableInterceptor and related functionality in other
+ packages is now implemented:
+ - The sever and client interceptors work as required since 1.4.
+ - The IOR interceptor works as needed for 1.5.
+* The org.omg.DynamicAny package is completed and passes the prepared
+ tests.
+* The Portable Object Adapter should now support the output of the
+ recent IDL to java compilers. These compilers now generate servants and
+ not CORBA objects as before, making the output depended on the existing
+ POA implementation. Completing POA means that such code can already be
+ tried to run on Classpath. Our POA is tested for the following usager
+ scenarios:
+ - POA converts servant to the CORBA object.
+ - Servant provides to the CORBA object.
+ - POA activates new CORBA object with the given Object Id
+ (byte array) that is later accessible for the servant.
+ - During the first call, the ServantActivator provides servant for
+ this and all subsequent calls on the current object.
+ - During each call, the ServantLocator provides servant for this call
+ only.
+ - ServantLocator or ServantActivator forwards call to another server.
+ - POA has a single servant, responsible for all objects.
+ - POA has a default servant, but some objects are explicitly
+ connected to they specific servants.
+ The POA is verified using tests from the former cost.omg.org.
+* The javax.swing.plaf.multi.* package is now implemented.
+* Editing and several key actions for JTree and JTable were implemented.
+* Lots of icons and look and feel improvements for Free Swing basic
+ and metal themes were added. Try running the GNU Classpath Swing
+ Demo in examples (gnu.classpath.examples.swing.Demo) with:
+ -Dswing.defaultlaf=javax.swing.plaf.basic.BasicLookAndFeel
+ -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel
+* Start of styled text capabilites for java.swing.text.
+* NIO FileChannel.map implementation, fast bulk put implementation for
+ DirectByteBuffer (speeds up this method 10x).
+* Split gtk+ awt peers event handling in two threads and improve gdk
+ lock handling (solves several AWT lock ups).
+* Speed up awt Image loading.
+* Updated TimeZone data against Olson tzdata2005l.
+* Make zip and jar UTF-8 "clean".
+* "native" code builds and compiles (warning free) on Darwin and
+ Solaris.
+
+Runtime interface changes:
+
+* All native resource "pointers" in the VM interface classes are now
+ exposed as gnu.classpath.Pointer objects. This might impact runtimes
+ that optimize and support java.nio.DirectByteBuffers. Creating these
+ classes and accessing the contents as void * pointers for the native
+ reference JNI implementation is done through the
+ JCL_NewRawDataObject and JCL_GetRawData functions.
+* Simplified the Class/VMClass interface.
+* Removed loadedClasses map from ClassLoader. It's now the VMs
+ responsibility to manage the list of defined and loaded classes for
+ each class loader.
+* Moved native methods from java.lang.reflect.Proxy to VMProxy.
+* Added hook to VMClassLoader to allow VM to do class caching.
+
+New Untested/Disabled Features:
+
+ The following new features are included, but not ready for
+ production yet. They are explicitly disabled and not supported. But
+ if you want to help with the development of these new features we
+ are interested in feedback. You will have to explicitly enable them
+ to try them out (and they will most likely contain bugs). If you are
+ interested in any of these then please join the mailing-list and
+ follow development in CVS.
+
+* QT4 AWT peers, enable by giving configure --enable-qt-peer.
+* JDWP framework, enable by deleting the jdwp references from
+ lib/standard.omit and vm/reference/standard.omit. No default
+ implementation is provided. Work is being done on gcj/gij
+ integration.
+* StAX java.xml.stream, enable by deleting the gnu.xml.stream and
+ java.xml.stream references in lib/standard.omit.
+
+The following people helped with this release:
+
+Aaron Luchko (Lots of JDWP work)
+Andreas Tobler (Darwin and Solaris testing and fixing
+Andrew Haley (gcj build speedups)
+Anthony Balkissoon (Lots of Free Swing work including JTable editing)
+Archie Cobbs (Build fixes)
+Audrius Meskauskas (Lots of omg corba work plus testing and documenting)
+Bastiaan Huisman (TimeZone bug fixing)
+Casey Marshall (NIO FileChannel.map support, security and policy updates)
+Chris Burdess (StAX work and gnu xml fixes)
+Christian Schlichtherle (Zip fixes and cleanups)
+Christian Thalinger (64-bit cleanups)
+Dalibor Topic (Qt4 build infrastructure)
+David Gilbert (Basic and Metal icon and plaf and lots of documenting)
+Guilhem Lavaux (JCL native Pointer updates)
+Ingo Proetel (Image, Logger and URLClassLoader updates)
+Ito Kazumitsu (NetworkInterfaces implementation and updates)
+Jan Roehrich (BasicTreeUI updates)
+Jeroen Frijters (VMProxy and VMClassLoader updates, RMIClassLoader fixes)
+Keith Seitz (Lots of JDWP work)
+Kelley Cook (Build fixes)
+Lillian Angel (Lots of Free Swing work including JTree editing)
+Mark Wielaard (Clipboard implementation, build and release infrastructure)
+Rainer Orth (Build fixes)
+Robert Schuster (Documentation updates and beans fixes)
+Roman Kennke (Lots of Free Swing work including styled text)
+Sven de Marothy (Qt4 peers)
+Thomas Fitzsimmons (Lots of gtk+ awt peer work)
+Tom Tromey (Lots of fixes including coordinating The Big Merge)
+Wolfgang Baer (GapContent bug fixes)
+
+We would also like to thank the numerous bug reporters and testers!
+
+</pre>
+
+<footer>
diff --git a/libjava/classpath/doc/www.gnu.org/announce/20051102.wml b/libjava/classpath/doc/www.gnu.org/announce/20051102.wml
new file mode 100644
index 00000000000..e39a4eaa5c5
--- /dev/null
+++ b/libjava/classpath/doc/www.gnu.org/announce/20051102.wml
@@ -0,0 +1,247 @@
+#!wml --include=..
+
+#use wml::std::page
+#use wml::std::lang
+#use wml::fmt::isolatin
+#use wml::std::case global=upper
+
+<lang:star:slice:>
+
+<set-var last-modified-author="mjw">
+
+#include <include/macros.wml>
+
+<header title="GNU Classpath 0.19 Announcement (2005-11-02)">
+<pre>
+GNU Classpath "95% and counting" 0.19 released
+
+GNU Classpath, essential libraries for java, is a project to create
+free core class libraries for use with runtimes, compilers and tools
+for the java programming language.
+
+The GNU Classpath developer snapshot releases are not directly aimed
+at the end user but are meant to be integrated into larger development
+platforms. For example the GCC (gcj) and Kaffe projects will use the
+developer snapshots as a base for future versions.
+
+Some highlights of changes in this release (more extensive list below):
+
+ Much more efficient painting for large Free Swing GUIs. Improved
+ accessibility support. HttpURLConnection rewrite. Official CORBA
+ VMCID assigned. Start of RMI over IIOP support. Qt4 support for
+ OS-X. Much improved Free Swing Metal theme. Free Swing Demo includes
+ theme switcher example (Metal, Ocean, GNU). JBoss now starts up and
+ Jonas testsuite passes for 95%. Support for the javax.sound.midi
+ framework and experimental DSSI and ALSA service providers. Early
+ version of the popular StAX API. Now has 96% coverage of 1.4 API.
+
+This is the first time we also have a pre-release of our 1.5 generics
+work. classpath-0.19-generics contains a version of the core library
+that uses the new 1.5 language features such as generics and
+enumerations. ECJ and JamVM are known to support the generics release
+out of the box. And you should be able to run Eclipse 3.1 with it to
+develop programs that use the new 1.5 language and core library
+additions. classpath-generics is a work in progress and not as
+extensively tested as our regular releases. But please try it out if
+you want to help us test the new 1.5 support of the core libraries.
+
+For this release we setup a Free Swing Test Application page
+http://developer.classpath.org/mediation/FreeSwingTestApps
+Please see that page for showcases of applications that work with this
+release and to help test other applications.
+
+It is also the first release that has GNU Classpath promotion banners.
+http://developer.classpath.org/mediation/ClasspathBanners
+Please feel free to add them to your project pages if your project is
+known to work with GNU Classpath or just to promote the project.
+
+32 people actively contributed to this release and made
+787 CVS commits during the last two months of development
+(excluding the generics branch work). diffstat since 0.18:
+ 1158 files changed, 93916 insertions(+), 36407 deletions(-)
+
+More details about the various changes and contributions below.
+
+A full list of bug reports fixed for this release can be found at:
+http://gcc.gnu.org/bugzilla/buglist.cgi?product=classpath&target_milestone=0.19
+
+This release depends on gtk+ 2.4 for AWT support. But gtk+ 2.6 or
+higher is recommended. Included, but not activated by default in this
+release is a Graphics2D implementation based on the Cairo Graphics
+framework (http://www.cairographics.org). Enabling this makes programs
+like JFreeChart and JEdit start up on GNU Classpath based runtimes.
+To enable this support install the cairo 0.5.x snapshot, configure GNU
+Classpath with --enable-gtk-cairo.
+
+One of the major focuses of the GNU Classpath project is expanding and
+using the Mauve test suite for Compatibility, Completeness and
+Correctness checking. Various groups around GNU Classpath collaborate
+on the free software Mauve test suite which contains around 34.000
+core library tests. Mauve has various modules for testing core class
+library implementations, byte code verifiers, source to byte code and
+native code compiler tests. Mauve also contains the Wonka visual test
+suite and the Jacks Compiler Killer Suite.
+See for more information: http://www.sourceware.org/mauve/
+This release passes 33.381 out of 34.262 Mauve core library tests.
+
+Conformance reports for the included jaxp support can be found in the
+doc/README.jaxp file.
+
+GNU Classpath 0.19 can be downloaded from
+ftp://ftp.gnu.org/pub/gnu/classpath/
+or one of the ftp.gnu.org mirrors
+http://www.gnu.org/order/ftp.html
+
+File: classpath-0.19.tar.gz
+MD5sum: 0b93b1c1dd3d33ef7fb6a47dbb29e41d
+SHA1sum: 43d499e8b83e04a7fc4a1d4d301638c5cec6c679
+
+File: classpath-0.19-generics.tar.gz (EXPERIMENTAL)
+MD5sum: 4c0ccc91a147af4010d19f48dbf441b3
+SHA1sum: b2a2b968523b3af35cd7e44bcc4f940621b3ca66
+
+The GNU Classpath developers site http://developer.classpath.org/
+provides detailed information on how to start with helping the GNU
+Classpath project and gives an overview of the core class library
+packages currently provided. For each snapshot release generated
+documentation is provided through the GNU Classpath Tools gjdoc
+project. A documentation generation framework for java source
+files used by the GNU project. Full documentation on the currently
+implementated packages and classes can be found at:
+http://developer.classpath.org/doc/
+
+New in release 0.19 (Nov 2, 2005)
+(See the ChangeLog file for a full list of changes.)
+
+* The Swing RepaintManager has been reworked for more efficient
+ painting, especially for large GUIs.
+
+* The Swing layout manager OverlayLayout has been implemented, the
+ BoxLayout has been rewritten to make use of the SizeRequirements
+ utility class and caching for more efficient layout.
+
+* Improved accessibility support for Swing.
+
+* The java.net.HttpURLConnection implementation no longer buffers the
+ entire response body in memory. This means that response bodies
+ larger than available memory can now be handled.
+
+* The Andrew Watson, Vice President and Technical Director of the
+ Object Management Group, has officially assigned us 20 bit Vendor
+ Minor Code Id: 0x47430 ("GC") that will mark remote Classpath -
+ specific system exceptions. Obtaining the VMCID means that GNU
+ Classpath now is a recogniseable type of node in a highly
+ interoperable CORBA world.
+
+* Classpath now includes the first working draft to support the RMI
+ over IIOP protocol. The current implementation is capable for remote
+ invocations, transferring various Serializables and Externalizables
+ via RMI-IIOP protocol. It can flatten graphs and, at least for the
+ simple cases, is interoperable with Sun's jdk 1.5.
+
+* Qt4 configury switches for OS-X. Additional to the --enable-qt-peer,
+ OS-X users with a Qt4 installation can build the qt-peers with the
+ argument --with-qt4dir=<Qt4-installation-dir>.
+
+* Significant progress has been made in the implementation of the
+ javax.swing.plaf.metal.* package, with most UI delegates in a
+ working state now. Please test this with your own applications and
+ provide feedback that will help us to improve this package.
+
+* The GUI demo (gnu.classpath.examples.swing.Demo) has been extended
+ to highlight various features in our free-swing implementation. And
+ includes a look and feel switcher (Metal default, Ocean or GNU).
+
+Runtime interface changes:
+
+* Changed implementation of VMClassLoader.getPackage(s) : new method
+ VMClassLoader.getBootPackages should be implemented by the vm, and
+ sould return a string array of boot package names ("java.lang",
+ "java.net", ...). Feedback from vm implementors for usability and
+ relevance of the getBootPackages method would be greatly
+ appreciated.
+
+New Untested/Disabled Features:
+
+ The following new features are included, but not ready for
+ production yet. They are explicitly disabled and not supported. But
+ if you want to help with the development of these new features we
+ are interested in feedback. You will have to explicitly enable them
+ to try them out (and they will most likely contain bugs). If you are
+ interested in any of these then please join the mailing-list and
+ follow development in CVS.
+
+* Cairo Gtk+ Graphics2D support, enabled by giving configure
+ --enable-gtk-cairo.
+* QT4 AWT peers, enable by giving configure --enable-qt-peer.
+
+The following people helped with this release:
+
+Andreas Tobler
+ Qt4 support for Darwin/OSX, Graphics2D support, gtk+ updates.
+Andrew Haley
+ Serialization and URLClassLoader fixes.
+Andrew John Hughes
+ Serialization fixes, Properties XML support and generic branch work.
+Anthony Balkissoon
+ Lots of Free Swing additions.
+Anthony Green
+ MIDI framework, ALSA and DSSI providers.
+Audrius Meskauskas
+ Lots of new CORBA and RMI work and bugfixes.
+Casey Marshall
+ Crypto algorithm fixes.
+Chris Burdess
+ StAX and dom xml:id support.
+Christian Thalinger
+ Configuration and VM inteface fixes and CACAO integration.
+Dalibor Topic
+ Build cleanups and Kaffe integration.
+David Daney
+ HttpURLConnection rewrite and improvements.
+David Gilbert
+ Lots of Free Swing and metal theme additions.
+David Lichteblau
+ JCL support library global/local reference cleanups.
+Gael Thomas
+ VMClassLoader boot packages support sugestions.
+Guilhem Lavaux
+ Configuration, thread and channel fixes and Kaffe integration.
+Jan Roehrich
+ BasicTreeUI fixes.
+Jeroen Frijters
+ Serialization fixes, better Proxy support, bug fixes and IKVM integration.
+Julian Scheid
+ Documentation updates and gjdoc support.
+Keith Seitz
+ JDWP support.
+Lillian Angel
+ Lots of Free Swing additions.
+Mark Wielaard
+ Bug fixes, packaging and release management
+Martin Cordova
+ Suggestions for better SocketTimeoutException.
+Michael Koch
+ Configuration fixes.
+Nicolas Geoffray
+ VMClassLoader and AccessController improvements.
+Paul Jenner
+ Better -Werror support.
+Robert Schuster
+ XML and URL, AWT and Free Swing bug fixes
+Roman Kennke
+ Lots of Free Swing additions.
+Santiago Gala
+ AccessControlContext fixes.
+Stuart Ballard
+ RMI constant fixes.
+Sven de Marothy
+ BMP imageio support, CSS and TextLayout fixes.
+Thomas Fitzsimmons
+ Lots of imageio framework additions, lots of AWT and Free Swing bug fixes.
+Tom Tromey
+ Eclipse integration, generics work, lots of bug fixes and gcj integration.
+
+We would also like to thank the numerous bug reporters and testers!
+</pre>
+<footer>
diff --git a/libjava/classpath/doc/www.gnu.org/corba.wml b/libjava/classpath/doc/www.gnu.org/corba.wml
new file mode 100644
index 00000000000..cb9d7c58d8d
--- /dev/null
+++ b/libjava/classpath/doc/www.gnu.org/corba.wml
@@ -0,0 +1,37 @@
+#include "include/layout.wml"
+
+<subject "GNU Classpath CORBA interoperability page">
+
+<box>
+
+<boxtitle>GNU Classpath::Object management group</boxtitle>
+<boxitem>
+This page is referenced from the official
+<a href="http://doc.omg.org/vendor-tags">OMG Vendor tag list</a>,
+maintained by the <a href = "http://www.corba.org/">OMG</a>.
+It is is designed to help programmers debugging interoperation
+with our ORB.
+</boxitem>
+
+<boxtitle>GNU Classpath::CORBA interoperability</boxtitle>
+<boxitem>
+<ol>
+<li><a href="http://developer.classpath.org/mediation/CorbaInteroperability">
+Interoperability information (system exception minor codes, etc).</a></li>
+<li><a href="http://developer.classpath.org/doc/">GNU Classpath API Specification</a></li>
+<li><a href="bugs.html">Bug database.</a></li>
+<li>GNU Classpath CORBA vs:
+<a href="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk12-classpath.html">JDK 1.2</a>
+<a href="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk13-classpath.html">JDK 1.3</a>
+<a href="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk14-classpath.html">JDK 1.4</a>
+ (updated nightly)</li>
+<li><a href="http://www.gnu.org/software/classpath/classpath.html">Project home page</a></li>
+</ol>
+Registered information
+<ul>
+<li>GNU Classpath Vendor Minor Code Id (VMCID) is 0x47430xxx
+("GC\x00\x00" - "GC\x0f\xff").</li>
+</ul>
+</boxitem>
+
+</box>
diff --git a/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml b/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml
index 902544fbe32..a5139fbd5b6 100755
--- a/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml
+++ b/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml
@@ -35,6 +35,15 @@ page describing them in more detail:
</box>
<box>
+<boxtitle><a name="Development">GNU Classpath::Tools::Downloads</a></boxtitle>
+<boxitem>
+At the moment there are only official releases of gjdoc on
+<createlink url="ftp://ftp.gnu.org/gnu/classpath/" name="ftp.gnu.org"/>.
+All other tools are available from CVS from the savannah project page below.
+</boxitem>
+</box>
+
+<box>
<boxtitle><a name="Development">GNU Classpath::Tools::Development</a></boxtitle>
<boxitem>
GNU Classpath Tools is part of the GNU Classpath project which is hosted at
diff --git a/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml b/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml
index 48bbe5ea270..96018f60331 100644
--- a/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml
+++ b/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml
@@ -77,10 +77,10 @@ sub mylink {
<download-block>
<download
- date="15 July 2005"
- version="0.17"
- url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.17.tar.gz"
- notes="http://www.gnu.org/software/classpath/announce/20050715.html"
+ date="02 November 2005"
+ version="0.19"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.19.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20051102.html"
>
<!-- download
@@ -100,6 +100,18 @@ sub mylink {
<download-block>
<download
+ date="06 September 2005"
+ version="0.18"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.18.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20050906.html"
+>
+<download
+ date="15 July 2005"
+ version="0.17"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.17.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20050715.html"
+>
+<download
date="30 June 2005"
version="0.16"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.16.tar.gz"
diff --git a/libjava/classpath/doc/www.gnu.org/home.wml b/libjava/classpath/doc/www.gnu.org/home.wml
index 1d59593b8f4..ff512f22a9d 100644
--- a/libjava/classpath/doc/www.gnu.org/home.wml
+++ b/libjava/classpath/doc/www.gnu.org/home.wml
@@ -36,7 +36,7 @@ obtained by looking at these resources.
<ul>
<li><createlink url="tasks.html" name="Task descriptions"></li>
<li>GNU Classpath vs: <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk10-classpath.html" name="JDK 1.0"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk11-classpath.html" name="JDK 1.1"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk12-classpath.html" name="JDK 1.2"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk13-classpath.html" name="JDK 1.3"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk14-classpath.html" name="JDK 1.4"> (updated nightly)</li>
- <li>GNU Classpath <createlink url="http://ontographics.com/classpath/mauve/mauvereport.cgi" name="Mauve Results"></li>
+ <li>GNU Classpath <createlink url="http://www.object-refinery.com/classpath/mauve/report/" name="Mauve Results"></li>
</ul>
</p>
</boxitem>
diff --git a/libjava/classpath/doc/www.gnu.org/include/layout.wml b/libjava/classpath/doc/www.gnu.org/include/layout.wml
index a82849205cb..485b9860146 100644
--- a/libjava/classpath/doc/www.gnu.org/include/layout.wml
+++ b/libjava/classpath/doc/www.gnu.org/include/layout.wml
@@ -116,7 +116,7 @@
<menuitem><createlink name="CVS" url="http://savannah.gnu.org/cvs/?group=classpath"></menuitem>
<menutitle>Development</menutitle>
-<menuitem><createlink name="Tasks" url="tasks.html"></menuitem>
+<menuitem><createlink name="Tasks" url="http://developer.classpath.org/mediation/ClasspathOpenTasks"></menuitem>
<menuitem><createlink name="Docs" url="docs/docs.html"></menuitem>
<menuitem><createlink name="Testing" url="benchmarks.html#testing"></menuitem>
<menuitem><createlink name="Benchmarks" url="benchmarks.html#benchmarks"></menuitem>
diff --git a/libjava/classpath/doc/www.gnu.org/newsitems.txt b/libjava/classpath/doc/www.gnu.org/newsitems.txt
index b4976dffc43..dbfcfd2ced9 100644
--- a/libjava/classpath/doc/www.gnu.org/newsitems.txt
+++ b/libjava/classpath/doc/www.gnu.org/newsitems.txt
@@ -1,3 +1,13 @@
+<newsitem date="02 Nov 2005">
+<createlink name="GNU Classpath 0.19"
+ url="announce/20051102.html">
+</newsitem>
+
+<newsitem date="06 Sep 2005">
+<createlink name="GNU Classpath 0.18"
+ url="announce/20050906.html">
+</newsitem>
+
<newsitem date="03 Aug 2005">
<createlink name="Generics Branch Merge Announcement"
url="http://lists.gnu.org/archive/html/classpath/2005-08/msg00002.html">
diff --git a/libjava/classpath/doc/www.gnu.org/tasks.wml b/libjava/classpath/doc/www.gnu.org/tasks.wml
index 00959bd9a48..34e36512f3d 100755
--- a/libjava/classpath/doc/www.gnu.org/tasks.wml
+++ b/libjava/classpath/doc/www.gnu.org/tasks.wml
@@ -1,326 +1,14 @@
-#include "include/layout.wml"
+<html>
+<head>
+<title>GNU Classpath Tasklist - GNU Project - Free Software Foundation (FSF)</title>
+<META HTTP-EQUIV="Refresh"
+ CONTENT="0; URL=http://developer.classpath.org/mediation/ClasspathOpenTasks">
+</head>
+<body>
+This page has moved. If your browser doesn't automatically redirect to
+its new location, click
+<a href="http://developer.classpath.org/mediation/ClasspathOpenTasks">
+http://developer.classpath.org/mediation/ClasspathOpenTasks</a>.
+</body>
+</html>
-##
-#
-# Special Tags
-#
-
-# <task
-# title="task title"
-# contact="contact person"
-# skills="..."
-# estimation="..."
-# >
-# ... task description ...
-# </task>
-
-
-
-# the task counter
-#
-<set-var __TASKSEQCNT=1>
-
-<define-tag task-section endtag=required>
- <preserve name>
- <set-var %attributes>
-{#TASKINDEX#:
- <boxitem>
- <!---boxtitle--->
- <strong><get-var __TASKSEQCNT>. <get-var name></strong> <br>
- <!---/boxtitle--->
-:#TASKINDEX#}
- <boxtitle><get-var __TASKSEQCNT>. <get-var name></boxtitle>
- <set-var __TASKCNT=1>
- %body
-{#TASKINDEX#:
- </boxitem>
- <br>
-:#TASKINDEX#}
- <increment __TASKSEQCNT>
- <restore name>
-</define-tag>
-
-<define-tag task endtag=required>
-<preserve title>
-<preserve contact>
-<preserve skills>
-<preserve estimation>
-<set-var %attributes>
-{#TASKINDEX#:
- <!---strong--><a href="tasks.html#task<get-var __TASKSEQCNT>_<get-var __TASKCNT>"><get-var __TASKSEQCNT>.<get-var __TASKCNT> <get-var title></a><!---/strong--> (<get-var estimation>)<br>
-:#TASKINDEX#}
- <boxitem>
- <h3><a name="task<get-var __TASKSEQCNT>_<get-var __TASKCNT>"><get-var __TASKSEQCNT>.<get-var __TASKCNT> <get-var title></a></h3>
- <table border="0">
- <tr><td valign="top"><strong>Description:</strong></td><td>%body</td></tr>
- <tr><td><strong>Skills:</strong></td><td><get-var skills></td></tr>
- <tr><td><strong>Estimated time:</strong></td><td><get-var estimation></td></tr>
- <tr><td><strong>Contact person:</strong></td><td><get-var contact></td></tr>
- </table>
- </boxitem>
-<increment __TASKCNT>
-<restore estimation>
-<restore skills>
-<restore contact>
-<restore title>
-
-</define-tag>
-
-
-<define-tag sb>
- Sascha Brawer
-</define-tag>
-<define-tag mw>
- Mark Wielaard
-</define-tag>
-<define-tag pr>
- Patrik Reali
-</define-tag>
-<define-tag cm>
- Casey Marshall
-</define-tag>
-<define-tag dt>
- Dalibor Topic
-</define-tag>
-<define-tag mk>
- Michael Koch
-</define-tag>
-
-<set-var last-modified-author="prk">
-
-<subject "GNU Classpath Tasklist">
-
-<h1>GNU Classpath Tasklist</h1>
-
-<box>
-
-<boxitem>
-This list is a collection of tasks for helping GNU Classpath's progress. They are a good starting point if you would like to help in producing a complete and high-quality free Java implementation.
-
-<p>Another source of inspiration are GNU Classpath's <createlink name="task list" url="http://savannah.gnu.org/pm/?group=classpath"> and <createlink name="patch list" url="http://savannah.gnu.org/patch/?group=classpath"> on Savannah, though these are usually meant for the project members.
-</boxitem>
-
-<boxtitle>Index</boxtitle>
-{#TASKINDEX#}
-
-
-
-<task-section name="Graphics">
-<task
- title="javax.imageio"
- estimation="2 weeks"
- skills=""
- contact="<sb> or <mk>"
->
-Write an implementation of the javax.imageio framework.
-</task>
-
-<task
- title="Constructive Area Geometry"
- estimation="6 weeks (?)."
- skills="Computational geometry skills"
- contact="<sb>"
->
-Implement java.awt.geom.Area. This would be useful for some
-graphics applications.
-</task>
-
-<task
- title="Composite Contexts"
- estimation="2 days for each operator"
- skills="It helps if you are familiar with the java.awt.image framework."
- contact="<sb>"
->
-Implement some CompositeContexts for Porter/Duff operators on raster
-images. This would be useful for supporting 2D graphics. See
-java.awt.AlphaComposite and its createContext method.
-</task>
-
-</task-section>
-
-<task-section name="CORBA">
-<task
- title="Help with CORBA implementation"
- estimation="This depends on the sub-task you pick."
- skills="Know or be ready to read the OMG documentation."
- contact="Audrius Meskauskas"
->
-The CORBA implementation in the Classpath project is
-now a working but incomplete prototype. A number of CORBA
-related tasks are available. If you are not a CORBA expert, you should be ready
-to learn by reading the <createlink name="OMG specifications"
-url="http://www.omg.org/cgi-bin/doc?formal/04-03-12"> and probably by writing some
-relatively simple classes.
-</task>
-</task-section>
-
-<task-section name="Testing">
-<task
- title="Make Mauve an application"
- estimation=""
- skills=""
- contact="<pr>"
->
-On some environments, it is not possible to run shell scripts
-because there is no shell. Make the Mauve test suite a self-contained
-application (one big JAR file).
-</task>
-
-<task
- title="Write Mauve tests"
- estimation=""
- skills=""
- contact="<mw>"
->
-Write Mauve tests.
-</task>
-
-<task
- title="Mauve tests for javax.image.io"
- estimation="1 week"
- skills=""
- contact="<sb>"
->
-<p>Write Mauve tests for reading in images. You could use the test images
-at libpng.org and write Mauve testlets that load each image from
-a file. Compute a hash (such as SHA-1) over the contents of the
-DataBuffer. If the hash matches, the test succeeds.
-</p><p>
-Note that we don't have javax.imageio yet, so you'd have to develop
-this with the Sun JDK.
-</p>
-</task>
-
-<task
- title="Generator for Mauve tests"
- estimation="2 weeks (prototype) + 2 weeks (tuning)"
- skills=""
- contact="<dt>"
->
-Write a program which automatically generates basic Mauve tests.
-
-
-</task>
-
-</task-section>
-
-<task-section name="Automation">
-
-<task
- title="Script for running regression tests"
- estimation="1 week"
- skills="???"
- contact=""
->
-Write a script that once a night checks out Classpath from cvs,
-compiles it, runs the Mauve test suite (also from cvs) on it
-using some free JVM (e.g. Kissme), and posts the results to
-some web site. For comparison, it would be very helpful if the
-same Mauve testlets were also run with a current Sun JVM.
-</task>
-
-<task
- title="Integrate Classpath testsuite into Mauve"
- estimation=""
- skills=""
- contact="<mw>"
->
-Classpath has a rather small number of tests in the subdirectories
-test/ and testsuite/. Look through these tests and check whether the
-same functionality is already tested by Mauve. If not, write a
-Mauve testlet and submit it to mauve-patches@sources.redhat.com <mailto:mauve-patches@sources.redhat.com>.
-The goal is to remove the test suite from Classpath.
-</task>
-
-
-<task
- title="Script for running Japitools"
- estimation="1 week"
- skills=""
- contact="???"
->
-Write a script that once a night checks out Classpath from cvs,
-runs Japitools on it, and posts the results on some web site.
-</task>
-
-<task
- title="Script for running gjdoc"
- estimation="1 week"
- skills=""
- contact=""
->
-Write a script that once a night checks out Classpath from cvs,
-runs gjdoc on it, and posts the generated documentation on some
-web site. While you're at it, fix gjdoc so it copies embedded
-documentation images (classpath-tools support request #102205).
-</task>
-
-<task
- title="JAR file verification"
- estimation=""
- skills=""
- contact="<mw>"
->
-</task>
-</task-section>
-
-<task-section name="Native stuff">
-
-<task
- title="Libiconv Service Provider for java.nio.charset"
- estimation="2 weeks"
- skills=""
- contact=""
->Write a service provider for java.nio.charset that uses the
-libiconv library for converting character encodings to and
-from UTF-16. This would be a first step for replacing
-gnu.java.io.EncodingManager by the java.nio.charset framework,
-which is richer and not specific to Classpath.
-</task>
-</task-section>
-
-<task-section name="Security">
-
-<task
- title="Security Audit"
- estimation=""
- skills=""
- contact=""
->We need to make a pass over the Classpath Java source, making sure
-that all required calls to the SecurityManager are in place. At the same
-time we need to ensure that there is no way to get around
-SecurityManager by directly calling code in gnu.*.
-</task>
-
-<task
- title="Security Testing"
- estimation=""
- skills=""
- contact=""
->We need Mauve tests for all the calls to SecurityManager.
-Additionally, enabling a security manager will probably reveal
-code in Classpath that needs to be wrapped in AccessController.doPrivileged().
-</task>
-
-</task-section>
-
-<task-section name="Related Projects">
-<task
- title="Help GNU Crypto"
- estimation=""
- skills=""
- contact="<cm>"
->
-</task>
-<task
- title="Help Classpath-x"
- estimation=""
- skills=""
- contact=""
->
-??? (maybe this should be more specific, e.g. "Write an
-IMAP plug-in for javax.mail on top of inetlib" (if they want
-this at all)
-</task-section>
-
-</box>
diff --git a/libjava/classpath/examples/Makefile.in b/libjava/classpath/examples/Makefile.in
index 5c067bce5e1..f688ab77707 100644
--- a/libjava/classpath/examples/Makefile.in
+++ b/libjava/classpath/examples/Makefile.in
@@ -41,10 +41,8 @@ subdir = examples
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/Makefile.jawt.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -86,10 +84,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -226,6 +228,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -239,6 +242,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
index b4a37720faa..fb5ebdbb5dc 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
@@ -73,7 +73,7 @@ import org.omg.CosNaming.NamingContextHelper;
*/
public class Demo
{
- public static void main(final String[] args)
+ public static void main(String[] an_args)
{
// We create the following naming graph:
// <ROOT CONTEXT>
@@ -90,6 +90,8 @@ public class Demo
System.out.println("Starting the GNU Classpath " +
"built-in transient naming service"
);
+
+ final String[] args = an_args;
new Thread()
{
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
index 85f233a1d4c..f53609cf718 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication;
+import java.io.File;
+
import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DirectTest;
import gnu.classpath.examples.CORBA.SimpleCommunication.communication.RequestTest;
@@ -61,23 +63,34 @@ public class Demo
{
public static void main(final String[] args)
{
+ File ior = new File("IOR.txt");
+ if (ior.exists())
+ ior.delete();
+
// Start the server.
new Thread()
{
public void run()
{
- comServer.start_server(args);
+ DemoServer.start_server(args);
}
}.start();
- System.out.println("Waiting for three seconds for the server to start...");
-
- // Pause some time for the server to start.
- try {
- Thread.sleep(3000);
- }
- catch (InterruptedException ex) {
- }
+ System.out.print("Waiting for the server to start ");
+ while (!ior.exists())
+ {
+ // Pause some time for the server to start.
+ try
+ {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException ex)
+ {
+ }
+ System.out.print(".");
+ }
+ System.out.println("ok.");
+ System.out.println();
// Test the stream oriented communication.
DirectTest.main(args);
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java
index d4e0c56b2c8..d7b1a7771fb 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java
@@ -1,4 +1,4 @@
-/* comServer.java --
+/* DemoServer.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication;
-import gnu.classpath.examples.CORBA.SimpleCommunication.communication.comServant;
+import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DemoServant;
import org.omg.CORBA.ORB;
@@ -47,7 +47,7 @@ import java.io.PrintStream;
/**
* This is the server class that handles the client requests,
- * delegating the functionality to the {@link comServant}.
+ * delegating the functionality to the {@link DemoServant}.
*
* When starting, the server writes the IOR.txt file into the current
* folder. With the information, stored in this file, the server
@@ -62,7 +62,7 @@ import java.io.PrintStream;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class comServer
+public class DemoServer
{
public static void main(String[] args)
@@ -78,7 +78,7 @@ public class comServer
final ORB orb = org.omg.CORBA.ORB.init(args, null);
// Create the servant and register it with the ORB.
- comServant tester = new comServant();
+ DemoServant tester = new DemoServant();
orb.connect(tester);
// Storing the IOR reference.
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
index 08d1759d8d2..c07b77b1728 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
@@ -1,4 +1,4 @@
-/* comServant.java --
+/* DemoServant.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,12 +45,6 @@ import org.omg.CORBA.DoubleHolder;
import org.omg.CORBA.ShortHolder;
import org.omg.CORBA.StringHolder;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.PrintStream;
-
/**
* This class handles the actual server functionality in this test
* application. When the client calls the remote method, this
@@ -62,8 +56,8 @@ import java.io.PrintStream;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class comServant
- extends _comTesterImplBase
+public class DemoServant
+ extends _DemoTesterImplBase
{
/**
* The field, that can be set and checked by remote client.
@@ -129,7 +123,7 @@ public class comServant
/**
* Accept and return the structures.
*/
- public returnThis passStructure(passThis in_structure)
+ public StructureToReturn passStructure(StructureToPass in_structure)
{
System.out.println("SERVER: ***** Transferring structures");
System.out.println("SERVER: Received " + in_structure.a + ":" +
@@ -137,7 +131,7 @@ public class comServant
);
// Create and send back the returned structure.
- returnThis r = new returnThis();
+ StructureToReturn r = new StructureToReturn();
r.c = in_structure.a + in_structure.b;
r.n = 555;
r.arra = new int[] { 11, 22, 33 };
@@ -147,14 +141,14 @@ public class comServant
/**
* Pass and return the tree structure
*/
- public void passTree(nodeHolder tree)
+ public void passTree(TreeNodeHolder tree)
{
System.out.println("SERVER: ***** Transferring tree");
StringBuffer b = new StringBuffer();
// This both creates the tree string representation
- // and changes the node names.
+ // and changes the TreeNode names.
getImage(b, tree.value);
System.out.println("SERVER: The tree was: " + b + ", returning changed.");
}
@@ -190,11 +184,11 @@ public class comServant
*
* @param parameter specifies which exception will be thrown.
*
- * @throws ourUserException for the non negative parameter.
+ * @throws WeThrowThisException for the non negative parameter.
* @throws BAD_OPERATION for the negative parameter.
*/
public void throwException(int parameter)
- throws ourUserException
+ throws WeThrowThisException
{
System.out.println("SERVER: ***** Testing exceptions");
if (parameter > 0)
@@ -202,7 +196,7 @@ public class comServant
System.out.println("SERVER: Throwing the user exception, " +
"specific field = "+parameter
);
- throw new ourUserException(parameter);
+ throw new WeThrowThisException(parameter);
}
else
{
@@ -215,12 +209,12 @@ public class comServant
/**
* Visit all tree nodes, getting the string representation
- * and adding '++' to the node names.
+ * and adding '++' to the TreeNode names.
*
* @param b the buffer to collect the string representation.
- * @param n the rott tree node.
+ * @param n the rott tree TreeNode.
*/
- private void getImage(StringBuffer b, node n)
+ private void getImage(StringBuffer b, TreeNode n)
{
b.append(n.name);
n.name = n.name + "++";
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
index 495807eb980..f3766f3251a 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
@@ -1,4 +1,4 @@
-/* comTester.java --
+/* DemoTester.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,12 +45,12 @@ import org.omg.CORBA.StringHolder;
/**
* The interface of our remote object. Some IDL compiles split it
- * into "comTester" and "comTesterOperations", but we do not see
+ * into "DemoTester" and "comTesterOperations", but we do not see
* much sense in doing this here.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface comTester
+public interface DemoTester
{
/**
* Passes wide (UTF-16) string and narrow (ISO8859_1) string.
@@ -77,14 +77,14 @@ public interface comTester
/**
* Passes and returns the structures.
*/
- returnThis passStructure(passThis in_structure);
+ StructureToReturn passStructure(StructureToPass in_structure);
/**
* Pass and return the tree structure
*
- * @param tree the root node of the tree.
+ * @param tree the root TreeNode of the tree.
*/
- void passTree(nodeHolder tree);
+ void passTree(TreeNodeHolder tree);
/**
* Just prints the "Hello" message.
@@ -102,10 +102,10 @@ public interface comTester
void theField(int newTheField);
/**
- * Throws either 'ourUserException' with the 'ourField' field
+ * Throws either 'WeThrowThisException' with the 'ourField' field
* initialised to the passed positive value
* or system exception (if the parameter is zero or negative).
*/
void throwException(int parameter)
- throws ourUserException;
+ throws WeThrowThisException;
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
index 5cf372b26a5..732b00cfb30 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
@@ -57,7 +57,7 @@ import java.io.IOException;
* where the program has been started.
*
* The IOR.txt file is written by the server
- * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}.
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
* The server should be reachable over Internet, unless blocked by
* security tools.
*
@@ -83,7 +83,7 @@ public class DirectTest
/**
* The invocation target.
*/
- comTester object;
+ DemoTester object;
/**
* Get the object reference.
@@ -102,7 +102,7 @@ public class DirectTest
String ior = new String(c);
DirectTest we = new DirectTest();
- we.object = (comTester) orb.string_to_object(ior);
+ we.object = (DemoTester) orb.string_to_object(ior);
we.Demo();
orb.shutdown(false);
}
@@ -199,11 +199,11 @@ public class DirectTest
{
System.out.println("***** Pass structure");
- passThis arg = new passThis();
+ StructureToPass arg = new StructureToPass();
arg.a = "A";
arg.b = "B";
- returnThis r = object.passStructure(arg);
+ StructureToReturn r = object.passStructure(arg);
System.out.println(" Fields of the returned structure:");
@@ -257,15 +257,15 @@ public class DirectTest
// +-- bb
System.out.println("***** Pass and return the tree.");
- node n = nod("Root");
+ TreeNode n = nod("Root");
- n.children = new node[] { nod("a"), nod("b") };
- n.children [ 1 ].children = new node[] { nod("ba"), nod("bb") };
- n.children [ 1 ].children [ 0 ].children = new node[] { nod("bac") };
+ n.children = new TreeNode[] { nod("a"), nod("b") };
+ n.children [ 1 ].children = new TreeNode[] { nod("ba"), nod("bb") };
+ n.children [ 1 ].children [ 0 ].children = new TreeNode[] { nod("bac") };
- nodeHolder nh = new nodeHolder(n);
+ TreeNodeHolder nh = new TreeNodeHolder(n);
- // The server should add '++' to each node name.
+ // The server should add '++' to each TreeNode name.
object.passTree(nh);
// Convert the returned tree to some strig representation.
@@ -288,7 +288,7 @@ public class DirectTest
object.throwException(123);
throw new InternalError();
}
- catch (ourUserException uex)
+ catch (WeThrowThisException uex)
{
System.out.println(" The user exception with field " + uex.ourField +
", has been thrown on remote side."
@@ -312,9 +312,9 @@ public class DirectTest
/**
* Get the string representation of the passed tree.
* @param b the string buffer to accumulate the representation.
- * @param n the tree (root node).
+ * @param n the tree (root TreeNode).
*/
- private void getImage(StringBuffer b, node n)
+ private void getImage(StringBuffer b, TreeNode n)
{
b.append(n.name);
b.append(": (");
@@ -328,15 +328,15 @@ public class DirectTest
}
/**
- * Create a node with the given header.
+ * Create a TreeNode with the given header.
*
- * @param hdr the node header.
- * @return the created node.
+ * @param hdr the TreeNode header.
+ * @return the created TreeNode.
*/
- private node nod(String hdr)
+ private TreeNode nod(String hdr)
{
- node n = new node();
- n.children = new node[ 0 ];
+ TreeNode n = new TreeNode();
+ n.children = new TreeNode[ 0 ];
n.name = hdr;
return n;
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
index 977fb428287..9c908e520cc 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
@@ -1,3 +1,39 @@
+/* RequestTest.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
@@ -7,14 +43,10 @@ import java.io.FileReader;
import java.io.IOException;
import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.ByteHolder;
-import org.omg.CORBA.DoubleHolder;
import org.omg.CORBA.ExceptionList;
import org.omg.CORBA.NVList;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Request;
-import org.omg.CORBA.ShortHolder;
-import org.omg.CORBA.StringHolder;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.UnknownUserException;
@@ -25,7 +57,7 @@ import org.omg.CORBA.UnknownUserException;
* where the program has been started.
*
* The IOR.txt file is written by the server
- * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}.
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
* The server should be reachable over Internet, unless blocked by
* security tools.
*
@@ -106,7 +138,6 @@ public class RequestTest
throw new InternalError();
}
testSystemException();
- testUserException();
testWideNarrowStrings();
}
@@ -135,13 +166,6 @@ public class RequestTest
Request r =
object._create_request(null, "passSimple", orb.create_list(0), null);
- ByteHolder a_byte = new ByteHolder((byte) 0);
- ShortHolder a_short = new ShortHolder((short) 3);
- StringHolder a_string = new StringHolder("[string 4]");
-
- // This is an 'out' parameter; the value must not be passed to servant.
- DoubleHolder a_double = new DoubleHolder(56.789);
-
r.add_inout_arg().insert_octet((byte) 0);
r.add_in_arg().insert_long(2);
r.add_inout_arg().insert_short((short) 3);
@@ -188,7 +212,7 @@ public class RequestTest
try
{
ExceptionList exList = orb.create_exception_list();
- exList.add(ourUserExceptionHelper.type());
+ exList.add(WeThrowThisExceptionHelper.type());
Request rq =
object._create_request(null, "throwException", orb.create_list(1),
@@ -217,7 +241,7 @@ public class RequestTest
System.out.println("**** Test user exception:");
ExceptionList exList = orb.create_exception_list();
- exList.add(ourUserExceptionHelper.type());
+ exList.add(WeThrowThisExceptionHelper.type());
Request rq =
object._create_request(null, "throwException", orb.create_list(1), null,
@@ -228,7 +252,7 @@ public class RequestTest
rq.invoke();
UnknownUserException uku = (UnknownUserException) rq.env().exception();
- ourUserException our_exception = ourUserExceptionHelper.extract(uku.except);
+ WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except);
System.out.println(" Our user exception, field " + our_exception.ourField +
", has been thrown on remote side."
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
index 2a680b91bee..d17e91fbac0 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
@@ -1,4 +1,4 @@
-/* passThis.java --
+/* StructureToPass.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,9 +44,14 @@ package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class passThis
+public class StructureToPass
implements org.omg.CORBA.portable.IDLEntity
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The first string, stored in this structure (defined as
* "narrow string").
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
index 6b9f4ce0102..c41ebe237ea 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
@@ -1,4 +1,4 @@
-/* passThisHelper.java --
+/* StructureToPassHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
-import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TypeCode;
@@ -46,17 +45,17 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
/**
- * The helper operations for the {@link passThis}.
+ * The helper operations for the {@link StructureToPass}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class passThisHelper
+public abstract class StructureToPassHelper
{
/**
- * The repository ID of the {@link passThis}.
+ * The repository ID of the {@link StructureToPass}.
*/
private static String id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass:1.0";
/**
* Get the repository id.
@@ -69,9 +68,9 @@ public abstract class passThisHelper
/**
* Read the structure from the CDR stram.
*/
- public static passThis read(InputStream istream)
+ public static StructureToPass read(InputStream istream)
{
- passThis value = new passThis();
+ StructureToPass value = new StructureToPass();
value.a = istream.read_string();
value.b = istream.read_wstring();
return value;
@@ -88,13 +87,13 @@ public abstract class passThisHelper
members [ 0 ] = new StructMember("a", member, null);
member = ORB.init().create_string_tc(0);
members [ 1 ] = new StructMember("b", member, null);
- return ORB.init().create_struct_tc(passThisHelper.id(), "passThis", members);
+ return ORB.init().create_struct_tc(StructureToPassHelper.id(), "StructureToPass", members);
}
/**
* Write the structure into the CDR stream.
*/
- public static void write(OutputStream ostream, passThis value)
+ public static void write(OutputStream ostream, StructureToPass value)
{
ostream.write_string(value.a);
ostream.write_wstring(value.b);
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
index 0d93cbaf66f..5bbe6908e27 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
@@ -6,32 +6,32 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
-public final class passThisHolder
+public final class StructureToPassHolder
implements Streamable
{
- public passThis value;
+ public StructureToPass value;
- public passThisHolder()
+ public StructureToPassHolder()
{
}
- public passThisHolder(passThis initialValue)
+ public StructureToPassHolder(StructureToPass initialValue)
{
value = initialValue;
}
public void _read(InputStream i)
{
- value = passThisHelper.read(i);
+ value = StructureToPassHelper.read(i);
}
public org.omg.CORBA.TypeCode _type()
{
- return passThisHelper.type();
+ return StructureToPassHelper.type();
}
public void _write(OutputStream o)
{
- passThisHelper.write(o, value);
+ StructureToPassHelper.write(o, value);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
index b7c3923ce16..5dc843ae8c7 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
@@ -1,4 +1,4 @@
-/* returnThis.java --
+/* StructureToReturn.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,9 +44,14 @@ import org.omg.CORBA.portable.IDLEntity;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class returnThis
+public class StructureToReturn
implements IDLEntity
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The string field.
*/
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
index 79838d75ca4..42fb7a574a7 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
@@ -1,4 +1,4 @@
-/* returnThisHelper.java --
+/* StructureToReturnHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
-import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TCKind;
@@ -46,17 +45,17 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
/**
- * This class defines the helper operations for {@link returnThis}.
+ * This class defines the helper operations for {@link StructureToReturn}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class returnThisHelper
+public abstract class StructureToReturnHelper
{
/**
* The repository id.
*/
private static String _id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn:1.0";
/**
* Return the repository id.
@@ -69,9 +68,9 @@ public abstract class returnThisHelper
/**
* Read the structure from the CDR stream.
*/
- public static returnThis read(InputStream istream)
+ public static StructureToReturn read(InputStream istream)
{
- returnThis value = new returnThis();
+ StructureToReturn value = new StructureToReturn();
value.n = istream.read_long();
value.c = istream.read_wstring();
value.arra = new int[ 3 ];
@@ -95,7 +94,7 @@ public abstract class returnThisHelper
member = ORB.init().get_primitive_tc(TCKind.tk_long);
member = ORB.init().create_array_tc(3, member);
members [ 2 ] = new StructMember("arra", member, null);
- return ORB.init().create_struct_tc(returnThisHelper.id(), "returnThis",
+ return ORB.init().create_struct_tc(StructureToReturnHelper.id(), "StructureToReturn",
members
);
}
@@ -103,7 +102,7 @@ public abstract class returnThisHelper
/**
* Write the structure to the CDR stream.
*/
- public static void write(OutputStream ostream, returnThis value)
+ public static void write(OutputStream ostream, StructureToReturn value)
{
ostream.write_long(value.n);
ostream.write_wstring(value.c);
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
index 294e37ac3ef..c70f9cfccdd 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
@@ -10,25 +10,25 @@ import org.omg.CORBA.portable.Streamable;
/**
* The holder for the structure, returned from the server.
*/
-public final class returnThisHolder
+public final class StructureToReturnHolder
implements Streamable
{
/**
* The enclosed structure.
*/
- public returnThis value = null;
+ public StructureToReturn value = null;
/**
* Create the empty holder.
*/
- public returnThisHolder()
+ public StructureToReturnHolder()
{
}
/**
* Crate the holder with the defined initial value.
*/
- public returnThisHolder(returnThis initialValue)
+ public StructureToReturnHolder(StructureToReturn initialValue)
{
value = initialValue;
}
@@ -38,7 +38,7 @@ public final class returnThisHolder
*/
public void _read(InputStream in)
{
- value = returnThisHelper.read(in);
+ value = StructureToReturnHelper.read(in);
}
/**
@@ -46,7 +46,7 @@ public final class returnThisHolder
*/
public TypeCode _type()
{
- return returnThisHelper.type();
+ return StructureToReturnHelper.type();
}
/**
@@ -55,6 +55,6 @@ public final class returnThisHolder
*/
public void _write(OutputStream out)
{
- returnThisHelper.write(out, value);
+ StructureToReturnHelper.write(out, value);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
index 527d02d0668..b267f39eaff 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
@@ -1,4 +1,4 @@
-/* node.java --
+/* TreeNode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,12 +44,17 @@ package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class node
+public class TreeNode
implements org.omg.CORBA.portable.IDLEntity
{
- /** The node name */
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /** The TreeNode name */
public String name = null;
- /** The node children. */
- public node[] children = null;
+ /** The TreeNode children. */
+ public TreeNode[] children = null;
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
index 8d4121cda3f..f111d0eac93 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
@@ -1,4 +1,4 @@
-/* nodeHelper.java --
+/* TreeNodeHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,13 +51,13 @@ import org.omg.CORBA.portable.OutputStream;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class nodeHelper
+public abstract class TreeNodeHelper
{
/**
- * The node repository id, used to identify the structure.
+ * The TreeNode repository id, used to identify the structure.
*/
private static String _id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/node:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode:1.0";
/**
* Caches the typecode, allowing to compute it only once.
@@ -66,21 +66,21 @@ public abstract class nodeHelper
/**
* This is used to handle the recursive object references in
- * CORBA - supported way. The tree node definition is recursive,
- * as the node contains the sequence of the nodes as its field.
+ * CORBA - supported way. The tree TreeNode definition is recursive,
+ * as the TreeNode contains the sequence of the nodes as its field.
*/
private static boolean active;
/**
- * Extract the tree node from the unversal CORBA wrapper, Any.
+ * Extract the tree TreeNode from the unversal CORBA wrapper, Any.
*/
- public static node extract(Any a)
+ public static TreeNode extract(Any a)
{
return read(a.create_input_stream());
}
/**
- * Get the node string identifer.
+ * Get the TreeNode string identifer.
*/
public static String id()
{
@@ -88,9 +88,9 @@ public abstract class nodeHelper
}
/**
- * Insert the node into the universal CORBA wrapper, Any.
+ * Insert the TreeNode into the universal CORBA wrapper, Any.
*/
- public static void insert(Any a, node that)
+ public static void insert(Any a, TreeNode that)
{
OutputStream out = a.create_output_stream();
a.type(type());
@@ -99,22 +99,22 @@ public abstract class nodeHelper
}
/**
- * Read the node from the common data reprentation (CDR) stream.
+ * Read the TreeNode from the common data reprentation (CDR) stream.
*/
- public static node read(InputStream istream)
+ public static TreeNode read(InputStream istream)
{
- node value = new node();
+ TreeNode value = new TreeNode();
value.name = istream.read_string();
int _len0 = istream.read_long();
- value.children = new node[ _len0 ];
+ value.children = new TreeNode[ _len0 ];
for (int i = 0; i < value.children.length; ++i)
- value.children [ i ] = nodeHelper.read(istream);
+ value.children [ i ] = TreeNodeHelper.read(istream);
return value;
}
/**
- * Get the node type code definition.
+ * Get the TreeNode type code definition.
*/
public static synchronized TypeCode type()
{
@@ -131,7 +131,7 @@ public abstract class nodeHelper
return ORB.init().create_recursive_tc(_id);
active = true;
- // List all memebers of the node structure.
+ // List all memebers of the TreeNode structure.
StructMember[] members = new StructMember[ 2 ];
TypeCode memberType;
memberType = ORB.init().create_string_tc(0);
@@ -139,7 +139,7 @@ public abstract class nodeHelper
memberType = ORB.init().create_recursive_tc("");
members [ 1 ] = new StructMember("children", memberType, null);
typeCode =
- ORB.init().create_struct_tc(nodeHelper.id(), "node", members);
+ ORB.init().create_struct_tc(TreeNodeHelper.id(), "TreeNode", members);
active = false;
}
}
@@ -148,13 +148,13 @@ public abstract class nodeHelper
}
/**
- * Write the node into the common data reprentation (CDR) stream.
+ * Write the TreeNode into the common data reprentation (CDR) stream.
*/
- public static void write(OutputStream ostream, node value)
+ public static void write(OutputStream ostream, TreeNode value)
{
ostream.write_string(value.name);
ostream.write_long(value.children.length);
for (int i = 0; i < value.children.length; ++i)
- nodeHelper.write(ostream, value.children [ i ]);
+ TreeNodeHelper.write(ostream, value.children [ i ]);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
index 8e4913912dc..ec180ce579a 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
@@ -1,4 +1,4 @@
-/* nodeHolder.java --
+/* TreeNodeHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,57 +44,57 @@ import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
/**
- * The node holder is a wrapper about the node data structure. It
- * can be used where the node must be passed both to and from
+ * The TreeNode holder is a wrapper about the TreeNode data structure. It
+ * can be used where the TreeNode must be passed both to and from
* the method being called. The same structure holds the tree,
- * as it can be represented as a root node with children.
+ * as it can be represented as a root TreeNode with children.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class nodeHolder
+public class TreeNodeHolder
implements Streamable
{
/**
- * Stores the node value.
+ * Stores the TreeNode value.
*/
- public node value;
+ public TreeNode value;
/**
- * Creates the node holder with the null initial value.
+ * Creates the TreeNode holder with the null initial value.
*/
- public nodeHolder()
+ public TreeNodeHolder()
{
}
/**
- * Creates the node holder with the given initial value.
+ * Creates the TreeNode holder with the given initial value.
*/
- public nodeHolder(node initialValue)
+ public TreeNodeHolder(TreeNode initialValue)
{
value = initialValue;
}
/**
- * Reads the node value from the common data representation (CDR)
+ * Reads the TreeNode value from the common data representation (CDR)
* stream.
*/
public void _read(InputStream in)
{
- value = nodeHelper.read(in);
+ value = TreeNodeHelper.read(in);
}
/**
- * Writes the node value into common data representation (CDR)
+ * Writes the TreeNode value into common data representation (CDR)
* stream.
* @return
*/
public TypeCode _type()
{
- return nodeHelper.type();
+ return TreeNodeHelper.type();
}
public void _write(OutputStream out)
{
- nodeHelper.write(out, value);
+ TreeNodeHelper.write(out, value);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
index 51ea5f2d6d8..cf20d61ecdc 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
@@ -1,4 +1,4 @@
-/* ourUserException.java --
+/* WeThrowThisException.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,10 +49,15 @@ import org.omg.CORBA.portable.IDLEntity;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class ourUserException
+public class WeThrowThisException
extends UserException
implements IDLEntity
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Our specific field, transferred to client.
*/
@@ -63,7 +68,7 @@ public class ourUserException
*
* @param _ourField the value of our specific field.
*/
- public ourUserException(int _ourField)
+ public WeThrowThisException(int _ourField)
{
ourField = _ourField;
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
index 8c499df6472..4d5eee74b4b 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
@@ -1,4 +1,4 @@
-/* ourUserExceptionHelper.java --
+/* WeThrowThisExceptionHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,14 +50,14 @@ import org.omg.CORBA.TypeCode;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class ourUserExceptionHelper
+public abstract class WeThrowThisExceptionHelper
{
/**
* The exception repository id. This name is also used to find the
* mapping local CORBA class.
*/
private static String _id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0";
/**
* Get the exception repository id.
@@ -71,7 +71,7 @@ public abstract class ourUserExceptionHelper
* Extract the exception from the given Any where it might be
* wrapped.
*/
- public static ourUserException extract(Any a)
+ public static WeThrowThisException extract(Any a)
{
return read(a.create_input_stream());
}
@@ -79,9 +79,9 @@ public abstract class ourUserExceptionHelper
/**
* Read the exception from the CDR stream.
*/
- public static ourUserException read(org.omg.CORBA.portable.InputStream istream)
+ public static WeThrowThisException read(org.omg.CORBA.portable.InputStream istream)
{
- ourUserException value = new ourUserException(0);
+ WeThrowThisException value = new WeThrowThisException(0);
// The repository ID is not used
istream.read_string();
@@ -98,8 +98,8 @@ public abstract class ourUserExceptionHelper
TypeCode member = null;
member = ORB.init().get_primitive_tc(TCKind.tk_long);
members [ 0 ] = new StructMember("ourField", member, null);
- return ORB.init().create_struct_tc(ourUserExceptionHelper.id(),
- "ourUserException", members
+ return ORB.init().create_struct_tc(WeThrowThisExceptionHelper.id(),
+ "WeThrowThisException", members
);
}
@@ -107,7 +107,7 @@ public abstract class ourUserExceptionHelper
* Write the exception into the CDR stream.
*/
public static void write(org.omg.CORBA.portable.OutputStream ostream,
- ourUserException value
+ WeThrowThisException value
)
{
ostream.write_string(id());
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
index 4c8f5b94c68..237c23086eb 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
@@ -1,4 +1,4 @@
-/* _comTesterImplBase.java --
+/* _DemoTesterImplBase.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,13 +53,16 @@ import org.omg.CORBA.portable.ResponseHandler;
/**
* The base for the class that is actually implementing the functionality
- * of the object on the server side ({@link comServant} of our case).
+ * of the object on the server side ({@link DemoServant} of our case).
+ *
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "ImplBase".
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class _comTesterImplBase
+public abstract class _DemoTesterImplBase
extends ObjectImpl
- implements comTester, InvokeHandler
+ implements DemoTester, InvokeHandler
{
/**
* When the server receives the request message from client, it
@@ -138,7 +141,7 @@ public abstract class _comTesterImplBase
}
else
/*
- Throws either 'ourUserException' with the 'ourField' field
+ Throws either 'WeThrowThisException' with the 'ourField' field
initialised to the passed positive value
or system exception (if the parameter is zero or negative).
*/
@@ -150,21 +153,21 @@ public abstract class _comTesterImplBase
throwException(parameter);
out = rh.createReply();
}
- catch (ourUserException exception)
+ catch (WeThrowThisException exception)
{
out = rh.createExceptionReply();
- ourUserExceptionHelper.write(out, exception);
+ WeThrowThisExceptionHelper.write(out, exception);
}
}
else
/* Passes and returns the structures. */
if (a_method.equals("passStructure"))
{
- passThis in_structure = passThisHelper.read(in);
- returnThis result = null;
+ StructureToPass in_structure = StructureToPassHelper.read(in);
+ StructureToReturn result = null;
result = passStructure(in_structure);
out = rh.createReply();
- returnThisHelper.write(out, result);
+ StructureToReturnHelper.write(out, result);
}
else
/* Passes and returns the string sequence. */
@@ -180,11 +183,11 @@ public abstract class _comTesterImplBase
/** Pass and return the tree structure */
if (a_method.equals("passTree"))
{
- nodeHolder tree = new nodeHolder();
- tree.value = nodeHelper.read(in);
+ TreeNodeHolder tree = new TreeNodeHolder();
+ tree.value = TreeNodeHelper.read(in);
passTree(tree);
out = rh.createReply();
- nodeHelper.write(out, tree.value);
+ TreeNodeHelper.write(out, tree.value);
}
else
@@ -201,6 +204,6 @@ public abstract class _comTesterImplBase
public String[] _ids()
{
// They are the same as for the stub.
- return _comTesterStub._ids;
+ return _DemoTesterStub._ids;
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
index b71cd8e863f..c8e0ccd6d27 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
@@ -1,4 +1,4 @@
-/* _comTesterStub.java --
+/* _DemoTesterStub.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,23 +55,26 @@ import org.omg.CORBA.portable.RemarshalException;
* side. It has all the same methods as the actual implementation
* on the server side. These methods contain the code for remote
* invocation.
+ *
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "Stub".
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class _comTesterStub
+public class _DemoTesterStub
extends ObjectImpl
- implements comTester
+ implements DemoTester
{
/**
- * A string array of comTester repository ids.
+ * A string array of DemoTester repository ids.
*/
public static String[] _ids =
{
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester:1.0"
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester:1.0"
};
/**
- * Return an array of comTester repository ids.
+ * Return an array of DemoTester repository ids.
*/
public String[] _ids()
{
@@ -217,7 +220,7 @@ public class _comTesterStub
/**
Passes and returns the structures.
*/
- public returnThis passStructure(passThis in_structure)
+ public StructureToReturn passStructure(StructureToPass in_structure)
{
InputStream in = null;
try
@@ -226,13 +229,13 @@ public class _comTesterStub
OutputStream out = _request("passStructure", true);
// Write the structure, using its helper.
- passThisHelper.write(out, in_structure);
+ StructureToPassHelper.write(out, in_structure);
// Invoke the method.
in = _invoke(out);
// Read the returned structer, using another helper.
- returnThis result = returnThisHelper.read(in);
+ StructureToReturn result = StructureToReturnHelper.read(in);
return result;
}
catch (ApplicationException ex)
@@ -253,7 +256,7 @@ public class _comTesterStub
/**
* Pass and return the tree structure
*/
- public void passTree(nodeHolder tree)
+ public void passTree(TreeNodeHolder tree)
{
InputStream in = null;
try
@@ -261,15 +264,15 @@ public class _comTesterStub
// Get the stream where the parameters must be written.
OutputStream out = _request("passTree", true);
- // Write the tree (node with its chilred, grandchildren and so on),
+ // Write the tree (TreeNode with its chilred, grandchildren and so on),
// using the appropriate helper.
- nodeHelper.write(out, tree.value);
+ TreeNodeHelper.write(out, tree.value);
// Call the method.
in = _invoke(out);
// Read the returned tree.
- tree.value = nodeHelper.read(in);
+ tree.value = TreeNodeHelper.read(in);
}
catch (ApplicationException ex)
{
@@ -382,10 +385,10 @@ public class _comTesterStub
* of the positive value of this argument, and system
* exception otherwise.
*
- * @throws ourUserException
+ * @throws WeThrowThisException
*/
public void throwException(int parameter)
- throws ourUserException
+ throws WeThrowThisException
{
InputStream in = null;
try
@@ -408,9 +411,9 @@ public class _comTesterStub
// If this is the user exception we expect to catch, read and throw
// it here. The system exception, if thrown, is handled by _invoke.
- if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException:1.0")
+ if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0")
)
- throw ourUserExceptionHelper.read(in);
+ throw WeThrowThisExceptionHelper.read(in);
else
throw new MARSHAL(id);
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java
new file mode 100644
index 00000000000..7e403d8d686
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java
@@ -0,0 +1,137 @@
+/* Demo.java -- And example of MIDI support
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.midi;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.sound.midi.*;
+
+/**
+ * An example how javax.sound.midi facilities work.
+ */
+public class Demo extends Frame implements ItemListener
+{
+ Choice midiInChoice = new Choice();
+ Choice midiOutChoice = new Choice();
+
+ MidiDevice inDevice = null;
+ MidiDevice outDevice = null;
+
+ ArrayList inDevices = new ArrayList();
+ ArrayList outDevices = new ArrayList();
+
+ public Demo () throws Exception
+ {
+ MenuBar mb = new MenuBar ();
+ Menu menu = new Menu ("File");
+ MenuItem quit = new MenuItem("Quit", new MenuShortcut('Q'));
+ quit.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.exit(0);
+ }
+ });
+ menu.add (quit);
+ mb.add(menu);
+
+ setTitle("synthcity: the GNU Classpath MIDI Demo");
+ setLayout(new FlowLayout());
+
+ MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
+
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = MidiSystem.getMidiDevice(infos[i]);
+ if (device.getMaxReceivers() > 0)
+ {
+ midiOutChoice.addItem(infos[i].getDescription());
+ outDevices.add(device);
+ }
+ if (device.getMaxTransmitters() > 0)
+ {
+ midiInChoice.addItem(infos[i].getDescription());
+ inDevices.add(device);
+ }
+ }
+
+ setMenuBar (mb);
+ add(new Label("MIDI IN: "));
+ add(midiInChoice);
+ add(new Label(" MIDI OUT: "));
+ add(midiOutChoice);
+
+ midiInChoice.addItemListener(this);
+ midiOutChoice.addItemListener(this);
+
+ pack();
+ show();
+ }
+
+ public void itemStateChanged (ItemEvent e)
+ {
+ try
+ {
+ if (e.getItemSelectable() == midiInChoice)
+ {
+ if (inDevice != null)
+ inDevice.close();
+ inDevice = (MidiDevice)
+ inDevices.get(midiInChoice.getSelectedIndex());
+ }
+
+ if (e.getItemSelectable() == midiOutChoice)
+ {
+ if (outDevice != null)
+ outDevice.close();
+ outDevice = (MidiDevice)
+ outDevices.get(midiOutChoice.getSelectedIndex());
+ }
+
+ if (inDevice != null && outDevice != null)
+ {
+ if (! inDevice.isOpen())
+ inDevice.open();
+ if (! outDevice.isOpen())
+ outDevice.open();
+ Transmitter t = inDevice.getTransmitter();
+ if (t == null)
+ System.err.println (inDevice + ".getTransmitter() == null");
+ Receiver r = outDevice.getReceiver();
+ if (r == null)
+ System.err.println (outDevice + ".getReceiver() == null");
+
+ if (t != null && r != null)
+ t.setReceiver (r);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public static void main (String args[]) throws Exception
+ {
+ new Demo();
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java
new file mode 100644
index 00000000000..b53ba3b5c85
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java
@@ -0,0 +1,284 @@
+/* ButtonDemo.java -- An example showing various buttons in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JToggleButton;
+import javax.swing.SwingConstants;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * A simple button demo showing various buttons in different states.
+ */
+public class ButtonDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ private JCheckBox buttonState;
+ private JButton button1;
+ private JButton button2;
+ private JButton button3;
+ private JButton button4;
+
+ private JCheckBox toggleState;
+ private JToggleButton toggle1;
+ private JToggleButton toggle2;
+ private JToggleButton toggle3;
+ private JToggleButton toggle4;
+
+ private JCheckBox checkBoxState;
+ private JCheckBox checkBox1;
+ private JCheckBox checkBox2;
+ private JCheckBox checkBox3;
+
+ private JCheckBox radioState;
+ private JRadioButton radio1;
+ private JRadioButton radio2;
+ private JRadioButton radio3;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public ButtonDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(4, 1));
+ panel.add(createButtonPanel());
+ panel.add(createTogglePanel());
+ panel.add(createCheckBoxPanel());
+ panel.add(createRadioPanel());
+ content.add(panel);
+ return content;
+ }
+
+ private JPanel createButtonPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.buttonState = new JCheckBox("Enabled", true);
+ this.buttonState.setActionCommand("BUTTON_STATE");
+ this.buttonState.addActionListener(this);
+ panel.add(this.buttonState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JButton"));
+ this.button1 = new JButton("Button 1");
+
+ this.button2 = new JButton("Button 2");
+ this.button2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+
+ this.button3 = new JButton("Button 3");
+ this.button3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
+ this.button3.setHorizontalTextPosition(SwingConstants.CENTER);
+ this.button3.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+ this.button4 = new JButton("Button 4");
+ this.button4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
+ this.button4.setText(null);
+
+ buttonPanel.add(button1);
+ buttonPanel.add(button2);
+ buttonPanel.add(button3);
+ buttonPanel.add(button4);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createTogglePanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.toggleState = new JCheckBox("Enabled", true);
+ this.toggleState.setActionCommand("TOGGLE_STATE");
+ this.toggleState.addActionListener(this);
+
+ panel.add(this.toggleState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JToggleButton"));
+
+ this.toggle1 = new JToggleButton("Toggle 1");
+
+ this.toggle2 = new JToggleButton("Toggle 2");
+ this.toggle2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+
+ this.toggle3 = new JToggleButton("Toggle 3");
+ this.toggle3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
+ this.toggle3.setHorizontalTextPosition(SwingConstants.CENTER);
+ this.toggle3.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+ this.toggle4 = new JToggleButton("Toggle 4");
+ this.toggle4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
+ this.toggle4.setText(null);
+
+ ButtonGroup toggleGroup = new ButtonGroup();
+ toggleGroup.add(toggle1);
+ toggleGroup.add(toggle2);
+ toggleGroup.add(toggle3);
+ toggleGroup.add(toggle4);
+
+ buttonPanel.add(toggle1);
+ buttonPanel.add(toggle2);
+ buttonPanel.add(toggle3);
+ buttonPanel.add(toggle4);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createCheckBoxPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.checkBoxState = new JCheckBox("Enabled", true);
+ this.checkBoxState.setActionCommand("CHECKBOX_STATE");
+ this.checkBoxState.addActionListener(this);
+
+ panel.add(this.checkBoxState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JCheckBox"));
+ this.checkBox1 = new JCheckBox("CheckBox 1");
+
+ this.checkBox2 = new JCheckBox("CheckBox 2");
+
+ this.checkBox3 = new JCheckBox("CheckBox 3");
+
+ buttonPanel.add(checkBox1);
+ buttonPanel.add(checkBox2);
+ buttonPanel.add(checkBox3);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createRadioPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.radioState = new JCheckBox("Enabled", true);
+ this.radioState.setActionCommand("RADIO_STATE");
+ this.radioState.addActionListener(this);
+ panel.add(this.radioState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JRadioButton"));
+ this.radio1 = new JRadioButton("Radio 1");
+
+ this.radio2 = new JRadioButton("Radio 2");
+
+ this.radio3 = new JRadioButton("Radio 3");
+
+ ButtonGroup radioGroup = new ButtonGroup();
+ radioGroup.add(radio1);
+ radioGroup.add(radio2);
+ radioGroup.add(radio3);
+
+ buttonPanel.add(radio1);
+ buttonPanel.add(radio2);
+ buttonPanel.add(radio3);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("BUTTON_STATE"))
+ {
+ button1.setEnabled(buttonState.isSelected());
+ button2.setEnabled(buttonState.isSelected());
+ button3.setEnabled(buttonState.isSelected());
+ button4.setEnabled(buttonState.isSelected());
+ }
+ else if (e.getActionCommand().equals("TOGGLE_STATE"))
+ {
+ toggle1.setEnabled(toggleState.isSelected());
+ toggle2.setEnabled(toggleState.isSelected());
+ toggle3.setEnabled(toggleState.isSelected());
+ toggle4.setEnabled(toggleState.isSelected());
+ }
+ else if (e.getActionCommand().equals("CHECKBOX_STATE"))
+ {
+ checkBox1.setEnabled(checkBoxState.isSelected());
+ checkBox2.setEnabled(checkBoxState.isSelected());
+ checkBox3.setEnabled(checkBoxState.isSelected());
+ }
+ else if (e.getActionCommand().equals("RADIO_STATE"))
+ {
+ radio1.setEnabled(radioState.isSelected());
+ radio2.setEnabled(radioState.isSelected());
+ radio3.setEnabled(radioState.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ ButtonDemo app = new ButtonDemo("Button Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch b/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch
new file mode 100644
index 00000000000..7d041a0b0e7
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.cdt.launch.localCLaunch">
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebugger"/>
+<stringAttribute key="org.eclipse.cdt.launch.protocol" value="mi"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
+<listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="jamvm"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="src/jamvm"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel gnu.classpath.examples.swing.Demo"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=""/>
+</launchConfiguration>
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java
new file mode 100644
index 00000000000..52431cb5d53
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java
@@ -0,0 +1,360 @@
+/* ComboBoxDemo.java -- An example showing various combo boxes in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * A simple demo showing various combo boxes in different states.
+ */
+public class ComboBoxDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ class CustomCellRenderer extends DefaultListCellRenderer
+ {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus)
+ {
+ DefaultListCellRenderer result = (DefaultListCellRenderer)
+ super.getListCellRendererComponent(list, value, index, isSelected,
+ cellHasFocus);
+ Icon icon = (Icon) value;
+ result.setIcon(icon);
+ result.setText("Index = " + index);
+ return result;
+ }
+ }
+
+ private JCheckBox comboState1;
+ private JComboBox combo1;
+ private JComboBox combo2;
+
+ private JCheckBox comboState2;
+ private JComboBox combo3;
+ private JComboBox combo4;
+
+ private JCheckBox comboState3;
+ private JComboBox combo5;
+ private JComboBox combo6;
+
+ private JCheckBox comboState4;
+ private JComboBox combo7;
+ private JComboBox combo8;
+
+ private JCheckBox comboState5;
+ private JComboBox combo9;
+ private JComboBox combo10;
+
+ private JCheckBox comboState6;
+ private JComboBox combo11;
+ private JComboBox combo12;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public ComboBoxDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(6, 1));
+ panel.add(createPanel1());
+ panel.add(createPanel2());
+ panel.add(createPanel3());
+ panel.add(createPanel4());
+ panel.add(createPanel5());
+ panel.add(createPanel6());
+ content.add(panel);
+ return content;
+ }
+
+ private JPanel createPanel1()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState1 = new JCheckBox("Enabled", true);
+ this.comboState1.setActionCommand("COMBO_STATE1");
+ this.comboState1.addActionListener(this);
+ panel.add(this.comboState1, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Regular: "));
+ this.combo1 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+
+ this.combo2 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo2.setEditable(true);
+
+ controlPanel.add(combo1);
+ controlPanel.add(combo2);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel2()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState2 = new JCheckBox("Enabled", true);
+ this.comboState2.setActionCommand("COMBO_STATE2");
+ this.comboState2.addActionListener(this);
+ panel.add(this.comboState2, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Large Font: "));
+ this.combo3 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo3.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ this.combo4 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo4.setEditable(true);
+ this.combo4.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ controlPanel.add(combo3);
+ controlPanel.add(combo4);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel3()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState3 = new JCheckBox("Enabled", true);
+ this.comboState3.setActionCommand("COMBO_STATE3");
+ this.comboState3.addActionListener(this);
+ panel.add(this.comboState3, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Colored Background: "));
+ this.combo5 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo5.setBackground(Color.yellow);
+
+ this.combo6 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo6.setEditable(true);
+ this.combo6.setBackground(Color.yellow);
+
+ controlPanel.add(combo5);
+ controlPanel.add(combo6);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes that are empty.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel4()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState4 = new JCheckBox("Enabled", true);
+ this.comboState4.setActionCommand("COMBO_STATE4");
+ this.comboState4.addActionListener(this);
+ panel.add(this.comboState4, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Empty: "));
+ this.combo7 = new JComboBox();
+ this.combo8 = new JComboBox();
+ this.combo8.setEditable(true);
+
+ controlPanel.add(combo7);
+ controlPanel.add(combo8);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes that are narrow but contain long text
+ * items.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel5()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState5 = new JCheckBox("Enabled", true);
+ this.comboState5.setActionCommand("COMBO_STATE5");
+ this.comboState5.addActionListener(this);
+ panel.add(this.comboState5, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Narrow: "));
+ this.combo9 = new JComboBox(new Object[] {
+ "A really long item that will be truncated when displayed"});
+ this.combo9.setPreferredSize(new Dimension(100, 30));
+ this.combo10 = new JComboBox(new Object[] {
+ "A really long item that will be truncated when displayed"});
+ this.combo10.setPreferredSize(new Dimension(100, 30));
+ this.combo10.setEditable(true);
+
+ controlPanel.add(combo9);
+ controlPanel.add(combo10);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes with a custom renderer.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel6()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState6 = new JCheckBox("Enabled", true);
+ this.comboState6.setActionCommand("COMBO_STATE6");
+ this.comboState6.addActionListener(this);
+ panel.add(this.comboState6, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Custom Renderer: "));
+ this.combo11 = new JComboBox(new Object[] {
+ MetalIconFactory.getFileChooserHomeFolderIcon(),
+ MetalIconFactory.getFileChooserNewFolderIcon()});
+ this.combo11.setPreferredSize(new Dimension(100, 30));
+ this.combo11.setRenderer(new CustomCellRenderer());
+ this.combo12 = new JComboBox(new Object[] {
+ MetalIconFactory.getFileChooserHomeFolderIcon(),
+ MetalIconFactory.getFileChooserNewFolderIcon()});
+ this.combo12.setPreferredSize(new Dimension(100, 30));
+ this.combo12.setRenderer(new CustomCellRenderer());
+ this.combo12.setEditable(true);
+
+ controlPanel.add(combo11);
+ controlPanel.add(combo12);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("COMBO_STATE1"))
+ {
+ combo1.setEnabled(comboState1.isSelected());
+ combo2.setEnabled(comboState1.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE2"))
+ {
+ combo3.setEnabled(comboState2.isSelected());
+ combo4.setEnabled(comboState2.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE3"))
+ {
+ combo5.setEnabled(comboState3.isSelected());
+ combo6.setEnabled(comboState3.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE4"))
+ {
+ combo7.setEnabled(comboState4.isSelected());
+ combo8.setEnabled(comboState4.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE5"))
+ {
+ combo9.setEnabled(comboState5.isSelected());
+ combo10.setEnabled(comboState5.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE6"))
+ {
+ combo11.setEnabled(comboState6.isSelected());
+ combo12.setEnabled(comboState6.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ ComboBoxDemo app = new ComboBoxDemo("ComboBox Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
index e8c428b5963..549a42e4b99 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
@@ -24,20 +24,16 @@ package gnu.classpath.examples.swing;
import java.awt.*;
import java.awt.event.*;
-import java.awt.font.*;
-import java.awt.geom.*;
-import java.awt.image.*;
import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.tree.*;
import javax.swing.border.*;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.OceanTheme;
+
import java.net.URL;
-import java.util.*;
public class Demo
{
@@ -51,26 +47,44 @@ public class Demo
if (System.getProperty("swing.defaultlaf") == null)
{
StringBuffer text = new StringBuffer();
- text.append("\tYou may change the Look and Feel of this\n");
- text.append("\tDemo by setting the system property\n");
- text.append("\t-Dswing.defaultlaf=<LAFClassName>\n\n");
- text.append("\tPossible values for <LAFClassName> are:\n");
- text.append("\t * javax.swing.plaf.metal.MetalLookAndFeel\n");
- text.append("\t\tthe default Java L&F\n");
- text.append("\t * gnu.classpath.examples.swing.GNULookAndFeel\n");
- text.append("\tthe GNU Look and Feel\n");
- text.append("\t(derived from javax.swing.plaf.basic.BasicLookAndFeel\n\n");
- text.append("\tthe default is gnu.classpath.examples.swing.GNULookAndFeel\n");
- JEditorPane textPane = new JEditorPane();
- // temporary hack, preferred size should be computed by the
- // component
- textPane.setPreferredSize(new Dimension(400, 300));
- textPane.setText(text.toString());
- JOptionPane.showMessageDialog(null, textPane,
- "Look and Feel notice",
- JOptionPane.INFORMATION_MESSAGE);
-
- UIManager.setLookAndFeel(new GNULookAndFeel());
+ text.append("You may change the Look and Feel of this\n");
+ text.append("Demo by setting the system property\n");
+ text.append("-Dswing.defaultlaf=<LAFClassName>\n");
+ text.append("\n");
+ text.append("Possible values for <LAFClassName> are:\n");
+ text.append("\n");
+ text.append("* javax.swing.plaf.metal.MetalLookAndFeel\n");
+ text.append(" the default GNU Classpath L&F\n");
+ text.append("\n");
+ text.append("* gnu.classpath.examples.swing.GNULookAndFeel\n");
+ text.append(" the GNU Look and Feel\n");
+ text.append(" (derived from javax.swing.plaf.basic.BasicLookAndFeel)\n");
+ text.append("\n");
+ text.append("MetalLookAndFeel supports different Themes.\n");
+ text.append("DefaultMetalTheme (the default) and OceanTheme (in development)\n");
+
+ final String DEFAULT = "MetalLookAndFeel (default)";
+ final String OCEAN = "MetalLookAndFeel (Ocean)";
+ final String GNU = "GNULookAndFeel";
+ final String[] lafs = new String[] { DEFAULT, OCEAN, GNU };
+
+ int laf = JOptionPane.showOptionDialog(null, text /* textPane */,
+ "Look and Feel choice",
+ JOptionPane.OK_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null, lafs, DEFAULT);
+ if (laf == 0)
+ {
+ MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ if (laf == 1)
+ {
+ MetalLookAndFeel.setCurrentTheme(new OceanTheme());
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ else if (laf == 2)
+ UIManager.setLookAndFeel(new GNULookAndFeel());
}
}
catch (UnsupportedLookAndFeelException e)
@@ -147,10 +161,7 @@ public class Demo
JMenu examples = new JMenu("Examples");
new PopUpAction("Buttons",
- mkPanel(new JComponent[]
- {mkBigButton("mango"),
- mkBigButton("guava"),
- mkBigButton("lemon")}),
+ (new ButtonDemo("Button Demo")).createContent(),
examples);
new PopUpAction("Toggles",
@@ -166,9 +177,13 @@ public class Demo
examples);
new PopUpAction("Slider",
- mkSliders(),
+ (new SliderDemo("Slider Demo")).createContent(),
examples);
+ new PopUpAction("ProgressBar",
+ ProgressBarDemo.createContent(),
+ examples);
+
new PopUpAction("List",
mkListPanel(new String[] { "hello",
"this",
@@ -181,7 +196,7 @@ public class Demo
examples);
new PopUpAction("Scrollbar",
- mkScrollBar(),
+ (new ScrollBarDemo("ScrollBarDemo")).createContent(),
examples);
new PopUpAction("Viewport",
@@ -189,8 +204,8 @@ public class Demo
examples);
new PopUpAction("ScrollPane",
- mkScrollPane(mkBigButton("Scroll Me!")),
- examples);
+ mkScrollPane(mkBigButton("Scroll Me!")),
+ examples);
new PopUpAction("TabPane",
mkTabs(new String[] {"happy",
@@ -203,19 +218,19 @@ public class Demo
examples);
new PopUpAction("TextField",
- mkTextField("Hello, World!"),
+ (new TextFieldDemo("TextField Demo")).createContent(),
examples);
+ new PopUpAction("FileChooser",
+ (new FileChooserDemo("FileChooser Demo")).createContent(),
+ examples);
+
new PopUpAction("ColorChooser",
mkColorChooser(),
examples);
new PopUpAction("ComboBox",
- mkComboBox(new String[] {"Stop",
- "Software",
- "Hoarders",
- "Support",
- "GNU!"}),
+ (new ComboBoxDemo("ComboBox Demo")).createContent(),
examples);
new PopUpAction("Editor",
@@ -317,6 +332,7 @@ public class Demo
else
b = new JButton(title, icon);
+ b.setToolTipText(title);
if (hAlign != -1) b.setHorizontalAlignment(hAlign);
if (vAlign != -1) b.setVerticalAlignment(vAlign);
if (hPos != -1) b.setHorizontalTextPosition(hPos);
@@ -640,6 +656,14 @@ public class Demo
panel.add(but, BorderLayout.NORTH);
but.doClick();
but.doClick();
+ JInternalFrame palette = new JInternalFrame("Palette", true, true, true,
+ true);
+ palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
+ desk.add(palette, JDesktopPane.PALETTE_LAYER);
+ JLabel label = new JLabel("This is a floating palette!");
+ palette.getContentPane().add(label);
+ palette.pack();
+ palette.setVisible(true);
return panel;
}
@@ -678,26 +702,6 @@ public class Demo
return tabs;
}
- static JComponent mkSliders()
- {
- JSlider slider = new JSlider();
- slider.setPaintTrack(true);
- slider.setPaintTicks(true);
- slider.setMajorTickSpacing(30);
- slider.setMinorTickSpacing(5);
- slider.setPaintLabels(true);
- slider.setInverted(false);
- JProgressBar progress = new JProgressBar();
- BoundedRangeModel model = new DefaultBoundedRangeModel(10, 1, 0, 100);
- progress.setModel(model);
- slider.setModel(model);
- JPanel panel = new JPanel();
- panel.setLayout(new GridLayout(1, 2));
- panel.add(slider);
- panel.add(progress);
- return panel;
- }
-
public Demo()
{
frame = new JFrame("Swing Activity Board");
@@ -735,11 +739,17 @@ public class Demo
return c;
}
- public static JRadioButton mkRadio(String label)
+ public static JPanel mkRadio(String label)
{
+ JPanel p = new JPanel();
JRadioButton c = new JRadioButton(label);
- c.setFont(new Font("Luxi", Font.PLAIN, 14));
- return c;
+ JRadioButton d = new JRadioButton("not " + label);
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(c);
+ bg.add(d);
+ p.add(c);
+ p.add(d);
+ return p;
}
public static JList mkList(Object[] elts)
@@ -1002,31 +1012,34 @@ public class Demo
private JPanel mkButtonBar()
{
- JPanel panel = new JPanel ();
- panel.setLayout(new FlowLayout());
+ JPanel panel = new JPanel (new GridLayout(2, 1));
+ JPanel panelA = new JPanel(new FlowLayout());
+ JPanel panelB = new JPanel(new FlowLayout());
new PopUpAction("Buttons",
- mkPanel(new JComponent[]
- {mkBigButton("mango"),
- mkBigButton("guava"),
- mkBigButton("lemon")}),
- panel);
+ (new ButtonDemo("Button Demo")).createContent(),
+ panelA);
new PopUpAction("Toggles",
mkToggle("cool and refreshing"),
- panel);
+ panelA);
new PopUpAction("Checkbox",
mkCheckbox("ice cold"),
- panel);
+ panelA);
new PopUpAction("Radio",
mkRadio("delicious"),
- panel);
+ panelA);
new PopUpAction("Slider",
- mkSliders(),
- panel);
+ (new SliderDemo("Slider Demo")).createContent(),
+ panelA);
+
+ new PopUpAction("ProgressBar",
+ ProgressBarDemo.createContent(),
+ panelA);
+
new PopUpAction("List",
mkListPanel(new String[] { "hello",
@@ -1037,60 +1050,60 @@ public class Demo
"that",
"wraps",
"over"}),
- panel);
+ panelA);
new PopUpAction("Scrollbar",
- mkScrollBar(),
- panel);
+ (new ScrollBarDemo("ScrollBar Demo")).createContent(),
+ panelA);
new PopUpAction("Viewport",
mkViewportBox(mkBigButton("View Me!")),
- panel);
+ panelA);
new PopUpAction("ScrollPane",
mkScrollPane(mkBigButton("Scroll Me!")),
- panel);
+ panelA);
new PopUpAction("TabPane",
mkTabs(new String[] {"happy",
"sad",
"indifferent"}),
- panel);
+ panelB);
new PopUpAction("Spinner",
mkSpinner(),
- panel);
+ panelB);
new PopUpAction("TextField",
- mkTextField("Hello, World!"),
- panel);
+ (new TextFieldDemo("TextField Demo")).createContent(),
+ panelB);
+
+ new PopUpAction("FileChooser",
+ (new FileChooserDemo("FileChooser Demo")).createContent(),
+ panelB);
new PopUpAction("ColorChooser",
mkColorChooser(),
- panel);
+ panelB);
new PopUpAction("ComboBox",
- mkComboBox(new String[] {"Stop",
- "Software",
- "Hoarders",
- "Support",
- "GNU!"}),
- panel);
+ (new ComboBoxDemo("ComboBox Demo")).createContent(),
+ panelB);
new PopUpAction("Editor",
mkEditorPane(),
- panel);
+ panelB);
new PopUpAction("Tree",
mkTree(),
- panel);
+ panelB);
new PopUpAction("Table",
mkTable(),
- panel);
+ panelB);
JButton exitDisposer = mkDisposerButton(frame);
- panel.add(exitDisposer);
+ panelB.add(exitDisposer);
exitDisposer.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -1098,11 +1111,8 @@ public class Demo
System.exit(1);
}
});
+ panel.add(panelA);
+ panel.add(panelB);
return panel;
}
-
- public static JTextField mkTextField(String sometext)
- {
- return new JTextField(sometext, 40);
- }
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java
new file mode 100644
index 00000000000..70bb56d66cf
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java
@@ -0,0 +1,228 @@
+/* FileChooserDemo.java -- An example showing file choosers in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * A simple demo showing the {@link JFileChooser} component used in different
+ * ways.
+ */
+public class FileChooserDemo extends JFrame implements ActionListener
+{
+ /**
+ * A file filter for Java source files.
+ */
+ static class JavaFileFilter extends FileFilter
+ {
+ public String getDescription()
+ {
+ return "Java Source Files (.java)";
+ }
+ public boolean accept(File f)
+ {
+ if (f != null)
+ {
+ return f.getName().endsWith(".java") || f.isDirectory();
+ }
+ else
+ return false;
+ }
+ }
+
+ /** A label to display the selected file. */
+ JLabel selectedFileLabel;
+
+ /**
+ * A list showing the selected files (where multi selections are
+ * allowed).
+ */
+ JList selectedFilesList;
+
+ /** A label to display the return code for the JFileChooser. */
+ JLabel returnCodeLabel;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param frameTitle the frame title.
+ */
+ public FileChooserDemo(String frameTitle)
+ {
+ super(frameTitle);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ // create a panel of buttons to select the different styles of file
+ // chooser...
+ JPanel buttonPanel = new JPanel(new GridLayout(5, 1));
+ JButton openButton = new JButton("Open...");
+ openButton.setActionCommand("OPEN");
+ openButton.addActionListener(this);
+ buttonPanel.add(openButton);
+ JButton saveButton = new JButton("Save...");
+ saveButton.setActionCommand("SAVE");
+ saveButton.addActionListener(this);
+ buttonPanel.add(saveButton);
+ JButton queryButton = new JButton("Select Directory...");
+ queryButton.setActionCommand("SELECT_DIRECTORY");
+ queryButton.addActionListener(this);
+ buttonPanel.add(queryButton);
+ JButton openJavaButton = new JButton("Open Java file...");
+ openJavaButton.setActionCommand("OPEN_JAVA");
+ openJavaButton.addActionListener(this);
+ buttonPanel.add(openJavaButton);
+ JButton openMultiButton = new JButton("Open multiple files...");
+ openMultiButton.setActionCommand("OPEN_MULTI");
+ openMultiButton.addActionListener(this);
+ buttonPanel.add(openMultiButton);
+ panel.add(buttonPanel, BorderLayout.WEST);
+
+ // create a panel to display the selected file(s) and the return code
+ JPanel displayPanel = new JPanel(new BorderLayout());
+
+ selectedFileLabel = new JLabel("-");
+ selectedFileLabel.setBorder(BorderFactory.createTitledBorder("Selected File/Directory: "));
+ displayPanel.add(selectedFileLabel, BorderLayout.NORTH);
+
+ selectedFilesList = new JList();
+ JScrollPane sp = new JScrollPane(selectedFilesList);
+ sp.setBorder(BorderFactory.createTitledBorder("Selected Files: "));
+ displayPanel.add(sp);
+
+ returnCodeLabel = new JLabel("0");
+ returnCodeLabel.setBorder(BorderFactory.createTitledBorder("Return Code:"));
+ displayPanel.add(returnCodeLabel, BorderLayout.SOUTH);
+
+ panel.add(displayPanel);
+ return panel;
+ }
+
+ /**
+ * When the user clicks on a button, launch the appropriate file chooser
+ * and report the results.
+ *
+ * @param e the event.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ int option = 0;
+ File selectedFile = null;
+ File[] selectedFiles = new File[0];
+
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("OPEN"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("OPEN_MULTI"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setMultiSelectionEnabled(true);
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("OPEN_JAVA"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setFileFilter(new JavaFileFilter());
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("SAVE"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ option = chooser.showSaveDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("SELECT_DIRECTORY"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ option = chooser.showDialog(this, "Select");
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+
+ // display the selection and return code
+ if (selectedFile != null)
+ selectedFileLabel.setText(selectedFile.toString());
+ else
+ selectedFileLabel.setText("null");
+ DefaultListModel listModel = new DefaultListModel();
+ for (int i = 0; i < selectedFiles.length; i++)
+ listModel.addElement(selectedFiles[i]);
+ selectedFilesList.setModel(listModel);
+ returnCodeLabel.setText(Integer.toString(option));
+ }
+
+ public static void main(String[] args)
+ {
+ FileChooserDemo app = new FileChooserDemo("File Chooser Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java b/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java
index 97e91a89f3f..c8fd09d744c 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java
@@ -22,8 +22,13 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
package gnu.classpath.examples.swing;
import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import javax.swing.Icon;
import javax.swing.ImageIcon;
+import javax.swing.JCheckBox;
+import javax.swing.JRadioButton;
import javax.swing.UIDefaults;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.IconUIResource;
@@ -64,8 +69,10 @@ public class GNULookAndFeel extends BasicLookAndFeel
"MenuBar.background", new ColorUIResource(blueGray),
"MenuItem.background", new ColorUIResource(blueGray),
"ScrollBar.background", new ColorUIResource(blueGray),
-
- "Tree.closedIcon",
+ "CheckBox.icon", new CheckBoxIcon(),
+ "RadioButton.icon", new RadioButtonIcon(),
+
+ "Tree.closedIcon",
new IconUIResource(new ImageIcon
(getClass().getResource
(iconspath + "TreeClosed.png"))),
@@ -82,4 +89,177 @@ public class GNULookAndFeel extends BasicLookAndFeel
}
return LAF_defaults;
}
+
+ /**
+ * The icon used for CheckBoxes in the BasicLookAndFeel. This is an empty
+ * icon with a size of 13x13 pixels.
+ */
+ static class CheckBoxIcon
+ implements Icon
+ {
+ /**
+ * Returns the height of the icon. The BasicLookAndFeel CheckBox icon
+ * has a height of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ /**
+ * Returns the width of the icon. The BasicLookAndFeel CheckBox icon
+ * has a width of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. The BasicLookAndFeel CheckBox icon is empty and does
+ * not need to be painted.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color save = g.getColor();
+ g.setColor(c.getForeground());
+ g.drawRect(x, y, getIconWidth(), getIconHeight());
+
+ JCheckBox item = (JCheckBox) c;
+ if (item.isSelected())
+ {
+ g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
+ g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
+ g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
+ g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
+ }
+
+ g.setColor(save);
+ }
+ }
+
+ /**
+ * The icon used for RadioButtons in the GNULookAndFeel. This is an empty
+ * icon with a size of 13x13 pixels.
+ */
+ static class RadioButtonIcon
+ implements Icon
+ {
+ /**
+ * Returns the height of the icon. The GNULookAndFeel RadioButton icon
+ * has a height of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ /**
+ * Returns the width of the icon. The GNULookAndFeel RadioButton icon
+ * has a width of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. The GNULookAndFeel RadioButton icon is empty and does
+ * not need to be painted.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ JRadioButton b = (JRadioButton) c;
+
+ // draw outer circle
+ if (b.isEnabled())
+ g.setColor(Color.GRAY);
+ else
+ g.setColor(Color.GRAY);
+ g.drawLine(x + 2, y + 1, x + 3, y + 1);
+ g.drawLine(x + 4, y, x + 7, y);
+ g.drawLine(x + 8, y + 1, x + 9, y + 1);
+ g.drawLine(x + 10, y + 2, x + 10, y + 3);
+ g.drawLine(x + 11, y + 4, x + 11, y + 7);
+ g.drawLine(x + 10, y + 8, x + 10, y + 9);
+ g.drawLine(x + 8, y + 10, x + 9, y + 10);
+ g.drawLine(x + 4, y + 11, x + 7, y + 11);
+ g.drawLine(x + 2, y + 10, x + 3, y + 10);
+ g.drawLine(x + 1, y + 9, x + 1, y + 8);
+ g.drawLine(x, y + 7, x, y + 4);
+ g.drawLine(x + 1, y + 2, x + 1, y + 3);
+
+ if (b.getModel().isArmed())
+ {
+ g.setColor(Color.GRAY);
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 4, y + 10, x + 7, y + 10);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 10, y + 4, x + 10, y + 7);
+ g.fillRect(x + 2, y + 2, 8, 8);
+ }
+ else
+ {
+ // only draw inner highlight if not filled
+ if (b.isEnabled())
+ {
+ g.setColor(Color.WHITE);
+
+ g.drawLine(x + 2, y + 8, x + 2, y + 9);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 3);
+ g.drawLine(x + 3, y + 2, x + 3, y + 2);
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 8, y + 2, x + 9, y + 2);
+ }
+ }
+
+ // draw outer highlight
+ if (b.isEnabled())
+ {
+ g.setColor(Color.WHITE);
+
+ // outer
+ g.drawLine(x + 10, y + 1, x + 10, y + 1);
+ g.drawLine(x + 11, y + 2, x + 11, y + 3);
+ g.drawLine(x + 12, y + 4, x + 12, y + 7);
+ g.drawLine(x + 11, y + 8, x + 11, y + 9);
+ g.drawLine(x + 10, y + 10, x + 10, y + 10);
+ g.drawLine(x + 8, y + 11, x + 9, y + 11);
+ g.drawLine(x + 4, y + 12, x + 7, y + 12);
+ g.drawLine(x + 2, y + 11, x + 3, y + 11);
+ }
+
+ if (b.isSelected())
+ {
+ if (b.isEnabled())
+ g.setColor(Color.BLACK);
+ else
+ g.setColor(Color.GRAY);
+ g.drawLine(x + 4, y + 3, x + 7, y + 3);
+ g.fillRect(x + 3, y + 4, 6, 4);
+ g.drawLine(x + 4, y + 8, x + 7, y + 8);
+ }
+ g.setColor(savedColor);
+ }
+ }
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java
new file mode 100644
index 00000000000..d62175bcd79
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java
@@ -0,0 +1,219 @@
+/* ProgressBarDemo.java -- A demonstration of JProgressBars
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+public class ProgressBarDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ /**
+ * Creates a new ProgressBarDemo window with the specified title.
+ *
+ * @param title the title of the program window
+ */
+ ProgressBarDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ getContentPane().add(content);
+ getContentPane().add(closePanel, BorderLayout.SOUTH);
+ }
+
+ static JPanel createContent()
+ {
+ JPanel content = new JPanel();
+ content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
+ JPanel horizontalProgressBar = createHorizontalProgressBar();
+ content.add(horizontalProgressBar);
+ content.add(Box.createVerticalStrut(10));
+ JPanel verticalProgressBar = createVerticalProgressBar();
+ content.add(verticalProgressBar);
+ return content;
+ }
+
+ private static JPanel createHorizontalProgressBar()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+
+ // Plain progress bar.
+ final JProgressBar hor1 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ panel.add(hor1);
+ final JSlider slider1 = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
+ slider1.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ hor1.setValue(slider1.getValue());
+ }
+ });
+ panel.add(slider1);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Plain progress bar with some text.
+ final JProgressBar hor2 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor2.setString("ProgressBar Demo");
+ hor2.setStringPainted(true);
+ panel.add(hor2);
+ final JSlider slider2 = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
+ slider2.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ hor2.setValue(slider2.getValue());
+ }
+ });
+ panel.add(slider2);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Indeterminate progress bar.
+ final JProgressBar hor3 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor3.setIndeterminate(true);
+ panel.add(hor3);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Indeterminate progress bar with text.
+ final JProgressBar hor4 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor4.setIndeterminate(true);
+ hor4.setString("Indeterminate ProgressBar");
+ hor4.setStringPainted(true);
+ panel.add(hor4);
+
+ return panel;
+ }
+
+ private static JPanel createVerticalProgressBar()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ final JProgressBar vert = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ panel.add(vert);
+ final JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0);
+ slider.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ vert.setValue(slider.getValue());
+ }
+ });
+ panel.add(slider);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ final JProgressBar vert2 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert2.setString("ProgressBar Demo");
+ panel.add(vert2);
+ vert2.setStringPainted(true);
+ final JSlider slider2 = new JSlider(JSlider.VERTICAL, 0, 100, 0);
+ slider2.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ vert2.setValue(slider2.getValue());
+ }
+ });
+ panel.add(slider2);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ // Indeterminate progress bar.
+ final JProgressBar vert3 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert3.setIndeterminate(true);
+ panel.add(vert3);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ // Indeterminate progress bar with text.
+ final JProgressBar vert4 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert4.setIndeterminate(true);
+ vert4.setString("Indeterminate ProgressBar");
+ vert4.setStringPainted(true);
+ panel.add(vert4);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * The entry point when running as a standalone program.
+ *
+ * @param args command line arguments
+ */
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater(
+ new Runnable()
+ {
+ public void run()
+ {
+ ProgressBarDemo app = new ProgressBarDemo("ProgressBar Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+ });
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java
new file mode 100644
index 00000000000..fce137301d7
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java
@@ -0,0 +1,141 @@
+/* ScrollBarDemo.java -- An example showing scroll bars in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+
+/**
+ * A simple scroll bar demo showing various scroll bars in different states.
+ */
+public class ScrollBarDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public ScrollBarDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = createScrollBarPanel();
+ content.add(panel);
+ return content;
+ }
+
+ private JPanel createScrollBarPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ JPanel horizontalPanel = new JPanel();
+
+ JScrollBar scroll1a = new JScrollBar(JScrollBar.HORIZONTAL);
+ JScrollBar scroll1b = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1b.setEnabled(false);
+ JScrollBar scroll1c = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1c.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ JScrollBar scroll1d = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1d.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ scroll1d.setEnabled(false);
+ horizontalPanel.add(scroll1a);
+ horizontalPanel.add(scroll1b);
+ horizontalPanel.add(scroll1c);
+ horizontalPanel.add(scroll1d);
+
+ panel.add(horizontalPanel, BorderLayout.NORTH);
+
+ JPanel verticalPanel = new JPanel();
+ verticalPanel.setLayout(new GridLayout(1, 7));
+
+ JScrollBar scroll2a = new JScrollBar(JScrollBar.VERTICAL);
+ JScrollBar scroll2b = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2b.setEnabled(false);
+ JScrollBar scroll2c = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2c.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ JScrollBar scroll2d = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2d.setEnabled(false);
+ scroll2d.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+
+ verticalPanel.add(scroll2a);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2b);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2c);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2d);
+
+ panel.add(verticalPanel, BorderLayout.EAST);
+
+ JPanel centerPanel = new JPanel(new GridLayout(1, 2));
+ centerPanel.add(new JScrollBar(JScrollBar.HORIZONTAL));
+ centerPanel.add(new JScrollBar(JScrollBar.VERTICAL));
+ panel.add(centerPanel);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ ScrollBarDemo app = new ScrollBarDemo("ScrollBar Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java
new file mode 100644
index 00000000000..736024c48da
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java
@@ -0,0 +1,249 @@
+/* SliderDemo.java -- An example showing JSlider in various configurations.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+
+public class SliderDemo extends JFrame implements ActionListener
+{
+
+ JSlider hslider1;
+ JSlider hslider2;
+ JSlider hslider3;
+ JSlider hslider4;
+ JSlider hslider5;
+ JSlider hslider6;
+ JSlider hslider7;
+ JSlider hslider8;
+
+ JSlider vslider1;
+ JSlider vslider2;
+ JSlider vslider3;
+ JSlider vslider4;
+ JSlider vslider5;
+ JSlider vslider6;
+ JSlider vslider7;
+ JSlider vslider8;
+
+ JCheckBox enabledCheckBox;
+
+ public SliderDemo(String frameTitle)
+ {
+ super(frameTitle);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(1, 2));
+ panel.add(createHorizontalPanel());
+ panel.add(createVerticalPanel());
+ enabledCheckBox = new JCheckBox("Enabled");
+ enabledCheckBox.setSelected(true);
+ enabledCheckBox.setActionCommand("TOGGLE_ENABLED");
+ enabledCheckBox.addActionListener(this);
+ JPanel checkBoxPanel = new JPanel();
+ checkBoxPanel.add(enabledCheckBox);
+ JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(panel);
+ panel2.add(checkBoxPanel, BorderLayout.SOUTH);
+ content.add(panel2);
+ return content;
+ }
+
+ private JPanel createHorizontalPanel()
+ {
+ JPanel panel = new JPanel(new GridLayout(8, 1));
+
+ hslider1 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ panel.add(hslider1);
+
+ hslider2 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider2.setMajorTickSpacing(20);
+ hslider2.setMinorTickSpacing(5);
+ hslider2.setPaintTicks(true);
+ panel.add(hslider2);
+
+ hslider3 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider3.setMajorTickSpacing(20);
+ hslider3.setMinorTickSpacing(5);
+ hslider3.setPaintLabels(true);
+ hslider3.setPaintTicks(true);
+ panel.add(hslider3);
+
+ hslider4 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider4.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ hslider4.setMajorTickSpacing(20);
+ hslider4.setMinorTickSpacing(5);
+ hslider4.setPaintLabels(true);
+ hslider4.setPaintTicks(true);
+ panel.add(hslider4);
+
+ hslider5 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider5.setInverted(true);
+ panel.add(hslider5);
+
+ hslider6 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider6.setInverted(true);
+ hslider6.setMajorTickSpacing(20);
+ hslider6.setMinorTickSpacing(5);
+ hslider6.setPaintTicks(true);
+ panel.add(hslider6);
+
+ hslider7 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider7.setInverted(true);
+ hslider7.setMajorTickSpacing(20);
+ hslider7.setMinorTickSpacing(5);
+ hslider7.setPaintLabels(true);
+ hslider7.setPaintTicks(true);
+ panel.add(hslider7);
+
+ hslider8 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider8.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ hslider8.setInverted(true);
+ hslider8.setMajorTickSpacing(20);
+ hslider8.setMinorTickSpacing(5);
+ hslider8.setPaintLabels(true);
+ hslider8.setPaintTicks(true);
+ panel.add(hslider8);
+
+ return panel;
+ }
+
+ private JPanel createVerticalPanel()
+ {
+ JPanel panel = new JPanel(new GridLayout(1, 8));
+
+ vslider1 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ panel.add(vslider1);
+
+ vslider2 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider2.setMajorTickSpacing(20);
+ vslider2.setMinorTickSpacing(5);
+ vslider2.setPaintTicks(true);
+ panel.add(vslider2);
+
+ vslider3 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider3.setMajorTickSpacing(20);
+ vslider3.setMinorTickSpacing(5);
+ vslider3.setPaintLabels(true);
+ vslider3.setPaintTicks(true);
+ panel.add(vslider3);
+
+ vslider4 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider4.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ vslider4.setMajorTickSpacing(20);
+ vslider4.setMinorTickSpacing(5);
+ vslider4.setPaintLabels(true);
+ vslider4.setPaintTicks(true);
+ panel.add(vslider4);
+
+ vslider5 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider5.setInverted(true);
+ panel.add(vslider5);
+
+ vslider6 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider6.setInverted(true);
+ vslider6.setMajorTickSpacing(20);
+ vslider6.setMinorTickSpacing(5);
+ vslider6.setPaintTicks(true);
+ panel.add(vslider6);
+
+ vslider7 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider7.setInverted(true);
+ vslider7.setMajorTickSpacing(20);
+ vslider7.setMinorTickSpacing(5);
+ vslider7.setPaintLabels(true);
+ vslider7.setPaintTicks(true);
+ panel.add(vslider7);
+
+ vslider8 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider8.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ vslider8.setInverted(true);
+ vslider8.setMajorTickSpacing(20);
+ vslider8.setMinorTickSpacing(5);
+ vslider8.setPaintLabels(true);
+ vslider8.setPaintTicks(true);
+ panel.add(vslider8);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("TOGGLE_ENABLED"))
+ {
+ boolean enabled = enabledCheckBox.isSelected();
+ hslider1.setEnabled(enabled);
+ hslider2.setEnabled(enabled);
+ hslider3.setEnabled(enabled);
+ hslider4.setEnabled(enabled);
+ hslider5.setEnabled(enabled);
+ hslider6.setEnabled(enabled);
+ hslider7.setEnabled(enabled);
+ hslider8.setEnabled(enabled);
+ vslider1.setEnabled(enabled);
+ vslider2.setEnabled(enabled);
+ vslider3.setEnabled(enabled);
+ vslider4.setEnabled(enabled);
+ vslider5.setEnabled(enabled);
+ vslider6.setEnabled(enabled);
+ vslider7.setEnabled(enabled);
+ vslider8.setEnabled(enabled);
+ }
+ }
+ public static void main(String[] args)
+ {
+ SliderDemo app = new SliderDemo("Slider Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java
new file mode 100644
index 00000000000..5ddf1168061
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java
@@ -0,0 +1,488 @@
+/* TextFieldDemo.java -- An example showing various textfields in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultCaret;
+import javax.swing.text.JTextComponent;
+
+/**
+ * A simple textfield demo showing various textfields in different states.
+ */
+public class TextFieldDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ /**
+ * A custom caret for demonstration purposes. This class is inspired by the
+ * CornerCaret from the OReilly Swing book.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ static class CornerCaret extends DefaultCaret
+ {
+ public CornerCaret()
+ {
+ super();
+ setBlinkRate(500);
+ }
+
+ protected synchronized void damage(Rectangle r)
+ {
+ if (r == null) return;
+ x = r.x;
+ y = r.y + (r.height * 4 / 5 - 3);
+ width = 5;
+ height = 5;
+ repaint();
+ }
+
+ public void paint(Graphics g)
+ {
+ JTextComponent comp = getComponent();
+ if (comp == null) return;
+ int dot = getDot();
+ Rectangle r = null;
+ try
+ {
+ r = comp.modelToView(dot);
+ }
+ catch (BadLocationException e)
+ {
+ return;
+ }
+ if (r == null) return;
+ int dist = r.height * 4 / 5 - 3;
+ if ((x != r.x) || (y != r.y + dist))
+ {
+ repaint();
+ x = r.x;
+ y = r.y + dist;
+ width = 5;
+ height = 5;
+ }
+ if (isVisible())
+ {
+ g.drawLine(r.x, r.y + dist, r.x, r.y + dist + 4);
+ g.drawLine(r.x, r.y + dist + 4, r.x + 4, r.y + dist + 4);
+ }
+ }
+ }
+
+ /**
+ * The left aligned textfields and state buttons.
+ */
+ JTextField textfield1;
+ JTextField textfield2;
+ JTextField textfield3;
+ JCheckBox enabled1;
+ JCheckBox editable1;
+JPanel textFieldPanel1;
+ /**
+ * The right aligned textfields and state buttons.
+ */
+ JTextField textfield4;
+ JTextField textfield5;
+ JTextField textfield6;
+ JCheckBox enabled2;
+ JCheckBox editable2;
+
+ /**
+ * The centered textfields and state buttons.
+ */
+ JTextField textfield7;
+ JTextField textfield8;
+ JTextField textfield9;
+ JCheckBox enabled3;
+ JCheckBox editable3;
+
+ /**
+ * The custom colored textfields and state buttons.
+ */
+ JTextField textfield10;
+ JTextField textfield11;
+ JTextField textfield12;
+ JTextField textfield13;
+ JTextField textfield14;
+ JCheckBox enabled4;
+ JCheckBox editable4;
+
+ /**
+ * Some miscallenous textfield demos.
+ */
+ JTextField textfield15;
+ JTextField textfield16;
+ JCheckBox enabled5;
+ JCheckBox editable5;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public TextFieldDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(5, 1));
+ panel.add(createLeftAlignedPanel());
+ panel.add(createRightAlignedPanel());
+ panel.add(createCenteredPanel());
+ panel.add(createCustomColoredPanel());
+ panel.add(createMiscPanel());
+ content.add(panel);
+ //content.setPreferredSize(new Dimension(400, 300));
+ return content;
+ }
+
+ private JPanel createLeftAlignedPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Left aligned"));
+
+ 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);
+
+ panel.add(textFieldPanel1);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled1 = new JCheckBox("enabled");
+ enabled1.setSelected(true);
+ enabled1.addActionListener(this);
+ enabled1.setActionCommand("ENABLED1");
+ statePanel.add(enabled1);
+ editable1 = new JCheckBox("editable");
+ editable1.setSelected(true);
+ editable1.addActionListener(this);
+ editable1.setActionCommand("EDITABLE1");
+ statePanel.add(editable1);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createRightAlignedPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Right aligned"));
+
+ 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;
+ }
+
+ 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;
+ }
+
+ private JPanel createCustomColoredPanel()
+ {
+ 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);
+
+ textfield11 = new JTextField("custom background");
+ textfield11.setForeground(Color.YELLOW);
+ textFieldPanel.add(textfield11);
+
+ textfield12 = new JTextField("custom disabled textcolor");
+ textfield12.setDisabledTextColor(Color.BLUE);
+ textFieldPanel.add(textfield12);
+
+ 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);
+
+ panel.add(textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled4 = new JCheckBox("enabled");
+ enabled4.setSelected(true);
+ enabled4.addActionListener(this);
+ enabled4.setActionCommand("ENABLED4");
+ statePanel.add(enabled4);
+ editable4 = new JCheckBox("editable");
+ editable4.setSelected(true);
+ editable4.addActionListener(this);
+ editable4.setActionCommand("EDITABLE4");
+ statePanel.add(editable4);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createMiscPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Miscallenous"));
+
+ JPanel textFieldPanel = new JPanel();
+ textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
+
+ textfield15 = new JTextField("Custom Caret");
+ textfield15.setCaret(new CornerCaret());
+ textFieldPanel.add(textfield15);
+
+ textfield16 = new JTextField("Custom Caret color");
+ textfield16.setCaretColor(Color.MAGENTA);
+ textFieldPanel.add(textfield16);
+
+ panel.add(textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled5 = new JCheckBox("enabled");
+ enabled5.setSelected(true);
+ enabled5.addActionListener(this);
+ enabled5.setActionCommand("ENABLED5");
+ statePanel.add(enabled5);
+ editable5 = new JCheckBox("editable");
+ editable5.setSelected(true);
+ editable5.addActionListener(this);
+ editable5.setActionCommand("EDITABLE5");
+ statePanel.add(editable5);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("ENABLED1"))
+ {
+ boolean enabled = enabled1.isSelected();
+ textfield1.setEnabled(enabled);
+ textfield2.setEnabled(enabled);
+ textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE1"))
+ {
+ boolean editable = editable1.isSelected();
+ textfield1.setEditable(editable);
+ textfield2.setEditable(editable);
+ textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED2"))
+ {
+ boolean enabled = enabled2.isSelected();
+ textfield4.setEnabled(enabled);
+ textfield5.setEnabled(enabled);
+ textfield6.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE2"))
+ {
+ boolean editable = editable2.isSelected();
+ textfield4.setEditable(editable);
+ textfield5.setEditable(editable);
+ textfield6.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED3"))
+ {
+ boolean enabled = enabled3.isSelected();
+ textfield7.setEnabled(enabled);
+ textfield8.setEnabled(enabled);
+ textfield9.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE3"))
+ {
+ boolean editable = editable3.isSelected();
+ textfield7.setEditable(editable);
+ textfield8.setEditable(editable);
+ textfield9.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);
+ }
+ 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);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ TextFieldDemo app = new TextFieldDemo("TextField Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/external/Makefile.in b/libjava/classpath/external/Makefile.in
index 45d7baf1421..f0d2a3b0d48 100644
--- a/libjava/classpath/external/Makefile.in
+++ b/libjava/classpath/external/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = external
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -84,10 +82,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -224,6 +226,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -237,6 +240,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/external/sax/Makefile.in b/libjava/classpath/external/sax/Makefile.in
index 22f59a5b608..15c949d2253 100644
--- a/libjava/classpath/external/sax/Makefile.in
+++ b/libjava/classpath/external/sax/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = external/sax
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/external/w3c_dom/Makefile.in b/libjava/classpath/external/w3c_dom/Makefile.in
index 30b1a1d4658..6305a265c5d 100644
--- a/libjava/classpath/external/w3c_dom/Makefile.in
+++ b/libjava/classpath/external/w3c_dom/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = external/w3c_dom
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrInput.java b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
index 69f9c8c5837..866ec2cc945 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
@@ -1,4 +1,4 @@
-/* cdrInput.java --
+/* AbstractCdrInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,16 +39,17 @@ exception statement from your version. */
package gnu.CORBA.CDR;
import gnu.CORBA.BigDecimalHelper;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.GIOP.CharSets_OSF;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import gnu.CORBA.IOR;
-import gnu.CORBA.IOR_Delegate;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.Minor;
import gnu.CORBA.TypeCodeHelper;
import gnu.CORBA.Unexpected;
import gnu.CORBA.Version;
import gnu.CORBA.gnuAny;
-import gnu.CORBA.stubFinder;
+import gnu.CORBA.StubLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.AnySeqHolder;
@@ -81,38 +82,44 @@ import java.io.Serializable;
import java.math.BigDecimal;
/**
- * A simple CORBA CDR (common data representation)
- * input stream, reading data from the
- * given {@link java.io.InputStream}. The primitive types
- * are aligned on they natural boundaries by implementing the
- * abstract method {@link #align(int boundary)}.
- *
- * The same class also implements {@link org.omg.CORBA.DataInputStream} to
- * read the object content in a user defined way.
- *
+ * A simple CORBA CDR (common data representation) input stream, reading data
+ * from the given {@link java.io.InputStream}. The primitive types are aligned
+ * on they natural boundaries by implementing the abstract method
+ * {@link #align(int boundary)}.
+ *
+ * The same class also implements {@link org.omg.CORBA.DataInputStream} to read
+ * the object content in a user defined way.
+ *
+ * TODO This class uses 16 bits per Unicode character only, as it was until jdk
+ * 1.4 inclusive.
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public abstract class cdrInput
+public abstract class AbstractCdrInput
extends org.omg.CORBA_2_3.portable.InputStream
implements org.omg.CORBA.DataInputStream
{
/**
- * The message, explaining that the exception has been thrown due
- * unexpected end of the input stream. This usually happens the
- * server and client disagree on communication or data representation
- * rules.
+ * The runtime, associated with this stream. This field is only used when
+ * reading and writing value types and filled-in in gnu.CORBA.CDR.Vio.
+ */
+ public transient gnuRuntime runtime;
+
+ /**
+ * The message, explaining that the exception has been thrown due unexpected
+ * end of the input stream. This usually happens the server and client
+ * disagree on communication or data representation rules.
*/
protected static final String UNEXP_EOF = "Unexpected end of stream";
/**
- * This instance is used to convert primitive data types into the
- * byte sequences.
+ * This instance is used to convert primitive data types into the byte
+ * sequences.
*/
- protected abstractDataInputStream b;
+ protected AbstractDataInput b;
/**
- * The input stream, from where the data are actually
- * being read.
+ * The input stream, from where the data are actually being read.
*/
protected java.io.InputStream actual_stream;
@@ -129,71 +136,68 @@ public abstract class cdrInput
/**
* The code set information.
*/
- protected cxCodeSet codeset = cxCodeSet.STANDARD;
+ protected CodeSetServiceContext codeset = CodeSetServiceContext.STANDARD;
/**
- * The name of the currently used narrow charset, null if
- * the native narrow charset is used.
+ * The name of the currently used narrow charset, null if the native narrow
+ * charset is used.
*/
private String narrow_charset = null;
/**
- * The name of the currently used wide charset, null if
- * the native wide charset is used.
+ * The name of the currently used wide charset, null if the native wide
+ * charset is used.
*/
private String wide_charset = null;
/**
- * True if the native code set is used for narrow characters.
- * If the set is native, no the intermediate Reader object
- * is instantiated when writing characters.
+ * True if the native code set is used for narrow characters. If the set is
+ * native, no the intermediate Reader object is instantiated when writing
+ * characters.
*/
private boolean narrow_native;
/**
- * True if the native code set is used for wide characters.
- * If the set is native, no the intermediate Reader object
- * is instantiated when writing characters.
+ * True if the native code set is used for wide characters. If the set is
+ * native, no the intermediate Reader object is instantiated when writing
+ * characters.
*/
private boolean wide_native;
/**
- * If true, the stream expect
- * the multi-byte data in the form "less significant byte
- * first" (Little Endian). This is the opposite to the
- * java standard (Big Endian).
+ * If true, the stream expect the multi-byte data in the form "less
+ * significant byte first" (Little Endian). This is the opposite to the java
+ * standard (Big Endian).
*/
private boolean little_endian;
/**
- * Creates the stream. The stream reads Big Endian by
- * default.
- *
+ * Creates the stream. The stream reads Big Endian by default.
+ *
* @param readFrom a stream to read CORBA input from.
*/
- public cdrInput(java.io.InputStream readFrom)
+ public AbstractCdrInput(java.io.InputStream readFrom)
{
setInputStream(readFrom);
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
- * Creates the stream, requiring the subsequent call
- * of {@link #setInputStream(java.io.InputStream)}.
+ * Creates the stream, requiring the subsequent call of
+ * {@link #setInputStream(java.io.InputStream)}.
*/
- public cdrInput()
+ public AbstractCdrInput()
{
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
- * Set the Big Endian or Little Endian encoding.
- * The stream reads Big Endian by default.
- *
- * @param use_little_endian if true, the stream expect
- * the multi-byte data in the form "less significant byte
- * first" (Little Endian). This is the opposite to the
- * java standard (Big Endian).
+ * Set the Big Endian or Little Endian encoding. The stream reads Big Endian
+ * by default.
+ *
+ * @param use_little_endian if true, the stream expect the multi-byte data in
+ * the form "less significant byte first" (Little Endian). This is the
+ * opposite to the java standard (Big Endian).
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -202,8 +206,29 @@ public abstract class cdrInput
}
/**
+ * Get the used encoding.
+ *
+ * @param true for Big Endian, false for Little Endian.
+ */
+ public boolean isBigEndian()
+ {
+ return !little_endian;
+ }
+
+ /**
+ * Clone all important settings to another stream.
+ */
+ public void cloneSettings(AbstractCdrInput stream)
+ {
+ stream.setBigEndian(isBigEndian());
+ stream.setCodeSet(getCodeSet());
+ stream.setVersion(giop);
+ stream.setOrb(orb);
+ }
+
+ /**
* Set the input stream that receives the CORBA input.
- *
+ *
* @param readFrom the stream.
*/
public void setInputStream(java.io.InputStream readFrom)
@@ -217,13 +242,14 @@ public abstract class cdrInput
}
/**
- * Set the alignment offset, if the index of the first byte in the
- * stream is different from 0.
+ * Set the alignment offset, if the index of the first byte in the stream is
+ * different from 0.
*/
public abstract void setOffset(int offset);
/**
* Set the orb, associated with this stream.
+ *
* @param an_orb
*/
public void setOrb(ORB an_orb)
@@ -232,8 +258,8 @@ public abstract class cdrInput
}
/**
- * Set the GIOP version. Some data types are written differently
- * for the different versions. The default version is 1.0 .
+ * Set the GIOP version. Some data types are written differently for the
+ * different versions. The default version is 1.0 .
*/
public void setVersion(Version giop_version)
{
@@ -246,8 +272,8 @@ public abstract class cdrInput
public abstract void align(int boundary);
/**
- * Reads the CORBA unsigned long (java int), returning the
- * value in the sufficiently large java long.
+ * Reads the CORBA unsigned long (java int), returning the value in the
+ * sufficiently large java long.
*/
public long gnu_read_ulong()
{
@@ -260,6 +286,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -270,8 +297,8 @@ public abstract class cdrInput
}
/**
- * Read the unsigned short integer value and return it as java
- * int, sufficiently large to hold all values.
+ * Read the unsigned short integer value and return it as java int,
+ * sufficiently large to hold all values.
*/
public int gnu_read_ushort()
{
@@ -283,6 +310,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -295,6 +323,7 @@ public abstract class cdrInput
/**
* Return the associated {@link ORB}.
+ *
* @return the associated {@link ORB} or null is no such is set.
*/
public ORB orb()
@@ -306,7 +335,7 @@ public abstract class cdrInput
* Read a single byte directly from the buffer.
*/
public int read()
- throws java.io.IOException
+ throws java.io.IOException
{
try
{
@@ -315,6 +344,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -324,7 +354,7 @@ public abstract class cdrInput
* Read bytes directly from the buffer.
*/
public int read(byte[] x, int ofs, int len)
- throws java.io.IOException
+ throws java.io.IOException
{
try
{
@@ -333,6 +363,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -342,7 +373,7 @@ public abstract class cdrInput
* Read bytes directly from the buffer.
*/
public int read(byte[] x)
- throws java.io.IOException
+ throws java.io.IOException
{
try
{
@@ -351,24 +382,25 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
}
/**
- * Read the CORBA object. The object to read is represented in the
- * form of the plain (not a string-encoded) IOR profile without the
- * heading endian indicator. The responsible method for reading such
- * data is {@link IOR.read_no_endian}.
- *
- * The returned object is usually casted into the given type using
- * the .narrow method of its helper, despite in some cases the direct
- * cast would also work.
- *
- * The null objects are recognised from the empty profile set.
- * For such objects, null is returned.
- *
+ * Read the CORBA object. The object to read is represented in the form of the
+ * plain (not a string-encoded) IOR profile without the heading endian
+ * indicator. The responsible method for reading such data is
+ * {@link IOR.read_no_endian}.
+ *
+ * The returned object is usually casted into the given type using the .narrow
+ * method of its helper, despite in some cases the direct cast would also
+ * work.
+ *
+ * The null objects are recognised from the empty profile set. For such
+ * objects, null is returned.
+ *
* @return the loaded and constructed object.
*/
public org.omg.CORBA.Object read_Object()
@@ -384,41 +416,42 @@ public abstract class cdrInput
// Check maybe this is a remote reference to the local object.
// This is only possible if we access the repository of the
// connected object.
- if (orb instanceof Functional_ORB)
+ if (orb instanceof OrbFunctional)
{
- Functional_ORB forb = (Functional_ORB) orb;
+ OrbFunctional forb = (OrbFunctional) orb;
org.omg.CORBA.Object local = forb.find_local_object(ior);
if (local != null)
return local;
}
// Search for the available stubs.
- ObjectImpl impl = stubFinder.search(orb, ior);
+ ObjectImpl impl = StubLocator.search(orb, ior);
try
{
if (impl._get_delegate() == null)
- impl._set_delegate(new IOR_Delegate(orb, ior));
+ impl._set_delegate(new IorDelegate(orb, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception
// in response to the attempt to get the unset delegate.
- impl._set_delegate(new IOR_Delegate(orb, ior));
+ impl._set_delegate(new IorDelegate(orb, ior));
}
return impl;
}
catch (IOException ex)
{
- BAD_OPERATION bad = new BAD_OPERATION();
+ MARSHAL bad = new MARSHAL();
+ bad.minor = Minor.IOR;
bad.initCause(ex);
throw bad;
}
}
/**
- * Read the type code. The type code format is defined in the
- * CORBA documenation.
+ * Read the type code. The type code format is defined in the CORBA
+ * documenation.
*/
public TypeCode read_TypeCode()
{
@@ -438,9 +471,8 @@ public abstract class cdrInput
}
/**
- * Read the CORBA {@link Any}. This method first reads the
- * type code, then delegates the functionality
- * to {@link Any#read_value}.
+ * Read the CORBA {@link Any}. This method first reads the type code, then
+ * delegates the functionality to {@link Any#read_value}.
*/
public Any read_any()
{
@@ -451,8 +483,7 @@ public abstract class cdrInput
}
/**
- * Read the boolean, treating any non zero byte as true,
- * zero byte as false.
+ * Read the boolean, treating any non zero byte as true, zero byte as false.
*/
public boolean read_boolean()
{
@@ -463,6 +494,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -481,12 +513,13 @@ public abstract class cdrInput
{
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.read() == 0 ? false : true;
+ x[i] = b.read() == 0 ? false : true;
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -498,8 +531,8 @@ public abstract class cdrInput
}
/**
- * Read a character using narrow charset encoding. Depending form
- * which encoding is set, this still can be Unicode or ever wider.
+ * Read a character using narrow charset encoding. Depending form which
+ * encoding is set, this still can be Unicode or ever wider.
*/
public char read_char()
{
@@ -513,6 +546,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -533,18 +567,19 @@ public abstract class cdrInput
if (narrow_native)
{
for (int i = offset; i < offset + length; i++)
- x [ i ] = (char) b.read();
+ x[i] = (char) b.read();
}
else
{
- InputStreamReader reader =
- new InputStreamReader((InputStream) b, narrow_charset);
+ InputStreamReader reader = new InputStreamReader((InputStream) b,
+ narrow_charset);
reader.read(x, offset, length);
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -568,6 +603,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -588,12 +624,13 @@ public abstract class cdrInput
align(8);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readDouble();
+ x[i] = b.readDouble();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -605,26 +642,24 @@ public abstract class cdrInput
}
/**
- * Read the encapsulated stream.
- * If the encapsulated sequence appears to be in the
- * Little endian format, the flag of the returned stream
- * is set to read Little endian.
+ * Read the encapsulated stream. If the encapsulated sequence appears to be in
+ * the Little endian format, the flag of the returned stream is set to read
+ * Little endian.
*/
- public cdrBufInput read_encapsulation()
+ public BufferredCdrInput read_encapsulation()
{
try
{
int l = read_long();
- byte[] r = new byte[ l ];
+ byte[] r = new byte[l];
int n = 0;
- reading:
- while (n < r.length)
+ reading: while (n < r.length)
{
n += read(r, n, r.length - n);
}
- cdrBufInput capsule = new cdrBufInput(r);
+ BufferredCdrInput capsule = new BufferredCdrInput(r);
capsule.setOrb(orb);
int endian = capsule.read_octet();
@@ -639,6 +674,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -650,9 +686,8 @@ public abstract class cdrInput
}
/**
- * Read the CORBA fixed (the end of the <code>fixed</code>
- * can be determined by its last byte). The scale is always
- * assumed to be zero.
+ * Read the CORBA fixed (the end of the <code>fixed</code> can be determined
+ * by its last byte). The scale is always assumed to be zero.
*/
public BigDecimal read_fixed()
{
@@ -663,6 +698,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -686,6 +722,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -706,12 +743,13 @@ public abstract class cdrInput
align(4);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readFloat();
+ x[i] = b.readFloat();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -735,6 +773,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -755,12 +794,13 @@ public abstract class cdrInput
align(4);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readInt();
+ x[i] = b.readInt();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -783,7 +823,9 @@ public abstract class cdrInput
}
catch (EOFException ex)
{
- throw new MARSHAL(UNEXP_EOF);
+ MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
+ throw t;
}
catch (IOException ex)
@@ -802,12 +844,13 @@ public abstract class cdrInput
align(8);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readLong();
+ x[i] = b.readLong();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -830,6 +873,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -852,6 +896,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -863,24 +908,24 @@ public abstract class cdrInput
}
/**
- * Read the length of the byte array as CORBA long and then
- * the array itseld.
+ * Read the length of the byte array as CORBA long and then the array itseld.
*/
public byte[] read_sequence()
{
try
{
int l = read_long();
- byte[] b = new byte[ l ];
+ byte[] buf = new byte[l];
if (l > 0)
{
- read(b);
+ b.readFully(buf);
}
- return b;
+ return buf;
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -904,6 +949,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -924,12 +970,13 @@ public abstract class cdrInput
align(2);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readShort();
+ x[i] = b.readShort();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -941,21 +988,21 @@ public abstract class cdrInput
}
/**
- * Read a singe byte string. The method firs reads the
- * byte array and then calls a constructor to create a
- * string from this array. The character encoding, if
- * previously set, is taken into consideration.
- *
+ * Read a singe byte string. The method firs reads the byte array and then
+ * calls a constructor to create a string from this array. The character
+ * encoding, if previously set, is taken into consideration.
+ *
* @return a loaded string.
*/
public String read_string()
{
+ int n = 0;
try
{
align(4);
- int n = b.readInt();
- byte[] s = new byte[ n ];
+ n = b.readInt();
+ byte[] s = new byte[n];
b.read(s);
// Discard the null terminator.
@@ -967,19 +1014,26 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
-
catch (IOException ex)
{
throw new Unexpected();
}
+ catch (NegativeArraySizeException nex)
+ {
+ MARSHAL m = new MARSHAL("Input stream broken, got " + n + "(0x"
+ + Integer.toHexString(n) + ") as a string size");
+ m.minor = Minor.Negative;
+ throw m;
+ }
}
/**
- * Reads the CORBA unsigned long (java int), delegating
- * functionality to {@link #read_long}.
+ * Reads the CORBA unsigned long (java int), delegating functionality to
+ * {@link #read_long}.
*/
public int read_ulong()
{
@@ -987,9 +1041,8 @@ public abstract class cdrInput
}
/**
- * Reads the array of CORBA unsigned long (java integer) values,
- * delegating functionality to
- * {@link #real_long_array}.
+ * Reads the array of CORBA unsigned long (java integer) values, delegating
+ * functionality to {@link #real_long_array}.
*/
public void read_ulong_array(int[] x, int offs, int len)
{
@@ -997,11 +1050,9 @@ public abstract class cdrInput
}
/**
- * Read the CORBA unsigned long long value,
- * delegating functionality to {@link #read_longlong}.
- * There is no way to return values over the limit of
- * the java signed long in other way than returning
- * the negative value.
+ * Read the CORBA unsigned long long value, delegating functionality to
+ * {@link #read_longlong}. There is no way to return values over the limit of
+ * the java signed long in other way than returning the negative value.
*/
public long read_ulonglong()
{
@@ -1009,9 +1060,8 @@ public abstract class cdrInput
}
/**
- * Reads the array of CORBA long long (java long) values,
- * delegating functionality to
- * {@link #real_longlong_array}.
+ * Reads the array of CORBA long long (java long) values, delegating
+ * functionality to {@link #real_longlong_array}.
*/
public void read_ulonglong_array(long[] x, int offs, int len)
{
@@ -1019,10 +1069,9 @@ public abstract class cdrInput
}
/**
- * Read the unsigned short integer value. Due strange specification,
- * the returned value must be the short type as well, so the
- * the best solution seems just to delegete functionality to
- * read_short.
+ * Read the unsigned short integer value. Due strange specification, the
+ * returned value must be the short type as well, so the the best solution
+ * seems just to delegete functionality to read_short.
*/
public short read_ushort()
{
@@ -1030,8 +1079,8 @@ public abstract class cdrInput
}
/**
- * Read an array of unsigned short values, delegating the
- * functionality to {@link read_short_array}.
+ * Read an array of unsigned short values, delegating the functionality to
+ * {@link read_short_array}.
*/
public void read_ushort_array(short[] x, int offs, int len)
{
@@ -1039,24 +1088,64 @@ public abstract class cdrInput
}
/**
- * Reads the wide character using the encoding, specified in the
- * wide_charset.
+ * Reads the wide character using the encoding, specified in the wide_charset.
*/
public char read_wchar()
{
try
{
if (giop.until_inclusive(1, 1))
- align(2);
+ {
+ align(2);
- if (wide_native)
- return (char) b.readShort();
+ if (wide_native)
+ return (char) b.readShort();
+ else
+ return (char) new InputStreamReader((InputStream) b, wide_charset).read();
+ }
else
- return (char) new InputStreamReader((InputStream) b, wide_charset).read();
+ {
+ int l = b.read();
+ if (l == 2 && wide_native)
+ return b.readChar();
+ else if (l <= 0)
+ {
+ MARSHAL m = new MARSHAL("wchar size " + l);
+ m.minor = Minor.Negative;
+ throw m;
+ }
+ else
+ {
+ byte[] bytes = new byte[l];
+ b.readFully(bytes);
+ String cs;
+
+ if (bytes.length > 2 && bytes[0] == 0xFE && bytes[1] == 0xFF)
+ cs = new String(bytes, 2, bytes.length - 2, wide_charset);
+ else if (bytes.length > 2 && bytes[0] == 0xFF
+ && bytes[1] == 0xFE)
+ {
+ // Litle endian detected - swap bytes.
+ byte t;
+ for (int i = 3; i < bytes.length; i = i + 2)
+ {
+ t = bytes[i];
+ bytes[i - 1] = bytes[i];
+ bytes[i] = t;
+ }
+ cs = new String(bytes, 2, bytes.length - 2, wide_charset);
+ }
+ else
+ cs = new String(bytes, wide_charset);
+
+ return cs.charAt(0);
+ }
+ }
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1067,8 +1156,8 @@ public abstract class cdrInput
}
/**
- * Read an array of "wide chars", each representing a two byte
- * Unicode character, high byte first.
+ * Read an array of "wide chars", each representing a two byte Unicode
+ * character, high byte first.
*/
public void read_wchar_array(char[] x, int offset, int length)
{
@@ -1080,18 +1169,19 @@ public abstract class cdrInput
if (wide_native)
{
for (int i = offset; i < offset + length; i++)
- x [ i ] = (char) b.readShort();
+ x[i] = (char) b.readShort();
}
else
{
- InputStreamReader reader =
- new InputStreamReader((InputStream) b, wide_charset);
+ InputStreamReader reader = new InputStreamReader((InputStream) b,
+ wide_charset);
reader.read(x, offset, length);
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1103,13 +1193,11 @@ public abstract class cdrInput
}
/**
- * Reads the string in wide character format
- * (ussually UTF-16, Unicode). Takes the currently set charset
- * into consideration.
- *
- * If the native (UTF-16) encoding is used
- * of the GIOP protocol is before 1.2, delegates functionality
- * to "plain" {@link #read_wstring_UTF_16}.
+ * Reads the string in wide character format (ussually UTF-16, Unicode). Takes
+ * the currently set charset into consideration.
+ *
+ * If the native (UTF-16) encoding is used of the GIOP protocol is before 1.2,
+ * delegates functionality to "plain" {@link #read_wstring_UTF_16}.
*/
public String read_wstring()
{
@@ -1121,7 +1209,7 @@ public abstract class cdrInput
align(4);
int n = b.readInt();
- byte[] s = new byte[ n ];
+ byte[] s = new byte[n];
b.read(s);
return new String(s, 0, n, wide_charset);
@@ -1129,6 +1217,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1140,9 +1229,9 @@ public abstract class cdrInput
}
/**
- * Reads first length of the string and the all characters as an
- * Unicode (UTF-16) characters. Mind that GIOP 1.1 has the extra
- * null character at the end that must be discarded.
+ * Reads first length of the string and the all characters as an Unicode
+ * (UTF-16) characters. Mind that GIOP 1.1 has the extra null character at the
+ * end that must be discarded.
*/
public String read_wstring_UTF_16()
{
@@ -1150,6 +1239,13 @@ public abstract class cdrInput
{
int p = 0;
int n = read_long();
+
+ if (n<0)
+ {
+ MARSHAL m = new MARSHAL("Negative string size");
+ m.minor = Minor.Negative;
+ throw m;
+ }
// The null terminator that is no longer present since 1.2 .
int nt = giop.since_inclusive(1, 2) ? 0 : 1;
@@ -1157,26 +1253,30 @@ public abstract class cdrInput
// Convert bytes to shorts.
n = n / 2;
- char[] s = new char[ n ];
+ // Empty string.
+ if (n == 0)
+ return "";
+
+ char[] s = new char[n];
for (int i = 0; i < s.length; i++)
- s [ i ] = (char) b.readShort();
+ s[i] = (char) b.readShort();
// Check for the byte order marker here.
- if (s [ 0 ] == 0xFEFF)
+ if (s[0] == 0xFEFF)
{
// Big endian encoding - do nothing, but move the pointer
// one position forward.
p = 1;
}
- else if (s [ 0 ] == 0xFFFE)
+ else if (s[0] == 0xFFFE)
{
// Little endian encoding, swap the bytes and move one
// position forward.
p = 1;
for (int i = p; i < s.length; i++)
- s [ i ] = swap(s [ i ]);
+ s[i] = swap(s[i]);
}
// Discard the null terminator and, if needed, the endian marker.
@@ -1186,6 +1286,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1213,7 +1314,7 @@ public abstract class cdrInput
/**
* Set the current code set context.
*/
- public void setCodeSet(cxCodeSet a_codeset)
+ public void setCodeSet(CodeSetServiceContext a_codeset)
{
this.codeset = a_codeset;
narrow_charset = CharSets_OSF.getName(codeset.char_data);
@@ -1226,7 +1327,7 @@ public abstract class cdrInput
/**
* Get the current code set context.
*/
- public cxCodeSet getCodeSet()
+ public CodeSetServiceContext getCodeSet()
{
return codeset;
}
@@ -1235,9 +1336,9 @@ public abstract class cdrInput
* Read the object that is an instance of the given class. The current
* implementation delegates functionality to the parameterless
* {@link readObject()}.
- *
+ *
* @param klass a class of that this object the instance is.
- *
+ *
* @return the returned object.
*/
public org.omg.CORBA.Object read_Object(Class klass)
@@ -1247,11 +1348,11 @@ public abstract class cdrInput
/**
* Read a value type structure from the stream.
- *
- * OMG specification states the writing format is outside the scope
- * of GIOP definition. This implementation uses java serialization
- * mechanism, calling {@link ObjectInputStream#readObject}
- *
+ *
+ * OMG specification states the writing format is outside the scope of GIOP
+ * definition. This implementation uses java serialization mechanism, calling
+ * {@link ObjectInputStream#readObject}
+ *
* @return an value type structure, unmarshaled from the stream
*/
public Serializable read_Value()
@@ -1260,14 +1361,13 @@ public abstract class cdrInput
}
/**
- * Read the abstract interface. An abstract interface can be either
- * CORBA value type or CORBA object and is returned as an abstract
- * java.lang.Object.
- *
- * As specified in OMG specification, this reads a single
- * boolean and then delegates either to {@link #read_Object()} (for false)
- * or to {@link #read_Value()} (for true).
- *
+ * Read the abstract interface. An abstract interface can be either CORBA
+ * value type or CORBA object and is returned as an abstract java.lang.Object.
+ *
+ * As specified in OMG specification, this reads a single boolean and then
+ * delegates either to {@link #read_Object()} (for false) or to
+ * {@link #read_Value()} (for true).
+ *
* @return an abstract interface, unmarshaled from the stream
*/
public java.lang.Object read_Abstract()
@@ -1276,10 +1376,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_char_array(CharSeqHolder holder, int offset, int length)
{
@@ -1288,10 +1388,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_wchar_array(WCharSeqHolder holder, int offset, int length)
{
@@ -1300,23 +1400,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the char array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the char array to fit the newly read
+ * values.
+ *
* @param holder_value the existing char array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private char[] ensureArray(char[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new char[ offset + length ];
+ return new char[offset + length];
else if (holder_value.length < offset + length)
{
- char[] value = new char[ offset + length ];
+ char[] value = new char[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1325,10 +1425,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_ulong_array(ULongSeqHolder holder, int offset, int length)
{
@@ -1337,10 +1437,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_long_array(LongSeqHolder holder, int offset, int length)
{
@@ -1349,23 +1449,22 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the int array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the int array to fit the newly read values.
+ *
* @param holder_value the existing int array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private int[] ensureArray(int[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new int[ offset + length ];
+ return new int[offset + length];
else if (holder_value.length < offset + length)
{
- int[] value = new int[ offset + length ];
+ int[] value = new int[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1374,10 +1473,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_float_array(FloatSeqHolder holder, int offset, int length)
{
@@ -1386,23 +1485,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the float array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the float array to fit the newly read
+ * values.
+ *
* @param holder_value the existing float array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private float[] ensureArray(float[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new float[ offset + length ];
+ return new float[offset + length];
else if (holder_value.length < offset + length)
{
- float[] value = new float[ offset + length ];
+ float[] value = new float[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1411,10 +1510,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_double_array(DoubleSeqHolder holder, int offset, int length)
{
@@ -1423,23 +1522,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the double array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the double array to fit the newly read
+ * values.
+ *
* @param holder_value the existing double array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private double[] ensureArray(double[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new double[ offset + length ];
+ return new double[offset + length];
else if (holder_value.length < offset + length)
{
- double[] value = new double[ offset + length ];
+ double[] value = new double[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1448,10 +1547,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_short_array(ShortSeqHolder holder, int offset, int length)
{
@@ -1467,23 +1566,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the short array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the short array to fit the newly read
+ * values.
+ *
* @param holder_value the existing short array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private short[] ensureArray(short[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new short[ offset + length ];
+ return new short[offset + length];
else if (holder_value.length < offset + length)
{
- short[] value = new short[ offset + length ];
+ short[] value = new short[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1492,10 +1591,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_octet_array(OctetSeqHolder holder, int offset, int length)
{
@@ -1504,23 +1603,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the byte array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the byte array to fit the newly read
+ * values.
+ *
* @param holder_value the existing byte array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private byte[] ensureArray(byte[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new byte[ offset + length ];
+ return new byte[offset + length];
else if (holder_value.length < offset + length)
{
- byte[] value = new byte[ offset + length ];
+ byte[] value = new byte[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1529,51 +1628,49 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_longlong_array(LongLongSeqHolder holder, int offset,
- int length
- )
+ int length)
{
holder.value = ensureArray(holder.value, offset, length);
read_longlong_array(holder.value, offset, length);
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_ulonglong_array(ULongLongSeqHolder holder, int offset,
- int length
- )
+ int length)
{
holder.value = ensureArray(holder.value, offset, length);
read_ulonglong_array(holder.value, offset, length);
}
/**
- * If required, allocate or resize the array of longs to fit the newly
- * read values.
- *
+ * If required, allocate or resize the array of longs to fit the newly read
+ * values.
+ *
* @param holder_value the existing array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private long[] ensureArray(long[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new long[ offset + length ];
+ return new long[offset + length];
else if (holder_value.length < offset + length)
{
- long[] value = new long[ offset + length ];
+ long[] value = new long[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1582,10 +1679,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_boolean_array(BooleanSeqHolder holder, int offset, int length)
{
@@ -1594,23 +1691,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the array of booleans to fit the newly
- * read values.
- *
+ * If required, allocate or resize the array of booleans to fit the newly read
+ * values.
+ *
* @param holder_value the existing array of booleans, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private boolean[] ensureArray(boolean[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new boolean[ offset + length ];
+ return new boolean[offset + length];
else if (holder_value.length < offset + length)
{
- boolean[] value = new boolean[ offset + length ];
+ boolean[] value = new boolean[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1619,38 +1716,38 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_any_array(AnySeqHolder holder, int offset, int length)
{
holder.value = ensureArray(holder.value, offset, length);
for (int i = offset; i < offset + length; i++)
{
- holder.value [ i ] = read_any();
+ holder.value[i] = read_any();
}
}
/**
- * If required, allocate or resize the array of Anys to fit the newly
- * read values.
- *
+ * If required, allocate or resize the array of Anys to fit the newly read
+ * values.
+ *
* @param holder_value the existing array of Anys, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private Any[] ensureArray(Any[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new Any[ offset + length ];
+ return new Any[offset + length];
else if (holder_value.length < offset + length)
{
- Any[] value = new Any[ offset + length ];
+ Any[] value = new Any[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1659,11 +1756,10 @@ public abstract class cdrInput
}
/**
- * This method is required to represent the DataInputStream as a value
- * type object.
- *
- * @return a single entity "IDL:omg.org/CORBA/DataInputStream:1.0",
- * always.
+ * This method is required to represent the DataInputStream as a value type
+ * object.
+ *
+ * @return a single entity "IDL:omg.org/CORBA/DataInputStream:1.0", always.
*/
public String[] _truncatable_ids()
{
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
index 85f341c912d..7b4d5ec58ff 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
@@ -1,4 +1,4 @@
-/* cdrOutput.java --
+/* AbstractCdrOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,27 +39,28 @@ exception statement from your version. */
package gnu.CORBA.CDR;
import gnu.CORBA.BigDecimalHelper;
-import gnu.CORBA.GIOP.CharSets_OSF;
-import gnu.CORBA.GIOP.cxCodeSet;
-import gnu.CORBA.Poa.gnuServantObject;
import gnu.CORBA.IOR;
-import gnu.CORBA.Simple_delegate;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.Minor;
import gnu.CORBA.TypeCodeHelper;
import gnu.CORBA.Unexpected;
import gnu.CORBA.Version;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.GIOP.CharSets_OSF;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
+import org.omg.CORBA.DataInputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.CORBA.portable.OutputStream;
@@ -68,7 +69,6 @@ import org.omg.CORBA.portable.Streamable;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Serializable;
-
import java.math.BigDecimal;
/**
@@ -79,18 +79,27 @@ import java.math.BigDecimal;
* The same class also implements the {@link DataInputStream},
* providing support for writing the value type objects
* in a user defined way.
+ *
+ * TODO This class uses 16 bits per Unicode character only, as it was until
+ * jdk 1.4 inclusive.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public abstract class cdrOutput
+public abstract class AbstractCdrOutput
extends org.omg.CORBA_2_3.portable.OutputStream
implements org.omg.CORBA.DataOutputStream
{
/**
+ * The runtime, associated with this stream. This field is only used when
+ * reading and writing value types and filled-in in gnu.CORBA.CDR.Vio.
+ */
+ public transient gnuRuntime runtime;
+
+ /**
* This instance is used to convert primitive data types into the
* byte sequences.
*/
- protected abstractDataOutputStream b;
+ protected AbstractDataOutput b;
/**
* The associated orb, if any.
@@ -105,7 +114,7 @@ public abstract class cdrOutput
/**
* The code set information.
*/
- protected cxCodeSet codeset;
+ protected CodeSetServiceContext codeset;
/**
* The name of the currently used narrow charset.
@@ -148,19 +157,19 @@ public abstract class cdrOutput
*
* @param writeTo a stream to write CORBA output to.
*/
- public cdrOutput(java.io.OutputStream writeTo)
+ public AbstractCdrOutput(java.io.OutputStream writeTo)
{
setOutputStream(writeTo);
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
* Creates the stream, requiring the subsequent call
* of {@link #setOutputStream(java.io.OutputStream)}.
*/
- public cdrOutput()
+ public AbstractCdrOutput()
{
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
@@ -168,11 +177,22 @@ public abstract class cdrOutput
* stream is different from 0.
*/
public abstract void setOffset(int an_offset);
+
+ /**
+ * Clone all important settings to another stream.
+ */
+ public void cloneSettings(AbstractCdrOutput stream)
+ {
+ stream.setBigEndian(!little_endian);
+ stream.setCodeSet(getCodeSet());
+ stream.setVersion(giop);
+ stream.setOrb(orb);
+ }
/**
* Set the current code set context.
*/
- public void setCodeSet(cxCodeSet a_codeset)
+ public void setCodeSet(CodeSetServiceContext a_codeset)
{
this.codeset = a_codeset;
narrow_charset = CharSets_OSF.getName(codeset.char_data);
@@ -185,7 +205,7 @@ public abstract class cdrOutput
/**
* Get the current code set context.
*/
- public cxCodeSet getCodeSet()
+ public CodeSetServiceContext getCodeSet()
{
return codeset;
}
@@ -255,9 +275,9 @@ public abstract class cdrOutput
*
* @return the encapsulated stream.
*/
- public cdrOutput createEncapsulation()
+ public AbstractCdrOutput createEncapsulation()
{
- return new encapsulatedOutput(this, !little_endian);
+ return new EncapsulationStream(this, !little_endian);
}
/**
@@ -313,53 +333,56 @@ public abstract class cdrOutput
}
/**
- * Read the CORBA object. The object is written
- * form of the plain (not a string-encoded) IOR profile without the
- * heading endian indicator. The responsible method for reading such
- * data is {@link IOR.write_no_endian}.
- *
- * The null value is written as defined in OMG specification
- * (zero length string, followed by an empty set of profiles).
- */
+ * Read the CORBA object. The object is written form of the plain (not a
+ * string-encoded) IOR profile without the heading endian indicator. The
+ * responsible method for reading such data is {@link IOR.write_no_endian}.
+ *
+ * The null value is written as defined in OMG specification (zero length
+ * string, followed by an empty set of profiles).
+ */
public void write_Object(org.omg.CORBA.Object x)
{
- if (x == null)
+ ORB w_orb = orb;
+ if (x instanceof IorProvider)
{
- IOR.write_null(this);
+ ((IorProvider) x).getIor()._write_no_endian(this);
return;
}
- else if (x instanceof gnuServantObject)
+ else if (x == null)
{
- // The ORB may be different if several ORBs coexist
- // in the same machine.
- gnuServantObject g = (gnuServantObject) x;
- IOR ior = g.orb.getLocalIor(x);
- ior._write_no_endian(this);
+ IOR.write_null(this);
return;
}
else if (x instanceof ObjectImpl)
{
Delegate d = ((ObjectImpl) x)._get_delegate();
- if (d instanceof Simple_delegate)
+ if (d instanceof IorProvider)
{
- Simple_delegate ido = (Simple_delegate) d;
- ido.getIor()._write_no_endian(this);
+ ((IorProvider) d).getIor()._write_no_endian(this);
return;
}
+ else
+ {
+ ORB d_orb = d.orb(x);
+ if (d_orb != null)
+ w_orb = d_orb;
+ }
}
// Either this is not an ObjectImpl or it has the
// unexpected delegate. Try to convert via ORBs
// object_to_string().
- if (orb != null)
+ if (w_orb != null)
{
- IOR ior = IOR.parse(orb.object_to_string(x));
+ IOR ior = IOR.parse(w_orb.object_to_string(x));
ior._write_no_endian(this);
return;
}
else
- throw new BAD_OPERATION("Please set the ORB for this stream.");
+ throw new BAD_OPERATION(
+ "Please set the ORB for this stream, cannot write "
+ + x.getClass().getName());
}
/**
@@ -399,7 +422,7 @@ public abstract class cdrOutput
}
else
{
- primitiveTypeCode p = new primitiveTypeCode(TCKind.tk_null);
+ PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
write_TypeCode(p);
}
}
@@ -726,6 +749,7 @@ public abstract class cdrOutput
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.CDR;
t.initCause(ex);
throw t;
}
@@ -737,7 +761,7 @@ public abstract class cdrOutput
* representing the stream buffer length (the number of
* bytes being subsequently written).
*/
- public void write_sequence(cdrBufOutput from)
+ public void write_sequence(BufferedCdrOutput from)
{
try
{
@@ -747,6 +771,7 @@ public abstract class cdrOutput
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.CDR;
t.initCause(ex);
throw t;
}
@@ -874,28 +899,41 @@ public abstract class cdrOutput
}
/**
- * Writes the character as two byte short integer (Unicode value),
- * high byte first. Writes in Big Endian, but never writes the
- * endian indicator.
- *
- * The character is always written using the native UTF-16BE charset
- * because its size under arbitrary encoding is not evident.
+ * Writes the character as two byte short integer (Unicode value), high byte
+ * first. Writes in Big Endian, but never writes the endian indicator.
+ *
+ * The character is always written using the native UTF-16BE charset because
+ * its size under arbitrary encoding is not evident.
*/
public void write_wchar(char x)
{
try
{
if (giop.until_inclusive(1, 1))
- align(2);
+ {
+ align(2);
- if (wide_native)
- b.writeShort(x);
+ if (wide_native)
+ b.writeShort(x);
+ else
+ {
+ OutputStreamWriter ow = new OutputStreamWriter(
+ (OutputStream) b, wide_charset);
+ ow.write(x);
+ ow.flush();
+ }
+ }
+ else if (wide_native)
+ {
+ b.writeByte(2);
+ b.writeChar(x);
+ }
else
{
- OutputStreamWriter ow =
- new OutputStreamWriter((OutputStream) b, wide_charset);
- ow.write(x);
- ow.flush();
+ String encoded = new String(new char[] { x });
+ byte[] bytes = encoded.getBytes(wide_charset);
+ b.write(bytes.length + 2);
+ b.write(bytes);
}
}
catch (IOException ex)
@@ -906,13 +944,13 @@ public abstract class cdrOutput
/**
* Write the array of wide chars.
- *
+ *
* @param chars the array of wide chars
* @param offset offset
* @param length length
- *
- * The char array is always written using the native UTF-16BE charset
- * because the character size under arbitrary encoding is not evident.
+ *
+ * The char array is always written using the native UTF-16BE charset because
+ * the character size under arbitrary encoding is not evident.
*/
public void write_wchar_array(char[] chars, int offset, int length)
{
@@ -998,12 +1036,12 @@ public abstract class cdrOutput
/** {@inheritDoc} */
public void write_Abstract(java.lang.Object value)
{
- write_Abstract(value);
+ write_abstract_interface(value);
}
/** {@inheritDoc} */
public void write_Value(Serializable value)
{
- write_Value(value);
+ write_value(value);
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/abstractDataInputStream.java b/libjava/classpath/gnu/CORBA/CDR/AbstractDataInput.java
index be926254dd0..4d120fa2c0c 100644
--- a/libjava/classpath/gnu/CORBA/CDR/abstractDataInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractDataInput.java
@@ -1,4 +1,4 @@
-/* abstractDataInputStream.java --
+/* AbstractDataInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.io.IOException;
* @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface abstractDataInputStream
+public interface AbstractDataInput
{
/**
* This method reads bytes from the underlying stream into the specified
diff --git a/libjava/classpath/gnu/CORBA/CDR/abstractDataOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/AbstractDataOutput.java
index 2f9b8c419fc..e37c0cb7ddd 100644
--- a/libjava/classpath/gnu/CORBA/CDR/abstractDataOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractDataOutput.java
@@ -1,4 +1,4 @@
-/* abstractDataOutputStream.java --
+/* AbstractDataOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.io.IOException;
* @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface abstractDataOutputStream
+public interface AbstractDataOutput
{
/**
* This method flushes any unwritten bytes to the underlying stream.
diff --git a/libjava/classpath/gnu/CORBA/CDR/aligningInputStream.java b/libjava/classpath/gnu/CORBA/CDR/AligningInput.java
index a719b32ee1e..e2710628a52 100644
--- a/libjava/classpath/gnu/CORBA/CDR/aligningInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AligningInput.java
@@ -1,4 +1,4 @@
-/* aligningInputStream.java --
+/* AligningInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import org.omg.CORBA.BAD_PARAM;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class aligningInputStream
+public class AligningInput
extends ByteArrayInputStream
{
/**
@@ -61,24 +61,12 @@ public class aligningInputStream
*
* @param a_buffer a buffer to read from.
*/
- public aligningInputStream(byte[] a_buffer)
+ public AligningInput(byte[] a_buffer)
{
super(a_buffer);
}
/**
- * Create a stream, reading from the given buffer region.
- *
- * @param a_buffer a buffer to read from.
- * @param offset the offset of the region.
- * @param length thr length of the region.
- */
- public aligningInputStream(byte[] a_buffer, int offset, int length)
- {
- super(a_buffer, offset, length);
- }
-
- /**
* Set the alignment offset, if the index of the first byte in the
* stream is different from 0.
*/
@@ -119,4 +107,25 @@ public class aligningInputStream
{
return buf;
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return pos + offset;
+ }
+
+ /**
+ * Jump to the given position, taking offset into consideration.
+ */
+ public void seek(int position)
+ {
+ if (position < offset || position > (count+offset))
+ throw new ArrayIndexOutOfBoundsException(position
+ + " is out of valid ["+offset+".." + (count+offset) + "[ range");
+ pos = position - offset;
+ }
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/aligningOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/AligningOutput.java
index 8a682c1fd6d..135f75af6a7 100644
--- a/libjava/classpath/gnu/CORBA/CDR/aligningOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AligningOutput.java
@@ -1,4 +1,4 @@
-/* aligningOutputStream.java --
+/* AligningOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.CORBA.CDR;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import org.omg.CORBA.BAD_PARAM;
@@ -49,7 +48,7 @@ import org.omg.CORBA.BAD_PARAM;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class aligningOutputStream
+public class AligningOutput
extends ByteArrayOutputStream
{
/**
@@ -60,14 +59,14 @@ public class aligningOutputStream
/**
* Create a stream with the default intial buffer size.
*/
- public aligningOutputStream()
+ public AligningOutput()
{
}
/**
* Create a stream with the given intial buffer size.
*/
- public aligningOutputStream(int initial_size)
+ public AligningOutput(int initial_size)
{
super(initial_size);
}
@@ -118,4 +117,32 @@ public class aligningOutputStream
write(0);
}
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return size()+offset;
+ }
+
+ /**
+ * Seek to the given position (not in use).
+ */
+ public void seek(int position)
+ {
+ count = position - offset;
+ }
+
+ /**
+ * Get the buffer without copying it. Use with care.
+ */
+ public byte[] getBuffer()
+ {
+ return buf;
+ }
+
+
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java b/libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java
new file mode 100644
index 00000000000..7a4d9c5aa8f
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java
@@ -0,0 +1,254 @@
+/* ArrayValueHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.ObjectCreator;
+
+import org.omg.CORBA.BooleanSeqHelper;
+import org.omg.CORBA.CharSeqHelper;
+import org.omg.CORBA.DoubleSeqHelper;
+import org.omg.CORBA.FloatSeqHelper;
+import org.omg.CORBA.LongLongSeqHelper;
+import org.omg.CORBA.LongSeqHelper;
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA.ShortSeqHelper;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.rmi.Remote;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+/**
+ * Writes arrays as a boxed value types. A single instance is used to write a
+ * single array. This class is only used with RMI/IIOP, to handle array boxed
+ * values.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+class ArrayValueHelper
+ implements BoxedValueHelper
+{
+ /**
+ * The value handler (one for all instances).
+ */
+ static ValueHandler handler = Util.createValueHandler();
+
+ /**
+ * A class of the array being written.
+ */
+ Class arrayClass;
+
+ /**
+ * The array component class.
+ */
+ Class component;
+
+ /**
+ * The array component repository Id.
+ */
+ String componentId;
+
+ /**
+ * If true, the array members are written as objects rather than as values.
+ * True for Remotes and CORBA objects.
+ */
+ boolean written_as_object()
+ {
+ return org.omg.CORBA.Object.class.isAssignableFrom(component)
+ || Remote.class.isAssignableFrom(component);
+ }
+
+ /**
+ * Creates the instance of the helper to write this specific array class.
+ */
+ ArrayValueHelper(Class an_arrayClass)
+ {
+ arrayClass = an_arrayClass;
+ }
+
+ /**
+ * Get the array repository Id that will be the RMI repository id.
+ */
+ public String get_id()
+ {
+ return ObjectCreator.getRepositoryId(arrayClass);
+ }
+
+ /**
+ * Read the array from the input stream.
+ */
+ public Serializable read_value(InputStream input)
+ {
+ if (input instanceof HeadlessInput)
+ {
+ ((HeadlessInput) input).subsequentCalls = true;
+ }
+
+ component = arrayClass.getComponentType();
+
+ if (component.equals(byte.class))
+ return OctetSeqHelper.read(input);
+ else if (component.equals(String.class))
+ {
+ // String array is optimized because this may be frequent.
+ String[] s = new String[input.read_long()];
+
+ for (int i = 0; i < s.length; i++)
+ s[i] = (String) Vio.read(input, Vio.m_StringValueHelper);
+ return s;
+ }
+ else if (component.equals(int.class))
+ return LongSeqHelper.read(input);
+ else if (component.equals(long.class))
+ return LongLongSeqHelper.read(input);
+ else if (component.equals(double.class))
+ return DoubleSeqHelper.read(input);
+ else if (component.equals(float.class))
+ return FloatSeqHelper.read(input);
+ else if (component.equals(boolean.class))
+ return BooleanSeqHelper.read(input);
+ else if (component.equals(short.class))
+ return ShortSeqHelper.read(input);
+ else if (component.equals(char.class))
+ return CharSeqHelper.read(input);
+ else
+ {
+ // Read others, use reflection.
+ int n = input.read_long();
+
+ gnuValueStream s = null;
+
+ Serializable array = (Serializable) Array.newInstance(component, n);
+ if (written_as_object())
+ for (int i = 0; i < n; i++)
+ {
+ gnuRuntime g;
+ int position;
+ if (input instanceof gnuValueStream)
+ {
+ s = (gnuValueStream) input;
+ g = s.getRunTime();
+ position = s.getPosition();
+ }
+ else
+ {
+ g = null;
+ position = -1;
+ }
+
+ if (input instanceof HeadlessInput)
+ ((HeadlessInput) input).subsequentCalls = true;
+
+ Object o = handler.readValue(input, position, component, null, g);
+ Array.set(array, i, o);
+ }
+ else
+ for (int i = 0; i < n; i++)
+ Array.set(array, i, Vio.read(input, component));
+ return array;
+ }
+ }
+
+ /**
+ * Write the array to the input stream.
+ */
+ public void write_value(OutputStream output, Serializable value)
+ {
+ if (output instanceof gnuValueStream)
+ {
+ gnuRuntime r = ((gnuValueStream) output).getRunTime();
+ if (r != null)
+ r.target = null;
+ }
+
+ if (value instanceof byte[])
+ OctetSeqHelper.write(output, (byte[]) value);
+ else if (value instanceof String[])
+ {
+ String[] s = (String[]) value;
+ output.write_long(s.length);
+ for (int i = 0; i < s.length; i++)
+ Vio.write(output, s[i], Vio.m_StringValueHelper);
+ }
+ else if (value instanceof int[])
+ LongSeqHelper.write(output, (int[]) value);
+ else if (value instanceof long[])
+ LongLongSeqHelper.write(output, (long[]) value);
+ else if (value instanceof double[])
+ DoubleSeqHelper.write(output, (double[]) value);
+ else if (value instanceof float[])
+ FloatSeqHelper.write(output, (float[]) value);
+ else if (value instanceof boolean[])
+ BooleanSeqHelper.write(output, (boolean[]) value);
+ else if (value instanceof short[])
+ ShortSeqHelper.write(output, (short[]) value);
+ else if (value instanceof char[])
+ CharSeqHelper.write(output, (char[]) value);
+ else
+ {
+ // Write others, use reflection.
+ component = arrayClass.getComponentType();
+
+ int n = Array.getLength(value);
+ output.write_long(n);
+ if (written_as_object())
+ for (int i = 0; i < n; i++)
+ {
+ Object o = Array.get(value, i);
+ if (o == null)
+ output.write_Object(null);
+ else
+ // CORBA objects have another notation.
+ handler.writeValue(output, (Serializable) o);
+ }
+ else
+ {
+ for (int i = 0; i < n; i++)
+ Vio.write(output, (Serializable) Array.get(value, i),
+ component);
+ }
+
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java b/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java
index bc019396adb..1559d75a41e 100644
--- a/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java
@@ -49,7 +49,7 @@ import java.io.InputStream;
*/
public class BigEndianInputStream
extends DataInputStream
- implements abstractDataInputStream
+ implements AbstractDataInput
{
/**
* Delegates to the parent constructor.
diff --git a/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java
index e0aa7da773e..7d3b02ec950 100644
--- a/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java
@@ -50,7 +50,7 @@ import java.io.OutputStream;
*/
public class BigEndianOutputStream
extends DataOutputStream
- implements abstractDataOutputStream
+ implements AbstractDataOutput
{
/**
* Delegate functionality to the parent constructor.
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrBufOutput.java b/libjava/classpath/gnu/CORBA/CDR/BufferedCdrOutput.java
index 47f5f176b39..69bf95beb66 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrBufOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BufferedCdrOutput.java
@@ -1,4 +1,4 @@
-/* cdrBufOutput.java --
+/* BufferedCdrOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,41 +41,47 @@ package gnu.CORBA.CDR;
import java.io.ByteArrayOutputStream;
/**
- * A CORBA output stream, writing data into the internal
- * buffer ({@link ByteArrayOutputStream}).
- *
+ * A CORBA output stream, writing data into the internal buffer ({@link ByteArrayOutputStream}).
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class cdrBufOutput
- extends cdrOutput
+public class BufferedCdrOutput
+ extends AbstractCdrOutput
+ implements gnuValueStream
{
/**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
* The byte buffer.
*/
- public final aligningOutputStream buffer;
+ public final AligningOutput buffer;
/**
* Creates the instance with the given initial buffer size.
+ *
* @param bufSize the buffer size.
*/
- public cdrBufOutput(int bufSize)
+ public BufferedCdrOutput(int bufSize)
{
- buffer = new aligningOutputStream(bufSize);
+ buffer = new AligningOutput(bufSize);
setOutputStream(buffer);
}
/**
* Creates the instance with the default buffer size.
*/
- public cdrBufOutput()
+ public BufferedCdrOutput()
{
- buffer = new aligningOutputStream();
+ buffer = new AligningOutput();
setOutputStream(buffer);
}
/**
- * Set the alignment offset, if the index of the first byte in the
- * stream is different from 0.
+ * Set the alignment offset, if the index of the first byte in the stream is
+ * different from 0.
*/
public void setOffset(int an_offset)
{
@@ -95,7 +101,7 @@ public class cdrBufOutput
*/
public org.omg.CORBA.portable.InputStream create_input_stream()
{
- cdrBufInput in = new cdrBufInput(buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(buffer.toByteArray());
in.setOrb(orb);
in.setVersion(giop);
@@ -112,4 +118,39 @@ public class cdrBufOutput
buffer.reset();
setOutputStream(buffer);
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return buffer.getPosition();
+ }
+
+ /**
+ * Get the associated RunTime.
+ */
+ public gnuRuntime getRunTime()
+ {
+ return runtime;
+ }
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime)
+ {
+ runtime = a_runtime;
+ }
+
+ /**
+ * Seek to the given position.
+ */
+ public void seek(int position)
+ {
+ buffer.seek(position);
+ }
+
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrBufInput.java b/libjava/classpath/gnu/CORBA/CDR/BufferredCdrInput.java
index 3cab7216c3b..f0159a88dac 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrBufInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BufferredCdrInput.java
@@ -1,4 +1,4 @@
-/* cdrBufInput.java --
+/* BufferredCdrInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,18 +43,20 @@ package gnu.CORBA.CDR;
* The CDR input stream that reads data from the byte buffer.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
- *
- * TODO character encoding. Now the encoding can be set, but it is ignored.
- * If you take this task, scan 'TODO character encoding' for
- * relevant places.
*/
-public class cdrBufInput
- extends cdrInput
+public class BufferredCdrInput
+ extends AbstractCdrInput
+ implements gnuValueStream
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The byte array input stream to read data from.
*/
- public final aligningInputStream buffer;
+ public final AligningInput buffer;
/**
* Creates the CDR input stream that reads from the given buffer
@@ -62,9 +64,9 @@ public class cdrBufInput
*
* @param a_buffer an array to read from.
*/
- public cdrBufInput(byte[] a_buffer)
+ public BufferredCdrInput(byte[] a_buffer)
{
- buffer = new aligningInputStream(a_buffer);
+ buffer = new AligningInput(a_buffer);
setInputStream(buffer);
}
@@ -112,4 +114,40 @@ public class cdrBufInput
buffer.reset();
setInputStream(buffer);
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return buffer.getPosition();
+ }
+
+ /**
+ * Jump to the given position, taking offset into consideration.
+ */
+ public void seek(int position)
+ {
+ buffer.seek(position);
+ setInputStream(buffer);
+ }
+
+ /**
+ * Get the associated RunTime.
+ */
+ public gnuRuntime getRunTime()
+ {
+ return runtime;
+ }
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime)
+ {
+ runtime = a_runtime;
+ }
+
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/encapsulatedOutput.java b/libjava/classpath/gnu/CORBA/CDR/EncapsulationStream.java
index 3350291bc73..4945d9c906a 100644
--- a/libjava/classpath/gnu/CORBA/CDR/encapsulatedOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/EncapsulationStream.java
@@ -48,8 +48,8 @@ import java.io.IOException;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class encapsulatedOutput
- extends cdrOutput
+public class EncapsulationStream
+ extends AbstractCdrOutput
{
/**
* The Big Endian (most siginificant byte first flag).
@@ -64,7 +64,7 @@ public class encapsulatedOutput
/**
* The byte buffer.
*/
- public final aligningOutputStream buffer;
+ public final AligningOutput buffer;
/**
* The stream, where the data are being encapsulated.
@@ -75,11 +75,11 @@ public class encapsulatedOutput
* Create the EncapsulationOutput with the given parent stream
* and the specified encoding.
*/
- public encapsulatedOutput(org.omg.CORBA.portable.OutputStream _parent,
+ public EncapsulationStream(org.omg.CORBA.portable.OutputStream _parent,
boolean use_big_endian)
{
super();
- buffer = new aligningOutputStream();
+ buffer = new AligningOutput();
setOutputStream(buffer);
parent = _parent;
write(use_big_endian?BIG_ENDIAN:LITTLE_ENDIAN);
@@ -126,7 +126,7 @@ public class encapsulatedOutput
*/
public org.omg.CORBA.portable.InputStream create_input_stream()
{
- cdrBufInput in = new cdrBufInput(buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(buffer.toByteArray());
in.setOrb(orb);
in.setVersion(giop);
diff --git a/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java b/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
new file mode 100644
index 00000000000..0c18dafb195
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
@@ -0,0 +1,749 @@
+/* HeadlessInput.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.AnySeqHolder;
+import org.omg.CORBA.BooleanSeqHolder;
+import org.omg.CORBA.CharSeqHolder;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.DataInputStream;
+import org.omg.CORBA.DoubleSeqHolder;
+import org.omg.CORBA.FloatSeqHolder;
+import org.omg.CORBA.LongLongSeqHolder;
+import org.omg.CORBA.LongSeqHolder;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.OctetSeqHolder;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.ShortSeqHolder;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.ULongLongSeqHolder;
+import org.omg.CORBA.ULongSeqHolder;
+import org.omg.CORBA.UShortSeqHolder;
+import org.omg.CORBA.WCharSeqHolder;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * Substitutes the main stream in factories when the header is already behind.
+ * Overrides methods that may be invoked from the factory, forcing not to read
+ * the header if called first time on this stream.
+ *
+ * This stream reverts to default behavior if one or more call are made (reading
+ * value types that are nested fields of the value type).
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class HeadlessInput
+ extends org.omg.CORBA_2_3.portable.InputStream
+ implements DataInputStream, gnuValueStream
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Indicates that no positional information is available.
+ */
+ static final int NONE = -1;
+
+ /**
+ * If true, this is not the first call.
+ */
+ public boolean subsequentCalls;
+
+ /**
+ * The enclosed stream.
+ */
+ final BufferredCdrInput stream;
+
+ /**
+ * Create an instance, reading from the given buffer.
+ *
+ * @param a_stram a stream from where the data will be read.
+ * @param inheritSettings a stream from that endian and other settings are
+ * inherited.
+ */
+ public HeadlessInput(BufferredCdrInput a_stream, InputStream inheritSettings)
+ {
+ stream = a_stream;
+
+ if (inheritSettings instanceof AbstractCdrInput)
+ {
+ AbstractCdrInput t = (AbstractCdrInput) inheritSettings;
+ t.cloneSettings(stream);
+ }
+ else if (stream.orb() == null)
+ stream.setOrb(inheritSettings.orb());
+
+ if (inheritSettings instanceof gnuValueStream
+ && stream.getRunTime() == null)
+ {
+ stream.setRunTime(((gnuValueStream) inheritSettings).getRunTime());
+ }
+ }
+
+ /**
+ * Tries to read using boxed value helper.
+ */
+ public Serializable read_value(BoxedValueHelper helper)
+ {
+ if (subsequentCalls)
+ return stream.read_value(helper);
+ else
+ {
+ subsequentCalls = true;
+ return helper.read_value(this);
+ }
+ }
+
+ /**
+ * Tries to locate a factory using repository id.
+ */
+ public Serializable read_value(String repository_id)
+ {
+ if (subsequentCalls)
+ return stream.read_value(repository_id);
+ else
+ {
+ subsequentCalls = true;
+ Serializable value = (Serializable) Vio.readValue(this, NONE, null,
+ null, repository_id, null, null);
+ return value;
+ }
+ }
+
+ /**
+ * Try to read when having an unitialised value.
+ */
+ public Serializable read_value(Serializable value)
+ {
+ if (subsequentCalls)
+ return stream.read_value(value);
+ else
+ {
+ subsequentCalls = true;
+ value = (Serializable) Vio.readValue(this, NONE, value, null, null,
+ null, null);
+ return value;
+ }
+ }
+
+ /**
+ * Try to read when having an unitialised value.
+ */
+ public Serializable read_value(Class clz)
+ {
+ if (subsequentCalls)
+ return stream.read_value(clz);
+ else
+ {
+ try
+ {
+ subsequentCalls = true;
+ Serializable value = (Serializable) Vio.instantiateAnyWay(clz);
+ value = (Serializable) Vio.readValue(this, NONE, value, null, null,
+ null, null);
+ return value;
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Can't read an instance of "
+ + clz.getName());
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int available()
+ throws IOException
+ {
+ return stream.available();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void close()
+ throws IOException
+ {
+ stream.close();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void mark(int readlimit)
+ {
+ stream.mark(readlimit);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public boolean markSupported()
+ {
+ return stream.markSupported();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public ORB orb()
+ {
+ return stream.orb();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Object read_abstract_interface()
+ {
+ return stream.read_abstract_interface();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Object read_abstract_interface(Class clz)
+ {
+ return stream.read_abstract_interface(clz);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Any read_any()
+ {
+ return stream.read_any();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_boolean_array(boolean[] value, int offset, int length)
+ {
+ stream.read_boolean_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public boolean read_boolean()
+ {
+ return stream.read_boolean();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_char_array(char[] value, int offset, int length)
+ {
+ stream.read_char_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public char read_char()
+ {
+ return stream.read_char();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Context read_Context()
+ {
+ return stream.read_Context();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_double_array(double[] value, int offset, int length)
+ {
+ stream.read_double_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public double read_double()
+ {
+ return stream.read_double();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public BigDecimal read_fixed()
+ {
+ return stream.read_fixed();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_float_array(float[] value, int offset, int length)
+ {
+ stream.read_float_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public float read_float()
+ {
+ return stream.read_float();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_long_array(int[] value, int offset, int length)
+ {
+ stream.read_long_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read_long()
+ {
+ return stream.read_long();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_longlong_array(long[] value, int offset, int length)
+ {
+ stream.read_longlong_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public long read_longlong()
+ {
+ return stream.read_longlong();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public org.omg.CORBA.Object read_Object()
+ {
+ return stream.read_Object();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public org.omg.CORBA.Object read_Object(Class klass)
+ {
+ return stream.read_Object(klass);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_octet_array(byte[] value, int offset, int length)
+ {
+ stream.read_octet_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public byte read_octet()
+ {
+ return stream.read_octet();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Principal read_Principal()
+ {
+ return stream.read_Principal();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_short_array(short[] value, int offset, int length)
+ {
+ stream.read_short_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public short read_short()
+ {
+ return stream.read_short();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public String read_string()
+ {
+ return stream.read_string();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public TypeCode read_TypeCode()
+ {
+ return stream.read_TypeCode();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulong_array(int[] value, int offset, int length)
+ {
+ stream.read_ulong_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read_ulong()
+ {
+ return stream.read_ulong();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulonglong_array(long[] value, int offset, int length)
+ {
+ stream.read_ulonglong_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public long read_ulonglong()
+ {
+ return stream.read_ulonglong();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ushort_array(short[] value, int offset, int length)
+ {
+ stream.read_ushort_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public short read_ushort()
+ {
+ return stream.read_ushort();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Serializable read_value()
+ {
+ return read_value((Serializable) null);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_wchar_array(char[] value, int offset, int length)
+ {
+ stream.read_wchar_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public char read_wchar()
+ {
+ return stream.read_wchar();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public String read_wstring()
+ {
+ return stream.read_wstring();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read()
+ throws IOException
+ {
+ return stream.read();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read(byte[] b, int off, int len)
+ throws IOException
+ {
+ return stream.read(b, off, len);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read(byte[] b)
+ throws IOException
+ {
+ return stream.read(b);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void reset()
+ throws IOException
+ {
+ stream.reset();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public long skip(long n)
+ throws IOException
+ {
+ return stream.skip(n);
+ }
+
+ /**
+ * Get a string representation.
+ */
+ public String toString()
+ {
+ return "HeadlessInput+" + stream.toString();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public String[] _truncatable_ids()
+ {
+ return stream._truncatable_ids();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Object read_Abstract()
+ {
+ return stream.read_Abstract();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_any_array(AnySeqHolder holder, int offset, int length)
+ {
+ stream.read_any_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_boolean_array(BooleanSeqHolder holder, int offset, int length)
+ {
+ stream.read_boolean_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_char_array(CharSeqHolder holder, int offset, int length)
+ {
+ stream.read_char_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_double_array(DoubleSeqHolder holder, int offset, int length)
+ {
+ stream.read_double_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_float_array(FloatSeqHolder holder, int offset, int length)
+ {
+ stream.read_float_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_long_array(LongSeqHolder holder, int offset, int length)
+ {
+ stream.read_long_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_longlong_array(LongLongSeqHolder holder, int offset,
+ int length)
+ {
+ stream.read_longlong_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_octet_array(OctetSeqHolder holder, int offset, int length)
+ {
+ stream.read_octet_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_short_array(ShortSeqHolder holder, int offset, int length)
+ {
+ stream.read_short_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulong_array(ULongSeqHolder holder, int offset, int length)
+ {
+ stream.read_ulong_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulonglong_array(ULongLongSeqHolder holder, int offset,
+ int length)
+ {
+ stream.read_ulonglong_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ushort_array(UShortSeqHolder holder, int offset, int length)
+ {
+ stream.read_ushort_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to read_value.
+ */
+ public Serializable read_Value()
+ {
+ return read_value();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_wchar_array(WCharSeqHolder holder, int offset, int length)
+ {
+ stream.read_wchar_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int getPosition()
+ {
+ return stream.getPosition();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public gnuRuntime getRunTime()
+ {
+ return stream.runtime;
+ }
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime)
+ {
+ stream.runtime = a_runtime;
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void seek(int position)
+ {
+ stream.seek(position);
+ }
+
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java b/libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java
new file mode 100644
index 00000000000..3259a48770c
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java
@@ -0,0 +1,169 @@
+/* IDLTypeHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+/**
+ * Handles case when the CORBA IDL type with the known helper is wrapped into
+ * Value type.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class IDLTypeHelper
+ implements BoxedValueHelper
+{
+ /**
+ * A helper class.
+ */
+ protected Class helper;
+
+ /**
+ * Argument values for Helper.id().
+ */
+ static final Object[] ARGS_ID_V = new Object[0];
+
+ /**
+ * Argument types for Helper.id()).
+ */
+ static final Class[] ARGS_ID = new Class[0];
+
+ /**
+ * Argument types for Helper.read.
+ */
+ static final Class[] ARGS_READ = new Class[] { org.omg.CORBA.portable.InputStream.class };
+
+ /**
+ * Create an IDLTypeHelper that works via given helper class.
+ */
+ public IDLTypeHelper(Class a_helperClass)
+ {
+ helper = a_helperClass;
+ }
+
+ /**
+ * Get the Id, returned by this helper (use reflection).
+ */
+ public String get_id()
+ {
+ try
+ {
+ Method m = helper.getMethod("id", ARGS_ID);
+ return (String) m.invoke(null, ARGS_ID_V);
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL(msg() + " id()");
+ m.minor = Minor.Boxed;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Read an instance from the stream.
+ */
+ public Serializable read_value(InputStream input)
+ {
+ try
+ {
+ Method m = helper.getMethod("read", ARGS_READ);
+ return (Serializable) m.invoke(null, new Object[] { input });
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL(msg() + " read(..)");
+ m.minor = Minor.Boxed;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Write the instance to the stream.
+ */
+ public void write_value(OutputStream output, Serializable value)
+ {
+ try
+ {
+ Method[] m = helper.getMethods();
+
+ for (int i = 0; i < m.length; i++)
+ {
+ if (m[i].getName().equals("write")
+ && ((m[i].getModifiers() & Modifier.STATIC) != 0))
+ {
+ Class[] p = m[i].getParameterTypes();
+
+ if (p.length == 2 && OutputStream.class.isAssignableFrom(p[0])
+ && p[1].isAssignableFrom(value.getClass()))
+ {
+ m[i].invoke(null, new Object[] { output, value });
+ return;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL(msg() + " write(..)");
+ m.minor = Minor.Boxed;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Create the start of message for exceptions.
+ */
+ String msg()
+ {
+ return "Failed calling " + helper.getName() + " method: ";
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java b/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
index b71a9a4f66d..02cfa08ae8e 100644
--- a/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
@@ -55,7 +55,7 @@ import java.io.PushbackInputStream;
*/
public class LittleEndianInputStream
extends FilterInputStream
- implements abstractDataInputStream
+ implements AbstractDataInput
{
// Byte buffer, used to make primitive read calls more efficient.
byte[] buf = new byte[ 8 ];
diff --git a/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java
index a6d56cfa6d0..6791a82e7c3 100644
--- a/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java
@@ -55,7 +55,7 @@ import java.io.OutputStream;
*/
public class LittleEndianOutputStream
extends FilterOutputStream
- implements abstractDataOutputStream
+ implements AbstractDataOutput
{
/**
* This method initializes an instance of <code>DataOutputStream</code> to
diff --git a/libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java b/libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java
new file mode 100644
index 00000000000..314dd8eb948
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java
@@ -0,0 +1,292 @@
+/* UnknownExceptionCtxHandler.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.GIOP.ServiceContext;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.StringValueHelper;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.lang.reflect.Constructor;
+import java.util.StringTokenizer;
+
+import javax.rmi.CORBA.Util;
+
+/**
+ * Reads the data about an unknown exception from the UnknownExceptionInfo.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class UnknownExceptionCtxHandler
+ extends Vio
+{
+ /**
+ * Encode exception and add its recored to the message service contexts.
+ */
+ public static ServiceContext[] addExceptionContext(ServiceContext[] current,
+ Throwable exception, Object details)
+ {
+ try
+ {
+ ServiceContext[] c = new ServiceContext[current.length + 1];
+ if (current.length > 0)
+ System.arraycopy(current, 0, c, 0, current.length);
+
+ BufferedCdrOutput output = new BufferedCdrOutput();
+
+ if (details instanceof OutputStream)
+ output.setOrb(((OutputStream) output).orb());
+
+ if (details instanceof AbstractCdrOutput)
+ ((AbstractCdrOutput) details).cloneSettings(output);
+
+ write(output, exception);
+
+ ServiceContext xc = new ServiceContext();
+ xc.context_id = ServiceContext.UnknownExceptionInfo;
+ xc.context_data = output.buffer.toByteArray();
+ c[current.length] = xc;
+ return c;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return current;
+ }
+ }
+
+ /**
+ * Write data about unknown exception.
+ */
+ public static void write(BufferedCdrOutput output, Throwable t)
+ {
+ t.fillInStackTrace();
+ output.write_Value(t);
+ }
+
+ /**
+ * Read the data about an unknown exception from the UnknownExceptionInfo.
+ * Following the documentation, this must be just value type, but it seems
+ * that in Sun's implementation is is not, as starts from 0x0. For value type,
+ * this would be null.
+ *
+ * TODO Implement reading and writing in Sun format, making Classpath IIOP
+ * interoperable with Sun's implementation. Current inmplementation reads and
+ * reproduces the exception class type only.
+ *
+ * @param input the input stream to read the context (orb and other settings
+ * are inherited from the main stream that received the message).
+ *
+ * @param contexts all service contexts that were present in the message.
+ *
+ * @return the Throwable, extracted from context, on null, if this has failed.
+ */
+ public static Throwable read(BufferredCdrInput input, ServiceContext[] contexts)
+ {
+ input.mark(Integer.MAX_VALUE);
+
+ int h = input.read_long();
+ if (h == 0)
+ {
+ // This block reads exception info in the Sun specific format.
+ // (currently we read the exception name only).
+ try
+ {
+ // We may need to jump back if the value is read via value
+ // factory.
+ input.mark(512);
+
+ int value_tag = input.read_long();
+ checkTag(value_tag);
+
+ String codebase = null;
+ String[] ids = null;
+ String id = null;
+
+ // Check for the agreed null value.
+ if (value_tag == vt_NULL)
+ return null;
+ else if (value_tag == vt_INDIRECTION)
+ return (Throwable) readIndirection(input);
+ else
+ {
+ // Read the value.
+ if ((value_tag & vf_CODEBASE) != 0)
+ {
+ // The codebase is present. The codebase is a space
+ // separated list of URLs from where the implementing
+ // code can be downloaded.
+ codebase = read_string(input);
+ }
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0)
+ {
+ // Multiple supported repository ids are present.
+ ids = read_string_array(input);
+ }
+ else if ((value_tag & vf_ID) != 0)
+ {
+ // Single supported repository id is present.
+ id = read_string(input);
+ }
+ }
+
+ java.lang.Object ox = createInstance(id, ids, codebase);
+
+ return (Throwable) ox;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+ else
+ {
+ input.reset();
+ // Read as defined in OMG documentation.
+ return (Throwable) input.read_Value();
+ }
+ }
+
+ /**
+ * Load exception by name and create the instance. The reason why this is
+ * different from Vio is because some exceptions have no parameterless
+ * constructor, but have a constructor with the string parameter instead.
+ */
+ static Object createInstance(String id, String[] ids, String codebase)
+ {
+ Object o = _createInstance(id, codebase);
+
+ if (ids != null)
+ for (int i = 0; i < ids.length && o == null; i++)
+ o = _createInstance(ids[i], codebase);
+ return o;
+ }
+
+ static Object _createInstance(String id, String codebase)
+ {
+ if (id == null)
+ return null;
+ if (id.equals(StringValueHelper.id()))
+ return "";
+ StringTokenizer st = new StringTokenizer(id, ":");
+
+ String prefix = st.nextToken();
+ if (prefix.equalsIgnoreCase("IDL"))
+ return ObjectCreator.Idl2Object(id);
+ else if (prefix.equalsIgnoreCase("RMI"))
+ {
+ String className = st.nextToken();
+ String hashCode = st.nextToken();
+ String sid = null;
+ if (st.hasMoreElements())
+ sid = st.nextToken();
+
+ try
+ {
+ Class objectClass = Util.loadClass(className, codebase,
+ Vio.class.getClassLoader());
+
+ String rid = ObjectCreator.getRepositoryId(objectClass);
+
+ if (!rid.equals(id))
+ {
+ // If direct string comparison fails, compare by meaning.
+ StringTokenizer st2 = new StringTokenizer(rid, ":");
+ if (!st2.nextToken().equals("RMI"))
+ throw new InternalError("RMI format expected: '" + rid + "'");
+ if (!st2.nextToken().equals(className))
+ throwIt("Class name mismatch", id, rid, null);
+
+ try
+ {
+ long h1 = Long.parseLong(hashCode, 16);
+ long h2 = Long.parseLong(st2.nextToken(), 16);
+ if (h1 != h2)
+ throwIt("Hashcode mismatch", id, rid, null);
+
+ if (sid != null && st2.hasMoreTokens())
+ {
+ long s1 = Long.parseLong(hashCode, 16);
+ long s2 = Long.parseLong(st2.nextToken(), 16);
+ if (s1 != s2)
+ throwIt("serialVersionUID mismatch", id, rid, null);
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ throwIt("Invalid hashcode or svuid format: ", id, rid, e);
+ }
+ }
+
+ // Some RemoteExceptions have no public parameterless constructor,
+ // but they have constructor taking string as parameter.
+ try
+ {
+ return objectClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ // Try instantiate passing string as parameter.
+ Constructor c = objectClass.getConstructor(new Class[] { String.class });
+ return c.newInstance(new Object[] { "<message unavailable>" });
+ }
+ }
+ catch (MARSHAL m)
+ {
+ m.minor = Minor.Instantiation;
+ throw m;
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate " + id);
+ m.minor = Minor.Instantiation;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ else
+ throw new NO_IMPLEMENT("Unsupported prefix " + prefix + ":");
+ }
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/VMVio.java b/libjava/classpath/gnu/CORBA/CDR/VMVio.java
new file mode 100644
index 00000000000..9b719fd7c50
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/VMVio.java
@@ -0,0 +1,101 @@
+/* VMVio.java -- Native operations, required by value IO.
+ 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. */
+
+/**
+ * This is a temporary replacement for the native call that would allocate
+ * objects without public constructors. The replacement only allocates
+ * objects with public parameterless constructor and objects with public
+ * constructor taking string (like some Throwables).
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ *
+ * TODO FIXME replace by native call like in VMObjectInputStream.
+ * Required modification of Classpath the build system.
+ */
+
+
+package gnu.CORBA.CDR;
+
+import java.lang.reflect.Constructor;
+
+public class VMVio
+{
+ /**
+ * Allocates a new Object of type clazz but without running the default
+ * constructor on it. It then calls the given constructor on it. The given
+ * constructor method comes from the constr_clazz which is a super class of
+ * the given clazz.
+ */
+ public static Object allocateObject(Class clazz, Class constr_clazz,
+ Constructor constructor)
+ throws InstantiationException
+ {
+ try
+ {
+ Constructor c = clazz.getConstructor(new Class[0]);
+ c.setAccessible(true);
+ return c.newInstance(new Object[0]);
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ Constructor c = clazz.getConstructor(new Class[] { String.class });
+ return c.newInstance(new Object[] { "" });
+ }
+ catch (Exception ex2)
+ {
+ Constructor c[] = clazz.getConstructors();
+
+ for (int i = 0; i < c.length; i++)
+ {
+ try
+ {
+ c[i].setAccessible(true);
+ Class[] args = c[i].getParameterTypes();
+ return c[i].newInstance(new Object[args.length]);
+ }
+ catch (Exception ex3)
+ {
+ // Try another one.
+ }
+ }
+ }
+ throw new InstantiationException(clazz.getName());
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/Vio.java b/libjava/classpath/gnu/CORBA/CDR/Vio.java
index 0a37132b26f..fd878cb3555 100644
--- a/libjava/classpath/gnu/CORBA/CDR/Vio.java
+++ b/libjava/classpath/gnu/CORBA/CDR/Vio.java
@@ -1,4 +1,4 @@
-/* gnuValueBaseHelper.java --
+/* Vio.java -- Value type IO operations.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.CORBA.CDR;
+import gnu.CORBA.Minor;
import gnu.CORBA.ObjectCreator;
import org.omg.CORBA.CustomMarshal;
@@ -46,106 +47,144 @@ import org.omg.CORBA.DataOutputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.StringValueHelper;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.WStringValueHelper;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.CORBA.portable.ValueFactory;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.StringTokenizer;
-import java.lang.reflect.Method;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
/**
* A specialised class for reading and writing the value types.
- *
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class Vio
{
/**
- * If true, wrap value type data into chunks. This decrease the
- * performance, but is required for the interoperability with
- * Sun's CORBA implementation. Chunking may increase the security,
- * as there is more control on the number of bytes being transferred.
- *
+ * If true, wrap value type data into chunks. This decrease the performance,
+ * and is not required for interoperability with jdk 1.5, but is left in the
+ * implementation as the optional mode for solving possible interoperability
+ * problems with non-Sun CORBA implementations.
+ *
* The current implementation would accept both single chunk or multiple
- * chunks, but will always send a single chunk.
+ * chunks, but will always send a single chunk (if true) or unchunked data (if
+ * false).
*/
- public static boolean USE_CHUNKING = true;
+ public static boolean USE_CHUNKING = false;
/**
- * The first field in the value record. The last octet may contain
- * additional flags (vf_CODEBASE, vf_ID and vf_MULTIPLE_IDS). The tag
- * value is different for the indirections (vt_INDIRECTION) and
- * nulls (vt_NULL).
+ * The first field in the value record. The last octet may contain additional
+ * flags (vf_CODEBASE, vf_ID and vf_MULTIPLE_IDS). The tag value is different
+ * for the indirections (vt_INDIRECTION) and nulls (vt_NULL).
*/
public static final int vt_VALUE_TAG = 0x7fffff00;
/**
- * The value tag flag, indicating that the codebase URL is present
- * in the value tag record.
+ * The value tag flag, indicating that the codebase URL is present in the
+ * value tag record.
*/
public static final int vf_CODEBASE = 0x1;
/**
- * The value tag flag, indicating that a single repository id is present
- * in the value tag record.
+ * The value tag flag, indicating that a single repository id is present in
+ * the value tag record.
*/
public static final int vf_ID = 0x2;
/**
- * The value tag flag, indicating, that there are multiple repository
- * ids present in the record. If this flag is set, the flag vf_ID must
- * also be set, resulting the value of the least significant byte 0x6.
+ * The value tag flag, indicating, that there are multiple repository ids
+ * present in the record. If this flag is set, the flag vf_ID must also be
+ * set, resulting the value of the least significant byte 0x6.
*/
public static final int vf_MULTIPLE_IDS = 0x4;
/**
* The value tag flag, indicating the presence of chunking. Each chunk is
- * preceeded by a positive int, indicating the number of bytes in the chunk.
- * A sequence of chunks is terminated by a non positive int.
+ * preceeded by a positive int, indicating the number of bytes in the chunk. A
+ * sequence of chunks is terminated by a non positive int.
*/
public static final int vf_CHUNKING = 0x8;
/**
* The indirection tag value. Such tag must be followed by the CORBA long,
* indicating the offset in the CORBA message, where the indirected
- * information is present. This offset is assumed zero at the position
- * where the mentioned CORBA long starts and can refer both forward
- * (positive values) and backward (negative values).
+ * information is present. This offset is assumed zero at the position where
+ * the mentioned CORBA long starts and can refer both forward (positive
+ * values) and backward (negative values).
*/
public static final int vt_INDIRECTION = 0xffffffff;
/**
- * This tag value means that the value object being transferred is equal
- * to null.
+ * This tag value means that the value object being transferred is equal to
+ * null.
*/
public static final int vt_NULL = 0x0;
/**
- * Read the value base from the given input stream. Determines the
- * required class from the repository id. This includes operations
- * that are not required when an unitialised instance or at least
- * class of the value type is known. Hence it may be faster to use
- * the alternative methods, read(InputStream, Class) or
- * read(InputStream, Serializable).
- *
+ * The size of CORBA long (java int).
+ */
+ static final int INT_SIZE = 4;
+
+ /**
+ * The String value helper (one instance is sufficient).
+ */
+ public static final WStringValueHelper m_StringValueHelper = new WStringValueHelper();
+
+ /**
+ * An instance of the value handler.
+ */
+ static ValueHandler handler = Util.createValueHandler();
+
+ /**
+ * Read the value base from the given input stream. Determines the required
+ * class from the repository id. This includes operations that are not
+ * required when an unitialised instance or at least class of the value type
+ * is known. Hence it may be faster to use the alternative methods,
+ * read(InputStream, Class) or read(InputStream, Serializable).
+ *
* @param input a stream to read from.
- *
+ * @param repository_id a repository id of the object being read, may be null.
+ *
* @return the loaded value.
- *
+ *
* @throws MARSHAL if the reading has failed due any reason.
*/
public static Serializable read(InputStream input)
{
- // Explicitly prevent the stream from closing as we may need
- // to read the subsequent bytes as well. Stream may be auto-closed
- // in its finalizer.
+ return read(input, (String) null);
+ }
+
+ /**
+ * Read the value base from the given input stream. Determines the required
+ * class from the repository id. This includes operations that are not
+ * required when an unitialised instance or at least class of the value type
+ * is known. Hence it may be faster to use the alternative methods,
+ * read(InputStream, Class) or read(InputStream, Serializable).
+ *
+ * @param an_input a stream to read from.
+ * @param repository_id a repository id of the object being read, may be null.
+ *
+ * @return the loaded value.
+ *
+ * @throws MARSHAL if the reading has failed due any reason.
+ */
+ public static Serializable read(InputStream input, String repository_id)
+ {
try
{
+ final int position = getCurrentPosition(input);
// We may need to jump back if the value is read via value factory.
input.mark(512);
@@ -154,18 +193,13 @@ public abstract class Vio
String codebase = null;
String[] ids = null;
- String id = null;
-
- // The existing implementing object.
- java.lang.Object ox = null;
+ String id = repository_id;
// Check for the agreed null value.
if (value_tag == vt_NULL)
return null;
else if (value_tag == vt_INDIRECTION)
-
- // TODO FIXME Implement support for indirections.
- throw new NO_IMPLEMENT("Indirections unsupported");
+ return readIndirection(input);
else
{
// Read the value.
@@ -174,152 +208,173 @@ public abstract class Vio
// The codebase is present. The codebase is a space
// separated list of URLs from where the implementing
// code can be downloaded.
- codebase = input.read_string();
+ codebase = read_string(input);
}
if ((value_tag & vf_MULTIPLE_IDS) != 0)
{
// Multiple supported repository ids are present.
- ids = StringSeqHelper.read(input);
- for (int i = 0; (i < ids.length) && (ox == null); i++)
- {
- ox = ObjectCreator.Idl2Object(ids [ i ]);
-
- if (ox == null)
- {
- // Try to find the value factory.
- ValueFactory f =
- ((org.omg.CORBA_2_3.ORB) input.orb()).lookup_value_factory(ids [ i ]);
-
- if (f != null)
- {
- // Reset, as the value factory reads from beginning.
- input.reset();
- return f.read_value((org.omg.CORBA_2_3.portable.InputStream) input);
- }
- }
- }
+ ids = read_string_array(input);
}
else if ((value_tag & vf_ID) != 0)
{
// Single supported repository id is present.
- id = input.read_string();
- ox = ObjectCreator.Idl2Object(id);
-
- if (ox == null)
- {
- // Try to find the value factory.
- ValueFactory f =
- ((org.omg.CORBA_2_3.ORB) input.orb()).lookup_value_factory(id);
-
- if (f != null)
- {
- input.reset();
- return f.read_value((org.omg.CORBA_2_3.portable.InputStream) input);
- }
- }
+ id = read_string(input);
}
}
- if (ox == null)
- throw new MARSHAL("Unable to instantiate the value type");
+ BoxedValueHelper helper = getHelper(null, id);
+ // The existing implementing object.
+ java.lang.Object ox = null;
+
+ if (helper != null)
+ ox = null; // Helper will care about the instantiating.
+ else if (id.equals(WStringValueHelper.id()))
+ helper = m_StringValueHelper;
else
- {
- read_instance(input, ox, value_tag, null);
- return (Serializable) ox;
- }
+ ox = createInstance(id, ids, codebase);
+ return (Serializable) read_instance(input, position, ox, value_tag,
+ helper, id, ids, codebase);
}
catch (Exception ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
}
}
/**
- * Read the value base from the given input stream when
- * the value base class is available. Hence there is no need
- * to guess it from the repository id.
- *
+ * Read the value base from the given input stream when the value base class
+ * is available. Hence there is no need to guess it from the repository id.
+ *
* @param input a stream to read from.
* @param value_class the class of the value being read.
- *
+ *
* @return the loaded value.
- *
+ *
* @throws MARSHAL if the reading has failed due any reason.
*/
public static Serializable read(InputStream input, Class value_class)
{
- // Explicitly prevent the stream from closing as we may need
- // to read the subsequent bytes as well. Stream may be auto-closed
- // in its finalizer.
+ final int position = getCurrentPosition(input);
+
+ String id = null;
+ String[] ids = null;
+ String codebase = null;
+
try
{
int value_tag = input.read_long();
checkTag(value_tag);
- // The existing implementing object.
- java.lang.Object ox = value_class.newInstance();
-
// Check for the agreed null value.
if (value_tag == vt_NULL)
return null;
else if (value_tag == vt_INDIRECTION)
-
- // TODO FIXME Implement support for indirections.
- throw new NO_IMPLEMENT("Indirections unsupported");
+ return readIndirection(input);
else
{
// Read the value.
if ((value_tag & vf_CODEBASE) != 0)
{
- // The codebase is present, but skip it.
- input.read_string();
+ // The codebase is present.
+ codebase = read_string(input);
}
if ((value_tag & vf_MULTIPLE_IDS) != 0)
{
- // Multiple supported repository ids are present, but skip them.
- StringSeqHelper.read(input);
+ // Multiple supported repository ids are present.
+ ids = read_string_array(input);
}
else if ((value_tag & vf_ID) != 0)
{
- // Single supported repository id is present, but skip it.
- input.read_string();
+ // Single supported repository id is present.
+ id = read_string(input);
}
}
- read_instance(input, ox, value_tag, null);
+ BoxedValueHelper vHelper = id != null ? getHelper(value_class, id)
+ : getHelper(value_class, ids);
+
+ java.lang.Object ox;
+
+ if (vHelper == null)
+ {
+ try
+ {
+ ox = createInstance(id, ids, codebase);
+ }
+ catch (Exception e)
+ {
+ ox = null;
+ }
+
+ if (ox != null)
+ {
+ if (value_class != null
+ && !value_class.isAssignableFrom(ox.getClass()))
+ {
+ MARSHAL m = new MARSHAL(ox.getClass() + " is not a "
+ + value_class.getName());
+ m.minor = Minor.ClassCast;
+ throw m;
+ }
+ }
+ }
+ else
+ ox = null;
+
+ ox = read_instance(input, position, ox, value_tag, vHelper, id, ids,
+ codebase);
return (Serializable) ox;
}
+ catch (MARSHAL m)
+ {
+ throw m;
+ }
+ catch (SystemException sysEx)
+ {
+ // OK.
+ throw sysEx;
+ }
catch (Exception ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL("Cant read " + value_class);
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
}
}
/**
- * Read the value base from the given input stream when
- * the unitialised instance is available. Hence there is no need
- * to guess the class from the repository id and then to instantiate
- * an instance.
- *
+ * Read the value base from the given input stream when the unitialised
+ * instance is available. Hence there is no need to guess the class from the
+ * repository id and then to instantiate an instance.
+ *
* @param input a stream to read from.
- *
- * @param value_instance an pre-created instance of the value. If the
- * helper is not null, this parameter is ignored an should be null.
- *
- * @param helper a helper to create an instance and read the object-
- * specific part of the record. If the value_instance is used instead,
- * this parameter should be null.
- *
+ *
+ * @param value_instance an pre-created instance of the value. If the helper
+ * is not null, this parameter is ignored an should be null.
+ *
+ * @param helper a helper to create an instance and read the object- specific
+ * part of the record. If the value_instance is used instead, this parameter
+ * should be null.
+ *
* @return the loaded value.
- *
+ *
* @throws MARSHAL if the reading has failed due any reason.
*/
public static Object read(InputStream input, Object value_instance,
- Object helper
- )
+ BoxedValueHelper helper)
{
+ final int position = getCurrentPosition(input);
+
+ String id = null;
+ String[] ids = null;
+ String codebase = null;
+
try
{
int value_tag = input.read_long();
@@ -329,207 +384,396 @@ public abstract class Vio
if (value_tag == vt_NULL)
return null;
else if (value_tag == vt_INDIRECTION)
-
- // TODO FIXME Implement support for indirections.
- throw new NO_IMPLEMENT("Indirections unsupported");
+ return readIndirection(input);
else
{
// Read the value.
if ((value_tag & vf_CODEBASE) != 0)
{
- // The codebase is present, but skip it.
- input.read_string();
+ // The codebase is present.
+ codebase = read_string(input);
}
if ((value_tag & vf_MULTIPLE_IDS) != 0)
{
- // Multiple supported repository ids are present, but skip them.
- StringSeqHelper.read(input);
+ // Multiple supported repository ids are present.
+ ids = read_string_array(input);
}
else if ((value_tag & vf_ID) != 0)
{
- // Single supported repository id is present, but skip it.
- input.read_string();
+ // Single supported repository id is present.
+ id = read_string(input);
}
}
- value_instance =
- read_instance(input, value_instance, value_tag, helper);
+ Class value_class = value_instance == null ? null
+ : value_instance.getClass();
+
+ if (helper == null)
+ helper = id != null ? getHelper(value_class, id) : getHelper(
+ value_class, ids);
+
+ value_instance = read_instance(input, position, value_instance,
+ value_tag, helper, id, ids, codebase);
return value_instance;
}
catch (Exception ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
}
}
/**
- * Read using provided boxed value helper. This method expects
- * the full value type header, followed by contents, that are
- * delegated to the provided helper. It handles null.
- *
+ * Read using provided boxed value helper. This method expects the full value
+ * type header, followed by contents, that are delegated to the provided
+ * helper. It handles null.
+ *
* @param input the stream to read from.
- * @param helper the helper that reads the type-specific part of
- * the content.
- *
- * @return the value, created by the helper, or null if the
- * header indicates that null was previously written.
+ * @param helper the helper that reads the type-specific part of the content.
+ *
+ * @return the value, created by the helper, or null if the header indicates
+ * that null was previously written.
*/
- public static Serializable read(InputStream input, Object helper)
+ public static Serializable read(InputStream input, BoxedValueHelper helper)
{
return (Serializable) read(input, null, helper);
}
/**
- * Fill in the instance fields by the data from the input stream.
- * The method assumes that the value header, if any, is already
- * behind. The information from the stream is stored into the
- * passed ox parameter.
- *
+ * Fill in the instance fields by the data from the input stream. The method
+ * assumes that the value header, if any, is already behind. The information
+ * from the stream is stored into the passed ox parameter.
+ *
* @param input an input stream to read from.
- *
+ *
* @param value a pre-instantiated value type object, must be either
- * Streamable or CustomMarshal. If the helper is used, this parameter
- * is ignored and should be null.
- *
+ * Streamable or CustomMarshal. If the helper is used, this parameter is
+ * ignored and should be null.
+ *
* @param value_tag the tag that must be read previously.
- * @param helper the helper for read object specific part; may be
- * null to read in using other methods.
- *
+ * @param helper the helper for read object specific part; may be null to read
+ * in using other methods.
+ *
* @return the value that was read.
*/
- private static Object read_instance(InputStream input, Object value,
- int value_tag, Object helper
- )
+ static Object read_instance(InputStream input, final int position,
+ Object value, int value_tag, BoxedValueHelper helper, String id,
+ String[] ids, String codebase)
{
+ if (helper != m_StringValueHelper && id != null)
+ if (id.equals(StringValueHelper.id()))
+ {
+ value = null;
+ helper = m_StringValueHelper;
+ }
+
try
{
if ((value_tag & vf_CHUNKING) != 0)
{
- ByteArrayOutputStream bout = null;
- int n = -1;
-
- // Read all chunks.
- int chunk_size = input.read_long();
- if (chunk_size < 0)
- throw new MARSHAL("Invalid first chunk size " + chunk_size);
-
- byte[] r = new byte[ chunk_size ];
-
- while (chunk_size > 0)
- {
- if (r.length < chunk_size)
- r = new byte[ chunk_size + 256 ];
-
- n = 0;
- reading:
- while (n < chunk_size)
- n += input.read(r, n, r.length - n);
-
- // Read the size of the next chunk.
- chunk_size = input.read_long();
-
- // If the value is non negative, there is more than one chunk.
- // Accumulate chunks in the buffer.
- // The last chunk (or the only chunk, if only one chunk is
- // present) is not written in the buffer. It is stored in the
- // array r, avoiding unnecessary buffer operations.
- if (chunk_size > 0)
- {
- bout = new ByteArrayOutputStream(2 * chunk_size);
- bout.write(r, 0, chunk_size);
- }
- }
+ BufferedCdrOutput output = createBuffer(input, 1024);
+ // Read the current (not a nested one) value in this spec case.
+ readNestedValue(value_tag, input, output, -1);
+ BufferredCdrInput ci = new BufferredCdrInput(output.buffer.getBuffer());
+ ci.setRunTime(output.getRunTime());
- if (bout != null)
- {
- // More than one chunk was present.
- // Add the last chunk.
- bout.write(r, 0, n);
- input = new noHeaderInput(bout.toByteArray());
- }
- else
- {
- // Only one chunk was present.
- input = new noHeaderInput(r);
- }
+ input = new HeadlessInput(ci, input);
}
else
{
- if (input instanceof cdrBufInput)
+ if (input instanceof BufferredCdrInput)
{
// Highly probable case.
- input =
- new noHeaderInput(((cdrBufInput) input).buffer.getBuffer());
+ input = new HeadlessInput((BufferredCdrInput) input, null);
+ }
+ else if (input instanceof HeadlessInput)
+ {
+ // There is no need to instantiate one more HeadlessInput
+ // as we can just reset.
+ ((HeadlessInput) input).subsequentCalls = false;
}
else
{
- cdrBufOutput bout = new cdrBufOutput();
+ BufferedCdrOutput bout = new BufferedCdrOutput();
int c;
while ((c = input.read()) >= 0)
bout.write((byte) c);
- input = new noHeaderInput(bout.buffer.toByteArray());
+ input = new HeadlessInput(
+ (BufferredCdrInput) bout.create_input_stream(), input);
}
}
}
catch (IOException ex)
{
MARSHAL m = new MARSHAL("Unable to read chunks");
+ m.minor = Minor.Value;
m.initCause(ex);
throw m;
}
- // The user-defines io operations are implemented.
- if (value instanceof CustomMarshal)
+ return readValue(input, position, value, helper, id, ids, codebase);
+ }
+
+ /**
+ * Create a buffer, inheriting critical settings from the passed input stream.
+ */
+ private static BufferedCdrOutput createBuffer(InputStream input, int proposed_size)
+ {
+ BufferedCdrOutput bout;
+ bout = new BufferedCdrOutput(2 * proposed_size + 256);
+
+ if (input instanceof BufferredCdrInput)
{
- CustomMarshal marsh = (CustomMarshal) value;
- try
+ BufferredCdrInput in = (BufferredCdrInput) input;
+ bout.setBigEndian(in.isBigEndian());
+ }
+
+ if (input instanceof gnuValueStream)
+ bout.setRunTime(((gnuValueStream) input).getRunTime());
+ else
+ bout.setRunTime(new gnuRuntime(null, null));
+ return bout;
+ }
+
+ /**
+ * Read the chunked nested value from the given input stream, transferring the
+ * contents to the given output stream.
+ *
+ * @param value_tag the value tag of the value being read.
+ * @param input the input stream from where the remainder of the nested value
+ * must be read.
+ * @param output the output stream where the unchunked nested value must be
+ * copied.
+ *
+ * @return the tag that ended the nested value.
+ */
+ public static int readNestedValue(int value_tag, InputStream input,
+ BufferedCdrOutput output, int level)
+ throws IOException
+ {
+ String id = null;
+ if (level < -1)
+ {
+ // For the first level, this information is already behind.
+ output.write_long(value_tag - vf_CHUNKING);
+
+ // The nested value should be aways chunked.
+ if ((value_tag & vf_CHUNKING) == 0)
+ {
+ MARSHAL m = new MARSHAL("readNestedValue: must be chunked");
+ m.minor = Minor.Chunks;
+ throw m;
+ }
+ else if (value_tag == vt_NULL)
+ {
+ MARSHAL m = new MARSHAL("readNestedValue: nul");
+ m.minor = Minor.Chunks;
+ throw m;
+ }
+ else if (value_tag == vt_INDIRECTION)
{
- marsh.unmarshal((DataInputStream) input);
+ MARSHAL m = new MARSHAL("readNestedValue: indirection");
+ m.minor = Minor.Chunks;
+ throw m;
}
- catch (ClassCastException ex)
+ else
{
- incorrect_plug_in(ex);
+ // Read the value.
+ if ((value_tag & vf_CODEBASE) != 0)
+ {
+ String codebase = read_string(input);
+ write_string(output, codebase);
+ }
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0)
+ {
+ // Multiple supported repository ids are present.
+ String[] ids = read_string_array(input);
+ id = ids[0];
+ write_string_array(output, ids);
+ }
+ else if ((value_tag & vf_ID) != 0)
+ {
+ id = read_string(input);
+ write_string(output, id);
+ }
}
}
+
+ int n = -1;
+
+ // Read all chunks.
+ int chunk_size;
+
+ byte[] r = null;
+
+ while (true)
+ {
+ // Read the size of the next chunk or it may also be the
+ // header of the nested value.
+ chunk_size = input.read_long();
+
+ // End of chunk terminator.
+ if (chunk_size < 0 && chunk_size >= level)
+ return chunk_size;
+ else if (chunk_size >= 0x7FFFFF00)
+ {
+ int onInput = getCurrentPosition(input) - 4;
+ int onOutput = output.getPosition();
+ output.getRunTime().redirect(onInput, onOutput);
+ // Value over 0x7FFFFF00 indicates that the nested value
+ // starts here. Read the nested value, storing it into the output.
+ // First parameter is actually the value tag.
+ chunk_size = readNestedValue(chunk_size, input, output, level - 1);
+ if (chunk_size < 0 && chunk_size >= level)
+ return chunk_size;
+ }
+ else
+ {
+ // The chunk follows.
+ if (r == null || r.length < chunk_size)
+ r = new byte[chunk_size + 256];
+
+ n = 0;
+ reading: while (n < chunk_size)
+ n += input.read(r, n, chunk_size - n);
+ output.write(r, 0, n);
+ }
+ }
+ }
+
+ /**
+ * Read the value (the header must be behind).
+ */
+ public static Serializable readValue(InputStream input, final int position,
+ Object value, BoxedValueHelper helper, String id, String[] ids,
+ String codebase)
+ {
+ gnuRuntime g;
+ gnuValueStream c = ((gnuValueStream) input);
+ if (c.getRunTime() == null)
+ {
+ g = new gnuRuntime(codebase, value);
+ c.setRunTime(g);
+ }
+ else
+ {
+ g = c.getRunTime();
+ g.addCodeBase(codebase);
+ g.target = (Serializable) value;
+ }
+ if (value != null)
+ g.objectWritten(value, position);
+
+ if (input instanceof HeadlessInput)
+ ((HeadlessInput) input).subsequentCalls = false;
+
+ boolean ok = true;
+
+ // The user-defined io operations are implemented.
+ if (value instanceof CustomMarshal)
+ {
+ CustomMarshal marsh = (CustomMarshal) value;
+ marsh.unmarshal((DataInputStream) input);
+ }
else
// The IDL-generated io operations are implemented.
if (value instanceof Streamable)
{
((Streamable) value)._read(input);
}
- else if (helper instanceof BoxedValueHelper)
- value = ((BoxedValueHelper) helper).read_value(input);
- else if (helper instanceof ValueFactory)
- value =
- ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input);
+ else if (helper != null)
+ {
+ // If helper is non-null the value should normally be null.
+ value = helper.read_value(input);
+ g.objectWritten(value, position);
+ }
else
+ {
+ ok = false;
+ ValueFactory factory = null;
+ org.omg.CORBA_2_3.ORB orb = (org.omg.CORBA_2_3.ORB) input.orb();
- // Stating the interfaces that the USER should use.
- throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue or CustomValue."
- );
+ if (id != null)
+ factory = orb.lookup_value_factory(id);
- // The negative end of state marker is expected from OMG standard.
- // If the chunking is used, this marker is already extracted.
- if ((value_tag & vf_CHUNKING) == 0)
+ if (factory == null && ids != null)
+ {
+ for (int i = 0; i < ids.length && factory == null; i++)
+ {
+ factory = orb.lookup_value_factory(ids[i]);
+ }
+ }
+
+ if (factory != null)
+ {
+ value = factory.read_value((org.omg.CORBA_2_3.portable.InputStream) input);
+ ok = true;
+ }
+ }
+
+ if (!ok && value instanceof Serializable)
+ // Delegate to ValueHandler
{
- int eor = input.read_long();
- if (eor >= 0)
- throw new MARSHAL("End of state marker has an invalid value " + eor);
+ if (ids != null && ids.length > 0)
+ id = ids[0];
+
+ value = handler.readValue(input, position, value.getClass(), id, g);
+ ok = true;
}
- return value;
+ if (!ok)
+ {
+ if (value != null)
+ {
+ MARSHAL m = new MARSHAL(value.getClass().getName()
+ + " must be Streamable, CustomMarshal or Serializable");
+ m.minor = Minor.UnsupportedValue;
+ throw m;
+ }
+ else
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate " + id + ":" + list(ids)
+ + " helper " + helper);
+ m.minor = Minor.UnsupportedValue;
+ throw m;
+ }
+ }
+ else
+ return (Serializable) value;
+ }
+
+ /**
+ * Conveniency method to list ids in exception reports.
+ */
+ static String list(String[] s)
+ {
+ if (s == null)
+ return "null";
+ else
+ {
+ StringBuffer b = new StringBuffer("{");
+ for (int i = 0; i < s.length; i++)
+ {
+ b.append(s[i]);
+ b.append(" ");
+ }
+ b.append("}");
+ return b.toString();
+ }
}
/**
* Write the value base into the given stream.
- *
+ *
* @param output a stream to write to.
- *
+ *
* @param value a value type object, must be either Streamable or
* CustomMarshal.
- *
+ *
* @throws MARSHAL if the writing failed due any reason.
*/
public static void write(OutputStream output, Serializable value)
@@ -537,45 +781,82 @@ public abstract class Vio
// Write null if this is a null value.
if (value == null)
output.write_long(vt_NULL);
+ else if (value instanceof String)
+ write(output, value, m_StringValueHelper);
else
- write(output, value, ObjectCreator.toIDL(value.getClass().getName()));
- }
-
- /**
- * Write the value base into the given stream, stating that it is an
- * instance of the given class. The written record has no repository
- * id and requires to supply a class or initialised instance for reading
- * rather than an actual class it is.
- *
- * This results writing a different repository id.
- *
- * If the passed value implements the {@link CustomMarshal},
- * the helper uses {@link CustomMarshal#marshal}
- * to write the content in a user defined way. Otherwise,
- * this implementation initialises the {@link ObjectOutputStream}
- * and writes through it.
- *
+ write(output, value, value.getClass());
+ }
+
+ /**
+ * Write the value base into the given stream, stating that it is an instance
+ * of the given class.
+ *
* @param output a stream to write to.
- *
+ *
* @param value a value to write.
- *
+ *
* @throws MARSHAL if the writing failed due any reason.
*/
public static void write(OutputStream output, Serializable value,
- Class substitute
- )
+ Class substitute)
{
// Write null if this is a null value.
if (value == null)
output.write_long(vt_NULL);
+ else if (value instanceof String || substitute == String.class)
+ writeString(output, value);
+ else
+ {
+ String vId = ObjectCreator.getRepositoryId(value.getClass());
+ if (substitute == null || value.getClass().equals(substitute))
+ write_instance(output, value, vId, getHelper(value.getClass(), vId));
+ else
+ {
+ String vC = ObjectCreator.getRepositoryId(substitute);
+ String[] ids = new String[] { vId, vC };
+ BoxedValueHelper h = getHelper(substitute.getClass(), ids);
+ // If the helper is available, it is also responsible for
+ // providing the repository Id. Otherwise, write both
+ // ids.
+ if (h == null)
+ write_instance(output, value, ids, null);
+ else
+ write_instance(output, value, h.get_id(), null);
+ }
+ }
+ }
+ /**
+ * Write the value base into the given stream, supplementing it with an array
+ * of the provided repository ids plus the repository id, derived from the
+ * passed value.
+ *
+ * @param output a stream to write to.
+ *
+ * @param value a value to write.
+ *
+ * @throws MARSHAL if the writing failed due any reason.
+ */
+ public static void write(OutputStream output, Serializable value,
+ String[] multiple_ids)
+ {
+ // Write null if this is a null value.
+ if (value == null)
+ output.write_long(vt_NULL);
else
- write(output, value, ObjectCreator.toIDL(substitute.getName()));
+ {
+ String[] ids = new String[multiple_ids.length + 1];
+ ids[0] = ObjectCreator.getRepositoryId(value.getClass());
+ System.arraycopy(multiple_ids, 0, ids, 1, multiple_ids.length);
+ BoxedValueHelper h = getHelper(value.getClass(), ids);
+ write_instance(output, value, ids, h);
+ }
}
/**
- * Write value when its repository Id is explicitly given.
- *
+ * Write value when its repository Id is explicitly given. Only this Id is
+ * written, the type of value is not taken into consideration.
+ *
* @param output an output stream to write into.
* @param value a value to write.
* @param id a value repository id.
@@ -585,172 +866,608 @@ public abstract class Vio
if (value == null)
output.write_long(vt_NULL);
else
- write_instance(output, value, id, null);
+ write_instance(output, value, id, getHelper(value.getClass(), id));
}
/**
- * Write standard value type header, followed by contents, produced
- * by the boxed value helper.
- *
+ * Write standard value type header, followed by contents, produced by the
+ * boxed value helper.
+ *
* @param output the stream to write to.
* @param value the value to write, can be null.
- * @param helper the helper that writes the value content if it is
- * not null.
+ * @param helper the helper that writes the value content if it is not null
+ * (must be provided for this method).
*/
public static void write(OutputStream output, Serializable value,
- Object helper
- )
+ BoxedValueHelper helper)
{
+ if (helper == null)
+ throw new AssertionError("Helper must be provided");
if (value == null)
output.write_long(vt_NULL);
else
+ write_instance(output, value, helper.get_id(), helper);
+ }
+
+ /**
+ * Write the parameter that is surely a string and not null.
+ */
+ private static void writeString(OutputStream output, Serializable string)
+ {
+ write_instance(output, string, m_StringValueHelper.get_id(),
+ m_StringValueHelper);
+ }
+
+ /**
+ * Write value when its repository Id is explicitly given. Does not handle
+ * null.
+ *
+ * @param output an output stream to write into.
+ * @param value a value to write.
+ * @param id a value repository id (can be either single string or string
+ * array).
+ * @param helper a helper, writing object - specifical part. Can be null if
+ * the value should be written using other methods.
+ */
+ static void write_instance(OutputStream output, Serializable value,
+ Object ids, BoxedValueHelper helper)
+ {
+ gnuValueStream rout = null;
+ gnuRuntime runtime = null;
+
+ try
{
- String id;
+ if (output instanceof gnuValueStream)
+ {
+ int position;
+ rout = (gnuValueStream) output;
+ runtime = rout.getRunTime();
+
+ if (runtime == null)
+ {
+ runtime = new gnuRuntime(null, value);
+ rout.setRunTime(runtime);
+ rout.getRunTime().objectWritten(value,
+ position = rout.getPosition());
+ }
+ else if (runtime.target == value)
+ {
+ if (!writeSelf(output, value))
+ throw new InternalError("Recursive helper call for "
+ + value.getClass().getName());
+ return;
+ }
+ else
+ {
+ position = runtime.isWrittenAt(value);
+ if (position >= 0)
+ {
+ // The object was already written.
+ output.write_long(vt_INDIRECTION);
+ output.write_long(position - rout.getPosition());
+ // Replacing object write data by indirection reference.
+ return;
+ }
+ else
+ {
+ runtime.objectWritten(value, position = rout.getPosition());
+ }
+ }
+ }
+
+ int value_tag = vt_VALUE_TAG;
+
+ if (ids instanceof String)
+ value_tag |= vf_ID;
+ else if (ids instanceof String[])
+ // OMG standard requires to set both flags.
+ value_tag |= vf_MULTIPLE_IDS | vf_ID;
- if (helper instanceof BoxedValueHelper)
- id = ((BoxedValueHelper) helper).get_id();
+ int chunkSizeLocation;
+
+ OutputStream outObj;
+
+ if (USE_CHUNKING)
+ {
+ // Wrap the value being written into one chunk (makes sense only for
+ // compatibility reasons).
+ outObj = output;
+ value_tag |= vf_CHUNKING;
+ }
+ else
+ outObj = output;
+
+ output.write_long(value_tag);
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0)
+ write_string_array(output, (String[]) ids);
+ else if ((value_tag & vf_ID) != 0)
+ write_string(output, (String) ids);
+
+ if (USE_CHUNKING)
+ {
+ // So far, write 0x55555555 instead of the chunk size (alignment may
+ // take place).
+ output.write_long(0x55555555);
+ // If the chunking is involved, the chunk size must be written here.
+ chunkSizeLocation = rout.getPosition() - INT_SIZE;
+ }
else
- id = "";
+ // Not in use for this case.
+ chunkSizeLocation = -1;
+
+ writeValue(outObj, value, helper);
- write_instance(output, value, id, helper);
+ if (USE_CHUNKING)
+ {
+ // Write the chunk size where the place for it was reserved.
+ int chunkSize = rout.getPosition() - chunkSizeLocation - INT_SIZE;
+ int current = rout.getPosition();
+ rout.seek(chunkSizeLocation);
+ output.write_long(chunkSize);
+ rout.seek(current);
+
+ // The end of record marker.
+ output.write_long(-1);
+ }
+ }
+ finally
+ {
+ if (runtime != null)
+ runtime.target = null;
}
}
/**
- * Write value when its repository Id is explicitly given.
- * Does not handle null.
- *
- * @param output an output stream to write into.
- * @param value a value to write.
- * @param id a value repository id.
- * @param helper a helper, writing object - specifica part. Can be null
- * if the value should be written unsing other methods.
+ * Write value (after header).
*/
- private static void write_instance(OutputStream output, Serializable value,
- String id, Object helper
- )
+ static void writeValue(OutputStream output, Serializable value,
+ BoxedValueHelper helper)
{
- // This implementation always writes a single repository id.
- // It never writes multiple repository ids and currently does not use
- // a codebase.
- int value_tag = vt_VALUE_TAG | vf_ID;
+ ((gnuValueStream) output).getRunTime().target = value;
+ if (helper != null)
+ helper.write_value(output, value);
+ else if (!writeSelf(output, value))
+ {
+ // Try to find helper via class loader.
+ boolean ok = false;
- OutputStream outObj;
- cdrBufOutput out = null;
+ if (!ok)
+ {
+ if (output instanceof BufferedCdrOutput)
+ {
+ BufferedCdrOutput b = (BufferedCdrOutput) output;
+ if (b.runtime == null)
+ b.runtime = new gnuRuntime(null, value);
+ }
- if (USE_CHUNKING)
+ handler.writeValue(output, value);
+ }
+ }
+ }
+
+ /**
+ * Try to write value supposing that it implements self-streamable interfaces.
+ * Return false if it does not or true on success.
+ */
+ static boolean writeSelf(OutputStream output, Serializable value)
+ {
+ // User defined write method is present.
+ if (value instanceof CustomMarshal)
{
- out = new cdrBufOutput();
- out.setOrb(output.orb());
- outObj = out;
- value_tag |= vf_CHUNKING;
+ ((CustomMarshal) value).marshal((DataOutputStream) output);
+ return true;
}
- else
- outObj = output;
+ else if (value instanceof Streamable)
+ {
+ ((Streamable) value)._write(output);
+ return true;
+ }
+ return false;
+ }
- output.write_long(value_tag);
- output.write_string(id);
+ /**
+ * Read the indirection data and return the object that was already written to
+ * this stream.
+ *
+ * @param an_input the input stream, must be BufferredCdrInput.
+ */
+ static Serializable readIndirection(InputStream an_input)
+ {
+ if (!(an_input instanceof gnuValueStream))
+ throw new NO_IMPLEMENT(gnuValueStream.class.getName()
+ + " expected as parameter");
- if (helper instanceof BoxedValueHelper)
+ gnuValueStream in = (gnuValueStream) an_input;
+
+ int current_pos = in.getPosition();
+
+ int offset = an_input.read_long();
+ if (offset > -INT_SIZE)
{
- ((BoxedValueHelper) helper).write_value(outObj, value);
+ MARSHAL m = new MARSHAL("Indirection tag refers to " + offset
+ + " (must be less than -" + INT_SIZE + ")");
+ m.minor = Minor.Offset;
+ throw m;
}
- else
- // User defince write method is present.
- if (value instanceof CustomMarshal)
+
+ int stored_at = current_pos + offset;
+
+ if (in.getRunTime() == null)
+ {
+ MARSHAL m = new MARSHAL(stored_at + " offset " + offset + ": not written");
+ m.minor = Minor.Value;
+ throw m;
+ }
+
+ return (Serializable) in.getRunTime().isObjectWrittenAt(stored_at, offset);
+ }
+
+ /**
+ * Check the passed value tag for correctness.
+ *
+ * @param value_tag a tag to check, must be between 0x7fffff00 and 0x7fffffff
+ *
+ * @throws MARSHAL if the tag is outside this interval.
+ */
+ static void checkTag(int value_tag)
+ {
+ if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff)
+ && value_tag != vt_NULL && value_tag != vt_INDIRECTION)
+ {
+ MARSHAL m = new MARSHAL("Invalid value record, unsupported header tag: "
+ + value_tag + " (0x" + Integer.toHexString(value_tag) + ")");
+ m.minor = Minor.ValueHeaderTag;
+ throw m;
+ }
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0 && (value_tag & vf_ID) == 0)
{
+ MARSHAL m = new MARSHAL("Invalid value record header flag combination (0x"
+ + Integer.toHexString(value_tag) + ")");
+ m.minor = Minor.ValueHeaderFlags;
+ throw m;
+ }
+ }
+
+ /**
+ * Throw MARSHAL.
+ */
+ static void throwIt(String msg, String id1, String id2, Throwable e)
+ throws MARSHAL
+ {
+ MARSHAL m = new MARSHAL(msg + ":'" + id1 + "' versus '" + id2 + "'");
+ if (e != null)
+ m.initCause(e);
+ m.minor = Minor.Value;
+ throw m;
+ }
+
+ /**
+ * Load class by name and create the instance.
+ */
+ static Object createInstance(String id, String[] ids, String codebase)
+ {
+ Object o = null;
+
+ if (id != null)
+ o = _createInstance(id, codebase);
+
+ if (ids != null)
+ for (int i = 0; i < ids.length && o == null; i++)
+ o = _createInstance(ids[i], codebase);
+ return o;
+ }
+
+ static Object _createInstance(String id, String codebase)
+ {
+ if (id == null)
+ return null;
+ if (id.equals(StringValueHelper.id()))
+ return "";
+ StringTokenizer st = new StringTokenizer(id, ":");
+
+ String prefix = st.nextToken();
+ if (prefix.equalsIgnoreCase("IDL"))
+ return ObjectCreator.Idl2Object(id);
+ else if (prefix.equalsIgnoreCase("RMI"))
+ {
+ String className = st.nextToken();
+ String hashCode = st.nextToken();
+ String sid = null;
+ if (st.hasMoreElements())
+ sid = st.nextToken();
+
try
{
- ((CustomMarshal) value).marshal((DataOutputStream) outObj);
+ Class objectClass = Util.loadClass(className, codebase,
+ Vio.class.getClassLoader());
+
+ String rid = ObjectCreator.getRepositoryId(objectClass);
+
+ if (!rid.equals(id))
+ {
+ // If direct string comparison fails, compare by meaning.
+ StringTokenizer st2 = new StringTokenizer(rid, ":");
+ if (!st2.nextToken().equals("RMI"))
+ throw new InternalError("RMI format expected: '" + rid + "'");
+ if (!st2.nextToken().equals(className))
+ throwIt("Class name mismatch", id, rid, null);
+
+ try
+ {
+ long h1 = Long.parseLong(hashCode, 16);
+ long h2 = Long.parseLong(st2.nextToken(), 16);
+ if (h1 != h2)
+ throwIt("Hashcode mismatch", id, rid, null);
+
+ if (sid != null && st2.hasMoreTokens())
+ {
+ long s1 = Long.parseLong(hashCode, 16);
+ long s2 = Long.parseLong(st2.nextToken(), 16);
+ if (s1 != s2)
+ throwIt("serialVersionUID mismatch", id, rid, null);
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ throwIt("Invalid hashcode or svuid format: ", id, rid, e);
+ }
+ }
+
+ // Low - level instantiation required here.
+ return instantiateAnyWay(objectClass);
}
- catch (ClassCastException ex)
+ catch (Exception ex)
{
- incorrect_plug_in(ex);
+ MARSHAL m = new MARSHAL("Unable to instantiate " + id);
+ m.minor = Minor.Instantiation;
+ m.initCause(ex);
+ throw m;
}
}
- else if (value instanceof Streamable)
+ else
+ throw new NO_IMPLEMENT("Unsupported prefix " + prefix + ":");
+ }
+
+ /**
+ * Read string, expecting the probable indirection.
+ */
+ static String read_string(InputStream input)
+ {
+ gnuValueStream g = (gnuValueStream) input;
+ int previous = g.getPosition();
+ int l = input.read_long();
+ if (l != vt_INDIRECTION)
{
- ((Streamable) value)._write(outObj);
+ g.seek(previous);
+ String s = input.read_string();
+ if (g.getRunTime() == null)
+ g.setRunTime(new gnuRuntime(null, null));
+ g.getRunTime().singleIdWritten(s, previous);
+ return s;
}
else
{
- // Try to find helper via class loader.
- boolean ok = false;
- try
+ gnuRuntime r = g.getRunTime();
+ int base = g.getPosition();
+ int delta = input.read_long();
+ if (r == null)
{
- Class helperClass = Class.forName(ObjectCreator.toHelperName(id));
-
- // It will be the helper for the encapsulated boxed value, not the
- // for the global boxed value type itself.
- Method write =
- helperClass.getMethod("write",
- new Class[]
- {
- org.omg.CORBA.portable.OutputStream.class, value.getClass()
- }
- );
- write.invoke(null, new Object[] { outObj, value });
- ok = true;
+ previous = g.getPosition();
+ g.seek(base + delta);
+ String indir = input.read_string();
+ g.seek(previous);
+ return indir;
}
- catch (Exception ex)
+ else
{
- ok = false;
+ return (String) r.isObjectWrittenAt(base + delta, delta);
}
+ }
+ }
- // Stating the interfaces that the USER should use.
- if (!ok)
- throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue" + " or CustomValue."
- );
+ /**
+ * Read string array, expecting the probable indirection.
+ */
+ static String[] read_string_array(InputStream input)
+ {
+ gnuValueStream g = (gnuValueStream) input;
+ int previous = g.getPosition();
+ int l = input.read_long();
+ if (l != vt_INDIRECTION)
+ {
+ g.seek(previous);
+ String[] s = StringSeqHelper.read(input);
+ if (g.getRunTime() == null)
+ g.setRunTime(new gnuRuntime(null, null));
+ g.getRunTime().objectWritten(s, previous);
+ return s;
}
+ else
+ {
+ gnuRuntime r = g.getRunTime();
+ int base = g.getPosition();
+ int delta = input.read_long();
+ if (r == null)
+ {
+ previous = g.getPosition();
+ g.seek(base + delta);
+ String[] indir = StringSeqHelper.read(input);
+ g.seek(previous);
+ return indir;
+ }
+ else
+ {
+ return (String[]) r.isObjectWrittenAt(base + delta, delta);
+ }
+ }
+ }
- if (USE_CHUNKING)
+ /**
+ * Write repository Id, probably shared.
+ */
+ static void write_string(OutputStream output, String id)
+ {
+ if (output instanceof gnuValueStream)
{
- output.write_long(out.buffer.size());
- try
+ gnuValueStream b = (gnuValueStream) output;
+ if (b != null)
+ {
+ int written = b.getRunTime().idWrittenAt(id);
+ if (written >= 0)
+ {
+ // Reuse existing id record.
+ output.write_long(vt_INDIRECTION);
+ int p = b.getPosition();
+ output.write_long(written - p);
+ }
+ else
+ {
+ b.getRunTime().singleIdWritten(id, b.getPosition());
+ output.write_string(id);
+ }
+ }
+ }
+ else
+ output.write_string(id);
+ }
+
+ /**
+ * Write repository Id, probably shared.
+ */
+ static void write_string_array(OutputStream output, String[] ids)
+ {
+ if (output instanceof gnuValueStream)
+ {
+ gnuValueStream b = (gnuValueStream) output;
+ if (b != null)
{
- out.buffer.writeTo(output);
+ int written = b.getRunTime().idWrittenAt(ids);
+ if (written >= 0)
+ {
+ // Reuse existing id record.
+ output.write_long(vt_INDIRECTION);
+ int p = b.getPosition();
+ output.write_long(written - p);
+ }
+ else
+ {
+ b.getRunTime().multipleIdsWritten(ids, b.getPosition());
+ StringSeqHelper.write(output, ids);
+ }
}
- catch (IOException ex)
+ }
+ else
+ StringSeqHelper.write(output, ids);
+ }
+
+ /**
+ * Get the helper that could write the given object, or null if no pre-defined
+ * helper available for this object.
+ */
+ public static BoxedValueHelper getHelper(Class x, Object ids)
+ {
+ if (x != null && x.equals(String.class))
+ return m_StringValueHelper;
+ else if (x != null && x.isArray())
+ return new ArrayValueHelper(x);
+ else if (ids instanceof String)
+ return locateHelper((String) ids);
+ else if (ids instanceof String[])
+ {
+ String[] ia = (String[]) ids;
+ BoxedValueHelper h;
+ for (int i = 0; i < ia.length; i++)
{
- MARSHAL m = new MARSHAL();
- m.initCause(ex);
- throw m;
+ h = locateHelper(ia[i]);
+ if (h != null)
+ return h;
}
+ return null;
}
+ else
+ return null;
+ }
- // The end of record marker, required by OMG standard.
- output.write_long(-1);
+ /**
+ * Get the helper that could write the given object, or null if no pre-defined
+ * helper available for this object.
+ */
+ public static BoxedValueHelper getHelper(Class x, String id)
+ {
+ if (x != null && x.equals(String.class))
+ return m_StringValueHelper;
+ else if (x != null && x.isArray())
+ return new ArrayValueHelper(x);
+ else
+ return locateHelper(id);
}
/**
- * This can be called if the alternative CORBA implementation
- * is incorrectly plugged in.
- *
- * @throws NO_IMPLEMENT, always.
+ * Try to locate helper from the repository id.
*/
- static void incorrect_plug_in(Throwable ex) throws NO_IMPLEMENT
+ static BoxedValueHelper locateHelper(String id)
{
- NO_IMPLEMENT no = new NO_IMPLEMENT("Incorrect CORBA plug-in");
- no.initCause(ex);
- throw no;
+ if (id != null)
+ {
+ if (id.equals(m_StringValueHelper.get_id()))
+ return m_StringValueHelper;
+ else
+ // Try to locate helper for IDL type.
+ if (id.startsWith("IDL:"))
+ {
+ try
+ {
+ Class helperClass = ObjectCreator.findHelper(id);
+ if (BoxedValueHelper.class.isAssignableFrom(helperClass))
+ return (BoxedValueHelper) helperClass.newInstance();
+ else if (helperClass != null)
+ return new IDLTypeHelper(helperClass);
+ else
+ return null;
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+ }
+ return null;
}
/**
- * Check the passed value tag for correctness.
- *
- * @param value_tag a tag to check, must be between 0x7fffff00 and 0x7fffffff
- *
- * @throws MARSHAL if the tag is outside this interval.
+ * Get the current position.
*/
- private static final void checkTag(int value_tag)
+ static int getCurrentPosition(InputStream x)
{
- if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) &&
- value_tag != vt_NULL &&
- value_tag != vt_INDIRECTION
- )
- throw new MARSHAL("Invalid value record, unsupported header tag: " +
- value_tag
- );
+ if (x instanceof gnuValueStream)
+ return ((gnuValueStream) x).getPosition();
+ else
+ return 0;
+ }
+
+ /**
+ * Instantiate an instance of this class anyway; also in the case when it has
+ * no parameterless or any other constructor. The fields will be assigned
+ * while reading the class from the stream.
+ *
+ * @param clazz a class for that the instance should be instantiated.
+ */
+ public static Object instantiateAnyWay(Class clazz)
+ throws Exception
+ {
+ Class first_nonserial = clazz;
+
+ while (Serializable.class.isAssignableFrom(first_nonserial)
+ || Modifier.isAbstract(first_nonserial.getModifiers()))
+ first_nonserial = first_nonserial.getSuperclass();
+
+ final Class local_constructor_class = first_nonserial;
+
+ Constructor constructor = local_constructor_class.getDeclaredConstructor(new Class[0]);
+
+ return VMVio.allocateObject(clazz, constructor.getDeclaringClass(),
+ constructor);
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java b/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
new file mode 100644
index 00000000000..774c92816ae
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
@@ -0,0 +1,336 @@
+/* gnuRuntime.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.MARSHAL;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * Our implementation of the sending context runtime.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class gnuRuntime
+ extends LocalObject
+ implements org.omg.SendingContext.RunTime
+{
+ /**
+ * The data entry about the object that was written.
+ */
+ static class Entry
+ {
+ /**
+ * The stream position, where the object was written.
+ */
+ int at;
+
+ /**
+ * The object that was written.
+ */
+ Object object;
+
+ public String toString()
+ {
+ return object + "[" + at + "] "+object.getClass().getName();
+ }
+ }
+
+ /**
+ * The instruction that the actual object is stored at different location.
+ * Used when processing chunked data where positions shifts due removing the
+ * chunking tags.
+ */
+ static class Redirection
+ extends Entry
+ {
+ public String toString()
+ {
+ return "->" + at;
+ }
+ }
+
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The history of the written objects, maps object to records. The different
+ * objects must be treated as different regardless that .equals returns.
+ */
+ private Map sh_objects = new IdentityHashMap();
+
+ /**
+ * The written repository Ids that can be shared.
+ */
+ private Map sh_ids = new TreeMap(new Comparator()
+ {
+ public int compare(Object a, Object b)
+ {
+ if (a instanceof String && b instanceof String)
+ // Comparing string with string.
+ return ((String) a).compareTo((String) b);
+ else if (a instanceof String[] && b instanceof String[])
+ {
+ // Comparing array with array.
+ String[] sa = (String[]) a;
+ String[] sb = (String[]) b;
+
+ if (sa.length != sb.length)
+ return sa.length - sb.length;
+ else
+ {
+ int c;
+ for (int i = 0; i < sa.length; i++)
+ {
+ c = sa[i].compareTo(sb[i]);
+ if (c != 0)
+ return c;
+ }
+ return 0;
+ }
+ }
+ else
+ // Comparing string with array.
+ return a instanceof String ? 1 : -1;
+ }
+ });
+
+ /**
+ * The history of the written objects, maps positions to records. The
+ * different objects must be treated as different regardless that .equals
+ * returns.
+ */
+ private Map positions = new HashMap();
+
+ /**
+ * The Codebase.
+ */
+ private String codebase;
+
+ /**
+ * The pre-created instance of the object being written (avoid
+ * re-instantiation).
+ */
+ public Serializable target;
+
+ /**
+ * Create Runtime.
+ *
+ * @param a_id a repository Id, if only one Id was specified in the stream.
+ * @param a_ids a repository Ids, if the multiple Ids were specified in te
+ * stream.
+ * @param a_codabase a codebase, if it was specified in the stream.
+ */
+ public gnuRuntime(String a_codebase, Object a_target)
+ {
+ if (a_target instanceof Serializable)
+ target = (Serializable) a_target;
+
+ codebase = a_codebase;
+ }
+
+ /**
+ * Mark the given object as written at the given position.
+ */
+ public void objectWritten(Object object, int at)
+ {
+ if (object == null || at < 0)
+ return; // No positional information provided.
+ if (sh_objects.containsKey(object))
+ throw new AssertionError("Repetetive writing of the same object "
+ + object + " at " + at + dump());
+
+ Entry e = new Entry();
+ e.at = at;
+ e.object = object;
+
+ sh_objects.put(object, e);
+ positions.put(new Integer(at), e);
+ }
+
+ /**
+ * Check if the object is already written.
+ *
+ * @return the position, at that the object is allready written or -1 if it is
+ * not yet written.
+ */
+ public int isWrittenAt(Object x)
+ {
+ Entry e = (Entry) sh_objects.get(x);
+ return e == null ? -1 : e.at;
+ }
+
+ /**
+ * Set redirection, indicating that the object, searched at the p_searched
+ * position can be actually found at the p_present position.
+ */
+ public void redirect(int p_searched, int p_present)
+ {
+ Redirection redirection = new Redirection();
+ redirection.at = p_present;
+ positions.put(new Integer(p_searched), redirection);
+ }
+
+ /**
+ * Get the object, written at the given position. This returs both shared
+ * objects and repository Ids.
+ *
+ * @return the position, at that the object is allready written.
+ *
+ * @throws MARSHAL if there is no object written at that position.
+ */
+ public Object isObjectWrittenAt(int x, int offset)
+ {
+ Entry e = (Entry) positions.get(new Integer(x));
+ if (e instanceof Redirection)
+ return isObjectWrittenAt(e.at, offset);
+ else if (e != null)
+ return e.object;
+ else
+ {
+ MARSHAL m = new MARSHAL("No object was written at " + x +
+ " (offset " + offset + ") r " + this + dump());
+ m.minor = Minor.Graph;
+ throw m;
+ }
+ }
+
+ /**
+ * Mark the given object as written at the given position.
+ */
+ public void singleIdWritten(String id, int at)
+ {
+ if (sh_ids.containsKey(id))
+ throw new InternalError("Repetetive writing of the same string " +
+ id + dump());
+
+ Entry e = new Entry();
+ e.at = at;
+ e.object = id;
+
+ sh_ids.put(id, e);
+ positions.put(new Integer(at), e);
+ }
+
+ /**
+ * Mark the given object as written at the given position.
+ */
+ public void multipleIdsWritten(String[] ids, int at)
+ {
+ if (sh_ids.containsKey(ids))
+ throw new InternalError("Repetetive writing of the same string " +
+ ids + dump());
+
+ Entry e = new Entry();
+ e.at = at;
+ e.object = ids;
+
+ sh_ids.put(ids, e);
+ positions.put(new Integer(at), e);
+ }
+
+ /**
+ * Check if the object is already written.
+ *
+ * @return the position, at that the object is allready written or -1 if it is
+ * not yet written.
+ */
+ public int idWrittenAt(Object x)
+ {
+ Entry e = (Entry) sh_ids.get(x);
+ return e == null ? -1 : e.at;
+ }
+
+ /**
+ * Get the codebase.
+ */
+ public String getCodeBase()
+ {
+ return codebase;
+ }
+
+ /**
+ * Set the codebase, preserving the old value if the passed parameter is null
+ * and forming the space delimited list if both new and old values are not
+ * null.
+ */
+ public void addCodeBase(String base)
+ {
+ if (base != null)
+ {
+ if (codebase == null)
+ codebase = base;
+ else
+ codebase = codebase + " " + base;
+ }
+ }
+
+ /**
+ * Dump all objects that are currently stored.
+ */
+ public String dump()
+ {
+ StringBuffer b = new StringBuffer(" Stream content: \n");
+
+ // Sort by position.
+ TreeSet t = new TreeSet(positions.keySet());
+ Iterator p = t.iterator();
+
+ while (p.hasNext())
+ {
+ Object k = p.next();
+ b.append(" " + k + ": " + ((Entry) positions.get(k)).toString()
+ + "\n");
+ }
+ return b.toString();
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java b/libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java
new file mode 100644
index 00000000000..663c9901861
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java
@@ -0,0 +1,71 @@
+/* gnuValueStream.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+/**
+ * A stream, implementing this interface, provides methods to get/set a position
+ * and get the RunTime.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface gnuValueStream
+{
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition();
+
+ /**
+ * Jump to the given position, taking offset into consideration.
+ */
+ public void seek(int position);
+
+ /**
+ * Get the RunTime information.
+ */
+ public gnuRuntime getRunTime();
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime);
+
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java b/libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java
deleted file mode 100644
index 0c787ddc2df..00000000000
--- a/libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/* noHeaderInput.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.CORBA.CDR;
-
-import org.omg.CORBA.CustomMarshal;
-import org.omg.CORBA.DataInputStream;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.Streamable;
-import org.omg.CORBA.portable.ValueFactory;
-
-import java.io.Serializable;
-
-/**
- * Substitutes the main stream in factories when the header is already
- * behind. Overrides methods that may be invoked from the factory,
- * forcing not to read the header if called first time on this stream.
- *
- * This stream reverts to default behavior if one or more call are
- * made (reading value types that are nested fields of the value type).
- *
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-class noHeaderInput
- extends cdrBufInput
- implements DataInputStream
-{
- /**
- * If true, this is not the first call.
- */
- boolean notFirst;
-
- /**
- * Create an instance, reading from the given buffer.
- */
- public noHeaderInput(byte[] buffer)
- {
- super(buffer);
- }
-
- /**
- * Read when knowning the class instance.
- */
- public Serializable read_value(Class clz)
- {
- if (notFirst)
- return super.read_value(clz);
- else
- {
- try
- {
- notFirst = true;
- return read_value((Serializable) clz.newInstance());
- }
- catch (Exception ex)
- {
- MARSHAL m = new MARSHAL("Unable to create an instance");
- m.initCause(ex);
- throw m;
- }
- }
- }
-
- /**
- * Tries to read using boxed value helper.
- */
- public Serializable read_value(BoxedValueHelper helper)
- {
- if (notFirst)
- return super.read_value(helper);
- else
- {
- notFirst = true;
- return helper.read_value(this);
- }
- }
-
- /**
- * Tries to locate a factory using repository id.
- */
- public Serializable read_value(String repository_id)
- {
- if (notFirst)
- return super.read_value(repository_id);
- else
- {
- notFirst = true;
-
- ValueFactory factory =
- ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
- if (factory == null)
- throw new MARSHAL("No factory");
- return factory.read_value(this);
- }
- }
-
- /**
- * Try to read when having an unitialised value.
- */
- public Serializable read_value(Serializable value)
- {
- if (notFirst)
- return super.read_value(value);
- else
- {
- notFirst = true;
-
- // The user-defines io operations are implemented.
- if (value instanceof CustomMarshal)
- {
- CustomMarshal marsh = (CustomMarshal) value;
- try
- {
- marsh.unmarshal((DataInputStream) this);
- }
- catch (ClassCastException ex)
- {
- Vio.incorrect_plug_in(ex);
- }
- }
- else
- // The IDL-generated io operations are implemented.
- if (value instanceof Streamable)
- {
- ((Streamable) value)._read(this);
- }
- return value;
- }
- }
-} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/cdrEncapsCodec.java b/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java
index 699c6f76a9c..93dd1cdcdfb 100644
--- a/libjava/classpath/gnu/CORBA/cdrEncapsCodec.java
+++ b/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java
@@ -1,4 +1,4 @@
-/* cdrEncapsCodec.java --
+/* CdrEncapsCodecImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,9 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
@@ -57,19 +57,19 @@ import org.omg.IOP.CodecPackage.TypeMismatch;
/**
* The local {@link Codec} implementation for ENCODING_CDR_ENCAPS
* encoding. This is a local implementation; the remote side should
- * have its own Codec of this kind.
+ * have its own Codec of this kind.
*
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class cdrEncapsCodec
+public class CdrEncapsCodecImpl
extends LocalObject
implements Codec
{
- /**
- * The default version of encoding, used in parameterless constructor.
+ /**
+ * Use serialVersionUID for interoperability.
*/
- private static final Version DEFAULT_VERSION = new Version(1, 2);
+ private static final long serialVersionUID = 1;
/**
* If set to true, no wide string or wide character is allowed (GIOP 1.0).
@@ -99,7 +99,7 @@ public class cdrEncapsCodec
/**
* Create an instance of this Codec, encoding following the given version.
*/
- public cdrEncapsCodec(ORB _orb, Version _version)
+ public CdrEncapsCodecImpl(ORB _orb, Version _version)
{
orb = _orb;
version = _version;
@@ -125,8 +125,8 @@ public class cdrEncapsCodec
public Any decode(byte[] them)
throws FormatMismatch
{
- cdrBufInput input = createInput(them);
- cdrBufInput encapsulation = createEncapsulation(them, input);
+ BufferredCdrInput input = createInput(them);
+ BufferredCdrInput encapsulation = createEncapsulation(them, input);
TypeCode type = encapsulation.read_TypeCode();
@@ -142,9 +142,9 @@ public class cdrEncapsCodec
return readAny(type, encapsulation);
}
- private cdrBufInput createEncapsulation(byte[] them, cdrBufInput input)
+ private BufferredCdrInput createEncapsulation(byte[] them, BufferredCdrInput input)
{
- cdrBufInput encapsulation;
+ BufferredCdrInput encapsulation;
if ((them [ 0 ] | them [ 1 ] | them [ 2 ] | them [ 3 ]) == 0)
{
@@ -163,10 +163,10 @@ public class cdrEncapsCodec
{
checkTypePossibility("", that.type());
- cdrBufOutput output = createOutput(that);
+ BufferedCdrOutput output = createOutput(that);
- // cdrBufOutput has internal support for this encoding.
- cdrOutput encapsulation = output.createEncapsulation();
+ // BufferedCdrOutput has internal support for this encoding.
+ AbstractCdrOutput encapsulation = output.createEncapsulation();
try
{
@@ -179,6 +179,7 @@ public class cdrEncapsCodec
catch (Exception ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(ex);
throw m;
}
@@ -206,8 +207,8 @@ public class cdrEncapsCodec
throw new TypeMismatch(ex.getMessage());
}
- cdrBufInput input = createInput(them);
- cdrBufInput encapsulation = createEncapsulation(them, input);
+ BufferredCdrInput input = createInput(them);
+ BufferredCdrInput encapsulation = createEncapsulation(them, input);
return readAny(type, encapsulation);
}
@@ -217,13 +218,13 @@ public class cdrEncapsCodec
* @param type a type of the Any to read.
* @param input the encapsulation stream.
*/
- private Any readAny(TypeCode type, cdrBufInput encapsulation)
+ private Any readAny(TypeCode type, BufferredCdrInput encapsulation)
throws MARSHAL
{
gnuAny a = new gnuAny();
a.setOrb(orb);
- // cdrBufInput has internal support for this encoding.
+ // BufferredCdrInput has internal support for this encoding.
a.read_value(encapsulation, type);
return a;
}
@@ -234,9 +235,9 @@ public class cdrEncapsCodec
{
checkTypePossibility("", that.type());
- cdrBufOutput output = createOutput(that);
+ BufferedCdrOutput output = createOutput(that);
- cdrOutput encapsulation = output.createEncapsulation();
+ AbstractCdrOutput encapsulation = output.createEncapsulation();
try
{
@@ -248,6 +249,7 @@ public class cdrEncapsCodec
catch (Exception ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(ex);
throw m;
}
@@ -256,7 +258,7 @@ public class cdrEncapsCodec
/**
* Create the CDR output stream for writing the given Any.
- * The cdrBufOutput has internal support for encapsulation encodings.
+ * The BufferedCdrOutput has internal support for encapsulation encodings.
*
* @param that the Any that will be written.
*
@@ -265,10 +267,10 @@ public class cdrEncapsCodec
* @throws InvalidTypeForEncoding if that Any cannot be written under the
* given version.
*/
- private cdrBufOutput createOutput(Any that)
+ private BufferedCdrOutput createOutput(Any that)
throws InvalidTypeForEncoding
{
- cdrBufOutput output = new cdrBufOutput();
+ BufferedCdrOutput output = new BufferedCdrOutput();
output.setOrb(orb);
output.setVersion(version);
return output;
@@ -325,9 +327,9 @@ public class cdrEncapsCodec
*
* @return the stream.
*/
- private cdrBufInput createInput(byte[] them)
+ private BufferredCdrInput createInput(byte[] them)
{
- cdrBufInput input = new cdrBufInput(them);
+ BufferredCdrInput input = new BufferredCdrInput(them);
input.setOrb(orb);
input.setVersion(version);
return input;
diff --git a/libjava/classpath/gnu/CORBA/Connected_objects.java b/libjava/classpath/gnu/CORBA/Connected_objects.java
index b7eefb133a2..ce5761007c0 100644
--- a/libjava/classpath/gnu/CORBA/Connected_objects.java
+++ b/libjava/classpath/gnu/CORBA/Connected_objects.java
@@ -90,17 +90,6 @@ public class Connected_objects
* applicable.
*/
public final java.lang.Object identity;
-
- public boolean equals(java.lang.Object other)
- {
- if (other instanceof cObject)
- {
- cObject o = (cObject) other;
- return o.object.equals(object) && o.port == port;
- }
- else
- return false;
- }
}
/**
diff --git a/libjava/classpath/gnu/CORBA/corbaArrayList.java b/libjava/classpath/gnu/CORBA/CorbaList.java
index 1690f0583cb..25bea923099 100644
--- a/libjava/classpath/gnu/CORBA/corbaArrayList.java
+++ b/libjava/classpath/gnu/CORBA/CorbaList.java
@@ -1,4 +1,4 @@
-/* corbaArrayList.java --
+/* CorbaList.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import org.omg.CORBA.Bounds;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class corbaArrayList
+public class CorbaList
extends ArrayList
implements Serializable
{
@@ -64,7 +64,7 @@ public class corbaArrayList
/**
* Creates the list with the given initial size.
*/
- public corbaArrayList(int initial_size)
+ public CorbaList(int initial_size)
{
super(initial_size);
}
@@ -72,7 +72,7 @@ public class corbaArrayList
/**
* Creates the list with the default size.
*/
- public corbaArrayList()
+ public CorbaList()
{
}
diff --git a/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java b/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java
new file mode 100644
index 00000000000..51df047192c
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java
@@ -0,0 +1,79 @@
+/* DefaultSocketFactory.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.CORBA;
+
+import gnu.CORBA.interfaces.SocketFactory;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * The default socket factory that forges "plain" server and client sockets. The
+ * class can be replaced by setting the gnu.CORBA.SocketFactory property.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class DefaultSocketFactory
+ implements SocketFactory
+{
+ /**
+ * It is enough to have one instance of this class for all ORBs.
+ */
+ public static final DefaultSocketFactory Singleton = new DefaultSocketFactory();
+
+ /**
+ * Create a client socket.
+ */
+ public Socket createClientSocket(String host, int port)
+ throws IOException
+ {
+ return new Socket(host, port);
+ }
+
+ /**
+ * Create a server socket.
+ */
+ public ServerSocket createServerSocket(int port)
+ throws IOException
+ {
+ return new ServerSocket(port);
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/DynAn/abstractDynAny.java b/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java
index 47176c4b589..7060f86b27f 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/abstractDynAny.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java
@@ -1,4 +1,4 @@
-/* abstractDynAny.java --
+/* AbstractAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.typeNamer;
+import gnu.CORBA.TypeKindNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
@@ -54,7 +54,7 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class abstractDynAny
+public abstract class AbstractAny
extends LocalObject
implements Serializable
{
@@ -108,12 +108,12 @@ public abstract class abstractDynAny
/**
* The change value listener.
*/
- valueChangedListener listener;
+ ValueChangeListener listener;
/**
* Create the abstract dyn any.
*/
- public abstractDynAny(TypeCode oType, TypeCode aType,
+ public AbstractAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -163,8 +163,8 @@ public abstract class abstractDynAny
*/
String typeMismatch(TypeCode expected, TypeCode actual)
{
- return typeNamer.nameIt(expected) + " expected " +
- typeNamer.nameIt(actual);
+ return TypeKindNamer.nameIt(expected) + " expected " +
+ TypeKindNamer.nameIt(actual);
}
/**
diff --git a/libjava/classpath/gnu/CORBA/DynAn/anyDivideable.java b/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
index 5f52c8078eb..c96cbedc73b 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/anyDivideable.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
@@ -1,4 +1,4 @@
-/* anyDivideable.java --
+/* DivideableAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.typeNamer;
+import gnu.CORBA.TypeKindNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.CompletionStatus;
@@ -58,8 +58,8 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class anyDivideable
- extends abstractDynAny
+public abstract class DivideableAny
+ extends AbstractAny
implements Serializable
{
/**
@@ -78,7 +78,7 @@ public abstract class anyDivideable
*/
protected int pos = 0;
- public anyDivideable(TypeCode oType, TypeCode aType,
+ public DivideableAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -486,9 +486,9 @@ public abstract class anyDivideable
{
if (!official_type.equal(other.type()))
return false;
- else if (other instanceof anyDivideable)
+ else if (other instanceof DivideableAny)
{
- anyDivideable x = (anyDivideable) other;
+ DivideableAny x = (DivideableAny) other;
if (x.array.length != array.length)
return false;
@@ -499,7 +499,7 @@ public abstract class anyDivideable
}
return true;
}
- else if (other == null || other instanceof abstractDynAny)
+ else if (other == null || other instanceof AbstractAny)
return false;
else
return other.to_any().equal(to_any());
diff --git a/libjava/classpath/gnu/CORBA/DynAn/abstractRecord.java b/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java
index 8d8b7a559b1..a3e3680d966 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/abstractRecord.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java
@@ -1,4 +1,4 @@
-/* abstractRecord.java --
+/* RecordAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
+import gnu.CORBA.HolderLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -65,8 +65,8 @@ import java.lang.reflect.Field;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class abstractRecord
- extends anyDivideable
+public abstract class RecordAny
+ extends DivideableAny
implements DynAny, Serializable
{
/**
@@ -80,7 +80,7 @@ public abstract class abstractRecord
*
* @param fields The DynAny's, representing the fields of the structure.
*/
- public abstractRecord(TypeCode oType, TypeCode aType,
+ public RecordAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -277,7 +277,7 @@ public abstract class abstractRecord
c [ i ] = array [ i ].copy();
}
- abstractRecord d = newInstance(official_type, final_type, factory, orb);
+ RecordAny d = newInstance(official_type, final_type, factory, orb);
d.array = c;
return d;
}
@@ -285,7 +285,7 @@ public abstract class abstractRecord
/**
* Create a new instance when copying.
*/
- protected abstract abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ protected abstract RecordAny newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory,
ORB anOrb
);
@@ -297,7 +297,7 @@ public abstract class abstractRecord
{
try
{
- Streamable sHolder = holderFactory.createHolder(official_type);
+ Streamable sHolder = HolderLocator.createHolder(official_type);
Class sHolderClass = sHolder.getClass();
Field sHolderValue = sHolderClass.getField("value");
@@ -371,7 +371,7 @@ public abstract class abstractRecord
fField = structure.getClass().getField(fNames [ i ]);
field = fField.get(structure);
fType = array [ i ].type();
- holder = holderFactory.createHolder(fType);
+ holder = HolderLocator.createHolder(fType);
member = createAny();
holder.getClass().getField("value").set(holder, field);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/anyUndivideable.java b/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java
index b31a6b357f9..da4e9618ee7 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/anyUndivideable.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java
@@ -55,8 +55,8 @@ import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class anyUndivideable
- extends abstractDynAny
+public abstract class UndivideableAny
+ extends AbstractAny
implements Serializable
{
/**
@@ -67,7 +67,7 @@ public abstract class anyUndivideable
/**
* Create a new instance with the given typecode.
*/
- public anyUndivideable(TypeCode oType, TypeCode aType,
+ public UndivideableAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
super(oType, aType, aFactory, anOrb);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/valueChangedListener.java b/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java
index 94ddffbecf7..59727615999 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/valueChangedListener.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java
@@ -1,4 +1,4 @@
-/* valueChangedListener.java --
+/* ValueChangeListener.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package gnu.CORBA.DynAn;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface valueChangedListener
+public interface ValueChangeListener
{
void changed();
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
index 015628ebf90..23141de3d96 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
@@ -38,14 +38,14 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.OctetHolder;
import gnu.CORBA.Unexpected;
import gnu.CORBA.WCharHolder;
import gnu.CORBA.WStringHolder;
-import gnu.CORBA.holderFactory;
-import gnu.CORBA.typeNamer;
-import gnu.CORBA.universalHolder;
+import gnu.CORBA.HolderLocator;
+import gnu.CORBA.TypeKindNamer;
+import gnu.CORBA.GeneralHolder;
import org.omg.CORBA.Any;
import org.omg.CORBA.AnyHolder;
@@ -84,7 +84,7 @@ import java.util.Arrays;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
+public class gnuDynAny extends AbstractAny implements DynAny, Serializable
{
/**
* Use serialVersionUID for interoperability.
@@ -132,7 +132,7 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
{
if (holder != null)
{
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
holder._write(buffer);
gnuDynAny other;
@@ -165,7 +165,7 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
public DynAny current_component() throws TypeMismatch
{
throw new TypeMismatch("Not applicable for " +
- typeNamer.nameIt(final_type)
+ TypeKindNamer.nameIt(final_type)
);
}
@@ -193,14 +193,14 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
{
throw new InvalidValue(ISNULL);
}
- else if (a_holder instanceof universalHolder)
+ else if (a_holder instanceof GeneralHolder)
{
- holder = holderFactory.createHolder(official_type);
+ holder = HolderLocator.createHolder(official_type);
if (holder == null)
- holder = holderFactory.createHolder(final_type);
+ holder = HolderLocator.createHolder(final_type);
if (holder == null)
- holder = ((universalHolder) a_holder).Clone();
+ holder = ((GeneralHolder) a_holder).Clone();
else
{
InputStream in = an_any.create_input_stream();
@@ -890,7 +890,7 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
*/
public boolean equal(DynAny other)
{
- if (other instanceof abstractDynAny)
+ if (other instanceof AbstractAny)
{
if (other instanceof gnuDynAny)
{
@@ -899,10 +899,10 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
if (!x.holder.getClass().equals(holder.getClass()))
return false;
- cdrBufOutput b1 = new cdrBufOutput();
+ BufferedCdrOutput b1 = new BufferedCdrOutput();
x.holder._write(b1);
- cdrBufOutput b2 = new cdrBufOutput(b1.buffer.size() + 10);
+ BufferedCdrOutput b2 = new BufferedCdrOutput(b1.buffer.size() + 10);
holder._write(b2);
return Arrays.equals(b1.buffer.toByteArray(),
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
index dd1762890de..b8b39bfbcdf 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
@@ -40,8 +40,8 @@ package gnu.CORBA.DynAn;
import gnu.CORBA.Poa.ORB_1_4;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
-import gnu.CORBA.typeNamer;
+import gnu.CORBA.HolderLocator;
+import gnu.CORBA.TypeKindNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
@@ -227,7 +227,7 @@ public class gnuDynAnyFactory
*/
public DynAny create_simple(TypeCode official, TypeCode type)
{
- Streamable holder = holderFactory.createHolder(type);
+ Streamable holder = HolderLocator.createHolder(type);
return new gnuDynAny(holder, official, type, this, orb);
}
@@ -314,7 +314,7 @@ public class gnuDynAnyFactory
case TCKind._tk_Principal :
case TCKind._tk_abstract_interface :
throw new InconsistentTypeCode("Following API, the " +
- typeNamer.nameIt(type) +
+ TypeKindNamer.nameIt(type) +
" must not be supported."
);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
index 1c08496d423..825cd0a5638 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
+import gnu.CORBA.HolderLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
@@ -66,7 +66,7 @@ import java.lang.reflect.Field;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynArray
- extends anyDivideable
+ extends DivideableAny
implements DynArray, Serializable
{
/**
@@ -238,10 +238,10 @@ public class gnuDynArray
try
{
Streamable memberHolder =
- holderFactory.createHolder(official_components);
+ HolderLocator.createHolder(official_components);
if (memberHolder == null)
- memberHolder = holderFactory.createHolder(final_components);
+ memberHolder = HolderLocator.createHolder(final_components);
Class memberHolderClass = memberHolder.getClass();
Class memberClass = memberHolderClass.getField("value").getType();
@@ -260,7 +260,7 @@ public class gnuDynArray
Array.set(members, i, member);
}
- Streamable arrayHolder = holderFactory.createHolder(official_type);
+ Streamable arrayHolder = HolderLocator.createHolder(official_type);
arrayHolder.getClass().getField("value").set(arrayHolder, members);
Any g = createAny();
@@ -296,9 +296,9 @@ public class gnuDynArray
{
if (holderClass == null)
{
- holder = holderFactory.createHolder(official_components);
+ holder = HolderLocator.createHolder(official_components);
if (holder == null)
- holder = holderFactory.createHolder(final_components);
+ holder = HolderLocator.createHolder(final_components);
holderClass = holder.getClass();
}
else
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
index 2fccc85c59d..6eb7fe2bcac 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
@@ -60,7 +60,7 @@ import java.util.Arrays;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynEnum extends anyUndivideable implements DynEnum
+public class gnuDynEnum extends UndivideableAny implements DynEnum
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
index 39b00226245..9655f0387da 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
@@ -57,7 +57,7 @@ import java.math.BigDecimal;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynFixed extends anyUndivideable implements DynFixed
+public class gnuDynFixed extends UndivideableAny implements DynFixed
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
index b086d6478cc..b15aff3e124 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
@@ -54,7 +54,7 @@ import org.omg.DynamicAny.DynAny;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynStruct
- extends abstractRecord
+ extends RecordAny
implements DynStruct, Serializable
{
/**
@@ -89,7 +89,7 @@ public class gnuDynStruct
}
/** @inheritDoc */
- protected abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ protected RecordAny newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
return new gnuDynStruct(oType, aType, aFactory, anOrb);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
index ad41e24b6ae..ef5aed64512 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
@@ -62,8 +62,8 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynUnion
- extends anyDivideable
- implements DynUnion, Serializable, valueChangedListener
+ extends DivideableAny
+ implements DynUnion, Serializable, ValueChangeListener
{
/**
* Use serialVersionUID for interoperability.
@@ -96,7 +96,7 @@ public class gnuDynUnion
discriminator =
factory.create_dyn_any_from_type_code(final_type.discriminator_type());
- ((abstractDynAny) discriminator).listener = this;
+ ((AbstractAny) discriminator).listener = this;
if (final_type.default_index() >= 0)
set_to_default_member();
@@ -114,7 +114,7 @@ public class gnuDynUnion
/*
* (non-Javadoc)
*
- * @see gnu.CORBA.DynAn.anyDivideable#to_any()
+ * @see gnu.CORBA.DynAn.DivideableAny#to_any()
*/
public Any to_any()
{
@@ -171,7 +171,7 @@ public class gnuDynUnion
gnuDynUnion other =
new gnuDynUnion(official_type, final_type, factory, orb);
other.discriminator = discriminator.copy();
- ((abstractDynAny) other.discriminator).listener = other;
+ ((AbstractAny) other.discriminator).listener = other;
if (array.length == 1)
{
other.array = new DynAny[] { other.discriminator };
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
index c2db9479785..0c31d4093e2 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
+import gnu.CORBA.Minor;
import gnu.CORBA.Unexpected;
import org.omg.CORBA.Any;
@@ -66,7 +67,7 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynValue extends abstractRecord implements DynValue,
+public class gnuDynValue extends RecordAny implements DynValue,
Serializable
{
/**
@@ -243,7 +244,7 @@ public class gnuDynValue extends abstractRecord implements DynValue,
/**
* Create a new instance.
*/
- protected abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ protected RecordAny newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -301,9 +302,12 @@ public class gnuDynValue extends abstractRecord implements DynValue,
ValueFactory factory =
((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(official_type.id());
if (factory == null)
- throw new MARSHAL("Factory for " + official_type.id() +
- " not registered."
- );
+ {
+ MARSHAL m = new MARSHAL("Factory for " + official_type.id() +
+ " not registered.");
+ m.minor = Minor.Factory;
+ throw m;
+ }
OutputStream out = orb.create_output_stream();
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
index 66e18f3b2fe..a13e9fc2c50 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
+import gnu.CORBA.HolderLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -65,7 +65,7 @@ import java.lang.reflect.Field;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynValueBox
- extends anyDivideable
+ extends DivideableAny
implements DynValueBox, Serializable
{
/**
@@ -208,7 +208,7 @@ public class gnuDynValueBox
{
try
{
- Streamable holder = holderFactory.createHolder(content);
+ Streamable holder = HolderLocator.createHolder(content);
Field v = holder.getClass().getField("value");
v.set(holder, s);
diff --git a/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java b/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
index 890ca5fe51c..8fc8697a4f3 100644
--- a/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
+++ b/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
@@ -125,6 +125,7 @@ public class EmptyExceptionHolder
catch (Exception ex)
{
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.CDR;
bad.initCause(ex);
throw bad;
}
diff --git a/libjava/classpath/gnu/CORBA/ExceptionCreator.java b/libjava/classpath/gnu/CORBA/ExceptionCreator.java
deleted file mode 100644
index 8b75205056b..00000000000
--- a/libjava/classpath/gnu/CORBA/ExceptionCreator.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/* ExceptionCreator.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.CORBA;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.CompletionStatusHelper;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- * Creates the objects from the agreed IDL names.
- *
- * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
- */
-public class ExceptionCreator
-{
- /**
- * The standard OMG prefix.
- */
- public static final String OMG_PREFIX = "omg.org/";
-
- /**
- * The standard java prefix.
- */
- public static final String JAVA_PREFIX = "org.omg.";
-
- /**
- * Create the system exception with the given idl name.
- *
- * @param idl the exception IDL name, must match the syntax
- * "IDL:<class/name>:1.0".
- * @param minor the exception minor code.
- * @param completed the exception completion status.
- *
- * @return the created exception.
- */
- public static SystemException createSystemException(String idl, int minor,
- CompletionStatus completed
- )
- {
- try
- {
- String cl = toClassName(idl);
- Class exClass = Class.forName(cl);
-
- Constructor constructor =
- exClass.getConstructor(new Class[]
- {
- String.class, int.class,
- CompletionStatus.class
- }
- );
-
- Object exception =
- constructor.newInstance(new Object[]
- {
- " Remote exception " + idl + ", minor " +
- minor + ", " + completed + ".",
- new Integer(minor), completed
- }
- );
-
- return (SystemException) exception;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return new UNKNOWN("Unsupported system exception", minor, completed);
- }
- }
-
- /**
- * Read the system exception from the given stream.
- * @param input the CDR stream to read from.
- * @return the exception that has been stored in the stream
- * (IDL name, minor code and completion status).
- */
- public static SystemException readSystemException(InputStream input)
- {
- String idl = input.read_string();
- int minor = input.read_ulong();
- CompletionStatus status = CompletionStatusHelper.read(input);
-
- SystemException exception =
- ExceptionCreator.createSystemException(idl, minor, status);
-
- return exception;
- }
-
- /**
- * Reads the user exception, having the given Id, from the
- * input stream. The id is expected to be in the form like
- * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
- * @param idl the exception idl name.
- * @param input the stream to read from.
- *
- * @return the loaded exception.
- * @return null if the helper class cannot be found.
- */
- public static UserException readUserException(String idl, InputStream input)
- {
- try
- {
- String helper = toHelperName(idl);
- Class helperClass = Class.forName(helper);
-
- Method read =
- helperClass.getMethod("read",
- new Class[]
- {
- org.omg.CORBA.portable.InputStream.class
- }
- );
-
- return (UserException) read.invoke(null, new Object[] { input });
- }
- catch (MARSHAL mex)
- {
- // This one is ok to throw
- throw mex;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return null;
- }
- }
-
- /**
- * Writes the system exception data to CDR output stream.
- *
- * @param output a stream to write data to.
- * @param ex an exception to write.
- */
- public static void writeSystemException(OutputStream output,
- SystemException ex
- )
- {
- String exIDL = toIDL(ex.getClass().getName());
- output.write_string(exIDL);
- output.write_ulong(ex.minor);
- CompletionStatusHelper.write(output, ex.completed);
- }
-
- /**
- * Converts teh given IDL name to class name.
- *
- * @param IDL the idl name.
- *
- */
- protected static String toClassName(String IDL)
- {
- String s = IDL;
- int a = s.indexOf(':') + 1;
- int b = s.lastIndexOf(':');
-
- s = IDL.substring(a, b);
-
- if (s.startsWith(OMG_PREFIX))
- s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
-
- return s.replace('/', '.');
- }
-
- /**
- * Gets the helper class name from the string like
- * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
- * @param IDL the idl name.
- */
- protected static String toHelperName(String IDL)
- {
- String s = IDL;
- int a = s.indexOf(':') + 1;
- int b = s.lastIndexOf(':');
-
- s = IDL.substring(a, b);
-
- if (s.startsWith(OMG_PREFIX))
- s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
-
- return s.replace('/', '.') + "Helper";
- }
-
- /**
- * Convert the class name to IDL name.
- *
- * @param cn the class name.
- *
- * @return the idl name.
- */
- protected static String toIDL(String cn)
- {
- if (cn.startsWith(JAVA_PREFIX))
- cn = cn.substring(JAVA_PREFIX.length());
-
- cn = cn.replace('.', '/');
-
- return "IDL:" + OMG_PREFIX + cn + ":1.0";
- }
-}
diff --git a/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java b/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
index c7fae5b061b..cbdf46f259a 100644
--- a/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
+++ b/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
@@ -81,6 +81,7 @@ public abstract class ForwardRequestHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java b/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
index f3f35dbaa21..bffb02678aa 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
@@ -47,7 +47,10 @@ import java.util.Set;
/**
* This class contains the codes, used to identify character sets
* in CORBA. These codes are defined in Open Software Foundation (OSF)
- * code set registry
+ * code set registry.
+ *
+ * The name of this class specially sets "OSF" apart if somebody would start
+ * searching Open Software Foundation abbreviation.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java b/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
index d884329c440..38039c2ed21 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
@@ -38,15 +38,13 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
import org.omg.CORBA.MARSHAL;
import java.io.IOException;
import java.io.OutputStream;
-import java.net.Socket;
-
/**
* The explicit command to close the connection.
*
@@ -60,6 +58,11 @@ import java.net.Socket;
public class CloseMessage
extends MessageHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The singleton close message is typically enough, despite new
* instances may be instantiated if the specific version field
@@ -95,6 +98,7 @@ public class CloseMessage
catch (IOException ex)
{
MARSHAL m = new MARSHAL("Unable to flush the stream");
+ m.minor = Minor.Header;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
index 7f42c07f236..ab565db3797 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.IOR;
import gnu.CORBA.IOR.CodeSets_profile;
@@ -51,7 +51,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class cxCodeSet
+public class CodeSetServiceContext
extends ServiceContext
{
/**
@@ -62,7 +62,7 @@ public class cxCodeSet
/**
* The standard component to include in the messages.
*/
- public static final cxCodeSet STANDARD = new cxCodeSet();
+ public static final CodeSetServiceContext STANDARD = new CodeSetServiceContext();
/**
* The encoding, used to transfer the narrow (1 byte) character data.
@@ -84,13 +84,13 @@ public class cxCodeSet
*
* @param contexts the array of contexts, can be null.
*/
- public static cxCodeSet find(ServiceContext[] contexts)
+ public static CodeSetServiceContext find(ServiceContext[] contexts)
{
if (contexts != null)
for (int i = 0; i < contexts.length; i++)
{
- if (contexts [ i ] instanceof cxCodeSet)
- return (cxCodeSet) contexts [ i ];
+ if (contexts [ i ] instanceof CodeSetServiceContext)
+ return (CodeSetServiceContext) contexts [ i ];
}
return STANDARD;
}
@@ -102,12 +102,12 @@ public class cxCodeSet
* If you take this task, scan 'TODO character encoding' for
* relevant places.
*/
- public static cxCodeSet negotiate(IOR.CodeSets_profile profile)
+ public static CodeSetServiceContext negotiate(IOR.CodeSets_profile profile)
{
if (profile.negotiated != null)
return profile.negotiated;
- cxCodeSet use = new cxCodeSet();
+ CodeSetServiceContext use = new CodeSetServiceContext();
use.char_data =
negotiate(profile.narrow, STANDARD.char_data, CharSets_OSF.ISO8859_1);
@@ -124,9 +124,9 @@ public class cxCodeSet
* Read the context from the given stream. Does not read the
* code sets id.
*/
- public void readContext(cdrInput input)
+ public void readContext(AbstractCdrInput input)
{
- cdrInput encap = input.read_encapsulation();
+ AbstractCdrInput encap = input.read_encapsulation();
char_data = encap.read_ulong();
wide_char_data = encap.read_ulong();
@@ -145,11 +145,11 @@ public class cxCodeSet
* Write the context to the given stream, including the code
* sets id.
*/
- public void write(cdrOutput output)
+ public void write(AbstractCdrOutput output)
{
output.write_ulong(ID);
- cdrOutput enout = output.createEncapsulation();
+ AbstractCdrOutput enout = output.createEncapsulation();
enout.write_long(char_data);
enout.write_ulong(wide_char_data);
diff --git a/libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
index ba6c1f88d8f..77ea20e38f0 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
@@ -1,4 +1,4 @@
-/* contextSupportingHeader.java --
+/* ContextHandler.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.omg.CORBA.BAD_INV_ORDER;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class contextSupportingHeader
+public abstract class ContextHandler
{
/**
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java b/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
index 8d3b3539be5..99942fee359 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
import java.io.IOException;
import java.io.OutputStream;
@@ -46,6 +48,7 @@ import java.io.OutputStream;
import java.net.Socket;
import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
/**
* The error message is sent in response to the message, encoded
@@ -59,6 +62,11 @@ import org.omg.CORBA.MARSHAL;
public class ErrorMessage
extends MessageHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Create a new error message, setting the message field
* to the {@link MESSAGE_ERROR} and the version number to
@@ -73,14 +81,22 @@ public class ErrorMessage
/**
* Send the error message to the given IOR address.
*
- * @param to the IOR address (host and port, other fields
+ * @param ior the IOR address (host and port, other fields
* are not used).
+ *
+ * @param orb the ORB, sending the error message.
*/
- public void send(IOR ior)
+ public void send(IOR ior, ORB orb)
{
try
{
- Socket socket = new Socket(ior.Internet.host, ior.Internet.port);
+ Socket socket;
+
+ if (orb instanceof OrbFunctional)
+ socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
+ ior.Internet.host, ior.Internet.port);
+ else
+ socket = new Socket(ior.Internet.host, ior.Internet.port);
OutputStream socketOutput = socket.getOutputStream();
write(socketOutput);
@@ -90,6 +106,7 @@ public class ErrorMessage
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
index 61c46e11ea4..e1bdb512bfb 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
@@ -1,4 +1,4 @@
-/* MessageHeader.java -- GIOP 1.0 message header.
+/* MessageHeader.java -- GIOP message header.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,33 +38,39 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
+import gnu.CORBA.Minor;
+import gnu.CORBA.Version;
+import gnu.CORBA.CDR.BigEndianInputStream;
import gnu.CORBA.CDR.BigEndianOutputStream;
import gnu.CORBA.CDR.LittleEndianInputStream;
import gnu.CORBA.CDR.LittleEndianOutputStream;
-import gnu.CORBA.CDR.abstractDataOutputStream;
-import gnu.CORBA.Version;
+import gnu.CORBA.CDR.AbstractDataInput;
+import gnu.CORBA.CDR.AbstractDataOutput;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.IDLEntity;
-import java.io.DataInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
-
+import java.net.Socket;
import java.util.Arrays;
-import gnu.CORBA.CDR.BigEndianInputStream;
-import gnu.CORBA.CDR.abstractDataInputStream;
-import java.io.InputStream;
/**
* The GIOP message header.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class MessageHeader
implements IDLEntity
{
/**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
* Request message.
*/
public static final byte REQUEST = 0;
@@ -80,16 +86,15 @@ public class MessageHeader
public static final byte CANCEL_REQUEST = 2;
/**
- * Locate request message, used to check the server ability to
- * process requests for the object reference.
- * This message is also used to get the
+ * Locate request message, used to check the server ability to process
+ * requests for the object reference. This message is also used to get the
* address where the object reference should be sent.
*/
public static final byte LOCATE_REQUEST = 3;
/**
- * Locate reply message, sent in response to the
- * {@link #LocateRequest} message.
+ * Locate reply message, sent in response to the {@link #LocateRequest}
+ * message.
*/
public static final byte LOCATE_REPLY = 4;
@@ -104,8 +109,8 @@ public class MessageHeader
public static final byte MESSAGE_ERROR = 6;
/**
- * The fragment messge, following the previous message that
- * has more fragments flag set. Added in GIOP 1.1
+ * The fragment messge, following the previous message that has more fragments
+ * flag set. Added in GIOP 1.1
*/
public static final byte FRAGMENT = 7;
@@ -117,12 +122,9 @@ public class MessageHeader
/**
* The message type names.
*/
- protected static String[] types =
- new String[]
- {
- "Request", "Reply", "Cancel", "Locate request", "Locate reply",
- "Close connection", "Error", "Fragment"
- };
+ protected static String[] types = new String[] { "Request", "Reply",
+ "Cancel", "Locate request", "Locate reply", "Close connection", "Error",
+ "Fragment" };
/**
* The GIOP version. Initialised to 1.0 .
@@ -154,7 +156,7 @@ public class MessageHeader
/**
* Create an empty message header, corresponding the given version.
- *
+ *
* @param major the major message header version.
* @param minor the minot message header version.
*/
@@ -164,8 +166,8 @@ public class MessageHeader
}
/**
- * Checks if the message is encoded in the Big Endian, most significant
- * byte first.
+ * Checks if the message is encoded in the Big Endian, most significant byte
+ * first.
*/
public boolean isBigEndian()
{
@@ -173,10 +175,18 @@ public class MessageHeader
}
/**
+ * Checks if the message is partial, and more subsequent fragments follow.
+ */
+ public boolean moreFragmentsFollow()
+ {
+ return (flags & 0x2) != 0;
+ }
+
+ /**
* Set the encoding to use.
- *
- * @param use_big_endian if true (default), the Big Endian
- * encoding is used. If false, the Little Endian encoding is used.
+ *
+ * @param use_big_endian if true (default), the Big Endian encoding is used.
+ * If false, the Little Endian encoding is used.
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -196,16 +206,16 @@ public class MessageHeader
/**
* Get the message type as string.
- *
+ *
* @param type the message type as int (the field {@link message_type}).
- *
+ *
* @return the message type as string.
*/
public String getTypeString(int type)
{
try
{
- return types [ type ];
+ return types[type];
}
catch (ArrayIndexOutOfBoundsException ex)
{
@@ -215,10 +225,10 @@ public class MessageHeader
/**
* Creates reply header, matching the message header version number.
- *
+ *
* @return one of {@link gnu.CORBA.GIOP.v1_0.ReplyHeader},
- * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on
- * the version number in this header.
+ * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on the version
+ * number in this header.
*/
public ReplyHeader create_reply_header()
{
@@ -230,10 +240,10 @@ public class MessageHeader
/**
* Creates request header, matching the message header version number.
- *
+ *
* @return one of {@link gnu.CORBA.GIOP.v1_0.RequestHeader},
- * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on
- * the version number in this header.
+ * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on the version
+ * number in this header.
*/
public RequestHeader create_request_header()
{
@@ -261,24 +271,28 @@ 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
+ throws MARSHAL
{
try
{
- byte[] xMagic = new byte[ MAGIC.length ];
+ byte[] xMagic = new byte[MAGIC.length];
istream.read(xMagic);
if (!Arrays.equals(xMagic, MAGIC))
- throw new MARSHAL("Not a GIOP message");
+ {
+ MARSHAL m = new MARSHAL("Not a GIOP message");
+ m.minor = Minor.Giop;
+ throw m;
+ }
version = Version.read_version(istream);
- abstractDataInputStream din;
+ AbstractDataInput din;
flags = (byte) istream.read();
@@ -295,6 +309,7 @@ public class MessageHeader
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
@@ -302,26 +317,26 @@ public class MessageHeader
/**
* Get the short string summary of the message.
- *
+ *
* @return a short message summary.
*/
public String toString()
{
- return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little") +
- " endian, " + getTypeString(message_type) + ", " + message_size +
- " bytes. ";
+ return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little")
+ + " endian, " + getTypeString(message_type) + ", " + message_size
+ + " bytes. ";
}
/**
* Write the header to stream.
- *
+ *
* @param out a stream to write into.
*/
public void write(java.io.OutputStream out)
{
try
{
- abstractDataOutputStream dout;
+ AbstractDataOutput dout;
if (isBigEndian())
dout = new BigEndianOutputStream(out);
@@ -333,18 +348,99 @@ public class MessageHeader
// Write version number.
version.write((OutputStream) dout);
-
dout.write(flags);
-
dout.write(message_type);
-
dout.writeInt(message_size);
}
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
}
+
+ /**
+ * Read data, followed by the message header. Handle fragmented messages.
+ *
+ * @param source the data source to read from.
+ * @param service the socket on that the time outs are set. Can be null (no
+ * timeouts are set).
+ * @param to_read the timeout while reading the message.
+ * @param to_pause the timeout for pauses between the message parts.
+ */
+ public byte[] readMessage(InputStream source, Socket service, int to_read,
+ int to_pause)
+ {
+ try
+ {
+ byte[] r = new byte[message_size];
+
+ int n = 0;
+ if (service != null)
+ service.setSoTimeout(to_read);
+
+ reading: while (n < r.length)
+ {
+ n += source.read(r, n, r.length - n);
+ }
+ if (service != null)
+ service.setSoTimeout(to_pause);
+
+ // Read the message remainder if the message is fragmented.
+ if (moreFragmentsFollow())
+ {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream(
+ 2 * r.length);
+ buffer.write(r);
+
+ if (r.length < 10)
+ // Increase the buffer size if the default value (size of the
+ // previous message) is really too small.
+ r = new byte[1024];
+
+ MessageHeader h2 = new MessageHeader();
+
+ do
+ {
+ h2.read(source);
+
+ int dn;
+
+ n = 0;
+ reading: while (n < h2.message_size)
+ {
+ dn = source.read(r, 0, h2.message_size - n);
+
+ if (n == 0 && service != null)
+ service.setSoTimeout(to_read);
+
+ if (n == 0 && version.since_inclusive(1, 2))
+ {
+ // Skip the four byte request id.
+ buffer.write(r, 4, dn - 4);
+ }
+ else
+ buffer.write(r, 0, dn);
+ n = +dn;
+ }
+
+ if (service != null)
+ service.setSoTimeout(to_pause);
+ }
+ while (h2.moreFragmentsFollow());
+ return buffer.toByteArray();
+ }
+ else
+ return r;
+ }
+ catch (IOException ioex)
+ {
+ MARSHAL m = new MARSHAL("Unable to read the message continuation.");
+ m.minor = Minor.Header;
+ m.initCause(ioex);
+ throw m;
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
index f0f409394e6..d1448290331 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
/**
* The header of the standard reply.
@@ -47,7 +47,7 @@ import gnu.CORBA.CDR.cdrOutput;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ReplyHeader
- extends contextSupportingHeader
+ extends ContextHandler
{
/**
* Reply status, if no exception occured.
@@ -121,7 +121,7 @@ public abstract class ReplyHeader
*
* @param in a stream to read from.
*/
- public abstract void read(cdrInput in);
+ public abstract void read(AbstractCdrInput in);
/**
* Returns a short string representation.
@@ -141,5 +141,5 @@ public abstract class ReplyHeader
*
* @param out a stream to write into.
*/
- public abstract void write(cdrOutput out);
+ public abstract void write(AbstractCdrOutput out);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
index 17cccb8834a..3cfadfd7867 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.portable.IDLEntity;
@@ -49,7 +49,7 @@ import org.omg.CORBA.portable.IDLEntity;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class RequestHeader
- extends contextSupportingHeader
+ extends ContextHandler
implements IDLEntity
{
/**
@@ -137,7 +137,7 @@ public abstract class RequestHeader
*
* @param in a stream to read from.
*/
- public abstract void read(cdrInput in);
+ public abstract void read(AbstractCdrInput in);
/**
* Return a string representation.
@@ -149,6 +149,6 @@ public abstract class RequestHeader
*
* @param out a stream to write into.
*/
- public abstract void write(cdrOutput out);
+ public abstract void write(AbstractCdrOutput out);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
index 29a8ea8ac77..78519510cb7 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.BAD_PARAM;
@@ -48,7 +48,7 @@ import org.omg.CORBA.portable.IDLEntity;
/**
* Contains the ORB service data being passed.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class ServiceContext
@@ -59,6 +59,50 @@ public class ServiceContext
*/
private static final long serialVersionUID = 1;
+ /* Standard values for the context_id. */
+ public static final int TransactionService = 0;
+
+ /**
+ * Defines code sets, used to encode wide and narrow characters. Required for
+ * messages with data structures, involving wide characters.
+ */
+ public static final int CodeSets = 1;
+
+ public static final int ChainBypassCheck = 2;
+
+ public static final int ChainBypassInfo = 3;
+
+ public static final int LogicalThreadId = 4;
+
+ public static final int BI_DIR_IIOP = 5;
+
+ public static final int SendingContextRunTime = 6;
+
+ public static final int INVOCATION_POLICIES = 7;
+
+ public static final int FORWARDED_IDENTITY = 8;
+
+ /**
+ * Contains exception details if exception being transferred is other than
+ * System or User exception. javax.rmi uses this context to transfer arbitrary
+ * java exceptions as CORBA value types.
+ */
+ public static final int UnknownExceptionInfo = 9;
+
+ public static final int RTCorbaPriority = 10;
+
+ public static final int RTCorbaPriorityRange = 11;
+
+ public static final int FT_GROUP_VERSION = 12;
+
+ public static final int FT_REQUEST = 13;
+
+ public static final int ExceptionDetailMessage = 14;
+
+ public static final int SecurityAttributeService = 15;
+
+ public static final int ActivityService = 16;
+
/**
* The context id (for instance, 0x1 for code sets context). At the moment of
* writing, the OMG defines 16 standard values and provides rules to register
@@ -90,18 +134,18 @@ public class ServiceContext
/**
* Read the context values from the stream.
- *
+ *
* @param istream a stream to read from.
*/
- public static ServiceContext read(cdrInput istream)
+ public static ServiceContext read(AbstractCdrInput istream)
{
int id = istream.read_ulong();
switch (id)
{
- case cxCodeSet.ID:
+ case CodeSetServiceContext.ID:
- cxCodeSet codeset = new cxCodeSet();
+ CodeSetServiceContext codeset = new CodeSetServiceContext();
codeset.readContext(istream);
return codeset;
@@ -117,7 +161,7 @@ public class ServiceContext
/**
* Read a sequence of contexts from the input stream.
*/
- public static ServiceContext[] readSequence(cdrInput istream)
+ public static ServiceContext[] readSequence(AbstractCdrInput istream)
{
int size = istream.read_long();
ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
@@ -128,10 +172,10 @@ public class ServiceContext
/**
* Write the context values into the stream.
- *
+ *
* @param ostream a stream to write the data to.
*/
- public void write(cdrOutput ostream)
+ public void write(AbstractCdrOutput ostream)
{
ostream.write_ulong(context_id);
ostream.write_sequence(context_data);
@@ -140,7 +184,7 @@ public class ServiceContext
/**
* Write the sequence of contexts into the input stream.
*/
- public static void writeSequence(cdrOutput ostream, ServiceContext[] value)
+ public static void writeSequence(AbstractCdrOutput ostream, ServiceContext[] value)
{
ostream.write_long(value.length);
for (int i = 0; i < value.length; i++)
@@ -172,8 +216,7 @@ public class ServiceContext
// Replace context.
if (!replace)
throw new BAD_INV_ORDER("Repetetive setting of the context "
- + service_context.context_id, 15,
- CompletionStatus.COMPLETED_NO);
+ + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
else
cx[exists] = service_context;
}
@@ -205,15 +248,13 @@ public class ServiceContext
// Replace context.
if (!replace)
throw new BAD_INV_ORDER("Repetetive setting of the context "
- + service_context.context_id, 15,
- CompletionStatus.COMPLETED_NO);
+ + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
else
cx[exists] = new ServiceContext(service_context);
return cx;
}
}
-
/**
* Find context with the given name in the context array.
*/
@@ -227,8 +268,8 @@ public class ServiceContext
}
/**
- * Find context with the given name in the context array,
- * converting into org.omg.IOP.ServiceContext.
+ * Find context with the given name in the context array, converting into
+ * org.omg.IOP.ServiceContext.
*/
public static org.omg.IOP.ServiceContext findContext(int ctx_name,
ServiceContext[] cx)
@@ -240,6 +281,17 @@ public class ServiceContext
}
/**
+ * Find context with the given name in the context array without conversions.
+ */
+ public static ServiceContext find(int ctx_name, ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return cx[i];
+ return null;
+ }
+
+ /**
* Return a string representation.
*/
public String toString()
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
index 27181ca6347..c085c17fb9b 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_0;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
/**
* The header of the standard reply.
@@ -98,13 +98,13 @@ public class ReplyHeader
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
service_context = ServiceContext.readSequence(in);
request_id = in.read_ulong();
reply_status = in.read_ulong();
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -128,12 +128,12 @@ public class ReplyHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
ServiceContext.writeSequence(out, service_context);
out.write_ulong(request_id);
out.write_ulong(reply_status);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
index 7ede4e5b926..5cf723cbc42 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_0;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.portable.IDLEntity;
@@ -112,7 +112,7 @@ public class RequestHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
service_context = ServiceContext.readSequence(in);
request_id = in.read_ulong();
@@ -121,7 +121,7 @@ public class RequestHeader
operation = in.read_string();
requesting_principal = in.read_sequence();
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -143,7 +143,7 @@ public class RequestHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
ServiceContext.writeSequence(out, service_context);
out.write_ulong(request_id);
@@ -152,6 +152,6 @@ public class RequestHeader
out.write_string(operation);
out.write_sequence(requesting_principal);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
index c3f51a37b91..3fc1541d9ab 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_2;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
/**
* GIOP 1.2 reply header.
@@ -56,7 +56,7 @@ public class ReplyHeader
*/
public ReplyHeader()
{
- service_context = new ServiceContext[] { cxCodeSet.STANDARD };
+ service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
}
/**
@@ -89,13 +89,13 @@ public class ReplyHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
request_id = in.read_ulong();
reply_status = in.read_ulong();
service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -107,12 +107,12 @@ public class ReplyHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
out.write_ulong(request_id);
out.write_ulong(reply_status);
gnu.CORBA.GIOP.ServiceContext.writeSequence(out, service_context);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
index d294d006723..6b37b6c676c 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
@@ -38,10 +38,11 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_2;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.Minor;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import java.io.IOException;
@@ -58,6 +59,11 @@ import org.omg.CORBA.NO_IMPLEMENT;
public class RequestHeader
extends gnu.CORBA.GIOP.v1_0.RequestHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Indicates that the object is addressed by the object key.
*/
@@ -89,7 +95,7 @@ public class RequestHeader
*/
public RequestHeader()
{
- service_context = new ServiceContext[] { cxCodeSet.STANDARD };
+ service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
}
/**
@@ -123,7 +129,7 @@ public class RequestHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
try
{
@@ -150,20 +156,23 @@ public class RequestHeader
throw new NO_IMPLEMENT("Object addressing by by IOR addressing info");
default :
- throw new MARSHAL("Unknow addressing method in request, " +
+ MARSHAL m = new MARSHAL("Unknow addressing method in request, " +
AddressingDisposition
);
+ m.minor = Minor.UnsupportedAddressing;
+ throw m;
}
operation = in.read_string();
service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
// No requesting principal in this new format.
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
@@ -186,7 +195,7 @@ public class RequestHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
out.write_ulong(request_id);
@@ -208,6 +217,6 @@ public class RequestHeader
ServiceContext.writeSequence(out, service_context);
// No requesting principal in this new format.
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/universalHolder.java b/libjava/classpath/gnu/CORBA/GeneralHolder.java
index c20dac442dd..ffba69d79f6 100644
--- a/libjava/classpath/gnu/CORBA/universalHolder.java
+++ b/libjava/classpath/gnu/CORBA/GeneralHolder.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.MARSHAL;
@@ -60,18 +60,18 @@ import java.io.IOException;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class universalHolder
+public class GeneralHolder
implements Streamable
{
/**
* The binary data, stored inside this holder.
*/
- private cdrBufOutput value = new cdrBufOutput();
+ private BufferedCdrOutput value = new BufferedCdrOutput();
/**
* Create the universal holder that uses the given buffer to store the data.
*/
- public universalHolder(cdrBufOutput buffer)
+ public GeneralHolder(BufferedCdrOutput buffer)
{
value = buffer;
}
@@ -89,9 +89,9 @@ public class universalHolder
{
try
{
- if (input instanceof cdrBufInput)
+ if (input instanceof BufferredCdrInput)
{
- cdrBufInput b = (cdrBufInput) input;
+ BufferredCdrInput b = (BufferredCdrInput) input;
value.write(b.buffer.getBuffer());
}
else
@@ -110,6 +110,7 @@ public class universalHolder
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Any;
t.initCause(ex);
throw t;
}
@@ -122,7 +123,9 @@ public class universalHolder
*/
public TypeCode _type()
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.Inappropriate;
+ throw bad;
}
/**
@@ -142,6 +145,7 @@ public class universalHolder
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Any;
t.initCause(ex);
throw t;
}
@@ -158,13 +162,13 @@ public class universalHolder
/**
* Clone.
*/
- public universalHolder Clone()
+ public GeneralHolder Clone()
{
try
{
- cdrBufOutput nb = new cdrBufOutput(value.buffer.size());
+ BufferedCdrOutput nb = new BufferedCdrOutput(value.buffer.size());
value.buffer.writeTo(nb);
- return new universalHolder(nb);
+ return new GeneralHolder(nb);
}
catch (IOException ex)
{
diff --git a/libjava/classpath/gnu/CORBA/holderFactory.java b/libjava/classpath/gnu/CORBA/HolderLocator.java
index 159d22332dc..edd4d2cf7a4 100644
--- a/libjava/classpath/gnu/CORBA/holderFactory.java
+++ b/libjava/classpath/gnu/CORBA/HolderLocator.java
@@ -1,4 +1,4 @@
-/* holderFactory.java --
+/* HolderLocator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@ import org.omg.CORBA.ObjectHolder;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class holderFactory
+public class HolderLocator
{
/**
* The array, sufficiently large to use any {@link TCKind}._tk* constant as
diff --git a/libjava/classpath/gnu/CORBA/IOR.java b/libjava/classpath/gnu/CORBA/IOR.java
index 02e94aa6426..5d6d3152f8f 100644
--- a/libjava/classpath/gnu/CORBA/IOR.java
+++ b/libjava/classpath/gnu/CORBA/IOR.java
@@ -38,12 +38,12 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.CharSets_OSF;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
@@ -59,6 +59,8 @@ import org.omg.IOP.TaggedProfileHelper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.zip.Adler32;
/**
* The implementaton of the Interoperable Object Reference (IOR). IOR can be
@@ -174,16 +176,16 @@ public class IOR
* The negotiated coding result for this IOR. Saves time, requred for
* negotiation computations.
*/
- public cxCodeSet negotiated;
+ public CodeSetServiceContext negotiated;
/**
* Read the code set profile information from the given input stream.
*
* @param profile a stream to read from.
*/
- public void read(cdrInput profile)
+ public void read(AbstractCdrInput profile)
{
- cdrBufInput encapsulation = profile.read_encapsulation();
+ BufferredCdrInput encapsulation = profile.read_encapsulation();
narrow.read(encapsulation);
wide.read(encapsulation);
}
@@ -201,9 +203,9 @@ public class IOR
*
* @param profile a stream to write into.
*/
- public void write(cdrOutput profile)
+ public void write(AbstractCdrOutput profile)
{
- cdrOutput encapsulation = profile.createEncapsulation();
+ AbstractCdrOutput encapsulation = profile.createEncapsulation();
narrow.write(encapsulation);
wide.write(encapsulation);
try
@@ -274,13 +276,13 @@ public class IOR
/**
* Write the internet profile (except the heading tag.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
try
{
// Need to write the Internet profile into the separate
// stream as we must know the size in advance.
- cdrOutput b = out.createEncapsulation();
+ AbstractCdrOutput b = out.createEncapsulation();
version.write(b);
b.write_string(host);
@@ -310,6 +312,7 @@ public class IOR
catch (Exception e)
{
MARSHAL m = new MARSHAL("Unable to write Internet profile.");
+ m.minor = Minor.IOR;
m.initCause(e);
throw m;
}
@@ -392,7 +395,7 @@ public class IOR
buf.write(cx);
}
- cdrBufInput cdr = new cdrBufInput(buf.toByteArray());
+ BufferredCdrInput cdr = new BufferredCdrInput(buf.toByteArray());
r._read(cdr);
return r;
@@ -411,7 +414,7 @@ public class IOR
* @param c a stream to read from.
* @throws IOException if the stream throws it.
*/
- public void _read(cdrInput c)
+ public void _read(AbstractCdrInput c)
throws IOException, BAD_PARAM
{
int endian;
@@ -433,13 +436,13 @@ public class IOR
* If the stream contains a null value, the Id and Internet fields become
* equal to null. Otherwise Id contains some string (possibly empty).
*
- * Id is checked for null in cdrInput that then returns null instead of
+ * Id is checked for null in AbstractCdrInput that then returns null instead of
* object.
*
* @param c a stream to read from.
* @throws IOException if the stream throws it.
*/
- public void _read_no_endian(cdrInput c)
+ public void _read_no_endian(AbstractCdrInput c)
throws IOException, BAD_PARAM
{
Id = c.read_string();
@@ -456,7 +459,7 @@ public class IOR
for (int i = 0; i < n_profiles; i++)
{
int tag = c.read_long();
- cdrBufInput profile = c.read_encapsulation();
+ BufferredCdrInput profile = c.read_encapsulation();
if (tag == Internet_profile.TAG_INTERNET_IOP)
{
@@ -515,7 +518,7 @@ public class IOR
* Write this IOR record to the provided CDR stream. This procedure writes the
* zero (Big Endian) marker first.
*/
- public void _write(cdrOutput out)
+ public void _write(AbstractCdrOutput out)
{
// Always use Big Endian.
out.write(0);
@@ -528,7 +531,7 @@ public class IOR
* The null value is written as defined in OMG specification (zero length
* string, followed by an empty set of profiles).
*/
- public static void write_null(cdrOutput out)
+ public static void write_null(AbstractCdrOutput out)
{
// Empty Id string.
out.write_string("");
@@ -541,7 +544,7 @@ public class IOR
* Write this IOR record to the provided CDR stream. The procedure writed data
* in Big Endian, but does NOT add any endian marker to the beginning.
*/
- public void _write_no_endian(cdrOutput out)
+ public void _write_no_endian(AbstractCdrOutput out)
{
// Write repository id.
out.write_string(Id);
@@ -595,7 +598,7 @@ public class IOR
*/
public String toStringifiedReference()
{
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
_write(out);
@@ -675,7 +678,7 @@ public class IOR
TaggedComponent[] present;
if (profile.profile_data.length > 0)
{
- cdrBufInput in = new cdrBufInput(profile.profile_data);
+ BufferredCdrInput in = new BufferredCdrInput(profile.profile_data);
present = new TaggedComponent[in.read_long()];
@@ -687,7 +690,7 @@ public class IOR
else
present = new TaggedComponent[0];
- cdrBufOutput out = new cdrBufOutput(profile.profile_data.length
+ BufferedCdrOutput out = new BufferedCdrOutput(profile.profile_data.length
+ component.component_data.length
+ 8);
@@ -715,4 +718,51 @@ public class IOR
// The future supported tagged profiles should be added here.
throw new BAD_PARAM("Unsupported profile type " + profile.tag);
}
+
+ /**
+ * Checks for equality.
+ */
+ public boolean equals(Object x)
+ {
+ if (x instanceof IOR)
+ {
+ boolean keys;
+ boolean hosts = true;
+
+ IOR other = (IOR) x;
+
+ if (Internet==null || other.Internet==null)
+ return Internet == other.Internet;
+
+ if (key != null && other.key != null)
+ keys = Arrays.equals(key, other.key);
+ else
+ keys = key == other.key;
+
+ if (Internet != null && Internet.host != null)
+ if (other.Internet != null && other.Internet.host != null)
+ hosts = other.Internet.host.equals(Internet.host);
+
+ return keys & hosts && Internet.port==other.Internet.port;
+ }
+ else
+ return false;
+ }
+
+ /**
+ * Get the hashcode of this IOR.
+ */
+ public int hashCode()
+ {
+ Adler32 adler = new Adler32();
+ if (key != null)
+ adler.update(key);
+ if (Internet != null)
+ {
+ if (Internet.host != null)
+ adler.update(Internet.host.getBytes());
+ adler.update(Internet.port);
+ }
+ return (int) adler.getValue();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java b/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
index 88756988c92..2b77de58e0e 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
@@ -38,16 +38,20 @@ exception statement from your version. */
package gnu.CORBA.Interceptor;
+import org.omg.CORBA.OBJ_ADAPTER;
+import org.omg.CORBA.OMGVMCID;
import org.omg.PortableInterceptor.IORInfo;
import org.omg.PortableInterceptor.IORInterceptor;
import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
/**
* A block of the all registered IOR interceptors.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class IORInterceptors implements IORInterceptorOperations
+public class IORInterceptors implements IORInterceptor_3_0Operations
{
/**
* The array of all registered IOR interceptors.
@@ -106,4 +110,81 @@ public class IORInterceptors implements IORInterceptorOperations
{
return getClass().getName();
}
+
+ /**
+ * Call this method for all registered CORBA 3.0 interceptors.
+ */
+ public void adapter_manager_state_changed(int adapterManagerId, short adapterState)
+ {
+ for (int i = 0; i < interceptors.length; i++)
+ {
+ try
+ {
+ if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+ {
+ ((IORInterceptor_3_0Operations) interceptors[i]).
+ adapter_manager_state_changed(adapterManagerId, adapterState);
+ }
+ }
+ catch (Exception exc)
+ {
+ OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+ oa.initCause(exc);
+ oa.minor = 6 | OMGVMCID.value;
+ throw oa;
+ }
+ }
+ }
+
+ /**
+ * Call this method for all registered CORBA 3.0 interceptors.
+ */
+ public void adapter_state_changed(ObjectReferenceTemplate[] adapters, short adaptersState)
+ {
+ for (int i = 0; i < interceptors.length; i++)
+ {
+ try
+ {
+ if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+ {
+ ((IORInterceptor_3_0Operations) interceptors[i]).
+ adapter_state_changed(adapters, adaptersState);
+ }
+ }
+ catch (Exception exc)
+ {
+ OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+ oa.initCause(exc);
+ oa.minor = 6 | OMGVMCID.value;
+ throw oa;
+ }
+ }
+ }
+
+ /**
+ * Call this method for all registered CORBA 3.0 interceptors.
+ *
+ * @throws OBJ_ADAPTER minor 6 on any failure (as defined by OMG specs).
+ */
+ public void components_established(IORInfo info)
+ {
+ for (int i = 0; i < interceptors.length; i++)
+ {
+ try
+ {
+ if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+ {
+ ((IORInterceptor_3_0Operations) interceptors[i]).
+ components_established(info);
+ }
+ }
+ catch (Exception exc)
+ {
+ OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+ oa.initCause(exc);
+ oa.minor = 6 | OMGVMCID.value;
+ throw oa;
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java b/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
index ff35cd0c85e..4bb895bb376 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.CORBA.Interceptor;
import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.ObjectCreator;
import gnu.CORBA.gnuCodecFactory;
import org.omg.CORBA.BAD_INV_ORDER;
@@ -87,7 +88,7 @@ public class Registrator extends LocalObject implements ORBInitInfo
/**
* The agreed properties prefix.
*/
- public final static String m_prefix =
+ public static final String m_prefix =
"org.omg.PortableInterceptor.ORBInitializerClass.";
/**
@@ -182,7 +183,8 @@ public class Registrator extends LocalObject implements ORBInitInfo
try
{
String cn = sk.substring(m_prefix.length());
- Class iClass = Class.forName(cn);
+ Class iClass = ObjectCreator.forName(cn);
+
ORBInitializer initializer =
(ORBInitializer) iClass.newInstance();
m_initializers.add(initializer);
@@ -467,4 +469,4 @@ public class Registrator extends LocalObject implements ORBInitInfo
{
return m_ior.size() > 0;
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java b/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
index ee8af7fc0b4..a33afc3362e 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.Interceptor;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.Poa.ORB_1_4;
import org.omg.CORBA.Any;
@@ -198,7 +198,7 @@ public class gnuIcCurrent extends ObjectImpl implements Current
Any[] r = get_slots();
Any[] copy = new Any[ r.length ];
- cdrBufOutput buf = new cdrBufOutput();
+ BufferedCdrOutput buf = new BufferedCdrOutput();
buf.setOrb(orb);
for (int i = 0; i < copy.length; i++)
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java b/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
index 1c406cb5e46..256a28cb567 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
@@ -40,12 +40,14 @@ package gnu.CORBA.Interceptor;
import gnu.CORBA.IOR;
import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.gnuPOA;
import org.omg.CORBA.LocalObject;
import org.omg.CORBA.Policy;
import org.omg.IOP.TaggedComponent;
import org.omg.PortableInterceptor.IORInfo;
-import org.omg.PortableServer.POA;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
/**
* Implements IORInfo.
@@ -67,7 +69,7 @@ public class gnuIorInfo extends LocalObject implements IORInfo
/**
* The POA, to that IOR is related.
*/
- public final POA poa;
+ public final gnuPOA poa;
/**
* The IOR itself.
@@ -77,7 +79,7 @@ public class gnuIorInfo extends LocalObject implements IORInfo
/**
* Create an instance.
*/
- public gnuIorInfo(ORB_1_4 an_orb, POA a_poa, IOR an_ior)
+ public gnuIorInfo(ORB_1_4 an_orb, gnuPOA a_poa, IOR an_ior)
{
orb = an_orb;
poa = a_poa;
@@ -113,8 +115,42 @@ public class gnuIorInfo extends LocalObject implements IORInfo
/**
* Return the state of the object POA.
*/
- short state()
+ public short state()
{
return (short) poa.the_POAManager().get_state().value();
}
+
+ /**
+ * Get the adapter template, associated with this poa.
+ */
+ public ObjectReferenceTemplate adapter_template()
+ {
+ return poa.getReferenceTemplate();
+ }
+
+ /**
+ * Get the object factory of the current POA.
+ */
+ public ObjectReferenceFactory current_factory()
+ {
+ return poa.getReferenceFactory();
+ }
+
+ /**
+ * Set the object factory of the current POA.
+ */
+ public void current_factory(ObjectReferenceFactory factory)
+ {
+ poa.setReferenceFactory(factory);
+ }
+
+ /**
+ * The method currently uses system identity hashcode that should be
+ * different for each object.
+ */
+ public int manager_id()
+ {
+ // The System.identityHashCode is also called in gnuPoaManager.
+ return System.identityHashCode(poa.the_POAManager());
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java b/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
index 5f75f76878a..8d5c681e705 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
@@ -42,6 +42,7 @@ import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
import gnu.CORBA.ObjectCreator;
import gnu.CORBA.Poa.gnuServantObject;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.Unexpected;
import gnu.CORBA.gnuRequest;
@@ -453,4 +454,23 @@ public class gnuServerRequestInfo extends LocalObject
}
return p;
}
+
+ /** @inheritDoc */
+ public String[] adapter_name()
+ {
+ return m_object.poa.getReferenceTemplate().adapter_name();
+ }
+
+ /** @inheritDoc */
+ public String orb_id()
+ {
+ return m_object.orb.orb_id;
+ }
+
+ /** @inheritDoc */
+ public String server_id()
+ {
+ return OrbFunctional.server_id;
+ }
+
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/IOR_Delegate.java b/libjava/classpath/gnu/CORBA/IorDelegate.java
index 3b64eb585c4..27fb5de9a55 100644
--- a/libjava/classpath/gnu/CORBA/IOR_Delegate.java
+++ b/libjava/classpath/gnu/CORBA/IorDelegate.java
@@ -38,9 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
+import gnu.CORBA.CDR.BufferredCdrInput;
import gnu.CORBA.GIOP.ReplyHeader;
-import gnu.CORBA.Poa.activeObjectMap;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.Context;
@@ -70,23 +69,12 @@ import java.net.Socket;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class IOR_Delegate extends Simple_delegate
+public class IorDelegate extends SimpleDelegate
{
/**
- * True if the current IOR does not map into the local servant. If false, the
- * IOR is either local or should be checked.
- */
- boolean remote_ior;
-
- /**
- * If not null, this field contains data about the local servant.
- */
- activeObjectMap.Obj local_ior;
-
- /**
* Contructs an instance of object using the given IOR.
*/
- public IOR_Delegate(ORB an_orb, IOR an_ior)
+ public IorDelegate(ORB an_orb, IOR an_ior)
{
super(an_orb, an_ior);
}
@@ -168,37 +156,36 @@ public class IOR_Delegate extends Simple_delegate
* request to the new direction. The ReplyHeader.LOCATION_FORWARD_PERM will
* cause additionally to remember the new location by this delegate, so
* subsequent calls will be immediately delivered to the new target.
- *
+ *
* @param target the target object.
* @param output the output stream, previously returned by
* {@link #request(org.omg.CORBA.Object, String, boolean)}.
- *
+ *
* @return the input stream, to read the response from or null for a one-way
* request.
- *
+ *
* @throws SystemException if the SystemException has been thrown on the
* remote side (the exact type and the minor code matches the data of the
* remote exception that has been thrown).
- *
+ *
* @throws org.omg.CORBA.portable.ApplicationException as specified.
* @throws org.omg.CORBA.portable.RemarshalException as specified.
*/
public InputStream invoke(org.omg.CORBA.Object target, OutputStream output)
throws ApplicationException, RemarshalException
{
- streamRequest request = (streamRequest) output;
- Forwardings:
- while (true)
+ StreamBasedRequest request = (StreamBasedRequest) output;
+ Forwardings: while (true)
{
try
{
if (request.response_expected)
{
- binaryReply response = request.request.submit();
+ RawReply response = request.request.submit();
// Read reply header.
ReplyHeader rh = response.header.create_reply_header();
- cdrBufInput input = response.getStream();
+ BufferredCdrInput input = response.getStream();
input.setOrb(orb);
rh.read(input);
request.request.m_rph = rh;
@@ -207,34 +194,33 @@ public class IOR_Delegate extends Simple_delegate
switch (rh.reply_status)
{
- case ReplyHeader.NO_EXCEPTION :
+ case ReplyHeader.NO_EXCEPTION:
if (request.request.m_interceptor != null)
- request.request.m_interceptor.
- receive_reply(request.request.m_info);
+ request.request.m_interceptor.receive_reply(request.request.m_info);
if (response.header.version.since_inclusive(1, 2))
input.align(8);
return input;
- case ReplyHeader.SYSTEM_EXCEPTION :
+ case ReplyHeader.SYSTEM_EXCEPTION:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
showException(request, input);
- throw ObjectCreator.readSystemException(input);
+ throw ObjectCreator.readSystemException(input,
+ rh.service_context);
- case ReplyHeader.USER_EXCEPTION :
+ case ReplyHeader.USER_EXCEPTION:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
showException(request, input);
- throw new ApplicationException(request.
- request.m_exception_id, input
- );
+ throw new ApplicationException(
+ request.request.m_exception_id, input);
- case ReplyHeader.LOCATION_FORWARD_PERM :
+ case ReplyHeader.LOCATION_FORWARD_PERM:
moved_permanently = true;
- case ReplyHeader.LOCATION_FORWARD :
+ case ReplyHeader.LOCATION_FORWARD:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
@@ -245,10 +231,8 @@ public class IOR_Delegate extends Simple_delegate
}
catch (IOException ex)
{
- MARSHAL t =
- new MARSHAL("Cant read forwarding info", 5102,
- CompletionStatus.COMPLETED_NO
- );
+ MARSHAL t = new MARSHAL("Cant read forwarding info",
+ 5102, CompletionStatus.COMPLETED_NO);
t.initCause(ex);
throw t;
}
@@ -277,8 +261,8 @@ public class IOR_Delegate extends Simple_delegate
r.setIor(forwarded);
- IOR_contructed_object it =
- new IOR_contructed_object(orb, forwarded);
+ IorObject it = new IorObject(orb,
+ forwarded);
r.m_target = it;
@@ -298,11 +282,10 @@ public class IOR_Delegate extends Simple_delegate
setIor(prev_ior);
}
- default :
- throw new MARSHAL("Unknow reply status: " +
- rh.reply_status, 8000 + rh.reply_status,
- CompletionStatus.COMPLETED_NO
- );
+ default:
+ throw new MARSHAL("Unknow reply status: "
+ + rh.reply_status, 8000 + rh.reply_status,
+ CompletionStatus.COMPLETED_NO);
}
}
else
@@ -314,8 +297,7 @@ public class IOR_Delegate extends Simple_delegate
catch (ForwardRequest forwarded)
{
ForwardRequest fw = forwarded;
- Forwarding2:
- while (true)
+ Forwarding2: while (true)
{
try
{
@@ -356,7 +338,7 @@ public class IOR_Delegate extends Simple_delegate
/**
* Show exception to interceptor.
*/
- void showException(streamRequest request, cdrBufInput input)
+ void showException(StreamBasedRequest request, BufferredCdrInput input)
throws ForwardRequest
{
input.mark(2048);
@@ -408,9 +390,10 @@ public class IOR_Delegate extends Simple_delegate
request.set_target(target);
request.setOperation(operation);
- streamRequest out = request.getParameterStream();
+ StreamBasedRequest out = request.getParameterStream();
out.response_expected = response_expected;
request.setORB(orb);
+ out.setOrb(orb);
return out;
}
@@ -447,8 +430,6 @@ public class IOR_Delegate extends Simple_delegate
public void setIor(IOR an_ior)
{
super.setIor(an_ior);
- remote_ior = false;
- local_ior = null;
}
/**
@@ -456,11 +437,6 @@ public class IOR_Delegate extends Simple_delegate
*/
public boolean is_local(org.omg.CORBA.Object self)
{
- if (remote_ior)
- return false;
- else if (local_ior != null)
- return true;
- else
- return super.is_local(self);
+ return false;
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/IOR_contructed_object.java b/libjava/classpath/gnu/CORBA/IorObject.java
index 2fab70799db..02f5a495d49 100644
--- a/libjava/classpath/gnu/CORBA/IOR_contructed_object.java
+++ b/libjava/classpath/gnu/CORBA/IorObject.java
@@ -1,4 +1,4 @@
-/* IOR_contructed_object.java --
+/* IorObject.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,8 +46,9 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class IOR_contructed_object
+public class IorObject
extends ObjectImpl
+ implements IorProvider
{
/**
* The IOR, from which the object was constructed.
@@ -64,10 +65,10 @@ public class IOR_contructed_object
*
* @param an_ior the IOR.
*/
- public IOR_contructed_object(ORB orb, IOR an_ior)
+ public IorObject(ORB orb, IOR an_ior)
{
ior = an_ior;
- _set_delegate(new IOR_Delegate(orb, ior));
+ _set_delegate(new IorDelegate(orb, ior));
id = new String[] { ior.Id };
}
@@ -76,12 +77,20 @@ public class IOR_contructed_object
*
* @param an_ior the IOR in the string form.
*/
- public IOR_contructed_object(Functional_ORB orb, String an_ior)
+ public IorObject(OrbFunctional orb, String an_ior)
{
ior = IOR.parse(an_ior);
- _set_delegate(new IOR_Delegate(orb, ior));
+ _set_delegate(new IorDelegate(orb, ior));
id = new String[] { ior.Id };
}
+
+ /**
+ * Get the IOR of this object.
+ */
+ public IOR getIor()
+ {
+ return ior;
+ }
public String[] _ids()
{
diff --git a/libjava/classpath/org/omg/CORBA/IDLEntity.java b/libjava/classpath/gnu/CORBA/IorProvider.java
index 6515d83305b..875b5de1f7d 100644
--- a/libjava/classpath/org/omg/CORBA/IDLEntity.java
+++ b/libjava/classpath/gnu/CORBA/IorProvider.java
@@ -1,4 +1,4 @@
-/* IDLEntity.java --
+/* IorProvider.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,16 +35,18 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
-package org.omg.CORBA;
-
-import java.io.Serializable;
+package gnu.CORBA;
/**
- * Indicates that this class has a corresponding Helper class.
- * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ * Marks the possibility of the implementing object to return the associated
+ * IOR.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface IDLEntity
- extends Serializable
+public interface IorProvider
{
+ /**
+ * Get the IOR of the associated object.
+ */
+ IOR getIor();
}
diff --git a/libjava/classpath/gnu/CORBA/Minor.java b/libjava/classpath/gnu/CORBA/Minor.java
new file mode 100644
index 00000000000..511a34d559b
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/Minor.java
@@ -0,0 +1,282 @@
+/* Minor.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.CORBA;
+
+
+/**
+ * Provides information and operations, related to about the 20 bit vendor minor
+ * code Id. This code is included into all CORBA system exceptions and is also
+ * transferred to remote side.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface Minor
+{
+ // Note: MARSHAL done.
+
+ /* MARSHAL */
+
+ /**
+ * The GNU Classpath VMCID. The last 12 bits can be used to mark up to 4096
+ * possible exceptions.
+ */
+ int vendor = 0x47430000;
+
+ /*
+ * Minor codes form MARSHAL exception.
+ */
+
+ /**
+ * The message being received is not a GIOP message. It does not start from
+ * the expected magic sequence byte[] { 'G', 'I', 'O', 'P' }.
+ */
+ int Giop = 1 | vendor;
+
+ /**
+ * The unexpected IOException while reading or writing the GIOP message header
+ * or the subsequent request or response header
+ */
+ int Header = 2 | vendor;
+
+ /**
+ * The data stream ended before reading all expected values from it. This
+ * usually means that the CORBA message is corrupted, but may also indicate
+ * that the server expects the remote method being invoked to have more or
+ * different parameters.
+ */
+ int EOF = 3 | vendor;
+
+ /**
+ * The unexpected IOException while reading or writing the data via Commond
+ * Data Representation stream.
+ */
+ int CDR = 5 | vendor;
+
+ /**
+ * The unexpected IOException while reading or writing the Value type.
+ */
+ int Value = 6 | vendor;
+
+ /**
+ * The unexpected IOException while handling request forwarding.
+ */
+ int Forwarding = 7 | vendor;
+
+ /**
+ * The unexpected IOException while handling data encapsulation, tagged
+ * components, tagged profiles, etc.
+ */
+ int Encapsulation = 8 | vendor;
+
+ /**
+ * The unexpected IOException while inserting or extracting data to/from the
+ * Any or DynamicAny.
+ */
+ int Any = 9 | vendor;
+
+ /**
+ * The unexpected UserException in the context where it cannot be handled and
+ * must be converted to the SystemException.
+ */
+ int UserException = 10 | vendor;
+
+ /**
+ * While the operation could formally be applied to the target, the OMG
+ * standard states that it is actually not applicable. For example, some CORBA
+ * objects like POA are always local and should not be passed to or returned
+ * from the remote side.
+ */
+ int Inappropriate = 11 | vendor;
+
+ /**
+ * When reading data, it was discovered that size of the data structure like
+ * string, sequence or character is written as the negative number.
+ */
+ int Negative = 12 | vendor;
+
+ /**
+ * Reference to non-existing node in the data grapth while reading the value
+ * types.
+ */
+ int Graph = 14 | vendor;
+
+ /**
+ * Unexpected exception was thrown from the IDL type helper while handling the
+ * object of this type as a boxed value.
+ */
+ int Boxed = 15 | vendor;
+
+ /**
+ * Unable to instantiate an value type object while reading it from the
+ * stream.
+ */
+ int Instantiation = 16 | vendor;
+
+ /**
+ * The header tag of the value type being read from the CDR stream contains an
+ * unexpected value outside 0x7fffff00 .. 0x7fffffff and also not null and not
+ * an indirection.
+ */
+ int ValueHeaderTag = 17 | vendor;
+
+ /**
+ * The header tag flags of the value type being read from the CDR stream make
+ * the invalid combination (for instance, 0x7fffff04).
+ */
+ int ValueHeaderFlags = 18 | vendor;
+
+ /**
+ * The value type class, written on the wire, is not compatible with the
+ * expected class, passed as a parameter to the InputStream.read_value.
+ */
+ int ClassCast = 19 | vendor;
+
+ /**
+ * Positive or otherwise invalid indirection offset when reading the data
+ * graph of the value type.
+ */
+ int Offset = 20 | vendor;
+
+ /**
+ * Errors while reading the chunked value type.
+ */
+ int Chunks = 21 | vendor;
+
+ /**
+ * No means are provided to write this value type.
+ */
+ int UnsupportedValue = 22 | vendor;
+
+ /**
+ * The value factory, required for the operation being invoked, is not
+ * registered with this ORB.
+ */
+ int Factory = 23 | vendor;
+
+ /**
+ * Unsupported object addressing method in GIOP request header.
+ */
+ int UnsupportedAddressing = 24 | vendor;
+
+ /**
+ * Invalid stringified object reference (IOR).
+ */
+ int IOR = 25 | vendor;
+
+ /**
+ * Problems with converting between stubs, ties, interfaces and
+ * implementations.
+ */
+ int TargetConversion = 26 | vendor;
+
+ /**
+ * Problems with reading or writing the fields of the value type object.
+ */
+ int ValueFields = 27 | vendor;
+
+ /**
+ * The instance of the value type is not serializable.
+ */
+ int NonSerializable = 28 | vendor;
+
+ /* BAD_OPERATION */
+
+ /**
+ * The remote side requested to invoke the method that is not available on
+ * that target (client and server probably disagree in the object definition).
+ */
+ int Method = 0 | vendor;
+
+ /**
+ * Failed to activate the inactive object.
+ */
+ int Activation = 10 | vendor;
+
+ /*
+ * Any - Attempt to extract from the Any value of the different type that was
+ * stored into that Any.
+ */
+
+ /* ClassCast - Unable to narrow the object into stub. */
+
+ /**
+ * The policies, applying to ORB or POA prevent the requested operation.
+ */
+ int Policy = 11 | vendor;
+
+ /**
+ * Socket related errors like failure to open socket on the expected port,
+ * failure to get a free port when required and so on.
+ */
+ int Socket = 12 | vendor;
+
+ /**
+ * The passed value for enumeration is outside the valid range for that
+ * enumeration.
+ */
+ int Enumeration = 14 | vendor;
+
+ /**
+ * The passed policy code is outside the valid range of the possible policies
+ * for the given policy type.
+ */
+ int PolicyType = 15 | vendor;
+
+ /* NO_RESOURCES */
+
+ /**
+ * Unable to get a free port for a new socket. Proably too many objects under
+ * unsuitable POA policy.
+ */
+ int Ports = 20 | vendor;
+
+ /**
+ * Too many parallel calls (too many parallel threads). The thread control
+ * prevents malicios client from knocking the server out by suddenly
+ * submitting large number of requests.
+ */
+ int Threads = 21 | vendor;
+
+ /**
+ * The IOR starts with file://, http:// or ftp://, but this local or remote
+ * resource is not accessible.
+ */
+ int Missing_IOR = 22 | vendor;
+
+}
diff --git a/libjava/classpath/gnu/CORBA/NamingService/Ext.java b/libjava/classpath/gnu/CORBA/NamingService/Ext.java
index fb7406c4618..ee27e68cd79 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/Ext.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/Ext.java
@@ -73,7 +73,7 @@ public class Ext
* The converter class converts between string and array form of the
* name.
*/
- private snConverter converter = new snConverter();
+ private NameTransformer converter = new NameTransformer();
/**
* Create the extensions for the given instance of the context.
diff --git a/libjava/classpath/gnu/CORBA/NamingService/cmpNameComponent.java b/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java
index 1e06fb8ee35..6116ba94e74 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/cmpNameComponent.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java
@@ -1,4 +1,4 @@
-/* cmpNameComponent.java --
+/* NameComponentComparator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,18 +49,18 @@ import java.util.Comparator;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public final class cmpNameComponent
+public final class NameComponentComparator
implements Comparator
{
/**
* The singleton instance of the name comparator.
*/
- public static final cmpNameComponent singleton = new cmpNameComponent();
+ public static final NameComponentComparator singleton = new NameComponentComparator();
/**
* It is enough to have a singleton.
*/
- private cmpNameComponent()
+ private NameComponentComparator()
{
}
@@ -93,6 +93,6 @@ public final class cmpNameComponent
*/
public boolean equals(Object x)
{
- return x instanceof cmpNameComponent;
+ return x instanceof NameComponentComparator;
}
}
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
index f886cf93533..422db1c58da 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
@@ -1,44 +1,45 @@
/* NameParser.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package gnu.CORBA.NamingService;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import gnu.CORBA.Unexpected;
import gnu.CORBA.Version;
@@ -51,11 +52,15 @@ import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextHelper;
import org.omg.CosNaming._NamingContextStub;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.StringTokenizer;
@@ -74,7 +79,7 @@ import java.util.StringTokenizer;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NameParser
- extends snConverter
+ extends NameTransformer
{
/**
* The corbaloc prefix.
@@ -90,6 +95,21 @@ public class NameParser
* The IOR prefix.
*/
public static final String pxIOR = "ior";
+
+ /**
+ * The file:// prefix.
+ */
+ public static final String pxFILE = "file://";
+
+ /**
+ * The ftp:// prefix.
+ */
+ public static final String pxFTP = "ftp://";
+
+ /**
+ * The http:// prefix.
+ */
+ public static final String pxHTTP = "http://";
/**
* Marks iiop protocol.
@@ -114,7 +134,7 @@ public class NameParser
/**
* The string to name converter, initialized on demand.
*/
- static snConverter converter;
+ static NameTransformer converter;
/**
* The current position.
@@ -134,6 +154,9 @@ public class NameParser
* 2. corbaloc:rir:[/key] <br>
* 3. corbaname:[iiop][version.subversion@]:host[:port]/key <br>
* 4. corbaname:rir:[/key] <br>
+ * 5. file://[file name]<br>
+ * 6. http://[url]<br>
+ * 7. ftp://[url]<br>
*
* Protocol defaults to IOP, the object key defaults to the NameService.
*
@@ -143,9 +166,31 @@ public class NameParser
* @return the resolved object.
*/
public synchronized org.omg.CORBA.Object corbaloc(String corbaloc,
- Functional_ORB orb)
+ OrbFunctional orb)
throws BAD_PARAM
{
+ return corbaloc(corbaloc, orb, 0);
+ }
+
+ /**
+ * Parse controlling against the infinite recursion loop.
+ */
+ private org.omg.CORBA.Object corbaloc(String corbaloc,
+ OrbFunctional orb, int recursion)
+ {
+ // The used CORBA specification does not state how many times we should to
+ //redirect, but the infinite loop may be used to knock out the system.
+ // by malicious attempt.
+ if (recursion > 10)
+ throw new DATA_CONVERSION("More than 10 redirections");
+
+ if (corbaloc.startsWith(pxFILE))
+ return corbaloc(readFile(corbaloc.substring(pxFILE.length())), orb, recursion+1);
+ else if (corbaloc.startsWith(pxHTTP))
+ return corbaloc(readUrl(corbaloc), orb, recursion+1);
+ else if (corbaloc.startsWith(pxFTP))
+ return corbaloc(readUrl(corbaloc), orb, recursion+1);
+
boolean corbaname;
// The alternative addresses, if given.
@@ -304,6 +349,70 @@ public class NameParser
else
throw new DATA_CONVERSION("Unsupported protocol '" + t[p] + "'");
}
+
+ /**
+ * Read IOR from the file in the local file system.
+ */
+ String readFile(String file)
+ {
+ File f = new File(file);
+ if (!f.exists())
+ {
+ DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
+ + " does not exist.");
+ err.minor = Minor.Missing_IOR;
+ }
+ try
+ {
+ char[] c = new char[(int) f.length()];
+ FileReader fr = new FileReader(f);
+ fr.read(c);
+ fr.close();
+ return new String(c).trim();
+ }
+ catch (IOException ex)
+ {
+ DATA_CONVERSION d = new DATA_CONVERSION();
+ d.initCause(ex);
+ d.minor = Minor.Missing_IOR;
+ throw (d);
+ }
+ }
+
+ /**
+ * Read IOR from the remote URL.
+ */
+ String readUrl(String url)
+ {
+ URL u;
+ try
+ {
+ u = new URL(url);
+ }
+ catch (MalformedURLException mex)
+ {
+ throw new BAD_PARAM("Malformed URL: '" + url + "'");
+ }
+
+ try
+ {
+ InputStreamReader r = new InputStreamReader(u.openStream());
+
+ StringBuffer b = new StringBuffer();
+ int c;
+
+ while ((c = r.read()) > 0)
+ b.append((char) c);
+
+ return b.toString().trim();
+ }
+ catch (Exception exc)
+ {
+ DATA_CONVERSION d = new DATA_CONVERSION("Reading " + url + " failed.");
+ d.minor = Minor.Missing_IOR;
+ throw d;
+ }
+ }
private org.omg.CORBA.Object resolve(org.omg.CORBA.Object object)
{
@@ -329,7 +438,7 @@ public class NameParser
}
if (converter == null)
- converter = new snConverter();
+ converter = new NameTransformer();
try
{
@@ -380,7 +489,7 @@ public class NameParser
static NameParser n = new NameParser();
- static void corbalocT(String ior, Functional_ORB orb)
+ static void corbalocT(String ior, OrbFunctional orb)
{
System.out.println(ior);
System.out.println(n.corbaloc(ior, orb));
@@ -391,7 +500,7 @@ public class NameParser
{
try
{
- Functional_ORB orb = (Functional_ORB) ORB.init(args, null);
+ OrbFunctional orb = (OrbFunctional) ORB.init(args, null);
corbalocT("corbaloc:iiop:1.3@155axyz.com/Prod/aTradingService", orb);
corbalocT("corbaloc:iiop:2.7@255bxyz.com/Prod/bTradingService", orb);
corbalocT("corbaloc:iiop:355cxyz.com/Prod/cTradingService", orb);
diff --git a/libjava/classpath/gnu/CORBA/NamingService/snConverter.java b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
index a9b9219d76a..0e0782a5756 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/snConverter.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
@@ -1,4 +1,4 @@
-/* snConverter.java --
+/* NameTransformer.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import java.util.StringTokenizer;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class snConverter
+public class NameTransformer
{
/**
* A string, indicating the escape character.
@@ -301,7 +301,7 @@ public class snConverter
NameComponent b = new NameComponent("b/z", "b.k");
NameComponent c = new NameComponent("c", "");
- snConverter sn = new snConverter();
+ NameTransformer sn = new NameTransformer();
try
{
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java b/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
index a69b0617269..95deb0096bd 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
@@ -66,7 +66,7 @@ public class NamingMap
*/
public NamingMap()
{
- map = new TreeMap(cmpNameComponent.singleton);
+ map = new TreeMap(NameComponentComparator.singleton);
}
/**
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
index e46bed7f7a1..bf72637d7d7 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
@@ -1,4 +1,4 @@
-/* Server.java --
+/* NamingServiceTransient.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.NamingService;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import org.omg.CosNaming.NamingContextExt;
@@ -102,7 +102,7 @@ public class NamingServiceTransient
try
{
// Create and initialize the ORB
- final Functional_ORB orb = new Functional_ORB();
+ final OrbFunctional orb = new OrbFunctional();
if (args.length > 1)
for (int i = 0; i < args.length - 1; i++)
@@ -114,7 +114,7 @@ public class NamingServiceTransient
iorf = args[i + 1];
}
- Functional_ORB.setPort(port);
+ OrbFunctional.setPort(port);
// Create the servant and register it with the ORB
NamingContextExt namer = new Ext(new TransientContext());
@@ -159,6 +159,6 @@ public class NamingServiceTransient
// Restore the default value for allocating ports for the subsequent
// objects.
- Functional_ORB.setPort(Functional_ORB.DEFAULT_INITIAL_PORT);
+ OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
}
}
diff --git a/libjava/classpath/gnu/CORBA/ObjectCreator.java b/libjava/classpath/gnu/CORBA/ObjectCreator.java
index 81c1d06e775..5937e76b31e 100644
--- a/libjava/classpath/gnu/CORBA/ObjectCreator.java
+++ b/libjava/classpath/gnu/CORBA/ObjectCreator.java
@@ -38,27 +38,37 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.UnknownExceptionCtxHandler;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.classpath.VMStackWalker;
import org.omg.CORBA.Any;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.CompletionStatusHelper;
import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.StructMember;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueBase;
-import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.rmi.CORBA.Util;
/**
* Creates java objects from the agreed IDL names for the simple case when the
* CORBA object is directly mapped into the locally defined java class.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class ObjectCreator
@@ -79,91 +89,137 @@ public class ObjectCreator
public static final String CLASSPATH_PREFIX = "gnu.CORBA.";
/**
+ * Maps classes to they IDL or RMI names. Computing RMI name is an expensive
+ * operations, so frequently used RMI keys are reused. The map must be weak to
+ * ensure that the class can be unloaded, when applicable.
+ */
+ public static Map m_names = new WeakHashMap();
+
+ /**
+ * Maps IDL strings into known classes. The map must be weak to ensure that
+ * the class can be unloaded, when applicable.
+ */
+ public static Map m_classes = new WeakHashMap();
+
+ /**
+ * Maps IDL types to they helpers.
+ */
+ public static Map m_helpers = new WeakHashMap();
+
+ /**
* Try to instantiate an object with the given IDL name. The object must be
* mapped to the local java class. The omg.org domain must be mapped into the
* object in either org/omg or gnu/CORBA namespace.
- *
+ *
* @param IDL name
* @return instantiated object instance or null if no such available.
*/
public static java.lang.Object createObject(String idl, String suffix)
{
- try
- {
- return Class.forName(toClassName(JAVA_PREFIX, idl) + suffix)
- .newInstance();
- }
- catch (Exception ex)
+ synchronized (m_classes)
{
- try
+ Class known = (Class) (suffix == null ? m_classes.get(idl)
+ : m_classes.get(idl + 0xff + suffix));
+ Object object;
+
+ if (known != null)
{
- return Class.forName(toClassName(CLASSPATH_PREFIX, idl) + suffix)
- .newInstance();
+ try
+ {
+ return known.newInstance();
+ }
+ catch (Exception ex)
+ {
+ RuntimeException rex = new RuntimeException(idl + " suffix "
+ + suffix, ex);
+ throw rex;
+ }
}
- catch (Exception exex)
+ else
{
- return null;
+ if (suffix == null)
+ suffix = "";
+ try
+ {
+ known = forName(toClassName(JAVA_PREFIX, idl) + suffix);
+ object = known.newInstance();
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ known = forName(toClassName(CLASSPATH_PREFIX, idl)
+ + suffix);
+ object = known.newInstance();
+ }
+ catch (Exception exex)
+ {
+ return null;
+ }
+ }
+ m_classes.put(idl + 0xff + suffix, known);
+ return object;
}
}
}
/**
- * Create the system exception with the given idl name.
- *
- * @param idl the exception IDL name, must match the syntax "IDL:<class/name>:1.0".
- * @param minor the exception minor code.
- * @param completed the exception completion status.
- *
- * @return the created exception.
+ * Read the system exception from the given stream.
+ *
+ * @param input the CDR stream to read from.
+ * @param contexts the service contexts in request/reply header/
+ *
+ * @return the exception that has been stored in the stream (IDL name, minor
+ * code and completion status).
*/
- public static SystemException createSystemException(String idl, int minor,
- CompletionStatus completed
- )
+ public static SystemException readSystemException(InputStream input,
+ ServiceContext[] contexts)
{
+ SystemException exception;
+
+ String idl = input.read_string();
+ int minor = input.read_ulong();
+ CompletionStatus completed = CompletionStatusHelper.read(input);
+
try
{
- String cl = toClassName(JAVA_PREFIX, idl);
- Class exClass = Class.forName(cl);
-
- Constructor constructor =
- exClass.getConstructor(new Class[]
- {
- String.class, int.class, CompletionStatus.class
- }
- );
-
- Object exception =
- constructor.newInstance(new Object[]
- {
- " Remote exception " + idl + ", minor " + minor + ", " +
- completed + ".", new Integer(minor), completed
- }
- );
-
- return (SystemException) exception;
+ exception = (SystemException) createObject(idl, null);
+ exception.minor = minor;
+ exception.completed = completed;
}
catch (Exception ex)
{
- ex.printStackTrace();
- return new UNKNOWN("Unsupported system exception", minor, completed);
+ UNKNOWN u = new UNKNOWN("Unsupported system exception " + idl, minor,
+ completed);
+ u.initCause(ex);
+ throw u;
}
- }
- /**
- * Read the system exception from the given stream.
- *
- * @param input the CDR stream to read from.
- * @return the exception that has been stored in the stream (IDL name, minor
- * code and completion status).
- */
- public static SystemException readSystemException(InputStream input)
- {
- String idl = input.read_string();
- int minor = input.read_ulong();
- CompletionStatus status = CompletionStatusHelper.read(input);
+ try
+ {
+ // If UnknownExceptionInfo is present in the contexts, read it and
+ // set as a cause of this exception.
+ ServiceContext uEx = ServiceContext.find(
+ ServiceContext.UnknownExceptionInfo, contexts);
- SystemException exception =
- ObjectCreator.createSystemException(idl, minor, status);
+ if (uEx != null)
+ {
+ BufferredCdrInput in = new BufferredCdrInput(uEx.context_data);
+ in.setOrb(in.orb());
+ if (input instanceof AbstractCdrInput)
+ {
+ ((AbstractCdrInput) input).cloneSettings(in);
+ }
+
+ Throwable t = UnknownExceptionCtxHandler.read(in, contexts);
+ exception.initCause(t);
+ }
+ }
+ catch (Exception ex)
+ {
+ // Unsupported context format. Do not terminate as the user program may
+ // not need it.
+ }
return exception;
}
@@ -172,10 +228,10 @@ public class ObjectCreator
* Reads the user exception, having the given Id, from the input stream. The
* id is expected to be in the form like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
+ *
* @param idl the exception idl name.
* @param input the stream to read from.
- *
+ *
* @return the loaded exception.
* @return null if the helper class cannot be found.
*/
@@ -183,13 +239,10 @@ public class ObjectCreator
{
try
{
- String helper = toHelperName(idl);
- Class helperClass = Class.forName(helper);
+ Class helperClass = findHelper(idl);
- Method read =
- helperClass.getMethod("read",
- new Class[] { org.omg.CORBA.portable.InputStream.class }
- );
+ Method read = helperClass.getMethod("read",
+ new Class[] { org.omg.CORBA.portable.InputStream.class });
return (UserException) read.invoke(null, new Object[] { input });
}
@@ -208,7 +261,7 @@ public class ObjectCreator
/**
* Gets the helper class name from the string like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
+ *
* @param IDL the idl name.
*/
public static String toHelperName(String IDL)
@@ -227,15 +280,14 @@ public class ObjectCreator
/**
* Writes the system exception data to CDR output stream.
- *
+ *
* @param output a stream to write data to.
* @param ex an exception to write.
*/
public static void writeSystemException(OutputStream output,
- SystemException ex
- )
+ SystemException ex)
{
- String exIDL = toIDL(ex.getClass().getName());
+ String exIDL = getRepositoryId(ex.getClass());
output.write_string(exIDL);
output.write_ulong(ex.minor);
CompletionStatusHelper.write(output, ex.completed);
@@ -243,9 +295,9 @@ public class ObjectCreator
/**
* Converts the given IDL name to class name.
- *
+ *
* @param IDL the idl name.
- *
+ *
*/
protected static String toClassName(String prefix, String IDL)
{
@@ -265,34 +317,43 @@ public class ObjectCreator
* Converts the given IDL name to class name and tries to load the matching
* class. The OMG prefix (omg.org) is replaced by the java prefix org.omg. No
* other prefixes are added.
- *
+ *
* @param IDL the idl name.
- *
- * TODO Cache the returned classes, avoiding these string manipulations each
- * time the conversion is required.
- *
+ *
* @return the matching class or null if no such is available.
*/
public static Class Idl2class(String IDL)
{
- String s = IDL;
- int a = s.indexOf(':') + 1;
- int b = s.lastIndexOf(':');
-
- s = IDL.substring(a, b);
-
- if (s.startsWith(OMG_PREFIX))
- s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
-
- String cn = s.replace('/', '.');
-
- try
+ synchronized (m_classes)
{
- return Class.forName(cn);
- }
- catch (ClassNotFoundException ex)
- {
- return null;
+ Class c = (Class) m_classes.get(IDL);
+
+ if (c != null)
+ return c;
+ else
+ {
+ String s = IDL;
+ int a = s.indexOf(':') + 1;
+ int b = s.lastIndexOf(':');
+
+ s = IDL.substring(a, b);
+
+ if (s.startsWith(OMG_PREFIX))
+ s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
+
+ String cn = s.replace('/', '.');
+
+ try
+ {
+ c = forName(cn);
+ m_classes.put(IDL, c);
+ return c;
+ }
+ catch (ClassNotFoundException ex)
+ {
+ return null;
+ }
+ }
}
}
@@ -301,9 +362,9 @@ public class ObjectCreator
* and create an object instance with parameterless constructor. The OMG
* prefix (omg.org) is replaced by the java prefix org.omg. No other prefixes
* are added.
- *
+ *
* @param IDL the idl name.
- *
+ *
* @return instantiated object instance or null if such attempt was not
* successful.
*/
@@ -325,34 +386,53 @@ public class ObjectCreator
}
/**
- * Convert the class name to IDL name.
- *
- * @param cn the class name.
- *
- * @return the idl name.
+ * Convert the class name to IDL or RMI name (repository id). If the class
+ * inherits from IDLEntity, ValueBase or SystemException, returns repository
+ * Id in the IDL:(..) form. If it does not, returns repository Id in the
+ * RMI:(..) form.
+ *
+ * @param cx the class for that the name must be computed.
+ *
+ * @return the idl or rmi name.
*/
- public static String toIDL(String cn)
+ public static synchronized String getRepositoryId(Class cx)
{
- if (cn.startsWith(JAVA_PREFIX))
- cn = OMG_PREFIX + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
- else if (cn.startsWith(CLASSPATH_PREFIX))
- cn =
- OMG_PREFIX +
- cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
-
- return "IDL:" + cn + ":1.0";
+ String name = (String) m_names.get(cx);
+ if (name != null)
+ return name;
+
+ String cn = cx.getName();
+ if (!(IDLEntity.class.isAssignableFrom(cx)
+ || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
+ {
+ // Not an IDL entity.
+ name = Util.createValueHandler().getRMIRepositoryID(cx);
+ }
+ else
+ {
+ if (cn.startsWith(JAVA_PREFIX))
+ cn = OMG_PREFIX
+ + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
+ else if (cn.startsWith(CLASSPATH_PREFIX))
+ cn = OMG_PREFIX
+ + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
+
+ name = "IDL:" + cn + ":1.0";
+ }
+ m_names.put(cx, name);
+ return name;
}
/**
* Insert the passed parameter into the given Any, assuming that the helper
* class is available. The helper class must have the "Helper" suffix and be
* in the same package as the class of the object being inserted.
- *
+ *
* @param into the target to insert.
- *
+ *
* @param object the object to insert. It can be any object as far as the
* corresponding helper is provided.
- *
+ *
* @return true on success, false otherwise.
*/
public static boolean insertWithHelper(Any into, Object object)
@@ -360,12 +440,10 @@ public class ObjectCreator
try
{
String helperClassName = object.getClass().getName() + "Helper";
- Class helperClass = Class.forName(helperClassName);
+ Class helperClass = forName(helperClassName);
- Method insert =
- helperClass.getMethod("insert",
- new Class[] { Any.class, object.getClass() }
- );
+ Method insert = helperClass.getMethod("insert", new Class[] {
+ Any.class, object.getClass() });
insert.invoke(null, new Object[] { into, object });
@@ -385,20 +463,20 @@ public class ObjectCreator
{
try
{
- cdrBufOutput output = new cdrBufOutput();
+ BufferedCdrOutput output = new BufferedCdrOutput();
- String m_exception_id = toIDL(exception.getClass().getName());
+ String m_exception_id = getRepositoryId(exception.getClass());
output.write_string(m_exception_id);
output.write_ulong(exception.minor);
CompletionStatusHelper.write(output, exception.completed);
String name = getDefaultName(m_exception_id);
- universalHolder h = new universalHolder(output);
+ GeneralHolder h = new GeneralHolder(output);
into.insert_Streamable(h);
- recordTypeCode r = new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
r.setId(m_exception_id);
r.setName(name);
into.type(r);
@@ -444,4 +522,69 @@ public class ObjectCreator
if (!ok)
throw new InternalError("Exception wrapping broken");
}
+
+ /**
+ * Find helper for the class with the given name.
+ */
+ public static Class findHelper(String idl)
+ {
+ synchronized (m_helpers)
+ {
+ Class c = (Class) m_helpers.get(idl);
+ if (c != null)
+ return c;
+ try
+ {
+ String helper = toHelperName(idl);
+ c = forName(helper);
+
+ m_helpers.put(idl, c);
+ return c;
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Load the class with the given name. This method tries to use the context
+ * class loader first. If this fails, it searches for the suitable class
+ * loader in the caller stack trace. This method is a central point where all
+ * requests to find a class by name are delegated.
+ */
+ public static Class forName(String className) throws ClassNotFoundException
+ {
+ try
+ {
+ return Class.forName(className, true,
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException nex)
+ {
+ /**
+ * Returns the first user defined class loader on the call stack, or
+ * null when no non-null class loader was found.
+ */
+ Class[] ctx = VMStackWalker.getClassContext();
+ for (int i = 0; i < ctx.length; i++)
+ {
+ // Since we live in a class loaded by the bootstrap
+ // class loader, getClassLoader is safe to call without
+ // needing to be wrapped in a privileged action.
+ ClassLoader cl = ctx[i].getClassLoader();
+ try
+ {
+ if (cl != null)
+ return Class.forName(className, true, cl);
+ }
+ catch (ClassNotFoundException nex2)
+ {
+ // Try next.
+ }
+ }
+ }
+ throw new ClassNotFoundException(className);
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/OctetHolder.java b/libjava/classpath/gnu/CORBA/OctetHolder.java
index 02fd9a432ec..06d7538d70f 100644
--- a/libjava/classpath/gnu/CORBA/OctetHolder.java
+++ b/libjava/classpath/gnu/CORBA/OctetHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -64,7 +64,7 @@ public final class OctetHolder
* The default type code for this holder.
*/
private static final TypeCode t_octet =
- new primitiveTypeCode(TCKind.tk_octet);
+ new PrimitiveTypeCode(TCKind.tk_octet);
/**
* The <code>long</code> (CORBA <code>octet</code>) value,
diff --git a/libjava/classpath/gnu/CORBA/OrbFocused.java b/libjava/classpath/gnu/CORBA/OrbFocused.java
new file mode 100644
index 00000000000..a0f9993c1a0
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/OrbFocused.java
@@ -0,0 +1,375 @@
+/* OrbFocused.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA;
+
+import gnu.CORBA.Poa.ORB_1_4;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.portable.InvokeHandler;
+
+import java.applet.Applet;
+import java.net.ServerSocket;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Random;
+import java.util.StringTokenizer;
+
+/**
+ * This class implements the ORB that uses a single port or the restricted port
+ * range for all its objects. It is required to for use together with various
+ * firewalls that does not allow opening multiple randomly selected ports, as
+ * the defauld CORBA implementation used to do. The firewal must be configured
+ * to allow CORBA to work on one fixed port or (for better performance) on a
+ * small fixed range of ports. This does not restrict the maximal number of the
+ * connected objects as the objects can share the same port.
+ *
+ * The used port or the used port range can be specified via property
+ * gnu.CORBA.ListenerPort. The value of this property is a single port or range
+ * of ports, boundary values (inclusive) being separeted by dash (for instance,
+ * "1245-1250").
+ *
+ * It is possible to instantiate multiple instances of the focused ORBs and
+ * combine them with the ordinary ORBs. If you instantiate several instances of
+ * the focused ORBs on the same host, they used port sets should not overlap.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class OrbFocused
+ extends ORB_1_4
+{
+ /**
+ * The name of the fixed port range property. The presence of this property
+ * indicates that the default focused ORB must be used.
+ */
+ public static final String LISTENER_PORT = "gnu.CORBA.ListenerPort";
+
+ /**
+ * The start of the range of the available ports, inclusive.
+ */
+ int m_ports_from = -1;
+
+ /**
+ * The end of the range of the available ports, inclusive.
+ */
+ int m_ports_to = -1;
+
+ /**
+ * The requests to port are served in parallel threads.
+ */
+ static final int PARALLEL = 0;
+
+ /**
+ * The requests to port are served in the same thread.
+ */
+ static final int SEQUENTIAL = 1;
+
+ /**
+ * The random number generator to get a random port in the valid range.
+ */
+ Random m_random = new Random();
+
+ /**
+ * Parse the "gnu.CORBA.ListenerPort" property and initialize the valid port
+ * set range.
+ */
+ public void setPortRange(String property)
+ {
+ int from, to;
+ try
+ {
+ StringTokenizer st = new StringTokenizer(property, " -");
+ if (st.countTokens() == 1)
+ from = to = Integer.parseInt(st.nextToken());
+ else
+ {
+ from = Integer.parseInt(st.nextToken());
+ to = Integer.parseInt(st.nextToken());
+ m_random = new Random();
+ }
+ setPortRange(from, to);
+ }
+ catch (Exception ex)
+ {
+ throw new BAD_PARAM("Unable to parse port range '" + property + "'");
+ }
+ }
+
+ /**
+ * Set the port range.
+ *
+ * @param from - start of the port range, inclusive.
+ * @param to - end of the port range, inclusive.
+ */
+ public void setPortRange(int from, int to)
+ {
+ if (from < 0 || to < 0 || to < from)
+ throw new BAD_PARAM("Invalid range");
+ m_ports_from = from;
+ m_ports_to = to;
+ }
+
+ /**
+ * Get the port from the previously specified usage range.
+ */
+ int getPortFromRange(int attempt)
+ {
+ if (m_ports_from == m_ports_to)
+ return m_ports_from;
+ else if (m_ports_to - m_ports_from < RANDOM_PORT_ATTEMPTS)
+ return m_ports_from + (attempt % (m_ports_to - m_ports_from + 1));
+ else
+ return m_random.nextInt(m_ports_to - m_ports_from + 1) + m_ports_from;
+ }
+
+ /**
+ * Get the shared port server where the new object can be added. This may
+ * result reusing the existing server or instantiating a new server. If the
+ * new server is instantiated and the ORB is already running, the server is
+ * started.
+ */
+ protected portServer getPortServer(int type)
+ {
+ portServer p;
+
+ int n;
+ if (m_ports_from < m_ports_to)
+ n = RANDOM_PORT_ATTEMPTS;
+ else
+ n = 1;
+
+ Ports: for (int a = 0; a < n; a++)
+ {
+ int port = getPortFromRange(a);
+ for (int i = 0; i < portServers.size(); i++)
+ {
+ p = (portServer) portServers.get(i);
+ if (p.s_port == port)
+ {
+ return (portServer) p;
+ }
+ }
+ // The server is not yet instantiated. Instantiate.
+ try
+ {
+ // Check if the port is ok:
+ ServerSocket s = socketFactory.createServerSocket(port);
+ s.close();
+
+ portServer shared;
+
+ switch (type)
+ {
+ case PARALLEL:
+ shared = new portServer(port);
+ break;
+
+ case SEQUENTIAL:
+ shared = new sharedPortServer(port);
+ break;
+
+ default:
+ throw new InternalError("Invalid server type " + type);
+ }
+
+ portServers.add(shared);
+
+ if (running)
+ shared.start();
+
+ return shared;
+ }
+ catch (Exception ex)
+ {
+ // Port is taken or probably other problems.
+ continue Ports;
+ }
+ }
+ throw new NO_RESOURCES("No free port available at " + m_ports_from + "-"
+ + m_ports_to, Minor.Ports, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Start the ORBs main working cycle (receive invocation - invoke on the local
+ * object - send response - wait for another invocation).
+ *
+ * The method only returns after calling {@link #shutdown(boolean)}.
+ */
+ public void run()
+ {
+ if (m_ports_from < 0 || m_ports_to < 0)
+ throw new BAD_INV_ORDER("For " + getClass().getName() + " "
+ + LISTENER_PORT + " property must be set");
+
+ running = true;
+
+ // Start all port servers. In the current subclass, the portServers
+ // collection must be already filled in.
+ Iterator iter = portServers.iterator();
+
+ while (iter.hasNext())
+ {
+ portServer subserver = (portServer) iter.next();
+
+ if (!subserver.isAlive())
+ {
+ // Reuse the current thread for the last portServer.
+ if (!iter.hasNext())
+ {
+ // Discard the iterator.
+ iter = null;
+ subserver.run();
+ return;
+ }
+ else
+ subserver.start();
+ }
+ }
+ }
+
+ /**
+ * Get free port from the allowed range. This method instantiates the port
+ * server for the returned port.
+ */
+ public int getFreePort()
+ throws BAD_OPERATION
+ {
+ portServer s = getPortServer(PARALLEL);
+ return s.s_port;
+ }
+
+ /**
+ * Connect the given CORBA object to this ORB, explicitly specifying the
+ * object key and the identity of the thread (and port), where the object must
+ * be served. The identity is normally the POA.
+ *
+ * The new port server will be started only if there is no one already running
+ * for the same identity. Otherwise, the task of the existing port server will
+ * be widened, including duty to serve the given object. All objects,
+ * connected to a single identity by this method, will process they requests
+ * subsequently in the same thread. The method is used when the expected
+ * number of the objects is too large to have a single port and thread per
+ * object. This method is used by POAs, having a single thread policy.
+ *
+ * @param object the object, must implement the {@link InvokeHandler})
+ * interface.
+ * @param key the object key, usually used to identify the object from remote
+ * side.
+ * @param port the port, where the object must be connected.
+ *
+ * @throws BAD_PARAM if the object does not implement the
+ * {@link InvokeHandler}).
+ */
+ public void connect_1_thread(org.omg.CORBA.Object object, byte[] key,
+ java.lang.Object identity)
+ {
+ sharedPortServer shared = (sharedPortServer) identities.get(identity);
+ if (shared == null)
+ {
+ shared = (sharedPortServer) getPortServer(SEQUENTIAL);
+ identities.put(identity, shared);
+ if (running)
+ {
+ shared.start();
+ }
+ }
+
+ Connected_objects.cObject ref = connected_objects.add(key, object,
+ shared.s_port, identity);
+ IOR ior = createIOR(ref);
+ prepareObject(object, ior);
+ }
+
+ /**
+ * In this type of ORB, the service is started by {@link #getPortServer}. The
+ * method below is not in use and should return without action.
+ */
+ public void startService(IOR ior)
+ {
+ }
+
+ /**
+ * Set parameters (additionally search for the port range property).
+ */
+ protected void set_parameters(Applet applet, Properties props)
+ {
+ super.set_parameters(applet, props);
+ String lp = applet.getParameter(LISTENER_PORT);
+ if (lp != null)
+ setPortRange(lp);
+ }
+
+ /**
+ * Set parameters (additionally search for the port range property).
+ */
+ protected void set_parameters(String[] args, Properties props)
+ {
+ super.set_parameters(args, props);
+ String lp = null;
+
+ String lpKey = "-" + LISTENER_PORT;
+
+ if (args != null)
+ if (args.length >= 2)
+ {
+ for (int i = 0; i < args.length - 1; i++)
+ if (args[i].equals(lpKey))
+ lp = args[i + 1];
+ }
+
+ if (lp != null)
+ setPortRange(lp);
+
+ }
+
+ /**
+ * Additionally set the port range property, when applicable.
+ */
+ protected void useProperties(Properties props)
+ {
+ super.useProperties(props);
+ String lp = props.getProperty(LISTENER_PORT);
+ if (lp != null)
+ setPortRange(lp);
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/Functional_ORB.java b/libjava/classpath/gnu/CORBA/OrbFunctional.java
index 1565b2cf14a..f147e817a0f 100644
--- a/libjava/classpath/gnu/CORBA/Functional_ORB.java
+++ b/libjava/classpath/gnu/CORBA/OrbFunctional.java
@@ -1,4 +1,4 @@
-/* Functional_ORB.java --
+/* OrbFunctional.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,9 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.UnknownExceptionCtxHandler;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.CloseMessage;
import gnu.CORBA.GIOP.ErrorMessage;
import gnu.CORBA.GIOP.MessageHeader;
@@ -48,38 +49,35 @@ import gnu.CORBA.GIOP.RequestHeader;
import gnu.CORBA.NamingService.NameParser;
import gnu.CORBA.NamingService.NamingServiceTransient;
import gnu.CORBA.Poa.gnuForwardRequest;
+import gnu.CORBA.interfaces.SocketFactory;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.DATA_CONVERSION;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_RESOURCES;
import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.Request;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.WrongTransaction;
+import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.InvokeHandler;
import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.UnknownException;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import java.applet.Applet;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
-
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -87,6 +85,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
+import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
@@ -98,14 +97,15 @@ import java.util.TreeMap;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Functional_ORB extends Restricted_ORB
+public class OrbFunctional extends OrbRestricted
{
/**
* A server, responsible for listening on requests on some local port. The ORB
* may listen on multiple ports and process the requests in separate threads.
* Normally the server takes one port per object being served.
*/
- class portServer extends Thread
+ protected class portServer
+ extends Thread
{
/**
* The number of the currently running parallel threads.
@@ -133,26 +133,27 @@ public class Functional_ORB extends Restricted_ORB
portServer(int _port)
{
s_port = _port;
- }
-
- /**
- * Enter the serving loop (get request/process it). All portServer normally
- * terminate thy threads when the Functional_ORB.running is set to false.
- */
- public void run()
- {
+ setDaemon(true);
try
{
- service = new ServerSocket(s_port);
+ service = socketFactory.createServerSocket(s_port);
}
catch (IOException ex)
{
- BAD_OPERATION bad =
- new BAD_OPERATION("Unable to open the server socket.");
+ BAD_OPERATION bad = new BAD_OPERATION(
+ "Unable to open the server socket at " + s_port);
+ bad.minor = Minor.Socket;
bad.initCause(ex);
throw bad;
}
+ }
+ /**
+ * Enter the serving loop (get request/process it). All portServer normally
+ * terminate thy threads when the OrbFunctional.running is set to false.
+ */
+ public void run()
+ {
while (running)
{
try
@@ -168,11 +169,11 @@ public class Functional_ORB extends Restricted_ORB
}
catch (Exception iex)
{
- // Wait 5 seconds. Do not terminate the
+ // Wait. Do not terminate the
// service due potentially transient error.
try
{
- Thread.sleep(5000);
+ Thread.sleep(TWAIT_SERVER_ERROR_PAUSE);
}
catch (InterruptedException ex)
{
@@ -183,10 +184,11 @@ public class Functional_ORB extends Restricted_ORB
/**
* Perform a single serving step.
- *
+ *
* @throws java.lang.Exception
*/
- void tick() throws Exception
+ void tick()
+ throws Exception
{
serve(this, service);
}
@@ -222,7 +224,7 @@ public class Functional_ORB extends Restricted_ORB
* serving multiple requests (probably to the different objects) on the same
* thread.
*/
- class sharedPortServer extends portServer
+ protected class sharedPortServer extends portServer
{
/**
* Create a new portServer, serving on specific port.
@@ -249,6 +251,23 @@ public class Functional_ORB extends Restricted_ORB
* for a free port.
*/
public static int DEFAULT_INITIAL_PORT = 1126;
+
+ /**
+ * When trying to open the socket on a random port, start of the interval to
+ * try.
+ */
+ public static int RANDOM_PORT_FROM = 1024;
+
+ /**
+ * When trying to open the socket on a random port, end of the interval to
+ * try.
+ */
+ public static int RANDOM_PORT_TO = 4024;
+
+ /**
+ * The number of attempts to try when opening random port.
+ */
+ public static int RANDOM_PORT_ATTEMPTS = 64;
/**
* The property of port, on that this ORB is listening for requests from
@@ -277,7 +296,18 @@ public class Functional_ORB extends Restricted_ORB
* The string, defining the naming service initial reference.
*/
public static final String NAME_SERVICE = "NameService";
-
+
+ /**
+ * Defines the ORB ID that is accessible by IOR interceptors.
+ */
+ public static final String ORB_ID = "org.omg.CORBA.ORBid";
+
+
+ /**
+ * Defines the SERVER ID that is accessible by IOR interceptors.
+ */
+ public static final String SERVER_ID = "org.omg.CORBA.ServerId";
+
/**
* The if the client has once opened a socket, it should start sending the
* message header in a given time. Otherwise the server will close the socket.
@@ -301,6 +331,13 @@ public class Functional_ORB extends Restricted_ORB
*/
public static String AFTER_RECEIVING =
"gnu.classpath.CORBA.TOUT_AFTER_RECEIVING";
+
+ /**
+ * The server waits for this duration after the potentially transient error
+ * during its servicing cycle.
+ */
+ public static String SERVER_ERROR_PAUSE =
+ "gnu.classpath.CORBA.SERVER_ERROR_PAUSE";
/**
* The address of the local host.
@@ -313,7 +350,7 @@ public class Functional_ORB extends Restricted_ORB
* This prevents server hang when the client opens the socket, but does not
* send any message, usually due crash on the client side.
*/
- private int TOUT_START_READING_MESSAGE = 20 * 1000;
+ public int TOUT_START_READING_MESSAGE = 20 * 1000;
// (Here and below, we use * to make the meaning of the constant clearler).
@@ -321,14 +358,20 @@ public class Functional_ORB extends Restricted_ORB
* If the client has started to send the request message, the socket time out
* changes to the specified value.
*/
- private int TOUT_WHILE_READING = 2 * 60 * 1000;
+ public int TOUT_WHILE_READING = 2 * 60 * 1000;
/**
* If the message body is received, the time out changes to the specifice
* value. This must be longer, as includes time, required to process the
* received task. We make it 40 minutes.
*/
- private int TOUT_AFTER_RECEIVING = 40 * 60 * 1000;
+ public int TOUT_AFTER_RECEIVING = 40 * 60 * 1000;
+
+ /**
+ * The server waits for this duration after the potentially transient error
+ * during its servicing cycle.
+ */
+ public int TWAIT_SERVER_ERROR_PAUSE = 5000;
/**
* Some clients tend to submit multiple requests over the same socket. The
@@ -338,6 +381,17 @@ public class Functional_ORB extends Restricted_ORB
* seven seconds.
*/
public static int TANDEM_REQUESTS = 7000;
+
+ /**
+ * The Id of this ORB.
+ */
+ public String orb_id = "orb_"+hashCode();
+
+ /**
+ * The Id of this Server. This field is defined static to ensure it has
+ * the same value over all ORB's in this machine.
+ */
+ public static String server_id = "server_"+OrbFunctional.class.hashCode();
/**
* The map of the already conncted objects.
@@ -365,7 +419,7 @@ public class Functional_ORB extends Restricted_ORB
/**
* The currently active portServers.
*/
- private ArrayList portServers = new ArrayList();
+ protected ArrayList portServers = new ArrayList();
/**
* The host, on that the name service is expected to be running.
@@ -414,11 +468,16 @@ public class Functional_ORB extends Restricted_ORB
* exceeding this limit, the NO_RESOURCES is thrown back to the client.
*/
private int MAX_RUNNING_THREADS = 256;
+
+ /**
+ * The producer of the client and server sockets for this ORB.
+ */
+ public SocketFactory socketFactory = DefaultSocketFactory.Singleton;
/**
* Create the instance of the Functional ORB.
*/
- public Functional_ORB()
+ public OrbFunctional()
{
try
{
@@ -457,13 +516,14 @@ public class Functional_ORB extends Restricted_ORB
/**
* Get the currently free port, starting from the initially set port and going
* up max 20 steps, then trying to bind into any free address.
- *
+ *
* @return the currently available free port.
- *
+ *
* @throws NO_RESOURCES if the server socked cannot be opened on the local
* host.
*/
- public int getFreePort() throws BAD_OPERATION
+ public int getFreePort()
+ throws BAD_OPERATION
{
ServerSocket s;
int a_port;
@@ -475,7 +535,7 @@ public class Functional_ORB extends Restricted_ORB
{
Integer free = (Integer) freed_ports.getLast();
freed_ports.removeLast();
- s = new ServerSocket(free.intValue());
+ s = socketFactory.createServerSocket(free.intValue());
s.close();
return free.intValue();
}
@@ -491,7 +551,7 @@ public class Functional_ORB extends Restricted_ORB
{
try
{
- s = new ServerSocket(a_port);
+ s = socketFactory.createServerSocket(a_port);
s.close();
Port = a_port + 1;
return a_port;
@@ -502,21 +562,31 @@ public class Functional_ORB extends Restricted_ORB
}
}
- try
- {
- // Try any port.
- s = new ServerSocket();
- a_port = s.getLocalPort();
- s.close();
- return a_port;
- }
- catch (IOException ex)
+ Random rand = new Random();
+ // Try any random port in the interval RANDOM_PORT_FROM.RANDOM_PORT_TO.
+ int range = RANDOM_PORT_TO - RANDOM_PORT_FROM;
+ IOException ioex = null;
+ for (int i = 0; i < RANDOM_PORT_ATTEMPTS; i++)
{
- NO_RESOURCES bad =
- new NO_RESOURCES("Unable to open the server socket.");
- bad.initCause(ex);
- throw bad;
+ try
+ {
+ a_port = RANDOM_PORT_FROM + rand.nextInt(range);
+ s = socketFactory.createServerSocket(a_port);
+ s.close();
+ return a_port;
+ }
+ catch (IOException ex)
+ {
+ // Repeat the loop if this exception has been thrown.
+ ioex = ex;
+ }
}
+
+ NO_RESOURCES bad = new NO_RESOURCES("Unable to open the server socket.");
+ bad.minor = Minor.Ports;
+ if (ioex != null)
+ bad.initCause(ioex);
+ throw bad;
}
/**
@@ -525,7 +595,7 @@ public class Functional_ORB extends Restricted_ORB
* on this port first. It the port is busy, or if more objects are connected,
* the subsequent object will receive a larger port values, skipping
* unavailable ports, if required. The change applies globally.
- *
+ *
* @param a_Port a port, on that the server is listening for requests.
*/
public static void setPort(int a_Port)
@@ -677,9 +747,9 @@ public class Functional_ORB extends Restricted_ORB
if (object instanceof ObjectImpl)
{
Delegate delegate = ((ObjectImpl) object)._get_delegate();
- if (delegate instanceof Simple_delegate)
+ if (delegate instanceof SimpleDelegate)
{
- byte[] key = ((Simple_delegate) delegate).getIor().key;
+ byte[] key = ((SimpleDelegate) delegate).getIor().key;
rmKey = connected_objects.get(key);
}
}
@@ -756,11 +826,7 @@ public class Functional_ORB extends Restricted_ORB
if (!ior.Internet.host.equals(LOCAL_HOST))
return null;
- // Must be the same port.
- if (ior.Internet.port != Port)
- return null;
-
- return find_connected_object(ior.key);
+ return find_connected_object(ior.key, ior.Internet.port);
}
/**
@@ -806,8 +872,8 @@ public class Functional_ORB extends Restricted_ORB
if (forObject instanceof ObjectImpl)
{
Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
- if (delegate instanceof Simple_delegate)
- return ((Simple_delegate) delegate).getIor().toStringifiedReference();
+ if (delegate instanceof SimpleDelegate)
+ return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
}
// Handle the case when the object is local.
@@ -899,7 +965,7 @@ public class Functional_ORB extends Restricted_ORB
}
else
subserver = (portServer) identities.get(obj.identity);
-
+
if (!subserver.isAlive())
{
// Reuse the current thread for the last portServer.
@@ -915,6 +981,30 @@ public class Functional_ORB extends Restricted_ORB
}
}
}
+
+ /**
+ * Start the server in a new thread, if not already running. This method is
+ * used to ensure that the objects being transfered will be served from the
+ * remote side, if required. If the ORB is started using this method, it
+ * starts as a daemon thread.
+ */
+ public void ensureRunning()
+ {
+ final OrbFunctional THIS = this;
+
+ if (!running)
+ {
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ THIS.run();
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+ }
/**
* Shutdown the ORB server.
@@ -961,21 +1051,22 @@ public class Functional_ORB extends Restricted_ORB
org.omg.CORBA.Object object = find_local_object(ior);
if (object == null)
{
- ObjectImpl impl = stubFinder.search(this, ior);
+ ObjectImpl impl = StubLocator.search(this, ior);
try
{
if (impl._get_delegate() == null)
- impl._set_delegate(new IOR_Delegate(this, ior));
+ impl._set_delegate(new IorDelegate(this, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception
// in response to the attempt to get the unset delegate.
- impl._set_delegate(new IOR_Delegate(this, ior));
+ impl._set_delegate(new IorDelegate(this, ior));
}
object = impl;
- connected_objects.add(ior.key, impl, ior.Internet.port, null);
+ // TODO remove commented out code below.
+ // connected_objects.add(ior.key, impl, ior.Internet.port, null);
}
return object;
}
@@ -995,7 +1086,7 @@ public class Functional_ORB extends Restricted_ORB
ior.Internet.port = ns_port;
ior.key = NamingServiceTransient.getDefaultKey();
- IOR_contructed_object iorc = new IOR_contructed_object(this, ior);
+ IorObject iorc = new IorObject(this, ior);
NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
initial_references.put(NAME_SERVICE, namer);
return namer;
@@ -1004,23 +1095,29 @@ public class Functional_ORB extends Restricted_ORB
/**
* Find and return the object, that must be previously connected to this ORB.
* Return null if no such object is available.
- *
+ *
* @param key the object key.
- *
+ * @param port the port where the object is connected.
+ *
* @return the connected object, null if none.
*/
- protected org.omg.CORBA.Object find_connected_object(byte[] key)
+ protected org.omg.CORBA.Object find_connected_object(byte[] key, int port)
{
Connected_objects.cObject ref = connected_objects.get(key);
- return ref == null ? null : ref.object;
+ if (ref == null)
+ return null;
+ if (port >= 0 && ref.port != port)
+ return null;
+ else
+ return ref.object;
}
/**
* Set the ORB parameters. This method is normally called from
* {@link #init(Applet, Properties)}.
- *
+ *
* @param app the current applet.
- *
+ *
* @param props application specific properties, passed as the second
* parameter in {@link #init(Applet, Properties)}. Can be <code>null</code>.
*/
@@ -1033,37 +1130,39 @@ public class Functional_ORB extends Restricted_ORB
{
for (int i = 0; i < para.length; i++)
{
- if (para [ i ] [ 0 ].equals(LISTEN_ON))
- Port = Integer.parseInt(para [ i ] [ 1 ]);
- if (para [ i ] [ 0 ].equals(REFERENCE))
+ if (para[i][0].equals(LISTEN_ON))
+ Port = Integer.parseInt(para[i][1]);
+ if (para[i][0].equals(REFERENCE))
{
- StringTokenizer st =
- new StringTokenizer(para [ i ] [ 1 ], "=");
+ StringTokenizer st = new StringTokenizer(para[i][1], "=");
initial_references.put(st.nextToken(),
- string_to_object(st.nextToken())
- );
+ string_to_object(st.nextToken()));
}
- if (para [ i ] [ 0 ].equals(NS_HOST))
- ns_host = para [ i ] [ 1 ];
- if (para [ i ] [ 0 ].equals(START_READING_MESSAGE))
- TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]);
- if (para [ i ] [ 0 ].equals(WHILE_READING))
- TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]);
- if (para [ i ] [ 0 ].equals(AFTER_RECEIVING))
- TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]);
+ if (para[i][0].equals(ORB_ID))
+ orb_id = para[i][1];
+
+ if (para[i][0].equals(SERVER_ID))
+ server_id = para[i][1];
+
+ if (para[i][0].equals(NS_HOST))
+ ns_host = para[i][1];
+ if (para[i][0].equals(START_READING_MESSAGE))
+ TOUT_START_READING_MESSAGE = Integer.parseInt(para[i][1]);
+ if (para[i][0].equals(WHILE_READING))
+ TOUT_WHILE_READING = Integer.parseInt(para[i][1]);
+ if (para[i][0].equals(AFTER_RECEIVING))
+ TOUT_AFTER_RECEIVING = Integer.parseInt(para[i][1]);
try
{
- if (para [ i ] [ 0 ].equals(NS_PORT))
- ns_port = Integer.parseInt(para [ i ] [ 1 ]);
+ if (para[i][0].equals(NS_PORT))
+ ns_port = Integer.parseInt(para[i][1]);
}
catch (NumberFormatException ex)
{
- BAD_PARAM bad =
- new BAD_PARAM("Invalid " + NS_PORT +
- "property, unable to parse '" +
- props.getProperty(NS_PORT) + "'"
- );
+ BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT
+ + "property, unable to parse '" + props.getProperty(NS_PORT)
+ + "'");
bad.initCause(ex);
throw bad;
}
@@ -1074,11 +1173,11 @@ public class Functional_ORB extends Restricted_ORB
/**
* Set the ORB parameters. This method is normally called from
* {@link #init(String[], Properties)}.
- *
+ *
* @param para the parameters, that were passed as the parameters to the
* <code>main(String[] args)</code> method of the current standalone
* application.
- *
+ *
* @param props application specific properties that were passed as a second
* parameter in {@link init(String[], Properties)}). Can be <code>null</code>.
*/
@@ -1088,29 +1187,33 @@ public class Functional_ORB extends Restricted_ORB
{
for (int i = 0; i < para.length - 1; i++)
{
- if (para [ i ].endsWith("ListenOn"))
- Port = Integer.parseInt(para [ i + 1 ]);
- if (para [ i ].endsWith("ORBInitRef"))
+ if (para[i].endsWith("ListenOn"))
+ Port = Integer.parseInt(para[i + 1]);
+ if (para[i].endsWith("ORBInitRef"))
{
- StringTokenizer st = new StringTokenizer(para [ i + 1 ], "=");
+ StringTokenizer st = new StringTokenizer(para[i + 1], "=");
initial_references.put(st.nextToken(),
- string_to_object(st.nextToken())
- );
+ string_to_object(st.nextToken()));
}
- if (para [ i ].endsWith("ORBInitialHost"))
- ns_host = para [ i + 1 ];
+ if (para[i].endsWith("ORBInitialHost"))
+ ns_host = para[i + 1];
+
+ if (para[i].endsWith("ServerId"))
+ server_id = para[i++];
+ else if (para[i].endsWith("ORBid"))
+ orb_id = para[i++];
+
try
{
- if (para [ i ].endsWith("ORBInitialPort"))
- ns_port = Integer.parseInt(para [ i + 1 ]);
+ if (para[i].endsWith("ORBInitialPort"))
+ ns_port = Integer.parseInt(para[i + 1]);
}
catch (NumberFormatException ex)
{
- throw new BAD_PARAM("Invalid " + para [ i ] +
- "parameter, unable to parse '" +
- props.getProperty(para [ i + 1 ]) + "'"
- );
+ throw new BAD_PARAM("Invalid " + para[i]
+ + "parameter, unable to parse '"
+ + props.getProperty(para[i + 1]) + "'");
}
}
}
@@ -1156,7 +1259,7 @@ public class Functional_ORB extends Restricted_ORB
* @throws BAD_PARAM if the object does not implement the
* {@link InvokeHandler}).
*/
- private void prepareObject(org.omg.CORBA.Object object, IOR ior)
+ protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
throws BAD_PARAM
{
/*
@@ -1172,12 +1275,12 @@ public class Functional_ORB extends Restricted_ORB
try
{
if (impl._get_delegate() == null)
- impl._set_delegate(new Simple_delegate(this, ior));
+ impl._set_delegate(new SimpleDelegate(this, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception.
- impl._set_delegate(new Simple_delegate(this, ior));
+ impl._set_delegate(new SimpleDelegate(this, ior));
}
}
}
@@ -1197,7 +1300,7 @@ public class Functional_ORB extends Restricted_ORB
*/
private void respond_to_client(OutputStream net_out,
MessageHeader msh_request, RequestHeader rh_request,
- bufferedResponseHandler handler, SystemException sysEx
+ ResponseHandlerImpl handler, SystemException sysEx
) throws IOException
{
// Set the reply header properties.
@@ -1211,8 +1314,8 @@ public class Functional_ORB extends Restricted_ORB
reply.reply_status = ReplyHeader.NO_EXCEPTION;
reply.request_id = rh_request.request_id;
- cdrBufOutput out =
- new cdrBufOutput(50 + handler.getBuffer().buffer.size());
+ BufferedCdrOutput out =
+ new BufferedCdrOutput(50 + handler.getBuffer().buffer.size());
out.setOrb(this);
out.setOffset(msh_request.getHeaderSize());
@@ -1256,7 +1359,7 @@ public class Functional_ORB extends Restricted_ORB
rh_forward.request_id = rh_request.request_id;
// The forwarding code is either LOCATION_FORWARD or LOCATION_FORWARD_PERM.
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
out.setOrb(this);
out.setOffset(msh_forward.getHeaderSize());
@@ -1324,11 +1427,11 @@ public class Functional_ORB extends Restricted_ORB
/**
* A single servicing step, when the client socket is alrady open.
- *
+ *
* Normally, each task matches a single remote invocation. However under
* frequent tandem submissions the same task may span over several
* invocations.
- *
+ *
* @param service the opened client socket.
* @param no_resources if true, the "NO RESOURCES" exception is thrown to the
* client.
@@ -1337,8 +1440,7 @@ public class Functional_ORB extends Restricted_ORB
{
try
{
- Serving:
- while (true)
+ Serving: while (true)
{
InputStream in = service.getInputStream();
service.setSoTimeout(TOUT_START_READING_MESSAGE);
@@ -1358,9 +1460,7 @@ public class Functional_ORB extends Restricted_ORB
if (max_version != null)
{
if (!msh_request.version.until_inclusive(max_version.major,
- max_version.minor
- )
- )
+ max_version.minor))
{
OutputStream out = service.getOutputStream();
new ErrorMessage(max_version).write(out);
@@ -1368,25 +1468,14 @@ public class Functional_ORB extends Restricted_ORB
}
}
- byte[] r = new byte[ msh_request.message_size ];
-
- int n = 0;
-
- service.setSoTimeout(TOUT_WHILE_READING);
-
- reading:
- while (n < r.length)
- {
- n += in.read(r, n, r.length - n);
- }
-
- service.setSoTimeout(TOUT_AFTER_RECEIVING);
+ byte[] r = msh_request.readMessage(in, service, TOUT_WHILE_READING,
+ TOUT_AFTER_RECEIVING);
if (msh_request.message_type == MessageHeader.REQUEST)
{
RequestHeader rh_request;
- cdrBufInput cin = new cdrBufInput(r);
+ BufferredCdrInput cin = new BufferredCdrInput(r);
cin.setOrb(this);
cin.setVersion(msh_request.version);
cin.setOffset(msh_request.getHeaderSize());
@@ -1406,8 +1495,8 @@ public class Functional_ORB extends Restricted_ORB
// find the target object.
}
- InvokeHandler target =
- (InvokeHandler) find_connected_object(rh_request.object_key);
+ InvokeHandler target = (InvokeHandler) find_connected_object(
+ rh_request.object_key, -1);
// Prepare the reply header. This must be done in advance,
// as the size must be known for handler to set alignments
@@ -1415,17 +1504,19 @@ public class Functional_ORB extends Restricted_ORB
ReplyHeader rh_reply = msh_request.create_reply_header();
// TODO log errors about not existing objects and methods.
- bufferedResponseHandler handler =
- new bufferedResponseHandler(this, msh_request, rh_reply,
- rh_request
- );
+ ResponseHandlerImpl handler = new ResponseHandlerImpl(
+ this, msh_request, rh_reply, rh_request);
SystemException sysEx = null;
try
{
if (no_resources)
- throw new NO_RESOURCES();
+ {
+ NO_RESOURCES no = new NO_RESOURCES("Too many parallel calls");
+ no.minor = Minor.Threads;
+ throw no;
+ }
if (target == null)
throw new OBJECT_NOT_EXIST();
target._invoke(rh_request.operation, cin, handler);
@@ -1442,24 +1533,45 @@ public class Functional_ORB extends Restricted_ORB
continue Serving;
}
}
+ catch (UnknownException uex)
+ {
+ sysEx = new UNKNOWN("Unknown", 2,
+ CompletionStatus.COMPLETED_MAYBE);
+ sysEx.initCause(uex.originalEx);
+
+ org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+ rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+ rh_reply.service_context, uex.originalEx, ech);
+
+ ObjectCreator.writeSystemException(ech, sysEx);
+ }
catch (SystemException ex)
{
sysEx = ex;
-
- org.omg.CORBA.portable.OutputStream ech =
- handler.createExceptionReply();
+
+ org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+ rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+ rh_reply.service_context, ex, ech);
+
ObjectCreator.writeSystemException(ech, ex);
}
catch (Exception except)
{
+ // This should never happen under normal operation and
+ // can only indicate errors in user object implementation.
+ // We inform the user.
except.printStackTrace();
- sysEx =
- new UNKNOWN("Unknown", 2,
- CompletionStatus.COMPLETED_MAYBE
- );
- org.omg.CORBA.portable.OutputStream ech =
- handler.createExceptionReply();
+ sysEx = new UNKNOWN("Unknown", 2,
+ CompletionStatus.COMPLETED_MAYBE);
+ sysEx.initCause(except);
+
+ org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+ rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+ rh_reply.service_context, except, ech);
ObjectCreator.writeSystemException(ech, sysEx);
}
@@ -1469,21 +1581,17 @@ public class Functional_ORB extends Restricted_ORB
{
OutputStream sou = service.getOutputStream();
respond_to_client(sou, msh_request, rh_request, handler,
- sysEx
- );
+ sysEx);
}
}
- else if (msh_request.message_type == MessageHeader.CLOSE_CONNECTION ||
- msh_request.message_type == MessageHeader.MESSAGE_ERROR
- )
+ else if (msh_request.message_type == MessageHeader.CLOSE_CONNECTION
+ || msh_request.message_type == MessageHeader.MESSAGE_ERROR)
{
CloseMessage.close(service.getOutputStream());
service.close();
return;
}
- ;
- // TODO log error: "Not a request message."
if (service != null && !service.isClosed())
// Wait for the subsequent invocations on the
@@ -1505,8 +1613,12 @@ public class Functional_ORB extends Restricted_ORB
return;
}
}
-
- private void useProperties(Properties props)
+
+ /**
+ * Set the ORB parameters from the properties that were accumulated
+ * from several locations.
+ */
+ protected void useProperties(Properties props)
{
if (props != null)
{
@@ -1527,6 +1639,9 @@ public class Functional_ORB extends Restricted_ORB
if (props.containsKey(AFTER_RECEIVING))
TOUT_AFTER_RECEIVING =
Integer.parseInt(props.getProperty(AFTER_RECEIVING));
+ if (props.containsKey(SERVER_ERROR_PAUSE))
+ TWAIT_SERVER_ERROR_PAUSE =
+ Integer.parseInt(props.getProperty(SERVER_ERROR_PAUSE));
}
catch (NumberFormatException ex)
{
@@ -1535,7 +1650,31 @@ public class Functional_ORB extends Restricted_ORB
"'"
);
}
-
+
+ if (props.containsKey(SocketFactory.PROPERTY))
+ {
+ String factory = null;
+ try
+ {
+ factory = props.getProperty(SocketFactory.PROPERTY);
+ if (factory!=null)
+ socketFactory = (SocketFactory)
+ ObjectCreator.forName(factory).newInstance();
+ }
+ catch (Exception ex)
+ {
+ BAD_PARAM p = new BAD_PARAM("Bad socket factory "+factory);
+ p.initCause(ex);
+ throw p;
+ }
+ }
+
+ if (props.containsKey(ORB_ID))
+ orb_id = props.getProperty(ORB_ID);
+
+ if (props.containsKey(SERVER_ID))
+ server_id = props.getProperty(SERVER_ID);
+
Enumeration en = props.elements();
while (en.hasMoreElements())
{
diff --git a/libjava/classpath/gnu/CORBA/Restricted_ORB.java b/libjava/classpath/gnu/CORBA/OrbRestricted.java
index 247cd205ccb..c0401800a89 100644
--- a/libjava/classpath/gnu/CORBA/Restricted_ORB.java
+++ b/libjava/classpath/gnu/CORBA/OrbRestricted.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.typecodes.AliasTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
@@ -60,6 +64,7 @@ import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ValueFactory;
import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
import java.applet.Applet;
@@ -82,18 +87,18 @@ import java.util.Properties;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
+public class OrbRestricted extends org.omg.CORBA_2_3.ORB
{
/**
* The singleton instance of this ORB.
*/
- public static final ORB Singleton = new Restricted_ORB();
+ public static final ORB Singleton = new OrbRestricted();
/**
* The cumulated listener for all IOR interceptors. Interceptors are used by
* {@link gnu.CORBA.Poa.ORB_1_4}.
*/
- public IORInterceptorOperations iIor;
+ public IORInterceptor_3_0Operations iIor;
/**
* The cumulated listener for all server request interceptors. Interceptors
@@ -126,14 +131,14 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
* Create a new instance of the RestrictedORB. This is used in derived classes
* only.
*/
- protected Restricted_ORB()
+ protected OrbRestricted()
{
}
/** {@inheritDoc} */
public TypeCode create_alias_tc(String id, String name, TypeCode typecode)
{
- return new aliasTypeCode(typecode, id, name);
+ return new AliasTypeCode(typecode, id, name);
}
/** {@inheritDoc} */
@@ -147,8 +152,8 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_array_tc(int length, TypeCode element_type)
{
- primitiveArrayTypeCode p =
- new primitiveArrayTypeCode(TCKind.tk_array, element_type);
+ ArrayTypeCode p =
+ new ArrayTypeCode(TCKind.tk_array, element_type);
p.setLength(length);
return p;
}
@@ -162,7 +167,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_enum_tc(String id, String name, String[] values)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_enum);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_enum);
for (int i = 0; i < values.length; i++)
{
r.field().name = values [ i ];
@@ -191,7 +196,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
StructMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
r.setId(id);
r.setName(name);
@@ -229,7 +234,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public OutputStream create_output_stream()
{
- cdrBufOutput stream = new cdrBufOutput();
+ BufferedCdrOutput stream = new BufferedCdrOutput();
stream.setOrb(this);
return stream;
}
@@ -237,8 +242,8 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_sequence_tc(int bound, TypeCode element_type)
{
- primitiveArrayTypeCode p =
- new primitiveArrayTypeCode(TCKind.tk_sequence, element_type);
+ ArrayTypeCode p =
+ new ArrayTypeCode(TCKind.tk_sequence, element_type);
p.setLength(bound);
return p;
}
@@ -246,7 +251,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_string_tc(int bound)
{
- stringTypeCode p = new stringTypeCode(TCKind.tk_string);
+ StringTypeCode p = new StringTypeCode(TCKind.tk_string);
p.setLength(bound);
return p;
}
@@ -256,7 +261,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
StructMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_struct);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
r.setId(id);
r.setName(name);
@@ -273,7 +278,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
TypeCode discriminator_type, UnionMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_union);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_union);
r.setId(id);
r.setName(name);
r.setDiscriminator_type(discriminator_type);
@@ -290,7 +295,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_wstring_tc(int bound)
{
- stringTypeCode p = new stringTypeCode(TCKind.tk_wstring);
+ StringTypeCode p = new StringTypeCode(TCKind.tk_wstring);
p.setLength(bound);
return p;
}
@@ -300,7 +305,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
{
try
{
- return typeNamer.getPrimitveTC(tcKind);
+ return TypeKindNamer.getPrimitveTC(tcKind);
}
catch (BadKind ex)
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/activeObjectMap.java b/libjava/classpath/gnu/CORBA/Poa/AOM.java
index 1354ba9c5e1..9faf0883ded 100644
--- a/libjava/classpath/gnu/CORBA/Poa/activeObjectMap.java
+++ b/libjava/classpath/gnu/CORBA/Poa/AOM.java
@@ -1,4 +1,4 @@
-/* activeObjectMap.java --
+/* AOM.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,6 @@ package gnu.CORBA.Poa;
import gnu.CORBA.ByteArrayComparator;
-import org.omg.PortableServer.POA;
import org.omg.PortableServer.Servant;
import java.util.Iterator;
@@ -57,7 +56,7 @@ import java.util.TreeMap;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class activeObjectMap
+public class AOM
{
/**
* The reference data about the object, placed on the AOM.
@@ -67,7 +66,7 @@ public class activeObjectMap
/**
* Create an initialised instance.
*/
- Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, POA _poa)
+ Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, gnuPOA _poa)
{
object = _object;
key = _key;
@@ -96,7 +95,7 @@ public class activeObjectMap
/**
* The POA, where the object is connected.
*/
- public final POA poa;
+ public final gnuPOA poa;
/**
* The object key.
@@ -142,17 +141,6 @@ public class activeObjectMap
{
deactivated = state;
}
-
- public boolean equals(java.lang.Object other)
- {
- if (other instanceof Obj)
- {
- Obj o = (Obj) other;
- return o.object.equals(object);
- }
- else
- return false;
- }
}
/**
@@ -269,7 +257,7 @@ public class activeObjectMap
*
* @return the newly created object record.
*/
- public Obj add(org.omg.CORBA.Object object, Servant servant, POA poa)
+ public Obj add(org.omg.CORBA.Object object, Servant servant, gnuPOA poa)
{
return add(generateObjectKey(object), object, servant, poa);
}
@@ -283,7 +271,7 @@ public class activeObjectMap
* @param poa the POA, where the object is connected.
*/
public Obj add(byte[] key, org.omg.CORBA.Object object, Servant servant,
- POA poa
+ gnuPOA poa
)
{
Obj rec = new Obj(object, key, servant, poa);
@@ -298,7 +286,7 @@ public class activeObjectMap
* and object.
* @param port the port that this object would take.
*/
- public Obj add(servantDelegate delegate)
+ public Obj add(ServantDelegateImpl delegate)
{
Obj rec =
new Obj(delegate.object, delegate.servant_id, delegate.servant,
diff --git a/libjava/classpath/gnu/CORBA/Poa/vPolicy.java b/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java
index 9e45b56d7ee..44ebaf45351 100644
--- a/libjava/classpath/gnu/CORBA/Poa/vPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java
@@ -1,4 +1,4 @@
-/* vPolicy.java --
+/* AccessiblePolicy.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.omg.CORBA.Policy;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface vPolicy
+public interface AccessiblePolicy
extends Policy
{
/**
diff --git a/libjava/classpath/gnu/CORBA/Poa/dynImpHandler.java b/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java
index 1cc3e131cd7..903f8bfbbe1 100644
--- a/libjava/classpath/gnu/CORBA/Poa/dynImpHandler.java
+++ b/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java
@@ -1,4 +1,4 @@
-/* dynImpHandler.java --
+/* DynamicImpHandler.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ import org.omg.PortableServer.DynamicImplementation;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class dynImpHandler
+public class DynamicImpHandler
implements InvokeHandler
{
/**
@@ -66,7 +66,7 @@ public class dynImpHandler
* Create a new instance, wrapping some dyn implementation.
* @param _servant
*/
- public dynImpHandler(DynamicImplementation _servant)
+ public DynamicImpHandler(DynamicImplementation _servant)
{
servant = _servant;
}
diff --git a/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java b/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
index 2df378df6a4..b1d5eaf8c03 100644
--- a/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
@@ -39,8 +39,9 @@ exception statement from your version. */
package gnu.CORBA.Poa;
import gnu.CORBA.IOR;
-import gnu.CORBA.IOR_Delegate;
-import gnu.CORBA.IOR_contructed_object;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.IorObject;
+import gnu.CORBA.Minor;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
@@ -101,9 +102,9 @@ public class ForwardedServant
ObjectImpl fto = (ObjectImpl) a_ref;
// Check maybe the remote side forwarded back to our local object.
- if (fto instanceof IOR_contructed_object)
+ if (fto instanceof IorObject)
{
- IOR_contructed_object iref = (IOR_contructed_object) fto;
+ IorObject iref = (IorObject) fto;
// Check maybe the IOR is local.
ORB t_orb = iref._orb();
@@ -111,13 +112,13 @@ public class ForwardedServant
{
ORB_1_4 orb = (ORB_1_4) t_orb;
Delegate d = iref._get_delegate();
- if (d instanceof IOR_Delegate)
+ if (d instanceof IorDelegate)
{
- IOR_Delegate ird = (IOR_Delegate) iref._get_delegate();
+ IorDelegate ird = (IorDelegate) iref._get_delegate();
IOR ior = ird.getIor();
if (orb.LOCAL_HOST.equalsIgnoreCase(ior.Internet.host))
{
- activeObjectMap.Obj rx = orb.rootPOA.findIorKey(ior.key);
+ AOM.Obj rx = orb.rootPOA.findIorKey(ior.key);
if (rx != null)
{
if (rx.object == fto ||
@@ -175,6 +176,7 @@ public class ForwardedServant
catch (IOException io_ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Forwarding;
m.initCause(io_ex);
throw m;
}
diff --git a/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java b/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
index 7af3369d2e8..72dd8f0cf50 100644
--- a/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
+++ b/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package gnu.CORBA.Poa;
-import gnu.CORBA.CDR.cdrOutput;
-import gnu.CORBA.streamRequest;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.StreamBasedRequest;
import org.omg.CORBA.ARG_INOUT;
import org.omg.CORBA.Bounds;
@@ -68,17 +70,22 @@ import java.util.Arrays;
* A local delegate, transferring all object requests to the locally available
* servant. This class is involved in handling the method invocations on the
* local object, obtained by POA.create_reference_with_id.
- *
+ *
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
+public class LocalDelegate
+ extends org.omg.CORBA_2_3.portable.Delegate
+ implements IorProvider
{
/**
* The same servant as an invocation handler.
*/
gnuServantObject object;
+
String operation;
- final gnuPOA poa;
+
+ public final gnuPOA poa;
+
final byte[] Id;
/**
@@ -91,6 +98,14 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
poa = a_poa;
Id = an_id;
}
+
+ /**
+ * Get the IOR of the connected object.
+ */
+ public IOR getIor()
+ {
+ return object.getIor();
+ }
public Request request(org.omg.CORBA.Object target, String method)
{
@@ -107,8 +122,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
}
public boolean is_equivalent(org.omg.CORBA.Object target,
- org.omg.CORBA.Object other
- )
+ org.omg.CORBA.Object other)
{
if (target == other)
return true;
@@ -157,9 +171,9 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
/**
* Check if this object could be named by the given repository id.
- *
+ *
* @param idl_id the repository id to check.
- *
+ *
* @return true if it is one of the possible repository ids of this object.
*/
public boolean is_a(org.omg.CORBA.Object a_servant, String idl_id)
@@ -167,7 +181,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
String[] maybe = object._ids();
for (int i = 0; i < maybe.length; i++)
{
- if (maybe [ i ].equals(idl_id))
+ if (maybe[i].equals(idl_id))
return true;
}
return false;
@@ -186,8 +200,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
String method, NVList parameters, NamedValue returns,
- ExceptionList exceptions, ContextList ctx_list
- )
+ ExceptionList exceptions, ContextList ctx_list)
{
operation = method;
@@ -204,8 +217,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
* Create request for using with DII.
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
- String method, NVList parameters, NamedValue returns
- )
+ String method, NVList parameters, NamedValue returns)
{
operation = method;
@@ -226,23 +238,20 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
/**
* Create a request to invoke the method of this CORBA object.
- *
+ *
* @param operation the name of the method to invoke.
* @param response_expected specifies if this is one way message or the
* response to the message is expected.
- *
+ *
* @return the stream where the method arguments should be written.
*/
public org.omg.CORBA.portable.OutputStream request(
- org.omg.CORBA.Object target,
- String method,
- boolean response_expected
- )
+ org.omg.CORBA.Object target, String method, boolean response_expected)
{
operation = method;
// Check if the object is not explicitly deactivated.
- activeObjectMap.Obj e = poa.aom.get(Id);
+ AOM.Obj e = poa.aom.get(Id);
if (e != null && e.isDeactiveted())
{
if (poa.servant_activator != null || poa.servant_locator != null)
@@ -280,7 +289,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
/**
* Make an invocation.
- *
+ *
* @param target not in use.
* @param output the stream request that should be returned by
* {@link #m_request} in this method.
@@ -292,31 +301,29 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
{
try
{
- streamRequest sr = (streamRequest) output;
+ StreamBasedRequest sr = (StreamBasedRequest) output;
LocalRequest lr = (LocalRequest) sr.request;
- InvokeHandler handler =
- lr.object.getHandler(lr.operation(), lr.cookie, false);
+ InvokeHandler handler = lr.object.getHandler(lr.operation(), lr.cookie,
+ false);
- if (handler instanceof dynImpHandler)
+ if (handler instanceof DynamicImpHandler)
{
// The local request known how to handle it, but the different
// method must be called.
lr.invoke();
// The encapsulation will inherit orb, endian, charsets, etc.
- cdrOutput buf = sr.createEncapsulation();
+ AbstractCdrOutput buf = sr.createEncapsulation();
// Write all request parameters to the buffer stream.
if (lr.env().exception() != null)
{
try
{
- UnknownUserException uex =
- (UnknownUserException) lr.env().exception();
+ UnknownUserException uex = (UnknownUserException) lr.env().exception();
throw new ApplicationException(uex.except.type().id(),
- uex.except.create_input_stream()
- );
+ uex.except.create_input_stream());
}
catch (BadKind ex)
{
@@ -334,9 +341,8 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
for (int i = 0; i < lr.arguments().count(); i++)
{
a = lr.arguments().item(i);
- if (a.flags() == ARG_INOUT.value ||
- a.flags() == ARG_INOUT.value
- )
+ if (a.flags() == ARG_INOUT.value
+ || a.flags() == ARG_INOUT.value)
{
a.value().write_value(buf);
}
@@ -362,10 +368,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
try
{
return ((ObjectImpl) f.forward_reference)._invoke(f.forward_reference._request(
- operation,
- true
- )
- );
+ operation, true));
}
catch (RemarshalException e)
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java b/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
index a727499fce5..a2c0bb106c3 100644
--- a/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
+++ b/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
@@ -38,19 +38,19 @@ exception statement from your version. */
package gnu.CORBA.Poa;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.v1_2.ReplyHeader;
import gnu.CORBA.GIOP.v1_2.RequestHeader;
import gnu.CORBA.Interceptor.gnuClientRequestInfo;
import gnu.CORBA.Interceptor.gnuServerRequestInfo;
+import gnu.CORBA.typecodes.RecordTypeCode;
import gnu.CORBA.ObjectCreator;
import gnu.CORBA.Unexpected;
import gnu.CORBA.gnuAny;
import gnu.CORBA.gnuRequest;
-import gnu.CORBA.recordTypeCode;
-import gnu.CORBA.streamReadyHolder;
-import gnu.CORBA.streamRequest;
+import gnu.CORBA.StreamHolder;
+import gnu.CORBA.StreamBasedRequest;
import org.omg.CORBA.ARG_OUT;
import org.omg.CORBA.Any;
@@ -115,7 +115,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
/**
* The buffer to write into.
*/
- cdrBufOutput buffer;
+ BufferedCdrOutput buffer;
/**
* The responsible POA.
@@ -252,7 +252,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
handler = object.getHandler(operation(), cookie, false);
}
- cdrBufOutput request_part = new cdrBufOutput();
+ BufferedCdrOutput request_part = new BufferedCdrOutput();
request_part.setOrb(orb());
@@ -288,7 +288,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
request_part.create_input_stream();
// Ensure the servant (handler) has a delegate set.
- servantDelegate sd = null;
+ ServantDelegateImpl sd = null;
Delegate d = null;
@@ -300,19 +300,19 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
{
// In some cases exception is thrown if the delegate is not set.
}
- if (d instanceof servantDelegate)
+ if (d instanceof ServantDelegateImpl)
{
// If the delegate is already set, try to reuse the existing
// instance.
- sd = (servantDelegate) d;
+ sd = (ServantDelegateImpl) d;
if (sd.object != object)
{
- sd = new servantDelegate(servant, poa, Id);
+ sd = new ServantDelegateImpl(servant, poa, Id);
}
}
else
{
- sd = new servantDelegate(servant, poa, Id);
+ sd = new ServantDelegateImpl(servant, poa, Id);
}
servant._set_delegate(sd);
@@ -368,13 +368,13 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
{
// Failed due any reason, insert without
// helper.
- a.insert_Streamable(new streamReadyHolder(
+ a.insert_Streamable(new StreamHolder(
buf.create_input_stream()
)
);
- recordTypeCode r =
- new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r =
+ new RecordTypeCode(TCKind.tk_except);
r.setId(uex_idl);
r.setName(ObjectCreator.getDefaultName(uex_idl));
}
@@ -531,9 +531,9 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
{
InvokeHandler handler = object.getHandler(operation(), cookie, false);
- if (handler instanceof dynImpHandler)
+ if (handler instanceof DynamicImpHandler)
{
- DynamicImplementation dyn = ((dynImpHandler) handler).servant;
+ DynamicImplementation dyn = ((DynamicImpHandler) handler).servant;
if (serverRequest == null)
{
serverRequest = new LocalServerRequest(this);
@@ -589,7 +589,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
// Prepare an Any that will hold the exception.
gnuAny exc = new gnuAny();
- exc.insert_Streamable(new streamReadyHolder(input));
+ exc.insert_Streamable(new StreamHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
@@ -637,7 +637,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
*
* @return the CDR output stream, containing the written output.
*/
- cdrBufOutput getBuffer()
+ BufferedCdrOutput getBuffer()
{
return buffer;
}
@@ -656,7 +656,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
*/
private void prepareStream()
{
- buffer = new cdrBufOutput();
+ buffer = new BufferedCdrOutput();
buffer.setOrb(orb());
}
@@ -664,9 +664,9 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
* Get the parameter stream, where the invocation arguments should be written
* if they are written into the stream directly.
*/
- public streamRequest getParameterStream()
+ public StreamBasedRequest getParameterStream()
{
- m_parameter_buffer = new streamRequest();
+ m_parameter_buffer = new StreamBasedRequest();
m_parameter_buffer.request = this;
m_parameter_buffer.setOrb(poa.orb());
return m_parameter_buffer;
diff --git a/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java b/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
index d95bf2be8f6..bb00aab70eb 100644
--- a/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.Poa;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import gnu.CORBA.Connected_objects.cObject;
import gnu.CORBA.DynAn.gnuDynAnyFactory;
@@ -53,11 +53,13 @@ import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORB;
import org.omg.CORBA.Policy;
import org.omg.CORBA.PolicyError;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
import org.omg.PortableServer.POAPackage.InvalidPolicy;
import java.applet.Applet;
@@ -69,7 +71,7 @@ import java.util.Properties;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class ORB_1_4
- extends Functional_ORB
+ extends OrbFunctional
{
/**
* The root POA.
@@ -100,7 +102,7 @@ public class ORB_1_4
super();
try
{
- rootPOA = new gnuPOA(null, "RootPOA", null, policySets.rootPoa(), this);
+ rootPOA = new gnuPOA(null, "RootPOA", null, StandardPolicies.rootPoa(), this);
}
catch (InvalidPolicy ex)
{
@@ -130,7 +132,7 @@ public class ORB_1_4
{
try
{
- activeObjectMap.Obj exists = rootPOA.findObject(forObject);
+ AOM.Obj exists = rootPOA.findObject(forObject);
if (exists == null)
throw new OBJECT_NOT_EXIST(forObject == null ? "null"
: forObject.toString());
@@ -201,9 +203,9 @@ public class ORB_1_4
IOR ior = super.createIOR(ref);
if (iIor != null)
{
- activeObjectMap.Obj obj = rootPOA.findIorKey(ior.key);
+ AOM.Obj obj = rootPOA.findIorKey(ior.key);
- POA poa;
+ gnuPOA poa;
// Null means that the object was connected to the ORB directly.
if (obj == null)
@@ -215,6 +217,7 @@ public class ORB_1_4
// This may modify the ior.
iIor.establish_components(info);
+ iIor.components_established(info);
}
return ior;
}
@@ -252,5 +255,39 @@ public class ORB_1_4
super.set_parameters(para, props);
registerInterceptors(props, para);
}
+
+ /**
+ * This method is called by RMI-IIOP {@link javax.rmi.Tie#orb(ORB)}, passing
+ * <code>this</code> as parameter. The ORB will try to connect that tie as
+ * one of its objects, if it is not already connected. If the wrapper is an
+ * instance of Servant this method also activates the root poa (if not already
+ * active).
+ */
+ public void set_delegate(java.lang.Object wrapper)
+ {
+ if (wrapper instanceof org.omg.CORBA.Object)
+ {
+ org.omg.CORBA.Object object = (org.omg.CORBA.Object) wrapper;
+ if (connected_objects.getKey(object) == null)
+ connect(object);
+ }
+ else if (wrapper instanceof Servant)
+ {
+ Servant s = (Servant) wrapper;
+ if (rootPOA.findServant(s) == null)
+ try
+ {
+ rootPOA.servant_to_reference(s);
+ if (rootPOA.the_POAManager().get_state().value() == State._HOLDING)
+ rootPOA.the_POAManager().activate();
+ }
+ catch (Exception e)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("Unable to connect "
+ + wrapper + " to " + this);
+ throw bad;
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/servantDelegate.java b/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java
index f59c01c6b3e..e65214d4a9a 100644
--- a/libjava/classpath/gnu/CORBA/Poa/servantDelegate.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java
@@ -1,4 +1,4 @@
-/* servantDelegate.java --
+/* ServantDelegateImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ import org.omg.PortableServer.portable.Delegate;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class servantDelegate
+public class ServantDelegateImpl
implements Delegate
{
/**
@@ -93,7 +93,7 @@ public class servantDelegate
* @param a_servant the servant.
* @param a_servant_id the servant id.
*/
- public servantDelegate(Servant a_servant, gnuPOA a_poa, byte[] a_servant_id)
+ public ServantDelegateImpl(Servant a_servant, gnuPOA a_poa, byte[] a_servant_id)
{
poa = a_poa;
servant = a_servant;
diff --git a/libjava/classpath/gnu/CORBA/Poa/policySets.java b/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java
index eb688467ae7..b2edc4056ab 100644
--- a/libjava/classpath/gnu/CORBA/Poa/policySets.java
+++ b/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java
@@ -1,4 +1,4 @@
-/* policySets.java --
+/* StandardPolicies.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,14 +56,14 @@ import java.util.ArrayList;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class policySets
+public class StandardPolicies
{
/**
* The default policy set, as defined in OMG specs. This is also
* the policy set for the root POA.
*/
- private static final vPolicy[] rootPOASet =
- new vPolicy[]
+ private static final AccessiblePolicy[] rootPOASet =
+ new AccessiblePolicy[]
{
new gnuThreadPolicy(ThreadPolicyValue.ORB_CTRL_MODEL),
new gnuLifespanPolicy(LifespanPolicyValue.TRANSIENT),
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java b/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
index 3019a2ae966..17d5a0f9e04 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
@@ -69,7 +69,7 @@ public class gnuAdapterActivator
{
try
{
- POA n = parent.create_POA(child_name, null, policySets.rootPoa());
+ POA n = parent.create_POA(child_name, null, StandardPolicies.rootPoa());
n.the_POAManager().activate();
}
catch (Exception ex)
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
index a404486ce70..91531909a6a 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.IdAssignmentPolicyValue;
*/
public class gnuIdAssignmentPolicy
extends _PolicyImplBase
- implements IdAssignmentPolicy, vPolicy
+ implements IdAssignmentPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
index 2abd1f4845f..0b5fa1420bd 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.IdUniquenessPolicyValue;
*/
public class gnuIdUniquenessPolicy
extends _PolicyImplBase
- implements IdUniquenessPolicy, vPolicy
+ implements IdUniquenessPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
index 1e539a2c4e0..f1721beef64 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.ImplicitActivationPolicyValue;
*/
public class gnuImplicitActivationPolicy
extends _PolicyImplBase
- implements ImplicitActivationPolicy, vPolicy
+ implements ImplicitActivationPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
index 97b3f2d7a9b..f26596cd951 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.LifespanPolicyValue;
*/
public class gnuLifespanPolicy
extends _PolicyImplBase
- implements LifespanPolicy, vPolicy
+ implements LifespanPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
index 1d9e838532a..6f2a019a3bb 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
@@ -49,10 +49,15 @@ import org.omg.CORBA.LocalObject;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.OBJ_ADAPTER;
import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
import org.omg.CORBA.Policy;
import org.omg.CORBA.SetOverrideType;
import org.omg.CORBA.TRANSIENT;
import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableInterceptor.NON_EXISTENT;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper;
import org.omg.PortableServer.AdapterActivator;
import org.omg.PortableServer.ForwardRequest;
import org.omg.PortableServer.IdAssignmentPolicy;
@@ -87,8 +92,10 @@ import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongAdapter;
import org.omg.PortableServer.POAPackage.WrongPolicy;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
/**
* Our POA implementation.
@@ -97,12 +104,108 @@ import gnu.CORBA.CDR.cdrBufOutput;
*/
public class gnuPOA
extends LocalObject
- implements POA
+ implements POA, ObjectReferenceFactory
{
/**
+ * The object reference template, associated with this POA.
+ *
+ * @since 1.5
+ */
+ class RefTemplate implements ObjectReferenceTemplate
+ {
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ RefTemplate()
+ {
+ // The adapter name is computed once.
+ ArrayList names = new ArrayList();
+ names.add(the_name());
+
+ POA poa = the_parent();
+ while (poa != null)
+ {
+ names.add(poa.the_name());
+ poa = poa.the_parent();
+ }
+
+ // Fill in the string array in reverse (more natural) order,
+ // root POA first.
+ m_adapter_name = new String[names.size()];
+
+ for (int i = 0; i < m_adapter_name.length; i++)
+ m_adapter_name[i] = (String) names.get(m_adapter_name.length - i - 1);
+ }
+
+ /**
+ * The adapter name
+ */
+ final String[] m_adapter_name;
+
+ /**
+ * Get the name of this POA.
+ */
+ public String[] adapter_name()
+ {
+ return (String[]) m_adapter_name.clone();
+ }
+
+ /**
+ * Get the ORB id.
+ */
+ public String orb_id()
+ {
+ return m_orb.orb_id;
+ }
+
+ /**
+ * Get the server id.
+ */
+ public String server_id()
+ {
+ return OrbFunctional.server_id;
+ }
+
+ /**
+ * Create the object.
+ */
+ public Object make_object(String repositoryId, byte[] objectId)
+ {
+ return create_reference_with_id(objectId, repositoryId);
+ }
+
+ /**
+ * Get the array of truncatible repository ids.
+ */
+ public String[] _truncatable_ids()
+ {
+ return ref_template_ids;
+ }
+ }
+
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The adapter reference template.
+ */
+ ObjectReferenceTemplate refTemplate;
+
+ /**
+ * The reference template repository ids. Defined outside the class as it
+ * cannot have static members.
+ */
+ final static String[] ref_template_ids =
+ new String[] { ObjectReferenceTemplateHelper.id() };
+
+ /**
* The active object map, mapping between object keys, objects and servants.
*/
- public final activeObjectMap aom = new activeObjectMap();
+ public final AOM aom = new AOM();
/**
* The children of this POA.
@@ -182,6 +285,12 @@ public class gnuPOA
* necessity of the frequent checks.
*/
public final boolean retain_servant;
+
+ /**
+ * The object reference factory, used to create the new object
+ * references.
+ */
+ ObjectReferenceFactory m_object_factory = this;
/**
* Create a new abstract POA.
@@ -199,7 +308,7 @@ public class gnuPOA
throws InvalidPolicy
{
// Add default policies.
- Policy[] all_policies = policySets.withDefault(a_policies);
+ Policy[] all_policies = StandardPolicies.withDefault(a_policies);
name = a_name;
parent = a_parent;
@@ -222,12 +331,14 @@ public class gnuPOA
for (int i = 0; i < s_policies.length; i++)
{
s_policies [ i ] = all_policies [ i ].copy();
- m_policies.add(((vPolicy) s_policies [ i ]).getValue());
+ m_policies.add(((AccessiblePolicy) s_policies [ i ]).getValue());
}
retain_servant = applies(ServantRetentionPolicyValue.RETAIN);
validatePolicies(a_policies);
+
+ refTemplate = new RefTemplate();
}
/**
@@ -281,7 +392,7 @@ public class gnuPOA
keys.addAll(aom.keySet());
byte[] key;
- activeObjectMap.Obj obj;
+ AOM.Obj obj;
boolean last;
for (int i = 0; i < keys.size(); i++)
{
@@ -422,30 +533,30 @@ public class gnuPOA
}
/**
- * Generate the Object Id for the given servant and add the servant to
- * the Active Object Map using this Id a a key. If the servant
- * activator is set, its incarnate method will be called.
- *
- * @param a_servant a servant that would serve the object with the
- * returned Object Id. If null is passed, under apporoprate policies the
- * servant activator is invoked.
- *
+ * Generate the Object Id for the given servant and add the servant to the
+ * Active Object Map using this Id a a key. If the servant activator is set,
+ * its incarnate method will be called.
+ *
+ * @param a_servant a servant that would serve the object with the returned
+ * Object Id. If null is passed, under apporoprate policies the servant
+ * activator is invoked.
+ *
* @return the generated objert Id for the given servant.
- *
- * @throws ServantAlreadyActive if this servant is already in the
- * Active Object Map and the UNIQUE_ID policy applies.
- *
- * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN
- * do not apply to this POA.
+ *
+ * @throws ServantAlreadyActive if this servant is already in the Active
+ * Object Map and the UNIQUE_ID policy applies.
+ *
+ * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN do not
+ * apply to this POA.
*/
public byte[] activate_object(Servant a_servant)
- throws ServantAlreadyActive, WrongPolicy
+ throws ServantAlreadyActive, WrongPolicy
{
checkDiscarding();
required(ServantRetentionPolicyValue.RETAIN);
required(IdAssignmentPolicyValue.SYSTEM_ID);
- activeObjectMap.Obj exists = aom.findServant(a_servant);
+ AOM.Obj exists = aom.findServant(a_servant);
if (exists != null)
{
@@ -464,28 +575,30 @@ public class gnuPOA
// activations.
}
- byte[] object_key = activeObjectMap.getFreeId();
- servantDelegate delegate = new servantDelegate(a_servant, this, object_key);
- connectDelegate(object_key, delegate);
+ byte[] object_key = AOM.getFreeId();
+ ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this,
+ object_key);
+ create_and_connect(object_key,
+ a_servant._all_interfaces(this, object_key)[0], delegate);
return object_key;
}
/**
- * Add the given servant to the Active Object Map as a servant for the
- * object with the provided Object Id. If the servant activator is
- * set, its incarnate method will be called.
- *
+ * Add the given servant to the Active Object Map as a servant for the object
+ * with the provided Object Id. If the servant activator is set, its incarnate
+ * method will be called.
+ *
* @param an_Object_Id an object id for the given object.
- * @param a_servant a servant that will serve the object with the given
- * Object Id. If null is passed, under apporoprate policies the
- * servant activator is invoked.
- *
- * @throws ObjectAlreadyActive if the given object id is already in the
- * Active Object Map.
- * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and
- * this servant is already in use.
- * @throws WrongPolicy if the required RETAIN policy does not apply to
- * this POA.
+ * @param a_servant a servant that will serve the object with the given Object
+ * Id. If null is passed, under apporoprate policies the servant activator is
+ * invoked.
+ *
+ * @throws ObjectAlreadyActive if the given object id is already in the Active
+ * Object Map.
+ * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and this
+ * servant is already in use.
+ * @throws WrongPolicy if the required RETAIN policy does not apply to this
+ * POA.
* @throws BAD_PARAM if the passed object id is invalid due any reason.
*/
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant)
@@ -496,16 +609,14 @@ public class gnuPOA
}
/**
- * Same as activate_object_with_id, but permits gnuForwardRequest
- * forwarding exception. This is used when the activation is called
- * from the remote invocation context and we have possibility
- * to return the forwarding message.
+ * Same as activate_object_with_id, but permits gnuForwardRequest forwarding
+ * exception. This is used when the activation is called from the remote
+ * invocation context and we have possibility to return the forwarding
+ * message.
*/
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant,
- boolean use_forwarding
- )
- throws ServantAlreadyActive, ObjectAlreadyActive,
- WrongPolicy
+ boolean use_forwarding)
+ throws ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy
{
checkDiscarding();
required(ServantRetentionPolicyValue.RETAIN);
@@ -514,12 +625,12 @@ public class gnuPOA
// already active.
if (applies(IdUniquenessPolicyValue.UNIQUE_ID))
{
- activeObjectMap.Obj sx = aom.findServant(a_servant, false);
+ AOM.Obj sx = aom.findServant(a_servant, false);
if (sx != null)
throw new ServantAlreadyActive();
}
- activeObjectMap.Obj exists = aom.get(an_Object_Id);
+ AOM.Obj exists = aom.get(an_Object_Id);
if (exists != null)
{
if (exists.servant == null)
@@ -537,26 +648,27 @@ public class gnuPOA
}
else
{
- servantDelegate delegate =
- new servantDelegate(a_servant, this, an_Object_Id);
- connectDelegate(an_Object_Id, delegate);
+ ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this,
+ an_Object_Id);
+ create_and_connect(an_Object_Id, a_servant._all_interfaces(this,
+ an_Object_Id)[0], delegate);
}
}
/**
* Locate the servant for this object Id and connect it to ORB.
- *
+ *
* @param an_Object_Id the object id.
* @param a_servant the servant (may be null).
* @param exists an existing active object map entry.
- * @param use_forwarding allow to throw the gnuForwardRequest
- * if the activator throws ForwardRequest.
- *
- * @throws OBJ_ADAPTER minor 4 if the servant cannot be located
- * (the required servant manager may be missing).
+ * @param use_forwarding allow to throw the gnuForwardRequest if the activator
+ * throws ForwardRequest.
+ *
+ * @throws OBJ_ADAPTER minor 4 if the servant cannot be located (the required
+ * servant manager may be missing).
*/
private void locateServant(byte[] an_Object_Id, Servant a_servant,
- activeObjectMap.Obj exists, boolean use_forwarding
+ AOM.Obj exists, boolean use_forwarding
)
throws InternalError
{
@@ -582,8 +694,8 @@ public class gnuPOA
throw new OBJ_ADAPTER("no servant", 4, CompletionStatus.COMPLETED_NO);
}
- servantDelegate delegate =
- new servantDelegate(exists.servant, this, an_Object_Id);
+ ServantDelegateImpl delegate =
+ new ServantDelegateImpl(exists.servant, this, an_Object_Id);
exists.servant._set_delegate(delegate);
object.setServant(exists.servant);
connect_to_orb(an_Object_Id, delegate.object);
@@ -605,7 +717,7 @@ public class gnuPOA
{
required(ServantRetentionPolicyValue.RETAIN);
- activeObjectMap.Obj exists = aom.get(the_Object_Id);
+ AOM.Obj exists = aom.get(the_Object_Id);
if (exists == null || exists.isDeactiveted())
throw new ObjectNotActive();
@@ -615,7 +727,7 @@ public class gnuPOA
// Check if this servant is serving something else.
aom.remove(the_Object_Id);
- activeObjectMap.Obj other = aom.findServant(exists.servant, false);
+ AOM.Obj other = aom.findServant(exists.servant, false);
boolean remaining = other != null;
@@ -643,7 +755,7 @@ public class gnuPOA
throws WrongPolicy
{
required(IdAssignmentPolicyValue.SYSTEM_ID);
- return create_reference_with_id(activeObjectMap.getFreeId(), a_repository_id);
+ return create_reference_with_id(AOM.getFreeId(), a_repository_id);
}
/**
@@ -662,8 +774,8 @@ public class gnuPOA
* servant.
*/
public org.omg.CORBA.Object create_reference_with_id(byte[] an_object_id,
- String a_repository_id
- )
+ String a_repository_id
+ )
{
String[] ids;
if (a_repository_id == null)
@@ -672,7 +784,7 @@ public class gnuPOA
ids = new String[] { a_repository_id };
// Check maybe such object is already activated.
- activeObjectMap.Obj e = aom.get(an_object_id);
+ AOM.Obj e = aom.get(an_object_id);
Servant servant;
if (e == null)
@@ -847,7 +959,7 @@ public class gnuPOA
return m_poa_id;
else
{
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
POA p = this;
while (p != null)
{
@@ -874,7 +986,7 @@ public class gnuPOA
{
required(ServantRetentionPolicyValue.RETAIN);
- activeObjectMap.Obj ref = aom.get(the_Object_Id);
+ AOM.Obj ref = aom.get(the_Object_Id);
if (ref == null)
throw new ObjectNotActive();
else
@@ -897,7 +1009,7 @@ public class gnuPOA
{
if (applies(ServantRetentionPolicyValue.RETAIN))
{
- activeObjectMap.Obj ref = aom.get(the_Object_Id);
+ AOM.Obj ref = aom.get(the_Object_Id);
if (ref == null || ref.isDeactiveted())
{
if (default_servant != null)
@@ -932,7 +1044,7 @@ public class gnuPOA
public byte[] reference_to_id(org.omg.CORBA.Object the_Object)
throws WrongAdapter, WrongPolicy
{
- activeObjectMap.Obj ref = aom.findObject(the_Object);
+ AOM.Obj ref = aom.findObject(the_Object);
if (ref == null)
throw new WrongAdapter();
return ref.key;
@@ -958,7 +1070,7 @@ public class gnuPOA
{
if (applies(ServantRetentionPolicyValue.RETAIN))
{
- activeObjectMap.Obj ref = aom.findObject(the_Object);
+ AOM.Obj ref = aom.findObject(the_Object);
if (ref == null)
throw new WrongAdapter();
else if (ref.isDeactiveted() || ref.servant == null)
@@ -1017,7 +1129,7 @@ public class gnuPOA
)
)
{
- activeObjectMap.Obj ref = null;
+ AOM.Obj ref = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
ref = aom.findServant(the_Servant);
if (ref == null &&
@@ -1047,31 +1159,31 @@ public class gnuPOA
}
/**
- * <p>Converts the given servant to the object reference.
- * The servant will serve all methods, invoked on the returned object.
- * The returned object reference can be passed to the remote client,
- * enabling remote invocations.
- * </p><p>
- * If the specified servant is active, it is returned. Otherwise,
- * if the POA has the IMPLICIT_ACTIVATION policy the method activates
- * the servant. In this case, if the servant activator is set,
- * the {@link ServantActivatorOperations#incarnate} method will be called.
+ * <p>
+ * Converts the given servant to the object reference. The servant will serve
+ * all methods, invoked on the returned object. The returned object reference
+ * can be passed to the remote client, enabling remote invocations.
* </p>
- *
+ * <p>
+ * If the specified servant is active, it is returned. Otherwise, if the POA
+ * has the IMPLICIT_ACTIVATION policy the method activates the servant. In
+ * this case, if the servant activator is set, the
+ * {@link ServantActivatorOperations#incarnate} method will be called.
+ * </p>
+ *
* @throws ServantNotActive if the servant is inactive and no
* IMPLICIT_ACTIVATION policy applies.
* @throws WrongPolicy This method needs the RETAIN policy and either the
* UNIQUE_ID or IMPLICIT_ACTIVATION policies.
- *
+ *
* @return the object, exposing the given servant in the context of this POA.
*/
public org.omg.CORBA.Object servant_to_reference(Servant the_Servant)
- throws ServantNotActive,
- WrongPolicy
+ throws ServantNotActive, WrongPolicy
{
required(ServantRetentionPolicyValue.RETAIN);
- activeObjectMap.Obj exists = null;
+ AOM.Obj exists = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
exists = aom.findServant(the_Servant);
@@ -1092,17 +1204,17 @@ public class gnuPOA
else
return exists.object;
}
- if (exists == null &&
- applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
- )
+ if (exists == null
+ && applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
{
checkDiscarding();
- byte[] object_key = activeObjectMap.getFreeId();
+ byte[] object_key = AOM.getFreeId();
- servantDelegate delegate =
- new servantDelegate(the_Servant, this, object_key);
- connectDelegate(object_key, delegate);
+ ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant,
+ this, object_key);
+ create_and_connect(object_key, the_Servant._all_interfaces(this,
+ object_key)[0], delegate);
return delegate.object;
}
@@ -1111,22 +1223,22 @@ public class gnuPOA
}
/**
- * Incarnate in cases when request forwarding is not expected
- * because the servant must be provided by the servant activator.
- *
- * @param x the aom entry, where the object is replaced by
- * value, returned by servant activator (if not null).
- *
+ * Incarnate in cases when request forwarding is not expected because the
+ * servant must be provided by the servant activator.
+ *
+ * @param x the aom entry, where the object is replaced by value, returned by
+ * servant activator (if not null).
+ *
* @param key the object key.
- *
+ *
* @param a_servant the servant that was passed as a parameter in the
* activation method.
- *
- * @param use_forwarding if true, the gnuForwardRequest is throw
- * under the forwarding exception (for remote client). Otherwise, the
- * request is internally redirected (for local invocation).
+ *
+ * @param use_forwarding if true, the gnuForwardRequest is throw under the
+ * forwarding exception (for remote client). Otherwise, the request is
+ * internally redirected (for local invocation).
*/
- private Servant incarnate(activeObjectMap.Obj x, byte[] object_key,
+ private Servant incarnate(AOM.Obj x, byte[] object_key,
Servant a_servant, boolean use_forwarding
)
{
@@ -1281,34 +1393,46 @@ public class gnuPOA
}
/**
- * <p> Destroy this POA and all descendant POAs. The destroyed POAs can be
- * later re-created via {@link AdapterActivator} or by invoking
- * {@link #create_POA}.
- * This differs from {@link PoaManagerOperations#deactivate} that does
- * not allow recreation of the deactivated POAs. After deactivation,
- * recreation is only possible if the POAs were later destroyed.
- * </p><p>
- * The remote invocation on the target, belonging to the POA that is
- * currently destroyed return the remote exception ({@link TRANSIENT},
- * minor code 4).
+ * <p>
+ * Destroy this POA and all descendant POAs. The destroyed POAs can be later
+ * re-created via {@link AdapterActivator} or by invoking {@link #create_POA}.
+ * This differs from {@link PoaManagerOperations#deactivate} that does not
+ * allow recreation of the deactivated POAs. After deactivation, recreation is
+ * only possible if the POAs were later destroyed.
* </p>
+ * <p>
+ * The remote invocation on the target, belonging to the POA that is currently
+ * destroyed return the remote exception ({@link TRANSIENT}, minor code 4).
+ * </p>
+ *
* @param etherealize_objects if true, and POA has RETAIN policy, and the
* servant manager is available, the servant manager method
- * {@link ServantActivatorOperations#etherealize} is called for each
- * <i>active</i> object in the Active Object Map. This method should not
- * try to access POA being destroyed. If <code>destroy</code> is called
- * multiple times before the destruction completes,
- * the etherialization should be invoked only once.
- *
+ * {@link ServantActivatorOperations#etherealize} is called for each <i>active</i>
+ * object in the Active Object Map. This method should not try to access POA
+ * being destroyed. If <code>destroy</code> is called multiple times before
+ * the destruction completes, the etherialization should be invoked only once.
+ *
* @param wait_for_completion if true, the method waits till the POA being
- * destroyed completes all current requests and etherialization. If false,
- * the method returns immediately.
+ * destroyed completes all current requests and etherialization. If false, the
+ * method returns immediately.
*/
public void destroy(boolean etherealize_objects, boolean wait_for_completion)
{
+ // Notify the IOR interceptors about that the POA is destroyed.
+ if (m_orb.iIor != null)
+ m_orb.iIor.adapter_state_changed(
+ new ObjectReferenceTemplate[] { getReferenceTemplate() },
+ NON_EXISTENT.value);
+
if (wait_for_completion)
waitWhileRunning();
+ // Nofify the IOR interceptors that the POA is destroyed.
+ if (m_manager instanceof gnuPOAManager)
+ {
+ ((gnuPOAManager) m_manager).poaDestroyed(this);
+ }
+
// Put the brake instead of manager, preventing the subsequent
// requests.
gnuPOAManager g = new gnuPOAManager();
@@ -1328,7 +1452,7 @@ public class gnuPOA
keys.addAll(aom.keySet());
byte[] key;
- activeObjectMap.Obj obj;
+ AOM.Obj obj;
for (int i = 0; i < keys.size(); i++)
{
key = (byte[]) keys.get(i);
@@ -1348,7 +1472,7 @@ public class gnuPOA
POA[] ch = the_children();
for (int i = 0; i < ch.length; i++)
{
- ch [ i ].destroy(etherealize_objects, wait_for_completion);
+ ch[i].destroy(etherealize_objects, wait_for_completion);
}
}
@@ -1430,13 +1554,14 @@ public class gnuPOA
}
/**
- * Connect the given delegate under the given key, also calling
- * incarnate.
+ * Connect the given delegate under the given key, also calling incarnate.
*/
- private void connectDelegate(byte[] object_key, servantDelegate delegate)
+ private void create_and_connect(byte[] object_key, String repository_id,
+ ServantDelegateImpl delegate)
{
aom.add(delegate);
- connect_to_orb(object_key, delegate.object);
+ connect_to_orb(object_key, getReferenceFactory().make_object(repository_id,
+ object_key));
if (servant_activator != null)
incarnate(null, object_key, delegate.servant, false);
}
@@ -1517,9 +1642,9 @@ public class gnuPOA
/**
* Recursively searches for the given object in the POA tree.
*/
- public activeObjectMap.Obj findObject(org.omg.CORBA.Object object)
+ public AOM.Obj findObject(org.omg.CORBA.Object object)
{
- activeObjectMap.Obj h = aom.findObject(object);
+ AOM.Obj h = aom.findObject(object);
if (h != null)
return h;
else
@@ -1533,16 +1658,16 @@ public class gnuPOA
}
return h;
}
-
+
/**
* Recursively searches for the given key in the POA tree.
* @param ior_key the key, ecapsulating both object
* and poa ids.
* @return
*/
- public activeObjectMap.Obj findKey(byte[] object_id, byte[] poa_id)
+ public AOM.Obj findKey(byte[] object_id, byte[] poa_id)
{
- activeObjectMap.Obj h = null;
+ AOM.Obj h = null;
if (Arrays.equals(poa_id, id()))
h = aom.get(object_id);
if (h != null)
@@ -1563,9 +1688,9 @@ public class gnuPOA
* Parses the given key, extracts poa and object id and searches
* for such reference.
*/
- public activeObjectMap.Obj findIorKey(byte[] ior_key)
+ public AOM.Obj findIorKey(byte[] ior_key)
{
- cdrBufInput in = new cdrBufInput(ior_key);
+ BufferredCdrInput in = new BufferredCdrInput(ior_key);
int signature = in.read_long();
if (signature != SIGNATURE)
return null;
@@ -1582,7 +1707,7 @@ public class gnuPOA
*/
public byte[] toIORKey(byte[] object_id)
{
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
buffer.write_long(SIGNATURE);
buffer.write_sequence(object_id);
buffer.write_sequence(id());
@@ -1600,7 +1725,7 @@ public class gnuPOA
*/
public byte[] idFormIor(byte[] ior_key)
{
- cdrBufInput in = new cdrBufInput(ior_key);
+ BufferredCdrInput in = new BufferredCdrInput(ior_key);
int signature = in.read_long();
if (signature != SIGNATURE)
return null;
@@ -1612,4 +1737,70 @@ public class gnuPOA
else
return null;
}
+
+ /**
+ * Recursively searches for the given servant in the POA tree.
+ */
+ public AOM.Obj findServant(Servant servant)
+ {
+ AOM.Obj h = aom.findServant(servant);
+ if (h != null)
+ return h;
+ else
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ h = ((gnuPOA) children.get(i)).findServant(servant);
+ if (h != null)
+ return h;
+ }
+ }
+ return h;
+ }
+
+ /**
+ * Get the object reference template of this POA.
+ * Instantiate a singleton instance, if required.
+ */
+ public ObjectReferenceTemplate getReferenceTemplate()
+ {
+ if (refTemplate == null)
+ refTemplate = new RefTemplate();
+
+ return refTemplate;
+ }
+
+ public ObjectReferenceFactory getReferenceFactory()
+ {
+ return m_object_factory;
+ }
+
+ public void setReferenceFactory(ObjectReferenceFactory factory)
+ {
+ m_object_factory = factory;
+ }
+
+ /**
+ * Create the object (needed by the factory interface).
+ */
+ public Object make_object(String a_repository_id, byte[] an_object_id)
+ {
+ AOM.Obj existing = aom.get(an_object_id);
+ // The object may already exist. In this case, it is just returned.
+ if (existing != null && existing.object != null)
+ return existing.object;
+ else
+ {
+ return new gnuServantObject(new String[] { a_repository_id },
+ an_object_id, this, m_orb);
+ }
+ }
+
+ /**
+ * Required by object reference factory ops.
+ */
+ public String[] _truncatable_ids()
+ {
+ return ref_template_ids;
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
index 6c1b5644f36..7710306b748 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
@@ -40,6 +40,8 @@ package gnu.CORBA.Poa;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.LocalObject;
+import org.omg.PortableInterceptor.NON_EXISTENT;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
import org.omg.PortableServer.POAManager;
import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
import org.omg.PortableServer.POAManagerPackage.State;
@@ -59,18 +61,22 @@ public class gnuPOAManager
extends LocalObject
implements POAManager
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
- * The POAs, controlled by this manager. The members must be instances of
- * the gnuAbstractPOA.
+ * The POAs, controlled by this manager.
*/
- HashSet POAs = new HashSet();
+ private HashSet POAs = new HashSet();
/**
* The state of the manager. The newly created manager is always
* in the holding state.
*/
State state = State.HOLDING;
-
+
/**
* Get the state of the POA manager.
*/
@@ -94,6 +100,8 @@ public class gnuPOAManager
state = State.ACTIVE;
else
throw new AdapterInactive();
+
+ notifyInterceptors(state.value());
}
/**
@@ -113,6 +121,9 @@ public class gnuPOAManager
state = State.HOLDING;
else
throw new AdapterInactive();
+
+ notifyInterceptors(state.value());
+
if (wait_for_completion)
waitForIdle();
}
@@ -144,6 +155,9 @@ public class gnuPOAManager
if (state == State.INACTIVE)
throw new AdapterInactive("Repetetive inactivation");
state = State.INACTIVE;
+
+ notifyInterceptors(state.value());
+
if (wait_for_completion)
waitForIdle();
@@ -178,6 +192,9 @@ public class gnuPOAManager
state = State.DISCARDING;
else
throw new AdapterInactive();
+
+ notifyInterceptors(state.value());
+
if (wait_for_completion)
waitForIdle();
}
@@ -193,11 +210,13 @@ public class gnuPOAManager
{
if (state == State.ACTIVE)
throw new BAD_INV_ORDER("The state is active");
-
+
+ gnuPOA poa;
Iterator iter = POAs.iterator();
+
while (iter.hasNext())
{
- gnuPOA poa = (gnuPOA) iter.next();
+ poa = (gnuPOA) iter.next();
poa.waitWhileRunning();
}
}
@@ -222,4 +241,33 @@ public class gnuPOAManager
{
POAs.remove(poa);
}
+
+ /**
+ * This method is called when POA is destryed. The interceptors are
+ * notified.
+ */
+ public void poaDestroyed(gnuPOA poa)
+ {
+ notifyInterceptors(NON_EXISTENT.value);
+ }
+
+ /**
+ * Notify CORBA 3.0 interceptors about the status change.
+ */
+ public synchronized void notifyInterceptors(int new_state)
+ {
+ gnuPOA poa;
+ Iterator iter = POAs.iterator();
+
+ // The System.identityHashCode is also called in gnuIorInfo.
+ while (iter.hasNext())
+ {
+ poa = (gnuPOA) iter.next();
+ if (poa.m_orb.iIor != null)
+ {
+ poa.m_orb.iIor.adapter_manager_state_changed(
+ System.identityHashCode(this), (short) new_state);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
index 5bbcd1321b3..2f77639c698 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.RequestProcessingPolicyValue;
*/
public class gnuRequestProcessingPolicy
extends _PolicyImplBase
- implements RequestProcessingPolicy, vPolicy
+ implements RequestProcessingPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
index 1ad98d1cecd..020897a45b4 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
@@ -39,14 +39,17 @@ exception statement from your version. */
package gnu.CORBA.Poa;
import gnu.CORBA.GIOP.ReplyHeader;
-import gnu.CORBA.IOR_Delegate;
-import gnu.CORBA.IOR_contructed_object;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.IorObject;
import gnu.CORBA.Interceptor.gnuServerRequestInfo;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.Minor;
import gnu.CORBA.ObjectCreator;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.bufferedResponseHandler;
-import gnu.CORBA.recordTypeCode;
-import gnu.CORBA.streamReadyHolder;
+import gnu.CORBA.ResponseHandlerImpl;
+import gnu.CORBA.StreamHolder;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -90,7 +93,8 @@ import java.util.Arrays;
public class gnuServantObject extends ObjectImpl
implements org.omg.CORBA.Object,
InvokeHandler,
- CurrentOperations
+ CurrentOperations,
+ IorProvider
{
/**
* The associated servant that must also implement the {@link InvokeHandler}
@@ -144,6 +148,14 @@ public class gnuServantObject extends ObjectImpl
poa = a_poa;
orb = an_orb;
}
+
+ /**
+ * Get the IOR as it would be for this object.
+ */
+ public IOR getIor()
+ {
+ return orb.getLocalIor(this);
+ }
/**
* Create a servant object, associated with the passed servant.
@@ -257,10 +269,8 @@ public class gnuServantObject extends ObjectImpl
}
catch (Exception ex)
{
- ex.printStackTrace();
-
BAD_OPERATION bad =
- new BAD_OPERATION("Unable to activate", 0x5004,
+ new BAD_OPERATION("Unable to activate", Minor.Activation,
CompletionStatus.COMPLETED_NO
);
bad.initCause(ex);
@@ -276,7 +286,7 @@ public class gnuServantObject extends ObjectImpl
// No servant and no servant manager - throw exception.
else
{
- throw new BAD_OPERATION("Unable to activate", 0x5002,
+ throw new BAD_OPERATION("Unable to activate", Minor.Activation,
CompletionStatus.COMPLETED_NO
);
}
@@ -294,7 +304,7 @@ public class gnuServantObject extends ObjectImpl
}
else if (a_servant instanceof DynamicImplementation)
{
- return new dynImpHandler((DynamicImplementation) a_servant);
+ return new DynamicImpHandler((DynamicImplementation) a_servant);
}
else
{
@@ -402,17 +412,17 @@ public class gnuServantObject extends ObjectImpl
boolean intercept = false;
ServerRequestInterceptorOperations interceptor = null;
gnuServerRequestInfo info = null;
- bufferedResponseHandler i_handler = null;
+ ResponseHandlerImpl i_handler = null;
try
{
if (orb.iServer != null &&
- r_handler instanceof bufferedResponseHandler
+ r_handler instanceof ResponseHandlerImpl
)
{
interceptor = orb.iServer;
- i_handler = (bufferedResponseHandler) r_handler;
+ i_handler = (ResponseHandlerImpl) r_handler;
info =
new gnuServerRequestInfo(this, i_handler.request_header,
@@ -426,7 +436,7 @@ public class gnuServantObject extends ObjectImpl
try
{
CookieHolder cookie = null;
- activeObjectMap.Obj self = poa.aom.get(Id);
+ AOM.Obj self = poa.aom.get(Id);
if (poa.servant_locator != null)
{
@@ -467,18 +477,18 @@ public class gnuServantObject extends ObjectImpl
{
// In some cases exception is thrown if the delegate is not set.
}
- if (d instanceof servantDelegate)
+ if (d instanceof ServantDelegateImpl)
{
// If the delegate is already set, check maybe we can
// reuse the existing instance.
- if (((servantDelegate) d).object != this)
+ if (((ServantDelegateImpl) d).object != this)
{
- servant._set_delegate(new servantDelegate(servant, poa, Id));
+ servant._set_delegate(new ServantDelegateImpl(servant, poa, Id));
}
}
else
{
- servant._set_delegate(new servantDelegate(servant, poa, Id));
+ servant._set_delegate(new ServantDelegateImpl(servant, poa, Id));
}
try
@@ -536,13 +546,13 @@ public class gnuServantObject extends ObjectImpl
{
// Failed due any reason, insert without
// helper.
- a.insert_Streamable(new streamReadyHolder(
+ a.insert_Streamable(new StreamHolder(
buf.create_input_stream()
)
);
- recordTypeCode r =
- new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r =
+ new RecordTypeCode(TCKind.tk_except);
r.setId(uex_idl);
r.setName(ObjectCreator.getDefaultName(
uex_idl
@@ -774,12 +784,12 @@ public class gnuServantObject extends ObjectImpl
gnuServantObject g = (gnuServantObject) other;
return orb == g.orb && poa == g.poa && Arrays.equals(Id, g.Id);
}
- else if (other instanceof IOR_contructed_object)
+ else if (other instanceof IorObject)
{
- IOR_contructed_object ir = ((IOR_contructed_object) other);
+ IorObject ir = ((IorObject) other);
try
{
- IOR_Delegate ird = (IOR_Delegate) ir._get_delegate();
+ IorDelegate ird = (IorDelegate) ir._get_delegate();
byte[] ior_id = poa.idFormIor(ird.getIor().key);
if (ior_id != null && Arrays.equals(ior_id, Id))
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
index 009e70e1b35..9fb61ab3f1f 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.ServantRetentionPolicyValue;
*/
public class gnuServantRetentionPolicy
extends _PolicyImplBase
- implements ServantRetentionPolicy, vPolicy
+ implements ServantRetentionPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
index f42ebefb363..1de94a10145 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.ThreadPolicyValue;
*/
public class gnuThreadPolicy
extends _PolicyImplBase
- implements ThreadPolicy, vPolicy
+ implements ThreadPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/binaryReply.java b/libjava/classpath/gnu/CORBA/RawReply.java
index 71afa377679..a36f4b4b2d7 100644
--- a/libjava/classpath/gnu/CORBA/binaryReply.java
+++ b/libjava/classpath/gnu/CORBA/RawReply.java
@@ -1,4 +1,4 @@
-/* binaryReply.java --
+/* RawReply.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
+import gnu.CORBA.CDR.BufferredCdrInput;
import gnu.CORBA.GIOP.MessageHeader;
import org.omg.CORBA.ORB;
@@ -48,7 +48,7 @@ import org.omg.CORBA.ORB;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-class binaryReply
+class RawReply
{
/**
* The message header.
@@ -71,7 +71,7 @@ class binaryReply
* @param an_header the message header
* @param a_data the message data.
*/
- binaryReply(ORB an_orb, MessageHeader an_header, byte[] a_data)
+ RawReply(ORB an_orb, MessageHeader an_header, byte[] a_data)
{
orb = an_orb;
header = an_header;
@@ -83,9 +83,9 @@ class binaryReply
*
* @return the CDR stream to read the message data.
*/
- cdrBufInput getStream()
+ BufferredCdrInput getStream()
{
- cdrBufInput in = new cdrBufInput(data);
+ BufferredCdrInput in = new BufferredCdrInput(data);
in.setOffset(header.getHeaderSize());
in.setVersion(header.version);
in.setOrb(orb);
diff --git a/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java b/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java
index 0fe945ca1f0..4d509cc5253 100644
--- a/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java
+++ b/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java
@@ -1,4 +1,4 @@
-/* bufferedResponseHandler.java --
+/* ResponseHandlerImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,11 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.ORB;
import org.omg.CORBA.portable.OutputStream;
@@ -53,7 +53,7 @@ import org.omg.CORBA.portable.ResponseHandler;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class bufferedResponseHandler
+public class ResponseHandlerImpl
implements ResponseHandler
{
/**
@@ -86,7 +86,7 @@ public class bufferedResponseHandler
/**
* The buffer to write into.
*/
- private cdrBufOutput buffer;
+ private BufferedCdrOutput buffer;
/**
* Create a new buffered response handler that uses the given message headers.
@@ -96,7 +96,7 @@ public class bufferedResponseHandler
* @param m_header a message header.
* @param r_header a reply header.
*/
- bufferedResponseHandler(ORB an_orb, MessageHeader m_header,
+ ResponseHandlerImpl(ORB an_orb, MessageHeader m_header,
ReplyHeader r_header, RequestHeader rq_header)
{
message_header = m_header;
@@ -147,7 +147,7 @@ public class bufferedResponseHandler
*
* @return the CDR output stream, containing the written output.
*/
- public cdrBufOutput getBuffer()
+ public BufferedCdrOutput getBuffer()
{
return buffer;
}
@@ -166,10 +166,10 @@ public class bufferedResponseHandler
*/
private void prepareStream()
{
- buffer = new cdrBufOutput();
+ buffer = new BufferedCdrOutput();
buffer.setOrb(orb);
buffer.setVersion(message_header.version);
- buffer.setCodeSet(cxCodeSet.find(reply_header.service_context));
+ buffer.setCodeSet(CodeSetServiceContext.find(reply_header.service_context));
// Since 1.2, the data section is always aligned on the 8 byte boundary.
// In older versions, it is necessary to set the offset correctly.
diff --git a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
index 7f40fc84d2d..a6f7aa52b8d 100644
--- a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
+++ b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.ARG_IN;
import org.omg.CORBA.ARG_INOUT;
@@ -67,7 +67,7 @@ public class ServiceRequestAdapter
/**
* A buffer for writing the response.
*/
- cdrBufOutput reply = new cdrBufOutput();
+ BufferedCdrOutput reply = new BufferedCdrOutput();
/**
* If set to true, an exception has been thrown during the invocation.
@@ -105,7 +105,7 @@ public class ServiceRequestAdapter
int OUT = ARG_OUT.value;
// Write all arguments to the buffer output stream.
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
gnuNVList args = new gnuNVList();
request.arguments(args);
@@ -127,7 +127,7 @@ public class ServiceRequestAdapter
{
// Write the exception information
gnuAny exc = new gnuAny();
- universalHolder uku = new universalHolder(h.reply);
+ GeneralHolder uku = new GeneralHolder(h.reply);
exc.insert_Streamable(uku);
request.set_exception(exc);
}
@@ -146,7 +146,7 @@ public class ServiceRequestAdapter
{
// Use the universal holder otherwise.
gnuAny r = new gnuAny();
- r.insert_Streamable(new streamReadyHolder(in));
+ r.insert_Streamable(new StreamHolder(in));
}
// Unpack the arguments
diff --git a/libjava/classpath/gnu/CORBA/Simple_delegate.java b/libjava/classpath/gnu/CORBA/SimpleDelegate.java
index 5eabc7da8a0..c6e20e17374 100644
--- a/libjava/classpath/gnu/CORBA/Simple_delegate.java
+++ b/libjava/classpath/gnu/CORBA/SimpleDelegate.java
@@ -57,8 +57,9 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Simple_delegate
+public class SimpleDelegate
extends Delegate
+ implements IorProvider
{
/**
* The orb.
@@ -70,7 +71,7 @@ public class Simple_delegate
*/
protected IOR ior;
- public Simple_delegate(ORB an_orb, IOR an_ior)
+ public SimpleDelegate(ORB an_orb, IOR an_ior)
{
orb = an_orb;
ior = an_ior;
@@ -195,13 +196,11 @@ public class Simple_delegate
}
/**
- * Returns true if the objects are the same of have
- * the same delegate set. All objects in this implementation
- * have a separate delegate.
+ * Returns true if the objects are the same or have the same delegate set. All
+ * objects in this implementation have a separate delegate.
*/
public boolean is_equivalent(org.omg.CORBA.Object target,
- org.omg.CORBA.Object other
- )
+ org.omg.CORBA.Object other)
{
if (target == other)
return true;
@@ -209,14 +208,26 @@ public class Simple_delegate
{
try
{
- org.omg.CORBA.portable.Delegate a =
- ((ObjectImpl) target)._get_delegate();
- org.omg.CORBA.portable.Delegate b =
- ((ObjectImpl) other)._get_delegate();
+ org.omg.CORBA.portable.Delegate a = ((ObjectImpl) target)._get_delegate();
+ org.omg.CORBA.portable.Delegate b = ((ObjectImpl) other)._get_delegate();
if (a == b)
{
return true;
}
+ else
+ {
+ // We compere the IOR's in this case.
+ if (a instanceof IorProvider && b instanceof IorProvider)
+ {
+ IOR ia = ((IorProvider) a).getIor();
+ IOR ib = ((IorProvider) b).getIor();
+
+ if (ia != null && ib != null)
+ return (ia.equals(ib));
+ else
+ return ia == ib;
+ }
+ }
if (a != null && b != null)
{
return a.equals(b);
@@ -265,12 +276,19 @@ public class Simple_delegate
}
/**
- * This should never be called this type delegate.
- *
- * @throws InternalError, always.
+ * This method assumes that the target is local and connected to the ORB.
*/
public Request request(org.omg.CORBA.Object target, String operation)
{
- throw new InternalError();
+ if (orb instanceof OrbFunctional)
+ {
+ ((OrbFunctional) orb).ensureRunning();
+ }
+ gnuRequest g = new gnuRequest();
+ g.setORB(orb);
+ g.setOperation(operation);
+ g.setIor(ior);
+ g.m_target = target;
+ return g;
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/SocketRepository.java b/libjava/classpath/gnu/CORBA/SocketRepository.java
index a6b99200a48..e48a9a5da17 100644
--- a/libjava/classpath/gnu/CORBA/SocketRepository.java
+++ b/libjava/classpath/gnu/CORBA/SocketRepository.java
@@ -40,8 +40,9 @@ package gnu.CORBA;
import java.net.Socket;
import java.net.SocketException;
-
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
/**
* This class caches the opened sockets that are reused during the
@@ -56,9 +57,10 @@ public class SocketRepository
* The socket map.
*/
private static HashMap sockets = new HashMap();
-
+
/**
- * Put a socket.
+ * Put a socket. This method also discards all not reusable sockets from
+ * the map.
*
* @param key as socket key.
*
@@ -66,7 +68,41 @@ public class SocketRepository
*/
public static void put_socket(Object key, Socket s)
{
- sockets.put(key, s);
+ synchronized (sockets)
+ {
+ sockets.put(key, s);
+ gc();
+ }
+ }
+
+ /**
+ * Removes all non reusable sockets. As it is private,
+ * we know we call from the synchronized code already.
+ */
+ private static void gc()
+ {
+ Iterator iter = sockets.entrySet().iterator();
+
+ Map.Entry e;
+ Socket sx;
+
+ while (iter.hasNext())
+ {
+ e = (Map.Entry) iter.next();
+ sx = (Socket) e.getValue();
+
+ if (not_reusable(sx))
+ iter.remove();
+ }
+ }
+
+ /**
+ * Return true if the socket is no longer reusable.
+ */
+ static boolean not_reusable(Socket s)
+ {
+ return (s.isClosed() || !s.isBound() || !s.isConnected() ||
+ s.isInputShutdown() || s.isOutputShutdown());
}
/**
@@ -75,31 +111,41 @@ public class SocketRepository
* @param key a socket key.
*
* @return an opened socket for reuse, null if no such available or it is
- * closed.
+ * closed, its input or output has been shutown or otherwise the socket is not
+ * reuseable.
*/
public static Socket get_socket(Object key)
{
- Socket s = (Socket) sockets.get(key);
- if (s == null)
+ if (true)
return null;
- else if (s.isClosed())
- {
- sockets.remove(key);
- return null;
- }
- else
+
+ synchronized (sockets)
{
- sockets.remove(key);
- try
+ Socket s = (Socket) sockets.get(key);
+ if (s == null)
+ return null;
+
+ // Ensure that the socket is fully reusable.
+ else if (not_reusable(s))
{
- // Set one minute time out that will be changed later.
- s.setSoTimeout(60*1000);
+ sockets.remove(key);
+ return null;
}
- catch (SocketException e)
+ else
{
- s = null;
+ try
+ {
+ // Set one minute time out that will be changed later.
+ s.setSoTimeout(60 * 1000);
+ }
+ catch (SocketException e)
+ {
+ s = null;
+ }
+
+ sockets.remove(key);
+ return s;
}
- return s;
}
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/streamRequest.java b/libjava/classpath/gnu/CORBA/StreamBasedRequest.java
index a0f7eb09928..66796d653c9 100644
--- a/libjava/classpath/gnu/CORBA/streamRequest.java
+++ b/libjava/classpath/gnu/CORBA/StreamBasedRequest.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
/**
* A stream, additionally holding the gnu request.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class streamRequest
- extends cdrBufOutput
+public class StreamBasedRequest
+ extends BufferedCdrOutput
{
/**
* The enclosed request.
diff --git a/libjava/classpath/gnu/CORBA/streamReadyHolder.java b/libjava/classpath/gnu/CORBA/StreamHolder.java
index a777bd55597..de2fda0ba89 100644
--- a/libjava/classpath/gnu/CORBA/streamReadyHolder.java
+++ b/libjava/classpath/gnu/CORBA/StreamHolder.java
@@ -1,4 +1,4 @@
-/* streamReadyHolder.java --
+/* StreamHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class streamReadyHolder
+public class StreamHolder
implements Streamable
{
/**
@@ -65,7 +65,7 @@ public class streamReadyHolder
*
* @param a_stream a stream.
*/
- public streamReadyHolder(InputStream a_stream)
+ public StreamHolder(InputStream a_stream)
{
stream = a_stream;
}
@@ -98,7 +98,10 @@ public class streamReadyHolder
}
catch (IOException ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.initCause(ex);
+ m.minor = Minor.CDR;
+ throw m;
}
}
diff --git a/libjava/classpath/gnu/CORBA/stubFinder.java b/libjava/classpath/gnu/CORBA/StubLocator.java
index 77efd004717..d9e5ee4712c 100644
--- a/libjava/classpath/gnu/CORBA/stubFinder.java
+++ b/libjava/classpath/gnu/CORBA/StubLocator.java
@@ -1,4 +1,4 @@
-/* stubFinder.java --
+/* StubLocator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class stubFinder
+public class StubLocator
{
/**
* Search for the possibly available default stub.
@@ -83,7 +83,7 @@ public class stubFinder
String stub = "_" + s.substring(b + 1) + "Stub";
- Class stubClass = Class.forName(path + stub);
+ Class stubClass = ObjectCreator.forName(path + stub);
return (ObjectImpl) stubClass.newInstance();
}
@@ -105,6 +105,6 @@ public class stubFinder
*/
protected static ObjectImpl createDefaultStub(ORB orb, IOR ior)
{
- return new IOR_contructed_object(orb, ior);
+ return new IorObject(orb, ior);
}
}
diff --git a/libjava/classpath/gnu/CORBA/TypeCodeHelper.java b/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
index c742275420e..4ffb0b74446 100644
--- a/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
+++ b/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
@@ -38,6 +38,13 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
@@ -62,10 +69,10 @@ public class TypeCodeHelper
{
TCKind kind = TCKind.from_int(in.read_long());
TypeCode rt;
- generalTypeCode g;
- recordTypeCode r;
- recordTypeCode.Field f;
- stringTypeCode s;
+ GeneralTypeCode g;
+ RecordTypeCode r;
+ RecordTypeCode.Field f;
+ StringTypeCode s;
int n;
switch (kind.value())
@@ -73,21 +80,21 @@ public class TypeCodeHelper
case TCKind._tk_sequence :
case TCKind._tk_array :
- primitiveArrayTypeCode p = new primitiveArrayTypeCode(kind);
+ ArrayTypeCode p = new ArrayTypeCode(kind);
p.setLength(in.read_long());
rt = p;
break;
case TCKind._tk_string :
case TCKind._tk_wstring :
- s = new stringTypeCode(kind);
+ s = new StringTypeCode(kind);
s.setLength(in.read_long());
rt = s;
break;
case TCKind._tk_fixed :
- fixedTypeCode fx = new fixedTypeCode();
+ FixedTypeCode fx = new FixedTypeCode();
fx.setDigits(in.read_short());
fx.setScale(in.read_short());
rt = fx;
@@ -96,7 +103,7 @@ public class TypeCodeHelper
case TCKind._tk_objref :
case TCKind._tk_native :
case TCKind._tk_abstract_interface :
- g = new generalTypeCode(kind);
+ g = new GeneralTypeCode(kind);
g.setId(in.read_string());
g.setName(in.read_string());
rt = g;
@@ -104,7 +111,7 @@ public class TypeCodeHelper
case TCKind._tk_alias :
case TCKind._tk_value_box :
- g = new generalTypeCode(kind);
+ g = new GeneralTypeCode(kind);
g.setId(in.read_string());
g.setName(in.read_string());
g.setContentType(in.read_TypeCode());
@@ -113,7 +120,7 @@ public class TypeCodeHelper
case TCKind._tk_struct :
case TCKind._tk_except :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
@@ -129,7 +136,7 @@ public class TypeCodeHelper
break;
case TCKind._tk_enum :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
@@ -144,7 +151,7 @@ public class TypeCodeHelper
break;
case TCKind._tk_union :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
r.setDiscriminator_type(in.read_TypeCode());
@@ -164,7 +171,7 @@ public class TypeCodeHelper
break;
case TCKind._tk_value :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
r.setTypeModifier(in.read_short());
@@ -183,7 +190,7 @@ public class TypeCodeHelper
break;
default :
- rt = new primitiveTypeCode(kind);
+ rt = new PrimitiveTypeCode(kind);
}
return rt;
}
diff --git a/libjava/classpath/gnu/CORBA/typeNamer.java b/libjava/classpath/gnu/CORBA/TypeKindNamer.java
index f790dc95970..3296db3600a 100644
--- a/libjava/classpath/gnu/CORBA/typeNamer.java
+++ b/libjava/classpath/gnu/CORBA/TypeKindNamer.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
@@ -48,7 +51,7 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class typeNamer
+public class TypeKindNamer
{
/**
* Names of the primitve types.
@@ -69,46 +72,46 @@ public class typeNamer
protected static final TypeCode[] primitveCodes =
new TypeCode[]
{
- new primitiveTypeCode(TCKind.tk_null),
- new primitiveTypeCode(TCKind.tk_void),
- new primitiveTypeCode(TCKind.tk_short),
- new primitiveTypeCode(TCKind.tk_long),
- new primitiveTypeCode(TCKind.tk_ushort),
- new primitiveTypeCode(TCKind.tk_ulong),
- new primitiveTypeCode(TCKind.tk_float),
- new primitiveTypeCode(TCKind.tk_double),
- new primitiveTypeCode(TCKind.tk_boolean),
- new primitiveTypeCode(TCKind.tk_char),
- new primitiveTypeCode(TCKind.tk_octet),
- new primitiveTypeCode(TCKind.tk_any),
- new primitiveTypeCode(TCKind.tk_TypeCode),
- new primitiveTypeCode(TCKind.tk_Principal),
- new recordTypeCode(TCKind.tk_objref),
- new primitiveTypeCode(TCKind.tk_struct),
- new primitiveTypeCode(TCKind.tk_union),
- new primitiveTypeCode(TCKind.tk_enum),
- new primitiveTypeCode(TCKind.tk_string),
- new primitiveTypeCode(TCKind.tk_sequence),
- new primitiveTypeCode(TCKind.tk_array),
- new primitiveTypeCode(TCKind.tk_alias),
- new primitiveTypeCode(TCKind.tk_except),
- new primitiveTypeCode(TCKind.tk_longlong),
- new primitiveTypeCode(TCKind.tk_ulonglong),
- new primitiveTypeCode(TCKind.tk_longdouble),
- new primitiveTypeCode(TCKind.tk_wchar),
- new primitiveTypeCode(TCKind.tk_wstring),
- new primitiveTypeCode(TCKind.tk_fixed),
- new primitiveTypeCode(TCKind.tk_value),
- new primitiveTypeCode(TCKind.tk_value_box),
- new primitiveTypeCode(TCKind.tk_native),
- new primitiveTypeCode(TCKind.tk_abstract_interface)
+ new PrimitiveTypeCode(TCKind.tk_null),
+ new PrimitiveTypeCode(TCKind.tk_void),
+ new PrimitiveTypeCode(TCKind.tk_short),
+ new PrimitiveTypeCode(TCKind.tk_long),
+ new PrimitiveTypeCode(TCKind.tk_ushort),
+ new PrimitiveTypeCode(TCKind.tk_ulong),
+ new PrimitiveTypeCode(TCKind.tk_float),
+ new PrimitiveTypeCode(TCKind.tk_double),
+ new PrimitiveTypeCode(TCKind.tk_boolean),
+ new PrimitiveTypeCode(TCKind.tk_char),
+ new PrimitiveTypeCode(TCKind.tk_octet),
+ new PrimitiveTypeCode(TCKind.tk_any),
+ new PrimitiveTypeCode(TCKind.tk_TypeCode),
+ new PrimitiveTypeCode(TCKind.tk_Principal),
+ new RecordTypeCode(TCKind.tk_objref),
+ new PrimitiveTypeCode(TCKind.tk_struct),
+ new PrimitiveTypeCode(TCKind.tk_union),
+ new PrimitiveTypeCode(TCKind.tk_enum),
+ new PrimitiveTypeCode(TCKind.tk_string),
+ new PrimitiveTypeCode(TCKind.tk_sequence),
+ new PrimitiveTypeCode(TCKind.tk_array),
+ new PrimitiveTypeCode(TCKind.tk_alias),
+ new PrimitiveTypeCode(TCKind.tk_except),
+ new PrimitiveTypeCode(TCKind.tk_longlong),
+ new PrimitiveTypeCode(TCKind.tk_ulonglong),
+ new PrimitiveTypeCode(TCKind.tk_longdouble),
+ new PrimitiveTypeCode(TCKind.tk_wchar),
+ new PrimitiveTypeCode(TCKind.tk_wstring),
+ new PrimitiveTypeCode(TCKind.tk_fixed),
+ new PrimitiveTypeCode(TCKind.tk_value),
+ new PrimitiveTypeCode(TCKind.tk_value_box),
+ new PrimitiveTypeCode(TCKind.tk_native),
+ new PrimitiveTypeCode(TCKind.tk_abstract_interface)
};
static
{
// The Id of the "abstract object" is defined as empty string.
- recordTypeCode object =
- (recordTypeCode) primitveCodes [ TCKind._tk_objref ];
+ RecordTypeCode object =
+ (RecordTypeCode) primitveCodes [ TCKind._tk_objref ];
object.setId("");
object.setName("Object");
}
diff --git a/libjava/classpath/gnu/CORBA/Version.java b/libjava/classpath/gnu/CORBA/Version.java
index 84f40bf4f39..efc27c22081 100644
--- a/libjava/classpath/gnu/CORBA/Version.java
+++ b/libjava/classpath/gnu/CORBA/Version.java
@@ -70,8 +70,8 @@ public class Version
/**
* Create the version with the given version numbers.
*
- * @param major major number (0..255)
- * @param minor minor number (0..255)
+ * @param _major major number (0..255)
+ * @param _minor minor number (0..255)
*/
public Version(int _major, int _minor)
{
@@ -99,6 +99,15 @@ public class Version
Version that = (Version) other;
return same(that);
}
+
+ /**
+ * Get the hashcode, higher 8 bits being the major version and lower 8 bits
+ * the minor version.
+ */
+ public int hashCode()
+ {
+ return major << 8 | minor;
+ }
/**
* Read from the input stream, major number first.
@@ -114,7 +123,10 @@ public class Version
}
catch (IOException ex)
{
- throw new MARSHAL("IOException while reading message header");
+ MARSHAL m = new MARSHAL("IOException while reading message header");
+ m.initCause(ex);
+ m.minor = Minor.Header;
+ throw m;
}
}
@@ -166,7 +178,7 @@ public class Version
* Returs true if the given version is lower or equal to the
* version, specified by the provided minor and major version
* number. This means, the version, specified by these two numbers,
- * should be supported by teh current version.
+ * should be supported by the current version.
*
* @param a_major a major version number.
* @param a_minor a minor version number.
@@ -200,7 +212,11 @@ public class Version
}
catch (IOException ex)
{
- throw new MARSHAL("IOException while writing message header");
+ MARSHAL m = new MARSHAL("IOException while writing message header");
+ m.minor = Minor.Header;
+ m.initCause(ex);
+ throw m;
}
}
+
}
diff --git a/libjava/classpath/gnu/CORBA/WCharHolder.java b/libjava/classpath/gnu/CORBA/WCharHolder.java
index 23f0ad100f9..3c6a87fbe2d 100644
--- a/libjava/classpath/gnu/CORBA/WCharHolder.java
+++ b/libjava/classpath/gnu/CORBA/WCharHolder.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
@@ -61,7 +63,7 @@ public final class WCharHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_char = new primitiveTypeCode(TCKind.tk_wchar);
+ private static final TypeCode t_char = new PrimitiveTypeCode(TCKind.tk_wchar);
/**
* The <code>char</code> (CORBA <code>wchar</code>) value,
diff --git a/libjava/classpath/gnu/CORBA/WStringHolder.java b/libjava/classpath/gnu/CORBA/WStringHolder.java
index c9e8e33234d..7f18791dfee 100644
--- a/libjava/classpath/gnu/CORBA/WStringHolder.java
+++ b/libjava/classpath/gnu/CORBA/WStringHolder.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.StringTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
@@ -62,8 +64,8 @@ public class WStringHolder
/**
* The default type code for this holder.
*/
- private static final stringTypeCode t_string =
- new stringTypeCode(TCKind.tk_wstring);
+ private static final StringTypeCode t_string =
+ new StringTypeCode(TCKind.tk_wstring);
/**
* The <code>String</code> (CORBA <code>string</code>) value,
diff --git a/libjava/classpath/gnu/CORBA/_PolicyImplBase.java b/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
index d9ff9d648ad..17a5f4a40e5 100644
--- a/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
+++ b/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
@@ -165,7 +165,8 @@ public abstract class _PolicyImplBase
output.write_long(policyCode);
}
else
- throw new BAD_OPERATION(method, 0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(method, Minor.Method,
+ CompletionStatus.COMPLETED_MAYBE);
return output;
}
diff --git a/libjava/classpath/gnu/CORBA/gnuAny.java b/libjava/classpath/gnu/CORBA/gnuAny.java
index 7e5ef335149..729386da2c4 100644
--- a/libjava/classpath/gnu/CORBA/gnuAny.java
+++ b/libjava/classpath/gnu/CORBA/gnuAny.java
@@ -39,8 +39,10 @@ exception statement from your version. */
package gnu.CORBA;
import gnu.CORBA.CDR.Vio;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.AnyHolder;
@@ -62,19 +64,14 @@ import org.omg.CORBA.StringHolder;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodeHolder;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.ValueBaseHolder;
-import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.Streamable;
-import java.io.IOException;
import java.io.Serializable;
-
import java.lang.reflect.Field;
-
import java.math.BigDecimal;
-
import java.util.Arrays;
+import java.util.zip.Adler32;
/**
* The implementation of {@link Any}.
@@ -93,12 +90,17 @@ import java.util.Arrays;
public class gnuAny
extends Any
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The value, returned by {@link #type()} if the value has been
* not intialized.
*/
protected static final TypeCode nullType =
- new primitiveTypeCode(TCKind.tk_null);
+ new PrimitiveTypeCode(TCKind.tk_null);
/**
* The Streamable, representing the value, held by this gnuAny.
@@ -137,11 +139,11 @@ public class gnuAny
*/
public gnuAny Clone()
{
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
out.setOrb(orb);
out.write_any(this);
- cdrBufInput in = new cdrBufInput(out.buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(out.buffer.toByteArray());
in.setOrb(orb);
return (gnuAny) in.read_any();
}
@@ -152,18 +154,18 @@ public class gnuAny
*/
public org.omg.CORBA.portable.InputStream create_input_stream()
{
- if (has instanceof universalHolder)
+ if (has instanceof GeneralHolder)
{
- universalHolder u = (universalHolder) has;
+ GeneralHolder u = (GeneralHolder) has;
return u.getInputStream();
}
else
{
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
out.setOrb(orb);
write_value(out);
- cdrBufInput in = new cdrBufInput(out.buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(out.buffer.toByteArray());
in.setOrb(orb);
return in;
}
@@ -174,7 +176,7 @@ public class gnuAny
*/
public org.omg.CORBA.portable.OutputStream create_output_stream()
{
- cdrBufOutput stream = new cdrBufOutput();
+ BufferedCdrOutput stream = new BufferedCdrOutput();
stream.setOrb(orb);
return stream;
}
@@ -194,11 +196,11 @@ public class gnuAny
if (has.equals(((gnuAny) other).has))
return true;
- cdrBufOutput a = new cdrBufOutput();
+ BufferedCdrOutput a = new BufferedCdrOutput();
a.setOrb(orb);
write_value(a);
- cdrBufOutput b = new cdrBufOutput();
+ BufferedCdrOutput b = new BufferedCdrOutput();
b.setOrb(orb);
other.write_value(b);
@@ -207,6 +209,28 @@ public class gnuAny
return Arrays.equals(ba, bb);
}
+
+ /**
+ * Get the content - dependent hashcode.
+ */
+ public int hashCode()
+ {
+ if (has == null)
+ return type().kind().value();
+ else
+ {
+ Adler32 adler = new Adler32();
+
+ BufferedCdrOutput a = new BufferedCdrOutput();
+ a.setOrb(orb);
+ write_value(a);
+
+ adler.update(a.buffer.toByteArray());
+ adler.update(type().kind().value());
+
+ return (int) adler.getValue() & Integer.MAX_VALUE;
+ }
+ }
/**
* Delegates functionality to {@link #equal(Any)}.
@@ -232,7 +256,10 @@ public class gnuAny
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
@@ -297,7 +324,10 @@ public class gnuAny
}
catch (Exception ex)
{
- return new BAD_OPERATION("Value type expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Value type expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
}
}
@@ -664,7 +694,7 @@ public class gnuAny
else
has = new StringHolder(x);
- typecode = new stringTypeCode(TCKind.tk_string);
+ typecode = new StringTypeCode(TCKind.tk_string);
}
/** {@inheritDoc} */
@@ -751,40 +781,27 @@ public class gnuAny
}
else
{
- has = holderFactory.createHolder(a_type);
+ has = HolderLocator.createHolder(a_type);
if (has == null)
{
// Use the Universal Holder that reads till the end of stream.
// This works with the extract/insert pair of the typical
// Helper.
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
buffer.setOrb(orb);
- has = new universalHolder(buffer);
+ has = new GeneralHolder(buffer);
}
}
type(a_type);
- if (!(has instanceof universalHolder) &&
+ if (!(has instanceof GeneralHolder) &&
(kind == TCKind._tk_value_box))
{
// The streamable only contains operations for
// reading the value, not the value header.
Field vField = has.getClass().getField("value");
- BoxedValueHelper helper;
-
- try
- {
- Class helperClass =
- Class.forName(ObjectCreator.toHelperName(a_type.id()));
- helper = (BoxedValueHelper) helperClass.newInstance();
- }
- catch (Exception ex)
- {
- helper = null;
- }
-
- Object content = Vio.read(input, helper);
+ Object content = Vio.read(input, a_type.id());
vField.set(has, content);
}
else
@@ -793,6 +810,7 @@ public class gnuAny
catch (Exception ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Any;
m.initCause(ex);
throw m;
}
@@ -805,7 +823,7 @@ public class gnuAny
return typecode;
else if (xKind >= 0)
{
- typecode = new primitiveTypeCode(TCKind.from_int(xKind));
+ typecode = new PrimitiveTypeCode(TCKind.from_int(xKind));
return typecode;
}
else
@@ -838,38 +856,43 @@ public class gnuAny
/**
* Check if the current value if the value of the given kind.
+ *
* @param kind a kind to check.
* @throws BAD_OPERATION if the value is not set of is different kind.
*/
protected void check(int kind)
- throws BAD_OPERATION
+ throws BAD_OPERATION
{
if (has == null)
- throw new BAD_OPERATION("value not set");
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("value not set");
+ bad.minor = Minor.Any;
+ throw bad;
+ }
if (xKind >= 0)
{
if (xKind != kind)
- if (!(
- xKind == TCKind._tk_alias &&
- has._type().kind().value() == kind
- )
- )
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " when stored " + typeNamer.nameIt(xKind)
- );
+ if (!(xKind == TCKind._tk_alias && has._type().kind().value() == kind))
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("Extracting "
+ + TypeKindNamer.nameIt(kind) + " when stored "
+ + TypeKindNamer.nameIt(xKind));
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
else
{
if (type().kind().value() != kind)
- if (!(
- type().kind().value() == TCKind._tk_alias &&
- has._type().kind().value() == kind
- )
- )
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " stored " + typeNamer.nameIt(type())
- );
+ if (!(type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind))
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("Extracting "
+ + TypeKindNamer.nameIt(kind) + " stored "
+ + TypeKindNamer.nameIt(type()));
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
}
diff --git a/libjava/classpath/gnu/CORBA/gnuCodecFactory.java b/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
index 067de498c79..8cf9ccf7bc4 100644
--- a/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
+++ b/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
@@ -83,7 +83,7 @@ public class gnuCodecFactory extends LocalObject implements CodecFactory
"supported by this factory."
);
- return new cdrEncapsCodec(orb,
+ return new CdrEncapsCodecImpl(orb,
new Version(for_encoding.major_version, for_encoding.minor_version)
);
}
diff --git a/libjava/classpath/gnu/CORBA/gnuContextList.java b/libjava/classpath/gnu/CORBA/gnuContextList.java
index 2a26437debe..68584c3891c 100644
--- a/libjava/classpath/gnu/CORBA/gnuContextList.java
+++ b/libjava/classpath/gnu/CORBA/gnuContextList.java
@@ -53,7 +53,7 @@ public class gnuContextList
/**
* The collection, holding the actual list of strings.
*/
- corbaArrayList strings = new corbaArrayList();
+ CorbaList strings = new CorbaList();
/** {@inheritDoc} */
public void add(String name)
diff --git a/libjava/classpath/gnu/CORBA/gnuExceptionList.java b/libjava/classpath/gnu/CORBA/gnuExceptionList.java
index b684ec928cf..5f0c0c9f50d 100644
--- a/libjava/classpath/gnu/CORBA/gnuExceptionList.java
+++ b/libjava/classpath/gnu/CORBA/gnuExceptionList.java
@@ -54,7 +54,7 @@ public class gnuExceptionList
/**
* A list to store the objects.
*/
- protected corbaArrayList list = new corbaArrayList();
+ protected CorbaList list = new CorbaList();
/** {@inheritDoc} */
public void add(TypeCode an_exception)
diff --git a/libjava/classpath/gnu/CORBA/gnuNVList.java b/libjava/classpath/gnu/CORBA/gnuNVList.java
index e436c332caa..3645a3e8dd2 100644
--- a/libjava/classpath/gnu/CORBA/gnuNVList.java
+++ b/libjava/classpath/gnu/CORBA/gnuNVList.java
@@ -53,14 +53,14 @@ public class gnuNVList
/**
* The list of the named values.
*/
- protected corbaArrayList list;
+ protected CorbaList list;
/**
* Creates the list with the default initial size.
*/
public gnuNVList()
{
- list = new corbaArrayList();
+ list = new CorbaList();
}
/**
@@ -68,7 +68,7 @@ public class gnuNVList
*/
public gnuNVList(int initial_size)
{
- list = new corbaArrayList(initial_size);
+ list = new CorbaList(initial_size);
}
/** {@inheritDoc} */
diff --git a/libjava/classpath/gnu/CORBA/gnuRequest.java b/libjava/classpath/gnu/CORBA/gnuRequest.java
index 7d756eddba3..5adf7412926 100644
--- a/libjava/classpath/gnu/CORBA/gnuRequest.java
+++ b/libjava/classpath/gnu/CORBA/gnuRequest.java
@@ -38,12 +38,12 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import gnu.CORBA.Interceptor.gnuClientRequestInfo;
import gnu.CORBA.Poa.ORB_1_4;
@@ -54,6 +54,7 @@ import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.Bounds;
+import org.omg.CORBA.COMM_FAILURE;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
@@ -134,8 +135,8 @@ public class gnuRequest extends Request implements Cloneable
/**
* The empty byte array.
*/
- private static final binaryReply EMPTY =
- new binaryReply(null, new MessageHeader(), new byte[ 0 ]);
+ private static final RawReply EMPTY =
+ new RawReply(null, new MessageHeader(), new byte[ 0 ]);
/**
* The context holder for methods ctx(Context) and ctx().
@@ -222,7 +223,7 @@ public class gnuRequest extends Request implements Cloneable
* The request arguments in the case when they are directly written into the
* parameter buffer.
*/
- protected streamRequest m_parameter_buffer;
+ protected StreamBasedRequest m_parameter_buffer;
/**
* The array of slots.
@@ -294,8 +295,8 @@ public class gnuRequest extends Request implements Cloneable
orb = an_orb;
// Take the interceptor from the ORB.
- if (orb instanceof Restricted_ORB)
- m_interceptor = ((Restricted_ORB) orb).iClient;
+ if (orb instanceof OrbRestricted)
+ m_interceptor = ((OrbRestricted) orb).iClient;
if (m_interceptor != null && orb instanceof ORB_1_4)
{
@@ -332,12 +333,12 @@ public class gnuRequest extends Request implements Cloneable
* Get the parameter stream, where the invocation arguments should be written
* if they are written into the stream directly.
*/
- public streamRequest getParameterStream()
+ public StreamBasedRequest getParameterStream()
{
- m_parameter_buffer = new streamRequest();
+ m_parameter_buffer = new StreamBasedRequest();
m_parameter_buffer.request = this;
m_parameter_buffer.setVersion(ior.Internet.version);
- m_parameter_buffer.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));
+ m_parameter_buffer.setCodeSet(CodeSetServiceContext.negotiate(ior.Internet.CodeSets));
m_parameter_buffer.setOrb(orb);
m_parameter_buffer.setBigEndian(Big_endian);
@@ -345,7 +346,7 @@ public class gnuRequest extends Request implements Cloneable
// correctly.
if (ior.Internet.version.until_inclusive(1, 1))
{
- cdrBufOutput measure = new cdrBufOutput();
+ BufferedCdrOutput measure = new BufferedCdrOutput();
measure.setOffset(12);
if (m_rqh == null)
m_rqh = new gnu.CORBA.GIOP.v1_0.RequestHeader();
@@ -513,8 +514,8 @@ public class gnuRequest extends Request implements Cloneable
try
{
ObjectImpl impl = (ObjectImpl) e.forward;
- Simple_delegate delegate =
- (Simple_delegate) impl._get_delegate();
+ SimpleDelegate delegate =
+ (SimpleDelegate) impl._get_delegate();
ior = delegate.getIor();
}
catch (Exception ex)
@@ -714,14 +715,15 @@ public class gnuRequest extends Request implements Cloneable
/**
* Do the actual invocation. This implementation requires to set the IOR
* property ({@link #setIOR(IOR)} before calling this method.
- *
+ *
* @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously set
* or if the direct argument addition is mixed with the direct argument
* writing into the output stream.
- *
+ *
* @return the server response in binary form.
*/
- public synchronized binaryReply submit() throws ForwardRequest
+ public synchronized RawReply submit()
+ throws ForwardRequest
{
gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();
@@ -742,26 +744,25 @@ public class gnuRequest extends Request implements Cloneable
m_interceptor.send_request(m_info);
// Prepare the submission.
- cdrBufOutput request_part = new cdrBufOutput();
+ BufferedCdrOutput request_part = new BufferedCdrOutput();
request_part.setOffset(header.getHeaderSize());
request_part.setVersion(header.version);
- request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));
+ request_part.setCodeSet(CodeSetServiceContext.negotiate(ior.Internet.CodeSets));
request_part.setOrb(orb);
request_part.setBigEndian(header.isBigEndian());
// This also sets the stream encoding to the encoding, specified
// in the header.
rh.write(request_part);
-
+
if (m_args != null && m_args.count() > 0)
{
write_parameters(header, request_part);
if (m_parameter_buffer != null)
- throw new BAD_INV_ORDER("Please either add parameters or " +
- "write them into stream, but not both " + "at once."
- );
+ throw new BAD_INV_ORDER("Please either add parameters or "
+ + "write them into stream, but not both " + "at once.");
}
if (m_parameter_buffer != null)
@@ -789,12 +790,15 @@ public class gnuRequest extends Request implements Cloneable
{
// The BindException 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++)
+ Open: for (int i = 0; i < PAUSE_STEPS; i++)
{
try
{
- socket = new Socket(ior.Internet.host, ior.Internet.port);
+ if (orb instanceof OrbFunctional)
+ 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)
@@ -816,9 +820,8 @@ public class gnuRequest extends Request implements Cloneable
}
if (socket == null)
- throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port +
- " in use"
- );
+ throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port
+ + " in use");
socket.setKeepAlive(true);
OutputStream socketOutput = socket.getOutputStream();
@@ -836,25 +839,26 @@ public class gnuRequest extends Request implements Cloneable
InputStream socketInput = socket.getInputStream();
response_header.read(socketInput);
- byte[] r = new byte[ response_header.message_size ];
- int n = 0;
- reading:
- while (n < r.length)
+ byte[] r;
+ if (orb instanceof OrbFunctional)
{
- n += socketInput.read(r, n, r.length - n);
+ OrbFunctional fo = (OrbFunctional) orb;
+ r = response_header.readMessage(socketInput, socket,
+ fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING);
}
- return new binaryReply(orb, response_header, r);
+ else
+ r = response_header.readMessage(socketInput, null, 0, 0);
+
+ return new RawReply(orb, response_header, r);
}
else
return EMPTY;
}
catch (IOException io_ex)
{
- MARSHAL m =
- new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" +
- ior.Internet.port, 10000 + ior.Internet.port,
- CompletionStatus.COMPLETED_NO
- );
+ COMM_FAILURE m = new COMM_FAILURE("Unable to open a socket at "
+ + ior.Internet.host + ":" + ior.Internet.port, 0xC9,
+ CompletionStatus.COMPLETED_NO);
m.initCause(io_ex);
throw m;
}
@@ -864,7 +868,7 @@ public class gnuRequest extends Request implements Cloneable
{
if (socket != null && !socket.isClosed())
{
- socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS);
+ socket.setSoTimeout(OrbFunctional.TANDEM_REQUESTS);
SocketRepository.put_socket(key, socket);
}
}
@@ -929,14 +933,15 @@ public class gnuRequest extends Request implements Cloneable
* Do actual invocation. This method recursively calls itself if the
* redirection is detected.
*/
- private void p_invoke() throws SystemException, ForwardRequest
+ private void p_invoke()
+ throws SystemException, ForwardRequest
{
- binaryReply response = submit();
+ RawReply response = submit();
if (m_rph == null)
m_rph = response.header.create_reply_header();
- cdrBufInput input = response.getStream();
+ BufferredCdrInput input = response.getStream();
input.setOrb(orb);
m_rph.read(input);
@@ -946,7 +951,7 @@ public class gnuRequest extends Request implements Cloneable
switch (m_rph.reply_status)
{
- case ReplyHeader.NO_EXCEPTION :
+ case ReplyHeader.NO_EXCEPTION:
NamedValue arg;
@@ -992,7 +997,7 @@ public class gnuRequest extends Request implements Cloneable
break;
- case ReplyHeader.SYSTEM_EXCEPTION :
+ case ReplyHeader.SYSTEM_EXCEPTION:
if (align)
{
input.align(8);
@@ -1000,7 +1005,8 @@ public class gnuRequest extends Request implements Cloneable
}
readExceptionId(input);
- m_sys_ex = ObjectCreator.readSystemException(input);
+ m_sys_ex = ObjectCreator.readSystemException(input,
+ m_rph.service_context);
m_environment.exception(m_sys_ex);
if (m_interceptor != null)
@@ -1008,7 +1014,7 @@ public class gnuRequest extends Request implements Cloneable
throw m_sys_ex;
- case ReplyHeader.USER_EXCEPTION :
+ case ReplyHeader.USER_EXCEPTION:
if (align)
{
input.align(8);
@@ -1020,7 +1026,7 @@ public class gnuRequest extends Request implements Cloneable
gnuAny exc = new gnuAny();
exc.setOrb(orb);
- exc.insert_Streamable(new streamReadyHolder(input));
+ exc.insert_Streamable(new StreamHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
@@ -1030,8 +1036,8 @@ public class gnuRequest extends Request implements Cloneable
break;
- case ReplyHeader.LOCATION_FORWARD_PERM :
- case ReplyHeader.LOCATION_FORWARD :
+ case ReplyHeader.LOCATION_FORWARD_PERM:
+ case ReplyHeader.LOCATION_FORWARD:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
@@ -1043,8 +1049,7 @@ public class gnuRequest extends Request implements Cloneable
catch (IOException ex)
{
new MARSHAL("Cant read forwarding info", 5103,
- CompletionStatus.COMPLETED_NO
- );
+ CompletionStatus.COMPLETED_NO);
}
setIor(forwarded);
@@ -1058,17 +1063,16 @@ public class gnuRequest extends Request implements Cloneable
p_invoke();
return;
- default :
+ default:
throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status,
- CompletionStatus.COMPLETED_NO
- );
+ CompletionStatus.COMPLETED_NO);
}
}
/**
* Read exception id without changing the stream pointer position.
*/
- void readExceptionId(cdrBufInput input)
+ void readExceptionId(BufferredCdrInput input)
{
input.mark(2048);
m_exception_id = input.read_string();
@@ -1084,7 +1088,7 @@ public class gnuRequest extends Request implements Cloneable
* @throws MARSHAL if the attempt to write the parameters has failde.
*/
protected void write_parameter_buffer(MessageHeader header,
- cdrBufOutput request_part
+ BufferedCdrOutput request_part
) throws MARSHAL
{
try
@@ -1097,7 +1101,9 @@ public class gnuRequest extends Request implements Cloneable
}
catch (IOException ex)
{
- throw new MARSHAL("Unable to write method arguments to CDR output.");
+ MARSHAL m = new MARSHAL("Unable to write method arguments to CDR output.");
+ m.minor = Minor.CDR;
+ throw m;
}
}
@@ -1110,7 +1116,7 @@ public class gnuRequest extends Request implements Cloneable
* @throws MARSHAL if the attempt to write the parameters has failde.
*/
protected void write_parameters(MessageHeader header,
- cdrBufOutput request_part
+ BufferedCdrOutput request_part
) throws MARSHAL
{
// Align after 1.2, but only once.
@@ -1161,7 +1167,7 @@ public class gnuRequest extends Request implements Cloneable
*/
public TaggedProfile effective_profile()
{
- cdrBufOutput buf = new cdrBufOutput(512);
+ BufferedCdrOutput buf = new BufferedCdrOutput(512);
buf.setOrb(orb);
ior.Internet.write(buf);
@@ -1176,7 +1182,7 @@ public class gnuRequest extends Request implements Cloneable
*/
public org.omg.CORBA.Object effective_target()
{
- return new IOR_contructed_object(orb, ior);
+ return new IorObject(orb, ior);
}
/**
@@ -1188,7 +1194,7 @@ public class gnuRequest extends Request implements Cloneable
if (id == TAG_CODE_SETS.value)
{
// Codesets are encoded separately.
- cdrBufOutput buf = new cdrBufOutput(512);
+ BufferedCdrOutput buf = new BufferedCdrOutput(512);
buf.setOrb(orb);
ior.Internet.CodeSets.write(buf);
@@ -1289,7 +1295,7 @@ public class gnuRequest extends Request implements Cloneable
return m_forwarding_target;
if (m_forward_ior != null)
- return new IOR_contructed_object(orb, m_forward_ior);
+ return new IorObject(orb, m_forward_ior);
else
return null;
}
diff --git a/libjava/classpath/gnu/CORBA/gnuValueHolder.java b/libjava/classpath/gnu/CORBA/gnuValueHolder.java
index 0b382648981..8263113ec2a 100644
--- a/libjava/classpath/gnu/CORBA/gnuValueHolder.java
+++ b/libjava/classpath/gnu/CORBA/gnuValueHolder.java
@@ -123,7 +123,7 @@ public class gnuValueHolder
try
{
Class helperClass =
- Class.forName(ObjectCreator.toHelperName(type.id()));
+ ObjectCreator.forName(ObjectCreator.toHelperName(type.id()));
helper = (BoxedValueHelper) helperClass.newInstance();
}
diff --git a/libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java b/libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java
new file mode 100644
index 00000000000..7797dcbf917
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java
@@ -0,0 +1,95 @@
+/* SocketFactory.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.interfaces;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * This class produces sockets for serving and submitting CORBA requests. The
+ * socket factory can be set using {@link gnuOrb.setSocketFactory()} for
+ * producting all sockets for that ORB. This is needed for using secure sockets,
+ * for implementing the desired timeout policies, for HTTP tunnels and in some
+ * other similar cases. While such functionality is provided by near all
+ * existing CORBA implementations, no standard mechanism is defined.
+ *
+ * The socket factory may need to put additional information to the IORs of the
+ * objects, released by the ORB. Because of this reason, this interface extends
+ * IORInterceptorOperations.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface SocketFactory
+{
+ /**
+ * The name of the ORB property that forces the ORB to use the socket
+ * factory class, the name of that (String) is the value of this property.
+ */
+ final String PROPERTY = "gnu.CORBA.SocketFactory";
+
+ /**
+ * Create a server socket that should serve remote invocations on the given
+ * port. The ORB may use this socket to serve either one or more objects.
+ *
+ * @param port the port, on that the socket should be listening for requests.
+ * The port policy can be controlled by {@link gnuPortManager}.
+ *
+ * @throws IOException if the socket cannot be created on the given port due
+ * any reasons. The ORB may try to open the socket on another port, calling
+ * this method with the different parameter.
+ */
+ ServerSocket createServerSocket(int port)
+ throws IOException;
+
+ /**
+ * Create a client socket that should send a request to the remote side. When
+ * returned, the socket should be opened and ready to communicate.
+ *
+ * @param port the port, on that the socket should be openend. The port is
+ * usually part of the internet profile.
+ *
+ * @throws IOException if the socket cannot be created on the given port due
+ * any reasons. The ORB may try to open the socket on another port, calling
+ * this method with the different parameter.
+ */
+ Socket createClientSocket(String host, int port)
+ throws IOException;
+
+}
diff --git a/libjava/classpath/gnu/CORBA/interfaces/package.html b/libjava/classpath/gnu/CORBA/interfaces/package.html
new file mode 100644
index 00000000000..101475b2da1
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/interfaces/package.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html -
+ 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.CORBA.interfaces</title></head>
+
+<body>
+<p>This package contains Classpath specific interfaces that
+the user program may be forced to use in cases when no
+other, better solution of the problem is available. The
+existing classes and methods in this package should not
+be removed without the real need</p>
+</body>
+</html>
diff --git a/libjava/classpath/gnu/CORBA/aliasTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java
index 88466310142..3cb8ebfb393 100644
--- a/libjava/classpath/gnu/CORBA/aliasTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java
@@ -1,4 +1,4 @@
-/* aliasTypeCode.java --
+/* AliasTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
@@ -47,9 +48,14 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class aliasTypeCode
- extends primitiveTypeCode
+public class AliasTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The typecode repository id.
*/
@@ -76,7 +82,7 @@ public class aliasTypeCode
*
* @param a_name the name of the newly created typecode.
*/
- public aliasTypeCode(TypeCode an_aliasFor, String an_id, String a_name)
+ public AliasTypeCode(TypeCode an_aliasFor, String an_id, String a_name)
{
super(TCKind.tk_alias);
aliasFor = an_aliasFor;
diff --git a/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java
index fc020bed788..bb798101a99 100644
--- a/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java
@@ -1,4 +1,4 @@
-/* primitiveArrayTypeCode.java --
+/* ArrayTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
@@ -46,9 +47,15 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
* A TypeCode for arrays.
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class primitiveArrayTypeCode
- extends primitiveTypeCode
+public class ArrayTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+
/**
* The array components.
*/
@@ -67,10 +74,10 @@ public class primitiveArrayTypeCode
*
* @param array_of the sequence member type.
*/
- public primitiveArrayTypeCode(TCKind array_of)
+ public ArrayTypeCode(TCKind array_of)
{
super(TCKind.tk_sequence);
- of = new primitiveTypeCode(array_of);
+ of = new PrimitiveTypeCode(array_of);
}
/**
@@ -81,7 +88,7 @@ public class primitiveArrayTypeCode
* sequence of array).
* @param array_of the sequence member type.
*/
- public primitiveArrayTypeCode(TCKind this_type, TypeCode array_of)
+ public ArrayTypeCode(TCKind this_type, TypeCode array_of)
{
super(this_type);
of = array_of;
diff --git a/libjava/classpath/gnu/CORBA/fixedTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
index eb610417b29..c5fae63bd28 100644
--- a/libjava/classpath/gnu/CORBA/fixedTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
@@ -1,4 +1,4 @@
-/* fixedTypeCode.java --
+/* FixedTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import java.math.BigDecimal;
@@ -48,9 +49,15 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
* A typecode for CORBA <code>fixed</code>
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class fixedTypeCode
- extends primitiveTypeCode
+public class FixedTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+
/**
* The number of the used digits.
*/
@@ -64,7 +71,7 @@ public class fixedTypeCode
/**
* Creates the instance of the fixed type code.
*/
- public fixedTypeCode()
+ public FixedTypeCode()
{
super(TCKind.tk_fixed);
}
@@ -73,7 +80,7 @@ public class fixedTypeCode
* Creates the instance of the fixed type code,
* setting the digits and scale by example.
*/
- public fixedTypeCode(BigDecimal example)
+ public FixedTypeCode(BigDecimal example)
{
super(TCKind.tk_fixed);
if (example != null)
diff --git a/libjava/classpath/gnu/CORBA/generalTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java
index 3b7914878c3..0a907844ad9 100644
--- a/libjava/classpath/gnu/CORBA/generalTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java
@@ -1,4 +1,4 @@
-/* generalTypeCode.java --
+/* GeneralTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,9 +36,9 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import java.util.Arrays;
import java.util.BitSet;
@@ -56,9 +56,15 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class generalTypeCode
- extends primitiveTypeCode
+public class GeneralTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+
/**
* Indicates that the field value has not been previously set.
*/
@@ -87,21 +93,21 @@ public class generalTypeCode
/**
* Create a new instance, setting kind to the given kind.
- * @param kind
+ * @param a_kind the kind of the typecode being created.
*/
- public generalTypeCode(TCKind kind)
+ public GeneralTypeCode(TCKind a_kind)
{
- super(kind);
- if (!lengthAllowed.get(kind.value()))
+ super(a_kind);
+ if (!lengthAllowed.get(a_kind.value()))
len = UNSET;
}
/**
* Set this property.
*/
- public void setConcreteBase_type(TypeCode concrete_base_type)
+ public void setConcreteBase_type(TypeCode a_concrete_base_type)
{
- this.concrete_base_type = concrete_base_type;
+ this.concrete_base_type = a_concrete_base_type;
}
/**
@@ -115,9 +121,9 @@ public class generalTypeCode
/**
* Set this property.
*/
- public void setId(String id)
+ public void setId(String an_id)
{
- this.id = id;
+ this.id = an_id;
}
/**
@@ -132,9 +138,9 @@ public class generalTypeCode
/**
* Set this property.
*/
- public void setName(String name)
+ public void setName(String a_name)
{
- this.name = name;
+ this.name = a_name;
}
/**
@@ -179,8 +185,8 @@ public class generalTypeCode
if (kind() != other.kind())
return false;
- cdrBufOutput a = new cdrBufOutput(16);
- cdrBufOutput b = new cdrBufOutput(16);
+ BufferedCdrOutput a = new BufferedCdrOutput(16);
+ BufferedCdrOutput b = new BufferedCdrOutput(16);
a.write_TypeCode(this);
b.write_TypeCode(other);
diff --git a/libjava/classpath/gnu/CORBA/primitiveTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java
index 4bf97d0230b..22d39a82c97 100644
--- a/libjava/classpath/gnu/CORBA/primitiveTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java
@@ -1,4 +1,4 @@
-/* primitiveTypeCode.java --
+/* PrimitiveTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005 Free Software Foundation, Inc.
@@ -37,17 +37,17 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
import java.io.Serializable;
import org.omg.CORBA.Any;
-import org.omg.CORBA.IDLEntity;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.IDLEntity;
/**
* An information about a primitive CORBA data type
@@ -60,16 +60,21 @@ import org.omg.CORBA.TypeCodePackage.Bounds;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class primitiveTypeCode
+public class PrimitiveTypeCode
extends TypeCode
implements IDLEntity, Serializable
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The kind of this TypeCode.
*/
protected final TCKind kind;
- public primitiveTypeCode(TCKind a_kind)
+ public PrimitiveTypeCode(TCKind a_kind)
{
kind = a_kind;
}
diff --git a/libjava/classpath/gnu/CORBA/recordTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java
index 8f2ecde7d1a..89f3425465b 100644
--- a/libjava/classpath/gnu/CORBA/recordTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java
@@ -1,4 +1,4 @@
-/* recordTypeCode.java --
+/* RecordTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,9 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
+import gnu.CORBA.CorbaList;
import org.omg.CORBA.Any;
import org.omg.CORBA.StructMember;
@@ -53,9 +55,14 @@ import org.omg.CORBA.ValueMember;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class recordTypeCode
- extends generalTypeCode
+public class RecordTypeCode
+ extends GeneralTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The individual field of the record.
*/
@@ -85,16 +92,16 @@ public class recordTypeCode
/**
* The members of this data structure.
*/
- protected corbaArrayList members = new corbaArrayList();
+ protected CorbaList members = new CorbaList();
private TypeCode discriminator_type;
private int default_index = UNSET;
/**
* Creates the type code of the given kind.
*/
- public recordTypeCode(TCKind kind)
+ public RecordTypeCode(TCKind a_kind)
{
- super(kind);
+ super(a_kind);
}
/**
diff --git a/libjava/classpath/gnu/CORBA/recursiveTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
index 6bc672e6e49..0e6ac375e50 100644
--- a/libjava/classpath/gnu/CORBA/recursiveTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
@@ -1,4 +1,4 @@
-/* recursiveTypeCode.java --
+/* RecursiveTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
@@ -44,9 +45,14 @@ import org.omg.CORBA.TCKind;
* The typecode, serving as a placeholder in defining
* typecodes, containing recursion.
*/
-public class recursiveTypeCode
- extends primitiveTypeCode
+public class RecursiveTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The id of the type for that this type serves as a
* placeholder.
@@ -60,7 +66,7 @@ public class recursiveTypeCode
* @param id the Id of the type for that this type serves as a
* placeholder.
*/
- public recursiveTypeCode(String an_id)
+ public RecursiveTypeCode(String an_id)
{
super(TCKind.tk_null);
the_id = an_id;
diff --git a/libjava/classpath/gnu/CORBA/stringTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java
index 27aa119f30e..2d1689b4560 100644
--- a/libjava/classpath/gnu/CORBA/stringTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java
@@ -1,4 +1,4 @@
-/* stringTypeCode.java --
+/* StringTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
@@ -44,9 +45,14 @@ import org.omg.CORBA.TCKind;
* The typecode for string and wide string.
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class stringTypeCode
- extends primitiveTypeCode
+public class StringTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
private int len = 0;
/**
@@ -55,7 +61,7 @@ public class stringTypeCode
* @param a_kind a kind of this typecode, normally
* either tk_string or tk_wstring.
*/
- public stringTypeCode(TCKind a_kind)
+ public StringTypeCode(TCKind a_kind)
{
super(a_kind);
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/package.html b/libjava/classpath/gnu/CORBA/typecodes/package.html
index 6aed0fc0169..891b3b96574 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/package.html
+++ b/libjava/classpath/gnu/CORBA/typecodes/package.html
@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- package.html - describes classes in gnu.java.net.protocol.http.event package.
+<!-- package.html
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,10 +37,12 @@ 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.java.net.protocol.http.event</title></head>
+<head><title>GNU Classpath - gnu.CORBA.typecodes</title></head>
<body>
-<p></p>
-
+ Contains GNU Classpath specific typecode definitions.
+
+ @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
</body>
</html>
+
diff --git a/libjava/classpath/gnu/classpath/ByteArray.java b/libjava/classpath/gnu/classpath/ByteArray.java
new file mode 100644
index 00000000000..6307b8abd79
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/ByteArray.java
@@ -0,0 +1,109 @@
+/* ByteArray.java -- wrapper around a byte array, with nice toString output.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public final class ByteArray
+{
+ private final byte[] value;
+
+ public ByteArray (final byte[] value)
+ {
+ this.value = value;
+ }
+
+ public byte[] getValue ()
+ {
+ return value;
+ }
+
+ public String toString ()
+ {
+ StringWriter str = new StringWriter ();
+ PrintWriter out = new PrintWriter (str);
+ int i = 0;
+ int len = value.length;
+ while (i < len)
+ {
+ out.print (formatInt (i, 16, 8));
+ out.print (" ");
+ int l = Math.min (16, len - i);
+ String s = toHexString (value, i, l, ' ');
+ out.print (s);
+ for (int j = 56 - (56 - s.length ()); j < 56; j++)
+ out.print (" ");
+ for (int j = 0; j < l; j++)
+ {
+ byte b = value[i+j];
+ if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E)
+ out.print (".");
+ else
+ out.print ((char) (b & 0xFF));
+ }
+ out.println ();
+ i += 16;
+ }
+ return str.toString ();
+ }
+
+ public static String toHexString (byte[] buf, int off, int len, char sep)
+ {
+ StringBuffer str = new StringBuffer();
+ for (int i = 0; i < len; i++)
+ {
+ str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16));
+ str.append (Character.forDigit (buf[i+off] & 0x0F, 16));
+ if (i < len - 1)
+ str.append(sep);
+ }
+ return str.toString();
+ }
+
+ public static String formatInt (int value, int radix, int len)
+ {
+ String s = Integer.toString (value, radix);
+ StringBuffer buf = new StringBuffer ();
+ for (int j = 0; j < len - s.length(); j++)
+ buf.append ("0");
+ buf.append (s);
+ return buf.toString();
+ }
+}
diff --git a/libjava/classpath/gnu/classpath/SystemProperties.java b/libjava/classpath/gnu/classpath/SystemProperties.java
index 600e1a6c159..524f04099aa 100644
--- a/libjava/classpath/gnu/classpath/SystemProperties.java
+++ b/libjava/classpath/gnu/classpath/SystemProperties.java
@@ -106,12 +106,6 @@ public class SystemProperties
if (defaultProperties.get("file.encoding") == null)
defaultProperties.put("file.encoding", "8859_1");
- // Default to the Swing FocusManager so that the old-style Swing API
- // for FocusManager can be supported without hardcoding it in AWT.
- if (defaultProperties.get("gnu.java.awt.FocusManager") == null)
- defaultProperties.put("gnu.java.awt.FocusManager",
- "gnu.java.awt.FocusManager");
-
// XXX FIXME - Temp hack for old systems that set the wrong property
if (defaultProperties.get("java.io.tmpdir") == null)
defaultProperties.put("java.io.tmpdir",
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
new file mode 100644
index 00000000000..b0d9b656562
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
@@ -0,0 +1,85 @@
+/* VmDeathEvent.java -- An event specifying that the VM has terminated
+ Copyright (C) 2005 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * Event notifying the debugger that the virtual machine has terminated.
+ *
+ * @author Keith Seitz (keiths@redhat.com)
+ */
+public class VmDeathEvent
+ extends Event
+{
+ /**
+ * Constructs a <code>VmDeathEvent</code> object
+ *
+ * @param thread the initial thread
+ */
+ public VmDeathEvent ()
+ {
+ super (JdwpConstants.EventKind.VM_DEATH);
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event.
+ * This event has no valid types.
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or <code>null</code>
+ */
+ public Object getParameter (Class type)
+ {
+ return null;
+ }
+
+ /**
+ * Writes out event-specific data
+ */
+ protected void _writeData (DataOutputStream outStream)
+ throws IOException
+ {
+ // no data (request ID done by VMIdManager)
+ }
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
index 75753cda095..d029e61e10d 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
@@ -66,7 +66,7 @@ public class StepFilter
public StepFilter (ThreadId tid, int size, int depth)
throws InvalidThreadException
{
- if (tid == null | tid.getReference().get () == null)
+ if (tid.getReference().get () == null)
throw new InvalidThreadException (tid.getId ());
_tid = tid;
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
index 039b4372125..83ad4094660 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
@@ -66,7 +66,7 @@ public class ThreadOnlyFilter
public ThreadOnlyFilter (ThreadId tid)
throws InvalidThreadException
{
- if (tid == null | tid.getReference().get () == null)
+ if (tid.getReference().get () == null)
throw new InvalidThreadException (tid.getId ());
_tid = tid;
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
index 24702166252..a9dc6cc815f 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
@@ -88,7 +88,8 @@ public class ArrayReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeLength(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
index 8ae1b450862..b77c3a833a2 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
@@ -82,7 +82,8 @@ public class ArrayTypeCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
public void executeNewInstance(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
index 4e8e23ede23..cc591b17dd1 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
@@ -86,7 +86,8 @@ public class ClassLoaderReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
public void executeVisibleClasses(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
index dcafa6f84d2..cfec20bc7ce 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
@@ -79,7 +79,8 @@ public class ClassObjectReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
public void executeReflectedType(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
index ff6010e59cb..f60da7b7021 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
@@ -95,7 +95,8 @@ public class ClassTypeCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeSuperclass(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
index 389b2d349f9..e4b1b602ef5 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
@@ -102,7 +102,8 @@ public class EventRequestCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeSet(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java
index b5db664e4e4..53308d7c11b 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java
@@ -94,7 +94,8 @@ public class MethodCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeLineTable(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
index 23a64c341e6..ef421ea5b28 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
@@ -106,7 +106,8 @@ public class ObjectReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeReferenceType(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
index b9944f7d9a0..7338480fcab 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
@@ -128,7 +128,8 @@ public class ReferenceTypeCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeSignature(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java
index 480f4ca2833..7890a8e4b1b 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java
@@ -91,7 +91,8 @@ public class StackFrameCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeGetValues(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
index 8f5bc685cda..13fde0ac732 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
@@ -84,7 +84,8 @@ public class StringReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeValue(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
index 8a11195a708..ba36251f665 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
@@ -85,7 +85,8 @@ public class ThreadGroupReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeName(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
index 73643b6a83a..559e405b65a 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
@@ -118,7 +118,8 @@ public class ThreadReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeName(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
index b83406873e3..6bdb236818c 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
@@ -67,7 +67,7 @@ public class VirtualMachineCommandSet
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
throws JdwpException
{
- boolean keepRunning = true;
+ boolean shutdown = false;
try
{
switch (command)
@@ -91,7 +91,7 @@ public class VirtualMachineCommandSet
executeIDsizes(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.DISPOSE:
- keepRunning = false;
+ shutdown = true;
executeDispose(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.SUSPEND:
@@ -101,7 +101,7 @@ public class VirtualMachineCommandSet
executeResume(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.EXIT:
- keepRunning = false;
+ shutdown = true;
executeExit(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.CREATE_STRING:
@@ -145,7 +145,8 @@ public class VirtualMachineCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return keepRunning;
+
+ return shutdown;
}
private void executeVersion(ByteBuffer bb, DataOutputStream os)
@@ -164,8 +165,8 @@ public class VirtualMachineCommandSet
String vmVersion = props.getProperty("java.version");
String vmName = props.getProperty("java.vm.name");
JdwpString.writeString(os, description);
- os.write(jdwpMajor);
- os.write(jdwpMinor);
+ os.writeInt(jdwpMajor);
+ os.writeInt(jdwpMinor);
JdwpString.writeString(os, vmName);
JdwpString.writeString(os, vmVersion);
}
diff --git a/libjava/classpath/gnu/java/awt/AWTUtilities.java b/libjava/classpath/gnu/java/awt/AWTUtilities.java
index af1fc13ca50..ca7b5511853 100644
--- a/libjava/classpath/gnu/java/awt/AWTUtilities.java
+++ b/libjava/classpath/gnu/java/awt/AWTUtilities.java
@@ -592,9 +592,12 @@ public class AWTUtilities
if (destination == null)
destination = getRoot(source);
-
- convertPointToScreen(pt, source);
- convertPointFromScreen(pt, destination);
+
+ if (source.isShowing() && destination.isShowing())
+ {
+ convertPointToScreen(pt, source);
+ convertPointFromScreen(pt, destination);
+ }
return pt;
}
diff --git a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
index 08b2140f443..99f90c9f85d 100644
--- a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
+++ b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
@@ -98,13 +98,11 @@ public class EmbeddedWindow extends Frame
}
catch (IllegalAccessException e)
{
- throw new RuntimeException
- ("couldn't set java.awt.Component.peer field");
+ throw new AssertionError (e);
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException
- ("couldn't set java.awt.Component.peer field");
+ throw new AssertionError (e);
}
super.addNotify();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java
index 7a439e83a9d..c79f403edfd 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java
@@ -1,5 +1,5 @@
/* GdkFontMetrics.java
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,15 +62,28 @@ public class GdkFontMetrics extends FontMetrics
static final int TEXT_METRICS_HEIGHT = 3;
static final int TEXT_METRICS_X_ADVANCE = 4;
static final int TEXT_METRICS_Y_ADVANCE = 5;
-
-
+
+ /**
+ * Makes sure to return a Font based on the given Font that has as
+ * peer a GdkFontPeer. Used in the initializer.
+ */
+ private static Font initFont(Font font)
+ {
+ if (font == null)
+ return new Font("Dialog", Font.PLAIN, 12);
+ else if (font.getPeer() instanceof GdkFontPeer)
+ return font;
+ else
+ {
+ ClasspathToolkit toolkit;
+ toolkit = (ClasspathToolkit) Toolkit.getDefaultToolkit();
+ return toolkit.getFont(font.getName(), font.getAttributes());
+ }
+ }
+
public GdkFontMetrics (Font font)
{
- super (font.getPeer() instanceof GdkFontPeer
- ? font
- : ((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
- .getFont (font.getName(), font.getAttributes ()));
-
+ super(initFont(font));
peer = (GdkFontPeer) this.font.getPeer();
font_metrics = new int[5];
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
index 160602b03bf..d80306c8a82 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
@@ -68,7 +68,7 @@ public class GdkGraphics extends Graphics
Color color, xorColor;
GtkComponentPeer component;
- Font font;
+ Font font = new Font ("Dialog", Font.PLAIN, 12);
Rectangle clip;
GtkImage image;
@@ -88,6 +88,8 @@ public class GdkGraphics extends Graphics
color = g.color;
xorColor = g.xorColor;
font = g.font;
+ if (font == null)
+ font = new Font ("Dialog", Font.PLAIN, 12);
clip = new Rectangle (g.clip);
component = g.component;
@@ -115,7 +117,6 @@ public class GdkGraphics extends Graphics
GdkGraphics (GtkComponentPeer component)
{
this.component = component;
- font = component.awtComponent.getFont ();
color = Color.black;
if (component.isRealized ())
@@ -128,6 +129,8 @@ public class GdkGraphics extends Graphics
{
initState (component);
color = component.awtComponent.getForeground ();
+ if (color == null)
+ color = Color.BLACK;
Dimension d = component.awtComponent.getSize ();
clip = new Rectangle (0, 0, d.width, d.height);
}
@@ -137,6 +140,8 @@ public class GdkGraphics extends Graphics
{
initStateUnlocked (component);
color = component.awtComponent.getForeground ();
+ if (color == null)
+ color = Color.BLACK;
Dimension d = component.awtComponent.getSize ();
clip = new Rectangle (0, 0, d.width, d.height);
}
@@ -378,7 +383,8 @@ public class GdkGraphics extends Graphics
public void setFont (Font font)
{
- this.font = font;
+ if (font != null)
+ this.font = font;
}
native void setFunction (int gdk_func);
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
index 6d9aabf77d5..c9ed3012658 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
@@ -101,7 +101,7 @@ public class GdkGraphics2D extends Graphics2D
static
{
if (! Configuration.GTK_CAIRO_ENABLED)
- throw new Error("Grahics2D not implemented. "
+ throw new Error("Graphics2D not implemented. "
+ "Cairo was not found or disabled at configure time");
if (Configuration.INIT_LOAD_LIBRARY)
@@ -154,11 +154,22 @@ public class GdkGraphics2D extends Graphics2D
public Graphics create(int x, int y, int width, int height)
{
- return new GdkGraphics2D(width, height);
+ return new GdkGraphics2D(this, x, y, width, height);
+ }
+
+ private void fail_g2d ()
+ {
+ System.err.println ("Attempted to instantiate GdkGraphics2D"
+ + " but Graphics2D not enabled. Try again with"
+ + " -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D");
+ System.exit (1);
}
GdkGraphics2D(GdkGraphics2D g)
{
+ if (!GtkToolkit.useGraphics2D ())
+ fail_g2d ();
+
paint = g.paint;
stroke = g.stroke;
setRenderingHints(g.hints);
@@ -198,8 +209,18 @@ public class GdkGraphics2D extends Graphics2D
stateStack = new Stack();
}
+ GdkGraphics2D(GdkGraphics2D g, int x, int y, int widht, int height)
+ {
+ this(g);
+ translate(x, y);
+ clipRect(0, 0, widht, height);
+ }
+
GdkGraphics2D(int width, int height)
{
+ if (!GtkToolkit.useGraphics2D ())
+ fail_g2d ();
+
initState(width, height);
setColor(Color.black);
@@ -215,6 +236,9 @@ public class GdkGraphics2D extends Graphics2D
GdkGraphics2D(GtkComponentPeer component)
{
+ if (!GtkToolkit.useGraphics2D ())
+ fail_g2d ();
+
this.component = component;
if (component.isRealized())
@@ -949,7 +973,10 @@ public class GdkGraphics2D extends Graphics2D
public Shape getClip()
{
- return clip.getBounds2D(); //getClipInDevSpace();
+ if (clip == null)
+ return null;
+ else
+ return clip.getBounds2D(); //getClipInDevSpace();
}
public Rectangle getClipBounds()
@@ -992,8 +1019,11 @@ public class GdkGraphics2D extends Graphics2D
if (clip == null)
{
// Reset clipping.
- Dimension d = component.awtComponent.getSize();
- setClip(0, 0, d.width, d.height);
+ if (component != null)
+ {
+ Dimension d = component.awtComponent.getSize();
+ setClip(0, 0, d.width, d.height);
+ }
}
else
{
@@ -1045,8 +1075,9 @@ public class GdkGraphics2D extends Graphics2D
public void clearRect(int x, int y, int width, int height)
{
- cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
- bg.getBlue() / 255.0, 1.0);
+ if (bg != null)
+ cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
+ bg.getBlue() / 255.0, 1.0);
cairoNewPath();
cairoRectangle(x, y, width, height);
cairoFill();
@@ -1371,7 +1402,8 @@ public class GdkGraphics2D extends Graphics2D
public void copyArea(int x, int y, int width, int height, int dx, int dy)
{
- throw new java.lang.UnsupportedOperationException();
+ GdkGraphics2D g = (GdkGraphics2D) create(x, y, width, height);
+ gdkDrawDrawable(g, x + dx, y + dy);
}
public void drawArc(int x, int y, int width, int height, int startAngle,
@@ -1604,6 +1636,11 @@ public class GdkGraphics2D extends Graphics2D
public void setFont(Font f)
{
+ // Sun's JDK does not throw NPEs, instead it leaves the current setting
+ // unchanged. So do we.
+ if (f == null)
+ return;
+
if (f.getPeer() instanceof GdkFontPeer)
font = f;
else
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
index ff51745f26c..c3ae581b14f 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
@@ -388,10 +388,7 @@ public class GdkTextLayout
throw new Error("not implemented");
}
- public Shape getOutline (AffineTransform tx)
- {
- throw new Error("not implemented");
- }
+ public native Shape getOutline (AffineTransform tx);
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint,
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
index c140744397a..ed7dc74d22e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
@@ -131,9 +131,6 @@ public class GtkChoicePeer extends GtkComponentPeer
protected void postChoiceItemEvent (String label, int stateChange)
{
- // Must set our state before notifying listeners
- if (stateChange == ItemEvent.SELECTED)
- ((Choice) awtComponent).select (label);
postItemEvent (label, stateChange);
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index 60e8371277f..fe0dae70dd0 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -71,6 +71,7 @@ import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
import java.awt.peer.ComponentPeer;
import java.awt.peer.ContainerPeer;
+import java.awt.peer.WindowPeer;
import java.util.Timer;
import java.util.TimerTask;
@@ -98,6 +99,7 @@ public class GtkComponentPeer extends GtkGenericPeer
native int[] gtkWidgetGetBackground ();
native void gtkWidgetGetDimensions (int[] dim);
native void gtkWidgetGetPreferredDimensions (int[] dim);
+ native void gtkWindowGetLocationOnScreen (int[] point);
native void gtkWidgetGetLocationOnScreen (int[] point);
native void gtkWidgetSetCursor (int type);
native void gtkWidgetSetCursorUnlocked (int type);
@@ -270,7 +272,10 @@ public class GtkComponentPeer extends GtkGenericPeer
public Point getLocationOnScreen ()
{
int point[] = new int[2];
- gtkWidgetGetLocationOnScreen (point);
+ if( this instanceof WindowPeer )
+ gtkWindowGetLocationOnScreen (point);
+ else
+ gtkWidgetGetLocationOnScreen (point);
return new Point (point[0], point[1]);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java
index c2cbc37dce9..f5ba3ad2c5e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java
@@ -44,6 +44,10 @@ import java.awt.Rectangle;
import java.awt.event.PaintEvent;
import java.awt.peer.DialogPeer;
+import javax.swing.JDialog;
+import javax.swing.JPopupMenu;
+import javax.swing.JToolTip;
+
public class GtkDialogPeer extends GtkWindowPeer
implements DialogPeer
{
@@ -82,10 +86,28 @@ public class GtkDialogPeer extends GtkWindowPeer
void create ()
{
- // Create a decorated dialog window.
- create (GDK_WINDOW_TYPE_HINT_DIALOG, true);
-
Dialog dialog = (Dialog) awtComponent;
+ int type = GDK_WINDOW_TYPE_HINT_DIALOG;
+
+ if (dialog instanceof JDialog)
+ {
+ Class heavyWeightClass;
+ try
+ {
+ heavyWeightClass = Class.forName("javax.swing.Popup$JWindowPopup");
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new AssertionError(e);
+ }
+
+ if (dialog.getClass() == heavyWeightClass
+ || ((JDialog) dialog).getContentPane() instanceof JToolTip)
+ type = GDK_WINDOW_TYPE_HINT_MENU;
+ }
+
+ // Create a decorated dialog window.
+ create (type, !((Dialog) awtComponent).isUndecorated ());
gtkWindowSetModal (dialog.isModal ());
setTitle (dialog.getTitle ());
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
index 6eb90ffa0bd..99cca0cffa7 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -168,7 +168,8 @@ public class GtkFramePeer extends GtkWindowPeer
void create ()
{
// Create a normal decorated window.
- create (GDK_WINDOW_TYPE_HINT_NORMAL, true);
+ create (GDK_WINDOW_TYPE_HINT_NORMAL,
+ !((Frame) awtComponent).isUndecorated ());
Frame frame = (Frame) awtComponent;
diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java b/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
index 54f4888cf8d..591b528035d 100644
--- a/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
+++ b/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.awt.peer.qt;
+import gnu.classpath.Configuration;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
@@ -135,7 +136,8 @@ public class QtToolkit extends ClasspathToolkit
{
eventQueue = new EventQueue();
repaintThread = new QtRepaintThread();
- System.loadLibrary("qtpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ System.loadLibrary("qtpeer");
String theme = null;
try
diff --git a/libjava/classpath/gnu/java/beans/DummyAppletContext.java b/libjava/classpath/gnu/java/beans/DummyAppletContext.java
index 4facb470d95..583d2f5cbee 100644
--- a/libjava/classpath/gnu/java/beans/DummyAppletContext.java
+++ b/libjava/classpath/gnu/java/beans/DummyAppletContext.java
@@ -63,7 +63,6 @@ import java.util.Iterator;
class DummyAppletContext implements AppletContext
{
private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_SET);
- private static final AudioClip DUMMY_CLIP = new DummyAudioClip();
DummyAppletContext()
{
@@ -80,14 +79,7 @@ class DummyAppletContext implements AppletContext
*/
public AudioClip getAudioClip(URL url)
{
- try
- {
- return (url.openConnection() != null ? DUMMY_CLIP : null);
- }
- catch (IOException ioe)
- {
- return null;
- }
+ return Applet.newAudioClip(url);
}
/** Loads the <code>Image</code> instance by delegating to
@@ -170,31 +162,4 @@ class DummyAppletContext implements AppletContext
{
return Collections.EMPTY_SET.iterator();
}
-
- /** Dummy <code>AudioClip</code> implementation that does nothing but
- * preventing <code>NullPointerException</code>S being thrown in programs
- * that expect a valid <code>AudioClip</code> instance to be returned by
- * their Applet.
- *
- * @author Robert Schuster
- */
- static class DummyAudioClip implements AudioClip
- {
- public void play()
- {
- }
-
- public void stop()
- {
- }
-
- public void loop()
- {
- }
-
- public String toString()
- {
- return "DummyAudioClip never plays anything - implement javax.sound and make us happy :)";
- }
- }
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java b/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
index a34fe346e0f..a675e8c9012 100644
--- a/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
@@ -57,10 +57,10 @@ class BooleanHandler extends SimpleHandler
protected Object parse(String number) throws AssemblyException
{
if (number.equals("true"))
- return new Boolean(true);
+ return Boolean.TRUE;
if (number.equals("false"))
- return new Boolean(false);
+ return Boolean.FALSE;
throw new AssemblyException(new IllegalArgumentException("Element contained no valid boolean value."));
}
diff --git a/libjava/classpath/gnu/java/io/PlatformHelper.java b/libjava/classpath/gnu/java/io/PlatformHelper.java
index d2c60123192..79ce6e8f470 100644
--- a/libjava/classpath/gnu/java/io/PlatformHelper.java
+++ b/libjava/classpath/gnu/java/io/PlatformHelper.java
@@ -109,11 +109,6 @@ public class PlatformHelper
String tmppath = path.replace('/', separatorChar);
StringBuffer canonpath;
- // We found it'll be more efficient and easy to handle to
- // return a lowercased canonical path
- if(isWindows)
- tmppath = tmppath.toLowerCase();
-
int i;
if ((i = beginWithRootPathPrefix(tmppath)) == 0 )
diff --git a/libjava/classpath/gnu/java/net/LineInputStream.java b/libjava/classpath/gnu/java/net/LineInputStream.java
index 5ca068618da..81a3c7d1fd4 100644
--- a/libjava/classpath/gnu/java/net/LineInputStream.java
+++ b/libjava/classpath/gnu/java/net/LineInputStream.java
@@ -1,5 +1,5 @@
/* LineInputStream.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.net;
+import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
@@ -91,7 +92,8 @@ public class LineInputStream
buf = new ByteArrayOutputStream();
this.encoding = encoding;
eof = false;
- blockReads = in.markSupported();
+ // If it is already buffered, additional buffering gains nothing.
+ blockReads = !(in instanceof BufferedInputStream) && in.markSupported();
}
/**
@@ -109,11 +111,12 @@ public class LineInputStream
if (blockReads)
{
// Use mark and reset to read chunks of bytes
- final int MIN_LENGTH = 1024;
+ final int MAX_LENGTH = 1024;
int len, pos;
-
+
len = in.available();
- len = (len < MIN_LENGTH) ? MIN_LENGTH : len;
+ if (len == 0 || len > MAX_LENGTH)
+ len = MAX_LENGTH;
byte[] b = new byte[len];
in.mark(len);
// Read into buffer b
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java b/libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java
deleted file mode 100644
index 680e45d3e49..00000000000
--- a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Authenticator.java --ByteArrayResponseBodyReader.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.protocol.http;
-
-/**
- * Simple response body reader that stores content in a byte array.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class ByteArrayResponseBodyReader
- implements ResponseBodyReader
-{
-
- /**
- * The content.
- */
- protected byte[] content;
-
- /**
- * The position in the content at which the next write will occur.
- */
- protected int pos;
-
- /**
- * The length of the buffer.
- */
- protected int len;
-
- /**
- * Constructs a new byte array response body reader.
- */
- public ByteArrayResponseBodyReader()
- {
- this(4096);
- }
-
- /**
- * Constructs a new byte array response body reader with the specified
- * initial buffer size.
- * @param size the initial buffer size
- */
- public ByteArrayResponseBodyReader(int size)
- {
- content = new byte[size];
- pos = len = 0;
- }
-
- /**
- * This reader accepts all responses.
- */
- public boolean accept(Request request, Response response)
- {
- return true;
- }
-
- public void read(byte[] buffer, int offset, int length)
- {
- int l = length - offset;
- if (pos + l > content.length)
- {
- byte[] tmp = new byte[content.length * 2];
- System.arraycopy(content, 0, tmp, 0, pos);
- content = tmp;
- }
- System.arraycopy(buffer, offset, content, pos, l);
- pos += l;
- len = pos;
- }
-
- public void close()
- {
- pos = 0;
- }
-
- /**
- * Retrieves the content of this reader as a byte array.
- * The size of the returned array is the number of bytes read.
- */
- public byte[] toByteArray()
- {
- byte[] ret = new byte[len];
- System.arraycopy(content, 0, ret, 0, len);
- return ret;
- }
-
-}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
index c0706b70840..a4487d146e8 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
@@ -110,7 +110,7 @@ public class ChunkedInputStream
// Read chunk header
int c, last = 0;
boolean seenSemi = false;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
do
{
c = in.read();
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
index 45e2f733ff3..0be7a097e5b 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
@@ -139,7 +139,7 @@ public class Cookie
public String toString(boolean showPath, boolean showDomain)
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(name);
buf.append('=');
buf.append(value);
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
index 6d9f447a2ac..573a7918d82 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
@@ -41,10 +41,6 @@ package gnu.java.net.protocol.http;
import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.java.net.EmptyX509TrustManager;
-import gnu.java.net.protocol.http.event.ConnectionEvent;
-import gnu.java.net.protocol.http.event.ConnectionListener;
-import gnu.java.net.protocol.http.event.RequestEvent;
-import gnu.java.net.protocol.http.event.RequestListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -57,6 +53,7 @@ import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -131,8 +128,6 @@ public class HTTPConnection
*/
protected int minorVersion;
- private final List connectionListeners;
- private final List requestListeners;
private final List handshakeCompletedListeners;
/**
@@ -165,6 +160,12 @@ public class HTTPConnection
*/
protected CookieManager cookieManager;
+
+ /**
+ * The pool that this connection is a member of (if any).
+ */
+ private LinkedHashMap pool;
+
/**
* Creates a new HTTP connection.
* @param hostname the name of the host to connect to
@@ -236,8 +237,6 @@ public class HTTPConnection
this.connectionTimeout = connectionTimeout;
this.timeout = timeout;
majorVersion = minorVersion = 1;
- connectionListeners = new ArrayList(4);
- requestListeners = new ArrayList(4);
handshakeCompletedListeners = new ArrayList(2);
}
@@ -332,6 +331,73 @@ public class HTTPConnection
}
/**
+ * The number of times this HTTPConnection has be used via keep-alive.
+ */
+ int useCount;
+
+ /**
+ * Generates a key for connections in the connection pool.
+ *
+ * @param h the host name.
+ * @param p the port.
+ * @param sec true if using https.
+ *
+ * @return the key.
+ */
+ static Object getPoolKey(String h, int p, boolean sec)
+ {
+ StringBuilder buf = new StringBuilder(sec ? "https://" : "http://");
+ buf.append(h);
+ buf.append(':');
+ buf.append(p);
+ return buf.toString();
+ }
+
+ /**
+ * Set the connection pool that this HTTPConnection is a member of.
+ * If left unset or set to null, it will not be a member of any pool
+ * and will not be a candidate for reuse.
+ *
+ * @param p the pool.
+ */
+ void setPool(LinkedHashMap p)
+ {
+ pool = p;
+ }
+
+ /**
+ * Signal that this HTTPConnection is no longer needed and can be
+ * returned to the connection pool.
+ *
+ */
+ void release()
+ {
+ if (pool != null)
+ {
+ synchronized (pool)
+ {
+ useCount++;
+ Object key = HTTPConnection.getPoolKey(hostname, port, secure);
+ pool.put(key, this);
+ while (pool.size() >= HTTPURLConnection.maxConnections)
+ {
+ // maxConnections must always be >= 1
+ Object lru = pool.keySet().iterator().next();
+ HTTPConnection c = (HTTPConnection)pool.remove(lru);
+ try
+ {
+ c.closeConnection();
+ }
+ catch (IOException ioe)
+ {
+ // Ignore it. We are just cleaning up.
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Creates a new request using this connection.
* @param method the HTTP method to invoke
* @param path the URI-escaped RFC2396 <code>abs_path</code> with
@@ -367,7 +433,7 @@ public class HTTPConnection
Cookie[] cookies = cookieManager.getCookies(hostname, secure, path);
if (cookies != null && cookies.length > 0)
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("$Version=1");
for (int i = 0; i < cookies.length; i++)
{
@@ -378,7 +444,6 @@ public class HTTPConnection
ret.setHeader("Cookie", buf.toString());
}
}
- fireRequestEvent(RequestEvent.REQUEST_CREATED, ret);
return ret;
}
@@ -388,14 +453,7 @@ public class HTTPConnection
public void close()
throws IOException
{
- try
- {
- closeConnection();
- }
- finally
- {
- fireConnectionEvent(ConnectionEvent.CONNECTION_CLOSED);
- }
+ closeConnection();
}
/**
@@ -534,7 +592,7 @@ public class HTTPConnection
*/
protected String getURI()
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(secure ? "https://" : "http://");
buf.append(hostname);
if (secure)
@@ -584,84 +642,6 @@ public class HTTPConnection
// -- Events --
- public void addConnectionListener(ConnectionListener l)
- {
- synchronized (connectionListeners)
- {
- connectionListeners.add(l);
- }
- }
-
- public void removeConnectionListener(ConnectionListener l)
- {
- synchronized (connectionListeners)
- {
- connectionListeners.remove(l);
- }
- }
-
- protected void fireConnectionEvent(int type)
- {
- ConnectionEvent event = new ConnectionEvent(this, type);
- ConnectionListener[] l = null;
- synchronized (connectionListeners)
- {
- l = new ConnectionListener[connectionListeners.size()];
- connectionListeners.toArray(l);
- }
- for (int i = 0; i < l.length; i++)
- {
- switch (type)
- {
- case ConnectionEvent.CONNECTION_CLOSED:
- l[i].connectionClosed(event);
- break;
- }
- }
- }
-
- public void addRequestListener(RequestListener l)
- {
- synchronized (requestListeners)
- {
- requestListeners.add(l);
- }
- }
-
- public void removeRequestListener(RequestListener l)
- {
- synchronized (requestListeners)
- {
- requestListeners.remove(l);
- }
- }
-
- protected void fireRequestEvent(int type, Request request)
- {
- RequestEvent event = new RequestEvent(this, type, request);
- RequestListener[] l = null;
- synchronized (requestListeners)
- {
- l = new RequestListener[requestListeners.size()];
- requestListeners.toArray(l);
- }
- for (int i = 0; i < l.length; i++)
- {
- switch (type)
- {
- case RequestEvent.REQUEST_CREATED:
- l[i].requestCreated(event);
- break;
- case RequestEvent.REQUEST_SENDING:
- l[i].requestSent(event);
- break;
- case RequestEvent.REQUEST_SENT:
- l[i].requestSent(event);
- break;
- }
- }
- }
-
void addHandshakeCompletedListener(HandshakeCompletedListener l)
{
synchronized (handshakeCompletedListeners)
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
index 9f2055fe658..d5da7d61ae4 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.java.net.protocol.http;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -75,7 +74,8 @@ public class HTTPURLConnection
/**
* Pool of reusable connections, used if keepAlive is true.
*/
- private static final Map connectionPool = new LinkedHashMap();
+ private static final LinkedHashMap connectionPool = new LinkedHashMap();
+ static int maxConnections;
/*
* The underlying connection.
@@ -87,7 +87,6 @@ public class HTTPURLConnection
int proxyPort;
String agent;
boolean keepAlive;
- int maxConnections;
private Request request;
private Headers requestHeaders;
@@ -95,8 +94,8 @@ public class HTTPURLConnection
private boolean requestMethodSetExplicitly;
private Response response;
- private ByteArrayInputStream responseSink;
- private ByteArrayInputStream errorSink;
+ private InputStream responseSink;
+ private InputStream errorSink;
private HandshakeCompletedEvent handshakeEvent;
@@ -202,34 +201,59 @@ public class HTTPURLConnection
}
connection.setProxy(proxyHostname, proxyPort);
}
- request = connection.newRequest(method, file);
- if (!keepAlive)
- {
- request.setHeader("Connection", "close");
- }
- if (agent != null)
- {
- request.setHeader("User-Agent", agent);
- }
- request.getHeaders().putAll(requestHeaders);
- if (requestSink != null)
+ try
{
- byte[] content = requestSink.toByteArray();
- RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content);
- request.setRequestBodyWriter(writer);
+ request = connection.newRequest(method, file);
+ if (!keepAlive)
+ {
+ request.setHeader("Connection", "close");
+ }
+ if (agent != null)
+ {
+ request.setHeader("User-Agent", agent);
+ }
+ request.getHeaders().putAll(requestHeaders);
+ if (requestSink != null)
+ {
+ byte[] content = requestSink.toByteArray();
+ RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content);
+ request.setRequestBodyWriter(writer);
+ }
+ if (creds != null)
+ {
+ request.setAuthenticator(new Authenticator() {
+ public Credentials getCredentials(String realm, int attempts)
+ {
+ return (attempts < 2) ? creds : null;
+ }
+ });
+ }
+ response = request.dispatch();
}
- ByteArrayResponseBodyReader reader = new ByteArrayResponseBodyReader();
- request.setResponseBodyReader(reader);
- if (creds != null)
+ catch (IOException ioe)
{
- request.setAuthenticator(new Authenticator() {
- public Credentials getCredentials(String realm, int attempts)
+ if (connection.useCount > 0)
+ {
+ // Connection re-use failed: Try a new connection.
+ try
+ {
+ connection.close();
+ }
+ catch (IOException _)
+ {
+ // Ignore.
+ }
+ connection = null;
+ retry = true;
+ continue;
+ }
+ else
{
- return (attempts < 2) ? creds : null;
+ // First time the connection was used: Hard failure.
+ throw ioe;
}
- });
}
- response = request.dispatch();
+
if (response.getCodeClass() == 3 && getInstanceFollowRedirects())
{
// Follow redirect
@@ -307,7 +331,8 @@ public class HTTPURLConnection
}
else
{
- responseSink = new ByteArrayInputStream(reader.toByteArray ());
+ responseSink = response.getBody();
+
if (response.getCode() == 404)
{
errorSink = responseSink;
@@ -328,27 +353,14 @@ public class HTTPURLConnection
HTTPConnection connection;
if (keepAlive)
{
- StringBuffer buf = new StringBuffer(secure ? "https://" : "http://");
- buf.append(Thread.currentThread().hashCode());
- buf.append('@');
- buf.append(host);
- buf.append(':');
- buf.append(port);
- String key = buf.toString();
+ Object key = HTTPConnection.getPoolKey(host, port, secure);
synchronized (connectionPool)
{
- connection = (HTTPConnection) connectionPool.get(key);
+ connection = (HTTPConnection) connectionPool.remove(key);
if (connection == null)
{
connection = new HTTPConnection(host, port, secure);
- // Good housekeeping
- if (connectionPool.size() == maxConnections)
- {
- // maxConnections must always be >= 1
- Object lru = connectionPool.keySet().iterator().next();
- connectionPool.remove(lru);
- }
- connectionPool.put(key, connection);
+ connection.setPool(connectionPool);
}
}
}
@@ -502,9 +514,9 @@ public class HTTPURLConnection
return null;
}
}
- Map headers = response.getHeaders();
- Map ret = new LinkedHashMap();
- ret.put("", Collections.singletonList(getStatusLine(response)));
+ Headers headers = response.getHeaders();
+ LinkedHashMap ret = new LinkedHashMap();
+ ret.put(null, Collections.singletonList(getStatusLine(response)));
for (Iterator i = headers.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
@@ -512,7 +524,7 @@ public class HTTPURLConnection
String value = (String) entry.getValue();
ret.put(key, Collections.singletonList(value));
}
- return ret;
+ return Collections.unmodifiableMap(ret);
}
String getStatusLine(Response response)
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Headers.java b/libjava/classpath/gnu/java/net/protocol/http/Headers.java
index 847ebefc1f6..9306fc411c9 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Headers.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Headers.java
@@ -60,7 +60,7 @@ import java.util.Set;
* @author Chris Burdess (dog@gnu.org)
*/
public class Headers
- implements Map
+ extends LinkedHashMap
{
static final DateFormat dateFormat = new HTTPDateFormat();
@@ -143,36 +143,18 @@ public class Headers
}
- private LinkedHashMap headers;
-
public Headers()
{
- headers = new LinkedHashMap();
- }
-
- public int size()
- {
- return headers.size();
- }
-
- public boolean isEmpty()
- {
- return headers.isEmpty();
}
public boolean containsKey(Object key)
{
- return headers.containsKey(new Header((String) key));
- }
-
- public boolean containsValue(Object value)
- {
- return headers.containsValue(value);
+ return super.containsKey(new Header((String) key));
}
public Object get(Object key)
{
- return headers.get(new Header((String) key));
+ return super.get(new Header((String) key));
}
/**
@@ -180,7 +162,7 @@ public class Headers
*/
public String getValue(String header)
{
- return (String) headers.get(new Header(header));
+ return (String) super.get(new Header(header));
}
/**
@@ -205,6 +187,27 @@ public class Headers
}
/**
+ * Returns the value of the specified header as a long, or -1 if the
+ * header is not present or cannot be parsed as a long.
+ */
+ public long getLongValue(String header)
+ {
+ String val = getValue(header);
+ if (val == null)
+ {
+ return -1;
+ }
+ try
+ {
+ return Long.parseLong(val);
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ return -1;
+ }
+
+ /**
* Returns the value of the specified header as a date,
* or <code>null</code> if the header is not present or not a date.
*/
@@ -227,12 +230,12 @@ public class Headers
public Object put(Object key, Object value)
{
- return headers.put(new Header((String) key), value);
+ return super.put(new Header((String) key), value);
}
public Object remove(Object key)
{
- return headers.remove(new Header((String) key));
+ return super.remove(new Header((String) key));
}
public void putAll(Map t)
@@ -241,18 +244,13 @@ public class Headers
{
String key = (String) i.next();
String value = (String) t.get(key);
- headers.put(new Header(key), value);
+ put(key, value);
}
}
- public void clear()
- {
- headers.clear();
- }
-
public Set keySet()
{
- Set keys = headers.keySet();
+ Set keys = super.keySet();
Set ret = new LinkedHashSet();
for (Iterator i = keys.iterator(); i.hasNext(); )
{
@@ -261,14 +259,9 @@ public class Headers
return ret;
}
- public Collection values()
- {
- return headers.values();
- }
-
public Set entrySet()
{
- Set entries = headers.entrySet();
+ Set entries = super.entrySet();
Set ret = new LinkedHashSet();
for (Iterator i = entries.iterator(); i.hasNext(); )
{
@@ -278,16 +271,6 @@ public class Headers
return ret;
}
- public boolean equals(Object other)
- {
- return headers.equals(other);
- }
-
- public int hashCode()
- {
- return headers.hashCode();
- }
-
/**
* Parse the specified input stream, adding headers to this collection.
*/
@@ -298,7 +281,7 @@ public class Headers
(LineInputStream) in : new LineInputStream(in);
String name = null;
- StringBuffer value = new StringBuffer();
+ StringBuilder value = new StringBuilder();
while (true)
{
String line = lin.readLine();
@@ -354,14 +337,14 @@ public class Headers
private void addValue(String name, String value)
{
Header key = new Header(name);
- String old = (String) headers.get(key);
+ String old = (String) super.get(key);
if (old == null)
{
- headers.put(key, value);
+ super.put(key, value);
}
else
{
- headers.put(key, old + ", " + value);
+ super.put(key, old + ", " + value);
}
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java b/libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java
new file mode 100644
index 00000000000..16cf56a2919
--- /dev/null
+++ b/libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java
@@ -0,0 +1,220 @@
+/* LimitedLengthInputStream.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.net.protocol.http;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * InputStream that limits the total number of bytes that can be read
+ * from an underlying stream. In addition to limiting the number of
+ * bytes read, close() is not propagated to the underlying stream.
+ *
+ * @author David Daney (ddaney@avtrex.com)
+ */
+class LimitedLengthInputStream
+ extends InputStream
+{
+ private long remainingLen;
+ private boolean restrictLen;
+ private HTTPConnection connection;
+ private boolean eof;
+ private InputStream in;
+ private boolean doClose;
+
+
+ private void handleClose()
+ throws IOException
+ {
+ eof = true;
+ if (doClose)
+ {
+ in.close();
+ }
+ else
+ {
+ connection.release();
+ }
+ in = null;
+ connection = null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param in the underlying stream
+ *
+ * @param maxLen the maximum number of bytes to read
+ *
+ * @param restrictLen if true the number of bytes that can be read
+ * from this stream will be limited to maxLen, otherwise the number
+ * of bytes is not restricted.
+ *
+ * @param con the HTTPConnection associated with this stream
+ *
+ * @param doClose if true con will be closed when finished reading,
+ * else it will be placed back in the connection pool.
+ *
+ */
+ LimitedLengthInputStream(InputStream in,
+ long maxLen,
+ boolean restrictLen,
+ HTTPConnection con,
+ boolean doClose)
+ throws IOException
+
+ {
+ this.in = in;
+ this.remainingLen = maxLen;
+ this.restrictLen = restrictLen;
+ this.connection = con;
+ this.doClose = doClose;
+
+ if (restrictLen)
+ {
+ if (maxLen < 0)
+ throw new IllegalArgumentException();
+ else if (maxLen == 0)
+ handleClose(); // Nothing to do, release the connection.
+ }
+ }
+
+ public synchronized int read()
+ throws IOException
+ {
+ if (eof)
+ return -1; // EOF
+
+ int r;
+
+ if (restrictLen)
+ {
+ r = in.read();
+ if (-1 != r)
+ remainingLen--;
+
+ if (0 == remainingLen)
+ handleClose();
+ }
+ else
+ {
+ r = in.read();
+ if (r == -1)
+ handleClose();
+ }
+
+ return r;
+ }
+
+ public int read(byte[] buffer)
+ throws IOException
+ {
+ return read(buffer, 0, buffer.length);
+ }
+
+ public synchronized int read(byte[] buffer, int offset, int length)
+ throws IOException
+ {
+ if (eof)
+ return -1; // EOF
+
+ if (restrictLen && length > remainingLen)
+ length = (int) remainingLen;
+
+ int r = in.read(buffer, offset, length);
+
+ if (-1 == r)
+ handleClose();
+
+ if (restrictLen && r > 0)
+ {
+ remainingLen -= r;
+ if (0 == remainingLen)
+ handleClose();
+ }
+ return r;
+ }
+
+ public synchronized long skip(long n)
+ throws IOException
+ {
+
+ if (eof)
+ return 0;
+
+ if (restrictLen && n > remainingLen)
+ n = remainingLen;
+
+ long r = in.skip(n);
+
+ if (restrictLen)
+ {
+ remainingLen -= r;
+ if (0 == remainingLen)
+ handleClose();
+ }
+ return r;
+ }
+
+ public synchronized int available()
+ throws IOException
+ {
+ if (eof)
+ return 0;
+
+ int a = in.available();
+ if (restrictLen && a > remainingLen)
+ a = (int)remainingLen;
+ return a;
+ }
+
+ public synchronized void close()
+ throws IOException
+ {
+ if (eof)
+ return;
+
+ // If we get to here, the stream was not fully read. Just throw
+ // it away.
+
+ doClose = true;
+
+ handleClose();
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Request.java b/libjava/classpath/gnu/java/net/protocol/http/Request.java
index 21205e6bba8..b9441b3f736 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Request.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Request.java
@@ -1,5 +1,5 @@
/* Request.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,6 @@ package gnu.java.net.protocol.http;
import gnu.java.net.BASE64;
import gnu.java.net.LineInputStream;
-import gnu.java.net.protocol.http.event.RequestEvent;
import java.io.IOException;
import java.io.InputStream;
@@ -100,11 +99,6 @@ public class Request
protected int requestBodyNegotiationThreshold;
/**
- * The response body reader.
- */
- protected ResponseBodyReader responseBodyReader;
-
- /**
* Map of response header handlers.
*/
protected Map responseHeaderHandlers;
@@ -236,16 +230,6 @@ public class Request
}
/**
- * Sets the response body reader.
- * @param responseBodyReader the handler to receive notifications of
- * response body content
- */
- public void setResponseBodyReader(ResponseBodyReader responseBodyReader)
- {
- this.responseBodyReader = responseBodyReader;
- }
-
- /**
* Sets a callback handler to be invoked for the specified header name.
* @param name the header name
* @param handler the handler to receive the value for the header
@@ -324,13 +308,10 @@ public class Request
do
{
retry = false;
- // Send request
- connection.fireRequestEvent(RequestEvent.REQUEST_SENDING, this);
// Get socket output and input streams
OutputStream out = connection.getOutputStream();
- LineInputStream in =
- new LineInputStream(connection.getInputStream());
+
// Request line
String requestUri = path;
if (connection.isUsingProxy() &&
@@ -369,28 +350,42 @@ public class Request
count += len;
}
while (len > -1 && count < contentLength);
- out.write(CRLF.getBytes(US_ASCII));
}
out.flush();
- // Sent event
- connection.fireRequestEvent(RequestEvent.REQUEST_SENT, this);
// Get response
- response = readResponse(in);
- int sc = response.getCode();
- if (sc == 401 && authenticator != null)
- {
- if (authenticate(response, attempts++))
- {
- retry = true;
- }
- }
- else if (sc == 100 && expectingContinue)
- {
- requestHeaders.remove("Expect");
- setHeader("Content-Length", Integer.toString(contentLength));
- expectingContinue = false;
- retry = true;
- }
+ while(true)
+ {
+ response = readResponse(connection.getInputStream());
+ int sc = response.getCode();
+ if (sc == 401 && authenticator != null)
+ {
+ if (authenticate(response, attempts++))
+ {
+ retry = true;
+ }
+ }
+ else if (sc == 100)
+ {
+ if (expectingContinue)
+ {
+ requestHeaders.remove("Expect");
+ setHeader("Content-Length",
+ Integer.toString(contentLength));
+ expectingContinue = false;
+ retry = true;
+ }
+ else
+ {
+ // A conforming server can send an unsoliceted
+ // Continue response but *should* not (RFC 2616
+ // sec 8.2.3). Ignore the bogus Continue
+ // response and get the real response that
+ // should follow
+ continue;
+ }
+ }
+ break;
+ }
}
while (retry);
}
@@ -402,14 +397,16 @@ public class Request
return response;
}
- Response readResponse(LineInputStream in)
+ Response readResponse(InputStream in)
throws IOException
{
String line;
int len;
// Read response status line
- line = in.readLine();
+ LineInputStream lis = new LineInputStream(in);
+
+ line = lis.readLine();
if (line == null)
{
throw new ProtocolException("Peer closed connection");
@@ -438,30 +435,25 @@ public class Request
String message = line.substring(end + 1, len - 1);
// Read response headers
Headers responseHeaders = new Headers();
- responseHeaders.parse(in);
+ responseHeaders.parse(lis);
notifyHeaderHandlers(responseHeaders);
- // Construct response
- int codeClass = code / 100;
- Response ret = new Response(majorVersion, minorVersion, code,
- codeClass, message, responseHeaders);
+ InputStream body = null;
+
switch (code)
{
+ case 100:
case 204:
case 205:
case 304:
break;
default:
- // Does response body reader want body?
- boolean notify = (responseBodyReader != null);
- if (notify)
- {
- if (!responseBodyReader.accept(this, ret))
- {
- notify = false;
- }
- }
- readResponseBody(ret, in, notify);
+ body = createResponseBodyStream(responseHeaders, majorVersion,
+ minorVersion, in);
}
+
+ // Construct response
+ Response ret = new Response(majorVersion, minorVersion, code,
+ message, responseHeaders, body);
return ret;
}
@@ -487,25 +479,40 @@ public class Request
}
}
- void readResponseBody(Response response, InputStream in,
- boolean notify)
+ private InputStream createResponseBodyStream(Headers responseHeaders,
+ int majorVersion,
+ int minorVersion,
+ InputStream in)
throws IOException
{
- byte[] buffer = new byte[4096];
- int contentLength = -1;
+ long contentLength = -1;
Headers trailer = null;
- String transferCoding = response.getHeader("Transfer-Encoding");
+ // Persistent connections are the default in HTTP/1.1
+ boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
+ "close".equalsIgnoreCase(responseHeaders.getValue("Connection")) ||
+ (connection.majorVersion == 1 && connection.minorVersion == 0) ||
+ (majorVersion == 1 && minorVersion == 0);
+
+ String transferCoding = responseHeaders.getValue("Transfer-Encoding");
if ("chunked".equalsIgnoreCase(transferCoding))
{
- trailer = new Headers();
- in = new ChunkedInputStream(in, trailer);
+ in = new LimitedLengthInputStream(in, -1, false, connection, doClose);
+
+ in = new ChunkedInputStream(in, responseHeaders);
}
else
{
- contentLength = response.getIntHeader("Content-Length");
+ contentLength = responseHeaders.getLongValue("Content-Length");
+
+ if (contentLength < 0)
+ doClose = true; // No Content-Length, must close.
+
+ in = new LimitedLengthInputStream(in, contentLength,
+ contentLength >= 0,
+ connection, doClose);
}
- String contentCoding = response.getHeader("Content-Encoding");
+ String contentCoding = responseHeaders.getValue("Content-Encoding");
if (contentCoding != null && !"identity".equals(contentCoding))
{
if ("gzip".equals(contentCoding))
@@ -522,51 +529,7 @@ public class Request
contentCoding);
}
}
-
- // Persistent connections are the default in HTTP/1.1
- boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
- "close".equalsIgnoreCase(response.getHeader("Connection")) ||
- (connection.majorVersion == 1 && connection.minorVersion == 0) ||
- (response.majorVersion == 1 && response.minorVersion == 0);
-
- int count = contentLength;
- int len = (count > -1) ? count : buffer.length;
- len = (len > buffer.length) ? buffer.length : len;
- while (len > -1)
- {
- len = in.read(buffer, 0, len);
- if (len < 0)
- {
- // EOF
- connection.closeConnection();
- break;
- }
- if (notify)
- {
- responseBodyReader.read(buffer, 0, len);
- }
- if (count > -1)
- {
- count -= len;
- if (count < 1)
- {
- if (doClose)
- {
- connection.closeConnection();
- }
- break;
- }
- }
- }
- if (notify)
- {
- responseBodyReader.close();
- }
- if (trailer != null)
- {
- response.getHeaders().putAll(trailer);
- notifyHeaderHandlers(trailer);
- }
+ return in;
}
boolean authenticate(Response response, int attempts)
@@ -686,7 +649,7 @@ public class Request
{
int len = text.length();
String key = null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
Properties ret = new Properties();
boolean inQuote = false;
for (int i = 0; i < len; i++)
@@ -739,7 +702,7 @@ public class Request
{
int nc = connection.getNonceCount(nonce);
String hex = Integer.toHexString(nc);
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i = 8 - hex.length(); i > 0; i--)
{
buf.append('0');
@@ -810,7 +773,7 @@ public class Request
int len = text.length();
String attr = null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean inQuote = false;
for (int i = 0; i <= len; i++)
{
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Response.java b/libjava/classpath/gnu/java/net/protocol/http/Response.java
index 29dc28b17d3..58d74542c30 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Response.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Response.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.net.protocol.http;
+import java.io.InputStream;
import java.util.Date;
/**
@@ -64,19 +65,6 @@ public class Response
protected final int code;
/**
- * The class of the response. This is the most significant digit of the
- * status code.
- * <dl>
- * <dt><code>1xx</code></dt> <dd>Informational response</dd>
- * <dt><code>2xx</code></dt> <dd>Success</dd>
- * <dt><code>3xx</code></dt> <dd>Redirection</dd>
- * <dt><code>4xx</code></dt> <dd>Client error</dd>
- * <dt><code>5xx</code></dt> <dd>Server error</dd>
- * </dl>
- */
- protected final int codeClass;
-
- /**
* Human-readable text of the response.
*/
protected final String message;
@@ -87,18 +75,22 @@ public class Response
protected final Headers headers;
/**
+ * An InputStream that returns the body of the response.
+ */
+ protected final InputStream body;
+
+ /**
* Constructs a new response with the specified parameters.
*/
protected Response(int majorVersion, int minorVersion, int code,
- int codeClass, String message,
- Headers headers)
+ String message, Headers headers, InputStream body)
{
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
this.code = code;
- this.codeClass = codeClass;
this.message = message;
this.headers = headers;
+ this.body = body;
}
/**
@@ -129,12 +121,19 @@ public class Response
}
/**
- * Returns the class of the response.
- * @see #codeClass
+ * Returns the class of the response. This is the most significant
+ * digit of the status code.
+ * <dl>
+ * <dt><code>1xx</code></dt> <dd>Informational response</dd>
+ * <dt><code>2xx</code></dt> <dd>Success</dd>
+ * <dt><code>3xx</code></dt> <dd>Redirection</dd>
+ * <dt><code>4xx</code></dt> <dd>Client error</dd>
+ * <dt><code>5xx</code></dt> <dd>Server error</dd>
+ * </dl>
*/
public int getCodeClass()
{
- return codeClass;
+ return code / 100;
}
/**
@@ -173,6 +172,15 @@ public class Response
}
/**
+ * Returns the header value for the specified name as a long.
+ * @param name the header name
+ */
+ public long getLongHeader(String name)
+ {
+ return headers.getLongValue(name);
+ }
+
+ /**
* Returns the header value for the specified name as a date.
* @param name the header name
*/
@@ -181,5 +189,14 @@ public class Response
return headers.getDateValue(name);
}
+ /**
+ * Returns an InputStream that returns the body of the response.
+ *
+ * @return the body of the response
+ */
+ public InputStream getBody()
+ {
+ return body;
+ }
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java b/libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java
deleted file mode 100644
index 49e1b376f0f..00000000000
--- a/libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ResponseBodyReader.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.protocol.http;
-
-/**
- * Callback interface for receiving notification of response body content.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface ResponseBodyReader
-{
-
- /**
- * Indicate whether this reader is interested in the specified response.
- * If it returns false, it will not receive body content notifications for
- * that response.
- */
- boolean accept(Request request, Response response);
-
- /**
- * Receive notification of body content.
- * @param buffer the content buffer
- * @param offset the offset within the buffer that content starts
- * @param length the length of the content
- */
- void read(byte[] buffer, int offset, int length);
-
- /**
- * Notifies the reader that the end of the content was reached.
- */
- void close();
-
-}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java b/libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java
deleted file mode 100644
index c880fbce6f0..00000000000
--- a/libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* RequestListener.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.protocol.http.event;
-
-import java.util.EventListener;
-
-/**
- * A request listener.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface RequestListener
- extends EventListener
-{
-
- /**
- * Callback invoked when a request is created from the associated
- * connection.
- */
- void requestCreated(RequestEvent event);
-
- /**
- * Callback invoked when the request has been initialised with all data
- * and before sending this data to the server.
- */
- void requestSending(RequestEvent event);
-
- /**
- * Callback invoked after all request data has been sent to the server.
- */
- void requestSent(RequestEvent event);
-
-}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
index bd7a80da739..e854874208a 100644
--- a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
+++ b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
@@ -69,13 +69,17 @@ public final class Connection extends JarURLConnection
private static Hashtable cache = new Hashtable();
private static final int READBUFSIZE = 4*1024;
- public static synchronized JarFile get (URL url) throws IOException
+ public static synchronized JarFile get (URL url, boolean useCaches)
+ throws IOException
{
- JarFile jf = (JarFile) cache.get (url);
+ JarFile jf;
+ if (useCaches)
+ {
+ jf = (JarFile) cache.get (url);
+ if (jf != null)
+ return jf;
+ }
- if (jf != null)
- return jf;
-
if ("file".equals (url.getProtocol()))
{
File f = new File (url.getFile());
@@ -100,9 +104,10 @@ public final class Connection extends JarURLConnection
jf = new JarFile (f, true,
ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
}
-
- cache.put (url, jf);
-
+
+ if (useCaches)
+ cache.put (url, jf);
+
return jf;
}
}
@@ -120,7 +125,7 @@ public final class Connection extends JarURLConnection
return;
jar_url = getJarFileURL();
- jar_file = JarFileCache.get (jar_url);
+ jar_file = JarFileCache.get (jar_url, useCaches);
String entry_name = getEntryName();
if (entry_name != null
diff --git a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
index 9fb71c1ae1c..fcddbd6c351 100644
--- a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
@@ -258,7 +258,7 @@ public final class SocketChannelImpl extends SocketChannel
}
else
{
- dst.put (data, offset, len);
+ dst.put (data, offset, readBytes);
}
return readBytes;
diff --git a/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java b/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
index 0ee5d3fc287..466f3dd5587 100644
--- a/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
@@ -175,7 +175,8 @@ public final class FileChannelImpl extends FileChannel
*/
protected void finalize() throws IOException
{
- this.close();
+ if (fd != -1)
+ close();
}
public int read (ByteBuffer dst) throws IOException
diff --git a/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java b/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
index e3927d99466..fa1dbc412f4 100644
--- a/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
+++ b/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
@@ -54,6 +54,8 @@ final class UTF_16Decoder extends CharsetDecoder
static final int BIG_ENDIAN = 0;
static final int LITTLE_ENDIAN = 1;
static final int UNKNOWN_ENDIAN = 2;
+ static final int MAYBE_BIG_ENDIAN = 3;
+ static final int MAYBE_LITTLE_ENDIAN = 4;
private static final char BYTE_ORDER_MARK = 0xFEFF;
private static final char REVERSED_BYTE_ORDER_MARK = 0xFFFE;
@@ -81,26 +83,37 @@ final class UTF_16Decoder extends CharsetDecoder
byte b2 = in.get ();
// handle byte order mark
- if (byteOrder == UNKNOWN_ENDIAN)
+ if (byteOrder == UNKNOWN_ENDIAN ||
+ byteOrder == MAYBE_BIG_ENDIAN ||
+ byteOrder == MAYBE_LITTLE_ENDIAN)
{
char c = (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF));
if (c == BYTE_ORDER_MARK)
{
+ if (byteOrder == MAYBE_LITTLE_ENDIAN)
+ {
+ return CoderResult.malformedForLength (2);
+ }
byteOrder = BIG_ENDIAN;
inPos += 2;
continue;
}
else if (c == REVERSED_BYTE_ORDER_MARK)
{
+ if (byteOrder == MAYBE_BIG_ENDIAN)
+ {
+ return CoderResult.malformedForLength (2);
+ }
byteOrder = LITTLE_ENDIAN;
inPos += 2;
continue;
}
else
{
- // assume big endian, do not consume bytes,
+ // assume big or little endian, do not consume bytes,
// continue with normal processing
- byteOrder = BIG_ENDIAN;
+ byteOrder = (byteOrder == MAYBE_LITTLE_ENDIAN ?
+ LITTLE_ENDIAN : BIG_ENDIAN);
}
}
diff --git a/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java b/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java
index d354e04e5de..63f2855d520 100644
--- a/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java
+++ b/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java
@@ -64,7 +64,7 @@ final class UnicodeLittle extends Charset
public CharsetDecoder newDecoder ()
{
- return new UTF_16Decoder (this, UTF_16Decoder.UNKNOWN_ENDIAN);
+ return new UTF_16Decoder (this, UTF_16Decoder.MAYBE_LITTLE_ENDIAN);
}
public CharsetEncoder newEncoder ()
diff --git a/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java b/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java
index 58eaa85bac4..873e9ecda41 100644
--- a/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java
+++ b/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java
@@ -62,7 +62,11 @@ public final class IconvProvider extends CharsetProvider
}
}
- private IconvProvider()
+ // Declaring the construtor public may violate the use of singleton.
+ // But it must be public so that an instance of this class can be
+ // created by Class.newInstance(), which is the case when this provider is
+ // defined in META-INF/services/java.nio.charset.spi.CharsetProvider.
+ public IconvProvider()
{
IconvMetaData.setup();
}
diff --git a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java
index b1e086a73b2..9f18d129e71 100644
--- a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java
+++ b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java
@@ -81,7 +81,7 @@ public final class DGCImpl_Stub
public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException {
try {
if (useNewInvoke) {
- ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, new java.lang.Boolean($param_3)}, -5803803475088455571L);
+ ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, Boolean.valueOf($param_3)}, -5803803475088455571L);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
diff --git a/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
new file mode 100644
index 00000000000..2e1e7805531
--- /dev/null
+++ b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
@@ -0,0 +1,350 @@
+/* RMIClassLoaderImpl.java -- FIXME: briefly describe file purpose
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.rmi.server;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.rmi.server.RMIClassLoaderSpi;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * The default implementation of {@link java.rmi.server.RMIClassLoaderSpi}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class RMIClassLoaderImpl extends RMIClassLoaderSpi
+{
+ private static class MyClassLoader extends URLClassLoader
+ {
+ // Package-private to avoid a trampoline constructor.
+ MyClassLoader (URL[] urls, ClassLoader parent, String annotation)
+ {
+ super (urls, parent);
+ this.annotation = annotation;
+ }
+
+ private MyClassLoader (URL[] urls, ClassLoader parent)
+ {
+ super (urls, parent);
+ this.annotation = urlToAnnotation (urls);
+ }
+
+ public static String urlToAnnotation (URL[] urls)
+ {
+ if (urls.length == 0)
+ return null;
+
+ StringBuffer annotation = new StringBuffer (64 * urls.length);
+
+ for (int i = 0; i < urls.length; i++)
+ {
+ annotation.append (urls [i].toExternalForm());
+ annotation.append (' ');
+ }
+
+ return annotation.toString();
+ }
+
+ public final String getClassAnnotation()
+ {
+ return annotation;
+ }
+
+ private final String annotation;
+ }
+
+ /**
+ * This class is used to identify a cached classloader by its codebase and
+ * the context classloader that is its parent.
+ */
+ private static class CacheKey
+ {
+ private String mCodeBase;
+ private ClassLoader mContextClassLoader;
+
+ public CacheKey (String theCodebase, ClassLoader theContextClassLoader)
+ {
+ mCodeBase = theCodebase;
+ mContextClassLoader = theContextClassLoader;
+ }
+
+ /**
+ * @return true if the codebase and the context classloader are equal
+ */
+ public boolean equals (Object theOther)
+ {
+ if (theOther instanceof CacheKey)
+ {
+ CacheKey key = (CacheKey) theOther;
+
+ return (equals (this.mCodeBase,key.mCodeBase)
+ && equals (this.mContextClassLoader, key.mContextClassLoader));
+ }
+ return false;
+ }
+
+ /**
+ * Test if the two objects are equal or both null.
+ * @param theOne
+ * @param theOther
+ * @return
+ */
+ private boolean equals (Object theOne, Object theOther)
+ {
+ return theOne != null ? theOne.equals (theOther) : theOther == null;
+ }
+
+ /**
+ * @return hashCode
+ */
+ public int hashCode()
+ {
+ return ((mCodeBase != null ? mCodeBase.hashCode() : 0)
+ ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1));
+ }
+
+ public String toString()
+ {
+ return "[" + mCodeBase + "," + mContextClassLoader + "]";
+ }
+
+ }
+
+ private static RMIClassLoaderImpl instance = null;
+
+ private static Map cacheLoaders; //map annotations to loaders
+ private static Map cacheAnnotations; //map loaders to annotations
+ //class loader for defaultAnnotation
+ private static MyClassLoader defaultClassLoader;
+
+ //defaultAnnotation is got from system property
+ // "java.rmi.server.defaultAnnotation"
+ private static String defaultAnnotation;
+
+ //URL object for defaultAnnotation
+ private static URL defaultCodebase;
+
+ static
+ {
+ // 89 is a nice prime number for Hashtable initial capacity
+ cacheLoaders = new Hashtable (89);
+ cacheAnnotations = new Hashtable (89);
+
+ defaultAnnotation = System.getProperty ("java.rmi.server.defaultAnnotation");
+
+ try
+ {
+ if (defaultAnnotation != null)
+ defaultCodebase = new URL (defaultAnnotation);
+ }
+ catch (Exception _)
+ {
+ defaultCodebase = null;
+ }
+
+ if (defaultCodebase != null)
+ {
+ defaultClassLoader = new MyClassLoader (new URL[] { defaultCodebase }, null,
+ defaultAnnotation);
+ cacheLoaders.put (new CacheKey (defaultAnnotation,
+ Thread.currentThread().getContextClassLoader()),
+ defaultClassLoader);
+ }
+ }
+
+ /**
+ * This is a singleton class and may only be instantiated once from within
+ * the {@link #getInstance} method.
+ */
+ private RMIClassLoaderImpl()
+ {
+ }
+
+ /**
+ * Returns an instance of RMIClassLoaderImpl.
+ *
+ * @return an instance of RMIClassLoaderImpl
+ */
+ public static RMIClassLoaderSpi getInstance()
+ {
+ if (instance == null)
+ instance = new RMIClassLoaderImpl();
+ return instance;
+ }
+
+ public Class loadClass(String codeBase, String name,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ ClassLoader loader;
+ if (defaultLoader == null)
+ loader = Thread.currentThread().getContextClassLoader();
+ else
+ loader = defaultLoader;
+
+ //try context class loader first
+ try
+ {
+ return Class.forName(name, false, loader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ // class not found in the local classpath
+ }
+
+ if (codeBase.length() == 0) //==""
+ {
+ loader = defaultClassLoader;
+ }
+ else
+ {
+ loader = getClassLoader(codeBase);
+ }
+
+ if (loader == null)
+ {
+ //do not throw NullPointerException
+ throw new ClassNotFoundException ("Could not find class (" + name +
+ ") at codebase (" + codeBase + ")");
+ }
+
+ return Class.forName(name, false, loader);
+ }
+
+ public Class loadProxyClass(String codeBase, String[] interfaces,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ // FIXME: Implement this.
+ return null;
+ }
+
+ /**
+ * Gets a classloader for the given codebase and with the current
+ * context classloader as parent.
+ *
+ * @param codebase
+ *
+ * @return a classloader for the given codebase
+ *
+ * @throws MalformedURLException if the codebase contains a malformed URL
+ */
+ public ClassLoader getClassLoader(String codebase)
+ throws MalformedURLException
+ {
+ ClassLoader loader;
+ CacheKey loaderKey = new CacheKey
+ (codebase, Thread.currentThread().getContextClassLoader());
+ loader = (ClassLoader) cacheLoaders.get (loaderKey);
+
+ if (loader == null)
+ {
+ //create an entry in cacheLoaders mapping a loader to codebases.
+ // codebases are separated by " "
+ StringTokenizer tok = new StringTokenizer (codebase, " ");
+ ArrayList urls = new ArrayList();
+
+ while (tok.hasMoreTokens())
+ urls.add (new URL(tok.nextToken()));
+
+ loader = new MyClassLoader((URL[]) urls.toArray(new URL [urls.size()]),
+ Thread.currentThread().getContextClassLoader(),
+ codebase);
+ cacheLoaders.put (loaderKey, loader);
+ }
+
+ return loader;
+ }
+
+ /**
+ * Returns a string representation of the network location where a remote
+ * endpoint can get the class-definition of the given class.
+ *
+ * @param cl
+ *
+ * @return a space seperated list of URLs where the class-definition
+ * of cl may be found
+ */
+ public String getClassAnnotation(Class cl)
+ {
+ ClassLoader loader = cl.getClassLoader();
+
+ if (loader == null
+ || loader == ClassLoader.getSystemClassLoader())
+ {
+ return System.getProperty ("java.rmi.server.codebase");
+ }
+
+ if (loader instanceof MyClassLoader)
+ {
+ return ((MyClassLoader) loader).getClassAnnotation();
+ }
+
+ String s = (String) cacheAnnotations.get (loader);
+
+ if (s != null)
+ return s;
+
+ if (loader instanceof URLClassLoader)
+ {
+ URL[] urls = ((URLClassLoader) loader).getURLs();
+
+ if (urls.length == 0)
+ return null;
+
+ StringBuffer annotation = new StringBuffer (64 * urls.length);
+
+ for (int i = 0; i < urls.length; i++)
+ {
+ annotation.append (urls [i].toExternalForm());
+ annotation.append (' ');
+ }
+
+ s = annotation.toString();
+ cacheAnnotations.put (loader, s);
+ return s;
+ }
+
+ return System.getProperty ("java.rmi.server.codebase");
+ }
+}
diff --git a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
index 888b30bf6b6..587d57fc7bb 100644
--- a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
+++ b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
@@ -102,7 +102,7 @@ protected Class resolveProxyClass(String intfs[])
protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException {
if(valueClass.isPrimitive()){
if(valueClass == Boolean.TYPE)
- return new Boolean(readBoolean());
+ return Boolean.valueOf(readBoolean());
if(valueClass == Byte.TYPE)
return new Byte(readByte());
if(valueClass == Character.TYPE)
diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastServer.java b/libjava/classpath/gnu/java/rmi/server/UnicastServer.java
index 065ef8c77ee..a8da7256320 100644
--- a/libjava/classpath/gnu/java/rmi/server/UnicastServer.java
+++ b/libjava/classpath/gnu/java/rmi/server/UnicastServer.java
@@ -51,13 +51,16 @@ import java.rmi.RemoteException;
import java.rmi.ServerError;
import java.rmi.server.ObjID;
import java.rmi.server.UID;
+import java.util.Collections;
+import java.util.Map;
import java.util.Hashtable;
+import java.util.IdentityHashMap;
public class UnicastServer
implements ProtocolConstants {
static private Hashtable objects = new Hashtable(); //mapping OBJID to server ref
-static private Hashtable refcache = new Hashtable(); //mapping obj itself to server ref
+static private Map refcache = Collections.synchronizedMap(new IdentityHashMap()); //mapping obj itself to server ref
static private DGCImpl dgc;
public static void exportObject(UnicastServerRef obj) {
diff --git a/libjava/classpath/gnu/java/security/PolicyFile.java b/libjava/classpath/gnu/java/security/PolicyFile.java
index c6a3061ead2..3064f041b9d 100644
--- a/libjava/classpath/gnu/java/security/PolicyFile.java
+++ b/libjava/classpath/gnu/java/security/PolicyFile.java
@@ -533,7 +533,7 @@ public final class PolicyFile extends Policy
if (clazz == null)
{
currentPerms.add(new UnresolvedPermission(className,
- null, null, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+ null, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
continue;
}
try
@@ -555,7 +555,7 @@ public final class PolicyFile extends Policy
if (clazz == null)
{
currentPerms.add(new UnresolvedPermission(className,
- target, null, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+ target, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
continue;
}
try
@@ -598,7 +598,7 @@ public final class PolicyFile extends Policy
if (clazz == null)
{
currentPerms.add(new UnresolvedPermission(className,
- target, action, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+ target, action, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
continue;
}
else
diff --git a/libjava/classpath/gnu/java/security/der/BitString.java b/libjava/classpath/gnu/java/security/der/BitString.java
index b88b14541b6..02b1c037762 100644
--- a/libjava/classpath/gnu/java/security/der/BitString.java
+++ b/libjava/classpath/gnu/java/security/der/BitString.java
@@ -286,6 +286,19 @@ public class BitString implements Cloneable, Comparable
return 0; // not reached.
}
+ public int hashCode()
+ {
+ int result = 0;
+ for (int i = 0; i < bytes.length - 1; ++i)
+ result = result * 31 + bytes[i];
+ if (bytes.length > 0)
+ {
+ int lastByte = bytes[bytes.length - 1] & ~ ((1 << ignoredBits) - 1);
+ result = result * 31 + lastByte;
+ }
+ return result;
+ }
+
public boolean equals(Object o)
{
if (!(o instanceof BitString))
diff --git a/libjava/classpath/gnu/java/security/der/DERReader.java b/libjava/classpath/gnu/java/security/der/DERReader.java
index cb07f14325f..09ec1e2dff0 100644
--- a/libjava/classpath/gnu/java/security/der/DERReader.java
+++ b/libjava/classpath/gnu/java/security/der/DERReader.java
@@ -389,7 +389,7 @@ public class DERReader implements DER
Integer.parseInt(str.substring( 4, 6)), // day
Integer.parseInt(str.substring( 6, 8)), // hour
Integer.parseInt(str.substring( 8, 10))); // minute
- if (date.length() == 12);
+ if (date.length() == 12)
calendar.set(Calendar.SECOND,
Integer.parseInt(str.substring(10, 12)));
}
diff --git a/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java
new file mode 100644
index 00000000000..591fc688cc0
--- /dev/null
+++ b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java
@@ -0,0 +1,123 @@
+/* DiffieHellmanKeyFactoryImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.security.provider;
+
+import gnu.javax.crypto.GnuDHPrivateKey;
+
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.KeyFactorySpi;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.KeySpec;
+
+import javax.crypto.spec.DHParameterSpec;
+import javax.crypto.spec.DHPrivateKeySpec;
+import javax.crypto.spec.DHPublicKeySpec;
+
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.interfaces.DHPublicKey;
+
+public class DiffieHellmanKeyFactoryImpl extends KeyFactorySpi
+{
+ protected PrivateKey engineGeneratePrivate (final KeySpec spec)
+ throws InvalidKeySpecException
+ {
+ if (spec instanceof DHPrivateKeySpec)
+ {
+ DHPrivateKeySpec dh = (DHPrivateKeySpec) spec;
+ return new GnuDHPrivateKey (dh.getX (),
+ new DHParameterSpec (dh.getP (), dh.getG ()));
+ }
+ throw new InvalidKeySpecException ();
+ }
+
+ protected PublicKey engineGeneratePublic (final KeySpec spec)
+ throws InvalidKeySpecException
+ {
+ if (spec instanceof DHPublicKeySpec)
+ {
+ DHPublicKeySpec dh = (DHPublicKeySpec) spec;
+ return new GnuDHPublicKey (new DHParameterSpec (dh.getP (), dh.getG ()),
+ dh.getY(), null);
+ }
+ throw new InvalidKeySpecException ();
+ }
+
+ protected KeySpec engineGetKeySpec (final Key key, final Class specClass)
+ throws InvalidKeySpecException
+ {
+ if (key instanceof DHPrivateKey)
+ {
+ if (DHPrivateKeySpec.class.isAssignableFrom (specClass))
+ {
+ DHParameterSpec params = ((DHPrivateKey) key).getParams ();
+ return new DHPrivateKeySpec (((DHPrivateKey) key).getX (),
+ params.getP (), params.getG ());
+ }
+ }
+ if (key instanceof DHPublicKey)
+ {
+ if (DHPublicKeySpec.class.isAssignableFrom (specClass))
+ {
+ DHParameterSpec params = ((DHPublicKey) key).getParams ();
+ return new DHPublicKeySpec (((DHPublicKey) key).getY (),
+ params.getP (), params.getG ());
+ }
+ }
+ throw new InvalidKeySpecException ();
+ }
+
+ protected Key engineTranslateKey (final Key key)
+ throws InvalidKeyException
+ {
+ if (key instanceof DHPrivateKey)
+ {
+ return new GnuDHPrivateKey (((DHPrivateKey) key).getX (),
+ ((DHPrivateKey) key).getParams ());
+ }
+ if (key instanceof DHPublicKey)
+ {
+ return new GnuDHPublicKey (((DHPublicKey) key).getParams (),
+ ((DHPublicKey) key).getY (), null);
+ }
+ throw new InvalidKeyException ();
+ }
+}
diff --git a/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java
new file mode 100644
index 00000000000..1b68d274fa8
--- /dev/null
+++ b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java
@@ -0,0 +1,86 @@
+/* DiffieHellmanKeyPairGeneratorImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.security.provider;
+
+import gnu.javax.crypto.GnuDHPrivateKey;
+
+import java.math.BigInteger;
+
+import java.security.KeyPair;
+import java.security.KeyPairGeneratorSpi;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.spec.DHParameterSpec;
+
+public class DiffieHellmanKeyPairGeneratorImpl extends KeyPairGeneratorSpi
+{
+ private SecureRandom random;
+ private DHParameterSpec params;
+
+ public KeyPair generateKeyPair ()
+ {
+ if (params == null || random == null)
+ throw new IllegalStateException ("not initialized");
+ byte[] buf = new byte[(params.getP ().bitLength() >>> 3)];
+ random.nextBytes (buf);
+ BigInteger x = new BigInteger (1, buf);
+ BigInteger y = params.getG ().modPow (x, params.getP ());
+ GnuDHPublicKey pub = new GnuDHPublicKey (params, y, null);
+ GnuDHPrivateKey priv = new GnuDHPrivateKey (x, params);
+
+ return new KeyPair (pub, priv);
+ }
+
+ public void initialize (final int keysize, final SecureRandom random)
+ {
+ throw new UnsupportedOperationException ("key generation without parameters not supported");
+ }
+
+ public void initialize (final AlgorithmParameterSpec params,
+ final SecureRandom random)
+ {
+ if (!(params instanceof DHParameterSpec))
+ throw new IllegalArgumentException ("expecting Diffie-Hellman parameters");
+ this.params = (DHParameterSpec) params;
+ this.random = random;
+ if (this.random == null)
+ this.random = new SecureRandom ();
+ }
+}
diff --git a/libjava/classpath/gnu/java/security/provider/Gnu.java b/libjava/classpath/gnu/java/security/provider/Gnu.java
index 849f63c1601..e553bbcbd8a 100644
--- a/libjava/classpath/gnu/java/security/provider/Gnu.java
+++ b/libjava/classpath/gnu/java/security/provider/Gnu.java
@@ -46,7 +46,7 @@ public final class Gnu extends Provider
{
public Gnu()
{
- super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, RSA, X.509 Certificates and CRLs, PKIX certificate path validators, Collection cert stores");
+ super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, RSA, X.509 Certificates and CRLs, PKIX certificate path validators, Collection cert stores, Diffie-Hellman key agreement and key pair generator");
AccessController.doPrivileged (new PrivilegedAction()
{
@@ -100,10 +100,12 @@ public final class Gnu extends Provider
// Key Pair Generator
put("KeyPairGenerator.DSA",
gnu.java.security.provider.DSAKeyPairGenerator.class.getName());
+ put("KeyPairGenerator.DiffieHellman", DiffieHellmanKeyPairGeneratorImpl.class.getName ());
put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
+ put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
// Key Factory
put("KeyFactory.DSA",
@@ -122,6 +124,9 @@ public final class Gnu extends Provider
put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
+ put("KeyFactory.DiffieHellman", DiffieHellmanKeyFactoryImpl.class.getName());
+ put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
+
// Message Digests
put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName());
put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName());
@@ -161,6 +166,14 @@ public final class Gnu extends Provider
// CertStore
put("CertStore.Collection", CollectionCertStoreImpl.class.getName());
+ // KeyAgreement
+ put("KeyAgreement.DiffieHellman", gnu.javax.crypto.DiffieHellmanImpl.class.getName());
+ put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
+
+ // Cipher
+ put("Cipher.RSAES-PKCS1-v1_5", gnu.javax.crypto.RSACipherImpl.class.getName());
+ put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
+
return null;
}
});
diff --git a/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java b/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java
index 00f7a6ed220..d8f5c6158e3 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java
@@ -112,7 +112,7 @@ public class BasicConstraints extends Extension.Value
if (encoded == null)
{
List bc = new ArrayList (2);
- bc.add (new DERValue (DER.BOOLEAN, new Boolean (ca)));
+ bc.add (new DERValue (DER.BOOLEAN, Boolean.valueOf (ca)));
if (pathLenConstraint >= 0)
bc.add (new DERValue (DER.INTEGER,
BigInteger.valueOf ((long) pathLenConstraint)));
diff --git a/libjava/classpath/gnu/java/security/x509/ext/Extension.java b/libjava/classpath/gnu/java/security/x509/ext/Extension.java
index 5ca9ac3a91d..97097a2f380 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/Extension.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/Extension.java
@@ -232,7 +232,7 @@ public class Extension
{
List ext = new ArrayList (3);
ext.add (new DERValue (DER.OBJECT_IDENTIFIER, oid));
- ext.add (new DERValue (DER.BOOLEAN, new Boolean (critical)));
+ ext.add (new DERValue (DER.BOOLEAN, Boolean.valueOf (critical)));
ext.add (new DERValue (DER.OCTET_STRING, value.getEncoded()));
return new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, ext);
}
@@ -274,6 +274,14 @@ public class Extension
return (byte[]) encoded;
}
+ public int hashCode()
+ {
+ int result = 0;
+ for (int i = 0; i < encoded.length; ++i)
+ result = result * 31 + encoded[i];
+ return result;
+ }
+
public boolean equals(Object o)
{
if (!(o instanceof Value))
diff --git a/libjava/classpath/gnu/java/text/BaseBreakIterator.java b/libjava/classpath/gnu/java/text/BaseBreakIterator.java
index c28a2089ad7..4afd8ae6611 100644
--- a/libjava/classpath/gnu/java/text/BaseBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/BaseBreakIterator.java
@@ -68,12 +68,15 @@ public abstract class BaseBreakIterator extends BreakIterator
return iter.getBeginIndex();
}
+ /**
+ * Return the first boundary after <code>pos</code>.
+ * This has the side effect of setting the index of the
+ * CharacterIterator.
+ */
public int following (int pos)
{
- int save = iter.getIndex();
iter.setIndex(pos);
int r = next ();
- iter.setIndex(save);
return r;
}
diff --git a/libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java b/libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java
new file mode 100644
index 00000000000..4797af7cf79
--- /dev/null
+++ b/libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java
@@ -0,0 +1,159 @@
+/* DiffieHellmanImpl.java -- implementation of the Diffie-Hellman key agreement.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.crypto;
+
+import gnu.java.security.provider.GnuDHPublicKey;
+
+import java.math.BigInteger;
+
+import java.security.Key;
+import java.security.InvalidKeyException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.KeyAgreementSpi;
+import javax.crypto.SecretKey;
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.interfaces.DHPublicKey;
+import javax.crypto.spec.DHParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * The Diffie-Hellman key agreement.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public final class DiffieHellmanImpl extends KeyAgreementSpi
+{
+
+ /** The private key being used for this agreement. */
+ private DHPrivateKey key;
+
+ /** The current result. */
+ private BigInteger result;
+
+ /** True if the caller told us we are done. */
+ private boolean last_phase_done;
+
+ /** Trivial default constructor. */
+ public DiffieHellmanImpl ()
+ {
+ key = null;
+ result = null;
+ last_phase_done = false;
+ }
+
+ // KeyAgreementSpi methods.
+
+ protected Key engineDoPhase (final Key incoming, final boolean lastPhase)
+ throws InvalidKeyException
+ {
+ if (key == null)
+ throw new IllegalStateException ("not initialized");
+ if (last_phase_done)
+ throw new IllegalStateException ("last phase already done");
+
+ if (!(incoming instanceof DHPublicKey))
+ throw new InvalidKeyException ("expecting javax.crypto.interfaces.DHPublicKey");
+ DHPublicKey pub = (DHPublicKey) incoming;
+ DHParameterSpec s1 = key.getParams();
+ DHParameterSpec s2 = pub.getParams();
+ if (!s1.getG().equals (s2.getG())
+ || !s1.getP().equals (s2.getP())
+ || s1.getL() != s2.getL())
+ throw new InvalidKeyException ("supplied key is not compatible");
+
+ result = pub.getY().modPow (key.getX(), s1.getP());
+ if (lastPhase)
+ {
+ last_phase_done = true;
+ return null;
+ }
+
+ throw new IllegalArgumentException ("only supports two-party Diffie Hellman");
+ }
+
+ protected byte[] engineGenerateSecret ()
+ {
+ if (result == null || !last_phase_done)
+ throw new IllegalStateException ("not finished");
+
+ byte[] buf = result.toByteArray ();
+ if (buf[0] == 0x00)
+ {
+ byte[] buf2 = new byte[buf.length - 1];
+ System.arraycopy (buf, 1, buf2, 0, buf2.length);
+ buf = buf2;
+ }
+ return buf;
+ }
+
+ protected int engineGenerateSecret (final byte[] secret, final int offset)
+ {
+ byte[] s = engineGenerateSecret();
+ System.arraycopy (s, 0, secret, offset, s.length);
+ return s.length;
+ }
+
+ protected SecretKey engineGenerateSecret (final String algorithm)
+ throws InvalidKeyException
+ {
+ byte[] s = engineGenerateSecret();
+ return new SecretKeySpec (s, algorithm);
+ }
+
+ protected void engineInit (final Key key, final SecureRandom random)
+ throws InvalidKeyException
+ {
+ if (!(key instanceof DHPrivateKey))
+ throw new InvalidKeyException ("not a javax.crypto.interfaces.DHPrivateKey");
+ this.key = (DHPrivateKey) key;
+ result = null;
+ last_phase_done = false;
+ }
+
+ protected void engineInit (final Key key, final AlgorithmParameterSpec params,
+ final SecureRandom random)
+ throws InvalidKeyException
+ {
+ engineInit (key, random);
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java b/libjava/classpath/gnu/javax/crypto/GnuDHPrivateKey.java
index 3f6f5454e73..f70cd7d2aec 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java
+++ b/libjava/classpath/gnu/javax/crypto/GnuDHPrivateKey.java
@@ -1,5 +1,5 @@
-/* ConnectionEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+/* GnuDHPrivateKey.java -- a Diffie-Hellman private key.
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ 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
@@ -36,46 +36,55 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.protocol.http.event;
+package gnu.javax.crypto;
+
+import java.math.BigInteger;
-import java.util.EventObject;
+import javax.crypto.interfaces.DHKey;
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.spec.DHParameterSpec;
/**
- * A connection event.
+ * A Diffie-Hellman private key.
*
- * @author Chris Burdess (dog@gnu.org)
+ * @author Casey Marshall (csm@gnu.org)
*/
-public class ConnectionEvent
- extends EventObject
+public class GnuDHPrivateKey implements DHPrivateKey
{
- /**
- * The connection closed event type.
- */
- public static final int CONNECTION_CLOSED = 0;
-
- /**
- * The type of this event.
- */
- protected int type;
-
- /**
- * Constructs a connection event with the specified source and type.
- */
- public ConnectionEvent(Object source, int type)
+ private final BigInteger x;
+ private final DHParameterSpec params;
+
+ public GnuDHPrivateKey (final BigInteger x, final DHParameterSpec params)
{
- super(source);
- this.type = type;
+ x.getClass ();
+ params.getClass ();
+ this.x = x;
+ this.params = params;
}
- /**
- * Returns the type of this event.
- * @see #type
- */
- public int getType()
+ public DHParameterSpec getParams()
{
- return type;
+ return params;
+ }
+
+ public String getAlgorithm()
+ {
+ return "DiffieHellman";
+ }
+
+ public String getFormat ()
+ {
+ return "NONE";
+ }
+
+ public byte[] getEncoded ()
+ {
+ return null;
}
-
-}
+ public BigInteger getX ()
+ {
+ return x;
+ }
+}
diff --git a/libjava/classpath/gnu/javax/crypto/RSACipherImpl.java b/libjava/classpath/gnu/javax/crypto/RSACipherImpl.java
new file mode 100644
index 00000000000..0a4c29db6f1
--- /dev/null
+++ b/libjava/classpath/gnu/javax/crypto/RSACipherImpl.java
@@ -0,0 +1,311 @@
+/* DiffieHellmanImpl.java -- implementation of the Diffie-Hellman key agreement.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.crypto;
+
+import gnu.classpath.ByteArray;
+import gnu.classpath.debug.Component;
+import gnu.classpath.debug.SystemLogger;
+
+import java.math.BigInteger;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+import java.security.interfaces.RSAKey;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPrivateCrtKey;
+import java.security.interfaces.RSAPublicKey;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+import java.util.logging.Logger;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.CipherSpi;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.ShortBufferException;
+
+public class RSACipherImpl extends CipherSpi
+{
+ private static final Logger logger = SystemLogger.SYSTEM;
+
+ private static final byte[] EMPTY = new byte[0];
+ private int opmode = -1;
+ private RSAPrivateKey decipherKey = null;
+ private RSAPublicKey blindingKey = null;
+ private RSAPublicKey encipherKey = null;
+ private SecureRandom random = null;
+ private byte[] dataBuffer = null;
+ private int pos = 0;
+
+ protected void engineSetMode (String mode) throws NoSuchAlgorithmException
+ {
+ throw new NoSuchAlgorithmException ("only one mode available");
+ }
+
+ protected void engineSetPadding (String pad) throws NoSuchPaddingException
+ {
+ throw new NoSuchPaddingException ("only one padding available");
+ }
+
+ protected int engineGetBlockSize ()
+ {
+ return 1;
+ }
+
+ protected int engineGetOutputSize (int inputLen)
+ {
+ int outputLen = 0;
+ if (decipherKey != null)
+ {
+ outputLen = (decipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else if (encipherKey != null)
+ {
+ outputLen = (encipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else
+ throw new IllegalStateException ("not initialized");
+ if (inputLen > outputLen)
+ throw new IllegalArgumentException ("not configured to encode " + inputLen
+ + "bytes; at most " + outputLen);
+ return outputLen;
+ }
+
+ protected int engineGetKeySize (final Key key) throws InvalidKeyException
+ {
+ if (!(key instanceof RSAKey))
+ throw new InvalidKeyException ("not an RSA key");
+ return ((RSAKey) key).getModulus ().bitLength ();
+ }
+
+ protected byte[] engineGetIV ()
+ {
+ return null;
+ }
+
+ protected AlgorithmParameters engineGetParameters()
+ {
+ return null;
+ }
+
+ protected void engineInit (int opmode, Key key, SecureRandom random)
+ throws InvalidKeyException
+ {
+ int outputLen = 0;
+ if (opmode == Cipher.ENCRYPT_MODE)
+ {
+ if (!(key instanceof RSAPublicKey))
+ throw new InvalidKeyException ("expecting a RSAPublicKey");
+ encipherKey = (RSAPublicKey) key;
+ decipherKey = null;
+ blindingKey = null;
+ outputLen = (encipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else if (opmode == Cipher.DECRYPT_MODE)
+ {
+ if (key instanceof RSAPrivateKey)
+ {
+ decipherKey = (RSAPrivateKey) key;
+ encipherKey = null;
+ blindingKey = null;
+ outputLen = (decipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else if (key instanceof RSAPublicKey)
+ {
+ if (decipherKey == null)
+ throw new IllegalStateException ("must configure decryption key first");
+ if (!decipherKey.getModulus ().equals (((RSAPublicKey) key).getModulus ()))
+ throw new InvalidKeyException ("blinding key is not compatible");
+ blindingKey = (RSAPublicKey) key;
+ return;
+ }
+ else
+ throw new InvalidKeyException ("expecting either an RSAPrivateKey or an RSAPublicKey (for blinding)");
+ }
+ else
+ throw new IllegalArgumentException ("only encryption and decryption supported");
+ this.random = random;
+ this.opmode = opmode;
+ pos = 0;
+ dataBuffer = new byte[outputLen];
+ }
+
+ protected void engineInit (int opmode, Key key, AlgorithmParameterSpec spec, SecureRandom random)
+ throws InvalidKeyException
+ {
+ engineInit (opmode, key, random);
+ }
+
+ protected void engineInit (int opmode, Key key, AlgorithmParameters params, SecureRandom random)
+ throws InvalidKeyException
+ {
+ engineInit (opmode, key, random);
+ }
+
+ protected byte[] engineUpdate (byte[] in, int offset, int length)
+ {
+ if (opmode != Cipher.ENCRYPT_MODE && opmode != Cipher.DECRYPT_MODE)
+ throw new IllegalStateException ("not initialized");
+ System.arraycopy (in, offset, dataBuffer, pos, length);
+ pos += length;
+ return EMPTY;
+ }
+
+ protected int engineUpdate (byte[] in, int offset, int length, byte[] out, int outOffset)
+ {
+ engineUpdate (in, offset, length);
+ return 0;
+ }
+
+ protected byte[] engineDoFinal (byte[] in, int offset, int length)
+ throws IllegalBlockSizeException, BadPaddingException
+ {
+ engineUpdate (in, offset, length);
+ if (opmode == Cipher.DECRYPT_MODE)
+ {
+ if (pos < dataBuffer.length)
+ throw new IllegalBlockSizeException ("expecting exactly " + dataBuffer.length + " bytes");
+ BigInteger enc = new BigInteger (1, dataBuffer);
+ byte[] dec = rsaDecrypt (enc);
+ logger.log (Component.CRYPTO, "RSA: decryption produced\n{0}",
+ new ByteArray (dec));
+ if (dec[0] != 0x02)
+ throw new BadPaddingException ("expected padding type 2");
+ int i;
+ for (i = 1; i < dec.length && dec[i] != 0x00; i++);
+ int len = dec.length - i;
+ byte[] result = new byte[len];
+ System.arraycopy (dec, i, result, 0, len);
+ pos = 0;
+ return result;
+ }
+ else
+ {
+ offset = dataBuffer.length - pos;
+ if (offset < 3)
+ throw new IllegalBlockSizeException ("input is too large to encrypt");
+ byte[] dec = new byte[dataBuffer.length];
+ dec[0] = 0x02;
+ if (random == null)
+ random = new SecureRandom ();
+ byte[] pad = new byte[offset - 2];
+ random.nextBytes (pad);
+ for (int i = 0; i < pad.length; i++)
+ if (pad[i] == 0)
+ pad[i] = 1;
+ System.arraycopy (pad, 0, dec, 1, pad.length);
+ dec[dec.length - pos] = 0x00;
+ System.arraycopy (dataBuffer, 0, dec, offset, pos);
+ logger.log (Component.CRYPTO, "RSA: produced padded plaintext\n{0}",
+ new ByteArray (dec));
+ BigInteger x = new BigInteger (1, dec);
+ BigInteger y = x.modPow (encipherKey.getPublicExponent (),
+ encipherKey.getModulus ());
+ byte[] enc = y.toByteArray ();
+ if (enc[0] == 0x00)
+ {
+ byte[] tmp = new byte[enc.length - 1];
+ System.arraycopy (enc, 1, tmp, 0, tmp.length);
+ enc = tmp;
+ }
+ pos = 0;
+ return enc;
+ }
+ }
+
+ protected int engineDoFinal (byte[] out, int offset)
+ throws ShortBufferException, IllegalBlockSizeException, BadPaddingException
+ {
+ byte[] result = engineDoFinal (EMPTY, 0, 0);
+ if (out.length - offset < result.length)
+ throw new ShortBufferException ("need " + result.length + ", have "
+ + (out.length - offset));
+ System.arraycopy (result, 0, out, offset, result.length);
+ return result.length;
+ }
+
+ protected int engineDoFinal (final byte[] input, final int offset, final int length,
+ final byte[] output, final int outputOffset)
+ throws ShortBufferException, IllegalBlockSizeException, BadPaddingException
+ {
+ byte[] result = engineDoFinal (input, offset, length);
+ if (output.length - outputOffset < result.length)
+ throw new ShortBufferException ("need " + result.length + ", have "
+ + (output.length - outputOffset));
+ System.arraycopy (result, 0, output, outputOffset, result.length);
+ return result.length;
+ }
+
+ /**
+ * Decrypts the ciphertext, employing RSA blinding if possible.
+ */
+ private byte[] rsaDecrypt (BigInteger enc)
+ {
+ if (random == null)
+ random = new SecureRandom ();
+ BigInteger n = decipherKey.getModulus ();
+ BigInteger r = null;
+ BigInteger pubExp = null;
+ if (blindingKey != null)
+ pubExp = blindingKey.getPublicExponent ();
+ if (pubExp != null && (decipherKey instanceof RSAPrivateCrtKey))
+ pubExp = ((RSAPrivateCrtKey) decipherKey).getPublicExponent ();
+ if (pubExp != null)
+ {
+ r = new BigInteger (n.bitLength () - 1, random);
+ enc = r.modPow (pubExp, n).multiply (enc).mod (n);
+ }
+
+ BigInteger dec = enc.modPow (decipherKey.getPrivateExponent (), n);
+
+ if (pubExp != null)
+ {
+ dec = dec.multiply (r.modInverse (n)).mod (n);
+ }
+
+ return dec.toByteArray ();
+ }
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java
new file mode 100644
index 00000000000..c4a582bfa20
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java
@@ -0,0 +1,169 @@
+/* BMPDecoder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.image.ColorModel;
+import java.awt.image.IndexColorModel;
+import java.awt.image.BufferedImage;
+
+public abstract class BMPDecoder {
+
+ protected BMPInfoHeader infoHeader;
+ protected BMPFileHeader fileHeader;
+ protected long offset;
+
+ public BMPDecoder(BMPFileHeader fh, BMPInfoHeader ih){
+ fileHeader = fh;
+ infoHeader = ih;
+ offset = BMPFileHeader.SIZE + BMPInfoHeader.SIZE;
+ }
+
+ /**
+ * Determines the coding type of the bitmap and returns the corresponding
+ * decoder.
+ */
+ public static BMPDecoder getDecoder(BMPFileHeader fh, BMPInfoHeader ih){
+ switch(ih.getCompression()){
+ case BMPInfoHeader.BI_RGB: // uncompressed RGB
+ switch(ih.getBitCount()){
+ case 32:
+ return new DecodeBF32(fh, ih, true);
+
+ case 24:
+ return new DecodeRGB24(fh, ih);
+
+ case 16:
+ return new DecodeBF16(fh, ih, true);
+
+ case 8:
+ return new DecodeRGB8(fh, ih);
+
+ case 4:
+ return new DecodeRGB4(fh, ih);
+
+ case 1:
+ return new DecodeRGB1(fh, ih);
+
+ default:
+ return null;
+ }
+
+ case BMPInfoHeader.BI_RLE8:
+ return new DecodeRLE8(fh, ih);
+
+ case BMPInfoHeader.BI_RLE4:
+ return new DecodeRLE4(fh, ih);
+
+ case BMPInfoHeader.BI_BITFIELDS:
+ switch(ih.getBitCount()){
+ case 16:
+ return new DecodeBF16(fh, ih, false);
+
+ case 32:
+ return new DecodeBF32(fh, ih, false);
+
+ default:
+ return null;
+ }
+
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * The image decoder.
+ */
+ public abstract BufferedImage decode(ImageInputStream in)
+ throws IOException, BMPException;
+
+ /**
+ * Reads r,g,b bit masks from an inputstream
+ */
+ protected int[] readBitMasks(ImageInputStream in) throws IOException {
+ int[] bitmasks = new int[3];
+ byte[] temp = new byte[12];
+ if(in.read(temp) != 12)
+ throw new IOException("Couldn't read bit masks.");
+ offset += 12;
+
+ ByteBuffer buf = ByteBuffer.wrap(temp);
+ buf.order(ByteOrder.LITTLE_ENDIAN);
+ bitmasks[0] = buf.getInt();
+ bitmasks[1] = buf.getInt();
+ bitmasks[2] = buf.getInt();
+ return bitmasks;
+ }
+
+ /**
+ * Reads an N-color palette from an inputstream in RGBQUAD format and
+ * returns an equivalent ColorModel object
+ */
+ protected IndexColorModel readPalette(ImageInputStream in) throws IOException {
+ int N = infoHeader.getNumberOfPaletteEntries();
+ byte[] r = new byte[N];
+ byte[] g = new byte[N];
+ byte[] b = new byte[N];
+ for(int i=0;i<N;i++){
+ byte[] RGBquad = new byte[4];
+ if(in.read(RGBquad) != 4)
+ throw new IOException("Error reading palette information.");
+ // RGBQUAD structure is b,g,r,0
+ r[i] = RGBquad[2];
+ g[i] = RGBquad[1];
+ b[i] = RGBquad[0];
+ }
+
+ offset += 4*N;
+ return new IndexColorModel(8, N, r, g, b);
+ }
+
+ /**
+ * Read bytes to the start of the image data
+ */
+ protected void skipToImage(ImageInputStream in) throws IOException {
+ byte[] d = new byte[1];
+ long n = fileHeader.getOffset() - offset;
+ for(int i=0;i<n;i++)
+ in.read(d);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPException.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPException.java
new file mode 100644
index 00000000000..d3c62e7597e
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPException.java
@@ -0,0 +1,47 @@
+/* BMPException.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import javax.imageio.IIOException;
+
+public class BMPException extends IIOException {
+
+ public BMPException(String message){
+ super(message);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java
new file mode 100644
index 00000000000..246e0eacfeb
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java
@@ -0,0 +1,128 @@
+/* BMPFileHeader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class BMPFileHeader {
+ /** Header signature, always 'BM' */
+ private final static short bfType = 0x424d;
+
+ /** Bitmap file size, in bytes. */
+ private long bfSize;
+
+ /** Offset from the beginning of the file to the bitmap data */
+ private long bfOffBits;
+
+ /** BITMAPFILEHEADER is 14 bytes */
+ public static final int SIZE = 14;
+
+ /**
+ * Creates the header from an input stream, which is not closed.
+ * @throws IOException if an I/O error occured.
+ * @throws BMPException if the header was invalid
+ */
+ public BMPFileHeader(ImageInputStream in) throws IOException, BMPException {
+ byte[] data = new byte[SIZE];
+
+ if (in.read(data) != SIZE)
+ throw new IOException("Couldn't read header.");
+ ByteBuffer buf = ByteBuffer.wrap(data);
+
+ if(buf.getShort(0) != bfType)
+ throw new BMPException("Not a BMP file.");
+
+ buf.order(ByteOrder.LITTLE_ENDIAN);
+
+ // get size (keep unsigned)
+ bfSize = ((long)buf.getInt(2) & (0xFFFFFFFF));
+
+ // Two reserved shorts are here, and should be zero,
+ // perhaps they should be tested to be zero, but I don't
+ // feel this strictness is necessary.
+
+ bfOffBits = ((long)buf.getInt(10) & (0xFFFFFFFF));
+ }
+
+ /**
+ * Writes the header to an output stream, which is not closed or flushed.
+ * @throws IOException if an I/O error occured.
+ */
+ public void write(OutputStream out) throws IOException {
+ ByteBuffer buf = ByteBuffer.allocate(SIZE);
+ buf.putShort(0, bfType); // ID
+ buf.putInt(2, (int)(bfSize & (0xFFFFFFFF))); // size
+ buf.putInt(6, 0); // 4 reserved bytes set to zero
+ buf.putInt(2, (int)(bfOffBits & (0xFFFFFFFF))); // size
+ out.write(buf.array());
+ }
+
+ /**
+ * Sets the file size
+ */
+ public void setSize(long size){
+ bfSize = size;
+ }
+
+ /**
+ * Sets the bitmap offset within the file
+ */
+ public void setOffset(long offset){
+ bfOffBits = offset;
+ }
+
+ /**
+ * Gets the file size
+ */
+ public long getSize(){
+ return bfSize;
+ }
+
+ /**
+ * Gets the bitmap offset within the file
+ */
+ public long getOffset(){
+ return bfOffBits;
+ }
+}
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java
new file mode 100644
index 00000000000..3341d4b4aed
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java
@@ -0,0 +1,153 @@
+/* BMPImageReader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.*;
+import javax.imageio.spi.*;
+import javax.imageio.metadata.*;
+import javax.imageio.stream.ImageInputStream;
+import java.util.Iterator;
+import java.awt.image.BufferedImage;
+
+public class BMPImageReader extends ImageReader {
+ private BMPInfoHeader infoHeader;
+ private BMPFileHeader fileHeader;
+ private BMPDecoder decoder;
+
+ protected BMPImageReader(ImageReaderSpi originatingProvider){
+ super(originatingProvider);
+ infoHeader = null;
+ fileHeader = null;
+ decoder = null;
+ }
+
+ private void validateIndex(int imageIndex)
+ throws IndexOutOfBoundsException {
+ if (imageIndex != 0)
+ throw new IndexOutOfBoundsException("Invalid image index.");
+ }
+
+ public void setInput(Object input) {
+ super.setInput(input);
+ }
+
+ public void setInput(Object input,
+ boolean seekForwardOnly,
+ boolean ignoreMetadata) {
+ super.setInput(input, seekForwardOnly, ignoreMetadata);
+ }
+
+ public void setInput(Object input, boolean isStreamable) {
+ super.setInput(input, isStreamable);
+
+ if (!(input instanceof ImageInputStream))
+ throw new IllegalArgumentException("Input not an ImageInputStream.");
+ }
+
+ private void checkStream() throws IOException {
+ if (!(input instanceof ImageInputStream))
+ throw new IllegalStateException("Input not an ImageInputStream.");
+ if(input == null)
+ throw new IllegalStateException("No input stream.");
+
+ }
+
+ private void readHeaders() throws IOException, IIOException {
+ if(fileHeader != null)
+ return;
+
+ checkStream();
+
+ fileHeader = new BMPFileHeader((ImageInputStream)input);
+ infoHeader = new BMPInfoHeader((ImageInputStream)input);
+ decoder = BMPDecoder.getDecoder(fileHeader, infoHeader);
+ }
+
+ public int getWidth(int imageIndex) throws IOException {
+ validateIndex(imageIndex);
+ readHeaders();
+ return infoHeader.getWidth();
+ }
+
+ public int getHeight(int imageIndex) throws IOException {
+ validateIndex(imageIndex);
+ readHeaders();
+ return infoHeader.getHeight();
+ }
+
+ public Iterator getImageTypes(int imageIndex){
+ validateIndex(imageIndex);
+ return null;
+ }
+
+ /**
+ * Returns the number of images. BMP files can only contain a single one.
+ */
+ public int getNumImages(boolean allowSearch){
+ return 1;
+ }
+
+
+ // FIXME: Support metadata
+ public IIOMetadata getImageMetadata(int imageIndex){
+ validateIndex(imageIndex);
+ return null;
+ }
+
+ // FIXME: Support metadata
+ public IIOMetadata getStreamMetadata(){
+ return null;
+ }
+
+ /**
+ * Reads the image indexed by imageIndex and returns it as
+ * a complete BufferedImage, using a supplied ImageReadParam.
+ */
+ public BufferedImage read(int imageIndex, ImageReadParam param)
+ throws IOException, IIOException {
+ validateIndex(imageIndex);
+ readHeaders();
+ return decoder.decode((ImageInputStream)input);
+ }
+
+
+}
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java
new file mode 100644
index 00000000000..b175c7d076b
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java
@@ -0,0 +1,123 @@
+/* BMPImageReaderSpi.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import java.util.Locale;
+import javax.imageio.ImageReader;
+import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.stream.ImageInputStream;
+
+public class BMPImageReaderSpi extends ImageReaderSpi {
+
+ static final String vendorName = "GNU";
+ static final String version = "0.1";
+ static final String readerClassName =
+ "gnu.javax.imageio.bmp.BMPImageReader";
+ static final String[] names = { "Microsoft Windows BMP" };
+ static final String[] suffixes = { ".bmp", ".bm" };
+ static final String[] MIMETypes = {
+ "image/bmp",
+ "image/x-windows-bmp"};
+
+ static final String[] writerSpiNames = null;
+ //{"com.mycompany.imageio.MyFormatImageWriterSpi" };
+
+ static final boolean supportsStandardStreamMetadataFormat = false;
+ static final String nativeStreamMetadataFormatName = null;
+ static final String nativeStreamMetadataFormatClassName = null;
+ static final String[] extraStreamMetadataFormatNames = null;
+ static final String[] extraStreamMetadataFormatClassNames = null;
+ static final boolean supportsStandardImageMetadataFormat = false;
+ static final String nativeImageMetadataFormatName = null;
+ static final String nativeImageMetadataFormatClassName = null;
+ static final String[] extraImageMetadataFormatNames = null;
+ static final String[] extraImageMetadataFormatClassNames = null;
+
+ public BMPImageReaderSpi() {
+ super(vendorName, version,
+ names, suffixes, MIMETypes,
+ readerClassName,
+ STANDARD_INPUT_TYPE, // Accept ImageImageInputStreams
+ writerSpiNames,
+ supportsStandardStreamMetadataFormat,
+ nativeStreamMetadataFormatName,
+ nativeStreamMetadataFormatClassName,
+ extraStreamMetadataFormatNames,
+ extraStreamMetadataFormatClassNames,
+ supportsStandardImageMetadataFormat,
+ nativeImageMetadataFormatName,
+ nativeImageMetadataFormatClassName,
+ extraImageMetadataFormatNames,
+ extraImageMetadataFormatClassNames);
+ }
+
+ public String getDescription(Locale locale) {
+ return "Microsoft BMP v3";
+ }
+
+ public boolean canDecodeInput(Object input)
+ throws IOException {
+ if (!(input instanceof ImageInputStream))
+ return false;
+
+ ImageInputStream in = (ImageInputStream)input;
+ boolean retval;
+
+ in.mark();
+ try {
+ new BMPFileHeader(in);
+ retval = true;
+ } catch(BMPException e){
+ retval = false;
+ }
+ in.reset();
+
+ return retval;
+ }
+
+ public ImageReader createReaderInstance(Object extension) {
+ return new BMPImageReader(this);
+ }
+}
+
+
+
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java
new file mode 100644
index 00000000000..edcb4e644cc
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java
@@ -0,0 +1,201 @@
+/* BMPInfoHeader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.Dimension;
+
+public class BMPInfoHeader {
+ /** Size of the bitmap info header*/
+ private int biSize;
+
+ /** Pixel width of the bitmap */
+ private int biWidth;
+
+ /** Pixel height of the bitmap */
+ private int biHeight;
+
+ /** Number of bitplanes = 1 */
+ private short biPlanes;
+
+ /** Number of bpp = 1,4,8,24 */
+ private short biBitCount;
+
+ /** Compression type, RGB8, RLE8, RLE4, BITFIELDS */
+ private int biCompression;
+
+ /** Byte size of the uncompressed bitmap, can be 0. */
+ private int biSizeImage;
+
+ /** X resolution, dots per meter */
+ private int biXPelsPerMeter;
+
+ /** Y resolution, dots per meter */
+ private int biYPelsPerMeter;
+
+ /** Number of colors used (palette only, can be 0 for all) */
+ private int biClrUsed;
+
+ /** Number of 'important' colors, 0 for all */
+ private int biClrImportant;
+
+ /** BITMAPINFOHEADER is 40 bytes */
+ public static final int SIZE = 40;
+
+ /**
+ * Compression types
+ */
+ public static final int BI_RGB = 0;
+ public static final int BI_RLE8 = 1;
+ public static final int BI_RLE4 = 2;
+ public static final int BI_BITFIELDS = 3;
+
+ /**
+ * Creates the header from an input stream, which is not closed.
+ * @throws IOException if an I/O error occured.
+ * @throws BMPException if the header was invalid
+ */
+ public BMPInfoHeader(ImageInputStream in) throws IOException, BMPException {
+ byte[] data = new byte[SIZE];
+
+ if (in.read(data) != SIZE)
+ throw new IOException("Couldn't read header.");
+ ByteBuffer buf = ByteBuffer.wrap(data);
+ buf.order(ByteOrder.LITTLE_ENDIAN);
+
+ int n;
+ if((n=buf.getInt()) != SIZE)
+ throw new BMPException("Invalid BITMAPINFOHEADER size: "+n);
+
+ biWidth = buf.getInt();
+ biHeight = buf.getInt();
+ biPlanes = buf.getShort();
+ setBitCount(buf.getShort());
+ setCompression(buf.getInt());
+ biSizeImage = buf.getInt();
+ biXPelsPerMeter = buf.getInt();
+ biYPelsPerMeter = buf.getInt();
+ biClrUsed = buf.getInt();
+ biClrImportant = buf.getInt();
+ }
+
+ public void setBitCount(short bitcount) throws BMPException {
+ switch(bitcount){
+ case 1:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ biBitCount = bitcount;
+ break;
+
+ default:
+ throw new BMPException("Invalid number of bits per pixel: "+
+ bitcount);
+ }
+ }
+
+ public short getBitCount() { return biBitCount; }
+
+ public void setCompression(int compression) throws BMPException {
+ switch(compression){
+ case BI_RLE8:
+ if(getBitCount() != 8)
+ throw new BMPException("Invalid number of bits per pixel.");
+ biCompression = compression;
+ break;
+ case BI_RLE4:
+ if(getBitCount() != 4)
+ throw new BMPException("Invalid number of bits per pixel.");
+ biCompression = compression;
+ break;
+
+ case BI_RGB:
+ case BI_BITFIELDS:
+ biCompression = compression;
+ break;
+
+ default:
+ throw new BMPException("Unknown bitmap compression type.");
+ }
+ }
+
+ public int getNumberOfPaletteEntries(){
+ if(biClrUsed == 0)
+ switch(biBitCount){
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+
+ default: // should not happen
+ return 0;
+ }
+
+ return biClrUsed;
+ }
+
+ public int getCompression(){
+ return biCompression;
+ }
+
+ public Dimension getSize(){
+ return new Dimension(biWidth, biHeight);
+ }
+
+ public int getWidth(){
+ return biWidth;
+ }
+
+ public int getHeight(){
+ return biHeight;
+ }
+
+ public void setSize(Dimension d){
+ biWidth = (int)d.getWidth();
+ biHeight = (int)d.getHeight();
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
new file mode 100644
index 00000000000..702c93ab3ca
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
@@ -0,0 +1,104 @@
+/* DecodeBF16.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferUShort;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeBF16 extends BMPDecoder {
+ private int[] bitmasks;
+ private boolean useDefaultMasks;
+
+ public DecodeBF16(BMPFileHeader fh, BMPInfoHeader ih,
+ boolean udm){
+ super(fh,ih);
+
+ useDefaultMasks = udm;
+ if(useDefaultMasks) // 5-6-5 mask, B,G,R
+ bitmasks = new int[] { 0x00F800, 0x0007E0, 0x00001F };
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ if(!useDefaultMasks)
+ bitmasks = readBitMasks(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ // BMP scanlines are padded to dword offsets
+ int scansize = (w + (w&1)) << 1;
+ short[] data = new short[w*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = (short)((scanline[x*2] & (0xFF)) |
+ ((scanline[x*2+1] & (0xFF)) << 8));
+ }
+
+ ColorModel cm = new DirectColorModel(16,
+ bitmasks[0], bitmasks[1], bitmasks[2]);
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_USHORT,
+ w, h,
+ bitmasks);
+ DataBuffer db = new DataBufferUShort(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+ return new BufferedImage(cm, raster, false, null);
+ }
+
+}
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java
new file mode 100644
index 00000000000..ee64f4b0eac
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java
@@ -0,0 +1,108 @@
+/* DecodeBF32.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferInt;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeBF32 extends BMPDecoder {
+ private int[] bitmasks;
+ private boolean useDefaultMasks;
+
+ public DecodeBF32(BMPFileHeader fh, BMPInfoHeader ih,
+ boolean udm){
+ super(fh,ih);
+
+ useDefaultMasks = udm;
+ if(useDefaultMasks)
+ bitmasks = new int[] { 0x00FF0000, 0x0000FF00, 0x000000FF };
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ if(!useDefaultMasks)
+ bitmasks = readBitMasks(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ // BMP scanlines are padded to dword offsets
+ int scansize = w << 2;
+ int[] data = new int[w*h];
+
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = ((scanline[x<<2] & (0xFF)) |
+ ((scanline[(x<<2)+1] & (0xFF)) << 8) |
+ ((scanline[(x<<2)+2] & (0xFF)) << 16) |
+ ((scanline[(x<<2)+3] & (0xFF)) << 24));
+ }
+
+ ColorModel cm = new DirectColorModel(32,
+ bitmasks[0], bitmasks[1], bitmasks[2]);
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,
+ w, h,
+ bitmasks);
+ DataBuffer db = new DataBufferInt(data, w*h);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(cm, raster, false, null);
+ }
+
+}
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java
new file mode 100644
index 00000000000..9ca82d9ee4a
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java
@@ -0,0 +1,96 @@
+/* DecodeRGB1.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRGB1 extends BMPDecoder {
+
+ public DecodeRGB1(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ public BufferedImage decode(ImageInputStream in)
+ throws IOException, BMPException {
+
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+ int size = (w*h)>>3;
+
+ int scansize = w>>3;
+ byte[] data = new byte[size];
+
+ for(int y=h-1;y>=0;y--){
+ // Scanlines are padded to dword boundries
+ int readsize = scansize;
+ if((readsize & 3) != 0) readsize += (4 - (scansize & 3));
+
+ byte[] scanline = new byte[readsize];
+ if(in.read(scanline) != readsize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<scansize;x++)
+ data[x + y*scansize] = scanline[x];
+ }
+
+ SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h, 1);
+
+ DataBuffer db = new DataBufferByte(data, size, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+}
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java
new file mode 100644
index 00000000000..2a910cb3063
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java
@@ -0,0 +1,77 @@
+/* DecodeRGB24.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.Dimension;
+
+public class DecodeRGB24 extends BMPDecoder {
+
+ public DecodeRGB24(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+ BufferedImage image = new BufferedImage(w, h,
+ BufferedImage.TYPE_INT_RGB);
+ // BMP scanlines are padded to dword offsets
+ int scansize = ((w*3 & 3) != 0)? w*3 + 4 - (w*3 & 3): w*3;
+ int[] data = new int[w*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = scanline[x*3] +
+ (scanline[x*3+1] << 8) +
+ (scanline[x*3+2] << 16);
+ }
+ image.setRGB(0, 0, w, h, data, 0, w);
+ return image;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java
new file mode 100644
index 00000000000..a10d390ab82
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java
@@ -0,0 +1,92 @@
+/* DecodeRGB4.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRGB4 extends BMPDecoder {
+
+ public DecodeRGB4(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+ int size = (w*h) >> 1;
+
+ // Scanline padded to dword offsets
+ int wbytes = (w + (w & 1)) >> 1;
+ int scansize = ((wbytes & 3) != 0)? (wbytes + 4 - (wbytes&3)) : wbytes;
+
+ byte[] data = new byte[wbytes*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<wbytes;x++)
+ data[x + y*wbytes] = scanline[x];
+ }
+ SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h, 4);
+
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+}
+
+
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerImpl.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB8.java
index 906381fe478..dfe4a19e8be 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerImpl.java
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB8.java
@@ -1,5 +1,5 @@
-/* ValueHandlerImpl.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* DecodeRGB8.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,48 +35,56 @@ 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.imageio.bmp;
-package gnu.javax.rmi.CORBA;
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
-import java.io.*;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
-//import org.omg.SendingContext.RunTime;
-import javax.rmi.CORBA.ValueHandler;
+public class DecodeRGB8 extends BMPDecoder {
-public class ValueHandlerImpl
- implements ValueHandler
-{
+ public DecodeRGB8(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
- public String getRMIRepositoryID(Class clz)
- {
- throw new Error("Not implemented for ValueHandler");
- }
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
- // XXX - Runtime -> RunTime
- public Runtime getRunTimeCodeBase()
- {
- throw new Error("Not implemented for ValueHandler");
- }
-
- public boolean isCustomMarshaled(Class clz)
- {
- throw new Error("Not implemented for ValueHandler");
- }
-
- // XXX - Runtime -> RunTime
- public Serializable readValue(InputStream in, int offset, Class clz, String repositoryID, Runtime sender)
- {
- throw new Error("Not implemented for ValueHandler");
- }
-
- public Serializable writeReplace(Serializable value)
- {
- throw new Error("Not implemented for ValueHandler");
- }
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ // BMP scanlines are padded to dword offsets
+ int scansize = ((w & 3) != 0)? w + 4 - (w & 3): w;
+ byte[] data = new byte[w*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = scanline[x];
+ }
+
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h,
+ new int[] {0xFF});
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
- public void writeValue(OutputStream out, Serializable value)
- {
- throw new Error("Not implemented for ValueHandler");
- }
+ return new BufferedImage(palette, raster, false, null);
+ }
+
}
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java
new file mode 100644
index 00000000000..55d314f05f1
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java
@@ -0,0 +1,176 @@
+/* DecodeRLE4.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRLE4 extends BMPDecoder {
+
+ public DecodeRLE4(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ /**
+ * RLE control codes
+ */
+ private static final byte ESCAPE = (byte)0;
+ private static final byte EOL = (byte)0; // end of line
+ private static final byte EOB = (byte)1; // end of bitmap
+ private static final byte DELTA = (byte)2; // delta
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ byte[] data = uncompress(w, h, in);
+ SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h, 4);
+
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+ private byte[] uncompress(int w, int h, ImageInputStream in)
+ throws BMPException, IOException {
+ byte[] cmd = new byte[2];
+ byte[] data = new byte[w*h>>1];
+ int offIn = 0;
+ int x=0,y=0;
+
+ // width in bytes
+ w += (w&1);
+ w = w >> 1;
+
+ try {
+ while(((x>>1) + y*w) < w*h){
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+
+ if(cmd[0] == ESCAPE){
+ switch(cmd[1]){
+ case EOB: // end of bitmap
+ return data;
+ case EOL: // end of line
+ x = 0;
+ y++;
+ break;
+ case DELTA: // delta
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+ int dx = cmd[0] & (0xFF);
+ int dy = cmd[1] & (0xFF);
+ x += dx;
+ y += dy;
+ break;
+
+ default:
+ // decode a literal run
+ int length = cmd[1] & (0xFF);
+
+ // size of run, which is word aligned.
+ int bytesize = length;
+ bytesize += (bytesize & 1);
+ bytesize >>= 1;
+ bytesize += (bytesize & 1);
+
+ byte[] run = new byte[bytesize];
+ if(in.read(run) != bytesize)
+ throw new IOException("Error reading compressed data.");
+
+ if((x&1) == 0){
+ length += (length&1);
+ length >>= 1;
+ System.arraycopy(run, 0, data, ((x>>1) + w*(h-y-1)),
+ length);
+ } else {
+ for(int i=0;i<length;i++){
+ if((i&1) == 0) // copy high to low
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((run[i>>1]&0xF0) >> 4);
+ else // copy low to high
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((run[i>>1]&0x0F) << 4);
+ }
+ }
+ x += cmd[1] & (0xFF);
+ break;
+ }
+ } else {
+ // decode a byte run
+ int length = cmd[0] & (0xFF);
+ if((x&1) == 0){
+ length += (length&1);
+ length >>= 1;
+ for(int i=0;i<length;i++)
+ data[(h-y-1)*w + i + (x >> 1)] = cmd[1];
+ } else {
+ for(int i=0;i<length;i++){
+ if((i&1) == 0) // copy high to low
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((cmd[1]&0xF0) >> 4);
+ else // copy low to high
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((cmd[1]&0x0F) << 4);
+ }
+ }
+ x += cmd[0] & (0xFF);
+ }
+ }
+ return data;
+ } catch(ArrayIndexOutOfBoundsException e){
+ throw new BMPException("Invalid RLE data.");
+ }
+ }
+}
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
new file mode 100644
index 00000000000..1d00e6751d0
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
@@ -0,0 +1,143 @@
+/* DecodeRLE8.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRLE8 extends BMPDecoder {
+
+ public DecodeRLE8(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ /**
+ * RLE control codes
+ */
+ private static final byte ESCAPE = (byte)0;
+ private static final byte EOL = (byte)0; // end of line
+ private static final byte EOB = (byte)1; // end of bitmap
+ private static final byte DELTA = (byte)2; // delta
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ byte[] data = uncompress(w, h, in);
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h,
+ new int[] {0xFF});
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+ private byte[] uncompress(int w, int h, ImageInputStream in)
+ throws BMPException, IOException {
+ byte[] cmd = new byte[2];
+ byte[] data = new byte[w*h];
+ int offIn = 0;
+ int x=0,y=0;
+
+ try {
+ while((x + y*w) < w*h){
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+
+ if(cmd[0] == ESCAPE){
+ switch(cmd[1]){
+ case EOB: // end of bitmap
+ return data;
+ case EOL: // end of line
+ x = 0;
+ y++;
+ break;
+ case DELTA: // delta
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+ int dx = cmd[0] & (0xFF);
+ int dy = cmd[1] & (0xFF);
+ x += dx;
+ y += dy;
+ break;
+
+ default:
+ // decode a literal run
+ int length = cmd[1] & (0xFF);
+ int copylength = length;
+
+ // absolute mode must be word-aligned
+ length += (length & 1);
+
+ byte[] run = new byte[length];
+ if(in.read(run) != length)
+ throw new IOException("Error reading compressed data.");
+
+ System.arraycopy(run, 0, data, (x+w*(h-y-1)),
+ copylength);
+ x += copylength;
+ break;
+ }
+ } else {
+ // decode a byte run
+ int length = cmd[0] & (0xFF);
+ for(int i=0;i<length;i++)
+ data[(h-y-1)*w + x++] = cmd[1];
+ }
+ }
+ return data;
+ } catch(ArrayIndexOutOfBoundsException e){
+ throw new BMPException("Invalid RLE data.");
+ }
+ }
+}
+
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java
new file mode 100644
index 00000000000..e80cabf6b2b
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java
@@ -0,0 +1,297 @@
+/* CorbaInput.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.CDR.gnuRuntime;
+
+import org.omg.CORBA_2_3.portable.InputStream;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Converts calls on java ObjectOutputStream to calls on CORBA OutputStream. A
+ * class to substitute for objects using readObject method.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class CorbaInput
+ extends ObjectInputStream
+ implements ObjectInput
+{
+
+ /**
+ * The underlying CORBA stream from where the actual input is taken.
+ */
+ public InputStream stream;
+
+ /**
+ * The utility class to write the object fields in default way.
+ */
+ final RmiUtilities util;
+
+ /**
+ * The object currently being read.
+ */
+ Object current;
+
+ /**
+ * The offset of the object currently being read.
+ */
+ int offset;
+
+ /**
+ * The repository id of the object currently being read.
+ */
+ String rid;
+
+ /**
+ * The runtime, related to the object currently being read.
+ */
+ gnuRuntime runtime;
+
+ /**
+ * Create an instance, delegating calls to the given CORBA stream.
+ */
+ public CorbaInput(InputStream an_input, Object firstObject,
+ RmiUtilities an_util, int an_offset, String a_rid,
+ gnuRuntime a_runtime)
+ throws Exception
+ {
+ stream = an_input;
+ current = firstObject;
+ util = an_util;
+
+ offset = an_offset;
+ rid = a_rid;
+ runtime = a_runtime;
+ }
+
+ /** @inheritDoc */
+ public int available()
+ throws IOException
+ {
+ return stream.available();
+ }
+
+ /**
+ * No action.
+ */
+ public void close()
+ throws IOException
+ {
+ }
+
+ /** @inheritDoc */
+ public void defaultReadObject()
+ throws IOException, ClassNotFoundException
+ {
+ util.readFields(offset, rid, (Serializable) current, stream, runtime);
+ }
+
+ /** @inheritDoc */
+ public void mark(int readlimit)
+ {
+ stream.mark(readlimit);
+ }
+
+ /** @inheritDoc */
+ public boolean markSupported()
+ {
+ return stream.markSupported();
+ }
+
+ /** @inheritDoc */
+ public int read()
+ throws IOException
+ {
+ return stream.read();
+ }
+
+ /** @inheritDoc */
+ public int read(byte[] buf, int off, int len)
+ throws IOException
+ {
+ return stream.read(buf, off, len);
+ }
+
+ /** @inheritDoc */
+ public int read(byte[] b)
+ throws IOException
+ {
+ return stream.read(b);
+ }
+
+ /** @inheritDoc */
+ public boolean readBoolean()
+ throws IOException
+ {
+ return stream.read_boolean();
+ }
+
+ /** @inheritDoc */
+ public byte readByte()
+ throws IOException
+ {
+ return (byte) stream.read();
+ }
+
+ /** @inheritDoc */
+ public char readChar()
+ throws IOException
+ {
+ return stream.read_char();
+ }
+
+ /** @inheritDoc */
+ public double readDouble()
+ throws IOException
+ {
+ return stream.read_double();
+ }
+
+ /** @inheritDoc */
+ public float readFloat()
+ throws IOException
+ {
+ return stream.read_float();
+ }
+
+ /** @inheritDoc */
+ public void readFully(byte[] buf, int off, int len)
+ throws IOException
+ {
+ // This class only reads from the buffered streams.
+ stream.read(buf, off, len);
+ }
+
+ /** @inheritDoc */
+ public void readFully(byte[] buf)
+ throws IOException
+ {
+ // This class only reads from the buffered streams.
+ stream.read(buf);
+ }
+
+ /** @inheritDoc */
+ public int readInt()
+ throws IOException
+ {
+ return stream.read_long();
+ }
+
+ /** @inheritDoc */
+ public String readLine()
+ throws IOException
+ {
+ return new DataInputStream(this).readLine();
+ }
+
+ /** @inheritDoc */
+ public long readLong()
+ throws IOException
+ {
+ return stream.read_longlong();
+ }
+
+ /** @inheritDoc */
+ public short read_short()
+ throws IOException
+ {
+ return stream.read_short();
+ }
+
+ /** @inheritDoc */
+ public int readUnsignedByte()
+ throws IOException
+ {
+ return (stream.read() & 0xFF);
+ }
+
+ /** @inheritDoc */
+ public int readUnsignedShort()
+ throws IOException
+ {
+ return (stream.read_short() & 0xFFFF);
+ }
+
+ /**
+ * Read as wide string (not as UTF).
+ */
+ public String readUTF()
+ throws IOException
+ {
+ return stream.read_wstring();
+ }
+
+ /** @inheritDoc */
+ public void reset()
+ throws IOException
+ {
+ stream.reset();
+ }
+
+ /** @inheritDoc */
+ public long skip(long n)
+ throws IOException
+ {
+ return stream.skip(n);
+ }
+
+ /** @inheritDoc */
+ public int skipBytes(int len)
+ throws IOException
+ {
+ return (int) stream.skip(len);
+ }
+
+ /**
+ * Objects are read as abstract interfaces.
+ */
+ protected Object readObjectOverride()
+ throws IOException, ClassNotFoundException
+ {
+ current = stream.read_abstract_interface();
+ return current;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java
new file mode 100644
index 00000000000..1c723407980
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java
@@ -0,0 +1,219 @@
+/* CorbaOutput.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+/**
+ * A class to substitute as an ObjectOutputStream for objects using writeObject
+ * method.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class CorbaOutput
+ extends ObjectOutputStream
+ implements ObjectOutput
+{
+ /**
+ * A CORBA stream where the output is forwarded.
+ */
+ final OutputStream stream;
+
+ /**
+ * The utility class to write the object fields in default way.
+ */
+ final RmiUtilities util;
+
+ /**
+ * The object currently being written.
+ */
+ Object current;
+
+ /**
+ * Create an instance, delegating calls to the given CORBA stream.
+ */
+ public CorbaOutput(OutputStream an_output, Object firstObject,
+ RmiUtilities an_util)
+ throws Exception
+ {
+ stream = an_output;
+ current = firstObject;
+ util = an_util;
+ }
+
+ /**
+ * No action.
+ */
+ public void close()
+ throws IOException
+ {
+ }
+
+ /** @inheritDoc */
+ public void flush()
+ throws IOException
+ {
+ stream.flush();
+ }
+
+ /** @inheritDoc */
+ public void write(byte[] buf, int off, int len)
+ throws IOException
+ {
+ stream.write(buf, off, len);
+ }
+
+ /** @inheritDoc */
+ public void write(byte[] buf)
+ throws IOException
+ {
+ stream.write(buf);
+ }
+
+ /** @inheritDoc */
+ public void write(int val)
+ throws IOException
+ {
+ stream.write(val);
+ }
+
+ /** @inheritDoc */
+ public void writeBoolean(boolean val)
+ throws IOException
+ {
+ stream.write_boolean(val);
+ }
+
+ /** @inheritDoc */
+ public void writeByte(int val)
+ throws IOException
+ {
+ stream.write(val);
+ }
+
+ /** @inheritDoc */
+ public void writeBytes(String str)
+ throws IOException
+ {
+ stream.write_string(str);
+ }
+
+ /** @inheritDoc */
+ public void writeChar(int val)
+ throws IOException
+ {
+ stream.write_wchar((char) val);
+ }
+
+ /** @inheritDoc */
+ public void writeChars(String str)
+ throws IOException
+ {
+ stream.write_char_array(str.toCharArray(), 0, str.length());
+ }
+
+ /** @inheritDoc */
+ public void writeDouble(double val)
+ throws IOException
+ {
+ stream.write_double(val);
+ }
+
+ /** @inheritDoc */
+ public void writeFloat(float val)
+ throws IOException
+ {
+ stream.write_float(val);
+ }
+
+ /** @inheritDoc */
+ public void writeInt(int val)
+ throws IOException
+ {
+ stream.write_long(val);
+ }
+
+ /** @inheritDoc */
+ public void writeLong(long val)
+ throws IOException
+ {
+ stream.write_longlong(val);
+ }
+
+ /**
+ * Objects are written as abstract interfaces.
+ */
+ protected void writeObjectOverride(Object obj)
+ throws IOException
+ {
+ current = obj;
+ stream.write_abstract_interface(obj);
+ }
+
+ /** @inheritDoc */
+ public void writeShort(int val)
+ throws IOException
+ {
+ stream.write_short((short) val);
+ }
+
+ /**
+ * Such strings are written as wide strings, not as UTF.
+ */
+ public void writeUTF(String str)
+ throws IOException
+ {
+ stream.write_wstring(str);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public void defaultWriteObject()
+ throws IOException
+ {
+ util.writeFields(stream, (Serializable) current);
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java b/libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java
new file mode 100644
index 00000000000..5bdf7dac933
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java
@@ -0,0 +1,85 @@
+/* DefaultWriteObjectTester.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
+import java.io.IOException;
+
+/**
+ * Tests if the defaultWriteObject method has been called.
+ * This information is required by RMI-IIOP header.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class DefaultWriteObjectTester
+ extends CorbaOutput
+{
+ /**
+ * The flag, indicating, that the defaultWriteObject method was called.
+ */
+ public boolean dwo_called;
+
+ /**
+ * Create an instance, delegating calls to the given CORBA stream.
+ */
+ public DefaultWriteObjectTester(Object firstObject)
+ throws Exception
+ {
+ super(new BufferedCdrOutput(), firstObject, null);
+ }
+
+ /**
+ * Set the flag that defaultWriteObject was called.
+ */
+ public void defaultWriteObject()
+ throws IOException
+ {
+ dwo_called = true;
+ }
+
+ /**
+ * Do not write other objects.
+ */
+ protected void writeObjectOverride(Object obj)
+ throws IOException
+ {
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java b/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java
index d71546d7561..0607c9f9626 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java
@@ -1,5 +1,5 @@
/* DelegateFactory.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,38 +38,70 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
-import java.util.HashMap;
+import gnu.CORBA.ObjectCreator;
+
+/**
+ * This class produces delegates, using the system properties. If not
+ * corresponding property is specified, returns default implementations.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public class DelegateFactory
{
- private static HashMap cache = new HashMap(4);
-
- public static synchronized Object getInstance(String type)
- throws GetDelegateInstanceException
+ /**
+ * The name to get a stub delegate.
+ */
+ public static final String STUB = "Stub";
+
+ /**
+ * The name to get the util delegate.
+ */
+ public static final String UTIL = "Util";
+
+ /**
+ * The name to get the ValueHandler delegate.
+ */
+ public static final String VALUEHANDLER = "ValueHandler";
+
+ /**
+ * The name to get the PortableRemoteObject delegate.
+ */
+ public static final String PORTABLE_REMOTE_OBJECT = "PortableRemoteObject";
+
+ /**
+ * Get an instance of the given delegate. As in all cases the singleton
+ * instance is used, the caching here would be redundant.
+ *
+ * @param type a delegate type.
+ *
+ * @return the associated delegate.
+ *
+ * @throws InternalError if the delegate class, indicated in the system
+ * properties, cannot be instantiated.
+ */
+ public static Object getInstance(String type)
+ throws InternalError
{
- Object r = cache.get(type);
- if (r != null)
- return r;
- String dcname = System.getProperty("javax.rmi.CORBA." + type + "Class");
+ String propertyName = "javax.rmi.CORBA." + type + "Class";
+ String dcname = System.getProperty(propertyName);
if (dcname == null)
{
- //throw new DelegateException
- // ("no javax.rmi.CORBA.XXXClass property sepcified.");
- dcname = "gnu.javax.rmi.CORBA." + type + "DelegateImpl";
+ // // No javax.rmi.CORBA.XXXClass property sepcified.
+ dcname = "gnu.javax.rmi.CORBA." + type + "DelegateImpl";
}
try
{
- Class dclass = Class.forName(dcname,
- true,
- Thread.currentThread().getContextClassLoader());
- r = dclass.newInstance();
- cache.put(type, r);
- return r;
+ Class dclass = ObjectCreator.forName(dcname);
+ return dclass.newInstance();
}
- catch(Exception e)
+ catch (Exception e)
{
- throw new GetDelegateInstanceException
- ("Exception when trying to get delegate instance:" + dcname, e);
+ InternalError ierr = new InternalError("Exception when trying to get "
+ + type + "delegate instance:" + dcname);
+ ierr.initCause(e);
+ throw ierr;
}
}
}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java
index 6a7e6b74622..ea4f73811f0 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java
@@ -1,5 +1,5 @@
/* PortableRemoteObjectDelegateImpl.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,99 +38,325 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
-import gnu.javax.rmi.PortableServer;
+import gnu.CORBA.SimpleDelegate;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.Poa.LocalDelegate;
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.AOM;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.server.RMIClassLoader;
import javax.rmi.CORBA.PortableRemoteObjectDelegate;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+
+/**
+ * Implements PortableRemoteObjectDelegate.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com) (stub)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
public class PortableRemoteObjectDelegateImpl
implements PortableRemoteObjectDelegate
{
-
- public PortableRemoteObjectDelegateImpl()
- {
- }
-
- public void connect(Remote remote, Remote remote1)
+ /**
+ * <p>
+ * Makes the remote object <code>a_target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>a_source</code> parameter. The a_target is connected to the same
+ * ORB (and, if applicable, to the same POA) as the a_source.
+ *
+ * @param a_target the target to connect to ORB, must be an instance of either
+ * {@link ObjectImpl} (Stubs and old-style ties) or {@link Servant} (POA-bases
+ * ties).
+ *
+ * @param a_source the object, providing the connection information, must be
+ * an instance of either {@link ObjectImpl} (Stubs and old-style ties) or
+ * {@link Servant} (POA-bases ties).
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
+ public void connect(Remote a_target, Remote a_source)
throws RemoteException
{
- throw new Error("Not implemented for PortableRemoteObjectDelegateImpl");
- }
-
- public void exportObject(Remote obj)
- throws RemoteException
- {
- PortableServer.exportObject(obj);
+ ORB orb = null;
+ POA poa = null;
+ boolean ok = false;
+
+ try
+ {
+ if (a_source instanceof Servant)
+ {
+ Servant s = (Servant) a_source;
+ orb = s._orb();
+ poa = s._poa();
+ ok = true;
+ }
+
+ if (!ok && a_source instanceof ObjectImpl)
+ {
+ ObjectImpl o = (ObjectImpl) a_source;
+ orb = o._orb();
+ ok = true;
+ try
+ {
+ if (orb instanceof ORB_1_4)
+ {
+ // POA information available.
+ ORB_1_4 xorb = (ORB_1_4) orb;
+ Delegate d = o._get_delegate();
+
+ if (d instanceof LocalDelegate)
+ {
+ LocalDelegate l = (LocalDelegate) d;
+ poa = l.poa;
+ }
+ else if (d instanceof SimpleDelegate)
+ {
+ byte[] ior_key = ((SimpleDelegate) d).getIor().key;
+ AOM.Obj ref = xorb.rootPOA.findIorKey(ior_key);
+ if (ref != null)
+ poa = ref.poa;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ // OK, POA info is not available, but as ORB is available, we
+ // will connect in a default way.
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ RuntimeException rex = new RuntimeException("Unable to get info from "
+ + a_source);
+ rex.initCause(ex);
+ throw rex;
+ }
+
+ if (!ok && a_source instanceof Tie)
+ {
+ Tie t = (Tie) a_source;
+ orb = t.orb();
+ poa = null;
+ ok = true;
+ }
+
+ if (orb == null)
+ throw new RemoteException("Unable to determine ORB from " + a_source);
+
+ if (a_target instanceof Stub)
+ {
+ StubDelegateImpl.connect((Stub) a_target, orb, poa);
+ }
+ else if (a_target instanceof Servant)
+ {
+ try
+ {
+ if (poa == null)
+ {
+ poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+ // Activate if not active.
+ if (poa.the_POAManager().get_state().value() == State._HOLDING)
+ poa.the_POAManager().activate();
+ }
+ poa.servant_to_reference((Servant) a_target);
+ }
+ catch (Exception ex)
+ {
+ throw new Unexpected(ex);
+ }
+ }
+ else if (a_target instanceof org.omg.CORBA.Object)
+ {
+ // Connect as object.
+ orb.connect((org.omg.CORBA.Object) a_target);
+ }
+ else if (a_target instanceof Tie)
+ {
+ // We avoid calling this because it will aways connect to the root poa.
+ ((Tie) a_target).orb(orb);
+ }
}
+ /**
+ * Narrow the given object to the instance of the given class. The currently
+ * supported narrowing types are:
+ *
+ * 1. Simple widening conversion.<br>
+ * 2. ObjectImpl -> RMI interface.<br>
+ * 3. ObjectImpl -> ObjectImpl.<br>
+ * 4. Tie -> Remote (implementation)<br>
+ * 5. Remote (implementation) -> Tie.<br>
+ *
+ * The narrowing has sense only for derived classes.
+ */
public Object narrow(Object narrowFrom, Class narrowTo)
throws ClassCastException
{
if (narrowTo == null)
throw new ClassCastException("Can't narrow to null class");
- if (narrowFrom == null)
+ else if (narrowFrom == null)
return null;
+ else
+ // Simple narrowing case.
+ if (narrowTo.isAssignableFrom(narrowFrom.getClass()))
+ return narrowFrom;
+ else if (narrowTo.isInterface() || narrowFrom instanceof ObjectImpl)
+ {
+ // Narrow CORBA object to passed interface.
+
+ String interf = narrowTo.getName();
+ String stubClassName;
- Class fromClass = narrowFrom.getClass();
- Object result = null;
-
+ stubClassName = getStubClassName(interf);
+
+ try
+ {
+ // Replace the interface class by the stub class.
+ narrowTo = Util.loadClass(stubClassName, null,
+ narrowTo.getClassLoader());
+ }
+ catch (ClassNotFoundException e)
+ {
+ ClassCastException cex = new ClassCastException("Class not found: "
+ + stubClassName);
+ cex.initCause(e);
+ throw cex;
+ }
+ }
+ else if (narrowFrom instanceof Tie)
+ {
+ // Try to substitute the return tie target as a return value.
+ Remote target = ((Tie) narrowFrom).getTarget();
+ if (target != null && narrowTo.isAssignableFrom(target.getClass()))
+ return target;
+ }
+
+ Object narrowed;
try
{
- if (narrowTo.isAssignableFrom(fromClass))
- result = narrowFrom;
- else
- {
- System.out.println("We still haven't implement this case: narrow "
- + narrowFrom + " of type " + fromClass + " to "
- + narrowTo);
- Class[] cs = fromClass.getInterfaces();
- for (int i = 0; i < cs.length; i++)
- System.out.println(cs[i]);
- Exception e1 = new Exception();
- try
- {
- throw e1;
- }
- catch(Exception ee)
- {
- ee.printStackTrace();
- }
- System.exit(2);
- //throw new Error("We still haven't implement this case: narrow "
- // + narrowFrom + " of type " + fromClass + " to "
- // + narrowTo);
- /*
- ObjectImpl objimpl = (ObjectImpl)narrowFrom;
- if(objimpl._is_a(PortableServer.getTypeName(narrowTo)))
- result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo);
- */
- }
- }
- catch(Exception e)
- {
- result = null;
- }
-
- if (result == null)
- throw new ClassCastException("Can't narrow from "
- + fromClass + " to " + narrowTo);
-
- return result;
+ narrowed = narrowTo.newInstance();
+ }
+ catch (Exception e)
+ {
+ ClassCastException cex = new ClassCastException("Cannot instantiate "
+ + narrowTo.getName());
+ cex.initCause(e);
+ throw cex;
+ }
+
+ if (narrowed instanceof ObjectImpl)
+ {
+ // This also works for the instances of the Stub.
+ ObjectImpl target = (ObjectImpl) narrowed;
+ // Set the delegate, as is done in *Helper.narrow(..).
+ target._set_delegate(((ObjectImpl) narrowFrom)._get_delegate());
+ }
+ else if (narrowed instanceof Tie && narrowFrom instanceof Remote)
+ {
+ // Try to set the narrowing object as a target for the Tie.
+ ((Tie) narrowed).setTarget((Remote) narrowFrom);
+ }
+ else
+ throw new ClassCastException("Narrowing of " + narrowFrom.getClass()
+ + " to " + narrowTo + " is either not possible or not implemented.");
+
+ return narrowed;
}
-
- public Remote toStub(Remote obj)
+
+ /**
+ * Get the Stub class name for the name, representing the given interface.
+ */
+ static String getStubClassName(String interf)
+ {
+ String stubClassName;
+ int p = interf.lastIndexOf('.');
+
+ if (p < 0)
+ // The interface is defined in the default package.
+ stubClassName = "_" + interf + "_Stub";
+ else
+ stubClassName = interf.substring(0, p + 1) + "_"
+ + interf.substring(p + 1) + "_Stub";
+ return stubClassName;
+ }
+
+ /**
+ * Get stub for the given implementation, searching by class name pattern. The
+ * found stub must implement Remote for this method to succeed.
+ */
+ public Remote toStub(Remote ObjImpl)
throws NoSuchObjectException
{
- return PortableServer.toStub(obj);
+ String icn = ObjImpl.getClass().getName();
+ if (!icn.endsWith("Impl"))
+ throw new BAD_PARAM("Invalid class name '" + icn
+ + "', must end with 'Impl'");
+
+ String sn = "_" + icn.substring(0, icn.length() - "Impl".length())
+ + "_Stub";
+
+ Class stubClass;
+ Object o_stub;
+
+ try
+ {
+ stubClass = RMIClassLoader.loadClass(sn);
+ o_stub = stubClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ NoSuchObjectException n = new NoSuchObjectException(sn);
+ n.initCause(e);
+ throw n;
+ }
+
+ if (!Remote.class.isAssignableFrom(stubClass))
+ throw new ClassCastException(stubClass.getName()
+ + " exists but cannot be returned as it does not inherit from "
+ + Remote.class.getName());
+
+ return (Remote) o_stub;
}
+ /**
+ * If the object tie is no longer in use, disconnet it from the orb.
+ */
public void unexportObject(Remote obj)
throws NoSuchObjectException
{
- PortableServer.unexportObject(obj);
+ Util.unexportObject(obj);
+ }
+
+ /**
+ * Find or create a tie for this target and mark it as being used by the given
+ * object.
+ */
+ public void exportObject(Remote obj)
+ throws RemoteException
+ {
+ if (obj instanceof Stub)
+ Util.registerTarget(StubDelegateImpl.getTieFromStub((Stub) obj), obj);
+ else if (obj instanceof Tie)
+ {
+ Tie t = (Tie) obj;
+ Util.registerTarget(t, null);
+ }
}
}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java b/libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java
new file mode 100644
index 00000000000..91bfa3776dc
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java
@@ -0,0 +1,946 @@
+/* RmiUtilities.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.Minor;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.CDR.Vio;
+import gnu.CORBA.CDR.gnuRuntime;
+import gnu.CORBA.CDR.gnuValueStream;
+import gnu.CORBA.CDR.HeadlessInput;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.StringValueHelper;
+import org.omg.CORBA.WStringValueHelper;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueBase;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+import org.omg.SendingContext.RunTime;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.rmi.Remote;
+import java.security.MessageDigest;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.TreeSet;
+import java.util.WeakHashMap;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+/**
+ * Defines methods that must be accessible in several derived classes.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class RmiUtilities
+{
+ /**
+ * The currently used RMI-IIOP version format.
+ */
+ public static byte VERSION = 1;
+
+ /**
+ * The non - writable class fields.
+ */
+ static final int NON_WRITABLE = Modifier.STATIC | Modifier.TRANSIENT;
+
+ /**
+ * The standard String repository Id.
+ */
+ public static final String RMI_STRING_ID = StringValueHelper.id();
+
+ /**
+ * The standard Class repository Id.
+ */
+ public static final String RMI_CLASS_ID = "RMI:javax.rmi.CORBA.ClassDesc:2BABDA04587ADCCC:CFBF02CF5294176B";
+
+ /**
+ * The standard string array repository Id.
+ */
+ public static final String RMI_STRING_ARRAY_ID = "RMI:[Ljava.lang.String;:071DA8BE7F971128:A0F0A4387A3BB342";
+
+ /**
+ * An instance of the wide string value helper for writing strings.
+ */
+ static WStringValueHelper wStringValueHelper = new WStringValueHelper();
+
+ /**
+ * Set of serializable classes that have .writeObject and .readObject defined.
+ * Contains weak references to ensure that the classes will be unloadable.
+ */
+ WeakHashMap io_format = new WeakHashMap();
+
+ /**
+ * The standard IO format with no .writeObject and .readObject defined.
+ */
+ static final Object STANDARD = new Object();
+
+ /**
+ * The custom IO format with .writeObject and .readObject defined,
+ * defaultWriteObject called.
+ */
+ static final Object CUSTOM_DWO = new Object();
+
+ /**
+ * The custom IO format with .writeObject and .readObject defined,
+ * defaultWriteObject has not been called.
+ */
+ static final Object CUSTOM_NO_DWO = new Object();
+
+ /**
+ * The arguments for readObject.
+ */
+ static final Class[] READ_OBJECT_ARGS = new Class[] { ObjectInputStream.class };
+
+ /**
+ * The arguments for writeObject.
+ */
+ static final Class[] WRITE_OBJECT_ARGS = new Class[] { ObjectOutputStream.class };
+
+ /**
+ * The undocumented field that is heading the Sun's object data, written with
+ * writeObject.
+ */
+ static final int S_X = 16908034;
+
+ /**
+ * Write all fields of the passed value.
+ */
+ void writeFields(OutputStream an_output, Serializable object)
+ {
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+ try
+ {
+ Class o_class = object.getClass();
+ Field[] fields = getWritableFields(o_class);
+ Field f;
+
+ Class fc;
+
+ for (int i = 0; i < fields.length; i++)
+ {
+ f = fields[i];
+ fc = f.getType();
+ Object v = f.get(object);
+
+ if (fc == String.class)
+ {
+ output.write_value((Serializable) v, wStringValueHelper);
+ }
+ else if (fc == int.class)
+ output.write_long(((Integer) v).intValue());
+ else if (fc == long.class)
+ output.write_longlong(((Number) v).longValue());
+ else if (fc == double.class)
+ output.write_double(((Number) v).doubleValue());
+ else if (fc == float.class)
+ output.write_float(((Number) v).floatValue());
+ else if (fc == boolean.class)
+ output.write_boolean(((Boolean) v).booleanValue());
+ else if (fc == short.class)
+ output.write_short(((Number) v).shortValue());
+ else if (fc == byte.class)
+ output.write_octet(((Number) v).byteValue());
+ else if (fc == char.class)
+ output.write_wchar(((Character) v).charValue());
+ else
+ {
+ if (!fc.isInterface() && Remote.class.isAssignableFrom(fc))
+ fc = getExportedInterface(fc);
+ writeMember(output, v, fc);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Cannot write " + object);
+ m.minor = Minor.ValueFields;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Write a memeber (field) of the data structure.
+ */
+ void writeMember(org.omg.CORBA_2_3.portable.OutputStream output,
+ Object object, Class xClass)
+ {
+ if (output instanceof gnuValueStream)
+ {
+ gnuRuntime g = ((gnuValueStream) output).getRunTime();
+ // Reset the target as we are already beyond the critical point
+ // where is must have the value being written.
+ if (g != null)
+ g.target = null;
+ }
+ if (Serializable.class.isAssignableFrom(xClass)
+ || Remote.class.isAssignableFrom(xClass))
+ {
+ // Object handles null reference on its own.
+ if (org.omg.CORBA.Object.class.isAssignableFrom(xClass)
+ || Remote.class.isAssignableFrom(xClass))
+ {
+ if (object == null)
+ output.write_Object(null);
+ else if (isTieRequired(object))
+ exportTie(output, object, xClass);
+ else
+ writeValue(output, (Serializable) object);
+ }
+ else
+ output.write_value((Serializable) object, xClass);
+ }
+ else
+ {
+ MARSHAL m = new MARSHAL(xClass + " is not Serializable");
+ m.minor = Minor.NonSerializable;
+ throw m;
+ }
+ }
+
+ /**
+ * Check if the object must be wrapped into Tie, connected to the ORB and then
+ * the corresponding Stub be written.
+ */
+ public boolean isTieRequired(Object object)
+ {
+ return object instanceof Remote && !(object instanceof Stub);
+ }
+
+ /**
+ * Get the interface under that the class of this object must be exposed. The
+ * interface must be derived from Remote.
+ */
+ Class getExportedInterface(Object object)
+ throws MARSHAL
+ {
+ Class fc = null;
+ Class[] interfaces = object.getClass().getInterfaces();
+ for (int i = 0; i < interfaces.length; i++)
+ {
+ if (!Remote.class.equals(interfaces[i]))
+ if (Remote.class.isAssignableFrom(interfaces[i]))
+ {
+ if (fc == null)
+ fc = interfaces[i];
+ else
+ {
+ MARSHAL m = new MARSHAL("Both " + fc + " and " + interfaces[i]
+ + " extends Remote");
+ m.minor = Minor.TargetConversion;
+ throw m;
+ }
+ }
+ }
+ if (fc == null)
+ {
+ MARSHAL m = new MARSHAL(object.getClass()
+ + " does not implement any interface, derived from Remote");
+ m.minor = Minor.TargetConversion;
+ throw m;
+ }
+ return fc;
+ }
+
+ /**
+ * Get the persistent hash code for the given class, as defined by OMG
+ * standard. The inheritance, field names and types (but not the visibility)
+ * are taken into consideration as well as the presence of the writeObject
+ * method are taken into consideration. The class name and methods, if any,
+ * are not taken into consideration.
+ */
+ public static long getHashCode(Class c)
+ {
+ Class of = c.isArray() ? c.getComponentType() : null;
+ if (c.isArray()
+ && ((!Serializable.class.isAssignableFrom(of) || of.isPrimitive() || Remote.class.isAssignableFrom(of))))
+ return 0;
+ if (!Serializable.class.isAssignableFrom(c))
+ return 0;
+ try
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ DataOutputStream out = new DataOutputStream(bout);
+
+ Class superClass = c.getSuperclass();
+ if (superClass != null)
+ out.writeLong(getHashCode(superClass));
+
+ int writeObjectPresentCode;
+ try
+ {
+ c.getDeclaredMethod("writeObject",
+ new Class[] { ObjectOutputStream.class });
+ writeObjectPresentCode = 2; // Exists.
+ }
+ catch (NoSuchMethodException e)
+ {
+ writeObjectPresentCode = 1; // Missing.
+ }
+ out.writeInt(writeObjectPresentCode);
+
+ Field[] fields = c.getDeclaredFields();
+
+ Arrays.sort(fields, new Comparator()
+ {
+ public int compare(Object a, Object b)
+ {
+ Field fa = (Field) a;
+ Field fb = (Field) b;
+ return fa.getName().compareTo(fb.getName());
+ }
+ });
+
+ Field f;
+ for (int i = 0; i < fields.length; i++)
+ {
+ f = fields[i];
+ if ((f.getModifiers() & NON_WRITABLE) == 0)
+ {
+ out.writeUTF(f.getName());
+ out.writeUTF(getDescriptor(f.getType()));
+ }
+ }
+
+ out.flush();
+ out.close();
+ MessageDigest shaDigest;
+ try
+ {
+ shaDigest = MessageDigest.getInstance("SHA");
+ }
+ catch (Exception ex)
+ {
+ throw new InternalError("SHA digesting algorithm is not available");
+ }
+
+ // Return the digest value to the calling
+ // method as an array of bytes.
+ byte[] sha = shaDigest.digest(bout.toByteArray());
+
+ long hash = 0;
+ for (int i = 0; i < Math.min(8, sha.length); i++)
+ {
+ hash += (long) (sha[i] & 255) << (i * 8);
+ }
+ return hash;
+ }
+ catch (IOException ioex)
+ {
+ throw new Unexpected(ioex);
+ }
+ }
+
+ /**
+ * Converts to hexadecimal string, supplementing leading zeros.
+ */
+ public static String toHex(long l)
+ {
+ StringBuffer b = new StringBuffer();
+ b.append(Long.toHexString(l).toUpperCase());
+ while (b.length() < 16)
+ b.insert(0, '0');
+ return b.toString();
+ }
+
+ /**
+ * Returns a <code>String</code> representing the type-encoding of a class.
+ */
+ static String getDescriptor(Class type)
+ {
+ if (type.equals(boolean.class))
+ return "Z";
+ if (type.equals(byte.class))
+ return "B";
+ if (type.equals(short.class))
+ return "S";
+ if (type.equals(char.class))
+ return "C";
+ if (type.equals(int.class))
+ return "I";
+ if (type.equals(long.class))
+ return "J";
+ if (type.equals(float.class))
+ return "F";
+ if (type.equals(double.class))
+ return "D";
+ if (type.equals(void.class))
+ return "V";
+ else if (type.isArray())
+ {
+ StringBuffer l = new StringBuffer("[");
+ Class component = type.getComponentType();
+
+ while (component.isArray())
+ {
+ l.append('[');
+ component = component.getComponentType();
+ }
+
+ l.append('L');
+ l.append(component.getName().replace('.', '/'));
+ l.append(';');
+ return l.toString();
+ }
+ else
+ return "L" + type.getName().replace('.', '/') + ';';
+ }
+
+ public static Field[] getWritableFields(Class c)
+ {
+ TreeSet set = new TreeSet(new Comparator()
+ {
+ public int compare(Object a, Object b)
+ {
+ return ((Field) a).getName().compareTo(((Field) b).getName());
+ }
+ });
+
+ while (!c.equals(Object.class))
+ {
+ Field[] f = c.getDeclaredFields();
+ for (int i = 0; i < f.length; i++)
+ {
+ if ((f[i].getModifiers() & NON_WRITABLE) == 0)
+ {
+ f[i].setAccessible(true);
+ set.add(f[i]);
+ }
+ }
+ c = c.getSuperclass();
+ }
+
+ Field[] r = new Field[set.size()];
+ int p = 0;
+ Iterator it = set.iterator();
+ while (it.hasNext())
+ {
+ r[p++] = (Field) it.next();
+ }
+ return r;
+ }
+
+ /**
+ * The method is called for Remotes that are not Stubs. It is assumed, that
+ * the Remote is an implementation. The method searches for the suitable tie
+ * and, if found, exports it by creating and connecting the stub. Such export
+ * is supported since jdk 1.5.
+ */
+ void exportTie(org.omg.CORBA_2_3.portable.OutputStream output,
+ Object implementation, Class interfaceClass)
+ {
+ try
+ {
+ // Remote, but non - stub class (implementation)
+ // must be replaced by stub.
+ Tie t = Util.getTie((Remote) implementation);
+ if (t instanceof Servant)
+ {
+ POA rootPoa = POAHelper.narrow(output.orb().resolve_initial_references(
+ "RootPOA"));
+ org.omg.CORBA.Object co = rootPoa.servant_to_reference((Servant) t);
+ Stub stub = (Stub) PortableRemoteObject.narrow(co, interfaceClass);
+ writeRemoteObject(output, stub);
+
+ if (rootPoa.the_POAManager().get_state().value() == State._HOLDING)
+ rootPoa.the_POAManager().activate();
+ }
+ else if (t instanceof org.omg.CORBA.Object)
+ {
+ org.omg.CORBA.Object co = (org.omg.CORBA.Object) t;
+ output.orb().connect(co);
+
+ Stub stub = (Stub) PortableRemoteObject.narrow(co, interfaceClass);
+ writeRemoteObject(output, stub);
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Unable to export " + implementation);
+ m.minor = Minor.TargetConversion;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Start the ORB, if it is not already runnning.
+ */
+ void ensureOrbRunning(org.omg.CORBA_2_3.portable.OutputStream output)
+ {
+ // Ensure ORB is running.
+ if (output.orb() instanceof OrbFunctional)
+ {
+ ((OrbFunctional) output.orb()).ensureRunning();
+ }
+ }
+
+ /**
+ * Write data to the CORBA output stream. Writes the object contents only; the
+ * header must be already written. For object, containing objects, may be
+ * called recursively.
+ *
+ * @param an_output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public void writeRemoteObject(OutputStream an_output, Object object)
+ {
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+
+ if (isTieRequired(object))
+ {
+ // Find the interface that is implemented by the object and extends
+ // Remote.
+ Class fc = getExportedInterface(object);
+ exportTie(output, object, fc);
+ }
+ else if (object instanceof org.omg.CORBA.Object)
+ {
+ ensureOrbRunning(output);
+ an_output.write_Object((org.omg.CORBA.Object) object);
+ }
+ else if (object != null && object instanceof Serializable)
+ writeFields(an_output, (Serializable) object);
+ }
+
+ /**
+ * Write data to the CORBA output stream. Writes the object contents only; the
+ * header must be already written. For object, containing objects, may be
+ * called recursively.
+ *
+ * @param an_output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public void writeValue(OutputStream an_output, Serializable object)
+ {
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+
+ if (isTieRequired(object))
+ {
+ // Find the interface that is implemented by the object and extends
+ // Remote.
+ Class fc = getExportedInterface(object);
+ exportTie(output, object, fc);
+ }
+ else if (object instanceof org.omg.CORBA.Object)
+ {
+ ensureOrbRunning(output);
+ an_output.write_Object((org.omg.CORBA.Object) object);
+ }
+ else if (object instanceof Externalizable)
+ {
+ try
+ {
+ ObjectOutputStream stream = new CorbaOutput(output, object,
+ this);
+ stream.write(VERSION);
+ ((Externalizable) object).writeExternal(stream);
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("writeExternal failed");
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ else if (object instanceof Serializable)
+ {
+ Object mode = null;
+ synchronized (io_format)
+ {
+ mode = io_format.get(object.getClass());
+ if (mode == STANDARD)
+ {
+ writeFields(an_output, (Serializable) object);
+ return;
+ }
+ }
+ try
+ {
+ Method m = object.getClass().getDeclaredMethod("writeObject",
+ WRITE_OBJECT_ARGS);
+ m.setAccessible(true); // May be private.
+
+ try
+ {
+ ObjectOutputStream stream = new CorbaOutput(output,
+ object, this);
+
+ // Write version.
+ stream.write(VERSION);
+
+ if (mode == CUSTOM_DWO)
+ // Write true, supposing that the defaultWriteObject
+ // has been called.
+ stream.write(1);
+ else if (mode == CUSTOM_NO_DWO)
+ // Write false (has not been called)
+ stream.write(0);
+ else
+ {
+ // Measure.
+ DefaultWriteObjectTester tester = new DefaultWriteObjectTester(object);
+ m.invoke(object, new Object[] { tester });
+
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(),
+ tester.dwo_called ? CUSTOM_DWO : CUSTOM_NO_DWO);
+ stream.write(tester.dwo_called ? 1 : 0);
+ }
+ }
+
+ m.invoke(object, new Object[] { stream });
+ stream.flush();
+ }
+ catch (Exception ex)
+ {
+ MARSHAL mx = new MARSHAL(object.getClass().getName()
+ + ".writeObject failed");
+ mx.initCause(ex);
+ throw mx;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Write in a standard way.
+ writeFields(an_output, (Serializable) object);
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(), STANDARD);
+ }
+ }
+ }
+ }
+
+ /**
+ * Read data from the CDR input stream. Reads the object contents only; the
+ * header must be already read (the repository id or ids ara passed). For
+ * object, containing objects, may be called recursively.
+ *
+ * @param an_input the stream to read from, must be
+ * org.omg.CORBA_2_3.portable.InputStream
+ * @param object the instance of the object being read.
+ * @param id the repository Id from the stream in the case when single id was
+ * specified.
+ * @param ids the repository Ids from the stream in the case when multiple ids
+ * were specified.
+ * @param codebase the codebase, if it was included in the header of the value
+ * type. Null if not codebase was included.
+ *
+ * @return the object, extracted from the stream.
+ */
+ /**
+ * Read value from the input stream in the case when the value is not
+ * Streamable or CustomMarshalled.
+ */
+ public Serializable readValue(InputStream in, int offset, Class clz,
+ String repositoryID, RunTime sender)
+ {
+ if (in instanceof HeadlessInput)
+ ((HeadlessInput) in).subsequentCalls = true;
+
+ gnuRuntime g;
+ Serializable object = null;
+
+ try
+ {
+ g = (gnuRuntime) sender;
+ object = g.target;
+ }
+ catch (ClassCastException e)
+ {
+ // Working with the other CORBA implementation.
+ g = null;
+ }
+
+ org.omg.CORBA_2_3.portable.InputStream input = (org.omg.CORBA_2_3.portable.InputStream) in;
+
+ if (Remote.class.isAssignableFrom(clz)
+ || ValueBase.class.isAssignableFrom(clz))
+ {
+ // Interface is narrowed into Stub.
+ if (clz.isInterface())
+ try
+ {
+ clz = Util.loadClass(
+ PortableRemoteObjectDelegateImpl.getStubClassName(clz.getName()),
+ null, clz.getClassLoader());
+ }
+ catch (ClassNotFoundException e)
+ {
+ MARSHAL m = new MARSHAL("Cannot get stub from interface "
+ + clz.getClass().getName());
+ m.minor = Minor.TargetConversion;
+ m.initCause(e);
+ throw m;
+ }
+
+ // Remote needs special handling.
+ if (ObjectImpl.class.isAssignableFrom(clz))
+ {
+ // First read CORBA object reference.
+ Object ro = input.read_Object();
+
+ ObjectImpl obj = (ObjectImpl) ro;
+ if (obj == null)
+ return null;
+
+ Delegate delegate = obj._get_delegate();
+ object = instantiate(offset, clz, g);
+ ((ObjectImpl) object)._set_delegate(delegate);
+ }
+ // The object - specific data follows.
+ }
+ else if (org.omg.CORBA.Object.class.isAssignableFrom(clz))
+ object = (Serializable) input.read_Object();
+
+ if (object == null)
+ object = instantiate(offset, clz, g);
+
+ // The sentence below prevents attempt to read the internal fields of the
+ // ObjectImpl (or RMI Stub) that might follow the object definition.
+ // Sun's jre 1.5 does not write this information. The stubs, generated
+ // by rmic, does not contain such fields.
+ if (object instanceof ObjectImpl)
+ return object;
+
+ if (object instanceof Externalizable)
+ {
+ try
+ {
+ CorbaInput stream = new CorbaInput(input, object, this,
+ offset, repositoryID, g);
+
+ byte version = stream.readByte();
+ if (version != 1)
+ throw new MARSHAL("Unsuported RMI-IIOP version " + version);
+
+ ((Externalizable) object).readExternal(stream);
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("readExternal failed");
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ else
+ {
+ Object mode = null;
+ synchronized (io_format)
+ {
+ mode = io_format.get(object.getClass());
+ }
+
+ if (mode == STANDARD)
+ {
+ readFields(offset, repositoryID, object, input, g);
+ }
+ else
+ {
+ try
+ {
+ Method m = object.getClass().getDeclaredMethod("readObject",
+ READ_OBJECT_ARGS);
+ try
+ {
+ m.setAccessible(true); // May be private.
+
+ CorbaInput stream = new CorbaInput(input,
+ object, this, offset, repositoryID, g);
+
+ byte version = stream.readByte();
+ if (version != 1)
+ throw new MARSHAL("Unsuported RMI-IIOP version "
+ + version);
+
+ // This would indicate is defaultWriteObject has been
+ // called,
+ // but the readObject method normally takes care about this.
+ boolean dwo = stream.readByte() != 0;
+
+ m.invoke(object, new Object[] { stream });
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(), dwo ? CUSTOM_DWO
+ : CUSTOM_NO_DWO);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ MARSHAL mx = new MARSHAL(object.getClass().getName()
+ + ".readObject failed");
+ mx.initCause(ex);
+ throw mx;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Read in a standard way.
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(), STANDARD);
+ readFields(offset, repositoryID, object, input, g);
+ }
+ }
+ }
+ }
+ return object;
+ }
+
+ /**
+ * Create an instance.
+ */
+ Serializable instantiate(int offset, Class clz, gnuRuntime g)
+ throws MARSHAL
+ {
+ Serializable object;
+ try
+ {
+ object = (Serializable) Vio.instantiateAnyWay(clz);
+ g.objectWritten(object, offset);
+ }
+ catch (Exception e)
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate " + clz);
+ m.minor = Minor.Instantiation;
+ m.initCause(e);
+ throw m;
+ }
+ return object;
+ }
+
+ /**
+ * Read fields of the object.
+ */
+ void readFields(int offset, String repositoryID, Serializable object,
+ org.omg.CORBA_2_3.portable.InputStream input, gnuRuntime r)
+ throws MARSHAL
+ {
+ Field f = null;
+ Class o_class = object.getClass();
+
+ try
+ {
+ // The returned field array must already be in canonical order.
+ Field[] fields = getWritableFields(o_class);
+
+ Class fc;
+
+ for (int i = 0; i < fields.length; i++)
+ {
+ // Full value type header expected ahead.
+ if (input instanceof HeadlessInput)
+ ((HeadlessInput) input).subsequentCalls = true;
+
+ f = fields[i];
+ fc = f.getType();
+
+ Object v;
+
+ if (fc == String.class)
+ {
+ v = input.read_value(wStringValueHelper);
+ }
+ else if (fc == int.class)
+ v = new Integer(input.read_long());
+ else if (fc == long.class)
+ v = new Long(input.read_longlong());
+ else if (fc == double.class)
+ v = new Double(input.read_double());
+ else if (fc == float.class)
+ v = new Float(input.read_float());
+ else if (fc == boolean.class)
+ v = input.read_boolean() ? Boolean.TRUE : Boolean.FALSE;
+ else if (fc == short.class)
+ v = new Short(input.read_short());
+ else if (fc == byte.class)
+ v = new Byte(input.read_octet());
+ else if (fc == char.class)
+ v = new Character(input.read_char());
+ else if (org.omg.CORBA.Object.class.isAssignableFrom(fc)
+ || Remote.class.isAssignableFrom(fc))
+ {
+ v = readValue(input, offset, fc, null, r);
+ }
+ else
+ {
+ v = Vio.read(input, fc);
+ }
+
+ f.set(object, v);
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Cannot read " + o_class.getName() + " field "
+ + f);
+ m.initCause(ex);
+ m.minor = Minor.ValueFields;
+ throw m;
+ }
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java
index 998d59e3379..afc254ddb49 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java
@@ -1,5 +1,5 @@
-/* StubDelegateImpl.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* StubDelegateImpl.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,67 +38,273 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.rmi.Remote;
import java.rmi.RemoteException;
+
+import javax.rmi.PortableRemoteObject;
import javax.rmi.CORBA.Stub;
import javax.rmi.CORBA.StubDelegate;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+
+/**
+ * The default stub delegate.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com) (stub)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
public class StubDelegateImpl
implements StubDelegate
{
-
- private int hashCode;
-
- public StubDelegateImpl(){
- hashCode = 0;
+ /**
+ * <p>
+ * Finds the suitable {@link Tie} for this Stub and connects it to the given
+ * ORB. The tie is found by the name pattern. If the found tie is derived from
+ * {@link org.omg.CORBA.PortableServer.Servant}, it is connected to the root
+ * POA, also activating it (if not already active).
+ * </p>
+ * <p>
+ * This method does not allow to specify, to which POA the found Tie must be
+ * connected and requires to use the deprecated method {@link ORB#connect}.
+ * Many useful POA features remain unaccessible. A better alternative it might
+ * be to generate a {@link org.omg.CORBA.PortableServer.Servant} - derived Tie
+ * (-poa key in rmic) and connect it to POA in one of the many ways, listed in
+ * the description of the {@link orb.omg.PortableServer} package). The
+ * obtained CORBA object can be narrowed into stub using
+ * {@link PortableRemoteObject#narrow}.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ *
+ * @throws BAD_PARAM if the name of this stub does not match the stub name
+ * pattern, "_*_Stub" or if the Tie class, "_*Impl_Tie", does not exists or an
+ * instance of this class cannot be instantiated.
+ */
+ public void connect(Stub self, ORB orb)
+ throws RemoteException
+ {
+ connect(self, orb, null);
}
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public void connect(Stub self, javax.rmi.ORB orb)
+
+ /**
+ * Connect when the POA is specified.
+ */
+ public static void connect(Stub self, ORB orb, POA poa)
throws RemoteException
{
- throw new Error("Not implemented for StubDelegate");
+ ORB oorb = null;
+ try
+ {
+ Delegate d = self._get_delegate();
+ if (d != null)
+ oorb = d.orb(self);
+ }
+ catch (Exception e)
+ {
+ // Failed to get Delegate or ORB.
+ // (possible ony for user-written Stubs).
+ }
+
+ if (oorb != null)
+ {
+ if (!oorb.equals(orb))
+ throw new RemoteException("Stub " + self
+ + " is connected to another ORB, " + orb);
+ else
+ return;
+ }
+
+ Tie t = null;
+ if (self instanceof Remote)
+ t = Util.getTie((Remote) self);
+
+ // Find by name pattern.
+ if (t == null)
+ t = getTieFromStub(self);
+
+ Delegate delegate;
+
+ if (t instanceof Servant)
+ {
+ try
+ {
+ if (poa == null)
+ {
+ poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+ // Activate if not active.
+ if (poa.the_POAManager().get_state().value() == State._HOLDING)
+ poa.the_POAManager().activate();
+ }
+
+ ObjectImpl obj = (ObjectImpl) poa.servant_to_reference((Servant) t);
+ delegate = obj._get_delegate();
+ }
+ catch (Exception ex)
+ {
+ throw new Unexpected(ex);
+ }
+ }
+ else if (t instanceof ObjectImpl)
+ {
+ ObjectImpl o = (ObjectImpl) t;
+ orb.connect(o);
+ delegate = o._get_delegate();
+ }
+ else
+ throw new BAD_PARAM("The Tie must be either Servant or ObjectImpl");
+
+ self._set_delegate(delegate);
}
- public boolean equals(Stub self, Object obj)
+ /**
+ * Locate a tie class, appropriate to the given stub class, by the name
+ * pattern.
+ */
+ public static Tie getTieFromStub(java.lang.Object self)
{
- if(self == null || obj == null)
- return self == obj;
- if(!(obj instanceof Stub))
- return false;
- return self.hashCode() == ((Stub)obj).hashCode();
+ Tie t;
+ String sn = self.getClass().getName();
+ if (!sn.endsWith("_Stub"))
+ throw new BAD_PARAM("The stub name, " + sn
+ + ", does not match _*_Stub pattern");
+
+ String tn = sn.substring(0, sn.length() - "_Stub".length()) + "Impl_Tie";
+ Class tieClass = null;
+
+ try
+ {
+ tieClass = ObjectCreator.forName(tn);
+ t = (Tie) tieClass.newInstance();
+ if (self instanceof Remote)
+ Util.registerTarget(t, (Remote) self);
+ }
+ catch (Exception e)
+ {
+ BAD_PARAM bad = new BAD_PARAM("Unable to instantiate '" + tn + "'");
+ bad.initCause(e);
+ throw bad;
+ }
+ return t;
+ }
+
+ /**
+ * Compare two stubs for equality.
+ */
+ public boolean equals(Stub self, java.lang.Object obj)
+ {
+ if (obj instanceof ObjectImpl)
+ {
+ ObjectImpl other = (ObjectImpl) obj;
+ Delegate d1 = other._get_delegate();
+ Delegate d2 = self._get_delegate();
+ if (d1 == null || d2 == null)
+ return d1 == d2;
+ else
+ return d1.equals(d2);
+ }
+ else return false;
}
+ /**
+ * Get the hash code (from IOR reference).
+ */
public int hashCode(Stub self)
{
- //FIX ME
- return hashCode;
+ Delegate d = self._get_delegate();
+ return d==null?0:d.hashCode();
}
+ /**
+ * Returns the IOR reference of the connected ORB.
+ *
+ * @see ORB#object_to_string(org.omg.CORBA.Object);
+ */
public String toString(Stub self)
{
try
{
- return self._orb().object_to_string(self);
+ return self._orb().object_to_string(self);
}
- // XXX javax.rmi.BAD_OPERATION -> org.omg.CORBA.BAD_OPERATION
- catch(javax.rmi.BAD_OPERATION bad_operation)
+ catch (Exception ex)
{
- return null;
+ return null;
}
}
- public void readObject(Stub self, ObjectInputStream s)
+ /**
+ * This should never be called. The ORB must be supplied.
+ *
+ * @see #connect
+ */
+ public void readObject(Stub self, ObjectInputStream input)
throws IOException, ClassNotFoundException
{
- throw new Error("Not implemented for StubDelegate");
+ readObject(self, input, null);
}
- public void writeObject(Stub self, ObjectOutputStream s)
+ /**
+ * Read as CORBA object when the ORB is known. The ORB must be set under the
+ * previous call of Stub.connect. The Stub is automatically registered with
+ * this ORB.
+ */
+ public void readObject(Stub self, ObjectInputStream input, ORB orb)
+ throws IOException, ClassNotFoundException
+ {
+ byte[] b = (byte[]) input.readObject();
+ BufferredCdrInput in = new BufferredCdrInput(b);
+
+ if (orb != null)
+ in.setOrb(orb);
+
+ ObjectImpl r = (ObjectImpl) in.read_Object();
+
+ self._set_delegate(r._get_delegate());
+ }
+
+ /**
+ * Write as CORBA object. The ORB is taken from the
+ * org.omg.CORBA.portable.Delegate. The Stub is automatically registered with
+ * this ORB (if not already done).
+ */
+ public void writeObject(Stub self, ObjectOutputStream output)
+ throws IOException
+ {
+ writeObject(self, output, null);
+ }
+
+ /**
+ * Write as CORBA object. The ORB must be either set under the previous call
+ * of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate.
+ * The Stub is automatically registered with this ORB (if not already done).
+ */
+ public void writeObject(Stub self, ObjectOutputStream output, ORB orb)
throws IOException
{
- throw new Error("Not implemented for StubDelegate");
+ BufferedCdrOutput out = new BufferedCdrOutput();
+ out.setOrb(orb == null ? self._orb() : orb);
+ out.write_Object(self);
+
+ output.writeObject(out.buffer.toByteArray());
}
-
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java b/libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java
new file mode 100644
index 00000000000..70e751a6f2c
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java
@@ -0,0 +1,93 @@
+/* TieTargetRecord.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import java.util.HashSet;
+
+import javax.rmi.CORBA.Tie;
+
+/**
+ * Represents a Tie, connected to possibly multiple invocation targets.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class TieTargetRecord
+{
+ /**
+ * The associated Tie.
+ */
+ public final Tie tie;
+
+ /**
+ * The objects, exposing the tie.
+ */
+ public HashSet targets = new HashSet();
+
+ /**
+ * Create a new record.
+ */
+ public TieTargetRecord(Tie a_tie)
+ {
+ tie = a_tie;
+ }
+
+ /**
+ * Add a target.
+ */
+ public void add(Object target)
+ {
+ targets.add(target);
+ }
+
+ /**
+ * Remove target.
+ */
+ public void remove(Object target)
+ {
+ targets.remove(target);
+ }
+
+ /**
+ * Return true if the tie has no associated invocation targets.
+ */
+ public boolean unused()
+ {
+ return targets.size() == 0;
+ }
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java
index 7bed2aa22dc..66a4e24ff18 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java
@@ -1,5 +1,5 @@
-/* UtilDelegateImpl.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* UtilDelegateImpl.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,115 +38,717 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
+import gnu.CORBA.Minor;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.AOM;
+import gnu.CORBA.Poa.gnuPOA;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
import java.rmi.server.RMIClassLoader;
-import java.net.MalformedURLException;
-import java.io.*;
-//import org.omg.CORBA.ORB;
-//import org.omg.CORBA.SystemException;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
-import javax.rmi.CORBA.*;
+import java.util.Hashtable;
+
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.UtilDelegate;
+import javax.rmi.CORBA.ValueHandler;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+/**
+ * The implementation of UtilDelegate.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com) (stub)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
public class UtilDelegateImpl
+ extends RmiUtilities
implements UtilDelegate
{
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public Object copyObject(Object obj, javax.rmi.ORB orb)
+ /**
+ * The instance of the value handler, requested once.
+ */
+ static ValueHandler m_ValueHandler;
+
+ /**
+ * The global map of all ties to they records.
+ */
+ static Hashtable m_Ties = new Hashtable();
+
+ /**
+ * The global map of all targets to they records.
+ */
+ static Hashtable m_Targets = new Hashtable();
+
+ /**
+ * The standard package for that the exception names are omitted.
+ */
+ static final String m_StandardPackage = "org.omg.CORBA.";
+
+ /**
+ * Make a deep copy of the object.
+ */
+ public Object copyObject(Object obj, ORB orb)
throws RemoteException
{
- throw new Error("Not implemented for UtilDelegate");
+ // Strings are immutable, can be shared.
+ if (obj instanceof String)
+ return obj;
+ else if (obj == null)
+ return null;
+ else if (obj instanceof String[] || obj instanceof String[][]
+ || obj instanceof String[][][])
+ {
+ // String arrays can be just cloned.
+ return ((Object[]) obj).clone();
+ }
+ else if (obj instanceof Serializable)
+ {
+ try
+ {
+ ByteArrayOutputStream a = new ByteArrayOutputStream();
+ ObjectOutputStream ou = new ObjectOutputStream(a);
+ ou.writeObject(obj);
+ ou.close();
+ ObjectInputStream input = new ObjectInputStream(
+ new ByteArrayInputStream(a.toByteArray()));
+ return input.readObject();
+ }
+ catch (Exception ex)
+ {
+ RemoteException rex = new RemoteException("Cannot copy " + obj);
+ throw rex;
+ }
+ }
+ else
+ return obj;
}
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public Object[] copyObjects(Object obj[], javax.rmi.ORB orb)
+ /**
+ * Make a deep copy of the object array.
+ */
+ public Object[] copyObjects(Object[] obj, ORB orb)
throws RemoteException
{
- throw new Error("Not implemented for UtilDelegate");
+ return (Object[]) copyObject(obj, orb);
}
public ValueHandler createValueHandler()
{
- throw new Error("Not implemented for UtilDelegate");
+ if (m_ValueHandler == null)
+ m_ValueHandler = (ValueHandler) DelegateFactory.getInstance(DelegateFactory.VALUEHANDLER);
+ return m_ValueHandler;
}
-
+
+ /**
+ * Returns the codebase of the given class.
+ */
public String getCodebase(Class clz)
{
- throw new Error("Not implemented for UtilDelegate");
+ return RMIClassLoader.getClassAnnotation(clz);
}
-
+
+ /**
+ * Get the Tie that handles invocations on the given target. If the target/Tie
+ * pair has not been previously registered using {@link #registerTarget},
+ * this method tries to locate a tie class by the name pattern. If this
+ * succeeds, the tie-target pair is also registered.
+ *
+ * @return the Tie.
+ */
public Tie getTie(Remote target)
{
- throw new Error("Not implemented for UtilDelegate");
+ synchronized (m_Targets)
+ {
+ Tie tie;
+ TieTargetRecord r = ((TieTargetRecord) m_Targets.get(target));
+ if (r == null)
+ {
+ if (target instanceof Stub)
+ {
+ tie = StubDelegateImpl.getTieFromStub(target);
+ registerTarget(tie, target);
+ }
+ else
+ {
+ // Treat this as implementation.
+ String tieClassName = getTieClassName(target.getClass().getName());
+ try
+ {
+ Class tieClass = Util.loadClass(tieClassName, null,
+ target.getClass().getClassLoader());
+ tie = (Tie) tieClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate "
+ + tieClassName);
+ m.minor = Minor.TargetConversion;
+ m.initCause(e);
+ throw m;
+ }
+ tie.setTarget(target);
+ registerTarget(tie, target);
+ }
+ }
+ else
+ tie = r.tie;
+ return tie;
+ }
+ }
+
+ /**
+ * Get the Stub class name for the name, representing the given interface.
+ */
+ private String getTieClassName(String interf)
+ {
+ String stubClassName;
+ int p = interf.lastIndexOf('.');
+
+ if (p < 0)
+ // The interface is defined in the default package.
+ stubClassName = "_" + interf + "_Tie";
+ else
+ stubClassName = interf.substring(0, p + 1) + "_"
+ + interf.substring(p + 1) + "_Tie";
+ return stubClassName;
}
-
+
+ /**
+ * Register the Tie-target pair. As the Tie is a Servant, it can potentially
+ * be connected to several objects and hence may be registered with several
+ * targets.
+ */
+ public void registerTarget(Tie tie, Remote target)
+ {
+ synchronized (m_Ties)
+ {
+ synchronized (m_Targets)
+ {
+ TieTargetRecord r = (TieTargetRecord) m_Ties.get(tie);
+ if (r == null)
+ {
+ // First registration for this Tie.
+ r = new TieTargetRecord(tie);
+ m_Ties.put(tie, r);
+ }
+ if (target != null)
+ {
+ r.add(target);
+ m_Targets.put(target, r);
+ }
+ }
+ }
+ }
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets. Independing from the POA policies, the transparent
+ * reactivation will not be possible.
+ */
+ public void unexportObject(Remote target)
+ throws NoSuchObjectException
+ {
+ synchronized (m_Ties)
+ {
+ synchronized (m_Targets)
+ {
+ TieTargetRecord r = ((TieTargetRecord) m_Targets.get(target));
+ if (r != null)
+ {
+ if (target instanceof org.omg.CORBA.Object)
+ r.tie.orb().disconnect((org.omg.CORBA.Object) target);
+
+ if (r.unused())
+ {
+ m_Targets.remove(target);
+ m_Ties.remove(r.tie);
+ r.tie.deactivate();
+
+ if (r.tie.orb() instanceof ORB_1_4)
+ {
+ // Standard case, when more deep cleanup is possible.
+ // Independing from the POA policies, the object will
+ // not be activable transparently.
+ ORB_1_4 orb = (ORB_1_4) r.tie.orb();
+
+ if (target instanceof org.omg.CORBA.Object)
+ {
+ AOM.Obj record = orb.rootPOA.findObject((org.omg.CORBA.Object) target);
+
+ if (record != null && record.servant == r.tie
+ && record.poa instanceof gnuPOA)
+ {
+ ((gnuPOA) record.poa).aom.remove(record.key);
+ record.deactivated = true;
+ record.servant = null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if the given stub is local.
+ *
+ * @param stub a stub to check.
+ * @return true if the stub is local, false otherwise.
+ */
public boolean isLocal(Stub stub)
throws RemoteException
{
- throw new Error("Not implemented for UtilDelegate");
+ try
+ {
+ return stub._is_local();
+ }
+ catch (SystemException e)
+ {
+ RemoteException rex = new RemoteException();
+ rex.initCause(e);
+ throw rex;
+ }
}
+ /**
+ * Load the class. The method uses class loaders from the call stact first. If
+ * this fails, the further behaviour depends on the System Property
+ * "java.rmi.server.useCodebaseOnly" with default value "false".
+ *
+ * <ul>
+ * <li>Try the current thread context class loader first.</li>
+ * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
+ * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
+ * <li> If remoteCodebase is null or useCodebaseOnly is true then call
+ * java.rmi.server.RMIClassLoader.loadClass(className)</li>
+ * <li>If a class is still not successfully loaded and the loader != null
+ * then try Class.forName(className, false, loader). </li>
+ * </ul>
+ *
+ * @param className the name of the class.
+ * @param remoteCodebase the codebase.
+ * @param loader the class loader.
+ * @return the loaded class.
+ *
+ * @throws ClassNotFoundException of the class cannot be loaded.
+ */
public Class loadClass(String className, String remoteCodebase,
- ClassLoader loader)
+ ClassLoader loader)
throws ClassNotFoundException
{
- try{
- if (remoteCodebase == null)
- return RMIClassLoader.loadClass(className);
- else
- return RMIClassLoader.loadClass(remoteCodebase, className);
- }
- catch (MalformedURLException e1)
+ if (loader == null)
+ loader = Thread.currentThread().getContextClassLoader();
+
+ String p_useCodebaseOnly = System.getProperty("java.rmi.server.useCodebaseOnly");
+
+ boolean useCodebaseOnly = p_useCodebaseOnly != null
+ && p_useCodebaseOnly.trim().equalsIgnoreCase("true");
+
+ try
{
- throw new ClassNotFoundException(className, e1);
+ if (remoteCodebase != null && !useCodebaseOnly)
+ return RMIClassLoader.loadClass(remoteCodebase, className);
}
- catch(ClassNotFoundException e2)
+ catch (Exception e)
{
- if(loader != null)
- return loader.loadClass(className);
- else
- return null;
+ // This failed but try others.
}
+
+ try
+ {
+ if (remoteCodebase == null || useCodebaseOnly)
+ return RMIClassLoader.loadClass(remoteCodebase, className);
+ }
+ catch (Exception e)
+ {
+ // This failed but try others.
+ }
+
+ if (loader != null)
+ return Class.forName(className, true, loader);
+
+ throw new ClassNotFoundException(className + " at " + remoteCodebase);
}
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p>
+ * <p>
+ * <pre>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p>
+ * <p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
public RemoteException mapSystemException(SystemException ex)
{
- throw new Error("Not implemented for UtilDelegate");
+ RemoteException rex;
+
+ String status;
+
+ switch (ex.completed.value())
+ {
+ case CompletionStatus._COMPLETED_MAYBE:
+ status = "Maybe";
+ break;
+
+ case CompletionStatus._COMPLETED_NO:
+ status = "No";
+ break;
+
+ case CompletionStatus._COMPLETED_YES:
+ status = "Yes";
+ break;
+
+ default:
+ status = "Unexpected completion status " + ex.completed.value();
+ }
+
+ String name = ex.getClass().getName();
+
+ if (name.startsWith(m_StandardPackage))
+ name = name.substring(m_StandardPackage.length());
+
+ String message = "CORBA " + name + " 0x" + Integer.toHexString(ex.minor)
+ + " " + status;
+
+ if (ex instanceof COMM_FAILURE)
+ rex = new MarshalException(message, ex);
+ else if (ex instanceof INV_OBJREF)
+ {
+ rex = new NoSuchObjectException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof NO_PERMISSION)
+ rex = new AccessException(message, ex);
+ else if (ex instanceof MARSHAL)
+ rex = new MarshalException(message, ex);
+ else if (ex instanceof BAD_PARAM)
+ rex = new MarshalException(message, ex);
+ else if (ex instanceof OBJECT_NOT_EXIST)
+ {
+ rex = new NoSuchObjectException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof TRANSACTION_REQUIRED)
+ {
+ rex = new TransactionRequiredException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof TRANSACTION_ROLLEDBACK)
+ {
+ rex = new TransactionRolledbackException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof INVALID_TRANSACTION)
+ {
+ rex = new InvalidTransactionException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof UNKNOWN)
+ rex = wrapException(ex.getCause());
+ else
+ rex = new RemoteException(message, ex);
+
+ return rex;
}
- public Object readAny(InputStream in)
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param ex an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
+ public RemoteException wrapException(Throwable ex)
+ throws RuntimeException
{
- throw new Error("Not implemented for UtilDelegate");
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException) ex;
+ else if (ex instanceof Error)
+ return new ServerError(ex.getMessage(), (Error) ex);
+ else if (ex instanceof RemoteException)
+ return new ServerException(ex.getMessage(), (Exception) ex);
+ else if (ex instanceof SystemException)
+ return wrapException(mapSystemException((SystemException) ex));
+ else
+ return new UnexpectedException("Unexpected", (Exception) ex);
}
- public void registerTarget(Tie tie, Remote target)
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ public void writeAbstractObject(OutputStream output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ ((org.omg.CORBA_2_3.portable.OutputStream) output).write_abstract_interface(object);
}
-
- public void unexportObject(Remote target)
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ public void writeAny(OutputStream output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ Any any = output.orb().create_any();
+ if (object == null)
+ {
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_abstract_interface);
+ t.setId("IDL:omg.org/CORBA/AbstractBase:1.0");
+ t.setName("");
+ any.type(t);
+ output.write_any(any);
+ return;
+ }
+ else if (object instanceof org.omg.CORBA.Object
+ && !(object instanceof Remote))
+ {
+ // Write as value type.
+ boolean inserted = ObjectCreator.insertWithHelper(any, object);
+ if (inserted)
+ {
+ output.write_any(any);
+ return;
+ }
+ }
+
+ if (object instanceof org.omg.CORBA.Object)
+ writeAnyAsRemote(output, object);
+ else if (object instanceof Serializable)
+ {
+ any.insert_Value((Serializable) object);
+ output.write_any(any);
+ }
+ else
+ {
+ MARSHAL m = new MARSHAL(object.getClass().getName()
+ + " must be CORBA Object, Remote or Serializable");
+ m.minor = Minor.NonSerializable;
+ throw m;
+ }
}
-
- public RemoteException wrapException(Throwable orig)
+
+ /**
+ * Write Any as for remote object.
+ */
+ void writeAnyAsRemote(OutputStream output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_objref);
+ t.setId(m_ValueHandler.getRMIRepositoryID(object.getClass()));
+ t.setName(object.getClass().getName());
+
+ // Writing Any (typecode, followed by value).
+ output.write_TypeCode(t);
+ writeRemoteObject(output, object);
}
-
- public void writeAbstractObject(OutputStream out, Object obj)
+
+ /**
+ * Get the class name excluding the package name.
+ */
+ String getName(String n)
{
- throw new Error("Not implemented for UtilDelegate");
+ int p = n.lastIndexOf('.');
+ if (p < 0)
+ return n;
+ else
+ return n.substring(p + 1);
}
-
- public void writeAny(OutputStream out, Object obj)
+
+ /**
+ * Read Any from the input stream.
+ */
+ public Object readAny(InputStream input)
{
- throw new Error("Not implemented for UtilDelegate");
+ return input.read_any();
}
- public void writeRemoteObject(OutputStream out, Object obj)
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible. This method is used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public void writeRemoteObject(OutputStream an_output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+ if (object == null)
+ an_output.write_Object(null);
+ else if (isTieRequired(object))
+ {
+ // Find the interface that is implemented by the object and extends
+ // Remote.
+ Class fc = getExportedInterface(object);
+ exportTie(output, object, fc);
+ }
+ else if (object instanceof org.omg.CORBA.Object)
+ {
+ ensureOrbRunning(output);
+ an_output.write_Object((org.omg.CORBA.Object) object);
+ }
+ else if (object != null && object instanceof Serializable)
+ writeFields(an_output, (Serializable) object);
}
-}
+
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
new file mode 100644
index 00000000000..dc3b3cd6ee8
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
@@ -0,0 +1,163 @@
+/* ValueHandlerDelegateImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.CDR.gnuRuntime;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.SendingContext.RunTime;
+
+import java.io.Externalizable;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.rmi.Remote;
+
+import javax.rmi.CORBA.ValueHandler;
+import javax.rmi.CORBA.ValueHandlerMultiFormat;
+
+/**
+ * Implementation of the ValueHandler.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
+public class ValueHandlerDelegateImpl
+ extends RmiUtilities
+ implements ValueHandler, ValueHandlerMultiFormat
+{
+ /**
+ * Return the maximal supported stream format version. We currently
+ * support the version 1.
+ *
+ * TODO Support the version 2.
+ */
+ public byte getMaximumStreamFormatVersion()
+ {
+ return 1;
+ }
+
+ /**
+ * Write value using the given stream format version.
+ */
+ public void writeValue(OutputStream output, Serializable value, byte version)
+ {
+ if (version!=1)
+ throw new BAD_PARAM("Unsupported stream format version "+version);
+ else
+ writeValue(output, value);
+ }
+
+ /**
+ * This implementation associates RunTime with stream rather than with the
+ * value handler and this method is not used in the implementation. It is
+ * implemented just for the sake of compatibility.
+ */
+ public RunTime getRunTimeCodeBase()
+ {
+ return new gnuRuntime(null, null);
+ }
+
+ /**
+ * Checks if an instance of this class can write its fields itself.
+ */
+ public boolean isCustomMarshaled(Class clz)
+ {
+ return CustomMarshal.class.isAssignableFrom(clz)
+ || Streamable.class.isAssignableFrom(clz);
+ }
+
+ /**
+ * No replacement, returns the passed parameter.
+ */
+ public Serializable writeReplace(Serializable value)
+ {
+ return value;
+ }
+
+ /**
+ * Compute the repository id in the RMI hashed format.
+ */
+ public String getRMIRepositoryID(final Class cx)
+ {
+ long hash = 0;
+ Class of = cx.isArray() ? cx.getComponentType() : null;
+
+ if (cx.equals(String[].class))
+ return RMI_STRING_ARRAY_ID;
+ else if (cx.equals(String.class))
+ return RMI_STRING_ID;
+ else if (cx.equals(Class.class))
+ return RMI_CLASS_ID;
+ else if (Remote.class.isAssignableFrom(cx)
+ || !Serializable.class.isAssignableFrom(cx)
+ || cx.isInterface()
+ || (cx.isArray() && (!Serializable.class.isAssignableFrom(of)
+ || of.isPrimitive() || Remote.class.isAssignableFrom(of)))
+
+ )
+ // Some classes that have zero hash code and serial no version id
+ // included.
+ return "RMI:" + cx.getName() + ":" + toHex(hash);
+ else if (cx.isArray())
+ // Arrays have the same hashcode and uid as they components.
+ return "RMI:" + cx.getName() + ":" + toHex(getHashCode(of)) + ":"
+ + toHex(getSid(of));
+ else
+ {
+ if (Externalizable.class.isAssignableFrom(cx))
+ hash = 1;
+ else
+ hash = getHashCode(cx);
+
+ return "RMI:" + cx.getName() + ":" + toHex(hash) + ":"
+ + toHex(getSid(cx));
+ }
+ }
+
+ /**
+ * Get the class serial version UID.
+ */
+ long getSid(Class cx)
+ {
+ ObjectStreamClass osc = ObjectStreamClass.lookup(cx);
+ return osc.getSerialVersionUID();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/javax/rmi/PortableServer.java b/libjava/classpath/gnu/javax/rmi/PortableServer.java
deleted file mode 100644
index 4a841387dd7..00000000000
--- a/libjava/classpath/gnu/javax/rmi/PortableServer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/* PortableServer.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.rmi;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.server.UnicastRemoteObject;
-import java.rmi.server.RemoteStub;
-import java.util.Hashtable;
-
-import javax.rmi.CORBA.*;
-
-/**
- * The relationship of PortableRemoteObjectImpl with PortableServer
- * is like that of UnicastRemoteObject with UnicastServer
- */
-public class PortableServer
-{
- static private Hashtable tieCache = new Hashtable();
- static private Object NO_TIE = new Object();
-
- public static final synchronized void exportObject(Remote obj)
- throws RemoteException
- {
- if(Util.getTie(obj) != null)
- return;
-
- Tie tie = getTieFromRemote(obj);
- if (tie != null)
- Util.registerTarget(tie, obj);
- else
- UnicastRemoteObject.exportObject(obj);
- }
-
- public static final void unexportObject(Remote obj)
- {
- if (Util.getTie(obj) != null)
- Util.unexportObject(obj);
- if (tieCache.get(obj) != null) //??
- tieCache.remove(obj);
- }
-
- public static final Remote toStub(Remote obj)
- throws NoSuchObjectException
- {
- if (obj instanceof Stub || obj instanceof RemoteStub)
- return obj;
-
- Tie tie = Util.getTie(obj);
- Remote stub;
- if (tie != null)
- stub = getStubFromTie(tie);
- else
- throw new NoSuchObjectException("Can't toStub an unexported object");
- return stub;
- }
-
- static synchronized Tie getTieFromRemote(Remote obj)
- {
- Object tie = tieCache.get(obj);
- if (tie == null)
- {
- tie = getTieFromClass(obj.getClass());
- if(tie == null)
- tieCache.put(obj, NO_TIE);
- else
- tieCache.put(obj, tie);
- }
- else
- if(tie != NO_TIE)
- {
- try
- {
- tie = obj.getClass().newInstance();
- }
- catch(Exception _)
- {
- tie = null;
- }
- }
- else //NO_TIE
- tie = null;
-
- return (Tie)tie;
- }
-
- static synchronized Tie getTieFromClass(Class clz)
- {
- //FIX ME
- return null;
- }
-
- public static Remote getStubFromTie(Tie tie)
- {
- //FIX ME
- return null;
- }
-
- public static Remote getStubFromObjectImpl(ObjectImpl objimpl, Class toClass)
- {
- //FIX ME
- return null;
- }
-}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java
new file mode 100644
index 00000000000..fb9e684d096
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java
@@ -0,0 +1,130 @@
+/* AlsaInputPortDevice.java -- ALSA MIDI In Port
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
+import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
+
+/**
+ * ALSA MIDI In Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class AlsaInputPortDevice extends AlsaPortDevice
+{
+
+ AlsaInputPortDevice (AlsaPortInfo info)
+ {
+ super(info);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ return new AlsaTransmitter();
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java
new file mode 100644
index 00000000000..4951be6059c
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java
@@ -0,0 +1,216 @@
+/* AlsaMidiDeviceProvider.java -- The ALSA MIDI Device Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import gnu.classpath.Configuration;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDevice.Info;
+import javax.sound.midi.spi.MidiDeviceProvider;
+
+/**
+ * Provide ALSA MIDI devices.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class AlsaMidiDeviceProvider extends MidiDeviceProvider
+{
+ /**
+ * Abstract base for ALSA specific MIDI device info.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static abstract class AlsaInfo extends Info
+ {
+ /**
+ * Create an ALSA specific MIDI device info object.
+ *
+ * @param name the device name
+ * @param description the device description
+ */
+ public AlsaInfo(String name, String description)
+ {
+ super(name, "Alsa", description, "0.0");
+ }
+
+ abstract MidiDevice getDevice ();
+ }
+
+ /**
+ * ALSA MIDI Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ public static abstract class AlsaPortInfo extends AlsaInfo
+ {
+ long client;
+ long port;
+
+ /**
+ * Create ALSA MIDI In Port.
+ *
+ * @param name the device name
+ * @param description the device description
+ * @param client the client ID
+ * @param port the port ID
+ */
+ public AlsaPortInfo(String name, String description, long client, long port)
+ {
+ super(name, description);
+ this.client = client;
+ this.port = port;
+ }
+ }
+
+ /**
+ * ALSA Sequencer specific info.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class AlsaSequencerInfo extends AlsaInfo
+ {
+ public AlsaSequencerInfo(String name, String description)
+ {
+ super(name, description);
+ }
+
+ MidiDevice getDevice()
+ {
+ return AlsaMidiSequencerDevice.getInstance();
+ }
+ }
+
+ /**
+ * ALSA MIDI In Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class AlsaInputPortInfo extends AlsaPortInfo
+ {
+ public AlsaInputPortInfo(String name, String description, long client, long port)
+ {
+ super(name, description, client, port);
+ }
+
+ MidiDevice getDevice()
+ {
+ return new AlsaInputPortDevice(this);
+ }
+ }
+
+ /**
+ * ALSA MIDI Out Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class AlsaOutputPortInfo extends AlsaPortInfo
+ {
+ public AlsaOutputPortInfo(String name, String description, long client, long port)
+ {
+ super(name, description, client, port);
+ }
+
+ MidiDevice getDevice()
+ {
+ return new AlsaOutputPortDevice(this);
+ }
+ }
+
+ private static AlsaInfo[] infos;
+
+ private static native AlsaInfo[] getInputDeviceInfo_();
+ private static native AlsaInfo[] getOutputDeviceInfo_();
+
+ /**
+ * Initialize the ALSA system
+ */
+ private static native void init_();
+
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gjsmalsa");
+ }
+
+ init_();
+
+ AlsaInfo inputs[] = getInputDeviceInfo_();
+ AlsaInfo outputs[] = getOutputDeviceInfo_();
+
+ infos = new AlsaInfo[inputs.length + outputs.length + 1];
+ infos[0] = new AlsaSequencerInfo ("/dev/snd/seq", "ALSA Sequencer");
+ System.arraycopy(inputs, 0, infos, 1, inputs.length);
+ System.arraycopy(outputs, 0, infos, 1 + inputs.length, outputs.length);
+ }
+
+ public AlsaMidiDeviceProvider()
+ {
+ // Nothing.
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDeviceInfo()
+ */
+ public Info[] getDeviceInfo()
+ {
+ return infos;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDevice(javax.sound.midi.MidiDevice.Info)
+ */
+ public MidiDevice getDevice(Info info)
+ {
+ for (int i = 0; i < infos.length; i++)
+ {
+ if (info.equals(infos[i]))
+ {
+ return infos[i].getDevice();
+ }
+ }
+ throw new IllegalArgumentException("Don't recognize MIDI device " + info);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
new file mode 100644
index 00000000000..c91f1e39851
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
@@ -0,0 +1,519 @@
+/* AlsaMidiSequencerDevice.java -- The ALSA MIDI sequencer device
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.sound.midi.ControllerEventListener;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MetaEventListener;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Sequencer;
+import javax.sound.midi.Track;
+import javax.sound.midi.Transmitter;
+
+// FIXME: These next two imports are only required by gcj it seems.
+import javax.sound.midi.MidiDevice.Info;
+import javax.sound.midi.Sequencer.SyncMode;
+
+/**
+ * The ALSA MIDI sequencer device. This is a singleton device.
+ *
+ * @author green@redhat.com
+ *
+ */
+public class AlsaMidiSequencerDevice implements Sequencer
+{
+ // The singleton instance.
+ public final static AlsaMidiSequencerDevice instance = new AlsaMidiSequencerDevice();
+
+ // A pointer to a native chunk of memory
+ private long nativeState;
+
+ // The sequence to process
+ private Sequence sequence;
+
+ /**
+ * A private constructor. There should only be one instance of this
+ * device.
+ */
+ private AlsaMidiSequencerDevice()
+ {
+ super();
+ }
+
+ /**
+ * Return the sequencer singleton.
+ *
+ * @return the sequencer singleton
+ */
+ public static AlsaMidiSequencerDevice getInstance()
+ {
+ return instance;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setSequence(javax.sound.midi.Sequence)
+ */
+ public void setSequence(Sequence seq) throws InvalidMidiDataException
+ {
+ sequence = seq;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setSequence(java.io.InputStream)
+ */
+ public void setSequence(InputStream istream) throws IOException,
+ InvalidMidiDataException
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getSequence()
+ */
+ public Sequence getSequence()
+ {
+ return sequence;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#start()
+ */
+ public void start()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#stop()
+ */
+ public void stop()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#isRunning()
+ */
+ public boolean isRunning()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#startRecording()
+ */
+ public void startRecording()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#stopRecording()
+ */
+ public void stopRecording()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#isRecording()
+ */
+ public boolean isRecording()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#recordEnable(javax.sound.midi.Track, int)
+ */
+ public void recordEnable(Track track, int channel)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#recordDisable(javax.sound.midi.Track)
+ */
+ public void recordDisable(Track track)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTempoInBPM()
+ */
+ public float getTempoInBPM()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTempoInBPM(float)
+ */
+ public void setTempoInBPM(float bpm)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTempoInMPQ()
+ */
+ public float getTempoInMPQ()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTempoInMPQ(float)
+ */
+ public void setTempoInMPQ(float mpq)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTempoFactor(float)
+ */
+ public void setTempoFactor(float factor)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTempoFactor()
+ */
+ public float getTempoFactor()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTickLength()
+ */
+ public long getTickLength()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTickPosition()
+ */
+ public long getTickPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTickPosition(long)
+ */
+ public void setTickPosition(long tick)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMicrosecondLength()
+ */
+ public long getMicrosecondLength()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setMicrosecondPosition(long)
+ */
+ public void setMicrosecondPosition(long microsecond)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode)
+ */
+ public void setMasterSyncMode(SyncMode sync)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMasterSyncMode()
+ */
+ public SyncMode getMasterSyncMode()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMasterSyncModes()
+ */
+ public SyncMode[] getMasterSyncModes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode)
+ */
+ public void setSlaveSyncMode(SyncMode sync)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getSlaveSyncMode()
+ */
+ public SyncMode getSlaveSyncMode()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getSlaveSyncModes()
+ */
+ public SyncMode[] getSlaveSyncModes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTrackMute(int, boolean)
+ */
+ public void setTrackMute(int track, boolean mute)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTrackMute(int)
+ */
+ public boolean getTrackMute(int track)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTrackSolo(int, boolean)
+ */
+ public void setTrackSolo(int track, boolean solo)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTrackSolo(int)
+ */
+ public boolean getTrackSolo(int track)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#addMetaEventListener(javax.sound.midi.MetaEventListener)
+ */
+ public boolean addMetaEventListener(MetaEventListener listener)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#removeMetaEventListener(javax.sound.midi.MetaEventListener)
+ */
+ public void removeMetaEventListener(MetaEventListener listener)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#addControllerEventListener(javax.sound.midi.ControllerEventListener, int[])
+ */
+ public int[] addControllerEventListener(ControllerEventListener listener,
+ int[] controllers)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[])
+ */
+ public int[] removeControllerEventListener(ControllerEventListener listener,
+ int[] controllers)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getDeviceInfo()
+ */
+ public Info getDeviceInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ synchronized(this)
+ {
+ // Check to see if we're open already.
+ if (nativeState != 0)
+ return;
+
+ nativeState = open_();
+ }
+ }
+
+ /**
+ * Allocate the native state object, and open the sequencer.
+ *
+ * @return a long representation of a pointer to the nativeState.
+ */
+ private native long open_();
+
+ /**
+ * Close the sequencer and free the native state object.
+ */
+ private native void close_(long nativeState);
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ synchronized(this)
+ {
+ close_(nativeState);
+ nativeState = 0;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ synchronized(this)
+ {
+ return (nativeState != 0);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ return -1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ return -1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java
new file mode 100644
index 00000000000..bc5a5593967
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java
@@ -0,0 +1,131 @@
+/* AlsaOutputPortDevice.java -- ALSA MIDI Output Port Device
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
+
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
+
+/**
+ * ALSA MIDI Out Device
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class AlsaOutputPortDevice extends AlsaPortDevice
+{
+ AlsaOutputPortDevice (AlsaPortInfo info)
+ {
+ super(info);
+ }
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
new file mode 100644
index 00000000000..d666be1f1ba
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
@@ -0,0 +1,153 @@
+/* AlsaPortDevice.java -- ALSA MIDI Port Devices
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
+
+// FIXME: This next import is only rquired for gcj it seems.
+import javax.sound.midi.MidiDevice.Info;
+
+import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
+
+/**
+ * ALSA Port Device
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public abstract class AlsaPortDevice implements MidiDevice
+{
+ /**
+ * The ALSA Receiver class.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ public class AlsaReceiver implements Receiver
+ {
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#send(javax.sound.midi.MidiMessage, long)
+ */
+ public void send(MidiMessage message, long timeStamp)
+ throws IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ AlsaMidiDeviceProvider.AlsaPortInfo info;
+
+ public AlsaPortDevice (AlsaPortInfo info)
+ {
+ this.info = info;
+ }
+
+ public Info getDeviceInfo()
+ {
+ return info;
+ }
+
+ native void run_receiver_thread_ (long client, long port, Receiver receiver);
+
+ /**
+ * The ALSA Transmitter class.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ protected class AlsaTransmitter implements Transmitter, Runnable
+ {
+ private Receiver receiver;
+
+ public void run()
+ {
+ run_receiver_thread_ (info.client, info.port, receiver);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Transmitter#setReceiver(javax.sound.midi.Receiver)
+ */
+ public void setReceiver(Receiver receiver)
+ {
+ synchronized (this)
+ {
+ this.receiver = receiver;
+ }
+
+ // Create the processing thread
+ new Thread(this).start();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Transmitter#getReceiver()
+ */
+ public Receiver getReceiver()
+ {
+ synchronized (this)
+ {
+ return receiver;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Transmitter#close()
+ */
+ public void close()
+ {
+ synchronized (this)
+ {
+ receiver.close();
+ receiver = null;
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
new file mode 100644
index 00000000000..baf61732d18
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
@@ -0,0 +1,173 @@
+/* DSSIMidiDeviceProvider.java -- DSSI Device Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.dssi;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.io.FilenameFilter;
+
+import gnu.classpath.Configuration;
+import gnu.javax.sound.midi.alsa.AlsaMidiSequencerDevice;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDevice.Info;
+import javax.sound.midi.spi.MidiDeviceProvider;
+
+/**
+ * A DSSI MIDI device provider.
+ *
+ * DSSI (pronounced "dizzy") is an API for audio plugins, with particular
+ * application for software synthesis plugins with native user interfaces.
+ *
+ * Read about DSSI at http://dssi.sourceforge.net
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class DSSIMidiDeviceProvider extends MidiDeviceProvider
+{
+ /**
+ * The MidiDevice.Info specialized for DSSI synthesizers.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class DSSIInfo extends Info
+ {
+ String soname;
+ long index;
+
+ public DSSIInfo(String name, String vendor, String description,
+ String version, String soname, long index)
+ {
+ super(name, vendor, description, version);
+ this.soname = soname;
+ this.index = index;
+ }
+ }
+
+ static native long dlopen_(String soname);
+ static native void dlclose_(long sohandle);
+ static native long getDSSIHandle_(long sohandle, long index);
+ static native String getDSSIName_(long handle);
+ static native String getDSSICopyright_(long handle);
+ static native String getDSSIVendor_(long handle);
+ static native String getDSSILabel_(long handle);
+
+ private static List examineLibrary(String soname)
+ {
+ List list = new ArrayList();
+ long index = 0;
+ long handle;
+
+ long sohandle = dlopen_(soname);
+ if (sohandle == 0)
+ return list;
+ do
+ {
+ handle = getDSSIHandle_(sohandle, index);
+ if (handle == 0)
+ break;
+ String name = getDSSILabel_(handle);
+ String copyright = getDSSICopyright_(handle);
+ String label = getDSSIName_(handle);
+ String vendor = getDSSIVendor_(handle);
+ list.add(new DSSIInfo(name, vendor, label,
+ "DSSI-1", soname, index));
+ index++;
+ } while (true);
+
+ // Close the library and free memory
+ dlclose_(sohandle);
+
+ return list;
+ }
+
+ private static DSSIInfo[] infos;
+
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ System.loadLibrary("gjsmdssi");
+
+ File dssidir = new File("/usr/lib/dssi/");
+ String sofiles[] = dssidir.list(new FilenameFilter()
+ {
+ public boolean accept(File dir, String n)
+ {
+ return n.endsWith(".so");
+ }
+ });
+ List ilist = new ArrayList();
+ for (int i = 0; i < sofiles.length; i++)
+ ilist.addAll(examineLibrary(new File(dssidir, sofiles[i]).getAbsolutePath()));
+ infos = (DSSIInfo[]) ilist.toArray(new DSSIInfo[ilist.size()]);
+ }
+
+ public DSSIMidiDeviceProvider()
+ {
+ // Empty.
+ }
+
+ /* Return the Info array.
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDeviceInfo()
+ */
+ public Info[] getDeviceInfo()
+ {
+ return infos;
+ }
+
+ /* Get a MIDI Device for info.
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDevice(javax.sound.midi.MidiDevice.Info)
+ */
+ public MidiDevice getDevice(Info info)
+ {
+ for (int i = 0; i < infos.length; i++)
+ {
+ if (info.equals(infos[i]))
+ {
+ return new DSSISynthesizer(infos[i],
+ infos[i].soname,
+ infos[i].index);
+ }
+ }
+ throw new IllegalArgumentException("Don't recognize MIDI device " + info);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
new file mode 100644
index 00000000000..ca09b305078
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
@@ -0,0 +1,745 @@
+/* DSSISynthesizer.java -- DSSI Synthesizer Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.dssi;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.sound.midi.Instrument;
+import javax.sound.midi.MidiChannel;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Patch;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.ShortMessage;
+import javax.sound.midi.Soundbank;
+import javax.sound.midi.SoundbankResource;
+import javax.sound.midi.Synthesizer;
+import javax.sound.midi.Transmitter;
+import javax.sound.midi.VoiceStatus;
+
+// FIXME: This import in only required for gcj it seems.
+import javax.sound.midi.MidiDevice.Info;
+
+/**
+ * DSSI soft-synth support.
+ *
+ * All DSSI soft-synths are expected to be installed in /usr/lib/dssi.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class DSSISynthesizer implements Synthesizer
+{
+ /**
+ * The DSSI Instrument class.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ class DSSIInstrument extends Instrument
+ {
+ DSSIInstrument (Soundbank soundbank, Patch patch, String name)
+ {
+ super (soundbank, patch, name, null);
+ }
+
+ /* @see javax.sound.midi.SoundbankResource#getData()
+ */
+ public Object getData()
+ {
+ return null;
+ }
+
+ }
+
+/**
+ * DSSISoundbank holds all instruments.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ class DSSISoundbank implements Soundbank
+ {
+ private String name;
+ private String description;
+ private List instruments = new ArrayList();
+ private List resources = new ArrayList();
+ private String vendor;
+ private String version;
+
+ public DSSISoundbank(String name, String description, String vendor, String version)
+ {
+ this.name = name;
+ this.description = description;
+ this.vendor = vendor;
+ this.version = version;
+ }
+
+ void add(Instrument instrument)
+ {
+ instruments.add(instrument);
+ }
+
+ /* @see javax.sound.midi.Soundbank#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getVersion()
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getVendor()
+ */
+ public String getVendor()
+ {
+ return vendor;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getDescription()
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getResources()
+ */
+ public SoundbankResource[] getResources()
+ {
+ return (SoundbankResource[])
+ resources.toArray(new SoundbankResource[resources.size()]);
+ }
+
+ /* @see javax.sound.midi.Soundbank#getInstruments()
+ */
+ public Instrument[] getInstruments()
+ {
+ return (Instrument[])
+ instruments.toArray(new Instrument[instruments.size()]);
+ }
+
+ /* @see javax.sound.midi.Soundbank#getInstrument(javax.sound.midi.Patch)
+ */
+ public Instrument getInstrument(Patch patch)
+ {
+ Iterator itr = instruments.iterator();
+
+ while (itr.hasNext())
+ {
+ Instrument i = (Instrument) itr.next();
+ if (i.getPatch().equals(patch))
+ return i;
+ }
+
+ return null;
+ }
+ }
+
+/**
+ * The Receiver class receives all MIDI messages from a connected
+ * Transmitter.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ class DSSIReceiver implements Receiver
+ {
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#send(javax.sound.midi.MidiMessage, long)
+ */
+ public void send(MidiMessage message, long timeStamp)
+ throws IllegalStateException
+ {
+ if (message instanceof ShortMessage)
+ {
+ ShortMessage smessage = (ShortMessage) message;
+
+ switch (message.getStatus())
+ {
+ case ShortMessage.NOTE_ON:
+ int velocity = smessage.getData2();
+ if (velocity > 0)
+ channels[smessage.getChannel()].noteOn(smessage.getData1(),
+ smessage.getData2());
+ else
+ channels[smessage.getChannel()].noteOff(smessage.getData1());
+ break;
+ case ShortMessage.CONTROL_CHANGE:
+ channels[smessage.getChannel()].controlChange(smessage.getData1(),
+ smessage.getData2());
+ break;
+ default:
+ System.out.println ("Unhandled message: " + message.getStatus());
+ break;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ }
+
+ static native void noteOn_(long handle, int channel, int noteNumber, int velocity);
+ static native void noteOff_(long handle, int channel, int noteNumber, int velocity);
+ static native void setPolyPressure_(long handle, int channel, int noteNumber, int pressure);
+ static native int getPolyPressure_(long handle, int channel, int noteNumber);
+ static native void controlChange_(long handle, int channel, int control, int value);
+ static native void open_(long handle);
+ static native void close_(long handle);
+ static native String getProgramName_(long handle, int index);
+ static native int getProgramBank_(long handle, int index);
+ static native int getProgramProgram_(long handle, int index);
+ static native void selectProgram_(long handle, int bank, int program);
+
+ /**
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ public class DSSIMidiChannel implements MidiChannel
+ {
+ int channel = 0;
+
+ /**
+ * Default contructor.
+ */
+ public DSSIMidiChannel(int channel)
+ {
+ super();
+ this.channel = channel;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#noteOn(int, int)
+ */
+ public void noteOn(int noteNumber, int velocity)
+ {
+ noteOn_(sohandle, channel, noteNumber, velocity);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#noteOff(int, int)
+ */
+ public void noteOff(int noteNumber, int velocity)
+ {
+ noteOff_(sohandle, channel, noteNumber, velocity);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#noteOff(int)
+ */
+ public void noteOff(int noteNumber)
+ {
+ noteOff_(sohandle, channel, noteNumber, -1);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setPolyPressure(int, int)
+ */
+ public void setPolyPressure(int noteNumber, int pressure)
+ {
+ setPolyPressure_(sohandle, channel, noteNumber, pressure);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getPolyPressure(int)
+ */
+ public int getPolyPressure(int noteNumber)
+ {
+ return getPolyPressure_(sohandle, channel, noteNumber);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setChannelPressure(int)
+ */
+ public void setChannelPressure(int pressure)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getChannelPressure()
+ */
+ public int getChannelPressure()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* @see javax.sound.midi.MidiChannel#controlChange(int, int) */
+ public void controlChange(int controller, int value)
+ {
+ controlChange_(sohandle, channel, controller, value);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getController(int)
+ */
+ public int getController(int controller)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#programChange(int)
+ */
+ public void programChange(int program)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#programChange(int, int)
+ */
+ public void programChange(int bank, int program)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getProgram()
+ */
+ public int getProgram()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setPitchBend(int)
+ */
+ public void setPitchBend(int bend)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getPitchBend()
+ */
+ public int getPitchBend()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#resetAllControllers()
+ */
+ public void resetAllControllers()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#allNotesOff()
+ */
+ public void allNotesOff()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#allSoundOff()
+ */
+ public void allSoundOff()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#localControl(boolean)
+ */
+ public boolean localControl(boolean on)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setMono(boolean)
+ */
+ public void setMono(boolean on)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getMono()
+ */
+ public boolean getMono()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setOmni(boolean)
+ */
+ public void setOmni(boolean on)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getOmni()
+ */
+ public boolean getOmni()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setMute(boolean)
+ */
+ public void setMute(boolean mute)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getMute()
+ */
+ public boolean getMute()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setSolo(boolean)
+ */
+ public void setSolo(boolean solo)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getSolo()
+ */
+ public boolean getSolo()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ }
+
+ long sohandle;
+ long handle;
+ private Info info;
+
+ MidiChannel channels[] = new MidiChannel[16];
+
+ // The list of known soundbanks, and the default one.
+ List soundbanks = new ArrayList();
+ DSSISoundbank defaultSoundbank;
+
+ /**
+ * Create a DSSI Synthesizer.
+ *
+ * @param info the DSSIInfo for this soft-synth
+ * @param soname the name of the .so file for this DSSI synth
+ * @param index the DSSI index for this soft-synth
+ */
+ public DSSISynthesizer(Info info, String soname, long index)
+ {
+ super();
+ this.info = info;
+ sohandle = DSSIMidiDeviceProvider.dlopen_(soname);
+ handle = DSSIMidiDeviceProvider.getDSSIHandle_(sohandle, index);
+ channels[0] = new DSSIMidiChannel(0);
+ defaultSoundbank = new DSSISoundbank("name", "description",
+ "vendor", "version");
+ soundbanks.add(defaultSoundbank);
+
+ int i = 0;
+ String name;
+ do
+ {
+ name = getProgramName_(sohandle, i);
+ if (name != null)
+ {
+ defaultSoundbank.
+ add(new DSSIInstrument(defaultSoundbank,
+ new Patch(getProgramBank_(sohandle, i),
+ getProgramProgram_(sohandle, i)),
+ name));
+ i++;
+ }
+ } while (name != null);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getMaxPolyphony()
+ */
+ public int getMaxPolyphony()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getLatency()
+ */
+ public long getLatency()
+ {
+ // DSSI and LADSPA provide no way to determine the latency.
+ // Let's just return 0 for now.
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getChannels()
+ */
+ public MidiChannel[] getChannels()
+ {
+ return channels;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getVoiceStatus()
+ */
+ public VoiceStatus[] getVoiceStatus()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#isSoundbankSupported(javax.sound.midi.Soundbank)
+ */
+ public boolean isSoundbankSupported(Soundbank soundbank)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* @see javax.sound.midi.Synthesizer#loadInstrument(javax.sound.midi.Instrument)
+ */
+ public boolean loadInstrument(Instrument instrument)
+ {
+ // FIXME: perhaps this isn't quite right. It can probably
+ // be in any soundbank.
+ if (instrument.getSoundbank() != defaultSoundbank)
+ throw new IllegalArgumentException ("Synthesizer doesn't support this instrument's soundbank");
+
+ Patch patch = instrument.getPatch();
+ selectProgram_(sohandle, patch.getBank(), patch.getProgram());
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#unloadInstrument(javax.sound.midi.Instrument)
+ */
+ public void unloadInstrument(Instrument instrument)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#remapInstrument(javax.sound.midi.Instrument, javax.sound.midi.Instrument)
+ */
+ public boolean remapInstrument(Instrument from, Instrument to)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* @see javax.sound.midi.Synthesizer#getDefaultSoundbank()
+ */
+ public Soundbank getDefaultSoundbank()
+ {
+ return defaultSoundbank;
+ }
+
+ /* @see javax.sound.midi.Synthesizer#getAvailableInstruments()
+ */
+ public Instrument[] getAvailableInstruments()
+ {
+ List instruments = new ArrayList();
+ Iterator itr = soundbanks.iterator();
+ while (itr.hasNext())
+ {
+ Soundbank sb = (Soundbank) itr.next();
+ Instrument ins[] = sb.getInstruments();
+ for (int i = 0; i < ins.length; i++)
+ instruments.add(ins[i]);
+ }
+ return (Instrument[])
+ instruments.toArray(new Instrument[instruments.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getLoadedInstruments()
+ */
+ public Instrument[] getLoadedInstruments()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#loadAllInstruments(javax.sound.midi.Soundbank)
+ */
+ public boolean loadAllInstruments(Soundbank soundbank)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#unloadAllInstruments(javax.sound.midi.Soundbank)
+ */
+ public void unloadAllInstruments(Soundbank soundbank)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#loadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[])
+ */
+ public boolean loadInstruments(Soundbank soundbank, Patch[] patchList)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#unloadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[])
+ */
+ public void unloadInstruments(Soundbank soundbank, Patch[] patchList)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getDeviceInfo()
+ */
+ public Info getDeviceInfo()
+ {
+ return info;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ open_(sohandle);
+ }
+
+ /* @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ close_(sohandle);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ return 1;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ return 0;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ return new DSSIReceiver();
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ return null;
+ }
+}
diff --git a/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java b/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java
index 37e8cc9c120..011ca3c6a3d 100644
--- a/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java
+++ b/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java
@@ -109,7 +109,7 @@ public final class JAXPFactory
// (flags can't necessarily be set before parsing)
new JaxpParser().getXMLReader().setFeature(name, value);
- flags.put(name, new Boolean(value));
+ flags.put(name, Boolean.valueOf(value));
}
catch (SAXNotRecognizedException e)
{
diff --git a/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java b/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java
index 7e950ce042a..6864ff65971 100644
--- a/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java
+++ b/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java
@@ -717,7 +717,9 @@ final public class SAXDriver
}
else
{
- in.setSystemId(absolutize(baseURI, in.getSystemId(), false));
+ in.setSystemId(absolutize(baseURI,
+ in.getSystemId(),
+ entityResolver != base));
source = entityResolver.resolveEntity(in.getPublicId(),
in.getSystemId());
if (source == null)
diff --git a/libjava/classpath/gnu/xml/dom/DomDocument.java b/libjava/classpath/gnu/xml/dom/DomDocument.java
index dc476b582ac..29b8dc72e53 100644
--- a/libjava/classpath/gnu/xml/dom/DomDocument.java
+++ b/libjava/classpath/gnu/xml/dom/DomDocument.java
@@ -210,13 +210,15 @@ public class DomDocument
*/
public Element getElementById(String id)
{
- DomDoctype doctype = (DomDoctype) getDoctype();
-
- if (doctype == null || !doctype.hasIds()
- || id == null || id.length() == 0)
+ if (id == null || id.length() == 0)
{
return null;
}
+ DomDoctype doctype = (DomDoctype) getDoctype();
+ if (doctype != null && !doctype.hasIds())
+ {
+ doctype = null;
+ }
// yes, this is linear in size of document.
// it'd be easy enough to maintain a hashtable.
@@ -233,25 +235,39 @@ public class DomDocument
if (current.getNodeType() == ELEMENT_NODE)
{
DomElement element = (DomElement) current;
- DTDElementTypeInfo info =
- doctype.getElementTypeInfo(current.getNodeName());
- if (info != null &&
- id.equals(element.getAttribute(info.idAttrName)))
- {
- return element;
- }
- else if (element.userIdAttrs != null)
+ if (doctype != null)
{
- for (Iterator i = element.userIdAttrs.iterator();
- i.hasNext(); )
+ DTDElementTypeInfo info =
+ doctype.getElementTypeInfo(current.getNodeName());
+ if (info != null &&
+ id.equals(element.getAttribute(info.idAttrName)))
{
- Node idAttr = (Node) i.next();
- if (id.equals(idAttr.getNodeValue()))
+ return element;
+ }
+ else if (element.userIdAttrs != null)
+ {
+ for (Iterator i = element.userIdAttrs.iterator();
+ i.hasNext(); )
{
- return element;
+ Node idAttr = (Node) i.next();
+ if (id.equals(idAttr.getNodeValue()))
+ {
+ return element;
+ }
}
}
}
+ // xml:id
+ String xmlId = element.getAttribute("xml:id");
+ if (xmlId == null)
+ {
+ xmlId = element.getAttributeNS(XMLConstants.XML_NS_URI,
+ "id");
+ }
+ if (id.equals(xmlId))
+ {
+ return element;
+ }
}
// descend?
diff --git a/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java b/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java
index 3706fba84f5..03420c463e8 100644
--- a/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java
+++ b/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java
@@ -376,31 +376,31 @@ public class GnomeDocument
name = name.toLowerCase();
if ("canonical-form".equals(name))
{
- return new Boolean(canonicalForm);
+ return Boolean.valueOf(canonicalForm);
}
else if ("cdata-sections".equals(name))
{
- return new Boolean(cdataSections);
+ return Boolean.valueOf(cdataSections);
}
else if ("check-character-normalization".equals(name))
{
- return new Boolean(checkCharacterNormalization);
+ return Boolean.valueOf(checkCharacterNormalization);
}
else if ("comments".equals(name))
{
- return new Boolean(comments);
+ return Boolean.valueOf(comments);
}
else if ("datatype-normalization".equals(name))
{
- return new Boolean(datatypeNormalization);
+ return Boolean.valueOf(datatypeNormalization);
}
else if ("element-content-whitespace".equals(name))
{
- return new Boolean(elementContentWhitespace);
+ return Boolean.valueOf(elementContentWhitespace);
}
else if ("entities".equals(name))
{
- return new Boolean(entities);
+ return Boolean.valueOf(entities);
}
else if ("error-handler".equals(name))
{
@@ -408,43 +408,43 @@ public class GnomeDocument
}
else if ("infoset".equals(name))
{
- return new Boolean(!validateIfSchema &&
- !entities &&
- !datatypeNormalization &&
- !cdataSections &&
- namespaceDeclarations &&
- wellFormed &&
- elementContentWhitespace &&
- comments &&
- namespaces);
+ return Boolean.valueOf(!validateIfSchema &&
+ !entities &&
+ !datatypeNormalization &&
+ !cdataSections &&
+ namespaceDeclarations &&
+ wellFormed &&
+ elementContentWhitespace &&
+ comments &&
+ namespaces);
}
else if ("namespaces".equals(name))
{
- return new Boolean(namespaces);
+ return Boolean.valueOf(namespaces);
}
else if ("namespace-declarations".equals(name))
{
- return new Boolean(namespaceDeclarations);
+ return Boolean.valueOf(namespaceDeclarations);
}
else if ("normalize-characters".equals(name))
{
- return new Boolean(normalizeCharacters);
+ return Boolean.valueOf(normalizeCharacters);
}
else if ("split-cdata-sections".equals(name))
{
- return new Boolean(splitCdataSections);
+ return Boolean.valueOf(splitCdataSections);
}
else if ("validate".equals(name))
{
- return new Boolean(validate);
+ return Boolean.valueOf(validate);
}
else if ("validate-if-schema".equals(name))
{
- return new Boolean(validateIfSchema);
+ return Boolean.valueOf(validateIfSchema);
}
else if ("well-formed".equals(name))
{
- return new Boolean(wellFormed);
+ return Boolean.valueOf(wellFormed);
}
else
{
@@ -497,7 +497,7 @@ public class GnomeDocument
}
else if (value instanceof String)
{
- return new Boolean ((String) value).booleanValue();
+ return Boolean.valueOf ((String) value).booleanValue();
}
return false;
}
diff --git a/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java b/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java
index 0fbfa9264aa..8391767490c 100644
--- a/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java
+++ b/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java
@@ -1607,7 +1607,7 @@ public final class ValidationConsumer extends EventFilter
throw new RuntimeException ("patchNext");
}
- if (table != null && (flags | F_LOOPHEAD) != 0)
+ if (table != null && (flags & F_LOOPHEAD) != 0)
table.put (this, this);
}
diff --git a/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java b/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java
index 25f520416e2..05b6d6c0f11 100644
--- a/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java
@@ -121,7 +121,8 @@ public class XMLOutputFactoryImpl
{
if (IS_PREFIX_DEFAULTING.equals(name))
prefixDefaulting = ((Boolean) value).booleanValue();
- throw new IllegalArgumentException(name);
+ else
+ throw new IllegalArgumentException(name);
}
public Object getProperty(String name)
diff --git a/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java b/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java
index 9ac0abe2712..d677048cfa1 100644
--- a/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java
@@ -39,7 +39,10 @@ package gnu.xml.stream;
import java.io.IOException;
import java.io.Writer;
+import java.util.Enumeration;
+import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
@@ -57,16 +60,56 @@ public class XMLStreamWriterImpl
implements XMLStreamWriter
{
+ /**
+ * The underlying character stream to write to.
+ */
protected final Writer writer;
+
+ /**
+ * The encoding being used.
+ * Note that this must match the encoding of the character stream.
+ */
protected final String encoding;
+
+ /**
+ * Whether prefix defaulting is being used.
+ * If true and a prefix has not been defined for a namespace specified on
+ * an element or an attribute, a new prefix and namespace declaration will
+ * be created.
+ */
protected final boolean prefixDefaulting;
+
+ /**
+ * The namespace context used to determine the namespace-prefix mappings
+ * in scope.
+ */
protected NamespaceContext namespaceContext;
+ /**
+ * The stack of elements in scope.
+ * Used to close the remaining elements.
+ */
private LinkedList elements;
+
+ /**
+ * Whether a start element has been opened but not yet closed.
+ */
private boolean inStartElement;
+
+ /**
+ * Whether we are in an empty element.
+ */
private boolean emptyElement;
+
private NamespaceSupport namespaces;
-
+ private int count = 0;
+
+ /**
+ * Constructor.
+ * @see #writer
+ * @see #encoding
+ * @see #prefixDefaulting
+ */
protected XMLStreamWriterImpl(Writer writer, String encoding,
boolean prefixDefaulting)
{
@@ -77,6 +120,10 @@ public class XMLStreamWriterImpl
namespaces = new NamespaceSupport();
}
+ /**
+ * Write the end of a start-element event.
+ * This will close the element if it was defined to be an empty element.
+ */
private void endStartElement()
throws IOException
{
@@ -128,7 +175,7 @@ public class XMLStreamWriterImpl
if (!isDeclared)
{
if (prefixDefaulting)
- prefix = XMLConstants.DEFAULT_NS_PREFIX;
+ prefix = createPrefix(namespaceURI);
else
throw new XMLStreamException("namespace " + namespaceURI +
" has not been declared");
@@ -140,13 +187,13 @@ public class XMLStreamWriterImpl
writer.write(':');
}
writer.write(localName);
- if (prefixDefaulting && !isDeclared)
+ inStartElement = true;
+ if (!isDeclared)
{
writeNamespace(prefix, namespaceURI);
}
elements.addLast(new String[] { prefix, localName });
- inStartElement = true;
}
catch (IOException e)
{
@@ -156,6 +203,26 @@ public class XMLStreamWriterImpl
}
}
+ /**
+ * Creates a new unique prefix in the document.
+ * Subclasses may override this method to provide a suitably unique prefix
+ * for the given namespace.
+ * @param namespaceURI the namespace URI
+ */
+ protected String createPrefix(String namespaceURI)
+ {
+ Set prefixes = new HashSet();
+ for (Enumeration e = namespaces.getPrefixes(); e.hasMoreElements(); )
+ prefixes.add(e.nextElement());
+ String ret;
+ do
+ {
+ ret = "ns" + (count++);
+ }
+ while (prefixes.contains(ret));
+ return ret;
+ }
+
public void writeStartElement(String prefix, String localName,
String namespaceURI)
throws XMLStreamException
@@ -656,6 +723,12 @@ public class XMLStreamWriterImpl
throw new IllegalArgumentException(name);
}
+ /**
+ * Write the specified text, ensuring that the content is suitably encoded
+ * for XML.
+ * @param text the text to write
+ * @param inAttr whether we are in an attribute value
+ */
private void writeEncoded(String text, boolean inAttr)
throws IOException
{
diff --git a/libjava/classpath/gnu/xml/transform/StreamSerializer.java b/libjava/classpath/gnu/xml/transform/StreamSerializer.java
index eb045393dff..74b10057c12 100644
--- a/libjava/classpath/gnu/xml/transform/StreamSerializer.java
+++ b/libjava/classpath/gnu/xml/transform/StreamSerializer.java
@@ -694,7 +694,11 @@ public class StreamSerializer
{
buf = new StringBuffer(text.substring(0, i));
}
- buf.append("&apos;");
+ if (mode == Stylesheet.OUTPUT_HTML)
+ // HTML does not define &apos;, use character entity ref
+ buf.append("&#x27;");
+ else
+ buf.append("&apos;");
}
else if (c == '"' && inAttr)
{
diff --git a/libjava/classpath/gnu/xml/transform/TransformerImpl.java b/libjava/classpath/gnu/xml/transform/TransformerImpl.java
index a36aa6173f2..cf404884736 100644
--- a/libjava/classpath/gnu/xml/transform/TransformerImpl.java
+++ b/libjava/classpath/gnu/xml/transform/TransformerImpl.java
@@ -1,5 +1,5 @@
/* TransformerImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -505,6 +505,12 @@ class TransformerImpl
{
URL url = new URL(systemId);
URLConnection connection = url.openConnection();
+ // We need to call setDoInput(false), because our
+ // implementation of the file protocol allows writing
+ // (unlike Sun), but it will fail with a FileNotFoundException
+ // if we also open the connection for input and the output
+ // file doesn't yet exist.
+ connection.setDoInput(false);
connection.setDoOutput(true);
out = connection.getOutputStream();
}
diff --git a/libjava/classpath/include/Makefile.am b/libjava/classpath/include/Makefile.am
index c775874ea98..ab9b40c0f41 100644
--- a/libjava/classpath/include/Makefile.am
+++ b/libjava/classpath/include/Makefile.am
@@ -7,6 +7,13 @@ ARG_JNI_JAVAH = -jni
ARG_CLASSPATH_JAVAH = -bootclasspath
JAVAH = $(USER_JAVAH) $(ARG_JNI_JAVAH) $(ARG_CLASSPATH_JAVAH) ../lib:$(USER_CLASSLIB)
+SOUND_H_FILES = \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
+
XMLJ_H_FILES = \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeDocument.h \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeXPathNodeList.h \
@@ -106,6 +113,7 @@ $(top_srcdir)/include/gnu_java_awt_peer_qt_QtContainerPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
H_FILES = \
+$(SOUND_H_FILES) \
$(XMLJ_H_FILES) \
$(GTKPEER_H_FILES) \
$(QTPEER_H_FILES) \
@@ -150,6 +158,12 @@ $(top_srcdir)/include/gnu_java_awt_peer_gtk_%.h: $(top_builddir)/lib/gnu/java/aw
$(top_srcdir)/include/gnu_java_awt_peer_qt_%.h: $(top_builddir)/lib/gnu/java/awt/peer/qt/%.class
$(JAVAH) -o $@ gnu.java.awt.peer.qt.$*
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/alsa/%.class
+ $(JAVAH) -o $@ gnu.javax.sound.midi.alsa.$*
+
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/dssi/%.class
+ $(JAVAH) -o $@ gnu.javax.sound.midi.dssi.$*
+
$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainDatagramSocketImpl.java
$(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl
$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java
diff --git a/libjava/classpath/include/Makefile.in b/libjava/classpath/include/Makefile.in
index de575b9f0c4..fc59b767f9f 100644
--- a/libjava/classpath/include/Makefile.in
+++ b/libjava/classpath/include/Makefile.in
@@ -40,10 +40,8 @@ subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -76,10 +74,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -216,6 +218,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -229,6 +232,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -245,6 +249,13 @@ DISTCLEANFILES = jni_md.h
ARG_JNI_JAVAH = -jni
ARG_CLASSPATH_JAVAH = -bootclasspath
JAVAH = $(USER_JAVAH) $(ARG_JNI_JAVAH) $(ARG_CLASSPATH_JAVAH) ../lib:$(USER_CLASSLIB)
+SOUND_H_FILES = \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
+
XMLJ_H_FILES = \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeDocument.h \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeXPathNodeList.h \
@@ -344,6 +355,7 @@ $(top_srcdir)/include/gnu_java_awt_peer_qt_QtContainerPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
H_FILES = \
+$(SOUND_H_FILES) \
$(XMLJ_H_FILES) \
$(GTKPEER_H_FILES) \
$(QTPEER_H_FILES) \
@@ -568,6 +580,12 @@ uninstall-am: uninstall-info-am
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_awt_peer_qt_%.h: $(top_builddir)/lib/gnu/java/awt/peer/qt/%.class
@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.awt.peer.qt.$*
+@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_javax_sound_midi_alsa_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/alsa/%.class
+@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.javax.sound.midi.alsa.$*
+
+@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_javax_sound_midi_dssi_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/dssi/%.class
+@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.javax.sound.midi.dssi.$*
+
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainDatagramSocketImpl.java
@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java
diff --git a/libjava/classpath/include/config.h.in b/libjava/classpath/include/config.h.in
index ab5e10994f2..b67526ff95c 100644
--- a/libjava/classpath/include/config.h.in
+++ b/libjava/classpath/include/config.h.in
@@ -12,6 +12,9 @@
/* Define to 1 if you have the `accept' function. */
#undef HAVE_ACCEPT
+/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
+#undef HAVE_ALSA_ASOUNDLIB_H
+
/* Define to 1 if you have the <asm/ioctls.h> header file. */
#undef HAVE_ASM_IOCTLS_H
@@ -30,6 +33,9 @@
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
+/* Define to 1 if you have the <dssi.h> header file. */
+#undef HAVE_DSSI_H
+
/* Define to 1 if you have the `execve' function. */
#undef HAVE_EXECVE
@@ -271,5 +277,8 @@
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
+/* Define to `__attribute__' to nothing if it's not supported. */
+#undef __attribute__
+
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
index b4d0c5328c4..c74a574e719 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
@@ -16,6 +16,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_indexToPos (JNIE
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_initState (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_initStaticState (JNIEnv *env, jclass);
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline (JNIEnv *env, jobject, jobject);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
index 2c32e3f6c73..da86e23a80e 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
@@ -16,6 +16,7 @@ JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidge
JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions (JNIEnv *env, jobject, jintArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked (JNIEnv *env, jobject, jint);
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h
new file mode 100644
index 00000000000..8e3ed710450
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider__
+#define __gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jobjectArray JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getInputDeviceInfo_1 (JNIEnv *env, jclass);
+JNIEXPORT jobjectArray JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getOutputDeviceInfo_1 (JNIEnv *env, jclass);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_init_1 (JNIEnv *env, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h
new file mode 100644
index 00000000000..e6205394c6b
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h
@@ -0,0 +1,20 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice__
+#define __gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jlong JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_open_1 (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_close_1 (JNIEnv *env, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h
new file mode 100644
index 00000000000..30fae5ff78a
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_alsa_AlsaPortDevice__
+#define __gnu_javax_sound_midi_alsa_AlsaPortDevice__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1 (JNIEnv *env, jobject, jlong, jlong, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_alsa_AlsaPortDevice__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h
new file mode 100644
index 00000000000..6306a3e7a64
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h
@@ -0,0 +1,25 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider__
+#define __gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jlong JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1 (JNIEnv *env, jclass, jstring);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1 (JNIEnv *env, jclass, jlong, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1 (JNIEnv *env, jclass, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
new file mode 100644
index 00000000000..3cb0b77e6c2
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
@@ -0,0 +1,29 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_dssi_DSSISynthesizer__
+#define __gnu_javax_sound_midi_dssi_DSSISynthesizer__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_setPolyPressure_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getPolyPressure_1 (JNIEnv *env, jclass, jlong, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_controlChange_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 (JNIEnv *env, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 (JNIEnv *env, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 (JNIEnv *env, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1 (JNIEnv *env, jclass, jlong, jint, jint);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_dssi_DSSISynthesizer__ */
diff --git a/libjava/classpath/java/applet/Applet.java b/libjava/classpath/java/applet/Applet.java
index d0610ba0ea1..bb855351b8d 100644
--- a/libjava/classpath/java/applet/Applet.java
+++ b/libjava/classpath/java/applet/Applet.java
@@ -54,6 +54,10 @@ import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.UnsupportedAudioFileException;
/**
* This is the base applet class. An applet is a Java program that
@@ -257,8 +261,6 @@ public class Applet extends Panel
* Returns an audio clip from the specified URL. This clip is not tied to
* any particular applet.
*
- * XXX Classpath does not yet implement this.
- *
* @param url the URL of the audio clip
* @return the retrieved audio clip
* @throws NullPointerException if url is null
@@ -267,8 +269,7 @@ public class Applet extends Panel
*/
public static final AudioClip newAudioClip(URL url)
{
- // This requires an implementation of AudioClip in gnu.java.applet.
- throw new Error("Not implemented");
+ return new URLAudioClip(url);
}
/**
@@ -521,4 +522,71 @@ public class Applet extends Panel
return s;
}
} // class AccessibleApplet
+
+ private static class URLAudioClip implements AudioClip
+ {
+ // The URL we will try to play.
+ // This is null if we have already tried to create an
+ // audio input stream from this URL.
+ private URL url;
+
+ // The real audio clip. This is null before the URL is read,
+ // and might be null afterward if we were unable to read the URL
+ // for some reason.
+ private Clip clip;
+
+ public URLAudioClip(URL url)
+ {
+ this.url = url;
+ }
+
+ private synchronized Clip getClip()
+ {
+ if (url == null)
+ return clip;
+ try
+ {
+ clip = AudioSystem.getClip();
+ clip.open(AudioSystem.getAudioInputStream(url));
+ }
+ catch (LineUnavailableException _)
+ {
+ // Ignore.
+ }
+ catch (IOException _)
+ {
+ // Ignore.
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Ignore.
+ }
+ url = null;
+ return clip;
+ }
+
+ public void loop()
+ {
+ Clip myclip = getClip();
+ if (myclip != null)
+ myclip.loop(Clip.LOOP_CONTINUOUSLY);
+ }
+
+ public void play()
+ {
+ Clip myclip = getClip();
+ if (myclip != null)
+ myclip.start();
+ }
+
+ public void stop()
+ {
+ Clip myclip = getClip();
+ if (myclip != null)
+ {
+ myclip.stop();
+ myclip.setFramePosition(0);
+ }
+ }
+ }
} // class Applet
diff --git a/libjava/classpath/java/awt/BorderLayout.java b/libjava/classpath/java/awt/BorderLayout.java
index adf2ebf65f6..1b67c01cfcb 100644
--- a/libjava/classpath/java/awt/BorderLayout.java
+++ b/libjava/classpath/java/awt/BorderLayout.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.awt;
+
/**
* This class implements a layout manager that positions components
* in certain sectors of the parent container.
@@ -229,6 +230,12 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
private int vgap;
+ // Some constants for use with calcSize().
+ private static final int MIN = 0;
+ private static final int MAX = 1;
+ private static final int PREF = 2;
+
+
/**
* Initializes a new instance of <code>BorderLayout</code> with no
* horiztonal or vertical gaps between components.
@@ -423,7 +430,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
*/
public float getLayoutAlignmentX(Container parent)
{
- return(parent.getAlignmentX());
+ return 0.5F;
}
/**
@@ -438,7 +445,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
*/
public float getLayoutAlignmentY(Container parent)
{
- return(parent.getAlignmentY());
+ return 0.5F;
}
/**
@@ -449,7 +456,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
*/
public void invalidateLayout(Container parent)
{
- // FIXME: Implement this properly!
+ // Nothing to do here.
}
/**
@@ -560,7 +567,8 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
}
/**
- * FIXME: Document me!
+ * This is a convenience method to set the bounds on a component.
+ * If the indicated component is null, nothing is done.
*/
private void setBounds(Component comp, int x, int y, int w, int h)
{
@@ -569,12 +577,6 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
comp.setBounds(x, y, w, h);
}
- // FIXME: Maybe move to top of file.
- // Some constants for use with calcSize().
- private static final int MIN = 0;
- private static final int MAX = 1;
- private static final int PREF = 2;
-
private Dimension calcCompSize(Component comp, int what)
{
if (comp == null || !comp.isVisible())
@@ -660,4 +662,112 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
return(new Dimension(width, height));
}
}
+
+ /**
+ * Return the component at the indicated location, or null if no component
+ * is at that location. The constraints argument must be one of the
+ * location constants specified by this class.
+ * @param constraints the location
+ * @return the component at that location, or null
+ * @throws IllegalArgumentException if the constraints argument is not
+ * recognized
+ * @since 1.5
+ */
+ public Component getLayoutComponent(Object constraints)
+ {
+ if (constraints == CENTER)
+ return center;
+ if (constraints == NORTH)
+ return north;
+ if (constraints == EAST)
+ return east;
+ if (constraints == SOUTH)
+ return south;
+ if (constraints == WEST)
+ return west;
+ if (constraints == PAGE_START)
+ return firstLine;
+ if (constraints == PAGE_END)
+ return lastLine;
+ if (constraints == LINE_START)
+ return firstItem;
+ if (constraints == LINE_END)
+ return lastItem;
+ throw new IllegalArgumentException("constraint " + constraints
+ + " is not recognized");
+ }
+
+ /**
+ * Return the component at the specified location, which must be one
+ * of the absolute constants such as CENTER or SOUTH. The container's
+ * orientation is used to map this location to the correct corresponding
+ * component, so for instance in a right-to-left container, a request
+ * for the EAST component could return the LINE_END component. This will
+ * return null if no component is available at the given location.
+ * @param container the container whose orientation is used
+ * @param constraints the absolute location of the component
+ * @return the component at the location, or null
+ * @throws IllegalArgumentException if the constraint is not recognized
+ */
+ public Component getLayoutComponent(Container container, Object constraints)
+ {
+ ComponentOrientation orient = container.getComponentOrientation();
+ if (constraints == CENTER)
+ return center;
+ // Note that we don't support vertical layouts.
+ if (constraints == NORTH)
+ return north;
+ if (constraints == SOUTH)
+ return south;
+ if (constraints == WEST)
+ {
+ // Note that relative layout takes precedence.
+ if (orient.isLeftToRight())
+ return firstItem == null ? west : firstItem;
+ return lastItem == null ? west : lastItem;
+ }
+ if (constraints == EAST)
+ {
+ // Note that relative layout takes precedence.
+ if (orient.isLeftToRight())
+ return lastItem == null ? east : lastItem;
+ return firstItem == null ? east : firstItem;
+ }
+ throw new IllegalArgumentException("constraint " + constraints
+ + " is not recognized");
+ }
+
+ /**
+ * Return the constraint corresponding to a component in this layout.
+ * If the component is null, or is not in this layout, returns null.
+ * Otherwise, this will return one of the constraint constants defined
+ * in this class.
+ * @param c the component
+ * @return the constraint, or null
+ * @since 1.5
+ */
+ public Object getConstraints(Component c)
+ {
+ if (c == null)
+ return null;
+ if (c == center)
+ return CENTER;
+ if (c == north)
+ return NORTH;
+ if (c == east)
+ return EAST;
+ if (c == south)
+ return SOUTH;
+ if (c == west)
+ return WEST;
+ if (c == firstLine)
+ return PAGE_START;
+ if (c == lastLine)
+ return PAGE_END;
+ if (c == firstItem)
+ return LINE_START;
+ if (c == lastItem)
+ return LINE_END;
+ return null;
+ }
}
diff --git a/libjava/classpath/java/awt/Button.java b/libjava/classpath/java/awt/Button.java
index 90be1e5b111..e788d824ee1 100644
--- a/libjava/classpath/java/awt/Button.java
+++ b/libjava/classpath/java/awt/Button.java
@@ -98,6 +98,8 @@ private transient ActionListener action_listeners;
protected class AccessibleAWTButton extends AccessibleAWTComponent
implements AccessibleAction, AccessibleValue
{
+ public static final long serialVersionUID = -5932203980244017102L;
+
protected AccessibleAWTButton()
{
// Do nothing here.
diff --git a/libjava/classpath/java/awt/Canvas.java b/libjava/classpath/java/awt/Canvas.java
index fe2f854847a..b599582ba93 100644
--- a/libjava/classpath/java/awt/Canvas.java
+++ b/libjava/classpath/java/awt/Canvas.java
@@ -292,8 +292,8 @@ public class Canvas
*
* @since 1.4
*/
- public void createBufferStrategy(int numBuffers,
- BufferCapabilities caps)
+ public void createBufferStrategy(int numBuffers, BufferCapabilities caps)
+ throws AWTException
{
if (numBuffers < 1)
throw new IllegalArgumentException("Canvas.createBufferStrategy: number"
@@ -305,15 +305,7 @@ public class Canvas
// a flipping strategy was requested
if (caps.isPageFlipping())
- {
- try
- {
- bufferStrategy = new CanvasFlipBufferStrategy(numBuffers);
- }
- catch (AWTException e)
- {
- }
- }
+ bufferStrategy = new CanvasFlipBufferStrategy(numBuffers);
else
bufferStrategy = new CanvasBltBufferStrategy(numBuffers, true);
}
diff --git a/libjava/classpath/java/awt/Checkbox.java b/libjava/classpath/java/awt/Checkbox.java
index cd39ad43617..93f60924723 100644
--- a/libjava/classpath/java/awt/Checkbox.java
+++ b/libjava/classpath/java/awt/Checkbox.java
@@ -392,6 +392,11 @@ Checkbox(String label, boolean state, CheckboxGroup group)
this.label = label;
this.state = state;
this.group = group;
+
+ if ( state && group != null )
+ {
+ group.setSelectedCheckbox(this);
+ }
}
/*************************************************************************/
@@ -610,8 +615,10 @@ dispatchEventImpl(AWTEvent e)
protected String
paramString()
{
- return ("label=" + label + ",state=" + state + ",group=" + group
- + "," + super.paramString());
+ // Note: We cannot add the checkbox group information here because this
+ // would trigger infinite recursion when CheckboxGroup.toString() is
+ // called and the box is in its selected state.
+ return ("label=" + label + ",state=" + state + "," + super.paramString());
}
/**
diff --git a/libjava/classpath/java/awt/CheckboxMenuItem.java b/libjava/classpath/java/awt/CheckboxMenuItem.java
index 5e446b84c8b..197065f6535 100644
--- a/libjava/classpath/java/awt/CheckboxMenuItem.java
+++ b/libjava/classpath/java/awt/CheckboxMenuItem.java
@@ -335,6 +335,8 @@ paramString()
implements AccessibleAction, AccessibleValue
{
// I think the base class provides the necessary implementation
+
+ private static final long serialVersionUID = -1122642964303476L;
}
/**
diff --git a/libjava/classpath/java/awt/Choice.java b/libjava/classpath/java/awt/Choice.java
index 5075ea92d83..df93c5b0742 100644
--- a/libjava/classpath/java/awt/Choice.java
+++ b/libjava/classpath/java/awt/Choice.java
@@ -565,6 +565,10 @@ processEvent(AWTEvent event)
protected void
processItemEvent(ItemEvent event)
{
+ int index = pItems.indexOf((String) event.getItem());
+ // Don't call back into the peers when selecting index here
+ if (event.getStateChange() == ItemEvent.SELECTED)
+ this.selectedIndex = index;
if (item_listeners != null)
item_listeners.itemStateChanged(event);
}
diff --git a/libjava/classpath/java/awt/Color.java b/libjava/classpath/java/awt/Color.java
index 4ad46d0c07c..b0312924170 100644
--- a/libjava/classpath/java/awt/Color.java
+++ b/libjava/classpath/java/awt/Color.java
@@ -762,7 +762,7 @@ public class Color implements Paint, Serializable
if (max == 0)
array[1] = 0;
else
- array[1] = (max - min) / max;
+ array[1] = ((float) (max - min)) / ((float) max);
// Calculate hue.
if (array[1] == 0)
array[0] = 0;
diff --git a/libjava/classpath/java/awt/ColorPaintContext.java b/libjava/classpath/java/awt/ColorPaintContext.java
index 759ba9d8734..82a78f63fb5 100644
--- a/libjava/classpath/java/awt/ColorPaintContext.java
+++ b/libjava/classpath/java/awt/ColorPaintContext.java
@@ -63,7 +63,7 @@ class ColorPaintContext implements PaintContext
/**
* Create the context for a given color.
*
- * @param c The solid color to use.
+ * @param colorRGB The solid color to use.
*/
ColorPaintContext(int colorRGB)
{
@@ -74,7 +74,7 @@ class ColorPaintContext implements PaintContext
* Create the context for a given color.
*
* @param cm The color model of this context.
- * @param c The solid color to use.
+ * @param colorRGB The solid color to use.
*/
ColorPaintContext(ColorModel cm,int colorRGB)
{
diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java
index 0ae1ffa7d0b..9b389e21ed4 100644
--- a/libjava/classpath/java/awt/Component.java
+++ b/libjava/classpath/java/awt/Component.java
@@ -587,6 +587,7 @@ public abstract class Component
*/
protected Component()
{
+ // Nothing to do here.
}
/**
@@ -720,8 +721,9 @@ public abstract class Component
/**
* Tests if the component is displayable. It must be connected to a native
- * screen resource, and all its ancestors must be displayable. A containment
- * hierarchy is made displayable when a window is packed or made visible.
+ * screen resource. This reduces to checking that peer is not null. A
+ * containment hierarchy is made displayable when a window is packed or
+ * made visible.
*
* @return true if the component is displayable
* @see Container#add(Component)
@@ -733,9 +735,7 @@ public abstract class Component
*/
public boolean isDisplayable()
{
- if (parent != null)
- return parent.isDisplayable();
- return false;
+ return peer != null;
}
/**
@@ -763,7 +763,7 @@ public abstract class Component
if (! visible || peer == null)
return false;
- return parent == null ? true : parent.isShowing();
+ return parent == null ? false : parent.isShowing();
}
/**
@@ -902,15 +902,16 @@ public abstract class Component
if (currentPeer != null)
currentPeer.setVisible(true);
+ // The JDK repaints the component before invalidating the parent.
+ // So do we.
+ if (isShowing())
+ repaint();
// Invalidate the parent if we have one. The component itself must
// not be invalidated. We also avoid NullPointerException with
// a local reference here.
Container currentParent = parent;
if (currentParent != null)
- {
- currentParent.invalidate();
- currentParent.repaint();
- }
+ currentParent.invalidate();
ComponentEvent ce =
new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN);
@@ -946,18 +947,19 @@ public abstract class Component
ComponentPeer currentPeer=peer;
if (currentPeer != null)
currentPeer.setVisible(false);
-
+ boolean wasShowing = isShowing();
this.visible = false;
-
+
+ // The JDK repaints the component before invalidating the parent.
+ // So do we.
+ if (wasShowing)
+ repaint();
// Invalidate the parent if we have one. The component itself must
// not be invalidated. We also avoid NullPointerException with
// a local reference here.
Container currentParent = parent;
if (currentParent != null)
- {
- currentParent.invalidate();
- currentParent.repaint();
- }
+ currentParent.invalidate();
ComponentEvent ce =
new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN);
@@ -976,7 +978,7 @@ public abstract class Component
{
if (foreground != null)
return foreground;
- return parent == null ? SystemColor.windowText : parent.getForeground();
+ return parent == null ? null : parent.getForeground();
}
/**
@@ -1075,8 +1077,9 @@ public abstract class Component
Component p = parent;
if (p != null)
return p.getFont();
- else
- return new Font("Dialog", Font.PLAIN, 12);
+ if (peer != null)
+ return peer.getGraphics().getFont();
+ return null;
}
/**
@@ -1402,17 +1405,14 @@ public abstract class Component
peer.setBounds (x, y, width, height);
// Erase old bounds and repaint new bounds for lightweights.
- if (isLightweight() && isShowing ())
+ if (isLightweight() && isShowing())
{
if (parent != null)
{
Rectangle parentBounds = parent.getBounds();
- Rectangle oldBounds = new Rectangle(parent.getX() + oldx,
- parent.getY() + oldy,
- oldwidth, oldheight);
- Rectangle newBounds = new Rectangle(parent.getX() + x,
- parent.getY() + y,
- width, height);
+ Rectangle oldBounds = new Rectangle(oldx, oldy, oldwidth,
+ oldheight);
+ Rectangle newBounds = new Rectangle(x, y, width, height);
Rectangle destroyed = oldBounds.union(newBounds);
if (!destroyed.isEmpty())
parent.repaint(0, destroyed.x, destroyed.y, destroyed.width,
@@ -1646,7 +1646,7 @@ public abstract class Component
*/
public Dimension getMaximumSize()
{
- return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
}
/**
@@ -1720,7 +1720,7 @@ public abstract class Component
valid = false;
prefSize = null;
minSize = null;
- if (parent != null && parent.valid)
+ if (parent != null && parent.isValid())
parent.invalidate();
}
@@ -1736,11 +1736,8 @@ public abstract class Component
if (peer != null)
{
Graphics gfx = peer.getGraphics();
- if (gfx != null)
- return gfx;
- // create graphics for lightweight:
- Container parent = getParent();
- if (parent != null)
+ // Create peer for lightweights.
+ if (gfx == null && parent != null)
{
gfx = parent.getGraphics();
Rectangle bounds = getBounds();
@@ -1748,6 +1745,8 @@ public abstract class Component
gfx.translate(bounds.x, bounds.y);
return gfx;
}
+ gfx.setFont(font);
+ return gfx;
}
return null;
}
@@ -1887,7 +1886,7 @@ public abstract class Component
* @see #repaint(long, int, int, int, int)
*/
public void repaint()
- {
+ {
if(!isShowing())
{
Component p = parent;
@@ -3481,7 +3480,10 @@ public abstract class Component
ComponentPeer tmp = peer;
peer = null;
if (tmp != null)
- tmp.dispose();
+ {
+ tmp.hide();
+ tmp.dispose();
+ }
}
/**
@@ -3807,13 +3809,16 @@ public abstract class Component
{
synchronized (getTreeLock ())
{
- // Find this Component's top-level ancestor.
- Container parent = getParent ();
-
+ // Find this Component's top-level ancestor.
+ Container parent = (this instanceof Container) ? (Container) this
+ : getParent();
while (parent != null
&& !(parent instanceof Window))
parent = parent.getParent ();
+ if (parent == null)
+ return;
+
Window toplevel = (Window) parent;
if (toplevel.isFocusableWindow ())
{
@@ -4241,9 +4246,9 @@ public abstract class Component
if (isDoubleBuffered())
param.append(",doublebuffered");
if (parent == null)
- param.append(",parent==null");
+ param.append(",parent=null");
else
- param.append(",parent==").append(parent.getName());
+ param.append(",parent=").append(parent.getName());
return param.toString();
}
@@ -5567,6 +5572,7 @@ p * <li>the set of backward traversal keys
*/
protected AccessibleAWTComponentHandler()
{
+ // Nothing to do here.
}
/**
@@ -5598,6 +5604,7 @@ p * <li>the set of backward traversal keys
*/
public void componentMoved(ComponentEvent e)
{
+ // Nothing to do here.
}
/**
@@ -5607,6 +5614,7 @@ p * <li>the set of backward traversal keys
*/
public void componentResized(ComponentEvent e)
{
+ // Nothing to do here.
}
} // class AccessibleAWTComponentHandler
@@ -5624,6 +5632,7 @@ p * <li>the set of backward traversal keys
*/
protected AccessibleAWTFocusHandler()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/java/awt/Container.java b/libjava/classpath/java/awt/Container.java
index 13d32f87f39..4676895bf64 100644
--- a/libjava/classpath/java/awt/Container.java
+++ b/libjava/classpath/java/awt/Container.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.awt;
+import java.awt.event.ComponentListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.KeyEvent;
@@ -394,17 +395,20 @@ public class Container extends Component
layoutMgr.addLayoutComponent(null, comp);
}
- if (isShowing ())
- {
- // Post event to notify of adding the component.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_ADDED,
- comp);
- getToolkit().getSystemEventQueue().postEvent(ce);
-
- // Repaint this container.
- repaint();
- }
+ // We previously only sent an event when this container is showing.
+ // Also, the event was posted to the event queue. A Mauve test shows
+ // that this event is not delivered using the event queue and it is
+ // also sent when the container is not showing.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_ADDED,
+ comp);
+ ContainerListener[] listeners = getContainerListeners();
+ for (int i = 0; i < listeners.length; i++)
+ listeners[i].componentAdded(ce);
+
+ // Repaint this container.
+ repaint(comp.getX(), comp.getY(), comp.getWidth(),
+ comp.getHeight());
}
}
@@ -419,6 +423,10 @@ public class Container extends Component
{
Component r = component[index];
+ ComponentListener[] list = r.getComponentListeners();
+ for (int j = 0; j < list.length; j++)
+ r.removeComponentListener(list[j]);
+
r.removeNotify();
System.arraycopy(component, index + 1, component, index,
@@ -730,7 +738,16 @@ public class Container extends Component
*/
public float getAlignmentX()
{
- return super.getAlignmentX();
+ LayoutManager layout = getLayout();
+ float alignmentX = 0.0F;
+ if (layout != null && layout instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layout;
+ alignmentX = lm2.getLayoutAlignmentX(this);
+ }
+ else
+ alignmentX = super.getAlignmentX();
+ return alignmentX;
}
/**
@@ -742,7 +759,16 @@ public class Container extends Component
*/
public float getAlignmentY()
{
- return super.getAlignmentY();
+ LayoutManager layout = getLayout();
+ float alignmentY = 0.0F;
+ if (layout != null && layout instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layout;
+ alignmentY = lm2.getLayoutAlignmentY(this);
+ }
+ else
+ alignmentY = super.getAlignmentY();
+ return alignmentY;
}
/**
@@ -1047,6 +1073,53 @@ public class Container extends Component
return this;
}
}
+
+ /**
+ * Finds the visible child component that contains the specified position.
+ * The top-most child is returned in the case where there is overlap.
+ * If the top-most child is transparent and has no MouseListeners attached,
+ * we discard it and return the next top-most component containing the
+ * specified position.
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return null if the <code>this</code> does not contain the position,
+ * otherwise the top-most component (out of this container itself and
+ * its descendants) meeting the criteria above.
+ */
+ Component findComponentForMouseEventAt(int x, int y)
+ {
+ synchronized (getTreeLock())
+ {
+ if (!contains(x, y))
+ return null;
+
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ // Ignore invisible children...
+ if (!component[i].isVisible())
+ continue;
+
+ int x2 = x - component[i].x;
+ int y2 = y - component[i].y;
+ // We don't do the contains() check right away because
+ // findComponentAt would redundantly do it first thing.
+ if (component[i] instanceof Container)
+ {
+ Container k = (Container) component[i];
+ Component r = k.findComponentForMouseEventAt(x2, y2);
+ if (r != null)
+ return r;
+ }
+ else if (component[i].contains(x2, y2))
+ return component[i];
+ }
+
+ //don't return transparent components with no MouseListeners
+ if (this.getMouseListeners().length == 0)
+ return null;
+ return this;
+ }
+ }
public Component findComponentAt(Point p)
{
@@ -1955,6 +2028,30 @@ class LightweightDispatcher implements Serializable
eventMask |= l;
}
+ /**
+ * Returns the deepest visible descendent of parent that contains the
+ * specified location and that is not transparent and MouseListener-less.
+ * @param parent the root component to begin the search
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return null if <code>parent</code> doesn't contain the location,
+ * parent if parent is not a container or has no child that contains the
+ * location, otherwise the appropriate component from the conditions
+ * above.
+ */
+ Component getDeepestComponentForMouseEventAt (
+ Component parent, int x, int y)
+ {
+ if (parent == null || (! parent.contains(x, y)))
+ return null;
+
+ if (! (parent instanceof Container))
+ return parent;
+
+ Container c = (Container) parent;
+ return c.findComponentForMouseEventAt(x, y);
+ }
+
Component acquireComponentForMouseEvent(MouseEvent me)
{
int x = me.getX ();
@@ -1968,7 +2065,7 @@ class LightweightDispatcher implements Serializable
while (candidate == null && parent != null)
{
candidate =
- AWTUtilities.getDeepestComponentAt(parent, p.x, p.y);
+ getDeepestComponentForMouseEventAt(parent, p.x, p.y);
if (candidate == null || (candidate.eventMask & me.getID()) == 0)
{
candidate = null;
@@ -2069,7 +2166,10 @@ class LightweightDispatcher implements Serializable
// Don't dispatch CLICKED events whose target is not the same as the
// target for the original PRESSED event.
if (candidate != pressedComponent)
- mouseEventTarget = null;
+ {
+ mouseEventTarget = null;
+ pressCount = 0;
+ }
else if (pressCount == 0)
pressedComponent = null;
}
@@ -2107,7 +2207,7 @@ class LightweightDispatcher implements Serializable
pressedComponent = null;
break;
}
-
+
MouseEvent newEvt =
AWTUtilities.convertMouseEvent(nativeContainer, me,
mouseEventTarget);
diff --git a/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java b/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java
index f53cc5ef04d..bce6352a900 100644
--- a/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java
+++ b/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java
@@ -146,8 +146,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
*/
private AWTKeyStroke waitForKeyStroke = null;
- /** The {@link java.util.SortedSet} of current {@link
- #EventDelayRequest}s. */
+ /** The {@link java.util.SortedSet} of current
+ * {@link EventDelayRequest}s. */
private SortedSet delayRequests = new TreeSet ();
public DefaultKeyboardFocusManager ()
diff --git a/libjava/classpath/java/awt/Dialog.java b/libjava/classpath/java/awt/Dialog.java
index d3eb975a86d..7e5e7215aac 100644
--- a/libjava/classpath/java/awt/Dialog.java
+++ b/libjava/classpath/java/awt/Dialog.java
@@ -519,6 +519,8 @@ paramString()
protected class AccessibleAWTDialog extends AccessibleAWTWindow
{
+ private static final long serialVersionUID = 4837230331833941201L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.DIALOG;
diff --git a/libjava/classpath/java/awt/EventQueue.java b/libjava/classpath/java/awt/EventQueue.java
index 15b6e1e7afd..235ad2ac17c 100644
--- a/libjava/classpath/java/awt/EventQueue.java
+++ b/libjava/classpath/java/awt/EventQueue.java
@@ -42,7 +42,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.InvocationEvent;
-import java.awt.event.WindowEvent;
import java.lang.reflect.InvocationTargetException;
import java.util.EmptyStackException;
diff --git a/libjava/classpath/java/awt/Font.java b/libjava/classpath/java/awt/Font.java
index 5de94586e2c..2e4c9f61c68 100644
--- a/libjava/classpath/java/awt/Font.java
+++ b/libjava/classpath/java/awt/Font.java
@@ -50,6 +50,7 @@ import java.awt.geom.Rectangle2D;
import java.awt.peer.FontPeer;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import java.text.AttributedCharacterIterator;
import java.text.CharacterIterator;
@@ -69,39 +70,35 @@ import java.util.StringTokenizer;
public class Font implements Serializable
{
-/*
- * Static Variables
- */
-
-/**
- * Constant indicating a "plain" font.
- */
-public static final int PLAIN = 0;
+ /**
+ * Constant indicating a "plain" font.
+ */
+ public static final int PLAIN = 0;
-/**
- * Constant indicating a "bold" font.
- */
-public static final int BOLD = 1;
+ /**
+ * Constant indicating a "bold" font.
+ */
+ public static final int BOLD = 1;
-/**
- * Constant indicating an "italic" font.
- */
-public static final int ITALIC = 2;
+ /**
+ * Constant indicating an "italic" font.
+ */
+ public static final int ITALIC = 2;
-/**
- * Constant indicating the baseline mode characteristic of Roman.
- */
-public static final int ROMAN_BASELINE = 0;
+ /**
+ * Constant indicating the baseline mode characteristic of Roman.
+ */
+ public static final int ROMAN_BASELINE = 0;
-/**
- * Constant indicating the baseline mode characteristic of Chinese.
- */
-public static final int CENTER_BASELINE = 1;
+ /**
+ * Constant indicating the baseline mode characteristic of Chinese.
+ */
+ public static final int CENTER_BASELINE = 1;
-/**
- * Constant indicating the baseline mode characteristic of Devanigri.
- */
-public static final int HANGING_BASELINE = 2;
+ /**
+ * Constant indicating the baseline mode characteristic of Devanigri.
+ */
+ public static final int HANGING_BASELINE = 2;
/**
@@ -170,1145 +167,1138 @@ public static final int HANGING_BASELINE = 2;
protected String name;
/**
- * The size of this font in pixels.
+ * The size of this font in points, rounded.
*
* @since 1.0
*/
protected int size;
/**
+ * The size of this font in points.
+ *
+ * @since 1.0
+ */
+ protected float pointSize;
+
+ /**
* The style of this font -- PLAIN, BOLD, ITALIC or BOLD+ITALIC.
*
* @since 1.0
*/
protected int style;
-// Serialization constant
-private static final long serialVersionUID = -4206021311591459213L;
+//Serialization constant
+ private static final long serialVersionUID = -4206021311591459213L;
// The ClasspathToolkit-provided peer which implements this font
- private ClasspathFontPeer peer;
-
-/*************************************************************************/
+ private transient ClasspathFontPeer peer;
-/*
- * Static Methods
- */
-/**
- * Creates a <code>Font</code> object from the specified string, which
- * is in one of the following formats:
- * <p>
- * <ul>
- * <li>fontname-style-pointsize
- * <li>fontname-style
- * <li>fontname-pointsize
- * <li>fontname
- * </ul>
- * <p>
- * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
- * style if none is specified is PLAIN. The default size if none
- * is specified is 12.
- *
- * @param fontspec a string specifying the required font (<code>null</code>
- * permitted, interpreted as 'Dialog-PLAIN-12').
- *
- * @return A font.
- */
- public static Font decode (String fontspec)
-{
- if (fontspec == null)
- fontspec = "Dialog-PLAIN-12";
- String name = null;
- int style = PLAIN;
- int size = 12;
-
- StringTokenizer st = new StringTokenizer(fontspec, "- ");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- if (name == null)
- {
- name = token;
- continue;
- }
-
- if (token.toUpperCase().equals("BOLD"))
- {
- style = BOLD;
- continue;
- }
- if (token.toUpperCase().equals("ITALIC"))
- {
- style = ITALIC;
- continue;
- }
- if (token.toUpperCase().equals("BOLDITALIC"))
- {
+ /**
+ * Creates a <code>Font</code> object from the specified string, which
+ * is in one of the following formats:
+ * <p>
+ * <ul>
+ * <li>fontname-style-pointsize
+ * <li>fontname-style
+ * <li>fontname-pointsize
+ * <li>fontname
+ * </ul>
+ * <p>
+ * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
+ * style if none is specified is PLAIN. The default size if none
+ * is specified is 12.
+ *
+ * @param fontspec a string specifying the required font (<code>null</code>
+ * permitted, interpreted as 'Dialog-PLAIN-12').
+ *
+ * @return A font.
+ */
+ public static Font decode(String fontspec)
+ {
+ if (fontspec == null)
+ fontspec = "Dialog-PLAIN-12";
+ String name = null;
+ int style = PLAIN;
+ int size = 12;
+
+ StringTokenizer st = new StringTokenizer(fontspec, "- ");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ if (name == null)
+ {
+ name = token;
+ continue;
+ }
+
+ if (token.toUpperCase().equals("BOLD"))
+ {
+ style = BOLD;
+ continue;
+ }
+ if (token.toUpperCase().equals("ITALIC"))
+ {
+ style = ITALIC;
+ continue;
+ }
+ if (token.toUpperCase().equals("BOLDITALIC"))
+ {
style = BOLD | ITALIC;
- continue;
- }
-
- int tokenval = 0;
- try
- {
- tokenval = Integer.parseInt(token);
- }
- catch(NumberFormatException e)
- {
- // Ignored.
- }
+ continue;
+ }
+
+ int tokenval = 0;
+ try
+ {
+ tokenval = Integer.parseInt(token);
+ }
+ catch (NumberFormatException e)
+ {
+ // Ignored.
+ }
if (tokenval != 0)
size = tokenval;
}
HashMap attrs = new HashMap();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
+ ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+ ClasspathFontPeer.copySizeToAttrs(size, attrs);
- return getFontFromToolkit (name, attrs);
-}
+ return getFontFromToolkit(name, attrs);
+ }
/* These methods delegate to the toolkit. */
- protected static ClasspathToolkit tk ()
+ static ClasspathToolkit tk()
{
- return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
+ return (ClasspathToolkit) Toolkit.getDefaultToolkit();
}
/* Every factory method in Font should eventually call this. */
- protected static Font getFontFromToolkit (String name, Map attribs)
+ static Font getFontFromToolkit(String name, Map attribs)
{
- return tk ().getFont (name, attribs);
+ return tk().getFont(name, attribs);
}
/* Every Font constructor should eventually call this. */
- protected static ClasspathFontPeer getPeerFromToolkit (String name, Map attrs)
+ static ClasspathFontPeer getPeerFromToolkit(String name, Map attrs)
{
- return tk ().getClasspathFontPeer (name, attrs);
+ return tk().getClasspathFontPeer(name, attrs);
}
-/*************************************************************************/
-
-/**
- * Returns a <code>Font</code> object from the passed property name.
- *
- * @param propname The name of the system property.
- * @param defval Value to use if the property is not found.
- *
- * @return The requested font, or <code>default</code> if the property
- * not exist or is malformed.
- */
- public static Font getFont (String propname, Font defval)
-{
- String propval = System.getProperty(propname);
- if (propval != null)
- return decode (propval);
+ /**
+ * Returns a <code>Font</code> object from the passed property name.
+ *
+ * @param propname The name of the system property.
+ * @param defval Value to use if the property is not found.
+ *
+ * @return The requested font, or <code>default</code> if the property
+ * not exist or is malformed.
+ */
+ public static Font getFont(String propname, Font defval)
+ {
+ String propval = System.getProperty(propname);
+ if (propval != null)
+ return decode(propval);
return defval;
-}
-
-/*************************************************************************/
-
-/**
- * Returns a <code>Font</code> object from the passed property name.
- *
- * @param propname The name of the system property.
- *
- * @return The requested font, or <code>null</code> if the property
- * not exist or is malformed.
- */
- public static Font getFont (String propname)
-{
- return getFont (propname, (Font)null);
-}
-
-/*************************************************************************/
+ }
-/*
- * Constructors
- */
+ /**
+ * Returns a <code>Font</code> object from the passed property name.
+ *
+ * @param propname The name of the system property.
+ *
+ * @return The requested font, or <code>null</code> if the property
+ * not exist or is malformed.
+ */
+ public static Font getFont(String propname)
+ {
+ return getFont(propname, (Font) null);
+ }
-/**
- * Initializes a new instance of <code>Font</code> with the specified
- * attributes.
- *
- * @param name The name of the font.
- * @param style The font style.
- * @param size The font point size.
- */
-
- public Font (String name, int style, int size)
+ /**
+ * Initializes a new instance of <code>Font</code> with the specified
+ * attributes.
+ *
+ * @param name The name of the font.
+ * @param style The font style.
+ * @param size The font point size.
+ */
+ public Font(String name, int style, int size)
{
HashMap attrs = new HashMap();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
- this.peer = getPeerFromToolkit (name, attrs);
+ ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+ ClasspathFontPeer.copySizeToAttrs(size, attrs);
+ this.peer = getPeerFromToolkit(name, attrs);
+ this.size = size;
+ this.pointSize = (float) size;
+ if (name != null)
+ this.name = name;
+ else
+ this.name = peer.getName(this);
}
- public Font (Map attrs)
+ public Font(Map attrs)
{
this(null, attrs);
}
/* This extra constructor is here to permit ClasspathToolkit and to
- build a font with a "logical name" as well as attrs.
- ClasspathToolkit.getFont(String,Map) uses reflection to call this
- package-private constructor. */
- Font (String name, Map attrs)
+ build a font with a "logical name" as well as attrs.
+ ClasspathToolkit.getFont(String,Map) uses reflection to call this
+ package-private constructor. */
+ Font(String name, Map attrs)
{
// If attrs is null, setting it to an empty HashMap will give this
// Font default attributes.
if (attrs == null)
attrs = new HashMap();
- this.peer = getPeerFromToolkit (name, attrs);
+ peer = getPeerFromToolkit(name, attrs);
+ size = (int) peer.getSize(this);
+ pointSize = peer.getSize(this);
+ if (name != null)
+ this.name = name;
+ else
+ this.name = peer.getName(this);
}
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
+ /**
* Returns the logical name of the font. A logical name is the name the
* font was constructed with. It may be the name of a logical font (one
* of 6 required names in all java environments) or it may be a face
* name.
- *
- * @return The logical name of the font.
- *
- * @see #getFamily()
- * @see #getFontName()
- */
+ *
+ * @return The logical name of the font.
+ *
+ * @see #getFamily()
+ * @see #getFontName()
+ */
public String getName ()
-{
- return peer.getName (this);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the style of the font.
- *
- * @return The font style.
- */
- public int getSize ()
-{
- return (int) peer.getSize (this);
-}
-
- public float getSize2D ()
-{
- return peer.getSize (this);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this is a plain font. This will be true if
- * and only if neither the bold nor the italics style is set.
- *
- * @return <code>true</code> if this is a plain font, <code>false</code>
- * otherwise.
- */
- public boolean isPlain ()
-{
- return peer.isPlain (this);
-}
+ {
+ return peer.getName(this);
+ }
-/*************************************************************************/
+ /**
+ * Returns the size of the font, in typographics points (1/72 of an inch),
+ * rounded to an integer.
+ *
+ * @return The font size
+ */
+ public int getSize()
+ {
+ return size;
+ }
-/**
- * Tests whether or not this font is bold.
- *
- * @return <code>true</code> if this font is bold, <code>false</code>
- * otherwise.
- */
- public boolean isBold ()
-{
- return peer.isBold (this);
-}
+ /**
+ * Returns the size of the font, in typographics points (1/72 of an inch).
+ *
+ * @return The font size
+ */
+ public float getSize2D()
+ {
+ return pointSize;
+ }
-/*************************************************************************/
+ /**
+ * Tests whether or not this is a plain font. This will be true if
+ * and only if neither the bold nor the italics style is set.
+ *
+ * @return <code>true</code> if this is a plain font, <code>false</code>
+ * otherwise.
+ */
+ public boolean isPlain()
+ {
+ return peer.isPlain(this);
+ }
-/**
- * Tests whether or not this font is italic.
- *
- * @return <code>true</code> if this font is italic, <code>false</code>
- * otherwise.
- */
- public boolean isItalic ()
-{
- return peer.isItalic (this);
-}
+ /**
+ * Tests whether or not this font is bold.
+ *
+ * @return <code>true</code> if this font is bold, <code>false</code>
+ * otherwise.
+ */
+ public boolean isBold()
+ {
+ return peer.isBold(this);
+ }
-/*************************************************************************/
+ /**
+ * Tests whether or not this font is italic.
+ *
+ * @return <code>true</code> if this font is italic, <code>false</code>
+ * otherwise.
+ */
+ public boolean isItalic()
+ {
+ return peer.isItalic(this);
+ }
-/**
+ /**
* Returns the family name of this font. A family name describes a design
* or "brand name" (such as Helvetica or Palatino). It is less specific
* than a font face name (such as Helvetica Bold).
- *
- * @return A string containing the font family name.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFontName()
- * @see GraphicsEnvironment#getAvailableFontFamilyNames()
- */
- public String getFamily ()
-{
- return peer.getFamily (this);
-}
+ *
+ * @return A string containing the font family name.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFontName()
+ * @see GraphicsEnvironment#getAvailableFontFamilyNames()
+ */
+ public String getFamily()
+ {
+ return peer.getFamily(this);
+ }
-/**
- * Returns integer code representing the sum of style flags of this font, a
- * combination of either {@link #PLAIN}, {@link #BOLD}, or {@link #ITALIC}.
- *
- * @return code representing the style of this font.
- *
- * @see #isPlain()
- * @see #isBold()
- * @see #isItalic()
- */
- public int getStyle ()
-{
- return peer.getStyle (this);
-}
+ /**
+ * Returns integer code representing the sum of style flags of this font, a
+ * combination of either {@link #PLAIN}, {@link #BOLD}, or {@link #ITALIC}.
+ *
+ * @return code representing the style of this font.
+ *
+ * @see #isPlain()
+ * @see #isBold()
+ * @see #isItalic()
+ */
+ public int getStyle()
+ {
+ return peer.getStyle(this);
+ }
-/**
- * Checks if specified character maps to a glyph in this font.
- *
- * @param c The character to check.
- *
- * @return Whether the character has a corresponding glyph in this font.
- *
- * @since 1.2
- */
- public boolean canDisplay (char c)
-{
- return peer.canDisplay (this, c);
-}
+ /**
+ * Checks if specified character maps to a glyph in this font.
+ *
+ * @param c The character to check.
+ *
+ * @return Whether the character has a corresponding glyph in this font.
+ *
+ * @since 1.2
+ */
+ public boolean canDisplay(char c)
+ {
+ return peer.canDisplay(this, c);
+ }
-/**
- * Checks how much of a given string can be mapped to glyphs in
- * this font.
- *
- * @param s The string to check.
- *
- * @return The index of the first character in <code>s</code> which cannot
- * be converted to a glyph by this font, or <code>-1</code> if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- */
- public int canDisplayUpTo (String s)
-{
- return peer.canDisplayUpTo (this, new StringCharacterIterator (s),
- 0, s.length () - 1);
-}
+ /**
+ * Checks how much of a given string can be mapped to glyphs in
+ * this font.
+ *
+ * @param s The string to check.
+ *
+ * @return The index of the first character in <code>s</code> which cannot
+ * be converted to a glyph by this font, or <code>-1</code> if all
+ * characters can be mapped to glyphs.
+ *
+ * @since 1.2
+ */
+ public int canDisplayUpTo(String s)
+ {
+ return peer.canDisplayUpTo(this, new StringCharacterIterator(s),
+ 0, s.length() - 1);
+ }
-/**
- * Checks how much of a given sequence of text can be mapped to glyphs in
- * this font.
- *
- * @param text Array containing the text to check.
- * @param start Position of first character to check in <code>text</code>.
- * @param limit Position of last character to check in <code>text</code>.
- *
- * @return The index of the first character in the indicated range which
- * cannot be converted to a glyph by this font, or <code>-1</code> if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- *
- * @throws IndexOutOfBoundsException if the range [start, limit] is
- * invalid in <code>text</code>.
- */
+ /**
+ * Checks how much of a given sequence of text can be mapped to glyphs in
+ * this font.
+ *
+ * @param text Array containing the text to check.
+ * @param start Position of first character to check in <code>text</code>.
+ * @param limit Position of last character to check in <code>text</code>.
+ *
+ * @return The index of the first character in the indicated range which
+ * cannot be converted to a glyph by this font, or <code>-1</code> if all
+ * characters can be mapped to glyphs.
+ *
+ * @since 1.2
+ *
+ * @throws IndexOutOfBoundsException if the range [start, limit] is
+ * invalid in <code>text</code>.
+ */
public int canDisplayUpTo (char[] text, int start, int limit)
-{
- return peer.canDisplayUpTo
- (this, new StringCharacterIterator (new String (text)), start, limit);
-}
+ {
+ return peer.canDisplayUpTo(this,
+ new StringCharacterIterator(new String (text)),
+ start, limit);
+ }
-/**
- * Checks how much of a given sequence of text can be mapped to glyphs in
- * this font.
- *
- * @param i Iterator over the text to check.
- * @param start Position of first character to check in <code>i</code>.
- * @param limit Position of last character to check in <code>i</code>.
- *
- * @return The index of the first character in the indicated range which
- * cannot be converted to a glyph by this font, or <code>-1</code> if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- *
- * @throws IndexOutOfBoundsException if the range [start, limit] is
- * invalid in <code>i</code>.
- */
- public int canDisplayUpTo (CharacterIterator i, int start, int limit)
-{
- return peer.canDisplayUpTo (this, i, start, limit);
-}
+ /**
+ * Checks how much of a given sequence of text can be mapped to glyphs in
+ * this font.
+ *
+ * @param i Iterator over the text to check.
+ * @param start Position of first character to check in <code>i</code>.
+ * @param limit Position of last character to check in <code>i</code>.
+ *
+ * @return The index of the first character in the indicated range which
+ * cannot be converted to a glyph by this font, or <code>-1</code> if all
+ * characters can be mapped to glyphs.
+ *
+ * @since 1.2
+ *
+ * @throws IndexOutOfBoundsException if the range [start, limit] is
+ * invalid in <code>i</code>.
+ */
+ public int canDisplayUpTo(CharacterIterator i, int start, int limit)
+ {
+ return peer.canDisplayUpTo(this, i, start, limit);
+ }
-/**
- * Creates a new font with point size 1 and {@link #PLAIN} style,
- * reading font data from the provided input stream. The resulting font
- * can have further fonts derived from it using its
- * <code>deriveFont</code> method.
- *
- * @param fontFormat Integer code indicating the format the font data is
- * in.Currently this can only be {@link #TRUETYPE_FONT}.
- * @param is {@link InputStream} from which font data will be read. This
- * stream is not closed after font data is extracted.
- *
- * @return A new {@link Font} of the format indicated.
- *
- * @throws IllegalArgumentException if <code>fontType</code> is not
- * recognized.
- * @throws FontFormatException if data in InputStream is not of format
- * indicated.
- * @throws IOException if insufficient data is present on InputStream.
- *
- * @since 1.3
- */
- public static Font createFont (int fontFormat, InputStream is)
- throws FontFormatException, IOException
-{
- return tk().createFont (fontFormat, is);
-}
+ /**
+ * Creates a new font with point size 1 and {@link #PLAIN} style,
+ * reading font data from the provided input stream. The resulting font
+ * can have further fonts derived from it using its
+ * <code>deriveFont</code> method.
+ *
+ * @param fontFormat Integer code indicating the format the font data is
+ * in.Currently this can only be {@link #TRUETYPE_FONT}.
+ * @param is {@link InputStream} from which font data will be read. This
+ * stream is not closed after font data is extracted.
+ *
+ * @return A new {@link Font} of the format indicated.
+ *
+ * @throws IllegalArgumentException if <code>fontType</code> is not
+ * recognized.
+ * @throws FontFormatException if data in InputStream is not of format
+ * indicated.
+ * @throws IOException if insufficient data is present on InputStream.
+ *
+ * @since 1.3
+ */
+ public static Font createFont (int fontFormat, InputStream is)
+ throws FontFormatException, IOException
+ {
+ return tk().createFont(fontFormat, is);
+ }
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param str The string to convert to Glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, String str)
-{
- return peer.createGlyphVector (this, ctx, new StringCharacterIterator (str));
-}
+ /**
+ * Maps characters to glyphs in a one-to-one relationship, returning a new
+ * {@link GlyphVector} with a mapped glyph for each input character. This
+ * sort of mapping is often sufficient for some scripts such as Roman, but
+ * is inappropriate for scripts with special shaping or contextual layout
+ * requirements such as Arabic, Indic, Hebrew or Thai.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param str The string to convert to Glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx, String str)
+ {
+ return peer.createGlyphVector(this, ctx, new StringCharacterIterator(str));
+ }
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param i Iterator over the text to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i)
-{
- return peer.createGlyphVector (this, ctx, i);
-}
+ /**
+ * Maps characters to glyphs in a one-to-one relationship, returning a new
+ * {@link GlyphVector} with a mapped glyph for each input character. This
+ * sort of mapping is often sufficient for some scripts such as Roman, but
+ * is inappropriate for scripts with special shaping or contextual layout
+ * requirements such as Arabic, Indic, Hebrew or Thai.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param i Iterator over the text to convert to glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx,
+ CharacterIterator i)
+ {
+ return peer.createGlyphVector(this, ctx, i);
+ }
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param chars Array of characters to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars)
-{
- return peer.createGlyphVector
- (this, ctx, new StringCharacterIterator (new String (chars)));
-}
+ /**
+ * Maps characters to glyphs in a one-to-one relationship, returning a new
+ * {@link GlyphVector} with a mapped glyph for each input character. This
+ * sort of mapping is often sufficient for some scripts such as Roman, but
+ * is inappropriate for scripts with special shaping or contextual layout
+ * requirements such as Arabic, Indic, Hebrew or Thai.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param chars Array of characters to convert to glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx, char[] chars)
+ {
+ return peer.createGlyphVector(this, ctx,
+ new StringCharacterIterator(new String(chars)));
+ }
-/**
- * Extracts a sequence of glyphs from a font, returning a new {@link
- * GlyphVector} with a mapped glyph for each input glyph code.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param glyphCodes Array of characters to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- *
- * @specnote This method is documented to perform character-to-glyph
- * conversions, in the Sun documentation, but its second parameter name is
- * "glyphCodes" and it is not clear to me why it would exist if its
- * purpose was to transport character codes inside integers. I assume it
- * is mis-documented in the Sun documentation.
- */
-
- public GlyphVector createGlyphVector (FontRenderContext ctx, int[] glyphCodes)
-{
- return peer.createGlyphVector (this, ctx, glyphCodes);
-}
+ /**
+ * Extracts a sequence of glyphs from a font, returning a new {@link
+ * GlyphVector} with a mapped glyph for each input glyph code.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param glyphCodes Array of characters to convert to glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ *
+ * @specnote This method is documented to perform character-to-glyph
+ * conversions, in the Sun documentation, but its second parameter name is
+ * "glyphCodes" and it is not clear to me why it would exist if its
+ * purpose was to transport character codes inside integers. I assume it
+ * is mis-documented in the Sun documentation.
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx, int[] glyphCodes)
+ {
+ return peer.createGlyphVector(this, ctx, glyphCodes);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new size and style.
- *
- * @param style The style of the newly created font.
- * @param size The size of the newly created font.
- *
- * @return A clone of the current font, with the specified size and style.
- *
- * @since 1.2
- */
- public Font deriveFont (int style, float size)
-{
- return peer.deriveFont (this, style, size);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new size and style.
+ *
+ * @param style The style of the newly created font.
+ * @param size The size of the newly created font.
+ *
+ * @return A clone of the current font, with the specified size and style.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(int style, float size)
+ {
+ return peer.deriveFont(this, style, size);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new size.
- *
- * @param size The size of the newly created font.
- *
- * @return A clone of the current font, with the specified size.
- *
- * @since 1.2
- */
- public Font deriveFont (float size)
-{
- return peer.deriveFont (this, size);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new size.
+ *
+ * @param size The size of the newly created font.
+ *
+ * @return A clone of the current font, with the specified size.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(float size)
+ {
+ return peer.deriveFont(this, size);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new style.
- *
- * @param style The style of the newly created font.
- *
- * @return A clone of the current font, with the specified style.
- *
- * @since 1.2
- */
- public Font deriveFont (int style)
-{
- return peer.deriveFont (this, style);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new style.
+ *
+ * @param style The style of the newly created font.
+ *
+ * @return A clone of the current font, with the specified style.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(int style)
+ {
+ return peer.deriveFont(this, style);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new style and subjected to a new affine transformation.
- *
- * @param style The style of the newly created font.
- * @param a The transformation to apply.
- *
- * @return A clone of the current font, with the specified style and
- * transform.
- *
- * @throws IllegalArgumentException If transformation is
- * <code>null</code>.
- *
- * @since 1.2
- */
- public Font deriveFont (int style, AffineTransform a)
-{
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new style and subjected to a new affine transformation.
+ *
+ * @param style The style of the newly created font.
+ * @param a The transformation to apply.
+ *
+ * @return A clone of the current font, with the specified style and
+ * transform.
+ *
+ * @throws IllegalArgumentException If transformation is
+ * <code>null</code>.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(int style, AffineTransform a)
+ {
if (a == null)
- throw new IllegalArgumentException ("Affine transformation is null");
+ throw new IllegalArgumentException("Affine transformation is null");
- return peer.deriveFont (this, style, a);
-}
+ return peer.deriveFont(this, style, a);
+ }
-/**
- * Produces a new {@link Font} based on the current font, subjected
- * to a new affine transformation.
- *
- * @param a The transformation to apply.
- *
- * @return A clone of the current font, with the specified transform.
- *
- * @throws IllegalArgumentException If transformation is
- * <code>null</code>.
- *
- * @since 1.2
- */
- public Font deriveFont (AffineTransform a)
-{
+ /**
+ * Produces a new {@link Font} based on the current font, subjected
+ * to a new affine transformation.
+ *
+ * @param a The transformation to apply.
+ *
+ * @return A clone of the current font, with the specified transform.
+ *
+ * @throws IllegalArgumentException If transformation is
+ * <code>null</code>.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(AffineTransform a)
+ {
if (a == null)
- throw new IllegalArgumentException ("Affine transformation is null");
+ throw new IllegalArgumentException("Affine transformation is null");
- return peer.deriveFont (this, a);
-}
+ return peer.deriveFont(this, a);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new set of attributes.
- *
- * @param attributes Attributes of the newly created font.
- *
- * @return A clone of the current font, with the specified attributes.
- *
- * @since 1.2
- */
- public Font deriveFont (Map attributes)
-{
- return peer.deriveFont (this, attributes);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new set of attributes.
+ *
+ * @param attributes Attributes of the newly created font.
+ *
+ * @return A clone of the current font, with the specified attributes.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(Map attributes)
+ {
+ return peer.deriveFont(this, attributes);
+ }
-/**
- * Returns a map of chracter attributes which this font currently has set.
- *
- * @return A map of chracter attributes which this font currently has set.
- *
- * @see #getAvailableAttributes()
- * @see java.text.AttributedCharacterIterator.Attribute
- * @see java.awt.font.TextAttribute
- */
- public Map getAttributes ()
-{
- return peer.getAttributes (this);
-}
+ /**
+ * Returns a map of chracter attributes which this font currently has set.
+ *
+ * @return A map of chracter attributes which this font currently has set.
+ *
+ * @see #getAvailableAttributes()
+ * @see java.text.AttributedCharacterIterator.Attribute
+ * @see java.awt.font.TextAttribute
+ */
+ public Map getAttributes()
+ {
+ return peer.getAttributes(this);
+ }
-/**
- * Returns an array of chracter attribute keys which this font understands.
- *
- * @return An array of chracter attribute keys which this font understands.
- *
- * @see #getAttributes()
- * @see java.text.AttributedCharacterIterator.Attribute
- * @see java.awt.font.TextAttribute
- */
+ /**
+ * Returns an array of chracter attribute keys which this font understands.
+ *
+ * @return An array of chracter attribute keys which this font understands.
+ *
+ * @see #getAttributes()
+ * @see java.text.AttributedCharacterIterator.Attribute
+ * @see java.awt.font.TextAttribute
+ */
public AttributedCharacterIterator.Attribute[] getAvailableAttributes()
-{
- return peer.getAvailableAttributes (this);
-}
+ {
+ return peer.getAvailableAttributes(this);
+ }
-/**
- * Returns a baseline code (one of {@link #ROMAN_BASELINE}, {@link
- * #CENTER_BASELINE} or {@link #HANGING_BASELINE}) indicating which baseline
- * this font will measure baseline offsets for, when presenting glyph
- * metrics for a given character.
- *
- * Baseline offsets describe the position of a glyph relative to an
- * invisible line drawn under, through the center of, or over a line of
- * rendered text, respectively. Different scripts use different baseline
- * modes, so clients should not assume all baseline offsets in a glyph
- * vector are from a common baseline.
- *
- * @param c The character code to select a baseline mode for.
- *
- * @return The baseline mode which would be used in a glyph associated
- * with the provided character.
- *
- * @since 1.2
- *
- * @see LineMetrics#getBaselineOffsets()
- */
- public byte getBaselineFor (char c)
-{
- return peer.getBaselineFor (this, c);
-}
+ /**
+ * Returns a baseline code (one of {@link #ROMAN_BASELINE}, {@link
+ * #CENTER_BASELINE} or {@link #HANGING_BASELINE}) indicating which baseline
+ * this font will measure baseline offsets for, when presenting glyph
+ * metrics for a given character.
+ *
+ * Baseline offsets describe the position of a glyph relative to an
+ * invisible line drawn under, through the center of, or over a line of
+ * rendered text, respectively. Different scripts use different baseline
+ * modes, so clients should not assume all baseline offsets in a glyph
+ * vector are from a common baseline.
+ *
+ * @param c The character code to select a baseline mode for.
+ *
+ * @return The baseline mode which would be used in a glyph associated
+ * with the provided character.
+ *
+ * @since 1.2
+ *
+ * @see LineMetrics#getBaselineOffsets()
+ */
+ public byte getBaselineFor(char c)
+ {
+ return peer.getBaselineFor(this, c);
+ }
-/**
- * Returns the family name of this font. A family name describes a
- * typographic style (such as Helvetica or Palatino). It is more specific
- * than a logical font name (such as Sans Serif) but less specific than a
- * font face name (such as Helvetica Bold).
- *
- * @param lc The locale in which to describe the name of the font family.
- *
- * @return A string containing the font family name, localized for the
- * provided locale.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFontName()
- * @see GraphicsEnvironment#getAvailableFontFamilyNames()
- * @see Locale
- */
- public String getFamily (Locale lc)
-{
- return peer.getFamily (this, lc);
-}
+ /**
+ * Returns the family name of this font. A family name describes a
+ * typographic style (such as Helvetica or Palatino). It is more specific
+ * than a logical font name (such as Sans Serif) but less specific than a
+ * font face name (such as Helvetica Bold).
+ *
+ * @param lc The locale in which to describe the name of the font family.
+ *
+ * @return A string containing the font family name, localized for the
+ * provided locale.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFontName()
+ * @see GraphicsEnvironment#getAvailableFontFamilyNames()
+ * @see Locale
+ */
+ public String getFamily(Locale lc)
+ {
+ return peer.getFamily(this, lc);
+ }
-/**
- * Returns a font appropriate for the given attribute set.
- *
- * @param attributes The attributes required for the new font.
- *
- * @return A new Font with the given attributes.
- *
- * @since 1.2
- *
- * @see java.awt.font.TextAttribute
- */
- public static Font getFont (Map attributes)
-{
- return getFontFromToolkit (null, attributes);
-}
+ /**
+ * Returns a font appropriate for the given attribute set.
+ *
+ * @param attributes The attributes required for the new font.
+ *
+ * @return A new Font with the given attributes.
+ *
+ * @since 1.2
+ *
+ * @see java.awt.font.TextAttribute
+ */
+ public static Font getFont(Map attributes)
+ {
+ return getFontFromToolkit(null, attributes);
+ }
-/**
- * Returns the font face name of the font. A font face name describes a
- * specific variant of a font family (such as Helvetica Bold). It is more
- * specific than both a font family name (such as Helvetica) and a logical
- * font name (such as Sans Serif).
- *
- * @return The font face name of the font.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFamily()
- */
- public String getFontName ()
-{
- return peer.getFontName (this);
-}
+ /**
+ * Returns the font face name of the font. A font face name describes a
+ * specific variant of a font family (such as Helvetica Bold). It is more
+ * specific than both a font family name (such as Helvetica) and a logical
+ * font name (such as Sans Serif).
+ *
+ * @return The font face name of the font.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFamily()
+ */
+ public String getFontName()
+ {
+ return peer.getFontName(this);
+ }
-/**
- * Returns the font face name of the font. A font face name describes a
- * specific variant of a font family (such as Helvetica Bold). It is more
+ /**
+ * Returns the font face name of the font. A font face name describes a
+ * specific variant of a font family (such as Helvetica Bold). It is more
* specific than both a font family name (such as Helvetica).
- *
- * @param lc The locale in which to describe the name of the font face.
- *
- * @return A string containing the font face name, localized for the
- * provided locale.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFamily()
- */
- public String getFontName (Locale lc)
-{
- return peer.getFontName (this, lc);
-}
+ *
+ * @param lc The locale in which to describe the name of the font face.
+ *
+ * @return A string containing the font face name, localized for the
+ * provided locale.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFamily()
+ */
+ public String getFontName(Locale lc)
+ {
+ return peer.getFontName(this, lc);
+ }
-/**
- * Returns the italic angle of this font, a measurement of its slant when
- * style is {@link #ITALIC}. The precise meaning is the inverse slope of a
- * caret line which "best measures" the font's italic posture.
- *
- * @return The italic angle.
- *
- * @see java.awt.font.TextAttribute#POSTURE
- */
- public float getItalicAngle ()
-{
- return peer.getItalicAngle (this);
-}
+ /**
+ * Returns the italic angle of this font, a measurement of its slant when
+ * style is {@link #ITALIC}. The precise meaning is the inverse slope of a
+ * caret line which "best measures" the font's italic posture.
+ *
+ * @return The italic angle.
+ *
+ * @see java.awt.font.TextAttribute#POSTURE
+ */
+ public float getItalicAngle()
+ {
+ return peer.getItalicAngle(this);
+ }
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param text The string to calculate metrics from.
- * @param begin Index of first character in <code>text</code> to measure.
- * @param limit Index of last character in <code>text</code> to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>text</code>.
- */
+ /**
+ * Returns a {@link LineMetrics} object constructed with the specified
+ * text and {@link FontRenderContext}.
+ *
+ * @param text The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param rc Context for calculating precise glyph placement and hints.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
public LineMetrics getLineMetrics(String text, int begin,
int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, new StringCharacterIterator (text),
- begin, limit, rc);
-}
+ {
+ return peer.getLineMetrics(this, new StringCharacterIterator(text),
+ begin, limit, rc);
+ }
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param chars The string to calculate metrics from.
- * @param begin Index of first character in <code>text</code> to measure.
- * @param limit Index of last character in <code>text</code> to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
- */
+ /**
+ * Returns a {@link LineMetrics} object constructed with the specified
+ * text and {@link FontRenderContext}.
+ *
+ * @param chars The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param rc Context for calculating precise glyph placement and hints.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>chars</code>.
+ */
public LineMetrics getLineMetrics(char[] chars, int begin,
int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, new StringCharacterIterator (new String(chars)),
- begin, limit, rc);
-}
+ {
+ return peer.getLineMetrics(this,
+ new StringCharacterIterator(new String(chars)),
+ begin, limit, rc);
+ }
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param ci The string to calculate metrics from.
- * @param begin Index of first character in <code>text</code> to measure.
- * @param limit Index of last character in <code>text</code> to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>ci</code>.
- */
- public LineMetrics getLineMetrics (CharacterIterator ci, int begin,
- int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, ci, begin, limit, rc);
-}
+ /**
+ * Returns a {@link LineMetrics} object constructed with the specified
+ * text and {@link FontRenderContext}.
+ *
+ * @param ci The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param rc Context for calculating precise glyph placement and hints.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>ci</code>.
+ */
+ public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
+ int limit, FontRenderContext rc)
+ {
+ return peer.getLineMetrics(this, ci, begin, limit, rc);
+ }
-/**
- * Returns the maximal bounding box of all the bounding boxes in this
- * font, when the font's bounding boxes are evaluated in a given {@link
- * FontRenderContext}
- *
- * @param rc Context in which to evaluate bounding boxes.
- *
- * @return The maximal bounding box.
- */
- public Rectangle2D getMaxCharBounds (FontRenderContext rc)
-{
- return peer.getMaxCharBounds (this, rc);
-}
+ /**
+ * Returns the maximal bounding box of all the bounding boxes in this
+ * font, when the font's bounding boxes are evaluated in a given {@link
+ * FontRenderContext}
+ *
+ * @param rc Context in which to evaluate bounding boxes.
+ *
+ * @return The maximal bounding box.
+ */
+ public Rectangle2D getMaxCharBounds(FontRenderContext rc)
+ {
+ return peer.getMaxCharBounds(this, rc);
+ }
-/**
- * Returns the glyph code this font uses to represent missing glyphs. This
- * code will be present in glyph vectors when the font was unable to
- * locate a glyph to represent a particular character code.
- *
- * @return The missing glyph code.
- *
- * @since 1.2
- */
- public int getMissingGlyphCode ()
-{
- return peer.getMissingGlyphCode (this);
-}
+ /**
+ * Returns the glyph code this font uses to represent missing glyphs. This
+ * code will be present in glyph vectors when the font was unable to
+ * locate a glyph to represent a particular character code.
+ *
+ * @return The missing glyph code.
+ *
+ * @since 1.2
+ */
+ public int getMissingGlyphCode()
+ {
+ return peer.getMissingGlyphCode(this);
+ }
-/**
- * Returns the overall number of glyphs in this font. This number is one
- * more than the greatest glyph code used in any glyph vectors this font
- * produces. In other words, glyph codes are taken from the range
- * <code>[ 0, getNumGlyphs() - 1 ]</code>.
- *
- * @return The number of glyphs in this font.
- *
- * @since 1.2
- */
- public int getNumGlyphs ()
-{
- return peer.getMissingGlyphCode (this);
-}
+ /**
+ * Returns the overall number of glyphs in this font. This number is one
+ * more than the greatest glyph code used in any glyph vectors this font
+ * produces. In other words, glyph codes are taken from the range
+ * <code>[ 0, getNumGlyphs() - 1 ]</code>.
+ *
+ * @return The number of glyphs in this font.
+ *
+ * @since 1.2
+ */
+ public int getNumGlyphs()
+ {
+ return peer.getMissingGlyphCode(this);
+ }
-/**
- * Returns the PostScript Name of this font.
- *
- * @return The PostScript Name of this font.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFamily()
- * @see #getFontName()
- */
- public String getPSName ()
-{
- return peer.getPostScriptName (this);
-}
+ /**
+ * Returns the PostScript Name of this font.
+ *
+ * @return The PostScript Name of this font.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFamily()
+ * @see #getFontName()
+ */
+ public String getPSName()
+ {
+ return peer.getPostScriptName(this);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param str The string to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @see #createGlyphVector(FontRenderContext, String)
- */
- public Rectangle2D getStringBounds (String str, FontRenderContext frc)
-{
- return getStringBounds (str, 0, str.length () - 1, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param str The string to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @see #createGlyphVector(FontRenderContext, String)
+ */
+ public Rectangle2D getStringBounds(String str, FontRenderContext frc)
+ {
+ return getStringBounds(str, 0, str.length() - 1, frc);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param str The string to measure.
- * @param begin Index of the first character in <code>str</code> to measure.
- * @param limit Index of the last character in <code>str</code> to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>str</code>.
- *
- * @since 1.2
- *
- * @see #createGlyphVector(FontRenderContext, String)
- */
- public Rectangle2D getStringBounds (String str, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, new StringCharacterIterator(str), begin, limit, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param str The string to measure.
+ * @param begin Index of the first character in <code>str</code> to measure.
+ * @param limit Index of the last character in <code>str</code> to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>str</code>.
+ *
+ * @since 1.2
+ *
+ * @see #createGlyphVector(FontRenderContext, String)
+ */
+ public Rectangle2D getStringBounds(String str, int begin,
+ int limit, FontRenderContext frc)
+ {
+ return peer.getStringBounds(this, new StringCharacterIterator(str), begin,
+ limit, frc);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param ci The text to measure.
- * @param begin Index of the first character in <code>ci</code> to measure.
- * @param limit Index of the last character in <code>ci</code> to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>ci</code>.
- *
- * @since 1.2
- *
- * @see #createGlyphVector(FontRenderContext, CharacterIterator)
- */
- public Rectangle2D getStringBounds (CharacterIterator ci, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, ci, begin, limit, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param ci The text to measure.
+ * @param begin Index of the first character in <code>ci</code> to measure.
+ * @param limit Index of the last character in <code>ci</code> to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>ci</code>.
+ *
+ * @since 1.2
+ *
+ * @see #createGlyphVector(FontRenderContext, CharacterIterator)
+ */
+ public Rectangle2D getStringBounds(CharacterIterator ci, int begin,
+ int limit, FontRenderContext frc)
+ {
+ return peer.getStringBounds(this, ci, begin, limit, frc);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param chars The text to measure.
- * @param begin Index of the first character in <code>ci</code> to measure.
- * @param limit Index of the last character in <code>ci</code> to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
- *
- * @since 1.2
- *
- * @see #createGlyphVector(FontRenderContext, char[])
- */
- public Rectangle2D getStringBounds (char[] chars, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, new StringCharacterIterator (new String (chars)),
- begin, limit, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param chars The text to measure.
+ * @param begin Index of the first character in <code>ci</code> to measure.
+ * @param limit Index of the last character in <code>ci</code> to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>chars</code>.
+ *
+ * @since 1.2
+ *
+ * @see #createGlyphVector(FontRenderContext, char[])
+ */
+ public Rectangle2D getStringBounds(char[] chars, int begin,
+ int limit, FontRenderContext frc)
+ {
+ return peer.getStringBounds(this,
+ new StringCharacterIterator(new String(chars)),
+ begin, limit, frc);
+ }
-/**
- * Returns a copy of the affine transformation this font is currently
- * subject to, if any.
- *
- * @return The current transformation.
- */
- public AffineTransform getTransform ()
-{
- return peer.getTransform (this);
-}
+ /**
+ * Returns a copy of the affine transformation this font is currently
+ * subject to, if any.
+ *
+ * @return The current transformation.
+ */
+ public AffineTransform getTransform()
+ {
+ return peer.getTransform(this);
+ }
-/**
- * Indicates whether this font's line metrics are uniform. A font may be
- * composed of several "subfonts", each covering a different code range,
- * and each with their own line metrics. A font with no subfonts, or
- * subfonts with identical line metrics, is said to have "uniform" line
- * metrics.
- *
- * @return Whether this font has uniform line metrics.
- *
- * @see LineMetrics
- * @see #getLineMetrics(String, FontRenderContext)
- */
- public boolean hasUniformLineMetrics ()
-{
- return peer.hasUniformLineMetrics (this);
-}
+ /**
+ * Indicates whether this font's line metrics are uniform. A font may be
+ * composed of several "subfonts", each covering a different code range,
+ * and each with their own line metrics. A font with no subfonts, or
+ * subfonts with identical line metrics, is said to have "uniform" line
+ * metrics.
+ *
+ * @return Whether this font has uniform line metrics.
+ *
+ * @see LineMetrics
+ * @see #getLineMetrics(String, FontRenderContext)
+ */
+ public boolean hasUniformLineMetrics()
+ {
+ return peer.hasUniformLineMetrics(this);
+ }
-/**
- * Indicates whether this font is subject to a non-identity affine
- * transformation.
- *
- * @return <code>true</code> iff the font has a non-identity affine
- * transformation applied to it.
- */
- public boolean isTransformed ()
-{
- return peer.isTransformed (this);
-}
+ /**
+ * Indicates whether this font is subject to a non-identity affine
+ * transformation.
+ *
+ * @return <code>true</code> iff the font has a non-identity affine
+ * transformation applied to it.
+ */
+ public boolean isTransformed()
+ {
+ return peer.isTransformed(this);
+ }
-/**
- * Produces a glyph vector representing a full layout fo the specified
- * text in this font. Full layouts may include complex shaping and
- * reordering operations, for scripts such as Arabic or Hindi.
- *
- * Bidirectional (bidi) layout is not performed in this method; text
- * should have its bidi direction specified with one of the flags {@link
- * #LAYOUT_LEFT_TO_RIGHT} or {@link #LAYOUT_RIGHT_TO_LEFT}.
- *
- * Some types of layout (notably Arabic glyph shaping) may examine context
- * characters beyond the bounds of the indicated range, in order to select
- * an appropriate shape. The flags {@link #LAYOUT_NO_START_CONTEXT} and
- * {@link #LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
- * context areas from being examined, for instance if they contain invalid
- * characters.
- *
- * @param frc Context in which to perform the layout.
- * @param chars Text to perform layout on.
- * @param start Index of first character to perform layout on.
- * @param limit Index of last character to perform layout on.
- * @param flags Combination of flags controlling layout.
- *
- * @return A new {@link GlyphVector} representing the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
- */
- public GlyphVector layoutGlyphVector (FontRenderContext frc,
- char[] chars, int start,
- int limit, int flags)
-{
- return peer.layoutGlyphVector (this, frc, chars, start, limit, flags);
-}
+ /**
+ * Produces a glyph vector representing a full layout fo the specified
+ * text in this font. Full layouts may include complex shaping and
+ * reordering operations, for scripts such as Arabic or Hindi.
+ *
+ * Bidirectional (bidi) layout is not performed in this method; text
+ * should have its bidi direction specified with one of the flags {@link
+ * #LAYOUT_LEFT_TO_RIGHT} or {@link #LAYOUT_RIGHT_TO_LEFT}.
+ *
+ * Some types of layout (notably Arabic glyph shaping) may examine context
+ * characters beyond the bounds of the indicated range, in order to select
+ * an appropriate shape. The flags {@link #LAYOUT_NO_START_CONTEXT} and
+ * {@link #LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
+ * context areas from being examined, for instance if they contain invalid
+ * characters.
+ *
+ * @param frc Context in which to perform the layout.
+ * @param chars Text to perform layout on.
+ * @param start Index of first character to perform layout on.
+ * @param limit Index of last character to perform layout on.
+ * @param flags Combination of flags controlling layout.
+ *
+ * @return A new {@link GlyphVector} representing the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>chars</code>.
+ */
+ public GlyphVector layoutGlyphVector(FontRenderContext frc,
+ char[] chars, int start,
+ int limit, int flags)
+ {
+ return peer.layoutGlyphVector(this, frc, chars, start, limit, flags);
+ }
-/**
- * Returns a native peer object for this font.
- *
- * @return A native peer object for this font.
- *
- * @deprecated
- */
- public FontPeer getPeer ()
-{
+ /**
+ * Returns a native peer object for this font.
+ *
+ * @return A native peer object for this font.
+ *
+ * @deprecated
+ */
+ public FontPeer getPeer()
+ {
return peer;
-}
+ }
-/**
- * Returns a hash value for this font.
- *
- * @return A hash for this font.
- */
+ /**
+ * Returns a hash value for this font.
+ *
+ * @return A hash for this font.
+ */
public int hashCode()
-{
+ {
return this.toString().hashCode();
-}
-
-
-/**
- * Tests whether or not the specified object is equal to this font. This
- * will be true if and only if:
- * <P>
- * <ul>
- * <li>The object is not <code>null</code>.
- * <li>The object is an instance of <code>Font</code>.
- * <li>The object has the same names, style, size, and transform as this object.
- * </ul>
- *
- * @return <code>true</code> if the specified object is equal to this
- * object, <code>false</code> otherwise.
- */
-public boolean
-equals(Object obj)
-{
- if (obj == null)
- return(false);
+ }
- if (!(obj instanceof Font))
- return(false);
- Font f = (Font)obj;
+ /**
+ * Tests whether or not the specified object is equal to this font. This
+ * will be true if and only if:
+ * <P>
+ * <ul>
+ * <li>The object is not <code>null</code>.
+ * <li>The object is an instance of <code>Font</code>.
+ * <li>The object has the same names, style, size, and transform as this object.
+ * </ul>
+ *
+ * @return <code>true</code> if the specified object is equal to this
+ * object, <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ return false;
- return (f.getName ().equals (this.getName ()) &&
- f.getFamily ().equals (this.getFamily ()) &&
- f.getFontName ().equals (this.getFontName ()) &&
- f.getTransform ().equals (this.getTransform ()) &&
- f.getSize() == this.getSize() &&
- f.getStyle() == this.getStyle());
-}
+ if (! (obj instanceof Font))
+ return false;
-/*************************************************************************/
+ Font f = (Font) obj;
-/**
- * Returns a string representation of this font.
- *
- * @return A string representation of this font.
- */
-public String
-toString()
-{
- String styleString = "";
-
- switch (getStyle ())
- {
- case 0:
- styleString = "plain";
- break;
- case 1:
- styleString = "bold";
- break;
- case 2:
- styleString = "italic";
- break;
- default:
- styleString = "unknown";
- }
+ return (f.getName().equals(this.getName())
+ && f.getFamily().equals(this.getFamily())
+ && f.getFontName().equals(this.getFontName())
+ && f.getTransform().equals(this.getTransform ())
+ && f.getSize() == this.getSize()
+ && f.getStyle() == this.getStyle());
+ }
- return getClass ().getName ()
- + "[family=" + getFamily ()
- + ",name=" + getFontName ()
- + ",style=" + styleString
- + ",size=" + getSize () + "]";
-}
+ /**
+ * Returns a string representation of this font.
+ *
+ * @return A string representation of this font.
+ */
+ public String toString()
+ {
+ String styleString = "";
+
+ switch (getStyle())
+ {
+ case 0:
+ styleString = "plain";
+ break;
+ case 1:
+ styleString = "bold";
+ break;
+ case 2:
+ styleString = "italic";
+ break;
+ default:
+ styleString = "unknown";
+ }
+
+ return getClass().getName()
+ + "[family=" + getFamily ()
+ + ",name=" + getFontName ()
+ + ",style=" + styleString
+ + ",size=" + getSize () + "]";
+ }
/**
@@ -1331,8 +1321,22 @@ toString()
*/
public LineMetrics getLineMetrics(String str, FontRenderContext frc)
{
- return getLineMetrics (str, 0, str.length () - 1, frc);
+ return getLineMetrics(str, 0, str.length() - 1, frc);
}
-} // class Font
+ /**
+ * Reads the normal fields from the stream and then constructs the
+ * peer from the style and size through getPeerFromToolkit().
+ */
+ private void readObject(ObjectInputStream ois)
+ throws IOException, ClassNotFoundException
+ {
+ ois.defaultReadObject();
+
+ HashMap attrs = new HashMap();
+ ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+ ClasspathFontPeer.copySizeToAttrs(size, attrs);
+ peer = getPeerFromToolkit(name, attrs);
+ }
+}
diff --git a/libjava/classpath/java/awt/FontMetrics.java b/libjava/classpath/java/awt/FontMetrics.java
index 6dd73ec2560..91866462fee 100644
--- a/libjava/classpath/java/awt/FontMetrics.java
+++ b/libjava/classpath/java/awt/FontMetrics.java
@@ -362,6 +362,18 @@ public abstract class FontMetrics implements java.io.Serializable
rc = gRC;
return font.getLineMetrics(chars, begin, limit, rc);
}
+
+ /**
+ * Returns the bounds of the largest character in a Graphics context.
+ * @param context the Graphics context object.
+ * @return a <code>Rectangle2D</code> representing the bounds
+ */
+ public Rectangle2D getMaxCharBounds(Graphics context)
+ {
+ if( context instanceof Graphics2D )
+ return font.getMaxCharBounds(((Graphics2D)context).getFontRenderContext());
+ return font.getMaxCharBounds( gRC );
+ }
/**
* Returns a {@link LineMetrics} object constructed with the
@@ -424,4 +436,13 @@ public abstract class FontMetrics implements java.io.Serializable
return gRC;
}
+
+ /**
+ * Returns if the font has uniform line metrics.
+ * @see Font#hasUniformLineMetrics()
+ */
+ public boolean hasUniformLineMetrics()
+ {
+ return font.hasUniformLineMetrics();
+ }
}
diff --git a/libjava/classpath/java/awt/Frame.java b/libjava/classpath/java/awt/Frame.java
index 05c938496e0..d6651f83e40 100644
--- a/libjava/classpath/java/awt/Frame.java
+++ b/libjava/classpath/java/awt/Frame.java
@@ -591,6 +591,8 @@ public static Frame[] getFrames()
protected class AccessibleAWTFrame extends AccessibleAWTWindow
{
+ private static final long serialVersionUID = -6172960752956030250L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.FRAME;
diff --git a/libjava/classpath/java/awt/Graphics.java b/libjava/classpath/java/awt/Graphics.java
index ff26190e5f0..a28ca7e428c 100644
--- a/libjava/classpath/java/awt/Graphics.java
+++ b/libjava/classpath/java/awt/Graphics.java
@@ -42,726 +42,595 @@ import java.awt.image.ImageObserver;
import java.text.AttributedCharacterIterator;
/**
- * This is the abstract superclass of classes for drawing to graphics
- * devices such as the screen or printers.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public abstract class Graphics
-{
-
-/*
- * Instance Variables
- */
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Default constructor for subclasses.
- */
-protected
-Graphics()
-{
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
+ * This is the abstract superclass of classes for drawing to graphics
+ * devices such as the screen or printers.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
*/
-
-/**
- * Returns a copy of this <code>Graphics</code> object.
- *
- * @return A copy of this object.
- */
-public abstract Graphics
-create();
-
-/*************************************************************************/
-
-/**
- * Returns a copy of this <code>Graphics</code> object. The origin point
- * will be translated to the point (x, y) and the cliping rectangle set
- * to the intersection of the clipping rectangle in this object and the
- * rectangle specified by the parameters to this method.
- *
- * @param x The new X coordinate of the clipping region rect.
- * @param y The new Y coordinate of the clipping region rect.
- * @param width The width of the clipping region intersect rectangle.
- * @param height The height of the clipping region intersect rectangle.
- *
- * @return A copy of this object, modified as specified.
- */
-public Graphics
-create(int x, int y, int width, int height)
+public abstract class Graphics
{
- Graphics g = create();
-
- g.translate(x, y);
- // FIXME: I'm not sure if this will work. Are the old clip rect bounds
- // translated above?
- g.clipRect(0, 0, width, height);
- return(g);
-}
-
-/*************************************************************************/
-
-/**
- * Translates this context so that its new origin point is the point
- * (x, y).
- *
- * @param x The new X coordinate of the origin.
- * @param y The new Y coordinate of the origin.
- */
-public abstract void
-translate(int x, int y);
-
-/*************************************************************************/
-
-/**
- * Returns the current color for this object.
- *
- * @return The color for this object.
- */
-public abstract Color
-getColor();
-
-/*************************************************************************/
-
-/**
- * Sets the current color for this object.
- *
- * @param color The new color.
- */
-public abstract void
-setColor(Color color);
-
-/*************************************************************************/
-
-/**
- * Sets this context into "paint" mode, where the target pixels are
- * completely overwritten when drawn on.
- */
-public abstract void
-setPaintMode();
-
-/*************************************************************************/
-
-/**
- * Sets this context info "XOR" mode, where the targe pixles are
- * XOR-ed when drawn on.
- *
- * @param color The color to XOR against.
- */
-public abstract void
-setXORMode(Color color);
+ /**
+ * Default constructor for subclasses.
+ */
+ protected
+ Graphics()
+ {
+ }
+
+ /**
+ * Returns a copy of this <code>Graphics</code> object.
+ *
+ * @return A copy of this object.
+ */
+ public abstract Graphics create();
+
+ /**
+ * Returns a copy of this <code>Graphics</code> object. The origin point
+ * will be translated to the point (x, y) and the cliping rectangle set
+ * to the intersection of the clipping rectangle in this object and the
+ * rectangle specified by the parameters to this method.
+ *
+ * @param x The new X coordinate of the clipping region rect.
+ * @param y The new Y coordinate of the clipping region rect.
+ * @param width The width of the clipping region intersect rectangle.
+ * @param height The height of the clipping region intersect rectangle.
+ *
+ * @return A copy of this object, modified as specified.
+ */
+ public Graphics create(int x, int y, int width, int height)
+ {
+ Graphics g = create();
+
+ g.translate(x, y);
+ // FIXME: I'm not sure if this will work. Are the old clip rect bounds
+ // translated above?
+ g.clipRect(0, 0, width, height);
+
+ return(g);
+ }
+
+ /**
+ * Translates this context so that its new origin point is the point
+ * (x, y).
+ *
+ * @param x The new X coordinate of the origin.
+ * @param y The new Y coordinate of the origin.
+ */
+ public abstract void translate(int x, int y);
+
+ /**
+ * Returns the current color for this object.
+ *
+ * @return The color for this object.
+ */
+ public abstract Color getColor();
+
+ /**
+ * Sets the current color for this object.
+ *
+ * @param color The new color.
+ */
+ public abstract void setColor(Color color);
+
+ /**
+ * Sets this context into "paint" mode, where the target pixels are
+ * completely overwritten when drawn on.
+ */
+ public abstract void setPaintMode();
+
+ /**
+ * Sets this context info "XOR" mode, where the targe pixles are
+ * XOR-ed when drawn on.
+ *
+ * @param color The color to XOR against.
+ */
+ public abstract void setXORMode(Color color);
-/*************************************************************************/
-
-/**
- * Returns the current font for this graphics context.
- *
- * @return The current font.
- */
-public abstract Font
-getFont();
-
-/*************************************************************************/
-
-/**
- * Sets the font for this graphics context to the specified value.
- *
- * @param font The new font.
- */
-public abstract void
-setFont(Font font);
-
-/*************************************************************************/
-
-/**
- * Returns the font metrics for the current font.
- *
- * @return The font metrics for the current font.
- */
-public FontMetrics
-getFontMetrics()
-{
- return(getFontMetrics(getFont()));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the font metrics for the specified font.
- *
- * @param font The font to return metrics for.
- *
- * @return The requested font metrics.
- */
-public abstract FontMetrics
-getFontMetrics(Font font);
-
-/*************************************************************************/
-
-/**
- * Returns the bounding rectangle of the clipping region for this
- * graphics context.
- *
- * @return The bounding rectangle for the clipping region.
- */
-public abstract Rectangle
-getClipBounds();
-
-/*************************************************************************/
-
-/**
- * Returns the bounding rectangle of the clipping region for this
- * graphics context.
- *
- * @return The bounding rectangle for the clipping region.
- *
- * @deprecated This method is deprecated in favor of
- * <code>getClipBounds()</code>.
- */
-public Rectangle
-getClipRect()
-{
- return(getClipBounds());
-}
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the intersection of the current clipping
- * region and the rectangle determined by the specified parameters.
- *
- * @param x The X coordinate of the upper left corner of the intersect rect.
- * @param y The Y coordinate of the upper left corner of the intersect rect.
- * @param width The width of the intersect rect.
- * @param height The height of the intersect rect.
- */
-public abstract void
-clipRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the rectangle determined by the specified
- * parameters.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-setClip(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Returns the current clipping region as a <code>Shape</code> object.
- *
- * @return The clipping region as a <code>Shape</code>.
- */
-public abstract Shape
-getClip();
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the specified <code>Shape</code>.
- *
- * @param clip The new clipping region.
- */
-public abstract void
-setClip(Shape clip);
-
-/*************************************************************************/
-
-/**
- * Copies the specified rectangle to the specified offset location.
- *
- * @param x The X coordinate of the upper left corner of the copy rect.
- * @param y The Y coordinate of the upper left corner of the copy rect.
- * @param width The width of the copy rect.
- * @param height The height of the copy rect.
- * @param dx The offset from the X value to start drawing.
- * @param dy The offset from the Y value to start drawing.
- */
-public abstract void
-copyArea(int x, int y, int width, int height, int dx, int dy);
-
-/*************************************************************************/
-
-/**
- * Draws a line between the two specified points.
- *
- * @param x1 The X coordinate of the first point.
- * @param y1 The Y coordinate of the first point.
- * @param x2 The X coordinate of the second point.
- * @param y2 The Y coordinate of the second point.
- */
-public abstract void
-drawLine(int x1, int y1, int x2, int y2);
-
-/*************************************************************************/
-
-/**
- * Fills the area bounded by the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- */
-public abstract void
-fillRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws the outline of the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- */
-public void
-drawRect(int x, int y, int width, int height)
-{
- int x1 = x;
- int y1 = y;
- int x2 = x + width;
- int y2 = y + height;
- drawLine(x1, y1, x2, y1);
- drawLine(x2, y1, x2, y2);
- drawLine(x2, y2, x1, y2);
- drawLine(x1, y2, x1, y1);
-}
-
-/*************************************************************************/
-
-/**
- * Clears the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the clear rect.
- * @param y The Y coordinate of the upper left corner of the clear rect.
- * @param width The width of the clear rect.
- * @param height The height of the clear rect.
- */
-public abstract void
-clearRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws the outline of the specified rectangle with rounded cornders.
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- * @param arcWidth The width of the corner arcs.
- * @param arcHeight The height of the corner arcs.
- */
-public abstract void
-drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
-/*************************************************************************/
-
-/**
- * Fills the specified rectangle with rounded cornders.
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- * @param arcWidth The width of the corner arcs.
- * @param arcHeight The height of the corner arcs.
- */
-public abstract void
-fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
-/*************************************************************************/
-
-public void
-draw3DRect(int x, int y, int width, int height, boolean raised)
-{
- Color color = getColor();
- Color tl = color.brighter();
- Color br = color.darker();
+ /**
+ * Returns the current font for this graphics context.
+ *
+ * @return The current font.
+ */
+ public abstract Font getFont();
+
+ /**
+ * Sets the font for this graphics context to the specified value.
+ *
+ * @param font The new font.
+ */
+ public abstract void setFont(Font font);
+
+ /**
+ * Returns the font metrics for the current font.
+ *
+ * @return The font metrics for the current font.
+ */
+ public FontMetrics getFontMetrics()
+ {
+ return getFontMetrics(getFont());
+ }
+
+ /**
+ * Returns the font metrics for the specified font.
+ *
+ * @param font The font to return metrics for.
+ *
+ * @return The requested font metrics.
+ */
+ public abstract FontMetrics getFontMetrics(Font font);
+
+ /**
+ * Returns the bounding rectangle of the clipping region for this
+ * graphics context.
+ *
+ * @return The bounding rectangle for the clipping region.
+ */
+ public abstract Rectangle getClipBounds();
+
+ /**
+ * Returns the bounding rectangle of the clipping region for this
+ * graphics context.
+ *
+ * @return The bounding rectangle for the clipping region.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getClipBounds()</code>.
+ */
+ public Rectangle getClipRect()
+ {
+ return getClipBounds();
+ }
+
+ /**
+ * Sets the clipping region to the intersection of the current clipping
+ * region and the rectangle determined by the specified parameters.
+ *
+ * @param x The X coordinate of the upper left corner of the intersect rect.
+ * @param y The Y coordinate of the upper left corner of the intersect rect.
+ * @param width The width of the intersect rect.
+ * @param height The height of the intersect rect.
+ */
+ public abstract void clipRect(int x, int y, int width, int height);
+
+ /**
+ * Sets the clipping region to the rectangle determined by the specified
+ * parameters.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+ public abstract void setClip(int x, int y, int width, int height);
+
+ /**
+ * Returns the current clipping region as a <code>Shape</code> object.
+ *
+ * @return The clipping region as a <code>Shape</code>.
+ */
+ public abstract Shape getClip();
+
+ /**
+ * Sets the clipping region to the specified <code>Shape</code>.
+ *
+ * @param clip The new clipping region.
+ */
+ public abstract void setClip(Shape clip);
+
+ /**
+ * Copies the specified rectangle to the specified offset location.
+ *
+ * @param x The X coordinate of the upper left corner of the copy rect.
+ * @param y The Y coordinate of the upper left corner of the copy rect.
+ * @param width The width of the copy rect.
+ * @param height The height of the copy rect.
+ * @param dx The offset from the X value to start drawing.
+ * @param dy The offset from the Y value to start drawing.
+ */
+ public abstract void copyArea(int x, int y, int width, int height, int dx,
+ int dy);
+
+ /**
+ * Draws a line between the two specified points.
+ *
+ * @param x1 The X coordinate of the first point.
+ * @param y1 The Y coordinate of the first point.
+ * @param x2 The X coordinate of the second point.
+ * @param y2 The Y coordinate of the second point.
+ */
+ public abstract void drawLine(int x1, int y1, int x2, int y2);
+
+ /**
+ * Fills the area bounded by the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the fill rect.
+ * @param y The Y coordinate of the upper left corner of the fill rect.
+ * @param width The width of the fill rect.
+ * @param height The height of the fill rect.
+ */
+ public abstract void fillRect(int x, int y, int width, int height);
+
+ /**
+ * Draws the outline of the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the draw rect.
+ * @param y The Y coordinate of the upper left corner of the draw rect.
+ * @param width The width of the draw rect.
+ * @param height The height of the draw rect.
+ */
+ public void drawRect(int x, int y, int width, int height)
+ {
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + width;
+ int y2 = y + height;
+ drawLine(x1, y1, x2, y1);
+ drawLine(x2, y1, x2, y2);
+ drawLine(x2, y2, x1, y2);
+ drawLine(x1, y2, x1, y1);
+ }
+
+ /**
+ * Clears the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the clear rect.
+ * @param y The Y coordinate of the upper left corner of the clear rect.
+ * @param width The width of the clear rect.
+ * @param height The height of the clear rect.
+ */
+ public abstract void clearRect(int x, int y, int width, int height);
+
+ /**
+ * Draws the outline of the specified rectangle with rounded cornders.
+ *
+ * @param x The X coordinate of the upper left corner of the draw rect.
+ * @param y The Y coordinate of the upper left corner of the draw rect.
+ * @param width The width of the draw rect.
+ * @param height The height of the draw rect.
+ * @param arcWidth The width of the corner arcs.
+ * @param arcHeight The height of the corner arcs.
+ */
+ public abstract void drawRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight);
+
+ /**
+ * Fills the specified rectangle with rounded cornders.
+ *
+ * @param x The X coordinate of the upper left corner of the fill rect.
+ * @param y The Y coordinate of the upper left corner of the fill rect.
+ * @param width The width of the fill rect.
+ * @param height The height of the fill rect.
+ * @param arcWidth The width of the corner arcs.
+ * @param arcHeight The height of the corner arcs.
+ */
+ public abstract void fillRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight);
+
+ public void draw3DRect(int x, int y, int width, int height, boolean raised)
+ {
+ Color color = getColor();
+ Color tl = color.brighter();
+ Color br = color.darker();
- if (!raised)
- {
- Color tmp = tl;
- tl = br;
- br = tmp;
- }
+ if (!raised)
+ {
+ Color tmp = tl;
+ tl = br;
+ br = tmp;
+ }
- int x1 = x;
- int y1 = y;
- int x2 = x + width;
- int y2 = y + height;
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + width;
+ int y2 = y + height;
- setColor(tl);
- drawLine(x1, y1, x2, y1);
- drawLine(x1, y2, x1, y1);
- setColor(br);
- drawLine(x2, y1, x2, y2);
- drawLine(x2, y2, x1, y2);
- setColor(color);
-}
-
-/**
- * Fills the specified rectangle with a 3D effect
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- * @param raised <code>true</code> if the rectangle appears raised,
- * <code>false</code> if it should appear etched.
- */
-public void
-fill3DRect(int x, int y, int width, int height, boolean raised)
-{
- fillRect(x, y, width, height);
- draw3DRect(x, y, width-1, height-1, raised);
-}
-
-/*************************************************************************/
-
-/**
- * Draws an oval that just fits within the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-drawOval(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Fills an oval that just fits within the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-fillOval(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws an arc using the specified bounding rectangle and the specified
- * angle parameter. The arc is centered at the center of the rectangle.
- * The arc starts at the arcAngle position and extend for arcAngle
- * degrees. The degree origin is at the 3 o'clock position.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- * @param arcStart The beginning angle of the arc.
- * @param arcAngle The extent of the arc.
- */
-public abstract void
-drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
-
-/*************************************************************************/
-
-/**
- * Fills the arc define by the specified bounding rectangle and the specified
- * angle parameter. The arc is centered at the center of the rectangle.
- * The arc starts at the arcAngle position and extend for arcAngle
- * degrees. The degree origin is at the 3 o'clock position.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- * @param arcStart The beginning angle of the arc.
- * @param arcAngle The extent of the arc.
- */
-public abstract void
-fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
-
-/*************************************************************************/
-
-/**
- * Draws a series of interconnected lines determined by the arrays
- * of corresponding x and y coordinates.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-drawPolyline(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Draws a series of interconnected lines determined by the arrays
- * of corresponding x and y coordinates. The figure is closed if necessary
- * by connecting the first and last points.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-drawPolygon(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Draws the specified polygon.
- *
- * @param polygon The polygon to draw.
- */
-public void
-drawPolygon(Polygon polygon)
-{
- drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
-}
-
-/*************************************************************************/
-
-/**
- * Fills the polygon determined by the arrays
- * of corresponding x and y coordinates.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-fillPolygon(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Fills the specified polygon
- *
- * @param polygon The polygon to fill.
- */
-public void
-fillPolygon(Polygon polygon)
-{
- fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
-}
-
-/*************************************************************************/
-
-/**
- * Draws the specified string starting at the specified point.
- *
- * @param string The string to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public abstract void
-drawString(String string, int x, int y);
-
-public abstract void drawString (AttributedCharacterIterator ci, int x, int y);
-
-/*************************************************************************/
-
-/**
- * Draws the specified characters starting at the specified point.
- *
- * @param data The array of characters to draw.
- * @param offset The offset into the array to start drawing characters from.
- * @param length The number of characters to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public void
-drawChars(char data[], int offset, int length, int x, int y)
-{
- drawString(new String(data, offset, length), x, y);
-}
-
-public void
-drawBytes(byte[] data, int offset, int length, int x, int y)
-{
- String str = new String(data, offset, length);
- drawString(str, x, y);
-}
-
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, ImageObserver observer);
+ setColor(tl);
+ drawLine(x1, y1, x2, y1);
+ drawLine(x1, y2, x1, y1);
+ setColor(br);
+ drawLine(x2, y1, x2, y2);
+ drawLine(x2, y2, x1, y2);
+ setColor(color);
+ }
+
+ /**
+ * Fills the specified rectangle with a 3D effect
+ *
+ * @param x The X coordinate of the upper left corner of the fill rect.
+ * @param y The Y coordinate of the upper left corner of the fill rect.
+ * @param width The width of the fill rect.
+ * @param height The height of the fill rect.
+ * @param raised <code>true</code> if the rectangle appears raised,
+ * <code>false</code> if it should appear etched.
+ */
+ public void fill3DRect(int x, int y, int width, int height, boolean raised)
+ {
+ fillRect(x, y, width, height);
+ draw3DRect(x, y, width-1, height-1, raised);
+ }
+
+ /**
+ * Draws an oval that just fits within the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+ public abstract void drawOval(int x, int y, int width, int height);
+
+ /**
+ * Fills an oval that just fits within the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+ public abstract void fillOval(int x, int y, int width, int height);
+
+ /**
+ * Draws an arc using the specified bounding rectangle and the specified
+ * angle parameter. The arc is centered at the center of the rectangle.
+ * The arc starts at the arcAngle position and extend for arcAngle
+ * degrees. The degree origin is at the 3 o'clock position.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ * @param arcStart The beginning angle of the arc.
+ * @param arcAngle The extent of the arc.
+ */
+ public abstract void drawArc(int x, int y, int width, int height,
+ int arcStart, int arcAngle);
+
+ /**
+ * Fills the arc define by the specified bounding rectangle and the specified
+ * angle parameter. The arc is centered at the center of the rectangle.
+ * The arc starts at the arcAngle position and extend for arcAngle
+ * degrees. The degree origin is at the 3 o'clock position.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ * @param arcStart The beginning angle of the arc.
+ * @param arcAngle The extent of the arc.
+ */
+ public abstract void fillArc(int x, int y, int width, int height,
+ int arcStart, int arcAngle);
+
+ /**
+ * Draws a series of interconnected lines determined by the arrays
+ * of corresponding x and y coordinates.
+ *
+ * @param xPoints The X coordinate array.
+ * @param yPoints The Y coordinate array.
+ * @param npoints The number of points to draw.
+ */
+ public abstract void drawPolyline(int xPoints[], int yPoints[], int npoints);
+
+ /**
+ * Draws a series of interconnected lines determined by the arrays
+ * of corresponding x and y coordinates. The figure is closed if necessary
+ * by connecting the first and last points.
+ *
+ * @param xPoints The X coordinate array.
+ * @param yPoints The Y coordinate array.
+ * @param npoints The number of points to draw.
+ */
+ public abstract void drawPolygon(int xPoints[], int yPoints[], int npoints);
+
+ /**
+ * Draws the specified polygon.
+ *
+ * @param polygon The polygon to draw.
+ */
+ public void drawPolygon(Polygon polygon)
+ {
+ drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
+ }
+
+ /**
+ * Fills the polygon determined by the arrays
+ * of corresponding x and y coordinates.
+ *
+ * @param xPoints The X coordinate array.
+ * @param yPoints The Y coordinate array.
+ * @param npoints The number of points to draw.
+ */
+ public abstract void fillPolygon(int xPoints[], int yPoints[], int npoints);
+
+ /**
+ * Fills the specified polygon
+ *
+ * @param polygon The polygon to fill.
+ */
+ public void fillPolygon(Polygon polygon)
+ {
+ fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
+ }
+
+ /**
+ * Draws the specified string starting at the specified point.
+ *
+ * @param string The string to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ */
+ public abstract void drawString(String string, int x, int y);
+
+ public abstract void drawString (AttributedCharacterIterator ci, int x,
+ int y);
+
+ /**
+ * Draws the specified characters starting at the specified point.
+ *
+ * @param data The array of characters to draw.
+ * @param offset The offset into the array to start drawing characters from.
+ * @param length The number of characters to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ */
+ public void drawChars(char data[], int offset, int length, int x, int y)
+ {
+ drawString(new String(data, offset, length), x, y);
+ }
+
+ public void drawBytes(byte[] data, int offset, int length, int x, int y)
+ {
+ String str = new String(data, offset, length);
+ drawString(str, x, y);
+ }
+
+ /**
+ * Draws all of the image that is available and returns. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y,
+ ImageObserver observer);
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. The image
- * is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param width The width of the rectangle to draw in.
- * @param height The height of the rectangle to draw in.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, int width, int height,
- ImageObserver observer);
+ /**
+ * Draws all of the image that is available and returns. The image
+ * is scaled to fit in the specified rectangle. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param width The width of the rectangle to draw in.
+ * @param height The height of the rectangle to draw in.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y, int width,
+ int height, ImageObserver observer);
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param bgcolor The background color to use for the image.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, Color bgcolor, ImageObserver observer);
+ /**
+ * Draws all of the image that is available and returns. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param bgcolor The background color to use for the image.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y, Color bgcolor,
+ ImageObserver observer);
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. The image
- * is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param width The width of the rectangle to draw in.
- * @param height The height of the rectangle to draw in.
- * @param bgcolor The background color to use for the image.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, int width, int height, Color bgcolor,
- ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * FIXME: Write Javadocs for this when you understand it.
- */
-public abstract boolean
-drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
- int sx2, int sy2, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * FIXME: Write Javadocs for this when you understand it.
- */
-public abstract boolean
-drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
- int sx2, int sy2, Color bgcolor, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * Free any resources held by this graphics context immediately instead
- * of waiting for the object to be garbage collected and finalized.
- */
-public abstract void
-dispose();
-
-/*************************************************************************/
-
-/**
- * Frees the resources held by this graphics context when it is
- * garbage collected.
- */
-public void
-finalize()
-{
- dispose();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this object.
- *
- * @return A string representation of this object.
- */
-public String
-toString()
-{
- return getClass ().getName () + "[font=" + getFont () + ",color=" + getColor () + "]";
-}
-
-public boolean
-hitClip(int x, int y, int width, int height)
-{
- throw new UnsupportedOperationException("not implemented yet");
-}
-
-public Rectangle
-getClipBounds(Rectangle r)
-{
- Rectangle clipBounds = getClipBounds();
+ /**
+ * Draws all of the image that is available and returns. The image
+ * is scaled to fit in the specified rectangle. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param width The width of the rectangle to draw in.
+ * @param height The height of the rectangle to draw in.
+ * @param bgcolor The background color to use for the image.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y, int width,
+ int height, Color bgcolor,
+ ImageObserver observer);
+
+ /**
+ * FIXME: Write Javadocs for this when you understand it.
+ */
+ public abstract boolean drawImage(Image image, int dx1, int dy1, int dx2,
+ int dy2, int sx1, int sy1, int sx2,
+ int sy2, ImageObserver observer);
+
+ /**
+ * FIXME: Write Javadocs for this when you understand it.
+ */
+ public abstract boolean drawImage(Image image, int dx1, int dy1, int dx2,
+ int dy2, int sx1, int sy1, int sx2,
+ int sy2, Color bgcolor,
+ ImageObserver observer);
+
+ /**
+ * Free any resources held by this graphics context immediately instead
+ * of waiting for the object to be garbage collected and finalized.
+ */
+ public abstract void dispose();
+
+ /**
+ * Frees the resources held by this graphics context when it is
+ * garbage collected.
+ */
+ public void finalize()
+ {
+ dispose();
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @return A string representation of this object.
+ */
+ public String toString()
+ {
+ return getClass ().getName () + "[font=" + getFont () + ",color="
+ + getColor () + "]";
+ }
+
+ /**
+ * Returns <code>true</code> if the specified rectangle intersects with the
+ * current clip, <code>false</code> otherwise.
+ *
+ * @param x the X coordinate of the upper left corner of the test rectangle
+ * @param y the Y coordinate of the upper left corner of the test rectangle
+ * @param width the width of the upper left corner of the test rectangle
+ * @param height the height of the upper left corner of the test rectangle
+ * @return <code>true</code> if the specified rectangle intersects with the
+ * current clip, <code>false</code> otherwise
+ */
+ public boolean hitClip(int x, int y, int width, int height)
+ {
+ return getClip().intersects(x, y, width, height);
+ }
+
+ public Rectangle getClipBounds(Rectangle r)
+ {
+ Rectangle clipBounds = getClipBounds();
- if (r == null)
- return clipBounds;
-
- r.x = clipBounds.x;
- r.y = clipBounds.y;
- r.width = clipBounds.width;
- r.height = clipBounds.height;
- return r;
+ if (r == null)
+ return clipBounds;
+
+ r.x = clipBounds.x;
+ r.y = clipBounds.y;
+ r.width = clipBounds.width;
+ r.height = clipBounds.height;
+ return r;
+ }
}
-
-} // class Graphics
-
diff --git a/libjava/classpath/java/awt/GraphicsConfiguration.java b/libjava/classpath/java/awt/GraphicsConfiguration.java
index 069d7414b3d..1526ad3cfc0 100644
--- a/libjava/classpath/java/awt/GraphicsConfiguration.java
+++ b/libjava/classpath/java/awt/GraphicsConfiguration.java
@@ -130,11 +130,10 @@ public abstract class GraphicsConfiguration
* with the given transparency. Because the buffer is volatile, it
* can be optimized by native graphics accelerators.
*
- * @param w the width of the buffer
- * @param h the height of the buffer
+ * @param width the width of the buffer
+ * @param height the height of the buffer
* @param transparency the transparency value for the buffer
* @return the buffered image, or null if none is supported
- * @throws AWTException if the capabilities cannot be met
* @since 1.5
*/
public abstract VolatileImage createCompatibleVolatileImage(int width,
diff --git a/libjava/classpath/java/awt/GridBagLayout.java b/libjava/classpath/java/awt/GridBagLayout.java
index 7f9ab249b6d..083c0b7a7a3 100644
--- a/libjava/classpath/java/awt/GridBagLayout.java
+++ b/libjava/classpath/java/awt/GridBagLayout.java
@@ -705,17 +705,20 @@ public class GridBagLayout
if (lastInCol.containsKey(new Integer(x)))
{
Component lastComponent = (Component) lastInRow.get(new Integer(x));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
-
- if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+ if (lastComponent != null)
{
- constraints.gridy = max_y - 1;
- break;
- }
- else
- {
- constraints.gridy = Math.max (constraints.gridy,
- lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+
+ if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+ {
+ constraints.gridy = max_y - 1;
+ break;
+ }
+ else
+ {
+ constraints.gridy = Math.max (constraints.gridy,
+ lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+ }
}
}
}
diff --git a/libjava/classpath/java/awt/Image.java b/libjava/classpath/java/awt/Image.java
index b657ad007d9..93c2c479024 100644
--- a/libjava/classpath/java/awt/Image.java
+++ b/libjava/classpath/java/awt/Image.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package java.awt;
+import java.awt.image.AreaAveragingScaleFilter;
import java.awt.image.FilteredImageSource;
+import java.awt.image.ImageFilter;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.ReplicateScaleFilter;
@@ -141,7 +143,6 @@ public abstract class Image
* This method is only valid for off-screen objects.
*
* @return a graphics context object for an off-screen object
- * @see Graphics#getcreateImage(int, int)
*/
public abstract Graphics getGraphics();
@@ -179,20 +180,25 @@ public abstract class Image
*/
public Image getScaledInstance(int width, int height, int flags)
{
+ ImageFilter filter;
switch (flags)
{
case SCALE_DEFAULT:
case SCALE_FAST:
case SCALE_REPLICATE:
- ImageProducer producer =
- new FilteredImageSource(this.getSource(),
- new ReplicateScaleFilter(width, height));
- return Toolkit.getDefaultToolkit().createImage(producer);
- case SCALE_SMOOTH:
+ filter = new ReplicateScaleFilter(width, height);
+ break;
case SCALE_AREA_AVERAGING:
+ filter = new AreaAveragingScaleFilter(width, height);
+ break;
+ case SCALE_SMOOTH:
+ throw new Error("SCALE_SMOOTH: not implemented");
default:
- throw new Error("not implemented");
+ throw new Error("Unknown flag or not implemented: " + flags);
}
+
+ ImageProducer producer = new FilteredImageSource(getSource(), filter);
+ return Toolkit.getDefaultToolkit().createImage(producer);
}
/**
diff --git a/libjava/classpath/java/awt/KeyboardFocusManager.java b/libjava/classpath/java/awt/KeyboardFocusManager.java
index f64618477bd..371ea9bdf8a 100644
--- a/libjava/classpath/java/awt/KeyboardFocusManager.java
+++ b/libjava/classpath/java/awt/KeyboardFocusManager.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt;
import java.applet.Applet;
+import java.awt.FocusTraversalPolicy;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
@@ -213,7 +214,7 @@ public abstract class KeyboardFocusManager
currentFocusOwners */
private static Map currentFocusCycleRoots = new HashMap ();
- /** The default {@link FocusTraveralPolicy} that focus-managing
+ /** The default {@link FocusTraversalPolicy} that focus-managing
{@link Container}s will use to define their initial focus
traversal policy. */
private FocusTraversalPolicy defaultPolicy;
@@ -287,7 +288,7 @@ public abstract class KeyboardFocusManager
KeyboardFocusManager manager;
if (m == null)
- manager = createFocusManager();
+ manager = new DefaultKeyboardFocusManager();
else
manager = m;
@@ -295,46 +296,6 @@ public abstract class KeyboardFocusManager
}
/**
- * Creates a KeyboardFocusManager. The exact class is determined by the
- * system property 'gnu.java.awt.FocusManager'. If this is not set,
- * we default to DefaultKeyboardFocusManager.
- */
- private static KeyboardFocusManager createFocusManager()
- {
- String fmClassName = System.getProperty("gnu.java.awt.FocusManager",
- "java.awt.DefaultKeyboardFocusManager");
- try
- {
- Class fmClass = Class.forName(fmClassName);
- KeyboardFocusManager fm = (KeyboardFocusManager) fmClass.newInstance();
- return fm;
- }
- catch (ClassNotFoundException ex)
- {
- System.err.println("The class " + fmClassName + " cannot be found.");
- System.err.println("Check the setting of the system property");
- System.err.println("gnu.java.awt.FocusManager");
- return null;
- }
- catch (InstantiationException ex)
- {
- System.err.println("The class " + fmClassName + " cannot be");
- System.err.println("instantiated.");
- System.err.println("Check the setting of the system property");
- System.err.println("gnu.java.awt.FocusManager");
- return null;
- }
- catch (IllegalAccessException ex)
- {
- System.err.println("The class " + fmClassName + " cannot be");
- System.err.println("accessed.");
- System.err.println("Check the setting of the system property");
- System.err.println("gnu.java.awt.FocusManager");
- return null;
- }
- }
-
- /**
* Retrieve the {@link Component} that has the keyboard focus, or
* null if the focus owner was not set by a thread in the current
* {@link java.lang.ThreadGroup}.
@@ -1364,11 +1325,11 @@ public abstract class KeyboardFocusManager
*
* @return a global object set by the current ThreadGroup, or null
*
- * @see getFocusOwner
- * @see getPermanentFocusOwner
- * @see getFocusedWindow
- * @see getActiveWindow
- * @see getCurrentFocusCycleRoot
+ * @see #getFocusOwner()
+ * @see #getPermanentFocusOwner()
+ * @see #getFocusedWindow()
+ * @see #getActiveWindow()
+ * @see #getCurrentFocusCycleRoot()
*/
private Object getObject (Map globalMap)
{
@@ -1388,11 +1349,11 @@ public abstract class KeyboardFocusManager
* @throws SecurityException if this is not the keyboard focus
* manager associated with the current {@link java.lang.ThreadGroup}
*
- * @see getGlobalFocusOwner
- * @see getGlobalPermanentFocusOwner
- * @see getGlobalFocusedWindow
- * @see getGlobalActiveWindow
- * @see getGlobalCurrentFocusCycleRoot
+ * @see #getGlobalFocusOwner()
+ * @see #getGlobalPermanentFocusOwner()
+ * @see #getGlobalFocusedWindow()
+ * @see #getGlobalActiveWindow()
+ * @see #getGlobalCurrentFocusCycleRoot()
*/
private Object getGlobalObject (Map globalMap)
{
@@ -1432,11 +1393,11 @@ public abstract class KeyboardFocusManager
* @param newObject the object to set
* @param property the property that will change
*
- * @see setGlobalFocusOwner
- * @see setGlobalPermanentFocusOwner
- * @see setGlobalFocusedWindow
- * @see setGlobalActiveWindow
- * @see setGlobalCurrentFocusCycleRoot
+ * @see #setGlobalFocusOwner(Component)
+ * @see #setGlobalPermanentFocusOwner(Component)
+ * @see #setGlobalFocusedWindow(Window)
+ * @see #setGlobalActiveWindow(Window)
+ * @see #setGlobalCurrentFocusCycleRoot(Container)
*/
private void setGlobalObject (Map globalMap,
Object newObject,
diff --git a/libjava/classpath/java/awt/List.java b/libjava/classpath/java/awt/List.java
index ab7d359633e..00636a0224f 100644
--- a/libjava/classpath/java/awt/List.java
+++ b/libjava/classpath/java/awt/List.java
@@ -1088,18 +1088,23 @@ paramString()
protected class AccessibleAWTList extends AccessibleAWTComponent
implements AccessibleSelection, ItemListener, ActionListener
{
+ private static final long serialVersionUID = 7924617370136012829L;
+
protected class AccessibleAWTListChild extends AccessibleAWTComponent
implements Accessible
{
- private int index;
+ private static final long serialVersionUID = 4412022926028300317L;
+
+ // Field names are fixed by serialization spec.
private List parent;
+ private int indexInParent;
public AccessibleAWTListChild(List parent, int indexInParent)
{
this.parent = parent;
- index = indexInParent;
+ this.indexInParent = indexInParent;
if (parent == null)
- index = -1;
+ this.indexInParent = -1;
}
/* (non-Javadoc)
@@ -1118,14 +1123,14 @@ paramString()
public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
- if (parent.isIndexSelected(index))
+ if (parent.isIndexSelected(indexInParent))
states.add(AccessibleState.SELECTED);
return states;
}
public int getAccessibleIndexInParent()
{
- return index;
+ return indexInParent;
}
}
diff --git a/libjava/classpath/java/awt/Menu.java b/libjava/classpath/java/awt/Menu.java
index 56ceccfc542..13ebb5211be 100644
--- a/libjava/classpath/java/awt/Menu.java
+++ b/libjava/classpath/java/awt/Menu.java
@@ -441,6 +441,8 @@ paramString()
*/
protected class AccessibleAWTMenu extends AccessibleAWTMenuItem
{
+ private static final long serialVersionUID = 5228160894980069094L;
+
protected AccessibleAWTMenu()
{
}
diff --git a/libjava/classpath/java/awt/MenuComponent.java b/libjava/classpath/java/awt/MenuComponent.java
index ec6980e10ca..375d08436e0 100644
--- a/libjava/classpath/java/awt/MenuComponent.java
+++ b/libjava/classpath/java/awt/MenuComponent.java
@@ -1157,7 +1157,7 @@ protected abstract class AccessibleAWTMenuComponent
* the appropriate information.
*
* @param color the new color to use for the background.
- * @see getBackground()
+ * @see #getBackground()
*/
public void setBackground(Color color)
{
@@ -1217,7 +1217,7 @@ protected abstract class AccessibleAWTMenuComponent
*
* @param enabled true if the component should be enabled,
* false otherwise.
- * @see #getEnabled()
+ * @see #isEnabled()
*/
public void setEnabled(boolean enabled)
{
diff --git a/libjava/classpath/java/awt/MenuItem.java b/libjava/classpath/java/awt/MenuItem.java
index 58dcb674146..3e39d118a05 100644
--- a/libjava/classpath/java/awt/MenuItem.java
+++ b/libjava/classpath/java/awt/MenuItem.java
@@ -108,6 +108,8 @@ private transient ActionListener action_listeners;
extends MenuComponent.AccessibleAWTMenuComponent
implements AccessibleAction, AccessibleValue
{
+ private static final long serialVersionUID = -217847831945965825L;
+
/** Constructor */
public AccessibleAWTMenuItem()
{
diff --git a/libjava/classpath/java/awt/Point.java b/libjava/classpath/java/awt/Point.java
index 492749b8dc3..31b72e2cc75 100644
--- a/libjava/classpath/java/awt/Point.java
+++ b/libjava/classpath/java/awt/Point.java
@@ -226,6 +226,10 @@ public class Point extends Point2D implements Serializable
*/
public boolean equals(Object obj)
{
+ // NOTE: No special hashCode() method is required for this class,
+ // as this equals() implementation is functionally equivalent to
+ // super.equals(), which does define a proper hashCode().
+
if (! (obj instanceof Point2D))
return false;
Point2D p = (Point2D) obj;
diff --git a/libjava/classpath/java/awt/Polygon.java b/libjava/classpath/java/awt/Polygon.java
index a72522cb089..403c336cde5 100644
--- a/libjava/classpath/java/awt/Polygon.java
+++ b/libjava/classpath/java/awt/Polygon.java
@@ -544,7 +544,6 @@ public class Polygon implements Shape, Serializable
* the positive X, or Y axis, within a given interval.
*
* @return the winding number.
- * @see #condensed
* @see #contains(double, double)
*/
private int evaluateCrossings(double x, double y, boolean useYaxis,
diff --git a/libjava/classpath/java/awt/PopupMenu.java b/libjava/classpath/java/awt/PopupMenu.java
index 90d48d903b9..540fffda718 100644
--- a/libjava/classpath/java/awt/PopupMenu.java
+++ b/libjava/classpath/java/awt/PopupMenu.java
@@ -140,6 +140,8 @@ show(Component component, int x, int y)
protected class AccessibleAWTPopupMenu extends AccessibleAWTMenu
{
+ private static final long serialVersionUID = -4282044795947239955L;
+
protected AccessibleAWTPopupMenu()
{
}
diff --git a/libjava/classpath/java/awt/Rectangle.java b/libjava/classpath/java/awt/Rectangle.java
index 0f21d495cd8..c4ba6ba1488 100644
--- a/libjava/classpath/java/awt/Rectangle.java
+++ b/libjava/classpath/java/awt/Rectangle.java
@@ -727,6 +727,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public boolean equals(Object obj)
{
+ // NOTE: No special hashCode() method is required for this class,
+ // as this equals() implementation is functionally equivalent to
+ // super.equals(), which does define a proper hashCode().
+
if (! (obj instanceof Rectangle2D))
return false;
Rectangle2D r = (Rectangle2D) obj;
diff --git a/libjava/classpath/java/awt/ScrollPane.java b/libjava/classpath/java/awt/ScrollPane.java
index b3ecc59fcd5..525d9d3e7da 100644
--- a/libjava/classpath/java/awt/ScrollPane.java
+++ b/libjava/classpath/java/awt/ScrollPane.java
@@ -401,7 +401,7 @@ setScrollPosition(int x, int y)
public void
addNotify()
{
- if (!isDisplayable ())
+ if (peer != null)
return;
setPeer((ComponentPeer)getToolkit().createScrollPane(this));
@@ -592,6 +592,8 @@ paramString()
protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
{
+ private static final long serialVersionUID = 6100703663886637L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.SCROLL_PANE;
diff --git a/libjava/classpath/java/awt/ScrollPaneAdjustable.java b/libjava/classpath/java/awt/ScrollPaneAdjustable.java
index cfca19b4423..bec5b5106de 100644
--- a/libjava/classpath/java/awt/ScrollPaneAdjustable.java
+++ b/libjava/classpath/java/awt/ScrollPaneAdjustable.java
@@ -87,12 +87,16 @@ public class ScrollPaneAdjustable
public void addAdjustmentListener (AdjustmentListener listener)
{
- AWTEventMulticaster.add (adjustmentListener, listener);
+ if (listener == null)
+ return;
+ adjustmentListener = AWTEventMulticaster.add (adjustmentListener, listener);
}
public void removeAdjustmentListener (AdjustmentListener listener)
{
- AWTEventMulticaster.remove (adjustmentListener, listener);
+ if (listener == null)
+ return;
+ adjustmentListener = AWTEventMulticaster.remove (adjustmentListener, listener);
}
public AdjustmentListener[] getAdjustmentListeners ()
diff --git a/libjava/classpath/java/awt/TextArea.java b/libjava/classpath/java/awt/TextArea.java
index d422d3306d2..b04cdc89204 100644
--- a/libjava/classpath/java/awt/TextArea.java
+++ b/libjava/classpath/java/awt/TextArea.java
@@ -603,6 +603,8 @@ public class TextArea extends TextComponent implements java.io.Serializable
protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
{
+ private static final long serialVersionUID = 3472827823632144419L;
+
protected AccessibleAWTTextArea()
{
}
diff --git a/libjava/classpath/java/awt/TextComponent.java b/libjava/classpath/java/awt/TextComponent.java
index 60e72fcb5cb..f08e59c9fc9 100644
--- a/libjava/classpath/java/awt/TextComponent.java
+++ b/libjava/classpath/java/awt/TextComponent.java
@@ -107,6 +107,8 @@ protected transient TextListener textListener;
extends AccessibleAWTComponent
implements AccessibleText, TextListener
{
+ private static final long serialVersionUID = 3631432373506317811L;
+
// Constructor
// Adds a listener for tracking caret changes
public AccessibleAWTTextComponent()
diff --git a/libjava/classpath/java/awt/TextField.java b/libjava/classpath/java/awt/TextField.java
index 4d62d024aad..3302a2eff89 100644
--- a/libjava/classpath/java/awt/TextField.java
+++ b/libjava/classpath/java/awt/TextField.java
@@ -523,6 +523,8 @@ paramString()
protected class AccessibleAWTTextField extends AccessibleAWTTextComponent
{
+ private static final long serialVersionUID = 6219164359235943158L;
+
protected AccessibleAWTTextField()
{
}
diff --git a/libjava/classpath/java/awt/Window.java b/libjava/classpath/java/awt/Window.java
index 1689d03706b..f8a620daebd 100644
--- a/libjava/classpath/java/awt/Window.java
+++ b/libjava/classpath/java/awt/Window.java
@@ -101,6 +101,8 @@ public class Window extends Container implements Accessible
protected class AccessibleAWTWindow extends AccessibleAWTContainer
{
+ private static final long serialVersionUID = 4215068635060671780L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.WINDOW;
@@ -278,14 +280,14 @@ public class Window extends Container implements Accessible
*/
public void show()
{
+ synchronized (getTreeLock())
+ {
if (parent != null && !parent.isDisplayable())
parent.addNotify();
if (peer == null)
addNotify();
// Show visible owned windows.
- synchronized (getTreeLock())
- {
Iterator e = ownedWindows.iterator();
while(e.hasNext())
{
@@ -302,14 +304,13 @@ public class Window extends Container implements Accessible
// synchronous access to ownedWindows there.
e.remove();
}
- }
validate();
super.show();
toFront();
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
manager.setGlobalFocusedWindow (this);
-
+
if (!shown)
{
FocusTraversalPolicy policy = getFocusTraversalPolicy ();
@@ -323,6 +324,7 @@ public class Window extends Container implements Accessible
shown = true;
}
+ }
}
public void hide()
@@ -346,13 +348,6 @@ public class Window extends Container implements Accessible
super.hide();
}
- public boolean isDisplayable()
- {
- if (super.isDisplayable())
- return true;
- return peer != null;
- }
-
/**
* Destroys any resources associated with this window. This includes
* all components in the window and all owned top-level windows.
@@ -808,20 +803,81 @@ public class Window extends Container implements Accessible
return isVisible();
}
- public void setLocationRelativeTo (Component c)
+ public void setLocationRelativeTo(Component c)
{
- if (c == null || !c.isShowing ())
+ int x = 0;
+ int y = 0;
+
+ if (c == null || !c.isShowing())
{
- int x = 0;
- int y = 0;
-
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
- Point center = ge.getCenterPoint ();
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Point center = ge.getCenterPoint();
x = center.x - (width / 2);
y = center.y - (height / 2);
- setLocation (x, y);
}
- // FIXME: handle case where component is non-null.
+ else
+ {
+ int cWidth = c.getWidth();
+ int cHeight = c.getHeight();
+ Dimension screenSize = getToolkit().getScreenSize();
+
+ x = c.getLocationOnScreen().x;
+ y = c.getLocationOnScreen().y;
+
+ // If bottom of component is cut off, window placed
+ // on the left or the right side of component
+ if ((y + cHeight) > screenSize.height)
+ {
+ // If the right side of the component is closer to the center
+ if ((screenSize.width / 2 - x) <= 0)
+ {
+ if ((x - width) >= 0)
+ x -= width;
+ else
+ x = 0;
+ }
+ else
+ {
+ if ((x + cWidth + width) <= screenSize.width)
+ x += cWidth;
+ else
+ x = screenSize.width - width;
+ }
+
+ y = screenSize.height - height;
+ }
+ else if (cWidth > width || cHeight > height)
+ {
+ // If right side of component is cut off
+ if ((x + width) > screenSize.width)
+ x = screenSize.width - width;
+ // If left side of component is cut off
+ else if (x < 0)
+ x = 0;
+ else
+ x += (cWidth - width) / 2;
+
+ y += (cHeight - height) / 2;
+ }
+ else
+ {
+ // If right side of component is cut off
+ if ((x + width) > screenSize.width)
+ x = screenSize.width - width;
+ // If left side of component is cut off
+ else if (x < 0 || (x - (width - cWidth) / 2) < 0)
+ x = 0;
+ else
+ x -= (width - cWidth) / 2;
+
+ if ((y - (height - cHeight) / 2) > 0)
+ y -= (height - cHeight) / 2;
+ else
+ y = 0;
+ }
+ }
+
+ setLocation(x, y);
}
/**
@@ -938,8 +994,8 @@ public class Window extends Container implements Accessible
*
* @since 1.4
*/
- public void createBufferStrategy(int numBuffers,
- BufferCapabilities caps)
+ public void createBufferStrategy(int numBuffers, BufferCapabilities caps)
+ throws AWTException
{
if (numBuffers < 1)
throw new IllegalArgumentException("Window.createBufferStrategy: number"
@@ -951,15 +1007,7 @@ public class Window extends Container implements Accessible
// a flipping strategy was requested
if (caps.isPageFlipping())
- {
- try
- {
- bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
- }
- catch (AWTException e)
- {
- }
- }
+ bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
else
bufferStrategy = new WindowBltBufferStrategy(numBuffers, true);
}
diff --git a/libjava/classpath/java/awt/color/ICC_Profile.java b/libjava/classpath/java/awt/color/ICC_Profile.java
index 75f55a1dacb..1072cd694db 100644
--- a/libjava/classpath/java/awt/color/ICC_Profile.java
+++ b/libjava/classpath/java/awt/color/ICC_Profile.java
@@ -324,11 +324,11 @@ public class ICC_Profile implements Serializable
* An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
* may be returned if appropriate.
*
- * @throws IllegalArgumentException if the profile data is an invalid
- * v2 profile.
- *
* @param data - the profile data
* @return An ICC_Profile object
+ *
+ * @throws IllegalArgumentException if the profile data is an invalid
+ * v2 profile.
*/
public static ICC_Profile getInstance(byte[] data)
{
@@ -373,12 +373,12 @@ public class ICC_Profile implements Serializable
* An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
* may be returned if appropriate.
*
+ * @param filename - the file name of the profile file.
+ * @return An ICC_Profile object
+ *
* @throws IllegalArgumentException if the profile data is an invalid
* v2 profile.
* @throws IOException if the file could not be read.
- *
- * @param filename - the file name of the profile file.
- * @return An ICC_Profile object
*/
public static ICC_Profile getInstance(String filename)
throws IOException
@@ -400,12 +400,12 @@ public class ICC_Profile implements Serializable
* An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
* may be returned if appropriate.
*
+ * @param in - the input stream to read the profile from.
+ * @return An ICC_Profile object
+ *
* @throws IllegalArgumentException if the profile data is an invalid
* v2 profile.
* @throws IOException if the stream could not be read.
- *
- * @param in - the input stream to read the profile from.
- * @return An ICC_Profile object
*/
public static ICC_Profile getInstance(InputStream in)
throws IOException
diff --git a/libjava/classpath/java/awt/event/InputEvent.java b/libjava/classpath/java/awt/event/InputEvent.java
index 8f9aed611f8..28cd9018599 100644
--- a/libjava/classpath/java/awt/event/InputEvent.java
+++ b/libjava/classpath/java/awt/event/InputEvent.java
@@ -197,17 +197,28 @@ public abstract class InputEvent extends ComponentEvent
private final long when;
/**
- * The modifiers in effect for this event. Package visible for use by
- * subclasses. The old style (bitmask 0x3f) should not be mixed with the
- * new style (bitmasks 0xffffffc0).
+ * The old-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
*
* @see #getModifiers()
* @see MouseEvent
- * @serial the modifier state, stored in the new style
+ * @serial the modifier state, stored in the old style
*/
int modifiers;
/**
+ * The new-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
+ *
+ * @see #getModifiersEx()
+ * @see MouseEvent
+ * @serial the modifier state, stored in the new style
+ */
+ int modifiersEx;
+
+ /**
* Initializes a new instance of <code>InputEvent</code> with the specified
* source, id, timestamp, and modifiers. Note that an invalid id leads to
* unspecified results.
@@ -222,7 +233,8 @@ public abstract class InputEvent extends ComponentEvent
{
super(source, id);
this.when = when;
- this.modifiers = EventModifier.extend(modifiers);
+ this.modifiers = modifiers & EventModifier.OLD_MASK;
+ this.modifiersEx = modifiers & EventModifier.NEW_MASK;
}
/**
@@ -232,7 +244,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isShiftDown()
{
- return (modifiers & SHIFT_DOWN_MASK) != 0;
+ return ((modifiers & SHIFT_MASK) != 0)
+ || ((modifiersEx & SHIFT_DOWN_MASK) != 0);
}
/**
@@ -243,7 +256,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isControlDown()
{
- return (modifiers & CTRL_DOWN_MASK) != 0;
+ return ((modifiers & CTRL_MASK) != 0)
+ || ((modifiersEx & CTRL_DOWN_MASK) != 0);
}
/**
@@ -253,7 +267,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isMetaDown()
{
- return (modifiers & META_DOWN_MASK) != 0;
+ return ((modifiers & META_MASK) != 0)
+ || ((modifiersEx & META_DOWN_MASK) != 0);
}
/**
@@ -263,7 +278,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isAltDown()
{
- return (modifiers & ALT_DOWN_MASK) != 0;
+ return ((modifiers & ALT_MASK) != 0)
+ || ((modifiersEx & ALT_DOWN_MASK) != 0);
}
/**
@@ -274,7 +290,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isAltGraphDown()
{
- return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
+ return ((modifiers & ALT_GRAPH_MASK) != 0)
+ || ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0);
}
/**
@@ -300,7 +317,7 @@ public abstract class InputEvent extends ComponentEvent
*/
public int getModifiers()
{
- return EventModifier.revert(modifiers);
+ return modifiers;
}
/**
@@ -321,7 +338,7 @@ public abstract class InputEvent extends ComponentEvent
*/
public int getModifiersEx()
{
- return modifiers;
+ return modifiersEx;
}
/**
diff --git a/libjava/classpath/java/awt/event/InvocationEvent.java b/libjava/classpath/java/awt/event/InvocationEvent.java
index 75feb62bd94..6f39d6b9130 100644
--- a/libjava/classpath/java/awt/event/InvocationEvent.java
+++ b/libjava/classpath/java/awt/event/InvocationEvent.java
@@ -107,6 +107,13 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
private Exception exception;
/**
+ * This is the caught Throwable thrown in the <code>run()</code> method.
+ * It is null if throwables are ignored, the run method hasn't completed,
+ * or there were no throwables thrown.
+ */
+ private Throwable throwable;
+
+ /**
* The timestamp when this event was created.
*
* @see #getWhen()
@@ -183,9 +190,11 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
{
runnable.run();
}
- catch (Exception e)
+ catch (Throwable t)
{
- exception = e;
+ throwable = t;
+ if (t instanceof Exception)
+ exception = (Exception)t;
}
else
runnable.run();
@@ -211,6 +220,18 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
}
/**
+ * Returns a throwable caught while executing the Runnable's run() method.
+ * Null if none was thrown or if this InvocationEvent doesn't catch
+ * throwables.
+ * @return the caught Throwable
+ * @since 1.5
+ */
+ public Throwable getThrowable()
+ {
+ return throwable;
+ }
+
+ /**
* Gets the timestamp of when this event was created.
*
* @return the timestamp of this event
diff --git a/libjava/classpath/java/awt/event/KeyEvent.java b/libjava/classpath/java/awt/event/KeyEvent.java
index a40a8e15c04..d4b93ba3e0b 100644
--- a/libjava/classpath/java/awt/event/KeyEvent.java
+++ b/libjava/classpath/java/awt/event/KeyEvent.java
@@ -1735,6 +1735,6 @@ public class KeyEvent extends InputEvent
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
- modifiers = EventModifier.extend(modifiers);
+ modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
} // class KeyEvent
diff --git a/libjava/classpath/java/awt/event/MouseEvent.java b/libjava/classpath/java/awt/event/MouseEvent.java
index 249c3d112e4..3e0fecacf94 100644
--- a/libjava/classpath/java/awt/event/MouseEvent.java
+++ b/libjava/classpath/java/awt/event/MouseEvent.java
@@ -42,6 +42,7 @@ import gnu.java.awt.EventModifier;
import java.awt.Component;
import java.awt.Point;
+import java.awt.PopupMenu;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -227,6 +228,12 @@ public class MouseEvent extends InputEvent
else if ((modifiers & BUTTON3_MASK) != 0)
this.button = BUTTON3;
}
+ // clear the mouse button modifier masks if this is a button
+ // release event.
+ if (id == MOUSE_RELEASED)
+ this.modifiersEx &= ~(BUTTON1_DOWN_MASK
+ | BUTTON2_DOWN_MASK
+ | BUTTON3_DOWN_MASK);
}
/**
@@ -392,17 +399,9 @@ public class MouseEvent extends InputEvent
s.append("unknown type,(");
}
s.append(x).append(',').append(y).append("),button=").append(button);
- if ((modifiers & EventModifier.NEW_MASK) != 0)
- {
- int mod = modifiers;
- if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0)
- mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK;
- if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0)
- mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK;
- s.append(",modifiers=").append(getModifiersExText(mod));
- }
- if (modifiers != 0)
- s.append(",extModifiers=").append(getModifiersExText(modifiers));
+ // FIXME: need a mauve test for this method
+ if (modifiersEx != 0)
+ s.append(",extModifiers=").append(getModifiersExText(modifiersEx));
return s.append(",clickCount=").append(clickCount).toString();
}
@@ -426,7 +425,7 @@ public class MouseEvent extends InputEvent
button = BUTTON2;
else if ((modifiers & BUTTON3_MASK) != 0)
button = BUTTON3;
- modifiers = EventModifier.extend(modifiers);
+ modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
}
} // class MouseEvent
diff --git a/libjava/classpath/java/awt/geom/Area.java b/libjava/classpath/java/awt/geom/Area.java
index 7a0fac43a34..ad20b535f68 100644
--- a/libjava/classpath/java/awt/geom/Area.java
+++ b/libjava/classpath/java/awt/geom/Area.java
@@ -1215,7 +1215,7 @@ public class Area implements Shape, Cloneable
* @param t1 - global parametric value of the first curve's starting point
* @param t2 - global parametric value of the second curve's starting point
* @param w1 - global parametric length of curve 1
- * @param c1 - global parametric length of curve 2
+ * @param w2 - global parametric length of curve 2
*
* The final four parameters are for keeping track of the parametric
* value of the curve. For a full curve t = 0, w = 1, w is halved with
diff --git a/libjava/classpath/java/awt/geom/GeneralPath.java b/libjava/classpath/java/awt/geom/GeneralPath.java
index f54855874dc..15fb8aba811 100644
--- a/libjava/classpath/java/awt/geom/GeneralPath.java
+++ b/libjava/classpath/java/awt/geom/GeneralPath.java
@@ -558,7 +558,8 @@ public final class GeneralPath implements Shape, Cloneable
* Constructs a new iterator for enumerating the segments of a
* GeneralPath.
*
- * @param at an affine transformation for projecting the returned
+ * @param path the path to enumerate
+ * @param transform an affine transformation for projecting the returned
* points, or <code>null</code> to return the original points
* without any mapping.
*/
diff --git a/libjava/classpath/java/awt/im/InputContext.java b/libjava/classpath/java/awt/im/InputContext.java
index c0505e7e98b..0bb107e36d1 100644
--- a/libjava/classpath/java/awt/im/InputContext.java
+++ b/libjava/classpath/java/awt/im/InputContext.java
@@ -49,6 +49,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
+import java.text.AttributedCharacterIterator.Attribute;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -334,7 +335,7 @@ public class InputContext
/**
* Starts a reconversion operation in the current input method. The input
- * method gets theh text to reconvert from the client component, using
+ * method gets the text to reconvert from the client component, using
* {@link InputMethodRequests#getSelectedText(Attribute[])}. Then the
* composed and committed text produced by the operation is sent back to
* the client using a sequence of InputMethodRequests.
diff --git a/libjava/classpath/java/awt/im/InputMethodHighlight.java b/libjava/classpath/java/awt/im/InputMethodHighlight.java
index 0d664b19366..6fbe42fe549 100644
--- a/libjava/classpath/java/awt/im/InputMethodHighlight.java
+++ b/libjava/classpath/java/awt/im/InputMethodHighlight.java
@@ -37,6 +37,9 @@ exception statement from your version. */
package java.awt.im;
+import java.awt.Toolkit;
+import java.text.Annotation;
+import java.text.AttributedCharacterIterator;
import java.util.Map;
/**
@@ -53,7 +56,7 @@ import java.util.Map;
* text segments.
*
* @author Eric Blake (ebb9@email.byu.edu)
- * @see AttributedCharacterIterators
+ * @see AttributedCharacterIterator
* @see Annotation
* @since 1.2
* @status updated to 1.4
diff --git a/libjava/classpath/java/awt/im/InputMethodRequests.java b/libjava/classpath/java/awt/im/InputMethodRequests.java
index d50ec33c5c8..0423358cc53 100644
--- a/libjava/classpath/java/awt/im/InputMethodRequests.java
+++ b/libjava/classpath/java/awt/im/InputMethodRequests.java
@@ -37,8 +37,10 @@ exception statement from your version. */
package java.awt.im;
+import java.awt.Component;
import java.awt.Rectangle;
import java.awt.font.TextHitInfo;
+import java.awt.event.InputMethodListener;
import java.text.AttributedCharacterIterator;
import java.text.AttributedCharacterIterator.Attribute;
diff --git a/libjava/classpath/java/awt/im/spi/InputMethod.java b/libjava/classpath/java/awt/im/spi/InputMethod.java
index 840d193a8d8..ebe4508418e 100644
--- a/libjava/classpath/java/awt/im/spi/InputMethod.java
+++ b/libjava/classpath/java/awt/im/spi/InputMethod.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package java.awt.im.spi;
import java.awt.AWTEvent;
+import java.awt.Component;
import java.awt.Rectangle;
+import java.awt.im.InputContext;
+import java.awt.im.InputMethodRequests;
+import java.text.AttributedCharacterIterator.Attribute;
import java.util.Locale;
/**
@@ -152,8 +156,8 @@ public interface InputMethod
* Notify this input method of changes in the client window. This is called
* when notifications are enabled (see {@link
* InputMethodContext#enableClientWindowNotification(InputMethod, boolean)},
- * if {@link #removeNotify(Component)} has not been called. The following
- * situations trigger a notification:<ul>
+ * if {@link InputContext#removeNotify(Component)} has not been called.
+ * The following situations trigger a notification:<ul>
* <li>The client window changes in location, size, visibility,
* iconification, or is closed.</li>
* <li>When enabling client notification (or on the first activation after
@@ -202,7 +206,7 @@ public interface InputMethod
/**
* Notify the input method that a client component has been removed from its
* hierarchy, or that input method support has been disabled. This is
- * called by {@link InputContext#removeNotify()}, and only when the input
+ * called by {@link InputContext#removeNotify(Component)}, and only when the input
* method is inactive.
*/
void removeNotify();
diff --git a/libjava/classpath/java/awt/im/spi/InputMethodContext.java b/libjava/classpath/java/awt/im/spi/InputMethodContext.java
index 43bee8d8617..17ec4f8f7ee 100644
--- a/libjava/classpath/java/awt/im/spi/InputMethodContext.java
+++ b/libjava/classpath/java/awt/im/spi/InputMethodContext.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.awt.im.spi;
+import java.awt.HeadlessException;
+import java.awt.Rectangle;
import java.awt.Window;
import java.awt.font.TextHitInfo;
import java.awt.im.InputMethodRequests;
@@ -113,7 +115,7 @@ public interface InputMethodContext extends InputMethodRequests
/**
* Sets whether notification of the client window's location and state should
* be enabled for the input method. When enabled, the input method's
- * {@link #notifyClientWindowChange(Rectangle)} method is called.
+ * {@link InputMethod#notifyClientWindowChange(Rectangle)} method is called.
* Notification is automatically disabled when the input method is disposed.
*
* @param inputMethod the method to change status of
diff --git a/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java b/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java
index 093d7319217..d234e5c57f3 100644
--- a/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java
+++ b/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java
@@ -39,6 +39,7 @@ package java.awt.im.spi;
import java.awt.AWTException;
import java.awt.Image;
+import java.awt.im.InputContext;
import java.util.Locale;
/**
@@ -57,7 +58,7 @@ public interface InputMethodDescriptor
* also by country and variant), via
* {@link InputContext#selectInputMethod(Locale)}. The returned list should
* ignore pass-through locales, so it is usually a subset of locales for
- * which {@link InputMethod#setContext(Locale)} returns true. If
+ * which {@link InputMethod#setLocale(Locale)} returns true. If
* {@link #hasDynamicLocaleList()} returns true, this is called each time
* information is needed, allowing dynamic addition or removal of supported
* locales.
diff --git a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
index 194d483d962..6333ce9e7f9 100644
--- a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
+++ b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
@@ -45,7 +45,7 @@ package java.awt.image;
* points should give the desired results although Sun does not
* specify what the exact algorithm should be.
* <br>
- * Currently this filter does nothing and needs to be implemented.
+ * FIXME: Currently this filter does nothing and needs to be implemented.
*
* @author C. Brian Jones (cbj@gnu.org)
*/
diff --git a/libjava/classpath/java/awt/image/BufferedImage.java b/libjava/classpath/java/awt/image/BufferedImage.java
index 124b81368e2..3cabfbde692 100644
--- a/libjava/classpath/java/awt/image/BufferedImage.java
+++ b/libjava/classpath/java/awt/image/BufferedImage.java
@@ -1,5 +1,5 @@
/* BufferedImage.java --
- Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
+ Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -48,9 +48,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Vector;
/**
@@ -64,7 +62,7 @@ import java.util.Vector;
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class BufferedImage extends Image
- implements WritableRenderedImage
+ implements WritableRenderedImage, Transparency
{
public static final int TYPE_CUSTOM = 0,
TYPE_INT_RGB = 1,
@@ -690,4 +688,16 @@ public class BufferedImage extends Image
observers.remove (to);
}
+
+ /**
+ * Return the transparency type.
+ *
+ * @return One of {@link #OPAQUE}, {@link #BITMASK}, or {@link #TRANSLUCENT}.
+ * @see Transparency#getTransparency()
+ * @since 1.5
+ */
+ public int getTransparency()
+ {
+ return colorModel.getTransparency();
+ }
}
diff --git a/libjava/classpath/java/awt/image/ColorModel.java b/libjava/classpath/java/awt/image/ColorModel.java
index 1ebcb98a76b..1ced2a04366 100644
--- a/libjava/classpath/java/awt/image/ColorModel.java
+++ b/libjava/classpath/java/awt/image/ColorModel.java
@@ -609,7 +609,7 @@ public abstract class ColorModel implements Transparency
* @param obj Array of TransferType or null.
*
* @return pixel value encoded according to the color model.
- * @throws ArrayIndexOutOfBounds
+ * @throws ArrayIndexOutOfBoundsException
* @throws ClassCastException
* @since 1.4
*/
diff --git a/libjava/classpath/java/awt/image/ComponentSampleModel.java b/libjava/classpath/java/awt/image/ComponentSampleModel.java
index 953f63c1ea1..5cf06e4a17f 100644
--- a/libjava/classpath/java/awt/image/ComponentSampleModel.java
+++ b/libjava/classpath/java/awt/image/ComponentSampleModel.java
@@ -63,8 +63,11 @@ public class ComponentSampleModel extends SampleModel
protected int[] bandOffsets;
protected int[] bankIndices;
- // FIXME: Should we really shadow the numBands in the superclass?
- //protected int numBands;
+ /**
+ * Number of bands in the image described.
+ * @specnote This field shadows the protected numBands in SampleModel.
+ */
+ protected int numBands;
/** Used when creating data buffers. */
protected int numBanks;
@@ -100,6 +103,7 @@ public class ComponentSampleModel extends SampleModel
this.bandOffsets = bandOffsets;
this.bankIndices = bankIndices;
+ this.numBands = bandOffsets.length;
this.numBanks = 0;
for (int b=0; b<bankIndices.length; b++)
diff --git a/libjava/classpath/java/awt/image/ImageConsumer.java b/libjava/classpath/java/awt/image/ImageConsumer.java
index e1834c3978f..fc5ed11e5ca 100644
--- a/libjava/classpath/java/awt/image/ImageConsumer.java
+++ b/libjava/classpath/java/awt/image/ImageConsumer.java
@@ -75,7 +75,7 @@ public interface ImageConsumer
* most one call to <code>setPixels</code> for any single pixel.
*
* @see #setHints
- * @see #setPixels
+ * @see #setPixels(int, int, int, int, ColorModel, int[], int, int)
*/
int SINGLEPASS = 8;
diff --git a/libjava/classpath/java/awt/image/PackedColorModel.java b/libjava/classpath/java/awt/image/PackedColorModel.java
index 894e6e66fda..b60230fa70d 100644
--- a/libjava/classpath/java/awt/image/PackedColorModel.java
+++ b/libjava/classpath/java/awt/image/PackedColorModel.java
@@ -90,11 +90,7 @@ public abstract class PackedColorModel extends ColorModel
return bitsPerComponent;
}
- /** Initializes the masks.
- *
- * @return an array containing the number of bits per color
- * component.
- */
+ /** Initializes the masks. */
private void initMasks(int[] colorMaskArray, int alphaMask)
{
int numComponents = colorMaskArray.length;
diff --git a/libjava/classpath/java/awt/image/SampleModel.java b/libjava/classpath/java/awt/image/SampleModel.java
index 257e30a5bd5..1159662223c 100644
--- a/libjava/classpath/java/awt/image/SampleModel.java
+++ b/libjava/classpath/java/awt/image/SampleModel.java
@@ -47,7 +47,8 @@ public abstract class SampleModel
/** Height of image described. */
protected int height;
- /** Number of bands in the image described. */
+ /** Number of bands in the image described. Package-private here,
+ shadowed by ComponentSampleModel. */
protected int numBands;
/**
diff --git a/libjava/classpath/java/awt/print/PrinterJob.java b/libjava/classpath/java/awt/print/PrinterJob.java
index e61ab61bc77..e1aeabc3e62 100644
--- a/libjava/classpath/java/awt/print/PrinterJob.java
+++ b/libjava/classpath/java/awt/print/PrinterJob.java
@@ -169,8 +169,11 @@ public abstract class PrinterJob
/**
* Prints the page with given attributes.
*/
- public abstract void print (PrintRequestAttributeSet attributes)
- throws PrinterException;
+ public void print (PrintRequestAttributeSet attributes)
+ throws PrinterException
+ {
+ print ();
+ }
/**
* Displays a dialog box to the user which allows the print job
diff --git a/libjava/classpath/java/beans/IndexedPropertyDescriptor.java b/libjava/classpath/java/beans/IndexedPropertyDescriptor.java
index efdc7b40238..0ba2ed4f493 100644
--- a/libjava/classpath/java/beans/IndexedPropertyDescriptor.java
+++ b/libjava/classpath/java/beans/IndexedPropertyDescriptor.java
@@ -1,4 +1,4 @@
-/* java.beans.IndexedPropertyDescriptor
+/* IndexedPropertyDescriptor.java --
Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,266 +42,380 @@ import java.lang.reflect.Array;
import java.lang.reflect.Method;
/**
- ** IndexedPropertyDescriptor describes information about a JavaBean
- ** indexed property, by which we mean an array-like property that
- ** has been exposed via a pair of get and set methods and another
- ** pair that allows you to get to the property by an index.<P>
- **
- ** An example property would have four methods like this:<P>
- ** <CODE>FooBar[] getFoo()</CODE><BR>
- ** <CODE>void setFoo(FooBar[])</CODE><BR>
- ** <CODE>FooBar getFoo(int)</CODE><BR>
- ** <CODE>void setFoo(int,FooBar)</CODE><P>
- **
- ** The constraints put on get and set methods are:<P>
- ** <OL>
- ** <LI>There must be at least a get(int) or a set(int,...) method.
- ** Nothing else is required. <B>Spec note:</B>One nice restriction
- ** would be that if there is a get() there must be a get(int), same
- ** with set, but that is not in the spec and is fairly harmless.)</LI>
- ** <LI>A get array method must have signature
- ** <CODE>&lt;propertyType&gt;[] &lt;getMethodName&gt;()</CODE></LI>
- ** <LI>A set array method must have signature
- ** <CODE>void &lt;setMethodName&gt;(&lt;propertyType&gt;[])</CODE></LI>
- ** <LI>A get index method must have signature
- ** <CODE>&lt;propertyType&gt; &lt;getMethodName&gt;(int)</CODE></LI>
- ** <LI>A set index method must have signature
- ** <CODE>void &lt;setMethodName&gt;(int,&lt;propertyType&gt;)</CODE></LI>
- ** <LI>All these methods may throw any exception.</LI>
- ** <LI>All these methods must be public.</LI>
- ** </OL>
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 26 Jul 1998
- **/
+ * IndexedPropertyDescriptor describes information about a JavaBean
+ * indexed property, by which we mean an array-like property that
+ * has been exposed via a pair of get and set methods and another
+ * pair that allows you to get to the property by an index.<P>
+ *
+ * An example property would have four methods like this:<P>
+ * <CODE>FooBar[] getFoo()</CODE><BR>
+ * <CODE>void setFoo(FooBar[])</CODE><BR>
+ * <CODE>FooBar getFoo(int)</CODE><BR>
+ * <CODE>void setFoo(int,FooBar)</CODE><P>
+ *
+ * The constraints put on get and set methods are:<P>
+ * <OL>
+ * <LI>There must be at least a get(int) or a set(int,...) method.
+ * Nothing else is required. <B>Spec note:</B>One nice restriction
+ * would be that if there is a get() there must be a get(int), same
+ * with set, but that is not in the spec and is fairly harmless.)</LI>
+ * <LI>A get array method must have signature
+ * <CODE>&lt;propertyType&gt;[] &lt;getMethodName&gt;()</CODE></LI>
+ * <LI>A set array method must have signature
+ * <CODE>void &lt;setMethodName&gt;(&lt;propertyType&gt;[])</CODE></LI>
+ * <LI>A get index method must have signature
+ * <CODE>&lt;propertyType&gt; &lt;getMethodName&gt;(int)</CODE></LI>
+ * <LI>A set index method must have signature
+ * <CODE>void &lt;setMethodName&gt;(int,&lt;propertyType&gt;)</CODE></LI>
+ * <LI>All these methods may throw any exception.</LI>
+ * <LI>All these methods must be public.</LI>
+ * </OL>
+ *
+ * @author John Keiser
+ * @since JDK1.1
+ */
+public class IndexedPropertyDescriptor extends PropertyDescriptor
+{
+ private Class indexedPropertyType;
+ private Method setIndex;
+ private Method getIndex;
-public class IndexedPropertyDescriptor extends PropertyDescriptor {
- private Class indexedPropertyType;
- private Method setIndex;
- private Method getIndex;
+ /**
+ * Create a new IndexedPropertyDescriptor by introspection.
+ * This form of constructor creates the PropertyDescriptor by
+ * looking for getter methods named <CODE>get&lt;name&gt;()</CODE>
+ * and setter methods named
+ * <CODE>set&lt;name&gt;()</CODE> in class
+ * <CODE>&lt;beanClass&gt;</CODE>, where &lt;name&gt; has its
+ * first letter capitalized by the constructor.<P>
+ *
+ * <B>Implementation note:</B> If there is a get(int) method,
+ * then the return type of that method is used to find the
+ * remaining methods. If there is no get method, then the
+ * set(int) method is searched for exhaustively and that type
+ * is used to find the others.<P>
+ *
+ * <B>Spec note:</B>
+ * If there is no get(int) method and multiple set(int) methods with
+ * the same name and the correct parameters (different type of course),
+ * then an IntrospectionException is thrown. While Sun's spec
+ * does not state this, it can make Bean behavior different on
+ * different systems (since method order is not guaranteed) and as
+ * such, can be treated as a bug in the spec. I am not aware of
+ * whether Sun's implementation catches this.
+ *
+ * @param name the programmatic name of the property, usually
+ * starting with a lowercase letter (e.g. fooManChu
+ * instead of FooManChu).
+ * @param beanClass the class the get and set methods live in.
+ *
+ * @exception IntrospectionException if the methods are not found or
+ * invalid.
+ */
+ public IndexedPropertyDescriptor(String name, Class beanClass)
+ throws IntrospectionException
+ {
+ super(name);
+ String capitalized;
+ try
+ {
+ capitalized = Character.toUpperCase(name.charAt(0))
+ + name.substring(1);
+ }
+ catch(StringIndexOutOfBoundsException e)
+ {
+ capitalized = "";
+ }
+ findMethods(beanClass, "get" + capitalized, "set" + capitalized,
+ "get" + capitalized, "set" + capitalized);
+ }
- /** Create a new IndexedPropertyDescriptor by introspection.
- ** This form of constructor creates the PropertyDescriptor by
- ** looking for getter methods named <CODE>get&lt;name&gt;()</CODE>
- ** and setter methods named
- ** <CODE>set&lt;name&gt;()</CODE> in class
- ** <CODE>&lt;beanClass&gt;</CODE>, where &lt;name&gt; has its
- ** first letter capitalized by the constructor.<P>
- **
- ** <B>Implementation note:</B> If there is a get(int) method,
- ** then the return type of that method is used to find the
- ** remaining methods. If there is no get method, then the
- ** set(int) method is searched for exhaustively and that type
- ** is used to find the others.<P>
- **
- ** <B>Spec note:</B>
- ** If there is no get(int) method and multiple set(int) methods with
- ** the same name and the correct parameters (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Class beanClass) throws IntrospectionException {
- super(name);
- String capitalized;
- try {
- capitalized = Character.toUpperCase(name.charAt(0)) + name.substring(1);
- } catch(StringIndexOutOfBoundsException e) {
- capitalized = "";
- }
- findMethods(beanClass, "get" + capitalized, "set" + capitalized, "get" + capitalized, "set" + capitalized);
- }
+ /**
+ * Create a new IndexedPropertyDescriptor by introspection.
+ * This form of constructor allows you to specify the
+ * names of the get and set methods to search for.<P>
+ *
+ * <B>Implementation note:</B> If there is a get(int) method,
+ * then the return type of that method is used to find the
+ * remaining methods. If there is no get method, then the
+ * set(int) method is searched for exhaustively and that type
+ * is used to find the others.<P>
+ *
+ * <B>Spec note:</B>
+ * If there is no get(int) method and multiple set(int) methods with
+ * the same name and the correct parameters (different type of course),
+ * then an IntrospectionException is thrown. While Sun's spec
+ * does not state this, it can make Bean behavior different on
+ * different systems (since method order is not guaranteed) and as
+ * such, can be treated as a bug in the spec. I am not aware of
+ * whether Sun's implementation catches this.
+ *
+ * @param name the programmatic name of the property, usually
+ * starting with a lowercase letter (e.g. fooManChu
+ * instead of FooManChu).
+ * @param beanClass the class the get and set methods live in.
+ * @param getMethodName the name of the get array method.
+ * @param setMethodName the name of the set array method.
+ * @param getIndexName the name of the get index method.
+ * @param setIndexName the name of the set index method.
+ *
+ * @exception IntrospectionException if the methods are not found or invalid.
+ */
+ public IndexedPropertyDescriptor(String name, Class beanClass,
+ String getMethodName, String setMethodName,
+ String getIndexName, String setIndexName)
+ throws IntrospectionException
+ {
+ super(name);
+ findMethods(beanClass, getMethodName, setMethodName, getIndexName,
+ setIndexName);
+ }
- /** Create a new IndexedPropertyDescriptor by introspection.
- ** This form of constructor allows you to specify the
- ** names of the get and set methods to search for.<P>
- **
- ** <B>Implementation note:</B> If there is a get(int) method,
- ** then the return type of that method is used to find the
- ** remaining methods. If there is no get method, then the
- ** set(int) method is searched for exhaustively and that type
- ** is used to find the others.<P>
- **
- ** <B>Spec note:</B>
- ** If there is no get(int) method and multiple set(int) methods with
- ** the same name and the correct parameters (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @param getMethodName the name of the get array method.
- ** @param setMethodName the name of the set array method.
- ** @param getIndexName the name of the get index method.
- ** @param setIndexName the name of the set index method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException {
- super(name);
- findMethods(beanClass, getMethodName, setMethodName, getIndexName, setIndexName);
- }
+ /**
+ * Create a new PropertyDescriptor using explicit Methods.
+ * Note that the methods will be checked for conformance to standard
+ * Property method rules, as described above at the top of this class.
+ *
+ * @param name the programmatic name of the property, usually
+ * starting with a lowercase letter (e.g. fooManChu
+ * instead of FooManChu).
+ * @param getMethod the get array method.
+ * @param setMethod the set array method.
+ * @param getIndex the get index method.
+ * @param setIndex the set index method.
+ *
+ * @exception IntrospectionException if the methods are not found or invalid.
+ */
+ public IndexedPropertyDescriptor(String name, Method getMethod,
+ Method setMethod, Method getIndex,
+ Method setIndex)
+ throws IntrospectionException
+ {
+ super(name);
+ if(getMethod != null && getMethod.getParameterTypes().length > 0)
+ throw new IntrospectionException("get method has parameters");
+ if(getMethod != null && setMethod.getParameterTypes().length != 1)
+ throw new IntrospectionException("set method does not have exactly one parameter");
+ if(getMethod != null && setMethod != null)
+ {
+ if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0]))
+ {
+ throw new IntrospectionException("set and get methods do not "
+ + "share the same type");
+ }
+ if(!getMethod.getDeclaringClass().isAssignableFrom
+ (setMethod.getDeclaringClass())
+ && !setMethod.getDeclaringClass().isAssignableFrom
+ (getMethod.getDeclaringClass()))
+ {
+ throw new IntrospectionException("set and get methods are not in "
+ + "the same class.");
+ }
+ }
- /** Create a new PropertyDescriptor using explicit Methods.
- ** Note that the methods will be checked for conformance to standard
- ** Property method rules, as described above at the top of this class.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param getMethod the get array method.
- ** @param setMethod the set array method.
- ** @param getIndex the get index method.
- ** @param setIndex the set index method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException {
- super(name);
- if(getMethod != null && getMethod.getParameterTypes().length > 0) {
- throw new IntrospectionException("get method has parameters");
- }
- if(getMethod != null && setMethod.getParameterTypes().length != 1) {
- throw new IntrospectionException("set method does not have exactly one parameter");
- }
- if(getMethod != null && setMethod != null) {
- if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) {
- throw new IntrospectionException("set and get methods do not share the same type");
- }
- if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass())
- && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) {
- throw new IntrospectionException("set and get methods are not in the same class.");
- }
- }
+ if (getIndex != null
+ && (getIndex.getParameterTypes().length != 1
+ || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE)))
+ {
+ throw new IntrospectionException("get index method has wrong "
+ + "parameters");
+ }
+ if (setIndex != null
+ && (setIndex.getParameterTypes().length != 2
+ || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE)))
+ {
+ throw new IntrospectionException("set index method has wrong "
+ + "parameters");
+ }
+ if (getIndex != null && setIndex != null)
+ {
+ if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1]))
+ {
+ throw new IntrospectionException("set index methods do not share "
+ + "the same type");
+ }
+ if(!getIndex.getDeclaringClass().isAssignableFrom
+ (setIndex.getDeclaringClass())
+ && !setIndex.getDeclaringClass().isAssignableFrom
+ (getIndex.getDeclaringClass()))
+ {
+ throw new IntrospectionException("get and set index methods are "
+ + "not in the same class.");
+ }
+ }
- if(getIndex != null && (getIndex.getParameterTypes().length != 1
- || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) {
- throw new IntrospectionException("get index method has wrong parameters");
- }
- if(setIndex != null && (setIndex.getParameterTypes().length != 2
- || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) {
- throw new IntrospectionException("set index method has wrong parameters");
- }
- if(getIndex != null && setIndex != null) {
- if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1])) {
- throw new IntrospectionException("set index methods do not share the same type");
- }
- if(!getIndex.getDeclaringClass().isAssignableFrom(setIndex.getDeclaringClass())
- && !setIndex.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) {
- throw new IntrospectionException("get and set index methods are not in the same class.");
- }
- }
+ if (getIndex != null && getMethod != null
+ && !getIndex.getDeclaringClass().isAssignableFrom
+ (getMethod.getDeclaringClass())
+ && !getMethod.getDeclaringClass().isAssignableFrom
+ (getIndex.getDeclaringClass()))
+ {
+ throw new IntrospectionException("methods are not in the same class.");
+ }
- if(getIndex != null && getMethod != null && !getIndex.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())
- && !getMethod.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) {
- throw new IntrospectionException("methods are not in the same class.");
- }
+ if (getIndex != null && getMethod != null
+ && !Array.newInstance(getIndex.getReturnType(),0)
+ .getClass().equals(getMethod.getReturnType()))
+ {
+ throw new IntrospectionException("array methods do not match index "
+ + "methods.");
+ }
- if(getIndex != null && getMethod != null && !Array.newInstance(getIndex.getReturnType(),0).getClass().equals(getMethod.getReturnType())) {
- throw new IntrospectionException("array methods do not match index methods.");
- }
+ this.getMethod = getMethod;
+ this.setMethod = setMethod;
+ this.getIndex = getIndex;
+ this.setIndex = setIndex;
+ this.indexedPropertyType = getIndex != null ? getIndex.getReturnType()
+ : setIndex.getParameterTypes()[1];
+ this.propertyType = getMethod != null ? getMethod.getReturnType()
+ : (setMethod != null ? setMethod.getParameterTypes()[0]
+ : Array.newInstance(this.indexedPropertyType,0).getClass());
+ }
- this.getMethod = getMethod;
- this.setMethod = setMethod;
- this.getIndex = getIndex;
- this.setIndex = setIndex;
- this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1];
- this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass());
- }
+ public Class getIndexedPropertyType()
+ {
+ return indexedPropertyType;
+ }
- public Class getIndexedPropertyType() {
- return indexedPropertyType;
- }
+ public Method getIndexedReadMethod()
+ {
+ return getIndex;
+ }
- public Method getIndexedReadMethod() {
- return getIndex;
- }
+ /**
+ * Sets the method that is used to read an indexed property.
+ *
+ * @param m the method to set
+ */
+ public void setIndexedReadMethod(Method m) throws IntrospectionException
+ {
+ getIndex = m;
+ }
- public Method getIndexedWriteMethod() {
- return setIndex;
- }
+ public Method getIndexedWriteMethod()
+ {
+ return setIndex;
+ }
- private void findMethods(Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException {
- try {
- if(getIndexName != null) {
- try {
- Class[] getArgs = new Class[1];
- getArgs[0] = java.lang.Integer.TYPE;
- getIndex = beanClass.getMethod(getIndexName,getArgs);
- indexedPropertyType = getIndex.getReturnType();
- } catch(NoSuchMethodException E) {
- }
- }
- if(getIndex != null) {
- if(setIndexName != null) {
- try {
- Class[] setArgs = new Class[2];
- setArgs[0] = java.lang.Integer.TYPE;
- setArgs[1] = indexedPropertyType;
- setIndex = beanClass.getMethod(setIndexName,setArgs);
- if(!setIndex.getReturnType().equals(java.lang.Void.TYPE)) {
- throw new IntrospectionException(setIndexName + " has non-void return type");
- }
- } catch(NoSuchMethodException E) {
- }
- }
- } else if(setIndexName != null) {
- Method[] m = beanClass.getMethods();
- for(int i=0;i<m.length;i++) {
- Method current = m[i];
- if(current.getName().equals(setIndexName)
- && current.getParameterTypes().length == 2
- && (current.getParameterTypes()[0]).equals(java.lang.Integer.TYPE)
- && current.getReturnType().equals(java.lang.Void.TYPE)) {
- if(setIndex != null) {
- throw new IntrospectionException("Multiple, different set methods found that fit the bill!");
- } else {
- setIndex = current;
- indexedPropertyType = current.getParameterTypes()[1];
- }
- }
- }
- if(setIndex == null) {
- throw new IntrospectionException("Cannot find get or set methods.");
- }
- } else {
- throw new IntrospectionException("Cannot find get or set methods.");
- }
+ /**
+ * Sets the method that is used to write an indexed property.
+ *
+ * @param m the method to set
+ */
+ public void setIndexedWriteMethod(Method m) throws IntrospectionException
+ {
+ setIndex = m;
+ }
- Class arrayType = Array.newInstance(indexedPropertyType,0).getClass();
+ private void findMethods(Class beanClass, String getMethodName,
+ String setMethodName, String getIndexName,
+ String setIndexName)
+ throws IntrospectionException
+ {
+ try
+ {
+ if(getIndexName != null)
+ {
+ try
+ {
+ Class[] getArgs = new Class[1];
+ getArgs[0] = java.lang.Integer.TYPE;
+ getIndex = beanClass.getMethod(getIndexName,getArgs);
+ indexedPropertyType = getIndex.getReturnType();
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+ }
+ if(getIndex != null)
+ {
+ if(setIndexName != null)
+ {
+ try
+ {
+ Class[] setArgs = new Class[2];
+ setArgs[0] = java.lang.Integer.TYPE;
+ setArgs[1] = indexedPropertyType;
+ setIndex = beanClass.getMethod(setIndexName,setArgs);
+ if(!setIndex.getReturnType().equals(java.lang.Void.TYPE))
+ {
+ throw new IntrospectionException(setIndexName
+ + " has non-void return type");
+ }
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+ }
+ }
+ else if(setIndexName != null)
+ {
+ Method[] m = beanClass.getMethods();
+ for(int i=0;i<m.length;i++)
+ {
+ Method current = m[i];
+ if(current.getName().equals(setIndexName)
+ && current.getParameterTypes().length == 2
+ && (current.getParameterTypes()[0])
+ .equals(java.lang.Integer.TYPE)
+ && current.getReturnType().equals(java.lang.Void.TYPE))
+ {
+ if(setIndex != null)
+ {
+ throw new IntrospectionException("Multiple, different "
+ + "set methods found that fit the bill!");
+ }
+ else
+ {
+ setIndex = current;
+ indexedPropertyType = current.getParameterTypes()[1];
+ }
+ }
+ }
+ if(setIndex == null)
+ {
+ throw new IntrospectionException("Cannot find get or set "
+ + "methods.");
+ }
+ }
+ else
+ {
+ throw new IntrospectionException("Cannot find get or set methods.");
+ }
- Class[] setArgs = new Class[1];
- setArgs[0] = arrayType;
- try {
- setMethod = beanClass.getMethod(setMethodName,setArgs);
- if(!setMethod.getReturnType().equals(java.lang.Void.TYPE)) {
- setMethod = null;
- }
- } catch(NoSuchMethodException E) {
- }
+ Class arrayType = Array.newInstance(indexedPropertyType,0).getClass();
- Class[] getArgs = new Class[0];
- try {
- getMethod = beanClass.getMethod(getMethodName,getArgs);
- if(!getMethod.getReturnType().equals(arrayType)) {
- getMethod = null;
- }
- } catch(NoSuchMethodException E) {
- }
- } catch(SecurityException E) {
- throw new IntrospectionException("SecurityException while trying to find methods.");
- }
- }
+ Class[] setArgs = new Class[1];
+ setArgs[0] = arrayType;
+ try
+ {
+ setMethod = beanClass.getMethod(setMethodName,setArgs);
+ if (!setMethod.getReturnType().equals(java.lang.Void.TYPE))
+ {
+ setMethod = null;
+ }
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+
+ Class[] getArgs = new Class[0];
+ try
+ {
+ getMethod = beanClass.getMethod(getMethodName,getArgs);
+ if (!getMethod.getReturnType().equals(arrayType))
+ {
+ getMethod = null;
+ }
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+ }
+ catch(SecurityException E)
+ {
+ throw new IntrospectionException("SecurityException while trying to "
+ + "find methods.");
+ }
+ }
}
diff --git a/libjava/classpath/java/beans/PropertyDescriptor.java b/libjava/classpath/java/beans/PropertyDescriptor.java
index 416d468576f..a22d6252e28 100644
--- a/libjava/classpath/java/beans/PropertyDescriptor.java
+++ b/libjava/classpath/java/beans/PropertyDescriptor.java
@@ -61,7 +61,6 @@ import java.lang.reflect.Method;
** @since 1.1
** @status updated to 1.4
**/
-
public class PropertyDescriptor extends FeatureDescriptor
{
Class propertyType;
@@ -521,6 +520,22 @@ public class PropertyDescriptor extends FeatureDescriptor
return newPropertyType;
}
+ /**
+ * Return a hash code for this object, conforming to the contract described
+ * in {@link Object#hashCode()}.
+ * @return the hash code
+ * @since 1.5
+ */
+ public int hashCode()
+ {
+ return ((propertyType == null ? 0 : propertyType.hashCode())
+ | (propertyEditorClass == null ? 0 : propertyEditorClass.hashCode())
+ | (bound ? Boolean.TRUE : Boolean.FALSE).hashCode()
+ | (constrained ? Boolean.TRUE : Boolean.FALSE).hashCode()
+ | (getMethod == null ? 0 : getMethod.hashCode())
+ | (setMethod == null ? 0 : setMethod.hashCode()));
+ }
+
/** Compares this <code>PropertyDescriptor</code> against the
* given object.
* Two PropertyDescriptors are equals if
diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java
index b7c4a49d8a9..5455adbaec3 100644
--- a/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java
@@ -61,7 +61,7 @@ public class BeanContextServicesSupport
protected class BCSSChild
extends BeanContextSupport.BCSChild
{
- private static final long serialVersionUID = -6848044915271367103L;
+ private static final long serialVersionUID = -3263851306889194873L;
}
protected class BCSSProxyServiceProvider
diff --git a/libjava/classpath/java/beans/beancontext/BeanContextSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextSupport.java
index 7e024e23a13..60ccc3af3e4 100644
--- a/libjava/classpath/java/beans/beancontext/BeanContextSupport.java
+++ b/libjava/classpath/java/beans/beancontext/BeanContextSupport.java
@@ -79,7 +79,7 @@ public class BeanContextSupport extends BeanContextChildSupport
protected class BCSChild implements Serializable
{
- private static final long serialVersionUID = 3289144128843950629L;
+ private static final long serialVersionUID = -5815286101609939109L;
}
protected static final class BCSIterator implements Iterator
diff --git a/libjava/classpath/java/io/ByteArrayOutputStream.java b/libjava/classpath/java/io/ByteArrayOutputStream.java
index e996ebbc70f..4196523d28e 100644
--- a/libjava/classpath/java/io/ByteArrayOutputStream.java
+++ b/libjava/classpath/java/io/ByteArrayOutputStream.java
@@ -1,5 +1,6 @@
/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -192,7 +193,7 @@ public class ByteArrayOutputStream extends OutputStream
*/
public String toString (int hibyte)
{
- return new String (buf, 0, count, hibyte);
+ return new String (buf, hibyte, 0, count);
}
// Resize buffer to accommodate new bytes.
diff --git a/libjava/classpath/java/io/DataOutputStream.java b/libjava/classpath/java/io/DataOutputStream.java
index 39f7ed1ff24..25178160dc8 100644
--- a/libjava/classpath/java/io/DataOutputStream.java
+++ b/libjava/classpath/java/io/DataOutputStream.java
@@ -302,7 +302,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs
*
- * @see writeInt
+ * @see #writeInt(int)
* @see DataInput#readFloat
* @see Float#floatToIntBits
*/
@@ -326,7 +326,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs
*
- * @see writeLong
+ * @see #writeLong(long)
* @see DataInput#readDouble
* @see Double#doubleToLongBits
*/
@@ -363,7 +363,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs
*
- * @see writeChar
+ * @see #writeChar(char)
*/
public final void writeChars (String value) throws IOException
{
diff --git a/libjava/classpath/java/io/File.java b/libjava/classpath/java/io/File.java
index 3b747e6bd03..3c7ac21301c 100644
--- a/libjava/classpath/java/io/File.java
+++ b/libjava/classpath/java/io/File.java
@@ -100,6 +100,17 @@ public class File implements Serializable, Comparable
* may be an absolute or relative path name.
*/
private String path;
+
+
+ /**
+ * The time (millisecond), when the last temporary file was created.
+ */
+ private static long last_tmp;
+
+ /**
+ * The number of files, created during the current millisecond.
+ */
+ private static int n_created;
/**
* This method tests whether or not the current thread is allowed to
@@ -446,6 +457,8 @@ public class File implements Serializable, Comparable
else
return drvDir;
}
+ else if (path.equals(""))
+ return System.getProperty ("user.dir");
else
return System.getProperty ("user.dir") + separatorChar + path;
}
@@ -532,6 +545,9 @@ public class File implements Serializable, Comparable
{
String prefix = null;
int nameSeqIndex = 0;
+
+ if (path.equals(""))
+ return null;
// The "prefix", if present, is the leading "/" on UNIX and
// either the drive specifier (e.g. "C:") or the leading "\\"
@@ -943,8 +959,8 @@ public class File implements Serializable, Comparable
public URI toURI()
{
String abspath = getAbsolutePath();
-
- if (isDirectory())
+
+ if (isDirectory() || path.equals(""))
abspath = abspath + separatorChar;
if (separatorChar == '\\')
@@ -1059,7 +1075,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
- public static File createTempFile(String prefix, String suffix,
+ public static synchronized File createTempFile(String prefix, String suffix,
File directory)
throws IOException
{
@@ -1091,10 +1107,23 @@ public class File implements Serializable, Comparable
// Now identify a file name and make sure it doesn't exist.
File file;
if (!VMFile.IS_DOS_8_3)
- {
+ {
do
{
- String filename = prefix + System.currentTimeMillis() + suffix;
+ long now = System.currentTimeMillis();
+ if (now > last_tmp)
+ {
+ // The last temporary file was created more than 1 ms ago.
+ last_tmp = now;
+ n_created = 0;
+ }
+ else
+ n_created++;
+
+ String name = Long.toHexString(now);
+ if (n_created > 0)
+ name += '_'+Integer.toHexString(n_created);
+ String filename = prefix + name + suffix;
file = new File(directory, filename);
}
while (VMFile.exists(file.path));
diff --git a/libjava/classpath/java/io/FileWriter.java b/libjava/classpath/java/io/FileWriter.java
index b34db83231e..ce18efe5e39 100644
--- a/libjava/classpath/java/io/FileWriter.java
+++ b/libjava/classpath/java/io/FileWriter.java
@@ -119,7 +119,7 @@ public class FileWriter extends OutputStreamWriter
* This method intializes a new <code>FileWriter</code> object to
* write to the
* specified named file. This form of the constructor allows the caller
- * to determin whether data should be written starting at the beginning or
+ * to determine whether data should be written starting at the beginning or
* the end of the file.
*
* @param name The name of the file to write to
diff --git a/libjava/classpath/java/io/FilterReader.java b/libjava/classpath/java/io/FilterReader.java
index 2bd040a7f72..1abaa8a4b68 100644
--- a/libjava/classpath/java/io/FilterReader.java
+++ b/libjava/classpath/java/io/FilterReader.java
@@ -131,7 +131,7 @@ public abstract class FilterReader extends Reader
/**
* Calls the <code>in.skip(long)</code> method
*
- * @param numBytes The requested number of chars to skip.
+ * @param num_chars The requested number of chars to skip.
*
* @return The value returned from <code>in.skip(long)</code>
*
diff --git a/libjava/classpath/java/io/InputStreamReader.java b/libjava/classpath/java/io/InputStreamReader.java
index 315af83e1a4..57cdc53ed22 100644
--- a/libjava/classpath/java/io/InputStreamReader.java
+++ b/libjava/classpath/java/io/InputStreamReader.java
@@ -38,16 +38,14 @@ exception statement from your version. */
package java.io;
-import java.nio.charset.UnsupportedCharsetException;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
+import gnu.java.nio.charset.EncodingHelper;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
-import gnu.java.nio.charset.EncodingHelper;
+import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
/**
* This class reads characters from a byte input stream. The characters
@@ -251,8 +249,12 @@ public class InputStreamReader extends Reader
this.in = in;
this.decoder = decoder;
+ Charset charset = decoder.charset();
try {
- maxBytesPerChar = decoder.charset().newEncoder().maxBytesPerChar();
+ if (charset == null)
+ maxBytesPerChar = 1f;
+ else
+ maxBytesPerChar = charset.newEncoder().maxBytesPerChar();
} catch(UnsupportedOperationException _){
maxBytesPerChar = 1f;
}
@@ -260,7 +262,10 @@ public class InputStreamReader extends Reader
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
decoder.reset();
- encoding = EncodingHelper.getOldCanonical(decoder.charset().name());
+ if (charset == null)
+ encoding = "US-ASCII";
+ else
+ encoding = EncodingHelper.getOldCanonical(decoder.charset().name());
}
/**
diff --git a/libjava/classpath/java/io/LineNumberReader.java b/libjava/classpath/java/io/LineNumberReader.java
index ea418a5e4d6..5e263f76111 100644
--- a/libjava/classpath/java/io/LineNumberReader.java
+++ b/libjava/classpath/java/io/LineNumberReader.java
@@ -115,7 +115,7 @@ public class LineNumberReader extends BufferedReader
/**
* This method sets the current line number to the specified value.
*
- * @param line_number The new line number
+ * @param lineNumber The new line number
*/
public void setLineNumber(int lineNumber)
{
@@ -139,7 +139,7 @@ public class LineNumberReader extends BufferedReader
* is called, the line number will be restored to the saved line number in
* addition to the stream position.
*
- * @param readlimit The number of chars that can be read before the
+ * @param readLimit The number of chars that can be read before the
* mark becomes invalid
*
* @exception IOException If an error occurs
@@ -269,7 +269,7 @@ public class LineNumberReader extends BufferedReader
*
* @param buf The array into which the chars read should be stored
* @param offset The offset into the array to start storing chars
- * @param len The requested number of chars to read
+ * @param count The requested number of chars to read
*
* @return The actual number of chars read, or -1 if end of stream
*
diff --git a/libjava/classpath/java/io/ObjectInputStream.java b/libjava/classpath/java/io/ObjectInputStream.java
index 54d5eeafadd..98a11dae3e1 100644
--- a/libjava/classpath/java/io/ObjectInputStream.java
+++ b/libjava/classpath/java/io/ObjectInputStream.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.io;
-import gnu.classpath.Configuration;
import gnu.java.io.ObjectIdentityWrapper;
import java.lang.reflect.Array;
@@ -53,6 +52,8 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.TreeSet;
import java.util.Vector;
public class ObjectInputStream extends InputStream
@@ -91,7 +92,6 @@ public class ObjectInputStream extends InputStream
}
this.resolveEnabled = false;
- this.isDeserializing = false;
this.blockDataPosition = 0;
this.blockDataBytes = 0;
this.blockData = new byte[BUFFER_SIZE];
@@ -99,7 +99,6 @@ public class ObjectInputStream extends InputStream
this.realInputStream = new DataInputStream(in);
this.nextOID = baseWireHandle;
this.objectLookupTable = new Hashtable();
- this.validators = new Vector();
this.classLookupTable = new Hashtable();
setBlockDataMode(true);
readStreamHeader();
@@ -113,7 +112,10 @@ public class ObjectInputStream extends InputStream
* <code>private void readObject (ObjectInputStream)</code>.
*
* If an exception is thrown from this method, the stream is left in
- * an undefined state.
+ * an undefined state. This method can also throw Errors and
+ * RuntimeExceptions if caused by existing readResolve() user code.
+ *
+ * @return The object read from the underlying stream.
*
* @exception ClassNotFoundException The class that an object being
* read in belongs to cannot be found.
@@ -121,291 +123,312 @@ public class ObjectInputStream extends InputStream
* @exception IOException Exception from underlying
* <code>InputStream</code>.
*/
- public final Object readObject() throws ClassNotFoundException, IOException
+ public final Object readObject()
+ throws ClassNotFoundException, IOException
{
if (this.useSubclassMethod)
return readObjectOverride();
- boolean was_deserializing;
-
Object ret_val;
- was_deserializing = this.isDeserializing;
-
- boolean is_consumed = false;
boolean old_mode = setBlockDataMode(false);
-
- this.isDeserializing = true;
-
byte marker = this.realInputStream.readByte();
- depth += 2;
+ if (DEBUG)
+ depth += 2;
if(dump) dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " ");
try
{
- switch (marker)
- {
- case TC_ENDBLOCKDATA:
- {
- ret_val = null;
- is_consumed = true;
- break;
- }
-
- case TC_BLOCKDATA:
- case TC_BLOCKDATALONG:
- {
- if (marker == TC_BLOCKDATALONG)
- { if(dump) dumpElementln("BLOCKDATALONG"); }
- else
- { if(dump) dumpElementln("BLOCKDATA"); }
- readNextBlock(marker);
- throw new StreamCorruptedException("Unexpected blockData");
- }
-
- case TC_NULL:
- {
- if(dump) dumpElementln("NULL");
- ret_val = null;
- break;
- }
-
- case TC_REFERENCE:
- {
- if(dump) dumpElement("REFERENCE ");
- Integer oid = new Integer(this.realInputStream.readInt());
- if(dump) dumpElementln(Integer.toHexString(oid.intValue()));
- ret_val = ((ObjectIdentityWrapper)
- this.objectLookupTable.get(oid)).object;
- break;
- }
-
- case TC_CLASS:
- {
- if(dump) dumpElementln("CLASS");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class clazz = osc.forClass();
- assignNewHandle(clazz);
- ret_val = clazz;
- break;
- }
+ ret_val = parseContent(marker);
+ }
+ finally
+ {
+ setBlockDataMode(old_mode);
+ if (DEBUG)
+ depth -= 2;
+ }
+
+ return ret_val;
+ }
- case TC_PROXYCLASSDESC:
+ /**
+ * Handles a content block within the stream, which begins with a marker
+ * byte indicating its type.
+ *
+ * @param marker the byte marker.
+ * @return an object which represents the parsed content.
+ * @throws ClassNotFoundException if the class of an object being
+ * read in cannot be found.
+ * @throws IOException if invalid data occurs or one is thrown by the
+ * underlying <code>InputStream</code>.
+ */
+ private Object parseContent(byte marker)
+ throws ClassNotFoundException, IOException
+ {
+ Object ret_val;
+ boolean is_consumed = false;
+
+ switch (marker)
+ {
+ case TC_ENDBLOCKDATA:
+ {
+ ret_val = null;
+ is_consumed = true;
+ break;
+ }
+
+ case TC_BLOCKDATA:
+ case TC_BLOCKDATALONG:
+ {
+ if (marker == TC_BLOCKDATALONG)
+ { if(dump) dumpElementln("BLOCKDATALONG"); }
+ else
+ { if(dump) dumpElementln("BLOCKDATA"); }
+ readNextBlock(marker);
+ }
+
+ case TC_NULL:
+ {
+ if(dump) dumpElementln("NULL");
+ ret_val = null;
+ break;
+ }
+
+ case TC_REFERENCE:
+ {
+ if(dump) dumpElement("REFERENCE ");
+ Integer oid = new Integer(this.realInputStream.readInt());
+ if(dump) dumpElementln(Integer.toHexString(oid.intValue()));
+ ret_val = ((ObjectIdentityWrapper)
+ this.objectLookupTable.get(oid)).object;
+ break;
+ }
+
+ case TC_CLASS:
+ {
+ if(dump) dumpElementln("CLASS");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class clazz = osc.forClass();
+ assignNewHandle(clazz);
+ ret_val = clazz;
+ break;
+ }
+
+ case TC_PROXYCLASSDESC:
+ {
+ if(dump) dumpElementln("PROXYCLASS");
+ int n_intf = this.realInputStream.readInt();
+ String[] intfs = new String[n_intf];
+ for (int i = 0; i < n_intf; i++)
+ {
+ intfs[i] = this.realInputStream.readUTF();
+ }
+
+ boolean oldmode = setBlockDataMode(true);
+ Class cl = resolveProxyClass(intfs);
+ setBlockDataMode(oldmode);
+
+ ObjectStreamClass osc = lookupClass(cl);
+ if (osc.firstNonSerializableParentConstructor == null)
+ {
+ osc.realClassIsSerializable = true;
+ osc.fields = osc.fieldMapping = new ObjectStreamField[0];
+ try
+ {
+ osc.firstNonSerializableParentConstructor =
+ Object.class.getConstructor(new Class[0]);
+ }
+ catch (NoSuchMethodException x)
+ {
+ throw (InternalError)
+ new InternalError("Object ctor missing").initCause(x);
+ }
+ }
+ assignNewHandle(osc);
+
+ if (!is_consumed)
+ {
+ byte b = this.realInputStream.readByte();
+ if (b != TC_ENDBLOCKDATA)
+ throw new IOException("Data annotated to class was not consumed." + b);
+ }
+ else
+ is_consumed = false;
+ ObjectStreamClass superosc = (ObjectStreamClass)readObject();
+ osc.setSuperclass(superosc);
+ ret_val = osc;
+ break;
+ }
+
+ case TC_CLASSDESC:
+ {
+ ObjectStreamClass osc = readClassDescriptor();
+
+ if (!is_consumed)
+ {
+ byte b = this.realInputStream.readByte();
+ if (b != TC_ENDBLOCKDATA)
+ throw new IOException("Data annotated to class was not consumed." + b);
+ }
+ else
+ is_consumed = false;
+
+ osc.setSuperclass ((ObjectStreamClass)readObject());
+ ret_val = osc;
+ break;
+ }
+
+ case TC_STRING:
+ case TC_LONGSTRING:
+ {
+ if(dump) dumpElement("STRING=");
+ String s = this.realInputStream.readUTF();
+ if(dump) dumpElementln(s);
+ ret_val = processResolution(null, s, assignNewHandle(s));
+ break;
+ }
+
+ case TC_ARRAY:
+ {
+ if(dump) dumpElementln("ARRAY");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class componentType = osc.forClass().getComponentType();
+ if(dump) dumpElement("ARRAY LENGTH=");
+ int length = this.realInputStream.readInt();
+ if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
+ Object array = Array.newInstance(componentType, length);
+ int handle = assignNewHandle(array);
+ readArrayElements(array, componentType);
+ if(dump)
+ for (int i = 0, len = Array.getLength(array); i < len; i++)
+ dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
+ ret_val = processResolution(null, array, handle);
+ break;
+ }
+
+ case TC_OBJECT:
+ {
+ if(dump) dumpElementln("OBJECT");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class clazz = osc.forClass();
+
+ if (!osc.realClassIsSerializable)
+ throw new NotSerializableException
+ (clazz + " is not Serializable, and thus cannot be deserialized.");
+
+ if (osc.realClassIsExternalizable)
{
- if(dump) dumpElementln("PROXYCLASS");
- int n_intf = this.realInputStream.readInt();
- String[] intfs = new String[n_intf];
- for (int i = 0; i < n_intf; i++)
- {
- intfs[i] = this.realInputStream.readUTF();
- System.out.println(intfs[i]);
- }
+ Externalizable obj = osc.newInstance();
- boolean oldmode = setBlockDataMode(true);
- Class cl = resolveProxyClass(intfs);
- setBlockDataMode(oldmode);
+ int handle = assignNewHandle(obj);
- ObjectStreamClass osc = lookupClass(cl);
- assignNewHandle(osc);
+ boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
- if (!is_consumed)
- {
- byte b = this.realInputStream.readByte();
- if (b != TC_ENDBLOCKDATA)
- throw new IOException("Data annotated to class was not consumed." + b);
- }
- else
- is_consumed = false;
- ObjectStreamClass superosc = (ObjectStreamClass)readObject();
- osc.setSuperclass(superosc);
- ret_val = osc;
- break;
- }
-
- case TC_CLASSDESC:
- {
- ObjectStreamClass osc = readClassDescriptor();
+ boolean oldmode = this.readDataFromBlock;
+ if (read_from_blocks)
+ setBlockDataMode(true);
- if (!is_consumed)
- {
- byte b = this.realInputStream.readByte();
- if (b != TC_ENDBLOCKDATA)
- throw new IOException("Data annotated to class was not consumed." + b);
+ obj.readExternal(this);
+
+ if (read_from_blocks)
+ {
+ setBlockDataMode(oldmode);
+ if (!oldmode)
+ if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
+ throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
}
- else
- is_consumed = false;
-
- osc.setSuperclass ((ObjectStreamClass)readObject());
- ret_val = osc;
- break;
- }
-
- case TC_STRING:
- case TC_LONGSTRING:
- {
- if(dump) dumpElement("STRING=");
- String s = this.realInputStream.readUTF();
- if(dump) dumpElementln(s);
- ret_val = processResolution(null, s, assignNewHandle(s));
- break;
- }
-
- case TC_ARRAY:
- {
- if(dump) dumpElementln("ARRAY");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class componentType = osc.forClass().getComponentType();
- if(dump) dumpElement("ARRAY LENGTH=");
- int length = this.realInputStream.readInt();
- if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
- Object array = Array.newInstance(componentType, length);
- int handle = assignNewHandle(array);
- readArrayElements(array, componentType);
- if(dump)
- for (int i = 0, len = Array.getLength(array); i < len; i++)
- dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
- ret_val = processResolution(null, array, handle);
- break;
- }
-
- case TC_OBJECT:
- {
- if(dump) dumpElementln("OBJECT");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class clazz = osc.forClass();
-
- if (!osc.realClassIsSerializable)
- throw new NotSerializableException
- (clazz + " is not Serializable, and thus cannot be deserialized.");
-
- if (osc.realClassIsExternalizable)
- {
- Externalizable obj = osc.newInstance();
-
- int handle = assignNewHandle(obj);
-
- boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
-
- boolean oldmode = this.readDataFromBlock;
- if (read_from_blocks)
- setBlockDataMode(true);
-
- obj.readExternal(this);
-
- if (read_from_blocks)
- {
- setBlockDataMode(oldmode);
- if (!oldmode)
- if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
- throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
- }
-
- ret_val = processResolution(osc, obj, handle);
- break;
- } // end if (osc.realClassIsExternalizable)
- Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
-
- int handle = assignNewHandle(obj);
- Object prevObject = this.currentObject;
- ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
-
- this.currentObject = obj;
- ObjectStreamClass[] hierarchy =
- inputGetObjectStreamClasses(clazz);
+ ret_val = processResolution(osc, obj, handle);
+ break;
- for (int i = 0; i < hierarchy.length; i++)
- {
- this.currentObjectStreamClass = hierarchy[i];
-
- if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
-
- // XXX: should initialize fields in classes in the hierarchy
- // that aren't in the stream
- // should skip over classes in the stream that aren't in the
- // real classes hierarchy
-
- Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
- if (readObjectMethod != null)
- {
- fieldsAlreadyRead = false;
- boolean oldmode = setBlockDataMode(true);
- callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
- setBlockDataMode(oldmode);
- }
- else
- {
- readFields(obj, currentObjectStreamClass);
- }
-
- if (this.currentObjectStreamClass.hasWriteMethod())
- {
- if(dump) dumpElement("ENDBLOCKDATA? ");
- try
- {
- // FIXME: XXX: This try block is to
- // catch EOF which is thrown for some
- // objects. That indicates a bug in
- // the logic.
-
- if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
- throw new IOException
- ("No end of block data seen for class with readObject (ObjectInputStream) method.");
- if(dump) dumpElementln("yes");
- }
-// catch (EOFException e)
-// {
-// if(dump) dumpElementln("no, got EOFException");
-// }
- catch (IOException e)
- {
- if(dump) dumpElementln("no, got IOException");
+ } // end if (osc.realClassIsExternalizable)
+
+ Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
+
+ int handle = assignNewHandle(obj);
+ Object prevObject = this.currentObject;
+ ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
+ TreeSet prevObjectValidators = this.currentObjectValidators;
+
+ this.currentObject = obj;
+ this.currentObjectValidators = null;
+ ObjectStreamClass[] hierarchy =
+ inputGetObjectStreamClasses(clazz);
+
+ for (int i = 0; i < hierarchy.length; i++)
+ {
+ this.currentObjectStreamClass = hierarchy[i];
+ if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
+
+ // XXX: should initialize fields in classes in the hierarchy
+ // that aren't in the stream
+ // should skip over classes in the stream that aren't in the
+ // real classes hierarchy
+
+ Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
+ if (readObjectMethod != null)
+ {
+ fieldsAlreadyRead = false;
+ boolean oldmode = setBlockDataMode(true);
+ callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
+ setBlockDataMode(oldmode);
+ }
+ else
+ {
+ readFields(obj, currentObjectStreamClass);
+ }
+
+ if (this.currentObjectStreamClass.hasWriteMethod())
+ {
+ if(dump) dumpElement("ENDBLOCKDATA? ");
+ try
+ {
+ /* Read blocks until an end marker */
+ byte writeMarker = this.realInputStream.readByte();
+ while (writeMarker != TC_ENDBLOCKDATA)
+ {
+ parseContent(writeMarker);
+ writeMarker = this.realInputStream.readByte();
}
+ if(dump) dumpElementln("yes");
+ }
+ catch (EOFException e)
+ {
+ throw (IOException) new IOException
+ ("No end of block data seen for class with readObject (ObjectInputStream) method.").initCause(e);
}
}
-
- this.currentObject = prevObject;
- this.currentObjectStreamClass = prevObjectStreamClass;
- ret_val = processResolution(osc, obj, handle);
-
- break;
- }
-
- case TC_RESET:
- if(dump) dumpElementln("RESET");
- clearHandles();
- ret_val = readObject();
- break;
-
- case TC_EXCEPTION:
- {
- if(dump) dumpElement("EXCEPTION=");
- Exception e = (Exception)readObject();
- if(dump) dumpElementln(e.toString());
- clearHandles();
- throw new WriteAbortedException("Exception thrown during writing of stream", e);
}
-
- default:
- throw new IOException("Unknown marker on stream: " + marker);
- }
- }
- finally
- {
- setBlockDataMode(old_mode);
+
+ this.currentObject = prevObject;
+ this.currentObjectStreamClass = prevObjectStreamClass;
+ ret_val = processResolution(osc, obj, handle);
+ if (currentObjectValidators != null)
+ invokeValidators();
+ this.currentObjectValidators = prevObjectValidators;
+
+ break;
+ }
- this.isDeserializing = was_deserializing;
+ case TC_RESET:
+ if(dump) dumpElementln("RESET");
+ clearHandles();
+ ret_val = readObject();
+ break;
- depth -= 2;
+ case TC_EXCEPTION:
+ {
+ if(dump) dumpElement("EXCEPTION=");
+ Exception e = (Exception)readObject();
+ if(dump) dumpElementln(e.toString());
+ clearHandles();
+ throw new WriteAbortedException("Exception thrown during writing of stream", e);
+ }
- if (! was_deserializing)
- {
- if (validators.size() > 0)
- invokeValidators();
- }
+ default:
+ throw new IOException("Unknown marker on stream: " + marker);
}
-
return ret_val;
}
@@ -716,8 +739,10 @@ public class ObjectInputStream extends InputStream
throw new InvalidObjectException("attempt to add a null "
+ "ObjectInputValidation object");
- this.validators.addElement(new ValidatorAndPriority (validator,
- priority));
+ if (currentObjectValidators == null)
+ currentObjectValidators = new TreeSet();
+
+ currentObjectValidators.add(new ValidatorAndPriority(validator, priority));
}
@@ -805,7 +830,7 @@ public class ObjectInputStream extends InputStream
/**
* Reconstruct class hierarchy the same way
- * {@link java.io.ObjectStreamClass.getObjectStreamClasses(java.lang.Class)} does
+ * {@link java.io.ObjectStreamClass#getObjectStreamClasses(Class)} does
* but using lookupClass instead of ObjectStreamClass.lookup. This
* dup is necessary localize the lookup table. Hopefully some future
* rewritings will be able to prevent this.
@@ -874,7 +899,7 @@ public class ObjectInputStream extends InputStream
}
else
for (int i = 0; i < intfs.length; i++)
- clss[i] = cl.loadClass(intfs[i]);
+ clss[i] = Class.forName(intfs[i], false, cl);
try
{
return Proxy.getProxyClass(cl, clss);
@@ -1195,7 +1220,7 @@ public class ObjectInputStream extends InputStream
* This method should be called by a method called 'readObject' in the
* deserializing class (if present). It cannot (and should not)be called
* outside of it. Its goal is to read all fields in the real input stream
- * and keep them accessible through the {@link #GetField} class. Calling
+ * and keep them accessible through the {@link GetField} class. Calling
* this method will not alter the deserializing object.
*
* @return A valid freshly created 'GetField' instance to get access to
@@ -1543,8 +1568,15 @@ public class ObjectInputStream extends InputStream
catch (IllegalAccessException ignore)
{
}
- catch (InvocationTargetException ignore)
+ catch (InvocationTargetException exception)
{
+ Throwable cause = exception.getCause();
+ if (cause instanceof ObjectStreamException)
+ throw (ObjectStreamException) cause;
+ else if (cause instanceof RuntimeException)
+ throw (RuntimeException) cause;
+ else if (cause instanceof Error)
+ throw (Error) cause;
}
}
@@ -1821,18 +1853,19 @@ public class ObjectInputStream extends InputStream
// on OBJ
private void invokeValidators() throws InvalidObjectException
{
- Object[] validators = new Object[this.validators.size()];
- this.validators.copyInto (validators);
- Arrays.sort (validators);
-
try
{
- for (int i=0; i < validators.length; i++)
- ((ObjectInputValidation)validators[i]).validateObject();
+ Iterator it = currentObjectValidators.iterator();
+ while(it.hasNext())
+ {
+ ValidatorAndPriority vap = (ValidatorAndPriority) it.next();
+ ObjectInputValidation validator = vap.validator;
+ validator.validateObject();
+ }
}
finally
{
- this.validators.removeAllElements();
+ currentObjectValidators = null;
}
}
@@ -1881,10 +1914,9 @@ public class ObjectInputStream extends InputStream
private Hashtable objectLookupTable;
private Object currentObject;
private ObjectStreamClass currentObjectStreamClass;
+ private TreeSet currentObjectValidators;
private boolean readDataFromBlock;
- private boolean isDeserializing;
private boolean fieldsAlreadyRead;
- private Vector validators;
private Hashtable classLookupTable;
private GetField prereadFields;
@@ -1908,14 +1940,6 @@ public class ObjectInputStream extends InputStream
System.out.print (Thread.currentThread() + ": ");
}
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary ("javaio");
- }
- }
-
// used to keep a prioritized list of object validators
private static final class ValidatorAndPriority implements Comparable
{
diff --git a/libjava/classpath/java/io/ObjectOutputStream.java b/libjava/classpath/java/io/ObjectOutputStream.java
index 5e754c5ec7a..573b9cfa1de 100644
--- a/libjava/classpath/java/io/ObjectOutputStream.java
+++ b/libjava/classpath/java/io/ObjectOutputStream.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.io;
-import gnu.classpath.Configuration;
import gnu.java.io.ObjectIdentityWrapper;
import gnu.java.lang.reflect.TypeSignature;
import gnu.java.security.action.SetAccessibleAction;
@@ -362,7 +361,9 @@ public class ObjectOutputStream extends OutputStream
break;
}
- throw new NotSerializableException(clazz.getName ());
+ throw new NotSerializableException(clazz.getName()
+ + " in "
+ + obj.getClass());
} // end pseudo-loop
}
catch (ObjectStreamException ose)
@@ -412,37 +413,53 @@ public class ObjectOutputStream extends OutputStream
protected void writeClassDescriptor(ObjectStreamClass osc) throws IOException
{
- realOutput.writeByte(TC_CLASSDESC);
- realOutput.writeUTF(osc.getName());
- realOutput.writeLong(osc.getSerialVersionUID());
- assignNewHandle(osc);
+ if (osc.isProxyClass)
+ {
+ realOutput.writeByte(TC_PROXYCLASSDESC);
+ Class[] intfs = osc.forClass().getInterfaces();
+ realOutput.writeInt(intfs.length);
+ for (int i = 0; i < intfs.length; i++)
+ realOutput.writeUTF(intfs[i].getName());
+
+ boolean oldmode = setBlockDataMode(true);
+ annotateProxyClass(osc.forClass());
+ setBlockDataMode(oldmode);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+ }
+ else
+ {
+ realOutput.writeByte(TC_CLASSDESC);
+ realOutput.writeUTF(osc.getName());
+ realOutput.writeLong(osc.getSerialVersionUID());
+ assignNewHandle(osc);
- int flags = osc.getFlags();
+ int flags = osc.getFlags();
- if (protocolVersion == PROTOCOL_VERSION_2
- && osc.isExternalizable())
- flags |= SC_BLOCK_DATA;
+ if (protocolVersion == PROTOCOL_VERSION_2
+ && osc.isExternalizable())
+ flags |= SC_BLOCK_DATA;
- realOutput.writeByte(flags);
+ realOutput.writeByte(flags);
- ObjectStreamField[] fields = osc.fields;
- realOutput.writeShort(fields.length);
+ ObjectStreamField[] fields = osc.fields;
+ realOutput.writeShort(fields.length);
- ObjectStreamField field;
- for (int i = 0; i < fields.length; i++)
- {
- field = fields[i];
- realOutput.writeByte(field.getTypeCode ());
- realOutput.writeUTF(field.getName ());
+ ObjectStreamField field;
+ for (int i = 0; i < fields.length; i++)
+ {
+ field = fields[i];
+ realOutput.writeByte(field.getTypeCode ());
+ realOutput.writeUTF(field.getName ());
- if (! field.isPrimitive())
- writeObject(field.getTypeString());
- }
+ if (! field.isPrimitive())
+ writeObject(field.getTypeString());
+ }
- boolean oldmode = setBlockDataMode(true);
- annotateClass(osc.forClass());
- setBlockDataMode(oldmode);
- realOutput.writeByte(TC_ENDBLOCKDATA);
+ boolean oldmode = setBlockDataMode(true);
+ annotateClass(osc.forClass());
+ setBlockDataMode(oldmode);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+ }
if (osc.isSerializable() || osc.isExternalizable())
writeObject(osc.getSuper());
@@ -531,7 +548,7 @@ public class ObjectOutputStream extends OutputStream
* version)</code> is provided to change the default protocol
* version.
*
- * For an explination of the differences beween the two protocols
+ * For an explanation of the differences between the two protocols
* see XXX: the Java ObjectSerialization Specification.
*
* @exception IOException if <code>version</code> is not a valid
@@ -1567,12 +1584,4 @@ public class ObjectOutputStream extends OutputStream
private boolean dump = false;
private static final boolean DEBUG = false;
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javaio");
- }
- }
}
diff --git a/libjava/classpath/java/io/ObjectStreamField.java b/libjava/classpath/java/io/ObjectStreamField.java
index 611457b3cfb..61ccdc7db76 100644
--- a/libjava/classpath/java/io/ObjectStreamField.java
+++ b/libjava/classpath/java/io/ObjectStreamField.java
@@ -208,7 +208,7 @@ public class ObjectStreamField implements Comparable
* This method sets the current offset of the field.
*
* @param off The offset of the field in bytes.
- * @see getOffset()
+ * @see #getOffset()
*/
protected void setOffset (int off)
{
diff --git a/libjava/classpath/java/io/OutputStreamWriter.java b/libjava/classpath/java/io/OutputStreamWriter.java
index ee229796cce..29fb631faf4 100644
--- a/libjava/classpath/java/io/OutputStreamWriter.java
+++ b/libjava/classpath/java/io/OutputStreamWriter.java
@@ -39,16 +39,14 @@ exception statement from your version. */
package java.io;
import gnu.java.nio.charset.EncodingHelper;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.charset.MalformedInputException;
-import java.nio.charset.UnsupportedCharsetException;
import java.nio.charset.CharacterCodingException;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CodingErrorAction;
+import java.nio.charset.MalformedInputException;
/**
* This class writes characters to an output stream that is byte oriented
@@ -124,52 +122,58 @@ public class OutputStreamWriter extends Writer
{
this.out = out;
try
- {
- // Don't use NIO if avoidable
- if(EncodingHelper.isISOLatin1(encoding_scheme))
{
- encodingName = "ISO8859_1";
- encoder = null;
- return;
- }
-
- /*
- * Workraround for encodings with a byte-order-mark.
- * We only want to write it once per stream.
- */
- try {
- if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
- encoding_scheme.equalsIgnoreCase("UTF-16") ||
- encoding_scheme.equalsIgnoreCase("UTF16"))
- {
- encoding_scheme = "UTF-16BE";
- out.write((byte)0xFE);
- out.write((byte)0xFF);
- } else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle")){
- encoding_scheme = "UTF-16LE";
- out.write((byte)0xFF);
- out.write((byte)0xFE);
- }
- } catch(IOException ioe){
- }
+ // Don't use NIO if avoidable
+ if(EncodingHelper.isISOLatin1(encoding_scheme))
+ {
+ encodingName = "ISO8859_1";
+ encoder = null;
+ return;
+ }
- outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ /*
+ * Workraround for encodings with a byte-order-mark.
+ * We only want to write it once per stream.
+ */
+ try
+ {
+ if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
+ encoding_scheme.equalsIgnoreCase("UTF-16") ||
+ encoding_scheme.equalsIgnoreCase("UTF16"))
+ {
+ encoding_scheme = "UTF-16BE";
+ out.write((byte)0xFE);
+ out.write((byte)0xFF);
+ }
+ else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle")){
+ encoding_scheme = "UTF-16LE";
+ out.write((byte)0xFF);
+ out.write((byte)0xFE);
+ }
+ }
+ catch(IOException ioe)
+ {
+ }
+
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
- Charset cs = EncodingHelper.getCharset(encoding_scheme);
- if(cs == null)
- throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
- " unknown");
- encoder = cs.newEncoder();
- encodingName = EncodingHelper.getOldCanonical(cs.name());
+ Charset cs = EncodingHelper.getCharset(encoding_scheme);
+ if(cs == null)
+ throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
+ " unknown");
+ encoder = cs.newEncoder();
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
- encoder.onMalformedInput(CodingErrorAction.REPLACE);
- encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- } catch(RuntimeException e) {
- // Default to ISO Latin-1, will happen if this is called, for instance,
- // before the NIO provider is loadable.
- encoder = null;
- encodingName = "ISO8859_1";
- }
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ }
+ catch(RuntimeException e)
+ {
+ // Default to ISO Latin-1, will happen if this is called, for instance,
+ // before the NIO provider is loadable.
+ encoder = null;
+ encodingName = "ISO8859_1";
+ }
}
/**
@@ -183,21 +187,55 @@ public class OutputStreamWriter extends Writer
this.out = out;
outputBuffer = null;
try
- {
- String encoding = System.getProperty("file.encoding");
- Charset cs = Charset.forName(encoding);
- encoder = cs.newEncoder();
- encodingName = EncodingHelper.getOldCanonical(cs.name());
- } catch(RuntimeException e) {
- encoder = null;
- encodingName = "ISO8859_1";
- }
+ {
+ String encoding = System.getProperty("file.encoding");
+ Charset cs = Charset.forName(encoding);
+ encoder = cs.newEncoder();
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
+ }
+ catch(RuntimeException e)
+ {
+ encoder = null;
+ encodingName = "ISO8859_1";
+ }
+
if(encoder != null)
- {
- encoder.onMalformedInput(CodingErrorAction.REPLACE);
- encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
- }
+ {
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ }
+ }
+
+ /**
+ * This method initializes a new instance of <code>OutputStreamWriter</code>
+ * to write to the specified stream using a given <code>Charset</code>.
+ *
+ * @param out The <code>OutputStream</code> to write to
+ * @param cs The <code>Charset</code> of the encoding to use
+ */
+ public OutputStreamWriter(OutputStream out, Charset cs)
+ {
+ this.out = out;
+ encoder = cs.newEncoder();
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ }
+
+ /**
+ * This method initializes a new instance of <code>OutputStreamWriter</code>
+ * to write to the specified stream using a given
+ * <code>CharsetEncoder</code>.
+ *
+ * @param out The <code>OutputStream</code> to write to
+ * @param enc The <code>CharsetEncoder</code> to encode the output with
+ */
+ public OutputStreamWriter(OutputStream out, CharsetEncoder enc)
+ {
+ this.out = out;
+ encoder = enc;
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
}
/**
diff --git a/libjava/classpath/java/io/PipedInputStream.java b/libjava/classpath/java/io/PipedInputStream.java
index beb310b4f0c..523ae2c70d3 100644
--- a/libjava/classpath/java/io/PipedInputStream.java
+++ b/libjava/classpath/java/io/PipedInputStream.java
@@ -130,7 +130,7 @@ public class PipedInputStream extends InputStream
* This stream is then ready for reading. If this stream is already
* connected or has been previously closed, then an exception is thrown
*
- * @param src The <code>PipedOutputStream</code> to connect this stream to
+ * @param source The <code>PipedOutputStream</code> to connect this stream to
*
* @exception IOException If this PipedInputStream or <code>source</code>
* has been connected already.
diff --git a/libjava/classpath/java/io/PrintWriter.java b/libjava/classpath/java/io/PrintWriter.java
index 5fd0b162f31..5667e705004 100644
--- a/libjava/classpath/java/io/PrintWriter.java
+++ b/libjava/classpath/java/io/PrintWriter.java
@@ -70,6 +70,11 @@ public class PrintWriter extends Writer
* on this stream.
*/
private boolean error;
+
+ /**
+ * Indicates whether or not the stream has been closed.
+ */
+ private boolean closed;
/**
* This is the underlying <code>Writer</code> we are sending output
@@ -139,6 +144,68 @@ public class PrintWriter extends Writer
}
/**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the default encoding.
+ * @param file name of the file to write to
+ * @throws FileNotFoundException if the file cannot be written or created
+ *
+ * @since 1.5
+ */
+ public PrintWriter(String file) throws FileNotFoundException
+ {
+ this(new FileOutputStream(file));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the specified encoding.
+ * @param file name of the file to write to
+ * @param enc the encoding to use
+ * @throws FileNotFoundException if the file cannot be written or created
+ * @throws UnsupportedEncodingException if the encoding is not supported
+ *
+ * @since 1.5
+ */
+ public PrintWriter(String file, String enc)
+ throws FileNotFoundException, UnsupportedEncodingException
+ {
+ this(new OutputStreamWriter(new FileOutputStream(file), enc));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the default encoding.
+ * @param file the file to write to
+ * @throws FileNotFoundException if the file cannot be written or created
+ *
+ * @since 1.5
+ */
+ public PrintWriter(File file) throws FileNotFoundException
+ {
+ this(new FileOutputStream(file));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the specified encoding.
+ * @param file the file to write to
+ * @param enc the encoding to use
+ * @throws FileNotFoundException if the file cannot be written or created
+ * @throws UnsupportedEncodingException if the encoding is not supported
+ *
+ * @since 1.5
+ */
+ public PrintWriter(File file, String enc)
+ throws FileNotFoundException, UnsupportedEncodingException
+ {
+ this(new OutputStreamWriter(new FileOutputStream(file), enc));
+ }
+
+ /**
* This method can be called by subclasses to indicate that an error
* has occurred and should be reported by <code>checkError</code>.
*/
@@ -158,7 +225,8 @@ public class PrintWriter extends Writer
*/
public boolean checkError()
{
- flush();
+ if (! closed)
+ flush();
return error;
}
@@ -185,7 +253,8 @@ public class PrintWriter extends Writer
{
try
{
- out.close();
+ out.close();
+ closed = true;
}
catch (IOException ex)
{
@@ -310,7 +379,7 @@ public class PrintWriter extends Writer
* This is the system dependent line separator
*/
private static final char[] line_separator
- = System.getProperty("line.separator").toCharArray();
+ = System.getProperty("line.separator", "\n").toCharArray();
/**
* This method prints a line separator sequence to the stream. The value
diff --git a/libjava/classpath/java/io/PushbackInputStream.java b/libjava/classpath/java/io/PushbackInputStream.java
index 71cf244274e..ff202c72df1 100644
--- a/libjava/classpath/java/io/PushbackInputStream.java
+++ b/libjava/classpath/java/io/PushbackInputStream.java
@@ -116,7 +116,14 @@ public class PushbackInputStream extends FilterInputStream
*/
public int available() throws IOException
{
- return (buf.length - pos) + super.available();
+ try
+ {
+ return (buf.length - pos) + super.available();
+ }
+ catch (NullPointerException npe)
+ {
+ throw new IOException ("Stream closed");
+ }
}
/**
diff --git a/libjava/classpath/java/lang/Boolean.java b/libjava/classpath/java/lang/Boolean.java
index b6910280e6b..902c93b3186 100644
--- a/libjava/classpath/java/lang/Boolean.java
+++ b/libjava/classpath/java/lang/Boolean.java
@@ -221,4 +221,36 @@ public final class Boolean implements Serializable
return false;
return "true".equalsIgnoreCase(System.getProperty(name));
}
+
+ /**
+ * If the String argument is "true", ignoring case, return true.
+ * Otherwise, return false.
+ *
+ * @param b String to parse
+ * @since 1.5
+ */
+ public static boolean parseBoolean(String b)
+ {
+ return "true".equalsIgnoreCase(b) ? true : false;
+ }
+
+ /**
+ * Compares this Boolean to another.
+ * @param b the Boolean to compare this Boolean to
+ * @return 0 if both Booleans represent the same value, a positive number
+ * if this Boolean represents true and b represents false, or a negative
+ * number otherwise.
+ * @since 1.5
+ */
+ public int compareTo (Boolean b)
+ {
+ if (b == null)
+ throw new NullPointerException("argument passed to compareTo(Boolean) cannot be null");
+
+ if (this.value == b.value)
+ return 0;
+ if (this.value == true)
+ return 1;
+ return -1;
+ }
}
diff --git a/libjava/classpath/java/lang/Byte.java b/libjava/classpath/java/lang/Byte.java
index 338e2167aa1..2560bfcffc3 100644
--- a/libjava/classpath/java/lang/Byte.java
+++ b/libjava/classpath/java/lang/Byte.java
@@ -50,7 +50,7 @@ package java.lang;
* @author Per Bothner
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public final class Byte extends Number implements Comparable
{
@@ -78,6 +78,16 @@ public final class Byte extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');
/**
+ * The number of bits needed to represent a <code>byte</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 8;
+
+ // This caches Byte values, and is used by boxing conversions via
+ // valueOf(). We're required to cache all possible values here.
+ private static Byte[] byteCache = new Byte[MAX_VALUE - MIN_VALUE + 1];
+
+ /**
* The immutable value of this Byte.
*
* @serial the wrapped byte
@@ -192,6 +202,26 @@ public final class Byte extends Number implements Comparable
}
/**
+ * Returns a <code>Byte</code> object wrapping the value.
+ * In contrast to the <code>Byte</code> constructor, this method
+ * will cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Byte</code>
+ *
+ * @since 1.5
+ */
+ public static Byte valueOf(byte val)
+ {
+ synchronized (byteCache)
+ {
+ if (byteCache[val - MIN_VALUE] == null)
+ byteCache[val - MIN_VALUE] = new Byte(val);
+ return byteCache[val - MIN_VALUE];
+ }
+ }
+
+ /**
* Convert the specified <code>String</code> into a <code>Byte</code>.
* The <code>String</code> may represent decimal, hexadecimal, or
* octal numbers.
diff --git a/libjava/classpath/java/lang/Character.java b/libjava/classpath/java/lang/Character.java
index 1e4f219a15f..78db41ef216 100644
--- a/libjava/classpath/java/lang/Character.java
+++ b/libjava/classpath/java/lang/Character.java
@@ -1,5 +1,5 @@
/* java.lang.Character -- Wrapper class for char, and Unicode subsets
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -1034,6 +1034,18 @@ public final class Character implements Serializable, Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('C');
/**
+ * The number of bits needed to represent a <code>char</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 16;
+
+ // This caches some Character values, and is used by boxing
+ // conversions via valueOf(). We must cache at least 0..127;
+ // this constant controls how much we actually cache.
+ private static final int MAX_CACHE = 127;
+ private static Character[] charCache = new Character[MAX_CACHE + 1];
+
+ /**
* Lu = Letter, Uppercase (Informative).
*
* @since 1.1
@@ -1480,34 +1492,48 @@ public final class Character implements Serializable, Comparable
/**
- * Minimum high surrrogate code in UTF-16 encoding.
+ * Minimum high surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MIN_HIGH_SURROGATE = '\ud800';
/**
- * Maximum high surrrogate code in UTF-16 encoding.
+ * Maximum high surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MAX_HIGH_SURROGATE = '\udbff';
/**
- * Minimum low surrrogate code in UTF-16 encoding.
+ * Minimum low surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MIN_LOW_SURROGATE = '\udc00';
/**
- * Maximum low surrrogate code in UTF-16 encoding.
+ * Maximum low surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MAX_LOW_SURROGATE = '\udfff';
/**
+ * Minimum surrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE;
+
+ /**
+ * Maximum low surrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MAX_SURROGATE = MAX_LOW_SURROGATE;
+
+ /**
* Grabs an attribute offset from the Unicode attribute database. The lower
* 5 bits are the character type, the next 2 bits are flags, and the top
* 9 bits are the offset into the attribute tables.
@@ -2303,6 +2329,37 @@ public final class Character implements Serializable, Comparable
}
/**
+ * Returns an <code>Character</code> object wrapping the value.
+ * In contrast to the <code>Character</code> constructor, this method
+ * will cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Character</code>
+ *
+ * @since 1.5
+ */
+ public static Character valueOf(char val)
+ {
+ if (val > MAX_CACHE)
+ return new Character(val);
+ synchronized (charCache)
+ {
+ if (charCache[val - MIN_VALUE] == null)
+ charCache[val - MIN_VALUE] = new Character(val);
+ return charCache[val - MIN_VALUE];
+ }
+ }
+
+ /**
+ * Reverse the bytes in val.
+ * @since 1.5
+ */
+ public static char reverseBytes(char val)
+ {
+ return (char) (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
+ }
+
+ /**
* Converts a unicode code point to a UTF-16 representation of that
* code point.
*
@@ -2370,7 +2427,7 @@ public final class Character implements Serializable, Comparable
* Return number of 16-bit characters required to represent the given
* code point.
*
- * @param codePoint a uncode code point
+ * @param codePoint a unicode code point
*
* @return 2 if codePoint >= 0x10000, 1 otherwise.
*
@@ -2415,4 +2472,210 @@ public final class Character implements Serializable, Comparable
{
return codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT;
}
+
+ /**
+ * Return true if the given character is a high surrogate.
+ * @param ch the character
+ * @return true if the character is a high surrogate character
+ *
+ * @since 1.5
+ */
+ public static boolean isHighSurrogate(char ch)
+ {
+ return ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE;
+ }
+
+ /**
+ * Return true if the given character is a low surrogate.
+ * @param ch the character
+ * @return true if the character is a low surrogate character
+ *
+ * @since 1.5
+ */
+ public static boolean isLowSurrogate(char ch)
+ {
+ return ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE;
+ }
+
+ /**
+ * Return true if the given characters compose a surrogate pair.
+ * This is true if the first character is a high surrogate and the
+ * second character is a low surrogate.
+ * @param ch1 the first character
+ * @param ch2 the first character
+ * @return true if the characters compose a surrogate pair
+ *
+ * @since 1.5
+ */
+ public static boolean isSurrogatePair(char ch1, char ch2)
+ {
+ return isHighSurrogate(ch1) && isLowSurrogate(ch2);
+ }
+
+ /**
+ * Given a valid surrogate pair, this returns the corresponding
+ * code point.
+ * @param high the high character of the pair
+ * @param low the low character of the pair
+ * @return the corresponding code point
+ *
+ * @since 1.5
+ */
+ public static int toCodePoint(char high, char low)
+ {
+ return ((high - MIN_HIGH_SURROGATE) << 10) + (low - MIN_LOW_SURROGATE);
+ }
+
+ /**
+ * Get the code point at the specified index in the CharSequence.
+ * This is like CharSequence#charAt(int), but if the character is
+ * the start of a surrogate pair, and there is a following
+ * character, and this character completes the pair, then the
+ * corresponding supplementary code point is returned. Otherwise,
+ * the character at the index is returned.
+ *
+ * @param sequence the CharSequence
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointAt(CharSequence sequence, int index)
+ {
+ int len = sequence.length();
+ if (index < 0 || index >= len)
+ throw new IndexOutOfBoundsException();
+ char high = sequence.charAt(index);
+ if (! isHighSurrogate(high) || ++index >= len)
+ return high;
+ char low = sequence.charAt(index);
+ if (! isLowSurrogate(low))
+ return high;
+ return toCodePoint(high, low);
+ }
+
+ /**
+ * Get the code point at the specified index in the CharSequence.
+ * If the character is the start of a surrogate pair, and there is a
+ * following character, and this character completes the pair, then
+ * the corresponding supplementary code point is returned.
+ * Otherwise, the character at the index is returned.
+ *
+ * @param chars the character array in which to look
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointAt(char[] chars, int index)
+ {
+ return codePointAt(chars, index, chars.length);
+ }
+
+ /**
+ * Get the code point at the specified index in the CharSequence.
+ * If the character is the start of a surrogate pair, and there is a
+ * following character within the specified range, and this
+ * character completes the pair, then the corresponding
+ * supplementary code point is returned. Otherwise, the character
+ * at the index is returned.
+ *
+ * @param chars the character array in which to look
+ * @param index the index of the codepoint to get, starting at 0
+ * @param limit the limit past which characters should not be examined
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;=
+ * limit, or if limit is negative or &gt;= the length of the array
+ * @since 1.5
+ */
+ public static int codePointAt(char[] chars, int index, int limit)
+ {
+ if (index < 0 || index >= limit || limit < 0 || limit >= chars.length)
+ throw new IndexOutOfBoundsException();
+ char high = chars[index];
+ if (! isHighSurrogate(high) || ++index >= limit)
+ return high;
+ char low = chars[index];
+ if (! isLowSurrogate(low))
+ return high;
+ return toCodePoint(high, low);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(char[], int), but checks the characters at
+ * <code>index-1</code> and <code>index-2</code> to see if they form
+ * a supplementary code point. If they do not, the character at
+ * <code>index-1</code> is returned.
+ *
+ * @param chars the character array
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointBefore(char[] chars, int index)
+ {
+ return codePointBefore(chars, index, 1);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(char[], int), but checks the characters at
+ * <code>index-1</code> and <code>index-2</code> to see if they form
+ * a supplementary code point. If they do not, the character at
+ * <code>index-1</code> is returned. The start parameter is used to
+ * limit the range of the array which may be examined.
+ *
+ * @param chars the character array
+ * @param index the index just past the codepoint to get, starting at 0
+ * @param start the index before which characters should not be examined
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is &gt; start or &gt;
+ * the length of the array, or if limit is negative or &gt;= the
+ * length of the array
+ * @since 1.5
+ */
+ public static int codePointBefore(char[] chars, int index, int start)
+ {
+ if (index < start || index > chars.length
+ || start < 0 || start >= chars.length)
+ throw new IndexOutOfBoundsException();
+ --index;
+ char low = chars[index];
+ if (! isLowSurrogate(low) || --index < start)
+ return low;
+ char high = chars[index];
+ if (! isHighSurrogate(high))
+ return low;
+ return toCodePoint(high, low);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(CharSequence, int), but checks the characters at
+ * <code>index-1</code> and <code>index-2</code> to see if they form
+ * a supplementary code point. If they do not, the character at
+ * <code>index-1</code> is returned.
+ *
+ * @param sequence the CharSequence
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointBefore(CharSequence sequence, int index)
+ {
+ int len = sequence.length();
+ if (index < 1 || index > len)
+ throw new IndexOutOfBoundsException();
+ --index;
+ char low = sequence.charAt(index);
+ if (! isLowSurrogate(low) || --index < 0)
+ return low;
+ char high = sequence.charAt(index);
+ if (! isHighSurrogate(high))
+ return low;
+ return toCodePoint(high, low);
+ }
} // class Character
diff --git a/libjava/classpath/java/lang/Class.java b/libjava/classpath/java/lang/Class.java
index 22f148e9136..726c794a413 100644
--- a/libjava/classpath/java/lang/Class.java
+++ b/libjava/classpath/java/lang/Class.java
@@ -41,7 +41,9 @@ package java.lang;
import gnu.classpath.VMStackWalker;
import java.io.InputStream;
+import java.io.ObjectStreamClass;
import java.io.Serializable;
+import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -99,7 +101,7 @@ public final class Class implements Serializable
/** The class signers. */
private Object[] signers = null;
/** The class protection domain. */
- private final ProtectionDomain pd;
+ private final transient ProtectionDomain pd;
/* We use an inner class, so that Class doesn't have a static initializer */
private static final class StaticData
@@ -592,7 +594,8 @@ public final class Class implements Serializable
ClassLoader cl = getClassLoader();
if (cl != null)
return cl.getPackage(getPackagePortion(getName()));
- return null;
+ else
+ return VMClassLoader.getPackage(getPackagePortion(getName()));
}
/**
@@ -721,7 +724,7 @@ public final class Class implements Serializable
* @param list List of methods to search
* @param name Name of method
* @param args Method parameter types
- * @see #getMethod()
+ * @see #getMethod(String, Class[])
*/
private static Method matchMethod(Method[] list, String name, Class[] args)
{
@@ -829,7 +832,7 @@ public final class Class implements Serializable
* public and final, but not an interface.
*
* @return the modifiers of this class
- * @see Modifer
+ * @see Modifier
* @since 1.1
*/
public int getModifiers()
diff --git a/libjava/classpath/java/lang/ClassLoader.java b/libjava/classpath/java/lang/ClassLoader.java
index 0d50a6e005d..9f586c4cffc 100644
--- a/libjava/classpath/java/lang/ClassLoader.java
+++ b/libjava/classpath/java/lang/ClassLoader.java
@@ -49,6 +49,7 @@ import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.ByteBuffer;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
@@ -472,6 +473,35 @@ public abstract class ClassLoader
}
/**
+ * Helper to define a class using the contents of a byte buffer. If
+ * the domain is null, the default of
+ * <code>Policy.getPolicy().getPermissions(new CodeSource(null,
+ * null))</code> is used. Once a class has been defined in a
+ * package, all further classes in that package must have the same
+ * set of certificates or a SecurityException is thrown.
+ *
+ * @param name the name to give the class. null if unknown
+ * @param buf a byte buffer containing bytes that form a class.
+ * @param domain the ProtectionDomain to give to the class, null for the
+ * default protection domain
+ * @return the class that was defined
+ * @throws ClassFormatError if data is not in proper classfile format
+ * @throws NoClassDefFoundError if the supplied name is not the same as
+ * the one specified by the byte buffer.
+ * @throws SecurityException if name starts with "java.", or if certificates
+ * do not match up
+ * @since 1.5
+ */
+ protected final Class defineClass(String name, ByteBuffer buf,
+ ProtectionDomain domain)
+ throws ClassFormatError
+ {
+ byte[] data = new byte[buf.remaining()];
+ buf.get(data);
+ return defineClass(name, data, 0, data.length, domain);
+ }
+
+ /**
* Links the class, if that has not already been done. Linking basically
* resolves all references to other classes made by this class.
*
@@ -883,7 +913,7 @@ public abstract class ClassLoader
*
* @param name the (system specific) name of the requested library
* @return the full pathname to the requested library, or null
- * @see Runtime#loadLibrary()
+ * @see Runtime#loadLibrary(String)
* @since 1.2
*/
protected String findLibrary(String name)
@@ -913,7 +943,7 @@ public abstract class ClassLoader
*
* @param name the package (and subpackages) to affect
* @param enabled true to set the default to enabled
- * @see #setDefaultAssertionStatus(String, boolean)
+ * @see #setDefaultAssertionStatus(boolean)
* @see #setClassAssertionStatus(String, boolean)
* @see #clearAssertionStatus()
* @since 1.4
@@ -934,7 +964,7 @@ public abstract class ClassLoader
* @param name the class to affect
* @param enabled true to set the default to enabled
* @throws NullPointerException if name is null
- * @see #setDefaultAssertionStatus(String, boolean)
+ * @see #setDefaultAssertionStatus(boolean)
* @see #setPackageAssertionStatus(String, boolean)
* @see #clearAssertionStatus()
* @since 1.4
diff --git a/libjava/classpath/java/lang/Double.java b/libjava/classpath/java/lang/Double.java
index 4fa47f46ddd..26b398bb695 100644
--- a/libjava/classpath/java/lang/Double.java
+++ b/libjava/classpath/java/lang/Double.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.lang;
-import gnu.classpath.Configuration;
/**
* Instances of class <code>Double</code> represent primitive
@@ -89,6 +88,12 @@ public final class Double extends Number implements Comparable
public static final double NaN = 0.0 / 0.0;
/**
+ * The number of bits needed to represent a <code>double</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 64;
+
+ /**
* The primitive type <code>double</code> is represented by this
* <code>Class</code> object.
* @since 1.1
@@ -168,6 +173,22 @@ public final class Double extends Number implements Comparable
}
/**
+ * Returns a <code>Double</code> object wrapping the value.
+ * In contrast to the <code>Double</code> constructor, this method
+ * may cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Double</code>
+ *
+ * @since 1.5
+ */
+ public static Double valueOf(double val)
+ {
+ // We don't actually cache, but we could.
+ return new Double(val);
+ }
+
+ /**
* Create a new <code>Double</code> object using the <code>String</code>.
*
* @param s the <code>String</code> to convert
diff --git a/libjava/classpath/java/lang/EnumConstantNotPresentException.java b/libjava/classpath/java/lang/EnumConstantNotPresentException.java
new file mode 100644
index 00000000000..dbec9d658ef
--- /dev/null
+++ b/libjava/classpath/java/lang/EnumConstantNotPresentException.java
@@ -0,0 +1,93 @@
+/* EnumConstantNotPresentException.java -- thrown when enum constant
+ not available
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.lang;
+
+/**
+ * An exception of this type is thrown when a symbolic reference is
+ * made to an enum constant which does not exist.
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @since 1.5
+ */
+public class EnumConstantNotPresentException extends RuntimeException
+{
+ /**
+ * The enum's type. Note that the name is fixed by the
+ * serialization spec.
+ */
+ private Class enumType;
+
+ /**
+ * The name of the missing enum constant. Note that the name is
+ * fixed by the serialization spec.
+ */
+ private String constantName;
+
+ /**
+ * Create a new EnumConstantNotPresentException with the indicated
+ * enum type and enum constant name.
+ * @param theEnum the enum's class
+ * @param name the name of the missing enum constant
+ */
+ public EnumConstantNotPresentException(Class theEnum, String name)
+ {
+ super("enum " + theEnum + " is missing the constant " + name);
+ enumType = theEnum;
+ constantName = name;
+ }
+
+ /**
+ * Return the name of the missing constant.
+ * @return the name of the missing constant
+ */
+ public String constantName()
+ {
+ return constantName;
+ }
+
+ /**
+ * Return the enum type which is missing a constant.
+ * @return the enum type which is missing a constant
+ */
+ public Class enumType()
+ {
+ return enumType;
+ }
+}
diff --git a/libjava/classpath/java/lang/Float.java b/libjava/classpath/java/lang/Float.java
index e6200dabddc..eef34a0abeb 100644
--- a/libjava/classpath/java/lang/Float.java
+++ b/libjava/classpath/java/lang/Float.java
@@ -94,6 +94,12 @@ public final class Float extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('F');
/**
+ * The number of bits needed to represent a <code>float</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 32;
+
+ /**
* The immutable value of this Float.
*
* @serial the wrapped float
@@ -192,6 +198,22 @@ public final class Float extends Number implements Comparable
}
/**
+ * Returns a <code>Float</code> object wrapping the value.
+ * In contrast to the <code>Float</code> constructor, this method
+ * may cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Float</code>
+ *
+ * @since 1.5
+ */
+ public static Float valueOf(float val)
+ {
+ // We don't actually cache, but we could.
+ return new Float(val);
+ }
+
+ /**
* Parse the specified <code>String</code> as a <code>float</code>. The
* extended BNF grammar is as follows:<br>
* <pre>
diff --git a/libjava/classpath/java/lang/Integer.java b/libjava/classpath/java/lang/Integer.java
index 53de9ab9667..f3fe85f5041 100644
--- a/libjava/classpath/java/lang/Integer.java
+++ b/libjava/classpath/java/lang/Integer.java
@@ -707,8 +707,8 @@ public final class Integer extends Number implements Comparable
* @throws NullPointerException if decode is true and str if null
* @see #parseInt(String, int)
* @see #decode(String)
- * @see Byte#parseInt(String, int)
- * @see Short#parseInt(String, int)
+ * @see Byte#parseByte(String, int)
+ * @see Short#parseShort(String, int)
*/
static int parseInt(String str, int radix, boolean decode)
{
diff --git a/libjava/classpath/java/lang/Long.java b/libjava/classpath/java/lang/Long.java
index 703eab8a0f3..74e2a52df7c 100644
--- a/libjava/classpath/java/lang/Long.java
+++ b/libjava/classpath/java/lang/Long.java
@@ -50,7 +50,7 @@ package java.lang;
* @author Warren Levy
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public final class Long extends Number implements Comparable
{
@@ -79,6 +79,12 @@ public final class Long extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass ('J');
/**
+ * The number of bits needed to represent a <code>long</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 64;
+
+ /**
* The immutable value of this Long.
*
* @serial the wrapped long
@@ -282,6 +288,21 @@ public final class Long extends Number implements Comparable
}
/**
+ * Returns a <code>Long</code> object wrapping the value.
+ *
+ * @param val the value to wrap
+ * @return the <code>Long</code>
+ *
+ * @since 1.5
+ */
+ public static synchronized Long valueOf(long val)
+ {
+ // We aren't required to cache here. We could, though perhaps we
+ // ought to consider that as an empirical question.
+ return new Long(val);
+ }
+
+ /**
* Convert the specified <code>String</code> into a <code>Long</code>.
* The <code>String</code> may represent decimal, hexadecimal, or
* octal numbers.
@@ -512,6 +533,136 @@ public final class Long extends Number implements Comparable
}
/**
+ * Return the number of bits set in x.
+ * @param x value to examine
+ * @since 1.5
+ */
+ public static int bitCount(long x)
+ {
+ // Successively collapse alternating bit groups into a sum.
+ x = ((x >> 1) & 0x5555555555555555L) + (x & 0x5555555555555555L);
+ x = ((x >> 2) & 0x3333333333333333L) + (x & 0x3333333333333333L);
+ int v = (int) ((x >>> 32) + x);
+ v = ((v >> 4) & 0x0f0f0f0f) + (v & 0x0f0f0f0f);
+ v = ((v >> 8) & 0x00ff00ff) + (v & 0x00ff00ff);
+ return ((v >> 16) & 0x0000ffff) + (v & 0x0000ffff);
+ }
+
+ /**
+ * Rotate x to the left by distance bits.
+ * @param x the value to rotate
+ * @param distance the number of bits by which to rotate
+ * @since 1.5
+ */
+ public static long rotateLeft(long x, int distance)
+ {
+ // This trick works because the shift operators implicitly mask
+ // the shift count.
+ return (x << distance) | (x >>> - distance);
+ }
+
+ /**
+ * Rotate x to the right by distance bits.
+ * @param x the value to rotate
+ * @param distance the number of bits by which to rotate
+ * @since 1.5
+ */
+ public static long rotateRight(long x, int distance)
+ {
+ // This trick works because the shift operators implicitly mask
+ // the shift count.
+ return (x << - distance) | (x >>> distance);
+ }
+
+ /**
+ * Find the highest set bit in value, and return a new value
+ * with only that bit set.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static long highestOneBit(long value)
+ {
+ value |= value >>> 1;
+ value |= value >>> 2;
+ value |= value >>> 4;
+ value |= value >>> 8;
+ value |= value >>> 16;
+ value |= value >>> 32;
+ return value ^ (value >>> 1);
+ }
+
+ /**
+ * Return the number of leading zeros in value.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static int numberOfLeadingZeros(long value)
+ {
+ value |= value >>> 1;
+ value |= value >>> 2;
+ value |= value >>> 4;
+ value |= value >>> 8;
+ value |= value >>> 16;
+ value |= value >>> 32;
+ return bitCount(~value);
+ }
+
+ /**
+ * Find the lowest set bit in value, and return a new value
+ * with only that bit set.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static long lowestOneBit(long value)
+ {
+ // Classic assembly trick.
+ return value & - value;
+ }
+
+ /**
+ * Find the number of trailing zeros in value.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static int numberOfTrailingZeros(long value)
+ {
+ return bitCount((value & -value) - 1);
+ }
+
+ /**
+ * Return 1 if x is positive, -1 if it is negative, and 0 if it is
+ * zero.
+ * @param x the value to examine
+ * @since 1.5
+ */
+ public static int signum(long x)
+ {
+ return x < 0 ? -1 : (x > 0 ? 1 : 0);
+ }
+
+ /**
+ * Reverse the bytes in val.
+ * @since 1.5
+ */
+ public static long reverseBytes(long val)
+ {
+ int hi = Integer.reverseBytes((int) val);
+ int lo = Integer.reverseBytes((int) (val >>> 32));
+ return (((long) hi) << 32) | lo;
+ }
+
+ /**
+ * Reverse the bits in val.
+ * @since 1.5
+ */
+ public static long reverse(long val)
+ {
+ long hi = Integer.reverse((int) val) & 0xffffffffL;
+ long lo = Integer.reverse((int) (val >>> 32)) & 0xffffffffL;
+ return (hi << 32) | lo;
+ }
+
+ /**
* Helper for converting unsigned numbers to String.
*
* @param num the number
diff --git a/libjava/classpath/java/lang/Object.java b/libjava/classpath/java/lang/Object.java
index f8c389a57ee..6212d7dfe72 100644
--- a/libjava/classpath/java/lang/Object.java
+++ b/libjava/classpath/java/lang/Object.java
@@ -343,7 +343,7 @@ public class Object
*
* <p>This thread still holds a lock on the object, so it is
* typical to release the lock by exiting the synchronized
- * code, calling wait(), or calling {@link Thread#sleep()}, so
+ * code, calling wait(), or calling {@link Thread#sleep(long)}, so
* that the newly awakened thread can actually resume. The
* awakened thread will most likely be awakened with an
* {@link InterruptedException}, but that is not guaranteed.
@@ -372,7 +372,7 @@ public class Object
*
* <p>This thread still holds a lock on the object, so it is
* typical to release the lock by exiting the synchronized
- * code, calling wait(), or calling {@link Thread#sleep()}, so
+ * code, calling wait(), or calling {@link Thread#sleep(long)}, so
* that one of the newly awakened threads can actually resume.
* The resuming thread will most likely be awakened with an
* {@link InterruptedException}, but that is not guaranteed.
diff --git a/libjava/classpath/java/lang/Process.java b/libjava/classpath/java/lang/Process.java
index b6e18ca4df3..ccaa3f15358 100644
--- a/libjava/classpath/java/lang/Process.java
+++ b/libjava/classpath/java/lang/Process.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.lang;
+import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
diff --git a/libjava/classpath/java/lang/Readable.java b/libjava/classpath/java/lang/Readable.java
index efc1985d606..d8967652b70 100644
--- a/libjava/classpath/java/lang/Readable.java
+++ b/libjava/classpath/java/lang/Readable.java
@@ -39,6 +39,7 @@ package java.lang;
import java.io.IOException;
import java.nio.CharBuffer;
+import java.nio.ReadOnlyBufferException;
/**
* A <code>Readable</code> object is simply a source for Unicode character
diff --git a/libjava/classpath/java/lang/RuntimePermission.java b/libjava/classpath/java/lang/RuntimePermission.java
index ca33307d12b..2f80b91077f 100644
--- a/libjava/classpath/java/lang/RuntimePermission.java
+++ b/libjava/classpath/java/lang/RuntimePermission.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.lang;
import java.security.BasicPermission;
+import java.security.Permission;
/**
* A <code>RuntimePermission</code> contains a permission name, but no
diff --git a/libjava/classpath/java/lang/SecurityManager.java b/libjava/classpath/java/lang/SecurityManager.java
index ef9e7597ddc..26d56a64bf3 100644
--- a/libjava/classpath/java/lang/SecurityManager.java
+++ b/libjava/classpath/java/lang/SecurityManager.java
@@ -41,19 +41,35 @@ package java.lang;
import gnu.classpath.VMStackWalker;
import java.awt.AWTPermission;
+import java.awt.Frame;
+import java.awt.Toolkit;
+import java.awt.Window;
import java.io.File;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.FilePermission;
+import java.io.RandomAccessFile;
import java.lang.reflect.Member;
import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketImplFactory;
import java.net.SocketPermission;
+import java.net.URL;
+import java.net.URLStreamHandlerFactory;
import java.security.AccessControlContext;
+import java.security.AccessControlException;
import java.security.AccessController;
import java.security.AllPermission;
+import java.security.BasicPermission;
import java.security.Permission;
+import java.security.Policy;
import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
import java.security.Security;
import java.security.SecurityPermission;
+import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
@@ -196,7 +212,7 @@ public class SecurityManager
* <ul>
* <li>All methods on the stack are from system classes</li>
* <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * created by {@link AccessController#doPrivileged(PrivilegedAction)},
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
@@ -219,7 +235,7 @@ public class SecurityManager
* <ul>
* <li>All methods on the stack are from system classes</li>
* <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * created by {@link AccessController#doPrivileged(PrivilegedAction)},
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
@@ -258,7 +274,7 @@ public class SecurityManager
* <ul>
* <li>All methods on the stack are from system classes</li>
* <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * created by {@link AccessController#doPrivileged(PrivilegedAction)},
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
@@ -431,7 +447,7 @@ public class SecurityManager
* @throws SecurityException if permission is denied
* @throws NullPointerException if g is null
* @see Thread#Thread()
- * @see ThreadGroup#ThreadGroup()
+ * @see ThreadGroup#ThreadGroup(String)
* @see ThreadGroup#stop()
* @see ThreadGroup#suspend()
* @see ThreadGroup#resume()
@@ -537,7 +553,7 @@ public class SecurityManager
* @throws NullPointerException if filename is null
* @see File
* @see FileInputStream#FileInputStream(String)
- * @see RandomAccessFile#RandomAccessFile(String)
+ * @see RandomAccessFile#RandomAccessFile(String, String)
*/
public void checkRead(String filename)
{
@@ -602,9 +618,9 @@ public class SecurityManager
* @see File
* @see File#canWrite()
* @see File#mkdir()
- * @see File#renameTo()
+ * @see File#renameTo(File)
* @see FileOutputStream#FileOutputStream(String)
- * @see RandomAccessFile#RandomAccessFile(String)
+ * @see RandomAccessFile#RandomAccessFile(String, String)
*/
public void checkWrite(String filename)
{
diff --git a/libjava/classpath/java/lang/Short.java b/libjava/classpath/java/lang/Short.java
index fbeea915bd3..eb40cd9e0e6 100644
--- a/libjava/classpath/java/lang/Short.java
+++ b/libjava/classpath/java/lang/Short.java
@@ -77,6 +77,19 @@ public final class Short extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('S');
/**
+ * The number of bits needed to represent a <code>short</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 16;
+
+ // This caches some Short values, and is used by boxing conversions
+ // via valueOf(). We must cache at least -128..127; these constants
+ // control how much we actually cache.
+ private static final int MIN_CACHE = -128;
+ private static final int MAX_CACHE = 127;
+ private static Short[] shortCache = new Short[MAX_CACHE - MIN_CACHE + 1];
+
+ /**
* The immutable value of this Short.
*
* @serial the wrapped short
@@ -189,6 +202,28 @@ public final class Short extends Number implements Comparable
}
/**
+ * Returns a <code>Short</code> object wrapping the value.
+ * In contrast to the <code>Short</code> constructor, this method
+ * will cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Short</code>
+ *
+ * @since 1.5
+ */
+ public static Short valueOf(short val)
+ {
+ if (val < MIN_CACHE || val > MAX_CACHE)
+ return new Short(val);
+ synchronized (shortCache)
+ {
+ if (shortCache[val - MIN_CACHE] == null)
+ shortCache[val - MIN_CACHE] = new Short(val);
+ return shortCache[val - MIN_CACHE];
+ }
+ }
+
+ /**
* Convert the specified <code>String</code> into a <code>Short</code>.
* The <code>String</code> may represent decimal, hexadecimal, or
* octal numbers.
@@ -350,4 +385,13 @@ public final class Short extends Number implements Comparable
{
return compareTo((Short)o);
}
+
+ /**
+ * Reverse the bytes in val.
+ * @since 1.5
+ */
+ public static short reverseBytes(short val)
+ {
+ return (short) (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
+ }
}
diff --git a/libjava/classpath/java/lang/StrictMath.java b/libjava/classpath/java/lang/StrictMath.java
index 32bd3540d80..2079cc11e41 100644
--- a/libjava/classpath/java/lang/StrictMath.java
+++ b/libjava/classpath/java/lang/StrictMath.java
@@ -1254,7 +1254,7 @@ public final strictfp class StrictMath
/**
* Super precision for 2/pi in 24-bit chunks, for use in
- * {@link #remPiOver2()}.
+ * {@link #remPiOver2(double, double[])}.
*/
private static final int TWO_OVER_PI[] = {
0xa2f983, 0x6e4e44, 0x1529fc, 0x2757d1, 0xf534dd, 0xc0db62,
@@ -1272,7 +1272,7 @@ public final strictfp class StrictMath
/**
* Super precision for pi/2 in 24-bit chunks, for use in
- * {@link #remPiOver2()}.
+ * {@link #remPiOver2(double, double[])}.
*/
private static final double PI_OVER_TWO[] = {
1.570796251296997, // Long bits 0x3ff921fb40000000L.
@@ -1286,8 +1286,8 @@ public final strictfp class StrictMath
};
/**
- * More constants related to pi, used in {@link #remPiOver2()} and
- * elsewhere.
+ * More constants related to pi, used in
+ * {@link #remPiOver2(double, double[])} and elsewhere.
*/
private static final double
PI_L = 1.2246467991473532e-16, // Long bits 0x3ca1a62633145c07L.
@@ -1301,7 +1301,7 @@ public final strictfp class StrictMath
/**
* Natural log and square root constants, for calculation of
* {@link #exp(double)}, {@link #log(double)} and
- * {@link #power(double, double)}. CP is 2/(3*ln(2)).
+ * {@link #pow(double, double)}. CP is 2/(3*ln(2)).
*/
private static final double
SQRT_1_5 = 1.224744871391589, // Long bits 0x3ff3988e1409212eL.
diff --git a/libjava/classpath/java/lang/String.java b/libjava/classpath/java/lang/String.java
index b4db8505051..369d8085a02 100644
--- a/libjava/classpath/java/lang/String.java
+++ b/libjava/classpath/java/lang/String.java
@@ -98,7 +98,7 @@ public final class String implements Serializable, Comparable, CharSequence
/**
* Stores unicode multi-character uppercase expansion table.
- * @see #toUpperCase(char)
+ * @see #toUpperCase(Locale)
* @see CharData#UPPER_EXPAND
*/
private static final char[] upperExpand
@@ -139,7 +139,7 @@ public final class String implements Serializable, Comparable, CharSequence
final int offset;
/**
- * An implementation for {@link CASE_INSENSITIVE_ORDER}.
+ * An implementation for {@link #CASE_INSENSITIVE_ORDER}.
* This must be {@link Serializable}. The class name is dictated by
* compatibility with Sun's JDK.
*/
@@ -233,6 +233,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @param count the number of characters from data to copy
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
*/
@@ -256,6 +257,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @param count the number of characters from ascii to copy
* @throws NullPointerException if ascii is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; ascii.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(byte[])
@@ -267,8 +269,13 @@ public final class String implements Serializable, Comparable, CharSequence
*/
public String(byte[] ascii, int hibyte, int offset, int count)
{
- if (offset < 0 || count < 0 || offset + count > ascii.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > ascii.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
value = new char[count];
this.offset = 0;
this.count = count;
@@ -327,8 +334,13 @@ public final class String implements Serializable, Comparable, CharSequence
public String(byte[] data, int offset, int count, String encoding)
throws UnsupportedEncodingException
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
try
{
CharsetDecoder csd = Charset.forName(encoding).newDecoder();
@@ -402,8 +414,13 @@ public final class String implements Serializable, Comparable, CharSequence
*/
public String(byte[] data, int offset, int count)
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
int o, c;
char[] v;
String encoding;
@@ -512,8 +529,13 @@ public final class String implements Serializable, Comparable, CharSequence
*/
String(char[] data, int offset, int count, boolean dont_copy)
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
if (dont_copy)
{
value = data;
@@ -554,6 +576,40 @@ public final class String implements Serializable, Comparable, CharSequence
}
/**
+ * Get the code point at the specified index. This is like #charAt(int),
+ * but if the character is the start of a surrogate pair, and the
+ * following character completes the pair, then the corresponding
+ * supplementary code point is returned.
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public synchronized int codePointAt(int index)
+ {
+ // Use the CharSequence overload as we get better range checking
+ // this way.
+ return Character.codePointAt(this, index);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(int), but checks the characters at <code>index-1</code> and
+ * <code>index-2</code> to see if they form a supplementary code point.
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * (while unspecified, this is a StringIndexOutOfBoundsException)
+ * @since 1.5
+ */
+ public synchronized int codePointBefore(int index)
+ {
+ // Use the CharSequence overload as we get better range checking
+ // this way.
+ return Character.codePointBefore(this, index);
+ }
+
+ /**
* Copies characters from this String starting at a specified start index,
* ending at a specified stop index, to a character array starting at
* a specified destination begin index.
@@ -628,21 +684,26 @@ public final class String implements Serializable, Comparable, CharSequence
ByteBuffer bbuf = cse.encode(CharBuffer.wrap(value, offset, count));
if(bbuf.hasArray())
return bbuf.array();
-
+
// Doubt this will happen. But just in case.
byte[] bytes = new byte[bbuf.remaining()];
bbuf.get(bytes);
return bytes;
-
- } catch(IllegalCharsetNameException e){
- throw new UnsupportedEncodingException("Encoding: "+enc+
- " not found.");
- } catch(UnsupportedCharsetException e){
- throw new UnsupportedEncodingException("Encoding: "+enc+
- " not found.");
- } catch(CharacterCodingException e){
- // XXX - Ignore coding exceptions? They shouldn't really happen.
- return null;
+ }
+ catch(IllegalCharsetNameException e)
+ {
+ throw new UnsupportedEncodingException("Encoding: " + enc
+ + " not found.");
+ }
+ catch(UnsupportedCharsetException e)
+ {
+ throw new UnsupportedEncodingException("Encoding: " + enc
+ + " not found.");
+ }
+ catch(CharacterCodingException e)
+ {
+ // This shouldn't ever happen.
+ throw (InternalError) new InternalError().initCause(e);
}
}
@@ -726,6 +787,26 @@ public final class String implements Serializable, Comparable, CharSequence
}
/**
+ * Compares the given CharSequence to this String. This is true if
+ * the CharSequence has the same content as this String at this
+ * moment.
+ *
+ * @param seq the CharSequence to compare to
+ * @return true if CharSequence has the same character sequence
+ * @throws NullPointerException if the given CharSequence is null
+ * @since 1.5
+ */
+ public boolean contentEquals(CharSequence seq)
+ {
+ if (seq.length() != count)
+ return false;
+ for (int i = 0; i < count; ++i)
+ if (value[offset + i] != seq.charAt(i))
+ return false;
+ return true;
+ }
+
+ /**
* Compares a String to this String, ignoring case. This does not handle
* multi-character capitalization exceptions; instead the comparison is
* made on a character-by-character basis, and is true if:<br><ul>
@@ -1546,6 +1627,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @return String containing the chars from data[offset..offset+count]
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(char[], int, int)
@@ -1566,6 +1648,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @return String containing the chars from data[offset..offset+count]
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(char[], int, int)
@@ -1677,6 +1760,49 @@ public final class String implements Serializable, Comparable, CharSequence
}
/**
+ * Return the number of code points between two indices in the
+ * <code>StringBuffer</code>. An unpaired surrogate counts as a
+ * code point for this purpose. Characters outside the indicated
+ * range are not examined, even if the range ends in the middle of a
+ * surrogate pair.
+ *
+ * @param start the starting index
+ * @param end one past the ending index
+ * @return the number of code points
+ * @since 1.5
+ */
+ public synchronized int codePointCount(int start, int end)
+ {
+ if (start < 0 || end >= count || start > end)
+ throw new StringIndexOutOfBoundsException();
+
+ start += offset;
+ end += offset;
+ int count = 0;
+ while (start < end)
+ {
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
+ }
+ return count;
+ }
+
+ /**
* Helper function used to detect which characters have a multi-character
* uppercase expansion. Note that this is only used in locations which
* track one-to-many capitalization (java.lang.Character does not do this).
@@ -1747,4 +1873,43 @@ public final class String implements Serializable, Comparable, CharSequence
return value;
}
+
+ /**
+ * Returns true iff this String contains the sequence of Characters
+ * described in s.
+ * @param s the CharSequence
+ * @return true iff this String contains s
+ */
+ public boolean contains (CharSequence s)
+ {
+ return this.indexOf(s.toString()) != -1;
+ }
+
+ /**
+ * Returns a string that is this string with all instances of the sequence
+ * represented by <code>target</code> replaced by the sequence in
+ * <code>replacement</code>.
+ * @param target the sequence to be replaced
+ * @param replacement the sequence used as the replacement
+ * @return the string constructed as above
+ */
+ public String replace (CharSequence target, CharSequence replacement)
+ {
+ String targetString = target.toString();
+ String replaceString = replacement.toString();
+ int targetLength = target.length();
+ int replaceLength = replacement.length();
+
+ int startPos = this.indexOf(targetString);
+ StringBuilder result = new StringBuilder(this);
+ while (startPos != -1)
+ {
+ // Replace the target with the replacement
+ result.replace(startPos, startPos + targetLength, replaceString);
+
+ // Search for a new occurrence of the target
+ startPos = result.indexOf(targetString, startPos + replaceLength);
+ }
+ return result.toString();
+ }
}
diff --git a/libjava/classpath/java/lang/StringBuffer.java b/libjava/classpath/java/lang/StringBuffer.java
index 94dec4878cb..caffd6e7050 100644
--- a/libjava/classpath/java/lang/StringBuffer.java
+++ b/libjava/classpath/java/lang/StringBuffer.java
@@ -148,6 +148,24 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Create a new <code>StringBuffer</code> with the characters from the
+ * specified <code>CharSequence</code>. Initial capacity will be the
+ * size of the CharSequence plus 16.
+ *
+ * @param sequence the <code>String</code> to convert
+ * @throws NullPointerException if str is null
+ *
+ * @since 1.5
+ */
+ public StringBuffer(CharSequence sequence)
+ {
+ count = Math.max(0, sequence.length());
+ value = new char[count + DEFAULT_CAPACITY];
+ for (int i = 0; i < count; ++i)
+ value[i] = sequence.charAt(i);
+ }
+
+ /**
* Get the length of the <code>String</code> this <code>StringBuffer</code>
* would create. Not to be confused with the <em>capacity</em> of the
* <code>StringBuffer</code>.
@@ -234,7 +252,6 @@ public final class StringBuffer implements Serializable, CharSequence
* @param index the index of the character to get, starting at 0
* @return the character at the specified index
* @throws IndexOutOfBoundsException if index is negative or &gt;= length()
- * (while unspecified, this is a StringIndexOutOfBoundsException)
*/
public synchronized char charAt(int index)
{
@@ -244,6 +261,39 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Get the code point at the specified index. This is like #charAt(int),
+ * but if the character is the start of a surrogate pair, and the
+ * following character completes the pair, then the corresponding
+ * supplementary code point is returned.
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public synchronized int codePointAt(int index)
+ {
+ return Character.codePointAt(value, index, count);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(int), but checks the characters at <code>index-1</code> and
+ * <code>index-2</code> to see if they form a supplementary code point.
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public synchronized int codePointBefore(int index)
+ {
+ // Character.codePointBefore() doesn't perform this check. We
+ // could use the CharSequence overload, but this is just as easy.
+ if (index >= count)
+ throw new IndexOutOfBoundsException();
+ return Character.codePointBefore(value, index, 1);
+ }
+
+ /**
* Get the specified array of characters. <code>srcOffset - srcEnd</code>
* characters will be copied into the array you pass in.
*
@@ -341,6 +391,46 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Append the <code>CharSequence</code> value of the argument to this
+ * <code>StringBuffer</code>.
+ *
+ * @param sequence the <code>CharSequence</code> to append
+ * @return this <code>StringBuffer</code>
+ * @see #append(Object)
+ * @since 1.5
+ */
+ public synchronized StringBuffer append(CharSequence sequence)
+ {
+ if (sequence == null)
+ sequence = "null";
+ return append(sequence, 0, sequence.length());
+ }
+
+ /**
+ * Append the specified subsequence of the <code>CharSequence</code>
+ * argument to this <code>StringBuffer</code>.
+ *
+ * @param sequence the <code>CharSequence</code> to append
+ * @param start the starting index
+ * @param end one past the ending index
+ * @return this <code>StringBuffer</code>
+ * @see #append(Object)
+ * @since 1.5
+ */
+ public synchronized StringBuffer append(CharSequence sequence,
+ int start, int end)
+ {
+ if (sequence == null)
+ sequence = "null";
+ if (start < 0 || end < 0 || start > end || end > sequence.length())
+ throw new IndexOutOfBoundsException();
+ ensureCapacity_unsynchronized(this.count + end - start);
+ for (int i = start; i < end; ++i)
+ value[count++] = sequence.charAt(i);
+ return this;
+ }
+
+ /**
* Append the <code>char</code> array to this <code>StringBuffer</code>.
* This is similar (but more efficient) than
* <code>append(new String(data))</code>, except in the case of null.
@@ -407,6 +497,25 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Append the code point to this <code>StringBuffer</code>.
+ * This is like #append(char), but will append two characters
+ * if a supplementary code point is given.
+ *
+ * @param code the code point to append
+ * @return this <code>StringBuffer</code>
+ * @see Character#toChars(int, char[], int)
+ * @since 1.5
+ */
+ public synchronized StringBuffer appendCodePoint(int code)
+ {
+ int len = Character.charCount(code);
+ ensureCapacity_unsynchronized(count + len);
+ Character.toChars(code, value, count);
+ count += len;
+ return this;
+ }
+
+ /**
* Append the <code>String</code> value of the argument to this
* <code>StringBuffer</code>. Uses <code>String.valueOf()</code> to convert
* to <code>String</code>.
@@ -660,6 +769,54 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Insert the <code>CharSequence</code> argument into this
+ * <code>StringBuffer</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @return this <code>StringBuffer</code>
+ * @throws IndexOutOfBoundsException if offset is out of bounds
+ * @since 1.5
+ */
+ public synchronized StringBuffer insert(int offset, CharSequence sequence)
+ {
+ if (sequence == null)
+ sequence = "null";
+ return insert(offset, sequence, 0, sequence.length());
+ }
+
+ /**
+ * Insert a subsequence of the <code>CharSequence</code> argument into this
+ * <code>StringBuffer</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @param start the starting index of the subsequence
+ * @param end one past the ending index of the subsequence
+ * @return this <code>StringBuffer</code>
+ * @throws IndexOutOfBoundsException if offset, start,
+ * or end are out of bounds
+ * @since 1.5
+ */
+ public synchronized StringBuffer insert(int offset, CharSequence sequence,
+ int start, int end)
+ {
+ if (sequence == null)
+ sequence = "null";
+ if (start < 0 || end < 0 || start > end || end > sequence.length())
+ throw new IndexOutOfBoundsException();
+ int len = end - start;
+ ensureCapacity_unsynchronized(count + len);
+ VMSystem.arraycopy(value, offset, value, offset + len, count - offset);
+ for (int i = start; i < end; ++i)
+ value[offset++] = sequence.charAt(i);
+ count += len;
+ return this;
+ }
+
+ /**
* Insert the <code>char[]</code> argument into this
* <code>StringBuffer</code>.
*
@@ -880,6 +1037,106 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * This may reduce the amount of memory used by the StringBuffer,
+ * by resizing the internal array to remove unused space. However,
+ * this method is not required to resize, so this behavior cannot
+ * be relied upon.
+ * @since 1.5
+ */
+ public synchronized void trimToSize()
+ {
+ int wouldSave = value.length - count;
+ // Some random heuristics: if we save less than 20 characters, who
+ // cares.
+ if (wouldSave < 20)
+ return;
+ // If we save more than 200 characters, shrink.
+ // If we save more than 1/4 of the buffer, shrink.
+ if (wouldSave > 200 || wouldSave * 4 > value.length)
+ {
+ char[] newValue = new char[count];
+ VMSystem.arraycopy(value, 0, newValue, 0, count);
+ value = newValue;
+ }
+ }
+
+ /**
+ * Return the number of code points between two indices in the
+ * <code>StringBuffer</code>. An unpaired surrogate counts as a
+ * code point for this purpose. Characters outside the indicated
+ * range are not examined, even if the range ends in the middle of a
+ * surrogate pair.
+ *
+ * @param start the starting index
+ * @param end one past the ending index
+ * @return the number of code points
+ * @since 1.5
+ */
+ public synchronized int codePointCount(int start, int end)
+ {
+ if (start < 0 || end >= count || start > end)
+ throw new StringIndexOutOfBoundsException();
+
+ int count = 0;
+ while (start < end)
+ {
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
+ }
+ return count;
+ }
+
+ /**
+ * Starting at the given index, this counts forward by the indicated
+ * number of code points, and then returns the resulting index. An
+ * unpaired surrogate counts as a single code point for this
+ * purpose.
+ *
+ * @param start the starting index
+ * @param codePoints the number of code points
+ * @return the resulting index
+ * @since 1.5
+ */
+ public synchronized int offsetByCodePoints(int start, int codePoints)
+ {
+ while (codePoints > 0)
+ {
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ --codePoints;
+ }
+ return start;
+ }
+
+ /**
* An unsynchronized version of ensureCapacity, used internally to avoid
* the cost of a second lock on the same object. This also has the side
* effect of duplicating the array, if it was shared (to form copy-on-write
diff --git a/libjava/classpath/java/lang/StringBuilder.java b/libjava/classpath/java/lang/StringBuilder.java
index b54c8ef7eb4..470f1ba9ad5 100644
--- a/libjava/classpath/java/lang/StringBuilder.java
+++ b/libjava/classpath/java/lang/StringBuilder.java
@@ -464,6 +464,25 @@ public final class StringBuilder
}
/**
+ * Append the code point to this <code>StringBuilder</code>.
+ * This is like #append(char), but will append two characters
+ * if a supplementary code point is given.
+ *
+ * @param code the code point to append
+ * @return this <code>StringBuilder</code>
+ * @see Character#toChars(int, char[], int)
+ * @since 1.5
+ */
+ public synchronized StringBuilder appendCodePoint(int code)
+ {
+ int len = Character.charCount(code);
+ ensureCapacity(count + len);
+ Character.toChars(code, value, count);
+ count += len;
+ return this;
+ }
+
+ /**
* Append the <code>String</code> value of the argument to this
* <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
* to <code>String</code>.
@@ -705,6 +724,52 @@ public final class StringBuilder
}
/**
+ * Insert the <code>CharSequence</code> argument into this
+ * <code>StringBuilder</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @return this <code>StringBuilder</code>
+ * @throws IndexOutOfBoundsException if offset is out of bounds
+ */
+ public synchronized StringBuilder insert(int offset, CharSequence sequence)
+ {
+ if (sequence == null)
+ sequence = "null";
+ return insert(offset, sequence, 0, sequence.length());
+ }
+
+ /**
+ * Insert a subsequence of the <code>CharSequence</code> argument into this
+ * <code>StringBuilder</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @param start the starting index of the subsequence
+ * @param end one past the ending index of the subsequence
+ * @return this <code>StringBuilder</code>
+ * @throws IndexOutOfBoundsException if offset, start,
+ * or end are out of bounds
+ */
+ public synchronized StringBuilder insert(int offset, CharSequence sequence,
+ int start, int end)
+ {
+ if (sequence == null)
+ sequence = "null";
+ if (start < 0 || end < 0 || start > end || end > sequence.length())
+ throw new IndexOutOfBoundsException();
+ int len = end - start;
+ ensureCapacity(count + len);
+ VMSystem.arraycopy(value, offset, value, offset + len, count - offset);
+ for (int i = start; i < end; ++i)
+ value[offset++] = sequence.charAt(i);
+ count += len;
+ return this;
+ }
+
+ /**
* Insert the <code>char[]</code> argument into this
* <code>StringBuilder</code>.
*
diff --git a/libjava/classpath/java/lang/System.java b/libjava/classpath/java/lang/System.java
index e466d3b8cfb..ea84dba47e2 100644
--- a/libjava/classpath/java/lang/System.java
+++ b/libjava/classpath/java/lang/System.java
@@ -464,7 +464,7 @@ public final class System
*
* @param finalizeOnExit whether to run finalizers on exit
* @throws SecurityException if permission is denied
- * @see Runtime#runFinalizersOnExit()
+ * @see Runtime#runFinalizersOnExit(boolean)
* @since 1.1
* @deprecated never rely on finalizers to do a clean, thread-safe,
* mop-up from your code
diff --git a/libjava/classpath/java/lang/Thread.java b/libjava/classpath/java/lang/Thread.java
index 37ca630b4ed..763228c16ef 100644
--- a/libjava/classpath/java/lang/Thread.java
+++ b/libjava/classpath/java/lang/Thread.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.lang;
+import java.security.Permission;
import java.util.Map;
import java.util.WeakHashMap;
@@ -704,7 +705,7 @@ public class Thread implements Runnable
*
* @return the context class loader
* @throws SecurityException when permission is denied
- * @see setContextClassLoader(ClassLoader)
+ * @see #setContextClassLoader(ClassLoader)
* @since 1.2
*/
public synchronized ClassLoader getContextClassLoader()
@@ -726,7 +727,7 @@ public class Thread implements Runnable
*
* @param classloader the new context class loader
* @throws SecurityException when permission is denied
- * @see getContextClassLoader()
+ * @see #getContextClassLoader()
* @since 1.2
*/
public synchronized void setContextClassLoader(ClassLoader classloader)
@@ -812,8 +813,11 @@ public class Thread implements Runnable
{
// Check parameters
- if (ms < 0 || ns < 0 || ns > 999999)
- throw new IllegalArgumentException();
+ if (ms < 0 )
+ throw new IllegalArgumentException("Negative milliseconds: " + ms);
+
+ if (ns < 0 || ns > 999999)
+ throw new IllegalArgumentException("Nanoseconds ouf of range: " + ns);
// Really sleep
VMThread.sleep(ms, ns);
diff --git a/libjava/classpath/java/lang/ThreadLocal.java b/libjava/classpath/java/lang/ThreadLocal.java
index 0b2b60867b9..bc839044574 100644
--- a/libjava/classpath/java/lang/ThreadLocal.java
+++ b/libjava/classpath/java/lang/ThreadLocal.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.lang;
import java.util.Map;
-import java.util.WeakHashMap;
/**
diff --git a/libjava/classpath/java/lang/ref/Reference.java b/libjava/classpath/java/lang/ref/Reference.java
index 1ec72438198..4b6a3adbcc1 100644
--- a/libjava/classpath/java/lang/ref/Reference.java
+++ b/libjava/classpath/java/lang/ref/Reference.java
@@ -68,7 +68,7 @@ package java.lang.ref;
* work. It is useful to keep track, when an object is finalized.
*
* @author Jochen Hoenicke
- * @see java.util.WeakHashtable
+ * @see java.util.WeakHashMap
*/
public abstract class Reference
{
@@ -104,7 +104,7 @@ public abstract class Reference
* Creates a new reference that is not registered to any queue.
* Since it is package private, it is not possible to overload this
* class in a different package.
- * @param referent the object we refer to.
+ * @param ref the object we refer to.
*/
Reference(Object ref)
{
@@ -115,7 +115,7 @@ public abstract class Reference
* Creates a reference that is registered to a queue. Since this is
* package private, it is not possible to overload this class in a
* different package.
- * @param referent the object we refer to.
+ * @param ref the object we refer to.
* @param q the reference queue to register on.
* @exception NullPointerException if q is null.
*/
diff --git a/libjava/classpath/java/lang/ref/WeakReference.java b/libjava/classpath/java/lang/ref/WeakReference.java
index 9f758ca1eab..b4018fbb55e 100644
--- a/libjava/classpath/java/lang/ref/WeakReference.java
+++ b/libjava/classpath/java/lang/ref/WeakReference.java
@@ -52,7 +52,7 @@ package java.lang.ref;
* automatically cleared, and you may remove it from the set. <br>
*
* @author Jochen Hoenicke
- * @see java.util.WeakHashtable
+ * @see java.util.WeakHashMap
*/
public class WeakReference
extends Reference
diff --git a/libjava/classpath/java/lang/reflect/Member.java b/libjava/classpath/java/lang/reflect/Member.java
index 9983b275a94..c39731f8487 100644
--- a/libjava/classpath/java/lang/reflect/Member.java
+++ b/libjava/classpath/java/lang/reflect/Member.java
@@ -60,7 +60,7 @@ public interface Member
* package-protected, but only which are declared in this class.
* Used in SecurityManager.checkMemberAccess() to determine the
* type of members to access.
- * @see SecurityManager#checkMemberAccess()
+ * @see SecurityManager#checkMemberAccess(Class, int)
*/
int DECLARED = 1;
@@ -68,7 +68,7 @@ public interface Member
* Represents public members only, but includes all inherited members.
* Used in SecurityManager.checkMemberAccess() to determine the type of
* members to access.
- * @see SecurityManager#checkMemberAccess()
+ * @see SecurityManager#checkMemberAccess(Class, int)
*/
int PUBLIC = 0;
diff --git a/libjava/classpath/java/lang/reflect/Proxy.java b/libjava/classpath/java/lang/reflect/Proxy.java
index 7a5fd30de16..137cb5a48a6 100644
--- a/libjava/classpath/java/lang/reflect/Proxy.java
+++ b/libjava/classpath/java/lang/reflect/Proxy.java
@@ -100,7 +100,7 @@ import java.util.Set;
* belongs to the classloader you designated.</li>
* <li>Reflection works as expected: {@link Class#getInterfaces()} and
* {@link Class#getMethods()} work as they do on normal classes.</li>
- * <li>The method {@link #isProxyClass()} will distinguish between
+ * <li>The method {@link #isProxyClass(Class)} will distinguish between
* true proxy classes and user extensions of this class. It only
* returns true for classes created by {@link #getProxyClass}.</li>
* <li>The {@link ProtectionDomain} of a proxy class is the same as for
@@ -111,8 +111,8 @@ import java.util.Set;
* the only way to create an instance of the proxy class.</li>
* <li>The proxy class contains a single constructor, which takes as
* its only argument an {@link InvocationHandler}. The method
- * {@link #newInstance} is shorthand to do the necessary
- * reflection.</li>
+ * {@link #newProxyInstance(ClassLoader, Class[], InvocationHandler)}
+ * is shorthand to do the necessary reflection.</li>
* </ul>
*
* <h3>Proxy Instances</h3>
@@ -126,7 +126,7 @@ import java.util.Set;
* a {@link ClassCastException}.</li>
* <li>Each proxy instance has an invocation handler, which can be
* accessed by {@link #getInvocationHandler(Object)}. Any call
- * to an interface method, including {@link Object#hashcode()},
+ * to an interface method, including {@link Object#hashCode()},
* {@link Object#equals(Object)}, or {@link Object#toString()},
* but excluding the public final methods of Object, will be
* encoded and passed to the {@link InvocationHandler#invoke}
@@ -413,8 +413,6 @@ public class Proxy implements Serializable
*/
ProxyType(ClassLoader loader, Class[] interfaces)
{
- if (loader == null)
- loader = ClassLoader.getSystemClassLoader();
this.loader = loader;
this.interfaces = interfaces;
}
@@ -426,8 +424,7 @@ public class Proxy implements Serializable
*/
public int hashCode()
{
- //loader is always not null
- int hash = loader.hashCode();
+ int hash = loader == null ? 0 : loader.hashCode();
for (int i = 0; i < interfaces.length; i++)
hash = hash * 31 + interfaces[i].hashCode();
return hash;
@@ -436,7 +433,7 @@ public class Proxy implements Serializable
/**
* Calculates equality.
*
- * @param the object to compare to
+ * @param other object to compare to
* @return true if it is a ProxyType with same data
*/
public boolean equals(Object other)
@@ -586,7 +583,7 @@ public class Proxy implements Serializable
/**
* Calculates equality.
*
- * @param the object to compare to
+ * @param other object to compare to
* @return true if it is a ProxySignature with same data
*/
public boolean equals(Object other)
@@ -617,7 +614,7 @@ public class Proxy implements Serializable
* The package this class is in <b>including the trailing dot</b>
* or an empty string for the unnamed (aka default) package.
*/
- String pack;
+ String pack = "";
/**
* The interfaces this class implements. Non-null, but possibly empty.
diff --git a/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java b/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java
index 6d5a8008459..ea574ad7c61 100644
--- a/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java
+++ b/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java
@@ -65,7 +65,7 @@ public class UndeclaredThrowableException extends RuntimeException
/**
* The immutable exception that this wraps. This field is redundant
- * with {@link Throwable#cause}, but is necessary for serial compatibility.
+ * with {@link Throwable#getCause()}, but is necessary for serial compatibility.
*
* @serial the chained exception
*/
diff --git a/libjava/classpath/java/math/BigDecimal.java b/libjava/classpath/java/math/BigDecimal.java
index d99be0f56ba..693c399874e 100644
--- a/libjava/classpath/java/math/BigDecimal.java
+++ b/libjava/classpath/java/math/BigDecimal.java
@@ -43,12 +43,27 @@ public class BigDecimal extends Number implements Comparable
private int scale;
private static final long serialVersionUID = 6108874887143696463L;
- private static final BigDecimal ZERO =
+ /**
+ * The constant zero as a BigDecimal with scale zero.
+ * @since 1.5
+ */
+ public static final BigDecimal ZERO =
new BigDecimal (BigInteger.valueOf (0), 0);
- private static final BigDecimal ONE =
+ /**
+ * The constant one as a BigDecimal with scale zero.
+ * @since 1.5
+ */
+ public static final BigDecimal ONE =
new BigDecimal (BigInteger.valueOf (1), 0);
+ /**
+ * The constant ten as a BigDecimal with scale zero.
+ * @since 1.5
+ */
+ public static final BigDecimal TEN =
+ new BigDecimal (BigInteger.valueOf (10), 0);
+
public static final int ROUND_UP = 0;
public static final int ROUND_DOWN = 1;
public static final int ROUND_CEILING = 2;
diff --git a/libjava/classpath/java/math/BigInteger.java b/libjava/classpath/java/math/BigInteger.java
index 82f550d144c..5a336b87248 100644
--- a/libjava/classpath/java/math/BigInteger.java
+++ b/libjava/classpath/java/math/BigInteger.java
@@ -76,7 +76,8 @@ public class BigInteger extends Number implements Comparable
private static final long serialVersionUID = -8287574255936472291L;
- /** We pre-allocate integers in the range minFixNum..maxFixNum. */
+ /** We pre-allocate integers in the range minFixNum..maxFixNum.
+ * Note that we must at least preallocate 0, 1, and 10. */
private static final int minFixNum = -100;
private static final int maxFixNum = 1024;
private static final int numFixNum = maxFixNum-minFixNum+1;
@@ -87,11 +88,23 @@ public class BigInteger extends Number implements Comparable
smallFixNums[i] = new BigInteger(i + minFixNum);
}
- // JDK1.2
+ /**
+ * The constant zero as a BigInteger.
+ * @since 1.2
+ */
public static final BigInteger ZERO = smallFixNums[-minFixNum];
- // JDK1.2
+ /**
+ * The constant one as a BigInteger.
+ * @since 1.2
+ */
public static final BigInteger ONE = smallFixNums[1 - minFixNum];
+
+ /**
+ * The constant ten as a BigInteger.
+ * @since 1.5
+ */
+ public static final BigInteger TEN = smallFixNums[10 - minFixNum];
/* Rounding modes: */
private static final int FLOOR = 1;
diff --git a/libjava/classpath/java/net/DatagramSocket.java b/libjava/classpath/java/net/DatagramSocket.java
index 875ddc778e9..40bafbb34dd 100644
--- a/libjava/classpath/java/net/DatagramSocket.java
+++ b/libjava/classpath/java/net/DatagramSocket.java
@@ -484,7 +484,6 @@ public class DatagramSocket
* @param address The address to connect this socket to.
* @param port The port to connect this socket to.
*
- * @exception SocketException If an error occurs.
* @exception IllegalArgumentException If address or port are invalid.
* @exception SecurityException If the caller is not allowed to send
* datagrams to or receive from this address and port.
diff --git a/libjava/classpath/java/net/Inet4Address.java b/libjava/classpath/java/net/Inet4Address.java
index 74ce6efb828..c80f1f175a2 100644
--- a/libjava/classpath/java/net/Inet4Address.java
+++ b/libjava/classpath/java/net/Inet4Address.java
@@ -70,7 +70,7 @@ public final class Inet4Address extends InetAddress
* only by static methods in this class.
*
* @param addr The IP number of this address as an array of bytes
- * @param hostname The hostname of this IP address.
+ * @param host The hostname of this IP address.
*/
Inet4Address(byte[] addr, String host)
{
diff --git a/libjava/classpath/java/net/InetSocketAddress.java b/libjava/classpath/java/net/InetSocketAddress.java
index 30d34e7e808..edeaf27753c 100644
--- a/libjava/classpath/java/net/InetSocketAddress.java
+++ b/libjava/classpath/java/net/InetSocketAddress.java
@@ -216,6 +216,6 @@ public class InetSocketAddress extends SocketAddress
*/
public String toString()
{
- return (addr == null ? hostname : addr.getHostName()) + ":" + port;
+ return (addr == null ? hostname : addr.toString()) + ":" + port;
}
}
diff --git a/libjava/classpath/java/net/ServerSocket.java b/libjava/classpath/java/net/ServerSocket.java
index f73c7482aa5..afc861403a1 100644
--- a/libjava/classpath/java/net/ServerSocket.java
+++ b/libjava/classpath/java/net/ServerSocket.java
@@ -316,7 +316,8 @@ public class ServerSocket
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
- sm.checkListen(impl.getLocalPort());
+ sm.checkAccept(impl.getInetAddress().getHostAddress(),
+ impl.getLocalPort());
Socket socket = new Socket();
@@ -369,6 +370,7 @@ public class ServerSocket
impl.accept(socket.impl);
socket.implCreated = true;
+ socket.bound = true;
}
/**
diff --git a/libjava/classpath/java/net/Socket.java b/libjava/classpath/java/net/Socket.java
index 9432a6be1d8..0ff6e6ea032 100644
--- a/libjava/classpath/java/net/Socket.java
+++ b/libjava/classpath/java/net/Socket.java
@@ -91,8 +91,9 @@ public class Socket
/**
* True if the socket is bound.
+ * Package private so it can be set from ServerSocket when accept is called.
*/
- private boolean bound;
+ boolean bound;
/**
* True if input is shutdown.
@@ -324,7 +325,9 @@ public class Socket
}
catch (IOException e)
{
- throw new SocketException(e.getMessage());
+ SocketException se = new SocketException(e.toString());
+ se.initCause(e);
+ throw se;
}
return impl;
@@ -481,7 +484,7 @@ public class Socket
/**
* Returns the local address to which this socket is bound. If this socket
* is not connected, then a wildcard address, for which
- * @see isAnyLocalAddress() is <code>true</code>, is returned.
+ * @see InetAddress#isAnyLocalAddress() is <code>true</code>, is returned.
*
* @return The local address
*
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java
index 85b38578169..726778eba0f 100644
--- a/libjava/classpath/java/net/URLClassLoader.java
+++ b/libjava/classpath/java/net/URLClassLoader.java
@@ -235,12 +235,10 @@ public class URLClassLoader extends SecureClassLoader
abstract static class Resource
{
final URLLoader loader;
- final String name;
- Resource(URLLoader loader, String name)
+ Resource(URLLoader loader)
{
this.loader = loader;
- this.name = name;
}
/**
@@ -391,11 +389,13 @@ public class URLClassLoader extends SecureClassLoader
static final class JarURLResource extends Resource
{
private final JarEntry entry;
+ private final String name;
JarURLResource(JarURLLoader loader, String name, JarEntry entry)
{
- super(loader, name);
+ super(loader);
this.entry = entry;
+ this.name = name;
}
InputStream getInputStream() throws IOException
@@ -496,7 +496,7 @@ public class URLClassLoader extends SecureClassLoader
RemoteResource(RemoteURLLoader loader, String name, URL url,
InputStream stream, int length)
{
- super(loader, name);
+ super(loader);
this.url = url;
this.stream = stream;
this.length = length;
@@ -535,9 +535,16 @@ public class URLClassLoader extends SecureClassLoader
/** get resource with the name "name" in the file url */
Resource getResource(String name)
{
- File file = new File(dir, name);
- if (file.exists() && !file.isDirectory())
- return new FileResource(this, name, file);
+ try
+ {
+ File file = new File(dir, name).getCanonicalFile();
+ if (file.exists() && !file.isDirectory())
+ return new FileResource(this, file);
+ }
+ catch (IOException e)
+ {
+ // Fall through...
+ }
return null;
}
}
@@ -546,9 +553,9 @@ public class URLClassLoader extends SecureClassLoader
{
final File file;
- FileResource(FileURLLoader loader, String name, File file)
+ FileResource(FileURLLoader loader, File file)
{
- super(loader, name);
+ super(loader);
this.file = file;
}
@@ -566,8 +573,7 @@ public class URLClassLoader extends SecureClassLoader
{
try
{
- return new URL(loader.baseURL, name,
- loader.classloader.getURLStreamHandler("file"));
+ return file.toURL();
}
catch (MalformedURLException e)
{
@@ -701,7 +707,7 @@ public class URLClassLoader extends SecureClassLoader
private void addURLImpl(URL newUrl)
{
- synchronized (urlloaders)
+ synchronized (this)
{
if (newUrl == null)
return; // Silently ignore...
@@ -748,19 +754,42 @@ public class URLClassLoader extends SecureClassLoader
}
/**
- * Adds an array of new locations to the end of the internal URL store.
+ * Adds an array of new locations to the end of the internal URL
+ * store. Called from the the constructors. Should not call to the
+ * protected addURL() method since that can be overridden and
+ * subclasses are not yet in a good state at this point.
+ * jboss 4.0.3 for example depends on this.
+ *
* @param newUrls the locations to add
*/
private void addURLs(URL[] newUrls)
{
for (int i = 0; i < newUrls.length; i++)
- addURL(newUrls[i]);
+ {
+ urls.add(newUrls[i]);
+ addURLImpl(newUrls[i]);
+ }
+ }
+
+ /**
+ * Look in both Attributes for a given value. The first Attributes
+ * object, if not null, has precedence.
+ */
+ private String getAttributeValue(Attributes.Name name, Attributes first,
+ Attributes second)
+ {
+ String result = null;
+ if (first != null)
+ result = first.getValue(name);
+ if (result == null)
+ result = second.getValue(name);
+ return result;
}
/**
* Defines a Package based on the given name and the supplied manifest
- * information. The manifest indicates the tile, version and
- * vendor information of the specification and implementation and wheter the
+ * information. The manifest indicates the title, version and
+ * vendor information of the specification and implementation and whether the
* package is sealed. If the Manifest indicates that the package is sealed
* then the Package will be sealed with respect to the supplied URL.
*
@@ -768,20 +797,43 @@ public class URLClassLoader extends SecureClassLoader
* @param manifest The manifest describing the specification,
* implementation and sealing details of the package
* @param url the code source url to seal the package
- * @exception IllegalArgumentException If this package name already exists
- * in this class loader
* @return the defined Package
+ * @throws IllegalArgumentException If this package name already exists
+ * in this class loader
*/
protected Package definePackage(String name, Manifest manifest, URL url)
throws IllegalArgumentException
{
+ // Compute the name of the package as it may appear in the
+ // Manifest.
+ StringBuffer xform = new StringBuffer(name);
+ for (int i = xform.length () - 1; i >= 0; --i)
+ if (xform.charAt(i) == '.')
+ xform.setCharAt(i, '/');
+ xform.append('/');
+ String xformName = xform.toString();
+
+ Attributes entryAttr = manifest.getAttributes(xformName);
Attributes attr = manifest.getMainAttributes();
- String specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
- String specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
- String specVendor = attr.getValue(Attributes.Name.SPECIFICATION_VENDOR);
- String implTitle = attr.getValue(Attributes.Name.IMPLEMENTATION_TITLE);
- String implVersion = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
- String implVendor = attr.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
+
+ String specTitle
+ = getAttributeValue(Attributes.Name.SPECIFICATION_TITLE,
+ entryAttr, attr);
+ String specVersion
+ = getAttributeValue(Attributes.Name.SPECIFICATION_VERSION,
+ entryAttr, attr);
+ String specVendor
+ = getAttributeValue(Attributes.Name.SPECIFICATION_VENDOR,
+ entryAttr, attr);
+ String implTitle
+ = getAttributeValue(Attributes.Name.IMPLEMENTATION_TITLE,
+ entryAttr, attr);
+ String implVersion
+ = getAttributeValue(Attributes.Name.IMPLEMENTATION_VERSION,
+ entryAttr, attr);
+ String implVendor
+ = getAttributeValue(Attributes.Name.IMPLEMENTATION_VENDOR,
+ entryAttr, attr);
// Look if the Manifest indicates that this package is sealed
// XXX - most likely not completely correct!
@@ -793,8 +845,10 @@ public class URLClassLoader extends SecureClassLoader
// make sure that the URL is null so the package is not sealed
url = null;
- return definePackage(name, specTitle, specVersion, specVendor, implTitle,
- implVersion, implVendor, url);
+ return definePackage(name,
+ specTitle, specVendor, specVersion,
+ implTitle, implVendor, implVersion,
+ url);
}
/**
@@ -926,7 +980,7 @@ public class URLClassLoader extends SecureClassLoader
*/
public String toString()
{
- synchronized (urlloaders)
+ synchronized (this)
{
if (thisString == null)
{
diff --git a/libjava/classpath/java/net/URLConnection.java b/libjava/classpath/java/net/URLConnection.java
index 0a12d588d9a..836f174dae6 100644
--- a/libjava/classpath/java/net/URLConnection.java
+++ b/libjava/classpath/java/net/URLConnection.java
@@ -530,7 +530,7 @@ public abstract class URLConnection
}
/**
- * Returns the value of a flag indicating whether or not input is going
+ * Sets the value of a flag indicating whether or not input is going
* to be done for this connection. This default to true unless the
* doOutput flag is set to false, in which case this defaults to false.
*
@@ -560,7 +560,7 @@ public abstract class URLConnection
}
/**
- * Returns a boolean flag indicating whether or not output will be done
+ * Sets a boolean flag indicating whether or not output will be done
* on this connection. The default value is false, so this method can
* be used to override the default
*
@@ -851,7 +851,7 @@ public abstract class URLConnection
}
/**
- * Set's the ContentHandlerFactory for an application. This can be called
+ * Sets the ContentHandlerFactory for an application. This can be called
* once and only once. If it is called again, then an Error is thrown.
* Unlike for other set factory methods, this one does not do a security
* check prior to setting the factory.
@@ -933,7 +933,7 @@ public abstract class URLConnection
}
/**
- * This method set the <code>FileNameMap</code> object being used
+ * This method sets the <code>FileNameMap</code> object being used
* to decode MIME types by file extension.
*
* @param map The <code>FileNameMap</code>.
diff --git a/libjava/classpath/java/net/URLStreamHandler.java b/libjava/classpath/java/net/URLStreamHandler.java
index 57ce2dfa290..ed95092219e 100644
--- a/libjava/classpath/java/net/URLStreamHandler.java
+++ b/libjava/classpath/java/net/URLStreamHandler.java
@@ -411,8 +411,6 @@ public abstract class URLStreamHandler
* @param url2 The second URL.
*
* @return True if both URLs contain the same host.
- *
- * @exception UnknownHostException If an unknown host is found
*/
protected boolean hostsEqual(URL url1, URL url2)
{
@@ -511,18 +509,24 @@ public abstract class URLStreamHandler
int size = protocol.length() + authority.length() + file.length() + 24;
StringBuffer sb = new StringBuffer(size);
- if (protocol != null && protocol.length() > 0)
+ if (protocol.length() > 0)
{
sb.append(protocol);
sb.append(":");
}
- if (authority.length() != 0)
- {
- sb.append("//").append(authority);
- }
-
- sb.append(file);
+ // If we have superfluous leading slashes (that means, at least 2)
+ // we always add the authority component ("//" + host) to
+ // avoid ambiguity. Otherwise we would generate an URL like
+ // proto://home/foo
+ // where we meant:
+ // host: <empty> - file: //home/foo
+ // but URL spec says it is:
+ // host: home - file: /foo
+ if (authority.length() != 0 || file.startsWith("//") )
+ sb.append("//").append(authority).append(file);
+ else
+ sb.append(file);
if (ref != null)
sb.append('#').append(ref);
diff --git a/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java
index 42ceab7e2c1..847c02cce06 100644
--- a/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java
+++ b/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -43,6 +43,7 @@ import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
+import java.nio.channels.IllegalBlockingModeException;
import java.util.LinkedList;
import java.util.ListIterator;
@@ -209,6 +210,8 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
* @return the registered selection key
*
* @exception ClosedChannelException If the channel is already closed.
+ * @exception IllegalBlockingModeException If the channel is configured in
+ * blocking mode.
*/
public final SelectionKey register(Selector selin, int ops, Object att)
throws ClosedChannelException
@@ -224,6 +227,9 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
synchronized (blockingLock())
{
+ if (blocking)
+ throw new IllegalBlockingModeException();
+
key = locate(selector);
if (key != null && key.isValid())
diff --git a/libjava/classpath/java/nio/charset/Charset.java b/libjava/classpath/java/nio/charset/Charset.java
index 0476b0daa2c..91801ddac87 100644
--- a/libjava/classpath/java/nio/charset/Charset.java
+++ b/libjava/classpath/java/nio/charset/Charset.java
@@ -38,19 +38,15 @@ exception statement from your version. */
package java.nio.charset;
+import gnu.classpath.ServiceFactory;
import gnu.classpath.SystemProperties;
-
import gnu.java.nio.charset.Provider;
import gnu.java.nio.charset.iconv.IconvProvider;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.spi.CharsetProvider;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -174,7 +170,7 @@ public abstract class Charset implements Comparable
* Returns the Charset instance for the charset of the given name.
*
* @param charsetName
- * @return
+ * @return the Charset instance for the indicated charset
* @throws UnsupportedCharsetException if this VM does not support
* the charset of the given name.
* @throws IllegalCharsetNameException if the given charset name is
@@ -265,23 +261,10 @@ public abstract class Charset implements Comparable
{
try
{
- Enumeration en = ClassLoader.getSystemResources
- ("META-INF/services/java.nio.charset.spi.CharsetProvider");
+ Iterator i = ServiceFactory.lookupProviders(CharsetProvider.class);
LinkedHashSet set = new LinkedHashSet();
- while (en.hasMoreElements())
- {
- BufferedReader rdr = new BufferedReader(new InputStreamReader
- (((URL) (en.nextElement())).openStream()));
- while (true)
- {
- String s = rdr.readLine();
- if (s == null)
- break;
- CharsetProvider p =
- (CharsetProvider) ((Class.forName(s)).newInstance());
- set.add(p);
- }
- }
+ while (i.hasNext())
+ set.add(i.next());
providers = new CharsetProvider[set.size()];
set.toArray(providers);
diff --git a/libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java b/libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java
new file mode 100644
index 00000000000..249137b0863
--- /dev/null
+++ b/libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java
@@ -0,0 +1,110 @@
+/* ActivationGroup_Stub.java -- Stub class for ActivationGroup impls.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.rmi.activation;
+
+import java.lang.reflect.Method;
+import java.rmi.MarshalledObject;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+
+/**
+ * A stub class for {@link ActivationGroup} implementations.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class ActivationGroup_Stub extends RemoteStub
+ implements ActivationInstantiator, Remote
+{
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * Creates a new instance of ActivationGroup_Stub.
+ *
+ * @param ref the remote reference
+ */
+ public ActivationGroup_Stub(RemoteRef ref)
+ {
+ super(ref);
+ }
+
+ /**
+ * Stub method for <code>ActivationGroup.newInstance()</code>.
+ *
+ * @param id the activation ID
+ * @param desc the activation description
+ *
+ * @return the return value of the invocation
+ *
+ * @throws RemoteException if the invocation throws a RemoteException
+ * @throws ActivationException if the invocation throws an
+ * ActivationException
+ */
+ public MarshalledObject newInstance(ActivationID id, ActivationDesc desc)
+ throws RemoteException, ActivationException
+ {
+ try
+ {
+ Method method = ActivationGroup_Stub.class.getDeclaredMethod
+ ("newInstance", new Class[]{ ActivationID.class,
+ ActivationDesc.class });
+ return (MarshalledObject) ref.invoke(this, method,
+ new Object[]{id, desc},
+ -5274445189091581345L);
+ }
+ catch (RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch (RemoteException ex)
+ {
+ throw ex;
+ }
+ catch (ActivationException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new UnexpectedException("Unexpected exception", ex);
+ }
+ }
+}
diff --git a/libjava/classpath/java/rmi/server/LoaderHandler.java b/libjava/classpath/java/rmi/server/LoaderHandler.java
index 189085710b4..0489cd16634 100644
--- a/libjava/classpath/java/rmi/server/LoaderHandler.java
+++ b/libjava/classpath/java/rmi/server/LoaderHandler.java
@@ -45,7 +45,11 @@ import java.net.URL;
*/
public interface LoaderHandler
{
- String packagePrefix = "";
+ /**
+ * For binary compatibility with the JDK, the string "sun.rmi.server".
+ * Not actually used for anything.
+ */
+ String packagePrefix = "sun.rmi.server";
/**
* @deprecated
diff --git a/libjava/classpath/java/rmi/server/RMIClassLoader.java b/libjava/classpath/java/rmi/server/RMIClassLoader.java
index a7a7cb84a58..f8997fd7e09 100644
--- a/libjava/classpath/java/rmi/server/RMIClassLoader.java
+++ b/libjava/classpath/java/rmi/server/RMIClassLoader.java
@@ -38,14 +38,10 @@ exception statement from your version. */
package java.rmi.server;
+import gnu.java.rmi.server.RMIClassLoaderImpl;
+
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.StringTokenizer;
-
/**
* This class provides a set of public static utility methods for supporting
@@ -60,221 +56,77 @@ public class RMIClassLoader
*/
private RMIClassLoader() {}
- private static class MyClassLoader extends URLClassLoader
- {
- // Package-private to avoid a trampoline constructor.
- MyClassLoader (URL[] urls, ClassLoader parent, String annotation)
- {
- super (urls, parent);
- this.annotation = annotation;
- }
-
- private MyClassLoader (URL[] urls, ClassLoader parent)
- {
- super (urls, parent);
- this.annotation = urlToAnnotation (urls);
- }
-
- public static String urlToAnnotation (URL[] urls)
- {
- if (urls.length == 0)
- return null;
-
- StringBuffer annotation = new StringBuffer (64 * urls.length);
-
- for (int i = 0; i < urls.length; i++)
- {
- annotation.append (urls [i].toExternalForm());
- annotation.append (' ');
- }
-
- return annotation.toString();
- }
-
- public final String getClassAnnotation()
- {
- return annotation;
- }
-
- private final String annotation;
- }
-
- /**
- * This class is used to identify a cached classloader by its codebase and
- * the context classloader that is its parent.
- */
- private static class CacheKey
- {
- private String mCodeBase;
- private ClassLoader mContextClassLoader;
-
- public CacheKey (String theCodebase, ClassLoader theContextClassLoader)
- {
- mCodeBase = theCodebase;
- mContextClassLoader = theContextClassLoader;
- }
-
- /**
- * @return true if the codebase and the context classloader are equal
- */
- public boolean equals (Object theOther)
- {
- if (theOther instanceof CacheKey)
- {
- CacheKey key = (CacheKey) theOther;
-
- return (equals (this.mCodeBase,key.mCodeBase)
- && equals (this.mContextClassLoader, key.mContextClassLoader));
- }
- return false;
- }
-
- /**
- * Test if the two objects are equal or both null.
- * @param theOne
- * @param theOther
- * @return
- */
- private boolean equals (Object theOne, Object theOther)
- {
- return theOne != null ? theOne.equals (theOther) : theOther == null;
- }
-
- /**
- * @return hashCode
- */
- public int hashCode()
- {
- return ((mCodeBase != null ? mCodeBase.hashCode() : 0)
- ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1));
- }
-
- public String toString()
- {
- return "[" + mCodeBase + "," + mContextClassLoader + "]";
- }
-
- }
-
- private static Map cacheLoaders; //map annotations to loaders
- private static Map cacheAnnotations; //map loaders to annotations
-
- //defaultAnnotation is got from system property
- // "java.rmi.server.defaultAnnotation"
- private static String defaultAnnotation;
-
- //URL object for defaultAnnotation
- private static URL defaultCodebase;
-
- //class loader for defaultAnnotation
- private static MyClassLoader defaultLoader;
-
- static
- {
- // 89 is a nice prime number for Hashtable initial capacity
- cacheLoaders = new Hashtable (89);
- cacheAnnotations = new Hashtable (89);
-
- defaultAnnotation = System.getProperty ("java.rmi.server.defaultAnnotation");
-
- try
- {
- if (defaultAnnotation != null)
- defaultCodebase = new URL (defaultAnnotation);
- }
- catch (Exception _)
- {
- defaultCodebase = null;
- }
-
- if (defaultCodebase != null)
- {
- defaultLoader = new MyClassLoader (new URL[] { defaultCodebase }, null,
- defaultAnnotation);
- cacheLoaders.put (new CacheKey (defaultAnnotation,
- Thread.currentThread().getContextClassLoader()),
- defaultLoader);
- }
- }
-
/**
* @deprecated
*/
- public static Class loadClass (String name)
+ public static Class loadClass(String name)
throws MalformedURLException, ClassNotFoundException
{
- return loadClass ("", name);
+ return loadClass("", name);
}
- public static Class loadClass (String codebases, String name)
+ public static Class loadClass(String codebase, String name)
throws MalformedURLException, ClassNotFoundException
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- //try context class loader first
- try
- {
- return Class.forName(name, false, loader);
- }
- catch (ClassNotFoundException e)
- {
- // class not found in the local classpath
- }
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.loadClass(codebase, name, null);
+ }
- if (codebases.length() == 0) //==""
- {
- loader = defaultLoader;
- }
- else
- {
- loader = getClassLoader(codebases);
- }
+ public static Class loadClass(String codebase, String name,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.loadClass(codebase, name, defaultLoader);
+ }
- if (loader == null)
- {
- //do not throw NullPointerException
- throw new ClassNotFoundException ("Could not find class (" + name +
- ") at codebase (" + codebases + ")");
- }
-
- return Class.forName(name, false, loader);
+ /**
+ * Loads a class from <code>codeBase</code>.
+ *
+ * This method delegates to
+ * {@link RMIClassLoaderSpi#loadClass(String, String, ClassLoader)} and
+ * passes <code>codeBase.toString()</code> as first argument,
+ * <code>name</code> as second argument and <code>null</code> as third
+ * argument.
+ *
+ * @param codeBase the code base from which to load the class
+ * @param name the name of the class
+ *
+ * @return the loaded class
+ *
+ * @throws MalformedURLException if the URL is not well formed
+ * @throws ClassNotFoundException if the requested class cannot be found
+ */
+ public static Class loadClass(URL codeBase, String name)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.loadClass(codeBase.toString(), name, null);
}
/**
* Gets a classloader for the given codebase and with the current
* context classloader as parent.
*
- * @param codebases
+ * @param codebase
*
* @return a classloader for the given codebase
*
* @throws MalformedURLException if the codebase contains a malformed URL
*/
- public static ClassLoader getClassLoader (String codebases)
+ public static ClassLoader getClassLoader(String codebase)
throws MalformedURLException
{
- ClassLoader loader;
- CacheKey loaderKey = new CacheKey
- (codebases, Thread.currentThread().getContextClassLoader());
- loader = (ClassLoader) cacheLoaders.get (loaderKey);
-
- if (loader == null)
- {
- //create an entry in cacheLoaders mapping a loader to codebases.
- // codebases are separated by " "
- StringTokenizer tok = new StringTokenizer (codebases, " ");
- ArrayList urls = new ArrayList();
-
- while (tok.hasMoreTokens())
- urls.add (new URL (tok.nextToken()));
-
- loader = new MyClassLoader ((URL[]) urls.toArray (new URL [urls.size()]),
- Thread.currentThread().getContextClassLoader(),
- codebases);
- cacheLoaders.put (loaderKey, loader);
- }
-
- return loader;
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.getClassLoader(codebase);
}
/**
@@ -286,47 +138,12 @@ public class RMIClassLoader
* @return a space seperated list of URLs where the class-definition
* of cl may be found
*/
- public static String getClassAnnotation (Class cl)
+ public static String getClassAnnotation(Class cl)
{
- ClassLoader loader = cl.getClassLoader();
-
- if (loader == null
- || loader == ClassLoader.getSystemClassLoader())
- {
- return System.getProperty ("java.rmi.server.codebase");
- }
-
- if (loader instanceof MyClassLoader)
- {
- return ((MyClassLoader) loader).getClassAnnotation();
- }
-
- String s = (String) cacheAnnotations.get (loader);
-
- if (s != null)
- return s;
-
- if (loader instanceof URLClassLoader)
- {
- URL[] urls = ((URLClassLoader) loader).getURLs();
-
- if (urls.length == 0)
- return null;
-
- StringBuffer annotation = new StringBuffer (64 * urls.length);
-
- for (int i = 0; i < urls.length; i++)
- {
- annotation.append (urls [i].toExternalForm());
- annotation.append (' ');
- }
-
- s = annotation.toString();
- cacheAnnotations.put (loader, s);
- return s;
- }
-
- return System.getProperty ("java.rmi.server.codebase");
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.getClassAnnotation(cl);
}
/**
@@ -336,4 +153,25 @@ public class RMIClassLoader
{
throw new Error ("Not implemented");
}
+
+ /**
+ * Returns the default service provider for <code>RMIClassLoader</code>.
+ *
+ * @return the default provider for <code>RMIClassLoader</code>
+ */
+ public static RMIClassLoaderSpi getDefaultProviderInstance()
+ {
+ return RMIClassLoaderImpl.getInstance();
+ }
+
+ /**
+ * Chooses, instantiates and returns a service provider.
+ *
+ * @return a service provider
+ */
+ private static RMIClassLoaderSpi getProviderInstance()
+ {
+ // TODO: Do something more useful here.
+ return null;
+ }
}
diff --git a/libjava/classpath/java/rmi/server/RemoteObject.java b/libjava/classpath/java/rmi/server/RemoteObject.java
index 0b3c229c9d9..60e57dc2428 100644
--- a/libjava/classpath/java/rmi/server/RemoteObject.java
+++ b/libjava/classpath/java/rmi/server/RemoteObject.java
@@ -120,7 +120,9 @@ public boolean equals(Object obj) {
in.read (); //some unknown UnicastRef2 field
}
- cname = RemoteRef.packagePrefix + '.' + cname;
+ // 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);
diff --git a/libjava/classpath/java/rmi/server/RemoteRef.java b/libjava/classpath/java/rmi/server/RemoteRef.java
index 7e34db39e89..f33f9d374c3 100644
--- a/libjava/classpath/java/rmi/server/RemoteRef.java
+++ b/libjava/classpath/java/rmi/server/RemoteRef.java
@@ -48,7 +48,11 @@ public interface RemoteRef extends Externalizable
{
long serialVersionUID = 3632638527362204081L;
- String packagePrefix = "gnu.java.rmi.server";
+ /**
+ * For binary compatibility with the JDK, the string "sun.rmi.server".
+ * Not actually used for anything.
+ */
+ String packagePrefix = "sun.rmi.server";
/**
* @deprecated
diff --git a/libjava/classpath/java/security/AccessControlContext.java b/libjava/classpath/java/security/AccessControlContext.java
index 9a6ad208144..3b51e94125b 100644
--- a/libjava/classpath/java/security/AccessControlContext.java
+++ b/libjava/classpath/java/security/AccessControlContext.java
@@ -77,14 +77,23 @@ public final class AccessControlContext
/**
* Construct a new AccessControlContext with the specified
- * ProtectionDomains and DomainCombiner
+ * {@link ProtectionDomain}s and {@link DomainCombiner}.
*
+ * <p>Code calling this constructor must have a {@link
+ * SecurityPermission} of <i>createAccessControlContext</i>.</p>
+ *
+ * @throws SecurityException If the caller does not have permission
+ * to create an access control context.
* @since 1.3
*/
public AccessControlContext(AccessControlContext acc,
DomainCombiner combiner)
{
- // XXX check permission to call this.
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ {
+ sm.checkPermission (new SecurityPermission ("createAccessControlContext"));
+ }
AccessControlContext acc2 = AccessController.getContext();
protectionDomains = combiner.combine (acc2.protectionDomains,
acc.protectionDomains);
@@ -119,10 +128,20 @@ public final class AccessControlContext
public void checkPermission(Permission perm) throws AccessControlException
{
if (protectionDomains.length == 0)
- throw new AccessControlException ("permission not granted");
+ throw new AccessControlException ("permission "
+ + perm
+ + " not granted: no protection domains");
+
for (int i = 0; i < protectionDomains.length; i++)
- if (!protectionDomains[i].implies(perm))
- throw new AccessControlException ("permission not granted");
+ {
+ final ProtectionDomain domain = protectionDomains[i];
+ if (!domain.implies(perm))
+ throw new AccessControlException ("permission "
+ + perm
+ + " not granted: "
+ + domain
+ + " does not imply it.");
+ }
}
/**
@@ -173,4 +192,9 @@ public final class AccessControlContext
return h;
}
+
+ ProtectionDomain[] getProtectionDomains ()
+ {
+ return protectionDomains;
+ }
}
diff --git a/libjava/classpath/java/security/AccessController.java b/libjava/classpath/java/security/AccessController.java
index bc9c2deefbb..93e34b87c22 100644
--- a/libjava/classpath/java/security/AccessController.java
+++ b/libjava/classpath/java/security/AccessController.java
@@ -142,8 +142,8 @@ public final class AccessController
* @param action the <code>PrivilegedExceptionAction</code> whose
* <code>run()</code> should be be called.
* @return the result of the <code>action.run()</code> method.
- * @exception PrivilegedActionException wrapped around any exception that
- * is thrown in the <code>run()</code> method.
+ * @exception PrivilegedActionException wrapped around any checked exception
+ * that is thrown in the <code>run()</code> method.
*/
public static Object doPrivileged(PrivilegedExceptionAction action)
throws PrivilegedActionException
@@ -153,6 +153,10 @@ public final class AccessController
{
return action.run();
}
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
throw new PrivilegedActionException(e);
@@ -178,8 +182,8 @@ public final class AccessController
* @param context the <code>AccessControlContext</code> whose protection
* domains should be added to the protection domain of the calling class.
* @return the result of the <code>action.run()</code> method.
- * @exception PrivilegedActionException wrapped around any exception that
- * is thrown in the <code>run()</code> method.
+ * @exception PrivilegedActionException wrapped around any checked exception
+ * that is thrown in the <code>run()</code> method.
*/
public static Object doPrivileged(PrivilegedExceptionAction action,
AccessControlContext context)
@@ -190,6 +194,10 @@ public final class AccessController
{
return action.run();
}
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
throw new PrivilegedActionException(e);
diff --git a/libjava/classpath/java/security/Identity.java b/libjava/classpath/java/security/Identity.java
index 26b01a50a6b..7ef59cfe2de 100644
--- a/libjava/classpath/java/security/Identity.java
+++ b/libjava/classpath/java/security/Identity.java
@@ -297,8 +297,8 @@ public abstract class Identity implements Principal, Serializable
if (identity == this)
return true;
- if ((((Identity) identity).getName() == this.name) &&
- (((Identity) identity).getScope() == this.scope))
+ if ((((Identity) identity).getName().equals(this.name)) &&
+ (((Identity) identity).getScope().equals(this.scope)))
return true;
return identityEquals((Identity) identity);
@@ -319,8 +319,8 @@ public abstract class Identity implements Principal, Serializable
*/
protected boolean identityEquals(Identity identity)
{
- return ((identity.getName() == this.name) &&
- (identity.getPublicKey() == this.publicKey));
+ return ((identity.getName().equals(this.name)) &&
+ (identity.getPublicKey().equals(this.publicKey)));
}
/**
diff --git a/libjava/classpath/java/security/Security.java b/libjava/classpath/java/security/Security.java
index 54b97923efd..fd51d0535b3 100644
--- a/libjava/classpath/java/security/Security.java
+++ b/libjava/classpath/java/security/Security.java
@@ -1,5 +1,5 @@
/* Security.java --- Java base security class implementation
- Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -651,7 +651,7 @@ public final class Security
if (result.isEmpty())
return null;
- return (Provider[]) result.toArray(new Provider[0]);
+ return (Provider[]) result.toArray(new Provider[result.size()]);
}
private static void selectProviders(String svc, String algo, String attr,
diff --git a/libjava/classpath/java/text/AttributedString.java b/libjava/classpath/java/text/AttributedString.java
index 9f0d5af1c49..c751ab43cf8 100644
--- a/libjava/classpath/java/text/AttributedString.java
+++ b/libjava/classpath/java/text/AttributedString.java
@@ -49,7 +49,7 @@ import java.util.Set;
/**
* This class models a <code>String</code> with attributes over various
* subranges of the string. It allows applications to access this
- * information via the <code>AttributedCharcterIterator</code> interface.
+ * information via the <code>AttributedCharacterIterator</code> interface.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
@@ -166,16 +166,16 @@ public class AttributedString
*
* @param aci The <code>AttributedCharacterIterator</code> containing the
* text and attribute information.
- * @param begin_index The beginning index of the text subrange.
- * @param end_index The ending index of the text subrange.
+ * @param begin The beginning index of the text subrange.
+ * @param end The ending index of the text subrange.
* @param attributes A list of attributes to include from the iterator, or
* <code>null</code> to include all attributes.
*/
- public AttributedString(AttributedCharacterIterator aci, int begin_index,
- int end_index, AttributedCharacterIterator.Attribute[] attributes)
+ public AttributedString(AttributedCharacterIterator aci, int begin, int end,
+ AttributedCharacterIterator.Attribute[] attributes)
{
// Validate some arguments
- if ((begin_index < 0) || (end_index < begin_index))
+ if ((begin < 0) || (end < begin) || end > aci.getEndIndex())
throw new IllegalArgumentException("Bad index values");
StringBuffer sb = new StringBuffer("");
@@ -186,7 +186,7 @@ public class AttributedString
all_attribs.retainAll(Arrays.asList(attributes));
// Loop through and extract the attributes
- char c = aci.setIndex(begin_index);
+ char c = aci.setIndex(begin);
ArrayList accum = new ArrayList();
do
@@ -209,28 +209,28 @@ public class AttributedString
int rl = aci.getRunLimit(attrib);
if (rl == -1)
continue;
- if (rl > end_index)
- rl = end_index;
- rl -= begin_index;
+ if (rl > end)
+ rl = end;
+ rl -= begin;
// Check to see if we already processed this one
int rs = aci.getRunStart(attrib);
- if ((rs < aci.getIndex()) && (aci.getIndex() != begin_index))
+ if ((rs < aci.getIndex()) && (aci.getIndex() != begin))
continue;
// If the attribute run starts before the beginning index, we
// need to junk it if it is an Annotation.
Object attrib_obj = aci.getAttribute(attrib);
- if (rs < begin_index)
+ if (rs < begin)
{
if (attrib_obj instanceof Annotation)
continue;
- rs = begin_index;
+ rs = begin;
}
else
{
- rs -= begin_index;
+ rs -= begin;
}
// Create a map object. Yes this will only contain one attribute
@@ -269,22 +269,23 @@ public class AttributedString
*
* @param attrib The attribute to add.
* @param value The value of the attribute, which may be <code>null</code>.
- * @param begin_index The beginning index of the subrange.
- * @param end_index The ending index of the subrange.
+ * @param begin The beginning index of the subrange.
+ * @param end The ending index of the subrange.
*
* @exception IllegalArgumentException If attribute is <code>null</code> or
* the subrange is not valid.
*/
public void addAttribute(AttributedCharacterIterator.Attribute attrib,
- Object value, int begin_index, int end_index)
+ Object value, int begin, int end)
{
if (attrib == null)
throw new IllegalArgumentException("null attribute");
-
+ if (end <= begin)
+ throw new IllegalArgumentException("Requires end > begin");
HashMap hm = new HashMap();
hm.put(attrib, value);
- addAttributes(hm, begin_index, end_index);
+ addAttributes(hm, begin, end);
}
/**
@@ -295,16 +296,17 @@ public class AttributedString
* @param begin_index The beginning index.
* @param end_index The ending index
*
- * @throws IllegalArgumentException If the list is <code>null</code> or the
- * subrange is not valid.
+ * @throws NullPointerException if <code>attributes</code> is
+ * <code>null</code>.
+ * @throws IllegalArgumentException if the subrange is not valid.
*/
public void addAttributes(Map attributes, int begin_index, int end_index)
{
if (attributes == null)
- throw new IllegalArgumentException("null attribute");
+ throw new NullPointerException("null attribute");
if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
- (end_index < begin_index))
+ (end_index <= begin_index))
throw new IllegalArgumentException("bad range");
AttributeRange[] new_list = new AttributeRange[attribs.length + 1];
diff --git a/libjava/classpath/java/text/AttributedStringIterator.java b/libjava/classpath/java/text/AttributedStringIterator.java
index 7fba5d63c3a..f6b9b186831 100644
--- a/libjava/classpath/java/text/AttributedStringIterator.java
+++ b/libjava/classpath/java/text/AttributedStringIterator.java
@@ -188,30 +188,44 @@ class AttributedStringIterator implements AttributedCharacterIterator
return(getRunLimit(s));
}
- public synchronized int getRunLimit(Set attribute_set)
+ public synchronized int getRunLimit(Set attributeSet)
{
- boolean hit = false;
- int runLimit = ci.getEndIndex ();
- int pos = ci.getIndex ();
-
- for (int i = 0; i < attribs.length; ++i)
+ if (attributeSet == null)
+ return ci.getEndIndex();
+
+ int current = ci.getIndex();
+ int end = ci.getEndIndex();
+ int limit = current;
+ if (current == end)
+ return end;
+ Map runValues = getAttributes();
+ while (limit < end)
+ {
+ Iterator iterator = attributeSet.iterator();
+ while (iterator.hasNext())
{
- if (pos >= attribs[i].begin_index &&
- pos < attribs[i].end_index)
+ // Qualified name is a workaround for a gcj 4.0 bug.
+ AttributedCharacterIterator.Attribute attributeKey
+ = (AttributedCharacterIterator.Attribute) iterator.next();
+ Object v1 = runValues.get(attributeKey);
+ Object v2 = getAttribute(attributeKey, limit + 1);
+ boolean changed = false;
+ // check for equal or both null, if NO return start
+ if (v1 != null)
+ {
+ changed = !v1.equals(v2);
+ }
+ else
{
- Iterator iter = attribute_set.iterator();
- while(iter.hasNext())
- if (attribs[i].attribs.containsKey(iter.next()))
- {
- hit = true;
- runLimit = Math.min(runLimit, attribs[i].end_index);
- }
+ changed = (v2 != null);
}
+ if (changed)
+ return limit + 1;
}
- if (hit)
- return runLimit;
- else
- return ci.getEndIndex();
+ // no differences, so increment limit and next and loop again
+ limit++;
+ }
+ return end;
}
/*************************************************************************/
@@ -221,69 +235,128 @@ class AttributedStringIterator implements AttributedCharacterIterator
* attribute combinations.
*/
+ /**
+ * Returns the index of the first character in the run containing the current
+ * character and defined by all the attributes defined for that character
+ * position.
+ *
+ * @return The run start index.
+ */
public int getRunStart()
{
return(getRunStart(getAttributes().keySet()));
}
+ /**
+ * Returns the index of the first character in the run, defined by the
+ * specified attribute, that contains the current character.
+ *
+ * @param attrib the attribute (<code>null</code> permitted).
+ *
+ * return The index of the first character in the run.
+ */
public int getRunStart(AttributedCharacterIterator.Attribute attrib)
{
+ if (attrib == null)
+ return ci.getBeginIndex();
HashSet s = new HashSet();
s.add(attrib);
-
return(getRunStart(s));
}
- public int getRunStart(Set attribute_set)
+ /**
+ * Returns the index of the first character in the run, defined by the
+ * specified attribute set, that contains the current character.
+ *
+ * @param attributeSet the attribute set (<code>null</code> permitted).
+ *
+ * return The index of the first character in the run.
+ */
+ public int getRunStart(Set attributeSet)
{
- boolean hit = false;
- int runBegin = 0;
- int pos = ci.getIndex();
-
- for (int i = 0; i < attribs.length; ++i)
+ if (attributeSet == null)
+ return ci.getBeginIndex();
+
+ int current = ci.getIndex();
+ int begin = ci.getBeginIndex();
+ int start = current;
+ if (start == begin)
+ return begin;
+ Map runValues = getAttributes();
+ int prev = start - 1;
+ while (start > begin)
+ {
+ Iterator iterator = attributeSet.iterator();
+ while (iterator.hasNext())
{
- if (pos >= attribs[i].begin_index &&
- pos <= attribs[i].end_index)
+ // Qualified name is a workaround for a gcj 4.0 bug.
+ AttributedCharacterIterator.Attribute attributeKey
+ = (AttributedCharacterIterator.Attribute) iterator.next();
+ Object v1 = runValues.get(attributeKey);
+ Object v2 = getAttribute(attributeKey, prev);
+ boolean changed = false;
+ // check for equal or both null, if NO return start
+ if (v1 != null)
+ {
+ changed = !v1.equals(v2);
+ }
+ else
{
- Iterator iter = attribute_set.iterator();
- while(iter.hasNext())
- if (attribs[i].attribs.containsKey(iter.next()))
- {
- hit = true;
- runBegin = Math.max(runBegin, attribs[i].begin_index);
- }
+ changed = (v2 != null);
}
+ if (changed)
+ return start;
}
- if (hit)
- return runBegin;
- else
- return -1;
+ // no differences, so decrement start and prev and loop again
+ start--;
+ prev--;
+ }
+ return start;
}
/*************************************************************************/
- public Object getAttribute(AttributedCharacterIterator.Attribute attrib)
+ /**
+ * Returns the value for an attribute at the specified position. If the
+ * attribute key (<code>key</code>) is <code>null</code>, the method returns
+ * <code>null</code>.
+ *
+ * @param key the key (<code>null</code> permitted).
+ * @param pos the character position.
+ *
+ * @return The attribute value (possibly <code>null</code>).
+ */
+ private Object getAttribute(AttributedCharacterIterator.Attribute key,
+ int pos)
{
if (attribs == null)
- return(null);
-
- for (int i = 0; i < attribs.length; i++)
+ return null;
+ for (int i = attribs.length - 1; i >= 0; i--)
{
- Set key_set = attribs[i].attribs.keySet();
- Iterator iter = key_set.iterator();
- while (iter.hasNext())
+ if (pos >= attribs[i].begin_index && pos < attribs[i].end_index)
{
- Object obj = iter.next();
-
- // Check for attribute match and range match
- if (obj.equals(attrib))
- if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() < attribs[i].end_index))
- return(attribs[i].attribs.get(obj));
+ Set keys = attribs[i].attribs.keySet();
+ if (keys.contains(key))
+ {
+ return attribs[i].attribs.get(key);
+ }
}
}
-
- return(null);
+ return null;
+ }
+
+ /**
+ * Returns the value for an attribute at the current position. If the
+ * attribute key (<code>key</code>) is <code>null</code>, the method returns
+ * <code>null</code>.
+ *
+ * @param key the key (<code>null</code> permitted).
+ *
+ * @return The attribute value (possibly <code>null</code>).
+ */
+ public Object getAttribute(AttributedCharacterIterator.Attribute key)
+ {
+ return getAttribute(key, ci.getIndex());
}
/*************************************************************************/
diff --git a/libjava/classpath/java/text/CharacterIterator.java b/libjava/classpath/java/text/CharacterIterator.java
index 58d6ddc3951..42da33c432f 100644
--- a/libjava/classpath/java/text/CharacterIterator.java
+++ b/libjava/classpath/java/text/CharacterIterator.java
@@ -68,7 +68,7 @@ public interface CharacterIterator extends Cloneable
* <code>getEndIndex() - 1</code>, it will not be incremented.
*
* @return The character at the position of the incremented index value,
- * or <code>DONE</code> if the index has reached getEndIndex() - 1
+ * or {@link #DONE} if the index has reached getEndIndex() - 1
*/
char next();
diff --git a/libjava/classpath/java/text/DateFormat.java b/libjava/classpath/java/text/DateFormat.java
index 5d412aada52..73aa62d9805 100644
--- a/libjava/classpath/java/text/DateFormat.java
+++ b/libjava/classpath/java/text/DateFormat.java
@@ -58,6 +58,9 @@ import java.util.TimeZone;
public abstract class DateFormat extends Format implements Cloneable
{
+ private static final long serialVersionUID = 7218322306649953788L;
+
+ // Names fixed by serialization spec.
protected Calendar calendar;
protected NumberFormat numberFormat;
diff --git a/libjava/classpath/java/text/ParsePosition.java b/libjava/classpath/java/text/ParsePosition.java
index 782f5e0eda2..b0a8a4a0b36 100644
--- a/libjava/classpath/java/text/ParsePosition.java
+++ b/libjava/classpath/java/text/ParsePosition.java
@@ -136,6 +136,15 @@ public class ParsePosition
ParsePosition other = (ParsePosition) obj;
return index == other.index && error_index == other.error_index;
}
+
+ /**
+ * Return the hash code for this object.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ return index ^ error_index;
+ }
/**
* This method returns a <code>String</code> representation of this
diff --git a/libjava/classpath/java/text/RuleBasedCollator.java b/libjava/classpath/java/text/RuleBasedCollator.java
index ae84a41032d..5756e9aa791 100644
--- a/libjava/classpath/java/text/RuleBasedCollator.java
+++ b/libjava/classpath/java/text/RuleBasedCollator.java
@@ -510,7 +510,7 @@ main_parse_loop:
int idx;
// Parse the subrules but do not iterate through all
- // sublist. This is the priviledge of the first call.
+ // sublist. This is the privilege of the first call.
idx = subParseString(true, sorted_rules, base_offset+i, subrules);
// Merge new parsed rules into the list.
diff --git a/libjava/classpath/java/text/StringCharacterIterator.java b/libjava/classpath/java/text/StringCharacterIterator.java
index e2674881333..85ca302cbe8 100644
--- a/libjava/classpath/java/text/StringCharacterIterator.java
+++ b/libjava/classpath/java/text/StringCharacterIterator.java
@@ -143,7 +143,7 @@ public final class StringCharacterIterator implements CharacterIterator
* an existing StringCharacterIterator and resets the beginning and
* ending index.
*
- * @param scci The StringCharacterIterator to copy the info from
+ * @param sci The StringCharacterIterator to copy the info from
* @param begin The beginning index of the range we are interested in.
* @param end The ending index of the range we are interested in.
*/
@@ -340,6 +340,16 @@ public final class StringCharacterIterator implements CharacterIterator
&& index == sci.index
&& text.equals (sci.text));
}
+
+ /**
+ * Return the hash code for this object.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ // Incorporate all the data in a goofy way.
+ return begin ^ end ^ index ^ text.hashCode();
+ }
/*************************************************************************/
diff --git a/libjava/classpath/java/util/ArrayList.java b/libjava/classpath/java/util/ArrayList.java
index 82bcca8c3e0..752f9da4ee0 100644
--- a/libjava/classpath/java/util/ArrayList.java
+++ b/libjava/classpath/java/util/ArrayList.java
@@ -551,7 +551,7 @@ public class ArrayList extends AbstractList
/**
* Serializes this object to the given stream.
*
- * @param out the stream to write to
+ * @param s the stream to write to
* @throws IOException if the underlying stream fails
* @serialData the size field (int), the length of the backing array
* (int), followed by its elements (Objects) in proper order.
@@ -572,7 +572,7 @@ public class ArrayList extends AbstractList
/**
* Deserializes this object from the given stream.
*
- * @param in the stream to read from
+ * @param s the stream to read from
* @throws ClassNotFoundException if the underlying stream fails
* @throws IOException if the underlying stream fails
* @serialData the size field (int), the length of the backing array
diff --git a/libjava/classpath/java/util/Arrays.java b/libjava/classpath/java/util/Arrays.java
index 15c1a5f33bf..b28c156b46e 100644
--- a/libjava/classpath/java/util/Arrays.java
+++ b/libjava/classpath/java/util/Arrays.java
@@ -2353,6 +2353,186 @@ 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
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (long[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (int[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (short[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (char[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (byte[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (boolean[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (float[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (double[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (Object[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
* Inner class used by {@link #asList(Object[])} to provide a list interface
* to an array. The name, though it clashes with java.util.ArrayList, is
* Sun's choice for Serialization purposes. Element addition and removal
diff --git a/libjava/classpath/java/util/Calendar.java b/libjava/classpath/java/util/Calendar.java
index 88bd76bcadc..f94bed40dad 100644
--- a/libjava/classpath/java/util/Calendar.java
+++ b/libjava/classpath/java/util/Calendar.java
@@ -914,8 +914,19 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public boolean equals(Object o)
{
- return (o instanceof Calendar)
- && getTimeInMillis() == ((Calendar) o).getTimeInMillis();
+ if (! (o instanceof Calendar))
+ return false;
+ Calendar cal = (Calendar) o;
+ if (getTimeInMillis() == ((Calendar) o).getTimeInMillis()
+ && cal.getFirstDayOfWeek() == getFirstDayOfWeek()
+ && cal.isLenient() == isLenient()
+ && cal.getMinimalDaysInFirstWeek() == getMinimalDaysInFirstWeek())
+ {
+ TimeZone self = getTimeZone();
+ TimeZone oth = cal.getTimeZone();
+ return self == null ? oth == null : self.equals(oth);
+ }
+ return false;
}
/**
@@ -926,7 +937,13 @@ public abstract class Calendar implements Serializable, Cloneable
public int hashCode()
{
long time = getTimeInMillis();
- return (int) ((time & 0xffffffffL) ^ (time >> 32));
+ int val = (int) ((time & 0xffffffffL) ^ (time >> 32));
+ val += (getFirstDayOfWeek() + (isLenient() ? 1230 : 1237)
+ + getMinimalDaysInFirstWeek());
+ TimeZone self = getTimeZone();
+ if (self != null)
+ val ^= self.hashCode();
+ return val;
}
/**
diff --git a/libjava/classpath/java/util/Collections.java b/libjava/classpath/java/util/Collections.java
index ed8a00500c6..e650bf8bda9 100644
--- a/libjava/classpath/java/util/Collections.java
+++ b/libjava/classpath/java/util/Collections.java
@@ -1731,8 +1731,8 @@ public class Collections
}
/**
- * The implementation of {@link #singletonMap(Object)}. This class name
- * is required for compatibility with Sun's JDK serializability.
+ * The implementation of {@link #singletonMap(Object, Object)}. This class
+ * name is required for compatibility with Sun's JDK serializability.
*
* @author Eric Blake (ebb9@email.byu.edu)
*/
@@ -2518,12 +2518,13 @@ public class Collections
}
/**
- * Add an element to the end of the underlying list (optional operation).
- * If the list imposes restraints on what can be inserted, such as no null
- * elements, this should be documented. A lock is obtained on the mutex before
- * any of the elements are added.
+ * Add the contents of a collection to the underlying list at the given
+ * index (optional operation). If the list imposes restraints on what
+ * can be inserted, such as no null elements, this should be documented.
+ * A lock is obtained on the mutex before any of the elements are added.
*
- * @param o the object to add
+ * @param index the index at which to insert
+ * @param c the collection to add
* @return <code>true</code>, as defined by Collection for a modified list
* @throws UnsupportedOperationException if this list does not support the
* add operation
@@ -3858,7 +3859,7 @@ public class Collections
/**
* Called only by trusted code to specify the mutex as well as the set.
* @param sync the mutex
- * @param l the list
+ * @param ss the set
*/
SynchronizedSortedSet(Object sync, SortedSet ss)
{
diff --git a/libjava/classpath/java/util/GregorianCalendar.java b/libjava/classpath/java/util/GregorianCalendar.java
index b086a7d04a4..89b7c4dbd02 100644
--- a/libjava/classpath/java/util/GregorianCalendar.java
+++ b/libjava/classpath/java/util/GregorianCalendar.java
@@ -868,6 +868,17 @@ public class GregorianCalendar extends Calendar
areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
}
+
+ /**
+ * Return a hash code for this object, following the general contract
+ * specified by {@link Object#hashCode()}.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ int val = (int) ((gregorianCutover >>> 32) ^ (gregorianCutover & 0xffffffff));
+ return super.hashCode() ^ val;
+ }
/**
* Compares the given calendar with this. An object, o, is
@@ -890,7 +901,8 @@ public class GregorianCalendar extends Calendar
return false;
GregorianCalendar cal = (GregorianCalendar) o;
- return (cal.getTimeInMillis() == getTimeInMillis());
+ return (cal.gregorianCutover == gregorianCutover
+ && super.equals(o));
}
/**
diff --git a/libjava/classpath/java/util/HashMap.java b/libjava/classpath/java/util/HashMap.java
index 5ca9cf6d500..7176db0d58e 100644
--- a/libjava/classpath/java/util/HashMap.java
+++ b/libjava/classpath/java/util/HashMap.java
@@ -449,7 +449,7 @@ public class HashMap extends AbstractMap
*
* @param value the value to search for in this HashMap
* @return true if at least one key maps to the value
- * @see containsKey(Object)
+ * @see #containsKey(Object)
*/
public boolean containsValue(Object value)
{
diff --git a/libjava/classpath/java/util/InvalidPropertiesFormatException.java b/libjava/classpath/java/util/InvalidPropertiesFormatException.java
new file mode 100644
index 00000000000..6540c2313f3
--- /dev/null
+++ b/libjava/classpath/java/util/InvalidPropertiesFormatException.java
@@ -0,0 +1,57 @@
+/* InvalidPropertiesFormatException.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util;
+
+import java.io.IOException;
+
+// FIXME: serialization methods should throw NotSerializableException
+/** @since 1.5 */
+public class InvalidPropertiesFormatException extends IOException
+{
+ public InvalidPropertiesFormatException(String message)
+ {
+ super(message);
+ }
+
+ public InvalidPropertiesFormatException(Throwable cause)
+ {
+ super();
+ initCause(cause);
+ }
+}
diff --git a/libjava/classpath/java/util/Locale.java b/libjava/classpath/java/util/Locale.java
index 6d3f8463252..9e7bbfea2b3 100644
--- a/libjava/classpath/java/util/Locale.java
+++ b/libjava/classpath/java/util/Locale.java
@@ -915,7 +915,7 @@ public final class Locale implements Serializable, Cloneable
/**
* Write the locale to an object stream.
*
- * @param output the stream to write to
+ * @param s the stream to write to
* @throws IOException if the write fails
* @serialData The first three fields are Strings representing language,
* country, and variant. The fourth field is a placeholder for
@@ -935,7 +935,7 @@ public final class Locale implements Serializable, Cloneable
/**
* Reads a locale from the input stream.
*
- * @param input the stream to read from
+ * @param s the stream to read from
* @throws IOException if reading fails
* @throws ClassNotFoundException if reading fails
* @serialData the hashCode is always invalid and must be recomputed
diff --git a/libjava/classpath/java/util/Map.java b/libjava/classpath/java/util/Map.java
index 256e98899f6..986ab9a84b4 100644
--- a/libjava/classpath/java/util/Map.java
+++ b/libjava/classpath/java/util/Map.java
@@ -324,10 +324,10 @@ public interface Map
* this must be:
*
<p><pre>(o instanceof Map.Entry)
-&& (getKey() == null ? ((HashMap) o).getKey() == null
- : getKey().equals(((HashMap) o).getKey()))
-&& (getValue() == null ? ((HashMap) o).getValue() == null
- : getValue().equals(((HashMap) o).getValue()))</pre>
+&& (getKey() == null ? ((Map.Entry) o).getKey() == null
+ : getKey().equals(((Map.Entry) o).getKey()))
+&& (getValue() == null ? ((Map.Entry) o).getValue() == null
+ : getValue().equals(((Map.Entry) o).getValue()))</pre>
*
* @param o the object to compare
*
diff --git a/libjava/classpath/java/util/Properties.java b/libjava/classpath/java/util/Properties.java
index f00615ba0bf..7c468da8b4f 100644
--- a/libjava/classpath/java/util/Properties.java
+++ b/libjava/classpath/java/util/Properties.java
@@ -47,6 +47,25 @@ import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DefaultHandler2;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Element;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSSerializer;
+
/**
* A set of persistent properties, which can be saved or loaded from a stream.
* A property list may also contain defaults, searched if the main list
@@ -200,12 +219,15 @@ label = Name:\\u0020</pre>
// The characters up to the next Whitespace, ':', or '='
// describe the key. But look for escape sequences.
- StringBuffer key = new StringBuffer();
+ // Try to short-circuit when there is no escape char.
+ int start = pos;
+ boolean needsEscape = line.indexOf('\\', pos) != -1;
+ StringBuilder key = needsEscape ? new StringBuilder() : null;
while (pos < line.length()
&& ! Character.isWhitespace(c = line.charAt(pos++))
&& c != '=' && c != ':')
{
- if (c == '\\')
+ if (needsEscape && c == '\\')
{
if (pos == line.length())
{
@@ -249,11 +271,20 @@ label = Name:\\u0020</pre>
}
}
}
- else
+ else if (needsEscape)
key.append(c);
}
boolean isDelim = (c == ':' || c == '=');
+
+ String keyString;
+ if (needsEscape)
+ keyString = key.toString();
+ else if (isDelim || Character.isWhitespace(c))
+ keyString = line.substring(start, pos - 1);
+ else
+ keyString = line.substring(start, pos);
+
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
pos++;
@@ -266,7 +297,15 @@ label = Name:\\u0020</pre>
pos++;
}
- StringBuffer element = new StringBuffer(line.length() - pos);
+ // Short-circuit if no escape chars found.
+ if (!needsEscape)
+ {
+ put(keyString, line.substring(pos));
+ continue;
+ }
+
+ // Escape char found so iterate through the rest of the line.
+ StringBuilder element = new StringBuilder(line.length() - pos);
while (pos < line.length())
{
c = line.charAt(pos++);
@@ -322,7 +361,7 @@ label = Name:\\u0020</pre>
else
element.append(c);
}
- put(key.toString(), element.toString());
+ put(keyString, element.toString());
}
}
@@ -386,7 +425,7 @@ label = Name:\\u0020</pre>
Iterator iter = entrySet ().iterator ();
int i = size ();
- StringBuffer s = new StringBuffer (); // Reuse the same buffer.
+ StringBuilder s = new StringBuilder (); // Reuse the same buffer.
while (--i >= 0)
{
Map.Entry entry = (Map.Entry) iter.next ();
@@ -529,7 +568,7 @@ label = Name:\\u0020</pre>
* leading spaces must be escaped for the value
* @see #store(OutputStream, String)
*/
- private void formatForOutput(String str, StringBuffer buffer, boolean key)
+ private void formatForOutput(String str, StringBuilder buffer, boolean key)
{
if (key)
{
@@ -578,4 +617,299 @@ label = Name:\\u0020</pre>
head = key;
}
}
+
+ /**
+ * <p>
+ * Encodes the properties as an XML file using the UTF-8 encoding.
+ * The format of the XML file matches the DTD
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ * </p>
+ * <p>
+ * Invoking this method provides the same behaviour as invoking
+ * <code>storeToXML(os, comment, "UTF-8")</code>.
+ * </p>
+ *
+ * @param os the stream to output to.
+ * @param comment a comment to include at the top of the XML file, or
+ * <code>null</code> if one is not required.
+ * @throws IOException if the serialization fails.
+ * @throws NullPointerException if <code>os</code> is null.
+ * @since 1.5
+ */
+ public void storeToXML(OutputStream os, String comment)
+ throws IOException
+ {
+ storeToXML(os, comment, "UTF-8");
+ }
+
+ /**
+ * <p>
+ * Encodes the properties as an XML file using the supplied encoding.
+ * The format of the XML file matches the DTD
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ * </p>
+ *
+ * @param os the stream to output to.
+ * @param comment a comment to include at the top of the XML file, or
+ * <code>null</code> if one is not required.
+ * @param encoding the encoding to use for the XML output.
+ * @throws IOException if the serialization fails.
+ * @throws NullPointerException if <code>os</code> or <code>encoding</code>
+ * is null.
+ * @since 1.5
+ */
+ public void storeToXML(OutputStream os, String comment, String encoding)
+ throws IOException
+ {
+ if (os == null)
+ throw new NullPointerException("Null output stream supplied.");
+ if (encoding == null)
+ throw new NullPointerException("Null encoding supplied.");
+ try
+ {
+ DOMImplementationRegistry registry =
+ DOMImplementationRegistry.newInstance();
+ DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
+ DocumentType doctype =
+ domImpl.createDocumentType("properties", null,
+ "http://java.sun.com/dtd/properties.dtd");
+ Document doc = domImpl.createDocument(null, "properties", doctype);
+ Element root = doc.getDocumentElement();
+ if (comment != null)
+ {
+ Element commentElement = doc.createElement("comment");
+ commentElement.appendChild(doc.createTextNode(comment));
+ root.appendChild(commentElement);
+ }
+ Iterator iterator = entrySet().iterator();
+ while (iterator.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ Element entryElement = doc.createElement("entry");
+ entryElement.setAttribute("key", (String) entry.getKey());
+ entryElement.appendChild(doc.createTextNode((String)
+ entry.getValue()));
+ root.appendChild(entryElement);
+ }
+ DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
+ LSSerializer serializer = loadAndSave.createLSSerializer();
+ LSOutput output = loadAndSave.createLSOutput();
+ output.setByteStream(os);
+ output.setEncoding(encoding);
+ serializer.write(doc, output);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw (IOException)
+ new IOException("The XML classes could not be found.").initCause(e);
+ }
+ catch (InstantiationException e)
+ {
+ throw (IOException)
+ new IOException("The XML classes could not be instantiated.")
+ .initCause(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw (IOException)
+ new IOException("The XML classes could not be accessed.")
+ .initCause(e);
+ }
+ }
+
+ /**
+ * <p>
+ * Decodes the contents of the supplied <code>InputStream</code> as
+ * an XML file, which represents a set of properties. The format of
+ * the XML file must match the DTD
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ * </p>
+ *
+ * @param in the input stream from which to receive the XML data.
+ * @throws IOException if an I/O error occurs in reading the input data.
+ * @throws InvalidPropertiesFormatException if the input data does not
+ * constitute an XML properties
+ * file.
+ * @throws NullPointerException if <code>in</code> is null.
+ * @since 1.5
+ */
+ public void loadFromXML(InputStream in)
+ throws IOException, InvalidPropertiesFormatException
+ {
+ if (in == null)
+ throw new NullPointerException("Null input stream supplied.");
+ try
+ {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setValidating(false); /* Don't use the URI */
+ XMLReader parser = factory.newSAXParser().getXMLReader();
+ PropertiesHandler handler = new PropertiesHandler();
+ parser.setContentHandler(handler);
+ parser.setProperty("http://xml.org/sax/properties/lexical-handler",
+ handler);
+ parser.parse(new InputSource(in));
+ }
+ catch (SAXException e)
+ {
+ throw (InvalidPropertiesFormatException)
+ new InvalidPropertiesFormatException("Error in parsing XML.").
+ initCause(e);
+ }
+ catch (ParserConfigurationException e)
+ {
+ throw (IOException)
+ new IOException("An XML parser could not be found.").
+ initCause(e);
+ }
+ }
+
+ /**
+ * This class deals with the parsing of XML using
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+ private class PropertiesHandler
+ extends DefaultHandler2
+ {
+
+ /**
+ * The current key.
+ */
+ private String key;
+
+ /**
+ * The current value.
+ */
+ private String value;
+
+ /**
+ * A flag to check whether a valid DTD declaration has been seen.
+ */
+ private boolean dtdDeclSeen;
+
+ /**
+ * Constructs a new Properties handler.
+ */
+ public PropertiesHandler()
+ {
+ key = null;
+ value = null;
+ dtdDeclSeen = false;
+ }
+
+ /**
+ * <p>
+ * Captures the start of the DTD declarations, if they exist.
+ * A valid properties file must declare the following doctype:
+ * </p>
+ * <p>
+ * <code>!DOCTYPE properties SYSTEM
+ * "http://java.sun.com/dtd/properties.dtd"</code>
+ * </p>
+ *
+ * @param name the name of the document type.
+ * @param publicId the public identifier that was declared, or
+ * null if there wasn't one.
+ * @param systemId the system identifier that was declared, or
+ * null if there wasn't one.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void startDTD(String name, String publicId, String systemId)
+ throws SAXException
+ {
+ if (name.equals("properties") &&
+ publicId == null &&
+ systemId.equals("http://java.sun.com/dtd/properties.dtd"))
+ {
+ dtdDeclSeen = true;
+ }
+ else
+ throw new SAXException("Invalid DTD declaration: " + name);
+ }
+
+ /**
+ * Captures the start of an XML element.
+ *
+ * @param uri the namespace URI.
+ * @param localName the local name of the element inside the namespace.
+ * @param qName the local name qualified with the namespace URI.
+ * @param attributes the attributes of this element.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void startElement(String uri, String localName,
+ String qName, Attributes attributes)
+ throws SAXException
+ {
+ if (qName.equals("entry"))
+ {
+ int index = attributes.getIndex("key");
+ if (index != -1)
+ key = attributes.getValue(index);
+ }
+ else if (qName.equals("comment") || qName.equals("properties"))
+ {
+ /* Ignore it */
+ }
+ else
+ throw new SAXException("Invalid tag: " + qName);
+ }
+
+ /**
+ * Captures characters within an XML element.
+ *
+ * @param ch the array of characters.
+ * @param start the start index of the characters to use.
+ * @param length the number of characters to use from the start index on.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException
+ {
+ if (key != null)
+ value = new String(ch,start,length);
+ }
+
+ /**
+ * Captures the end of an XML element.
+ *
+ * @param uri the namespace URI.
+ * @param localName the local name of the element inside the namespace.
+ * @param qName the local name qualified with the namespace URI.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void endElement(String uri, String localName,
+ String qName)
+ throws SAXException
+ {
+ if (qName.equals("entry"))
+ {
+ if (value == null)
+ value = "";
+ setProperty(key, value);
+ key = null;
+ value = null;
+ }
+ }
+
+ /**
+ * Captures the end of the XML document. If a DTD declaration has
+ * not been seen, the document is erroneous and an exception is thrown.
+ *
+ * @throws SAXException if the correct DTD declaration didn't appear.
+ */
+ public void endDocument()
+ throws SAXException
+ {
+ if (!dtdDeclSeen)
+ throw new SAXException("No appropriate DTD declaration was seen.");
+ }
+
+ } // class PropertiesHandler
+
} // class Properties
diff --git a/libjava/classpath/java/util/Random.java b/libjava/classpath/java/util/Random.java
index bc005075140..b016f78d4a2 100644
--- a/libjava/classpath/java/util/Random.java
+++ b/libjava/classpath/java/util/Random.java
@@ -102,7 +102,7 @@ public class Random implements Serializable
* in next.
*
* @serial the internal state of this generator
- * @see #next()
+ * @see #next(int)
*/
private long seed;
diff --git a/libjava/classpath/java/util/ResourceBundle.java b/libjava/classpath/java/util/ResourceBundle.java
index 91007e9b1aa..6aea6731a5d 100644
--- a/libjava/classpath/java/util/ResourceBundle.java
+++ b/libjava/classpath/java/util/ResourceBundle.java
@@ -419,7 +419,11 @@ public abstract class ResourceBundle
}
}
- throw new MissingResourceException("Bundle " + baseName + " not found",
+ throw new MissingResourceException("Bundle " + baseName
+ + " not found for locale "
+ + locale
+ + " by classloader "
+ + classLoader,
baseName, "");
}
@@ -508,8 +512,7 @@ public abstract class ResourceBundle
*
* @param baseName the raw bundle name, without locale qualifiers
* @param locale the locale
- * @param classloader the classloader
- * @param bundle the backup (parent) bundle
+ * @param classLoader the classloader
* @param wantBase whether a resource bundle made only from the base name
* (with no locale information attached) should be returned.
* @return the resource bundle if it was loaded, otherwise the backup
diff --git a/libjava/classpath/java/util/SimpleTimeZone.java b/libjava/classpath/java/util/SimpleTimeZone.java
index 995ccea84ca..0bda44c3327 100644
--- a/libjava/classpath/java/util/SimpleTimeZone.java
+++ b/libjava/classpath/java/util/SimpleTimeZone.java
@@ -468,6 +468,7 @@ public class SimpleTimeZone extends TimeZone
* @param dayOfWeek The day of week where daylight savings start.
* @param time The time in milliseconds standard time where daylight
* savings start.
+ * @exception IllegalArgumentException if parameters are out of range.
* @see SimpleTimeZone
*/
public void setStartRule(int month, int day, int dayOfWeek, int time)
@@ -796,7 +797,7 @@ public class SimpleTimeZone extends TimeZone
* dst and standard time.
* @param calYear the year of the date to check (for leap day checking).
* @param calMonth the month of the date to check.
- * @param calDay the day of month of the date to check.
+ * @param calDayOfMonth the day of month of the date to check.
* @param calDayOfWeek the day of week of the date to check.
* @param calMillis the millis of day of the date to check (standard time).
* @param mode the change mode; same semantic as startMode.
diff --git a/libjava/classpath/java/util/Timer.java b/libjava/classpath/java/util/Timer.java
index 715f06cf641..01a6fe8eab3 100644
--- a/libjava/classpath/java/util/Timer.java
+++ b/libjava/classpath/java/util/Timer.java
@@ -1,5 +1,5 @@
/* Timer.java -- Timer that runs TimerTasks at a later time.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -297,12 +297,67 @@ public class Timer
this.notify();
}
+ /**
+ * Remove all canceled tasks from the queue.
+ */
+ public synchronized int purge()
+ {
+ int removed = 0;
+ // Null out any elements that are canceled. Skip element 0 as
+ // it is the sentinel.
+ for (int i = elements; i > 0; --i)
+ {
+ if (heap[i].scheduled < 0)
+ {
+ ++removed;
+
+ // Remove an element by pushing the appropriate child
+ // into place, and then iterating to the bottom of the
+ // tree.
+ int index = i;
+ while (heap[index] != null)
+ {
+ int child = 2 * index;
+ if (child >= heap.length)
+ {
+ // Off end; we're done.
+ heap[index] = null;
+ break;
+ }
+
+ if (child + 1 >= heap.length || heap[child + 1] == null)
+ {
+ // Nothing -- we're done.
+ }
+ else if (heap[child] == null
+ || (heap[child].scheduled
+ > heap[child + 1].scheduled))
+ ++child;
+ heap[index] = heap[child];
+ index = child;
+ }
+ }
+ }
+
+ // Make a new heap if we shrank enough.
+ int newLen = heap.length;
+ while (elements - removed + DEFAULT_SIZE / 2 <= newLen / 4)
+ newLen /= 2;
+ if (newLen != heap.length)
+ {
+ TimerTask[] newHeap = new TimerTask[newLen];
+ System.arraycopy(heap, 0, newHeap, 0, elements + 1);
+ heap = newHeap;
+ }
+
+ return removed;
+ }
} // TaskQueue
/**
* The scheduler that executes all the tasks on a particular TaskQueue,
* reschedules any repeating tasks and that waits when no task has to be
- * executed immediatly. Stops running when canceled or when the parent
+ * executed immediately. Stops running when canceled or when the parent
* Timer has been finalized and no more tasks have to be executed.
*/
private static final class Scheduler implements Runnable
@@ -420,6 +475,30 @@ public class Timer
}
/**
+ * Create a new Timer whose Thread has the indicated name. It will have
+ * normal priority and will not be a daemon thread.
+ * @param name the name of the Thread
+ * @since 1.5
+ */
+ public Timer(String name)
+ {
+ this(false, Thread.NORM_PRIORITY, name);
+ }
+
+ /**
+ * Create a new Timer whose Thread has the indicated name. It will have
+ * normal priority. The boolean argument controls whether or not it
+ * will be a daemon thread.
+ * @param name the name of the Thread
+ * @param daemon true if the Thread should be a daemon thread
+ * @since 1.5
+ */
+ public Timer(String name, boolean daemon)
+ {
+ this(daemon, Thread.NORM_PRIORITY, name);
+ }
+
+ /**
* Creates a new Timer with a daemon Thread as scheduler if daemon is true,
* with the priority given and a default name.
*/
@@ -612,4 +691,14 @@ public class Timer
{
queue.setNullOnEmpty(true);
}
+
+ /**
+ * Removes all cancelled tasks from the queue.
+ * @return the number of tasks removed
+ * @since 1.5
+ */
+ public int purge()
+ {
+ return queue.purge();
+ }
}
diff --git a/libjava/classpath/java/util/TreeMap.java b/libjava/classpath/java/util/TreeMap.java
index 1e8c805d908..a00f257aa8b 100644
--- a/libjava/classpath/java/util/TreeMap.java
+++ b/libjava/classpath/java/util/TreeMap.java
@@ -1146,7 +1146,7 @@ public class TreeMap extends AbstractMap
*
* @param s the stream to read from
* @param count the number of keys to read
- * @param readValue true to read values, false to insert "" as the value
+ * @param readValues true to read values, false to insert "" as the value
* @throws ClassNotFoundException if the underlying stream fails
* @throws IOException if the underlying stream fails
* @see #readObject(ObjectInputStream)
diff --git a/libjava/classpath/java/util/WeakHashMap.java b/libjava/classpath/java/util/WeakHashMap.java
index 7593f7e330e..514ad8cd29f 100644
--- a/libjava/classpath/java/util/WeakHashMap.java
+++ b/libjava/classpath/java/util/WeakHashMap.java
@@ -241,7 +241,8 @@ public class WeakHashMap extends AbstractMap implements Map
// This method will get inlined.
cleanQueue();
if (knownMod != modCount)
- throw new ConcurrentModificationException();
+ throw new ConcurrentModificationException(knownMod + " != "
+ + modCount);
}
/**
@@ -698,21 +699,20 @@ public class WeakHashMap extends AbstractMap implements Map
// bucket may be enqueued later by the garbage collection, and
// internalRemove will be called a second time.
bucket.slot = -1;
- if (buckets[slot] == bucket)
- buckets[slot] = bucket.next;
- else
+
+ WeakBucket prev = null;
+ WeakBucket next = buckets[slot];
+ while (next != bucket)
{
- WeakBucket prev = buckets[slot];
- /* This may throw a NullPointerException. It shouldn't but if
- * a race condition occurred (two threads removing the same
- * bucket at the same time) it may happen. <br>
- * But with race condition many much worse things may happen
- * anyway.
- */
- while (prev.next != bucket)
- prev = prev.next;
- prev.next = bucket.next;
+ if (next == null) throw new InternalError("WeakHashMap in incosistent state");
+ prev = next;
+ next = prev.next;
}
+ if (prev == null)
+ buckets[slot] = bucket.next;
+ else
+ prev.next = bucket.next;
+
size--;
}
diff --git a/libjava/classpath/java/util/jar/Manifest.java b/libjava/classpath/java/util/jar/Manifest.java
index fdc76ff97ee..ff82aa2db96 100644
--- a/libjava/classpath/java/util/jar/Manifest.java
+++ b/libjava/classpath/java/util/jar/Manifest.java
@@ -80,10 +80,10 @@ public class Manifest implements Cloneable
/**
* Creates a Manifest from the supplied input stream.
*
- * @see read(Inputstream)
- * @see write(OutputStream)
+ * @see #read(InputStream)
+ * @see #write(OutputStream)
*
- * @param InputStream the input stream to read the manifest from
+ * @param in the input stream to read the manifest from
* @exception IOException when an i/o exception occurs or the input stream
* does not describe a valid manifest
*/
@@ -102,7 +102,7 @@ public class Manifest implements Cloneable
* a particular entry also changes the attributes of that entry in the
* original manifest.
*
- * @see clone()
+ * @see #clone()
* @param man the Manifest to copy from
*/
public Manifest(Manifest man)
diff --git a/libjava/classpath/java/util/logging/FileHandler.java b/libjava/classpath/java/util/logging/FileHandler.java
index 3d958b7d760..b03df97ec60 100644
--- a/libjava/classpath/java/util/logging/FileHandler.java
+++ b/libjava/classpath/java/util/logging/FileHandler.java
@@ -43,10 +43,6 @@ import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-
import java.util.LinkedList;
import java.util.ListIterator;
diff --git a/libjava/classpath/java/util/logging/Handler.java b/libjava/classpath/java/util/logging/Handler.java
index c3227d6f531..616b50234c4 100644
--- a/libjava/classpath/java/util/logging/Handler.java
+++ b/libjava/classpath/java/util/logging/Handler.java
@@ -191,8 +191,8 @@ h.setFormatter(h.getFormatter());</pre>
* Returns the character encoding which this handler uses for publishing
* log records.
*
- * @param encoding the name of a character encoding, or <code>null</code>
- * for the default platform encoding.
+ * @return the name of a character encoding, or <code>null</code>
+ * for the default platform encoding.
*/
public String getEncoding()
{
@@ -252,7 +252,7 @@ h.setFormatter(h.getFormatter());</pre>
* Sets the <code>Filter</code> for controlling which
* log records will be published by this <code>Handler</code>.
*
- * @return the <code>Filter</code> to use, or
+ * @param filter the <code>Filter</code> to use, or
* <code>null</code> to filter log records purely based
* on their severity level.
*/
diff --git a/libjava/classpath/java/util/logging/LogManager.java b/libjava/classpath/java/util/logging/LogManager.java
index 7e3fd97d01f..b62292f7978 100644
--- a/libjava/classpath/java/util/logging/LogManager.java
+++ b/libjava/classpath/java/util/logging/LogManager.java
@@ -664,7 +664,7 @@ public class LogManager
{
try
{
- return (new Boolean(getLogManager().getProperty(name))).booleanValue();
+ return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue();
}
catch (Exception ex)
{
@@ -682,7 +682,7 @@ public class LogManager
*
* @param defaultValue the value that will be returned if the
* property is not defined, or if
- * {@link Level.parse(java.lang.String)} does not like
+ * {@link Level#parse(java.lang.String)} does not like
* the property value.
*/
static Level getLevelProperty(String propertyName, Level defaultValue)
diff --git a/libjava/classpath/java/util/logging/LoggingPermission.java b/libjava/classpath/java/util/logging/LoggingPermission.java
index c7a2255ecea..1139a793a70 100644
--- a/libjava/classpath/java/util/logging/LoggingPermission.java
+++ b/libjava/classpath/java/util/logging/LoggingPermission.java
@@ -41,6 +41,8 @@ package java.util.logging;
public final class LoggingPermission
extends java.security.BasicPermission
{
+ private static final long serialVersionUID = 63564341580231582L;
+
/**
* Creates a new LoggingPermission.
*
diff --git a/libjava/classpath/java/util/logging/SimpleFormatter.java b/libjava/classpath/java/util/logging/SimpleFormatter.java
index f7a442792f9..ff53db8c055 100644
--- a/libjava/classpath/java/util/logging/SimpleFormatter.java
+++ b/libjava/classpath/java/util/logging/SimpleFormatter.java
@@ -85,7 +85,7 @@ public class SimpleFormatter
/**
* Formats a log record into a String.
*
- * @param the log record to be formatted.
+ * @param record the log record to be formatted.
*
* @return a short human-readable message, typically one or two
* lines. Lines are separated using the default platform line
diff --git a/libjava/classpath/java/util/logging/XMLFormatter.java b/libjava/classpath/java/util/logging/XMLFormatter.java
index 4dd63281727..8bd83ba3973 100644
--- a/libjava/classpath/java/util/logging/XMLFormatter.java
+++ b/libjava/classpath/java/util/logging/XMLFormatter.java
@@ -307,7 +307,7 @@ public class XMLFormatter
*
* @return a string for the header.
*
- * @param handler the handler which will prepend the returned
+ * @param h the handler which will prepend the returned
* string in front of the first log record. This method
* will inspect certain properties of the handler, for
* example its encoding, in order to construct the header.
diff --git a/libjava/classpath/java/util/prefs/Preferences.java b/libjava/classpath/java/util/prefs/Preferences.java
index c407ae6127a..3fee1c5da74 100644
--- a/libjava/classpath/java/util/prefs/Preferences.java
+++ b/libjava/classpath/java/util/prefs/Preferences.java
@@ -230,15 +230,15 @@ public abstract class Preferences {
}
/**
- * Returns the system preferences node for the package of an object.
- * The package node name of the object is determined by dropping the
- * class name of the object of the fully quallified class name and
- * replacing all '.' to '/' in the package name. If the class of the
+ * Returns the system preferences node for the package of a class.
+ * The package node name of the class is determined by dropping the
+ * final component of the fully qualified class name and
+ * changing all '.' to '/' in the package name. If the class of the
* object has no package then the package node name is "&lt;unnamed&gt;".
- * The returened node is <code>systemRoot().node(packageNodeName)</code>.
+ * The returned node is <code>systemRoot().node(packageNodeName)</code>.
*
- * @param o Object whose default system preference node is requested
- * @returns system preferences node that should be used by object o
+ * @param c Object whose default system preference node is requested
+ * @returns system preferences node that should be used by class c
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
@@ -249,15 +249,15 @@ public abstract class Preferences {
}
/**
- * Returns the user preferences node for the package of an object.
- * The package node name of the object is determined by dropping the
- * class name of the object of the fully quallified class name and
- * replacing all '.' to '/' in the package name. If the class of the
+ * Returns the user preferences node for the package of a class.
+ * The package node name of the class is determined by dropping the
+ * final component of the fully qualified class name and
+ * changing all '.' to '/' in the package name. If the class of the
* object has no package then the package node name is "&lt;unnamed&gt;".
- * The returened node is <code>userRoot().node(packageNodeName)</code>.
+ * The returned node is <code>userRoot().node(packageNodeName)</code>.
*
- * @param o Object whose default user preference node is requested
- * @returns user preferences node that should be used by object o
+ * @param c Object whose default userpreference node is requested
+ * @returns userpreferences node that should be used by class c
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
diff --git a/libjava/classpath/java/util/regex/Matcher.java b/libjava/classpath/java/util/regex/Matcher.java
index bd97ace54a8..5d04bdbfc2f 100644
--- a/libjava/classpath/java/util/regex/Matcher.java
+++ b/libjava/classpath/java/util/regex/Matcher.java
@@ -227,9 +227,9 @@ public final class Matcher
* If the match succeeds then more information can be obtained via the
* start, end, and group methods.
*
- * @see #start
- * @see #end
- * @see #group
+ * @see #start()
+ * @see #end()
+ * @see #group()
*/
public boolean matches ()
{
@@ -267,7 +267,7 @@ public final class Matcher
}
/**
- * @param group The index of a capturing group in this matcher's pattern
+ * @returns the index of a capturing group in this matcher's pattern
*
* @exception IllegalStateException If no match has yet been attempted,
* or if the previous match operation failed
diff --git a/libjava/classpath/java/util/zip/PendingBuffer.java b/libjava/classpath/java/util/zip/PendingBuffer.java
index dd7ed1008fb..9079b9804b7 100644
--- a/libjava/classpath/java/util/zip/PendingBuffer.java
+++ b/libjava/classpath/java/util/zip/PendingBuffer.java
@@ -183,7 +183,7 @@ class PendingBuffer
/**
* Flushes the pending buffer and returns that data in a new array
*
- * @param output the output stream
+ * @return the output stream
*/
public final byte[] toByteArray()
diff --git a/libjava/classpath/java/util/zip/ZipFile.java b/libjava/classpath/java/util/zip/ZipFile.java
index 0243abed1f8..4be845ea781 100644
--- a/libjava/classpath/java/util/zip/ZipFile.java
+++ b/libjava/classpath/java/util/zip/ZipFile.java
@@ -144,9 +144,18 @@ public class ZipFile implements ZipConstants
private void checkZipFile() throws IOException, ZipException
{
byte[] magicBuf = new byte[4];
- raf.read(magicBuf);
+ boolean validRead = true;
- if (readLeInt(magicBuf, 0) != LOCSIG)
+ try
+ {
+ raf.readFully(magicBuf);
+ }
+ catch (EOFException eof)
+ {
+ validRead = false;
+ }
+
+ if (validRead == false || readLeInt(magicBuf, 0) != LOCSIG)
{
raf.close();
throw new ZipException("Not a valid zip file");
@@ -377,7 +386,7 @@ public class ZipFile implements ZipConstants
* Checks that the ZipFile is still open and reads entries when necessary.
*
* @exception IllegalStateException when the ZipFile has already been closed.
- * @exception IOEexception when the entries could not be read.
+ * @exception IOException when the entries could not be read.
*/
private HashMap getEntries() throws IOException
{
@@ -395,7 +404,7 @@ public class ZipFile implements ZipConstants
/**
* Searches for a zip entry in this archive with the given name.
*
- * @param the name. May contain directory components separated by
+ * @param name the name. May contain directory components separated by
* slashes ('/').
* @return the zip entry, or null if no entry with that name exists.
*
diff --git a/libjava/classpath/javax/imageio/IIOException.java b/libjava/classpath/javax/imageio/IIOException.java
index 8f8dd03441c..b281db1b050 100644
--- a/libjava/classpath/javax/imageio/IIOException.java
+++ b/libjava/classpath/javax/imageio/IIOException.java
@@ -39,8 +39,9 @@ package javax.imageio;
import java.io.IOException;
-
/**
+ * A runtime exception to indicate image reading and writing failures.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class IIOException extends IOException
diff --git a/libjava/classpath/javax/imageio/IIOImage.java b/libjava/classpath/javax/imageio/IIOImage.java
index 651c9baaa21..0d987476239 100644
--- a/libjava/classpath/javax/imageio/IIOImage.java
+++ b/libjava/classpath/javax/imageio/IIOImage.java
@@ -45,13 +45,53 @@ import java.util.List;
import javax.imageio.metadata.IIOMetadata;
+/**
+ * IIOImage is a container class for components of an image file that
+ * stores image data, image metadata and thumbnails.
+ *
+ * The image data can be either a RenderedImage or a Raster but not
+ * both. Image readers that produce IIOImages will always produce
+ * BufferedImages from the RenderedImage field. Image writers that
+ * accept IIOImages will always accept RenderedImages and may
+ * optionally accept Rasters.
+ *
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
+ */
public class IIOImage
{
+ /**
+ * Image data as a RenderedImage. null if this IIOImage uses the
+ * Raster representation.
+ */
protected RenderedImage image;
+
+ /**
+ * Image metadata.
+ */
protected IIOMetadata metadata;
+
+ /**
+ * Image data as a Raster. null if this IIOImage uses the
+ * RenderedImage representation.
+ */
protected Raster raster;
+
+ /**
+ * A list of BufferedImage thumbnails of this image.
+ */
+ // for 1.5 these lists are List<? extends BufferedImage>
protected List thumbnails;
-
+
+ /**
+ * Construct an IIOImage containing raster image data, thumbnails
+ * and metadata.
+ *
+ * @param raster image data
+ * @param thumbnails a list of BufferedImage thumbnails or null
+ * @param metadata image metadata or null
+ *
+ * @exception IllegalArgumentException if raster is null
+ */
public IIOImage (Raster raster, List thumbnails, IIOMetadata metadata)
{
if (raster == null)
@@ -62,6 +102,16 @@ public class IIOImage
this.metadata = metadata;
}
+ /**
+ * Construct an IIOImage containing rendered image data, thumbnails
+ * and metadata.
+ *
+ * @param image rendered image data
+ * @param thumbnails a list of BufferedImage thumbnails or null
+ * @param metadata image metadata or null
+ *
+ * @exception IllegalArgumentException if image is null
+ */
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata)
{
if (image == null)
@@ -72,46 +122,111 @@ public class IIOImage
this.metadata = metadata;
}
+ /**
+ * Retrieve the image metadata or null if there is no metadata
+ * associated with this IIOImage.
+ *
+ * @return image metadata or null
+ */
public IIOMetadata getMetadata()
{
return metadata;
}
+ /**
+ * Retrieve the number of thumbnails in this IIOImage.
+ *
+ * @return the number of thumbnails
+ */
public int getNumThumbnails()
{
- return thumbnails.size();
+ return thumbnails == null ? 0 : thumbnails.size();
}
+ /**
+ * Retrieve the raster image data stored in this IIOImage or null if
+ * this image stores data using the RenderedImage representation.
+ *
+ * @return the raster image data or null
+ */
public Raster getRaster()
{
return raster;
}
+ /**
+ * Retrieve the rendered image data stored in this IIOImage or null
+ * if this image stores data using the Raster representation.
+ *
+ * @return the rendered image data or null
+ */
public RenderedImage getRenderedImage()
{
return image;
}
+ /**
+ * Retrieve the thumbnail stored at the specified index in the
+ * thumbnails list.
+ *
+ * @param index the index of the thumbnail to retrieve
+ *
+ * @return the buffered image thumbnail
+ *
+ * @exception IndexOutOfBoundsException if index is out-of-bounds
+ * @exception ClassCastException if the object returned from the
+ * thumbnails list is not a BufferedImage
+ */
public BufferedImage getThumbnail (int index)
{
+ // This throws a ClassCastException if the returned object is not
+ // a BufferedImage or an IndexOutOfBoundsException if index is
+ // out-of-bounds.
return (BufferedImage) thumbnails.get (index);
}
+ /**
+ * Retrieve the list of thumbnails or null if there are no
+ * thumbnails associated with this IIOImage. The returned reference
+ * can be used to update the thumbnails list.
+ *
+ * @return a list of thumbnails or null
+ */
public List getThumbnails()
{
return thumbnails;
}
+ /**
+ * Check whether this IIOImage stores its image data as a Raster or
+ * as a RenderedImage.
+ *
+ * @return true if this IIOImage uses the Raster representation,
+ * false if it uses the RenderedImage representation.
+ */
public boolean hasRaster()
{
return raster != null;
}
+ /**
+ * Set this IIOImage's metadata.
+ *
+ * @param metadata the image metadata
+ */
public void setMetadata (IIOMetadata metadata)
{
this.metadata = metadata;
}
+ /**
+ * Set the raster data for this image. This disposes of any
+ * existing rendered image data stored in this IIOImage.
+ *
+ * @param raster the image raster data
+ *
+ * @exception IllegalArgumentException if raster is null
+ */
public void setRaster (Raster raster)
{
if (raster == null)
@@ -121,6 +236,14 @@ public class IIOImage
this.raster = raster;
}
+ /**
+ * Set the rendered image data for this image. This disposes of any
+ * existing raster data stored in this IIOImage.
+ *
+ * @param image the rendered image data
+ *
+ * @exception IllegalArgumentException if image is null
+ */
public void setRenderedImage (RenderedImage image)
{
if (image == null)
@@ -130,9 +253,15 @@ public class IIOImage
this.raster = null;
}
+ /**
+ * Set the list of thumbnails for this IIOImage to a new list of
+ * BufferedImages or to null. Any existing thumbnails list is
+ * disposed.
+ *
+ * @param thumbnails a new list of thumbnails or null
+ */
public void setThumbnails (List thumbnails)
{
this.thumbnails = thumbnails;
}
-
-} // class IIOParam
+}
diff --git a/libjava/classpath/javax/imageio/IIOParam.java b/libjava/classpath/javax/imageio/IIOParam.java
index 01f6166059d..f6460b4e7ed 100644
--- a/libjava/classpath/javax/imageio/IIOParam.java
+++ b/libjava/classpath/javax/imageio/IIOParam.java
@@ -42,97 +42,317 @@ import java.awt.Point;
import java.awt.Rectangle;
/**
+ * An IIOParam stores parameters used when encoding or decoding image
+ * streams. ImageReadParam and ImageWriteParam extend this abstract
+ * base class.
+ *
+ * IIOParams allow control over how source pixels converted into
+ * destination pixels. This conversion can take place between a
+ * stream and in-memory image data, when an image reader is doing the
+ * conversion, or a writer can be doing the conversion from an
+ * in-memory source to a stream destination.
+ *
+ * An image reader can be restricted to only read from a given region;
+ * likewise a writer can be restricted to only write output to a given
+ * region.
+ *
+ * For image readers and writers, IIOParam supports image pixelation
+ * -- where the input image is approximated by the output image using
+ * larger-sized pixel blocks. For example: FIXME
+ *
+ * IIOParams can control how pixels are combined into larger blocks
+ * using sub-sampling matrices. For example: FIXME
+ *
+ * They can also control which source bands are read and written; this
+ * example reads the RGBA (red, green, blue, transparency) data from a
+ * PNG image and outputs just the red and transparency bands: FIXME
+ *
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
* @author Michael Koch (konqueror@gmx.de)
*/
public abstract class IIOParam
{
- protected IIOParamController controller;
- protected IIOParamController defaultController;
+ /**
+ * The controller called by this IIOParam to retrieve parameters.
+ */
+ protected IIOParamController controller = null;
+
+ /**
+ * The default controller called by this IIOParam to retrieve
+ * parameters.
+ */
+ protected IIOParamController defaultController = null;
+
+ /**
+ * The offset in the destination where the upper-left
+ * decoded/encoded pixel should be located.
+ */
protected Point destinationOffset = new Point(0, 0);
- protected ImageTypeSpecifier destinationType;
- protected int[] sourceBands;
- protected Rectangle sourceRegion;
- protected int sourceXSubsampling;
- protected int sourceYSubsampling;
- protected int subsamplingXOffset;
- protected int subsamplingYOffset;
/**
- * Initializes an <code>IIOParam</code> object.
+ * Sets the output colour type when writing or the destination image
+ * type when reading.
+ */
+ protected ImageTypeSpecifier destinationType = null;
+
+ /**
+ * An array indicating which source bands will be used or null.
+ */
+ protected int[] sourceBands = null;
+
+ /**
+ * The source pixel region or null.
+ */
+ protected Rectangle sourceRegion = null;
+
+ /**
+ * Sample every sourceXSubsampling'th pixel in the source image when
+ * pixelating the destination image in the horizontal direction.
+ */
+ protected int sourceXSubsampling = 1;
+
+ /**
+ * Sample every sourceYSubsampling'th pixel in the source image when
+ * pixelating the destination image in the vertical direction.
+ */
+ protected int sourceYSubsampling = 1;
+
+ /**
+ * Start sampling at this horizontal offset within the source region
+ * when pixelating the destination image in the horizontal
+ * direction.
+ */
+ protected int subsamplingXOffset = 0;
+
+ /**
+ * Start sampling at this vertical offset within the source region
+ * when pixelating the destination image in the vertical direction.
+ */
+ protected int subsamplingYOffset = 0;
+
+ /**
+ * Indicates whether or not the controller has been explicitly set
+ * to null.
+ */
+ private boolean no_controller = false;
+
+ /**
+ * Constructs an IIOParam object.
*/
protected IIOParam()
{
- // Do nothing here.
}
+ /**
+ * Activates the parameter controller by calling its activate method
+ * and passing it this IIOParam. A true return value indicates that
+ * this IIOParam's values are ready for the next read or write
+ * operation. A return value of false means that this IIOParam's
+ * values have not been affected because the controller operations
+ * were cancelled.
+ *
+ * @return true if parameters were successfully set, false if
+ * parameters were not changed
+ */
public boolean activateController()
{
if (controller == null)
- return false;
-
- return controller.activate(this);
+ {
+ if (defaultController == null || no_controller)
+ return false;
+ else
+ return defaultController.activate (this);
+ }
+ else
+ return controller.activate(this);
}
-
+
+ /**
+ * Retrieve the currently set controller if one has been set, or the
+ * default controller, or null if the controller has been explicitly
+ * set to null.
+ *
+ * @return the currently used controller or null
+ */
public IIOParamController getController()
{
- return controller;
+ return controller == null ?
+ (no_controller ? null : defaultController) : controller;
}
+ /**
+ * Retrieve the default controller regardless of whether or not a
+ * non-default controller has been set. The default controller may
+ * be null.
+ *
+ * @return the default controller or null
+ */
public IIOParamController getDefaultController()
{
return defaultController;
}
+ /**
+ * Retrieve the offset in the destination where the upper-left
+ * decoded/encoded pixel should be located. (0, 0) by default.
+ *
+ * @return the destination offset
+ */
public Point getDestinationOffset()
{
return destinationOffset;
}
+ /**
+ * Retrieve the currently set image-type specifier or null if none
+ * has been set.
+ *
+ * @return the current image-type specifier or null
+ */
public ImageTypeSpecifier getDestinationType()
{
return destinationType;
}
+ /**
+ * Retrieve the current source band values or null if source band
+ * values have not been set.
+ *
+ * The returned array is a copy of this IIOParam's source band
+ * array.
+ *
+ * @return the current set of source band values or null
+ */
public int[] getSourceBands()
{
- return sourceBands;
+ if (sourceBands == null)
+ return null;
+
+ int[] sourceBandsCopy = new int[sourceBands.length];
+ System.arraycopy (sourceBands, 0, sourceBandsCopy, 0, sourceBands.length);
+ return sourceBandsCopy;
}
+ /**
+ * Retrieve the source rectangle from which pixels should be read or
+ * null if no source region has been set.
+ *
+ * @return the current source region or null
+ */
public Rectangle getSourceRegion()
{
return sourceRegion;
}
+ /**
+ * Retrieve the number of pixel columns to advance before taking a
+ * pixel sample.
+ *
+ * @return the horizontal sub-sampling interval
+ */
public int getSourceXSubsampling()
{
return sourceXSubsampling;
}
+ /**
+ * Retrieve the number of pixel rows to advance before taking a
+ * pixel sample.
+ *
+ * @return the vertical sub-sampling interval
+ */
public int getSourceYSubsampling()
{
return sourceYSubsampling;
}
+ /**
+ * Retrieve the number of pixel columns to advance before taking any
+ * pixel samples.
+ *
+ * @return the horizontal sub-sampling offset
+ */
public int getSubsamplingXOffset()
{
return subsamplingXOffset;
}
-
+
+ /**
+ * Retrieve the number of pixel rows to advance before taking any
+ * pixel samples.
+ *
+ * @return the vertical sub-sampling offset
+ */
public int getSubsamplingYOffset()
{
return subsamplingYOffset;
}
+ /**
+ * Check if a non-null controller is currently available.
+ *
+ * @return true if getController returns a non-null value, false if
+ * getController returns null
+ */
public boolean hasController()
{
return getController() != null;
}
+ /**
+ * Sets the controller for this IIOParam. This is the controller
+ * that will be activated when activateController is called. The
+ * argument controller overrides this IIOParam's default controller.
+ * If the argument is null then no controller will be set, not even
+ * the default one. To reset the default controller call
+ * setController(getDefaultController()).
+ *
+ * @param controller the controller to set or null
+ */
public void setController(IIOParamController controller)
{
- this.controller = controller;
+ if (controller == defaultController)
+ {
+ this.controller = null;
+ no_controller = false;
+ }
+ else
+ {
+ no_controller = (controller == null);
+ this.controller = controller;
+ }
}
+ /**
+ * Set the destination image type.
+ *
+ * If this value is set on an image reader then its read method will
+ * return a new BufferedImage of the specified destination type. In
+ * this case any destination image set using setDestination() is
+ * ignored.
+ *
+ * If this is set on an image writer then the destination type
+ * affects only the colour model of the destination image. The
+ * destination type's SampleModel is ignored. The destination
+ * type's ColorModel will override the source image's colour model.
+ *
+ * @param destinationType the sample and colour models of the
+ * destination image
+ */
+ public void setDestinationType (ImageTypeSpecifier destinationType)
+ {
+ this.destinationType = destinationType;
+ }
+
+ /**
+ * Specify the destination pixel offset. Image writers are only
+ * affected by this setting when ImageWriter.replacePixels is called
+ * in which case the offset is into the region of pixels being
+ * changed.
+ *
+ * @param destinationOffset the offset where pixel writing should
+ * begin
+ */
public void setDestinationOffset(Point destinationOffset)
{
if (destinationOffset == null)
@@ -141,11 +361,43 @@ public abstract class IIOParam
this.destinationOffset = destinationOffset;
}
+ /**
+ * Set the indices of the source bands to be used. Duplicate
+ * indices are not allowed. A value of null means use all source
+ * bands. The argument array is copied and stored, so subsequent
+ * updates to it will not be reflected in this IIOParam.
+ *
+ * @param sourceBands the array of source bands to use
+ */
public void setSourceBands(int[] sourceBands)
{
- this.sourceBands = sourceBands;
+ int[] sourceBandsCopy = new int[sourceBands.length];
+ System.arraycopy (sourceBands, 0, sourceBandsCopy, 0, sourceBands.length);
+ this.sourceBands = sourceBandsCopy;
}
+ /**
+ * Set the source region from which to read. The number of pixels
+ * sampled from the source region depends on the source sub-sampling
+ * settings. If the combination of this sourceRegion and the
+ * current sub-sampling settings would result in no pixels being
+ * sampled then an IllegalStateException will be thrown.
+ *
+ * The source region is specified in the source image coordinate
+ * system which has point (0, 0) at the top-left and increases down
+ * and to the right. The argument source region is clipped to the
+ * image boundaries at read-time.
+ *
+ * A null argument sets the source region to null meaning that the
+ * whole image should be read.
+ *
+ * @param sourceRegion the rectangular source region
+ *
+ * @exception IllegalArgumentException if sourceRegion has width or
+ * height <= 0 or x or y < 0
+ * @exception IllegalStateException if the given sourceRegion and
+ * the current sampling settings would produce zero samples
+ */
public void setSourceRegion(Rectangle sourceRegion)
{
if (sourceRegion != null
@@ -154,15 +406,83 @@ public abstract class IIOParam
|| sourceRegion.width <= 0
|| sourceRegion.height <= 0))
throw new IllegalArgumentException("illegal source region");
-
- // FIXME: Throw IllegalStateException.
+
+ if (sourceRegion != null)
+ {
+ int num_rows =
+ (sourceRegion.height - subsamplingYOffset + sourceYSubsampling - 1)
+ / sourceYSubsampling;
+
+ int num_columns =
+ (sourceRegion.width - subsamplingXOffset + sourceXSubsampling - 1)
+ / sourceXSubsampling;
+
+ if (num_rows <= 0 || num_columns <= 0)
+ throw new IllegalStateException("zero pixels in source region");
+ }
this.sourceRegion = sourceRegion;
}
+ /**
+ * Set the source sampling intervals and offsets. Every
+ * sourceXSubsampling'th pixel horizontally and
+ * sourceYSubsampling'th pixel vertically will be sampled. Sampling
+ * will being a the subsamplingXOffset'th column and the
+ * subsamplingYOffset'th row.
+ *
+ * Horizontally, the number of sampled pixels will be:
+ *
+ * floor((width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling)
+ *
+ * Vertically:
+ *
+ * floor((height - subsamplingYOffset + sourceYSubsampling - 1) / sourceYSubsampling)
+ *
+ * If the current source region setting is such that the given
+ * sub-sampling arguments would produce zero pixel samples, an
+ * IllegalStateException is thrown.
+ *
+ * The offset parameters can be used to make source regions overlap
+ * when tiling across an image. This can eliminate seams and
+ * better-tile images whose width or height is not a multiple of the
+ * sampling interval.
+ *
+ * @param sourceXSubsampling the horizontal sampling interval
+ * @param sourceYSubsampling the vertical sampling interval
+ * @param subsamplingXOffset the horizontal offset of the initial
+ * sample
+ * @param subsamplingYOffset the vertical offset of the initial
+ * sample
+ *
+ * @exception IllegalArgumentException if either subsamplingXOffset
+ * or subsamplingYOffset is < 0
+ * @exception IllegalStateException if the current source region
+ * combined with the given sub-sampling parameters would produce
+ * zero pixel samples
+ */
public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling,
int subsamplingXOffset, int subsamplingYOffset)
{
+ if (subsamplingXOffset < 0 || subsamplingYOffset < 0)
+ throw new IllegalArgumentException("subsampling offset < 0");
+
+ if (sourceRegion != null)
+ {
+ int num_rows =
+ (sourceRegion.height - subsamplingYOffset + sourceYSubsampling - 1)
+ / sourceYSubsampling;
+
+ int num_columns =
+ (sourceRegion.width - subsamplingXOffset + sourceXSubsampling - 1)
+ / sourceXSubsampling;
+
+ if (num_rows <= 0 || num_columns <= 0)
+ throw new IllegalStateException("subsampling parameters would"
+ + " produce zero pixel samples"
+ + " in source region");
+ }
+
this.sourceXSubsampling = sourceXSubsampling;
this.sourceYSubsampling = sourceYSubsampling;
this.subsamplingXOffset = subsamplingXOffset;
diff --git a/libjava/classpath/javax/imageio/IIOParamController.java b/libjava/classpath/javax/imageio/IIOParamController.java
index 125520e735b..0ee54df4071 100644
--- a/libjava/classpath/javax/imageio/IIOParamController.java
+++ b/libjava/classpath/javax/imageio/IIOParamController.java
@@ -39,12 +39,23 @@ exception statement from your version. */
package javax.imageio;
/**
+ * An interface to set image parameters. An IIOParamController may be
+ * a GUI component, a database reader, command-line parser or any
+ * other means of getting parameter settings. For exampe, a dialog
+ * box could implement IIOParamController to allow a user to adjust
+ * JPEG compression levels.
+ *
+ * The activate method should always behave modally; it should only
+ * return when the action has been either cancelled or completed.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface IIOParamController
{
/**
- * Activates the controller.
+ * Activates the controller. A return value of false should mean
+ * that no changes were made to param. A return value of true
+ * should mean that the image is ready to be read or written.
*
* @param param the <code>IIOParam</code> to be modified
*
diff --git a/libjava/classpath/javax/imageio/ImageIO.java b/libjava/classpath/javax/imageio/ImageIO.java
index 95c7c325121..3ea7e858544 100644
--- a/libjava/classpath/javax/imageio/ImageIO.java
+++ b/libjava/classpath/javax/imageio/ImageIO.java
@@ -52,7 +52,10 @@ import java.util.Collections;
import java.util.Iterator;
import javax.imageio.spi.IIORegistry;
+import javax.imageio.spi.ImageInputStreamSpi;
+import javax.imageio.spi.ImageOutputStreamSpi;
import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.spi.ImageTranscoderSpi;
import javax.imageio.spi.ImageWriterSpi;
import javax.imageio.spi.ServiceRegistry;
import javax.imageio.stream.ImageInputStream;
@@ -60,12 +63,18 @@ import javax.imageio.stream.ImageOutputStream;
import javax.imageio.stream.MemoryCacheImageInputStream;
import javax.imageio.stream.MemoryCacheImageOutputStream;
+/**
+ * An uninstantiable class that provides static methods for locating
+ * and using image readers and writers.
+ */
public final class ImageIO
{
/**
- * This class isn't intended to be instantiated.
+ * Construct an ImageIO. Private since ImageIO is not instantiable.
*/
- private ImageIO() {}
+ private ImageIO()
+ {
+ }
private static final class ReaderFormatFilter implements ServiceRegistry.Filter
{
@@ -117,6 +126,35 @@ public final class ImageIO
}
}
+ private static final class ReaderObjectFilter implements ServiceRegistry.Filter
+ {
+ private Object object;
+
+ public ReaderObjectFilter(Object object)
+ {
+ this.object = object;
+ }
+
+ public boolean filter(Object provider)
+ {
+ if (provider instanceof ImageReaderSpi)
+ {
+ ImageReaderSpi spi = (ImageReaderSpi) provider;
+
+ try
+ {
+ if (spi.canDecodeInput(object))
+ return true;
+ }
+ catch (IOException e)
+ {
+ // Return false in this case
+ }
+ }
+ return false;
+ }
+ }
+
private static final class ReaderSuffixFilter implements ServiceRegistry.Filter
{
private String fileSuffix;
@@ -217,6 +255,66 @@ public final class ImageIO
}
}
+ private static final class WriterObjectFilter implements ServiceRegistry.Filter
+ {
+ private ImageTypeSpecifier type;
+ private String formatName;
+
+ public WriterObjectFilter(ImageTypeSpecifier type,
+ String formatName)
+ {
+ this.type = type;
+ this.formatName = formatName;
+ }
+
+ public boolean filter(Object provider)
+ {
+ if (provider instanceof ImageWriterSpi)
+ {
+ ImageWriterSpi spi = (ImageWriterSpi) provider;
+
+ if (spi.canEncodeImage(type))
+ {
+ String[] formatNames = spi.getFormatNames();
+ for (int i = formatNames.length - 1; i >= 0; --i)
+ if (formatName.equals(formatNames[i]))
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ private static final class TranscoderFilter implements ServiceRegistry.Filter
+ {
+ private ImageReader reader;
+ private ImageWriter writer;
+
+ public TranscoderFilter(ImageReader reader,
+ ImageWriter writer)
+ {
+ this.reader = reader;
+ this.writer = writer;
+ }
+
+ public boolean filter(Object provider)
+ {
+ if (provider instanceof ImageTranscoderSpi)
+ {
+ ImageTranscoderSpi spi = (ImageTranscoderSpi) provider;
+
+ if (spi.getReaderServiceProviderName().equals
+ (reader.getOriginatingProvider().getClass().getName())
+ && spi.getWriterServiceProviderName().equals
+ (writer.getOriginatingProvider().getClass().getName()))
+ return true;
+ }
+
+ return false;
+ }
+ }
+
private static final class ImageReaderIterator implements Iterator
{
Iterator it;
@@ -318,11 +416,26 @@ public final class ImageIO
}
}
+ /**
+ * Retrieve the current cache directory.
+ *
+ * @return the current cache directory or null if none is set.
+ */
public static File getCacheDirectory()
{
return cacheDirectory;
}
+ /**
+ * Retrieve an iterator over all registered readers for the given
+ * format.
+ *
+ * @param formatName an infomal format name (e.g. "jpeg" or "bmp")
+ *
+ * @return an iterator over a collection of image readers
+ *
+ * @exception IllegalArgumentException if formatName is null
+ */
public static Iterator getImageReadersByFormatName(String formatName)
{
if (formatName == null)
@@ -333,6 +446,17 @@ public final class ImageIO
formatName);
}
+ /**
+ * Retrieve an iterator over all registered readers for the given
+ * MIME type.
+ *
+ * @param MIMEType a MIME specification for an image type
+ * (e.g. "image/jpeg" or "image/x-bmp")
+ *
+ * @return an iterator over a collection of image readers
+ *
+ * @exception IllegalArgumentException if MIMEType is null
+ */
public static Iterator getImageReadersByMIMEType(String MIMEType)
{
if (MIMEType == null)
@@ -343,6 +467,16 @@ public final class ImageIO
MIMEType);
}
+ /**
+ * Retrieve an iterator over all registered readers for the given
+ * file suffix.
+ *
+ * @param fileSuffix an image file suffix (e.g. "jpg" or "bmp")
+ *
+ * @return an iterator over a collection of image readers
+ *
+ * @exception IllegalArgumentException if fileSuffix is null
+ */
public static Iterator getImageReadersBySuffix(String fileSuffix)
{
if (fileSuffix == null)
@@ -353,6 +487,16 @@ public final class ImageIO
fileSuffix);
}
+ /**
+ * Retrieve an iterator over all registered writers for the given
+ * format.
+ *
+ * @param formatName an infomal format name (e.g. "jpeg" or "bmp")
+ *
+ * @return an iterator over a collection of image writers
+ *
+ * @exception IllegalArgumentException if formatName is null
+ */
public static Iterator getImageWritersByFormatName(String formatName)
{
if (formatName == null)
@@ -363,6 +507,17 @@ public final class ImageIO
formatName);
}
+ /**
+ * Retrieve an iterator over all registered writers for the given
+ * MIME type.
+ *
+ * @param MIMEType a MIME specification for an image type
+ * (e.g. "image/jpeg" or "image/x-bmp")
+ *
+ * @return an iterator over a collection of image writers
+ *
+ * @exception IllegalArgumentException if MIMEType is null
+ */
public static Iterator getImageWritersByMIMEType(String MIMEType)
{
if (MIMEType == null)
@@ -373,6 +528,16 @@ public final class ImageIO
MIMEType);
}
+ /**
+ * Retrieve an iterator over all registered writers for the given
+ * file suffix.
+ *
+ * @param fileSuffix an image file suffix (e.g. "jpg" or "bmp")
+ *
+ * @return an iterator over a collection of image writers
+ *
+ * @exception IllegalArgumentException if fileSuffix is null
+ */
public static Iterator getImageWritersBySuffix(String fileSuffix)
{
if (fileSuffix == null)
@@ -383,6 +548,12 @@ public final class ImageIO
fileSuffix);
}
+ /**
+ * Retrieve all the informal format names supported by the
+ * collection of registered image readers.
+ *
+ * @return an array of format names
+ */
public static String[] getReaderFormatNames()
{
try
@@ -408,6 +579,12 @@ public final class ImageIO
}
}
+ /**
+ * Retrieve all the MIME types supported by the collection of
+ * registered image readers.
+ *
+ * @return an array of MIME types
+ */
public static String[] getReaderMIMETypes()
{
try
@@ -438,11 +615,23 @@ public final class ImageIO
return IIORegistry.getDefaultInstance();
}
+ /**
+ * Check whether or not an on-disk cache is used for image input and
+ * output streams.
+ *
+ * @return true if an on-disk cache is available, false otherwise
+ */
public static boolean getUseCache()
{
return useCache;
}
+ /**
+ * Retrieve all the informal format names supported by the
+ * collection of registered image writers.
+ *
+ * @return an array of format names
+ */
public static String[] getWriterFormatNames()
{
try
@@ -468,6 +657,12 @@ public final class ImageIO
}
}
+ /**
+ * Retrieve all the MIME types supported by the collection of
+ * registered image writers.
+ *
+ * @return an array of MIME types
+ */
public static String[] getWriterMIMETypes()
{
try
@@ -502,8 +697,20 @@ public final class ImageIO
IIORegistry.getDefaultInstance().registerApplicationClasspathSpis();
}
+ /**
+ * Set the directory to be used for caching image data. A null
+ * argument means to use the default system temporary directory.
+ * This cache directory is only used if getUseCache returns true.
+ *
+ * @param cacheDirectory the directory where image data should be
+ * cached
+ *
+ * @exception IllegalArgumentException if cacheDirectory is not a
+ * directory
+ */
public static void setCacheDirectory(File cacheDirectory)
{
+ // FIXME: add SecurityManager call
if (cacheDirectory != null)
{
if (!cacheDirectory.isDirectory())
@@ -515,37 +722,98 @@ public final class ImageIO
ImageIO.cacheDirectory = cacheDirectory;
}
+ /**
+ * Control whether or not an on-disk cache is used. This cache is
+ * used to store input or output data from an image data stream when
+ * data in the stream needs to be re-processed.
+ *
+ * If useCache is false the cache will be stored in memory. Doing
+ * so eliminates file creation and deletion overhead. The default
+ * is to use an on-disk cache.
+ *
+ * @param useCache true to use an on-disk cache, false otherwise
+ */
public static void setUseCache(boolean useCache)
{
ImageIO.useCache = useCache;
}
- /*
- * "Standard" simplified entry points.
+ /**
+ * Write an image to a file using a registered writer that supports
+ * the given format, overwriting the file if it already exists.
+ *
+ * @param im the image data to write
+ * @param formatName an informal description of the output format
+ * @param output the file to which the image will be written
+ *
+ * @return false if no registered writer supports the given format,
+ * true otherwise
+ *
+ * @exception IllegalArgumentException if any argument is null
+ * @exception IOException if a writing error occurs
*/
-
public static boolean write(RenderedImage im,
String formatName,
File output)
throws IOException
{
+ if (im == null || formatName == null || output == null)
+ throw new IllegalArgumentException ("null argument");
+
return write(im, formatName, new FileOutputStream(output));
}
+ /**
+ * Write an image to an output stream using a registered writer that
+ * supports the given format.
+ *
+ * @param im the image data to write
+ * @param formatName an informal description of the output format
+ * @param output the output stream to which the image will be
+ * written
+ *
+ * @return false if no registered writer supports the given format,
+ * true otherwise
+ *
+ * @exception IllegalArgumentException if any argument is null
+ * @exception IOException if a writing error occurs
+ */
public static boolean write(RenderedImage im,
String formatName,
OutputStream output)
throws IOException
{
+ if (im == null || formatName == null || output == null)
+ throw new IllegalArgumentException ("null argument");
+
return write(im, formatName, new MemoryCacheImageOutputStream(output));
}
-
-
+
+ /**
+ * Write an image to an ImageOutputStream using a registered writer
+ * that supports the given format. Image data is written starting
+ * at the ImageOutputStream's current stream pointer, overwriting
+ * any existing data.
+ *
+ * @param im the image data to write
+ * @param formatName an informal description of the output format
+ * @param output the image output stream to which the image will be
+ * written
+ *
+ * @return false if no registered writer supports the given format,
+ * true otherwise
+ *
+ * @exception IllegalArgumentException if any argument is null
+ * @exception IOException if a writing error occurs
+ */
public static boolean write(RenderedImage im,
String formatName,
ImageOutputStream output)
throws IOException
{
+ if (im == null || formatName == null || output == null)
+ throw new IllegalArgumentException ("null argument");
+
Iterator writers = getImageWritersByFormatName(formatName);
IIOImage img = new IIOImage(im, null, null);
while (writers.hasNext())
@@ -567,9 +835,27 @@ public final class ImageIO
return false;
}
+ /**
+ * Create a buffered image from an image input stream. An image
+ * reader that supports the given image data is automatically
+ * selected from the collection of registered readers. If no
+ * registered reader can handle the input format, null is returned.
+ *
+ * @param stream the image input stream from which to read image
+ * data
+ *
+ * @return a new buffered image created from the given image data,
+ * or null
+ *
+ * @exception IllegalArgumentException if stream is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(ImageInputStream stream)
throws IOException
{
+ if (stream == null)
+ throw new IllegalArgumentException("null argument");
+
Iterator providers = getRegistry().getServiceProviders(ImageReaderSpi.class, true);
while (providers.hasNext())
{
@@ -583,23 +869,330 @@ public final class ImageIO
}
return null;
}
-
+
+ /**
+ * Create a buffered image from a URL. An image reader that
+ * supports the given image data is automatically selected from the
+ * collection of registered readers. If no registered reader can
+ * handle the input format, null is returned.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * This method does not locate readers that read data directly from
+ * a URL. To locate such readers manually, use IIORegistry and
+ * ImageReaderSpi.
+ *
+ * @param input the URL from which to retrieve the image file
+ *
+ * @return a new buffered image created from the given image URL, or
+ * null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(URL input)
throws IOException
{
+ if (input == null)
+ throw new IllegalArgumentException("null argument");
+
return read(input.openStream());
}
+ /**
+ * Create a buffered image from an input stream. An image reader
+ * that supports the given image data is automatically selected from
+ * the collection of registered readers. If no registered reader
+ * can handle the input format, null is returned.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * This method does not locate readers that read data directly from
+ * an input stream. To locate such readers manually, use
+ * IIORegistry and ImageReaderSpi.
+ *
+ * @param input the input stream from which to read the image data
+ *
+ * @return a new buffered image created from the given input stream,
+ * or null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(InputStream input)
throws IOException
{
+ if (input == null)
+ throw new IllegalArgumentException("null argument");
+
return read(new MemoryCacheImageInputStream(input));
}
+ /**
+ * Create a buffered image from a file. An image reader that
+ * supports the given image data is automatically selected from the
+ * collection of registered readers. If no registered reader can
+ * handle the input format, null is returned.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * This method does not locate readers that read data directly from
+ * a file. To locate such readers manually, use IIORegistry and
+ * ImageReaderSpi.
+ *
+ * @param input the file from which to read image data
+ *
+ * @return a new buffered image created from the given image file,
+ * or null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(File input)
throws IOException
{
+ if (input == null)
+ throw new IllegalArgumentException("null argument");
+
return read(new FileInputStream(input));
}
+ /**
+ * Create an image input stream from the given object. The
+ * collection of ImageInputStreamSpis registered with the
+ * IIORegistry is searched for an image input stream that can take
+ * input from the given object. null is returned if no such SPI is
+ * registered.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * @param input an object from which to read image data
+ *
+ * @return an ImageInputStream that can read data from input, or
+ * null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if caching is required but not enabled
+ */
+ public static ImageInputStream createImageInputStream (Object input)
+ throws IOException
+ {
+ if (input == null)
+ throw new IllegalArgumentException ("null argument");
+
+ Iterator spis = getRegistry().getServiceProviders
+ (ImageInputStreamSpi.class, true);
+
+ ImageInputStreamSpi foundSpi = null;
+
+ while(spis.hasNext())
+ {
+ ImageInputStreamSpi spi = (ImageInputStreamSpi) spis.next();
+
+ if (input.getClass().equals(spi.getInputClass()))
+ {
+ foundSpi = spi;
+ break;
+ }
+ }
+
+ return foundSpi == null ? null :
+ foundSpi.createInputStreamInstance (input,
+ getUseCache(),
+ getCacheDirectory());
+ }
+
+ /**
+ * Create an image output stream from the given object. The
+ * collection of ImageOutputStreamSpis registered with the
+ * IIORegistry is searched for an image output stream that can send
+ * output to the given object. null is returned if no such SPI is
+ * registered.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * @param input an object to which to write image data
+ *
+ * @return an ImageOutputStream that can send data to output, or
+ * null
+ *
+ * @exception IllegalArgumentException if output is null
+ * @exception IOException if caching is required but not enabled
+ */
+ public static ImageOutputStream createImageOutputStream (Object output)
+ throws IOException
+ {
+ if (output == null)
+ throw new IllegalArgumentException ("null argument");
+
+ Iterator spis = getRegistry().getServiceProviders
+ (ImageOutputStreamSpi.class, true);
+
+ ImageOutputStreamSpi foundSpi = null;
+
+ while(spis.hasNext())
+ {
+ ImageOutputStreamSpi spi = (ImageOutputStreamSpi) spis.next();
+
+ if (output.getClass().equals(spi.getOutputClass()))
+ {
+ foundSpi = spi;
+ break;
+ }
+ }
+
+ return foundSpi == null ? null :
+ foundSpi.createOutputStreamInstance (output,
+ getUseCache(),
+ getCacheDirectory());
+ }
+
+ /**
+ * Retrieve an image reader corresponding to an image writer, or
+ * null if writer is not registered or if no corresponding reader is
+ * registered.
+ *
+ * @param writer a registered image writer
+ *
+ * @return an image reader corresponding to writer, or null
+ *
+ * @exception IllegalArgumentException if writer is null
+ */
+ public static ImageReader getImageReader (ImageWriter writer)
+ {
+ if (writer == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ImageWriterSpi spi = (ImageWriterSpi) getRegistry()
+ .getServiceProviderByClass(writer.getClass());
+
+ String[] readerSpiNames = spi.getImageReaderSpiNames();
+
+ ImageReader r = null;
+
+ if (readerSpiNames != null)
+ {
+ try
+ {
+ Class readerClass = Class.forName (readerSpiNames[0]);
+ r = (ImageReader) readerClass.newInstance ();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Retrieve an iterator over the collection of registered image
+ * readers that support reading data from the given object.
+ *
+ * @param input the object for which to retrieve image readers
+ *
+ * @return an iterator over a collection of image readers
+ */
+ public static Iterator getImageReaders (Object input)
+ {
+ if (input == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getRegistry().getServiceProviders (ImageReaderSpi.class,
+ new ReaderObjectFilter(input),
+ true);
+ }
+
+ /**
+ * Retrieve an iterator over the collection of registered image
+ * writers that support writing images of the given type and in the
+ * given format.
+ *
+ * @param type the output image's colour and sample models
+ * @param formatName the output image format
+ *
+ * @return an iterator over a collection of image writers
+ */
+ public static Iterator getImageWriters (ImageTypeSpecifier type,
+ String formatName)
+ {
+ if (type == null || formatName == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getRegistry().getServiceProviders (ImageWriterSpi.class,
+ new WriterObjectFilter(type,
+ formatName),
+ true);
+ }
+
+ /**
+ * Retrieve an image writer corresponding to an image reader, or
+ * null if reader is not registered or if no corresponding writer is
+ * registered. This method is useful for preserving metadata
+ * without needing to understand its format, since the returned
+ * writer will be able to write, unchanged, the metadata passed to
+ * it by the reader.
+ *
+ * @param reader a registered image reader
+ *
+ * @return an image writer corresponding to reader, or null
+ *
+ * @exception IllegalArgumentException if reader is null
+ */
+ public static ImageWriter getImageWriter (ImageReader reader)
+ {
+ if (reader == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ImageReaderSpi spi = (ImageReaderSpi) getRegistry()
+ .getServiceProviderByClass(reader.getClass());
+
+ String[] writerSpiNames = spi.getImageWriterSpiNames();
+
+ ImageWriter w = null;
+
+ if (writerSpiNames != null)
+ {
+ try
+ {
+ Class writerClass = Class.forName (writerSpiNames[0]);
+ w = (ImageWriter) writerClass.newInstance ();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+ return w;
+ }
+
+ /**
+ * Retrieve an iterator over a collection of image transcoders that
+ * support transcoding from the given image reader's metadata format
+ * to the given writer's metadata format.
+ *
+ * @param reader an image reader
+ * @param writer an image writer
+ *
+ * @return an iterator over a collection of image transcoders
+ *
+ * @exception IllegalArgumentException if either reader or writer is
+ * null
+ */
+ public static Iterator getImageTranscoders (ImageReader reader,
+ ImageWriter writer)
+ {
+ if (reader == null || writer == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getRegistry().getServiceProviders (ImageTranscoderSpi.class,
+ new TranscoderFilter (reader,
+ writer),
+ true);
+ }
}
diff --git a/libjava/classpath/javax/imageio/ImageReadParam.java b/libjava/classpath/javax/imageio/ImageReadParam.java
index 889fe6cc97d..b2680f6b14e 100644
--- a/libjava/classpath/javax/imageio/ImageReadParam.java
+++ b/libjava/classpath/javax/imageio/ImageReadParam.java
@@ -42,6 +42,8 @@ import java.awt.Dimension;
import java.awt.image.BufferedImage;
/**
+ * DOCUMENT ME
+ *
* @author Michel Koch (konqueror@gmx.de)
*/
public class ImageReadParam extends IIOParam
diff --git a/libjava/classpath/javax/imageio/ImageReader.java b/libjava/classpath/javax/imageio/ImageReader.java
index fdf692bd2aa..cdd77d52bad 100644
--- a/libjava/classpath/javax/imageio/ImageReader.java
+++ b/libjava/classpath/javax/imageio/ImageReader.java
@@ -1,5 +1,5 @@
/* ImageReader.java -- Decodes raster images.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,13 +38,19 @@ exception statement from your version. */
package javax.imageio;
+import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import java.util.Set;
import javax.imageio.event.IIOReadProgressListener;
import javax.imageio.event.IIOReadUpdateListener;
@@ -53,82 +59,233 @@ import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
+/**
+ * A class for decoding images within the ImageIO framework.
+ *
+ * An ImageReader for a given format is instantiated by an
+ * ImageReaderSpi for that format. ImageReaderSpis are registered
+ * with the IIORegistry.
+ *
+ * The ImageReader API supports reading animated images that may have
+ * multiple frames; to support such images many methods take an index
+ * parameter.
+ *
+ * Images may also be read in multiple passes, where each successive
+ * pass increases the level of detail in the destination image.
+ */
public abstract class ImageReader
{
private boolean aborted;
-
- protected Locale[] availableLocales;
- protected boolean ignoreMetadata;
- protected Object input;
- protected Locale locale;
- protected int minIndex;
- protected ImageReaderSpi originatingProvider;
- protected List progressListeners = new ArrayList();
- protected boolean seekForwardOnly;
- protected List updateListeners = new ArrayList();
- protected List warningListeners = new ArrayList();
- protected List warningLocales = new ArrayList();
+ /**
+ * All locales available for localization of warning messages, or
+ * null if localization is not supported.
+ */
+ protected Locale[] availableLocales = null;
+
+ /**
+ * true if the input source does not require metadata to be read,
+ * false otherwise.
+ */
+ protected boolean ignoreMetadata = false;
+
+ /**
+ * An ImageInputStream from which image data is read.
+ */
+ protected Object input = null;
+
+ /**
+ * The current locale used to localize warning messages, or null if
+ * no locale has been set.
+ */
+ protected Locale locale = null;
+
+ /**
+ * The minimum index at which data can be read. Constantly 0 if
+ * seekForwardOnly is false, always increasing if seekForwardOnly is
+ * true.
+ */
+ protected int minIndex = 0;
+
+ /**
+ * The image reader SPI that instantiated this reader.
+ */
+ protected ImageReaderSpi originatingProvider = null;
+
+ /**
+ * A list of installed progress listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List progressListeners = null;
+
+ /**
+ * true if this reader should only read data further ahead in the
+ * stream than its current location. false if it can read backwards
+ * in the stream. If this is true then caching can be avoided.
+ */
+ protected boolean seekForwardOnly = false;
+
+ /**
+ * A list of installed update listeners. Initially null, meaning no
+ * installed listeners.
+ */
+ protected List updateListeners = null;
+
+ /**
+ * A list of installed warning listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List warningListeners = null;
+
+ /**
+ * A list of warning locales corresponding with the list of
+ * installed warning listeners. Initially null, meaning no locales.
+ */
+ protected List warningLocales = null;
+
+ /**
+ * Construct an image reader.
+ *
+ * @param originatingProvider the provider that is constructing this
+ * image reader, or null
+ */
protected ImageReader(ImageReaderSpi originatingProvider)
{
this.originatingProvider = originatingProvider;
}
+ /**
+ * Request that reading be aborted. The unread contents of the
+ * image will be undefined.
+ *
+ * Readers should clear the abort flag before starting a read
+ * operation, then poll it periodically during the read operation.
+ */
public void abort()
{
aborted = true;
}
+ /**
+ * Check if the abort flag is set.
+ *
+ * @return true if the current read operation should be aborted,
+ * false otherwise
+ */
protected boolean abortRequested()
{
return aborted;
}
+ /**
+ * Install a read progress listener. This method will return
+ * immediately if listener is null.
+ *
+ * @param listener a read progress listener or null
+ */
public void addIIOReadProgressListener(IIOReadProgressListener listener)
{
if (listener == null)
return;
-
- progressListeners.add(listener);
+ if (progressListeners == null)
+ progressListeners = new ArrayList ();
+ progressListeners.add(listener);
}
+ /**
+ * Install a read update listener. This method will return
+ * immediately if listener is null.
+ *
+ * @param listener a read update listener
+ */
public void addIIOReadUpdateListener(IIOReadUpdateListener listener)
{
if (listener == null)
return;
-
- updateListeners.add(listener);
+ if (updateListeners == null)
+ updateListeners = new ArrayList ();
+ updateListeners.add(listener);
}
-
+
+ /**
+ * Install a read warning listener. This method will return
+ * immediately if listener is null. Warning messages sent to this
+ * listener will be localized using the current locale. If the
+ * current locale is null then this reader will select a sensible
+ * default.
+ *
+ * @param listener a read warning listener
+ */
public void addIIOReadWarningListener(IIOReadWarningListener listener)
{
if (listener == null)
return;
-
- warningListeners.add(listener);
+ if (warningListeners == null)
+ warningListeners = new ArrayList ();
+ warningListeners.add(listener);
}
+ /**
+ * Check if this reader can handle raster data. Determines whether
+ * or not readRaster and readTileRaster throw
+ * UnsupportedOperationException.
+ *
+ * @return true if this reader supports raster data, false if not
+ */
public boolean canReadRaster()
{
return false;
}
+ /**
+ * Clear the abort flag.
+ */
protected void clearAbortRequest()
{
aborted = false;
}
-
+
+ /**
+ * Releases any resources allocated to this object. Subsequent
+ * calls to methods on this object will produce undefined results.
+ *
+ * The default implementation does nothing; subclasses should use
+ * this method ensure that native resources are released.
+ */
public void dispose()
{
// The default implementation does nothing.
}
-
+
+ /**
+ * Returns the aspect ratio of this image, the ration of its width
+ * to its height. The aspect ratio is useful when resizing an image
+ * while keeping its proportions constant.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the image's aspect ratio
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public float getAspectRatio(int imageIndex)
throws IOException
{
+ if (input == null)
+ throw new IllegalStateException("input is null");
+
return (float) (getWidth(imageIndex) / getHeight(imageIndex));
}
+ /**
+ * Retrieve the available locales. Return null if no locales are
+ * available or a clone of availableLocales.
+ *
+ * @return an array of locales or null
+ */
public Locale[] getAvailableLocales()
{
if (availableLocales == null)
@@ -137,26 +294,107 @@ public abstract class ImageReader
return (Locale[]) availableLocales.clone();
}
+ /**
+ * Retrieve the default read parameters for this reader's image
+ * format.
+ *
+ * The default implementation returns new ImageReadParam().
+ *
+ * @return image reading parameters
+ */
public ImageReadParam getDefaultReadParam()
{
return new ImageReadParam();
}
+ /**
+ * Retrieve the format of the input source.
+ *
+ * @return the input source format name
+ *
+ * @exception IOException if a read error occurs
+ */
public String getFormatName()
throws IOException
{
return originatingProvider.getFormatNames()[0];
}
+ /**
+ * Get the height of the input image in pixels. If the input image
+ * is resizable then a default height is returned.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the height of the input image
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract int getHeight(int imageIndex)
throws IOException;
+ /**
+ * Get the metadata associated with this image. If the reader is
+ * set to ignore metadata or does not support reading metadata, or
+ * if no metadata is available then null is returned.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return a metadata object, or null
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract IIOMetadata getImageMetadata(int imageIndex)
throws IOException;
+ /**
+ * Get an iterator over the collection of image types into which
+ * this reader can decode image data. This method is guaranteed to
+ * return at least one valid image type specifier.
+ *
+ * The elements of the iterator should be ordered; the first element
+ * should be the most appropriate image type for this decoder,
+ * followed by the second-most appropriate, and so on.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return an iterator over a collection of image type specifiers
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract Iterator getImageTypes(int imageIndex)
throws IOException;
+ /**
+ * Set the input source to the given object, specify whether this
+ * reader should be allowed to read input from the data stream more
+ * than once, and specify whether this reader should ignore metadata
+ * in the input stream. The input source must be set before many
+ * methods can be called on this reader. (see all ImageReader
+ * methods that throw IllegalStateException). If input is null then
+ * the current input source will be removed.
+ *
+ * Unless this reader has direct access with imaging hardware, input
+ * should be an ImageInputStream.
+ *
+ * @param input the input source object
+ * @param seekForwardOnly true if this reader should be allowed to
+ * read input from the data stream more than once, false otherwise
+ * @param ignoreMetadata true if this reader should ignore metadata
+ * associated with the input source, false otherwise
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this reader and is not an ImageInputStream
+ */
public void setInput(Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
@@ -183,358 +421,960 @@ public abstract class ImageReader
this.minIndex = 0;
}
+ /**
+ * Set the input source to the given object and specify whether this
+ * reader should be allowed to read input from the data stream more
+ * than once. The input source must be set before many methods can
+ * be called on this reader. (see all ImageReader methods that throw
+ * IllegalStateException). If input is null then the current input
+ * source will be removed.
+ *
+ * @param input the input source object
+ * @param seekForwardOnly true if this reader should be allowed to
+ * read input from the data stream more than once, false otherwise
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this reader and is not an ImageInputStream
+ */
public void setInput(Object in, boolean seekForwardOnly)
{
setInput(in, seekForwardOnly, false);
}
- public void setInput(Object in)
+ /**
+ * Set the input source to the given object. The input source must
+ * be set before many methods can be called on this reader. (see all
+ * ImageReader methods that throw IllegalStateException). If input
+ * is null then the current input source will be removed.
+ *
+ * @param input the input source object
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this reader and is not an ImageInputStream
+ */
+ public void setInput(Object input)
{
- setInput(in, false, false);
+ setInput(input, false, false);
}
+ /**
+ * Get this reader's image input source. null is returned if the
+ * image source has not been set.
+ *
+ * @return an image input source object, or null
+ */
public Object getInput()
{
return input;
}
+ /**
+ * Get this reader's locale. null is returned if the locale has not
+ * been set.
+ *
+ * @return this reader's locale, or null
+ */
public Locale getLocale()
{
return locale;
}
+ /**
+ * Return the number of images available from the image input
+ * source, not including thumbnails. This method will return 1
+ * unless this reader is reading an animated image.
+ *
+ * Certain multi-image formats do not encode the total number of
+ * images. When reading images in those formats it may be necessary
+ * to repeatedly call read, incrementing the image index at each
+ * call, until an IndexOutOfBoundsException is thrown.
+ *
+ * The allowSearch parameter determines whether all images must be
+ * available at all times. When allowSearch is false, getNumImages
+ * will return -1 if the total number of images is unknown.
+ * Otherwise this method returns the number of images.
+ *
+ * @param allowSearch true if all images should be available at
+ * once, false otherwise
+ *
+ * @return -1 if allowSearch is false and the total number of images
+ * is currently unknown, or the number of images
+ *
+ * @exception IllegalStateException if input has not been set, or if
+ * seekForwardOnly is true
+ * @exception IOException if a read error occurs
+ */
public abstract int getNumImages(boolean allowSearch)
throws IOException;
+ /**
+ * Get the number of thumbnails associated with an image.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the number of thumbnails associated with this image
+ */
public int getNumThumbnails(int imageIndex)
throws IOException
{
return 0;
}
+ /**
+ * Get the ImageReaderSpi that created this reader or null.
+ *
+ * @return an ImageReaderSpi, or null
+ */
public ImageReaderSpi getOriginatingProvider()
{
return originatingProvider;
}
+ /**
+ * Get the metadata associated with the image being read. If the
+ * reader is set to ignore metadata or does not support reading
+ * metadata, or if no metadata is available then null is returned.
+ * This method returns metadata associated with the entirety of the
+ * image data, whereas getImageMetadata(int) returns metadata
+ * associated with a frame within a multi-image data stream.
+ *
+ * @return metadata associated with the image being read, or null
+ *
+ * @exception IOException if a read error occurs
+ */
public abstract IIOMetadata getStreamMetadata()
throws IOException;
+ /**
+ * Get the height of a thumbnail image.
+ *
+ * @param imageIndex the frame index
+ * @param thumbnailIndex the thumbnail index
+ *
+ * @return the height of the thumbnail image
+ *
+ * @exception UnsupportedOperationException if this reader does not
+ * support thumbnails
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if either index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getThumbnailHeight(int imageIndex, int thumbnailIndex)
throws IOException
{
return readThumbnail(imageIndex, thumbnailIndex).getHeight();
}
+ /**
+ * Get the width of a thumbnail image.
+ *
+ * @param imageIndex the frame index
+ * @param thumbnailIndex the thumbnail index
+ *
+ * @return the width of the thumbnail image
+ *
+ * @exception UnsupportedOperationException if this reader does not
+ * support thumbnails
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if either index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getThumbnailWidth(int imageIndex, int thumbnailIndex)
throws IOException
{
return readThumbnail(imageIndex, thumbnailIndex).getWidth();
}
+ /**
+ * Get the X coordinate in pixels of the top-left corner of the
+ * first tile in this image.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the X coordinate of this image's first tile
+ *
+ * @exception IllegalStateException if input is needed but the input
+ * source is not set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileGridXOffset(int imageIndex)
throws IOException
{
return 0;
}
+ /**
+ * Get the Y coordinate in pixels of the top-left corner of the
+ * first tile in this image.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the Y coordinate of this image's first tile
+ *
+ * @exception IllegalStateException if input is needed but the input
+ * source is not set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileGridYOffset(int imageIndex)
throws IOException
{
return 0;
}
+ /**
+ * Get the height of an image tile.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the tile height for the given image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileHeight(int imageIndex)
throws IOException
{
return getHeight(imageIndex);
}
+ /**
+ * Get the width of an image tile.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the tile width for the given image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileWidth(int imageIndex)
throws IOException
{
return getWidth(imageIndex);
}
+ /**
+ * Get the width of the input image in pixels. If the input image
+ * is resizable then a default width is returned.
+ *
+ * @param imageIndex the image's index
+ *
+ * @return the width of the input image
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract int getWidth(int imageIndex)
throws IOException;
+ /**
+ * Check whether or not the given image has thumbnails associated
+ * with it.
+ *
+ * @return true if the given image has thumbnails, false otherwise
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public boolean hasThumbnails(int imageIndex)
throws IOException
{
return getNumThumbnails(imageIndex) > 0;
}
+ /**
+ * Check if this image reader ignores metadata. This method simply
+ * returns the value of ignoreMetadata.
+ *
+ * @return true if metadata is being ignored, false otherwise
+ */
public boolean isIgnoringMetadata()
{
return ignoreMetadata;
}
+ /**
+ * Check if the given image is sub-divided into equal-sized
+ * non-overlapping pixel rectangles.
+ *
+ * A reader may expose tiling in the underlying format, hide it, or
+ * simulate tiling even if the underlying format is not tiled.
+ *
+ * @return true if the given image is tiled, false otherwise
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public boolean isImageTiled(int imageIndex)
throws IOException
{
return false;
}
+ /**
+ * Check if all pixels in this image are readily accessible. This
+ * method should return false for compressed formats. The return
+ * value is a hint as to the efficiency of certain image reader
+ * operations.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if random pixel access is fast, false otherwise
+ *
+ * @exception IllegalStateException if input is null and it is
+ * needed to determine the return value
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds but the frame data must be accessed to determine
+ * the return value
+ * @exception IOException if a read error occurs
+ */
public boolean isRandomAccessEasy(int imageIndex)
throws IOException
{
return false;
}
+ /**
+ * Check if this image reader may only seek forward within the input
+ * stream.
+ *
+ * @return true if this reader may only seek forward, false
+ * otherwise
+ */
public boolean isSeekForwardOnly()
{
return seekForwardOnly;
}
+ /**
+ * Notifies all installed read progress listeners that image loading
+ * has completed by calling their imageComplete methods.
+ */
protected void processImageComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.imageComplete (this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.imageComplete (this);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners that a certain
+ * percentage of the image has been loaded, by calling their
+ * imageProgress methods.
+ *
+ * @param percentageDone the percentage of image data that has been
+ * loaded
+ */
protected void processImageProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.imageProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.imageProgress(this, percentageDone);
+ }
}
}
-
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * imageStarted methods, that image loading has started on the given
+ * image.
+ *
+ * @param imageIndex the frame index of the image that has started
+ * loading
+ */
protected void processImageStarted(int imageIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.imageStarted(this, imageIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.imageStarted(this, imageIndex);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * imageUpdate methods, that the set of samples has changed.
+ *
+ * @param image the buffered image that is being updated
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processImageUpdate(BufferedImage image, int minX, int minY,
int width, int height, int periodX,
int periodY, int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.imageUpdate(this, image, minX, minY, width, height, periodX,
- periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.imageUpdate(this, image, minX, minY, width, height,
+ periodX, periodY, bands);
+ }
}
}
+ /**
+ * Notifies all installed update progress listeners, by calling
+ * their passComplete methods, that a progressive pass has
+ * completed.
+ *
+ * @param image the image that has being updated
+ */
protected void processPassComplete(BufferedImage image)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.passComplete(this, image);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.passComplete(this, image);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * passStarted methods, that a new pass has begun.
+ *
+ * @param image the buffered image that is being updated
+ * @param pass the current pass number
+ * @param minPass the pass at which decoding will begin
+ * @param maxPass the pass at which decoding will end
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processPassStarted(BufferedImage image, int pass, int minPass,
int maxPass, int minX, int minY,
int periodX, int periodY, int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.passStarted(this, image, pass, minPass, maxPass, minX, minY,
- periodX, periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.passStarted(this, image, pass, minPass, maxPass, minX,
+ minY, periodX, periodY, bands);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners that image loading
+ * has been aborted by calling their readAborted methods.
+ */
protected void processReadAborted()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.readAborted(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.readAborted(this);
+ }
}
}
-
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * sequenceComplete methods, that a sequence of images has completed
+ * loading.
+ */
protected void processSequenceComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.sequenceComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.sequenceComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * sequenceStarted methods, a sequence of images has started
+ * loading.
+ *
+ * @param minIndex the index of the first image in the sequence
+ */
protected void processSequenceStarted(int minIndex)
{
- Iterator it = progressListeners.iterator();
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.sequenceStarted(this, minIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.sequenceStarted(this, minIndex);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * thumbnailComplete methods, that a thumbnail has completed
+ * loading.
+ */
protected void processThumbnailComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.thumbnailComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.thumbnailComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed update progress listeners, by calling
+ * their thumbnailPassComplete methods, that a progressive pass has
+ * completed on a thumbnail.
+ *
+ * @param thumbnail the thumbnail that has being updated
+ */
protected void processThumbnailPassComplete(BufferedImage thumbnail)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.thumbnailPassComplete(this, thumbnail);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.thumbnailPassComplete(this, thumbnail);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * thumbnailPassStarted methods, that a new pass has begun.
+ *
+ * @param thumbnail the thumbnail that is being updated
+ * @param pass the current pass number
+ * @param minPass the pass at which decoding will begin
+ * @param maxPass the pass at which decoding will end
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processThumbnailPassStarted(BufferedImage thumbnail, int pass,
int minPass, int maxPass, int minX,
int minY, int periodX, int periodY,
int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.thumbnailPassStarted(this, thumbnail, pass, minPass, maxPass,
- minX, minY, periodX, periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.thumbnailPassStarted(this, thumbnail, pass, minPass,
+ maxPass, minX, minY, periodX,
+ periodY, bands);
+ }
}
}
-
+
+ /**
+ * Notifies all installed read progress listeners that a certain
+ * percentage of a thumbnail has been loaded, by calling their
+ * thumbnailProgress methods.
+ *
+ * @param percentageDone the percentage of thumbnail data that has
+ * been loaded
+ */
protected void processThumbnailProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.thumbnailProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.thumbnailProgress(this, percentageDone);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * imageStarted methods, that thumbnail loading has started on the
+ * given thumbnail of the given image.
+ *
+ * @param imageIndex the frame index of the image one of who's
+ * thumbnails has started loading
+ * @param thumbnailIndex the index of the thumbnail that has started
+ * loading
+ */
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * thumbnailUpdate methods, that the set of samples has changed.
+ *
+ * @param image the buffered image that is being updated
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processThumbnailUpdate(BufferedImage image, int minX, int minY,
int width, int height, int periodX,
int periodY, int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.thumbnailUpdate(this, image, minX, minY, width, height,
- periodX, periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.thumbnailUpdate(this, image, minX, minY, width, height,
+ periodX, periodY, bands);
+ }
}
}
+ /**
+ * Notifies all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ *
+ * @param warning the warning message
+ *
+ * @exception IllegalArgumentException if warning is null
+ */
protected void processWarningOccurred(String warning)
{
- Iterator it = warningListeners.iterator();
+ if (warning == null)
+ throw new IllegalArgumentException ("null argument");
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadWarningListener listener =
+ (IIOReadWarningListener) it.next();
+ listener.warningOccurred(this, warning);
+ }
+ }
+ }
+
+ /**
+ * Notify all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ * The warning message is retrieved from a resource bundle, using
+ * the given basename and keyword.
+ *
+ * @param baseName the basename of the resource from which to
+ * retrieve the warning message
+ * @param keyword the keyword used to retrieve the warning from the
+ * resource bundle
+ *
+ * @exception IllegalArgumentException if either baseName or keyword
+ * is null
+ * @exception IllegalArgumentException if no resource bundle is
+ * found using baseName
+ * @exception IllegalArgumentException if the given keyword produces
+ * no results from the resource bundle
+ * @exception IllegalArgumentException if the retrieved object is
+ * not a String
+ */
+ protected void processWarningOccurred(String baseName,
+ String keyword)
+ {
+ if (baseName == null || keyword == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ResourceBundle b = null;
+
+ try
+ {
+ b = ResourceBundle.getBundle(baseName, getLocale());
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no resource bundle found");
+ }
+
+ Object str = null;
- while (it.hasNext())
+ try
{
- IIOReadWarningListener listener = (IIOReadWarningListener) it.next();
- listener.warningOccurred(this, warning);
+ str = b.getObject(keyword);
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no results found for keyword");
+ }
+
+ if (! (str instanceof String))
+ throw new IllegalArgumentException ("retrieved object not a String");
+
+ String warning = (String) str;
+
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadWarningListener listener =
+ (IIOReadWarningListener) it.next();
+ listener.warningOccurred(this, warning);
+ }
}
}
+ /**
+ * Read the given frame into a buffered image using the given read
+ * parameters. Listeners will be notified of image loading progress
+ * and warnings.
+ *
+ * @param imageIndex the index of the frame to read
+ * @param param the image read parameters to use when reading
+ *
+ * @return a buffered image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract BufferedImage read(int imageIndex, ImageReadParam param)
throws IOException;
+ /**
+ * Check if this reader supports reading thumbnails.
+ *
+ * @return true if this reader supports reading thumbnails, false
+ * otherwise
+ */
public boolean readerSupportsThumbnails()
{
return false;
}
+ /**
+ * Read raw raster data. The image type specifier in param is
+ * ignored but all other parameters are used. Offset parameters are
+ * translated into the raster's coordinate space. This method may
+ * be implemented by image readers that want to provide direct
+ * access to raw image data.
+ *
+ * @param imageIndex the frame index
+ * @param param the image read parameters
+ *
+ * @return a raster containing the read image data
+ *
+ * @exception UnsupportedOperationException if this reader doesn't
+ * support rasters
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public Raster readRaster(int imageIndex, ImageReadParam param)
throws IOException
{
throw new UnsupportedOperationException();
}
+ /**
+ * Read a thumbnail.
+ *
+ * @param imageIndex the frame index
+ * @param thumbnailIndex the thumbnail index
+ *
+ * @return a buffered image of the thumbnail
+ *
+ * @exception UnsupportedOperationException if this reader doesn't
+ * support thumbnails
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if either the frame index or
+ * the thumbnail index is out-of-bounds
+ * @exception IOException if a read error occurs
+ *
+ */
public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex)
throws IOException
{
throw new UnsupportedOperationException();
}
+ /**
+ * Uninstall all read progress listeners.
+ */
public void removeAllIIOReadProgressListeners()
{
- progressListeners.clear();
+ progressListeners = null;
}
+ /**
+ * Uninstall all read update listeners.
+ */
public void removeAllIIOReadUpdateListeners()
{
- updateListeners.clear();
+ updateListeners = null;
}
+ /**
+ * Uninstall all read warning listeners.
+ */
public void removeAllIIOReadWarningListeners()
{
- warningListeners.clear();
+ warningListeners = null;
}
-
+
+ /**
+ * Uninstall the given read progress listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOReadProgressListener(IIOReadProgressListener listener)
{
if (listener == null)
return;
-
- progressListeners.remove(listener);
+ if (progressListeners != null)
+ {
+ progressListeners.remove(listener);
+ }
}
-
+
+ /**
+ * Uninstall the given read update listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOReadUpdateListener(IIOReadUpdateListener listener)
{
if (listener == null)
return;
-
- updateListeners.remove(listener);
+
+ if (updateListeners != null)
+ {
+ updateListeners.remove(listener);
+ }
}
-
+
+ /**
+ * Uninstall the given read warning listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOReadWarningListener(IIOReadWarningListener listener)
{
if (listener == null)
return;
-
- warningListeners.remove(listener);
+ if (warningListeners != null)
+ {
+ warningListeners.remove(listener);
+ }
}
-
+
+ /**
+ * Set the current locale or use the default locale.
+ *
+ * @param locale the locale to set, or null
+ */
public void setLocale(Locale locale)
{
if (locale != null)
@@ -553,4 +1393,644 @@ public abstract class ImageReader
this.locale = locale;
}
+
+ /**
+ * Check that the given read parameters have valid source and
+ * destination band settings. If the param.getSourceBands() returns
+ * null, the array is assumed to include all band indices, 0 to
+ * numSrcBands - 1; likewise if param.getDestinationBands() returns
+ * null, it is assumed to be an array containing indices 0 to
+ * numDstBands - 1. A failure will cause this method to throw
+ * IllegalArgumentException.
+ *
+ * @param param the image parameters to check
+ * @param numSrcBands the number of input source bands
+ * @param numDstBands the number of ouput destination bands
+ *
+ * @exception IllegalArgumentException if either the given source or
+ * destination band indices are invalid
+ */
+ protected static void checkReadParamBandSettings(ImageReadParam param,
+ int numSrcBands,
+ int numDstBands)
+ {
+ int[] srcBands = param.getSourceBands();
+ int[] dstBands = param.getDestinationBands();
+ boolean lengthsDiffer = false;
+ boolean srcOOB = false;
+ boolean dstOOB = false;
+
+ if (srcBands == null)
+ {
+ if (dstBands == null)
+ {
+ if (numSrcBands != numDstBands)
+ lengthsDiffer = true;
+ }
+ else
+ {
+ if (numSrcBands != dstBands.length)
+ lengthsDiffer = true;
+
+ for (int i = 0; i < dstBands.length; i++)
+ if (dstBands[i] > numSrcBands - 1)
+ {
+ dstOOB = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (dstBands == null)
+ {
+ if (srcBands.length != numDstBands)
+ lengthsDiffer = true;
+
+ for (int i = 0; i < srcBands.length; i++)
+ if (srcBands[i] > numDstBands - 1)
+ {
+ srcOOB = true;
+ break;
+ }
+ }
+ else
+ {
+ if (srcBands.length != dstBands.length)
+ lengthsDiffer = true;
+
+ for (int i = 0; i < srcBands.length; i++)
+ if (srcBands[i] > numDstBands - 1)
+ {
+ srcOOB = true;
+ break;
+ }
+
+ for (int i = 0; i < dstBands.length; i++)
+ if (dstBands[i] > numSrcBands - 1)
+ {
+ dstOOB = true;
+ break;
+ }
+ }
+ }
+
+ if (lengthsDiffer)
+ throw new IllegalArgumentException ("array lengths differ");
+
+ if (srcOOB)
+ throw new IllegalArgumentException ("source band index"
+ + " out-of-bounds");
+
+ if (dstOOB)
+ throw new IllegalArgumentException ("destination band index"
+ + " out-of-bounds");
+ }
+
+ /**
+ * Calcluate the source and destination regions that will be read
+ * from and written to, given image parameters and/or a destination
+ * buffered image. The source region will be clipped if any of its
+ * bounds are outside the destination region. Clipping will account
+ * for subsampling and destination offsets. Likewise, the
+ * destination region is clipped to the given destination image, if
+ * it is not null, using the given image parameters, if they are not
+ * null. IllegalArgumentException is thrown if either region will
+ * contain 0 pixels after clipping.
+ *
+ * @param image read parameters, or null
+ * @param srcWidth the width of the source image
+ * @param srcHeight the height of the source image
+ * @param image the destination image, or null
+ * @param srcRegion a rectangle whose values will be set to the
+ * clipped source region
+ * @param destRegion a rectangle whose values will be set to the
+ * clipped destination region
+ *
+ * @exception IllegalArgumentException if either srcRegion or
+ * destRegion is null
+ * @exception IllegalArgumentException if either of the calculated
+ * regions is empty
+ */
+ protected static void computeRegions (ImageReadParam param,
+ int srcWidth,
+ int srcHeight,
+ BufferedImage image,
+ Rectangle srcRegion,
+ Rectangle destRegion)
+ {
+ if (srcRegion == null || destRegion == null)
+ throw new IllegalArgumentException ("null region");
+
+ if (srcWidth == 0 || srcHeight == 0)
+ throw new IllegalArgumentException ("zero-sized region");
+
+ srcRegion = getSourceRegion(param, srcWidth, srcHeight);
+ if (image != null)
+ destRegion = new Rectangle (0, 0, image.getWidth(), image.getHeight());
+ else
+ destRegion = new Rectangle (0, 0, srcWidth, srcHeight);
+
+ if (param != null)
+ {
+ Point offset = param.getDestinationOffset();
+
+ if (offset.x < 0)
+ {
+ srcRegion.x -= offset.x;
+ srcRegion.width += offset.x;
+ }
+ if (offset.y < 0)
+ {
+ srcRegion.y -= offset.y;
+ srcRegion.height += offset.y;
+ }
+
+ srcRegion.width = srcRegion.width > destRegion.width
+ ? destRegion.width : srcRegion.width;
+ srcRegion.height = srcRegion.height > destRegion.height
+ ? destRegion.height : srcRegion.height;
+
+ if (offset.x >= 0)
+ {
+ destRegion.x += offset.x;
+ destRegion.width -= offset.x;
+ }
+ if (offset.y >= 0)
+ {
+ destRegion.y += offset.y;
+ destRegion.height -= offset.y;
+ }
+ }
+
+ if (srcRegion.isEmpty() || destRegion.isEmpty())
+ throw new IllegalArgumentException ("zero-sized region");
+ }
+
+ /**
+ * Return a suitable destination buffered image. If
+ * param.getDestination() is non-null, then it is returned,
+ * otherwise a buffered image is created using
+ * param.getDestinationType() if it is non-null and also in the
+ * given imageTypes collection, or the first element of imageTypes
+ * otherwise.
+ *
+ * @param param image read parameters from which a destination image
+ * or image type is retrieved, or null
+ * @param imageTypes a collection of legal image types
+ * @param width the width of the source image
+ * @param height the height of the source image
+ *
+ * @return a suitable destination buffered image
+ *
+ * @exception IIOException if param.getDestinationType() does not
+ * return an image type in imageTypes
+ * @exception IllegalArgumentException if imageTypes is null or
+ * empty, or if a non-ImageTypeSpecifier object is retrieved from
+ * imageTypes
+ * @exception IllegalArgumentException if the resulting destination
+ * region is empty
+ * @exception IllegalArgumentException if the product of width and
+ * height is greater than Integer.MAX_VALUE
+ */
+ protected static BufferedImage getDestination (ImageReadParam param,
+ Iterator imageTypes,
+ int width,
+ int height)
+ throws IIOException
+ {
+ if (imageTypes == null || !imageTypes.hasNext())
+ throw new IllegalArgumentException ("imageTypes null or empty");
+
+ if (width < 0 || height < 0)
+ throw new IllegalArgumentException ("negative dimension");
+
+ // test for overflow
+ if (width * height < Math.min (width, height))
+ throw new IllegalArgumentException ("width * height > Integer.MAX_VALUE");
+
+ BufferedImage dest = null;
+ ImageTypeSpecifier destType = null;
+
+ if (param != null)
+ {
+ dest = param.getDestination ();
+ if (dest == null)
+ {
+ ImageTypeSpecifier type = param.getDestinationType();
+ if (type != null)
+ {
+ Iterator it = imageTypes;
+
+ while (it.hasNext())
+ {
+ Object o = it.next ();
+ if (! (o instanceof ImageTypeSpecifier))
+ throw new IllegalArgumentException ("non-ImageTypeSpecifier object");
+
+ ImageTypeSpecifier t = (ImageTypeSpecifier) o;
+ if (t.equals (type))
+ {
+ dest = t.createBufferedImage (width, height);
+ break;
+ }
+ if (destType == null)
+ throw new IIOException ("invalid destination type");
+
+ }
+ }
+ }
+ }
+ if (dest == null)
+ {
+ Rectangle srcRegion = new Rectangle ();
+ Rectangle destRegion = new Rectangle ();
+
+ computeRegions (param, width, height, null, srcRegion, destRegion);
+
+ if (destRegion.isEmpty())
+ throw new IllegalArgumentException ("destination region empty");
+
+ if (destType == null)
+ {
+ Object o = imageTypes.next();
+ if (! (o instanceof ImageTypeSpecifier))
+ throw new IllegalArgumentException ("non-ImageTypeSpecifier"
+ + " object");
+
+ dest = ((ImageTypeSpecifier) o).createBufferedImage
+ (destRegion.width, destRegion.height);
+ }
+ else
+ dest = destType.createBufferedImage
+ (destRegion.width, destRegion.height);
+ }
+ return dest;
+ }
+
+ /**
+ * Get the metadata associated with this image. If the reader is
+ * set to ignore metadata or does not support reading metadata, or
+ * if no metadata is available then null is returned.
+ *
+ * This more specific version of getImageMetadata(int) can be used
+ * to restrict metadata retrieval to specific formats and node
+ * names, which can limit the amount of data that needs to be
+ * processed.
+ *
+ * @param imageIndex the frame index
+ * @param formatName the format of metadata requested
+ * @param nodeNames a set of Strings specifiying node names to be
+ * retrieved
+ *
+ * @return a metadata object, or null
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if formatName is null
+ * @exception IllegalArgumentException if nodeNames is null
+ * @exception IOException if a read error occurs
+ */
+ public IIOMetadata getImageMetadata (int imageIndex,
+ String formatName,
+ Set nodeNames)
+ throws IOException
+ {
+ if (formatName == null || nodeNames == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getImageMetadata (imageIndex);
+ }
+
+ /**
+ * Get the index at which the next image will be read. If
+ * seekForwardOnly is true then the returned value will increase
+ * monotonically each time an image frame is read. If
+ * seekForwardOnly is false then the returned value will always be
+ * 0.
+ *
+ * @return the current frame index
+ */
+ public int getMinIndex()
+ {
+ return minIndex;
+ }
+
+ /**
+ * Get the image type specifier that most closely represents the
+ * internal data representation used by this reader. This value
+ * should be included in the return value of getImageTypes.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return an image type specifier
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public ImageTypeSpecifier getRawImageType (int imageIndex)
+ throws IOException
+ {
+ return (ImageTypeSpecifier) getImageTypes(imageIndex).next();
+ }
+
+ /**
+ * Calculate a source region based on the given source image
+ * dimensions and parameters. Subsampling offsets and a source
+ * region are taken from the given image read parameters and used to
+ * clip the given image dimensions, returning a new rectangular
+ * region as a result.
+ *
+ * @param param image parameters, or null
+ * @param srcWidth the width of the source image
+ * @param srcHeight the height of the source image
+ *
+ * @return a clipped rectangle
+ */
+ protected static Rectangle getSourceRegion (ImageReadParam param,
+ int srcWidth,
+ int srcHeight)
+ {
+ Rectangle clippedRegion = new Rectangle (0, 0, srcWidth, srcHeight);
+
+ if (param != null)
+ {
+ Rectangle srcRegion = param.getSourceRegion();
+
+ if (srcRegion != null)
+ {
+ clippedRegion.x = srcRegion.x > clippedRegion.x
+ ? srcRegion.x : clippedRegion.x;
+ clippedRegion.y = srcRegion.y > clippedRegion.y
+ ? srcRegion.y : clippedRegion.y;
+ clippedRegion.width = srcRegion.width > clippedRegion.width
+ ? srcRegion.width : clippedRegion.width;
+ clippedRegion.height = srcRegion.height > clippedRegion.height
+ ? srcRegion.height : clippedRegion.height;
+ }
+
+ int xOffset = param.getSubsamplingXOffset();
+
+ clippedRegion.x += xOffset;
+ clippedRegion.width -= xOffset;
+
+ int yOffset = param.getSubsamplingYOffset();
+
+ clippedRegion.y += yOffset;
+ clippedRegion.height -= yOffset;
+ }
+ return clippedRegion;
+ }
+
+ /**
+ * Get the metadata associated with the image being read. If the
+ * reader is set to ignore metadata or does not support reading
+ * metadata, or if no metadata is available then null is returned.
+ * This method returns metadata associated with the entirety of the
+ * image data, whereas getStreamMetadata() returns metadata
+ * associated with a frame within a multi-image data stream.
+ *
+ * This more specific version of getStreamMetadata() can be used to
+ * restrict metadata retrieval to specific formats and node names,
+ * which can limit the amount of data that needs to be processed.
+ *
+ * @param formatName the format of metadata requested
+ * @param nodeNames a set of Strings specifiying node names to be
+ * retrieved
+ *
+ * @return metadata associated with the image being read, or null
+ *
+ * @exception IllegalArgumentException if formatName is null
+ * @exception IllegalArgumentException if nodeNames is null
+ * @exception IOException if a read error occurs
+ */
+ public IIOMetadata getStreamMetadata (String formatName,
+ Set nodeNames)
+ throws IOException
+ {
+ if (formatName == null || nodeNames == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getStreamMetadata();
+ }
+
+ /**
+ * Read the given frame all at once, using default image read
+ * parameters, and return a buffered image.
+ *
+ * The returned image will be formatted according to the
+ * currently-preferred image type specifier.
+ *
+ * Installed read progress listeners, update progress listeners and
+ * warning listeners will be notified of read progress, changes in
+ * sample sets and warnings respectively.
+ *
+ * @param the index of the image frame to read
+ *
+ * @return a buffered image
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public BufferedImage read (int imageIndex)
+ throws IOException
+ {
+ return read (imageIndex, null);
+ }
+
+ /**
+ * Read the given frame all at once, using the given image read
+ * parameters, and return an IIOImage. The IIOImage will contain a
+ * buffered image as returned by getDestination.
+ *
+ * Installed read progress listeners, update progress listeners and
+ * warning listeners will be notified of read progress, changes in
+ * sample sets and warnings respectively.
+ *
+ * The source and destination band settings are checked with a call
+ * to checkReadParamBandSettings.
+ *
+ * @param the index of the image frame to read
+ * @param the image read parameters
+ *
+ * @return an IIOImage
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if param.getSourceBands() and
+ * param.getDestinationBands() are incompatible
+ * @exception IllegalArgumentException if either the source or
+ * destination image regions are empty
+ * @exception IOException if a read error occurs
+ */
+ public IIOImage readAll (int imageIndex,
+ ImageReadParam param)
+ throws IOException
+ {
+ checkReadParamBandSettings (param,
+ param.getSourceBands().length,
+ param.getDestinationBands().length);
+
+ List l = new ArrayList ();
+
+ for (int i = 0; i < getNumThumbnails (imageIndex); i++)
+ l.add (readThumbnail(imageIndex, i));
+
+ return new IIOImage (getDestination(param, getImageTypes(imageIndex),
+ getWidth(imageIndex),
+ getHeight(imageIndex)),
+ l,
+ getImageMetadata (imageIndex));
+ }
+
+ /**
+ * Read all image frames all at once, using the given image read
+ * parameters iterator, and return an iterator over a collection of
+ * IIOImages. Each IIOImage in the collection will contain a
+ * buffered image as returned by getDestination.
+ *
+ * Installed read progress listeners, update progress listeners and
+ * warning listeners will be notified of read progress, changes in
+ * sample sets and warnings respectively.
+ *
+ * Each set of source and destination band settings are checked with
+ * a call to checkReadParamBandSettings.
+ *
+ * @param an iterator over the image read parameters
+ *
+ * @return an IIOImage
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IllegalArgumentException if a non-ImageReadParam is
+ * found in params
+ * @exception IllegalArgumentException if param.getSourceBands() and
+ * param.getDestinationBands() are incompatible
+ * @exception IllegalArgumentException if either the source or
+ * destination image regions are empty
+ * @exception IOException if a read error occurs
+ */
+ public Iterator readAll (Iterator params)
+ throws IOException
+ {
+ List l = new ArrayList ();
+ int index = 0;
+
+ while (params.hasNext())
+ {
+ if (params != null && ! (params instanceof ImageReadParam))
+ throw new IllegalArgumentException ("non-ImageReadParam found");
+
+ l.add (readAll(index++, (ImageReadParam) params.next ()));
+ }
+
+ return l.iterator();
+ }
+
+ /**
+ * Read a rendered image. This is a more general counterpart to
+ * read (int, ImageReadParam). All image data may not be read
+ * before this method returns and so listeners will not necessarily
+ * be notified.
+ *
+ * @param the index of the image frame to read
+ * @param the image read parameters
+ *
+ * @return a rendered image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if param.getSourceBands() and
+ * param.getDestinationBands() are incompatible
+ * @exception IllegalArgumentException if either the source or
+ * destination image regions are empty
+ * @exception IOException if a read error occurs
+ */
+ public RenderedImage readAsRenderedImage (int imageIndex,
+ ImageReadParam param)
+ throws IOException
+ {
+ return read (imageIndex, param);
+ }
+
+ /**
+ * Read the given tile into a buffered image. If the tile
+ * coordinates are out-of-bounds an exception is thrown. If the
+ * image is not tiled then the coordinates 0, 0 are expected and the
+ * entire image will be read.
+ *
+ * @param imageIndex the frame index
+ * @param tileX the horizontal tile coordinate
+ * @param tileY the vertical tile coordinate
+ *
+ * @return the contents of the tile as a buffered image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if the tile coordinates are
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public BufferedImage readTile (int imageIndex, int tileX, int tileY)
+ throws IOException
+ {
+ if (tileX != 0 || tileY != 0)
+ throw new IllegalArgumentException ("tileX not 0 or tileY not 0");
+
+ return read (imageIndex);
+ }
+
+ /**
+ * Read the given tile into a raster containing the raw image data.
+ * If the tile coordinates are out-of-bounds an exception is thrown.
+ * If the image is not tiled then the coordinates 0, 0 are expected
+ * and the entire image will be read.
+ *
+ * @param imageIndex the frame index
+ * @param tileX the horizontal tile coordinate
+ * @param tileY the vertical tile coordinate
+ *
+ * @return the contents of the tile as a raster
+ *
+ * @exception UnsupportedOperationException if rasters are not
+ * supported
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if the tile coordinates are
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public Raster readTileRaster (int imageIndex, int tileX, int tileY)
+ throws IOException
+ {
+ if (!canReadRaster())
+ throw new UnsupportedOperationException ("cannot read rasters");
+
+ if (tileX != 0 || tileY != 0)
+ throw new IllegalArgumentException ("tileX not 0 or tileY not 0");
+
+ return readRaster (imageIndex, null);
+ }
+
+ /**
+ * Reset this reader's internal state.
+ */
+ public void reset ()
+ {
+ setInput (null, false);
+ setLocale (null);
+ removeAllIIOReadUpdateListeners ();
+ removeAllIIOReadWarningListeners ();
+ removeAllIIOReadProgressListeners ();
+ clearAbortRequest ();
+ }
}
+
diff --git a/libjava/classpath/javax/imageio/ImageTranscoder.java b/libjava/classpath/javax/imageio/ImageTranscoder.java
index ccc99316269..1f9195f5816 100644
--- a/libjava/classpath/javax/imageio/ImageTranscoder.java
+++ b/libjava/classpath/javax/imageio/ImageTranscoder.java
@@ -41,14 +41,62 @@ package javax.imageio;
import javax.imageio.metadata.IIOMetadata;
/**
+ * An ImageTranscoder translates IIOMetadata objects provided by an
+ * ImageReader into corresponding IIOMetadata objects that can be
+ * understood by a given ImageWriter.
+ *
+ * Usually an ImageWriter will implement ImageTranscoder directly in
+ * which case the conversion methods will return IIOMetadata objects
+ * appropriate for this ImageWriter.
+ *
+ * Independent transcoders are also allowed; they must have knowledge
+ * of both the source IIOMetadata provided by the reader and the
+ * returned IIOMetadata expected by the writer.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface ImageTranscoder
{
+ /**
+ * Converts IIOMetadata from an input reader format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * The ImageTypeSpecifier specifies the destination image type.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an image reader
+ * @param imageType the output image type of the writer
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if either inData or imageType
+ * is null
+ */
IIOMetadata convertImageMetadata(IIOMetadata inData,
ImageTypeSpecifier imageType,
ImageWriteParam param);
+ /**
+ * Converts IIOMetadata from an input stream format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an input image stream
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if inData is null
+ */
IIOMetadata convertStreamMetadata(IIOMetadata inData,
ImageWriteParam param);
}
diff --git a/libjava/classpath/javax/imageio/ImageTypeSpecifier.java b/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
index 0751e376757..05b3a26d493 100644
--- a/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
+++ b/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
@@ -38,15 +38,47 @@ exception statement from your version. */
package javax.imageio;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.DataBuffer;
+import java.awt.image.BandedSampleModel;
+import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.IndexColorModel;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
+/**
+ * ImageTypeSpecifier store the color and sample models associated
+ * with an IIOImage.
+ */
public class ImageTypeSpecifier
{
+ /**
+ * The image's color model.
+ */
protected ColorModel colorModel;
+
+ /**
+ * The image's sample model.
+ */
protected SampleModel sampleModel;
+ /**
+ * Construct an image type specifier with the given models.
+ *
+ * @param colorModel the color model
+ * @param sampleModel the sample model
+ *
+ * @exception IllegalArgumentException if either model argument is
+ * null
+ * @exception IllegalArgumentException if the models are
+ * incompatible with one another
+ */
public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel)
{
if (colorModel == null)
@@ -63,6 +95,14 @@ public class ImageTypeSpecifier
this.sampleModel = sampleModel;
}
+ /**
+ * Construct an image type specifier that describes the given
+ * rendered image.
+ *
+ * @param image a rendered image
+ *
+ * @exception IllegalArgumentException if image is null
+ */
public ImageTypeSpecifier(RenderedImage image)
{
if (image == null)
@@ -72,21 +112,448 @@ public class ImageTypeSpecifier
this.sampleModel = image.getSampleModel();
}
+ /**
+ * Create an image type specifier for a banded image using a
+ * component color model and a banded sample model.
+ *
+ * @param colorSpace the color space
+ * @param bankIndices the bank indices at which each band will be
+ * stored
+ * @param bandOffsets the starting band offset for each band within
+ * its bank
+ * @param dataType the data type, a DataBuffer constant
+ * @param hasAlpha true if this image type specifier should have an
+ * alpha component, false otherwise
+ * @param isAlphaPremultiplied true if other color components should
+ * be premultiplied by the alpha component, false otherwise
+ *
+ * @return a banded image type specifier
+ *
+ * @exception IllegalArgumentException if any of colorSpace,
+ * bankIndices or bankOffsets is null
+ * @exception IllegalArgumentException if bankIndices and
+ * bankOffsets differ in length
+ * @excpetion IllegalArgumentException if the number of color space
+ * components, including the alpha component if requested, is
+ * different from bandOffsets.length
+ * @exception if dataType is not a valid DataBuffer constant
+ */
+ public static ImageTypeSpecifier createBanded (ColorSpace colorSpace,
+ int[] bankIndices,
+ int[] bankOffsets,
+ int dataType,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied)
+ {
+ if (colorSpace == null || bankIndices == null || bankOffsets == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (bankIndices.length != bankOffsets.length)
+ throw new IllegalArgumentException ("array lengths differ");
+
+ if (bankOffsets.length != (colorSpace.getNumComponents() + (hasAlpha ? 1 : 0)))
+ throw new IllegalArgumentException ("invalid bankOffsets length");
+
+ return new ImageTypeSpecifier (new ComponentColorModel (colorSpace,
+ hasAlpha,
+ isAlphaPremultiplied,
+ hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE,
+ dataType),
+ new BandedSampleModel (dataType, 1, 1, 1,
+ bankIndices,
+ bankOffsets));
+ }
+
+ /**
+ * Create a buffered image with the given dimensions using that has
+ * the characteristics specified by this image type specifier.
+ *
+ * @param the width of the buffered image, in pixels
+ * @param the height of the buffered image, in pixels
+ *
+ * @return a buffered image
+ *
+ * @exception IllegalArgumentException if either width or height is
+ * less than or equal to zero
+ * @exception IllegalArgumentException if width * height is greater
+ * than Integer.MAX_VALUE or if the storage required is greater than
+ * Integer.MAX_VALUE
+ */
+ public BufferedImage createBufferedImage (int width, int height)
+ {
+ if (width <= 0 || height <= 0)
+ throw new IllegalArgumentException ("dimension <= 0");
+
+ // test for overflow
+ if (width * height < Math.min (width, height))
+ throw new IllegalArgumentException ("width * height > Integer.MAX_VALUE");
+
+ if (width * height * sampleModel.getNumBands() < Math.min (width, height))
+ throw new IllegalArgumentException ("storage required >"
+ + " Integer.MAX_VALUE");
+
+ // FIXME: this is probably wrong:
+ return new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB);
+ }
+
+ /**
+ * Create an image type specifier that describes the given buffered
+ * image type.
+ *
+ * @param bufferedImageType the buffered image type to represent
+ * with the returned image type specifier
+ *
+ * @return a new image type specifier
+ *
+ * @exception IllegalArgumentException if bufferedImageType is not a
+ * BufferedImage constant or is BufferedImage.TYPE_CUSTOM
+ */
+ public static ImageTypeSpecifier createFromBufferedImageType (int bufferedImageType)
+ {
+ if (bufferedImageType <= BufferedImage.TYPE_CUSTOM
+ || bufferedImageType > BufferedImage.TYPE_BYTE_INDEXED)
+ throw new IllegalArgumentException ("invalid buffered image type");
+
+ return new ImageTypeSpecifier (new BufferedImage (1, 1, bufferedImageType));
+ }
+
+ /**
+ * Create an image type specifier that describes the given rendered
+ * image's type.
+ *
+ * @param image the rendered image
+ *
+ * @return a new image type specifier
+ *
+ * @exception IllegalArgumentException if image is null
+ */
+ public static ImageTypeSpecifier createFromRenderedImage (RenderedImage image)
+ {
+ if (image == null)
+ throw new IllegalArgumentException ("image null");
+
+ return new ImageTypeSpecifier (image);
+ }
+
+ /**
+ * Create a grayscale image type specifier, given the number of
+ * bits, data type and whether or not the data is signed.
+ *
+ * @param bits the number of bits used to specify a greyscale value
+ * @param dataType a DataBuffer type constant
+ * @param isSigned true if this type specifier should support
+ * negative values, false otherwise
+ *
+ * @return a greyscal image type specifier
+ *
+ * @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or 16
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_USHORT
+ * @exception if bits is larger than the number of bits in the given
+ * data type
+ */
+ public static ImageTypeSpecifier createGrayscale (int bits, int dataType, boolean isSigned)
+ {
+ return createGrayscale (bits, dataType, isSigned, false);
+ }
+
+ /**
+ * Create a grayscale image type specifier, given the number of
+ * bits, data type and whether or not the data is signed.
+ *
+ * @param bits the number of bits used to specify a greyscale value
+ * @param dataType a DataBuffer type constant
+ * @param isSigned true if this type specifier should support
+ * negative values, false otherwise
+ *
+ * @return a greyscal image type specifier
+ *
+ * @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or
+ * 16
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_USHORT
+ * @exception if bits is larger than the number of bits in the given
+ * data type
+ */
+ public static ImageTypeSpecifier createGrayscale (int bits, int dataType,
+ boolean isSigned,
+ boolean isAlphaPremultiplied)
+ {
+ if (bits != 1 && bits != 2 && bits != 4 && bits != 8 && bits != 16)
+ throw new IllegalArgumentException ("invalid bit size");
+
+ if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_SHORT
+ && dataType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException ("invalid data type");
+
+ if (dataType == DataBuffer.TYPE_BYTE && bits > 8)
+ throw new IllegalArgumentException ("number of bits too large for data type");
+
+ // FIXME: this is probably wrong:
+ return new ImageTypeSpecifier (new DirectColorModel (bits, 0xff, 0x0,
+ 0x0, 0xff),
+ new MultiPixelPackedSampleModel (dataType,
+ 1, 1,
+ bits));
+ }
+
+ /**
+ * Return an image type specifier for an image that uses an indexed
+ * colour model where each colour value has the specified number of
+ * bits and type and where the colour tables are those given.
+ *
+ * @param redLUT the red index values
+ * @param greenLUT the green index values
+ * @param blueLUT the blue index values
+ * @param alphaLUT the alpha index values
+ * @param bits the number of bits per index value
+ * @param dataType the type of each index value
+ *
+ * @return an indexed image type specifier
+ *
+ * @exception IllegalArgumentException if any of the colour arrays,
+ * not including alphaLUT, is null
+ * @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or
+ * 16
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_USHORT
+ * @exception if bits is larger than the number of bits in the given
+ * data type
+ */
+ public static ImageTypeSpecifier createIndexed (byte[] redLUT,
+ byte[] greenLUT,
+ byte[] blueLUT,
+ byte[] alphaLUT,
+ int bits,
+ int dataType)
+ {
+ if (redLUT == null || greenLUT == null || blueLUT == null)
+ throw new IllegalArgumentException ("null colour table");
+
+ if (bits != 1 && bits != 2 && bits != 4 && bits != 8 && bits != 16)
+ throw new IllegalArgumentException ("invalid bit size");
+
+ if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_SHORT
+ && dataType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException ("invalid data type");
+
+ if (dataType == DataBuffer.TYPE_BYTE && bits > 8)
+ throw new IllegalArgumentException ("number of bits too large for data type");
+
+ // FIXME: this is probably wrong:
+ return new ImageTypeSpecifier (new IndexColorModel (bits, redLUT.length,
+ redLUT, greenLUT, blueLUT,
+ alphaLUT),
+ new MultiPixelPackedSampleModel (dataType,
+ 1, 1,
+ bits));
+ }
+
+ /**
+ * Create an image type specifier that uses a component colour model
+ * and a pixel interleaved sample model. Each pixel component will
+ * be stored in a separate value of the given data type.
+ *
+ * @param colorSpace the colour space used by the colour model
+ * @param bandOffsets the starting band offset for each band within
+ * its bank
+ * @param dataType the type of each pixel value
+ * @param hasAlpha true if an alpha channel should be specified,
+ * false otherwise
+ * @param isAlphaPremultiplied true if other colour channels should
+ * be premultiplied by the alpha value, false otherwise
+ *
+ * @return an interleaved image type specifier
+ *
+ * @exception IllegalArgumentException if either colorSpace or
+ * bandOffsets is null
+ * @excpetion IllegalArgumentException if the number of color space
+ * components, including the alpha component if requested, is
+ * different from bandOffsets.length
+ * @exception if dataType is not a valid DataBuffer constant
+ */
+ public static ImageTypeSpecifier createInterleaved (ColorSpace colorSpace,
+ int[] bandOffsets,
+ int dataType,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied)
+ {
+ if (colorSpace == null || bandOffsets == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (bandOffsets.length != (colorSpace.getNumComponents() + (hasAlpha ? 1 : 0)))
+ throw new IllegalArgumentException ("invalid bankOffsets length");
+
+ return new ImageTypeSpecifier (new ComponentColorModel (colorSpace,
+ hasAlpha,
+ isAlphaPremultiplied,
+ hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE,
+ dataType),
+ new PixelInterleavedSampleModel (dataType, 1, 1, 1, 1,
+ bandOffsets));
+ }
+
+ /**
+ * Create an image type specifier using a direct color model and a
+ * packed sample model. All pixel components will be packed into
+ * one value of the given data type.
+ *
+ * @param colorSpace the color space to use in the color model
+ * @param redMask the bitmask for the red bits
+ * @param greenMask the bitmask for the green bits
+ * @param blueMask the bitmask for the blue bits
+ * @param alphaMask the bitmask for the alpha bits
+ * @param transferType the data type used to store pixel values
+ * @param isAlphaPremultiplied true if other colour channels should
+ * be premultiplied by the alpha value, false otherwise
+ *
+ * @return a packed image type specifier
+ *
+ * @exception IllegalArgumentException if colorSpace is null
+ * @exception IllegalArgumentException if colorSpace does not have
+ * type ColorSpace.TYPE_RGB
+ * @exception IllegalArgumentException if all masks are 0
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_INT
+ */
+ public static ImageTypeSpecifier createPacked (ColorSpace colorSpace,
+ int redMask,
+ int greenMask,
+ int blueMask,
+ int alphaMask,
+ int transferType,
+ boolean isAlphaPremultiplied)
+ {
+ if (colorSpace == null)
+ throw new IllegalArgumentException ("null color space");
+
+ if (colorSpace.getType() != ColorSpace.TYPE_RGB)
+ throw new IllegalArgumentException ("invalid color space type");
+
+ if (redMask == 0 && greenMask == 0 && blueMask == 0 && alphaMask == 0)
+ throw new IllegalArgumentException ("no non-zero mask");
+
+ if (transferType != DataBuffer.TYPE_BYTE && transferType != DataBuffer.TYPE_USHORT
+ && transferType != DataBuffer.TYPE_INT)
+ throw new IllegalArgumentException ("invalid data type");
+
+ // Assume DataBuffer.TYPE_BYTE.
+ int numBits = 8;
+
+ if (transferType == DataBuffer.TYPE_SHORT)
+ numBits = 16;
+ else if (transferType == DataBuffer.TYPE_INT)
+ numBits = 32;
+
+ return new ImageTypeSpecifier (new DirectColorModel (colorSpace,
+ numBits,
+ redMask,
+ greenMask,
+ blueMask,
+ alphaMask,
+ isAlphaPremultiplied,
+ transferType),
+ new MultiPixelPackedSampleModel (transferType,
+ 1, 1, numBits));
+ }
+
+ /**
+ * Get the number of bits per sample in the given band.
+ *
+ * @param band the band from which to get the number of bits
+ *
+ * @return the number of bits in the given band
+ *
+ * @exception IllegalArgumentException if band is out-of-bounds
+ */
+ public int getBitsPerBand (int band)
+ {
+ if (band < 0 || band > sampleModel.getNumBands())
+ throw new IllegalArgumentException ("band out-of-bounds");
+
+ return sampleModel.getSampleSize (band);
+ }
+
+ /**
+ * Get the buffered image constant specified by this image type
+ * specifier.
+ *
+ * @return a buffered image constant
+ */
+ public int getBufferedImageType ()
+ {
+ // FIXME:
+ return BufferedImage.TYPE_INT_RGB;
+ }
+
+ /**
+ * Create a sample model that is compatible with the one specified
+ * by this image type specifier, with the given dimensions.
+ *
+ * @param width the width of the returned sample model
+ * @param height the height of the returned sample model
+ *
+ * @return a sample model compatible with the one in this image type
+ * specifier, with the given dimensions
+ *
+ * @exception IllegalArgumentException if either width or height is
+ * less than or equal to 0
+ * @exception IllegalArgumentException if width * height is greater
+ * than Intere.MAX_VALUE
+ */
+ public SampleModel getSampleModel (int width, int height)
+ {
+ if (width <= 0 || height <= 0)
+ throw new IllegalArgumentException ("invalid dimension");
+
+ // test for overflow
+ if (width * height < Math.min (width, height))
+ throw new IllegalArgumentException ("width * height > Integer.MAX_VALUE");
+
+ return sampleModel.createCompatibleSampleModel (width, height);
+ }
+
+ /**
+ * Get the color model specified by this image type specifier.
+ *
+ * @return the color model
+ */
public ColorModel getColorModel()
{
return colorModel;
}
+ /**
+ * Get the number of bands specified by this image type specifier's
+ * sample model.
+ *
+ * @return the number of bands in the sample model
+ */
public int getNumBands()
{
return sampleModel.getNumBands();
}
+ /**
+ * Get the number of components specified by this image type
+ * specifier's color model.
+ *
+ * @return the number of color components per pixel
+ */
public int getNumComponents()
{
return colorModel.getNumComponents();
}
+ /**
+ * Get the sample model specified by this image type specifier.
+ *
+ * @return the sample model
+ */
public SampleModel getSampleModel()
{
return sampleModel;
diff --git a/libjava/classpath/javax/imageio/ImageWriteParam.java b/libjava/classpath/javax/imageio/ImageWriteParam.java
index 08f4885a8d1..84b257e04eb 100644
--- a/libjava/classpath/javax/imageio/ImageWriteParam.java
+++ b/libjava/classpath/javax/imageio/ImageWriteParam.java
@@ -41,6 +41,9 @@ package javax.imageio;
import java.awt.Dimension;
import java.util.Locale;
+/**
+ * DOCUMENT ME
+ */
public class ImageWriteParam extends IIOParam
{
public static final int MODE_DISABLED = 0;
diff --git a/libjava/classpath/javax/imageio/ImageWriter.java b/libjava/classpath/javax/imageio/ImageWriter.java
index 7479c3074f7..ef352154164 100644
--- a/libjava/classpath/javax/imageio/ImageWriter.java
+++ b/libjava/classpath/javax/imageio/ImageWriter.java
@@ -1,5 +1,5 @@
/* ImageWriter.java -- Encodes raster images.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,11 +39,16 @@ exception statement from your version. */
package javax.imageio;
import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
import javax.imageio.event.IIOWriteProgressListener;
import javax.imageio.event.IIOWriteWarningListener;
@@ -51,56 +56,161 @@ import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageWriterSpi;
+/**
+ * A class for encoding images within the ImageIO framework.
+ *
+ * An ImageWriter for a given format is instantiated by an
+ * ImageWriterSpi for that format. ImageWriterSpis are registered
+ * with the IIORegistry.
+ *
+ * The ImageWriter API supports writing animated images that may have
+ * multiple frames; to support such images many methods take an index
+ * parameter.
+ *
+ * Images may also be written in multiple passes, where each
+ * successive pass increases the level of detail in the destination
+ * image.
+ */
public abstract class ImageWriter
implements ImageTranscoder
{
private boolean aborted;
- protected Locale[] availableLocales;
- protected Locale locale;
- protected ImageWriterSpi originatingProvider;
- protected Object output;
- protected List progressListeners = new ArrayList();
- protected List warningListeners = new ArrayList();
- protected List warningLocales = new ArrayList();
+ /**
+ * All locales available for localization of warning messages, or
+ * null if localization is not supported.
+ */
+ protected Locale[] availableLocales = null;
+ /**
+ * The current locale used to localize warning messages, or null if
+ * no locale has been set.
+ */
+ protected Locale locale = null;
+
+ /**
+ * The image writer SPI that instantiated this writer.
+ */
+ protected ImageWriterSpi originatingProvider = null;
+
+ /**
+ * An ImageInputStream to which image data is written.
+ */
+ protected Object output = null;
+
+ /**
+ * A list of installed progress listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List progressListeners = null;
+
+ /**
+ * A list of installed warning listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List warningListeners = null;
+
+ /**
+ * A list of warning locales corresponding with the list of
+ * installed warning listeners. Initially null, meaning no locales.
+ */
+ protected List warningLocales = null;
+
+ /**
+ * Construct an image writer.
+ *
+ * @param originatingProvider the provider that is constructing this
+ * image writer, or null
+ */
protected ImageWriter(ImageWriterSpi originatingProvider)
{
this.originatingProvider = originatingProvider;
}
+ /**
+ * Throw an IllegalStateException if output is null.
+ *
+ * @exception IllegalStateException if output is null
+ */
private void checkOutputSet()
{
if (output == null)
throw new IllegalStateException("no output set");
}
+ /**
+ * Request that writing be aborted. The unwritten portions of the
+ * destination image will be undefined.
+ *
+ * Writers should clear the abort flag before starting a write
+ * operation, then poll it periodically during the write operation.
+ */
public void abort()
{
aborted = true;
}
+ /**
+ * Check if the abort flag is set.
+ *
+ * @return true if the current write operation should be aborted,
+ * false otherwise
+ */
protected boolean abortRequested()
{
return aborted;
}
+ /**
+ * Install a write progress listener. This method will return
+ * immediately if listener is null.
+ *
+ * @param listener a write progress listener or null
+ */
public void addIIOWriteProgressListener(IIOWriteProgressListener listener)
{
if (listener == null)
return;
-
+ if (progressListeners == null)
+ progressListeners = new ArrayList ();
progressListeners.add(listener);
}
-
+
+ /**
+ * Install a write warning listener. This method will return
+ * immediately if listener is null. Warning messages sent to this
+ * listener will be localized using the current locale. If the
+ * current locale is null then this writer will select a sensible
+ * default.
+ *
+ * @param listener a write warning listener
+ */
public void addIIOWriteWarningListener (IIOWriteWarningListener listener)
{
if (listener == null)
return;
-
+ if (warningListeners == null)
+ warningListeners = new ArrayList ();
warningListeners.add(listener);
}
+ /**
+ * Check whether a new empty image can be inserted at the given
+ * frame index. Pixel values may be filled in later using the
+ * replacePixels methods. Indices greater than the insertion index
+ * will be incremented. If imageIndex is -1, the image will be
+ * appended at the end of the current image list.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if an empty image can be inserted at imageIndex,
+ * false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canInsertEmpty(int imageIndex)
throws IOException
{
@@ -108,6 +218,22 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether an image can be inserted at the given frame index.
+ * Indices greater than the insertion index will be incremented. If
+ * imageIndex is -1, the image will be appended at the end of the
+ * current image list.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if an image can be inserted at imageIndex, false
+ * otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canInsertImage(int imageIndex)
throws IOException
{
@@ -115,6 +241,20 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether an image can be removed from the given frame index.
+ * Indices greater than the removal index will be decremented.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if an image can be removed from imageIndex, false
+ * otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canRemoveImage(int imageIndex)
throws IOException
{
@@ -122,6 +262,20 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether the metadata associated the image at the given
+ * frame index can be replaced.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if the metadata associated with the image at
+ * imageIndex can be replaced, false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canReplaceImageMetadata(int imageIndex)
throws IOException
{
@@ -129,6 +283,20 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether the pixels within the image at the given index can
+ * be replaced.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if the pixels in the image at imageIndex can be
+ * replaced, false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canReplacePixels(int imageIndex)
throws IOException
{
@@ -136,6 +304,16 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether the metadata associated the entire image stream can
+ * be replaced.
+ *
+ * @return true if the stream metadata can be replaced, false
+ * otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IOException if a write error occurs
+ */
public boolean canReplaceStreamMetadata()
throws IOException
{
@@ -143,6 +321,18 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether an entire empty image, including empty metadata and
+ * empty thumbnails, can be written to the output stream, leaving
+ * pixel values to be filled in later using the replacePixels
+ * methods.
+ *
+ * @return true if an entire empty image can be written before its
+ * contents are filled in, false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IOException if a write error occurs
+ */
public boolean canWriteEmpty()
throws IOException
{
@@ -150,68 +340,217 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check if IIOImages containing raster data are supported.
+ *
+ * @return true if raster IIOImages are supported, false otherwise
+ */
public boolean canWriteRasters()
{
return false;
}
+ /**
+ * Check if an image can be appended at the end of the current list
+ * of images even if prior images have already been written.
+ *
+ * @return true if sequences of images can be written, false
+ * otherwise
+ */
public boolean canWriteSequence()
{
return false;
}
+ /**
+ * Clear the abort flag.
+ */
protected void clearAbortRequest()
{
aborted = false;
}
-
+
+ /**
+ * Convert IIOMetadata from an input reader format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * The ImageTypeSpecifier specifies the destination image type.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an image reader
+ * @param imageType the output image type of the writer
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if either inData or imageType
+ * is null
+ */
public abstract IIOMetadata convertImageMetadata (IIOMetadata inData,
ImageTypeSpecifier imageType,
ImageWriteParam param);
+ /**
+ * Convert IIOMetadata from an input stream format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an input image stream
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if inData is null
+ */
public abstract IIOMetadata convertStreamMetadata (IIOMetadata inData,
ImageWriteParam param);
+ /**
+ * Releases any resources allocated to this object. Subsequent
+ * calls to methods on this object will produce undefined results.
+ *
+ * The default implementation does nothing; subclasses should use
+ * this method ensure that native resources are released.
+ */
public void dispose()
{
// The default implementation is empty. Subclasses have to overwrite it.
}
+ /**
+ * Retrieve the available locales. Return null if no locales are
+ * available or a clone of availableLocales.
+ *
+ * @return an array of locales or null
+ */
public Locale[] getAvailableLocales()
{
return availableLocales;
}
+ /**
+ * Get a metadata object appropriate for encoding an image specified
+ * by the given image type specifier and optional image write
+ * parameters.
+ *
+ * @param imageType an image type specifier
+ * @param param image writing parameters, or null
+ *
+ * @return a metadata object appropriate for encoding an image of
+ * the given type with the given parameters
+ */
public abstract IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, ImageWriteParam param);
+ /**
+ * Get a metadata object appropriate for encoding the default image
+ * type handled by this writer, optionally considering image write
+ * parameters.
+ *
+ * @param param image writing parameters, or null
+ *
+ * @return a metadata object appropriate for encoding an image of
+ * the default type with the given parameters
+ */
public abstract IIOMetadata getDefaultStreamMetadata (ImageWriteParam param);
+ /**
+ * Retrieve the default write parameters for this writer's image
+ * format.
+ *
+ * The default implementation returns new ImageWriteParam().
+ *
+ * @return image writing parameters
+ */
public ImageWriteParam getDefaultWriteParam()
{
return new ImageWriteParam(getLocale());
}
+ /**
+ * Get this writer's locale. null is returned if the locale has not
+ * been set.
+ *
+ * @return this writer's locale, or null
+ */
public Locale getLocale()
{
return locale;
}
- public int getNumThumbnailsSupported (ImageTypeSpecifier imageType, ImageWriteParam param,
- IIOMetadata streamMetadata, IIOMetadata imageMetadata)
+ /**
+ * Get the number of thumbnails supported by this image writer,
+ * based on the given image type, image writing parameters, and
+ * stream and image metadata. The image writing parameters are
+ * optional, in case they affect the number of thumbnails supported.
+ *
+ * @param imageType an image type specifier, or null
+ * @param param image writing parameters, or null
+ * @param streamMetadata the metadata associated with this stream,
+ * or null
+ * @param imageMetadata the metadata associated with this image, or
+ * null
+ *
+ * @return the number of thumbnails that this writer supports
+ * writing or -1 if the given information is insufficient
+ */
+ public int getNumThumbnailsSupported (ImageTypeSpecifier imageType,
+ ImageWriteParam param,
+ IIOMetadata streamMetadata,
+ IIOMetadata imageMetadata)
{
return 0;
}
+ /**
+ * Get the ImageWriterSpi that created this writer or null.
+ *
+ * @return an ImageWriterSpi, or null
+ */
public ImageWriterSpi getOriginatingProvider()
{
return originatingProvider;
}
+ /**
+ * Get this reader's image output destination. null is returned if
+ * the image destination has not been set.
+ *
+ * @return an image output destination object, or null
+ */
public Object getOutput()
{
return output;
}
+ /**
+ * Get the preferred sizes for thumbnails based on the given image
+ * type, image writing parameters, and stream and image metadata.
+ * The preferred sizes are returned in pairs of dimension values;
+ * the first value in the array is a dimension object representing
+ * the minimum thumbnail size, the second value is a dimension
+ * object representing a maximum thumbnail size. The writer can
+ * select a size within the range given by each pair, or it can
+ * ignore these size hints.
+ *
+ * @param imageType an image type specifier, or null
+ * @param param image writing parameters, or null
+ * @param streamMetadata the metadata associated with this stream,
+ * or null
+ * @param imageMetadata the metadata associated with this image, or
+ * null
+ *
+ * @return an array of dimension pairs whose length is a multiple of
+ * 2, or null if there is no preferred size (any size is allowed) or
+ * if the size is unknown (insufficient information was provided)
+ */
public Dimension[] getPreferredThumbnailSizes (ImageTypeSpecifier imageType,
ImageWriteParam param,
IIOMetadata streamMetadata,
@@ -220,120 +559,305 @@ public abstract class ImageWriter
return null;
}
+ /**
+ * Notifies all installed write progress listeners that image
+ * loading has completed by calling their imageComplete methods.
+ */
protected void processImageComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.imageComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.imageComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners that a certain
+ * percentage of the image has been loaded, by calling their
+ * imageProgress methods.
+ *
+ * @param percentageDone the percentage of image data that has been
+ * loaded
+ */
protected void processImageProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.imageProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.imageProgress(this, percentageDone);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners, by calling their
+ * imageStarted methods, that image loading has started on the given
+ * image.
+ *
+ * @param imageIndex the frame index of the image that has started
+ * loading
+ */
protected void processImageStarted(int imageIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.imageStarted(this, imageIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.imageStarted(this, imageIndex);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners, by calling their
+ * thumbnailComplete methods, that a thumbnail has completed
+ * loading.
+ */
protected void processThumbnailComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.thumbnailComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.thumbnailComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners that a certain
+ * percentage of a thumbnail has been loaded, by calling their
+ * thumbnailProgress methods.
+ *
+ * @param percentageDone the percentage of thumbnail data that has
+ * been loaded
+ */
protected void processThumbnailProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.thumbnailProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.thumbnailProgress(this, percentageDone);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners, by calling their
+ * imageStarted methods, that thumbnail loading has started on the
+ * given thumbnail of the given image.
+ *
+ * @param imageIndex the frame index of the image one of who's
+ * thumbnails has started loading
+ * @param thumbnailIndex the index of the thumbnail that has started
+ * loading
+ */
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ }
}
}
+ /**
+ * Notifies all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ *
+ * @param imageIndex the index of the image that was being written
+ * when the warning was raised
+ * @param warning the warning message
+ *
+ * @exception IllegalArgumentException if warning is null
+ */
protected void processWarningOccurred(int imageIndex, String warning)
{
- Iterator it = warningListeners.iterator();
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteWarningListener listener =
+ (IIOWriteWarningListener) it.next();
+ listener.warningOccurred(this, imageIndex, warning);
+ }
+ }
+ }
+
+ /**
+ * Notify all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ * The warning message is retrieved from a resource bundle, using
+ * the given basename and keyword.
+ *
+ * @param imageIndex the index of the image that was being written
+ * when the warning was raised
+ * @param baseName the basename of the resource from which to
+ * retrieve the warning message
+ * @param keyword the keyword used to retrieve the warning from the
+ * resource bundle
+ *
+ * @exception IllegalArgumentException if either baseName or keyword
+ * is null
+ * @exception IllegalArgumentException if no resource bundle is
+ * found using baseName
+ * @exception IllegalArgumentException if the given keyword produces
+ * no results from the resource bundle
+ * @exception IllegalArgumentException if the retrieved object is
+ * not a String
+ */
+ protected void processWarningOccurred(int imageIndex,
+ String baseName,
+ String keyword)
+ {
+ if (baseName == null || keyword == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ResourceBundle b = null;
- while (it.hasNext())
+ try
{
- IIOWriteWarningListener listener = (IIOWriteWarningListener) it.next();
- listener.warningOccurred(this, imageIndex, warning);
+ b = ResourceBundle.getBundle(baseName, getLocale());
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no resource bundle found");
+ }
+
+ Object str = null;
+
+ try
+ {
+ str = b.getObject(keyword);
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no results found for keyword");
+ }
+
+ if (! (str instanceof String))
+ throw new IllegalArgumentException ("retrieved object not a String");
+
+ String warning = (String) str;
+
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteWarningListener listener =
+ (IIOWriteWarningListener) it.next();
+ listener.warningOccurred(this, imageIndex, warning);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners that image
+ * loading has been aborted by calling their writeAborted methods.
+ */
protected void processWriteAborted()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.writeAborted(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.writeAborted(this);
+ }
}
}
+ /**
+ * Uninstall all write progress listeners.
+ */
public void removeAllIIOWriteProgressListeners()
{
- progressListeners.clear();
+ if (progressListeners != null)
+ {
+ progressListeners.clear();
+ }
}
+ /**
+ * Uninstall all write warning listeners.
+ */
public void removeAllIIOWriteWarningListeners()
{
- progressListeners.clear();
+ if (progressListeners != null)
+ {
+ progressListeners.clear();
+ }
}
-
- public void removeIIOWriteProgressListener (IIOWriteProgressListener listener)
+
+ /**
+ * Uninstall the given write progress listener.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeIIOWriteProgressListener (IIOWriteProgressListener listener)
{
if (listener == null)
return;
-
- progressListeners.remove(listener);
+ if (progressListeners != null)
+ {
+ progressListeners.remove(listener);
+ }
}
-
+ /**
+ * Uninstall the given write warning listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOWriteWarningListener (IIOWriteWarningListener listener)
{
if (listener == null)
return;
-
- warningListeners.remove(listener);
+ if (warningListeners != null)
+ {
+ warningListeners.remove(listener);
+ }
}
-
+ /**
+ * Reset this writer's internal state.
+ */
public void reset()
{
setOutput(null);
@@ -343,6 +867,11 @@ public abstract class ImageWriter
clearAbortRequest();
}
+ /**
+ * Set the current locale or use the default locale.
+ *
+ * @param locale the locale to set, or null
+ */
public void setLocale(Locale locale)
{
if (locale != null)
@@ -362,6 +891,18 @@ public abstract class ImageWriter
this.locale = locale;
}
+ /**
+ * Set the output destination of the given object. The output
+ * destination must be set before many methods can be called on this
+ * writer. (see all ImageWriter methods that throw
+ * IllegalStateException). If input is null then the current input
+ * source will be removed.
+ *
+ * @param input the output destination object
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this writer and is not an ImageInputStream
+ */
public void setOutput(Object output)
{
if (output != null)
@@ -385,6 +926,464 @@ public abstract class ImageWriter
this.output = output;
}
+ /**
+ * Write an image stream, including thumbnails and metadata to the
+ * output stream. The output must have been set prior to this
+ * method being called. Metadata associated with the stream may be
+ * supplied, or it can be left null. IIOImage may contain raster
+ * data if this writer supports rasters, or it will contain a
+ * rendered image. Thumbnails are resized if need be. Image
+ * writing parameters may be specified to affect writing, or may be
+ * left null.
+ *
+ * @param streamMetadata metadata associated with this stream, or
+ * null
+ * @param image an IIOImage containing image data, metadata and
+ * thumbnails to be written
+ * @param param image writing parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IllegalArgumentException if image is null
+ * @exception IOException if a write error occurs
+ */
public abstract void write (IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param)
throws IOException;
+
+ /**
+ * Complete inserting an empty image in the output stream.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if inserting empty
+ * images is not supported
+ * @exception IllegalArgumentException if a call to
+ * prepareInsertEmpty was not called previous to this method being
+ * called (a sequence of prepareInsertEmpty calls must be terminated
+ * by a call to endInsertEmpty)
+ * @exception IllegalArgumentException if prepareWriteEmpty was
+ * called before this method being called (without a terminating
+ * call to endWriteEmpty)
+ * @exception IllegalArgumentException if prepareReplacePixels was
+ * called before this method being called (without a terminating
+ * call to endReplacePixels)
+ * @exception IOException if a write error occurs
+ */
+ public void endInsertEmpty ()
+ throws IOException
+ {
+ if (!canInsertEmpty(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Complete replacing pixels in an image in the output stream.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported by this writer
+ * @exception IllegalArgumentException if prepareReplacePixels was
+ * not called before this method being called
+ * @exception IOException if a write error occurs
+ */
+ public void endReplacePixels ()
+ throws IOException
+ {
+ if (!canReplacePixels(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Complete writing an empty image to the image output stream.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing empty images
+ * is not supported
+ * @exception IllegalArgumentException if a call to
+ * prepareWriteEmpty was not called previous to this method being
+ * called (a sequence of prepareWriteEmpty calls must be terminated
+ * by a call to endWriteEmpty)
+ * @exception IllegalArgumentException if prepareInsertEmpty was
+ * called before this method being called (without a terminating
+ * call to endInsertEmpty)
+ * @exception IllegalArgumentException if prepareReplacePixels was
+ * called before this method being called (without a terminating
+ * call to endReplacePixels)
+ * @exception IOException if a write error occurs
+ */
+ public void endWriteEmpty ()
+ throws IOException
+ {
+ if (!canWriteEmpty())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Complete writing a sequence of images to the output stream. This
+ * method may patch header data and write out footer data.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IllegalStateException if prepareWriteSequence has not
+ * been called
+ * @exception UnsupportedOperationException if writing a sequence of
+ * images is not supported
+ * @exception IOException if a write error occurs
+ */
+ public void endWriteSequence ()
+ throws IOException
+ {
+ checkOutputSet();
+ if (!canWriteSequence())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start inserting an empty image in the image output stream. All
+ * indices after the specified index are incremented. An index of
+ * -1 implies that the empty image should be appended to the end of
+ * the current image list.
+ *
+ * The insertion that this method call starts is not complete until
+ * endInsertEmpty is called. prepareInsertEmpty cannot be called
+ * again until endInsertEmpty is called and calls to
+ * prepareWriteEmpty and prepareInsertEmpty may not be intersperced.
+ *
+ * @param imageIndex the image index
+ * @param imageType the image type specifier
+ * @param width the image width
+ * @param height the image height
+ * @param imageMetadata the image metadata, or null
+ * @param thumbnails a list of thumbnails, or null
+ * @param param image write parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if inserting empty
+ * images is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IllegalStateException if a previous call to
+ * prepareInsertEmpty was made (without a terminating call to
+ * endInsertEmpty)
+ * @exception IllegalStateException if a previous call to
+ * prepareWriteEmpty was made (without a terminating call to
+ * endWriteEmpty)
+ * @exception IllegalArgumentException if imageType is null or
+ * thumbnails contain non-BufferedImage objects
+ * @exception IllegalArgumentException if either width or height is
+ * less than 1
+ * @exception IOException if a write error occurs
+ */
+ public void prepareInsertEmpty (int imageIndex, ImageTypeSpecifier imageType,
+ int width, int height,
+ IIOMetadata imageMetadata,
+ List thumbnails,
+ ImageWriteParam param)
+ throws IOException
+ {
+ if (!canInsertEmpty(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start the replacement of pixels within an image in the output
+ * stream. Output pixels will be clipped to lie within region.
+ *
+ * @param imageIndex the index of the image in which pixels are
+ * being replaced
+ * @param region the rectangle to which to limit pixel replacement
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IllegalStateException if a previous call to
+ * prepareReplacePixels was made (without a terminating call to
+ * endReplacePixels)
+ * @exception IllegalArgumentException if either region.width or
+ * region.height is less than 1, or if region is null
+ * @exception IOException if a write error occurs
+ */
+ public void prepareReplacePixels (int imageIndex, Rectangle region)
+ throws IOException
+ {
+ if (canReplacePixels(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start writing an empty image to the end of the image output
+ * stream.
+ *
+ * The writing that this method call starts is not complete until
+ * endWriteEmpty is called. prepareWritetEmpty cannot be called
+ * again until endWriteEmpty is called and calls to
+ * prepareWriteEmpty and prepareInsertEmpty may not be intersperced.
+ *
+ * @param streamMetadata metadata associated with the stream, or null
+ * @param imageType the image type specifier
+ * @param width the image width
+ * @param height the image height
+ * @param imageMetadata the image metadata, or null
+ * @param thumbnails a list of thumbnails, or null
+ * @param param image write parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing empty images
+ * is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IllegalStateException if a previous call to
+ * prepareInsertEmpty was made (without a terminating call to
+ * endInsertEmpty)
+ * @exception IllegalStateException if a previous call to
+ * prepareWriteEmpty was made (without a terminating call to
+ * endWriteEmpty)
+ * @exception IllegalArgumentException if imageType is null or
+ * thumbnails contain non-BufferedImage objects
+ * @exception IllegalArgumentException if either width or height is
+ * less than 1
+ * @exception IOException if a write error occurs
+ */
+ public void prepareWriteEmpty (IIOMetadata streamMetadata,
+ ImageTypeSpecifier imageType,
+ int width, int height,
+ IIOMetadata imageMetadata,
+ List thumbnails,
+ ImageWriteParam param)
+ throws IOException
+ {
+ if (!canWriteEmpty())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start the writing of a sequence of images.
+ *
+ * @param streamMetadata the stream metadata, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing sequences of
+ * images is not supported
+ * @exception IOException if a write error occurs
+ */
+ public void prepareWriteSequence (IIOMetadata streamMetadata)
+ throws IOException
+ {
+ checkOutputSet();
+ if (!canWriteSequence())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Remove the image at the specified index from the output stream.
+ *
+ * @param imageIndex the frame index from which to remove the image
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if removing this image
+ * is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
+ public void removeImage (int imageIndex)
+ throws IOException
+ {
+ if (!canRemoveImage(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace the metadata associated with the image at the given
+ * index.
+ *
+ * @param imageIndex the index of the image whose metadata should be
+ * replaced
+ * @param imageMetadata the metadata, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing this
+ * image's metadata is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
+ public void replaceImageMetadata (int imageIndex, IIOMetadata imageMetadata)
+ throws IOException
+ {
+ if (!canReplaceImageMetadata(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace a region of an image in the output stream with a portion
+ * of the given rendered image. The image data must be of the same
+ * type as that in the output stream. The destination region is
+ * given by the image writing parameters and the source region is
+ * the one given to prepareReplacePixels.
+ *
+ * @param image the rendered image with which to overwrite the image
+ * region in the stream
+ * @param param the image writing parameters
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported
+ * @exception IllegalStateException if prepareReplacePixels was not
+ * called before this method was called
+ * @exception IllegalArgumentException if image is null or if param
+ * is null or if the overlap of the source and destination regions
+ * contains no pixels or if the image types differ and no conversion
+ * is possible
+ * @exception IOException if a write error occurs
+ */
+ public void replacePixels (RenderedImage image,
+ ImageWriteParam param)
+ throws IOException
+ {
+ if (!canReplacePixels(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace a region of an image in the output stream with a portion
+ * of the given raster data. The image data must be of the same
+ * type as that in the output stream. The destination region is
+ * given by the image writing parameters and the source region is
+ * the one given to prepareReplacePixels.
+ *
+ * @param raster the raster data with which to overwrite the image
+ * region in the stream
+ * @param param the image writing parameters
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported
+ * @exception IllegalStateException if prepareReplacePixels was not
+ * called before this method was called
+ * @exception UnsupportedOperationException if raster data is not
+ * supported
+ * @exception IllegalArgumentException if raster is null or if param
+ * is null or if the overlap of the source and destination regions
+ * contains no pixels or if the image types differ and no conversion
+ * is possible
+ * @exception IOException if a write error occurs
+ */
+ public void replacePixels (Raster raster, ImageWriteParam param)
+ throws IOException
+ {
+ if (!canReplacePixels(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace the metadata associated with this image stream.
+ *
+ * @param streamMetadata the stream metadata, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing the stream
+ * metadata is not supported
+ * @exception IOException if a write error occurs
+ */
+ public void replaceStreamMetadata (IIOMetadata streamMetadata)
+ throws IOException
+ {
+ if (!canReplaceStreamMetadata())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Write a rendered image to the output stream.
+ *
+ * @param image a rendered image containing image data to be written
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IllegalArgumentException if image is null
+ * @exception IOException if a write error occurs
+ */
+ public void write (RenderedImage image)
+ throws IOException
+ {
+ checkOutputSet();
+ write (null, new IIOImage(image, null, null), null);
+ }
+
+ /**
+ * Write a image data, metadata and thumbnails to the output stream.
+ *
+ * @param image image data, metadata and thumbnails to be written
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IllegalArgumentException if image is null
+ * @exception IOException if a write error occurs
+ */
+ public void write (IIOImage image)
+ throws IOException
+ {
+ checkOutputSet();
+ write (null, image, null);
+ }
+
+ /**
+ * Insert an image into the output stream. Indices greater than the
+ * specified index are incremented accordingly. Specifying an index
+ * of -1 causes the image to be appended at the end of the current
+ * image list.
+ *
+ * @param imageIndex the frame index at which to insert the image
+ * @param image the image data, metadata and thumbnails to be
+ * inserted
+ * @param the image write parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if image insertion is
+ * not supported
+ * @exception IllegalArgumentException if image is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IOException if a write error occurs
+ */
+ public void writeInsert (int imageIndex, IIOImage image, ImageWriteParam param)
+ throws IOException
+ {
+ if (!canInsertImage(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Write a sequence of images, including thumbnails and metadata, to
+ * the output stream. The output must have been set prior to this
+ * method being called. Metadata associated with the stream may be
+ * supplied, or it can be left null. IIOImage may contain raster
+ * data if this writer supports rasters, or it will contain a
+ * rendered image. Thumbnails are resized if need be. Image
+ * writing parameters may be specified to affect writing, or may be
+ * left null.
+ *
+ * @param streamMetadata metadata associated with this stream, or
+ * null
+ * @param image an IIOImage containing image data, metadata and
+ * thumbnails to be written
+ * @param param image writing parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing sequences of
+ * images is not supported
+ * @exception IllegalArgumentException if image is null
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IOException if a write error occurs
+ */
+ public void writeToSequence (IIOImage image, ImageWriteParam param)
+ throws IOException
+ {
+ if (!canWriteSequence())
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOAttr.java b/libjava/classpath/javax/imageio/metadata/IIOAttr.java
deleted file mode 100644
index 0c1d3d2ef3f..00000000000
--- a/libjava/classpath/javax/imageio/metadata/IIOAttr.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/* IIOAttr.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.imageio.metadata;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.TypeInfo;
-import org.w3c.dom.UserDataHandler;
-
-/**
- * Simple Attr node for metadata trees
- *
- * @author jlquinn
- */
-class IIOAttr implements Attr
-{
- String name;
- String value;
- IIOMetadataNode owner;
-
- public IIOAttr(String name, String value, IIOMetadataNode owner)
- {
- this.name = name;
- this.value = value;
- this.owner = owner;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getName()
- */
- public String getName()
- {
- return name;
- }
-
- public TypeInfo getSchemaTypeInfo()
- {
- throw new Error("not implemented");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getSpecified()
- */
- public boolean getSpecified()
- {
- // I don't think there can be default attrs in metadata
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getValue()
- */
- public String getValue()
- {
- return value;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#setValue(java.lang.String)
- */
- public void setValue(String value) throws DOMException
- {
- this.value = value;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getOwnerElement()
- */
- public Element getOwnerElement()
- {
- return owner;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNodeName()
- */
- public String getNodeName()
- {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNodeValue()
- */
- public String getNodeValue() throws DOMException
- {
- return value;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#setNodeValue(java.lang.String)
- */
- public void setNodeValue(String nodeValue) throws DOMException
- {
- this.value = nodeValue;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNodeType()
- */
- public short getNodeType()
- {
- return ATTRIBUTE_NODE;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getParentNode()
- */
- public Node getParentNode()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getChildNodes()
- */
- public NodeList getChildNodes()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getFirstChild()
- */
- public Node getFirstChild()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getLastChild()
- */
- public Node getLastChild()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getPreviousSibling()
- */
- public Node getPreviousSibling()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNextSibling()
- */
- public Node getNextSibling()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getAttributes()
- */
- public NamedNodeMap getAttributes()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getOwnerDocument()
- */
- public Document getOwnerDocument()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
- */
- public Node insertBefore(Node newChild, Node refChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
- */
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
- */
- public Node removeChild(Node oldChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
- */
- public Node appendChild(Node newChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#hasChildNodes()
- */
- public boolean hasChildNodes()
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#cloneNode(boolean)
- */
- public Node cloneNode(boolean deep)
- {
- return new IIOAttr(name, value, owner);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#normalize()
- */
- public void normalize()
- {
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- throw new Error("not implemented");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String)
- */
- public boolean isSupported(String feature, String version)
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNamespaceURI()
- */
- public String getNamespaceURI()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getPrefix()
- */
- public String getPrefix()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#setPrefix(java.lang.String)
- */
- public void setPrefix(String prefix) throws DOMException
- {
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getLocalName()
- */
- public String getLocalName()
- {
- return name;
- }
-
- public Object getUserData(String key)
- {
- throw new Error("not implemented");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#hasAttributes()
- */
- public boolean hasAttributes()
- {
- return false;
- }
-
- public boolean isId()
- {
- throw new Error("not implemented");
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- throw new Error("not implemented");
- }
-
- public String lookupPrefix(String namespaceURI)
- {
- throw new Error("not implemented");
- }
-
- public Object setUserData(String key, Object data, UserDataHandler handler)
- {
- throw new Error("not implemented");
- }
-
- public String getBaseURI()
- {
- throw new Error("not implemented");
- }
-
- public String getTextContent()
- {
- throw new Error("not implemented");
- }
-
- public void setTextContent(String textContent)
- {
- throw new Error("not implemented");
- }
-
- public short compareDocumentPosition(Node other)
- throws DOMException
- {
- throw new Error("not implemented");
- }
-
- public Object getFeature(String feature, String version)
- {
- throw new Error("not implemented");
- }
-
- public boolean isEqualNode(Node other)
- {
- throw new Error("not implemented");
- }
-
- public boolean isSameNode(Node other)
- {
- throw new Error("not implemented");
- }
-}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadata.java b/libjava/classpath/javax/imageio/metadata/IIOMetadata.java
index d727e1d1e51..e5105de2caf 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadata.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadata.java
@@ -38,8 +38,41 @@ exception statement from your version. */
package javax.imageio.metadata;
+import org.w3c.dom.Node;
+
/**
+ * Represents metadata that describe an image or an image stream.
+ * Each ImageIO plugin will represent image data using an opaque
+ * object but all such objects should expose their internal
+ * information as a tree of IIOMetadataNodes.
+ *
+ * There are three formats of metadata that a plugin can support:
+ *
+ * <ul>
+ * <li>a "native" format</li>
+ * <li>a custom format</li>
+ * <li>a standard plugin-neutral format</li>
+ * </ul>
+ *
+ * If a plugin supports more than one format of metadata, the other
+ * formats can be retrieved by calling getMetadataFormatNames.
+ *
+ * The native format is used to transfer metadata from one image to
+ * another image of the same type, losslessly.
+ *
+ * The custom format describes the image metadata and exposes a tree
+ * of IIOMetadataNodes but its internal representation is specific to
+ * this plugin.
+ *
+ * The plugin-neutral format uses a generic tree structure as its
+ * internal representation.
+ *
+ * ImageTranscoders may be used to convert metadata understood by one
+ * plugin to metadata understood by another, however the conversion
+ * may be lossy.
+ *
* @author Michael Koch (konqueror@gmx.de)
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
*/
public abstract class IIOMetadata
{
@@ -52,7 +85,7 @@ public abstract class IIOMetadata
protected boolean standardFormatSupported;
/**
- * Creates a <code>IIOMetaData</code> object.
+ * Construct an IIOMetadata object.
*/
protected IIOMetadata()
{
@@ -60,7 +93,7 @@ public abstract class IIOMetadata
}
/**
- * Creates a <code>IIOMetaData</code> object with the given arguments.
+ * Construct an IIOMetadata object.
*
* @param standardMetadataFormatSupported
* @param nativeMetadataFormatName
@@ -210,4 +243,81 @@ public abstract class IIOMetadata
{
this.controller = controller;
}
+
+ public abstract Node getAsTree (String formatName);
+
+ protected IIOMetadataNode getStandardChromaNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardCompressionNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardDataNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardDimensionNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardDocumentNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardTextNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardTileNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardTransparencyNode ()
+ {
+ return null;
+ }
+
+ private void appendChild (IIOMetadataNode node,
+ IIOMetadataNode child)
+ {
+ if (child != null)
+ node.appendChild(child);
+ }
+
+ protected final IIOMetadataNode getStandardTree ()
+ {
+ IIOMetadataNode node = new IIOMetadataNode();
+
+ appendChild (node, getStandardChromaNode());
+ appendChild (node, getStandardCompressionNode());
+ appendChild (node, getStandardDataNode());
+ appendChild (node, getStandardDimensionNode());
+ appendChild (node, getStandardDocumentNode());
+ appendChild (node, getStandardTextNode());
+ appendChild (node, getStandardTileNode());
+ appendChild (node, getStandardTransparencyNode());
+
+ return node;
+ }
+
+ public abstract void mergeTree (String formatName,
+ Node root)
+ throws IIOInvalidTreeException;
+
+ public void setFromTree (String formatName, Node root)
+ throws IIOInvalidTreeException
+ {
+ reset();
+
+ mergeTree (formatName, root);
+ }
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java b/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
index 2ce8f9c3d4b..aad30447c2f 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
@@ -38,6 +38,848 @@ exception statement from your version. */
package javax.imageio.metadata;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import javax.imageio.ImageTypeSpecifier;
+
public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat
{
+ /**
+ * The standard metadata format name constant set to
+ * "javax_imageio_1.0".
+ */
+ public static final String standardMetadataFormatName = "javax_imageio_1.0";
+
+ private String rootName;
+
+ // These maps assume that each element name is unique.
+
+ private Map nodes = new HashMap();
+
+ // A mapping from element name to child policy.
+ private Map childPolicies = new HashMap();
+
+ // A mapping from element name to the permissible number of
+ // children. Values in this map are length-two integer arrays; the
+ // first index is the minimum bound, the second index is the maximum
+ // bound.
+ private Map childRanges = new HashMap();
+
+ private String resourceBaseName;
+
+ // Package-private so that it may be used in IIOMetadataNode.
+ static class IIOMetadataNodeAttr extends IIOMetadataNode
+ implements Attr
+ {
+ protected Element owner;
+ protected String name;
+ protected int dataType;
+ protected boolean required;
+ protected String defaultValue;
+
+ public IIOMetadataNodeAttr (Element owner,
+ String name,
+ String defaultValue)
+ {
+ this (owner, name, IIOMetadataFormat.DATATYPE_STRING,
+ true, defaultValue);
+ }
+
+ public IIOMetadataNodeAttr (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ String defaultValue)
+ {
+ this.owner = owner;
+ this.name = name;
+ this.dataType = dataType;
+ this.required = required;
+ this.defaultValue = defaultValue;
+ }
+
+ public String getName ()
+ {
+ return name;
+ }
+
+ public Element getOwnerElement ()
+ {
+ return owner;
+ }
+
+ public int getDataType ()
+ {
+ return dataType;
+ }
+
+ public TypeInfo getSchemaTypeInfo ()
+ {
+ return null;
+ }
+
+ public boolean getSpecified ()
+ {
+ return false;
+ }
+
+ public String getValue ()
+ {
+ return defaultValue;
+ }
+
+ public boolean isId()
+ {
+ return false;
+ }
+
+ public void setValue (String value)
+ {
+ }
+
+ // new methods
+
+ public boolean isRequired ()
+ {
+ return required;
+ }
+ }
+
+ private class IIOMetadataNodeAttrEnumerated extends IIOMetadataNodeAttr
+ {
+ protected List enumeratedValues;
+
+ public IIOMetadataNodeAttrEnumerated (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ List enumeratedValues)
+ {
+ super (owner, name, dataType, required, defaultValue);
+ this.enumeratedValues = new ArrayList (enumeratedValues);
+ }
+
+ public Object[] getEnumerations ()
+ {
+ return enumeratedValues.toArray ();
+ }
+ }
+
+ private class IIOMetadataNodeAttrBounded extends IIOMetadataNodeAttr
+ {
+ protected String minValue;
+ protected String maxValue;
+ protected boolean minInclusive;
+ protected boolean maxInclusive;
+
+ public IIOMetadataNodeAttrBounded (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ String minValue,
+ String maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ super (owner, name, dataType, required, defaultValue);
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.minInclusive = minInclusive;
+ this.maxInclusive = maxInclusive;
+ }
+
+ public String getMinValue ()
+ {
+ return minValue;
+ }
+
+ public String getMaxValue ()
+ {
+ return maxValue;
+ }
+ }
+
+ private class IIOMetadataNodeAttrList extends IIOMetadataNodeAttr
+ {
+ protected int listMinLength;
+ protected int listMaxLength;
+
+ public IIOMetadataNodeAttrList (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ int listMinLength,
+ int listMaxLength)
+ {
+ super (owner, name, dataType, required, null);
+ this.listMinLength = listMinLength;
+ this.listMaxLength = listMaxLength;
+ }
+
+ public int getListMinLength ()
+ {
+ return listMinLength;
+ }
+
+ public int getListMaxLength ()
+ {
+ return listMaxLength;
+ }
+ }
+
+ private class NodeObject
+ {
+ protected Element owner;
+ protected Class classType;
+ protected boolean required;
+ protected Object defaultValue;
+ protected int valueType;
+
+ public NodeObject (Element owner,
+ Class classType,
+ boolean required,
+ Object defaultValue)
+ {
+ this.owner = owner;
+ this.classType = classType;
+ this.required = required;
+ this.defaultValue = defaultValue;
+ valueType = IIOMetadataFormat.VALUE_ARBITRARY;
+ }
+
+ public int getValueType ()
+ {
+ return valueType;
+ }
+
+ public Class getClassType ()
+ {
+ return classType;
+ }
+
+ public Element getOwnerElement ()
+ {
+ return owner;
+ }
+
+ public Object getDefaultValue ()
+ {
+ return defaultValue;
+ }
+
+ public boolean isRequired ()
+ {
+ return required;
+ }
+ }
+
+ private class NodeObjectEnumerated extends NodeObject
+ {
+ protected List enumeratedValues;
+
+ public NodeObjectEnumerated (Element owner,
+ Class classType,
+ boolean required,
+ Object defaultValue,
+ List enumeratedValues)
+ {
+ super (owner, classType, false, defaultValue);
+ this.enumeratedValues = enumeratedValues;
+ valueType = IIOMetadataFormat.VALUE_ENUMERATION;
+ }
+
+ public Object[] getEnumerations ()
+ {
+ return enumeratedValues.toArray();
+ }
+ }
+
+ private class NodeObjectBounded extends NodeObject
+ {
+ protected Comparable minValue;
+ protected Comparable maxValue;
+ protected boolean minInclusive;
+ protected boolean maxInclusive;
+
+ public NodeObjectBounded (Element owner,
+ Class classType,
+ Object defaultValue,
+ Comparable minValue,
+ Comparable maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ super (owner, classType, false, defaultValue);
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.minInclusive = minInclusive;
+ this.maxInclusive = maxInclusive;
+ if (minInclusive)
+ {
+ if (maxInclusive)
+ valueType = IIOMetadataFormat.VALUE_RANGE_MIN_MAX_INCLUSIVE;
+ else
+ valueType = IIOMetadataFormat.VALUE_RANGE_MIN_INCLUSIVE;
+ }
+ else
+ {
+ if (maxInclusive)
+ valueType = IIOMetadataFormat.VALUE_RANGE_MAX_INCLUSIVE;
+ else
+ valueType = IIOMetadataFormat.VALUE_RANGE;
+ }
+ }
+
+ public Comparable getMinValue ()
+ {
+ return minValue;
+ }
+
+ public Comparable getMaxValue ()
+ {
+ return maxValue;
+ }
+ }
+
+ private class NodeObjectArray extends NodeObject
+ {
+ protected Integer arrayMinLength;
+ protected Integer arrayMaxLength;
+
+ public NodeObjectArray (Element owner,
+ Class classType,
+ int arrayMinLength,
+ int arrayMaxLength)
+ {
+ super (owner, classType, false, null);
+ this.arrayMinLength = new Integer (arrayMinLength);
+ this.arrayMaxLength = new Integer (arrayMaxLength);
+ valueType = IIOMetadataFormat.VALUE_LIST;
+ }
+
+ public Comparable getArrayMinLength ()
+ {
+ return arrayMinLength;
+ }
+
+ public Comparable getArrayMaxLength ()
+ {
+ return arrayMaxLength;
+ }
+ }
+
+ /**
+ * Construct a blank IIOMetadataFormatImpl with the given root name
+ * and child policy.
+ *
+ * @param rootName the root element name
+ * @param childPolicy the child policy of the root element
+ *
+ * @exception IllegalArgumentException if rootName is null
+ * @exception IllegalArgumentException if childPolicy is
+ * CHILD_POLICY_REPEAT or if childPolicy is not a CHILD_POLICY
+ * constant
+ */
+ public IIOMetadataFormatImpl (String rootName, int childPolicy)
+ {
+ if (rootName == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (childPolicy < IIOMetadataFormat.CHILD_POLICY_ALL
+ || childPolicy > IIOMetadataFormat.CHILD_POLICY_SOME
+ || childPolicy == IIOMetadataFormat.CHILD_POLICY_REPEAT)
+ throw new IllegalArgumentException ("wrong child policy");
+
+ nodes.put (rootName, new IIOMetadataNode (rootName));
+ childPolicies.put (rootName, new Integer (childPolicy));
+ this.rootName = rootName;
+ }
+
+ /**
+ * Construct a blank IIOMetadataFormatImpl with the given root name,
+ * a child policy of CHILD_POLICY_REPEAT and the given minimum and
+ * maximum limits on the number of root element children.
+ *
+ * @param rootName the root element name
+ * @param minChildren the minimum number of children that this node
+ * can have
+ * @param maxChildren the maximum number of children that this node
+ * can have
+ *
+ * @exception IllegalArgumentException if rootName is null
+ * @exception IllegalArgumentException if minChildren is less than
+ * zero or greater than maxChildren
+ */
+ public IIOMetadataFormatImpl (String rootName,
+ int minChildren,
+ int maxChildren)
+ {
+ if (rootName == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (minChildren < 0 || maxChildren < minChildren)
+ throw new IllegalArgumentException ("invalid min or max children argument");
+
+ nodes.put (rootName, new IIOMetadataNode (rootName));
+ childPolicies.put (rootName, new Integer (IIOMetadataFormat.CHILD_POLICY_REPEAT));
+ childRanges.put (rootName, new int [] { minChildren, maxChildren });
+ this.rootName = rootName;
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ String defaultValue)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttr (node,
+ attrName,
+ dataType,
+ required,
+ defaultValue));
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ List enumeratedValues)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttrEnumerated (node,
+ attrName,
+ dataType,
+ required,
+ defaultValue,
+ enumeratedValues));
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ String minValue,
+ String maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttrBounded (node,
+ attrName,
+ dataType,
+ required,
+ defaultValue,
+ minValue,
+ maxValue,
+ minInclusive,
+ maxInclusive));
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ int listMinLength,
+ int listMaxLength)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttrList (node,
+ attrName,
+ dataType,
+ required,
+ listMinLength,
+ listMaxLength));
+ }
+
+ protected void addBooleanAttribute (String elementName,
+ String attrName,
+ boolean hasDefaultValue,
+ boolean defaultValue)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+
+ List enumeratedValues = new ArrayList();
+ enumeratedValues.add ("TRUE");
+ enumeratedValues.add ("FALSE");
+
+ node.setAttributeNode (new IIOMetadataNodeAttrEnumerated (node,
+ attrName,
+ IIOMetadataFormat.DATATYPE_BOOLEAN,
+ hasDefaultValue,
+ defaultValue ? "TRUE" : "FALSE",
+ enumeratedValues));
+ }
+
+ protected void addChildElement (String elementName, String parentName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (parentName);
+
+ node.appendChild (new IIOMetadataNode (elementName));
+ childPolicies.put (elementName, new Integer (IIOMetadataFormat.CHILD_POLICY_REPEAT));
+ }
+
+ protected void addElement (String elementName, String parentName, int childPolicy)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (parentName);
+
+ node.appendChild (new IIOMetadataNode (elementName));
+ childPolicies.put (elementName, new Integer (childPolicy));
+ }
+
+ protected void addElement (String elementName, String parentName,
+ int minChildren, int maxChildren)
+ {
+ addChildElement (elementName, parentName);
+ childRanges.put (elementName, new int [] { minChildren, maxChildren });
+ }
+
+ private void addNodeObject (IIOMetadataNode node, NodeObject o)
+ {
+ node.setUserObject (o);
+ }
+
+ private NodeObject getNodeObject (IIOMetadataNode node)
+ {
+ return (NodeObject) node.getUserObject ();
+ }
+
+ private void removeNodeObject (IIOMetadataNode node)
+ {
+ node.setUserObject (null);
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ boolean required, Object defaultValue)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObject (node,
+ classType,
+ required,
+ defaultValue));
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ boolean required, Object defaultValue,
+ List enumeratedValues)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObjectEnumerated (node,
+ classType,
+ required,
+ defaultValue,
+ enumeratedValues));
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ Object defaultValue,
+ Comparable minValue,
+ Comparable maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObjectBounded (node,
+ classType,
+ defaultValue,
+ minValue,
+ maxValue,
+ minInclusive,
+ maxInclusive));
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ int arrayMinLength, int arrayMaxLength)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObjectArray (node,
+ classType,
+ arrayMinLength,
+ arrayMaxLength));
+ }
+
+ public String getRootName ()
+ {
+ return rootName;
+ }
+
+ protected String getResourceBaseName ()
+ {
+ return resourceBaseName;
+ }
+
+ public static IIOMetadataFormat getStandardFormatInstance ()
+ {
+ // FIXME: populate this with the standard metadata format
+ return new IIOMetadataFormatImpl (standardMetadataFormatName,
+ IIOMetadataFormat.CHILD_POLICY_ALL)
+ {
+ public boolean canNodeAppear (String elementName,
+ ImageTypeSpecifier specifier)
+ {
+ return true;
+ }
+ };
+ }
+
+ public abstract boolean canNodeAppear (String elementName,
+ ImageTypeSpecifier specifier);
+
+ protected void removeAttribute (String elementName,
+ String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.removeAttribute (attrName);
+ }
+
+ protected void removeElement (String elementName)
+ {
+ nodes.remove (elementName);
+ }
+
+ protected void removeObjectValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ removeNodeObject (node);
+ }
+
+ protected void setResourceBaseName (String resourceBaseName)
+ {
+ this.resourceBaseName = resourceBaseName;
+ }
+
+ public int getAttributeDataType (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) node.getAttributeNode (attrName);
+ return attr.getDataType ();
+ }
+
+ public String getAttributeDefaultValue (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) node.getAttributeNode (attrName);
+ return attr.getValue();
+ }
+
+ public String getAttributeDescription (String elementName, String attrName, Locale locale)
+ {
+ return getDescription (elementName + "/" + attrName, locale);
+ }
+
+ public String[] getAttributeEnumerations (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrEnumerated attr =
+ (IIOMetadataNodeAttrEnumerated) node.getAttributeNode (attrName);
+
+ Object[] attrEnums = attr.getEnumerations();
+
+ String[] attrNames = new String[attrEnums.length];
+
+ for (int i = 0; i < attrEnums.length; i++)
+ {
+ attrNames[i] = (String) attrEnums[i];
+ }
+
+ return attrNames;
+ }
+
+ public int getAttributeListMaxLength (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrList attr =
+ (IIOMetadataNodeAttrList) node.getAttributeNode (attrName);
+ return attr.getListMaxLength();
+ }
+
+ public int getAttributeListMinLength (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrList attr =
+ (IIOMetadataNodeAttrList) node.getAttributeNode (attrName);
+ return attr.getListMinLength();
+ }
+
+ public String getAttributeMaxValue (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrBounded attr =
+ (IIOMetadataNodeAttrBounded) node.getAttributeNode (attrName);
+ return attr.getMaxValue();
+ }
+
+ public String getAttributeMinValue (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrBounded attr =
+ (IIOMetadataNodeAttrBounded) node.getAttributeNode (attrName);
+ return attr.getMinValue();
+ }
+
+ public String[] getAttributeNames (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+
+ NamedNodeMap attrNodes = node.getAttributes();
+
+ String[] attrNames = new String[attrNodes.getLength()];
+
+ for (int i = 0; i < attrNodes.getLength(); i++)
+ {
+ attrNames[i] = attrNodes.item (i).getLocalName();
+ }
+
+ return attrNames;
+ }
+
+ public int getAttributeValueType (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) node.getAttributeNode (attrName);
+ return attr.getDataType();
+ }
+
+ public String[] getChildNames (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+
+ NodeList childNodes = node.getChildNodes();
+
+ String[] childNames = new String[childNodes.getLength()];
+
+ for (int i = 0; i < childNodes.getLength(); i++)
+ {
+ childNames[i] = childNodes.item (i).getLocalName();
+ }
+
+ return childNames;
+ }
+
+ public int getChildPolicy (String elementName)
+ {
+ return ((Integer) childPolicies.get (elementName)).intValue();
+ }
+
+ private String getDescription (String resourceName, Locale locale)
+ {
+ if (resourceBaseName == null)
+ return null;
+
+ Locale l = locale;
+
+ if (l == null)
+ l = Locale.getDefault();
+
+ ResourceBundle bundle = ResourceBundle.getBundle (resourceBaseName, locale);
+
+ String desc = null;
+
+ if (bundle == null)
+ {
+ try
+ {
+ desc = bundle.getString (resourceName);
+ }
+ catch (MissingResourceException e)
+ {
+ desc = null;
+ }
+ }
+
+ return desc;
+ }
+
+ public String getElementDescription (String elementName, Locale locale)
+ {
+ return getDescription (elementName, locale);
+ }
+
+ public int getElementMaxChildren (String elementName)
+ {
+ return ((int[]) childRanges.get (elementName))[1];
+ }
+
+ public int getElementMinChildren (String elementName)
+ {
+ return ((int[]) childRanges.get (elementName))[0];
+ }
+
+ public int getObjectArrayMaxLength (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((Integer) ((NodeObjectArray) getNodeObject (node)).getArrayMaxLength ()).intValue();
+ }
+
+ public int getObjectArrayMinLength (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((Integer) ((NodeObjectArray) getNodeObject (node)).getArrayMinLength ()).intValue();
+ }
+
+ public Class getObjectClass (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return getNodeObject (node).getClassType ();
+ }
+
+ public Object getObjectDefaultValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return getNodeObject (node).getDefaultValue ();
+ }
+
+ public Object[] getObjectEnumerations (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((NodeObjectEnumerated) getNodeObject (node)).getEnumerations ();
+ }
+
+ public Comparable getObjectMaxValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((NodeObjectBounded) getNodeObject (node)).getMaxValue ();
+ }
+
+ public Comparable getObjectMinValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((NodeObjectBounded) getNodeObject (node)).getMinValue ();
+ }
+
+ public int getObjectValueType (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ NodeObject n = getNodeObject (node);
+
+ if (n == null)
+ return IIOMetadataFormat.VALUE_NONE;
+ else
+ return n.getValueType ();
+ }
+
+ public boolean isAttributeRequired (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((IIOMetadataNodeAttr) node.getAttributeNode (attrName)).isRequired();
+ }
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java b/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
index d9e0983e94a..2d52e467078 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
@@ -52,6 +52,7 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.TypeInfo;
import org.w3c.dom.UserDataHandler;
+import javax.imageio.metadata.IIOMetadataFormatImpl.IIOMetadataNodeAttr;
public class IIOMetadataNode
implements Element, NodeList
@@ -61,7 +62,127 @@ public class IIOMetadataNode
private List children = new ArrayList();
private IIOMetadataNode parent;
private Object obj;
+
+ /**
+ * Simple NamedNodeMap class for IIOMetadataNode.
+ *
+ * @author jlquinn
+ */
+ private class IIONamedNodeMap implements NamedNodeMap
+ {
+ HashMap attrs;
+
+ /**
+ * @param attrs
+ * @param node
+ */
+ public IIONamedNodeMap(HashMap attrs)
+ {
+ this.attrs = attrs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#getNamedItem(java.lang.String)
+ */
+ public Node getNamedItem(String name)
+ {
+ return (Node)attrs.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#setNamedItem(org.w3c.dom.Node)
+ */
+ public Node setNamedItem(Node arg) throws DOMException
+ {
+ if (arg instanceof IIOMetadataNodeAttr)
+ {
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) arg;
+ // The only code that can successfully do this is in this package.
+ if (attr.owner != null)
+ throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "");
+ return (Node)attrs.put(attr.name, attr);
+ }
+ // Anything else gets treated as an invalid op.
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "");
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#removeNamedItem(java.lang.String)
+ */
+ public Node removeNamedItem(String name) throws DOMException
+ {
+ return (Node)attrs.remove(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#item(int)
+ */
+ public Node item(int index)
+ {
+ return (Node)attrs.values().toArray()[index];
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#getLength()
+ */
+ public int getLength()
+ {
+ return attrs.size();
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#getNamedItemNS(java.lang.String, java.lang.String)
+ */
+ public Node getNamedItemNS(String namespaceURI, String localName)
+ {
+ return getNamedItem(localName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#setNamedItemNS(org.w3c.dom.Node)
+ */
+ public Node setNamedItemNS(Node arg) throws DOMException
+ {
+ return setNamedItem(arg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#removeNamedItemNS(java.lang.String, java.lang.String)
+ */
+ public Node removeNamedItemNS(String namespaceURI, String localName)
+ throws DOMException
+ {
+ return removeNamedItem(localName);
+ }
+ }
+
+ /**
+ * Simple NodeList implementation for IIOMetadataNode.
+ *
+ * @author jlquinn
+ *
+ */
+ private class IIONodeList implements NodeList
+ {
+ List children = new ArrayList();
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NodeList#item(int)
+ */
+ public Node item(int index)
+ {
+ return (index < children.size()) ? (Node)children.get(index) : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NodeList#getLength()
+ */
+ public int getLength()
+ {
+ return children.size();
+ }
+ }
+
public IIOMetadataNode()
{
// Do nothing here.
@@ -71,12 +192,12 @@ public class IIOMetadataNode
{
name = nodename;
}
-
+
public Object getUserObject()
{
return obj;
}
-
+
public void setUserObject(Object o)
{
obj = o;
@@ -85,7 +206,7 @@ public class IIOMetadataNode
public short compareDocumentPosition(Node other)
throws DOMException
{
- throw new Error("not implemented");
+ return Element.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
}
/* (non-Javadoc)
@@ -104,7 +225,7 @@ public class IIOMetadataNode
{
String val = getAttribute(name);
if (val != null)
- return new IIOAttr(name, val, this);
+ return new IIOMetadataNodeAttr(this, name, val);
return null;
}
@@ -126,7 +247,7 @@ public class IIOMetadataNode
public String getBaseURI()
{
- throw new Error("not implemented");
+ return null;
}
// Recursive function for assembling a node list.
@@ -217,7 +338,7 @@ public class IIOMetadataNode
if (attr != null)
attr.setValue(value);
else
- attrs.put(name, new IIOAttr(name, value, this));
+ attrs.put(name, new IIOMetadataNodeAttr(this, name, value));
}
/* (non-Javadoc)
@@ -295,7 +416,7 @@ public class IIOMetadataNode
// clone attrs
for (Iterator it = attrs.values().iterator(); it.hasNext();)
{
- IIOAttr attr = (IIOAttr)it.next();
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr)it.next();
newnode.attrs.put(attr.name, attr.cloneNode(deep));
attr.owner = newnode;
}
@@ -321,7 +442,7 @@ public class IIOMetadataNode
public Object getFeature(String feature, String version)
{
- throw new Error("not implemented");
+ return null;
}
/* (non-Javadoc)
@@ -432,18 +553,18 @@ public class IIOMetadataNode
public TypeInfo getSchemaTypeInfo()
{
- throw new Error("not implemented");
+ return null;
}
public String getTextContent()
throws DOMException
{
- throw new Error("not implemented");
+ return null;
}
public Object getUserData(String key)
{
- throw new Error("not implemented");
+ return null;
}
/* (non-Javadoc)
@@ -482,12 +603,12 @@ public class IIOMetadataNode
public boolean isDefaultNamespace(String namespaceURI)
{
- throw new Error("not implemented");
+ return true;
}
public boolean isEqualNode(Node arg)
{
- throw new Error("not implemented");
+ return true;
}
public boolean isSameNode(Node other)
@@ -506,12 +627,12 @@ public class IIOMetadataNode
public String lookupNamespaceURI(String prefix)
{
- throw new Error("not implemented");
+ return null;
}
public String lookupPrefix(String namespaceURI)
{
- throw new Error("not implemented");
+ return null;
}
/* (non-Javadoc)
@@ -550,19 +671,16 @@ public class IIOMetadataNode
public void setIdAttribute(String name, boolean isId)
throws DOMException
{
- throw new Error("not implemented");
}
public void setIdAttributeNode(Attr idAttr, boolean isId)
throws DOMException
{
- throw new Error("not implemented");
}
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
throws DOMException
{
- throw new Error("not implemented");
}
/* (non-Javadoc)
@@ -582,11 +700,10 @@ public class IIOMetadataNode
public void setTextContent(String textContent)
throws DOMException
{
- throw new Error("not implemented");
}
public Object setUserData(String key, Object data, UserDataHandler handler)
{
- throw new Error("not implemented");
+ return null;
}
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java b/libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java
deleted file mode 100644
index 92da28d5bb2..00000000000
--- a/libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/* IIONamedNodeMap.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 javax.imageio.metadata;
-
-import java.util.HashMap;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Simple NamedNodeMap class for IIOMetadataNode.
- *
- * @author jlquinn
- */
-class IIONamedNodeMap implements NamedNodeMap
-{
- HashMap attrs;
-
- /**
- * @param attrs
- * @param node
- */
- public IIONamedNodeMap(HashMap attrs)
- {
- this.attrs = attrs;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#getNamedItem(java.lang.String)
- */
- public Node getNamedItem(String name)
- {
- return (Node)attrs.get(name);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#setNamedItem(org.w3c.dom.Node)
- */
- public Node setNamedItem(Node arg) throws DOMException
- {
- if (arg instanceof IIOAttr)
- {
- IIOAttr attr = (IIOAttr) arg;
- // The only code that can successfully do this is in this package.
- if (attr.owner != null)
- throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "");
- return (Node)attrs.put(attr.name, attr);
- }
- // Anything else gets treated as an invalid op.
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#removeNamedItem(java.lang.String)
- */
- public Node removeNamedItem(String name) throws DOMException
- {
- return (Node)attrs.remove(name);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#item(int)
- */
- public Node item(int index)
- {
- return (Node)attrs.values().toArray()[index];
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#getLength()
- */
- public int getLength()
- {
- return attrs.size();
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#getNamedItemNS(java.lang.String, java.lang.String)
- */
- public Node getNamedItemNS(String namespaceURI, String localName)
- {
- return getNamedItem(localName);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#setNamedItemNS(org.w3c.dom.Node)
- */
- public Node setNamedItemNS(Node arg) throws DOMException
- {
- return setNamedItem(arg);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#removeNamedItemNS(java.lang.String, java.lang.String)
- */
- public Node removeNamedItemNS(String namespaceURI, String localName)
- throws DOMException
- {
- return removeNamedItem(localName);
- }
-
-}
diff --git a/libjava/classpath/javax/imageio/metadata/IIONodeList.java b/libjava/classpath/javax/imageio/metadata/IIONodeList.java
deleted file mode 100644
index 395d261b6c6..00000000000
--- a/libjava/classpath/javax/imageio/metadata/IIONodeList.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* IIOAttr.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 javax.imageio.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Simple NodeList implementation for IIOMetadataNode.
- *
- * @author jlquinn
- *
- */
-class IIONodeList implements NodeList
-{
- List children = new ArrayList();
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NodeList#item(int)
- */
- public Node item(int index)
- {
- return (index < children.size()) ? (Node)children.get(index) : null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NodeList#getLength()
- */
- public int getLength()
- {
- return children.size();
- }
-
-}
diff --git a/libjava/classpath/javax/imageio/package.html b/libjava/classpath/javax/imageio/package.html
index ce36a7b44bd..f6a604de8fc 100644
--- a/libjava/classpath/javax/imageio/package.html
+++ b/libjava/classpath/javax/imageio/package.html
@@ -40,7 +40,48 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.imageio</title></head>
<body>
-<p></p>
-
+<p>
+This package provides image input/output APIs.
+</p>
+<p>
+The standard class library provides other ways of loading images (@see
+java.awt.Toolkit, @see java.awt.Component)) but the ImageIO package is
+more powerful.
+</p>
+<p>
+The static ImageIO class supports reading and writing images in many
+different formats along with most other basic image I/O operations.
+</p>
+<p>
+Other classes provide finer control of image-related operations;
+reading is controlled by ImageReader, ImageReadParam and
+ImageTypeSpecifyer, writing by ImageWriter and ImageWriteParam.
+ImageTranscoder allows fine-grained control over how images are
+converted between formats and IIOException reports errors. IIOImage
+describes an image file in detail including metadata and thumbnails.
+</p>
+<h2>Supported Formats</h2>
+<p>
+The default GNU Classpath ImageIO backend uses ImageMagick and so
+supports the following formats:
+<table>
+<tr>
+<th></th> <th>Read</th> <th>Write</th>
+</tr>
+<tr><td>JPEG</td><td>yes</td><td>yes</td></tr>
+<tr><td>PNG</td><td>yes</td><td>yes</td></tr>
+<tr><td>BMP</td><td>yes</td><td>yes</td></tr>
+<tr><td>WBMP</td><td>yes</td><td>yes</td></tr>
+<tr><td>GIF</td><td>yes</td><td>yes</td></tr>
+<tr><td>TIFF</td><td>yes</td><td>yes</td></tr>
+<tr><td>XPM</td><td>yes</td><td>yes</td></tr>
+<tr><td>TGA</td><td>yes</td><td>yes</td></tr>
+<tr><td>PDF</td><td>yes</td><td>no</td></tr>
+<tr><td>SVG</td><td>yes</td><td>no</td></tr>
+<table>
+</p>
+<p>
+@since 1.4
+</p>
</body>
</html>
diff --git a/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java b/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java
index 4aa7fd41272..40d44e3d0e2 100644
--- a/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java
+++ b/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.imageio.spi;
+import javax.imageio.metadata.IIOMetadataFormat;
+import javax.imageio.metadata.IIOMetadataFormatImpl;
/**
* An abstract superclass that contains the common parts of {@link
@@ -422,4 +424,88 @@ public abstract class ImageReaderWriterSpi
{
return extraImageMetadataFormatNames;
}
+
+ /**
+ * Returns an IIOMetadataFormat object that represents the requested
+ * stream metadata format or null if the given format is supported
+ * but no IIOMetadataFormat can be created for it.
+ *
+ * @param formatName the requested stream metadata format name
+ *
+ * @return an IIOMetadataFormat object or null
+ *
+ * @throws IllegalArgumentException if formatName is null or is not
+ * one of the standard metadata format or this provider's native or
+ * extra stream metadata formats
+ */
+ public IIOMetadataFormat getStreamMetadataFormat (String formatName)
+ {
+ if (formatName == null)
+ throw new IllegalArgumentException ("null stream metadata format name");
+
+ if (!formatName.equals (getNativeStreamMetadataFormatName())
+ && !formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ {
+ String[] extraNames = getExtraStreamMetadataFormatNames ();
+ boolean foundName = false;
+ for (int i = 0; i < extraNames.length; i++)
+ {
+ if (formatName.equals(extraNames[i]))
+ {
+ foundName = true;
+ break;
+ }
+ }
+ if (!foundName)
+ throw new IllegalArgumentException ("unsupported stream metadata format name");
+ }
+
+ if (formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ return IIOMetadataFormatImpl.getStandardFormatInstance ();
+ else
+ // Default implementation returns null.
+ return null;
+ }
+
+ /**
+ * Returns an IIOMetadataFormat object that represents the requested
+ * image metadata format or null if the given format is supported
+ * but no IIOMetadataFormat can be created for it.
+ *
+ * @param formatName the requested image metadata format name
+ *
+ * @return an IIOMetadataFormat object or null
+ *
+ * @throws IllegalArgumentException if formatName is null or is not
+ * one of the standard metadata format or this provider's native or
+ * extra image metadata formats
+ */
+ public IIOMetadataFormat getImageMetadataFormat (String formatName)
+ {
+ if (formatName == null)
+ throw new IllegalArgumentException ("null image metadata format name");
+
+ if (!formatName.equals (getNativeImageMetadataFormatName())
+ && !formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ {
+ String[] extraNames = getExtraImageMetadataFormatNames ();
+ boolean foundName = false;
+ for (int i = 0; i < extraNames.length; i++)
+ {
+ if (formatName.equals(extraNames[i]))
+ {
+ foundName = true;
+ break;
+ }
+ }
+ if (!foundName)
+ throw new IllegalArgumentException ("unsupported image metadata format name");
+ }
+
+ if (formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ return IIOMetadataFormatImpl.getStandardFormatInstance ();
+ else
+ // Default implementation returns null.
+ return null;
+ }
}
diff --git a/libjava/classpath/javax/naming/CompoundName.java b/libjava/classpath/javax/naming/CompoundName.java
index 4b30557f8d3..b23736fa723 100644
--- a/libjava/classpath/javax/naming/CompoundName.java
+++ b/libjava/classpath/javax/naming/CompoundName.java
@@ -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;
@@ -48,9 +51,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.
- *
* FIXME: this class is underspecified. For instance, the `flat'
* direction is never described. If it means that the CompoundName
* can only have a single element, then the Enumeration-based
@@ -469,6 +469,25 @@ public class CompoundName implements Name, Cloneable, Serializable
"false")).booleanValue ();
}
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ mySyntax = (Properties) s.readObject();
+ int count = s.readInt();
+ elts = new Vector(count);
+ for (int i = 0; i < count; i++)
+ elts.addElement((String) s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(mySyntax);
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.elementAt(i));
+ }
+
// The spec specifies this but does not document it in any way (it
// is a package-private class). It is useless as far as I can tell.
// So we ignore it.
diff --git a/libjava/classpath/javax/naming/Name.java b/libjava/classpath/javax/naming/Name.java
index f8592d9ea3d..f0475766a97 100644
--- a/libjava/classpath/javax/naming/Name.java
+++ b/libjava/classpath/javax/naming/Name.java
@@ -1,5 +1,5 @@
/* Name.java -- Name build up from different components
- Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ import java.util.Enumeration;
* @author Anthony Green (green@redhat.com)
* @author Mark Wielaard (mark@klomp.org)
*/
-public interface Name extends Cloneable, Serializable
+public interface Name extends Cloneable, Serializable, Comparable
{
long serialVersionUID = -3617482732056931635L;
diff --git a/libjava/classpath/javax/print/DocFlavor.java b/libjava/classpath/javax/print/DocFlavor.java
index 732823fbeb2..1e96a70c024 100644
--- a/libjava/classpath/javax/print/DocFlavor.java
+++ b/libjava/classpath/javax/print/DocFlavor.java
@@ -54,6 +54,8 @@ public class DocFlavor implements Cloneable, Serializable
public static class BYTE_ARRAY
extends DocFlavor
{
+ private static final long serialVersionUID = -9065578006593857475L;
+
public static final BYTE_ARRAY AUTOSENSE = new BYTE_ARRAY("application/octet-stream");
public static final BYTE_ARRAY GIF = new BYTE_ARRAY("image/gif");
public static final BYTE_ARRAY JPEG = new BYTE_ARRAY("image/jpeg");
@@ -103,6 +105,8 @@ public class DocFlavor implements Cloneable, Serializable
public static class INPUT_STREAM
extends DocFlavor
{
+ private static final long serialVersionUID = -7045842700749194127L;
+
public static final INPUT_STREAM AUTOSENSE = new INPUT_STREAM("application/octet-stream");
public static final INPUT_STREAM GIF = new INPUT_STREAM("image/gif");
public static final INPUT_STREAM JPEG = new INPUT_STREAM("image/jpeg");
diff --git a/libjava/classpath/javax/print/attribute/Attribute.java b/libjava/classpath/javax/print/attribute/Attribute.java
index fcaa7d84cfe..7ce0247cea1 100644
--- a/libjava/classpath/javax/print/attribute/Attribute.java
+++ b/libjava/classpath/javax/print/attribute/Attribute.java
@@ -1,5 +1,5 @@
/* Attribute.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,11 +40,27 @@ package javax.print.attribute;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * Base interface of every printing attribute of the Java Print Service API.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface Attribute extends Serializable
{
+ /**
+ * Returns the category of the printing attribute which is the specific
+ * attribute class implementing this interface.
+ *
+ * @return The concrete {@link Class} instance of the attribute class.
+ */
Class getCategory ();
+ /**
+ * Returns the descriptive name of the attribute category.
+ *
+ * Implementations of the <code>Attribute</code> interfaces providing equal
+ * category values have to return equal name values.
+ *
+ * @return The name of the attribute category.
+ */
String getName ();
}
diff --git a/libjava/classpath/javax/print/attribute/AttributeSet.java b/libjava/classpath/javax/print/attribute/AttributeSet.java
index cdc7a8e4876..b4bdecad254 100644
--- a/libjava/classpath/javax/print/attribute/AttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/AttributeSet.java
@@ -1,5 +1,5 @@
/* AttributeSet.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,40 +38,159 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>AttributeSet</code> is the top-level interface for sets of printing
+ * attributes in the Java Print Service API.
+ * <p>
+ * There are no duplicate values allowed in an attribute set and there is
+ * at most one attribute object contained per category type. Based on the
+ * {@link java.util.Map} interface the values of attribute sets are objects
+ * of type {@link javax.print.attribute.Attribute} and the entries are the
+ * categories as {@link java.lang.Class} instances.
+ * </p>
+ * <p>
+ * The following specialized types of <code>AttributeSet</code> are available:
+ * <ul>
+ * <li>{@link javax.print.attribute.DocAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintRequestAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintJobAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintServiceAttributeSet}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Attribute sets may be unmodifiable depending on the context of usage. If
+ * used as read-only attribute set modifying operations throw an
+ * {@link javax.print.attribute.UnmodifiableSetException}.
+ * </p>
+ * <p>
+ * The Java Print Service API provides implementation classes for the existing
+ * attribute set interfaces but applications may use their own implementations.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
-
+
+ /**
+ * Removes all attributes from this attribute set.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
void clear ();
-
+
+ /**
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
+ */
boolean containsKey (Class category);
-
+
+ /**
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
+ */
boolean containsValue (Attribute attribute);
+ /**
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
+ */
boolean equals (Object obj);
-
- Attribute get (Class Category);
-
+
+ /**
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
+ */
+ Attribute get (Class category);
+
+ /**
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
+ */
int hashCode ();
-
+
+ /**
+ * Checks if the attribute set is empty.
+ *
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
+ */
boolean isEmpty ();
+ /**
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
boolean remove (Attribute attribute);
-
+
+ /**
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
boolean remove (Class category);
-
+
+ /**
+ * Returns the number of elements in this attribute set.
+ *
+ * @return The number of elements.
+ */
int size ();
-
+
+ /**
+ * Returns the content of the attribute set as an array
+ *
+ * @return An array of attributes.
+ */
Attribute[] toArray ();
}
diff --git a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
index 6f0ffc10d7f..5d97c66f21a 100644
--- a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
+++ b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
@@ -39,12 +39,41 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>AttributeSetUtilities</code> provides static methods for working
+ * with <code>AttributeSet</code>s.
+ * <p>
+ * For every type of an attribute set available in the Java Print Service API
+ * are methods provided to get an unmodifiable view of an attribute set.
+ * This unmodifiable view provides a read-only version of the attribute
+ * set which throws {@link javax.print.attribute.UnmodifiableSetException}s
+ * if state changing methods are invoked.
+ * </p>
+ * <p>
+ * Methods for getting a synchronized view of an attribute set are also
+ * available. This view provides synchronized (thread safe) access to the
+ * underlying wrapped attribute set.
+ * </P>
+ * <p>
+ * Three static methods for the implementation of own AttributeSets
+ * are provided, which verify that:
+ * <ul>
+ * <li>the given object is an attribute of the given interface.</li>
+ * <li>the category of given attribute is equals to a given category.</li>
+ * <li>the given object is a <code>Class</code> that implements the given
+ * interface name.</li>
+ * </ul>
+ *
+ */
public final class AttributeSetUtilities
{
/**
* This class isn't intended to be instantiated.
*/
- private AttributeSetUtilities() {}
+ private AttributeSetUtilities()
+ {
+ // only static methods
+ }
private static class UnmodifiableAttributeSet
implements AttributeSet, Serializable
@@ -287,7 +316,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static AttributeSet synchronizedView(AttributeSet attributeSet)
{
@@ -297,7 +327,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
{
@@ -307,7 +338,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
{
@@ -317,7 +349,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
{
@@ -327,7 +360,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
{
@@ -337,7 +371,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static AttributeSet unmodifiableView(AttributeSet attributeSet)
{
@@ -347,7 +382,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
{
@@ -357,7 +393,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
{
@@ -367,7 +404,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
{
@@ -377,7 +415,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
{
@@ -386,8 +425,10 @@ public final class AttributeSetUtilities
/**
* Verifies that the given object is a <code>Class</code> that
- * implements the given interface name.
- *
+ * implements the given interface name and returns it casted.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
* @return object casted to <code>Class</code>
*
* @exception ClassCastException if object is not a <code>Class</code>
@@ -410,7 +451,10 @@ public final class AttributeSetUtilities
/**
* Verifies that the given object is an attribute of the given interface.
- *
+ * and returns it casted to the interface type.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
* @return the object casted to <code>Attribute</code>
*
* @exception ClassCastException if object is no instance of interfaceName.
@@ -429,10 +473,11 @@ public final class AttributeSetUtilities
}
/**
- * Verifies that the category of attribute is equals to category.
- *
- * @param category the category the atteribute should be
- * @param attribute the attribute to verify
+ * Verifies that the category of attribute is equals to the given category
+ * class.
+ *
+ * @param category the category to test.
+ * @param attribute the attribute to verify.
*
* @exception IllegalArgumentException if the categories are not equal
* @exception NullPointerException if category is null
@@ -440,10 +485,10 @@ public final class AttributeSetUtilities
public static void verifyCategoryForValue(Class category,
Attribute attribute)
{
- if (category == null)
- throw new NullPointerException("object may not be null");
+ if (category == null || attribute == null)
+ throw new NullPointerException("category or attribute may not be null");
- if (category.equals(attribute.getCategory()))
+ if (!category.equals(attribute.getCategory()))
throw new IllegalArgumentException
("category of attribute not equal to category");
}
diff --git a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
index 0e583e0b990..d59193265e2 100644
--- a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
+++ b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
@@ -1,5 +1,5 @@
/* DateTimeSyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,10 @@ import java.io.Serializable;
import java.util.Date;
/**
- * @author Michael Koch
+ * <code>DateTimeSyntax</code> is the abstract base class of all attribute
+ * classes having a date and a time as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class DateTimeSyntax implements Cloneable, Serializable
{
@@ -52,7 +55,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Creates a <code>DateTimeSyntax</code> with a given value.
*
- * @param value the value for this syntax
+ * @param value the date for this syntax
*
* @exception NullPointerException if value is null
*/
@@ -67,7 +70,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Returns the date value of this object.
*
- * @return the date value
+ * @return The date value.
*/
public Date getValue()
{
@@ -79,7 +82,8 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
*
* @param obj the object to test
*
- * @return True if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -92,7 +96,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
diff --git a/libjava/classpath/javax/print/attribute/DocAttribute.java b/libjava/classpath/javax/print/attribute/DocAttribute.java
index 669d7d98251..9af3a7052af 100644
--- a/libjava/classpath/javax/print/attribute/DocAttribute.java
+++ b/libjava/classpath/javax/print/attribute/DocAttribute.java
@@ -1,5 +1,5 @@
/* DocAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing attributes of
+ * a {@link javax.print.Doc} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.DocAttributeSet}.
+ * </p><p>
+ * Attributes attached to a {@link javax.print.Doc} instance specify how the
+ * data should be printed.
+ * For example {@link javax.print.attribute.standard.Chromaticity} can be
+ * used to specify that a doc should be printed in color or monochrome.
+ * </p>
+ *
+ * @see javax.print.attribute.DocAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DocAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/DocAttributeSet.java b/libjava/classpath/javax/print/attribute/DocAttributeSet.java
index 72cd6d88a00..d8d09eb4857 100644
--- a/libjava/classpath/javax/print/attribute/DocAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/DocAttributeSet.java
@@ -1,5 +1,5 @@
/* DocAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>DocAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.DocAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>DocAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DocAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>DocAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>DocAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/EnumSyntax.java b/libjava/classpath/javax/print/attribute/EnumSyntax.java
index 3ed79fc5f68..9a5e62d458f 100644
--- a/libjava/classpath/javax/print/attribute/EnumSyntax.java
+++ b/libjava/classpath/javax/print/attribute/EnumSyntax.java
@@ -1,5 +1,5 @@
/* EnumSyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,10 +37,69 @@ exception statement from your version. */
package javax.print.attribute;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * <code>EnumSyntax</code> is the abstract base class of all enumeration
+ * classes in the Java Print Service API.
+ * <p>
+ * Every enumeration class which extends from EnumSyntax provides several
+ * enumeration objects as singletons of its class.
+ * </p>
+ * <p>
+ * Notes for implementing subclasses:
+ * <ul>
+ * <li>
+ * The values of all enumeration singelton instances have to be in a
+ * sequence which may start at any value. See: {@link #getOffset()}
+ * </li>
+ * <li>
+ * Subclasses have to override {@link #getEnumValueTable()} and should
+ * override {@link #getStringTable()} for correct serialization.
+ * </li>
+ * </ul>
+ * </p>
+ * Example:
+ * <pre>
+ * public class PrinterState extends EnumSyntax
+ * {
+ * public static final PrinterState IDLE = new PrinterState(1);
+ * public static final PrinterState PROCESSING = new PrinterState(2);
+ * public static final PrinterState STOPPED = new PrinterState(3);
+ *
+ * protected PrinterState(int value)
+ * {
+ * super(value);
+ * }
+ *
+ * // Overridden because values start not at zero !
+ * protected int getOffset()
+ * {
+ * return 1;
+ * }
+ *
+ * private static final String[] stringTable = { "idle", "processing",
+ * "stopped" };
+ *
+ * protected String[] getStringTable()
+ * {
+ * return stringTable;
+ * }
+ *
+ * private static final PrinterState[] enumValueTable = { IDLE,
+ * PROCESSING, STOPPED};
+ *
+ * protected EnumSyntax[] getEnumValueTable()
+ * {
+ * return enumValueTable;
+ * }
+ * }
+ * </pre>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
+ * @author Wolfgang Baer (WBaer@gmx.de)
*/
public abstract class EnumSyntax implements Cloneable, Serializable
{
@@ -51,7 +110,7 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Creates a <code>EnumSyntax</code> object.
*
- * @param value the value to set
+ * @param value the value to set.
*/
protected EnumSyntax(int value)
{
@@ -59,9 +118,9 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
- * Returns the value of this object.
+ * Returns the value of this enumeration object.
*
- * @return the value
+ * @return The value.
*/
public int getValue()
{
@@ -71,7 +130,7 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Clones this object.
*
- * @return a clone of this object
+ * @return A clone of this object.
*/
public Object clone()
{
@@ -87,9 +146,10 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
- * Returns the hashcode for this object.
+ * Returns the hashcode for this object.
+ * The hashcode is the value of this enumeration object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -98,8 +158,11 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Returns the string representation for this object.
+ * The string value from <code>getStringTable()</code> method is returned
+ * if subclasses override this method. Otherwise the value of this object
+ * as a string is returned.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
@@ -118,9 +181,10 @@ public abstract class EnumSyntax implements Cloneable, Serializable
* Returns a table with the enumeration values represented as strings
* for this object.
*
- * The default implementation just returns null.
+ * The default implementation just returns null. Subclasses should
+ * override this method.
*
- * @return the enumeration values as strings
+ * @return The enumeration values as strings.
*/
protected String[] getStringTable()
{
@@ -128,17 +192,49 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
+ * Needed for singelton semantics during deserialisation.
+ *
+ * Subclasses must not override this class. Subclasses have to override
+ * <code>getEnumValueTable()</code> and should override
+ * <code>getStringTable()</code> for correct serialization.
+ *
+ * @return The Object at index <code>value - getOffset()</code>
+ * in getEnumValueTable.
+ * @throws ObjectStreamException if getEnumValueTable() returns null.
+ */
+ protected Object readResolve() throws ObjectStreamException
+ {
+ EnumSyntax[] table = getEnumValueTable();
+ if (table == null)
+ throw new InvalidObjectException("Null enumeration value table "
+ + "for class "
+ + this.getClass().toString());
+
+ return table[value - getOffset()];
+ }
+
+ /**
* Returns a table with the enumeration values for this object.
*
- * The default implementation just returns null.
+ * The default implementation just returns null. Subclasses have to
+ * to override this method for serialization.
*
- * @return the enumeration values
+ * @return The enumeration values.
*/
protected EnumSyntax[] getEnumValueTable()
{
return null;
}
+ /**
+ * Returns the lowest used value by the enumerations of this class.
+ *
+ * The default implementation returns 0. This is enough if enumerations
+ * start with a zero value. Otherwise subclasses need to override this
+ * method for serialization and return the lowest value they use.
+ * .
+ * @return The lowest used value used.
+ */
protected int getOffset()
{
return 0;
diff --git a/libjava/classpath/javax/print/attribute/HashAttributeSet.java b/libjava/classpath/javax/print/attribute/HashAttributeSet.java
index c5fbe5ea88a..0db81bae540 100644
--- a/libjava/classpath/javax/print/attribute/HashAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashAttributeSet.java
@@ -1,5 +1,5 @@
/* HashAttributeSet.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,10 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
+/**
+ * <code>HashAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.AttributeSet}.
+ */
public class HashAttributeSet implements AttributeSet, Serializable
{
private static final long serialVersionUID = 5311560590283707917L;
@@ -73,9 +77,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
* Creates a <code>HashAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException If attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashAttributeSet(Attribute[] attributes)
{
@@ -83,12 +89,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates a <code>HashAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the set
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
*
- * @exception NullPointerException If attributes is null
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
*/
public HashAttributeSet(AttributeSet attributes)
{
@@ -111,7 +116,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the set.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if attribute is not an interface of
* interfaceName
@@ -128,7 +137,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -138,15 +152,20 @@ public class HashAttributeSet implements AttributeSet, Serializable
{
this(interfaceName);
- if (attributes == null)
- throw new NullPointerException();
-
- for (int index = 0; index < attributes.length; index++)
- addInternal(attributes[index], interfaceName);
+ if (attributes != null)
+ {
+ for (int index = 0; index < attributes.length; index++)
+ addInternal(attributes[index], interfaceName);
+ }
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -160,15 +179,16 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Adds the given attribute to the set.
- *
- * @param attribute the attribute to add
- *
- * @return true if the attribute set has changed, false otherwise
- *
- * @exception NullPointerException if attribute is null
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean add(Attribute attribute)
{
@@ -190,14 +210,13 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Adds the given attributes to the set.
- *
- * @param attributes the attributes to add
- *
- * @return true if the attribute set has changed, false otherwise
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
public boolean addAll(AttributeSet attributes)
{
@@ -218,9 +237,8 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Removes all attributes from this attribute set.
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public void clear()
{
@@ -228,11 +246,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Checks if this attribute set contains an entry with the given category.
- *
- * @param category the category to test for
- *
- * @return true if the category exists in this attribute set, false otherwise.
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
*/
public boolean containsKey(Class category)
{
@@ -240,12 +259,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Checks if this attribute set contains an entry with the given attribute.
- *
- * @param attribute the attribute to test for
- *
- * @return true if the attribute exists in this attribute set,
- * false otherwise.
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
*/
public boolean containsValue(Attribute attribute)
{
@@ -253,11 +271,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Tests of obj is equal to this object.
- *
- * @param obj the object to test
- *
- * @return true if both objects are equal, false otherwise.
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
*/
public boolean equals(Object obj)
{
@@ -268,33 +287,45 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Returns the attribute value that is connected to the given attribute
- * category. If the attribute set does not contains the given category null
- * will be returned.
- *
- * @param category the attribute category to return the attribute value for
- *
- * @return the attribute associated to category, or null
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
*/
public Attribute get(Class category)
{
+ if (category == null)
+ throw new NullPointerException("category may not be null");
+
return (Attribute) attributeMap.get(category);
}
/**
- * Returns the hashcode for this object.
- *
- * @return the hashcode
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
*/
public int hashCode()
{
- return attributeMap.hashCode() + interfaceName.hashCode();
+ int hashcode = 0;
+ Iterator it = attributeMap.values().iterator();
+ while (it.hasNext())
+ hashcode = hashcode + it.next().hashCode();
+
+ return hashcode;
}
/**
* Checks if the attribute set is empty.
*
- * @return true if the attribute set is empty, false otherwise
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
*/
public boolean isEmpty()
{
@@ -302,14 +333,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Removes the entry with the given attribute in it.
- *
- * @param attribute the attribute value of the entry to be removed
- *
- * @return true if the attribute set has changed, false otherwise.
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean remove(Attribute attribute)
{
@@ -320,11 +349,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Removes the entry with the given category in it.
- *
- * @param category the category value of the entry to be removed
- *
- * @return true if the attribute set has changed, false otherwise.
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean remove(Class category)
{
@@ -337,7 +367,7 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Returns the number of elements in this attribute set.
*
- * @return the number of elements.
+ * @return The number of elements.
*/
public int size()
{
@@ -347,12 +377,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Returns the content of the attribute set as an array
*
- * @return an array of attributes
+ * @return An array of attributes.
*/
public Attribute[] toArray()
{
int index = 0;
- Iterator it = attributeMap.entrySet().iterator();
+ Iterator it = attributeMap.values().iterator();
Attribute[] array = new Attribute[size()];
while (it.hasNext())
diff --git a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
index 1647ae2f999..2317db3bc1e 100644
--- a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
@@ -1,5 +1,5 @@
/* HashDocAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashDocAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.DocAttributeSet}.
+ */
public class HashDocAttributeSet extends HashAttributeSet
implements DocAttributeSet, Serializable
{
@@ -56,7 +60,7 @@ public class HashDocAttributeSet extends HashAttributeSet
* Creates a <code>HashDocAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashDocAttributeSet extends HashAttributeSet
* Creates a <code>HashDocAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashDocAttributeSet(DocAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashDocAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashDocAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashDocAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>DocAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
index 84fa7ec5d6a..ac4c902c332 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintJobAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintJobAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ */
public class HashPrintJobAttributeSet extends HashAttributeSet
implements Serializable, PrintJobAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintJobAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintJobAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintJobAttributeSet(PrintJobAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintJobAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintJobAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintJobAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
index 29a17861f7b..e74c0e00fbe 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintRequestAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintRequestAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ */
public class HashPrintRequestAttributeSet extends HashAttributeSet
implements Serializable, PrintRequestAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintRequestAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintRequestAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintRequestAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintRequestAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintRequestAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
index 60e12bff0d1..155514f2b01 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintServiceAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintServiceAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ */
public class HashPrintServiceAttributeSet extends HashAttributeSet
implements Serializable, PrintServiceAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintServiceAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintServiceAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintServiceAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintServiceAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintServiceAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/IntegerSyntax.java b/libjava/classpath/javax/print/attribute/IntegerSyntax.java
index d5500b4ca8a..c2f9224a2a2 100644
--- a/libjava/classpath/javax/print/attribute/IntegerSyntax.java
+++ b/libjava/classpath/javax/print/attribute/IntegerSyntax.java
@@ -1,5 +1,5 @@
/* IntegerSyntax.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,10 @@ package javax.print.attribute;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * <code>IntegerSyntax</code> is the abstract base class of all attribute
+ * classes having an integer as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class IntegerSyntax implements Cloneable, Serializable
{
@@ -49,7 +52,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Creates a <code>IntegerSyntax</code> with the given value.
*
- * @param value the value to set
+ * @param value the integer to set
*/
protected IntegerSyntax(int value)
{
@@ -57,9 +60,10 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
}
/**
- * Creates a <code>IntegerSyntax</code> with the given arguments.
+ * Creates a <code>IntegerSyntax</code> with the given integer value
+ * and checks if the value lies inside the given bounds..
*
- * @param value the value to set
+ * @param value the integer to set
* @param lowerBound the lower bound for the value
* @param upperBound the upper bound for the value
*
@@ -78,7 +82,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the value of this object.
*
- * @return the value
+ * @return The integer value.
*/
public int getValue()
{
@@ -86,11 +90,12 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
}
/**
- * Tests of obj is equal to this object.
+ * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
- * @return true if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -103,7 +108,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -113,7 +118,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the string representation for this object.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
index ba3a737b523..fd3663496c8 100644
--- a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
@@ -1,5 +1,5 @@
/* PrintJobAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing attributes or the
+ * status of a ({@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * of a print job.
+ * For example {@link javax.print.attribute.standard.DateTimeAtProcessing}
+ * is used to report at which date and time a job has started processing.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintJobAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
index 905d53c2d71..6283ae14276 100644
--- a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintJobAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintJobAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintJobAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
index 756350020d2..8a05b75d3cd 100644
--- a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
@@ -1,5 +1,5 @@
/* PrintRequestAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,18 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes which specify a requested
+ * attribute of {@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintRequestAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintRequestAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
index d72d2d71c47..350d9a644da 100644
--- a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintRequestAttributeSet.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintRequestAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintRequestAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintRequestAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintRequestAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
index 3cf8825f560..213f43796bb 100644
--- a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
@@ -1,5 +1,5 @@
/* PrintServiceAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing parameters
+ * or the status of a {@link javax.print.PrintService}.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * or the specific capabilities of itself.
+ * For example {@link javax.print.attribute.standard.PagesPerMinute} is used
+ * to specify the average printable pages per minute of the print service.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintServiceAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
index d67c9af55f0..fa22ee0d922 100644
--- a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintServiceAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintServiceAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintServiceAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
index d73b867d5f6..3990b66c50a 100644
--- a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
+++ b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package javax.print.attribute;
import java.io.Serializable;
-import java.util.Vector;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
/**
* @author Michael Koch
@@ -50,33 +54,41 @@ public abstract class SetOfIntegerSyntax
private int[][] members;
- private static int[][] normalize(Vector vecMembers)
+ private static int[][] normalize(int[][] values, int size)
{
- // XXX: Perhaps we should merge ranges that overlap.
-
- int current = 0;
- int[][] members = new int[vecMembers.size()][];
+ // Sort into increasing order. First the first index is
+ // compared, then the second.
+ Arrays.sort(values, 0, size, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ int[] v1 = (int[]) o1;
+ int[] v2 = (int[]) o2;
+ if (v1[0] == v2[0])
+ return v1[1] - v2[1];
+ return v1[0] - v2[0];
+ }
+ });
- while (vecMembers.size() > 0)
+ // Now coalesce overlapping ranges.
+ int outIndex = 0;
+ for (int i = 0; i < size; ++i)
{
- // Search the lowest range.
- int[] range = (int[]) vecMembers.elementAt(0);
-
- for (int index = 1; index < vecMembers.size(); index++)
+ // Note that we compare with values[i][1]+1, since
+ // we can coalesce {0,1} with {2,x}.
+ int save = i;
+ while (i + 1 < size && values[i + 1][0] <= values[i][1] + 1)
{
- int[] tmp = (int[]) vecMembers.elementAt(index);
-
- if (range[0] > tmp[0]
- || (range[0] == tmp[0]
- && range[0] > tmp[0]))
- range = tmp;
+ values[i][1] = Math.max(values[i][1], values[i + 1][1]);
+ ++i;
}
-
- members[current] = range;
- current++;
+ values[outIndex++] = values[save];
}
- return members;
+ int[][] result = new int[outIndex][];
+ System.arraycopy(values, 0, result, 0, outIndex);
+
+ return result;
}
/**
@@ -104,10 +116,13 @@ public abstract class SetOfIntegerSyntax
*/
protected SetOfIntegerSyntax(int[][] members)
{
- Vector vecMembers = new Vector();
-
- if (members != null)
+ int[][] newMembers;
+ int outIndex = 0;
+ if (members == null)
+ newMembers = new int[0][];
+ else
{
+ newMembers = new int[members.length][];
for (int index = 0; index < members.length; index++)
{
int lower;
@@ -126,6 +141,7 @@ public abstract class SetOfIntegerSyntax
else
throw new IllegalArgumentException("invalid member element");
+ // We only want to reject non-null ranges where lower<0.
if (lower <= upper && lower < 0)
throw new IllegalArgumentException("invalid member element");
@@ -134,12 +150,81 @@ public abstract class SetOfIntegerSyntax
int[] range = new int[2];
range[0] = lower;
range[1] = upper;
- vecMembers.add(range);
+ newMembers[outIndex++] = range;
}
}
}
- this.members = normalize(vecMembers);
+ this.members = normalize(newMembers, outIndex);
+ }
+
+ private boolean skipWhitespace(StringCharacterIterator i)
+ {
+ while (Character.isWhitespace(i.current()))
+ i.next();
+ return i.current() == CharacterIterator.DONE;
+ }
+
+ private boolean skipNumber(StringCharacterIterator i)
+ {
+ boolean readAny = false;
+ while (Character.isDigit(i.current()))
+ {
+ readAny = true;
+ i.next();
+ }
+ return readAny;
+ }
+
+ protected SetOfIntegerSyntax(String s)
+ {
+ ArrayList vals = new ArrayList();
+
+ StringCharacterIterator it = new StringCharacterIterator(s);
+
+ while (true)
+ {
+ // Skip whitespace.
+ if (skipWhitespace(it))
+ break;
+
+ // Parse integer.
+ int index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ int[] item = new int[2];
+ item[0] = Integer.parseInt(s.substring(index, it.getIndex()));
+
+ if (! skipWhitespace(it))
+ {
+ char c = it.current();
+ if (c == ':' || c == '-')
+ {
+ it.next();
+ if (skipWhitespace(it))
+ throw new IllegalArgumentException();
+ index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ item[1] = Integer.parseInt(s.substring(index, it.getIndex()));
+ }
+ else
+ item[1] = item[0];
+ }
+ else
+ item[1] = item[0];
+
+ if (item[0] <= item[1])
+ vals.add(item);
+
+ if (skipWhitespace(it))
+ break;
+ if (it.current() != ',')
+ throw new IllegalArgumentException();
+ it.next();
+ }
+
+ members = normalize((int[][]) vals.toArray(new int[0][]), vals.size());
}
/**
@@ -153,6 +238,7 @@ public abstract class SetOfIntegerSyntax
*/
protected SetOfIntegerSyntax(int lowerBound, int upperBound)
{
+ // We only want to reject non-null ranges where lower<0.
if (lowerBound <= upperBound
&& lowerBound < 0)
throw new IllegalArgumentException();
@@ -175,7 +261,7 @@ public abstract class SetOfIntegerSyntax
{
if (value < members[index][0])
return false;
- else if (value < members[index][1])
+ else if (value <= members[index][1])
return true;
}
@@ -205,8 +291,16 @@ public abstract class SetOfIntegerSyntax
{
if (! (obj instanceof SetOfIntegerSyntax))
return false;
-
- throw new Error("not implemented");
+ SetOfIntegerSyntax other = (SetOfIntegerSyntax) obj;
+ if (other.members.length != members.length)
+ return false;
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (members[i][0] != other.members[i][0]
+ || members[i][1] != other.members[i][1])
+ return false;
+ }
+ return true;
}
/**
@@ -216,7 +310,7 @@ public abstract class SetOfIntegerSyntax
*/
public int[][] getMembers()
{
- throw new Error("not implemented");
+ return (int[][]) members.clone();
}
/**
@@ -226,11 +320,14 @@ public abstract class SetOfIntegerSyntax
*/
public int hashCode()
{
- throw new Error("not implemented");
+ int result = 0;
+ for (int i = 0; i < members.length; ++i)
+ result += members[i][0] + members[i][1];
+ return result;
}
/**
- * Returns the smallest value that is greater then x.
+ * Returns the smallest value that is greater than x which is in this set.
*
* @param x an integer value
*
@@ -238,7 +335,16 @@ public abstract class SetOfIntegerSyntax
*/
public int next(int x)
{
- throw new Error("not implemented");
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (x >= members[i][1])
+ continue;
+ if (x < members[i][0])
+ return members[i][0];
+ // X is in this range.
+ return x + 1;
+ }
+ return -1;
}
/**
@@ -248,6 +354,18 @@ public abstract class SetOfIntegerSyntax
*/
public String toString()
{
- throw new Error("not implemented");
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (i > 0)
+ sb.append(',');
+ sb.append(members[i][0]);
+ if (members[i][0] != members[i][1])
+ {
+ sb.append('-');
+ sb.append(members[i][1]);
+ }
+ }
+ return sb.toString();
}
}
diff --git a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
index d0f4b65c647..a001e7e91ce 100644
--- a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
+++ b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
@@ -1,5 +1,5 @@
-/* Attribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* SupportedValuesAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,22 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes specifying the
+ * supported/allowed values for another printing attribute class.
+ * <p>
+ * A {@link javax.print.PrintService} instance for example provides
+ * printing attribute classes implementing this interface to indicate
+ * that a specific attribute type is supported and if the supported values.
+ * </p><p>
+ * E.g. a {@link javax.print.attribute.standard.JobPrioritySupported}
+ * instance indicates that the attribute class
+ * {@link javax.print.attribute.standard.JobPriority} is supported and
+ * provides the number of the possible priority levels.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface SupportedValuesAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/URISyntax.java b/libjava/classpath/javax/print/attribute/URISyntax.java
index f0583f7e53c..07deb4b5741 100644
--- a/libjava/classpath/javax/print/attribute/URISyntax.java
+++ b/libjava/classpath/javax/print/attribute/URISyntax.java
@@ -1,5 +1,5 @@
/* URISyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,10 @@ import java.io.Serializable;
import java.net.URI;
/**
- * @author Michael Koch
+ * <code>URISyntax</code> is the abstract base class of all attribute
+ * classes having an Uniform Resource Identifier URI as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class URISyntax
implements Cloneable, Serializable
@@ -66,11 +69,12 @@ public abstract class URISyntax
}
/**
- * Tests of obj is equal to this object.
+ * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
- * @returns true if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -83,7 +87,7 @@ public abstract class URISyntax
/**
* Returns the URI value of this syntax object.
*
- * @return the URI
+ * @return The URI.
*/
public URI getURI()
{
@@ -93,7 +97,7 @@ public abstract class URISyntax
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -103,7 +107,7 @@ public abstract class URISyntax
/**
* Returns the string representation for this object.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
index 678531769a5..ed1687c4cba 100644
--- a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
+++ b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
@@ -1,5 +1,5 @@
-/* Attribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* UnmodifiableSetException.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,14 @@ 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.print.attribute;
/**
- * @author Michael Koch
+ * Exception which is thrown if an operation on an unmodifiable set
+ * is invoked.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*
* @since 1.4
*/
@@ -56,7 +60,7 @@ public class UnmodifiableSetException extends RuntimeException
* Creates a <code>UnmodifiableSetException</code>
* with the given message.
*
- * @param message the message for the exception
+ * @param message the message of the exception
*/
public UnmodifiableSetException(String message)
{
diff --git a/libjava/classpath/javax/print/attribute/package.html b/libjava/classpath/javax/print/attribute/package.html
index ba67d1a79d6..37f24d56b47 100644
--- a/libjava/classpath/javax/print/attribute/package.html
+++ b/libjava/classpath/javax/print/attribute/package.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in javax.print.attribute package.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,10 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.print.attribute</title></head>
<body>
-<p></p>
-
+<p>Provides classes and interfaces describing the roles and
+syntax of attribute objects in the Java Print Service API.</p>
+<p>
+<b>Since:</b> 1.4
+</p>
</body>
</html>
diff --git a/libjava/classpath/javax/print/event/PrintEvent.java b/libjava/classpath/javax/print/event/PrintEvent.java
index cbf93852cc5..d44c2066818 100644
--- a/libjava/classpath/javax/print/event/PrintEvent.java
+++ b/libjava/classpath/javax/print/event/PrintEvent.java
@@ -1,5 +1,5 @@
/* PrintEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ import java.util.EventObject;
/**
+ * Superclass of all events in the Java Print Service API.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintEvent extends EventObject
@@ -58,7 +60,7 @@ public class PrintEvent extends EventObject
/**
* Returns a string representation of this object.
*
- * @return the string representation
+ * @return The string representation
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/event/PrintJobAdapter.java b/libjava/classpath/javax/print/event/PrintJobAdapter.java
index 3615108f93a..9229d195fe4 100644
--- a/libjava/classpath/javax/print/event/PrintJobAdapter.java
+++ b/libjava/classpath/javax/print/event/PrintJobAdapter.java
@@ -1,5 +1,5 @@
/* PrintJobAdapter.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,11 @@ package javax.print.event;
/**
+ * Adapter class for implementing {@link javax.print.event.PrintJobListener}
+ * classes. The methods in this class do nothing by default. Subclasses may
+ * only implement the methods for the {@link javax.print.event.PrintJobEvent}s
+ * they are interested in.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public abstract class PrintJobAdapter
@@ -53,10 +58,11 @@ public abstract class PrintJobAdapter
}
/**
- * Called to notify the client that all data has bin successfully transferred
+ * Called to notify the client that all data has been successfully transferred
* to the print service.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printDataTransferCompleted(PrintJobEvent event)
{
@@ -64,9 +70,10 @@ public abstract class PrintJobAdapter
}
/**
- * Called to notify the client that a print job was canceled.
+ * Called to notify the client that a print job was canceled.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobCanceled(PrintJobEvent event)
{
@@ -75,8 +82,9 @@ public abstract class PrintJobAdapter
/**
* Called to notify the client that a print job was successfully completed.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobCompleted(PrintJobEvent event)
{
@@ -86,8 +94,9 @@ public abstract class PrintJobAdapter
/**
* Called to notify the client that a print job failed to complete
* successfully.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobFailed(PrintJobEvent event)
{
@@ -96,8 +105,9 @@ public abstract class PrintJobAdapter
/**
* Called to notify the client that no more job events will be send.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobNoMoreEvents(PrintJobEvent event)
{
@@ -105,10 +115,12 @@ public abstract class PrintJobAdapter
}
/**
- * Called to notify the client that a problem occured during printing
- * but the user may be able to fix it.
+ * Called to notify the client that a problem occured during printing.
+ * This event signals problems a user might be able to fix
+ * (e.g. out of paper or paper jam).
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobRequiresAttention(PrintJobEvent event)
{
diff --git a/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java b/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java
index 0914aea9f4b..d401ab15152 100644
--- a/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java
+++ b/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,10 @@ import javax.print.attribute.PrintJobAttributeSet;
/**
+ * <code>PrintJobAttributeEvent</code>s are generated by a
+ * <code>PrintService</code> to inform registered listeners that attributes
+ * associated with a {@link javax.print.DocPrintJob} instance have changed.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintJobAttributeEvent extends PrintEvent
@@ -66,7 +70,7 @@ public class PrintJobAttributeEvent extends PrintEvent
/**
* Returns the print job generating this event.
*
- * @return the print job
+ * @return The print job.
*/
public DocPrintJob getPrintJob()
{
@@ -76,7 +80,7 @@ public class PrintJobAttributeEvent extends PrintEvent
/**
* Returns the attributes that changed and their new values.
*
- * @return the changes attributes
+ * @return The changed attributes.
*/
public PrintJobAttributeSet getAttributes()
{
diff --git a/libjava/classpath/javax/print/event/PrintJobAttributeListener.java b/libjava/classpath/javax/print/event/PrintJobAttributeListener.java
index ee816d22a1c..9f96d267e9c 100644
--- a/libjava/classpath/javax/print/event/PrintJobAttributeListener.java
+++ b/libjava/classpath/javax/print/event/PrintJobAttributeListener.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.event;
/**
+ * Listener interface to receive attribute changes from a print job.
+ * Implementations of this interface can be registered with a
+ * {@link javax.print.DocPrintJob} instance.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttributeListener
diff --git a/libjava/classpath/javax/print/event/PrintJobEvent.java b/libjava/classpath/javax/print/event/PrintJobEvent.java
index c4b7cd6f942..cc15f97535b 100644
--- a/libjava/classpath/javax/print/event/PrintJobEvent.java
+++ b/libjava/classpath/javax/print/event/PrintJobEvent.java
@@ -1,5 +1,5 @@
/* PrintEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,19 +41,38 @@ import javax.print.DocPrintJob;
/**
+ * <code>PrintJobEvent</code>s are generated by a print job during
+ * print job processing to inform registered listeners about the state
+ * of processing.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintJobEvent extends PrintEvent
{
private static final long serialVersionUID = -1711656903622072997L;
-
+
+ /** Indicates that the data transfer to the print service has completed. */
public static final int DATA_TRANSFER_COMPLETE = 106;
+
+ /** Indicates that the print job was canceled. */
public static final int JOB_CANCELED = 101;
+
+ /** Indicates that the print job was completed (=printed). */
public static final int JOB_COMPLETE = 102;
+
+ /** Indicates that the print job failed to complete. */
public static final int JOB_FAILED = 103;
+
+ /** Indicates that no more job events will be send.*/
public static final int NO_MORE_EVENTS = 105;
+
+ /**
+ * Indicates a situation where human intervention might be needed.
+ * E.g. the printer run out of paper or a paper jam occured.
+ */
public static final int REQUIRES_ATTENTION = 104;
+ /** The reason (one of the defined constants). */
private int reason;
/**
@@ -71,7 +90,7 @@ public class PrintJobEvent extends PrintEvent
/**
* Returns the reason for this event.
*
- * @return the reason
+ * @return The reason.
*/
public int getPrintEventType()
{
@@ -81,7 +100,7 @@ public class PrintJobEvent extends PrintEvent
/**
* Returns the print job that generated this event.
*
- * @return the print job
+ * @return The print job.
*/
public DocPrintJob getPrintJob()
{
diff --git a/libjava/classpath/javax/print/event/PrintJobListener.java b/libjava/classpath/javax/print/event/PrintJobListener.java
index d1dcf42be71..96c6d411d54 100644
--- a/libjava/classpath/javax/print/event/PrintJobListener.java
+++ b/libjava/classpath/javax/print/event/PrintJobListener.java
@@ -1,5 +1,5 @@
/* PrintJobListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,14 @@ package javax.print.event;
/**
- * @author Michael Koch (konqueror@gmx.de) */
+ * Listener interface to receive processing events from a print job.
+ * Implementations of this interface can be registered with a
+ * {@link javax.print.DocPrintJob} instance.
+ *
+ * @see javax.print.event.PrintJobAdapter
+ *
+ * @author Michael Koch (konqueror@gmx.de)
+ */
public interface PrintJobListener
{
/**
@@ -79,7 +86,9 @@ public interface PrintJobListener
void printJobNoMoreEvents(PrintJobEvent event);
/**
- * Notifies the listener that an error occured and the user might be able to fix it.
+ * Notifies the listener that a problem occured during printing.
+ * This event signals problems a user might be able to fix
+ * (e.g. out of paper or paper jam).
*
* @param event the event
*/
diff --git a/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java b/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java
index d3981747fa8..a41e213ff7b 100644
--- a/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java
+++ b/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,10 @@ import javax.print.attribute.PrintServiceAttributeSet;
/**
+ * <code>PrintServiceAttributeEvent</code>s are generated by a
+ * <code>PrintService</code> to inform registered listeners that
+ * its associated attributes have changed.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintServiceAttributeEvent extends PrintEvent
@@ -64,7 +68,7 @@ public class PrintServiceAttributeEvent extends PrintEvent
/**
* Returns the print service that generated this event.
*
- * @return the print service
+ * @return The print service.
*/
public PrintService getPrintService()
{
@@ -74,7 +78,7 @@ public class PrintServiceAttributeEvent extends PrintEvent
/**
* Returns the changed attributes this event reports.
*
- * @return the changed attributes
+ * @return The changed attributes.
*/
public PrintServiceAttributeSet getAttributes()
{
diff --git a/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java b/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java
index e43d9ad65ee..b46bf3b69d7 100644
--- a/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java
+++ b/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.event;
/**
+ * Listener interface to receive attribute changes from a print service.
+ * Implementations of this interface can be registered with a
+ * {@link javax.print.PrintService} instance.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttributeListener
diff --git a/libjava/classpath/javax/print/event/package.html b/libjava/classpath/javax/print/event/package.html
index 52a298a68da..f811013d10d 100644
--- a/libjava/classpath/javax/print/event/package.html
+++ b/libjava/classpath/javax/print/event/package.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in javax.print.event package.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,9 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.print.event</title></head>
<body>
-<p></p>
-
+<p>Provides events and listeners to be used with the Java Print Service API.</p>
+<p>
+<b>Since:</b> 1.4
+</p>
</body>
</html>
diff --git a/libjava/classpath/javax/rmi/BAD_OPERATION.java b/libjava/classpath/javax/rmi/BAD_OPERATION.java
deleted file mode 100644
index 36081a47c57..00000000000
--- a/libjava/classpath/javax/rmi/BAD_OPERATION.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package javax.rmi;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class BAD_OPERATION extends Exception { }
diff --git a/libjava/classpath/javax/rmi/CORBA/ClassDesc.java b/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
index 01befa49339..c8b38ead095 100644
--- a/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
+++ b/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
@@ -1,5 +1,5 @@
-/* ClassDesc.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* ClassDesc.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,16 +40,27 @@ package javax.rmi.CORBA;
import java.io.Serializable;
-public class ClassDesc
- implements Serializable
+/**
+ * This class is used to marshal java.lang.Class objects over IIOP.
+ * When used as a parameter type, return type, or data member, the Java Class
+ * is mapped to the OMG IDL type ::javax::rmi::CORBA::ClassDesc.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class ClassDesc implements Serializable
{
- /*
- * The following is serialized form required by Java API Doc
+ /**
+ * Use serialVersionUID (V1.4) for interoperability.
*/
- private String repid;
- private String codebase;
+ private static final long serialVersionUID = -3477057297839810709L;
+
+ /**
+ * The class repository Id.
+ */
+ String repid;
- public ClassDesc()
- {
- }
+ /**
+ * Space separeted list of URL's from where the code can be downloaded.
+ */
+ String codebase;
}
diff --git a/libjava/classpath/javax/rmi/CORBA/ObjectImpl.java b/libjava/classpath/javax/rmi/CORBA/ObjectImpl.java
deleted file mode 100644
index d76d673cede..00000000000
--- a/libjava/classpath/javax/rmi/CORBA/ObjectImpl.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package javax.rmi.CORBA;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class ObjectImpl
-{
- public ObjectImpl _orb() { return null; }
- public String object_to_string(ObjectImpl o)
- throws javax.rmi.BAD_OPERATION { return null; }
-}
diff --git a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
index 9ae45a33d04..2849707632b 100644
--- a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
@@ -1,5 +1,5 @@
/* PortableRemoteObjectDelegate.java -- Interface supporting PortableRemoteObject
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,23 +43,95 @@ import java.rmi.Remote;
import java.rmi.RemoteException;
/**
- * A delegate is a singleton class that support delegation for method
- * implementation in PortableRemoteObject.
+ * A delegate, implementing the functionality, provided by the
+ * {@link PortableRemoteObject}.
+ *
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of the alternative
+ * class that must implement {@link PortableRemoteObjectDelegate}.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public interface PortableRemoteObjectDelegate
{
+ /**
+ * <p>
+ * Makes the remote object <code>target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>source</code> parameter. Connection normally happens implicitly
+ * when the object is sent or received as an argument on a remote method call.
+ * </p>
+ * <p>
+ * The target object is connected to the same ORB as source by calling the
+ * {@link Stub#connect} if it is a stub or by associating its tie with an ORB
+ * if it is an implementation object.
+ * </p>
+ *
+ * @param target the target object that may be either an RMI/IDL stub or an
+ * exported RMI/IDL implementation object
+ * @param source the source object may also be either an RMI/IDL stub or an
+ * exported RMI/IDL implementation object.
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
void connect(Remote target, Remote source)
throws RemoteException;
-
+
+ /**
+ * Register the passed object with the ORB runtimes, making it remotely
+ * accessible. When called on jre with no objects exported, creates a
+ * non-daemon thread that prevents jre from terminating until all objects are
+ * unexported. Also, such object cannot be collected by garbage collector.
+ * This is usually impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to export.
+ *
+ * @throws RemoteException
+ */
void exportObject(Remote obj)
throws RemoteException;
+ /**
+ * Narrows the passed object to conform to the given interface or IDL type.
+ * This method may return different instance and cannot be replaced by the
+ * direct cast.
+ *
+ * @param narrowFrom an object to narrow.
+ * @param narrowTo a type to that the object must be narrowed.
+ *
+ * @return On success, an object of type narrowTo or null, if narrowFrom =
+ * null.
+ *
+ * @throws ClassCastException if no narrowing is possible.
+ */
Object narrow(Object narrowFrom, Class narrowTo)
throws ClassCastException;
-
+
+ /**
+ * Takes a server implementation object and returns a stub object that can be
+ * used to access that server object (target). If the target is connected, the
+ * returned stub is also connected to the same ORB. If the target is
+ * unconnected, the returned stub is unconnected.
+ *
+ * @param target a server side object.
+ * @return a stub object that can be used to access that server object.
+ *
+ * @throws NoSuchObjectException if a stub cannot be located for the given
+ * target.
+ */
Remote toStub(Remote obj)
throws NoSuchObjectException;
-
+
+ /**
+ * Deregister a currently exported server object from the ORB runtimes. The
+ * object to becomes available for garbage collection. This is usually
+ * impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to unexport.
+ *
+ * @throws NoSuchObjectException if the passed object is not currently
+ * exported.
+ */
void unexportObject(Remote obj)
throws NoSuchObjectException;
}
diff --git a/libjava/classpath/javax/rmi/CORBA/Stub.java b/libjava/classpath/javax/rmi/CORBA/Stub.java
index a35a08fa9d3..190b10dad57 100644
--- a/libjava/classpath/javax/rmi/CORBA/Stub.java
+++ b/libjava/classpath/javax/rmi/CORBA/Stub.java
@@ -1,5 +1,5 @@
-/* Stub.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Stub.java --
+ Copyright (C) 2004, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ exception statement from your version. */
package javax.rmi.CORBA;
import gnu.javax.rmi.CORBA.DelegateFactory;
-import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
+import gnu.javax.rmi.CORBA.StubDelegateImpl;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -47,7 +47,27 @@ import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.rmi.RemoteException;
-public abstract class Stub extends ObjectImpl
+import javax.rmi.PortableRemoteObject;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+
+/**
+ * A Stub descendants provide access to the object on the client side. This base
+ * class implements methods, required for remote or local invocation using CORBA
+ * mechanisms. The most of the functionality is forwarded to the stub delegate.
+ * This delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.StubClass" to the name of the alternative class that must
+ * implement {@link StubDelegate}. Hence Stub contains two delegates, one for
+ * Stub-related operations and another inherited from the ObjectImpl.
+ *
+ * @specnote GNU Classpath uses separate delegate per each Stub. The delegate
+ * holds information about the ORB and other data, specific for the each Stub.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class Stub
+ extends ObjectImpl
implements Serializable
{
/**
@@ -55,69 +75,129 @@ public abstract class Stub extends ObjectImpl
*/
private static final long serialVersionUID = 1087775603798577179L;
- private transient StubDelegate delegate;
-
- protected Stub()
- {
- try
- {
- delegate = (StubDelegate)DelegateFactory.getInstance("Stub");
- }
- catch(GetDelegateInstanceException e)
- {
- delegate = null;
- }
- }
+ /**
+ * The hashcode, computed once (expensive operation).
+ */
+ transient int m_hash = Integer.MIN_VALUE;
+
+ /**
+ * The stringified reference, computed once (expensive operation).
+ */
+ transient String m_ior;
+
+ /**
+ * The ORB, where the stub is connected on the client side.
+ */
+ transient ORB m_orb;
+ /**
+ * The associated delegate, responsible for the major of the functionality of
+ * this stub.
+ */
+ static StubDelegate delegate = (StubDelegate) DelegateFactory.getInstance(DelegateFactory.STUB);
+
+ /**
+ * Returns the same hashcode for all stubs that point to the same remote
+ * object.
+ */
public int hashCode()
{
- if(delegate != null)
- return delegate.hashCode(this);
- else
- return 0;
+ if (m_hash == Integer.MIN_VALUE)
+ m_hash = delegate.hashCode(this);
+ // This should finally result to the IOR comparison.
+ return m_hash;
}
- public boolean equals(Object obj)
+ /**
+ * The stubs are equal if they point to the same remote object.
+ */
+ public boolean equals(java.lang.Object obj)
{
- if(delegate != null)
- return delegate.equals(this, obj);
- else
- return false;
+ return delegate.equals(this, obj);
}
+ /**
+ * Get the string representation of this Stub.
+ *
+ * @return the CORBA IOR reference.
+ */
public String toString()
{
- String s = null;
- if(delegate != null)
- s = delegate.toString(this);
- if(s == null)
- s = super.toString();
- return s;
+ if (m_ior == null)
+ m_ior = delegate.toString(this);
+ return m_ior;
}
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public void connect(javax.rmi.ORB orb)
+ /**
+ * <p>
+ * Finds the suitable {@link Tie} for this Stub and connects it to the given
+ * ORB. The tie is found by the name pattern. If the found tie is derived from
+ * {@link org.omg.CORBA.PortableServer.Servant}, it is connected to the root
+ * POA, also activating it (if not already active).
+ * </p>
+ * <p>
+ * This method does not allow to specify, to which POA the found Tie must be
+ * connected and requires to use the deprecated method {@link ORB#connect}.
+ * Many useful POA features remain unaccessible. A better alternative it might
+ * be to generate a {@link org.omg.CORBA.PortableServer.Servant} - derived Tie
+ * (-poa key in rmic) and connect it to POA in one of the many ways, listed in
+ * the description of the {@link orb.omg.PortableServer} package). The
+ * obtained CORBA object can be narrowed into stub using
+ * {@link PortableRemoteObject#narrow}.
+ * </p>
+ * <p>
+ * It is frequently easier to call {@link PortableRemoteObject#connect} rather
+ * than this method.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ *
+ * @throws BAD_PARAM if the name of this stub does not match the stub name
+ * pattern, "_*_Stub" or if the Tie class, "_*Impl_Tie", does not exists or an
+ * instance of this class cannot be instantiated.
+ */
+ public void connect(ORB orb)
throws RemoteException
{
- if(delegate != null)
- delegate.connect(this, orb);
+ if (m_orb != null && orb != null)
+ {
+ if (m_orb.equals(orb))
+ throw new RemoteException("Stub " + this
+ + " is connected to another ORB, " + orb);
+ else
+ return;
+ }
+ m_orb = orb;
+ delegate.connect(this, orb);
}
/**
- * The following two routines are required by serialized form of Java API doc.
+ * Required by serialized form of Java API doc.
*/
- private void readObject(ObjectInputStream stream)
+ private void readObject(ObjectInputStream input)
throws IOException, ClassNotFoundException
{
- if(delegate != null)
- delegate.readObject(this, stream);
+ if (delegate instanceof StubDelegateImpl)
+ ((StubDelegateImpl) delegate).readObject(this, input, m_orb);
+ else
+ delegate.readObject(this, input);
}
- private void writeObject(ObjectOutputStream stream)
+ /**
+ * Required by serialized form of Java API doc.
+ */
+ private void writeObject(ObjectOutputStream output)
throws IOException
{
- if(delegate != null)
- delegate.writeObject(this, stream);
- }
+ // The m_orb in this case may be either known or not.
+ if (delegate instanceof StubDelegateImpl)
+ ((StubDelegateImpl) delegate).writeObject(this, output, m_orb);
+ else
-}
+ delegate.writeObject(this, output);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/StubDelegate.java b/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
index 5c00a038f0c..cdf76e841c3 100644
--- a/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
@@ -1,5 +1,5 @@
-/* StubDelegate.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* StubDelegate.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,28 +38,66 @@ exception statement from your version. */
package javax.rmi.CORBA;
+import org.omg.CORBA.ORB;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+
import java.rmi.RemoteException;
-//import org.omg.CORBA.ORB;
+/**
+ * A delegate, implementing the functionality, provided by the {@link Stub}.
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.StubClass" to the name of the alternative class that must
+ * implement StubDelegate.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public interface StubDelegate
{
-
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- void connect(Stub self, javax.rmi.ORB orb)
+ /**
+ * <p>
+ * Makes the stub ready for remote communication using the given ORB.
+ * </p>
+ * <p>
+ * It is frequently easier to call {@link PortableRemoteObject#connect} rather
+ * than this method.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ */
+ void connect(Stub self, ORB orb)
throws RemoteException;
+ /**
+ * The objects stubs are equal if they refer the same remote object.
+ */
boolean equals(Stub self, Object obj);
+ /**
+ * Get the hashcode fo this delegate.
+ */
int hashCode(Stub self);
+ /**
+ * Read this stub from the object input stream.
+ */
void readObject(Stub self, ObjectInputStream s)
throws IOException, ClassNotFoundException;
- String toString(Stub self);
-
+ /**
+ * Write this stub to the object output stream.
+ */
void writeObject(Stub self, ObjectOutputStream s)
throws IOException;
-}
+
+ /**
+ * Get the string representation of this stub.
+ */
+ String toString(Stub self);
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/SystemException.java b/libjava/classpath/javax/rmi/CORBA/SystemException.java
deleted file mode 100644
index f8afdc35e35..00000000000
--- a/libjava/classpath/javax/rmi/CORBA/SystemException.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package javax.rmi.CORBA;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class SystemException extends Exception { }
diff --git a/libjava/classpath/javax/rmi/CORBA/Tie.java b/libjava/classpath/javax/rmi/CORBA/Tie.java
index 4b1984c58e9..b8611838822 100644
--- a/libjava/classpath/javax/rmi/CORBA/Tie.java
+++ b/libjava/classpath/javax/rmi/CORBA/Tie.java
@@ -1,5 +1,5 @@
-/* Tie.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* Tie.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,28 +35,91 @@ 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.rmi.CORBA;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
-//import org.omg.CORBA.ORB;
-//import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.InvokeHandler;
-public interface Tie // XXX extends InvokeHandler
+/**
+ * <p>
+ * A Tie serves as a CORBA Servant or implementation base. It is connected to
+ * the ORB on a server side, providing the implementation of the required
+ * functionality. ORB access this implementation using {@link InvokeHandler}
+ * ._invoke(..). All such calls are finally delegated to the object, returned by
+ * {@link #getTarget()}.
+ * </p>
+ * <p>
+ * Ties are generated from implementations (name pattern *Impl) and have the
+ * name pattern _*Impl_Tie, for instance:<br>
+ * <code>rmic -keep -iiop -poa -always gnu.testlet.java.rmi.Remote.CalculatorImpl</code>
+ * </p>
+ * <p>
+ * Ties should normally be derived from the
+ * {@link org.omg.PortableServer.Servant}. Such ties are generated by
+ * <code>rmic</code> compiler using <code>-poa</code> key. Ties can be also
+ * derived from {@link org.omg.CORBA_2_3.portable.ObjectImpl}.
+ * </p>
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface Tie
+ extends InvokeHandler
{
-
- void deactivate();
-
+ /**
+ * Get the invocation target, where all method calls should be delegated.
+ *
+ * @return the object, implementing methods, defined in the interface being
+ * served by this Tie.
+ */
Remote getTarget();
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- javax.rmi.ORB orb();
-
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- void orb(javax.rmi.ORB orb);
-
+ /**
+ * Set the invocation target, where all method calls should be delegated.
+ *
+ * @param target the object, implementing methods, defined in the interface
+ * being served by this Tie. The code, produced by a typical rmic compiler
+ * usually requires the target to be an instance of the implementation from
+ * that the Tie was generated.
+ *
+ * @throws ClassCastException if the passed parameter is not an instance of
+ * the implementation from that the Tie was generated.
+ */
void setTarget(Remote target);
-
- // XXX Object -> org.omg.CORBA.Object
- Object thisObject();
-}
+
+ /**
+ * Get the ORB to that this Tie is connected.
+ *
+ * @see org.omg.PortableServer.Servant#_orb
+ */
+ ORB orb();
+
+ /**
+ * Connect this Tie to the given ORB.
+ */
+ void orb(ORB orb);
+
+ /**
+ * Get the object that delegates calls to this tie.
+ *
+ * @see org.omg.PortableServer.Servant#_this_object
+ */
+ org.omg.CORBA.Object thisObject();
+
+ /**
+ * Deactivate this Tie. The tie is normally deactivated using POA mechanisms.
+ * Depending on the POA policies, it may be possible to activate the Tie
+ * again. The ties that are not derived from
+ * {@link org.omg.PortableServer.Servant} deactivate themselves by
+ * {@link ORB.disconnect}.
+ *
+ * @throws NoSuchObjectException if there are no objects served by this Tie,
+ * or if the these objects are already deactivated.
+ *
+ * @see org.omg.PortableServer.POA#deactivate_object
+ */
+ void deactivate()
+ throws NoSuchObjectException;
+
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/Util.java b/libjava/classpath/javax/rmi/CORBA/Util.java
index 0370cce83a2..cfd3d7bd686 100644
--- a/libjava/classpath/javax/rmi/CORBA/Util.java
+++ b/libjava/classpath/javax/rmi/CORBA/Util.java
@@ -1,5 +1,5 @@
-/* Util.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Util.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,148 +38,379 @@ exception statement from your version. */
package javax.rmi.CORBA;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
import gnu.javax.rmi.CORBA.DelegateFactory;
-import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
+import java.rmi.server.RMIClassLoader;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+/**
+ * Provides utility methods used by stubs and ties to perform common operations.
+ * The functionality is forwarded to the enclosed UtilDelegate. This delegate
+ * can be altered by setting the system property "javax.rmi.CORBA.UtilClass" to
+ * the name of the alternative class that must implement {@link UtilDelegate}.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public class Util
{
+ /**
+ * The delegate, responsible for all functionality.
+ */
+ static UtilDelegate delegate = (UtilDelegate) DelegateFactory.getInstance(DelegateFactory.UTIL);
- private static UtilDelegate delegate;
- static
- {
- try
- {
- delegate = (UtilDelegate)DelegateFactory.getInstance("Util");
- }
- catch(GetDelegateInstanceException e)
- {
- delegate = null;
- }
- }
-
+ /**
+ * Prevents this class from being instantiated.
+ */
private Util()
{
}
- // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
- public static Object copyObject(Object obj, javax.rmi.ORB orb)
+ /**
+ * Used by local stubs to create a copy of the object. The object must be
+ * Serializable for this operation to succeed. Strings are not copied and
+ * 1D-3D string arrays are only cloned.
+ */
+ public static java.lang.Object copyObject(java.lang.Object object, ORB orb)
throws RemoteException
{
- if(delegate != null)
- return delegate.copyObject(obj, orb);
- else
- return null;
+ return delegate.copyObject(object, orb);
}
- // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
- public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb)
+ /**
+ * Used by local stubs to create a multiple copies of the object, preserving
+ * sharing accross the parameters if necessary.
+ */
+ public static java.lang.Object[] copyObjects(java.lang.Object[] object,
+ ORB orb)
throws RemoteException
{
- if(delegate != null)
- return delegate.copyObjects(obj, orb);
- else
- return null;
+ return delegate.copyObjects(object, orb);
}
-
+
+ /**
+ * Get the value handler that Serializes Java objects to and from CDR (GIOP)
+ * streams.
+ *
+ * When using the default Util implementation, the class of the returned
+ * handler can be altered by setting by setting the system property
+ * "javax.rmi.CORBA.ValueHandlerClass" to the name of the alternative class
+ * that must implement {@link ValueHandler}.
+ */
public static ValueHandler createValueHandler()
{
- if(delegate != null)
- return delegate.createValueHandler();
- else
- return null;
+ return delegate.createValueHandler();
}
-
+
+ /**
+ * This call is finally delegated to {@link RMIClassLoader#getClassAnnotation};
+ */
public static String getCodebase(Class clz)
{
- if(delegate != null)
- return delegate.getCodebase(clz);
- else
- return null;
+ return delegate.getCodebase(clz);
}
-
+
+ /**
+ * Get the Tie that handles invocations on the given target. If the target/Tie
+ * pair has not been previously registered using {@link #registerTarget},
+ * this method tries to locate a tie class by the name pattern. If this
+ * succeeds, the tie-target pair is also registered.
+ *
+ * @return the Tie.
+ */
public static Tie getTie(Remote target)
{
- if(delegate != null)
- return delegate.getTie(target);
- else
- return null;
+ return delegate.getTie(target);
}
+ /**
+ * Checks if the given stub is local. The implementation it delegates call to
+ * {@link ObjectImpl#_is_local().
+ *
+ * @param stub a stub to check.
+ * @return true if the stub is local, false otherwise.
+ *
+ * @throws RemoteException if the {@link ObjectImpl#_is_local()} throws a
+ * {@link org.omg.CORBA.SystemException}.
+ */
public static boolean isLocal(Stub stub)
throws RemoteException
{
- if(delegate != null)
- return delegate.isLocal(stub);
- else
- return false;
+ return delegate.isLocal(stub);
}
- public static Class loadClass(String className, String remoteCodebase, ClassLoader loader)
+ /**
+ * Load the class. The method uses class loaders from the call stact first. If
+ * this fails, the further behaviour depends on the System Property
+ * "java.rmi.server.useCodebaseOnly" with default value "false".
+ *
+ * <ul>
+ * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
+ * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
+ * <li> If remoteCodebase is null or useCodebaseOnly is true then call
+ * java.rmi.server.RMIClassLoader.loadClass(className)</li>
+ * <li>If a class is still not successfully loaded and the loader != null
+ * then try Class.forName(className, false, loader). </li>
+ * </ul>
+ *
+ * @param className the name of the class.
+ * @param remoteCodebase the codebase.
+ * @param loader the class loader.
+ * @return the loaded class.
+ *
+ * @throws ClassNotFoundException of the class cannot be loaded.
+ */
+ public static Class loadClass(String className, String remoteCodebase,
+ ClassLoader loader)
throws ClassNotFoundException
{
- if(delegate != null)
- return delegate.loadClass(className, remoteCodebase, loader);
- else
- throw new ClassNotFoundException(className + ": delegate == null");
- }
-
- public static RemoteException mapSystemException(SystemException ex)
- {
- if(delegate != null)
- return delegate.mapSystemException(ex);
- else
- return null;
+ return delegate.loadClass(className, remoteCodebase, loader);
}
- public static Object readAny(InputStream in)
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * The subsequent content is not part of the official RMI-IIOP standart and is
+ * added for compatibility with Sun's implementation:
+ * <ol>
+ * <li>the phrase "<code>; nested exception is: <i>(line feed)(tab)</i></code>"</li>
+ * <li>the full name of the mapped SystemException, as returned by
+ * Class.getName().</li>
+ * <li>the ": ".
+ * <li>the value, returned by .getMessage() of the passed parameter.</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p><p>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p><p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
+ public static RemoteException mapSystemException(SystemException ex)
{
- if(delegate != null)
- return delegate.readAny(in);
- else
- return null;
+ return delegate.mapSystemException(ex);
}
+ /**
+ * Register the Tie-target pair. As the Tie is a Servant, it can potentially
+ * be connected to several objects and hence may be registered with several
+ * targets.
+ */
public static void registerTarget(Tie tie, Remote target)
{
- if(delegate != null)
- delegate.registerTarget(tie, target);
+ delegate.registerTarget(tie, target);
}
-
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets. Independing from the POA policies, the transparent
+ * reactivation will not be possible.
+ */
public static void unexportObject(Remote target)
+ throws NoSuchObjectException
{
- if(delegate != null)
- delegate.unexportObject(target);
+ delegate.unexportObject(target);
}
-
- public static RemoteException wrapException(Throwable orig)
+
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param ex an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
+ public static RemoteException wrapException(Throwable exception)
{
- if(delegate != null)
- return delegate.wrapException(orig);
- else
- return null;
+ return delegate.wrapException(exception);
}
-
- public static void writeAbstractObject(OutputStream out, Object obj)
+
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ public static void writeAbstractObject(OutputStream output,
+ java.lang.Object object)
{
- if(delegate != null)
- delegate.writeAbstractObject(out, obj);
+ delegate.writeAbstractObject(output, object);
}
-
- public static void writeAny(OutputStream out, Object obj)
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ public static void writeAny(OutputStream output, java.lang.Object object)
{
- if(delegate != null)
- delegate.writeAny(out, obj);
+ delegate.writeAny(output, object);
}
-
- public static void writeRemoteObject(OutputStream out, Object obj)
+
+ /**
+ * Read Any from the input stream.
+ */
+ public static java.lang.Object readAny(InputStream input)
{
- if(delegate != null)
- delegate.writeRemoteObject(out, obj);
+ return delegate.readAny(input);
}
-}
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible (the ORB is started and activated, if required). This method is
+ * used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public static void writeRemoteObject(OutputStream output,
+ java.lang.Object object)
+ {
+ delegate.writeRemoteObject(output, object);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
index deeb94f68b5..cacb925810b 100644
--- a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
@@ -1,5 +1,5 @@
-/* UtilDelegate.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* UtilDelegate.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,48 +38,273 @@ exception statement from your version. */
package javax.rmi.CORBA;
-import java.io.InputStream;
-import java.io.OutputStream;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
-//import org.omg.CORBA.ORB;
-//import org.omg.CORBA.SystemException;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+/**
+ * A delegate, implementing the functionality, provided by the {@link Util}.
+ *
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.UtilClass" to the name of the alternative class that must
+ * implement this interface.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public interface UtilDelegate
{
+ /**
+ * Used by local stubs to create a copy of the object.
+ */
+ Object copyObject(Object obj, ORB orb)
+ throws RemoteException;
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException;
-
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException;
+ /**
+ * Used by local stubs to create a multiple copies of the object, preserving
+ * sharing accross the parameters if necessary.
+ */
+ Object[] copyObjects(Object[] obj, ORB orb)
+ throws RemoteException;
+ /**
+ * Get the value handler that Serializes Java objects to and from CDR (GIOP)
+ * streams.
+ */
ValueHandler createValueHandler();
-
+
String getCodebase(Class clz);
-
- Tie getTie(Remote target);
-
- boolean isLocal(Stub stub) throws RemoteException;
- Class loadClass(String className, String remoteCodebase,
- ClassLoader loader) throws ClassNotFoundException;
+ /**
+ * Checks if the given stub is local.
+ */
+ boolean isLocal(Stub stub)
+ throws RemoteException;
+
+ Class loadClass(String className, String remoteCodebase, ClassLoader loader)
+ throws ClassNotFoundException;
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * The subsequent content is not part of the official RMI-IIOP standart and is
+ * added for compatibility with Sun's implementation:
+ * <ol>
+ * <li>the phrase "<code>; nested exception is: <i>(line feed)(tab)</i></code>"</li>
+ * <li>the full name of the mapped SystemException, as returned by
+ * Class.getName().</li>
+ * <li>the ": ".
+ * <li>the value, returned by .getMessage() of the passed parameter.</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p><p>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p><p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
RemoteException mapSystemException(SystemException ex);
- Object readAny(InputStream in);
+ /**
+ * Get the Tie that handles invocations on the given target. The target/Tie
+ * pair must be previously registered using {@link #registerTarget}.
+ *
+ * @return the Tie, or null if no such is known.
+ */
+ Tie getTie(Remote target);
+ /**
+ * Register the Tie-target pair.
+ */
void registerTarget(Tie tie, Remote target);
-
- void unexportObject(Remote target);
-
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets.
+ */
+ void unexportObject(Remote target)
+ throws NoSuchObjectException;
+
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param ex an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
RemoteException wrapException(Throwable orig);
-
- void writeAbstractObject(OutputStream out, Object obj);
-
- void writeAny(OutputStream out, Object obj);
- void writeRemoteObject(OutputStream out, Object obj);
-}
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible. This method is used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ void writeRemoteObject(OutputStream output, Object obj);
+
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ void writeAbstractObject(OutputStream output, Object object);
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ void writeAny(OutputStream output, Object object);
+
+ /**
+ * Read Any from the input stream.
+ */
+ Object readAny(InputStream input);
+
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
index f26e75b2a86..c4213efdcfb 100644
--- a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
@@ -1,5 +1,5 @@
-/* ValueHandler.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* ValueHandler.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,28 +38,93 @@ exception statement from your version. */
package javax.rmi.CORBA;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.io.Serializable;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
-//import org.omg.SendingContext.RunTime;
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.SendingContext.RunTime;
+
+/**
+ * Serializes Java objects to and from CDR (GIOP) streams. The working instance
+ * of the value handler is returned by {@link Util#createValueHandler} and can
+ * be altered by setting the system property "javax.rmi.CORBA.ValueHandlerClass"
+ * to the name of the alternative class that must implement ValueHandler.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public interface ValueHandler
{
-
+ /**
+ * Get CORBA repository Id for the given java class.
+ *
+ * The syntax of the repository ID is the initial ?RMI:?, followed by the Java
+ * class name, followed by name, followed by a hash code string, followed
+ * optionally by a serialization version UID string.
+ *
+ * For Java identifiers that contain illegal OMG IDL identifier characters
+ * such as ?$?, any such illegal characters are replaced by ?\U? followed by
+ * the 4 hexadecimal characters (in upper case) representing the Unicode
+ * value.
+ *
+ * @param clz a class for that the repository Id is required.
+ *
+ * @return the class repository id.
+ */
String getRMIRepositoryID(Class clz);
-
- // XXX Runtime -> RunTime
- Runtime getRunTimeCodeBase();
-
+
+ /**
+ * Returns the CodeBase for this ValueHandler.
+ *
+ * @return the codebase.
+ */
+ RunTime getRunTimeCodeBase();
+
+ /**
+ * Indicates that the given class is responsible itself for writing its
+ * content to the stream. Such classes implement either {@link Streamable}
+ * (default marshalling, generated by IDL-to-java compiler) or
+ * {@link CustomMarshal} (the user-programmed marshalling).
+ *
+ * @param clz the class being checked.
+ * @return true if the class supports custom or default marshalling, false
+ * otherwise.
+ */
boolean isCustomMarshaled(Class clz);
-
- // XXX Runtime -> RunTime
+
+ /**
+ * Read value from the CORBA input stream in the case when the value is not
+ * Streamable or CustomMarshall'ed. The fields of the class being written will
+ * be accessed using reflection.
+ *
+ * @param in a CORBA stream to read.
+ * @param offset the current position in the input stream.
+ * @param clz the type of value being read.
+ * @param repositoryID the repository Id of the value being read.
+ * @param sender the sending context that should provide data about the
+ * message originator.
+ *
+ * @return the object, extracted from the stream.
+ */
Serializable readValue(InputStream in, int offset, Class clz,
- String repositoryID, Runtime sender);
-
+ String repositoryID, RunTime sender);
+
+ /**
+ * When the value provides the writeReplace method, the result of this method
+ * is written. Otherwise, the value itself is written.
+ *
+ * @param the value that should be written to the stream.
+ *
+ * @return the value that will be actually written to the stream.
+ */
Serializable writeReplace(Serializable value);
-
+
+ /**
+ * Write value to CORBA output stream using java senmatics.
+ *
+ * @param out a stream to write into.
+ * @param value a java object to write.
+ */
void writeValue(OutputStream out, Serializable value);
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java b/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java
new file mode 100644
index 00000000000..4db65c1dbfd
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java
@@ -0,0 +1,94 @@
+/* ValueHandlerMultiFormat.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+
+/**
+ * This interface extends the previous ValueHandler, supporting various stream
+ * format versions. The {@link ValueHandler} can be casted into this interface
+ * to access additional features.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ValueHandlerMultiFormat
+ extends ValueHandler
+{
+ /**
+ * Get the maximal supported version for the value types, supported by
+ * this value handler. The versions are integer numbers, the currently valid
+ * values being 1 and 2.
+ *
+ * These two versions differ in how the additional data, stored by the
+ * writeObject method, are encoded.
+ * <ul>
+ * <li> For version 1 (GNU Classpath default), that data (if present) are
+ * written "as is". </li>
+ * <li>For version 2, this data fragment is enclosed within a CDR custom
+ * valuetype with no codebase and repository Id "RMI:org.omg.custom.<class>"
+ * where <class> is the fully-qualified name of the class whose writeObject
+ * method is being invoked. If the object does not write any data via
+ * writeObject method, the null valuetype (0x0) must be written.</li>
+ * </ul>
+ * As the version number is part of the value type record, there is no need
+ * to the format control during the reading.
+ *
+ * @return the maximal supported version.
+ */
+ byte getMaximumStreamFormatVersion();
+
+ /**
+ * Write the value type to the output stream using the given format version.
+ * The older method {@link ValueHandler#writeValue} always uses the version 1.
+ *
+ * @param output the stream, where the value should be written, must implement
+ * {@link ValueOutputStream}.
+ * @param value the value that should be written.
+ * @param version the version of the format that must be used to write the
+ * value.
+ *
+ * @throws BAD_PARAM if the version number is less than 1 or greater than the
+ * maximal supported version.
+ */
+ void writeValue(OutputStream output, Serializable value, byte version);
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/package.html b/libjava/classpath/javax/rmi/CORBA/package.html
index f5a5ac758f9..6014c8c8533 100644
--- a/libjava/classpath/javax/rmi/CORBA/package.html
+++ b/libjava/classpath/javax/rmi/CORBA/package.html
@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- package.html - describes classes in javax.rmi.CORBA package.
+<!-- package.html - describes classes in javax.rmi package.
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,37 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.rmi.CORBA</title></head>
<body>
-<p></p>
-
+<p>
+Java RMI over IIOP combines RMI technology with CORBA technology. Like plain RMI,
+RMI over IIOP allows to work completely in the Java programming language
+(no IDL). When CORBA needs a separate helper class for each structure being
+passed, RMI over IIOP only needs stubs and ties for the objects that are remotely
+accessible. As a result, development with RMI-IIOP is easier. However the
+specialised pure CORBA helpers needs no reflection to transfer they structures
+and hence may be faster than methods, used by both RMI-IIOP and plain RMI.
+</p><p>
+Like RMI, RMI over IIOP provides flexibility by allowing to pass any serializable
+Java object (Objects By Value) between application components. A certain
+"imaginary IDL" is automatically supposed; this IDL can be explicitly generated
+and later used to interoperate with non-java application.
+</p><p>
+Like CORBA, RMI over IIOP is based on open standards defined with the
+participation of hundredsof vendors and users in the OMG. It uses IIOP
+communication protocol that provides much better interoperability with other
+programming languages.
+</p><p>
+With RMI/IIOP you can use advanced CORBA features: multiple objects per servant
+and servants per object, servant activators and locators, servant, client and
+ior interceptors, CORBA naming service, various ORB policies, stringified object
+references and so on. This functionality is based on CORBA value type standard.
+RMI/IIOP supports (and GNU Classpath implements) transferring of the arbitrary
+connected object graphs (graph flattenning).
+</p><p>
+GNU Classpath RMI-IIOP functionality is implemented as described in
+OMG formal/03-09-04 (IDL to Java mapping v1.3). Value types are written as
+described in formal/04-03-12 (CORBA 3.0.3).
+</p>
+@author Wu Gansha (gansha.wu@intel.com), headers.
+@author Audrius Meskauskas (AudriusA@Bioinformatics.org), implementation.
</body>
</html>
diff --git a/libjava/classpath/javax/rmi/ORB.java b/libjava/classpath/javax/rmi/ORB.java
deleted file mode 100644
index be7a894e65a..00000000000
--- a/libjava/classpath/javax/rmi/ORB.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package javax.rmi;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class ORB { }
diff --git a/libjava/classpath/javax/rmi/PortableRemoteObject.java b/libjava/classpath/javax/rmi/PortableRemoteObject.java
index 5e5d1fd29d7..5bb6b112613 100644
--- a/libjava/classpath/javax/rmi/PortableRemoteObject.java
+++ b/libjava/classpath/javax/rmi/PortableRemoteObject.java
@@ -1,5 +1,5 @@
-/* PortableRemoteObject.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* PortableRemoteObject.java --
+ Copyright (C) 2004, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,77 +39,190 @@ exception statement from your version. */
package javax.rmi;
import gnu.javax.rmi.CORBA.DelegateFactory;
-import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.rmi.CORBA.PortableRemoteObjectDelegate;
-
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+/**
+ * <p>
+ * An utility class for RMI/IDL server side object implementations. Server side
+ * implementation objects may inherit from this class, but this is not
+ * mandatory, as the needed methds are static. Server side implementations may
+ * choose to inherit from {@link ObjectImpl} or {@link Servant} instead.
+ * </p>
+ * <p>
+ * The functionality of methods in this class is forwarded to the enclosed
+ * PortableRemoteObjectDelegate. This delegate can be altered by setting the
+ * system property "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of
+ * the alternative class that must implement
+ * {@link PortableRemoteObjectDelegate}.
+ * </p>
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public class PortableRemoteObject
- implements Remote /* why doc doesn't say should implement Remote */
{
-
- private static PortableRemoteObjectDelegate delegate;
- static
- {
- try
- {
- delegate = (PortableRemoteObjectDelegate)DelegateFactory.getInstance
- ("PortableRemoteObject");
- }
- catch(GetDelegateInstanceException e)
- {
- e.printStackTrace();
- delegate = null;
- }
- }
-
+ /**
+ * A delegate where the functionality is forwarded.
+ */
+ static PortableRemoteObjectDelegate delegate = (PortableRemoteObjectDelegate) DelegateFactory.getInstance(DelegateFactory.PORTABLE_REMOTE_OBJECT);
+
+ /**
+ * The protected constructor calls {@link exportObject} (this).
+ *
+ * @throws RemoteException if the exportObject(this) throws one.
+ */
protected PortableRemoteObject()
throws RemoteException
{
- if(delegate != null)
- exportObject((Remote)this);
+ exportObject((Remote) this);
}
+ /**
+ * <p>
+ * Makes the remote object <code>a_target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>a_source</code> parameter. The a_target is connected to the same
+ * ORB (and, if applicable, to the same {@link POA}) as the a_source.
+ *
+ * @param a_target the target to connect to ORB, must be an instance of either
+ * {@link ObjectImpl} (Stubs and old-style ties) or {@link Tie}.
+ *
+ * @param a_source the object, providing the connection information, must be
+ * an instance of either {@link ObjectImpl} (Stubs and old-style ties) or
+ * {@link Servant} (the next-generation Ties supporting {@link POA}).
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
public static void connect(Remote target, Remote source)
throws RemoteException
{
- if(delegate != null)
- delegate.connect(target, source);
+ delegate.connect(target, source);
}
-
- public static void exportObject(Remote obj)
+
+ /**
+ * <p>
+ * Makes a server object ready for remote calls. The subclasses of
+ * PortableRemoteObject do not need to call this method, as it is called by
+ * the constructor.
+ * </p>
+ * <p>
+ * This method only creates a tie object and caches it for future usage. The
+ * created tie does not have a delegate or an ORB associated.
+ * </p>
+ *
+ * @param object the object to export.
+ *
+ * @throws RemoteException if export fails due any reason.
+ */
+ public static void exportObject(Remote object)
throws RemoteException
{
- if(delegate != null)
- delegate.exportObject(obj);
+ delegate.exportObject(object);
}
- public static Object narrow(Object narrowFrom, Class narrowTo)
+ /**
+ * Narrows the passed object to conform to the given interface or IDL type. In
+ * RMI-IIOP, this method replaces the narrow(org.omg.CORBA.Object) method that
+ * was present in the CORBA Helpers. This method frequently returns different
+ * instance and cannot be replaced by the direct cast. The typical narrowing
+ * cases (all supported by GNU Classpath) are:
+ * <ul>
+ * <li>A CORBA object (for instance, returned by the
+ * {@link ORB#string_to_object} or from the naming service) can be narrowed
+ * into interface, derived from Remote. The method will try to locate an
+ * appropriate {@link Stub} by the name pattern (_*_Stub). If the object being
+ * narrowed is connected to an ORB, the returned instance will inherit that
+ * connection, representing the same remote (or local) object, but now with
+ * the possibility to invoke remote methods. </li>
+ * <li>A CORBA object may be directly narrowed into the appropriate
+ * {@link Stub} class, if it is and passed as a second parameter. This allows
+ * to use non-standard stubs without parameterless constructors.</li>
+ * <li>Any two classes, derived from the {@link ObjectImpl} (may be Stub's)
+ * can be narrowed one into another (a delegate is transferred). </li>
+ * <li>An implementation of Remote can be narrowed into {@link Tie} that can
+ * later connected to an ORB, making the methods accessible remotely. The
+ * Remote being narrowed normally provides a local implementation, but you can
+ * also narrow remote Stub, creating "forwarding Tie".</li>
+ * <li>null is narrowed into null regardless of the second parameter.</li>
+ * <li>A {@link Tie} can be narrowed into Remote, representing the
+ * implementation for this Tie (if one is set).</li>
+ * </ul>
+ *
+ * @param object the object like CORBA Object, Stub or Remote that must be
+ * narrowed to the given interface.
+ *
+ * @param narrowToInstaceOf the class of the interface to that the object must
+ * be narrowed.
+ *
+ * @return On success, an object of type narrowTo or null, if narrowFrom =
+ * null.
+ *
+ * @throws ClassCastException if no narrowing is possible.
+ */
+ public static Object narrow(Object object, Class narrowToInstaceOf)
throws ClassCastException
{
- if(delegate != null)
- return delegate.narrow(narrowFrom, narrowTo);
- else
- return null;
+ return delegate.narrow(object, narrowToInstaceOf);
}
- public static Remote toStub(Remote obj)
+ /**
+ * <p>
+ * Takes a server implementation object (name pattern *imp) and returns a stub
+ * object that can be used to access that server object (target), name
+ * (pattern _*_Stub).
+ *
+ * The returned stub is not connected to any ORB and must be explicitly
+ * connected using {@link #connect}.
+ * </p>
+ * <p>
+ * The method signature prevents it from returning stubs that does not
+ * implement Remote (ClassCastException will be thrown).
+ * </p>
+ *
+ * @param target a server side object implementation.
+ * @return a stub object that can be used to access that server object.
+ *
+ * @throws NoSuchObjectException if a stub class cannot be located by supposed
+ * name pattern, or an instance of stub fails to be instantiated.
+ *
+ * @throws ClassCastException if the stub class can be located, but it does
+ * not inherit from Remote.
+ *
+ * @throws BAD_PARAM if the name of the passed class does not match the
+ * implementation name pattern (does not end by 'Impl').
+ */
+ public static Remote toStub(Remote targetImpl)
throws NoSuchObjectException
{
- if(delegate != null)
- return delegate.toStub(obj);
- else
- return null;
+ return delegate.toStub(targetImpl);
}
- public static void unexportObject(Remote obj)
+ /**
+ * Deregister a currently exported server object from the ORB runtimes. The
+ * object to becomes available for garbage collection. This is usually
+ * impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to unexport.
+ *
+ * @throws NoSuchObjectException if the passed object is not currently
+ * exported.
+ */
+ public static void unexportObject(Remote object)
throws NoSuchObjectException
{
- if(delegate != null)
- delegate.unexportObject(obj);
+ delegate.unexportObject(object);
}
-
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/package.html b/libjava/classpath/javax/rmi/package.html
index febf59bd61c..6014c8c8533 100644
--- a/libjava/classpath/javax/rmi/package.html
+++ b/libjava/classpath/javax/rmi/package.html
@@ -37,10 +37,40 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. -->
<html>
-<head><title>GNU Classpath - javax.rmi</title></head>
+<head><title>GNU Classpath - javax.rmi.CORBA</title></head>
<body>
-<p></p>
-
+<p>
+Java RMI over IIOP combines RMI technology with CORBA technology. Like plain RMI,
+RMI over IIOP allows to work completely in the Java programming language
+(no IDL). When CORBA needs a separate helper class for each structure being
+passed, RMI over IIOP only needs stubs and ties for the objects that are remotely
+accessible. As a result, development with RMI-IIOP is easier. However the
+specialised pure CORBA helpers needs no reflection to transfer they structures
+and hence may be faster than methods, used by both RMI-IIOP and plain RMI.
+</p><p>
+Like RMI, RMI over IIOP provides flexibility by allowing to pass any serializable
+Java object (Objects By Value) between application components. A certain
+"imaginary IDL" is automatically supposed; this IDL can be explicitly generated
+and later used to interoperate with non-java application.
+</p><p>
+Like CORBA, RMI over IIOP is based on open standards defined with the
+participation of hundredsof vendors and users in the OMG. It uses IIOP
+communication protocol that provides much better interoperability with other
+programming languages.
+</p><p>
+With RMI/IIOP you can use advanced CORBA features: multiple objects per servant
+and servants per object, servant activators and locators, servant, client and
+ior interceptors, CORBA naming service, various ORB policies, stringified object
+references and so on. This functionality is based on CORBA value type standard.
+RMI/IIOP supports (and GNU Classpath implements) transferring of the arbitrary
+connected object graphs (graph flattenning).
+</p><p>
+GNU Classpath RMI-IIOP functionality is implemented as described in
+OMG formal/03-09-04 (IDL to Java mapping v1.3). Value types are written as
+described in formal/04-03-12 (CORBA 3.0.3).
+</p>
+@author Wu Gansha (gansha.wu@intel.com), headers.
+@author Audrius Meskauskas (AudriusA@Bioinformatics.org), implementation.
</body>
</html>
diff --git a/libjava/classpath/javax/security/auth/Subject.java b/libjava/classpath/javax/security/auth/Subject.java
index 4e35a645ddb..1659c6425fe 100644
--- a/libjava/classpath/javax/security/auth/Subject.java
+++ b/libjava/classpath/javax/security/auth/Subject.java
@@ -1,5 +1,5 @@
/* Subject.java -- a single entity in the system.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -385,19 +385,19 @@ public final class Subject implements Serializable
// Constructors.
// -----------------------------------------------------------------------
- SecureSet (final Subject subject, final int type, final Collection elements)
+ SecureSet (final Subject subject, final int type, final Collection inElements)
{
this (subject, type);
- for (Iterator it = elements.iterator(); it.hasNext(); )
+ for (Iterator it = inElements.iterator(); it.hasNext(); )
{
Object o = it.next();
if (type == PRINCIPALS && !(o instanceof Principal))
{
throw new IllegalArgumentException(o+" is not a Principal");
}
- if (!elements.contains (o))
+ if (!this.elements.contains (o))
{
- elements.add (o);
+ this.elements.add (o);
}
}
}
@@ -511,7 +511,7 @@ public final class Subject implements Serializable
public synchronized boolean contains (final Object element)
{
- return elements.remove (element);
+ return elements.contains (element);
}
public boolean removeAll (final Collection c)
diff --git a/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java b/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java
index 94a7160eb18..927e7479df6 100644
--- a/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java
+++ b/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java
@@ -1,5 +1,5 @@
/* SubjectDomainCombiner.java -- domain combiner for Subjects.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,8 +67,9 @@ public class SubjectDomainCombiner implements DomainCombiner
final ProtectionDomain[] assigned)
{
LinkedList domains = new LinkedList();
- Principal[] principals =
- (Principal[]) subject.getPrincipals().toArray (new Principal[0]);
+ Principal[] principals = null;
+ if (subject != null)
+ principals = (Principal[]) subject.getPrincipals().toArray (new Principal[0]);
if (current != null)
{
for (int i = 0; i < current.length; i++)
diff --git a/libjava/classpath/javax/security/auth/login/Configuration.java b/libjava/classpath/javax/security/auth/login/Configuration.java
index 1e0d272f19e..eb5e4a81979 100644
--- a/libjava/classpath/javax/security/auth/login/Configuration.java
+++ b/libjava/classpath/javax/security/auth/login/Configuration.java
@@ -67,29 +67,7 @@ public abstract class Configuration
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission (new AuthPermission ("getLoginConfiguration"));
- if (config == null)
- {
- String conf = (String) AccessController.doPrivileged
- (new PrivilegedAction()
- {
- public Object run()
- {
- return Security.getProperty ("login.configuration.provider");
- }
- });
- try
- {
- if (conf != null)
- config = (Configuration) Class.forName (conf).newInstance();
- else
- config = new NullConfiguration();
- }
- catch (Exception x)
- {
- config = new NullConfiguration();
- }
- }
- return config;
+ return getConfig();
}
public static synchronized void setConfiguration (Configuration config)
@@ -115,6 +93,28 @@ public abstract class Configuration
*/
static Configuration getConfig()
{
+ if (config == null)
+ {
+ String conf = (String) AccessController.doPrivileged
+ (new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty ("login.configuration.provider");
+ }
+ });
+ try
+ {
+ if (conf != null)
+ config = (Configuration) Class.forName (conf).newInstance();
+ else
+ config = new NullConfiguration();
+ }
+ catch (Exception x)
+ {
+ config = new NullConfiguration();
+ }
+ }
return config;
}
}
diff --git a/libjava/classpath/javax/security/auth/login/LoginContext.java b/libjava/classpath/javax/security/auth/login/LoginContext.java
index 8fc2ca75983..a3cbf8f0651 100644
--- a/libjava/classpath/javax/security/auth/login/LoginContext.java
+++ b/libjava/classpath/javax/security/auth/login/LoginContext.java
@@ -220,7 +220,9 @@ public class LoginContext
Exception cause = null;
try
{
- module = (LoginModule) Class.forName (entry.getLoginModuleName()).newInstance();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class c = Class.forName(entry.getLoginModuleName(), true, cl);
+ module = (LoginModule) c.newInstance();
}
catch (ClassNotFoundException cnfe)
{
diff --git a/libjava/classpath/javax/security/auth/x500/X500Principal.java b/libjava/classpath/javax/security/auth/x500/X500Principal.java
index 78c35ade157..fcbb4950a39 100644
--- a/libjava/classpath/javax/security/auth/x500/X500Principal.java
+++ b/libjava/classpath/javax/security/auth/x500/X500Principal.java
@@ -140,6 +140,22 @@ public final class X500Principal implements Principal, Serializable
// Instance methods.
// ------------------------------------------------------------------------
+ public int hashCode()
+ {
+ int result = size();
+ for (int i = 0; i < size(); ++i)
+ {
+ Map m = (Map) components.get(i);
+ for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
+ {
+ Map.Entry e = (Map.Entry) it2.next();
+ // We don't bother looking at the value of the entry.
+ result = result * 31 + ((OID) e.getKey()).hashCode();
+ }
+ }
+ return result;
+ }
+
public boolean equals(Object o)
{
if (!(o instanceof X500Principal))
diff --git a/libjava/classpath/javax/security/sasl/AuthenticationException.java b/libjava/classpath/javax/security/sasl/AuthenticationException.java
index 12a8fe0529b..0f674645dc0 100644
--- a/libjava/classpath/javax/security/sasl/AuthenticationException.java
+++ b/libjava/classpath/javax/security/sasl/AuthenticationException.java
@@ -1,5 +1,5 @@
/* AuthenticationException.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,6 +49,8 @@ package javax.security.sasl;
* instead of <code>AuthenticationException</code> if it is unable to determine
* the nature of the failure, or if does not want to disclose the nature of the
* failure, for example, due to security reasons.</p>
+ *
+ * @since 1.5
*/
public class AuthenticationException extends SaslException
{
diff --git a/libjava/classpath/javax/security/sasl/AuthorizeCallback.java b/libjava/classpath/javax/security/sasl/AuthorizeCallback.java
index bf1b8470d31..fa3b29a3d92 100644
--- a/libjava/classpath/javax/security/sasl/AuthorizeCallback.java
+++ b/libjava/classpath/javax/security/sasl/AuthorizeCallback.java
@@ -1,5 +1,5 @@
/* AuthorizeCallback.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,19 +38,23 @@ exception statement from your version. */
package javax.security.sasl;
+import java.io.Serializable;
import javax.security.auth.callback.Callback;
/**
* This callback is used by {@link SaslServer} to determine whether one entity
* (identified by an authenticated authentication ID) can act on behalf of
* another entity (identified by an authorization ID).
+ *
+ * @since 1.5
*/
-public class AuthorizeCallback implements Callback
+public class AuthorizeCallback implements Callback, Serializable
{
-
// Constants and variables
// -------------------------------------------------------------------------
+ private static final long serialVersionUID = -2353344186490470805L;
+
/** @serial The (authenticated) authentication id to check. */
private String authenticationID = null;
diff --git a/libjava/classpath/javax/security/sasl/RealmCallback.java b/libjava/classpath/javax/security/sasl/RealmCallback.java
index 12d834054a4..7cb36433fe6 100644
--- a/libjava/classpath/javax/security/sasl/RealmCallback.java
+++ b/libjava/classpath/javax/security/sasl/RealmCallback.java
@@ -1,5 +1,5 @@
/* RealmCallback.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,6 +43,8 @@ import javax.security.auth.callback.TextInputCallback;
/**
* This callback is used by {@link SaslClient} and {@link SaslServer} to
* retrieve realm information.
+ *
+ * @since 1.5
*/
public class RealmCallback extends TextInputCallback
{
diff --git a/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java b/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java
index d16e61f6afd..7068a504bce 100644
--- a/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java
+++ b/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java
@@ -1,5 +1,5 @@
/* RealmChoiceCallback.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,6 +43,8 @@ import javax.security.auth.callback.ChoiceCallback;
/**
* This callback is used by {@link SaslClient} and {@link SaslServer} to obtain
* a realm given a list of realm choices.
+ *
+ * @since 1.5
*/
public class RealmChoiceCallback extends ChoiceCallback
{
diff --git a/libjava/classpath/javax/security/sasl/Sasl.java b/libjava/classpath/javax/security/sasl/Sasl.java
index 058e4f6e1b6..dbe4cc8c2ae 100644
--- a/libjava/classpath/javax/security/sasl/Sasl.java
+++ b/libjava/classpath/javax/security/sasl/Sasl.java
@@ -74,6 +74,8 @@ import javax.security.auth.callback.CallbackHandler;
* Sasl.createSaslServer(mechanism, protocol, serverName, props,
* callbackHandler);
* </pre>
+ *
+ * @since 1.5
*/
public class Sasl
{
diff --git a/libjava/classpath/javax/security/sasl/SaslClient.java b/libjava/classpath/javax/security/sasl/SaslClient.java
index 544ab17d6a8..58eb5e298b6 100644
--- a/libjava/classpath/javax/security/sasl/SaslClient.java
+++ b/libjava/classpath/javax/security/sasl/SaslClient.java
@@ -1,5 +1,5 @@
/* SaslClient.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,6 +102,8 @@ package javax.security.sasl;
*
* @see Sasl
* @see SaslClientFactory
+ *
+ * @since 1.5
*/
public interface SaslClient
{
@@ -216,7 +218,7 @@ public interface SaslClient
* @throws IllegalStateException if this authentication exchange has not
* completed.
*/
- Object getNegotiatedProperty(String propName) throws SaslException;
+ Object getNegotiatedProperty(String propName);
/**
* Disposes of any system resources or security-sensitive information the
diff --git a/libjava/classpath/javax/security/sasl/SaslClientFactory.java b/libjava/classpath/javax/security/sasl/SaslClientFactory.java
index d6e8cd5ffd1..ae36171c56e 100644
--- a/libjava/classpath/javax/security/sasl/SaslClientFactory.java
+++ b/libjava/classpath/javax/security/sasl/SaslClientFactory.java
@@ -1,5 +1,5 @@
/* SaslClientFactory.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,6 +55,8 @@ import javax.security.auth.callback.CallbackHandler;
*
* @see SaslClient
* @see Sasl
+ *
+ * @since 1.5
*/
public interface SaslClientFactory
{
diff --git a/libjava/classpath/javax/security/sasl/SaslException.java b/libjava/classpath/javax/security/sasl/SaslException.java
index 13113e6bcda..89764bb18f0 100644
--- a/libjava/classpath/javax/security/sasl/SaslException.java
+++ b/libjava/classpath/javax/security/sasl/SaslException.java
@@ -1,5 +1,5 @@
/* SaslException.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,8 @@ import java.io.Serializable;
/**
* This class represents an error that has occurred when using SASL.
+ *
+ * @since 1.5
*/
public class SaslException extends IOException implements Serializable
{
@@ -52,6 +54,8 @@ public class SaslException extends IOException implements Serializable
// Constants and variables
// -------------------------------------------------------------------------
+ private static final long serialVersionUID = 4579784287983423626L;
+
/**
* @serial The possibly null root cause exception.
*/
diff --git a/libjava/classpath/javax/security/sasl/SaslServer.java b/libjava/classpath/javax/security/sasl/SaslServer.java
index f5a04975d53..d30b8f6ba14 100644
--- a/libjava/classpath/javax/security/sasl/SaslServer.java
+++ b/libjava/classpath/javax/security/sasl/SaslServer.java
@@ -1,5 +1,5 @@
-/* SasServer.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+/* SaslServer.java
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -92,6 +92,8 @@ package javax.security.sasl;
*
* @see Sasl
* @see SaslServerFactory
+ *
+ * @since 1.5
*/
public interface SaslServer
{
@@ -211,7 +213,7 @@ public interface SaslServer
* @throws IllegalStateException if this authentication exchange has not
* completed.
*/
- Object getNegotiatedProperty(String propName) throws SaslException;
+ Object getNegotiatedProperty(String propName);
/**
* Disposes of any system resources or security-sensitive information the
diff --git a/libjava/classpath/javax/security/sasl/SaslServerFactory.java b/libjava/classpath/javax/security/sasl/SaslServerFactory.java
index 0fff32fa43b..fc43fb636e9 100644
--- a/libjava/classpath/javax/security/sasl/SaslServerFactory.java
+++ b/libjava/classpath/javax/security/sasl/SaslServerFactory.java
@@ -1,5 +1,5 @@
/* SaslServerFactory.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,6 +55,8 @@ import javax.security.auth.callback.CallbackHandler;
*
* @see SaslServer
* @see Sasl
+ *
+ * @since 1.5
*/
public interface SaslServerFactory
{
diff --git a/libjava/classpath/javax/sound/midi/ControllerEventListener.java b/libjava/classpath/javax/sound/midi/ControllerEventListener.java
new file mode 100644
index 00000000000..eb075b32f8b
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/ControllerEventListener.java
@@ -0,0 +1,58 @@
+/* ControllerEventListener.java -- Listener for MIDI controller events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.EventListener;
+
+/**
+ * The interface defines the methods to be implemented by classes wanting
+ * to be notified on MIDI controller events from a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface ControllerEventListener extends EventListener
+{
+ /**
+ * Called on MIDI controller events.
+ * @param event the controller change event message
+ */
+ public void controlChange(ShortMessage event);
+}
diff --git a/libjava/classpath/javax/sound/midi/Instrument.java b/libjava/classpath/javax/sound/midi/Instrument.java
new file mode 100644
index 00000000000..3402e8289c9
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Instrument.java
@@ -0,0 +1,77 @@
+/* Instrument.java -- A MIDI Instrument
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * The abstract base class for all MIDI instruments.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class Instrument extends SoundbankResource
+{
+ // The instrument patch.
+ private Patch patch;
+
+ /**
+ * Create a new Instrument.
+ *
+ * @param soundbank the Soundbank containing the instrument.
+ * @param patch the patch for this instrument
+ * @param name the name of this instrument
+ * @param dataClass the class used to represent sample data for this instrument
+ */
+ protected Instrument(Soundbank soundbank, Patch patch,
+ String name, Class dataClass)
+ {
+ super(soundbank, name, dataClass);
+ this.patch = patch;
+ }
+
+ /**
+ * Get the patch for this instrument.
+ *
+ * @return the patch for this instrument
+ */
+ public Patch getPatch()
+ {
+ return patch;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/InvalidMidiDataException.java b/libjava/classpath/javax/sound/midi/InvalidMidiDataException.java
new file mode 100644
index 00000000000..d7f770757a4
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/InvalidMidiDataException.java
@@ -0,0 +1,90 @@
+/* InvalidMidiDataException.java -- Thrown for invalid MIDI data.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This exception is thrown when we encounter bad MIDI data.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class InvalidMidiDataException extends Exception
+{
+ private static final long serialVersionUID = 2780771756789932067L;
+
+ /**
+ * Create an InvalidMidiDataException object.
+ */
+ public InvalidMidiDataException()
+ {
+ super();
+ }
+
+ /**
+ * Create an InvalidMidiDataException object.
+ *
+ * @param s the exception message string
+ */
+ public InvalidMidiDataException(String s)
+ {
+ super(s);
+ }
+
+ /**
+ * Create an InvalidMidiDataException object.
+ *
+ * @param s the exception message string
+ * @param cause the root cause of the exception
+ */
+ public InvalidMidiDataException(String s, Throwable cause)
+ {
+ super(s, cause);
+ }
+
+ /**
+ * Create an InvalidMidiDataException object.
+ *
+ * @param cause the root cause of the exception
+ */
+ public InvalidMidiDataException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/FocusManager.java b/libjava/classpath/javax/sound/midi/MetaEventListener.java
index 49b40bfc184..dd7b8a24be8 100644
--- a/libjava/classpath/gnu/java/awt/FocusManager.java
+++ b/libjava/classpath/javax/sound/midi/MetaEventListener.java
@@ -1,4 +1,4 @@
-/* FocusManager.java -- Provide Swing FocusManager API compatibility
+/* MetaEventListener.java -- Listener for MIDI meta events
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,18 +35,24 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.awt;
+
+package javax.sound.midi;
+
+import java.util.EventListener;
/**
- * This is a subclass of the otherwise abstract class
- * {@link javax.swing.FocusManager}. Its sole purpose is to make the Swing
- * FocusManager usable as a FocusManager in AWT, so that we can provide both
- * the new (1.4) KeyboardFocusManager API and still support the older
- * Swing FocusManager.
+ * The interface defines the methods to be implemented by classes wanting
+ * to be notified on MIDI meta events from a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
*
- * @author Roman Kennke
*/
-public class FocusManager
- extends javax.swing.FocusManager
+public interface MetaEventListener extends EventListener
{
+ /**
+ * Called on MIDI meta events.
+ * @param meta the meta event message
+ */
+ public void meta(MetaMessage meta);
}
diff --git a/libjava/classpath/javax/sound/midi/MetaMessage.java b/libjava/classpath/javax/sound/midi/MetaMessage.java
new file mode 100644
index 00000000000..2ca93accd77
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MetaMessage.java
@@ -0,0 +1,176 @@
+/* MetaMessage.java -- A meta message for MIDI files.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A system exclusive MIDI message.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MetaMessage extends MidiMessage
+{
+ /**
+ * The META status code. Only valid for MIDI files, not the wire protocol.
+ */
+ public static final int META = 0xFF;
+
+ // The length of the variable length data length encoding.
+ private int lengthLength = 0;
+
+ /**
+ * Create a default valid meta message.
+ *
+ * The official specs don't specify what message is to be
+ * created. For now, we create a zero length meta message
+ * with a type code of 0.
+ */
+ public MetaMessage()
+ {
+ super(new byte[4]);
+ data[0] = (byte) META;
+ data[1] = (byte) 0; // Type
+ data[2] = (byte) 1; // Length length
+ data[3] = (byte) 0; // Length
+ lengthLength = 1;
+ }
+
+ /**
+ * Create a MetaMessage object.
+ * @param data a complete system exclusive message
+ */
+ public MetaMessage(byte[] data)
+ {
+ super(data);
+ int index = 2;
+ lengthLength = 1;
+ while ((data[index++] & 0x80) > 0)
+ lengthLength++;
+ }
+
+ /**
+ * Set the meta message.
+ *
+ * @param type the meta type byte (< 128)
+ * @param data the message data
+ * @param length the length of the message data
+ * @throws InvalidMidiDataException if this message is invalid
+ */
+ public void setMessage(int type, byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ if (type > 127)
+ throw new InvalidMidiDataException("Meta type 0x"
+ + Integer.toHexString(type)
+ + " must be less than 128");
+
+ // For a nice description of how variable length values are handled,
+ // see http://www.borg.com/~jglatt/tech/midifile.htm
+
+ // First compute the length of the length value
+ lengthLength = 0;
+ int lengthValue = length;
+ do {
+ lengthValue = lengthValue >> 7;
+ lengthLength++;
+ } while (lengthValue > 0);
+
+ // Now allocate our data array
+ this.length = 2 + lengthLength + length;
+ this.data = new byte[this.length];
+ this.data[0] = (byte) META;
+ this.data[1] = (byte) type;
+
+ // Now compute the length representation
+ long buffer = length & 0x7F;
+ while ((length >>= 7) > 0)
+ {
+ buffer <<= 8;
+ buffer |= ((length & 0x7F) | 0x80);
+ }
+
+ // Now store the variable length length value
+ int index = 2;
+ do
+ {
+ this.data[index++] = (byte) (buffer & 0xFF);
+ if ((buffer & 0x80) == 0)
+ break;
+ buffer >>= 8;
+ } while (true);
+
+ // Now copy the real data.
+ System.arraycopy(data, 0, this.data, index, length);
+ }
+
+ /**
+ * Get the meta message type.
+ *
+ * @return the meta message type
+ */
+ public int getType()
+ {
+ return data[1];
+ }
+
+ /**
+ * Get the data for this message, not including the status,
+ * type, or length information.
+ *
+ * @return the message data, not including status, type or lenght info
+ */
+ public byte[] getData()
+ {
+ int dataLength = length - 2 - lengthLength;
+ byte[] result = new byte[dataLength];
+ System.arraycopy(data, 2 + lengthLength, result, 0, dataLength);
+ return result;
+ }
+
+ /* Create a deep-copy clone of this object.
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ byte message[] = new byte[length];
+ System.arraycopy(data, 0, message, 0, length);
+ return new MetaMessage(message);
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiChannel.java b/libjava/classpath/javax/sound/midi/MidiChannel.java
new file mode 100644
index 00000000000..fe3b5111ab7
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiChannel.java
@@ -0,0 +1,236 @@
+/* MidiChannel.java -- A MIDI channel
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A MIDI channel.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface MidiChannel
+{
+
+ /**
+ * Start playing a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @param velocity the velocity at which the key was pressed
+ */
+ public void noteOn(int noteNumber, int velocity);
+
+ /**
+ * Stop playing a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @param velocity the volcity at which the ket was released
+ */
+ public void noteOff(int noteNumber, int velocity);
+
+ /**
+ * Stop playing a note.
+ *
+ * @param noteNumber the MIDI note number
+ */
+ public void noteOff(int noteNumber);
+
+ /**
+ * Change in a key pressure for a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @param pressure the key pressure
+ */
+ public void setPolyPressure(int noteNumber, int pressure);
+
+ /**
+ * Get the key pressure for a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @return the key pressure
+ */
+ public int getPolyPressure(int noteNumber);
+
+ /**
+ * Set the key pressure for the channel.
+ *
+ * @param pressure the key pressure
+ */
+ public void setChannelPressure(int pressure);
+
+ /**
+ * Get the key pressure for the channel.
+ *
+ * @return the key pressure
+ */
+ public int getChannelPressure();
+
+ /**
+ * Set a change in a controller's value.
+ *
+ * @param controller the MIDI controller number (0 to 127)
+ * @param value the new value (0 to 127)
+ */
+ public void controlChange(int controller, int value);
+
+ /**
+ * Get a controller's value.
+ *
+ * @param controller the MIDI controller number (0 to 127)
+ * @return the controller's value (0 to 127)
+ */
+ public int getController(int controller);
+
+ /**
+ * Change the patch for this channel.
+ *
+ * @param program the patch number to switch to (0 to 127)
+ */
+ public void programChange(int program);
+
+ /**
+ * Change the bank and patch for this channel.
+ *
+ * @param bank the bank to switch to (0 to 16383)
+ * @param program the patch to switch to (0 to 127)
+ */
+ public void programChange(int bank, int program);
+
+ /**
+ * Get the current patch for this channel.
+ *
+ * @return current patch (0 to 127)
+ */
+ public int getProgram();
+
+ /**
+ * Change the pitch bend for this channel using a positive 14-bit value.
+ *
+ * @param bend the new pitch bend value
+ */
+ public void setPitchBend(int bend);
+
+ /**
+ * Get the pitch bend for this channel as a positive 14-bit value.
+ *
+ * @return the current patch bend value
+ */
+ public int getPitchBend();
+
+ /**
+ * Reset all MIDI controllers to their default values.
+ */
+ public void resetAllControllers();
+
+ /**
+ * Stop playing all notes. Sound may not stop.
+ */
+ public void allNotesOff();
+
+ /**
+ * Stop all sound.
+ */
+ public void allSoundOff();
+
+ /**
+ * Set whether or not local controls are on or off. They are on by
+ * default.
+ *
+ * @param on true to enable local controls, false to disable
+ * @return the new value
+ */
+ public boolean localControl(boolean on);
+
+ /**
+ * Turns mono mode on or off.
+ *
+ * @param on true to enable mono mode, false to disable
+ */
+ public void setMono(boolean on);
+
+ /**
+ * Get the current mono mode.
+ *
+ * @return true if mono is enabled, false otherwise
+ */
+ public boolean getMono();
+
+ /**
+ * Turns omni mode on or off.
+ *
+ * @param on true to enable omni mode, false to disable
+ */
+ public void setOmni(boolean on);
+
+ /**
+ * Get the current omni mode.
+ *
+ * @return true if omni is enabled, false otherwise
+ */
+ public boolean getOmni();
+
+ /**
+ * Turns mute mode on or off.
+ *
+ * @param mute true to enable mute mode, false to disable
+ */
+ public void setMute(boolean mute);
+
+ /**
+ * Get the current mute mode.
+ *
+ * @return true if mute is enabled, false otherwise
+ */
+ public boolean getMute();
+
+ /**
+ * Turns solo mode on or off. If any channels are soloed, then only those
+ * channels make sounds, otherwise all channels will make sound.
+ *
+ * @param solo true to enable solo mode, false to disable
+ */
+ public void setSolo(boolean solo);
+
+ /**
+ * Get the current solo mode.
+ *
+ * @return true is solo is enabled, false otherwise.
+ */
+ public boolean getSolo();
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiDevice.java b/libjava/classpath/javax/sound/midi/MidiDevice.java
new file mode 100644
index 00000000000..6f43c25481d
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiDevice.java
@@ -0,0 +1,220 @@
+/* MidiDevice.java -- Interface for MIDI devices
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Interface for all MIDI devices.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface MidiDevice
+{
+ /**
+ * Get the Info object describing this device.
+ * @return the Info object describing this device
+ */
+ public Info getDeviceInfo();
+
+ /**
+ * Open this MIDI device and allocate any system resource we need.
+ *
+ * @throws MidiUnavailableException if we're not able to open for some reason
+ */
+ public void open() throws MidiUnavailableException;
+
+ /**
+ * Close this MIDI device, and release any system resources we're using.
+ */
+ public void close();
+
+ /**
+ * Returns true if this MIDI device is open and false otherwise.
+ *
+ * @return true if this is open, false otherwise
+ */
+ public boolean isOpen();
+
+ /**
+ * If this device supports time-stamps, then it will return the number
+ * of microseconds since this device has been open, and -1 otherwise.
+ *
+ * @return -1 or the number of microseconds since this was opened
+ */
+ public long getMicrosecondPosition();
+
+ /**
+ * The maximum number of MIDI IN connections we can get as Receivers,
+ * or -1 if there is no maximum.
+ *
+ * @return -1 or the maximum number of Receivers we can get
+ */
+ public int getMaxReceivers();
+
+ /**
+ * The maximum number of MIDI OUT connections we can get as Transmitters,
+ * or -1 if there is no maximum.
+ *
+ * @return -1 or the maximum number of Transmitters we can get
+ */
+ public int getMaxTransmitters();
+
+ /**
+ * Get a MIDI IN Receiver for this device.
+ *
+ * @return a MIDI IN Receiver for this device
+ * @throws MidiUnavailableException if we can't get a Receiver
+ */
+ public Receiver getReceiver() throws MidiUnavailableException;
+
+ /**
+ * Get a MIDI OUT Transmitter for this device.
+ *
+ * @return a MIDI OUT Transmitter for this device
+ * @throws MidiUnavailableException if we can't get a Transmitter
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException;
+
+ /**
+ * A MIDI device descriptor object.
+ *
+ * @author green@redhat.com
+ *
+ */
+ public static class Info
+ {
+ // Private data describing this device
+ private String name;
+ private String vendor;
+ private String description;
+ private String version;
+
+ /**
+ * Create an Info object for a MIDI device
+ *
+ * @param name the device name
+ * @param vendor the vendor name
+ * @param description the device description
+ * @param version the device version string
+ */
+ public Info(String name, String vendor, String description, String version)
+ {
+ this.name = name;
+ this.vendor = vendor;
+ this.description = description;
+ this.version = version;
+ }
+
+ /**
+ * This equals method only returns true if this object
+ * is the same as obj.
+ *
+ * @param obj the object we're comparing to
+ * @return true if this is the same object
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return super.equals(obj);
+ }
+
+ /**
+ * A hash code for this object.
+ *
+ * @return the hash code for this object
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Get the device name.
+ *
+ * @return the device name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the device vendor.
+ *
+ * @return the device vendor
+ */
+ public String getVendor()
+ {
+ return vendor;
+ }
+
+ /**
+ * Get the device description
+ *
+ * @return the device description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * get the device version
+ *
+ * @return the device version
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Simple return the name of the device.
+ *
+ * @return the device name
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return name;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiEvent.java b/libjava/classpath/javax/sound/midi/MidiEvent.java
new file mode 100644
index 00000000000..3ca5c21ea86
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiEvent.java
@@ -0,0 +1,95 @@
+/* MidiEvent.java -- A MIDI Event
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A MIDI event is the combination of a MIDI message and a timestamp specified
+ * in MIDI ticks.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiEvent
+{
+ private final MidiMessage message;
+ private long tick;
+
+ /**
+ * Create a MIDI event object from the given MIDI message and timestamp.
+ *
+ * @param message the MidiMessage for this event
+ * @param tick the timestamp for this event
+ */
+ public MidiEvent(MidiMessage message, long tick)
+ {
+ this.message = message;
+ this.tick = tick;
+ }
+
+ /**
+ * Get the MIDI message for this event.
+ *
+ * @return the MidiMessage for this event
+ */
+ public MidiMessage getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * Set the timestemp for this event in MIDI ticks.
+ *
+ * @param tick the timestamp
+ */
+ public void setTick(long tick)
+ {
+ this.tick = tick;
+ }
+
+ /**
+ * Get the timestamp for this event in MIDI ticks.
+ *
+ * @return the timestamp for this even in MIDI ticks
+ */
+ public long getTick()
+ {
+ return tick;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiFileFormat.java b/libjava/classpath/javax/sound/midi/MidiFileFormat.java
new file mode 100644
index 00000000000..79fa9fe2964
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiFileFormat.java
@@ -0,0 +1,158 @@
+/* MidiFileFormat.java -- Information about a MIDI file
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Describe a MIDI file, including specifics about its type, length and timing.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiFileFormat
+{
+ /**
+ * The MIDI file type. This is either 0, 1 or 2.
+ *
+ * Type 0 files contain a single track and represents a single song
+ * performance.
+ * Type 1 may contain multiple tracks for a single song performance.
+ * Type 2 may contain multiple tracks, each representing a
+ * separate song performance.
+ *
+ * See http://en.wikipedia.org/wiki/MIDI#MIDI_file_formats for more
+ * information.
+ */
+ protected int type;
+
+ /**
+ * The division type of the MIDI file.
+ */
+ protected float divisionType;
+
+ /**
+ * The timing resolution of the MIDI file.
+ */
+ protected int resolution;
+
+ /**
+ * The size of the MIDI file in bytes.
+ */
+ protected int byteLength = UNKNOWN_LENGTH;
+
+ /**
+ * The length of the MIDI file in microseconds.
+ */
+ protected long microsecondLength = UNKNOWN_LENGTH;
+
+ /**
+ * A special value indicating an unknown quantity.
+ */
+ public static final int UNKNOWN_LENGTH = -1; // FIXME is this really -1?
+
+ /**
+ * Create a MidiFileFormat object from the given parameters.
+ *
+ * @param type the MIDI file type (0, 1, or 2)
+ * @param divisionType the MIDI file division type
+ * @param resolution the MIDI file timing resolution
+ * @param bytes the MIDI file size in bytes
+ * @param microseconds the MIDI file length in microseconds
+ */
+ public MidiFileFormat(int type, float divisionType,
+ int resolution, int bytes, long microseconds)
+ {
+ this.type = type;
+ this.divisionType = divisionType;
+ this.resolution = resolution;
+ this.byteLength = bytes;
+ this.microsecondLength = microseconds;
+ }
+
+ /**
+ * Get the MIDI file type (0, 1, or 2).
+ *
+ * @return the MIDI file type (0, 1, or 2)
+ */
+ public int getType()
+ {
+ return type;
+ }
+
+ /**
+ * Get the file division type.
+ *
+ * @return the file divison type
+ */
+ public float getDivisionType()
+ {
+ return divisionType;
+ }
+
+ /**
+ * Get the file timing resolution. If the division type is PPQ, then this
+ * is value represents ticks per beat, otherwise it's ticks per frame (SMPTE).
+ *
+ * @return the timing resolution in ticks per beat or ticks per frame
+ */
+ public int getResolution()
+ {
+ return resolution;
+ }
+
+ /**
+ * Get the file length in bytes.
+ *
+ * @return the file length in bytes or UNKNOWN_LENGTH
+ */
+ public int getByteLength()
+ {
+ return byteLength;
+ }
+
+ /**
+ * Get the file length in microseconds.
+ *
+ * @return the file length in microseconds or UNKNOWN_LENGTH
+ */
+ public long getMicrosecondLength()
+ {
+ return microsecondLength;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiMessage.java b/libjava/classpath/javax/sound/midi/MidiMessage.java
new file mode 100644
index 00000000000..e265b5eadcc
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiMessage.java
@@ -0,0 +1,126 @@
+/* MidiMessage.java -- base class for MIDI messages.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * The base class for all MIDI messages.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiMessage implements Cloneable
+{
+ /**
+ * MIDI message data.
+ */
+ protected byte data[];
+
+ /**
+ * The total length of the MIDI message.
+ */
+ protected int length;
+
+ /**
+ * MidiMessage contructor.
+ *
+ * @param data a valid MIDI message
+ */
+ protected MidiMessage(byte[] data)
+ {
+ this.data = data;
+ this.length = data.length;
+ }
+
+ /**
+ * Set the complete MIDI message.
+ *
+ * @param data The complete MIDI message.
+ * @param length The length of the MIDI message.
+ * @throws InvalidMidiDataException Thrown when the MIDI message is invalid.
+ */
+ protected void setMessage(byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ this.data = new byte[length];
+ System.arraycopy(data, 0, this.data, 0, length);
+ this.length = length;
+ }
+
+ /**
+ * Get the MIDI message data.
+ *
+ * @return an array containing the MIDI message data
+ */
+ public byte[] getMessage()
+ {
+ byte copy[] = new byte[length];
+ System.arraycopy(data, 0, copy, 0, length);
+ return copy;
+ }
+
+ /**
+ * Get the status byte of the MIDI message (as an int)
+ *
+ * @return the status byte of the MIDI message (as an int), or zero if the message length is zero.
+ */
+ public int getStatus()
+ {
+ if (length > 0)
+ return (data[0] & 0xff);
+ else
+ return 0;
+ }
+
+ /**
+ * Get the length of the MIDI message.
+ *
+ * @return the length of the MIDI messsage
+ */
+ public int getLength()
+ {
+ return length;
+ }
+
+ /* Create a clone of this object.
+ *
+ * @see java.lang.Object#clone()
+ */
+ public abstract Object clone();
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiSystem.java b/libjava/classpath/javax/sound/midi/MidiSystem.java
new file mode 100644
index 00000000000..8ea12eb7002
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiSystem.java
@@ -0,0 +1,566 @@
+/* MidiSystem.java -- Access system MIDI resources
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import gnu.classpath.ServiceFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+import javax.sound.midi.spi.MidiDeviceProvider;
+import javax.sound.midi.spi.MidiFileReader;
+import javax.sound.midi.spi.MidiFileWriter;
+import javax.sound.midi.spi.SoundbankReader;
+
+/**
+ * MidiSystem provides access to the computer system's MIDI resources,
+ * as well as utility routines for reading MIDI files and more.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiSystem
+{
+ /**
+ * Get an array of all available MIDI devices.
+ *
+ * @return a possibly empty array of all available MIDI devices
+ */
+ public static MidiDevice.Info[] getMidiDeviceInfo()
+ {
+ Iterator deviceProviders =
+ ServiceFactory.lookupProviders(MidiDeviceProvider.class);
+ List infoList = new ArrayList();
+
+ while (deviceProviders.hasNext())
+ {
+ MidiDeviceProvider provider = (MidiDeviceProvider) deviceProviders.next();
+ MidiDevice.Info[] infos = provider.getDeviceInfo();
+ for (int i = infos.length; i > 0; )
+ infoList.add(infos[--i]);
+ }
+
+ return (MidiDevice.Info[])
+ infoList.toArray(new MidiDevice.Info[infoList.size()]);
+ }
+
+ /**
+ * Get the specified MIDI device.
+ *
+ * @param info a description of the device we're looking for
+ * @return the requested MIDI device
+ * @throws MidiUnavailableException if no MIDI devices are configured or found
+ * @throws IllegalArgumentException if the device described by info is not found
+ */
+ public static MidiDevice getMidiDevice(MidiDevice.Info info)
+ throws MidiUnavailableException
+ {
+ Iterator deviceProviders =
+ ServiceFactory.lookupProviders(MidiDeviceProvider.class);
+
+ if (! deviceProviders.hasNext())
+ throw new MidiUnavailableException("No MIDI device providers available.");
+
+ do
+ {
+ MidiDeviceProvider provider =
+ (MidiDeviceProvider) deviceProviders.next();
+ if (provider.isDeviceSupported(info))
+ return provider.getDevice(info);
+ } while (deviceProviders.hasNext());
+
+ throw new IllegalArgumentException("MIDI device "
+ + info + " not available.");
+ }
+
+ /**
+ * Get the default Receiver instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Receiver instance
+ * @throws MidiUnavailableException if no Receiver is found
+ */
+ public static Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // receiver device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Receiver)
+ return (Receiver) device;
+ }
+ throw new MidiUnavailableException("No Receiver device available");
+ }
+
+ /**
+ * Get the default Transmitter instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Transmitter instance
+ * @throws MidiUnavailableException if no Transmitter is found
+ */
+ public static Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // Transmitter device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Transmitter)
+ return (Transmitter) device;
+ }
+ throw new MidiUnavailableException("No Transmitter device available");
+ }
+
+ /**
+ * Get the default Synthesizer instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Synthesizer instance
+ * @throws MidiUnavailableException if no Synthesizer is found
+ */
+ public static Synthesizer getSynthesizer() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // Synthesizer device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Synthesizer)
+ return (Synthesizer) device;
+ }
+ throw new MidiUnavailableException("No Synthesizer device available");
+ }
+
+ /**
+ * Get the default Sequencer instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Sequencer instance
+ * @throws MidiUnavailableException if no Sequencer is found
+ */
+ public static Sequencer getSequencer() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // Sequencer device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Sequencer)
+ return (Sequencer) device;
+ }
+ throw new MidiUnavailableException("No Sequencer device available");
+ }
+
+ /**
+ * Read a Soundbank object from the given stream.
+ *
+ * @param stream the stream from which to read the Soundbank
+ * @return the Soundbank object
+ * @throws InvalidMidiDataException if we were unable to read the soundbank
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Soundbank getSoundbank(InputStream stream)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
+ while (readers.hasNext())
+ {
+ SoundbankReader sr = (SoundbankReader) readers.next();
+ Soundbank sb = sr.getSoundbank(stream);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read soundbank from stream");
+ }
+
+ /**
+ * Read a Soundbank object from the given url.
+ *
+ * @param url the url from which to read the Soundbank
+ * @return the Soundbank object
+ * @throws InvalidMidiDataException if we were unable to read the soundbank
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Soundbank getSoundbank(URL url)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
+ while (readers.hasNext())
+ {
+ SoundbankReader sr = (SoundbankReader) readers.next();
+ Soundbank sb = sr.getSoundbank(url);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read from url " + url);
+ }
+
+ /**
+ * Read a Soundbank object from the given file.
+ *
+ * @param file the file from which to read the Soundbank
+ * @return the Soundbank object
+ * @throws InvalidMidiDataException if we were unable to read the soundbank
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Soundbank getSoundbank(File file)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
+ while (readers.hasNext())
+ {
+ SoundbankReader sr = (SoundbankReader) readers.next();
+ Soundbank sb = sr.getSoundbank(file);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read soundbank from file "
+ + file);
+ }
+
+ /**
+ * Read a MidiFileFormat object from the given stream.
+ *
+ * @param stream the stream from which to read the MidiFileFormat
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if we were unable to read the MidiFileFormat
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static MidiFileFormat getMidiFileFormat(InputStream stream)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ MidiFileFormat sb = sr.getMidiFileFormat(stream);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Can't read MidiFileFormat from stream");
+ }
+
+ /**
+ * Read a MidiFileFormat object from the given url.
+ *
+ * @param url the url from which to read the MidiFileFormat
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if we were unable to read the MidiFileFormat
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static MidiFileFormat getMidiFileFormat(URL url)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ MidiFileFormat sb = sr.getMidiFileFormat(url);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read from url " + url);
+ }
+
+ /**
+ * Read a MidiFileFormat object from the given file.
+ *
+ * @param file the file from which to read the MidiFileFormat
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if we were unable to read the MidiFileFormat
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static MidiFileFormat getMidiFileFormat(File file)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ MidiFileFormat sb = sr.getMidiFileFormat(file);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Can't read MidiFileFormat from file "
+ + file);
+ }
+
+ /**
+ * Read a Sequence object from the given stream.
+ *
+ * @param stream the stream from which to read the Sequence
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if we were unable to read the Sequence
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Sequence getSequence(InputStream stream)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ Sequence sq = sr.getSequence(stream);
+ if (sq != null)
+ return sq;
+ }
+ throw new InvalidMidiDataException("Can't read Sequence from stream");
+ }
+
+ /**
+ * Read a Sequence object from the given url.
+ *
+ * @param url the url from which to read the Sequence
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if we were unable to read the Sequence
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Sequence getSequence(URL url)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ Sequence sq = sr.getSequence(url);
+ if (sq != null)
+ return sq;
+ }
+ throw new InvalidMidiDataException("Cannot read from url " + url);
+ }
+
+ /**
+ * Read a Sequence object from the given file.
+ *
+ * @param file the file from which to read the Sequence
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if we were unable to read the Sequence
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Sequence getSequence(File file)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ Sequence sq = sr.getSequence(file);
+ if (sq != null)
+ return sq;
+ }
+ throw new InvalidMidiDataException("Can't read Sequence from file "
+ + file);
+ }
+
+ /**
+ * Return an array of supported MIDI file types on this system.
+ *
+ * @return the array of supported MIDI file types
+ */
+ public static int[] getMidiFileTypes()
+ {
+ // We only support a max of 3 MIDI file types.
+ boolean supported[] = new boolean[3];
+ // The number of supported formats.
+ int count = 0;
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+ int types[] = fw.getMidiFileTypes();
+ for (int i = types.length; i > 0;)
+ {
+ int type = types[--i];
+ if (supported[type] == false)
+ {
+ count++;
+ supported[type] = true;
+ }
+ }
+ }
+ int result[] = new int[count];
+ for (int i = supported.length; i > 0;)
+ {
+ if (supported[--i])
+ result[--count] = i;
+ }
+ return result;
+ }
+
+ /**
+ * Return true if the system supports writing files of type fileType.
+ *
+ * @param fileType the MIDI file type we want to write
+ * @return true if we can write fileType files, false otherwise
+ */
+ public static boolean isFileTypeSupported(int fileType)
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return an array of supported MIDI file types on this system
+ * for the given sequnce.
+ *
+ * @param sequence the sequnce to write
+ * @return the array of supported MIDI file types
+ */
+ public static int[] getMidiFileTypes(Sequence sequence)
+ {
+ // We only support a max of 3 MIDI file types.
+ boolean supported[] = new boolean[3];
+ // The number of supported formats.
+ int count = 0;
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+ int types[] = fw.getMidiFileTypes(sequence);
+ for (int i = types.length; i > 0;)
+ {
+ int type = types[--i];
+ if (supported[type] == false)
+ {
+ count++;
+ supported[type] = true;
+ }
+ }
+ }
+ int result[] = new int[count];
+ for (int i = supported.length; i > 0;)
+ {
+ if (supported[--i])
+ result[--count] = i;
+ }
+ return result;
+ }
+
+ /**
+ * Return true if the system supports writing files of type fileType
+ * for the given sequence.
+ *
+ * @param fileType the MIDI file type we want to write
+ * @param sequence the Sequence we want to write
+ * @return true if we can write fileType files for sequence, false otherwise
+ */
+ public static boolean isFileTypeSupported(int fileType, Sequence sequence)
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType, sequence))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write a sequence to an output stream using a specific MIDI file format.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file format to use
+ * @param out the output stream to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O exception happens
+ * @throws IllegalArgumentException if fileType is not supported for in
+ */
+ public static int write(Sequence in, int fileType, OutputStream out)
+ throws IOException
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType, in))
+ return fw.write(in, fileType, out);
+ }
+ throw new IllegalArgumentException("File type "
+ + fileType + " is not supported");
+ }
+
+ /**
+ * Write a sequence to a file using a specific MIDI file format.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file format to use
+ * @param out the file to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O exception happens
+ * @throws IllegalArgumentException if fileType is not supported for in
+ */
+ public static int write(Sequence in, int fileType, File out)
+ throws IOException
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType, in))
+ return fw.write(in, fileType, out);
+ }
+ throw new IllegalArgumentException("File type "
+ + fileType + " is not supported");
+ }
+}
+
diff --git a/libjava/classpath/javax/sound/midi/MidiUnavailableException.java b/libjava/classpath/javax/sound/midi/MidiUnavailableException.java
new file mode 100644
index 00000000000..d4b85e810aa
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiUnavailableException.java
@@ -0,0 +1,90 @@
+/* MidiUnavailableException.java -- MIDI resources are not available
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This exception is thrown when MIDI resources are not available.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiUnavailableException extends Exception
+{
+ private static final long serialVersionUID = 6093809578628944323L;
+
+ /**
+ * Create a MidiUnavailableException.
+ */
+ public MidiUnavailableException()
+ {
+ super();
+ }
+
+ /**
+ * Create an MidiUnavailableException object.
+ *
+ * @param s the exception message string
+ */
+ public MidiUnavailableException(String s)
+ {
+ super(s);
+ }
+
+ /**
+ * Create an MidiUnavailableException object.
+ *
+ * @param s the exception message string
+ * @param cause the root cause of the exception
+ */
+ public MidiUnavailableException(String s, Throwable cause)
+ {
+ super(s, cause);
+ }
+
+ /**
+ * Create an MidiUnavailableException object.
+ *
+ * @param cause the root cause of the exception
+ */
+ public MidiUnavailableException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Patch.java b/libjava/classpath/javax/sound/midi/Patch.java
new file mode 100644
index 00000000000..eb9d8bc3b82
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Patch.java
@@ -0,0 +1,86 @@
+/* Patch.java -- A MIDI patch.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A Patch describes where an Instrument is loaded on a Synthesizer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class Patch
+{
+ // Private data describing the patch
+ private int bank = 0;
+ private int program = 0;
+
+ /**
+ * Create a Patch object, specifying the bank and program in which this Patch
+ * is located.
+ *
+ * @param bank the bank in which this Patch is located
+ * @param program the program in which this Patch is located
+ */
+ public Patch(int bank, int program)
+ {
+ this.bank = bank;
+ this.program = program;
+ }
+
+ /**
+ * Get the bank in which this Patch is located.
+ *
+ * @return the bank in which this Patch is located
+ */
+ public int getBank()
+ {
+ return bank;
+ }
+
+ /**
+ * Get the program in which this Patch is located.
+ *
+ * @return the program in which this Patch is located
+ */
+ public int getProgram()
+ {
+ return program;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Receiver.java b/libjava/classpath/javax/sound/midi/Receiver.java
new file mode 100644
index 00000000000..0e70b2809e9
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Receiver.java
@@ -0,0 +1,66 @@
+/* Receiver.java -- An interface for objects receiving MIDI data
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This interface describes the methods required by objects receiving MIDI
+ * messages.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Receiver
+{
+ /**
+ * Send a MIDI message and timestamp. Some receivers don't support
+ * timestamps, in which case timeStamp should be -1.
+ *
+ * @param message the MIDI message to send
+ * @param timeStamp time timestamp for this message in microseconds (or -1)
+ * @throws IllegalStateException if the receiver is closed
+ */
+ public void send(MidiMessage message, long timeStamp)
+ throws IllegalStateException;
+
+ /**
+ * Close this receiver, possibly freeing system resources.
+ */
+ public void close();
+}
diff --git a/libjava/classpath/javax/sound/midi/Sequence.java b/libjava/classpath/javax/sound/midi/Sequence.java
new file mode 100644
index 00000000000..1a43d207ce6
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Sequence.java
@@ -0,0 +1,248 @@
+/* Sequence.java -- A sequence of MIDI events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * Objects of this type represent sequences of MIDI messages that can be
+ * played back by a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class Sequence
+{
+ /**
+ * The timing division type for this sequence (PPQ or SMPTE*)
+ */
+ protected float divisionType;
+
+ /**
+ * The timing resolution in ticks/beat or ticks/frame, depending on the
+ * division type.
+ */
+ protected int resolution;
+
+ /**
+ * The MIDI tracks used by this sequence.
+ */
+ protected Vector tracks;
+
+ /**
+ * Tempo-based timing. Resolution is specified in ticks per beat.
+ */
+ public static final float PPQ = 0.0f;
+
+ /**
+ * 24 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_24 = 24.0f;
+
+ /**
+ * 25 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_25 = 25.0f;
+
+ /**
+ * 30 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_30 = 30.0f;
+
+ /**
+ * 29.97 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_30DROP = 29.97f;
+
+ // Private helper class
+ private void init(float divisionType, int resolution, int numTracks)
+ throws InvalidMidiDataException
+ {
+ if (divisionType != PPQ
+ && divisionType != SMPTE_24
+ && divisionType != SMPTE_25
+ && divisionType != SMPTE_30
+ && divisionType != SMPTE_30DROP)
+ throw new InvalidMidiDataException("Invalid division type ("
+ + divisionType + ")");
+
+ this.divisionType = divisionType;
+ this.resolution = resolution;
+
+ tracks = new Vector(numTracks);
+ while (numTracks > 0)
+ tracks.set(--numTracks, new Track());
+ }
+
+ /**
+ * Create a MIDI sequence object with no initial tracks.
+ *
+ * @param divisionType the division type (must be one of PPQ or SMPTE_*)
+ * @param resolution the timing resolution
+ * @throws InvalidMidiDataException if the division type is invalid
+ */
+ public Sequence(float divisionType, int resolution)
+ throws InvalidMidiDataException
+ {
+ init(divisionType, resolution, 0);
+ }
+
+ /**
+ * Create a MIDI seqence object.
+ *
+ * @param divisionType the division type (must be one of PPQ or SMPTE_*)
+ * @param resolution the timing resolution
+ * @param numTracks the number of initial tracks
+ * @throws InvalidMidiDataException if the division type is invalid
+ */
+ public Sequence(float divisionType, int resolution, int numTracks)
+ throws InvalidMidiDataException
+ {
+ init(divisionType, resolution, 0);
+ }
+
+ /**
+ * The division type of this sequence.
+ *
+ * @return division type of this sequence
+ */
+ public float getDivisionType()
+ {
+ return divisionType;
+ }
+
+ /**
+ * The timing resolution for this sequence, relative to the division type.
+ *
+ * @return the timing resolution for this sequence
+ */
+ public int getResolution()
+ {
+ return resolution;
+ }
+
+ /**
+ * Create a new empty MIDI track and add it to this sequence.
+ *
+ * @return the newly create MIDI track
+ */
+ public Track createTrack()
+ {
+ Track track = new Track();
+ tracks.add(track);
+ return track;
+ }
+
+ /**
+ * Remove the specified MIDI track from this sequence.
+ *
+ * @param track the track to remove
+ * @return true if track was removed and false othewise
+ */
+ public boolean deleteTrack(Track track)
+ {
+ return tracks.remove(track);
+ }
+
+ /**
+ * Get an array of MIDI tracks used in this sequence.
+ *
+ * @return a possibly empty array of tracks
+ */
+ public Track[] getTracks()
+ {
+ return (Track[]) tracks.toArray(new Track[tracks.size()]);
+ }
+
+ /**
+ * The length of this sequence in microseconds.
+ *
+ * @return the length of this sequence in microseconds
+ */
+ public long getMicrosecondLength()
+ {
+ long tickLength = getTickLength();
+
+ if (divisionType == PPQ)
+ {
+ // FIXME
+ // How can this possible be computed? PPQ is pulses per quarter-note,
+ // which is dependent on the tempo of the Sequencer.
+ throw new
+ UnsupportedOperationException("Can't compute PPQ based lengths yet");
+ }
+ else
+ {
+ // This is a fixed tick per frame computation
+ return (long) ((tickLength * 1000000) / (divisionType * resolution));
+ }
+ }
+
+ /**
+ * The length of this sequence in MIDI ticks.
+ *
+ * @return the length of this sequence in MIDI ticks
+ */
+ public long getTickLength()
+ {
+ long length = 0;
+ Iterator itr = tracks.iterator();
+ while (itr.hasNext())
+ {
+ Track track = (Track) itr.next();
+ long trackTicks = track.ticks();
+ if (trackTicks > length)
+ length = trackTicks;
+ }
+ return length;
+ }
+
+ /**
+ * Get an array of patches used in this sequence.
+ *
+ * @return an array of patches used in this sequence
+ */
+ public Patch[] getPatchList()
+ {
+ // FIXE: not quite sure how to do this yet.
+ throw new UnsupportedOperationException("Can't get patch list yet");
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Sequencer.java b/libjava/classpath/javax/sound/midi/Sequencer.java
new file mode 100644
index 00000000000..894d876e91f
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Sequencer.java
@@ -0,0 +1,402 @@
+/* Sequencer.java -- A MIDI sequencer object
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A Sequencer object plays MIDI sequences described as Sequence objects.
+ * This class provides methods for loading and unloading sequences, as well
+ * as basic transport controls.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Sequencer extends MidiDevice
+{
+ /**
+ * Set the Sequence object for this sequencer.
+ *
+ * @param seq the Sequence to process
+ * @throws InvalidMidiDataException if the sequence is invalid for any reason
+ */
+ public void setSequence(Sequence seq) throws InvalidMidiDataException;
+
+ /**
+ * Set the sequence for this sequencer. istream reads on a valid MIDI file.
+ *
+ * @param istream an input stream for a valid MIDI file
+ * @throws IOException if an I/O exception happens
+ * @throws InvalidMidiDataException if the MIDI file contains bad data
+ */
+ public void setSequence(InputStream istream)
+ throws IOException, InvalidMidiDataException;
+
+ /**
+ * Get the current sequence object for this sequencer.
+ *
+ * @return the current sequence object. May be null.
+ */
+ public Sequence getSequence();
+
+ /**
+ * Start playback of the current sequence.
+ */
+ public void start();
+
+ /**
+ * Stop playback of the current sequence.
+ */
+ public void stop();
+
+ /**
+ * Returns true if the sequence is playing.
+ *
+ * @return true if the sequence is playing and false otherwise
+ */
+ public boolean isRunning();
+
+ /**
+ * Start playback and record of MIDI events.
+ * Any tracks enabled for recording will have their events replaced.
+ * Any newly recorded events, and all events from non-recording tracks
+ * will be sent to the sequencer's transmitter.
+ */
+ public void startRecording();
+
+ /**
+ * Stop recording, although continue playing.
+ */
+ public void stopRecording();
+
+ /**
+ * Returns true if sequence is recording.
+ *
+ * @return true if the sequence is recording and false otherwise
+ */
+ public boolean isRecording();
+
+ /**
+ * Enable recording for a specific track using data from a specific channel.
+ *
+ * @param track the track to enable for recording
+ * @param channel the channel from which to record
+ */
+ public void recordEnable(Track track, int channel);
+
+ /**
+ * Disable recording for a specific track.
+ *
+ * @param track the track to disable recording for
+ */
+ public void recordDisable(Track track);
+
+ /**
+ * Get the current tempo in beats per minute.
+ *
+ * @return the current tempo in beats per minute
+ */
+ public float getTempoInBPM();
+
+ /**
+ * Sets the current tempo in beats per minute.
+ *
+ * @param bpm the new tempo in bears per minutes
+ */
+ public void setTempoInBPM(float bpm);
+
+ /**
+ * Get the current tempo in microseconds per quarter note.
+ *
+ * @return the current tempo in microseconds per quarter note.
+ */
+ public float getTempoInMPQ();
+
+ /**
+ * Sets the current tempo in microseconds per quarter note.
+ *
+ * @param mpq the new tempo in microseconds per quarter note.
+ */
+ public void setTempoInMPQ(float mpq);
+
+ /**
+ * Set a scaling factor for the playback tempo, which is 1.0 by default.
+ *
+ * @param factor the new tempo scaling factor
+ */
+ public void setTempoFactor(float factor);
+
+ /**
+ * Get the current scaling factor for the playback tempo.
+ *
+ * @return the current tempo scaling factor
+ */
+ public float getTempoFactor();
+
+ /**
+ * Get the length of the current sequence in MIDI ticks.
+ *
+ * @return the length of the current sequence in MIDI ticks
+ */
+ public long getTickLength();
+
+ /**
+ * Get the current playback position of the sequencer in MIDI ticks.
+ *
+ * @return the current playback position of the sequencer in MIDI ticks
+ */
+ public long getTickPosition();
+
+ /**
+ * Set the current playback position of the sequencer in MIDI ticks.
+ *
+ * @param tick the new playback position of the sequencer in MIDI ticks
+ */
+ public void setTickPosition(long tick);
+
+ /**
+ * Get the length of the current sequence in microseconds.
+ *
+ * @return the length of the current sequence in microseconds
+ */
+ public long getMicrosecondLength();
+
+ /**
+ * Get the current playback position of the sequencer in microseconds.
+ *
+ * @return the current playback position of the sequencer in microseconds
+ */
+ public long getMicrosecondPosition();
+
+ /**
+ * Set the current playback position of the sequencer in microseconds.
+ *
+ * @param microsecond the new playback position of the sequencer in microseconds
+ */
+ public void setMicrosecondPosition(long microsecond);
+
+ /**
+ * Set the source of timing information. sync must be found in the array
+ * returned by getMasterSyncModes().
+ * FIXME: What happens if it isn't?
+ *
+ * @param sync the new source of timing information
+ */
+ public void setMasterSyncMode(SyncMode sync);
+
+ /**
+ * Get the source of timing information.
+ *
+ * @return the current source of timing information
+ */
+ public SyncMode getMasterSyncMode();
+
+ /**
+ * Get an array of timing sources supported by this sequencer.
+ *
+ * @return an array of timing sources supported by this sequencer
+ */
+ public SyncMode[] getMasterSyncModes();
+
+ /**
+ * Set the slave synchronization mode for this sequencer. sync must be
+ * found in the array returned by getSlaveSyncModes().
+ * FIXME: What happens if it isn't?
+ *
+ * @param sync the new slave sync mode for this sequencer
+ */
+ public void setSlaveSyncMode(SyncMode sync);
+
+ /**
+ * Get the current slave synchronization mode.
+ *
+ * @return the current slave synchronization mode
+ */
+ public SyncMode getSlaveSyncMode();
+
+ /**
+ * Get an array of slave sync modes supported by this sequencer.
+ *
+ * @return an array of slave sync modes supported by this sequencer
+ */
+ public SyncMode[] getSlaveSyncModes();
+
+ /**
+ * Sets the mute state for a specific track.
+ *
+ * @param track the track to modify
+ * @param mute the new mute state
+ */
+ public void setTrackMute(int track, boolean mute);
+
+ /**
+ * Get the mute state of a specific track.
+ *
+ * @param track the track to query
+ * @return the mute state for track
+ */
+ public boolean getTrackMute(int track);
+
+ /**
+ * Sets the solo state for a specific track.
+ *
+ * @param track the track to modify
+ * @param solo the new solo state
+ */
+ public void setTrackSolo(int track, boolean solo);
+
+ /**
+ * Get the solo state for a specific track.
+ *
+ * @param track the track to query
+ * @return the solo state for track
+ */
+ public boolean getTrackSolo(int track);
+
+ /**
+ * Add a meta event listening object to this sequencer. It will receive
+ * notification whenever the sequencer processes a meta event.
+ * A listener may fail to get added if this sequencer doesn't support
+ * meta events.
+ *
+ * @param listener the listener to add
+ * @return true if listener was added, false othewise
+ */
+ public boolean addMetaEventListener(MetaEventListener listener);
+
+ /**
+ * Remove a meta event listener from this sequencer.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeMetaEventListener(MetaEventListener listener);
+
+ /**
+ * Add a controller event listening object to this sequencer. It will
+ * receive notification whenever the sequencer processes a controller
+ * event for a specified controller number..
+ *
+ * @param listener the listener to add
+ * @param controllers the conroller numbers to listen to
+ * @return the controller numbers being listened to
+ */
+ public int[] addControllerEventListener(ControllerEventListener listener,
+ int controllers[]);
+
+ /**
+ * Remove a controller listener from this sequencer for the specified
+ * controller numbers.
+ *
+ * @param listener the listener to remove
+ * @param controllers the controllers to unlisten
+ * @return the controller numbers being unlistened
+ */
+ public int[] removeControllerEventListener(ControllerEventListener listener,
+ int controllers[]);
+
+ /**
+ * A SyncMode object represents the mechanism by which a MIDI sequencer
+ * synchronizes time with a master or slave device.
+ *
+ * @author green@redhat.com
+ *
+ */
+ public static class SyncMode
+ {
+ /**
+ * A master sync mode indicating the use of an internal sequencer clock.
+ */
+ public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock");
+
+ /**
+ * A master or slave sync mode indicating the use of MIDI clock messages.
+ */
+ public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync");
+
+ /**
+ * A master or slave sync mode indicating the use of MIDI Time Code
+ * messages.
+ */
+ public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code");
+
+ /**
+ * A slave sync mode indicating that no timing info will be transmitted.
+ */
+ public static final SyncMode NO_SYNC = new SyncMode("No Timing");
+
+ // The name
+ private String name;
+
+ /**
+ * Create a new SyncMode object
+ * @param name the SyncMode name
+ */
+ protected SyncMode(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * SyncMode objects are only equal when identical.
+ */
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ /**
+ * SyncMode objects use the Object hashCode.
+ */
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Use the SyncMode name as the string representation.
+ * @see java.lang.Object#toString()
+ */
+ public final String toString()
+ {
+ return name;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/ShortMessage.java b/libjava/classpath/javax/sound/midi/ShortMessage.java
new file mode 100644
index 00000000000..43c0e25fe72
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/ShortMessage.java
@@ -0,0 +1,344 @@
+/* ShortMessage.java -- A MIDI message no longer than 3 bytes
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A short MIDI message that is no longer than 3 bytes long.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class ShortMessage extends MidiMessage
+{
+ /**
+ * Status byte for System Exclusive message.
+ */
+ public static final int SYSTEM_EXCLUSIVE = 0xF0;
+
+ /**
+ * Status byte for Time Code message.
+ */
+ public static final int MIDI_TIME_CODE = 0xF1;
+
+ /**
+ * Status byte for Song Position Pointer message.
+ */
+ public static final int SONG_POSITION_POINTER = 0xF2;
+
+ /**
+ * Status byte for Song Select message.
+ */
+ public static final int SONG_SELECT = 0xF3;
+
+ /**
+ * Status byte for Tune Request message.
+ */
+ public static final int TUNE_REQUEST = 0xF6;
+
+ /**
+ * Status byte for End Of Exclusive message.
+ */
+ public static final int END_OF_EXCLUSIVE = 0xF7;
+
+ /**
+ * Status byte for Timing Clock message.
+ */
+ public static final int TIMING_CLOCK = 0xF8;
+
+ /**
+ * Status byte for Start message.
+ */
+ public static final int START = 0xFA;
+
+ /**
+ * Status byte for Continue message.
+ */
+ public static final int CONTINUE = 0xFB;
+
+ /**
+ * Status byte for Stop message.
+ */
+ public static final int STOP = 0xFC;
+
+ /**
+ * Status byte for Active Sensing message.
+ */
+ public static final int ACTIVE_SENSING = 0xFE;
+
+ /**
+ * Status byte for System Reset message.
+ */
+ public static final int SYSTEM_RESET = 0xFF;
+
+ /**
+ * Status nibble for Note Off message.
+ */
+ public static final int NOTE_OFF = 0x80;
+
+ /**
+ * Status nibble for Note On message.
+ */
+ public static final int NOTE_ON = 0x90;
+
+ /**
+ * Status nibble for Poly Pressure message.
+ */
+ public static final int POLY_PRESSURE = 0xA0;
+
+ /**
+ * Status nibble for Control Change message.
+ */
+ public static final int CONTROL_CHANGE = 0xB0;
+
+ /**
+ * Status nibble for Program Change message.
+ */
+ public static final int PROGRAM_CHANGE = 0xC0;
+
+ /**
+ * Statue nibble for Channel Pressure message.
+ */
+ public static final int CHANNEL_PRESSURE = 0xD0;
+
+ /**
+ * Status nibble for Pitch Bend message.
+ */
+ public static final int PITCH_BEND = 0xE0;
+
+ // Create and initialize a default, arbitrary message.
+ private static byte[] defaultMessage;
+ static
+ {
+ defaultMessage = new byte[1];
+ defaultMessage[0] = (byte) STOP;
+ }
+
+ /**
+ * Create a short MIDI message.
+ *
+ * The spec requires that this represent a valid MIDI message, but doesn't
+ * specify what it should be. We've chosen the STOP message for our
+ * implementation.
+ */
+ public ShortMessage()
+ {
+ this(defaultMessage);
+ }
+
+ /**
+ * Create a short MIDI message.
+ *
+ * The data argument should be a valid MIDI message. Unfortunately the spec
+ * does not allow us to throw an InvalidMidiDataException if data is invalid.
+ *
+ * @param data the message data
+ */
+ public ShortMessage(byte[] data)
+ {
+ super(data);
+ }
+
+ /**
+ * Set the MIDI message.
+ *
+ * @param status the status byte for this message
+ * @param data1 the first data byte for this message
+ * @param data2 the second data byte for this message
+ * @throws InvalidMidiDataException if status is bad, or data is out of range
+ */
+ public void setMessage(int status, int data1, int data2)
+ throws InvalidMidiDataException
+ {
+ length = getDataLength(status);
+ length++;
+ if (data == null || data.length < length)
+ data = new byte[length];
+ data[0] = (byte) status;
+ if (length > 1)
+ {
+ if (data1 < 0 || data1 > 127)
+ throw new InvalidMidiDataException("data1 (" + data1
+ + ") must be between 0 and 127.");
+ data[1] = (byte) data1;
+ if (length > 2)
+ {
+ if (data2 < 0 || data2 > 127)
+ throw new InvalidMidiDataException("data2 (" + data2
+ + ") must be between 0 and 127.");
+ data[2] = (byte) data2;
+ }
+ }
+ }
+
+ public void setMessage(int command, int channel, int data1, int data2)
+ throws InvalidMidiDataException
+ {
+ // TODO: This could probably stand some error checking.
+ // It currently assumes command and channel are valid values.
+ setMessage(command + channel, data1, data2);
+ }
+
+ /**
+ * Set the MIDI message to one that requires no data bytes.
+ *
+ * @param status the status byte for this message
+ * @throws InvalidMidiDataException if status is bad, or requires data
+ */
+ public void setMessage(int status) throws InvalidMidiDataException
+ {
+ int length = getDataLength(status);
+ if (length != 0)
+ throw new InvalidMidiDataException("Status byte 0x"
+ + Integer.toHexString(status)
+ + " requires "
+ + length + " bytes of data.");
+ setMessage(status, 0, 0);
+ }
+
+
+ /**
+ * Return the number of data bytes needed for a given MIDI status byte.
+ *
+ * @param status the status byte for a short MIDI message
+ * @return the number of data bytes needed for this status byte
+ * @throws InvalidMidiDataException if status is an invalid status byte
+ */
+ protected final int getDataLength(int status) throws InvalidMidiDataException
+ {
+ int originalStatus = status;
+
+ if ((status & 0xF0) != 0xF0)
+ status &= 0xF0;
+
+ switch (status)
+ {
+ case NOTE_OFF:
+ case NOTE_ON:
+ case POLY_PRESSURE:
+ case CONTROL_CHANGE:
+ case PITCH_BEND:
+ case SONG_POSITION_POINTER:
+ return 2;
+
+ case PROGRAM_CHANGE:
+ case CHANNEL_PRESSURE:
+ case SONG_SELECT:
+ case 0xF5: // FIXME: unofficial bus select. Not in spec??
+ return 1;
+
+ case SYSTEM_EXCLUSIVE:
+ return 0; // FIXME: is this correct?
+
+ case TUNE_REQUEST:
+ case END_OF_EXCLUSIVE:
+ case TIMING_CLOCK:
+ case START:
+ case CONTINUE:
+ case STOP:
+ case ACTIVE_SENSING:
+ case SYSTEM_RESET:
+ return 0;
+
+ default:
+ throw new InvalidMidiDataException("Invalid status: 0x"
+ + Integer.toHexString(originalStatus));
+ }
+ }
+
+ /**
+ * Get the channel information from this MIDI message, assuming it is a
+ * MIDI channel message.
+ *
+ * @return the MIDI channel for this message
+ */
+ public int getChannel()
+ {
+ return data[0] & 0x0F;
+ }
+
+ /**
+ * Get the command nibble from this MIDI message, assuming it is a MIDI
+ * channel message.
+ *
+ * @return the MIDI command for this message
+ */
+ public int getCommand()
+ {
+ return data[0] & 0xF0;
+ }
+
+ /**
+ * Get the first data byte from this message, assuming it exists, and
+ * zero otherwise.
+ *
+ * @return the first data byte or zero if none exists.
+ */
+ public int getData1()
+ {
+ if (length > 1)
+ return data[1];
+ else
+ return 0;
+ }
+
+ /**
+ * Get the second data byte from this message, assuming it exists, and
+ * zero otherwise.
+ *
+ * @return the second date byte or zero if none exists.
+ */
+ public int getData2()
+ {
+ if (length > 2)
+ return data[2];
+ else
+ return 0;
+ }
+
+ /* Create a deep-copy clone of this object.
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ byte message[] = new byte[length];
+ System.arraycopy(data, 0, message, 0, length);
+ return new ShortMessage(message);
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Soundbank.java b/libjava/classpath/javax/sound/midi/Soundbank.java
new file mode 100644
index 00000000000..16d9d79eaa6
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Soundbank.java
@@ -0,0 +1,101 @@
+/* Soundbank.java -- Container of Instruments to be loaded into a Synthesizer
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A Soundbank is a container for instruments which may be loaded into
+ * a Synthesizer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Soundbank
+{
+ /**
+ * Get the sound bank name.
+ *
+ * @return the sound bank name
+ */
+ String getName();
+
+ /**
+ * Get the sound bank version.
+ *
+ * @return the sound bank version
+ */
+ String getVersion();
+
+ /**
+ * Get the sound bank vendor.
+ *
+ * @return the sound bank vendor
+ */
+ String getVendor();
+
+
+ /**
+ * Get the sound bank description.
+ *
+ * @return the sound bank description
+ */
+ String getDescription();
+
+ /**
+ * Get an array of non-Instrument resources in this sound bank.
+ *
+ * @return an array of non-instrument resources in this sound bank
+ */
+ SoundbankResource[] getResources();
+
+ /**
+ * Get an array of Instruments in this sound bank.
+ *
+ * @return an array of instruments in this sound bank
+ */
+ Instrument[] getInstruments();
+
+ /**
+ * Get the Instrument for the given Patch.
+ *
+ * @param patch the Patch to search for
+ * @return the Instrument corresponding to patch
+ */
+ Instrument getInstrument(Patch patch);
+}
diff --git a/libjava/classpath/javax/sound/midi/SoundbankResource.java b/libjava/classpath/javax/sound/midi/SoundbankResource.java
new file mode 100644
index 00000000000..435017e4cf2
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/SoundbankResource.java
@@ -0,0 +1,104 @@
+/* SoundbankResource.java -- An audio resource from a sound bank
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * SoundbankResource objects represent audio data stored in a sound bank.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class SoundbankResource
+{
+ private final Soundbank soundbank;
+ private final String name;
+ private final Class dataClass;
+
+ /**
+ * Create a SoundbankResource object.
+ *
+ * @param soundbank the soundbank object containing this resource
+ * @param name the name of the resource
+ * @param dataClass the class used to represent the audio data
+ */
+ protected SoundbankResource(Soundbank soundbank, String name, Class dataClass)
+ {
+ this.soundbank = soundbank;
+ this.name = name;
+ this.dataClass = dataClass;
+ }
+
+ /**
+ * Get the sound bank containing this resource.
+ *
+ * @return the sound bank in which this resource resides
+ */
+ public Soundbank getSoundbank()
+ {
+ return soundbank;
+ }
+
+ /**
+ * Get the name of this resource.
+ *
+ * @return the name of this resource
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the class used to represent the audio data for this resource.
+ *
+ * @return the class used to represent the audio data for this resource
+ */
+ public Class getDataClass()
+ {
+ return dataClass;
+ }
+
+ /**
+ * Get the audio data for this resource.
+ *
+ * @return the audio data object for this resource
+ */
+ public abstract Object getData();
+}
diff --git a/libjava/classpath/javax/sound/midi/Synthesizer.java b/libjava/classpath/javax/sound/midi/Synthesizer.java
new file mode 100644
index 00000000000..22e5e9256f4
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Synthesizer.java
@@ -0,0 +1,173 @@
+/* Synthesizer.java -- A MIDI audio synthesizer interface
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Interface for MIDI audio synthesizer devices.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Synthesizer extends MidiDevice
+{
+ /**
+ * Get the maximum number of notes that the synth can play at once.
+ *
+ * @return the maximum number of notes that the synth can play at once
+ */
+ public int getMaxPolyphony();
+
+ /**
+ * The processing latency for this synth in microseconds.
+ *
+ * @return the processing latency for this synth in microseconds
+ */
+ public long getLatency();
+
+ /**
+ * Get the set of MIDI channels controlled by this synth.
+ *
+ * @return an array of MIDI channels controlled by this synth
+ */
+ public MidiChannel[] getChannels();
+
+ /**
+ * Get the current status for the voices produced by this synth.
+ *
+ * @return an array of VoiceStatus objects, getMaxPolyphony() in length
+ */
+ public VoiceStatus[] getVoiceStatus();
+
+ /**
+ * Returns true is this synth is capable of loading soundbank.
+ *
+ * @param soundbank the Soundbank to examine
+ * @return true if soundbank can be loaded, false otherwise
+ */
+ public boolean isSoundbankSupported(Soundbank soundbank);
+
+ /**
+ * Load an instrument into this synth. The instrument must be part of a
+ * supported soundbank.
+ *
+ * @param instrument the Instrument to load
+ * @return true if the instrument was loaded and false otherwise
+ * @throws IllegalArgumentException if this synth doesn't support instrument
+ */
+ public boolean loadInstrument(Instrument instrument);
+
+ /**
+ * Unload an instrument from this synth.
+ *
+ * @param instrument the Instrument to unload
+ * @throws IllegalArgumentException if this synth doesn't support instrument
+ */
+ public void unloadInstrument(Instrument instrument);
+
+ /**
+ * Move an intrument from one place to another. The instrument at the
+ * target location is unloaded.
+ *
+ * @param from the instrument source
+ * @param to the instrument target
+ * @return if from was remapped
+ * @throws IllegalArgumentException
+ */
+ public boolean remapInstrument(Instrument from, Instrument to);
+
+ /**
+ * Get the default Soundbank for this synth. Return null if there is no
+ * default.
+ *
+ * @return the default Soundbank for this synth, possibly null.
+ */
+ public Soundbank getDefaultSoundbank();
+
+ /**
+ * Get an array containing all instruments in this synthesizer.
+ *
+ * @return an array containing all instruments in this synthesizer
+ */
+ public Instrument[] getAvailableInstruments();
+
+ /**
+ * Get an array containing all instruments loaded in this synthesizer.
+ *
+ * @return an array containing all instruments loaded in this synthesizer
+ */
+ public Instrument[] getLoadedInstruments();
+
+ /**
+ * Load all soundbank instruments into this synthesizer.
+ *
+ * @param soundbank the Soundbank from which to load instruments
+ * @return true if all instruments were loaded, false othewise
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public boolean loadAllInstruments(Soundbank soundbank);
+
+ /**
+ * Unload all soundbank instruments from this synthesizer.
+ *
+ * @param soundbank the Soundbank containing the instruments to unload
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public void unloadAllInstruments(Soundbank soundbank);
+
+ /**
+ * Load a subset of soundbank instruments into this synthesizer. The
+ * subset is defined by an array of Patch objects.
+ *
+ * @param soundbank the Soundbank from which to load instruments
+ * @param patchList the array of patches identifying instruments to load
+ * @return true if instruments were loaded, false otherwise
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public boolean loadInstruments(Soundbank soundbank, Patch[] patchList);
+
+ /**
+ * Unload a subset of soundbank instruments from this synthesizer.
+ *
+ * @param soundbank the Soundbank containing the instruments to unload
+ * @param patchList the array of patches identifying instruments to unload
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public void unloadInstruments(Soundbank soundbank, Patch[] patchList);
+}
diff --git a/libjava/classpath/javax/sound/midi/SysexMessage.java b/libjava/classpath/javax/sound/midi/SysexMessage.java
new file mode 100644
index 00000000000..7ab60f4b6af
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/SysexMessage.java
@@ -0,0 +1,139 @@
+/* SysexMessage.java -- System Exclusive MIDI message.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A system exclusive MIDI message.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class SysexMessage extends MidiMessage
+{
+ public static final int SYSTEM_EXCLUSIVE = 0xF0;
+
+ public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7;
+
+ /**
+ * Create a default valid system exclusive message.
+ *
+ * The official specs don't specify what message is to be
+ * created. Our implementation creates an empty
+ * system exclusive message.
+ */
+ public SysexMessage()
+ {
+ super(new byte[2]);
+ data[0] = (byte) SYSTEM_EXCLUSIVE;
+ data[1] = (byte) ShortMessage.END_OF_EXCLUSIVE;
+ }
+
+ /**
+ * Create a SysexMessage object.
+ * @param data a complete system exclusive message
+ */
+ public SysexMessage(byte[] data)
+ {
+ super(data);
+ }
+
+ /**
+ * Set the sysex message. The first data byte (status) must be
+ * 0xF0 or 0xF7.
+ *
+ * @param data the message data
+ * @param length the length of the message data
+ * @throws InvalidMidiDataException if the status byte is not 0xF0 or 0xF7
+ */
+ public void setMessage(byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ if (data[0] != SYSTEM_EXCLUSIVE
+ || data[0] != SPECIAL_SYSTEM_EXCLUSIVE)
+ throw new InvalidMidiDataException("Sysex message starts with 0x"
+ + Integer.toHexString(data[0])
+ + " instead of 0xF0 or 0xF7");
+ super.setMessage(data, length);
+ }
+
+ /**
+ * Set the sysex message. status must be either 0xF0 or 0xF7.
+ *
+ * @param status the sysex statys byte (0xF0 or 0xF7)
+ * @param data the message data
+ * @param length the length of the message data
+ * @throws InvalidMidiDataException if status is not 0xF0 or 0xF7
+ */
+ public void setMessage(int status, byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ if (status != SYSTEM_EXCLUSIVE
+ || status != SPECIAL_SYSTEM_EXCLUSIVE)
+ throw new InvalidMidiDataException("Sysex message starts with 0x"
+ + Integer.toHexString(status)
+ + " instead of 0xF0 or 0xF7");
+ this.data = new byte[length+1];
+ this.data[0] = (byte) status;
+ System.arraycopy(data, 0, this.data, 1, length);
+ this.length = length+1;
+ }
+
+ /**
+ * Get the data for this message, not including the status byte.
+ * @return the message data, not including the status byte
+ */
+ public byte[] getData()
+ {
+ byte[] result = new byte[length - 1];
+ System.arraycopy(data, 1, result, 0, length - 1);
+ return result;
+ }
+
+ /* Create a deep-copy clone of this object.
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ byte message[] = new byte[length];
+ System.arraycopy(data, 0, message, 0, length);
+ return new SysexMessage(message);
+ }
+}
+
diff --git a/libjava/classpath/javax/sound/midi/Track.java b/libjava/classpath/javax/sound/midi/Track.java
new file mode 100644
index 00000000000..da7ef2ef3b9
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Track.java
@@ -0,0 +1,160 @@
+/* Track.java -- A track of MIDI events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.HashSet;
+import java.util.Vector;
+
+/**
+ * A Track contains a list of timecoded MIDI events for processing
+ * by a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class Track
+{
+ /**
+ * The list of MidiEvents for this track.
+ */
+ protected Vector events;
+
+ // A HashSet to speed processing
+ private HashSet eventSet;
+
+ /**
+ * Add a new event to this track. Specific events may only be added once.
+ * The event will be inserted into the appropriate spot in the event list
+ * based on its timecode.
+ *
+ * @param event the event to add
+ * @return true if the event was added, false otherwise
+ */
+ public boolean add(MidiEvent event)
+ {
+ synchronized (events)
+ {
+ if (eventSet.contains(event))
+ return false;
+
+ eventSet.add(event);
+
+ long targetTick = event.getTick();
+ int i = events.size() - 1;
+ while (i >= 0 && (((MidiEvent)events.get(i)).getTick() > targetTick))
+ i--;
+ events.add(i+1, event);
+ return true;
+ }
+ }
+
+ /**
+ * Remove an event from this track.
+ *
+ * @param event the event to remove
+ * @return true if the event was removed, false otherwise
+ */
+ public boolean remove(MidiEvent event)
+ {
+ synchronized (events)
+ {
+ if (! eventSet.remove(event))
+ return false;
+
+ int i = events.indexOf(event);
+ if (i >= 0)
+ {
+ events.remove(i);
+ return true;
+ }
+
+ throw new InternalError("event in set but not list");
+ }
+ }
+
+ /**
+ * Get an event idetified by its order index
+ *
+ * @param index the location of the event to get
+ * @return the event at index
+ * @throws ArrayIndexOutOfBoundsException if index is out of bounds
+ */
+ public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException
+ {
+ synchronized (events)
+ {
+ try
+ {
+ return (MidiEvent) events.get(index);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ throw (ArrayIndexOutOfBoundsException)
+ new ArrayIndexOutOfBoundsException().initCause(e);
+ }
+ }
+ }
+
+
+ /**
+ * Get the number events in this track.
+ *
+ * @return the number of events in this track
+ */
+ public int size()
+ {
+ return events.size();
+ }
+
+ /**
+ * Get the length of the track in MIDI ticks.
+ *
+ * @return the length of the track in MIDI ticks
+ */
+ public long ticks()
+ {
+ synchronized (events)
+ {
+ int size = events.size();
+ return ((MidiEvent) events.get(size - 1)).getTick();
+ }
+ }
+ }
+
diff --git a/libjava/classpath/javax/sound/midi/Transmitter.java b/libjava/classpath/javax/sound/midi/Transmitter.java
new file mode 100644
index 00000000000..d788725e065
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Transmitter.java
@@ -0,0 +1,70 @@
+/* Transmitter.java -- A interface for objects sending MIDI events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This interface specifies the methods required by objects which send
+ * MIDI events to Receivers, including MIDI IN ports and Sequencers.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Transmitter
+{
+ /**
+ * Set the Receiver to which MIDI events will be sent.
+ *
+ * @param receiver the Receiver to which MIDI events will be sent
+ */
+ public void setReceiver(Receiver receiver);
+
+ /**
+ * Get the Receiver to which MIDI events will be sent (possibly null)
+ *
+ * @return the Receiver to which MIDI events will be sent (possibly null)
+ */
+ public Receiver getReceiver();
+
+ /**
+ * Close this Transmitter, possibly releasing system resources.
+ * FIXME: Does this mean the Receiver is closed? I think it must.
+ */
+ public void close();
+}
diff --git a/libjava/classpath/javax/sound/midi/VoiceStatus.java b/libjava/classpath/javax/sound/midi/VoiceStatus.java
new file mode 100644
index 00000000000..a6a9c3f87c8
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/VoiceStatus.java
@@ -0,0 +1,79 @@
+/* VoiceStatus.java -- the current status of a Synthesizer voice
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Objects of this type define the status of a Synthesizer voice.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class VoiceStatus
+{
+ /**
+ * True if this voice is processing a MIDI note.
+ */
+ public boolean active = false;
+
+ /**
+ * The channel for this voice when active.
+ */
+ public int channel = 0;
+
+ /**
+ * The bank of the voice when active.
+ */
+ public int bank = 0;
+
+ /**
+ * The program for this voice when active.
+ */
+ public int program = 0;
+
+ /**
+ * The note for this voice when active.
+ */
+ public int note = 0;
+
+ /**
+ * The volume for this voice when active.
+ */
+ public int volume = 0;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java b/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java
new file mode 100644
index 00000000000..537edb2b3d0
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java
@@ -0,0 +1,90 @@
+/* MidiDeviceProvider.java -- Abstract parent for a MIDI device provider.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import javax.sound.midi.*;
+
+/**
+ * The abstract base class for all MidiDeviceProvider types.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiDeviceProvider
+{
+ /**
+ * Returns true if this provider supports a specific MIDI device.
+ *
+ * @param info the MIDI device descriptor
+ * @return true if this provider supports info
+ */
+ public boolean isDeviceSupported(MidiDevice.Info info)
+ {
+ MidiDevice.Info infos[] = getDeviceInfo();
+
+ int i = infos.length;
+
+ while (i > 0)
+ {
+ if (info.equals(infos[--i]))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the list descriptors for all MIDI devices supported by
+ * this provider.
+ *
+ * @return an array of descriptors for all supported MIDI devices.
+ */
+ public abstract MidiDevice.Info[] getDeviceInfo();
+
+ /**
+ * Get the MidiDevice for the MIDI device described by info
+ *
+ * @param info the descriptor for the MIDI device we want
+ * @return the MidiDevice we're looking for
+ * @throws IllegalArgumentException is this provider doesn't support info
+ */
+ public abstract MidiDevice getDevice(MidiDevice.Info info)
+ throws IllegalArgumentException;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java b/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java
new file mode 100644
index 00000000000..4342ebf5e2b
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java
@@ -0,0 +1,125 @@
+/* MidiFilerReader.java -- MIDI file reading services
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MidiFileFormat;
+import javax.sound.midi.Sequence;
+
+/**
+ * The MidiFileReader abstract class defines the methods to be provided
+ * by a MIDI file reader.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiFileReader
+{
+ /**
+ * Read a MidiFileFormat from the given stream.
+ *
+ * @param stream the stream from which to read the MIDI data
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if the stream refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract MidiFileFormat getMidiFileFormat(InputStream stream)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a MidiFileFormat from the given stream.
+ *
+ * @param url the url from which to read the MIDI data
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if the url refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract MidiFileFormat getMidiFileFormat(URL url)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a MidiFileFormat from the given stream.
+ *
+ * @param file the file from which to read the MIDI data
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if the file refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract MidiFileFormat getMidiFileFormat(File file)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a Sequence from the given stream.
+ *
+ * @param stream the stream from which to read the MIDI data
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if the stream refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract Sequence getSequence(InputStream stream)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a Sequence from the given stream.
+ *
+ * @param url the url from which to read the MIDI data
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if the url refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract Sequence getSequence(URL url)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a Sequence from the given stream.
+ *
+ * @param file the file from which to read the MIDI data
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if the file refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract Sequence getSequence(File file)
+ throws InvalidMidiDataException, IOException;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java b/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java
new file mode 100644
index 00000000000..e2a1f55c6e0
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java
@@ -0,0 +1,143 @@
+/* MidiFileWriter.java -- MIDI file writing services
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.sound.midi.Sequence;
+
+/**
+ * MidiFileWriter provides MIDI file writing services.
+ *
+ * There are three types of Standard MIDI File (SMF) formats,
+ * represented by integers 0, 1, and 2.
+ *
+ * Type 0 files contain a single track and represents a single song
+ * performance.
+ * Type 1 may contain multiple tracks for a single song performance.
+ * Type 2 may contain multiple tracks, each representing a
+ * separate song performance.
+ *
+ * See http://en.wikipedia.org/wiki/MIDI#MIDI_file_formats for more
+ * information.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiFileWriter
+{
+ /**
+ * Return the MIDI file types supported by this writer.
+ *
+ * @return the MIDI file types, or an empty array
+ */
+ public abstract int[] getMidiFileTypes();
+
+ /**
+ * Return the MIDI file types supported by this writer for the
+ * given sequence.
+ *
+ * @param sequence the sequence we'd like to write
+ * @return the MIDI file types, or an empty array
+ */
+ public abstract int[] getMidiFileTypes(Sequence sequence);
+
+ /**
+ * Returns true if this writer supports the given file type.
+ *
+ * @param fileType the file type we're asking about
+ * @return true if this writer supports fileType, false otherwise
+ */
+ public boolean isFileTypeSupported(int fileType)
+ {
+ int types[] = getMidiFileTypes();
+ for (int i = types.length; i > 0;)
+ {
+ if (types[--i] == fileType)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this writer supports the given file type for the
+ * given sequence.
+ *
+ * @param fileType the file type we're asking about
+ * @param sequence the sequence we'd like to write
+ * @return true if this writer supports fileType, false otherwise
+ */
+ public boolean isFileTypeSupported(int fileType, Sequence sequence)
+ {
+ int types[] = getMidiFileTypes(sequence);
+ for (int i = types.length; i > 0;)
+ {
+ if (types[--i] == fileType)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write a sequence to a stream using the specified MIDI file type.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file type to use
+ * @param out the output stream to write to
+ * @return the number of byte written
+ * @throws IOException if an I/O exception happens
+ */
+ public abstract int write(Sequence in, int fileType, OutputStream out)
+ throws IOException;
+
+ /**
+ * Write a sequence to a file using the specified MIDI file type.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file type to use
+ * @param out the file to write to
+ * @return the number of byte written
+ * @throws IOException if an I/O exception happens
+ */
+ public abstract int write(Sequence in, int fileType, File out)
+ throws IOException;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java b/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java
new file mode 100644
index 00000000000..dbf2bb0183a
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java
@@ -0,0 +1,97 @@
+/* SoundbankReader.java -- Soundbank file reading services
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.Soundbank;
+
+/**
+ * The SoundbankReader abstract class defines the methods to be provided
+ * by a soundbank file reader.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class SoundbankReader
+{
+ /**
+ * Get a Soundbank from the given URL.
+ *
+ * @param url from which to read the Soundbank
+ *
+ * @return the Soundbank object
+ *
+ * @throws InvalidMidiDataException if the data provided by url cannot be recognized
+ * @throws IOException if the data provided by url cannot be read
+ */
+ public abstract Soundbank getSoundbank(URL url)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Get a Soundbank from the given InputStream.
+ *
+ * @param stream from which to read the Soundbank
+ *
+ * @return the Soundbank object
+ *
+ * @throws InvalidMidiDataException if the data provided by InputStream cannot be recognized
+ * @throws IOException if the data provided by InputStream cannot be read
+ */
+ public abstract Soundbank getSoundbank(InputStream stream)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Get a Soundbank from the given File.
+ *
+ * @param file from which to read the Soundbank
+ *
+ * @return the Soundbank object
+ *
+ * @throws InvalidMidiDataException if the data provided by File cannot be recognized
+ * @throws IOException if the data provided by File cannot be read
+ */
+ public abstract Soundbank getSoundbank(File file)
+ throws InvalidMidiDataException, IOException;
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioFileFormat.java b/libjava/classpath/javax/sound/sampled/AudioFileFormat.java
new file mode 100644
index 00000000000..81bbe4ecf10
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioFileFormat.java
@@ -0,0 +1,242 @@
+/* Audio file format
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This describes an audio file, including information about its length,
+ * the format of the audio data, and other things.
+ * @since 1.3
+ */
+public class AudioFileFormat
+{
+ /**
+ * An instance of this type describes a standard audio file format.
+ * @since 1.3
+ */
+ public static class Type
+ {
+ // This is kind of goofy since there are multiple extensions for
+ // some of these.
+
+ /** The AIFC format. */
+ public static final Type AIFC = new Type("AIFC", "aifc");
+
+ /** The AIFF format. */
+ public static final Type AIFF = new Type("AIFF", "aiff");
+
+ /** The AU format. */
+ public static final Type AU = new Type("AU", "au");
+
+ /** The SND format. */
+ public static final Type SND = new Type("SND", "snd");
+
+ /** The WAVE format. */
+ public static final Type WAVE = new Type ("WAVE", "wav");
+
+ private String name;
+ private String extension;
+
+ /**
+ * Create a new Type given its name and file extension.
+ * The file extension does not include the ".".
+ * @param name the type's name
+ * @param extension the file extension
+ */
+ public Type(String name, String extension)
+ {
+ this.name = name;
+ this.extension = extension;
+ }
+
+ public final boolean equals(Object o)
+ {
+ if (! (o instanceof Type))
+ return false;
+ Type other = (Type) o;
+ return name.equals(other.name) && extension.equals(other.extension);
+ }
+
+ public final int hashCode()
+ {
+ return name.hashCode() + extension.hashCode();
+ }
+
+ /**
+ * Return the extension associated with this Type.
+ */
+ public String getExtension()
+ {
+ return extension;
+ }
+
+ /**
+ * Return the name of this Type.
+ */
+ public final String toString()
+ {
+ return name;
+ }
+ }
+
+ private int byteLength;
+ private AudioFormat format;
+ private Type type;
+ private int frameLength;
+ private Map properties;
+
+ /**
+ * Create a new AudioFileFormat given the type, the format, and the
+ * frame length. The new object will have an unspecified byte length,
+ * and an empty properties map.
+ * @param type the type
+ * @param fmt the format
+ * @param frameLen the frame length
+ */
+ public AudioFileFormat(Type type, AudioFormat fmt, int frameLen)
+ {
+ this.byteLength = AudioSystem.NOT_SPECIFIED;
+ this.format = fmt;
+ this.type = type;
+ this.frameLength = frameLen;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Create a new AudioFileFormat given the type, the format, the
+ * frame length, and some properties. The new object will have an
+ * unspecified byte length. A copy of the properties argument will
+ * be made, so changes to the map passed in will not affect the
+ * new AudioFileFormat.
+ * @param type the type
+ * @param fmt the format
+ * @param frameLen the frame length
+ * @param properties the properties
+ */
+ public AudioFileFormat(Type type, AudioFormat fmt, int frameLen,
+ Map properties)
+ {
+ this.byteLength = AudioSystem.NOT_SPECIFIED;
+ this.format = fmt;
+ this.type = type;
+ this.frameLength = frameLen;
+ this.properties = Collections.unmodifiableMap(new HashMap(properties));
+ }
+
+ /**
+ * Create a new AudioFileFormat given the type, the byte length, the format,
+ * and the frame length. The new object will have an empty properties map.
+ * @param type the type
+ * @param byteLen the byte length
+ * @param fmt the format
+ * @param frameLen the frame length
+ */
+ protected AudioFileFormat(Type type, int byteLen, AudioFormat fmt,
+ int frameLen)
+ {
+ this.byteLength = byteLen;
+ this.format = fmt;
+ this.type = type;
+ this.frameLength = frameLen;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Return the byte length of this file format.
+ */
+ public int getByteLength()
+ {
+ return byteLength;
+ }
+
+ /**
+ * Return the AudioFormat associated with this file format.
+ */
+ public AudioFormat getFormat()
+ {
+ return format;
+ }
+
+ /**
+ * Return the frame length of this file format.
+ */
+ public int getFrameLength()
+ {
+ return frameLength;
+ }
+
+ /**
+ * Return the value of a property defined in this format.
+ * @param key the property name
+ * @return the value of the property, or null if the property is not defined
+ */
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+ /**
+ * Return the Type associated with this file format.
+ */
+ public Type getType()
+ {
+ return type;
+ }
+
+ /**
+ * Return the properties associated with this format, as a Map.
+ * The returned Map is unmodifiable.
+ */
+ public Map properties()
+ {
+ return properties;
+ }
+
+ /**
+ * Return a description of this AudioFileFormat.
+ */
+ public String toString()
+ {
+ return ("byteLength=" + byteLength + "; format=" + format
+ + "; type=" + type + "; frameLength=" + frameLength);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioFormat.java b/libjava/classpath/javax/sound/sampled/AudioFormat.java
new file mode 100644
index 00000000000..5199d71c3a3
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioFormat.java
@@ -0,0 +1,345 @@
+/* An audio format
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This class describes an audio format, including its encoding,
+ * the number of channels, its frame rate, etc.
+ * @since 1.3
+ */
+public class AudioFormat
+{
+ /**
+ * This describes a given audio format encoding.
+ * @since 1.3
+ */
+ public static class Encoding
+ {
+ /** The ALAW encoding. */
+ public static final Encoding ALAW = new Encoding("alaw");
+
+ /** The signed PCM encoding. */
+ public static final Encoding PCM_SIGNED = new Encoding("pcm_signed");
+
+ /** The unsigned PCM encoding. */
+ public static final Encoding PCM_UNSIGNED = new Encoding("pcm_unsigned");
+
+ /** The ULAW encoding. */
+ public static final Encoding ULAW = new Encoding("ulaw");
+
+ private String name;
+
+ /**
+ * Create a new encoding descriptor, given its name.
+ * @param name the name
+ */
+ public Encoding(String name)
+ {
+ this.name = name;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this encoding.
+ */
+ public final String toString()
+ {
+ return name;
+ }
+ }
+
+ /**
+ * True if the audio data is stored big-endian.
+ */
+ protected boolean bigEndian;
+
+ /**
+ * The number of channels of data in this format.
+ */
+ protected int channels;
+
+ /**
+ * The encoding of this format.
+ */
+ protected Encoding encoding;
+
+ /**
+ * The frame rate of this format. This is the number of frames
+ * per second.
+ */
+ protected float frameRate;
+
+ /**
+ * The number of bytes per frame in this format.
+ */
+ protected int frameSize;
+
+ /**
+ * The number of samples per second.
+ */
+ protected float sampleRate;
+
+ /**
+ * The number of bits in each sample.
+ */
+ protected int sampleSizeInBits;
+
+ private Map properties;
+
+ /**
+ * Create a new audio format, given various attributes of it.
+ * The properties map for this format will be empty.
+ *
+ * @param encoding the encoding for this format
+ * @param sampleRate the sample rate
+ * @param sampleSizeInBits the sample size, in bits
+ * @param channels the number of channels
+ * @param frameSize the frame size, in bytes
+ * @param frameRate the frame rate, in frames per second
+ * @param bigEndian true if the data is stored big-endian
+ */
+ public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
+ int channels, int frameSize, float frameRate,
+ boolean bigEndian)
+ {
+ this.encoding = encoding;
+ this.sampleRate = sampleRate;
+ this.sampleSizeInBits = sampleSizeInBits;
+ this.channels = channels;
+ this.frameSize = frameSize;
+ this.frameRate = frameRate;
+ this.bigEndian = bigEndian;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Create a new audio format, given various attributes of it.
+ * The properties map is copied by this constructor, so changes
+ * to the argument Map will not affect the new object.
+ *
+ * @param encoding the encoding for this format
+ * @param sampleRate the sample rate
+ * @param sampleSizeInBits the sample size, in bits
+ * @param channels the number of channels
+ * @param frameSize the frame size, in bytes
+ * @param frameRate the frame rate, in frames per second
+ * @param bigEndian true if the data is stored big-endian
+ * @param properties a map describing properties of this format
+ */
+ public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
+ int channels, int frameSize, float frameRate,
+ boolean bigEndian, Map properties)
+ {
+ this.encoding = encoding;
+ this.sampleRate = sampleRate;
+ this.sampleSizeInBits = sampleSizeInBits;
+ this.channels = channels;
+ this.frameSize = frameSize;
+ this.frameRate = frameRate;
+ this.bigEndian = bigEndian;
+ this.properties = Collections.unmodifiableMap(new HashMap(properties));
+ }
+
+ /**
+ * Create a new PCM-based audio format, given various attributes of it.
+ * The encoding will either be Encoding#PCM_SIGNED or Encoding#PCM_UNSIGNED.
+ * The frame size for this format will be derived from the sample size in
+ * bits and the number of channels, unless one of those is
+ * AudioSystem#NOT_SPECIFIED. The frame rate will be the same as the sample
+ * rate, and the properties map will be empty.
+ *
+ * @param sampleRate the sample rate
+ * @param sampleSizeInBits the sample size, in bits
+ * @param channels the number of channels
+ * @param signed true if this is a signed encoding
+ * @param bigEndian true if the data is stored big-endian
+ */
+ public AudioFormat(float sampleRate, int sampleSizeInBits,
+ int channels, boolean signed, boolean bigEndian)
+ {
+ this.encoding = signed ? Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED;
+ this.sampleRate = sampleRate;
+ this.sampleSizeInBits = sampleSizeInBits;
+ this.channels = channels;
+ // It isn't clear whether channels can be NOT_SPECIFIED.
+ if (sampleSizeInBits == AudioSystem.NOT_SPECIFIED
+ || channels == AudioSystem.NOT_SPECIFIED)
+ this.frameSize = AudioSystem.NOT_SPECIFIED;
+ else
+ this.frameSize = (sampleSizeInBits + 7) / 8 * channels;
+ this.frameRate = sampleRate;
+ this.bigEndian = bigEndian;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Return the number of channels in this format.
+ */
+ public int getChannels()
+ {
+ return channels;
+ }
+
+ /**
+ * Return the encoding of this format.
+ */
+ public Encoding getEncoding()
+ {
+ return encoding;
+ }
+
+ /**
+ * Return the frame rate of this format.
+ */
+ public float getFrameRate()
+ {
+ return frameRate;
+ }
+
+ /**
+ * Return the frame size of this format.
+ */
+ public int getFrameSize()
+ {
+ return frameSize;
+ }
+
+ /**
+ * Given a key, return a property associated with this format;
+ * or null if this property is not set.
+ * @param key the name of the property
+ * @return the value of the property, or null if the property is not set
+ */
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+ /**
+ * Return the sample rate of this format.
+ */
+ public float getSampleRate()
+ {
+ return sampleRate;
+ }
+
+ /**
+ * Return the sample size of this format, in bits.
+ */
+ public int getSampleSizeInBits()
+ {
+ return sampleSizeInBits;
+ }
+
+ /**
+ * Return true if this format is big endian, false otherwise.
+ * This only matters for formats whose sample size is greater than
+ * one byte.
+ */
+ public boolean isBigEndian()
+ {
+ return bigEndian;
+ }
+
+ /**
+ * Return true if this audio format matches another.
+ * @param fmt the format to match against
+ * @return true if they match, false otherwise
+ */
+ public boolean matches(AudioFormat fmt)
+ {
+ if (! encoding.equals(fmt.encoding)
+ || channels != fmt.channels
+ || sampleSizeInBits != fmt.sampleSizeInBits
+ || frameSize != fmt.frameSize)
+ return false;
+ if (sampleRate != AudioSystem.NOT_SPECIFIED
+ && fmt.sampleRate != AudioSystem.NOT_SPECIFIED
+ && sampleRate != fmt.sampleRate)
+ return false;
+ if (frameRate != AudioSystem.NOT_SPECIFIED
+ && fmt.frameRate != AudioSystem.NOT_SPECIFIED
+ && frameRate != fmt.frameRate)
+ return false;
+ if (sampleSizeInBits > 8)
+ return bigEndian == fmt.bigEndian;
+ return true;
+ }
+
+ /**
+ * Return a read-only Map holding the properties associated with
+ * this format.
+ */
+ public Map properties()
+ {
+ return properties;
+ }
+
+ /**
+ * Return a description of this format.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(encoding);
+ result.append(" ");
+ result.append(sampleRate);
+ result.append(" Hz ");
+ result.append(sampleSizeInBits);
+ result.append(" bits ");
+ result.append(channels);
+ result.append(" channels");
+ if (sampleSizeInBits > 8)
+ result.append(bigEndian ? " big endian" : " little endian");
+ return result.toString();
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioInputStream.java b/libjava/classpath/javax/sound/sampled/AudioInputStream.java
new file mode 100644
index 00000000000..863578b0b6d
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioInputStream.java
@@ -0,0 +1,258 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * This is an InputStream which is specialized for reading audio files.
+ * In particular it only allows operations to act on a multiple of
+ * the audio stream's frame size.
+ * @since 1.3
+ */
+public class AudioInputStream extends InputStream
+{
+ /** The format of the audio stream. */
+ protected AudioFormat format;
+
+ /** The length of the audio stream in frames. */
+ protected long frameLength;
+
+ /** The current frame position, starting from frame zero. */
+ protected long framePos;
+
+ /** The size of a frame in bytes. */
+ protected int frameSize;
+
+ // I wonder why this class doesn't inherit from FilterInputStream.
+ private InputStream input;
+
+ // The saved frame position, used for mark/reset.
+ private long markedFramePos;
+
+ /**
+ * Create a new AudioInputStream given an underlying InputStream,
+ * the audio format, and the length of the data in frames. The
+ * frame size is taken from the format.
+ * @param is the underlying input stream
+ * @param fmt the format of the data
+ * @param length the length of the data in frames
+ */
+ public AudioInputStream(InputStream is, AudioFormat fmt, long length)
+ {
+ this.format = fmt;
+ this.frameLength = length;
+ this.framePos = 0;
+ this.frameSize = fmt.getFrameSize();
+ this.input = is;
+ }
+
+ /**
+ * Create a new AudioInputStream given a TargetDataLine. The audio
+ * format and the frame size are taken from the line.
+ * @param line the TargetDataLine
+ */
+ public AudioInputStream(TargetDataLine line)
+ {
+ this(new TargetInputStream(line), line.getFormat(),
+ AudioSystem.NOT_SPECIFIED);
+ }
+
+ /**
+ * Return the number of bytes available to be read from the
+ * underlying stream. This wrapper method ensures that the result
+ * is always a multiple of the frame size.
+ */
+ public int available() throws IOException
+ {
+ int result = input.available();
+ // Ensure result is a multiple of the frame size.
+ if (frameSize != AudioSystem.NOT_SPECIFIED)
+ result -= result % frameSize;
+ return result;
+ }
+
+ /**
+ * Close the stream.
+ */
+ public void close() throws IOException
+ {
+ input.close();
+ }
+
+ /**
+ * Get the format associated with this stream.
+ * @return the AudioFormat
+ */
+ public AudioFormat getFormat()
+ {
+ return format;
+ }
+
+ /**
+ * Get the length of this stream in frames. Note that this
+ * may be AudioSystem#NOT_SPECIFIED.
+ * @return the length of the stream in frames
+ */
+ public long getFrameLength()
+ {
+ return frameLength;
+ }
+
+ public void mark(int limit)
+ {
+ input.mark(limit);
+ markedFramePos = framePos;
+ }
+
+ /**
+ * Return true if the underlying stream supports mark and reset,
+ * false otherwise.
+ */
+ public boolean markSupported()
+ {
+ return input.markSupported();
+ }
+
+ /**
+ * Read a single byte from the underlying stream. If the frame
+ * size is set, and is not one byte, an IOException will be thrown.
+ */
+ public int read() throws IOException
+ {
+ if (frameSize != 1)
+ throw new IOException("frame size must be 1 for read()");
+ int result;
+ if (framePos == frameLength)
+ result = -1;
+ else
+ result = input.read();
+ if (result != -1)
+ ++framePos;
+ return result;
+ }
+
+ public int read(byte[] buf) throws IOException
+ {
+ return read(buf, 0, buf.length);
+ }
+
+ public int read(byte[] buf, int offset, int length) throws IOException
+ {
+ int result;
+ if (framePos == frameLength)
+ result = -1;
+ else
+ {
+ int myFrameSize = (frameSize == AudioSystem.NOT_SPECIFIED
+ ? 1 : frameSize);
+ // Ensure length is a multiple of frame size.
+ length -= length % myFrameSize;
+
+ result = 0;
+ while (result == 0 || result % myFrameSize != 0)
+ {
+ int val = input.read(buf, offset, length);
+ if (val < 0)
+ {
+ // This is a weird situation as we might have read a
+ // frame already. It isn't clear at all what to do if
+ // we only found a partial frame. For now we just
+ // return whatever we did find.
+ if (result == 0)
+ return -1;
+ result -= result % myFrameSize;
+ break;
+ }
+ result += val;
+ }
+ // assert result % myFrameSize == 0;
+ framePos += result / myFrameSize;
+ }
+ return result;
+ }
+
+ public void reset() throws IOException
+ {
+ input.reset();
+ framePos = markedFramePos;
+ }
+
+ public long skip(long n) throws IOException
+ {
+ if (frameSize != AudioSystem.NOT_SPECIFIED)
+ n -= n % frameSize;
+ long actual = input.skip(n);
+ if (frameSize != AudioSystem.NOT_SPECIFIED)
+ framePos += actual / frameSize;
+ return actual;
+ }
+
+ private static class TargetInputStream extends InputStream
+ {
+ private TargetDataLine line;
+ private byte[] buf;
+
+ /**
+ * Create a new TargetInputStream.
+ * @param line the line to wrap
+ */
+ public TargetInputStream(TargetDataLine line)
+ {
+ this.line = line;
+ // FIXME: do we have to call line.open()?
+ }
+
+ public synchronized int read() throws IOException
+ {
+ if (buf == null)
+ buf = new byte[1];
+ int count = read(buf, 0, 1);
+ if (count < 0)
+ return -1;
+ return buf[0];
+ }
+
+ public int read(byte[] buf, int offset, int length) throws IOException
+ {
+ return line.read(buf, offset, length);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioPermission.java b/libjava/classpath/javax/sound/sampled/AudioPermission.java
new file mode 100644
index 00000000000..6698e35ced2
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioPermission.java
@@ -0,0 +1,70 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.security.BasicPermission;
+
+/**
+ * This represents the permission to use an audio device.
+ * The only predefined permission names are "play" and "record".
+ * @since 1.3
+ */
+public class AudioPermission extends BasicPermission
+{
+ private static final long serialVersionUID = -5518053473477801126L;
+
+ /**
+ * Construct an AudioPermission with the given name.
+ * @param name the name of the permission, like "play" or "record"
+ */
+ public AudioPermission(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Construct an AudioPermission with the given name.
+ * @param name the name of the permission, like "play" or "record"
+ * @param actions the actions; should be null
+ */
+ public AudioPermission(String name, String actions)
+ {
+ super(name, actions);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioSystem.java b/libjava/classpath/javax/sound/sampled/AudioSystem.java
new file mode 100644
index 00000000000..0b0b754b59e
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioSystem.java
@@ -0,0 +1,744 @@
+/* Main interface to audio system
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import gnu.classpath.ServiceFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.sound.sampled.spi.AudioFileReader;
+import javax.sound.sampled.spi.AudioFileWriter;
+import javax.sound.sampled.spi.FormatConversionProvider;
+import javax.sound.sampled.spi.MixerProvider;
+
+/**
+ * This clas is the primary interface to the audio system. It contains
+ * a number of static methods which can be used to access this package's
+ * functionality.
+ *
+ * @since 1.3
+ */
+public class AudioSystem
+{
+ /**
+ * A constant which can be passed to a number of methods in this package,
+ * to indicate an unspecified value.
+ */
+ public static final int NOT_SPECIFIED = -1;
+
+ /**
+ * Return the file format of a given File.
+ * @param f the file to check
+ * @return the format of the file
+ * @throws UnsupportedAudioFileException if the file's format is not
+ * recognized
+ * @throws IOException if there is an I/O error reading the file
+ */
+ public static AudioFileFormat getAudioFileFormat(File f)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioFileFormat(f);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("file type not recognized");
+ }
+
+ /**
+ * Return the file format of a given input stream.
+ * @param is the input stream to check
+ * @return the format of the stream
+ * @throws UnsupportedAudioFileException if the stream's format is not
+ * recognized
+ * @throws IOException if there is an I/O error reading the stream
+ */
+ public static AudioFileFormat getAudioFileFormat(InputStream is)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioFileFormat(is);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("input stream type not recognized");
+ }
+
+ /**
+ * Return the file format of a given URL.
+ * @param url the URL to check
+ * @return the format of the URL
+ * @throws UnsupportedAudioFileException if the URL's format is not
+ * recognized
+ * @throws IOException if there is an I/O error reading the URL
+ */
+ public static AudioFileFormat getAudioFileFormat(URL url)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioFileFormat(url);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("URL type not recognized");
+ }
+
+ /**
+ * Return an array of all the supported AudioFileFormat types.
+ * @return an array of unique types
+ */
+ public static AudioFileFormat.Type[] getAudioFileTypes()
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter writer = (AudioFileWriter) i.next();
+ AudioFileFormat.Type[] types = writer.getAudioFileTypes();
+ for (int j = 0; j < types.length; ++j)
+ result.add(types[j]);
+ }
+ return (AudioFileFormat.Type[]) result.toArray(new AudioFileFormat.Type[result.size()]);
+ }
+
+ /**
+ * Return an array of all the supported AudioFileFormat types which match the
+ * given audio input stream
+ * @param ais the audio input stream
+ * @return an array of unique types
+ */
+ public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter writer = (AudioFileWriter) i.next();
+ AudioFileFormat.Type[] types = writer.getAudioFileTypes(ais);
+ for (int j = 0; j < types.length; ++j)
+ result.add(types[j]);
+ }
+ return (AudioFileFormat.Type[]) result.toArray(new AudioFileFormat.Type[result.size()]);
+ }
+
+ /**
+ * Given an audio input stream, this will try to create a new audio input
+ * stream whose encoding matches the given target encoding. If no provider
+ * offers this conversion, an exception is thrown.
+ * @param targ the target encoding
+ * @param ais the original audio stream
+ * @return a new audio stream
+ * @throws IllegalArgumentException if the conversion cannot be made
+ */
+ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
+ AudioInputStream ais)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (! prov.isConversionSupported(targ, ais.getFormat()))
+ continue;
+ return prov.getAudioInputStream(targ, ais);
+ }
+ throw new IllegalArgumentException("encoding not supported for stream");
+ }
+
+ /**
+ * Given an audio input stream, this will try to create a new audio input
+ * stream whose format matches the given target format. If no provider
+ * offers this conversion, an exception is thrown.
+ * @param targ the target format
+ * @param ais the original audio stream
+ * @return a new audio stream
+ * @throws IllegalArgumentException if the conversion cannot be made
+ */
+ public static AudioInputStream getAudioInputStream(AudioFormat targ,
+ AudioInputStream ais)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (! prov.isConversionSupported(targ, ais.getFormat()))
+ continue;
+ return prov.getAudioInputStream(targ, ais);
+ }
+ throw new IllegalArgumentException("format not supported for stream");
+ }
+
+ /**
+ * Return an audio input stream for the file.
+ * @param f the file to read
+ * @return an audio input stream for the file
+ * @throws UnsupportedAudioFileException if the file's audio format is not
+ * recognized
+ * @throws IOException if there is an error while reading the file
+ */
+ public static AudioInputStream getAudioInputStream(File f)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioInputStream(f);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("file type not recognized");
+ }
+
+ /**
+ * Return an audio input stream given an input stream.
+ * @param is the input stream
+ * @return an audio input stream
+ * @throws UnsupportedAudioFileException if the input stream's audio format
+ * is not supported by any of the installed providers
+ * @throws IOException if there is an error while reading the input stream
+ */
+ public static AudioInputStream getAudioInputStream(InputStream is)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioInputStream(is);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("input stream type not recognized");
+ }
+
+ /**
+ * Return an audio input stream for the given URL.
+ * @param url the URL
+ * @return an audio input stream
+ * @throws UnsupportedAudioFileException if the URL's audio format is not
+ * supported by any of the installed providers
+ * @throws IOException if there is an error while reading the URL
+ */
+ public static AudioInputStream getAudioInputStream(URL url)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioInputStream(url);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("URL type not recognized");
+ }
+
+ /**
+ * Return a new clip which can be used for playing back an audio stream.
+ * @throws LineUnavailableException if a clip is not available for some
+ * reason
+ * @throws SecurityException if a clip cannot be made for security reasons
+ * @since 1.5
+ */
+ public static Clip getClip()
+ throws LineUnavailableException
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ Line[] lines = mix.getSourceLines();
+ for (int j = 0; j < lines.length; ++j)
+ {
+ if (lines[j] instanceof Clip)
+ return (Clip) lines[j];
+ }
+ }
+ throw new LineUnavailableException("no Clip available");
+ }
+
+ /**
+ * Return a new clip which can be used for playing back an audio stream.
+ * The clip is obtained from the indicated mixer.
+ * @param info the mixer to use
+ * @throws LineUnavailableException if a clip is not available for some
+ * reason
+ * @throws SecurityException if a clip cannot be made for security reasons
+ * @since 1.5
+ */
+ public static Clip getClip(Mixer.Info info)
+ throws LineUnavailableException
+ {
+ Mixer mix = getMixer(info);
+ Line[] lines = mix.getSourceLines();
+ for (int j = 0; j < lines.length; ++j)
+ {
+ if (lines[j] instanceof Clip)
+ return (Clip) lines[j];
+ }
+ throw new LineUnavailableException("no Clip available");
+ }
+
+ /**
+ * Return a line matching the provided description. All the providers
+ * on the system are searched for a matching line.
+ * @param info description of the line
+ * @return the matching line
+ * @throws LineUnavailableException if no provider supplies a matching line
+ */
+ public static Line getLine(Line.Info info) throws LineUnavailableException
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ try
+ {
+ return mix.getLine(info);
+ }
+ catch (LineUnavailableException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new LineUnavailableException("no Clip available");
+ }
+
+ /**
+ * Return a mixer matching the provided description. All the providers
+ * on the system are searched for a matching mixer.
+ * @param info description of the mixer
+ * @return the matching mixer
+ * @throws IllegalArgumentException if no provider supplies a matching mixer
+ */
+ public static Mixer getMixer(Mixer.Info info)
+ {
+ Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
+ while (i.hasNext())
+ {
+ MixerProvider prov = (MixerProvider) i.next();
+ if (prov.isMixerSupported(info))
+ return prov.getMixer(info);
+ }
+ throw new IllegalArgumentException("mixer not found");
+ }
+
+ /**
+ * Return an array of descriptions of all the mixers provided on the system.
+ */
+ public static Mixer.Info[] getMixerInfo()
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
+ while (i.hasNext())
+ {
+ MixerProvider prov = (MixerProvider) i.next();
+ Mixer.Info[] is = prov.getMixerInfo();
+ for (int j = 0; j < is.length; ++j)
+ result.add(is[j]);
+ }
+ return (Mixer.Info[]) result.toArray(new Mixer.Info[result.size()]);
+ }
+
+ /**
+ * Return a source data line matching the given audio format.
+ * @param fmt the audio format
+ * @throws LineUnavailableException if no source data line matching
+ * this format is available
+ * @since 1.5
+ */
+ public static SourceDataLine getSourceDataLine(AudioFormat fmt)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
+ Mixer.Info[] mixers = getMixerInfo();
+ for (int i = 0; i < mixers.length; ++i)
+ {
+ Mixer mix = getMixer(mixers[i]);
+ if (mix.isLineSupported(info))
+ return (SourceDataLine) mix.getLine(info);
+ }
+ throw new LineUnavailableException("source data line not found");
+ }
+
+ /**
+ * Return a target data line matching the given audio format.
+ * @param fmt the audio format
+ * @throws LineUnavailableException if no target data line matching
+ * this format is available
+ * @since 1.5
+ */
+ public static SourceDataLine getSourceDataLine(AudioFormat fmt,
+ Mixer.Info mixer)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
+ Mixer mix = getMixer(mixer);
+ if (mix.isLineSupported(info))
+ return (SourceDataLine) mix.getLine(info);
+ throw new LineUnavailableException("source data line not found");
+ }
+
+ /**
+ * Return an array of descriptions of all the source lines matching
+ * the given line description.
+ * @param info description of the lines to match
+ */
+ public static Line.Info[] getSourceLineInfo(Line.Info info)
+ {
+ HashSet result = new HashSet();
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ Line.Info[] srcs = mix.getSourceLineInfo(info);
+ for (int j = 0; j < srcs.length; ++j)
+ result.add(srcs[j]);
+ }
+ return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+ }
+
+ /**
+ * Find and return a target data line matching the given audio format.
+ * @param fmt the format to match
+ * @throws LineUnavailableException if no matching line was found
+ * @since 1.5
+ */
+ public static TargetDataLine getTargetDataLine(AudioFormat fmt)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(TargetDataLine.class, fmt);
+ Mixer.Info[] mixers = getMixerInfo();
+ for (int i = 0; i < mixers.length; ++i)
+ {
+ Mixer mix = getMixer(mixers[i]);
+ if (mix.isLineSupported(info))
+ return (TargetDataLine) mix.getLine(info);
+ }
+ throw new LineUnavailableException("target data line not found");
+ }
+
+ /**
+ * Return a target data line matching the given audio format and
+ * mixer.
+ * @param fmt the audio format
+ * @param mixer the mixer description
+ * @return a target data line
+ * @throws LineUnavailableException if no matching target data line was
+ * found
+ * @since 1.5
+ */
+ public static TargetDataLine getTargetDataLine(AudioFormat fmt,
+ Mixer.Info mixer)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(TargetDataLine.class, fmt);
+ Mixer mix = getMixer(mixer);
+ if (mix.isLineSupported(info))
+ return (TargetDataLine) mix.getLine(info);
+ throw new LineUnavailableException("target data line not found");
+ }
+
+ /**
+ * Given a source encoding, return an array of all target encodings to which
+ * data in this form can be converted.
+ * @param source the source encoding
+ */
+ public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding source)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (! prov.isSourceEncodingSupported(source))
+ continue;
+ AudioFormat.Encoding[] es = prov.getTargetEncodings();
+ for (int j = 0; j < es.length; ++j)
+ result.add(es[j]);
+ }
+ return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
+ }
+
+ /**
+ * Given a source format, return an array of all the target encodings to
+ * which data in this format can be converted.
+ * @param source the source format
+ */
+ public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat source)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ AudioFormat.Encoding[] es = prov.getTargetEncodings(source);
+ for (int j = 0; j < es.length; ++j)
+ result.add(es[j]);
+ }
+ return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
+ }
+
+ /**
+ * Given a target encoding and a source audio format, return an array of all
+ * matching audio formats to which data in this source format can be converted.
+ * @param encoding the target encoding
+ * @param sourceFmt the source format
+ */
+ public static AudioFormat[] getTargetFormats(AudioFormat.Encoding encoding,
+ AudioFormat sourceFmt)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ AudioFormat[] es = prov.getTargetFormats(encoding, sourceFmt);
+ for (int j = 0; j < es.length; ++j)
+ result.add(es[j]);
+ }
+ return (AudioFormat[]) result.toArray(new AudioFormat[result.size()]);
+ }
+
+ /**
+ * Given a line description, return an array of descriptions of all
+ * the matching target lines.
+ * @param info the line description
+ */
+ public static Line.Info[] getTargetLineInfo(Line.Info info)
+ {
+ HashSet result = new HashSet();
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ Line.Info[] targs = mix.getTargetLineInfo(info);
+ for (int j = 0; j < targs.length; ++j)
+ result.add(targs[j]);
+ }
+ return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+ }
+
+ /**
+ * Return true if the currently installed providers are able to
+ * convert data from the given source format to the given target encoding.
+ * @param targ the target encoding
+ * @param source the source format
+ */
+ public static boolean isConversionSupported(AudioFormat.Encoding targ,
+ AudioFormat source)
+ {
+ Iterator i
+ = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (prov.isConversionSupported(targ, source))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if the currently installed providers are able to convert
+ * the given source format to the given target format.
+ * @param targ the target format
+ * @param source the source format
+ */
+ public static boolean isConversionSupported(AudioFormat targ,
+ AudioFormat source)
+ {
+ Iterator i
+ = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (prov.isConversionSupported(targ, source))
+ return true;
+ }
+ return false;
+ }
+
+ private static boolean isFileTypeSupported(AudioFileFormat.Type[] types,
+ AudioFileFormat.Type type)
+ {
+ for (int i = 0; i < types.length; ++i)
+ {
+ if (types[i].equals(type))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if the given audio file format is supported by one of
+ * the providers installed on the system.
+ * @param type the audio file format type
+ */
+ public static boolean isFileTypeSupported(AudioFileFormat.Type type)
+ {
+ return isFileTypeSupported(getAudioFileTypes(), type);
+ }
+
+ /**
+ * Return true if the given audio file format is supported for the
+ * given audio input stream by one of the providers installed on the
+ * system.
+ * @param type the audio file format type
+ * @param ais the audio input stream
+ */
+ public static boolean isFileTypeSupported(AudioFileFormat.Type type,
+ AudioInputStream ais)
+ {
+ return isFileTypeSupported(getAudioFileTypes(ais), type);
+ }
+
+ /**
+ * Return true if some provider on the system supplies a line
+ * matching the argument.
+ * @param info the line to match
+ */
+ public static boolean isLineSupported(Line.Info info)
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ if (getMixer(infos[i]).isLineSupported(info))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write an audio input stream to the given file, using the specified
+ * audio file format. All the providers installed on the system will
+ * be searched to find one that supports this operation.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param out the file to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs while writing
+ * @throws IllegalArgumentException if the file type is not supported
+ */
+ public static int write(AudioInputStream ais, AudioFileFormat.Type type,
+ File out)
+ throws IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter w = (AudioFileWriter) i.next();
+ if (w.isFileTypeSupported(type, ais))
+ return w.write(ais, type, out);
+ }
+ throw new IllegalArgumentException("file type not supported by system");
+ }
+
+ /**
+ * Write an audio input stream to the given output stream, using the
+ * specified audio file format. All the providers installed on the
+ * system will be searched to find one that supports this operation.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param os the output stream to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs while writing
+ * @throws IllegalArgumentException if the file type is not supported
+ */
+ public static int write(AudioInputStream ais, AudioFileFormat.Type type,
+ OutputStream os)
+ throws IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter w = (AudioFileWriter) i.next();
+ if (w.isFileTypeSupported(type, ais))
+ return w.write(ais, type, os);
+ }
+ throw new IllegalArgumentException("file type not supported by system");
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/BooleanControl.java b/libjava/classpath/javax/sound/sampled/BooleanControl.java
new file mode 100644
index 00000000000..aae1e23a298
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/BooleanControl.java
@@ -0,0 +1,145 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A BooleanControl is a Control which has two states.
+ * @since 1.3
+ */
+public class BooleanControl extends Control
+{
+ /**
+ * A Type specialized to represent a boolean control.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ // FIXME: correct constructions?
+
+ /**
+ * A control for applying reverb.
+ */
+ public final static Type APPLY_REVERB = new Type("Apply reverb");
+
+ /**
+ * A control for muting.
+ */
+ public final static Type MUTE = new Type("Mute");
+
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private Type type;
+ private boolean value;
+ private String trueLabel;
+ private String falseLabel;
+
+ /**
+ * Create a new boolean control, with the indicated Type and initial
+ * value. The description strings will default to "true" and "false".
+ * @param type the type
+ * @param init the initial value
+ */
+ protected BooleanControl(Type type, boolean init)
+ {
+ super(type);
+ this.value = init;
+ this.trueLabel = "true";
+ this.falseLabel = "false";
+ }
+
+ /**
+ * Create a new boolean control, with the indicated Type, initial
+ * value, and labels.
+ * @param type the type
+ * @param init the initial value
+ * @param trueLabel the label for the true state
+ * @param falseLabel the label for the false state
+ */
+ protected BooleanControl(Type type, boolean init, String trueLabel,
+ String falseLabel)
+ {
+ super(type);
+ this.value = init;
+ this.trueLabel = trueLabel;
+ this.falseLabel = falseLabel;
+ }
+
+ /**
+ * Return the label corresponding to the indicated state.
+ * @param state the state
+ * @return the true label or the false label, as appropriate
+ */
+ public String getStateLabel(boolean state)
+ {
+ return state ? trueLabel : falseLabel;
+ }
+
+ /**
+ * Return the current value of thhe control.
+ */
+ public boolean getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Set the value of the control as indicated.
+ * @param value the new value
+ */
+ public void setValue(boolean value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * Return a string describing this control.
+ */
+ public String toString()
+ {
+ return super.toString() + ": " + getStateLabel(value);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/Clip.java b/libjava/classpath/javax/sound/sampled/Clip.java
new file mode 100644
index 00000000000..1fa769470a2
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Clip.java
@@ -0,0 +1,115 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+
+/**
+ * A Clip represents some pre-loaded audio data.
+ * @since 1.3
+ */
+public interface Clip extends DataLine
+{
+ /**
+ * This can be passed to {@link #loop(int)} to indicate that looping
+ * should be done continuously.
+ */
+ int LOOP_CONTINUOUSLY = -1;
+
+ /**
+ * Return the frame length of this clip.
+ */
+ int getFrameLength();
+
+ /**
+ * Return the length of the clip in microseconds.
+ */
+ long getMicrosecondLength();
+
+ /**
+ * Start looping the clip. Looping will occur count times, or, if count
+ * is LOOP_CONTINUOUSLY, will be done continuously. A count of 0 indicates
+ * that any current looping should stop.
+ * @param count the number of times to loop
+ */
+ void loop(int count);
+
+ /**
+ * Open a clip, given an audio format and some data.
+ * @param fmt the format of the data
+ * @param data a byte array containing the audio data
+ * @param offset the offset of the first byte of data in the array
+ * @param len the length of the audio data in the array, in bytes
+ * @throws LineUnavailableException if the line cannot be opened
+ * @throws SecurityException if the line cannot be opened for security
+ * reasons
+ */
+ void open(AudioFormat fmt, byte[] data, int offset, int len)
+ throws LineUnavailableException;
+
+ /**
+ * Open a clip, given an audio input stream.
+ * @param ais the input stream
+ * @throws LineUnavailableException if the line cannot be opened
+ * @throws SecurityException if the line cannot be opened for security
+ * reasons
+ * @throws IOException if there is an I/O error while reading the stream
+ */
+ void open(AudioInputStream ais)
+ throws LineUnavailableException, IOException;
+
+ /**
+ * Set the position to the indicated frame.
+ * @param where new frame position
+ */
+ void setFramePosition(int where);
+
+ /**
+ * Set the loop begin and end points. These are used by loop(int).
+ * @param begin the starting point
+ * @param end the ending point
+ */
+ void setLoopPoints(int begin, int end);
+
+ /**
+ * Set the position to the indicated microsecond.
+ * @param ms the new position in microseconds
+ */
+ void setMicrosecondPosition(long ms);
+}
diff --git a/libjava/classpath/javax/sound/sampled/CompoundControl.java b/libjava/classpath/javax/sound/sampled/CompoundControl.java
new file mode 100644
index 00000000000..8664abca808
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/CompoundControl.java
@@ -0,0 +1,102 @@
+/* Control consisting of several other controls
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A compound control provides control over several other controls.
+ * @since 1.3
+ */
+public class CompoundControl extends Control
+{
+ /**
+ * This describes a single compound control.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private Control[] memberControls;
+
+ /**
+ * Create a new compound control given its type and members.
+ * @param type the type of the compound control
+ * @param members the members of the compound control
+ */
+ protected CompoundControl(Type type, Control[] members)
+ {
+ super(type);
+ // FIXME: clone?
+ this.memberControls = members;
+ }
+
+ /**
+ * Return the members of this compound control.
+ */
+ public Control[] getMemberControls()
+ {
+ // FIXME: clone?
+ return memberControls;
+ }
+
+ /**
+ * Return a string description of this compound control.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(super.toString());
+ result.append(": ");
+ for (int i = 0; i < memberControls.length; ++i)
+ {
+ if (i > 0)
+ result.append(", ");
+ result.append(memberControls[i].toString());
+ }
+ return result.toString();
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/RequestEvent.java b/libjava/classpath/javax/sound/sampled/Control.java
index 281c621f33f..810c2edd54d 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/RequestEvent.java
+++ b/libjava/classpath/javax/sound/sampled/Control.java
@@ -1,5 +1,5 @@
-/* RequestEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+/* Control over an attribute of a line
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ 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
@@ -36,72 +36,76 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.protocol.http.event;
-
-import gnu.java.net.protocol.http.Request;
-
-import java.util.EventObject;
+package javax.sound.sampled;
/**
- * A request event.
- *
- * @author Chris Burdess (dog@gnu.org)
+ * A control provides the ability to affect some attribute of a line,
+ * for instance its volume.
+ * @since 1.3
*/
-public class RequestEvent
- extends EventObject
+public class Control
{
-
- /**
- * The request created event type.
- */
- public static final int REQUEST_CREATED = 0;
-
- /**
- * The request sending event type.
- */
- public static final int REQUEST_SENDING = 1;
-
/**
- * The request sent event type.
+ * This describes a single control.
+ * @since 1.3
*/
- public static final int REQUEST_SENT = 2;
-
- /**
- * The type of this event.
- */
- protected int type;
+ public static class Type
+ {
+ private String name;
+
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ this.name = name;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this Type.
+ */
+ public String toString()
+ {
+ return name;
+ }
+ }
- /**
- * The request associated with this event.
- */
- protected Request request;
+ private Type type;
/**
- * Constructs a request event with the specified source, type, and request.
+ * Create a new Control given its Type.
+ * @param type the type
*/
- public RequestEvent(Object source, int type, Request request)
+ protected Control(Type type)
{
- super(source);
this.type = type;
- this.request = request;
}
/**
- * Returns the type of this event.
- * @see #type
+ * Return the Type of this Control.
*/
- public int getType()
+ public Type getType()
{
return type;
}
/**
- * Returns the request associated with this event.
+ * Return a String descrsibing this control. In particular the
+ * value will include the name of the associated Type.
*/
- public Request getRequest()
+ public String toString()
{
- return request;
+ return type.toString();
}
-
}
-
diff --git a/libjava/classpath/javax/sound/sampled/DataLine.java b/libjava/classpath/javax/sound/sampled/DataLine.java
new file mode 100644
index 00000000000..f755958fe87
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/DataLine.java
@@ -0,0 +1,265 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * The DataLine interface adds data-related functionality to the Line
+ * interface. For example, it adds methods to start and stop the data
+ * on the line.
+ * @since 1.3
+ */
+public interface DataLine extends Line
+{
+ /**
+ * This class extends Line.Info with information specific to DataLine.
+ * In particular it adds information about buffer sizes, and about supported
+ * audio formats.
+ * @since 1.3
+ */
+ class Info extends Line.Info
+ {
+ private int minBufferSize;
+ private int maxBufferSize;
+ private AudioFormat[] formats;
+
+ /**
+ * Create a new Info given the line's class and a supported
+ * audio format. The buffer sizes default to AudioSystem.NOT_SPECIFIED.
+ * @param klass the class of the line
+ * @param fmt the supported format
+ */
+ public Info(Class klass, AudioFormat fmt)
+ {
+ super(klass);
+ this.minBufferSize = AudioSystem.NOT_SPECIFIED;
+ this.maxBufferSize = AudioSystem.NOT_SPECIFIED;
+ this.formats = new AudioFormat[] { fmt };
+ }
+
+ /**
+ * Create a new Info given the line's class, the supported audio formats,
+ * the minimum buffer size, and the maximum buffer size.
+ * @param klass the class of the linee
+ * @param fmts the supported audio formats
+ * @param minSize the minimum buffer size
+ * @param maxSize the maximum buffer size
+ */
+ public Info(Class klass, AudioFormat[] fmts, int minSize, int maxSize)
+ {
+ super(klass);
+ this.minBufferSize = minSize;
+ this.maxBufferSize = maxSize;
+ this.formats = fmts;
+ }
+
+ /**
+ * Create a new Info given the line's class, a supported
+ * audio format, and a buffer size. Both the minimum and maximum
+ * sizes are set from this size.
+ * @param klass the class of the line
+ * @param fmt the supported format
+ * @param size the buffer size
+ */
+ public Info(Class klass, AudioFormat fmt, int size)
+ {
+ super(klass);
+ this.minBufferSize = size;
+ this.maxBufferSize = size;
+ this.formats = new AudioFormat[] { fmt };
+ }
+
+ /**
+ * Return the supported audio formats.
+ */
+ public AudioFormat[] getFormats()
+ {
+ // FIXME: clone?
+ return formats;
+ }
+
+ /**
+ * Return the maximum buffer size.
+ */
+ public int getMaxBufferSize()
+ {
+ return maxBufferSize;
+ }
+
+ /**
+ * Return the minimum buffer size.
+ */
+ public int getMinBufferSize()
+ {
+ return minBufferSize;
+ }
+
+ /**
+ * Return true if the indicated audio format is supported by this
+ * Info, false otherwise.
+ * @param fmt the audio format
+ * @return true if the format is supported
+ */
+ public boolean isFormatSupported(AudioFormat fmt)
+ {
+ for (int i = 0; i < formats.length; ++i)
+ {
+ if (fmt.matches(formats[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if this Info matches another Info object.
+ */
+ public boolean matches(Line.Info o)
+ {
+ if (! super.matches(o) || ! (o instanceof Info))
+ return false;
+ Info other = (Info) o;
+ if (minBufferSize < other.minBufferSize
+ || maxBufferSize > other.maxBufferSize)
+ return false;
+ for (int i = 0; i < formats.length; ++i)
+ {
+ boolean ok = false;
+ for (int j = 0; j < other.formats.length; ++j)
+ {
+ if (formats[i].matches(other.formats[j]))
+ {
+ ok = true;
+ break;
+ }
+ }
+ if (! ok)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Return a description of this Info object.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append("formats: [");
+ for (int i = 0; i < formats.length; ++i)
+ {
+ if (i > 0)
+ result.append(", ");
+ result.append(formats[i].toString());
+ }
+ result.append("]; minBufferSize: ");
+ result.append(minBufferSize);
+ result.append("; maxBufferSize: ");
+ result.append(maxBufferSize);
+ return result.toString();
+ }
+ }
+
+ /**
+ * Return the number of bytes currently available on this DataLine.
+ */
+ int available();
+
+ /**
+ * This method blocks until whatever data is buffered in the
+ * DataLine's internal buffer has been drained.
+ */
+ void drain();
+
+ /**
+ * This flushes the DataLine by discarding any buffered data.
+ */
+ void flush();
+
+ /**
+ * Returns the size of the DataLine's internal buffer, in bytes.
+ */
+ int getBufferSize();
+
+ /**
+ * Return the current format of the data associated with this DataLine.
+ */
+ AudioFormat getFormat();
+
+ /**
+ * Return the current frame position.
+ */
+ int getFramePosition();
+
+ /**
+ * Return the volume level for this DataLine.
+ */
+ float getLevel();
+
+ /**
+ * Return the current frame position.
+ * @since 1.5
+ */
+ long getLongFramePosition();
+
+ /**
+ * Return the number of microseconds this DataLine has been playing.
+ */
+ long getMicrosecondPosition();
+
+ /**
+ * Return true if this line is active, meaning that it is actively
+ * performing audio I/O.
+ */
+ boolean isActive();
+
+ /**
+ * Return true if this line is running, meaning that it has been
+ * started. When the line is stopped, this method will return false.
+ */
+ boolean isRunning();
+
+ /**
+ * Start processing data. This will emit a START event.
+ */
+ void start();
+
+ /**
+ * Stop processing data. This will emit a STOP event.
+ */
+ void stop();
+}
diff --git a/libjava/classpath/javax/sound/sampled/EnumControl.java b/libjava/classpath/javax/sound/sampled/EnumControl.java
new file mode 100644
index 00000000000..798f3a91c96
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/EnumControl.java
@@ -0,0 +1,126 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * An EnumControl is a Control which can take one of a specified set of
+ * values.
+ * @since 1.3
+ */
+public class EnumControl extends Control
+{
+ /**
+ * This Type describes an EnumControl.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ /** This describes an enum control used for reverb. */
+ public static final Type REVERB = new Type("Reverb");
+
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private Object[] values;
+ private Object value;
+
+ /**
+ * Create a new enumerated control given its Type, the range of valid
+ * values, and its initial value.
+ * @param type the type
+ * @param values the valid values
+ * @param val the initial value
+ */
+ protected EnumControl(Type type, Object[] values, Object val)
+ {
+ super(type);
+ // FIXME: error checking: values.length>0, val in values... ?
+ // FIXME: clone here?
+ this.values = values;
+ this.value = val;
+ }
+
+ /**
+ * Return the current value of this control.
+ */
+ public Object getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Return the valid values for this control.
+ */
+ public Object[] getValues()
+ {
+ // FIXME: clone here?
+ return values;
+ }
+
+ /**
+ * Set the value of this control. If the indicated value is not among
+ * the valid values, this method will throw an IllegalArgumentException.
+ * @param value the new value
+ * @throws IllegalArgumentException if the new value is invalid
+ */
+ public void setValue(Object value)
+ {
+ for (int i = 0; i < values.length; ++i)
+ {
+ if (! values[i].equals(value))
+ throw new IllegalArgumentException("value not supported");
+ }
+ this.value = value;
+ }
+
+ /**
+ * Return a string describing this control.
+ */
+ public String toString()
+ {
+ return super.toString() + ": " + value;
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/FloatControl.java b/libjava/classpath/javax/sound/sampled/FloatControl.java
new file mode 100644
index 00000000000..409c90de2cd
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/FloatControl.java
@@ -0,0 +1,267 @@
+/* Floating point control
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/** @since 1.3 */
+public class FloatControl extends Control
+{
+ /**
+ * An instance of this class describes a particular floating point control.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ /** Auxiliary return gain. */
+ public static final Type AUX_RETURN = new Type("AUX return");
+
+ /** Auxiliary send gain. */
+ public static final Type AUX_SEND = new Type("AUX send");
+
+ /** Balance. */
+ public static final Type BALANCE = new Type("Balance");
+
+ /** Master gain control. */
+ public static final Type MASTER_GAIN = new Type("Master gain");
+
+ /** Control for panning. */
+ public static final Type PAN = new Type("Pan");
+
+ /** Post-reverb gain. */
+ public static final Type REVERB_RETURN = new Type("Reverb return");
+
+ /** Pre-reverb gain. */
+ public static final Type REVERB_SEND = new Type("Reverb send");
+
+ /** Control the sample rate. */
+ public static final Type SAMPLE_RATE = new Type("Sample rate");
+
+ /** Volume control. */
+ public static final Type VOLUME = new Type("Volume");
+
+ /**
+ * Create a new type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private float minimum;
+ private float maximum;
+ private float precision;
+ private int updatePeriod;
+ private float value;
+ private String units;
+ private String minLabel;
+ private String maxLabel;
+ private String midLabel;
+
+ /**
+ * Create a new FloatControl given its type and various parameters.
+ * The minimum, maximum, and midpoint labels will all be the empty string.
+ *
+ * @param type the type
+ * @param min the minimum valuee
+ * @param max the maximum value
+ * @param prec the precision
+ * @param update the update period
+ * @param init the initial value
+ * @param units the description of the units
+ */
+ protected FloatControl(Type type, float min, float max, float prec,
+ int update, float init, String units)
+ {
+ super(type);
+ this.minimum = min;
+ this.maximum = max;
+ this.precision = prec;
+ this.updatePeriod = update;
+ this.value = init;
+ this.units = units;
+ this.minLabel = "";
+ this.maxLabel = "";
+ this.midLabel = "";
+ }
+
+ /**
+ * Create a new FloatControl given its type and various parameters.
+ *
+ * @param type the type
+ * @param min the minimum valuee
+ * @param max the maximum value
+ * @param prec the precision
+ * @param update the update period
+ * @param init the initial value
+ * @param units the description of the units
+ * @param minLabel the label for the minimum value
+ * @param midLabel the label for the midpoint
+ * @param maxLabel the label for the maximum value
+ */
+ protected FloatControl(Type type, float min, float max, float prec,
+ int update, float init, String units,
+ String minLabel, String midLabel, String maxLabel)
+ {
+ super(type);
+ this.minimum = min;
+ this.maximum = max;
+ this.precision = prec;
+ this.updatePeriod = update;
+ this.value = init;
+ this.units = units;
+ this.minLabel = minLabel;
+ this.maxLabel = maxLabel;
+ this.midLabel = midLabel;
+ }
+
+ /**
+ * Return the maximum value of this control.
+ */
+ public float getMaximum()
+ {
+ return maximum;
+ }
+
+ /**
+ * Return the label for the minimum value of this control.
+ */
+ public String getMaxLabel()
+ {
+ return maxLabel;
+ }
+
+ /**
+ * Return the label for the midpoint of this control.
+ */
+ public String getMidLabel()
+ {
+ return midLabel;
+ }
+
+ /**
+ * Return the minimum value of this control.
+ */
+ public float getMinimum()
+ {
+ return minimum;
+ }
+
+ /**
+ * Return the label for the minimum value of this control.
+ */
+ public String getMinLabel()
+ {
+ return minLabel;
+ }
+
+ /**
+ * Return the precision of this control.
+ */
+ public float getPrecision()
+ {
+ return precision;
+ }
+
+ /**
+ * Return the name of the units for this control.
+ */
+ public String getUnits()
+ {
+ return units;
+ }
+
+ /**
+ * Return the update period of this control.
+ */
+ public int getUpdatePeriod()
+ {
+ return updatePeriod;
+ }
+
+ /**
+ * Return the current value of this control.
+ */
+ public float getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Set the new value of this control.
+ * @param value the new value
+ * @throws IllegalArgumentException if the new value is greater than the
+ * maximum or less than the minimum.
+ */
+ public void setValue(float value)
+ {
+ if (value < minimum || value > maximum)
+ throw new IllegalArgumentException("value out of range");
+ this.value = value;
+ }
+
+ /**
+ * This tells the control to start at the starting value
+ * and to shift its value incrementally to the final value
+ * over the given time interval, specified in microseconds.
+ * The default implementation does not do this, but instead
+ * simply sets the value to the final value immediately.
+ *
+ * @param from the starting value
+ * @param to the final value
+ * @param ms the number of microseconds
+ */
+ public void shift(float from, float to, int ms)
+ {
+ if (from < minimum || from > maximum
+ || to < minimum || to > maximum
+ || ms < 0)
+ throw new IllegalArgumentException("argument out of range");
+ // The default just sets the value to TO.
+ this.value = to;
+ }
+
+ /**
+ * Return a string describing this control.
+ */
+ public String toString()
+ {
+ return super.toString() + ": " + value;
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/Line.java b/libjava/classpath/javax/sound/sampled/Line.java
new file mode 100644
index 00000000000..69bb9084f10
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Line.java
@@ -0,0 +1,150 @@
+/* An input or output line
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Line represents a single input or output audio line.
+ * @since 1.3
+ */
+public interface Line
+{
+ /**
+ * An object of this type holds information about a Line.
+ * @since 1.3
+ */
+ class Info
+ {
+ private Class klass;
+
+ /**
+ * Create a new Info object. The argument is the class of the line,
+ * for instance TargetDataLine.class.
+ * @param klass the class of the line
+ */
+ public Info(Class klass)
+ {
+ this.klass = klass;
+ }
+
+ /**
+ * Return the line's class.
+ */
+ public Class getLineClass()
+ {
+ return klass;
+ }
+
+ /**
+ * Return true if this Info object matches the given object.
+ * @param other the object to match
+ * @return true if they match, false otherwise
+ */
+ public boolean matches(Info other)
+ {
+ return klass.equals(other.klass);
+ }
+
+ /**
+ * Return a description of this Info object.
+ */
+ public String toString()
+ {
+ return klass.toString();
+ }
+ }
+
+ /**
+ * Add a listener which will be notified whenever this Line changes state.
+ * @param listener the listener to notify
+ */
+ void addLineListener(LineListener listener);
+
+ /**
+ * Close this line.
+ */
+ void close();
+
+ /**
+ * Return the control associated with this Line that matches the
+ * argument.
+ * @param what the type of the control to match
+ * @return the associated control
+ * @throws IllegalArgumentException if a control of this type is not
+ * available for this line
+ */
+ Control getControl(Control.Type what);
+
+ /**
+ * Return an array of controls associated with this Line. Note that
+ * this method will not return null -- if there are no controls, it
+ * will return a zero-length array.
+ */
+ Control[] getControls();
+
+ /**
+ * Return the Info object associated with this Line.
+ */
+ Info getLineInfo();
+
+ /**
+ * Return true if a Control matching the argument is available for this
+ * Line, false otherwise.
+ * @param what the type of the control to match
+ */
+ boolean isControlSupported(Control.Type what);
+
+ /**
+ * Return true if this line is open, false otherwise.
+ */
+ boolean isOpen();
+
+ /**
+ * Open this line.
+ * @throws LineUnavailableException if the line is unavailable for some
+ * reason
+ */
+ void open() throws LineUnavailableException;
+
+ /**
+ * Remove the listener from this Line; after this call the listener will
+ * no longer be notified when this Line changes state.
+ * @param listener the listener to remove
+ */
+ void removeLineListener(LineListener listener);
+}
diff --git a/libjava/classpath/javax/sound/sampled/LineEvent.java b/libjava/classpath/javax/sound/sampled/LineEvent.java
new file mode 100644
index 00000000000..7bba2cd1d96
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/LineEvent.java
@@ -0,0 +1,150 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.EventObject;
+
+// FIXME: attempts to serialize this should fail
+
+/**
+ * This class holds information about a state change of a Line.
+ * @since 1.3
+ */
+public class LineEvent extends EventObject
+{
+ /**
+ * This class represents the kinds of state changes that can occur
+ * to a Line. The standard states are availabe as static instances.
+ * @since 1.3
+ */
+ public static class Type
+ {
+ /** An event of this type is posted when a Line closes. */
+ public static final Type CLOSE = new Type("close");
+
+ /** An event of this type is posted when a Line opens. */
+ public static final Type OPEN = new Type("open");
+
+ /** An event of this type is posted when a Line starts. */
+ public static final Type START = new Type("start");
+
+ /** An event of this type is posted when a Line stops. */
+ public static final Type STOP = new Type("stop");
+
+ private String name;
+
+ /**
+ * Create a new type with the indicated name.
+ * @param name the name
+ */
+ protected Type(String name)
+ {
+ this.name = name;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this Type.
+ */
+ public String toString()
+ {
+ return name;
+ }
+ }
+
+ private Type type;
+ private long framePosition;
+ private Line line;
+
+ /**
+ * Create a new LineEvent with the indicated line, type, and frame position.
+ * @param line the line
+ * @param type the type of the event
+ * @param pos the frame position
+ */
+ public LineEvent(Line line, Type type, long pos)
+ {
+ super(line);
+ this.line = line;
+ this.type = type;
+ this.framePosition = pos;
+ }
+
+ /**
+ * Return the frame position associated with this event.
+ */
+ public long getFramePosition()
+ {
+ return framePosition;
+ }
+
+ /**
+ * Return the Line associated with this event.
+ */
+ public Line getLine()
+ {
+ return line;
+ }
+
+ /**
+ * Return the Type associated with this event.
+ */
+ public Type getType()
+ {
+ return type;
+ }
+
+ /**
+ * Return a description of this event.
+ */
+ public String toString()
+ {
+ return ("type=" + type + "; framePosition=" + framePosition
+ + "line=" + line);
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionListener.java b/libjava/classpath/javax/sound/sampled/LineListener.java
index 073e89d4407..1b87c027902 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionListener.java
+++ b/libjava/classpath/javax/sound/sampled/LineListener.java
@@ -1,5 +1,5 @@
-/* ConnectionListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+/* Listener for Lines
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ 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
@@ -36,23 +36,20 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.protocol.http.event;
+package javax.sound.sampled;
import java.util.EventListener;
/**
- * A connection listener.
- *
- * @author Chris Burdess (dog@gnu.org)
+ * This interface is used by classes which wish to be notified
+ * when the state of a Line changes.
+ * @since 1.3
*/
-public interface ConnectionListener
- extends EventListener
+public interface LineListener extends EventListener
{
-
/**
- * Callback invoked when the associated connection is closed.
+ * This is called when the line's status changes.
+ * @param ev the event describing the change
*/
- void connectionClosed(ConnectionEvent event);
-
+ void update(LineEvent ev);
}
-
diff --git a/libjava/classpath/javax/sound/sampled/LineUnavailableException.java b/libjava/classpath/javax/sound/sampled/LineUnavailableException.java
new file mode 100644
index 00000000000..b203d7be213
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/LineUnavailableException.java
@@ -0,0 +1,61 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/** @since 1.3 */
+public class LineUnavailableException extends Exception
+{
+ private static final long serialVersionUID = -2046718279487432130L;
+
+ /**
+ * Create a new LineUnavailableException.
+ */
+ public LineUnavailableException()
+ {
+ }
+
+ /**
+ * Create a new LineUnavailableException with the given message.
+ * @param msg the message
+ */
+ public LineUnavailableException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/Mixer.java b/libjava/classpath/javax/sound/sampled/Mixer.java
new file mode 100644
index 00000000000..b9afba3fe87
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Mixer.java
@@ -0,0 +1,206 @@
+/* Mixers
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Mixer is a Line which itself holds multiple lines.
+ * @since 1.3
+ */
+public interface Mixer extends Line
+{
+ /**
+ * An Info object describes a mixer.
+ * @since 1.3
+ */
+ class Info
+ {
+ private String name;
+ private String description;
+ private String vendor;
+ private String version;
+
+ /**
+ * Create a new mixer description.
+ * @param name the name of the mixer
+ * @param vendor the vendor
+ * @param desc a descriptive string
+ * @param vers the mixer's version
+ */
+ public Info(String name, String vendor, String desc, String vers)
+ {
+ this.name = name;
+ this.description = desc;
+ this.vendor = vendor;
+ this.version = vers;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of the mixer.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return the mixer's description.
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Return the mixer's vendor.
+ */
+ public String getVendor()
+ {
+ return vendor;
+ }
+
+ /**
+ * Return the mixer's version.
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public String toString()
+ {
+ return ("name=" + name + "; description=" + description
+ + "; vendor=" + vendor + "; version=" + version);
+ }
+ }
+
+ /**
+ * Return a Line associated with this Mixer, given its description.
+ * @param info the description of the line to find
+ * @return the corresponding Line
+ * @throws LineUnavailableException if no Line matching the description
+ * exists in this Mixer
+ */
+ Line getLine(Line.Info info) throws LineUnavailableException;
+
+ /**
+ * Return the number of lines matching this description.
+ * @param info the description of the lines to find.
+ */
+ int getMaxLines(Line.Info info);
+
+ /**
+ * Return an Info object describing this Mixer.
+ */
+ Info getMixerInfo();
+
+ /**
+ * Return an array of Info objects describing all the source lines
+ * available in this Mixer.
+ */
+ Line.Info[] getSourceLineInfo();
+
+ /**
+ * Return an array of Info objects describing all the source lines
+ * available in this Mixer, which match the provided decsription.
+ * @param info the description of the source lines to find
+ */
+ Line.Info[] getSourceLineInfo(Line.Info info);
+
+ /**
+ * Return an array of all the source lines available in this Mixer.
+ */
+ Line[] getSourceLines();
+
+ /**
+ * Return an array of Info objects describing all the target lines
+ * available in this Mixer.
+ */
+ Line.Info[] getTargetLineInfo();
+
+ /**
+ * Return an array of Info objects describing all the target lines
+ * available in this Mixer, which match the provided decsription.
+ * @param info the description of the target lines to find
+ */
+ Line.Info[] getTargetLineInfo(Line.Info info);
+
+ /**
+ * Return an array of all the target lines available in this Mixer.
+ */
+ Line[] getTargetLines();
+
+ /**
+ * Return true if a Line matching the given description is supported
+ * by this Mixer, false otherwise.
+ * @param info the description of the line to find
+ */
+ boolean isLineSupported(Line.Info info);
+
+ /**
+ * Return true if this Mixer supports synchronization of the given set
+ * of lines.
+ * @param lines the lines to check
+ * @param sync true if the synchronization must be accurate at all times
+ */
+ boolean isSynchronizationSupported(Line[] lines, boolean sync);
+
+ /**
+ * Start synchronization on the given set of lines.
+ * @param lines the lines to synchronize, or null for all the lines
+ * @param sync true if the synchronization must be accurate at all times
+ * @throws IllegalArgumentException if the lines cannot be synchronized
+ */
+ void synchronize(Line[] lines, boolean sync);
+
+ /**
+ * Stop synchronization for the given set of lines.
+ * @param lines the lines to unsynchronize, or null for all the lines
+ */
+ void unsynchronize(Line[] lines);
+}
diff --git a/libjava/classpath/javax/sound/sampled/Port.java b/libjava/classpath/javax/sound/sampled/Port.java
new file mode 100644
index 00000000000..7b3daafd3aa
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Port.java
@@ -0,0 +1,135 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Port is a Line which represents an audio device, for instance
+ * a microphone.
+ *
+ * @since 1.3
+ */
+public interface Port extends Line
+{
+ /**
+ * This describes a single port.
+ * @since 1.3
+ */
+ class Info extends Line.Info
+ {
+ // FIXME names?
+
+ /** A CD player. */
+ public static final Info COMPACT_DISC = new Info(Port.class,
+ "Compact Disc",
+ true);
+
+ /** Headphones. */
+ public static final Info HEADPHONE = new Info(Port.class, "Headphone",
+ false);
+
+ /** Generic input line. */
+ public static final Info LINE_IN = new Info(Port.class, "Line in",
+ true);
+
+ /** Generic output line. */
+ public static final Info LINE_OUT = new Info(Port.class, "Line out",
+ false);
+
+ /** A microphone. */
+ public static final Info MICROPHONE = new Info(Port.class, "Microphone",
+ true);
+
+ /** A speaker. */
+ public static final Info SPEAKER = new Info(Port.class, "Speaker",
+ false);
+
+ private String name;
+ private boolean isSource;
+
+ /**
+ * Create a new Info object, given the line's class, the name,
+ * and an argument indicating whether this is an input or an output.
+ * @param klass the class of the line
+ * @param name the name of the line
+ * @param isSource true if this is an input source
+ */
+ public Info(Class klass, String name, boolean isSource)
+ {
+ super(klass);
+ this.name = name;
+ this.isSource = isSource;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this object.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return true if this describes an input line.
+ */
+ public boolean isSource()
+ {
+ return isSource;
+ }
+
+ public boolean matches(Line.Info other)
+ {
+ return super.matches(other) && equals(other);
+ }
+
+ public String toString()
+ {
+ return super.toString() + "; name=" + name + "; isSource=" + isSource;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/ReverbType.java b/libjava/classpath/javax/sound/sampled/ReverbType.java
new file mode 100644
index 00000000000..a089593777d
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/ReverbType.java
@@ -0,0 +1,144 @@
+/* Reverb attributes
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This represents a reverb effect which can be applied to an audio signal.
+ * @since 1.3
+ */
+public class ReverbType
+{
+ private String name;
+ private int earlyReflectionDelay;
+ private float earlyReflectionIntensity;
+ private int lateReflectionDelay;
+ private float lateReflectionIntensity;
+ private int decayTime;
+
+ /**
+ * Create a new ReverbType given its attributes.
+ * @param name the name of this type
+ * @param earlyDelay the early delay time in microseconds
+ * @param earlyInten the early intensity in decibels
+ * @param lateDelay the late delay time in microseconds
+ * @param lateInten the late intensity in decibels
+ * @param decay the decay time in microseconds
+ */
+ protected ReverbType(String name, int earlyDelay, float earlyInten,
+ int lateDelay, float lateInten, int decay)
+ {
+ this.name = name;
+ this.earlyReflectionDelay = earlyDelay;
+ this.earlyReflectionIntensity = earlyInten;
+ this.lateReflectionDelay = lateDelay;
+ this.lateReflectionIntensity = lateInten;
+ this.decayTime = decay;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the decay time.
+ */
+ public int getDecayTime()
+ {
+ return decayTime;
+ }
+
+ /**
+ * Return the early reflection delay.
+ */
+ public int getEarlyReflectionDelay()
+ {
+ return earlyReflectionDelay;
+ }
+
+ /**
+ * Return the early reflection intensity.
+ */
+ public float getEarlyReflectionIntensity()
+ {
+ return earlyReflectionIntensity;
+ }
+
+ /**
+ * Return the late reflection delay.
+ */
+ public int getLateReflectionDelay()
+ {
+ return lateReflectionDelay;
+ }
+
+ /**
+ * Return the late reflection intensity.
+ */
+ public float getLateReflectionIntensity()
+ {
+ return lateReflectionIntensity;
+ }
+
+ /**
+ * Return the name of this ReverbType.
+ * @since 1.5
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return a description of this ReverbType.
+ */
+ public String toString()
+ {
+ return ("name=" + name + "; earlyReflectionDelay=" + earlyReflectionDelay
+ + "; earlyReflectionIntensity=" + earlyReflectionIntensity
+ + "; lateReflectionDelay=" + lateReflectionDelay
+ + "; lateReflectionIntensity=" + lateReflectionIntensity
+ + "; decayTime=" + decayTime);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/SourceDataLine.java b/libjava/classpath/javax/sound/sampled/SourceDataLine.java
new file mode 100644
index 00000000000..6e73d6d9c4e
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/SourceDataLine.java
@@ -0,0 +1,77 @@
+/* Output data line.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This is a DataLine to which data may be written.
+ * @since 1.3
+ */
+public interface SourceDataLine extends DataLine
+{
+ /**
+ * Open the line, given the desired audio format.
+ * @param fmt the format to use
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this is prevented by the security manager
+ */
+ void open(AudioFormat fmt)
+ throws LineUnavailableException;
+
+ /**
+ * Open the line, given the desired audio format and the buffer size.
+ * @param fmt the format to use
+ * @param size the buffer size
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this is prevented by the security manager
+ */
+ void open(AudioFormat fmt, int size)
+ throws LineUnavailableException;
+
+ /**
+ * Write audio data to this line. The data must be an integral number
+ * of frames, as determined by the audio format.
+ * @param buf a byte array of audio data
+ * @param offset index of the first byte in the array to use
+ * @param length the number of bytes to write
+ * @return the number of bytes written
+ */
+ int write(byte[] buf, int offset, int length);
+}
diff --git a/libjava/classpath/javax/sound/sampled/TargetDataLine.java b/libjava/classpath/javax/sound/sampled/TargetDataLine.java
new file mode 100644
index 00000000000..61ad344efc2
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/TargetDataLine.java
@@ -0,0 +1,79 @@
+/* Input data line.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This is a DataLine from which data may be read.
+ * @since 1.3
+ */
+public interface TargetDataLine extends DataLine
+{
+ /**
+ * Open the line using the indicated audio format.
+ * @param fmt the format to use
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this operation is prevented by the
+ * security manager
+ */
+ void open(AudioFormat fmt)
+ throws LineUnavailableException;
+
+ /**
+ * Open the line using the indicated audio format and buffer size.
+ * @param fmt the format to use
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this operation is prevented by the
+ * security manager
+ */
+ void open(AudioFormat fmt, int size)
+ throws LineUnavailableException;
+
+ /**
+ * Read data from the line into the given buffer. The requested data
+ * should be an integral number of framaes, as determined by the audio
+ * format.
+ * @param buf the buffer into which the data is put
+ * @param offset the initial offset at which to write
+ * @param length the maximum number of bytes to read
+ * @return the actual number of bytes read
+ */
+ int read(byte[] buf, int offset, int length);
+}
diff --git a/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java b/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java
new file mode 100644
index 00000000000..bced9c18f19
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java
@@ -0,0 +1,65 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * An exception of this type is thrown when an operation is attempted
+ * on a file whose format is unrecognized.
+ * @since 1.3
+ */
+public class UnsupportedAudioFileException extends Exception
+{
+ private static final long serialVersionUID = -139127412623160368L;
+
+ /**
+ * Create a new UnsupportedAudioFileException.
+ */
+ public UnsupportedAudioFileException()
+ {
+ }
+
+ /**
+ * Create a new UnsupportedAudioFileException with the indicated message.
+ * @param msg the message
+ */
+ public UnsupportedAudioFileException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java b/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java
new file mode 100644
index 00000000000..6df4cc22d43
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java
@@ -0,0 +1,146 @@
+/* Audio file reader API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+/**
+ * This abstract class defines the interface to audio file readers.
+ * A concrete provider subclass will implement the methods declared
+ * here. These methods can be used to determine the format of
+ * files, and to retrieve an AudioInputStream for a file.
+ * @since 1.3
+ */
+public abstract class AudioFileReader
+{
+ /**
+ * The default constructor. Note that this class is abstract and
+ * thus not directly instantiable.
+ */
+ public AudioFileReader()
+ {
+ }
+
+ /**
+ * Return the format of the given file as deduced by this provider.
+ * If the format of the file is not recognized, throws an exception.
+ * This will also throw an exception if there is an I/O error when
+ * reading the file.
+ * @param file the file to examine
+ * @return the audio file format
+ * @throws UnsupportedAudioFileException if the file's format is not
+ * recognized
+ * @throws IOException if there is an I/O error while reading the file
+ */
+ public abstract AudioFileFormat getAudioFileFormat(File file)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return the format of the given input stream as deduced by this provider.
+ * If the format of the stream is not recognized, throws an exception.
+ * This will also throw an exception if there is an I/O error when
+ * reading the stream. Note that providers typically use mark and reset
+ * on the stream when examining the data, and as a result an IOException
+ * may be thrown if the stream does not support these.
+ * @param is the stream to examine
+ * @return the audio file format
+ * @throws UnsupportedAudioFileException if the stream's format is not
+ * recognized
+ * @throws IOException if there is an I/O error while reading the stream
+ */
+ public abstract AudioFileFormat getAudioFileFormat(InputStream is)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return the format of the given URL as deduced by this provider.
+ * If the format of the URL is not recognized, throws an exception.
+ * This will also throw an exception if there is an I/O error when
+ * reading the URL.
+ * @param url the URL to examine
+ * @return the audio file format
+ * @throws UnsupportedAudioFileException if the URL's format is not
+ * recognized
+ * @throws IOException if there is an I/O error while reading the URL
+ */
+ public abstract AudioFileFormat getAudioFileFormat(URL url)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return an AudioInputStream for the given file. The file is assumed
+ * to hold valid audio data.
+ * @param file the file to read
+ * @return an AudioInputStream for the file
+ * @throws UnsupportedAudioFileException if the file's type is not
+ * recognized
+ * @throws IOException if there is an error while reading the file
+ */
+ public abstract AudioInputStream getAudioInputStream(File file)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return an AudioInputStream wrapping the given input stream. The stream
+ * is assumed to hold valid audio data.
+ * @param is the input stream to wrap
+ * @return an AudioInputStream for the stream
+ * @throws UnsupportedAudioFileException if the stream's type is not
+ * recognized
+ * @throws IOException if there is an error while reading the stream
+ */
+ public abstract AudioInputStream getAudioInputStream(InputStream is)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return an AudioInputStream for the given URL. The URL is assumed
+ * to hold valid audio data.
+ * @param url the URL to read
+ * @return an AudioInputStream for the URL
+ * @throws UnsupportedAudioFileException if the URL's type is not
+ * recognized
+ * @throws IOException if there is an error while reading the URL
+ */
+ public abstract AudioInputStream getAudioInputStream(URL url)
+ throws UnsupportedAudioFileException, IOException;
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java b/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java
new file mode 100644
index 00000000000..955bb051715
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java
@@ -0,0 +1,131 @@
+/* Audio file writer API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioInputStream;
+
+/**
+ * This abstract class provides an API for writing audio files. Concrete
+ * subclasses implement the methods declared here.
+ * @since 1.3
+ */
+public abstract class AudioFileWriter
+{
+ /**
+ * Creat a new audio file writer.
+ */
+ public AudioFileWriter()
+ {
+ }
+
+ /**
+ * Return an array of all audio file format types supported by this
+ * provider.
+ */
+ public abstract AudioFileFormat.Type[] getAudioFileTypes();
+
+ /**
+ * Return an array of all the audio file format types supported by this
+ * provider, which can be written given the input stream.
+ * @param ais the audio input stream
+ */
+ public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais);
+
+ /**
+ * Return true if the indicated type is supported by this provider.
+ * @param type the audio file format type
+ */
+ public boolean isFileTypeSupported(AudioFileFormat.Type type)
+ {
+ AudioFileFormat.Type[] types = getAudioFileTypes();
+ for (int i = 0; i < types.length; ++i)
+ {
+ if (type.equals(types[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if the indicated type is supported by this provider,
+ * and can be written from the given audio input stream.
+ * @param type the audio file format type
+ * @param ais the audio input stream to write
+ */
+ public boolean isFileTypeSupported(AudioFileFormat.Type type,
+ AudioInputStream ais)
+ {
+ AudioFileFormat.Type[] types = getAudioFileTypes(ais);
+ for (int i = 0; i < types.length; ++i)
+ {
+ if (type.equals(types[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write audio data to a file.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param out the file to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs when writing
+ */
+ public abstract int write(AudioInputStream ais, AudioFileFormat.Type type,
+ File out)
+ throws IOException;
+
+ /**
+ * Write audio data to an output stream.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param os the output stream
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs when writing
+ */
+ public abstract int write(AudioInputStream ais, AudioFileFormat.Type type,
+ OutputStream os)
+ throws IOException;
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java b/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java
new file mode 100644
index 00000000000..e96cc0454d1
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java
@@ -0,0 +1,179 @@
+/* Format conversion API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+
+/**
+ * A format conversion provider supplies methods for converting between
+ * different audio formats. This abstract class defines the interface
+ * to this functionality; concrete subclasses will implement the methods
+ * declared here.
+ * @since 1.3
+ */
+public abstract class FormatConversionProvider
+{
+ /**
+ * Create a new format conversion provider.
+ */
+ public FormatConversionProvider()
+ {
+ }
+
+ /**
+ * Return an audio input stream given the desired target encoding and
+ * another audio input stream. The data in the given stream will be
+ * converted to the desired encoding.
+ * @param encoding the encoding
+ * @param source the source audio input stream
+ * @return a new audio input stream
+ * @throws IllegalArgumentException if the conversion is not supported
+ */
+ public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding encoding,
+ AudioInputStream source);
+
+ /**
+ * Return an audio input stream given the desired target format and
+ * another audio input stream. The data in the given stream will be
+ * converted to the desired format.
+ * @param format the format
+ * @param source the source audio input stream
+ * @return a new audio input stream
+ * @throws IllegalArgumentException if the conversion is not supported
+ */
+ public abstract AudioInputStream getAudioInputStream(AudioFormat format,
+ AudioInputStream source);
+
+ /**
+ * Return an array of all the source encodings supported by this conversion
+ * provider.
+ */
+ public abstract AudioFormat.Encoding[] getSourceEncodings();
+
+ /**
+ * Return an array of all the target encodings supported by this conversion
+ * provider.
+ */
+ public abstract AudioFormat.Encoding[] getTargetEncodings();
+
+ /**
+ * Return an array of all the target encodings that are available for a given
+ * source format.
+ * @param fmt the source format
+ * @return an array of supported target encodings
+ */
+ public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat fmt);
+
+ /**
+ * Return a array of all the target formats that match given target encoding,
+ * and to which this provider can convert the source format.
+ * @param targ the target encoding to match
+ * @param src the source format
+ * @return an array of supported target formats
+ */
+ public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targ,
+ AudioFormat src);
+
+ /**
+ * Return true if this provider supports conversion from the given
+ * source format to the given target encoding.
+ * @param targ the target encoding
+ * @param src the source format
+ * @return true if the conversion is supported
+ */
+ public boolean isConversionSupported(AudioFormat.Encoding targ,
+ AudioFormat src)
+ {
+ AudioFormat.Encoding[] encodings = getTargetEncodings(src);
+ for (int i = 0; i < encodings.length; ++i)
+ {
+ if (targ.equals(encodings[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if this provider supports conversions from the given
+ * source format to the given target format.
+ * @param targ the source format
+ * @param src the target format
+ * @return true if the conversion is supported
+ */
+ public boolean isConversionSupported(AudioFormat targ, AudioFormat src)
+ {
+ AudioFormat[] encodings = getTargetFormats(targ.getEncoding(), src);
+ return encodings.length > 0;
+ }
+
+ /**
+ * Return true if an encoding matching the argument is supported as a
+ * source encoding by this provider.
+ * @param src the source encoding
+ * @return true if it is supported
+ */
+ public boolean isSourceEncodingSupported(AudioFormat.Encoding src)
+ {
+ AudioFormat.Encoding[] srcs = getSourceEncodings();
+ for (int i = 0; i < srcs.length; ++i)
+ {
+ if (src.equals(srcs[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if an encoding matching the argument is supported as a
+ * target encoding by this provider.
+ * @param targ the target encoding
+ * @return true if it is supported
+ */
+ public boolean isTargetEncodingSupported(AudioFormat.Encoding targ)
+ {
+ AudioFormat.Encoding[] encodings = getTargetEncodings();
+ for (int i = 0; i < encodings.length; ++i)
+ {
+ if (targ.equals(encodings[i]))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java b/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java
new file mode 100644
index 00000000000..1ae7b3bb7d8
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java
@@ -0,0 +1,86 @@
+/* Mixer API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import javax.sound.sampled.Mixer;
+
+/**
+ * This abstract class defines an interface to mixer providers.
+ * Concrete subclasses will implement the methods in this class.
+ * @since 1.3
+ */
+public abstract class MixerProvider
+{
+ /**
+ * Create a new mixer provider.
+ */
+ public MixerProvider()
+ {
+ }
+
+ /**
+ * Return a mixer that matches the given info object.
+ * @param info description of the mixer to match
+ * @return the mixer
+ * @throws IllegalArgumentException if no mixer matches the description
+ */
+ public abstract Mixer getMixer(Mixer.Info info);
+
+ /**
+ * Return an array of info objects describing all the mixers provided by
+ * this provider.
+ */
+ public abstract Mixer.Info[] getMixerInfo();
+
+ /**
+ * Return true if a mixer matching the provided description is supported.
+ * @param info description of the mixer to match
+ * @return true if it is supported by this provider
+ */
+ public boolean isMixerSupported(Mixer.Info info)
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ if (info.equals(infos[i]))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/libjava/classpath/javax/swing/AbstractButton.java b/libjava/classpath/javax/swing/AbstractButton.java
index 21c4fc0a26c..376b3a056ae 100644
--- a/libjava/classpath/javax/swing/AbstractButton.java
+++ b/libjava/classpath/javax/swing/AbstractButton.java
@@ -165,6 +165,8 @@ public abstract class AbstractButton extends JComponent
*/
public void stateChanged(ChangeEvent ev)
{
+ AbstractButton.this.fireStateChanged();
+ repaint();
}
}
@@ -375,6 +377,7 @@ public abstract class AbstractButton extends JComponent
protected AccessibleAbstractButton()
{
+ // Nothing to do here yet.
}
public AccessibleStateSet getAccessibleStateSet()
@@ -509,11 +512,37 @@ public abstract class AbstractButton extends JComponent
}
/**
- * Creates a new AbstractButton object.
+ * Creates a new AbstractButton object. Subclasses should call the following
+ * sequence in their constructor in order to initialize the button correctly:
+ * <pre>
+ * super();
+ * init(text, icon);
+ * </pre>
+ *
+ * The {@link #init(String, Icon)} method is not called automatically by this
+ * constructor.
+ *
+ * @see #init(String, Icon)
*/
public AbstractButton()
{
- init("", null);
+ actionListener = createActionListener();
+ changeListener = createChangeListener();
+ itemListener = createItemListener();
+
+ horizontalAlignment = CENTER;
+ horizontalTextPosition = TRAILING;
+ verticalAlignment = CENTER;
+ verticalTextPosition = CENTER;
+ borderPainted = true;
+ contentAreaFilled = true;
+ focusPainted = true;
+ setFocusable(true);
+ setAlignmentX(CENTER_ALIGNMENT);
+ setAlignmentY(CENTER_ALIGNMENT);
+ setDisplayedMnemonicIndex(-1);
+ setOpaque(true);
+ text = "";
updateUI();
}
@@ -524,7 +553,7 @@ public abstract class AbstractButton extends JComponent
*/
public ButtonModel getModel()
{
- return model;
+ return model;
}
/**
@@ -569,25 +598,6 @@ public abstract class AbstractButton extends JComponent
if (icon != null)
default_icon = icon;
-
- actionListener = createActionListener();
- changeListener = createChangeListener();
- itemListener = createItemListener();
-
- horizontalAlignment = CENTER;
- horizontalTextPosition = TRAILING;
- verticalAlignment = CENTER;
- verticalTextPosition = CENTER;
- borderPainted = true;
- contentAreaFilled = true;
-
- focusPainted = true;
- setFocusable(true);
-
- setAlignmentX(LEFT_ALIGNMENT);
- setAlignmentY(CENTER_ALIGNMENT);
-
- setDisplayedMnemonicIndex(-1);
}
/**
@@ -615,7 +625,8 @@ public abstract class AbstractButton extends JComponent
*/
public void setActionCommand(String actionCommand)
{
- model.setActionCommand(actionCommand);
+ if (model != null)
+ model.setActionCommand(actionCommand);
}
/**
@@ -782,7 +793,10 @@ public abstract class AbstractButton extends JComponent
*/
public int getMnemonic()
{
- return getModel().getMnemonic();
+ ButtonModel mod = getModel();
+ if (mod != null)
+ return mod.getMnemonic();
+ return -1;
}
/**
@@ -810,11 +824,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setMnemonic(int mne)
{
- int old = getModel().getMnemonic();
+ ButtonModel mod = getModel();
+ int old = -1;
+ if (mod != null)
+ old = mod.getMnemonic();
if (old != mne)
{
- getModel().setMnemonic(mne);
+ if (mod != null)
+ mod.setMnemonic(mne);
if (text != null && !text.equals(""))
{
@@ -907,7 +925,9 @@ public abstract class AbstractButton extends JComponent
*/
public void setSelected(boolean s)
{
- getModel().setSelected(s);
+ ButtonModel mod = getModel();
+ if (mod != null)
+ mod.setSelected(s);
}
/**
@@ -918,7 +938,10 @@ public abstract class AbstractButton extends JComponent
*/
public boolean isSelected()
{
- return getModel().isSelected();
+ ButtonModel mod = getModel();
+ if (mod != null)
+ return mod.isSelected();
+ return false;
}
/**
@@ -929,8 +952,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setEnabled(boolean b)
{
+ // Do nothing if state does not change.
+ if (b == isEnabled())
+ return;
super.setEnabled(b);
- getModel().setEnabled(b);
+ setFocusable(b);
+ ButtonModel mod = getModel();
+ if (mod != null)
+ mod.setEnabled(b);
}
/**
@@ -1608,16 +1637,9 @@ public abstract class AbstractButton extends JComponent
*
* @return The new ChangeListener
*/
- protected ChangeListener createChangeListener()
+ protected ChangeListener createChangeListener()
{
- return new ChangeListener()
- {
- public void stateChanged(ChangeEvent e)
- {
- AbstractButton.this.fireStateChanged();
- AbstractButton.this.repaint();
- }
- };
+ return new ButtonChangeListener();
}
/**
@@ -1669,18 +1691,22 @@ public abstract class AbstractButton extends JComponent
*/
public void doClick(int pressTime)
{
- getModel().setArmed(true);
- getModel().setPressed(true);
- try
+ ButtonModel mod = getModel();
+ if (mod != null)
{
- java.lang.Thread.sleep(pressTime);
- }
- catch (java.lang.InterruptedException e)
- {
- // probably harmless
+ mod.setArmed(true);
+ mod.setPressed(true);
+ try
+ {
+ java.lang.Thread.sleep(pressTime);
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ // probably harmless
+ }
+ mod.setPressed(false);
+ mod.setArmed(false);
}
- getModel().setPressed(false);
- getModel().setArmed(false);
}
/**
@@ -1979,6 +2005,7 @@ public abstract class AbstractButton extends JComponent
*/
public void updateUI()
{
+ // TODO: What to do here?
}
/**
diff --git a/libjava/classpath/javax/swing/AbstractSpinnerModel.java b/libjava/classpath/javax/swing/AbstractSpinnerModel.java
index d61113b0827..1a82f0a359d 100644
--- a/libjava/classpath/javax/swing/AbstractSpinnerModel.java
+++ b/libjava/classpath/javax/swing/AbstractSpinnerModel.java
@@ -61,6 +61,7 @@ public abstract class AbstractSpinnerModel implements SpinnerModel
*/
public AbstractSpinnerModel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/ActionMap.java b/libjava/classpath/javax/swing/ActionMap.java
index c14bafdb4be..65e193d2e79 100644
--- a/libjava/classpath/javax/swing/ActionMap.java
+++ b/libjava/classpath/javax/swing/ActionMap.java
@@ -80,6 +80,7 @@ public class ActionMap
*/
public ActionMap()
{
+ // Nothing to do here.
}
/**
@@ -170,7 +171,9 @@ public class ActionMap
*/
public Object[] keys()
{
- return actionMap.keySet().toArray();
+ if (size() != 0)
+ return actionMap.keySet().toArray();
+ return null;
}
/**
@@ -187,7 +190,9 @@ public class ActionMap
set.addAll(Arrays.asList(parent.allKeys()));
set.addAll(actionMap.keySet());
- return set.toArray();
+ if (set.size() != 0)
+ return set.toArray();
+ return null;
}
/**
diff --git a/libjava/classpath/javax/swing/BorderFactory.java b/libjava/classpath/javax/swing/BorderFactory.java
index 45cf3bbe074..ca78deb1290 100644
--- a/libjava/classpath/javax/swing/BorderFactory.java
+++ b/libjava/classpath/javax/swing/BorderFactory.java
@@ -71,7 +71,7 @@ public class BorderFactory
*/
public static Border createLineBorder(Color color)
{
- return null;
+ return createLineBorder(color, 1);
}
/**
diff --git a/libjava/classpath/javax/swing/BoundedRangeModel.java b/libjava/classpath/javax/swing/BoundedRangeModel.java
index 5ca5a7e043e..54446acd5ea 100644
--- a/libjava/classpath/javax/swing/BoundedRangeModel.java
+++ b/libjava/classpath/javax/swing/BoundedRangeModel.java
@@ -165,13 +165,13 @@ public interface BoundedRangeModel
*
* @param value the value
* @param extent the extent
- * @param minnimum the minimum value
+ * @param minimum the minimum value
* @param maximum the maximum value
* @param adjusting a flag that indicates the model is being adjusted
* continuously.
*/
void setRangeProperties(int value, int extent, int minimum, int maximum,
- boolean adjusting);
+ boolean adjusting);
/**
* Adds a <code>ChangeListener</code> to this object.
diff --git a/libjava/classpath/javax/swing/Box.java b/libjava/classpath/javax/swing/Box.java
index b2cb44aceb5..57519f6fcbd 100644
--- a/libjava/classpath/javax/swing/Box.java
+++ b/libjava/classpath/javax/swing/Box.java
@@ -40,6 +40,7 @@ package javax.swing;
import java.awt.AWTError;
import java.awt.Component;
+import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
@@ -63,13 +64,13 @@ public class Box extends JComponent implements Accessible
/**
* Provides accessibility support for <code>Box</code>es.
*/
- // FIXME: disable to make libjava compile; visibility rules are broken
- protected class AccessibleBox // extends Container.AccessibleAWTContainer
+ protected class AccessibleBox extends Container.AccessibleAWTContainer
{
private static final long serialVersionUID = -7775079816389931944L;
protected AccessibleBox()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
@@ -88,13 +89,14 @@ public class Box extends JComponent implements Accessible
/**
* Provides accessibility support for <code>Box.Filler</code>.
*/
- // FIXME: disable to make libjava compile; visibility rules are broken
- protected class AccessibleBoxFiller // extends Component.AccessibleAWTComponent
+ protected class AccessibleBoxFiller
+ extends Component.AccessibleAWTComponent
{
private static final long serialVersionUID = 164963348357479321L;
protected AccessibleBoxFiller()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
@@ -103,8 +105,6 @@ public class Box extends JComponent implements Accessible
}
}
- protected AccessibleContext accessibleContext;
-
private transient Dimension min, pref, max;
/**
@@ -135,9 +135,8 @@ public class Box extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
- // FIXME: disable to make libjava compile; visibility rules are broken
- // if (accessibleContext == null)
- // accessibleContext = new AccessibleBoxFiller();
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleBoxFiller();
return accessibleContext;
}
@@ -284,8 +283,8 @@ public class Box extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
- // if (accessibleContext == null)
- // accessibleContext = new AccessibleBox();
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleBox();
return accessibleContext;
}
diff --git a/libjava/classpath/javax/swing/BoxLayout.java b/libjava/classpath/javax/swing/BoxLayout.java
index 28bb53928ef..ebc0b4c211c 100644
--- a/libjava/classpath/javax/swing/BoxLayout.java
+++ b/libjava/classpath/javax/swing/BoxLayout.java
@@ -45,12 +45,6 @@ import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import gnu.java.awt.AWTUtilities;
/**
* A layout that stacks the children of a container in a Box, either
@@ -63,248 +57,6 @@ public class BoxLayout implements LayoutManager2, Serializable
{
/**
- * This is an abstraction that allows the BoxLayout algorithm to
- * be applied to both direction (X and Y) without duplicating the
- * algorithm. It defines several methods that access properties of
- * a component for a specific direction.
- */
- static interface Direction
- {
- /**
- * Returns the correct part of <code>d</code> for this direction. This will
- * be <code>d.width</code> for horizontal and <code>d.height</code> for
- * vertical direction.
- *
- * @param d the size as Dimension object
- *
- * @return the correct part of <code>d</code> for this direction
- */
- int size(Dimension d);
-
- /**
- * Returns the lower bounds of the {@link Insets} object according to this
- * direction. This will be <code>insets.top</code> for vertical direction
- * and <code>insets.left</code> for horizontal direction.
- *
- * @param the {@link Insets} object from which to return the lower bounds
- *
- * @return the lower bounds of the {@link Insets} object according to this
- * direction
- */
- int lower(Insets insets);
-
- /**
- * Returns the alignment property according to this direction.
- *
- * @param comp the Component for which to return the alignment property
- *
- * @return the alignment property according to this direction
- */
- float alignment(Component comp);
-
- /**
- * Sets the location for Component <code>c</code>. <code>coord1</code>
- * specifies the coordinate of the location in this direction,
- * <code>coord2</code> the coordinate of the location in the opposite
- * direction.
- *
- * @param c the Component for which to set the location
- * @param coord1 the coordinate in this direction
- * @param coord2 the coordinate in the opposite direction
- */
- void setLocation(Component c, int coord1, int coord2);
-
- /**
- * Sets the size for Component <code>c</code>. <code>coord1</code>
- * specifies the size in this direction,
- * <code>coord2</code> the size in the opposite
- * direction.
- *
- * @param c the Component for which to set the size
- * @param size1 the size in this direction
- * @param size2 the size in the opposite direction
- */
- void setSize(Component c, int size1, int size2);
- }
-
- /**
- * The horizontal direction.
- */
- static class Horizontal implements Direction
- {
- /**
- * Returns the correct part of <code>d</code> for this direction. This will
- * be <code>d.width</code> for horizontal and <code>d.height</code> for
- * vertical direction.
- *
- * @param d the size as Dimension object
- *
- * @return the correct part of <code>d</code> for this direction
- */
- public int size(Dimension d)
- {
- return d.width;
- }
-
- /**
- * Returns the lower bounds of the {@link Insets} object according to this
- * direction. This will be <code>insets.top</code> for vertical direction
- * and <code>insets.left</code> for horizontal direction.
- *
- * @param insets the {@link Insets} object from which to return the lower
- * bounds
- *
- * @return the lower bounds of the {@link Insets} object according to this
- * direction
- */
- public int lower(Insets insets)
- {
- return insets.left;
- }
-
- /**
- * Returns the alignment property according to this direction.
- *
- * @param comp the Component for which to return the alignment property
- *
- * @return the alignment property according to this direction
- */
- public float alignment(Component comp)
- {
- return comp.getAlignmentX();
- }
-
- /**
- * Sets the location for Component <code>c</code>. <code>coord1</code>
- * specifies the coordinate of the location in this direction,
- * <code>coord2</code> the coordinate of the location in the opposite
- * direction.
- *
- * @param c the Component for which to set the location
- * @param coord1 the coordinate in this direction
- * @param coord2 the coordinate in the opposite direction
- */
- public void setLocation(Component c, int coord1, int coord2)
- {
- c.setLocation(coord1, coord2);
- }
-
- /**
- * Sets the size for Component <code>c</code>. <code>coord1</code>
- * specifies the size in this direction,
- * <code>coord2</code> the size in the opposite
- * direction.
- *
- * @param c the Component for which to set the size
- * @param size1 the size in this direction
- * @param size2 the size in the opposite direction
- */
- public void setSize(Component c, int size1, int size2)
- {
- c.setSize(size1, size2);
- }
- }
- /**
- * The vertical direction.
- */
- static class Vertical implements Direction
- {
- /**
- * Returns the correct part of <code>d</code> for this direction. This will
- * be <code>d.width</code> for horizontal and <code>d.height</code> for
- * vertical direction.
- *
- * @param d the size as Dimension object
- *
- * @return the correct part of <code>d</code> for this direction
- */
- public int size(Dimension d)
- {
- return d.height;
- }
-
- /**
- * Returns the lower bounds of the {@link Insets} object according to this
- * direction. This will be <code>insets.top</code> for vertical direction
- * and <code>insets.left</code> for horizontal direction.
- *
- * @param insets the {@link Insets} object from which to return the lower
- * bounds
- *
- * @return the lower bounds of the {@link Insets} object according to this
- * direction
- */
- public int lower(Insets insets)
- {
- return insets.top;
- }
-
- /**
- * Returns the alignment property according to this direction.
- *
- * @param comp the Component for which to return the alignment property
- *
- * @return the alignment property according to this direction
- */
- public float alignment(Component comp)
- {
- return comp.getAlignmentY();
- }
-
- /**
- * Sets the location for Component <code>c</code>. <code>coord1</code>
- * specifies the coordinate of the location in this direction,
- * <code>coord2</code> the coordinate of the location in the opposite
- * direction.
- *
- * @param c the Component for which to set the location
- * @param coord1 the coordinate in this direction
- * @param coord2 the coordinate in the opposite direction
- */
- public void setLocation(Component c, int coord1, int coord2)
- {
- c.setLocation(coord2, coord1);
- }
-
- /**
- * Sets the size for Component <code>c</code>. <code>coord1</code>
- * specifies the size in this direction,
- * <code>coord2</code> the size in the opposite
- * direction.
- *
- * @param c the Component for which to set the size
- * @param size1 the size in this direction
- * @param size2 the size in the opposite direction
- */
- public void setSize(Component c, int size1, int size2)
- {
- c.setSize(size2, size1);
- }
- }
-
- /**
- * A helper class that temporarily stores the size specs of a component.
- */
- static class SizeReq
- {
- int size;
- int min;
- int pref;
- int max;
- float align;
- Component comp;
- SizeReq(Component comp, Direction dir)
- {
- this.min = dir.size(comp.getMinimumSize());
- this.pref = dir.size(comp.getPreferredSize());
- this.max = dir.size(comp.getMaximumSize());
- this.size = dir.size(comp.getSize());
- this.align = dir.alignment(comp);
- this.comp = comp;
- }
- }
-
- /**
* Specifies that components are laid out left to right.
*/
public static final int X_AXIS = 0;
@@ -334,16 +86,50 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
private Container container;
- /*
+ /**
* Current type of component layouting. Defaults to X_AXIS.
*/
private int way = X_AXIS;
- /** Constant for the horizontal direction. */
- private static final Direction HORIZONTAL = new Horizontal();
+ /**
+ * The size requirements of the containers children for the X direction.
+ */
+ private SizeRequirements[] xChildren;
+
+ /**
+ * The size requirements of the containers children for the Y direction.
+ */
+ private SizeRequirements[] yChildren;
+
+ /**
+ * The size requirements of the container to be laid out for the X direction.
+ */
+ private SizeRequirements xTotal;
+
+ /**
+ * The size requirements of the container to be laid out for the Y direction.
+ */
+ private SizeRequirements yTotal;
+
+ /**
+ * The offsets of the child components in the X direction.
+ */
+ private int[] offsetsX;
+
+ /**
+ * The offsets of the child components in the Y direction.
+ */
+ private int[] offsetsY;
+
+ /**
+ * The spans of the child components in the X direction.
+ */
+ private int[] spansX;
- /** Constant for the vertical direction. */
- private static final Direction VERTICAL = new Vertical();
+ /**
+ * The spans of the child components in the Y direction.
+ */
+ private int[] spansY;
/**
* Constructs a <code>BoxLayout</code> object.
@@ -355,6 +141,9 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public BoxLayout(Container container, int way)
{
+ if (way != X_AXIS && way != Y_AXIS && way != LINE_AXIS && way != PAGE_AXIS)
+ throw new AWTError("Invalid axis");
+
int width = 0;
int height = 0;
this.container = container;
@@ -369,6 +158,7 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void addLayoutComponent(String name, Component component)
{
+ // Nothing to do here.
}
/**
@@ -378,6 +168,7 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void removeLayoutComponent(Component component)
{
+ // Nothing to do here.
}
private boolean isHorizontalIn(Container parent)
@@ -401,45 +192,16 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public Dimension preferredLayoutSize(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Insets insets = parent.getInsets();
- int x = 0;
- int y = 0;
-
- List children = AWTUtilities.getVisibleChildren(parent);
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
- if (isHorizontalIn(parent))
- {
- x = insets.left + insets.right;
- // sum up preferred widths of components, find maximum of preferred
- // heights
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getPreferredSize();
- x += sz.width;
- y = Math.max(y, sz.height);
- }
- y += insets.bottom + insets.top;
- }
- else
- {
- y = insets.top + insets.bottom;
- // sum up preferred heights of components, find maximum of
- // preferred widths
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getPreferredSize();
- y += sz.height;
- x = Math.max(x, sz.width);
- }
- x += insets.left + insets.right;
+ checkTotalRequirements();
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.preferred + i.left + i.right,
+ yTotal.preferred + i.top + i.bottom);
}
-
- return new Dimension(x, y);
}
/**
@@ -451,41 +213,16 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public Dimension minimumLayoutSize(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Insets insets = parent.getInsets();
- int x = insets.left + insets.right;
- int y = insets.bottom + insets.top;
-
- List children = AWTUtilities.getVisibleChildren(parent);
-
- if (isHorizontalIn(parent))
+ synchronized (container.getTreeLock())
{
- // sum up preferred widths of components, find maximum of preferred
- // heights
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getMinimumSize();
- x += sz.width;
- y = Math.max(y, sz.height);
- }
- }
- else
- {
- // sum up preferred heights of components, find maximum of
- // preferred widths
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getMinimumSize();
- y += sz.height;
- x = Math.max(x, sz.width);
- }
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkTotalRequirements();
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.minimum + i.left + i.right,
+ yTotal.minimum + i.top + i.bottom);
}
-
- return new Dimension(x, y);
}
/**
@@ -495,12 +232,20 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void layoutContainer(Container parent)
{
- if (isHorizontalIn(parent))
- layoutAlgorithm(parent, HORIZONTAL, VERTICAL);
- else
- layoutAlgorithm(parent, VERTICAL, HORIZONTAL);
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkLayout();
+ Component[] children = container.getComponents();
+ Insets in = container.getInsets();
+ for (int i = 0; i < children.length; i++)
+ children[i].setBounds(offsetsX[i] + in.left, offsetsY[i] + in.top,
+ spansX[i], spansY[i]);
+ }
}
-
+
/**
* Adds a component to the layout. Not used in BoxLayout
*
@@ -509,6 +254,7 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void addLayoutComponent(Component child, Object constraints)
{
+ // Nothing to do here.
}
/**
@@ -520,10 +266,14 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public float getLayoutAlignmentX(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- return 0;
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkTotalRequirements();
+ return xTotal.alignment;
+ }
}
/**
@@ -535,10 +285,14 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public float getLayoutAlignmentY(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- return 0;
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkTotalRequirements();
+ return yTotal.alignment;
+ }
}
/**
@@ -548,8 +302,20 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void invalidateLayout(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ synchronized (container.getTreeLock())
+ {
+ xChildren = null;
+ yChildren = null;
+ xTotal = null;
+ yTotal = null;
+ offsetsX = null;
+ offsetsY = null;
+ spansX = null;
+ spansY = null;
+ }
}
/**
@@ -562,188 +328,117 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public Dimension maximumLayoutSize(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Insets insets = parent.getInsets();
- int x = insets.left + insets.right;
- int y = insets.top + insets.bottom;
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
- List children = AWTUtilities.getVisibleChildren(parent);
+ checkTotalRequirements();
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.maximum + i.left + i.right,
+ yTotal.maximum + i.top + i.bottom);
+ }
+ }
- if (isHorizontalIn(parent))
+ /**
+ * Makes sure that the xTotal and yTotal fields are set up correctly. A call
+ * to {@link #invalidateLayout} sets these fields to null and they have to be
+ * recomputed.
+ */
+ private void checkTotalRequirements()
+ {
+ if (xTotal == null || yTotal == null)
{
-
- // sum up preferred widths of components, find maximum of preferred
- // heights
- for (Iterator i = children.iterator(); i.hasNext();)
+ checkRequirements();
+ if (isHorizontalIn(container))
{
- Component comp = (Component) i.next();
- Dimension sz = comp.getMaximumSize();
- x += sz.width;
- // Check for overflow.
- if (x < 0)
- x = Integer.MAX_VALUE;
- y = Math.max(y, sz.height);
+ xTotal = SizeRequirements.getTiledSizeRequirements(xChildren);
+ yTotal = SizeRequirements.getAlignedSizeRequirements(yChildren);
}
- }
- else
- {
- // sum up preferred heights of components, find maximum of
- // preferred widths
- for (Iterator i = children.iterator(); i.hasNext();)
+ else
{
- Component comp = (Component) i.next();
- Dimension sz = comp.getMaximumSize();
- y += sz.height;
- // Check for overflow
- if (y < 0)
- y = Integer.MAX_VALUE;
- x = Math.max(x, sz.width);
+ xTotal = SizeRequirements.getAlignedSizeRequirements(xChildren);
+ yTotal = SizeRequirements.getTiledSizeRequirements(yChildren);
}
- }
- return new Dimension(x, y);
+ }
}
/**
- * Lays out the Container <code>c</code> in the layout direction
- * <code>layoutDir</code>. The direction that is crossing the layout
- * direction is specified in <code>crossDir</code>.
- *
- * @param parent
- * @param layoutDir
- * @param crossDir
+ * Makes sure that the xChildren and yChildren fields are correctly set up.
+ * A call to {@link #invalidateLayout(Container)} sets these fields to null,
+ * so they have to be set up again.
*/
- void layoutAlgorithm(Container parent, Direction layoutDir, Direction crossDir)
+ private void checkRequirements()
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Dimension parentSize = parent.getSize();
- Insets insets = parent.getInsets();
- Dimension innerSize = new Dimension(parentSize.width - insets.left
- - insets.right, parentSize.height
- - insets.bottom - insets.top);
-
- // Set all components to their preferredSizes and sum up the allocated
- // space. Create SizeReqs for each component and store them in
- // sizeReqs. Find the maximum size in the crossing direction.
- List children = AWTUtilities.getVisibleChildren(parent);
- Vector sizeReqs = new Vector();
- int allocated = 0;
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component c = (Component) i.next();
- SizeReq sizeReq = new SizeReq(c, layoutDir);
- int preferred = layoutDir.size(c.getPreferredSize());
- sizeReq.size = preferred;
- allocated += preferred;
- sizeReqs.add(sizeReq);
- }
-
- // Distribute remaining space (may be positive or negative) over components
- int remainder = layoutDir.size(innerSize) - allocated;
- distributeSpace(sizeReqs, remainder, layoutDir);
-
- // Resize and relocate components. If the component can be sized to
- // take the full space in the crossing direction, then do so, otherwise
- // align according to its alingnmentX or alignmentY property.
- int loc = 0;
- int offset1 = layoutDir.lower(insets);
- int offset2 = crossDir.lower(insets);
- for (Iterator i = sizeReqs.iterator(); i.hasNext();)
+ if (xChildren == null || yChildren == null)
{
- SizeReq sizeReq = (SizeReq) i.next();
- Component c = sizeReq.comp;
- int availCrossSize = crossDir.size(innerSize);
- int maxCross = crossDir.size(c.getMaximumSize());
- int crossSize = Math.min(availCrossSize, maxCross);
- int crossRemainder = availCrossSize - crossSize;
- int crossLoc = (int) (crossDir.alignment(c) * crossRemainder);
- layoutDir.setSize(c, sizeReq.size, crossSize);
- layoutDir.setLocation(c, offset1 + loc, offset2 + crossLoc);
- loc += sizeReq.size;
+ Component[] children = container.getComponents();
+ xChildren = new SizeRequirements[children.length];
+ yChildren = new SizeRequirements[children.length];
+ for (int i = 0; i < children.length; i++)
+ {
+ if (! children[i].isVisible())
+ {
+ xChildren[i] = new SizeRequirements();
+ yChildren[i] = new SizeRequirements();
+ }
+ else
+ {
+ xChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().width,
+ children[i].getPreferredSize().width,
+ children[i].getMaximumSize().width,
+ children[i].getAlignmentX());
+ yChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().height,
+ children[i].getPreferredSize().height,
+ children[i].getMaximumSize().height,
+ children[i].getAlignmentY());
+ }
+ }
}
}
/**
- * Distributes some space over a set of components. This implementation
- * tries to set the components as close as possible to their
- * <code>preferredSize</code>s, and respects the components
- * <code>minimumSize</code> and <code>maximumSize</code>.
- *
- * The algorithm is implemented as follows:
- *
- * <ul>
- * <li>The <code>remainder</code> is divided by the number of components
- * in <code>freeComponents</code>.</li>
- * <li>The result is added to (or substracted from) the size of each
- * component.</li>
- * <li>If the <code>minimumSize</code> or <code>maximumSize</code> of a
- * component is exceeded, then this component is set to its
- * <code>minimumSize</code> or <code>maximumSize</code>, it is removed from
- * <code>freeComponents</code> and the difference is added to a new
- * remainder.</li>
- * <li>Finally, if there is a new remainer != 0 and the
- * <code>freeComponents.size() != 0</code>, then this method is called
- * recursivly to distribute the newly allocated remaining space.</li>
- * </ul>
- *
- * @param freeComponents a SizeReq collection for components that have space
- * left so that they can be moved freely
- * @param remainder the space that should be distributed between the
- * components
- * @param dir the direction in which we operate
+ * Makes sure that the offsetsX, offsetsY, spansX and spansY fields are set
+ * up correctly. A call to {@link #invalidateLayout} sets these fields
+ * to null and they have to be recomputed.
*/
- void distributeSpace(Collection freeComponents, int remainder, Direction dir)
+ private void checkLayout()
{
- // Sum up total available space in components. If the remainder is negative
- // then we sum up the difference between minSize and size. If remainder
- // is positive we sum up the difference between maxSize and size.
- double totalAvailable = 0;
- for (Iterator i = freeComponents.iterator(); i.hasNext();)
- {
- SizeReq sizeReq = (SizeReq) i.next();
- if (remainder >= 0)
- totalAvailable += sizeReq.max - sizeReq.size;
- else
- totalAvailable += sizeReq.min - sizeReq.size;
- }
- if (totalAvailable == 0)
- if (remainder >= 0)
- totalAvailable = 1;
- else
- totalAvailable = -1;
-
- int newRemainder = 0;
- Vector stillFree = new Vector();
- for (Iterator i = freeComponents.iterator(); i.hasNext();)
+ if (offsetsX == null || offsetsY == null || spansX == null
+ || spansY == null)
{
- // Add/substract share to component.
- SizeReq sizeReq = (SizeReq) i.next();
- double available = 0;
- if (remainder >= 0)
- available = sizeReq.max - sizeReq.size;
+ checkRequirements();
+ checkTotalRequirements();
+ int len = container.getComponents().length;
+ offsetsX = new int[len];
+ offsetsY = new int[len];
+ spansX = new int[len];
+ spansY = new int[len];
+
+ Insets in = container.getInsets();
+ int width = container.getWidth() - in.left - in.right;
+ int height = container.getHeight() - in.top -in.bottom;
+
+ if (isHorizontalIn(container))
+ {
+ SizeRequirements.calculateTiledPositions(width,
+ xTotal, xChildren,
+ offsetsX, spansX);
+ SizeRequirements.calculateAlignedPositions(height,
+ yTotal, yChildren,
+ offsetsY, spansY);
+ }
else
- available = sizeReq.min - sizeReq.size;
- int share = (int) ((available / totalAvailable) * remainder);
- sizeReq.size += share;
- // check for min/maximumSize
- if (sizeReq.size < sizeReq.min)
- {
- newRemainder += sizeReq.size - sizeReq.min;
- sizeReq.size = sizeReq.min;
- }
- else if (sizeReq.size > sizeReq.max)
- {
- newRemainder += sizeReq.size - sizeReq.max;
- sizeReq.size = sizeReq.max;
- }
- else
- stillFree.add(sizeReq);
+ {
+ SizeRequirements.calculateAlignedPositions(width,
+ xTotal, xChildren,
+ offsetsX, spansX);
+ SizeRequirements.calculateTiledPositions(height,
+ yTotal, yChildren,
+ offsetsY, spansY);
+ }
}
- // recursivly call this method if necessary
- if (newRemainder != 0 && stillFree.size() > 0)
- distributeSpace(stillFree, newRemainder, dir);
}
}
diff --git a/libjava/classpath/javax/swing/ButtonGroup.java b/libjava/classpath/javax/swing/ButtonGroup.java
index 3de1d4b9f16..94f0109e634 100644
--- a/libjava/classpath/javax/swing/ButtonGroup.java
+++ b/libjava/classpath/javax/swing/ButtonGroup.java
@@ -79,6 +79,7 @@ public class ButtonGroup implements Serializable
*/
public ButtonGroup()
{
+ // Nothing to do here.
}
/**
@@ -89,6 +90,8 @@ public class ButtonGroup implements Serializable
public void add(AbstractButton b)
{
b.getModel().setGroup(this);
+ if (b.isSelected())
+ sel = b.getModel();
buttons.addElement(b);
}
@@ -158,7 +161,7 @@ public class ButtonGroup implements Serializable
{
ButtonModel old = sel;
sel = m;
-
+
if (old != null)
old.setSelected(false);
AbstractButton button = FindButton(old);
diff --git a/libjava/classpath/javax/swing/ButtonModel.java b/libjava/classpath/javax/swing/ButtonModel.java
index 1bdc5d1850d..03fac13d2fa 100644
--- a/libjava/classpath/javax/swing/ButtonModel.java
+++ b/libjava/classpath/javax/swing/ButtonModel.java
@@ -49,37 +49,253 @@ import javax.swing.event.ChangeListener;
*/
public interface ButtonModel extends ItemSelectable
{
- boolean isArmed();
- void setArmed(boolean b);
+ /**
+ * Returns <code>true</code> if the button is armed, <code>false</code>
+ * otherwise.
+ *
+ * A button is armed, when the user has pressed the mouse over it, but has
+ * not yet released the mouse.
+ *
+ * @return <code>true</code> if the button is armed, <code>false</code>
+ * otherwise
+ *
+ * @see #setArmed(boolean)
+ */
+ boolean isArmed();
- boolean isEnabled();
- void setEnabled(boolean b);
+ /**
+ * Sets the armed flag of the button.
+ *
+ * A button is armed, when the user has pressed the mouse over it, but has
+ * not yet released the mouse.
+ *
+ * @param b <code>true</code> if the button is armed, <code>false</code>
+ * otherwise
+ *
+ * @see #isArmed()
+ */
+ void setArmed(boolean b);
- void setPressed(boolean b);
- boolean isPressed();
+ /**
+ * Returns <code>true</code> if the button is enabled, <code>false</code>
+ * otherwise.
+ *
+ * When a button is disabled, it is usually grayed out and the user cannot
+ * change its state.
+ *
+ * @return <code>true</code> if the button is enabled, <code>false</code>
+ * otherwise
+ *
+ * @see #setEnabled(boolean)
+ */
+ boolean isEnabled();
+ /**
+ * Sets the enabled flag of the button.
+ *
+ * When a button is disabled, it is usually grayed out and the user cannot
+ * change its state.
+ *
+ * @param b <code>true</code> if the button is enabled, <code>false</code>
+ * otherwise
+ *
+ * @see #isEnabled()
+ */
+ void setEnabled(boolean b);
- void removeActionListener(ActionListener l);
- void addActionListener(ActionListener l);
+ /**
+ * Sets the pressed flag of the button.
+ *
+ * The button usually gets pressed when the user clicks on a button, it will
+ * be un-pressed when the user releases the mouse.
+ *
+ * @param b <code>true</code> if the button is pressed, <code>false</code>
+ * otherwise
+ *
+ * @see #isPressed()
+ */
+ void setPressed(boolean b);
- void addItemListener(ItemListener l);
- void removeItemListener(ItemListener l);
-
- void addChangeListener(ChangeListener l);
- void removeChangeListener(ChangeListener l);
+ /**
+ * Returns <code>true</code> if the button is pressed, <code>false</code>
+ * otherwise.
+ *
+ * The button usually gets pressed when the user clicks on a button, it will
+ * be un-pressed when the user releases the mouse.
+ *
+ * @return <code>true</code> if the button is pressed, <code>false</code>
+ * otherwise
+ *
+ * @see #setPressed(boolean)
+ */
+ boolean isPressed();
- void setRollover(boolean b);
- boolean isRollover();
+ /**
+ * Removes an {@link ActionListener} from the list of registered listeners.
+ *
+ * @param l the action listener to remove
+ *
+ * @see #addActionListener(ActionListener)
+ */
+ void removeActionListener(ActionListener l);
- int getMnemonic();
- void setMnemonic(int key);
+ /**
+ * Adds an {@link ActionListener} to the list of registered listeners.
+ *
+ * An <code>ActionEvent</code> is usually fired when the user clicks on a
+ * button.
+ *
+ * @param l the action listener to add
+ *
+ * @see #removeActionListener(ActionListener)
+ */
+ void addActionListener(ActionListener l);
- void setActionCommand(String s);
- String getActionCommand();
+ /**
+ * Adds an {@link ItemListener} to the list of registered listeners.
+ *
+ * An <code>ItemEvent</code> is usually fired when a button's selected
+ * state changes. This applies only to buttons that support the selected
+ * flag.
+ *
+ * @param l the item listener to add
+ *
+ * @see #removeItemListener(ItemListener)
+ */
+ void addItemListener(ItemListener l);
- void setGroup(ButtonGroup group);
+ /**
+ * Adds an {@link ItemListener} to the list of registered listeners.
+ *
+ * @param l the item listener to add
+ *
+ * @see #removeItemListener(ItemListener)
+ */
+ void removeItemListener(ItemListener l);
- void setSelected(boolean b);
- boolean isSelected();
+ /**
+ * Adds an {@link ChangeListener} to the list of registered listeners.
+ *
+ * A <code>ChangeEvent</code> is fired when any one of the button's flags
+ * changes.
+ *
+ * @param l the change listener to add
+ *
+ * @see #removeChangeListener(ChangeListener)
+ */
+ void addChangeListener(ChangeListener l);
+
+ /**
+ * Adds an {@link ChangeListener} to the list of registered listeners.
+ *
+ * @param l the change listener to add
+ *
+ * @see #removeChangeListener(ChangeListener)
+ */
+ void removeChangeListener(ChangeListener l);
+
+ /**
+ * Sets the rollover flag of the button.
+ *
+ * A button is rollover-ed, when the user has moved the mouse over it, but has
+ * not yet pressed the mouse.
+ *
+ * @param b <code>true</code> if the button is rollover, <code>false</code>
+ * otherwise
+ *
+ * @see #isRollover()
+ */
+ void setRollover(boolean b);
+
+ /**
+ * Returns <code>true</code> if the button is rollover-ed, <code>false</code>
+ * otherwise.
+ *
+ * A button is rollover-ed, when the user has moved the mouse over it, but has
+ * not yet pressed the mouse.
+ *
+ * @return <code>true</code> if the button is rollover, <code>false</code>
+ * otherwise
+ *
+ * @see #setRollover(boolean)
+ */
+ boolean isRollover();
+
+ /**
+ * Returns the keyboard mnemonic for the button. This specifies a shortcut
+ * or accelerator key that can be used to activate the button.
+ *
+ * @return the keyboard mnemonic for the button
+ *
+ * @see #setMnemonic(int)
+ */
+ int getMnemonic();
+
+ /**
+ * Sets the keyboard mnemonic for the button. This specifies a shortcut
+ * or accelerator key that can be used to activate the button.
+ *
+ * @param key the keyboard mnemonic for the button
+ *
+ * @see #getMnemonic()
+ */
+ void setMnemonic(int key);
+
+ /**
+ * Sets the action command for the button. This will be used in
+ * <code>ActionEvents</code> fired by the button.
+ *
+ * @param s the action command to set
+ *
+ * @see #getActionCommand()
+ */
+ void setActionCommand(String s);
+
+ /**
+ * Returns the action command of the button.
+ *
+ * @return the action command of the button
+ *
+ * @see #setActionCommand(String)
+ */
+ String getActionCommand();
+
+ /**
+ * Sets the button group for the button. Some kinds of button (e.g. radio
+ * buttons) allow only one button within a button group selected at any one
+ * time.
+ *
+ * @param group the button group to set
+ */
+ void setGroup(ButtonGroup group);
+
+ /**
+ * Sets the selected flag of the button.
+ *
+ * Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons)
+ * can be in one of two states: selected or unselected. The selected state
+ * is usually toggled by clicking on the button.
+ *
+ * @param b <code>true</code> if the button is selected, <code>false</code>
+ * otherwise
+ *
+ * @see #isSelected()
+ */
+ void setSelected(boolean b);
+
+ /**
+ * Returns <code>true</code> if the button is selected, <code>false</code>
+ * otherwise.
+ *
+ * Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons)
+ * can be in one of two states: selected or unselected. The selected state
+ * is usually toggled by clicking on the button.
+ *
+ * @return <code>true</code> if the button is selected, <code>false</code>
+ * otherwise
+ *
+ * @see #setSelected(boolean)
+ */
+ boolean isSelected();
}
diff --git a/libjava/classpath/javax/swing/CellEditor.java b/libjava/classpath/javax/swing/CellEditor.java
index bdb1665750d..3d229b26675 100644
--- a/libjava/classpath/javax/swing/CellEditor.java
+++ b/libjava/classpath/javax/swing/CellEditor.java
@@ -83,7 +83,7 @@ public interface CellEditor
/**
* addCellEditorListener
- * @param value0 TODO
+ * @param listener TODO
*/
void addCellEditorListener(CellEditorListener listener);
diff --git a/libjava/classpath/javax/swing/CellRendererPane.java b/libjava/classpath/javax/swing/CellRendererPane.java
index 886d5c5f2a8..c59afd3188a 100644
--- a/libjava/classpath/javax/swing/CellRendererPane.java
+++ b/libjava/classpath/javax/swing/CellRendererPane.java
@@ -54,9 +54,7 @@ import javax.accessibility.AccessibleRole;
*
* @author Andrew Selkirk
*/
-public class CellRendererPane
- extends Container
- implements Accessible
+public class CellRendererPane extends Container implements Accessible
{
private static final long serialVersionUID = -7642183829532984273L;
@@ -72,6 +70,7 @@ public class CellRendererPane
*/
protected AccessibleCellRendererPane()
{
+ // Nothing to do here.
}
/**
@@ -89,22 +88,13 @@ public class CellRendererPane
*/
protected AccessibleContext accessibleContext = null;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructs a new CellRendererPane.
*/
public CellRendererPane()
{
- } // CellRendererPane()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ // Nothing to do here.
+ }
/**
* Should not be called.
@@ -113,7 +103,8 @@ public class CellRendererPane
*/
public void update(Graphics graphics)
{
- } // update()
+ //Nothing to do here.
+ }
/**
* Despite normal behaviour this does <em>not</em> cause the container
@@ -121,7 +112,8 @@ public class CellRendererPane
*/
public void invalidate()
{
- } // invalidate()
+ // Overridden to do nothing.
+ }
/**
* Should not be called.
@@ -130,6 +122,7 @@ public class CellRendererPane
*/
public void paint(Graphics graphics)
{
+ // Overridden to do nothing.
}
/**
@@ -147,7 +140,7 @@ public class CellRendererPane
{
super.addImpl(c, constraints, index);
}
- } // addImpl()
+ }
/**
* Paints the specified component <code>c</code> on the {@link Graphics}
@@ -175,9 +168,10 @@ public class CellRendererPane
// reparent c
addImpl(c, null, 0);
+ Rectangle oldClip = graphics.getClipBounds();
// translate to (x,y)
graphics.translate(x, y);
-
+ graphics.clipRect(0, 0, w, h);
// set bounds of c
c.setBounds(0, 0, w, h);
@@ -192,8 +186,8 @@ public class CellRendererPane
// untranslate g
graphics.translate(-x, -y);
-
- } // paintComponent()
+ graphics.setClip(oldClip);
+ }
/**
* Paints the specified component <code>c</code> on the {@link Graphics}
@@ -215,7 +209,7 @@ public class CellRendererPane
Container p, int x, int y, int w, int h)
{
paintComponent(graphics, c, p, x, y, w, h, false);
- } // paintComponent()
+ }
/**
* Paints the specified component <code>c</code> on the {@link Graphics}
@@ -233,7 +227,7 @@ public class CellRendererPane
Container p, Rectangle r)
{
paintComponent(graphics, c, p, r.x, r.y, r.width, r.height);
- } // paintComponent()
+ }
/**
* getAccessibleContext <em>TODO</em>
diff --git a/libjava/classpath/javax/swing/ComboBoxEditor.java b/libjava/classpath/javax/swing/ComboBoxEditor.java
index 4eb5fc56206..8e914e4b9fe 100644
--- a/libjava/classpath/javax/swing/ComboBoxEditor.java
+++ b/libjava/classpath/javax/swing/ComboBoxEditor.java
@@ -64,7 +64,7 @@ public interface ComboBoxEditor
* combo box list then this method should be called to change editting item
* to the new selected item.
*
- * @param selectedItem item that is currently selected in the combo box
+ * @param item item that is currently selected in the combo box
*/
void setItem(Object item);
diff --git a/libjava/classpath/javax/swing/ComponentInputMap.java b/libjava/classpath/javax/swing/ComponentInputMap.java
index f95c3104535..28aa8e22cf6 100644
--- a/libjava/classpath/javax/swing/ComponentInputMap.java
+++ b/libjava/classpath/javax/swing/ComponentInputMap.java
@@ -78,7 +78,8 @@ public class ComponentInputMap extends InputMap
public void put(KeyStroke keystroke, Object value)
{
super.put(keystroke, value);
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
@@ -87,7 +88,8 @@ public class ComponentInputMap extends InputMap
public void clear()
{
super.clear();
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
@@ -98,7 +100,8 @@ public class ComponentInputMap extends InputMap
public void remove(KeyStroke keystroke)
{
super.remove(keystroke);
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
@@ -111,14 +114,19 @@ public class ComponentInputMap extends InputMap
*/
public void setParent(InputMap parentMap)
{
- if (! (parentMap instanceof ComponentInputMap))
- throw new IllegalArgumentException();
-
- if (((ComponentInputMap) parentMap).getComponent() != component)
- throw new IllegalArgumentException();
+ if (parentMap != null && !(parentMap instanceof ComponentInputMap))
+ throw new IllegalArgumentException("ComponentInputMaps can only have " +
+ "ComponentInputMaps for parents");
+
+ if (parentMap != null &&
+ ((ComponentInputMap) parentMap).getComponent() != component)
+ throw new
+ IllegalArgumentException("ComponentInputMaps' parents must " +
+ "be associated with the same JComponents");
super.setParent(parentMap);
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
diff --git a/libjava/classpath/javax/swing/DebugGraphics.java b/libjava/classpath/javax/swing/DebugGraphics.java
index 137b82337af..126309a5844 100644
--- a/libjava/classpath/javax/swing/DebugGraphics.java
+++ b/libjava/classpath/javax/swing/DebugGraphics.java
@@ -42,6 +42,7 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
+import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.image.ImageObserver;
@@ -84,15 +85,16 @@ public class DebugGraphics extends Graphics
static PrintStream debugLogStream = System.out;
/**
- * graphics
+ * Counts the created DebugGraphics objects. This is used by the
+ * logging facility.
*/
- Graphics graphics;
+ static int counter = 0;
/**
- * color
+ * graphics
*/
- Color color = Color.BLACK;
-
+ Graphics graphics;
+
/**
* buffer
*/
@@ -123,7 +125,7 @@ public class DebugGraphics extends Graphics
*/
public DebugGraphics()
{
- // TODO
+ counter++;
}
/**
@@ -134,7 +136,7 @@ public class DebugGraphics extends Graphics
*/
public DebugGraphics(Graphics graphics, JComponent component)
{
- this.graphics = graphics;
+ this(graphics);
// FIXME: What shall we do with component ?
}
@@ -145,6 +147,7 @@ public class DebugGraphics extends Graphics
*/
public DebugGraphics(Graphics graphics)
{
+ this();
this.graphics = graphics;
}
@@ -155,7 +158,10 @@ public class DebugGraphics extends Graphics
*/
public void setColor(Color color)
{
- this.color = color;
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting color: " + color);
+
+ graphics.setColor(color);
}
/**
@@ -166,7 +172,9 @@ public class DebugGraphics extends Graphics
*/
public Graphics create()
{
- return new DebugGraphics(graphics.create());
+ DebugGraphics copy = new DebugGraphics(graphics.create());
+ copy.debugOptions = debugOptions;
+ return copy;
}
/**
@@ -182,7 +190,10 @@ public class DebugGraphics extends Graphics
*/
public Graphics create(int x, int y, int width, int height)
{
- return new DebugGraphics(graphics.create(x, y, width, height));
+ DebugGraphics copy = new DebugGraphics(graphics.create(x, y, width,
+ height));
+ copy.debugOptions = debugOptions;
+ return copy;
}
/**
@@ -282,6 +293,9 @@ public class DebugGraphics extends Graphics
*/
public void setFont(Font font)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting font: " + font);
+
graphics.setFont(font);
}
@@ -292,7 +306,7 @@ public class DebugGraphics extends Graphics
*/
public Color getColor()
{
- return color;
+ return graphics.getColor();
}
/**
@@ -325,6 +339,9 @@ public class DebugGraphics extends Graphics
*/
public void translate(int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Translating by: " + new Point(x, y));
+
graphics.translate(x, y);
}
@@ -333,6 +350,9 @@ public class DebugGraphics extends Graphics
*/
public void setPaintMode()
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting paint mode");
+
graphics.setPaintMode();
}
@@ -343,6 +363,9 @@ public class DebugGraphics extends Graphics
*/
public void setXORMode(Color color)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting XOR mode: " + color);
+
graphics.setXORMode(color);
}
@@ -366,7 +389,16 @@ public class DebugGraphics extends Graphics
*/
public void clipRect(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().print(prefix() + " Setting clipRect: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.clipRect(x, y, width, height);
+
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(" Netting clipRect: " + graphics.getClipBounds());
}
/**
@@ -379,6 +411,12 @@ public class DebugGraphics extends Graphics
*/
public void setClip(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Setting new clipRect: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.setClip(x, y, width, height);
}
@@ -399,6 +437,9 @@ public class DebugGraphics extends Graphics
*/
public void setClip(Shape shape)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting new clipRect: " + shape);
+
graphics.setClip(shape);
}
@@ -424,18 +465,27 @@ public class DebugGraphics extends Graphics
*/
public void drawRect(int x, int y, int width, int height)
{
- for (int index = 0; index < (debugFlashCount - 1); ++index)
+ if ((debugOptions & LOG_OPTION) != 0)
{
- graphics.setColor(color);
- graphics.drawRect(x, y, width, height);
- sleep(debugFlashTime);
+ logStream().println(prefix() + " Drawing rect: "
+ + new Rectangle(x, y, width, height));
+ }
- graphics.setColor(debugFlashColor);
- graphics.drawRect(x, y, width, height);
- sleep(debugFlashTime);
+ if ((debugOptions & FLASH_OPTION) != 0)
+ {
+ Color color = graphics.getColor();
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.drawRect(x, y, width, height);
+ sleep(debugFlashTime);
+ graphics.setColor(debugFlashColor);
+ graphics.drawRect(x, y, width, height);
+ sleep(debugFlashTime);
+ }
+ graphics.setColor(color);
}
- graphics.setColor(color);
graphics.drawRect(x, y, width, height);
}
@@ -449,18 +499,27 @@ public class DebugGraphics extends Graphics
*/
public void fillRect(int x, int y, int width, int height)
{
- for (int index = 0; index < (debugFlashCount - 1); ++index)
+ if ((debugOptions & LOG_OPTION) != 0)
{
- graphics.setColor(color);
- graphics.fillRect(x, y, width, height);
- sleep(debugFlashTime);
+ logStream().println(prefix() + " Filling rect: "
+ + new Rectangle(x, y, width, height));
+ }
- graphics.setColor(debugFlashColor);
- graphics.fillRect(x, y, width, height);
- sleep(debugFlashTime);
+ if ((debugOptions & FLASH_OPTION) != 0)
+ {
+ Color color = graphics.getColor();
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.fillRect(x, y, width, height);
+ sleep(debugFlashTime);
+ graphics.setColor(debugFlashColor);
+ graphics.fillRect(x, y, width, height);
+ sleep(debugFlashTime);
+ }
+ graphics.setColor(color);
}
- graphics.setColor(color);
graphics.fillRect(x, y, width, height);
}
@@ -474,6 +533,12 @@ public class DebugGraphics extends Graphics
*/
public void clearRect(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Clearing rect: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.clearRect(x, y, width, height);
}
@@ -490,6 +555,14 @@ public class DebugGraphics extends Graphics
public void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing round rect: "
+ + new Rectangle(x, y, width, height)
+ + " arcWidth: " + arcWidth
+ + " arcHeight: " + arcHeight);
+ }
+
graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
}
@@ -506,6 +579,14 @@ public class DebugGraphics extends Graphics
public void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling round rect: "
+ + new Rectangle(x, y, width, height)
+ + " arcWidth: " + arcWidth
+ + " arcHeight: " + arcHeight);
+ }
+
graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
}
@@ -519,6 +600,12 @@ public class DebugGraphics extends Graphics
*/
public void drawLine(int x1, int y1, int x2, int y2)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing line: from (" + x1 + ", "
+ + y1 + ") to (" + x2 + ", " + y2 + ")");
+ }
+
graphics.drawLine(x1, y1, x2, y2);
}
@@ -533,6 +620,13 @@ public class DebugGraphics extends Graphics
*/
public void draw3DRect(int x, int y, int width, int height, boolean raised)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing 3D rect: "
+ + new Rectangle(x, y, width, height)
+ + "Raised bezel: " + raised);
+ }
+
graphics.draw3DRect(x, y, width, height, raised);
}
@@ -547,6 +641,13 @@ public class DebugGraphics extends Graphics
*/
public void fill3DRect(int x, int y, int width, int height, boolean raised)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling 3D rect: "
+ + new Rectangle(x, y, width, height)
+ + "Raised bezel: " + raised);
+ }
+
graphics.fill3DRect(x, y, width, height, raised);
}
@@ -560,6 +661,12 @@ public class DebugGraphics extends Graphics
*/
public void drawOval(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing oval: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.drawOval(x, y, width, height);
}
@@ -573,6 +680,12 @@ public class DebugGraphics extends Graphics
*/
public void fillOval(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling oval: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.fillOval(x, y, width, height);
}
@@ -589,6 +702,14 @@ public class DebugGraphics extends Graphics
public void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing arc: "
+ + new Rectangle(x, y, width, height)
+ + " startAngle: " + startAngle
+ + " arcAngle: " + arcAngle);
+ }
+
graphics.drawArc(x, y, width, height, startAngle, arcAngle);
}
@@ -605,6 +726,14 @@ public class DebugGraphics extends Graphics
public void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling arc: "
+ + new Rectangle(x, y, width, height)
+ + " startAngle: " + startAngle
+ + " arcAngle: " + arcAngle);
+ }
+
graphics.fillArc(x, y, width, height, startAngle, arcAngle);
}
@@ -617,6 +746,12 @@ public class DebugGraphics extends Graphics
*/
public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing polyline: nPoints: " + npoints
+ + " X's: " + xpoints + " Y's: " + ypoints);
+ }
+
graphics.drawPolyline(xpoints, ypoints, npoints);
}
@@ -629,6 +764,12 @@ public class DebugGraphics extends Graphics
*/
public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints
+ + " X's: " + xpoints + " Y's: " + ypoints);
+ }
+
graphics.drawPolygon(xpoints, ypoints, npoints);
}
@@ -641,6 +782,12 @@ public class DebugGraphics extends Graphics
*/
public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints
+ + " X's: " + xpoints + " Y's: " + ypoints);
+ }
+
graphics.fillPolygon(xpoints, ypoints, npoints);
}
@@ -653,6 +800,12 @@ public class DebugGraphics extends Graphics
*/
public void drawString(String string, int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing string: \"" + string
+ + "\" at: " + new Point(x, y));
+ }
+
graphics.drawString(string, x, y);
}
@@ -666,6 +819,12 @@ public class DebugGraphics extends Graphics
public void drawString(AttributedCharacterIterator iterator,
int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing string: \"" + iterator
+ + "\" at: " + new Point(x, y));
+ }
+
graphics.drawString(iterator, x, y);
}
@@ -681,6 +840,9 @@ public class DebugGraphics extends Graphics
public void drawBytes(byte[] data, int offset, int length,
int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Drawing bytes at: " + new Point(x, y));
+
graphics.drawBytes(data, offset, length, x, y);
}
@@ -696,18 +858,24 @@ public class DebugGraphics extends Graphics
public void drawChars(char[] data, int offset, int length,
int x, int y)
{
- for (int index = 0; index < (debugFlashCount - 1); ++index)
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Drawing chars at: " + new Point(x, y));
+
+ if ((debugOptions & FLASH_OPTION) != 0)
{
+ Color color = graphics.getColor();
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.drawChars(data, offset, length, x, y);
+ sleep(debugFlashTime);
+ graphics.setColor(debugFlashColor);
+ graphics.drawChars(data, offset, length, x, y);
+ sleep(debugFlashTime);
+ }
graphics.setColor(color);
- graphics.drawChars(data, offset, length, x, y);
- sleep(debugFlashTime);
-
- graphics.setColor(debugFlashColor);
- graphics.drawChars(data, offset, length, x, y);
- sleep(debugFlashTime);
}
- graphics.setColor(color);
graphics.drawChars(data, offset, length, x, y);
}
@@ -723,6 +891,12 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y,
ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image + " at: "
+ + new Point(x, y));
+ }
+
return graphics.drawImage(image, x, y, observer);
}
@@ -741,6 +915,12 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y, int width,
int height, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " at: " + new Rectangle(x, y, width, height));
+ }
+
return graphics.drawImage(image, x, y, width, height, observer);
}
@@ -759,6 +939,13 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y,
Color background, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " at: " + new Point(x, y)
+ + ", bgcolor: " + background);
+ }
+
return graphics.drawImage(image, x, y, background, observer);
}
@@ -779,6 +966,13 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y, int width, int height,
Color background, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " at: " + new Rectangle(x, y, width, height)
+ + ", bgcolor: " + background);
+ }
+
return graphics.drawImage(image, x, y, width, height, background, observer);
}
@@ -802,6 +996,13 @@ public class DebugGraphics extends Graphics
int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " destination: " + new Rectangle(dx1, dy1, dx2, dy2)
+ + " source: " + new Rectangle(sx1, sy1, sx2, sy2));
+ }
+
return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
}
@@ -827,6 +1028,14 @@ public class DebugGraphics extends Graphics
int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
Color background, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " destination: " + new Rectangle(dx1, dy1, dx2, dy2)
+ + " source: " + new Rectangle(sx1, sy1, sx2, sy2)
+ + ", bgcolor: " + background);
+ }
+
return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, background, observer);
}
@@ -843,6 +1052,13 @@ public class DebugGraphics extends Graphics
public void copyArea(int x, int y, int width, int height,
int destx, int desty)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Copying area from: "
+ + new Rectangle(x, y, width, height)
+ + " to: " + new Point(destx, desty));
+ }
+
graphics.copyArea(x, y, width, height, destx, desty);
}
@@ -873,6 +1089,11 @@ public class DebugGraphics extends Graphics
public void setDebugOptions(int options)
{
debugOptions = options;
+ if ((debugOptions & LOG_OPTION) != 0)
+ if (options == NONE_OPTION)
+ logStream().println(prefix() + "Disabling debug");
+ else
+ logStream().println(prefix() + "Enabling debug");
}
/**
@@ -884,4 +1105,21 @@ public class DebugGraphics extends Graphics
{
return debugOptions;
}
+
+ /**
+ * Creates and returns the prefix that should be prepended to all logging
+ * messages. The prefix is made up like this:
+ *
+ * <code>Graphics(<counter>-1)</code> where counter is an integer number
+ * saying how many DebugGraphics objects have been created so far. The second
+ * number always seem to be 1 on Sun's JDK, this has to be investigated a
+ * little more.
+ *
+ * @return the prefix that should be prepended to all logging
+ * messages
+ */
+ private String prefix()
+ {
+ return "Graphics(" + counter + "-1)";
+ }
}
diff --git a/libjava/classpath/javax/swing/DefaultButtonModel.java b/libjava/classpath/javax/swing/DefaultButtonModel.java
index f7d09d5780d..7ecf3b85fc6 100644
--- a/libjava/classpath/javax/swing/DefaultButtonModel.java
+++ b/libjava/classpath/javax/swing/DefaultButtonModel.java
@@ -145,6 +145,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
*/
public DefaultButtonModel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/DefaultCellEditor.java b/libjava/classpath/javax/swing/DefaultCellEditor.java
index 00e00864432..39e48551efb 100644
--- a/libjava/classpath/javax/swing/DefaultCellEditor.java
+++ b/libjava/classpath/javax/swing/DefaultCellEditor.java
@@ -69,7 +69,7 @@ public class DefaultCellEditor
private static final long serialVersionUID = 3564035141373880027L;
/**
- * Delegates a couple of method calls (such as {@link #isCellEditable)
+ * Delegates a couple of method calls (such as {@link #isCellEditable}
* to the component it contains and listens for events that indicate
* that editing has stopped.
*/
@@ -88,12 +88,13 @@ public class DefaultCellEditor
*/
protected EditorDelegate()
{
+ // Nothing to do here.
}
/**
* setValue
*
- * @param event TODO
+ * @param value TODO
*/
public void setValue(Object value)
{
@@ -387,7 +388,7 @@ public class DefaultCellEditor
/**
* getTableCellEditorComponent
*
- * @param tree TODO
+ * @param table TODO
* @param value TODO
* @param isSelected TODO
* @param row TODO
diff --git a/libjava/classpath/javax/swing/DefaultComboBoxModel.java b/libjava/classpath/javax/swing/DefaultComboBoxModel.java
index b48b968d697..ea261a33bbf 100644
--- a/libjava/classpath/javax/swing/DefaultComboBoxModel.java
+++ b/libjava/classpath/javax/swing/DefaultComboBoxModel.java
@@ -1,5 +1,5 @@
/* DefaultComboBoxModel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,13 +41,14 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Vector;
+import javax.swing.event.ListDataEvent;
+
/**
- * The default implementation of {@link MutableComboBoxModel}.
- * This model keeps track
- * of elements contained in the JComboBox as well as the current combo box
- * selection. Whenever selection in the JComboBox changes, the ComboBoxModel
- * will fire ListDataEvents to ComboBox's ListDataListeners.
+ * A model that stores a list of elements and a selected item (which may be
+ * <code>null</code>). Changes to the model are signalled to listeners using
+ * {@link ListDataEvent}. This model is designed for use by the
+ * {@link JComboBox} component.
*
* @author Andrew Selkirk
* @author Olga Rodimina
@@ -59,17 +60,17 @@ public class DefaultComboBoxModel extends AbstractListModel
private static final long serialVersionUID = 6698657703676921904L;
/**
- * List containing items in the combo box
+ * Storage for the elements in the model's list.
*/
private Vector list;
/**
- * Currently selected item in the combo box list
+ * The selected item (<code>null</code> indicates no selection).
*/
private Object selectedItem = null;
/**
- * Constructor DefaultComboBoxModel. Create empty JComboBox.
+ * Creates a new model, initially empty.
*/
public DefaultComboBoxModel()
{
@@ -77,64 +78,92 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Constructs new DefaultComboBoxModel object and initializes its item list
- * to values in the given array.
+ * Creates a new model and initializes its item list to the values in the
+ * given array. The selected item is set to the first item in the array, or
+ * <code>null</code> if the array length is zero.
*
- * @param items array containing items of the combo box.
+ * @param items an array containing items for the model (<code>null</code>
+ * not permitted).
+ *
+ * @throws NullPointerException if <code>items</code> is <code>null</code>.
*/
public DefaultComboBoxModel(Object[] items)
{
list = new Vector(Arrays.asList(items));
+ if (list.size() > 0)
+ selectedItem = list.get(0);
}
/**
- * Consturcts new DefaultComboBoxModel object and initializes its item list
- * to values in the given vector.
+ * Creates a new model and initializes its item list to the values in the
+ * given vector. The selected item is set to the first item in the vector,
+ * or <code>null</code> if the vector length is zero.
*
- * @param vector Vector containing items for this combo box.
+ * @param vector a vector containing items for the model (<code>null</code>
+ * not permitted).
+ *
+ * @throws NullPointerException if <code>vector</code> is <code>null</code>.
*/
public DefaultComboBoxModel(Vector vector)
{
this.list = vector;
+ if (vector.size() > 0)
+ selectedItem = vector.get(0);
}
/**
- * This method adds element to the combo box list. It fires ListDataEvent
- * indicating that component was added to the combo box to all of the
- * JComboBox's registered ListDataListeners.
+ * 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.
*
- * @param object item to add to the combo box list
+ * @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());
+ fireIntervalAdded(this, list.size() - 1, list.size() - 1);
+ if (list.size() == 1)
+ setSelectedItem(object);
}
/**
- * This method removes element at the specified index from the combo box
- * list. It fires ListDataEvent indicating that component was removed from
- * the combo box list to all of the JComboBox's registered
- * ListDataListeners.
+ * Removes the element at the specified index from the model's item list
+ * and sends a {@link ListDataEvent} to all registered listeners. If the
+ * element removed was the selected item, then the preceding element becomes
+ * the new selected item (or the next element, if there is no preceding
+ * element).
*
- * @param index index specifying location of the element to remove in the
- * combo box list.
+ * @param index the index of the item to remove.
+ *
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds.
*/
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);
+ }
fireIntervalRemoved(this, index, index);
}
/**
- * This method inserts given object to the combo box list at the specified
- * index. It fires ListDataEvent indicating that component was inserted to
- * the combo box list to all of the JComboBox's registered
- * ListDataListeners.
+ * Adds an element at the specified index in the model's item list
+ * and sends a {@link ListDataEvent} to all registered listeners.
*
* @param object element to insert
* @param index index specifing position in the list where given element
* should be inserted.
+ *
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds.
+ *
+ * @see #addElement(Object)
*/
public void insertElementAt(Object object, int index)
{
@@ -143,11 +172,13 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Removes given object from the combo box list. It fires ListDataEvent
- * indicating that component was removed from the combo box list to all of
- * the JComboBox's registered ListDataListeners.
+ * Removes an element from the model's item list and sends a
+ * {@link ListDataEvent} to all registered listeners. If the item to be
+ * removed is the current selected item, a new selected item will be set.
+ * If the element is not found in the model's item list, this method does
+ * nothing.
*
- * @param object Element that will be removed from the combo box list
+ * @param object the element to remove.
*/
public void removeElement(Object object)
{
@@ -157,21 +188,25 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Removes all the items from the JComboBox's item list. It fires
- * ListDataEvent indicating that all the elements were removed from the
- * combo box list to all of the JComboBox's registered ListDataListeners.
+ * Removes all the items from the model's item list, resets and selected item
+ * to <code>null</code>, and sends a {@link ListDataEvent} to all registered
+ * listeners.
*/
public void removeAllElements()
{
- list.clear();
- int listSize = getSize();
- fireIntervalAdded(this, 0, listSize);
+ selectedItem = null;
+ int size = getSize();
+ if (size > 0)
+ {
+ list.clear();
+ fireIntervalRemoved(this, 0, size - 1);
+ }
}
/**
- * Returns number of items in the combo box list
+ * Returns the number of items in the model's item list.
*
- * @return number of items in the combo box list
+ * @return The number of items in the model's item list.
*/
public int getSize()
{
@@ -179,32 +214,32 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Selects given object in the combo box list. This method fires
- * ListDataEvent to all registered ListDataListeners of the JComboBox. The
- * start and end index of the event is set to -1 to indicate combo box's
- * selection has changed, and not its contents.
- *
- * <p>If the given object is not contained in the combo box list then nothing
- * happens.</p>
+ * Sets the selected item for the model and sends a {@link ListDataEvent} to
+ * all registered listeners. The start and end index of the event is set to
+ * -1 to indicate the model's selection has changed, and not its contents.
*
- * @param object item to select in the JComboBox
+ * @param object the new selected item (<code>null</code> permitted).
*/
public void setSelectedItem(Object object)
{
-
- // Updates the selected item only if the given object
- // is null or in the list (this is how the JDK behaves).
- if(object == null || list.contains(object)) {
- selectedItem = object;
- fireContentsChanged(this, -1, -1);
- }
-
+ if (selectedItem == null)
+ {
+ if (object == null)
+ return;
+ }
+ else
+ {
+ if (selectedItem.equals(object))
+ return;
+ }
+ selectedItem = object;
+ fireContentsChanged(this, -1, -1);
}
/**
- * Returns currently selected item in the combo box list
+ * Returns the selected item.
*
- * @return currently selected item in the combo box list
+ * @return The selected item (possibly <code>null</code>).
*/
public Object getSelectedItem()
{
@@ -212,24 +247,27 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Returns element in the combo box list located at the given index
+ * Returns the element at the specified index in the model's item list.
*
- * @param index specifying location of the element in the list
+ * @param index the element index.
*
- * @return return element in the combo box list located at the given index
+ * @return The element at the specified index in the model's item list, or
+ * <code>null</code> if the <code>index</code> is outside the bounds
+ * of the list.
*/
public Object getElementAt(int index)
{
+ if (index < 0 || index >= list.size())
+ return null;
return list.elementAt(index);
}
/**
- * Returns index of the specified object in the combo box list.
+ * Returns the index of the specified element in the model's item list.
*
- * @param object element to look for in the combo box list .
+ * @param object the element.
*
- * @return Index specifying position of the specified element in combo box
- * list.
+ * @return The index of the specified element in the model's item list.
*/
public int getIndexOf(Object object)
{
diff --git a/libjava/classpath/javax/swing/DefaultDesktopManager.java b/libjava/classpath/javax/swing/DefaultDesktopManager.java
index 2b8977e9d6d..7f62c948625 100644
--- a/libjava/classpath/javax/swing/DefaultDesktopManager.java
+++ b/libjava/classpath/javax/swing/DefaultDesktopManager.java
@@ -91,6 +91,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
*/
public DefaultDesktopManager()
{
+ // Nothing to do here.
}
/**
@@ -223,6 +224,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
}
catch (PropertyVetoException e)
{
+ // Do nothing if attempt is vetoed.
}
}
@@ -302,6 +304,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
}
catch (PropertyVetoException e)
{
+ // Do nothing if attempt is vetoed.
}
}
@@ -329,6 +332,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
}
catch (PropertyVetoException e)
{
+ // Do nothing if attempt is vetoed.
}
}
}
diff --git a/libjava/classpath/javax/swing/DefaultListCellRenderer.java b/libjava/classpath/javax/swing/DefaultListCellRenderer.java
index 5a34ba7aa18..9a8e07071b5 100644
--- a/libjava/classpath/javax/swing/DefaultListCellRenderer.java
+++ b/libjava/classpath/javax/swing/DefaultListCellRenderer.java
@@ -68,6 +68,7 @@ public class DefaultListCellRenderer extends JLabel
{
public UIResource()
{
+ super();
}
}
@@ -124,62 +125,75 @@ public class DefaultListCellRenderer extends JLabel
public void validate()
{
+ // Overridden to do nothing.
}
public void revalidate()
{
+ // Overridden to do nothing.
}
public void repaint(long tm, int x, int y, int w, int h)
{
+ // Overridden to do nothing.
}
public void repaint(Rectangle rect)
{
+ // Overridden to do nothing.
}
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, byte oldValue,
byte newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, char oldValue,
char newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, short oldValue,
short newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, int oldValue,
int newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, long oldValue,
long newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, float oldValue,
float newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, double oldValue,
double newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, boolean oldValue,
boolean newValue)
{
+ // Overridden to do nothing.
}
}
diff --git a/libjava/classpath/javax/swing/DefaultListSelectionModel.java b/libjava/classpath/javax/swing/DefaultListSelectionModel.java
index f8d544d9b20..ce1dfdd79c5 100644
--- a/libjava/classpath/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/classpath/javax/swing/DefaultListSelectionModel.java
@@ -238,14 +238,32 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public void setLeadSelectionIndex(int leadIndex)
{
+ // Only set the lead selection index to < 0 if anchorSelectionIndex < 0.
+ if (leadIndex < 0)
+ {
+ if (anchorSelectionIndex < 0)
+ leadSelectionIndex = -1;
+ else
+ return;
+ }
+
+ // Only touch the lead selection index if the anchor is >= 0.
+ if (anchorSelectionIndex < 0)
+ return;
+
+ if (selectionMode == SINGLE_SELECTION)
+ setSelectionInterval (leadIndex, leadIndex);
+
int oldLeadIndex = leadSelectionIndex;
+ if (oldLeadIndex == -1)
+ oldLeadIndex = leadIndex;
if (setLeadCalledFromAdd == false)
oldSel = sel.clone();
leadSelectionIndex = leadIndex;
if (anchorSelectionIndex == -1)
- return;
-
+ return;
+
int R1 = Math.min(anchorSelectionIndex, oldLeadIndex);
int R2 = Math.max(anchorSelectionIndex, oldLeadIndex);
int S1 = Math.min(anchorSelectionIndex, leadIndex);
@@ -254,8 +272,6 @@ public class DefaultListSelectionModel implements Cloneable,
int lo = Math.min(R1, S1);
int hi = Math.max(R2, S2);
- BitSet oldRange = sel.get(lo, hi+1);
-
if (isSelectedIndex(anchorSelectionIndex))
{
sel.clear(R1, R2+1);
@@ -265,10 +281,7 @@ public class DefaultListSelectionModel implements Cloneable,
{
sel.set(R1, R2+1);
sel.clear(S1, S2+1);
- }
-
- BitSet newRange = sel.get(lo, hi+1);
- newRange.xor(oldRange);
+ }
int beg = sel.nextSetBit(0), end = -1;
for(int i=beg; i >= 0; i=sel.nextSetBit(i+1))
@@ -278,6 +291,27 @@ public class DefaultListSelectionModel implements Cloneable,
}
/**
+ * Moves the lead selection index to <code>leadIndex</code> without
+ * changing the selection values.
+ *
+ * If leadAnchorNotificationEnabled is true, send a notification covering the
+ * old and new lead cells.
+ *
+ * @param leadIndex the new lead selection index
+ * @since 1.5
+ */
+ public void moveLeadSelectionIndex (int leadIndex)
+ {
+ if (leadSelectionIndex == leadIndex)
+ return;
+
+ leadSelectionIndex = leadIndex;
+ if (isLeadAnchorNotificationEnabled())
+ fireValueChanged(Math.min(leadSelectionIndex, leadIndex),
+ Math.max(leadSelectionIndex, leadIndex));
+ }
+
+ /**
* Gets the value of the {@link #leadAnchorNotificationEnabled} property.
*
* @return The current property value
@@ -388,6 +422,9 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public boolean isSelectedIndex(int a)
{
+ // TODO: Probably throw an exception here?
+ if (a >= sel.length() || a < 0)
+ return false;
return sel.get(a);
}
@@ -415,7 +452,7 @@ public class DefaultListSelectionModel implements Cloneable,
oldSel = sel.clone();
if (selectionMode == SINGLE_SELECTION)
- sel.clear();
+ setSelectionInterval(index0, index1);
// COMPAT: Like Sun (but not like IBM), we allow calls to
// addSelectionInterval when selectionMode is
@@ -426,10 +463,7 @@ public class DefaultListSelectionModel implements Cloneable,
isSelectedIndex(index1) ||
isSelectedIndex(Math.max(lo-1,0)) ||
isSelectedIndex(Math.min(hi+1,sel.size()))))
- sel.clear();
-
- if (selectionMode == SINGLE_SELECTION)
- index0 = index1;
+ sel.clear();
// We have to update the anchorSelectionIndex and leadSelectionIndex
// variables
diff --git a/libjava/classpath/javax/swing/DesktopManager.java b/libjava/classpath/javax/swing/DesktopManager.java
index 300d66517ba..620c7ffb857 100644
--- a/libjava/classpath/javax/swing/DesktopManager.java
+++ b/libjava/classpath/javax/swing/DesktopManager.java
@@ -95,7 +95,7 @@ public interface DesktopManager
* This method should give focus to the JInternalFrame and its default focus
* owner.
*
- * @param frame The JInternalFrame to activate.
+ * @param vframe The JInternalFrame to activate.
*/
void activateFrame(JInternalFrame vframe);
diff --git a/libjava/classpath/javax/swing/FocusManager.java b/libjava/classpath/javax/swing/FocusManager.java
index 179fa6f82d2..a2109ee06c6 100644
--- a/libjava/classpath/javax/swing/FocusManager.java
+++ b/libjava/classpath/javax/swing/FocusManager.java
@@ -38,10 +38,19 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTEvent;
import java.awt.Component;
+import java.awt.Container;
import java.awt.DefaultKeyboardFocusManager;
+import java.awt.FocusTraversalPolicy;
+import java.awt.KeyEventDispatcher;
+import java.awt.KeyEventPostProcessor;
import java.awt.KeyboardFocusManager;
+import java.awt.Window;
import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
+import java.util.Set;
/**
* This class has been obsoleted by the new
@@ -54,46 +63,409 @@ public abstract class FocusManager
extends DefaultKeyboardFocusManager
{
/**
- * DisabledFocusManager
+ * A FocusManager that wraps an AWT KeyboardFocusManager and forwards all
+ * method calls to it. This is used for compatibility with the new focus
+ * system.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
*/
- static class DisabledFocusManager
+ private static class WrappingFocusManager
extends FocusManager
{
+ /**
+ * The wrapped KeyboardFocusManager.
+ */
+ private KeyboardFocusManager wrapped;
+
+ /**
+ * Creates a new instance of WrappedFocusManager.
+ *
+ * @param fm the focus manager to wrap
+ */
+ WrappingFocusManager(KeyboardFocusManager fm)
+ {
+ wrapped = fm;
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#dispatchEvent(AWTEvent)}.
+ *
+ * @param ev the event to dispatch
+ *
+ * @return <code>true</code> if the event has been dispatched,
+ * <code>false</code> otherwise
+ */
+ public boolean dispatchEvent(AWTEvent ev)
+ {
+ return wrapped.dispatchEvent(ev);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#dispatchKeyEvent(KeyEvent)}.
+ *
+ * @param ev the event to dispatch
+ *
+ * @return <code>true</code> if the event has been dispatched,
+ * <code>false</code> otherwise
+ */
+ public boolean dispatchKeyEvent(KeyEvent ev)
+ {
+ return wrapped.dispatchKeyEvent(ev);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#downFocusCycle(Container)}.
+ *
+ * @param c the container
+ */
+ public void downFocusCycle(Container c)
+ {
+ wrapped.downFocusCycle(c);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#upFocusCycle(Container)}.
+ *
+ * @param c the container
+ */
+ public void upFocusCycle(Container c)
+ {
+ wrapped.upFocusCycle(c);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#focusNextComponent(Component)}.
+ *
+ * @param c the component
+ */
+ public void focusNextComponent(Component c)
+ {
+ wrapped.focusNextComponent(c);
+ }
+
+ /**
+ * Wraps
+ * {@link DefaultKeyboardFocusManager#focusPreviousComponent(Component)}.
+ *
+ * @param c the component
+ */
+ public void focusPreviousComponent(Component c)
+ {
+ wrapped.focusPreviousComponent(c);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#postProcessKeyEvent(KeyEvent)}.
+ *
+ * @param e the key event
+ *
+ * @return a boolead
+ */
+ public boolean postProcessKeyEvent(KeyEvent e)
+ {
+ return wrapped.postProcessKeyEvent(e);
+ }
+
+ /**
+ * Wraps
+ * {@link DefaultKeyboardFocusManager#processKeyEvent(Component, KeyEvent)}.
+ *
+ * @param c the component
+ * @param e the key event
+ */
+ public void processKeyEvent(Component c, KeyEvent e)
+ {
+ wrapped.processKeyEvent(c, e);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)}.
+ *
+ * @param d the dispatcher
+ */
+ public void addKeyEventDispatcher(KeyEventDispatcher d)
+ {
+ wrapped.addKeyEventDispatcher(d);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
+ *
+ * @param p the post processor
+ */
+ public void addKeyEventPostProcessor(KeyEventPostProcessor p)
+ {
+ wrapped.addKeyEventPostProcessor(p);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(PropertyChangeListener)}.
+ *
+ * @param l the property change listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ wrapped.addPropertyChangeListener(l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(String, PropertyChangeListener)}.
+ *
+ * @param p the property name
+ * @param l the property change listener
+ */
+ public void addPropertyChangeListener(String p, PropertyChangeListener l)
+ {
+ wrapped.addPropertyChangeListener(p, l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(String, VetoableChangeListener)}.
+ *
+ * @param p the property name
+ * @param l the vetoable change listener
+ */
+ public void addVetoableChangeListener(String p, VetoableChangeListener l)
+ {
+ wrapped.addVetoableChangeListener(p, l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(VetoableChangeListener)}.
+ *
+ * @param l the vetoable change listener
+ */
+ public void addVetoableChangeListener(VetoableChangeListener l)
+ {
+ wrapped.addVetoableChangeListener(l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#clearGlobalFocusOwner()}.
+ */
+ public void clearGlobalFocusOwner()
+ {
+ wrapped.clearGlobalFocusOwner();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getActiveWindow()}.
+ *
+ * @return the active window
+ */
+ public Window getActiveWindow()
+ {
+ return wrapped.getActiveWindow();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getCurrentFocusCycleRoot()}.
+ *
+ * @return the focus cycle root
+ */
+ public Container getCurrentFocusCycleRoot()
+ {
+ return wrapped.getCurrentFocusCycleRoot();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalKeys(int)}.
+ *
+ * @param i the ID
+ *
+ * @return the focus traversal keys
+ */
+ public Set getDefaultFocusTraversalKeys(int i)
+ {
+ return wrapped.getDefaultFocusTraversalKeys(i);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalPolicy()}.
+ *
+ * @return the focus traversal policy
+ */
+ public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
+ {
+ return wrapped.getDefaultFocusTraversalPolicy();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getFocusedWindow()}.
+ *
+ * @return the focused window
+ */
+ public Window getFocusedWindow()
+ {
+ return wrapped.getFocusedWindow();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getFocusOwner()}.
+ *
+ * @return the focus owner
+ */
+ public Component getFocusOwner()
+ {
+ return wrapped.getFocusOwner();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getPermanentFocusOwner()}.
+ *
+ * @return the focus owner
+ */
+ public Component getPermanentFocusOwner()
+ {
+ return wrapped.getPermanentFocusOwner();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners()}.
+ *
+ * @return the property change listeners
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return wrapped.getPropertyChangeListeners();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners(String)}.
+ *
+ * @param n the property name
+ *
+ * @return the property change listeners
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners(String n)
+ {
+ return wrapped.getPropertyChangeListeners(n);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners()}.
+ *
+ * @return the vetoable change listeners
+ */
+ public VetoableChangeListener[] getVetoableChangeListeners()
+ {
+ return wrapped.getVetoableChangeListeners();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners(String)}.
+ *
+ * @param n the property name
+ *
+ * @return the vetoable change listeners
+ */
+ public VetoableChangeListener[] getVetoableChangeListeners(String n)
+ {
+ return wrapped.getVetoableChangeListeners(n);
+ }
+
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)}.
+ *
+ * @param d the key event dispatcher to remove
+ */
+ public void removeKeyEventDispatcher(KeyEventDispatcher d)
+ {
+ wrapped.removeKeyEventDispatcher(d);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
+ *
+ * @param p the post processor
+ */
+ public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
+ {
+ wrapped.removeKeyEventPostProcessor(p);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removePropertyChangeListener(PropertyChangeListener)}.
+ *
+ * @param l the listener
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ wrapped.removePropertyChangeListener(l);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removePropertyChangeListener(String, PropertyChangeListener)}.
+ *
+ * @param n the property name
+ * @param l the listener
+ */
+ public void removePropertyChangeListener(String n, PropertyChangeListener l)
+ {
+ wrapped.removePropertyChangeListener(n, l);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removeVetoableChangeListener(VetoableChangeListener)}.
+ *
+ * @param l the listener
+ */
+ public void removeVetoableChangeListener(VetoableChangeListener l)
+ {
+ wrapped.removeVetoableChangeListener(l);
+ }
/**
- * Constructor DisabledFocusManager
+ * Wraps
+ * {@link KeyboardFocusManager#removeVetoableChangeListener(String, VetoableChangeListener)}.
+ *
+ * @param n the property name
+ * @param l the listener
*/
- DisabledFocusManager()
+ public void removeVetoableChangeListener(String n, VetoableChangeListener l)
{
- // TODO
+ wrapped.removeVetoableChangeListener(n, l);
}
/**
- * processKeyEvent
- * @param component TODO
- * @param event TODO
+ * Wraps
+ * {@link KeyboardFocusManager#setDefaultFocusTraversalKeys(int, Set)}.
+ *
+ * @param id the ID
+ * @param k the keystrokes
*/
- public void processKeyEvent(Component component, KeyEvent event)
+ public void setDefaultFocusTraversalKeys(int id, Set k)
{
- // TODO
+ wrapped.setDefaultFocusTraversalKeys(id, k);
}
/**
- * focusNextComponent
- * @param component TODO
+ * Wraps {@link KeyboardFocusManager#setDefaultFocusTraversalPolicy(FocusTraversalPolicy)}.
+ *
+ * @param p the focus traversal policy
*/
- public void focusNextComponent(Component component)
+ public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy p)
{
- // TODO
+ wrapped.setDefaultFocusTraversalPolicy(p);
}
/**
- * focusPreviousComponent
- * @param value0 TODO
+ * Wraps
+ * {@link KeyboardFocusManager#setGlobalCurrentFocusCycleRoot(Container)}.
+ *
+ * @param r the focus cycle root
*/
- public void focusPreviousComponent(Component value0)
+ public void setGlobalCurrentFocusCycleRoot(Container r)
{
- // TODO
+ wrapped.setGlobalCurrentFocusCycleRoot(r);
}
}
@@ -117,20 +489,9 @@ public abstract class FocusManager
*/
public static FocusManager getCurrentManager()
{
- KeyboardFocusManager fm =
- KeyboardFocusManager.getCurrentKeyboardFocusManager();
- if (fm instanceof FocusManager)
- return (FocusManager) fm;
- else
- {
- System.err.println("The Swing FocusManager API has been obsoleted by");
- System.err.println("the new KeyboardFocusManager system.");
- System.err.println("You should either not use the Swing FocusManager");
- System.err.println("API or set the system property");
- System.err.println
- ("gnu.java.awt.FocusManager=javax.swing.FocusManager");
- }
- return null;
+ KeyboardFocusManager m =
+ KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ return new WrappingFocusManager(m);
}
/**
diff --git a/libjava/classpath/javax/swing/ImageIcon.java b/libjava/classpath/javax/swing/ImageIcon.java
index b650cd81f23..b6ed949d8dc 100644
--- a/libjava/classpath/javax/swing/ImageIcon.java
+++ b/libjava/classpath/javax/swing/ImageIcon.java
@@ -73,6 +73,7 @@ public class ImageIcon
*/
protected AccessibleImageIcon()
{
+ // Nothing to do here.
}
/**
@@ -204,7 +205,10 @@ public class ImageIcon
private static final long serialVersionUID = 532615968316031794L;
/** A dummy Component that is used in the MediaTracker. */
- protected static Component component = new Component(){};
+ protected static Component component = new Component()
+ {
+ // No need to implement this.
+ };
/** The MediaTracker used to monitor the loading of images. */
protected static MediaTracker tracker = new MediaTracker(component);
@@ -227,6 +231,7 @@ public class ImageIcon
*/
public ImageIcon()
{
+ // Nothing to do here.
}
/**
@@ -417,7 +422,7 @@ public class ImageIcon
}
catch (InterruptedException ex)
{
- ; // ignore this for now
+ // Ignore this for now.
}
finally
{
diff --git a/libjava/classpath/javax/swing/InputMap.java b/libjava/classpath/javax/swing/InputMap.java
index a7ec38c4117..cc65dfeed3e 100644
--- a/libjava/classpath/javax/swing/InputMap.java
+++ b/libjava/classpath/javax/swing/InputMap.java
@@ -171,8 +171,12 @@ public class InputMap
*/
public KeyStroke[] keys()
{
- KeyStroke[] array = new KeyStroke[size()];
- return (KeyStroke[]) inputMap.keySet().toArray(array);
+ if (size() != 0)
+ {
+ KeyStroke[] array = new KeyStroke[size()];
+ return (KeyStroke[]) inputMap.keySet().toArray(array);
+ }
+ return null;
}
/**
@@ -189,7 +193,9 @@ public class InputMap
set.addAll(Arrays.asList(parent.allKeys()));
set.addAll(inputMap.keySet());
- KeyStroke[] array = new KeyStroke[size()];
+ if (set.size() == 0)
+ return null;
+ KeyStroke[] array = new KeyStroke[set.size()];
return (KeyStroke[]) set.toArray(array);
}
diff --git a/libjava/classpath/javax/swing/InputVerifier.java b/libjava/classpath/javax/swing/InputVerifier.java
index 8e02ab813a3..eeb81b5d503 100644
--- a/libjava/classpath/javax/swing/InputVerifier.java
+++ b/libjava/classpath/javax/swing/InputVerifier.java
@@ -53,6 +53,7 @@ public abstract class InputVerifier
*/
public InputVerifier()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JApplet.java b/libjava/classpath/javax/swing/JApplet.java
index cafb2dabbb8..3ee1046c802 100644
--- a/libjava/classpath/javax/swing/JApplet.java
+++ b/libjava/classpath/javax/swing/JApplet.java
@@ -47,6 +47,7 @@ import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
/**
@@ -55,8 +56,28 @@ import javax.accessibility.AccessibleContext;
* @author original author unknown
*/
public class JApplet extends Applet
- implements RootPaneContainer
+ implements RootPaneContainer, Accessible
{
+ /**
+ * Provides accessibility support for <code>JApplet</code>.
+ */
+ protected class AccessibleJApplet extends Applet.AccessibleApplet
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJApplet</code>.
+ */
+ public AccessibleJApplet()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * The accessible context for this <code>JApplet</code>.
+ */
+ protected AccessibleContext accessibleContext;
+
private static final long serialVersionUID = 7269359214497372587L;
protected JRootPane rootPane;
@@ -64,20 +85,13 @@ public class JApplet extends Applet
/**
* @specnote rootPaneCheckingEnabled is false to comply with J2SE 5.0
*/
- protected boolean rootPaneCheckingEnabled=false;
-
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container
- */
- private boolean initStageDone = false;
+ protected boolean rootPaneCheckingEnabled = false;
public JApplet()
{
super.setLayout(new BorderLayout(1, 1));
getRootPane(); // Will do set/create.
- initStageDone = true; // Init stage is now over.
+ setRootPaneCheckingEnabled(true); // Init stage is now over.
}
public Dimension getPreferredSize()
@@ -89,13 +103,8 @@ public class JApplet extends Applet
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + "instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -155,20 +164,17 @@ public class JApplet extends Applet
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not use add() on JApplet directly. Use "
- + "getContentPane().add() instead");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp, constraints, index);
}
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJApplet();
+ return accessibleContext;
}
public JMenuBar getJMenuBar()
diff --git a/libjava/classpath/javax/swing/JButton.java b/libjava/classpath/javax/swing/JButton.java
index 5653fbf42f1..ff0ecfccfd4 100644
--- a/libjava/classpath/javax/swing/JButton.java
+++ b/libjava/classpath/javax/swing/JButton.java
@@ -75,9 +75,6 @@ public class JButton extends AbstractButton
boolean def;
boolean is_def;
- /** The AccessibleContext for this JButton. */
- AccessibleJButton accessibleContext;
-
public JButton()
{
this(null, null);
@@ -166,6 +163,10 @@ public class JButton extends AbstractButton
*/
public void removeNotify()
{
+ JRootPane root = SwingUtilities.getRootPane(this);
+ if (root != null && root.getDefaultButton() == this)
+ root.setDefaultButton(null);
+ super.removeNotify();
}
public void setDefaultCapable(boolean defaultCapable)
diff --git a/libjava/classpath/javax/swing/JCheckBox.java b/libjava/classpath/javax/swing/JCheckBox.java
index a743308dcca..74fda8f6dbe 100644
--- a/libjava/classpath/javax/swing/JCheckBox.java
+++ b/libjava/classpath/javax/swing/JCheckBox.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package javax.swing;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* A small box that displays a check or not, depending on it's
@@ -54,8 +56,32 @@ import javax.accessibility.AccessibleContext;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JCheckBox extends JToggleButton
+public class JCheckBox extends JToggleButton implements Accessible
{
+
+ /**
+ * Provides accessibility support for <code>JCheckBox</code>.
+ */
+ protected class AccessibleJCheckBox extends AccessibleJToggleButton
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJCheckBox</code>.
+ */
+ public AccessibleJCheckBox()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessble role of <code>JCheckBox</code>,
+ * {@link AccessibleRole#CHECK_BOX}.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.CHECK_BOX;
+ }
+ }
+
private static final long serialVersionUID = -5246739313864538930L;
public static final String BORDER_PAINTED_FLAT_CHANGED_PROPERTY =
@@ -71,61 +97,47 @@ public class JCheckBox extends JToggleButton
public JCheckBox()
{
- super();
- init();
+ this(null, null, false);
}
public JCheckBox(Action action)
{
super(action);
- init();
}
public JCheckBox(Icon icon)
{
- super(icon);
- init();
+ this(null, icon, false);
}
public JCheckBox(Icon icon, boolean selected)
{
- super(icon, selected);
- init();
+ this(null, icon, selected);
}
public JCheckBox(String text)
{
- super(text);
- init();
+ this(text, null, false);
}
public JCheckBox(String text, boolean selected)
{
- super(text, selected);
- init();
+ this(text, null, selected);
}
public JCheckBox(String text, Icon icon)
{
- super(text, icon);
- init();
+ this(text, icon, false);
}
public JCheckBox(String text, Icon icon, boolean selected)
{
super(text, icon, selected);
- init();
+ setHorizontalAlignment(LEADING);
+ setBorderPainted(false);
}
/**
- * Gets the AccessibleContext associated with this JCheckBox.
- */
- public AccessibleContext getAccessibleContext()
- {
- return null;
- }
-
- /**
* Returns a string that specifies the name of the Look and Feel class
* that renders this component.
*/
@@ -149,4 +161,16 @@ public class JCheckBox extends JToggleButton
firePropertyChange("borderPaintedFlat", borderPaintedFlat, newValue);
borderPaintedFlat = newValue;
}
+
+ /**
+ * Returns the accessible context for this <code>JCheckBox</code>.
+ *
+ * @return the accessible context for this <code>JCheckBox</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJCheckBox();
+ return accessibleContext;
+ }
}
diff --git a/libjava/classpath/javax/swing/JCheckBoxMenuItem.java b/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
index f9dd56500fe..815244259be 100644
--- a/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
+++ b/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package javax.swing;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -48,8 +45,9 @@ import javax.accessibility.AccessibleRole;
/**
* A menu item that displays a checkbox. Its behaviour is very similar
* to {@link JCheckBox}. Just like the <code>JCheckBox</code>, user can check
- * and uncheck this menu item by clicking on it. Also {@link #setSelected()}
- * and {@link #setState()} can be use used for the same purpose.
+ * and uncheck this menu item by clicking on it. Also
+ * {@link AbstractButton#setSelected} and {@link #setState} can be use used
+ * for the same purpose.
* <code>JCheckBoxMenuItem</code> uses
* <code>ToggleButtonModel</code> to keep track of its selection.
*
@@ -152,10 +150,6 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
this.setVisible(true);
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menuItem.
@@ -248,6 +242,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
*/
protected AccessibleJCheckBoxMenuItem()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
diff --git a/libjava/classpath/javax/swing/JColorChooser.java b/libjava/classpath/javax/swing/JColorChooser.java
index 4016b82f3fd..a9650ffb7e0 100644
--- a/libjava/classpath/javax/swing/JColorChooser.java
+++ b/libjava/classpath/javax/swing/JColorChooser.java
@@ -87,6 +87,7 @@ public class JColorChooser extends JComponent implements Accessible
*/
protected AccessibleJColorChooser()
{
+ // Nothing to do here.
}
/**
@@ -247,6 +248,7 @@ public class JColorChooser extends JComponent implements Accessible
}
catch (InterruptedException e)
{
+ // TODO: Should this be handled?
}
}
diff --git a/libjava/classpath/javax/swing/JComboBox.java b/libjava/classpath/javax/swing/JComboBox.java
index 47d18323a25..cd30840a6aa 100644
--- a/libjava/classpath/javax/swing/JComboBox.java
+++ b/libjava/classpath/javax/swing/JComboBox.java
@@ -46,8 +46,6 @@ import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.util.Vector;
import javax.accessibility.Accessible;
@@ -58,6 +56,7 @@ import javax.accessibility.AccessibleSelection;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.PopupMenuListener;
+import javax.swing.event.PopupMenuEvent;
import javax.swing.plaf.ComboBoxUI;
/**
@@ -212,10 +211,6 @@ public class JComboBox extends JComponent implements ItemSelectable,
this(new DefaultComboBoxModel());
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* This method returns true JComboBox is editable and false otherwise
*
@@ -310,7 +305,8 @@ public class JComboBox extends JComponent implements ItemSelectable,
// Stores old data model for event notification.
ComboBoxModel oldDataModel = dataModel;
dataModel = newDataModel;
-
+ selectedItemReminder = newDataModel.getSelectedItem();
+
// Notifies the listeners of the model change.
firePropertyChange("model", oldDataModel, dataModel);
}
@@ -551,14 +547,37 @@ public class JComboBox extends JComponent implements ItemSelectable,
return -1;
}
+ /**
+ * Returns an object that is used as the display value when calculating the
+ * preferred size for the combo box. This value is, of course, never
+ * displayed anywhere.
+ *
+ * @return The prototype display value (possibly <code>null</code>).
+ *
+ * @since 1.4
+ * @see #setPrototypeDisplayValue(Object)
+ */
public Object getPrototypeDisplayValue()
{
return prototypeDisplayValue;
}
- public void setPrototypeDisplayValue(Object newPrototypeDisplayValue)
+ /**
+ * Sets the object that is assumed to be the displayed item when calculating
+ * the preferred size for the combo box. A {@link PropertyChangeEvent} (with
+ * the name <code>prototypeDisplayValue</code>) is sent to all registered
+ * listeners.
+ *
+ * @param value the new value (<code>null</code> permitted).
+ *
+ * @since 1.4
+ * @see #getPrototypeDisplayValue()
+ */
+ public void setPrototypeDisplayValue(Object value)
{
- prototypeDisplayValue = newPrototypeDisplayValue;
+ Object oldValue = prototypeDisplayValue;
+ prototypeDisplayValue = value;
+ firePropertyChange("prototypeDisplayValue", oldValue, value);
}
/**
@@ -820,6 +839,47 @@ public class JComboBox extends JComponent implements ItemSelectable,
}
/**
+ * Fires a popupMenuCanceled() event to all <code>PopupMenuListeners</code>.
+ *
+ * Note: This method is intended for use by plaf classes only.
+ */
+ public void firePopupMenuCanceled()
+ {
+ PopupMenuListener[] listeners = getPopupMenuListeners();
+ PopupMenuEvent e = new PopupMenuEvent(this);
+ for(int i = 0; i < listeners.length; i++)
+ listeners[i].popupMenuCanceled(e);
+ }
+
+ /**
+ * Fires a popupMenuWillBecomeInvisible() event to all
+ * <code>PopupMenuListeners</code>.
+ *
+ * Note: This method is intended for use by plaf classes only.
+ */
+ public void firePopupMenuWillBecomeInvisible()
+ {
+ PopupMenuListener[] listeners = getPopupMenuListeners();
+ PopupMenuEvent e = new PopupMenuEvent(this);
+ for(int i = 0; i < listeners.length; i++)
+ listeners[i].popupMenuWillBecomeInvisible(e);
+ }
+
+ /**
+ * Fires a popupMenuWillBecomeVisible() event to all
+ * <code>PopupMenuListeners</code>.
+ *
+ * Note: This method is intended for use by plaf classes only.
+ */
+ public void firePopupMenuWillBecomeVisible()
+ {
+ PopupMenuListener[] listeners = getPopupMenuListeners();
+ PopupMenuEvent e = new PopupMenuEvent(this);
+ for(int i = 0; i < listeners.length; i++)
+ listeners[i].popupMenuWillBecomeVisible(e);
+ }
+
+ /**
* This method is invoked whenever selected item changes in the combo box's
* data model. It fires ItemEvent and ActionEvent to all registered
* ComboBox's ItemListeners and ActionListeners respectively, indicating
@@ -836,8 +896,9 @@ public class JComboBox extends JComponent implements ItemSelectable,
// Fire ItemEvent to indicate that new item is selected
Object newSelection = getSelectedItem();
- fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
- newSelection, ItemEvent.SELECTED));
+ if (newSelection != null)
+ fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+ newSelection, ItemEvent.SELECTED));
// Fire Action Event to JComboBox's registered listeners
fireActionEvent();
@@ -961,19 +1022,19 @@ public class JComboBox extends JComponent implements ItemSelectable,
*/
public void processKeyEvent(KeyEvent e)
{
- }
-
- /**
- * This method always returns false to indicate that JComboBox itself is
- * not focus traversable.
- *
- * @return false to indicate that JComboBox itself is not focus traversable.
- *
- * @deprecated
- */
- public boolean isFocusTraversable()
- {
- return false;
+ if (e.getKeyCode() == KeyEvent.VK_TAB)
+ setPopupVisible(false);
+ else if (keySelectionManager != null)
+ {
+ int i = keySelectionManager.selectionForKey(e.getKeyChar(),
+ getModel());
+ if (i >= 0)
+ setSelectedIndex(i);
+ else
+ super.processKeyEvent(e);
+ }
+ else
+ super.processKeyEvent(e);
}
/**
@@ -983,6 +1044,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
*/
public void setKeySelectionManager(KeySelectionManager aManager)
{
+ keySelectionManager = aManager;
}
/**
@@ -1147,6 +1209,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
protected AccessibleJComboBox()
{
+ // Nothing to do here.
}
public int getAccessibleChildrenCount()
@@ -1206,18 +1269,22 @@ public class JComboBox extends JComponent implements ItemSelectable,
public void addAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void removeAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void clearAccessibleSelection()
{
+ // TODO: Implement this properly.
}
public void selectAllAccessibleSelection()
{
+ // TODO: Implement this properly.
}
}
}
diff --git a/libjava/classpath/javax/swing/JComponent.java b/libjava/classpath/javax/swing/JComponent.java
index dc7689b0930..021a2a34080 100644
--- a/libjava/classpath/javax/swing/JComponent.java
+++ b/libjava/classpath/javax/swing/JComponent.java
@@ -44,6 +44,7 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.FocusTraversalPolicy;
import java.awt.Font;
@@ -53,6 +54,7 @@ import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.Window;
import java.awt.dnd.DropTarget;
import java.awt.event.ActionEvent;
@@ -64,7 +66,6 @@ import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
-import java.awt.image.ImageObserver;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -83,6 +84,8 @@ import javax.accessibility.AccessibleKeyBinding;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.event.EventListenerList;
@@ -121,9 +124,18 @@ public abstract class JComponent extends Container implements Serializable
protected class AccessibleFocusHandler
implements FocusListener
{
- protected AccessibleFocusHandler(){}
- public void focusGained(FocusEvent event){}
- public void focusLost(FocusEvent valevent){}
+ protected AccessibleFocusHandler()
+ {
+ // TODO: Implement this properly.
+ }
+ public void focusGained(FocusEvent event)
+ {
+ // TODO: Implement this properly.
+ }
+ public void focusLost(FocusEvent valevent)
+ {
+ // TODO: Implement this properly.
+ }
}
/**
@@ -132,9 +144,18 @@ public abstract class JComponent extends Container implements Serializable
protected class AccessibleContainerHandler
implements ContainerListener
{
- protected AccessibleContainerHandler() {}
- public void componentAdded(ContainerEvent event) {}
- public void componentRemoved(ContainerEvent valevent) {}
+ protected AccessibleContainerHandler()
+ {
+ // TODO: Implement this properly.
+ }
+ public void componentAdded(ContainerEvent event)
+ {
+ // TODO: Implement this properly.
+ }
+ public void componentRemoved(ContainerEvent valevent)
+ {
+ // TODO: Implement this properly.
+ }
}
private static final long serialVersionUID = -7047089700479897799L;
@@ -142,39 +163,217 @@ public abstract class JComponent extends Container implements Serializable
protected ContainerListener accessibleContainerHandler;
protected FocusListener accessibleFocusHandler;
- protected AccessibleJComponent() {}
- public void addPropertyChangeListener(PropertyChangeListener listener) {}
- public void removePropertyChangeListener(PropertyChangeListener listener) {}
- public int getAccessibleChildrenCount() { return 0; }
- public Accessible getAccessibleChild(int value0) { return null; }
- public AccessibleStateSet getAccessibleStateSet() { return null; }
- public String getAccessibleName() { return null; }
- public String getAccessibleDescription() { return null; }
- public AccessibleRole getAccessibleRole() { return null; }
- protected String getBorderTitle(Border value0) { return null; }
- public String getToolTipText() { return null; }
- public String getTitledBorderText() { return null; }
- public AccessibleKeyBinding getAccessibleKeyBinding() { return null; }
+ /**
+ * Manages the property change listeners;
+ */
+ private SwingPropertyChangeSupport changeSupport;
+
+ protected AccessibleJComponent()
+ {
+ changeSupport = new SwingPropertyChangeSupport(this);
+ }
+
+ /**
+ * Adds a property change listener to the list of registered listeners.
+ *
+ * @param listener the listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes a propery change listener from the list of registered listeners.
+ *
+ * @param listener the listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns the number of accessible children of this object.
+ *
+ * @return the number of accessible children of this object
+ */
+ 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;
+ }
+
+ /**
+ * Returns the accessible child component at index <code>i</code>.
+ *
+ * @param i the index of the accessible child to return
+ *
+ * @return the accessible child component at index <code>i</code>
+ */
+ 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;
+ }
+
+ /**
+ * Returns the accessible state set of this component.
+ *
+ * @return the accessible state set of this component
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // FIXME: Figure out which states should be set here, and which are
+ // inherited from the super class.
+ return super.getAccessibleStateSet();
+ }
+
+ /**
+ * Returns the localized name for this object. Generally this should
+ * almost never return {@link Component#getName()} since that is not
+ * a localized name. If the object is some kind of text component (like
+ * a menu item), then the value of the object may be returned. Also, if
+ * the object has a tooltip, the value of the tooltip may also be
+ * appropriate.
+ *
+ * @return the localized name for this object or <code>null</code> if this
+ * object has no name
+ */
+ public String getAccessibleName()
+ {
+ // TODO: Figure out what exactly to return here. It's possible that this
+ // method simply should return null.
+ return null;
+ }
+
+ /**
+ * Returns the localized description of this object.
+ *
+ * @return the localized description of this object or <code>null</code>
+ * if this object has no description
+ */
+ public String getAccessibleDescription()
+ {
+ // TODO: Figure out what exactly to return here. It's possible that this
+ // method simply should return null.
+ return null;
+ }
+
+ /**
+ * Returns the accessible role of this component.
+ *
+ * @return the accessible role of this component
+ *
+ * @see AccessibleRole
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ // TODO: Check if this is correct.
+ return AccessibleRole.SWING_COMPONENT;
+ }
+
+ /**
+ * Recursivly searches a border hierarchy (starting at <code>border) for
+ * a titled border and returns the title if one is found, <code>null</code>
+ * otherwise.
+ *
+ * @param border the border to start search from
+ *
+ * @return the border title of a possibly found titled border
+ */
+ protected String getBorderTitle(Border border)
+ {
+ String title = null;
+ if (border instanceof CompoundBorder)
+ {
+ CompoundBorder compound = (CompoundBorder) border;
+ Border inner = compound.getInsideBorder();
+ title = getBorderTitle(inner);
+ if (title == null)
+ {
+ Border outer = compound.getOutsideBorder();
+ title = getBorderTitle(outer);
+ }
+ }
+ else if (border instanceof TitledBorder)
+ {
+ TitledBorder titled = (TitledBorder) border;
+ title = titled.getTitle();
+ }
+ return title;
+ }
+
+ /**
+ * Returns the tooltip text for this accessible component.
+ *
+ * @return the tooltip text for this accessible component
+ */
+ public String getToolTipText()
+ {
+ return JComponent.this.getToolTipText();
+ }
+
+ /**
+ * Returns the title of the border of this accessible component if
+ * this component has a titled border, otherwise returns <code>null</code>.
+ *
+ * @return the title of the border of this accessible component if
+ * this component has a titled border, otherwise returns
+ * <code>null</code>
+ */
+ public String getTitledBorderText()
+ {
+ return getBorderTitle(getBorder());
+ }
+
+ /**
+ * Returns the keybindings associated with this accessible component or
+ * <code>null</code> if the component does not support key bindings.
+ *
+ * @return the keybindings associated with this accessible component
+ */
+ public AccessibleKeyBinding getAccessibleKeyBinding()
+ {
+ // TODO: Implement this properly.
+ return null;
+ }
}
/**
* An explicit value for the component's preferred size; if not set by a
* user, this is calculated on the fly by delegating to the {@link
- * ComponentUI.getPreferredSize} method on the {@link #ui} property.
+ * ComponentUI#getPreferredSize} method on the {@link #ui} property.
*/
Dimension preferredSize;
/**
* An explicit value for the component's minimum size; if not set by a
* user, this is calculated on the fly by delegating to the {@link
- * ComponentUI.getMinimumSize} method on the {@link #ui} property.
+ * ComponentUI#getMinimumSize} method on the {@link #ui} property.
*/
Dimension minimumSize;
/**
* An explicit value for the component's maximum size; if not set by a
* user, this is calculated on the fly by delegating to the {@link
- * ComponentUI.getMaximumSize} method on the {@link #ui} property.
+ * ComponentUI#getMaximumSize} method on the {@link #ui} property.
*/
Dimension maximumSize;
@@ -191,7 +390,7 @@ public abstract class JComponent extends Container implements Serializable
* @see javax.swing.OverlayLayout
* @see javax.swing.BoxLayout
*/
- float alignmentX = 0.5f;
+ float alignmentX = -1.0F;
/**
* A value between 0.0 and 1.0 indicating the preferred vertical
@@ -206,7 +405,7 @@ public abstract class JComponent extends Container implements Serializable
* @see javax.swing.OverlayLayout
* @see javax.swing.BoxLayout
*/
- float alignmentY = 0.5f;
+ float alignmentY = -1.0F;
/**
* The border painted around this component.
@@ -219,14 +418,14 @@ public abstract class JComponent extends Container implements Serializable
* The text to show in the tooltip associated with this component.
*
* @see #setToolTipText
- * @see #getToolTipText
+ * @see #getToolTipText()
*/
String toolTipText;
/**
* <p>Whether to double buffer this component when painting. This flag
- * should generally be <code>false</code>, except for top level
- * components such as {@link JFrame} or {@link JApplet}.</p>
+ * should generally be <code>true</code>, to ensure good painting
+ * performance.</p>
*
* <p>All children of a double buffered component are painted into the
* double buffer automatically, so only the top widget in a window needs
@@ -234,22 +433,21 @@ public abstract class JComponent extends Container implements Serializable
*
* @see #setDoubleBuffered
* @see #isDoubleBuffered
- * @see #paintLock
* @see #paint
*/
- boolean doubleBuffered = false;
+ boolean doubleBuffered = true;
/**
* A set of flags indicating which debugging graphics facilities should
* be enabled on this component. The values should be a combination of
- * {@link DebugGraphics.NONE_OPTION}, {@link DebugGraphics.LOG_OPTION},
- * {@link DebugGraphics.FLASH_OPTION}, or {@link
- * DebugGraphics.BUFFERED_OPTION}.
+ * {@link DebugGraphics#NONE_OPTION}, {@link DebugGraphics#LOG_OPTION},
+ * {@link DebugGraphics#FLASH_OPTION}, or {@link
+ * DebugGraphics#BUFFERED_OPTION}.
*
- * @see setDebugGraphicsOptions
- * @see getDebugGraphicsOptions
+ * @see #setDebugGraphicsOptions
+ * @see #getDebugGraphicsOptions
* @see DebugGraphics
- * @see getComponentGraphics
+ * @see #getComponentGraphics
*/
int debugGraphicsOptions;
@@ -299,7 +497,7 @@ public abstract class JComponent extends Container implements Serializable
* try to request focus, but the request might fail. Thus it is only
* a hint guiding swing's behavior.
*
- * @see #requestFocus
+ * @see #requestFocus()
* @see #isRequestFocusEnabled
* @see #setRequestFocusEnabled
*/
@@ -312,12 +510,18 @@ public abstract class JComponent extends Container implements Serializable
* timed intervals, continuing off in the direction the mouse exited the
* component, until the mouse is released or re-enters the component.
*
- * @see setAutoscrolls
- * @see getAutoscrolls
+ * @see #setAutoscrolls
+ * @see #getAutoscrolls
*/
boolean autoscrolls = false;
/**
+ * Indicates whether the current paint call is already double buffered or
+ * not.
+ */
+ static boolean isPaintingDoubleBuffered = false;
+
+ /**
* Listeners for events other than {@link PropertyChangeEvent} are
* handled by this listener list. PropertyChangeEvents are handled in
* {@link #changeSupport}.
@@ -342,7 +546,7 @@ public abstract class JComponent extends Container implements Serializable
private InputMap inputMap_whenFocused;
private InputMap inputMap_whenAncestorOfFocused;
- private InputMap inputMap_whenInFocusedWindow;
+ private ComponentInputMap inputMap_whenInFocusedWindow;
private ActionMap actionMap;
/** @since 1.3 */
private boolean verifyInputWhenFocusTarget;
@@ -350,16 +554,17 @@ public abstract class JComponent extends Container implements Serializable
private TransferHandler transferHandler;
- /**
- * A lock held during recursive painting; this is used to serialize
- * access to the double buffer, and also to select the "top level"
- * object which should acquire the double buffer in a given widget
- * tree (which may have multiple double buffered children).
- *
- * @see #doubleBuffered
- * @see #paint
+ /**
+ * Indicates if this component is currently painting a tile or not.
+ */
+ private boolean paintingTile;
+
+ /**
+ * A cached Rectangle object to be reused. Be careful when you use that,
+ * so that it doesn't get modified in another context within the same
+ * method call chain.
*/
- private static final Object paintLock = new Object();
+ private static transient Rectangle rectCache;
/**
* The default locale of the component.
@@ -404,6 +609,13 @@ public abstract class JComponent extends Container implements Serializable
public static final int WHEN_IN_FOCUSED_WINDOW = 2;
/**
+ * Indicates if this component is completely dirty or not. This is used
+ * by the RepaintManager's
+ * {@link RepaintManager#isCompletelyDirty(JComponent)} method.
+ */
+ boolean isCompletelyDirty = false;
+
+ /**
* Creates a new <code>JComponent</code> instance.
*/
public JComponent()
@@ -452,7 +664,9 @@ public abstract class JComponent extends Container implements Serializable
/**
* Add a client property <code>value</code> to this component, associated
* with <code>key</code>. If there is an existing client property
- * associated with <code>key</code>, it will be replaced.
+ * associated with <code>key</code>, it will be replaced. A
+ * {@link PropertyChangeEvent} is sent to registered listeners (with the
+ * name of the property being <code>key.toString()</code>).
*
* @param key The key of the client property association to add
* @param value The value of the client property association to add
@@ -463,10 +677,13 @@ public abstract class JComponent extends Container implements Serializable
*/
public final void putClientProperty(Object key, Object value)
{
+ Hashtable t = getClientProperties();
+ Object old = t.get(key);
if (value != null)
- getClientProperties().put(key, value);
+ t.put(key, value);
else
- getClientProperties().remove(key);
+ t.remove(key);
+ firePropertyChange(key.toString(), old, value);
}
/**
@@ -771,7 +988,8 @@ public abstract class JComponent extends Container implements Serializable
{
VetoableChangeListener[] listeners = getVetoableChangeListeners();
- PropertyChangeEvent evt = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
+ PropertyChangeEvent evt =
+ new PropertyChangeEvent(this, propertyName, oldValue, newValue);
for (int i = 0; i < listeners.length; i++)
listeners[i].vetoableChange(evt);
@@ -797,7 +1015,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public float getAlignmentX()
{
- return alignmentX;
+ float ret = alignmentX;
+ if (alignmentX < 0)
+ // alignment has not been set explicitly.
+ ret = super.getAlignmentX();
+
+ return ret;
}
/**
@@ -810,7 +1033,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public float getAlignmentY()
{
- return alignmentY;
+ float ret = alignmentY;
+ if (alignmentY < 0)
+ // alignment has not been set explicitly.
+ ret = super.getAlignmentY();
+
+ return ret;
}
/**
@@ -832,9 +1060,13 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setBorder(Border newBorder)
{
- Border oldBorder = border;
+ Border oldBorder = getBorder();
+ if (oldBorder == newBorder)
+ return;
+
border = newBorder;
firePropertyChange("border", oldBorder, newBorder);
+ repaint();
}
/**
@@ -885,10 +1117,19 @@ public abstract class JComponent extends Container implements Serializable
* @see #paint
*/
protected Graphics getComponentGraphics(Graphics g)
- {
- g.setFont (this.getFont());
- g.setColor (this.getForeground());
- return g;
+ {
+ Graphics g2 = g;
+ int options = getDebugGraphicsOptions();
+ if (options != DebugGraphics.NONE_OPTION)
+ {
+ if (!(g2 instanceof DebugGraphics))
+ g2 = new DebugGraphics(g);
+ DebugGraphics dg = (DebugGraphics) g2;
+ dg.setDebugOptions(dg.getDebugOptions() | options);
+ }
+ g2.setFont(this.getFont());
+ g2.setColor(this.getForeground());
+ return g2;
}
/**
@@ -901,7 +1142,19 @@ public abstract class JComponent extends Container implements Serializable
*/
public int getDebugGraphicsOptions()
{
- return 0;
+ String option = System.getProperty("gnu.javax.swing.DebugGraphics");
+ int options = debugGraphicsOptions;
+ if (option != null && option.length() != 0)
+ {
+ if (options < 0)
+ options = 0;
+
+ if (option.equals("LOG"))
+ options |= DebugGraphics.LOG_OPTION;
+ else if (option.equals("FLASH"))
+ options |= DebugGraphics.FLASH_OPTION;
+ }
+ return options;
}
/**
@@ -1298,6 +1551,7 @@ public abstract class JComponent extends Container implements Serializable
*/
public void grabFocus()
{
+ // TODO: Implement this properly.
}
/**
@@ -1366,13 +1620,16 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return <code>true</code> if this component is currently painting a tile.
+ * Return <code>true</code> if this component is currently painting a tile,
+ * this means that paint() is called again on another child component. This
+ * method returns <code>false</code> if this component does not paint a tile
+ * or if the last tile is currently painted.
*
- * @return Whether the component is painting a tile
+ * @return whether the component is painting a tile
*/
public boolean isPaintingTile()
{
- return false;
+ return paintingTile;
}
/**
@@ -1406,16 +1663,6 @@ public abstract class JComponent extends Container implements Serializable
* RepaintManager}. Client code should usually call {@link #repaint()} to
* trigger painting.</p>
*
- * <p>This method will acquire a double buffer from the {@link
- * RepaintManager} if the component's {@link #doubleBuffered} property is
- * <code>true</code> and the <code>paint</code> call is the
- * <em>first</em> recursive <code>paint</code> call inside swing.</p>
- *
- * <p>The method will also modify the provided {@link Graphics} context
- * via the {@link #getComponentGraphics} method. If you want to customize
- * the graphics object used for painting, you should override that method
- * rather than <code>paint</code>.</p>
- *
* <p>The body of the <code>paint</code> call involves calling {@link
* #paintComponent}, {@link #paintBorder}, and {@link #paintChildren} in
* order. If you want to customize painting behavior, you should override
@@ -1431,32 +1678,30 @@ public abstract class JComponent extends Container implements Serializable
*/
public void paint(Graphics g)
{
- Graphics g2 = g;
- Image doubleBuffer = null;
RepaintManager rm = RepaintManager.currentManager(this);
-
- if (isDoubleBuffered()
- && (rm.isDoubleBufferingEnabled())
- && (! Thread.holdsLock(paintLock)))
- {
- doubleBuffer = rm.getOffscreenBuffer(this, getWidth(), getHeight());
- }
-
- synchronized (paintLock)
+ // We do a little stunt act here to switch on double buffering if it's
+ // not already on. If we are not already doublebuffered, then we jump
+ // into the method paintDoubleBuffered, which turns on the double buffer
+ // and then calls paint(g) again. In the second call we go into the else
+ // branch of this if statement and actually paint things to the double
+ // buffer. When this method completes, the call stack unwinds back to
+ // paintDoubleBuffered, where the buffer contents is finally drawn to the
+ // screen.
+ if (!isPaintingDoubleBuffered && isDoubleBuffered()
+ && rm.isDoubleBufferingEnabled())
+ paintDoubleBuffered(g);
+ else
{
- if (doubleBuffer != null)
- {
- g2 = doubleBuffer.getGraphics();
- g2.setClip(g.getClipBounds());
- }
-
- g2 = getComponentGraphics(g2);
+ if (g.getClip() == null)
+ g.setClip(0, 0, getWidth(), getHeight());
+ Graphics g2 = getComponentGraphics(g);
paintComponent(g2);
paintBorder(g2);
paintChildren(g2);
-
- if (doubleBuffer != null)
- g.drawImage(doubleBuffer, 0, 0, (ImageObserver) null);
+ Rectangle clip = g2.getClipBounds();
+ if (clip.x == 0 && clip.y == 0 && clip.width == getWidth()
+ && clip.height == getHeight())
+ RepaintManager.currentManager(this).markCompletelyClean(this);
}
}
@@ -1495,7 +1740,69 @@ public abstract class JComponent extends Container implements Serializable
*/
protected void paintChildren(Graphics g)
{
- super.paint(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.
+ int startIndex = children.length - 1;
+ // No need to check for overlapping components when this component is
+ // optimizedDrawingEnabled (== it tiles its children).
+ if (! isOptimizedDrawingEnabled())
+ {
+ Rectangle clip = g.getClipBounds();
+ for (int i = 0; i < children.length; i++)
+ {
+ Rectangle childBounds = children[i].getBounds();
+ if (children[i].isOpaque()
+ && SwingUtilities.isRectangleContainingRectangle(childBounds,
+ g.getClipBounds()))
+ {
+ startIndex = i;
+ break;
+ }
+ }
+ }
+ // paintingTile becomes true just before we start painting the component's
+ // children.
+ paintingTile = true;
+ for (int i = startIndex; i >= 0; --i)
+ {
+ // paintingTile must be set to false before we begin to start painting
+ // the last tile.
+ if (i == 0)
+ paintingTile = false;
+
+ if (!children[i].isVisible())
+ continue;
+
+ Rectangle bounds = children[i].getBounds(rectCache);
+ Rectangle oldClip = g.getClipBounds();
+ if (oldClip == null)
+ oldClip = bounds;
+
+ if (!g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
+ continue;
+
+ boolean translated = false;
+ try
+ {
+ g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
+ g.translate(bounds.x, bounds.y);
+ translated = true;
+ children[i].paint(g);
+ }
+ finally
+ {
+ if (translated)
+ g.translate(-bounds.x, -bounds.y);
+ g.setClip(oldClip);
+ }
+ }
+ g.setClip(originalClip);
}
/**
@@ -1518,7 +1825,7 @@ public abstract class JComponent extends Container implements Serializable
Graphics g2 = g;
if (!(g instanceof Graphics2D))
g2 = g.create();
- ui.update(getComponentGraphics(g2), this);
+ ui.update(g2, this);
if (!(g instanceof Graphics2D))
g2.dispose();
}
@@ -1544,24 +1851,93 @@ public abstract class JComponent extends Container implements Serializable
* that root pane. This method is called from the {@link RepaintManager}
* and should always be called within the painting thread.
*
+ * <p>This method will acquire a double buffer from the {@link
+ * RepaintManager} if the component's {@link #doubleBuffered} property is
+ * <code>true</code> and the <code>paint</code> call is the
+ * <em>first</em> recursive <code>paint</code> call inside swing.</p>
+ *
+ * <p>The method will also modify the provided {@link Graphics} context
+ * via the {@link #getComponentGraphics} method. If you want to customize
+ * the graphics object used for painting, you should override that method
+ * rather than <code>paint</code>.</p>
+ *
* @param r The dirty rectangle to paint
*/
public void paintImmediately(Rectangle r)
{
- Component root = SwingUtilities.getRoot(this);
- if (root == null || ! root.isShowing())
+ // Try to find a root pane for this component.
+ //Component root = findPaintRoot(r);
+ Component root = findPaintRoot(r);
+ // If no paint root is found, then this component is completely overlapped
+ // by another component and we don't need repainting.
+ if (root == null)
return;
- Graphics g = root.getGraphics();
- if (g == null)
+ if (root == null || !root.isShowing())
return;
- Rectangle clip = SwingUtilities.convertRectangle(this, r, root);
- g.setClip(clip);
- root.paint(g);
+ Rectangle rootClip = SwingUtilities.convertRectangle(this, r, root);
+ if (root instanceof JComponent)
+ ((JComponent) root).paintImmediately2(rootClip);
+ else
+ root.repaint(rootClip.x, rootClip.y, rootClip.width, rootClip.height);
+ }
+
+ /**
+ * Performs the actual work of paintImmediatly on the repaint root.
+ *
+ * @param r the area to be repainted
+ */
+ void paintImmediately2(Rectangle r)
+ {
+ RepaintManager rm = RepaintManager.currentManager(this);
+ Graphics g = getGraphics();
+ g.setClip(r.x, r.y, r.width, r.height);
+ if (rm.isDoubleBufferingEnabled() && isDoubleBuffered())
+ paintDoubleBuffered(g);
+ else
+ paintSimple(g);
g.dispose();
}
/**
+ * Performs double buffered repainting.
+ *
+ * @param g the graphics context to paint to
+ */
+ void paintDoubleBuffered(Graphics g)
+ {
+
+ Rectangle r = g.getClipBounds();
+ if (r == null)
+ r = new Rectangle(0, 0, getWidth(), getHeight());
+ RepaintManager rm = RepaintManager.currentManager(this);
+
+ // Paint on the offscreen buffer.
+ Image buffer = rm.getOffscreenBuffer(this, getWidth(), getHeight());
+ Graphics g2 = buffer.getGraphics();
+ g2 = getComponentGraphics(g2);
+ g2.setClip(r.x, r.y, r.width, r.height);
+ isPaintingDoubleBuffered = true;
+ paint(g2);
+ isPaintingDoubleBuffered = false;
+ g2.dispose();
+
+ // Paint the buffer contents on screen.
+ g.drawImage(buffer, 0, 0, this);
+ }
+
+ /**
+ * Performs normal painting without double buffering.
+ *
+ * @param g the graphics context to use
+ */
+ void paintSimple(Graphics g)
+ {
+ Graphics g2 = getComponentGraphics(g);
+ paint(g2);
+ }
+
+ /**
* Return a string representation for this component, for use in
* debugging.
*
@@ -1685,7 +2061,11 @@ public abstract class JComponent extends Container implements Serializable
break;
case WHEN_IN_FOCUSED_WINDOW:
- inputMap_whenInFocusedWindow = map;
+ if (map != null && !(map instanceof ComponentInputMap))
+ throw new
+ IllegalArgumentException("WHEN_IN_FOCUSED_WINDOW " +
+ "InputMap must be a ComponentInputMap");
+ inputMap_whenInFocusedWindow = (ComponentInputMap)map;
break;
case UNDEFINED_CONDITION:
@@ -1711,7 +2091,7 @@ public abstract class JComponent extends Container implements Serializable
case WHEN_IN_FOCUSED_WINDOW:
if (inputMap_whenInFocusedWindow == null)
- inputMap_whenInFocusedWindow = new InputMap();
+ inputMap_whenInFocusedWindow = new ComponentInputMap(this);
return inputMap_whenInFocusedWindow;
case UNDEFINED_CONDITION:
@@ -1797,6 +2177,7 @@ public abstract class JComponent extends Container implements Serializable
*/
protected void processComponentKeyEvent(KeyEvent e)
{
+ // This method does nothing, it is meant to be overridden by subclasses.
}
/**
@@ -1825,40 +2206,56 @@ public abstract class JComponent extends Container implements Serializable
// 4. The WHEN_IN_FOCUSED_WINDOW maps of all the enabled components in
// the focused window are searched.
- if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
- e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED))
- // This is step 1 from above comment.
- e.consume();
- else if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
- e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
- e.getID() == KeyEvent.KEY_PRESSED))
- // This is step 2 from above comment.
- e.consume();
- else
+ KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e);
+ boolean pressed = e.getID() == KeyEvent.KEY_PRESSED;
+
+ if (processKeyBinding(keyStroke, e, WHEN_FOCUSED, pressed))
{
- // This is step 3 from above comment.
- Container current = this;
- while ((current = current.getParent()) instanceof JComponent)
+ // This is step 1 from above comment.
+ e.consume();
+ return;
+ }
+ else if (processKeyBinding
+ (keyStroke, e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
+ {
+ // This is step 2 from above comment.
+ e.consume();
+ return;
+ }
+
+ // This is step 3 from above comment.
+ Container current = getParent();
+ while (current != null)
+ {
+ // If current is a JComponent, see if it handles the event in its
+ // WHEN_ANCESTOR_OF_FOCUSED_COMPONENT maps.
+ if ((current instanceof JComponent) &&
+ ((JComponent)current).processKeyBinding
+ (keyStroke, e,WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
{
- if (((JComponent)current).processKeyBinding
- (KeyStroke.getKeyStrokeForEvent(e), e,
- WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
- e.getID() == KeyEvent.KEY_PRESSED))
- {
- e.consume();
- break;
- }
- if (current instanceof Window || current instanceof Applet
- || current instanceof JInternalFrame)
- break;
- }
- if (e.isConsumed())
- return;
+ e.consume();
+ return;
+ }
+
+ // Stop when we've tried a top-level container and it didn't handle it
+ if (current instanceof Window || current instanceof Applet)
+ break;
- // This is step 4 from above comment.
- // FIXME: Implement. Note, should use ComponentInputMaps rather
- // than walking the entire containment hierarchy.
+ // Move up the hierarchy
+ current = current.getParent();
}
+
+ // Current being null means the JComponent does not currently have a
+ // top-level ancestor, in which case we don't need to check
+ // WHEN_IN_FOCUSED_WINDOW bindings.
+ if (current == null || e.isConsumed())
+ return;
+
+ // This is step 4 from above comment. KeyboardManager maintains mappings
+ // related to WHEN_IN_FOCUSED_WINDOW bindings so that we don't have to
+ // traverse the containment hierarchy each time.
+ if (KeyboardManager.getManager().processKeyStroke(current, keyStroke, e))
+ e.consume();
}
protected boolean processKeyBinding(KeyStroke ks,
@@ -1975,8 +2372,19 @@ public abstract class JComponent extends Container implements Serializable
*/
public void revalidate()
{
- invalidate();
- RepaintManager.currentManager(this).addInvalidComponent(this);
+ if (! EventQueue.isDispatchThread())
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ revalidate();
+ }
+ });
+ else
+ {
+ invalidate();
+ RepaintManager.currentManager(this).addInvalidComponent(this);
+ }
}
/**
@@ -1999,7 +2407,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setAlignmentX(float a)
{
- alignmentX = a;
+ if (a < 0.0F)
+ alignmentX = 0.0F;
+ else if (a > 1.0)
+ alignmentX = 1.0F;
+ else
+ alignmentX = a;
}
/**
@@ -2009,7 +2422,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setAlignmentY(float a)
{
- alignmentY = a;
+ if (a < 0.0F)
+ alignmentY = 0.0F;
+ else if (a > 1.0)
+ alignmentY = 1.0F;
+ else
+ alignmentY = a;
}
/**
@@ -2049,9 +2467,11 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setEnabled(boolean enable)
{
- boolean oldEnabled = isEnabled();
+ if (enable == isEnabled())
+ return;
super.setEnabled(enable);
- firePropertyChange("enabled", oldEnabled, enable);
+ firePropertyChange("enabled", !enable, enable);
+ repaint();
}
/**
@@ -2061,7 +2481,11 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setFont(Font f)
{
+ if (f == getFont())
+ return;
super.setFont(f);
+ revalidate();
+ repaint();
}
/**
@@ -2071,7 +2495,10 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setBackground(Color bg)
{
+ if (bg == getBackground())
+ return;
super.setBackground(bg);
+ repaint();
}
/**
@@ -2081,42 +2508,51 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setForeground(Color fg)
{
+ if (fg == getForeground())
+ return;
super.setForeground(fg);
+ repaint();
}
/**
- * Set the value of the {@link #maximumSize} property.
+ * Set the value of the {@link #maximumSize} property. The passed value is
+ * copied, the later direct changes on the argument have no effect on the
+ * property value.
*
* @param max The new value of the property
*/
public void setMaximumSize(Dimension max)
{
Dimension oldMaximumSize = maximumSize;
- maximumSize = max;
+ maximumSize = new Dimension(max);
firePropertyChange("maximumSize", oldMaximumSize, maximumSize);
}
/**
- * Set the value of the {@link #minimumSize} property.
+ * Set the value of the {@link #minimumSize} property. The passed value is
+ * copied, the later direct changes on the argument have no effect on the
+ * property value.
*
* @param min The new value of the property
*/
public void setMinimumSize(Dimension min)
{
Dimension oldMinimumSize = minimumSize;
- minimumSize = min;
+ minimumSize = new Dimension(min);
firePropertyChange("minimumSize", oldMinimumSize, minimumSize);
}
/**
- * Set the value of the {@link #preferredSize} property.
+ * Set the value of the {@link #preferredSize} property. The passed value is
+ * copied, the later direct changes on the argument have no effect on the
+ * property value.
*
* @param pref The new value of the property
*/
public void setPreferredSize(Dimension pref)
{
Dimension oldPreferredSize = preferredSize;
- preferredSize = pref;
+ preferredSize = new Dimension(pref);
firePropertyChange("preferredSize", oldPreferredSize, preferredSize);
}
@@ -2131,6 +2567,7 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setNextFocusableComponent(Component aComponent)
{
+ // TODO: Implement this properly.
}
/**
@@ -2191,11 +2628,29 @@ public abstract class JComponent extends Container implements Serializable
/**
* Set the value of the visible property.
*
+ * If the value is changed, then the AncestorListeners of this component
+ * and all its children (recursivly) are notified.
+ *
* @param v The new value of the property
*/
public void setVisible(boolean v)
{
+ // No need to do anything if the actual value doesn't change.
+ if (isVisible() == v)
+ return;
+
super.setVisible(v);
+
+ // Notify AncestorListeners.
+ if (v == true)
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
+ else
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
+
+ Container parent = getParent();
+ if (parent != null)
+ parent.repaint(getX(), getY(), getWidth(), getHeight());
+ revalidate();
}
/**
@@ -2248,7 +2703,8 @@ public abstract class JComponent extends Container implements Serializable
ui.installUI(this);
firePropertyChange("UI", oldUI, newUI);
-
+ revalidate();
+ repaint();
}
/**
@@ -2427,47 +2883,22 @@ public abstract class JComponent extends Container implements Serializable
*/
public void addNotify()
{
+ // Register the WHEN_IN_FOCUSED_WINDOW keyboard bindings
+ // Note that here we unregister all bindings associated with
+ // this component and then re-register them. This may be more than
+ // necessary if the top-level ancestor hasn't changed. Should
+ // maybe improve this.
+ KeyboardManager km = KeyboardManager.getManager();
+ km.clearBindingsForComp(this);
+ km.registerEntireMap((ComponentInputMap)
+ this.getInputMap(WHEN_IN_FOCUSED_WINDOW));
super.addNotify();
- // let parents inherit the keybord mapping
- InputMap input = getInputMap();
- ActionMap actions = getActionMap();
-
- Container parent = getParent();
- while ((parent != null) && (parent instanceof JComponent))
- {
- JComponent jParent = (JComponent) parent;
- InputMap parentInput = jParent.getInputMap();
- ActionMap parentAction = jParent.getActionMap();
-
- KeyStroke[] ikeys = input.keys();
- for (int i = 0; i < ikeys.length; i++)
- {
- Object o = input.get(ikeys[i]);
- parentInput.put(ikeys[i], o);
- }
-
- Object[] akeys = actions.keys();
- for (int i = 0; i < akeys.length; i++)
- {
- Action a = actions.get(akeys[i]);
- parentAction.put(akeys[i], a);
- }
-
- parent = jParent.getParent();
- }
-
- // notify ancestor listeners
- AncestorListener[] ls = getAncestorListeners();
- AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED,
- this, parent);
- for (int i = 0; i < ls.length; i++)
- {
- ls[i].ancestorAdded(ev);
- }
+ // Notify AncestorListeners.
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
// fire property change event for 'ancestor'
- firePropertyChange("ancestor", null, parent);
+ firePropertyChange("ancestor", null, getParent());
}
/**
@@ -2490,43 +2921,14 @@ public abstract class JComponent extends Container implements Serializable
{
super.removeNotify();
- // let parents inherit the keybord mapping
- InputMap input = getInputMap();
- ActionMap actions = getActionMap();
-
- Container parent = getParent();
- while ((parent != null) && (parent instanceof JComponent))
- {
- JComponent jParent = (JComponent) parent;
- InputMap parentInput = jParent.getInputMap();
- ActionMap parentAction = jParent.getActionMap();
-
- KeyStroke[] ikeys = input.allKeys();
- for (int i = 0; i < ikeys.length; i++)
- {
- parentInput.remove(ikeys[i]);
- }
-
- Object[] akeys = actions.allKeys();
- for (int i = 0; i < akeys.length; i++)
- {
- parentAction.remove(akeys[i]);
- }
-
- parent = jParent.getParent();
- }
-
- // notify ancestor listeners
- AncestorListener[] ls = getAncestorListeners();
- AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED,
- this, parent);
- for (int i = 0; i < ls.length; i++)
- {
- ls[i].ancestorAdded(ev);
- }
+ // FIXME: remove the WHEN_IN_FOCUSED_WINDOW bindings from the
+ // KeyboardManager
+
+ // Notify ancestor listeners.
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
// fire property change event for 'ancestor'
- firePropertyChange("ancestor", parent, null);
+ firePropertyChange("ancestor", getParent(), null);
}
/**
@@ -2733,6 +3135,215 @@ public abstract class JComponent extends Container implements Serializable
*/
public void reshape(int x, int y, int w, int h)
{
+ int oldX = getX();
+ int oldY = getY();
super.reshape(x, y, w, h);
+ // Notify AncestorListeners.
+ if (oldX != getX() || oldY != getY())
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_MOVED);
+ }
+
+ /**
+ * Fires an AncestorEvent to this component's and all of its child
+ * component's AncestorListeners.
+ *
+ * @param ancestor the component that triggered the event
+ * @param id the kind of ancestor event that should be fired
+ */
+ void fireAncestorEvent(JComponent ancestor, int id)
+ {
+ // Fire event for registered ancestor listeners of this component.
+ AncestorListener[] listeners = getAncestorListeners();
+ if (listeners.length > 0)
+ {
+ AncestorEvent ev = new AncestorEvent(this, id,
+ ancestor, ancestor.getParent());
+ for (int i = 0; i < listeners.length; i++)
+ {
+ switch (id)
+ {
+ case AncestorEvent.ANCESTOR_MOVED:
+ listeners[i].ancestorMoved(ev);
+ break;
+ case AncestorEvent.ANCESTOR_ADDED:
+ listeners[i].ancestorAdded(ev);
+ break;
+ case AncestorEvent.ANCESTOR_REMOVED:
+ listeners[i].ancestorRemoved(ev);
+ break;
+ }
+ }
+ }
+ // Dispatch event to all children.
+ Component[] children = getComponents();
+ for (int i = 0; i < children.length; i++)
+ {
+ if (!(children[i] instanceof JComponent))
+ continue;
+ JComponent jc = (JComponent) children[i];
+ jc.fireAncestorEvent(ancestor, id);
+ }
+ }
+
+ /**
+ * Finds a suitable paint root for painting this component. This method first
+ * checks if this component is overlapped using
+ * {@link #findOverlapFreeParent(Rectangle)}. The returned paint root is then
+ * feeded to {@link #findOpaqueParent(Component)} to find the nearest opaque
+ * component for this paint root. If no paint is necessary, then we return
+ * <code>null</code>.
+ *
+ * @param c the clip of this component
+ *
+ * @return the paint root or <code>null</code> if no painting is necessary
+ */
+ private Component findPaintRoot(Rectangle c)
+ {
+ Component p = findOverlapFreeParent(c);
+ if (p == null)
+ return null;
+ Component root = findOpaqueParent(p);
+ return root;
+ }
+
+ /**
+ * Scans the containment hierarchy upwards for components that overlap the
+ * this component in the specified clip. This method returns
+ * <code>this</code>, if no component overlaps this component. It returns
+ * <code>null</code> if another component completely covers this component
+ * in the specified clip (no repaint necessary). If another component partly
+ * overlaps this component in the specified clip, then the parent of this
+ * component is returned (this is the component that must be used as repaint
+ * root). For efficient lookup, the method
+ * {@link #isOptimizedDrawingEnabled()} is used.
+ *
+ * @param clip the clip of this component
+ *
+ * @return the paint root, or <code>null</code> if no paint is necessary
+ */
+ private Component findOverlapFreeParent(Rectangle clip)
+ {
+ Rectangle currentClip = clip;
+ Component found = this;
+ Container parent = this;
+ while (parent != null && !(parent instanceof Window))
+ {
+ Container newParent = parent.getParent();
+ if (newParent == null)
+ break;
+ // If the parent is optimizedDrawingEnabled, then its children are
+ // tiled and cannot have an overlapping child. Go directly to next
+ // parent.
+ if (newParent instanceof JComponent
+ && ((JComponent) newParent).isOptimizedDrawingEnabled())
+ {
+ parent = newParent;
+ continue;
+ }
+
+ // First we must check if the new parent itself somehow clips the
+ // target rectangle. This can happen in JViewports.
+ Rectangle parRect = new Rectangle(0, 0, newParent.getWidth(),
+ newParent.getHeight());
+ Rectangle target = SwingUtilities.convertRectangle(found,
+ currentClip,
+ newParent);
+ if (target.contains(parRect) || target.intersects(parRect))
+ {
+ found = newParent;
+ currentClip = target;
+ parent = newParent;
+ continue;
+ }
+
+ // Otherwise we must check if one of the children of this parent
+ // overlaps with the current component.
+ Component[] children = newParent.getComponents();
+ // This flag is used to skip components that are 'below' the component
+ // in question.
+ boolean skip = true;
+ for (int i = children.length - 1; i >= 0; i--)
+ {
+ if (children[i] == parent)
+ skip = false;
+ if (skip)
+ continue;
+ Component c = children[i];
+ Rectangle compBounds = c.getBounds();
+ // If the component completely overlaps the clip in question, we
+ // don't need to repaint. Return null.
+ if (compBounds.contains(target))
+ return null;
+ if (compBounds.intersects(target))
+ {
+ // We found a parent whose children overlap with our current
+ // component. Make this the current component.
+ found = newParent;
+ currentClip = target;
+ break;
+ }
+ }
+ parent = newParent;
+ }
+ return found;
+ }
+
+ /**
+ * Finds the nearest component to <code>c</code> (upwards in the containment
+ * hierarchy), that is opaque. If <code>c</code> itself is opaque,
+ * this returns <code>c</code> itself.
+ *
+ * @param c the start component for the search
+ * @return the nearest component to <code>c</code> (upwards in the containment
+ * hierarchy), that is opaque; If <code>c</code> itself is opaque,
+ * this returns <code>c</code> itself
+ */
+ private Component findOpaqueParent(Component c)
+ {
+ Component found = c;
+ while (true)
+ {
+ if ((found instanceof JComponent) && ((JComponent) found).isOpaque())
+ break;
+ else if (!(found instanceof JComponent))
+ break;
+ Container p = found.getParent();
+ if (p == null)
+ break;
+ else
+ found = p;
+ }
+ return found;
+ }
+
+ /**
+ * This is the method that gets called when the WHEN_IN_FOCUSED_WINDOW map
+ * is changed.
+ *
+ * @param changed the JComponent associated with the WHEN_IN_FOCUSED_WINDOW
+ * map
+ */
+ void updateComponentInputMap(ComponentInputMap changed)
+ {
+ // Since you can change a component's input map via
+ // setInputMap, we have to check if <code>changed</code>
+ // is still in our WHEN_IN_FOCUSED_WINDOW map hierarchy
+ InputMap curr = getInputMap(WHEN_IN_FOCUSED_WINDOW);
+ while (curr != null && curr != changed)
+ curr = curr.getParent();
+
+ // If curr is null then changed is not in the hierarchy
+ if (curr == null)
+ return;
+
+ // Now we have to update the keyboard manager's hashtable
+ KeyboardManager km = KeyboardManager.getManager();
+
+ // This is a poor strategy, should be improved. We currently
+ // delete all the old bindings for the component and then register
+ // the current bindings.
+ km.clearBindingsForComp(changed.getComponent());
+ km.registerEntireMap((ComponentInputMap)
+ getInputMap(WHEN_IN_FOCUSED_WINDOW));
}
}
diff --git a/libjava/classpath/javax/swing/JDesktopPane.java b/libjava/classpath/javax/swing/JDesktopPane.java
index f4c80eca7d6..43ab71e7e9f 100644
--- a/libjava/classpath/javax/swing/JDesktopPane.java
+++ b/libjava/classpath/javax/swing/JDesktopPane.java
@@ -97,6 +97,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
*/
protected AccessibleJDesktopPane()
{
+ // Nothing to do here.
}
/**
@@ -246,6 +247,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
}
catch (PropertyVetoException e)
{
+ // We do nothing when the attempt is vetoed.
}
}
selectedFrame = null;
@@ -259,6 +261,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
}
catch (PropertyVetoException e)
{
+ // We do nothing when the attempt is vetoed.
}
}
diff --git a/libjava/classpath/javax/swing/JDialog.java b/libjava/classpath/javax/swing/JDialog.java
index 0f528ab1b45..b3f7c011f68 100644
--- a/libjava/classpath/javax/swing/JDialog.java
+++ b/libjava/classpath/javax/swing/JDialog.java
@@ -66,6 +66,21 @@ import javax.accessibility.AccessibleContext;
public class JDialog extends Dialog implements Accessible, WindowConstants,
RootPaneContainer
{
+ /**
+ * Provides accessibility support for <code>JDialog</code>s.
+ */
+ protected class AccessibleJDialog extends Dialog.AccessibleAWTDialog
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJDialog</code>.
+ */
+ public AccessibleJDialog()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
private static final long serialVersionUID = -864070866424508218L;
/** DOCUMENT ME! */
@@ -87,13 +102,6 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
/** Whether JDialogs are decorated by the Look and Feel. */
private static boolean decorated;
- /**
- * Whether we're in the init stage or not.
- * If so, adds and layouts are for top-level, otherwise they're for the
- * content pane
- */
- private boolean initStageDone = false;
-
/* Creates a new non-modal JDialog with no title
* using a shared Frame as the owner.
*/
@@ -244,7 +252,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
invalidate();
// Now that initStageDone is true, adds and layouts apply to contentPane,
// not top-level.
- initStageDone = true;
+ setRootPaneCheckingEnabled(true);
}
/**
@@ -315,13 +323,8 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set top-level layout. Use"
- + " getConentPane().setLayout instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -445,15 +448,10 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not add directly to JDialog."
- + " Use getContentPane().add instead.");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp, constraints, index);
}
/**
@@ -588,6 +586,8 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJDialog();
+ return accessibleContext;
}
}
diff --git a/libjava/classpath/javax/swing/JEditorPane.java b/libjava/classpath/javax/swing/JEditorPane.java
index e2f1319a2a7..9ddf970deea 100644
--- a/libjava/classpath/javax/swing/JEditorPane.java
+++ b/libjava/classpath/javax/swing/JEditorPane.java
@@ -41,15 +41,27 @@ package javax.swing;
import java.awt.Dimension;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
import java.net.URL;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleHyperlink;
+import javax.accessibility.AccessibleHypertext;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.Document;
import javax.swing.text.EditorKit;
+import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
/**
* A powerful text editor component that can handle different types of
@@ -76,6 +88,384 @@ import javax.swing.text.JTextComponent;
*/
public class JEditorPane extends JTextComponent
{
+ /**
+ * Provides accessibility support for <code>JEditorPane</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJEditorPane extends AccessibleJTextComponent
+ {
+
+ /**
+ * Creates a new <code>AccessibleJEditorPane</code> object.
+ */
+ protected AccessibleJEditorPane()
+ {
+ super();
+ }
+
+ /**
+ * Returns a description of this <code>AccessibleJEditorPane</code>. If
+ * this property is not set, then this returns the content-type of the
+ * editor pane.
+ *
+ * @return a description of this AccessibleJEditorPane
+ */
+ public String getAccessibleDescription()
+ {
+ String descr = super.getAccessibleDescription();
+ if (descr == null)
+ return getContentType();
+ else
+ return descr;
+ }
+
+ /**
+ * Returns the accessible state of this <code>AccessibleJEditorPane</code>.
+ *
+ * @return the accessible state of this <code>AccessibleJEditorPane</code>
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added here to the super's state.
+ return state;
+ }
+ }
+
+ /**
+ * Provides accessibility support for <code>JEditorPane</code>s, when the
+ * editor kit is an instance of {@link HTMLEditorKit}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJEditorPaneHTML extends AccessibleJEditorPane
+ {
+ /**
+ * Returns the accessible text of the <code>JEditorPane</code>. This will
+ * be an instance of
+ * {@link JEditorPaneAccessibleHypertextSupport}.
+ *
+ * @return the accessible text of the <code>JEditorPane</code>
+ */
+ public AccessibleText getAccessibleText()
+ {
+ return new JEditorPaneAccessibleHypertextSupport();
+ }
+ }
+
+ /**
+ * This is the accessible text that is returned by
+ * {@link AccessibleJEditorPaneHTML#getAccessibleText()}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class JEditorPaneAccessibleHypertextSupport
+ extends AccessibleJEditorPane implements AccessibleHypertext
+ {
+
+ /**
+ * The accessible representation of a HTML link.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class HTMLLink extends AccessibleHyperlink
+ {
+
+ /**
+ * The element in the document that represents the link.
+ */
+ Element element;
+
+ /**
+ * Creates a new <code>HTMLLink</code>.
+ *
+ * @param el the link element
+ */
+ public HTMLLink(Element el)
+ {
+ this.element = el;
+ }
+
+ /**
+ * Returns <code>true</code> if this <code>HTMLLink</code> is still
+ * valid. A <code>HTMLLink</code> can become invalid when the document
+ * changes.
+ *
+ * @return <code>true</code> if this <code>HTMLLink</code> is still
+ * valid
+ */
+ public boolean isValid()
+ {
+ // I test here if the element at our element's start offset is the
+ // same as the element in the document at this offset. If this is true,
+ // I consider the link valid, if not, then this link no longer
+ // represented by this HTMLLink and therefor invalid.
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ return doc.getCharacterElement(element.getStartOffset()) == element;
+ }
+
+ /**
+ * Returns the number of AccessibleActions in this link object. In
+ * general, link have 1 AccessibleAction associated with them. There are
+ * special cases where links can have multiple actions associated, like
+ * in image maps.
+ *
+ * @return the number of AccessibleActions in this link object
+ */
+ public int getAccessibleActionCount()
+ {
+ // TODO: Implement the special cases.
+ return 1;
+ }
+
+ /**
+ * Performs the specified action on the link object. This ususally means
+ * activating the link.
+ *
+ * @return <code>true</code> if the action has been performed
+ * successfully, <code>false</code> otherwise
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ String href = (String) element.getAttributes().getAttribute("href");
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ try
+ {
+ URL url = new URL(doc.getBase(), href);
+ setPage(url);
+ String desc = doc.getText(element.getStartOffset(),
+ element.getEndOffset() - element.getStartOffset());
+ HyperlinkEvent ev =
+ new HyperlinkEvent(JEditorPane.this,
+ HyperlinkEvent.EventType.ACTIVATED, url, desc,
+ element);
+ fireHyperlinkUpdate(ev);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the description of the action at action index <code>i</code>.
+ * This method returns the text within the element associated with this
+ * link.
+ *
+ * @param i the action index
+ *
+ * @return the description of the action at action index <code>i</code>
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ try
+ {
+ return doc.getText(element.getStartOffset(),
+ element.getEndOffset() - element.getStartOffset());
+ }
+ catch (BadLocationException ex)
+ {
+ throw (AssertionError)
+ new AssertionError("BadLocationException must not be thrown "
+ + "here.")
+ .initCause(ex);
+ }
+ }
+
+ /**
+ * Returns an {@link URL} object, that represents the action at action
+ * index <code>i</code>.
+ *
+ * @param i the action index
+ *
+ * @return an {@link URL} object, that represents the action at action
+ * index <code>i</code>
+ */
+ public Object getAccessibleActionObject(int i)
+ {
+ String href = (String) element.getAttributes().getAttribute("href");
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ try
+ {
+ URL url = new URL(doc.getBase(), href);
+ return url;
+ }
+ catch (MalformedURLException ex)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns an object that represents the link anchor. For examples, if
+ * the link encloses a string, then a <code>String</code> object is
+ * returned, if the link encloses an &lt;img&gt; tag, then an
+ * <code>ImageIcon</code> object is returned.
+ *
+ * @return an object that represents the link anchor
+ */
+ public Object getAccessibleActionAnchor(int i)
+ {
+ // TODO: This is only the String case. Implement all cases.
+ return getAccessibleActionDescription(i);
+ }
+
+ /**
+ * Returns the start index of the hyperlink element.
+ *
+ * @return the start index of the hyperlink element
+ */
+ public int getStartIndex()
+ {
+ return element.getStartOffset();
+ }
+
+ /**
+ * Returns the end index of the hyperlink element.
+ *
+ * @return the end index of the hyperlink element
+ */
+ public int getEndIndex()
+ {
+ return element.getEndOffset();
+ }
+
+ }
+
+ /**
+ * Returns the number of hyperlinks in the document.
+ *
+ * @return the number of hyperlinks in the document
+ */
+ public int getLinkCount()
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ count++;
+ linkIter.next();
+ }
+ return count;
+ }
+
+ /**
+ * Returns the <code>i</code>-th hyperlink in the document or
+ * <code>null</code> if there is no hyperlink with the specified index.
+ *
+ * @param i the index of the hyperlink to return
+ *
+ * @return the <code>i</code>-th hyperlink in the document or
+ * <code>null</code> if there is no hyperlink with the specified
+ * index
+ */
+ public AccessibleHyperlink getLink(int i)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ count++;
+ if (count == i)
+ break;
+ linkIter.next();
+ }
+ if (linkIter.isValid())
+ {
+ int offset = linkIter.getStartOffset();
+ // TODO: I fetch the element for the link via getCharacterElement().
+ // I am not sure that this is correct, maybe we must use
+ // getParagraphElement()?
+ Element el = doc.getCharacterElement(offset);
+ HTMLLink link = new HTMLLink(el);
+ return link;
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Returns the index of the link element at the character position
+ * <code>c</code> within the document, or <code>-1</code> if there is no
+ * link at the specified position.
+ *
+ * @param c the character index from which to fetch the link index
+ *
+ * @return the index of the link element at the character position
+ * <code>c</code> within the document, or <code>-1</code> if there
+ * is no link at the specified position
+ */
+ public int getLinkIndex(int c)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ if (linkIter.getStartOffset() <= c && linkIter.getEndOffset() > c)
+ break;
+ count++;
+ linkIter.next();
+ }
+ if (linkIter.isValid())
+ return count;
+ else
+ return -1;
+ }
+
+ /**
+ * Returns the link text of the link at index <code>i</code>, or
+ * <code>null</code>, if there is no link at the specified position.
+ *
+ * @param i the index of the link
+ *
+ * @return the link text of the link at index <code>i</code>, or
+ * <code>null</code>, if there is no link at the specified
+ * position
+ */
+ public String getLinkText(int i)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ count++;
+ if (count == i)
+ break;
+ linkIter.next();
+ }
+ if (linkIter.isValid())
+ {
+ int offset = linkIter.getStartOffset();
+ // TODO: I fetch the element for the link via getCharacterElement().
+ // I am not sure that this is correct, maybe we must use
+ // getParagraphElement()?
+ Element el = doc.getCharacterElement(offset);
+ try
+ {
+ String text = doc.getText(el.getStartOffset(),
+ el.getEndOffset() - el.getStartOffset());
+ return text;
+ }
+ catch (BadLocationException ex)
+ {
+ throw (AssertionError)
+ new AssertionError("BadLocationException must not be thrown "
+ + "here.")
+ .initCause(ex);
+ }
+ }
+ else
+ return null;
+ }
+ }
+
private static final long serialVersionUID = 3140472492599046285L;
private URL page;
@@ -128,9 +518,21 @@ public class JEditorPane extends JTextComponent
listeners[index].hyperlinkUpdate(event);
}
+ /**
+ * Returns the accessible context associated with this editor pane.
+ *
+ * @return the accessible context associated with this editor pane
+ */
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ {
+ if (getEditorKit() instanceof HTMLEditorKit)
+ accessibleContext = new AccessibleJEditorPaneHTML();
+ else
+ accessibleContext = new AccessibleJEditorPane();
+ }
+ return accessibleContext;
}
public final String getContentType()
@@ -169,12 +571,18 @@ public class JEditorPane extends JTextComponent
public boolean getScrollableTracksViewportHeight()
{
- return false;
+ /* Container parent = getParent();
+ return (parent instanceof JViewport &&
+ parent.isValid());*/
+ return isValid();
}
public boolean getScrollableTracksViewportWidth()
{
- return false;
+ /*Container parent = getParent();
+ return (parent instanceof JViewport &&
+ parent.isValid());*/
+ return isValid();
}
public URL getPage()
@@ -211,9 +619,26 @@ public class JEditorPane extends JTextComponent
/**
* This method initializes from a stream.
*/
- public void read(InputStream in, Object desc)
- throws IOException
+ public void read(InputStream in, Object desc) throws IOException
{
+ EditorKit kit = getEditorKit();
+ if (kit instanceof HTMLEditorKit && desc instanceof HTMLDocument)
+ {
+ Document doc = (Document) desc;
+ try
+ {
+ kit.read(in, doc, 0);
+ }
+ catch (BadLocationException ex)
+ {
+ assert false : "BadLocationException must not be thrown here.";
+ }
+ }
+ else
+ {
+ Reader inRead = new InputStreamReader(in);
+ super.read(inRead, desc);
+ }
}
/**
@@ -222,6 +647,7 @@ public class JEditorPane extends JTextComponent
public static void registerEditorKitForContentType(String type,
String classname)
{
+ // TODO: Implement this properly.
}
/**
@@ -231,6 +657,7 @@ public class JEditorPane extends JTextComponent
String classname,
ClassLoader loader)
{
+ // TODO: Implement this properly.
}
/**
@@ -239,6 +666,7 @@ public class JEditorPane extends JTextComponent
*/
public void replaceSelection(String content)
{
+ // TODO: Implement this properly.
}
/**
@@ -247,6 +675,7 @@ public class JEditorPane extends JTextComponent
*/
public void scrollToReference(String reference)
{
+ // TODO: Implement this properly.
}
public final void setContentType(String type)
@@ -281,6 +710,8 @@ public class JEditorPane extends JTextComponent
firePropertyChange("editorKit", oldValue, newValue);
invalidate();
repaint();
+ // Reset the accessibleContext since this depends on the editorKit.
+ accessibleContext = null;
}
public void setEditorKitForContentType(String type, EditorKit k)
diff --git a/libjava/classpath/javax/swing/JFileChooser.java b/libjava/classpath/javax/swing/JFileChooser.java
index 7569061ab2e..1598641f1b9 100644
--- a/libjava/classpath/javax/swing/JFileChooser.java
+++ b/libjava/classpath/javax/swing/JFileChooser.java
@@ -42,10 +42,13 @@ import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
import java.io.File;
import java.util.ArrayList;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.JDialog;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileSystemView;
@@ -70,171 +73,324 @@ public class JFileChooser extends JComponent implements Accessible
{
private static final long serialVersionUID = 3162921138695327837L;
- /** DOCUMENT ME! */
+ /**
+ * A dialog type for selecting a file to open.
+ * @see #setDialogType(int)
+ */
public static final int OPEN_DIALOG = 0;
- /** DOCUMENT ME! */
+ /**
+ * A dialog type for selecting a file to save.
+ * @see #setDialogType(int)
+ */
public static final int SAVE_DIALOG = 1;
- /** DOCUMENT ME! */
+ /**
+ * A dialog type for some custom purpose.
+ * @see #setDialogType(int)
+ */
public static final int CUSTOM_DIALOG = 2;
- /** DOCUMENT ME! */
+ /**
+ * A return value indicating the file chooser has been closed by cancelling.
+ *
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
public static final int CANCEL_OPTION = 1;
- /** DOCUMENT ME! */
+ /**
+ * A return value indicating the file chooser has been closed by approving
+ * the selection.
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
public static final int APPROVE_OPTION = 0;
- /** DOCUMENT ME! */
+ /**
+ * A return value indicating the file chooser has been closed by some error.
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
public static final int ERROR_OPTION = -1;
- /** DOCUMENT ME! */
+ /**
+ * A selection mode constant indicating acceptance of files only.
+ * @see #setFileSelectionMode(int)
+ */
public static final int FILES_ONLY = 0;
- /** DOCUMENT ME! */
+ /**
+ * A selection mode constant indicating acceptance of directories only.
+ * @see #setFileSelectionMode(int)
+ */
public static final int DIRECTORIES_ONLY = 1;
- /** DOCUMENT ME! */
+ /**
+ * A selection mode constant indicating acceptance of files and directories.
+ * @see #setFileSelectionMode(int)
+ */
public static final int FILES_AND_DIRECTORIES = 2;
- /** DOCUMENT ME! */
+ /**
+ * Action command string for cancelling the current selection.
+ * @see #cancelSelection()
+ */
public static final String CANCEL_SELECTION = "CancelSelection";
- /** DOCUMENT ME! */
+ /**
+ * Action command string for approving the current selection.
+ * @see #cancelSelection()
+ */
public static final String APPROVE_SELECTION = "ApproveSelection";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the approve button text.
+ * @see #setApproveButtonText(String)
+ */
public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY =
"ApproveButtonTextChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the approve button tool tip text.
+ * @see #setApproveButtonToolTipText(String)
+ */
public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY =
"ApproveButtonToolTipTextChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the approve button mnemonic.
+ * @see #setApproveButtonMnemonic(int)
+ */
public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY =
"ApproveButtonMnemonicChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for control button visibility.
+ * @see #setControlButtonsAreShown(boolean)
+ */
public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY =
"ControlButtonsAreShownChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the current directory.
+ * @see #setCurrentDirectory(File)
+ */
public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the selected file.
+ * @see #setSelectedFile(File)
+ */
public static final String SELECTED_FILE_CHANGED_PROPERTY =
"SelectedFileChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the selected files.
+ * @see #setSelectedFiles(File[])
+ */
public static final String SELECTED_FILES_CHANGED_PROPERTY =
"SelectedFilesChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for multi-selection.
+ * @see #setMultiSelectionEnabled(boolean)
+ */
public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY =
"MultiSelectionEnabledChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file system view' property.
+ * @see #setFileSystemView(FileSystemView)
+ */
public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY =
"FileSystemViewChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file view' property.
+ * @see #setFileView(FileView)
+ */
public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file hiding enabled' property.
+ * @see #setFileHidingEnabled(boolean)
+ */
public static final String FILE_HIDING_CHANGED_PROPERTY =
"FileHidingChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file filter' property.
+ * @see #setFileFilter(FileFilter)
+ */
public static final String FILE_FILTER_CHANGED_PROPERTY =
"fileFilterChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file selection mode' property.
+ * @see #setFileSelectionMode(int)
+ */
public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY =
"fileSelectionChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'accessory' property.
+ * @see #setAccessory(JComponent)
+ */
public static final String ACCESSORY_CHANGED_PROPERTY =
"AccessoryChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'accept all file filter used' property.
+ * @see #setAcceptAllFileFilterUsed(boolean)
+ */
public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY =
"acceptAllFileFilterUsedChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'dialog title' property.
+ * @see #setDialogTitle(String)
+ */
public static final String DIALOG_TITLE_CHANGED_PROPERTY =
"DialogTitleChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'dialog type' property.
+ * @see #setDialogType(int)
+ */
public static final String DIALOG_TYPE_CHANGED_PROPERTY =
"DialogTypeChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'choosable file filters' property.
+ * @see #addChoosableFileFilter(FileFilter)
+ */
public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY =
"ChoosableFileFilterChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The accessible context.
+ * @see #getAccessibleContext()
+ */
protected AccessibleContext accessibleContext;
- /** DOCUMENT ME! */
+ /**
+ * The file system view.
+ * @see #setFileSystemView(FileSystemView)
+ */
private FileSystemView fsv;
- /** DOCUMENT ME! */
+ /**
+ * The accessory component.
+ * @see #setAccessory(JComponent)
+ */
private JComponent accessory;
- /** DOCUMENT ME! */
+ /**
+ * The approve button mnemonic.
+ * @see #setApproveButtonMnemonic(int)
+ */
private int approveButtonMnemonic = 0;
- /** DOCUMENT ME! */
+ /**
+ * The approve button text.
+ * @see #setApproveButtonText(String)
+ */
private String approveButtonText;
- /** DOCUMENT ME! */
+ /**
+ * The approve button tool tip text.
+ * @see #setApproveButtonToolTipText(String)
+ */
private String approveButtonToolTipText;
- /** DOCUMENT ME! */
+ /**
+ * The choosable file filters.
+ * @see #addChoosableFileFilter(FileFilter)
+ */
private ArrayList choosableFilters = new ArrayList();
- /** DOCUMENT ME! */
+ /**
+ * A flag controlling whether the accept all file filter is used.
+ * @see #setAcceptAllFileFilterUsed(boolean)
+ */
private boolean isAcceptAll = true;
- /** DOCUMENT ME! */
+ /**
+ * The dialog title.
+ * @see #setDialogTitle(String)
+ */
private String dialogTitle;
- /** DOCUMENT ME! */
+ /**
+ * The dialog type.
+ * @see #setDialogType(int)
+ */
private int dialogType = OPEN_DIALOG;
- /** DOCUMENT ME! */
+ /**
+ * The return value for the dialog.
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
private int retval = ERROR_OPTION;
- /** DOCUMENT ME! */
+ /**
+ * A flag indicating whether the file chooser allows multiple selection.
+ * @see #isMultiSelectionEnabled()
+ */
private boolean multiSelection = false;
- /** DOCUMENT ME! */
+ /**
+ * A flag indicating whether file hiding is enabled.
+ * @see #isFileHidingEnabled()
+ */
private boolean fileHiding = true;
- /** DOCUMENT ME! */
+ /**
+ * The file selection mode.
+ * @see #setFileSelectionMode(int)
+ */
private int fileSelectionMode = FILES_AND_DIRECTORIES;
- /** DOCUMENT ME! */
+ /**
+ * The file view.
+ * @see #setFileView(FileView)
+ */
private FileView fv = null;
- /** DOCUMENT ME! */
+ /**
+ * A flag controlling whether or not the control buttons are visible.
+ * @see #setControlButtonsAreShown(boolean)
+ */
private boolean controlButtonsShown = true;
- /** DOCUMENT ME! */
+ /**
+ * The current directory.
+ * @see #setCurrentDirectory(File)
+ */
private File currentDir = null;
- /** DOCUMENT ME! */
+ /**
+ * The current file filter.
+ * @see #setFileFilter(FileFilter)
+ */
private FileFilter currentFilter = null;
- /** DOCUMENT ME! */
+ /**
+ * An array of selected files.
+ * @see #setSelectedFiles(File[])
+ */
private File[] selectedFiles;
- /** DOCUMENT ME! */
+ /**
+ * The selected file.
+ * @see #setSelectedFile(File)
+ */
private File selectedFile;
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*/
public JFileChooser()
{
@@ -243,9 +399,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param currentDirectoryPath DOCUMENT ME!
+ * @param currentDirectoryPath the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
*/
public JFileChooser(String currentDirectoryPath)
{
@@ -254,12 +412,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object with the specified directory and
- * FileSystemView.
+ * Creates a new <code>JFileChooser</code> object with the specified
+ * directory and {@link FileSystemView}.
*
- * @param currentDirectoryPath the directory that should initially be
- * shown the filechooser
- * @param fsv the FileSystemView object to use
+ * @param currentDirectoryPath the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
+ * @param fsv the file system view (if <code>null</code>, the default file
+ * system view is used).
*/
public JFileChooser(String currentDirectoryPath, FileSystemView fsv)
{
@@ -268,9 +428,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param currentDirectory DOCUMENT ME!
+ * @param currentDirectory the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
*/
public JFileChooser(File currentDirectory)
{
@@ -279,9 +441,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param fsv DOCUMENT ME!
+ * @param fsv the file system view (if <code>null</code>, the default file
+ * system view is used).
*/
public JFileChooser(FileSystemView fsv)
{
@@ -290,10 +453,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param currentDirectory DOCUMENT ME!
- * @param fsv DOCUMENT ME!
+ * @param currentDirectory the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
+ * @param fsv the file system view (if <code>null</code>, the default file
+ * system view is used).
*/
public JFileChooser(File currentDirectory, FileSystemView fsv)
{
@@ -302,9 +468,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets up the file chooser. This method is called by all the constructors.
*
- * @param view DOCUMENT ME!
+ * @param view the file system view (if <code>null</code>, the default file
+ * system view is used).
+ *
+ * @see FileSystemView#getFileSystemView()
*/
protected void setup(FileSystemView view)
{
@@ -336,9 +505,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the selected file, if there is one.
*
- * @return DOCUMENT ME!
+ * @return The selected file (possibly <code>null</code>).
+ *
+ * @see #setSelectedFile(File)
*/
public File getSelectedFile()
{
@@ -346,9 +517,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the selected file and sends a {@link PropertyChangeEvent} to all
+ * registered listeners. The property name is
+ * {@link #SELECTED_FILE_CHANGED_PROPERTY}.
*
- * @param file DOCUMENT ME!
+ * @param file the file (<code>null</code> permitted).
*/
public void setSelectedFile(File file)
{
@@ -361,9 +534,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the selected file or files.
*
- * @return DOCUMENT ME!
+ * @return An array of the selected files, or <code>null</code> if there are
+ * no selected files.
*/
public File[] getSelectedFiles()
{
@@ -375,9 +549,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the selected files and sends a {@link PropertyChangeEvent} (with the
+ * name {@link #SELECTED_FILES_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param selectedFiles DOCUMENT ME!
+ * @param selectedFiles the selected files (<code>null</code> permitted).
*/
public void setSelectedFiles(File[] selectedFiles)
{
@@ -393,9 +569,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the current directory.
*
- * @return DOCUMENT ME!
+ * @return The current directory.
*/
public File getCurrentDirectory()
{
@@ -403,9 +579,15 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the current directory and fires a {@link PropertyChangeEvent} (with
+ * the property name {@link #DIRECTORY_CHANGED_PROPERTY}) to all registered
+ * listeners. If <code>dir</code> is <code>null</code>, the current
+ * directory is set to the default directory returned by the file system
+ * view.
*
- * @param dir DOCUMENT ME!
+ * @param dir the new directory (<code>null</code> permitted).
+ *
+ * @see FileSystemView#getDefaultDirectory()
*/
public void setCurrentDirectory(File dir)
{
@@ -421,7 +603,7 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Called by the UI delegate when the parent directory is changed.
*/
public void changeToParentDirectory()
{
@@ -430,7 +612,7 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Rescans the current directory (this is handled by the UI delegate).
*/
public void rescanCurrentDirectory()
{
@@ -438,9 +620,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Ensures the the specified file is visible (this is handled by the
+ * UI delegate).
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*/
public void ensureFileIsVisible(File f)
{
@@ -448,11 +631,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Displays the file chooser in a modal dialog using the
+ * {@link #OPEN_DIALOG} type.
*
- * @param parent DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return A return value indicating how the dialog was closed (one of
+ * {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
+ * {@link #ERROR_OPTION}).
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -472,11 +658,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Displays the file chooser in a modal dialog using the
+ * {@link #SAVE_DIALOG} type.
*
- * @param parent DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return A return value indicating how the dialog was closed (one of
+ * {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
+ * {@link #ERROR_OPTION}).
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -493,12 +682,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Displays the file chooser in a modal dialog using the
+ * {@link #CUSTOM_DIALOG} type.
*
- * @param parent DOCUMENT ME!
- * @param approveButtonText DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return A return value indicating how the dialog was closed (one of
+ * {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
+ * {@link #ERROR_OPTION}).
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -517,11 +708,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Creates a modal dialog in which to display the file chooser.
*
- * @param parent DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return The dialog.
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -542,9 +733,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the flag that controls whether or not the control buttons are
+ * shown on the file chooser.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setControlButtonsAreShown(boolean)
*/
public boolean getControlButtonsAreShown()
{
@@ -552,9 +746,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether or not the control buttons are
+ * shown and, if it changes, sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY}) to
+ * all registered listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value for the flag.
*/
public void setControlButtonsAreShown(boolean b)
{
@@ -567,9 +764,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the type of file chooser.
*
- * @return DOCUMENT ME!
+ * @return {@link #OPEN_DIALOG}, {@link #SAVE_DIALOG} or
+ * {@link #CUSTOM_DIALOG}.
+ *
+ * @see #setDialogType(int)
*/
public int getDialogType()
{
@@ -577,9 +777,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the dialog type and fires a {@link PropertyChangeEvent} (with the
+ * property name {@link #DIALOG_TYPE_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param dialogType DOCUMENT ME!
+ * @param dialogType the dialog type (one of: {@link #OPEN_DIALOG},
+ * {@link #SAVE_DIALOG}, {@link #CUSTOM_DIALOG}).
+ *
+ * @throws IllegalArgumentException if <code>dialogType</code> is not valid.
*/
public void setDialogType(int dialogType)
{
@@ -596,9 +801,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the dialog title and sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #DIALOG_TITLE_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param dialogTitle DOCUMENT ME!
+ * @param dialogTitle the dialog title (<code>null</code> permitted).
+ *
+ * @see #getDialogTitle()
*/
public void setDialogTitle(String dialogTitle)
{
@@ -611,9 +820,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the dialog title.
*
- * @return DOCUMENT ME!
+ * @return The dialog title (possibly <code>null</code>).
+ *
+ * @see #setDialogTitle(String)
*/
public String getDialogTitle()
{
@@ -621,9 +832,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the tool tip text for the approve button and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param toolTipText DOCUMENT ME!
+ * @param toolTipText the text.
*/
public void setApproveButtonToolTipText(String toolTipText)
{
@@ -637,9 +851,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the tool tip text for the approve button.
*
- * @return DOCUMENT ME!
+ * @return The tool tip text for the approve button.
+ *
+ * @see #setApproveButtonToolTipText(String)
*/
public String getApproveButtonToolTipText()
{
@@ -647,9 +863,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the approve button mnemonic, or zero if no mnemonic has been set.
*
- * @return DOCUMENT ME!
+ * @return The approve button mnemonic.
+ *
+ * @see #setApproveButtonMnemonic(int)
*/
public int getApproveButtonMnemonic()
{
@@ -657,9 +875,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the mnemonic for the approve button and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param mnemonic DOCUMENT ME!
+ * @param mnemonic the mnemonic.
+ *
+ * @see #setApproveButtonMnemonic(char)
*/
public void setApproveButtonMnemonic(int mnemonic)
{
@@ -673,9 +896,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the mnemonic for the approve button and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param mnemonic DOCUMENT ME!
+ * @param mnemonic the mnemonic.
+ *
+ * @see #setApproveButtonMnemonic(int)
*/
public void setApproveButtonMnemonic(char mnemonic)
{
@@ -683,9 +911,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the approve button text and fires a {@link PropertyChangeEvent}
+ * (with the property name {@link #APPROVE_BUTTON_TEXT_CHANGED_PROPERTY}) to
+ * all registered listeners.
*
- * @param approveButtonText DOCUMENT ME!
+ * @param approveButtonText the text (<code>null</code> permitted).
+ *
+ * @see #getApproveButtonText()
*/
public void setApproveButtonText(String approveButtonText)
{
@@ -699,9 +931,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the approve button text.
*
- * @return DOCUMENT ME!
+ * @return The approve button text (possibly <code>null</code>).
+ *
+ * @see #setApproveButtonText(String)
*/
public String getApproveButtonText()
{
@@ -709,19 +943,22 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the available file filters for this file chooser.
*
- * @return DOCUMENT ME!
+ * @return The available file filters.
*/
public FileFilter[] getChoosableFileFilters()
{
- return (FileFilter[]) choosableFilters.toArray(new FileFilter[0]);
+ return (FileFilter[]) choosableFilters.toArray(new FileFilter[choosableFilters.size()]);
}
/**
- * DOCUMENT ME!
+ * Adds a file filter to the list of available filters and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param filter DOCUMENT ME!
+ * @param filter the filter.
*/
public void addChoosableFileFilter(FileFilter filter)
{
@@ -732,11 +969,15 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Removes a file filter from the list of available filters and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param f DOCUMENT ME!
+ * @param f the file filter.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the filter was removed and
+ * <code>false</code> otherwise.
*/
public boolean removeChoosableFileFilter(FileFilter f)
{
@@ -749,7 +990,8 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Clears the list of choosable file filters and installs the 'accept all'
+ * filter from the UI delegate.
*/
public void resetChoosableFileFilters()
{
@@ -759,9 +1001,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the 'accept all' file filter from the UI delegate.
*
- * @return DOCUMENT ME!
+ * @return The 'accept all' file filter.
*/
public FileFilter getAcceptAllFileFilter()
{
@@ -769,9 +1011,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the flag that controls whether or not the 'accept all' file
+ * filter is included in the list of filters.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setAcceptAllFileFilterUsed(boolean)
*/
public boolean isAcceptAllFileFilterUsed()
{
@@ -779,9 +1024,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether or not the 'accept all' file filter
+ * is included in the list of filters, and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value of the flag.
*/
public void setAcceptAllFileFilterUsed(boolean b)
{
@@ -794,9 +1043,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the accessory component for the file chooser. The default
+ * value is <code>null</code>.
*
- * @return DOCUMENT ME!
+ * @return The accessory component (possibly <code>null</code>).
+ *
+ * @see #setAccessory(JComponent)
*/
public JComponent getAccessory()
{
@@ -804,9 +1056,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the accessory component for the file chooser and sends a
+ * {@link PropertyChangeEvent} to all registered listeners. The property
+ * name is {@link #ACCESSORY_CHANGED_PROPERTY}.
*
- * @param newAccessory DOCUMENT ME!
+ * @param newAccessory the accessory component.
*/
public void setAccessory(JComponent newAccessory)
{
@@ -819,9 +1073,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the file selection mode and sends a {@link PropertyChangeEvent}
+ * to all registered listeners. The property name is
+ * {@link #FILE_SELECTION_MODE_CHANGED_PROPERTY}.
*
- * @param mode DOCUMENT ME!
+ * @param mode the mode ({@link #FILES_ONLY}, {@link #DIRECTORIES_ONLY} or
+ * {@link #FILES_AND_DIRECTORIES}).
+ *
+ * @throws IllegalArgumentException if the mode is invalid.
*/
public void setFileSelectionMode(int mode)
{
@@ -838,9 +1097,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the file selection mode, one of: {@link #FILES_ONLY},
+ * {@link #DIRECTORIES_ONLY} or {@link #FILES_AND_DIRECTORIES}. The
+ * default is {@link #FILES_ONLY}.
*
- * @return DOCUMENT ME!
+ * @return The file selection mode.
+ *
+ * @see #setFileSelectionMode(int)
*/
public int getFileSelectionMode()
{
@@ -848,9 +1111,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if file selection is enabled, and
+ * <code>false</code> otherwise. File selection is enabled when the
+ * file selection mode is {@link #FILES_ONLY} or
+ * {@link #FILES_AND_DIRECTORIES}.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if file selection is enabled.
+ *
+ * @see #getFileSelectionMode()
*/
public boolean isFileSelectionEnabled()
{
@@ -859,9 +1127,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if directory selection is enabled, and
+ * <code>false</code> otherwise. Directory selection is enabled when the
+ * file selection mode is {@link #DIRECTORIES_ONLY} or
+ * {@link #FILES_AND_DIRECTORIES}.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if file selection is enabled.
+ *
+ * @see #getFileSelectionMode()
*/
public boolean isDirectorySelectionEnabled()
{
@@ -870,9 +1143,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether multiple selections are allowed in
+ * this filechooser and sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #MULTI_SELECTION_ENABLED_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value of the flag.
*/
public void setMultiSelectionEnabled(boolean b)
{
@@ -885,9 +1161,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if multiple selections are allowed within this
+ * file chooser, and <code>false</code> otherwise.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setMultiSelectionEnabled(boolean)
*/
public boolean isMultiSelectionEnabled()
{
@@ -895,9 +1174,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if hidden files are to be hidden, and
+ * <code>false</code> otherwise.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setFileHidingEnabled(boolean)
*/
public boolean isFileHidingEnabled()
{
@@ -905,9 +1187,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether or not hidden files are displayed,
+ * and sends a {@link PropertyChangeEvent} (with the property name
+ * {@link #FILE_HIDING_CHANGED_PROPERTY}) to all registered listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value of the flag.
*/
public void setFileHidingEnabled(boolean b)
{
@@ -920,9 +1204,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the file filter and sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #FILE_FILTER_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param filter DOCUMENT ME!
+ * @param filter the filter.
*/
public void setFileFilter(FileFilter filter)
{
@@ -935,9 +1221,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the file filter.
*
- * @return DOCUMENT ME!
+ * @return The file filter.
+ *
+ * @see #setFileFilter(FileFilter)
*/
public FileFilter getFileFilter()
{
@@ -945,9 +1233,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets a custom {@link FileView} for the file chooser and sends a
+ * {@link PropertyChangeEvent} to all registered listeners. The property
+ * name is {@link #FILE_VIEW_CHANGED_PROPERTY}.
+ *
+ * @param fileView the file view (<code>null</code> permitted).
*
- * @param fileView DOCUMENT ME!
+ * @see #getFileView()
*/
public void setFileView(FileView fileView)
{
@@ -960,9 +1252,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the custom {@link FileView} for the file chooser.
*
- * @return DOCUMENT ME!
+ * @return The file view (possibly <code>null</code>).
*/
public FileView getFileView()
{
@@ -970,71 +1262,83 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the name of the file, generated by the current (or default)
+ * {@link FileView}.
*
- * @return DOCUMENT ME!
- */
- private FileView getInternalFileView()
- {
- if (fv == null)
- return getUI().getFileView(this);
- return fv;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return The file name.
*/
public String getName(File f)
{
- return getInternalFileView().getName(f);
+ String name = null;
+ if (fv != null)
+ name = fv.getName(f);
+ if (name == null)
+ name = getUI().getFileView(this).getName(f);
+ return name;
}
/**
- * DOCUMENT ME!
+ * Returns the description of the file, generated by the current (or default)
+ * {@link FileView}.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return The file description.
*/
public String getDescription(File f)
{
- return getInternalFileView().getDescription(f);
+ String result = null;
+ if (fv != null)
+ result = fv.getDescription(f);
+ if (result == null)
+ result = getUI().getFileView(this).getDescription(f);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns the type description for the file, generated by the current (or
+ * default) {@link FileView}.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return The file type description.
*/
public String getTypeDescription(File f)
{
- return getInternalFileView().getTypeDescription(f);
+ String result = null;
+ if (fv != null)
+ result = getFileView().getTypeDescription(f);
+ if (result == null)
+ result = getUI().getFileView(this).getTypeDescription(f);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns the icon provided by the current (or default) {@link FileView}.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return An icon representing the file.
*/
public Icon getIcon(File f)
{
- return getInternalFileView().getIcon(f);
+ Icon result = null;
+ if (fv != null)
+ result = fv.getIcon(f);
+ if (result == null)
+ result = getUI().getFileView(this).getIcon(f);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file or directory.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
*/
public boolean isTraversable(File f)
{
@@ -1042,11 +1346,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is accepted by the current
+ * file filter.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
*/
public boolean accept(File f)
{
@@ -1056,9 +1361,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the file system view for the file chooser and sends a
+ * {@link PropertyChangeEvent} to all registered listeners.
*
- * @param fsv DOCUMENT ME!
+ * @param fsv the file system view.
*/
public void setFileSystemView(FileSystemView fsv)
{
@@ -1071,9 +1377,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the file system view being used by this file chooser.
*
- * @return DOCUMENT ME!
+ * @return The file system view.
+ *
+ * @see #setFileSystemView(FileSystemView)
*/
public FileSystemView getFileSystemView()
{
@@ -1081,7 +1389,8 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Approves the selection. An {@link ActionEvent} is sent to all registered
+ * listeners.
*/
public void approveSelection()
{
@@ -1090,7 +1399,8 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Cancels the selection. An {@link ActionEvent} is sent to all registered
+ * listeners.
*/
public void cancelSelection()
{
@@ -1099,9 +1409,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Adds an {@link ActionListener} to the file chooser.
*
- * @param l DOCUMENT ME!
+ * @param l the listener.
*/
public void addActionListener(ActionListener l)
{
@@ -1109,9 +1419,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Removes an {@link ActionListener} from this file chooser.
*
- * @param l DOCUMENT ME!
+ * @param l the listener.
*/
public void removeActionListener(ActionListener l)
{
@@ -1126,9 +1436,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the action listeners registered with this file chooser.
*
- * @return DOCUMENT ME!
+ * @return An array of listeners.
*/
public ActionListener[] getActionListeners()
{
@@ -1136,9 +1446,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sends an @link {ActionEvent} to all registered listeners.
*
- * @param command DOCUMENT ME!
+ * @param command the action command.
*/
protected void fireActionPerformed(String command)
{
@@ -1151,7 +1461,7 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Installs the UI delegate for the current look and feel.
*/
public void updateUI()
{
@@ -1160,9 +1470,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the UI delegate class identifier.
*
- * @return DOCUMENT ME!
+ * @return <code>FileChooserUI</code>.
*/
public String getUIClassID()
{
@@ -1170,9 +1480,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the UI delegate for the component.
*
- * @return DOCUMENT ME!
+ * @return The UI delegate.
*/
public FileChooserUI getUI()
{
@@ -1190,12 +1500,29 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the accessible context.
*
- * @return DOCUMENT ME!
+ * @return The accessible context.
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ return new AccessibleJFileChooser();
+ }
+
+ /**
+ * Accessibility support for JFileChooser
+ */
+ protected class AccessibleJFileChooser
+ extends JComponent.AccessibleJComponent
+ {
+ protected AccessibleJFileChooser()
+ {
+ // Nothing to do here.
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.FILE_CHOOSER;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/JFrame.java b/libjava/classpath/javax/swing/JFrame.java
index 7081f5980e4..8d4dcb53b3c 100644
--- a/libjava/classpath/javax/swing/JFrame.java
+++ b/libjava/classpath/javax/swing/JFrame.java
@@ -50,6 +50,7 @@ import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
/**
@@ -65,8 +66,31 @@ import javax.accessibility.AccessibleContext;
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
public class JFrame extends Frame
- implements WindowConstants, RootPaneContainer
+ implements WindowConstants, RootPaneContainer, Accessible
{
+ /**
+ * Provides accessibility support for <code>JFrame</code>s.
+ */
+ protected class AccessibleJFrame extends Frame.AccessibleAWTFrame
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJFrame</code>.
+ */
+ public AccessibleJFrame()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * A flag for {@link #setDefaultCloseOperation(int)}, indicating that the
+ * application should be exited, when this <code>JFrame</code> is closed.
+ *
+ * @since 1.3
+ */
+ public static final int EXIT_ON_CLOSE = 3;
+
private static final long serialVersionUID = -3362141868504252139L;
private static boolean defaultLookAndFeelDecorated;
private int close_action = HIDE_ON_CLOSE;
@@ -78,13 +102,6 @@ public class JFrame extends Frame
*/
protected boolean rootPaneCheckingEnabled = false;
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container.
- */
- private boolean initStageDone = false;
-
public JFrame()
{
super("JFrame");
@@ -134,7 +151,7 @@ public class JFrame extends Frame
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
getRootPane(); // will do set/create
// We're now done the init stage.
- initStageDone = true;
+ setRootPaneCheckingEnabled(true);
}
public Dimension getPreferredSize()
@@ -156,13 +173,8 @@ public class JFrame extends Frame
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + " instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -222,15 +234,10 @@ public class JFrame extends Frame
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp,constraints,index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("rootPaneChecking is enabled - adding components "
- + "disallowed.");
- getContentPane().add(comp,constraints,index);
- }
+ super.addImpl(comp, constraints, index);
}
public void remove(Component comp)
@@ -275,6 +282,8 @@ public class JFrame extends Frame
public AccessibleContext getAccessibleContext()
{
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJFrame();
return accessibleContext;
}
diff --git a/libjava/classpath/javax/swing/JInternalFrame.java b/libjava/classpath/javax/swing/JInternalFrame.java
index b504aaaa5e3..479294b1377 100644
--- a/libjava/classpath/javax/swing/JInternalFrame.java
+++ b/libjava/classpath/javax/swing/JInternalFrame.java
@@ -437,13 +437,6 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
protected boolean rootPaneCheckingEnabled = false;
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container.
- */
- private boolean initStageDone = false;
-
/** Whether the JInternalFrame is resizable. */
protected boolean resizable;
@@ -567,7 +560,7 @@ public class JInternalFrame extends JComponent implements Accessible,
storedBounds = new Rectangle();
setRootPane(createRootPane());
updateUI();
- initStageDone = true; // Done the init stage, now adds go to content pane.
+ setRootPaneCheckingEnabled(true); // Done the init stage, now adds go to content pane.
}
/**
@@ -587,15 +580,10 @@ public class JInternalFrame extends JComponent implements Accessible,
// If we're in the initialization stage use super.add. Here we add the
// rootPane as well as the title bar and other stuff.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp,constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not use add() on JInternalFrame directly. Use "
- + "getContentPane().add() instead");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp,constraints, index);
}
/**
@@ -1187,7 +1175,7 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
protected String paramString()
{
- return "JInternalFrame";
+ return super.paramString();
}
/**
@@ -1227,8 +1215,7 @@ public class JInternalFrame extends JComponent implements Accessible,
public void reshape(int x, int y, int width, int height)
{
super.reshape(x, y, width, height);
- invalidate();
- doLayout();
+ revalidate();
}
/**
@@ -1489,13 +1476,8 @@ public class JInternalFrame extends JComponent implements Accessible,
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + " instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -1678,7 +1660,12 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
public void setUI(InternalFrameUI ui)
{
+ // We must temporarily go into init mode so that the UI can directly
+ // manipulate the JInternalFrame.
+ boolean old = isRootPaneCheckingEnabled();
+ setRootPaneCheckingEnabled(false);
super.setUI(ui);
+ setRootPaneCheckingEnabled(old);
}
/**
@@ -1704,7 +1691,13 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
public void updateUI()
{
+ // We must go into the init stage when updating the UI, so the UI can
+ // set layout and components directly on the internal frame, not its
+ // content pane.
+ boolean old = isRootPaneCheckingEnabled();
+ setRootPaneCheckingEnabled(false);
setUI((InternalFrameUI) UIManager.getUI(this));
+ setRootPaneCheckingEnabled(old);
}
/**
diff --git a/libjava/classpath/javax/swing/JLabel.java b/libjava/classpath/javax/swing/JLabel.java
index 2e7ad98ddae..a9adc96b2f4 100644
--- a/libjava/classpath/javax/swing/JLabel.java
+++ b/libjava/classpath/javax/swing/JLabel.java
@@ -331,9 +331,6 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
/** The gap between the icon and the text. */
private transient int iconTextGap = 4;
- /** The accessible context for this JLabel. */
- private AccessibleJLabel accessibleContext;
-
/**
* Creates a new vertically centered, horizontally on the leading edge
* JLabel object with text and no icon.
@@ -403,6 +400,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
this.text = text;
this.icon = icon;
this.horizontalAlignment = horizontalAlignment;
+ setAlignmentX(0.0F);
updateUI();
}
@@ -477,12 +475,14 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
{
if (text != newText)
{
- String oldText = text;
- text = newText;
- firePropertyChange("text", oldText, newText);
-
- if (text != null && text.length() <= displayedMnemonicIndex)
- setDisplayedMnemonicIndex(text.length() - 1);
+ String oldText = text;
+ text = newText;
+ firePropertyChange("text", oldText, newText);
+
+ if (text != null && text.length() <= displayedMnemonicIndex)
+ setDisplayedMnemonicIndex(text.length() - 1);
+ revalidate();
+ repaint();
}
}
diff --git a/libjava/classpath/javax/swing/JLayeredPane.java b/libjava/classpath/javax/swing/JLayeredPane.java
index 1ea39dc5007..346570d95b1 100644
--- a/libjava/classpath/javax/swing/JLayeredPane.java
+++ b/libjava/classpath/javax/swing/JLayeredPane.java
@@ -38,14 +38,20 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* A container that adds depth to the usual <code>Container</code> semantics.
@@ -116,6 +122,30 @@ import javax.accessibility.Accessible;
*/
public class JLayeredPane extends JComponent implements Accessible
{
+
+ /**
+ * Provides accessibility support for <code>JLayeredPane</code>.
+ */
+ protected class AccessibleJLayeredPane extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJLayeredPane</code>.
+ */
+ public AccessibleJLayeredPane()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessble role of <code>JLayeredPane</code>,
+ * {@link AccessibleRole#LAYERED_PANE}.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LAYERED_PANE;
+ }
+ }
+
private static final long serialVersionUID = 5534920399324590459L;
public static final String LAYER_PROPERTY = "layeredContainerLayer";
@@ -131,13 +161,15 @@ public class JLayeredPane extends JComponent implements Accessible
TreeMap layers; // Layer Number (Integer) -> Layer Size (Integer)
Hashtable componentToLayer; // Component -> Layer Number (Integer)
+ private transient Rectangle rectCache;
+
public JLayeredPane()
{
layers = new TreeMap ();
componentToLayer = new Hashtable ();
+ setLayout(null);
}
-
/**
* Looks up the layer a child component is currently assigned to.
*
@@ -223,29 +255,37 @@ public class JLayeredPane extends JComponent implements Accessible
ret[1] = getComponents ().length;
Iterator i = layers.entrySet ().iterator ();
while (i.hasNext())
- {
+ {
Map.Entry pair = (Map.Entry) i.next();
Integer layerNum = (Integer) pair.getKey ();
Integer layerSz = (Integer) pair.getValue ();
- if (layerNum.intValue() == layer.intValue())
+ int layerInt = layerNum.intValue();
+ if (layerInt == layer.intValue())
{
ret[0] = ret[1] - layerSz.intValue ();
- return ret;
+ break;
+ }
+ // In the following case there exists no layer with the specified
+ // number, so we return an empty interval here with the index at which
+ // such a layer would be inserted
+ else if (layerInt > layer.intValue())
+ {
+ ret[1] = ret[0];
+ break;
}
else
{
ret[1] -= layerSz.intValue ();
}
- }
- // should have found the layer during iteration
- throw new IllegalArgumentException ();
+ }
+ return ret;
}
/**
* Increments the recorded size of a given layer.
*
* @param layer the layer number to increment.
- * @see #incrLayer()
+ * @see #incrLayer
*/
private void incrLayer(Integer layer)
{
@@ -259,7 +299,7 @@ public class JLayeredPane extends JComponent implements Accessible
* Decrements the recorded size of a given layer.
*
* @param layer the layer number to decrement.
- * @see #decrLayer()
+ * @see #incrLayer
*/
private void decrLayer(Integer layer)
{
@@ -546,26 +586,15 @@ public class JLayeredPane extends JComponent implements Accessible
*
* @param index the index of the child component to remove.
*/
- public void remove (int index)
+ public void remove(int index)
{
- Component c = getComponent (index);
- int layer = getLayer (c);
- decrLayer (new Integer(layer));
- componentToLayer.remove (c);
- super.remove (index);
+ Component c = getComponent(index);
+ int layer = getLayer(c);
+ decrLayer(new Integer(layer));
+ componentToLayer.remove(c);
+ super.remove(index);
+ // FIXME: Figure out if this call is correct.
revalidate();
- repaint();
- }
-
- /**
- * Removes a child from this container. The child is specified directly.
- * After removal, the child no longer occupies a layer.
- *
- * @param comp the child to remove.
- */
- public void remove (Component comp)
- {
- remove (getIndexOf (comp));
}
/**
@@ -613,7 +642,7 @@ public class JLayeredPane extends JComponent implements Accessible
* @param index an ignored parameter, for compatibility.
*/
protected void addImpl(Component comp, Object layerConstraint, int index)
- {
+ {
Integer layer;
if (layerConstraint != null && layerConstraint instanceof Integer)
layer = (Integer) layerConstraint;
@@ -627,10 +656,8 @@ public class JLayeredPane extends JComponent implements Accessible
componentToLayer.put (comp, layer);
incrLayer (layer);
- super.addImpl(comp, null, newIdx);
- revalidate();
- repaint();
- }
+ super.addImpl(comp, null, newIdx);
+ }
/**
* Sets the layer property for a JComponent.
@@ -642,4 +669,50 @@ public class JLayeredPane extends JComponent implements Accessible
{
getLayeredPaneAbove(component).setLayer(component, layer);
}
+
+ /**
+ * Returns the accessible context for this <code>JLayeredPane</code>.
+ *
+ * @return the accessible context for this <code>JLayeredPane</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJLayeredPane();
+ return accessibleContext;
+ }
+
+ /**
+ * This method is overridden order to provide a reasonable painting
+ * mechanism for <code>JLayeredPane</code>. This is necessary since
+ * <code>JLayeredPane</code>'s do not have an own UI delegate.
+ *
+ * Basically this method clears the background for the
+ * <code>JLayeredPane</code> and then calls <code>super.paint(g)</code>.
+ *
+ * @param g the graphics context to use
+ */
+ public void paint(Graphics g)
+ {
+ if (isOpaque())
+ {
+ Color oldColor = g.getColor();
+ Rectangle clip = g.getClipBounds();
+ g.setColor(getBackground());
+ g.fillRect(clip.x, clip.y, clip.width, clip.height);
+ g.setColor(oldColor);
+ }
+ super.paint(g);
+ }
+
+ /**
+ * Overridden to return <code>false</code>, since <code>JLayeredPane</code>
+ * cannot guarantee that its children don't overlap.
+ *
+ * @return <code>false</code>
+ */
+ public boolean isOptimizedDrawingEnabled()
+ {
+ return false;
+ }
}
diff --git a/libjava/classpath/javax/swing/JList.java b/libjava/classpath/javax/swing/JList.java
index 92fe1ccfa67..4f5d3cc72c5 100644
--- a/libjava/classpath/javax/swing/JList.java
+++ b/libjava/classpath/javax/swing/JList.java
@@ -41,13 +41,25 @@ package javax.swing;
import java.awt.Color;
import java.awt.Component;
import java.awt.ComponentOrientation;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
@@ -108,6 +120,736 @@ import javax.swing.text.Position;
public class JList extends JComponent implements Accessible, Scrollable
{
+
+ /**
+ * Provides accessibility support for <code>JList</code>.
+ */
+ protected class AccessibleJList extends AccessibleJComponent
+ implements AccessibleSelection, PropertyChangeListener,
+ ListSelectionListener, ListDataListener
+ {
+
+ /**
+ * Provides accessibility support for list elements in <code>JList</code>s.
+ */
+ protected class AccessibleJListChild extends AccessibleContext
+ implements Accessible, AccessibleComponent
+ {
+
+ /**
+ * The parent list.
+ */
+ JList parent;
+
+ /**
+ * The index in the list for that child.
+ */
+ int listIndex;
+
+ /**
+ * The cursor for this list child.
+ */
+ // TODO: Testcases show that this class somehow stores state about the
+ // cursor. I cannot make up though how that could affect
+ // the actual list.
+ Cursor cursor = Cursor.getDefaultCursor();
+
+ /**
+ * Creates a new instance of <code>AccessibleJListChild</code>.
+ *
+ * @param list the list of which this is an accessible child
+ * @param index the list index for this child
+ */
+ public AccessibleJListChild(JList list, int index)
+ {
+ parent = list;
+ listIndex = index;
+ }
+
+ /**
+ * Returns the accessible context of this object. Returns
+ * <code>this</code> since <code>AccessibleJListChild</code>s are their
+ * own accessible contexts.
+ *
+ * @return the accessible context of this object, <code>this</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the background color for this list child. This returns the
+ * background of the <code>JList</code> itself since the background
+ * cannot be set on list children individually
+ *
+ * @return the background color for this list child
+ */
+ public Color getBackground()
+ {
+ return parent.getBackground();
+ }
+
+ /**
+ * Calling this method has no effect, since the background color cannot be
+ * set on list children individually.
+ *
+ * @param color not used here.
+ */
+ public void setBackground(Color color)
+ {
+ // Calling this method has no effect, since the background color cannot
+ // be set on list children individually.
+ }
+
+ /**
+ * Returns the foreground color for this list child. This returns the
+ * background of the <code>JList</code> itself since the foreground
+ * cannot be set on list children individually.
+ *
+ * @return the background color for this list child
+ */
+ public Color getForeground()
+ {
+ return parent.getForeground();
+ }
+
+ /**
+ * Calling this method has no effect, since the foreground color cannot be
+ * set on list children individually.
+ *
+ * @param color not used here.
+ */
+ public void setForeground(Color color)
+ {
+ // Calling this method has no effect, since the foreground color cannot
+ // be set on list children individually.
+ }
+
+ /**
+ * Returns the cursor for this list child.
+ *
+ * @return the cursor for this list child
+ */
+ public Cursor getCursor()
+ {
+ // TODO: Testcases show that this method returns the cursor that has
+ // been set by setCursor. I cannot make up though how that could affect
+ // the actual list.
+ return cursor;
+ }
+
+ /**
+ * Sets the cursor for this list child.
+ */
+ public void setCursor(Cursor cursor)
+ {
+ this.cursor = cursor;
+ // TODO: Testcases show that this method returns the cursor that has
+ // been set by setCursor. I cannot make up though how that could affect
+ // the actual list.
+ }
+
+ /**
+ * Returns the font of the <code>JList</code> since it is not possible to
+ * set fonts for list children individually.
+ *
+ * @return the font of the <code>JList</code>
+ */
+ public Font getFont()
+ {
+ return parent.getFont();
+ }
+
+ /**
+ * Does nothing since it is not possible to set the font on list children
+ * individually.
+ *
+ * @param font not used here
+ */
+ public void setFont(Font font)
+ {
+ // Does nothing since it is not possible to set the font on list
+ // children individually.
+ }
+
+ /**
+ * Returns the font metrics for the specified font. This method forwards
+ * to the parent <code>JList</code>.
+ *
+ * @param font the font for which the font metrics is queried
+ *
+ * @return the font metrics for the specified font
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return parent.getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if the parent <code>JList</code> is enabled,
+ * <code>false</code> otherwise. The list children cannot have an enabled
+ * flag set individually.
+ *
+ * @return <code>true</code> if the parent <code>JList</code> is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean isEnabled()
+ {
+ return parent.isEnabled();
+ }
+
+ /**
+ * Does nothing since the enabled flag cannot be set for list children
+ * individually.
+ *
+ * @param b not used here
+ */
+ public void setEnabled(boolean b)
+ {
+ // Does nothing since the enabled flag cannot be set for list children
+ // individually.
+ }
+
+ /**
+ * Returns <code>true</code> if this list child is visible,
+ * <code>false</code> otherwise. The value of this property depends
+ * on {@link JList#getFirstVisibleIndex()} and
+ * {@link JList#getLastVisibleIndex()}.
+ *
+ * @return <code>true</code> if this list child is visible,
+ * <code>false</code> otherwise
+ */
+ public boolean isVisible()
+ {
+ return listIndex >= parent.getFirstVisibleIndex()
+ && listIndex <= parent.getLastVisibleIndex();
+ }
+
+ /**
+ * The value of the visible property cannot be modified, so this method
+ * does nothing.
+ *
+ * @param b not used here
+ */
+ public void setVisible(boolean b)
+ {
+ // The value of the visible property cannot be modified, so this method
+ // does nothing.
+ }
+
+ /**
+ * Returns <code>true</code> if this list child is currently showing on
+ * screen and <code>false</code> otherwise. The list child is showing if
+ * it is visible and if it's parent JList is currently showing.
+ *
+ * @return <code>true</code> if this list child is currently showing on
+ * screen and <code>false</code> otherwise
+ */
+ public boolean isShowing()
+ {
+ return isVisible() && parent.isShowing();
+ }
+
+ /**
+ * Returns <code>true</code> if this list child covers the screen location
+ * <code>point</code> (relative to the <code>JList</code> coordinate
+ * system, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this list child covers the screen location
+ * <code>point</code> , <code>false</code> otherwise
+ */
+ public boolean contains(Point point)
+ {
+ return getBounds().contains(point);
+ }
+
+ /**
+ * Returns the absolute screen location of this list child.
+ *
+ * @return the absolute screen location of this list child
+ */
+ public Point getLocationOnScreen()
+ {
+ Point loc = getLocation();
+ SwingUtilities.convertPointToScreen(loc, parent);
+ return loc;
+ }
+
+ /**
+ * Returns the screen location of this list child relative to it's parent.
+ *
+ * @return the location of this list child relative to it's parent
+ *
+ * @see JList#indexToLocation(int)
+ */
+ public Point getLocation()
+ {
+ return parent.indexToLocation(listIndex);
+ }
+
+ /**
+ * Does nothing since the screen location cannot be set on list children
+ * explictitly.
+ *
+ * @param point not used here
+ */
+ public void setLocation(Point point)
+ {
+ // Does nothing since the screen location cannot be set on list children
+ // explictitly.
+ }
+
+ /**
+ * Returns the bounds of this list child.
+ *
+ * @return the bounds of this list child
+ *
+ * @see JList#getCellBounds(int, int)
+ */
+ public Rectangle getBounds()
+ {
+ return parent.getCellBounds(listIndex, listIndex);
+ }
+
+ /**
+ * Does nothing since the bounds cannot be set on list children
+ * individually.
+ *
+ * @param rectangle not used here
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ // Does nothing since the bounds cannot be set on list children
+ // individually.
+ }
+
+ /**
+ * Returns the size of this list child.
+ *
+ * @return the size of this list child
+ */
+ public Dimension getSize()
+ {
+ Rectangle b = getBounds();
+ return b.getSize();
+ }
+
+ /**
+ * Does nothing since the size cannot be set on list children
+ * individually.
+ *
+ * @param dimension not used here
+ */
+ public void setSize(Dimension dimension)
+ {
+ // Does nothing since the size cannot be set on list children
+ // individually.
+ }
+
+ /**
+ * Returns <code>null</code> because list children do not have children
+ * themselves
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> since list children are focus traversable.
+ *
+ * @return true
+ */
+ public boolean isFocusTraversable()
+ {
+ // TODO: Is this 100% ok?
+ return true;
+ }
+
+ /**
+ * Requests focus on the parent list. List children cannot request focus
+ * individually.
+ */
+ public void requestFocus()
+ {
+ // TODO: Is this 100% ok?
+ parent.requestFocus();
+ }
+
+ /**
+ * Adds a focus listener to the parent list. List children do not have
+ * their own focus management.
+ *
+ * @param listener the focus listener to add
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ // TODO: Is this 100% ok?
+ parent.addFocusListener(listener);
+ }
+
+ /**
+ * Removes a focus listener from the parent list. List children do not
+ * have their own focus management.
+ *
+ * @param listener the focus listener to remove
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ // TODO: Is this 100%
+ parent.removeFocusListener(listener);
+ }
+
+ /**
+ * Returns the accessible role of this list item, which is
+ * {@link AccessibleRole#LABEL}.
+ *
+ * @return {@link AccessibleRole#LABEL}
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LABEL;
+ }
+
+ /**
+ * Returns the accessible state set of this list item.
+ *
+ * @return the accessible state set of this list item
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet states = new AccessibleStateSet();
+ if (isVisible())
+ states.add(AccessibleState.VISIBLE);
+ if (isShowing())
+ states.add(AccessibleState.SHOWING);
+ if (isFocusTraversable())
+ states.add(AccessibleState.FOCUSABLE);
+ // TODO: How should the active state be handled? The API docs
+ // suggest that this state is set on the activated list child,
+ // that is the one that is drawn with a box. However, I don't know how
+ // to implement this.
+
+ // TODO: We set the selectable state here because list children are
+ // selectable. Is there a way to disable single children?
+ if (parent.isEnabled())
+ states.add(AccessibleState.SELECTABLE);
+
+ if (parent.isSelectedIndex(listIndex))
+ states.add(AccessibleState.SELECTED);
+
+ // TODO: Handle more states here?
+ return states;
+ }
+
+ /**
+ * Returns the index of this list child within it's parent list.
+ *
+ * @return the index of this list child within it's parent list
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return listIndex;
+ }
+
+ /**
+ * Returns <code>0</code> since list children don't have children
+ * themselves.
+ *
+ * @return <code>0</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns <code>null</code> since list children don't have children
+ * themselves.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the locale of this component. This call is forwarded to the
+ * parent list since list children don't have a separate locale setting.
+ *
+ * @return the locale of this component
+ */
+ public Locale getLocale()
+ {
+ return parent.getLocale();
+ }
+
+ /**
+ * This method does
+ * nothing, list children are transient accessible objects which means
+ * that they don't fire property change events.
+ *
+ * @param l not used here
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * This method does
+ * nothing, list children are transient accessible objects which means
+ * that they don't fire property change events.
+ *
+ * @param l not used here
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ // Do nothing here.
+ }
+
+ // TODO: Implement the remaining methods of this class.
+ }
+
+ /**
+ * Create a new AccessibleJList.
+ */
+ public AccessibleJList()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the number of selected accessible children.
+ *
+ * @return the number of selected accessible children
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectedIndices().length;
+ }
+
+ /**
+ * Returns the n-th selected accessible child.
+ *
+ * @param n the index of the selected child to return
+ *
+ * @return the n-th selected accessible child
+ */
+ public Accessible getAccessibleSelection(int n)
+ {
+ return new AccessibleJListChild(JList.this, getSelectedIndices()[n]);
+ }
+
+ /**
+ * Returns <code>true</code> if the n-th child is selected,
+ * <code>false</code> otherwise.
+ *
+ * @param n the index of the child of which the selected state is queried
+ *
+ * @return <code>true</code> if the n-th child is selected,
+ * <code>false</code> otherwise
+ */
+ public boolean isAccessibleChildSelected(int n)
+ {
+ return isSelectedIndex(n);
+ }
+
+ /**
+ * Adds the accessible item with the specified index to the selected items.
+ * If multiple selections are supported, the item is added to the selection,
+ * otherwise the item replaces the current selection.
+ *
+ * @param i the index of the item to add to the selection
+ */
+ public void addAccessibleSelection(int i)
+ {
+ addSelectionInterval(i, i);
+ }
+
+ /**
+ * Removes the accessible item with the specified index to the selection.
+ *
+ * @param i the index of the item to be removed from the selection
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ removeSelectionInterval(i, i);
+ }
+
+ /**
+ * Remove all selection items from the selection.
+ */
+ public void clearAccessibleSelection()
+ {
+ clearSelection();
+ }
+
+ /**
+ * Selects all items if multiple selections are supported.
+ * Otherwise do nothing.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ addSelectionInterval(0, getModel().getSize());
+ }
+
+ /**
+ * Receices notification when the list selection is changed. This method
+ * fires two property change events, the first with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY} and the second
+ * with {@link AccessibleContext#ACCESSIBLE_SELECTION_PROPERTY}.
+ *
+ * @param event the list selection event
+ */
+ public void valueChanged(ListSelectionEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ firePropertyChange(ACCESSIBLE_SELECTION_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+ /**
+ * Receives notification when items have changed in the
+ * <code>JList</code>. This method fires a property change event with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY}.
+ *
+ * @param event the list data event
+ */
+ public void contentsChanged(ListDataEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+ /**
+ * Receives notification when items are inserted into the
+ * <code>JList</code>. This method fires a property change event with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY}.
+ *
+ * @param event the list data event
+ */
+ public void intervalAdded(ListDataEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+ /**
+ * Receives notification when items are removed from the
+ * <code>JList</code>. This method fires a property change event with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY}.
+ *
+ * @param event the list data event
+ */
+ public void intervalRemoved(ListDataEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+
+ /**
+ * Receives notification about changes of the <code>JList</code>'s
+ * properties. This is used to re-register this object as listener to
+ * the data model and selection model when the data model or selection model
+ * changes.
+ *
+ * @param e the property change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propertyName = e.getPropertyName();
+ if (propertyName.equals("model"))
+ {
+ ListModel oldModel = (ListModel) e.getOldValue();
+ oldModel.removeListDataListener(this);
+ ListModel newModel = (ListModel) e.getNewValue();
+ newModel.addListDataListener(this);
+ }
+ else if (propertyName.equals("selectionModel"))
+ {
+ ListSelectionModel oldModel = (ListSelectionModel) e.getOldValue();
+ oldModel.removeListSelectionListener(this);
+ ListSelectionModel newModel = (ListSelectionModel) e.getNewValue();
+ oldModel.addListSelectionListener(this);
+ }
+ }
+
+ /**
+ * Return the state set of the <code>JList</code>.
+ *
+ * @return the state set of the <code>JList</code>
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // TODO: Figure out if there is possibly more state that must be
+ // handled here.
+ AccessibleStateSet s = super.getAccessibleStateSet();
+ if (getSelectionMode() != ListSelectionModel.SINGLE_SELECTION)
+ s.add(AccessibleState.MULTISELECTABLE);
+ return s;
+ }
+
+ /**
+ * Returns the accessible role for <code>JList</code>,
+ * {@link AccessibleRole#LIST}.
+ *
+ * @return the accessible role for <code>JList</code>
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LIST;
+ }
+
+ /**
+ * Returns the accessible child at the visual location <code>p</code>
+ * (relative to the upper left corner of the <code>JList</code>). If there
+ * is no child at that location, this returns <code>null</code>.
+ *
+ * @param p the screen location for which to return the accessible child
+ *
+ * @return the accessible child at the specified location, or
+ * <code>null</code> if there is no child at that location
+ */
+ public Accessible getAccessibleAt(Point p)
+ {
+ int childIndex = locationToIndex(p);
+ return getAccessibleChild(childIndex);
+ }
+
+ /**
+ * Returns the number of accessible children in the <code>JList</code>.
+ *
+ * @return the number of accessible children in the <code>JList</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return getModel().getSize();
+ }
+
+ /**
+ * Returns the n-th accessible child of this <code>JList</code>. This will
+ * be an instance of {@link AccessibleJListChild}. If there is no child
+ * at that index, <code>null</code> is returned.
+ *
+ * @param n the index of the child to return
+ *
+ * @return the n-th accessible child of this <code>JList</code>
+ */
+ public Accessible getAccessibleChild(int n)
+ {
+ if (getModel().getSize() <= n)
+ return null;
+ return new AccessibleJListChild(JList.this, n);
+ }
+ }
+
private static final long serialVersionUID = 4406629526391098046L;
/**
@@ -181,7 +923,7 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* This property specifies a foreground color for the selected cells in
- * the list. When {@link ListCellRenderer.getListCellRendererComponent}
+ * the list. When {@link ListCellRenderer#getListCellRendererComponent}
* is called with a selected cell object, the component returned will
* have its "foreground" set to this color.
*/
@@ -189,7 +931,7 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* This property specifies a background color for the selected cells in
- * the list. When {@link ListCellRenderer.getListCellRendererComponent}
+ * the list. When {@link ListCellRenderer#getListCellRendererComponent}
* is called with a selected cell object, the component returned will
* have its "background" property set to this color.
*/
@@ -216,9 +958,9 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* This property indicates a <em>preference</em> for the number of rows
* displayed in the list, and will scale the
- * {@link #preferredScrollableViewportSize} property accordingly. The actual
+ * {@link #getPreferredScrollableViewportSize} property accordingly. The actual
* number of displayed rows, when the list is placed in a real {@link
- * Viewport} or other component, may be greater or less than this number.
+ * JViewport} or other component, may be greater or less than this number.
*/
int visibleRowCount;
@@ -270,7 +1012,7 @@ public class JList extends JComponent implements Accessible, Scrollable
event.getValueIsAdjusting());
JList.this.repaint();
}
- };
+ }
/**
* Shared ListListener instance, subscribed to both the current {@link
@@ -437,7 +1179,7 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* Sets the value of the {@link #visibleRowCount} property.
*
- * @param visibleRowCount The new property value
+ * @param vc The new property value
*/
public void setVisibleRowCount(int vc)
{
@@ -563,8 +1305,8 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* Returns the list index of the upper left or upper right corner of the
- * {@link #visibleRect} property, depending on the {@link
- * #componentOrientation} property.
+ * visible rectangle of this list, depending on the {@link
+ * Component#getComponentOrientation} property.
*
* @return The index of the first visible list cell, or <code>-1</code>
* if none is visible.
@@ -585,7 +1327,8 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @return index of the cell to which specified location is closest to.
*/
- public int locationToIndex(Point location) {
+ public int locationToIndex(Point location)
+ {
return getUI().locationToIndex(this, location);
}
@@ -595,14 +1338,15 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @return location of the cell located at the specified index in the list.
*/
- public Point indexToLocation(int index){
- return getCellBounds(index, index).getLocation();
+ public Point indexToLocation(int index)
+ {
+ return getUI().indexToLocation(this, index);
}
/**
* Returns the list index of the lower right or lower left corner of the
- * {@link #visibleRect} property, depending on the {@link
- * #componentOrientation} property.
+ * visible rectangle of this list, depending on the {@link
+ * Component#getComponentOrientation} property.
*
* @return The index of the last visible list cell, or <code>-1</code>
* if none is visible.
@@ -625,7 +1369,7 @@ public class JList extends JComponent implements Accessible, Scrollable
* selected.
*
* @return An array of model indices, each of which is selected according
- * to the {@link #selection} property
+ * to the {@link #getSelectedValues} property
*/
public int[] getSelectedIndices()
{
@@ -640,7 +1384,7 @@ public class JList extends JComponent implements Accessible, Scrollable
n++;
int [] v = new int[n];
j = 0;
- for (i = lo; i < hi; ++i)
+ for (i = lo; i <= hi; ++i)
if (selectionModel.isSelectedIndex(i))
v[j++] = i;
return v;
@@ -670,7 +1414,7 @@ public class JList extends JComponent implements Accessible, Scrollable
* @return The first selected element, or <code>null</code> if no element
* is selected.
*
- * @see getSelectedValues
+ * @see #getSelectedValues
*/
public Object getSelectedValue()
{
@@ -686,7 +1430,7 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @return An array containing all the selected values
*
- * @see getSelectedValue
+ * @see #setSelectedValue
*/
public Object[] getSelectedValues()
{
@@ -845,7 +1589,7 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
- * Sets the value of the {@link #celLRenderer} property.
+ * Sets the value of the {@link #getCellRenderer} property.
*
* @param renderer The new property value
*/
@@ -876,10 +1620,15 @@ public class JList extends JComponent implements Accessible, Scrollable
* #listListener} is unsubscribed from the existing model, if it exists,
* and re-subscribed to the new model.
*
- * @param model The new property value
+ * @param model the new model (<code>null</code> not permitted).
+ *
+ * @throws IllegalArgumentException if <code>model</code> is
+ * <code>null</code>.
*/
public void setModel(ListModel model)
{
+ if (model == null)
+ throw new IllegalArgumentException("Null 'model' argument.");
if (this.model == model)
return;
@@ -1019,14 +1768,14 @@ public class JList extends JComponent implements Accessible, Scrollable
public AccessibleContext getAccessibleContext()
{
- return null;
+ return new AccessibleJList();
}
/**
* Returns a size indicating how much space this list would like to
* consume, when contained in a scrollable viewport. This is part of the
* {@link Scrollable} interface, which interacts with {@link
- * ScrollPaneLayout} and {@link Viewport} to define scrollable objects.
+ * ScrollPaneLayout} and {@link JViewport} to define scrollable objects.
*
* @return The preferred size
*/
@@ -1036,36 +1785,43 @@ public class JList extends JComponent implements Accessible, Scrollable
//return the value from getPreferredSize. The current ListUI is
//expected to override getPreferredSize to return an appropriate value.
if (getLayoutOrientation() != VERTICAL)
- return getPreferredSize();
+ return getPreferredSize();
+
+ int size = getModel().getSize();
+ // Trivial case: if fixedCellWidth and fixedCellHeight were set
+ // just use them
if (fixedCellHeight != -1 && fixedCellWidth != -1)
- return new Dimension(fixedCellWidth, getModel().getSize() *
- fixedCellHeight);
+ return new Dimension(fixedCellWidth, size * fixedCellHeight);
+
+ // If the model is empty we use 16 * the number of visible rows
+ // for the height and either fixedCellWidth (if set) or 256
+ // for the width
+ if (size == 0)
+ {
+ if (fixedCellWidth == -1)
+ return new Dimension(256, 16 * getVisibleRowCount());
+ else
+ return new Dimension(fixedCellWidth, 16 * getVisibleRowCount());
+ }
- int prefWidth, prefHeight;
+ // Calculate the width: if fixedCellWidth was set use that, otherwise
+ // use the preferredWidth
+ int prefWidth;
if (fixedCellWidth != -1)
prefWidth = fixedCellWidth;
else
- {
- prefWidth = 0;
- int size = getModel().getSize();
- for (int i = 0; i < size; i++)
- if (getCellBounds(i, i).width > prefWidth)
- prefWidth = getCellBounds(i, i).width;
- }
-
- if (getModel().getSize() == 0 && fixedCellWidth == -1)
- return new Dimension(256, 16 * getVisibleRowCount());
- else if (getModel().getSize() == 0)
- return new Dimension (fixedCellWidth, 16 * getVisibleRowCount());
-
+ prefWidth = getPreferredSize().width;
+
+ // Calculate the height: if fixedCellHeight was set use that, otherwise
+ // use the height of the first row multiplied by the number of visible
+ // rows
+ int prefHeight;
if (fixedCellHeight != -1)
prefHeight = fixedCellHeight;
else
- {
- prefHeight = getVisibleRowCount() * getCellBounds
- (getFirstVisibleIndex(), getFirstVisibleIndex()).height;
- }
+ prefHeight = getVisibleRowCount() * getCellBounds(0, 0).height;
+
return new Dimension (prefWidth, prefHeight);
}
@@ -1196,7 +1952,7 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
- * Gets the value of the {@link #scrollableTracksViewportWidth} property.
+ * Gets the value of the <code>scrollableTracksViewportWidth</code> property.
*
* @return <code>true</code> if the viewport is larger (horizontally)
* than the list and the list should be expanded to fit the viewport;
@@ -1221,7 +1977,7 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
- * Gets the value of the {@link #scrollableTracksViewportWidth} property.
+ * Gets the value of the </code>scrollableTracksViewportWidth</code> property.
*
* @return <code>true</code> if the viewport is larger (vertically)
* than the list and the list should be expanded to fit the viewport;
@@ -1373,7 +2129,7 @@ public class JList extends JComponent implements Accessible, Scrollable
*/
public Rectangle getCellBounds(int index0, int index1)
{
- return ((ListUI) ui).getCellBounds(this, index0, index1);
+ return getUI().getCellBounds(this, index0, index1);
}
/**
@@ -1383,8 +2139,8 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @param prefix the prefix to search for in the cell values
* @param startIndex the index where to start searching from
- * @param bias the search direction, either {@link Position.Bias.Forward}
- * or {@link Position.Bias.Backward}
+ * @param bias the search direction, either {@link Position.Bias#Forward}
+ * or {@link Position.Bias#Backward}
*
* @return the index of the found element or -1 if no such element has
* been found
diff --git a/libjava/classpath/javax/swing/JMenu.java b/libjava/classpath/javax/swing/JMenu.java
index 8dcad8b77cd..9734eb8732f 100644
--- a/libjava/classpath/javax/swing/JMenu.java
+++ b/libjava/classpath/javax/swing/JMenu.java
@@ -45,8 +45,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventListener;
@@ -137,10 +135,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
this(text);
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* Adds specified menu item to this menu
*
@@ -768,6 +762,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
protected void processKeyEvent(KeyEvent event)
{
+ // TODO: Implement this properly.
}
/**
@@ -812,6 +807,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
return accessibleContext;
}
+ // FIXME: This inner class is a complete stub and needs to be implemented.
protected class AccessibleJMenu extends AccessibleJMenuItem
implements AccessibleSelection
{
@@ -819,6 +815,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
protected AccessibleJMenu()
{
+ // Nothing to do here.
}
public int getAccessibleChildrenCount()
@@ -858,32 +855,48 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
public void addAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void removeAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void clearAccessibleSelection()
{
+ // TODO: Implement this properly.
}
public void selectAllAccessibleSelection()
{
+ // TODO: Implement this properly.
}
}
protected class WinListener extends WindowAdapter implements Serializable
{
- JPopupMenu popupMenu;
private static final long serialVersionUID = -6415815570638474823L;
+ /**
+ * Creates a new <code>WinListener</code>.
+ *
+ * @param popup the popup menu which is observed
+ */
public WinListener(JPopupMenu popup)
{
+ // TODO: What should we do with the popup argument?
}
+ /**
+ * Receives notification when the popup menu is closing and deselects
+ * the menu.
+ *
+ * @param event the window event
+ */
public void windowClosing(WindowEvent event)
{
+ setSelected(false);
}
}
diff --git a/libjava/classpath/javax/swing/JMenuBar.java b/libjava/classpath/javax/swing/JMenuBar.java
index eebb1a050be..f018daabf80 100644
--- a/libjava/classpath/javax/swing/JMenuBar.java
+++ b/libjava/classpath/javax/swing/JMenuBar.java
@@ -46,6 +46,9 @@ import java.awt.event.MouseEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
import javax.swing.plaf.MenuBarUI;
/**
@@ -59,6 +62,137 @@ import javax.swing.plaf.MenuBarUI;
*/
public class JMenuBar extends JComponent implements Accessible, MenuElement
{
+ /**
+ * Provides accessibility support for <code>JMenuBar</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJMenuBar extends AccessibleJComponent
+ implements AccessibleSelection
+ {
+
+ /**
+ * Returns the number of selected items in the menu bar. Possible values
+ * are <code>0</code> if nothing is selected, or <code>1</code> if one
+ * item is selected.
+ *
+ * @return the number of selected items in the menu bar
+ */
+ public int getAccessibleSelectionCount()
+ {
+ int count = 0;
+ if (getSelectionModel().getSelectedIndex() != -1)
+ count = 1;
+ return count;
+ }
+
+ /**
+ * Returns the selected with index <code>i</code> menu, or
+ * <code>null</code> if the specified menu is not selected.
+ *
+ * @param i the index of the menu to return
+ *
+ * @return the selected with index <code>i</code> menu, or
+ * <code>null</code> if the specified menu is not selected
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ if (getSelectionModel().getSelectedIndex() != i)
+ return null;
+ return getMenu(i);
+ }
+
+ /**
+ * Returns <code>true</code> if the specified menu is selected,
+ * <code>false</code> otherwise.
+ *
+ * @param i the index of the menu to check
+ *
+ *@return <code>true</code> if the specified menu is selected,
+ * <code>false</code> otherwise
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ return getSelectionModel().getSelectedIndex() == i;
+ }
+
+ /**
+ * Selects the menu with index <code>i</code>. If another menu is already
+ * selected, this will be deselected.
+ *
+ * @param i the menu to be selected
+ */
+ public void addAccessibleSelection(int i)
+ {
+ getSelectionModel().setSelectedIndex(i);
+ }
+
+ /**
+ * Deselects the menu with index <code>i</code>.
+ *
+ * @param i the menu index to be deselected
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ if (getSelectionModel().getSelectedIndex() == i)
+ getSelectionModel().clearSelection();
+ }
+
+ /**
+ * Deselects all possibly selected menus.
+ */
+ public void clearAccessibleSelection()
+ {
+ getSelectionModel().clearSelection();
+ }
+
+ /**
+ * In menu bars it is not possible to select all items, so this method
+ * does nothing.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ // In menu bars it is not possible to select all items, so this method
+ // does nothing.
+ }
+
+ /**
+ * Returns the accessible role of <code>JMenuBar</code>, which is
+ * {@link AccessibleRole#MENU_BAR}.
+ *
+ * @return the accessible role of <code>JMenuBar</code>, which is
+ * {@link AccessibleRole#MENU_BAR}
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.MENU_BAR;
+ }
+
+ /**
+ * Returns the <code>AccessibleSelection</code> for this object. This
+ * method returns <code>this</code>, since the
+ * <code>AccessibleJMenuBar</code> manages its selection itself.
+ *
+ * @return the <code>AccessibleSelection</code> for this object
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the state of this <code>AccessibleJMenuBar</code>.
+ *
+ * @return the state of this <code>AccessibleJMenuBar</code>.
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet stateSet = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added to the super state set.
+ return stateSet;
+ }
+ }
+
private static final long serialVersionUID = -8191026883931977036L;
/** JMenuBar's model. It keeps track of selected menu's index */
@@ -100,13 +234,15 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
*/
public void addNotify()
{
- // FIXME: Should register this menu bar with the keyboard manager
super.addNotify();
+ KeyboardManager.getManager().registerJMenuBar(this);
}
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJMenuBar();
+ return accessibleContext;
}
/**
@@ -253,7 +389,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menu bar.
*
- * @return The Look and Feel classID. "MenuItemUI"
+ * @return The Look and Feel classID. "MenuBarUI"
*/
public String getUIClassID()
{
@@ -338,6 +474,63 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
+ * This method overrides JComponent.processKeyBinding to allow the
+ * JMenuBar to check all the child components (recursiveley) to see
+ * if they'll consume the event.
+ *
+ * @param ks the KeyStroke for the event
+ * @param e the KeyEvent for the event
+ * @param condition the focus condition for the binding
+ * @param pressed true if the key is pressed
+ */
+ protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition,
+ boolean pressed)
+ {
+ // See if the regular JComponent behavior consumes the event
+ if (super.processKeyBinding(ks, e, condition, pressed))
+ return true;
+
+ // If not, have to recursively check all the child menu elements to see
+ // if they want it
+ MenuElement[] children = getSubElements();
+ for (int i = 0; i < children.length; i++)
+ if (processKeyBindingHelper(children[i], ks, e, condition, pressed))
+ return true;
+ return false;
+ }
+
+ /**
+ * This is a helper method to recursively check the children of this
+ * JMenuBar to see if they will consume a key event via key bindings.
+ * This is used for menu accelerators.
+ * @param menuElement the menuElement to check (and check all its children)
+ * @param ks the KeyStroke for the event
+ * @param e the KeyEvent that may be consumed
+ * @param condition the focus condition for the binding
+ * @param pressed true if the key was pressed
+ * @return true <code>menuElement</code> or one of its children consume
+ * the event (processKeyBinding returns true for menuElement or one of
+ * its children).
+ */
+ static boolean processKeyBindingHelper(MenuElement menuElement, KeyStroke ks,
+ KeyEvent e, int condition,
+ boolean pressed)
+ {
+ // First check the menuElement itself, if it's a JComponent
+ if (menuElement instanceof JComponent
+ && ((JComponent) menuElement).processKeyBinding(ks, e, condition,
+ pressed))
+ return true;
+
+ // If that didn't consume it, check all the children recursively
+ MenuElement[] children = menuElement.getSubElements();
+ for (int i = 0; i < children.length; i++)
+ if (processKeyBindingHelper(children[i], ks, e, condition, pressed))
+ return true;
+ return false;
+ }
+
+ /**
* Process mouse events forwarded from MenuSelectionManager. This method
* doesn't do anything. It is here to conform to the MenuElement interface.
*
@@ -358,7 +551,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
*/
public void removeNotify()
{
- // Must unregister this menu bar with the current keyboard manager.
+ KeyboardManager.getManager().unregisterJMenuBar(this);
super.removeNotify();
}
@@ -384,9 +577,14 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
* Sets help menu for this menu bar
*
* @param menu help menu
+ *
+ * @specnote The specification states that this method is not yet implemented
+ * and should throw an exception.
*/
public void setHelpMenu(JMenu menu)
{
+ // We throw an Error here, just as Sun's JDK does.
+ throw new Error("setHelpMenu() not yet implemented.");
}
/**
diff --git a/libjava/classpath/javax/swing/JMenuItem.java b/libjava/classpath/javax/swing/JMenuItem.java
index 069b7bc86f8..c87a4dc2b20 100644
--- a/libjava/classpath/javax/swing/JMenuItem.java
+++ b/libjava/classpath/javax/swing/JMenuItem.java
@@ -44,9 +44,6 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.util.EventListener;
import javax.accessibility.Accessible;
@@ -84,6 +81,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
public JMenuItem()
{
super();
+ init(null, null);
}
/**
@@ -118,6 +116,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
{
super();
super.setAction(action);
+ init(null, null);
}
/**
@@ -147,15 +146,6 @@ public class JMenuItem extends AbstractButton implements Accessible,
setMnemonic(mnemonic);
}
- private void readObject(ObjectInputStream stream)
- throws IOException, ClassNotFoundException
- {
- }
-
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* Initializes this menu item
*
@@ -176,7 +166,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
//borderPainted = false;
focusPainted = false;
horizontalAlignment = JButton.LEFT;
- horizontalTextPosition = JButton.LEFT;
+ horizontalTextPosition = JButton.TRAILING;
}
/**
@@ -189,7 +179,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
{
super.setUI(ui);
}
-
+
/**
* This method sets this menuItem's UI to the UIManager's default for the
* current look and feel.
@@ -255,13 +245,18 @@ public class JMenuItem extends AbstractButton implements Accessible,
}
/**
- * Sets accelerator for this menu item.
- *
+ * Sets the key combination which invokes the menu item's action
+ * listeners without navigating the menu hierarchy. Note that when the
+ * keyboard accelerator is typed, it will work whether or not the
+ * menu is currently displayed.
+ *
* @param keystroke accelerator for this menu item.
*/
public void setAccelerator(KeyStroke keystroke)
{
+ KeyStroke old = this.accelerator;
this.accelerator = keystroke;
+ firePropertyChange ("accelerator", old, keystroke);
}
/**
@@ -276,7 +271,11 @@ public class JMenuItem extends AbstractButton implements Accessible,
super.configurePropertiesFromAction(action);
if (! (this instanceof JMenu) && action != null)
- setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
+ {
+ setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
+ super.registerKeyboardAction(action, accelerator,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ }
}
/**
@@ -667,6 +666,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
public void stateChanged(ChangeEvent event)
{
+ // TODO: What should be done here, if anything?
}
public AccessibleRole getAccessibleRole()
diff --git a/libjava/classpath/javax/swing/JOptionPane.java b/libjava/classpath/javax/swing/JOptionPane.java
index ad0772ab8d3..057326cd209 100644
--- a/libjava/classpath/javax/swing/JOptionPane.java
+++ b/libjava/classpath/javax/swing/JOptionPane.java
@@ -1,5 +1,5 @@
/* JOptionPane.java
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,6 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.awt.Dimension;
import java.awt.Frame;
import javax.accessibility.Accessible;
@@ -60,16 +59,19 @@ public class JOptionPane extends JComponent implements Accessible
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented
+ // properly.
protected class AccessibleJOptionPane extends JComponent.AccessibleJComponent
{
/** DOCUMENT ME! */
private static final long serialVersionUID = 686071432213084821L;
-
+
/**
* Creates a new AccessibleJOptionPane object.
*/
protected AccessibleJOptionPane()
{
+ // Nothing to do here.
}
/**
@@ -343,8 +345,6 @@ public class JOptionPane extends JComponent implements Accessible
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
updateUI();
- invalidate();
- repaint();
}
/**
@@ -369,17 +369,12 @@ public class JOptionPane extends JComponent implements Accessible
inputValue = UNINITIALIZED_VALUE;
value = UNINITIALIZED_VALUE;
- // FIXME: This dialog should be centered on the parent
- // or at the center of the screen (if the parent is null)
- // Need getGraphicsConfiguration to return non-null in
- // order for that to work so we know how large the
- // screen is.
dialog.getContentPane().add(this);
dialog.setModal(true);
dialog.setResizable(false);
- dialog.invalidate();
- dialog.repaint();
-
+ dialog.pack();
+ dialog.setLocationRelativeTo(parentComponent);
+
return dialog;
}
@@ -513,6 +508,8 @@ public class JOptionPane extends JComponent implements Accessible
*/
public Object getInputValue()
{
+ if (getValue().equals(new Integer(CANCEL_OPTION)))
+ setInputValue(null);
return inputValue;
}
@@ -858,13 +855,13 @@ public class JOptionPane extends JComponent implements Accessible
*/
public static int showConfirmDialog(Component parentComponent, Object message)
{
- JOptionPane pane = new JOptionPane(message);
+ JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
JDialog dialog = pane.createDialog(parentComponent, "Select an Option");
-
- dialog.pack();
dialog.show();
-
- return ((Integer) pane.getValue()).intValue();
+
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -886,10 +883,11 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, PLAIN_MESSAGE, optionType);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -912,10 +910,11 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, messageType, optionType);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -940,10 +939,11 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, messageType, optionType, icon);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -964,9 +964,8 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(parentComponent, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -991,9 +990,8 @@ public class JOptionPane extends JComponent implements Accessible
pane.setInitialSelectionValue(initialSelectionValue);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(parentComponent, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1017,9 +1015,8 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1050,10 +1047,9 @@ public class JOptionPane extends JComponent implements Accessible
pane.setSelectionValues(selectionValues);
pane.setInitialSelectionValue(initialSelectionValue);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
-
- return (String) pane.getInputValue();
+
+ return pane.getInputValue();
}
/**
@@ -1071,9 +1067,8 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(null, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1096,9 +1091,8 @@ public class JOptionPane extends JComponent implements Accessible
pane.setWantsInput(true);
pane.setInitialSelectionValue(initialSelectionValue);
JDialog dialog = pane.createDialog(null, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1120,8 +1114,10 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
startModal(frame);
-
- return ((Integer) pane.getValue()).intValue();
+
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1146,7 +1142,9 @@ public class JOptionPane extends JComponent implements Accessible
startModal(frame);
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1172,7 +1170,9 @@ public class JOptionPane extends JComponent implements Accessible
startModal(frame);
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1200,7 +1200,9 @@ public class JOptionPane extends JComponent implements Accessible
startModal(frame);
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1222,7 +1224,7 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
startModal(frame);
-
+
return (String) pane.getInputValue();
}
@@ -1248,7 +1250,7 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
-
+
return (String) pane.getInputValue();
}
@@ -1283,8 +1285,8 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
-
- return (String) pane.getInputValue();
+
+ return pane.getInputValue();
}
/**
@@ -1376,8 +1378,10 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
-
- return ((Integer) pane.getValue()).intValue();
+
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1391,8 +1395,7 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE);
JDialog dialog = pane.createDialog(parentComponent, null);
- dialog.pack();
- dialog.show();
+ dialog.show();
}
/**
@@ -1410,7 +1413,6 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, messageType);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
}
@@ -1431,7 +1433,6 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType);
pane.setIcon(icon);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
}
@@ -1461,10 +1462,11 @@ public class JOptionPane extends JComponent implements Accessible
options, initialValue);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1524,34 +1526,34 @@ public class JOptionPane extends JComponent implements Accessible
* JInternalFrame's preferred size.
*
* @param f The JInternalFrame to make modal.
- * @param pane The JOptionPane to add to the JInternalFrame.
*/
private static void startModal(JInternalFrame f)
{
synchronized (f)
- {
- final JInternalFrame tmp = f;
- tmp.toFront();
-
- f.addInternalFrameListener(new InternalFrameAdapter()
- {
- public void internalFrameClosed(InternalFrameEvent e)
- {
- synchronized (tmp)
- {
- tmp.removeInternalFrameListener(this);
- tmp.notifyAll();
- }
- }
- });
- try
- {
- while (! f.isClosed())
- f.wait();
- }
- catch (InterruptedException ignored)
- {
- }
- }
+ {
+ final JInternalFrame tmp = f;
+ tmp.toFront();
+
+ f.addInternalFrameListener(new InternalFrameAdapter()
+ {
+ public void internalFrameClosed(InternalFrameEvent e)
+ {
+ synchronized (tmp)
+ {
+ tmp.removeInternalFrameListener(this);
+ tmp.notifyAll();
+ }
+ }
+ });
+ try
+ {
+ while (! f.isClosed())
+ f.wait();
+ }
+ catch (InterruptedException ignored)
+ {
+ // Ignore this Exception.
+ }
+ }
}
}
diff --git a/libjava/classpath/javax/swing/JPanel.java b/libjava/classpath/javax/swing/JPanel.java
index c7f7c448331..7805e92b6e9 100644
--- a/libjava/classpath/javax/swing/JPanel.java
+++ b/libjava/classpath/javax/swing/JPanel.java
@@ -43,6 +43,7 @@ import java.awt.LayoutManager;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.plaf.PanelUI;
/**
@@ -52,63 +53,90 @@ import javax.swing.plaf.PanelUI;
*/
public class JPanel extends JComponent implements Accessible
{
- public JPanel()
+ /**
+ * Provides accessibility support for <code>JPanel</code>.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ protected class AccessibleJPanel extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJPanel</code>.
+ */
+ public AccessibleJPanel()
{
- this(new FlowLayout(),
- true);
+ // Nothing to do here.
}
-
- public JPanel(boolean double_buffered)
- {
- this(new FlowLayout(),
- double_buffered);
- }
-
- public JPanel(LayoutManager layout)
- {
- this(layout,
- true);
- }
-
-
- public JPanel(LayoutManager layout,
- boolean isDoubleBuffered)
- {
- if (layout == null)
- {
- System.err.println("NO LAYOUT SET !!!");
- layout = new FlowLayout();
- }
- setLayout(layout);
- setOpaque(true);
-
- updateUI();
- }
-
- public String getUIClassID()
- { return "PanelUI"; }
-
- public void setUI(PanelUI ui) {
- super.setUI(ui);
- }
-
- public PanelUI getUI() {
- return (PanelUI)ui;
- }
-
- public void updateUI() {
- setUI((PanelUI)UIManager.getUI(this));
- }
-
-
- public AccessibleContext getAccessibleContext()
+ /**
+ * Returns the accessible role for <code>JPanel</code>, which is
+ * {@link AccessibleRole#PANEL}.
+ *
+ * @return the accessible role for <code>JPanel</code>
+ */
+ public AccessibleRole getAccessibleRole()
{
- return null;
+ return AccessibleRole.PANEL;
}
+ }
+
+ public JPanel()
+ {
+ this(new FlowLayout(), true);
+ }
+
+ public JPanel(boolean double_buffered)
+ {
+ this(new FlowLayout(), double_buffered);
+ }
+
+ public JPanel(LayoutManager layout)
+ {
+ this(layout, true);
+ }
+
+ public JPanel(LayoutManager layout, boolean isDoubleBuffered)
+ {
+ if (layout == null)
+ {
+ // TODO: Is this correct? Or should we throw a NPE?
+ layout = new FlowLayout();
+ }
+ setLayout(layout);
+ setOpaque(true);
+
+ updateUI();
+ }
+
+ public String getUIClassID()
+ {
+ return "PanelUI";
+ }
+
+ public void setUI(PanelUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ public PanelUI getUI()
+ {
+ return (PanelUI) ui;
+ }
+
+ public void updateUI()
+ {
+ setUI((PanelUI) UIManager.getUI(this));
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJPanel();
+ return accessibleContext;
+ }
- protected String paramString()
- {
+ protected String paramString()
+ {
return "JPanel";
- }
+ }
}
diff --git a/libjava/classpath/javax/swing/JPasswordField.java b/libjava/classpath/javax/swing/JPasswordField.java
index 151d2484a82..11e45e8a58a 100644
--- a/libjava/classpath/javax/swing/JPasswordField.java
+++ b/libjava/classpath/javax/swing/JPasswordField.java
@@ -67,6 +67,7 @@ public class JPasswordField extends JTextField
*/
protected AccessibleJPasswordField()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JPopupMenu.java b/libjava/classpath/javax/swing/JPopupMenu.java
index c4ee5fe7346..1f2282e2326 100644
--- a/libjava/classpath/javax/swing/JPopupMenu.java
+++ b/libjava/classpath/javax/swing/JPopupMenu.java
@@ -39,19 +39,13 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
-import java.awt.GridBagConstraints;
import java.awt.Insets;
-import java.awt.Panel;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.EventListener;
@@ -102,11 +96,11 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
1. if DefaultLightWeightPopupEnabled true
(i) use lightweight container if popup feets inside top-level window
- (ii) only use heavyweight container (JWindow) if popup doesn't fit.
+ (ii) only use heavyweight container (JDialog) if popup doesn't fit.
2. if DefaultLightWeightPopupEnabled false
(i) if popup fits, use awt.Panel (mediumWeight)
- (ii) if popup doesn't fit, use JWindow (heavyWeight)
+ (ii) if popup doesn't fit, use JDialog (heavyWeight)
*/
private static boolean DefaultLightWeightPopupEnabled = true;
@@ -130,8 +124,15 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
/* Popup that is used to display JPopupMenu */
private transient Popup popup;
- /* Location of the popup */
- private Point popupLocation;
+ /**
+ * Location of the popup, X coordinate.
+ */
+ private int popupLocationX;
+
+ /**
+ * Location of the popup, Y coordinate.
+ */
+ private int popupLocationY;
/* Field indicating if popup menu is visible or not */
private boolean visible = false;
@@ -158,15 +159,6 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
updateUI();
}
- private void readObject(ObjectInputStream stream)
- throws IOException, ClassNotFoundException
- {
- }
-
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* Adds given menu item to the popup menu
*
@@ -220,19 +212,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
public void remove(int index)
{
super.remove(index);
-
- GridBagConstraints constraints = new GridBagConstraints();
- constraints.fill = GridBagConstraints.BOTH;
- constraints.weightx = 100.0;
- constraints.weighty = 100.0;
-
- Component[] items = getComponents();
- for (int i = index; i < items.length; i++)
- {
- constraints.gridy = i;
- super.add(items[i], constraints, i);
- }
- this.setSize(this.getPreferredSize());
+ revalidate();
}
/**
@@ -257,27 +237,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void insert(Component component, int index)
{
- GridBagConstraints constraints = new GridBagConstraints();
- constraints.fill = GridBagConstraints.BOTH;
- constraints.weightx = 100.0;
- constraints.weighty = 100.0;
-
- constraints.gridy = index;
- super.add(component, constraints, index);
-
- // need to change constraints for the components that were moved by 1
- // due to the insertion
- if (index != -1)
- {
- Component[] items = getComponents();
-
- for (int i = index + 1; i < items.length; i++)
- {
- constraints.gridy = i;
- super.add(items[i], constraints, i);
- }
- }
- this.setSize(this.getPreferredSize());
+ super.add(component, index);
}
/**
@@ -527,7 +487,20 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void pack()
{
- super.setSize(null);
+ // Hook up this call so that it gets executed on the event thread in order
+ // to avoid synchronization problems when calling the layout manager.
+ if (! SwingUtilities.isEventDispatchThread())
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ show();
+ }
+ });
+ }
+
+ setSize(getPreferredSize());
}
/**
@@ -547,8 +520,21 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*
* @param visible true if popup menu will become visible and false otherwise.
*/
- public void setVisible(boolean visible)
+ public void setVisible(final boolean visible)
{
+ // Hook up this call so that it gets executed on the event thread in order
+ // to avoid synchronization problems when calling the layout manager.
+ if (! SwingUtilities.isEventDispatchThread())
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ setVisible(visible);
+ }
+ });
+ }
+
if (visible == isVisible())
return;
@@ -556,58 +542,21 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
this.visible = visible;
if (old != isVisible())
{
- firePropertyChange("visible", old, isVisible());
- if (visible)
- {
- firePopupMenuWillBecomeVisible();
- Container rootContainer = (Container) SwingUtilities.getRoot(invoker);
-
- boolean fit = true;
- Dimension size;
-
- // Determine the size of the popup menu
- if (this.getSize().width == 0 && this.getSize().width == 0)
- size = this.getPreferredSize();
- else
- size = this.getSize();
-
- if ((size.width > (rootContainer.getWidth() - popupLocation.x))
- || (size.height > (rootContainer.getHeight() - popupLocation.y)))
- fit = false;
- if (lightWeightPopupEnabled && fit)
- popup = new LightWeightPopup(this);
- else
- {
- if (fit)
- popup = new MediumWeightPopup(this);
- else
- popup = new HeavyWeightPopup(this);
- }
- if (popup instanceof LightWeightPopup
- || popup instanceof MediumWeightPopup)
- {
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker)
- .getLayeredPane();
- Point p = new Point(popupLocation.x, popupLocation.y);
- SwingUtilities.convertPointFromScreen(p, layeredPane);
- popup.show(p.x, p.y, size.width, size.height);
- }
- else
- {
- // Subtract insets of the top-level container if popup menu's
- // top-left corner is inside it.
- Insets insets = rootContainer.getInsets();
- popup.show(popupLocation.x - insets.left,
- popupLocation.y - insets.top, size.width,
- size.height);
- }
- }
- else
- {
- firePopupMenuWillBecomeInvisible();
- popup.hide();
- }
+ firePropertyChange("visible", old, isVisible());
+ if (visible)
+ {
+ firePopupMenuWillBecomeVisible();
+
+ PopupFactory pf = PopupFactory.getSharedInstance();
+ pack();
+ popup = pf.getPopup(invoker, this, popupLocationX, popupLocationY);
+ popup.show();
+ }
+ else
+ {
+ firePopupMenuWillBecomeInvisible();
+ popup.hide();
+ }
}
}
@@ -619,11 +568,11 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void setLocation(int x, int y)
{
- if (popupLocation == null)
- popupLocation = new Point();
-
- popupLocation.x = x;
- popupLocation.y = y;
+ popupLocationX = x;
+ popupLocationY = y;
+ // Handle the case when the popup is already showing. In this case we need
+ // to fetch a new popup from PopupFactory and use this. See the general
+ // contract of the PopupFactory.
}
/**
@@ -657,11 +606,14 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void show(Component component, int x, int y)
{
- setInvoker(component);
- Point p = new Point(x, y);
- SwingUtilities.convertPointToScreen(p, component);
- setLocation(p.x, p.y);
- setVisible(true);
+ if (component.isShowing())
+ {
+ setInvoker(component);
+ Point p = new Point(x, y);
+ SwingUtilities.convertPointToScreen(p, component);
+ setLocation(p.x, p.y);
+ setVisible(true);
+ }
}
/**
@@ -882,162 +834,13 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
}
/**
- * This interface is used to display menu items of the JPopupMenu
- */
- private interface Popup
- {
- /**
- * Displays container on the screen
- *
- * @param x x-coordinate of popup menu's location on the screen
- * @param y y-coordinate of popup menu's location on the screen
- * @param width width of the container that is used to display menu
- * item's for popup menu
- * @param height height of the container that is used to display menu
- * item's for popup menu
- */
- void show(int x, int y, int width, int height);
-
- /**
- * Hides container used to display popup menu item's from the screen
- */
- void hide();
- }
-
- /**
- * This class represents Popup menu that uses light weight container
- * to display its contents.
- */
- private class LightWeightPopup extends Container implements Popup
- {
- private Component c;
-
- /**
- * Creates a new LightWeightPopup menu
- *
- * @param c Container containing menu items
- */
- public LightWeightPopup(Container c)
- {
- this.c = c;
- }
-
- /**
- * Displayes lightweight container with menu items to the screen
- *
- * @param x x-coordinate of lightweight container on the screen
- * @param y y-coordinate of lightweight container on the screen
- * @param width width of the lightweight container
- * @param height height of the lightweight container
- */
- public void show(int x, int y, int width, int height)
- {
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- c.setBounds(x, y, width, height);
- layeredPane.add(c, JLayeredPane.POPUP_LAYER, 0);
- }
-
- /**
- * Hides lightweight container from the screen
- */
- public void hide()
- {
- // FIXME: Right now the lightweight container is removed from JLayered
- // pane. It is probably would be better in order to improve performance
- // to make the container invisible instead of removing it everytime.
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- int index = layeredPane.getIndexOf(c);
- layeredPane.remove(index);
- }
- }
-
- /**
- * MediumWeightPopup is an AWT Panel with JPopupMenu's menu items.
- * It is used to display JPopupMenu's menu items on the screen
- */
- private class MediumWeightPopup extends Panel implements Popup
- {
- /**
- * Creates a new MediumWeightPopup object.
- *
- * @param c Container with JPopupMenu's menu items
- */
- public MediumWeightPopup(Container c)
- {
- this.add(c);
- }
-
- /**
- * Displays AWT Panel with its components on the screen
- *
- * @param x x-coordinate of the upper-left corner of the panel's
- * @param y y-coordinate of the upper-left corner of the panel's
- * @param width width of the panel
- * @param height height of the panel
- */
- public void show(int x, int y, int width, int height)
- {
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- layeredPane.add(this, JLayeredPane.POPUP_LAYER, 0);
- this.setBounds(x, y, width, height);
- }
-
- /**
- * Hides This panel from the screen
- */
- public void hide()
- {
- // FIXME: Right now the lightweight container is removed from JLayered
- // pane. It is probably would be better in order to improve performance
- // to make the container invisible instead of removing it everytime.
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- int index = layeredPane.getIndexOf(this);
- layeredPane.remove(index);
- }
- }
-
- /**
- * HeavyWeightPopup is JWindow that is used to display JPopupMenu menu item's
- * on the screen
- */
- private class HeavyWeightPopup extends JWindow implements Popup
- {
- /**
- * Creates a new HeavyWeightPopup object.
- *
- * @param c Container containing menu items
- */
- public HeavyWeightPopup(Container c)
- {
- this.setContentPane(c);
- }
-
- /**
- * Displays JWindow container JPopupMenu's menu items to the screen
- *
- * @param x x-coordinate of JWindow containing menu items
- * @param y y-coordinate of JWindow containing menu items
- * @param width width of the JWindow
- * @param height height of the JWindow
- */
- public void show(int x, int y, int width, int height)
- {
- this.setBounds(x, y, width, height);
- this.show();
- }
- }
-
- /**
* This is the separator that can be used in popup menu.
*/
public static class Separator extends JSeparator
{
public Separator()
{
+ super();
}
public String getUIClassID()
@@ -1052,6 +855,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
protected AccessibleJPopupMenu()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
@@ -1066,8 +870,9 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
{
public void propertyChange(PropertyChangeEvent evt)
{
- JPopupMenu.this.revalidate();
- JPopupMenu.this.repaint();
+ // We used to have a revalidate() and repaint() call here. However I think
+ // this is not needed. Instead, a new Popup has to be fetched from the
+ // PopupFactory and used here.
}
}
}
diff --git a/libjava/classpath/javax/swing/JProgressBar.java b/libjava/classpath/javax/swing/JProgressBar.java
index 1b8fcea4672..0de9115dc7d 100644
--- a/libjava/classpath/javax/swing/JProgressBar.java
+++ b/libjava/classpath/javax/swing/JProgressBar.java
@@ -81,6 +81,8 @@ public class JProgressBar extends JComponent implements SwingConstants,
/**
* AccessibleJProgressBar
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented
+ // properly.
protected class AccessibleJProgressBar extends AccessibleJComponent
implements AccessibleValue
{
@@ -91,6 +93,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
*/
protected AccessibleJProgressBar()
{
+ // Nothing to do here.
}
/**
@@ -243,7 +246,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
model = new DefaultBoundedRangeModel(minimum, 0, minimum, maximum);
if (orientation != HORIZONTAL && orientation != VERTICAL)
throw new IllegalArgumentException(orientation + " is not a legal orientation");
- this.orientation = orientation;
+ setOrientation(orientation);
changeListener = createChangeListener();
model.addChangeListener(changeListener);
updateUI();
diff --git a/libjava/classpath/javax/swing/JRadioButton.java b/libjava/classpath/javax/swing/JRadioButton.java
index 66f5902e899..e0593f3a501 100644
--- a/libjava/classpath/javax/swing/JRadioButton.java
+++ b/libjava/classpath/javax/swing/JRadioButton.java
@@ -192,8 +192,8 @@ public class JRadioButton extends JToggleButton
public JRadioButton(String text, Icon icon, boolean selected)
{
super(text, icon, selected);
- borderPainted = false;
- contentAreaFilled = false;
+ setBorderPainted(false);
+ setHorizontalAlignment(LEADING);
}
/**
diff --git a/libjava/classpath/javax/swing/JRadioButtonMenuItem.java b/libjava/classpath/javax/swing/JRadioButtonMenuItem.java
index 76a8fef640a..61a8dbab300 100644
--- a/libjava/classpath/javax/swing/JRadioButtonMenuItem.java
+++ b/libjava/classpath/javax/swing/JRadioButtonMenuItem.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package javax.swing;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -149,10 +146,6 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
model.setSelected(selected);
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menuItem.
@@ -202,6 +195,7 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
*/
protected AccessibleJRadioButtonMenuItem()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
diff --git a/libjava/classpath/javax/swing/JRootPane.java b/libjava/classpath/javax/swing/JRootPane.java
index cb0bafd84e0..dea4ee4b195 100644
--- a/libjava/classpath/javax/swing/JRootPane.java
+++ b/libjava/classpath/javax/swing/JRootPane.java
@@ -42,10 +42,14 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.IllegalComponentStateException;
+import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.LayoutManager2;
+import java.awt.Rectangle;
import java.io.Serializable;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleRole;
import javax.swing.plaf.RootPaneUI;
@@ -59,10 +63,10 @@ import javax.swing.plaf.RootPaneUI;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JRootPane extends JComponent
+public class JRootPane extends JComponent implements Accessible
{
// The class used to obtain the accessible role for this object.
- protected static class AccessibleJRootPane
+ protected class AccessibleJRootPane extends AccessibleJComponent
{
/**
* For compatability with Sun's JDK
@@ -74,6 +78,7 @@ public class JRootPane extends JComponent
*/
protected AccessibleJRootPane()
{
+ // Nothing to do here.
}
/**
@@ -95,10 +100,36 @@ public class JRootPane extends JComponent
private static final long serialVersionUID = -4100116998559815027L;
/**
+ * The cached layout info for the glass pane.
+ */
+ private Rectangle glassPaneBounds;
+
+ /**
+ * The cached layout info for the layered pane.
+ */
+ private Rectangle layeredPaneBounds;
+
+ /**
+ * The cached layout info for the content pane.
+ */
+ private Rectangle contentPaneBounds;
+
+ /**
+ * The cached layout info for the menu bar.
+ */
+ private Rectangle menuBarBounds;
+
+ /**
+ * The cached preferred size.
+ */
+ private Dimension prefSize;
+
+ /**
* Creates a new <code>RootLayout</code> object.
*/
protected RootLayout()
{
+ // Nothing to do here.
}
/**
@@ -109,6 +140,7 @@ public class JRootPane extends JComponent
*/
public void addLayoutComponent(Component comp, Object constraints)
{
+ // Nothing to do here.
}
/**
@@ -119,6 +151,7 @@ public class JRootPane extends JComponent
*/
public void addLayoutComponent(String name, Component comp)
{
+ // Nothing to do here.
}
/**
@@ -130,7 +163,7 @@ public class JRootPane extends JComponent
*/
public float getLayoutAlignmentX(Container target)
{
- return target.getAlignmentX();
+ return 0.0F;
}
/**
@@ -142,7 +175,7 @@ public class JRootPane extends JComponent
*/
public float getLayoutAlignmentY(Container target)
{
- return target.getAlignmentY();
+ return 0.0F;
}
/**
@@ -152,6 +185,14 @@ public class JRootPane extends JComponent
*/
public void invalidateLayout(Container target)
{
+ synchronized (this)
+ {
+ glassPaneBounds = null;
+ layeredPaneBounds = null;
+ contentPaneBounds = null;
+ menuBarBounds = null;
+ prefSize = null;
+ }
}
/**
@@ -161,81 +202,56 @@ public class JRootPane extends JComponent
*/
public void layoutContainer(Container c)
{
- Dimension menuBarSize;
- Dimension containerSize = c.getSize(null);
- Dimension contentPaneSize = contentPane.getPreferredSize();
-
- /*
- if size of top-level window wasn't set then just set
- contentPane and menuBar to its preferred sizes.
- Otherwise, if the size of top-level window was specified then
- set menuBar to its preferred size and make content pane
- to fit into the remaining space
-
-
- +-------------------------------+
- | JLayeredPane |
- | +--------------------------+ |
- | | menuBar | |
- | +--------------------------+ |
- | +--------------------------+ |
- | |contentPane | |
- | | | |
- | | | |
- | | | |
- | +--------------------------+ |
- +-------------------------------+
-
- */
- if (containerSize.width == 0 && containerSize.height == 0)
+ if (glassPaneBounds == null || layeredPaneBounds == null
+ || contentPaneBounds == null || menuBarBounds == null)
{
+ Insets i = getInsets();
+ int containerWidth = c.getBounds().width - i.left - i.right;
+ int containerHeight = c.getBounds().height - i.top - i.bottom;
+
+ // 1. the glassPane fills entire viewable region (bounds - insets).
+ // 2. the layeredPane filles entire viewable region.
+ // 3. the menuBar is positioned at the upper edge of layeredPane.
+ // 4. the contentPane fills viewable region minus menuBar, if present.
+
+
+ // +-------------------------------+
+ // | JLayeredPane |
+ // | +--------------------------+ |
+ // | | menuBar | |
+ // | +--------------------------+ |
+ // | +--------------------------+ |
+ // | |contentPane | |
+ // | | | |
+ // | | | |
+ // | | | |
+ // | +--------------------------+ |
+ // +-------------------------------+
+
if (menuBar != null)
{
- int maxWidth;
- menuBarSize = menuBar.getPreferredSize();
- maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
- menuBar.setBounds(0, 0, maxWidth, menuBarSize.height);
- glassPane.setBounds(0, menuBarSize.height, maxWidth,
- contentPaneSize.height);
- contentPane.setBounds(0, menuBarSize.height, maxWidth,
- contentPaneSize.height);
- layeredPane.setSize(maxWidth,
- menuBarSize.height + contentPaneSize.height);
+ Dimension menuBarSize = menuBar.getPreferredSize();
+ if (menuBarSize.height > containerHeight)
+ menuBarSize.height = containerHeight;
+ menuBarBounds = new Rectangle(0, 0, containerWidth,
+ menuBarSize.height);
+ contentPaneBounds = new Rectangle(0, menuBarSize.height,
+ containerWidth,
+ containerHeight - menuBarSize.height);
}
else
- {
- glassPane.setBounds(0, 0, contentPaneSize.width,
- contentPaneSize.height);
- contentPane.setBounds(0, 0, contentPaneSize.width,
- contentPaneSize.height);
- layeredPane.setSize(contentPaneSize.width, contentPaneSize.height);
- }
+ contentPaneBounds = new Rectangle(0, 0, containerWidth,
+ containerHeight);
+
+ glassPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);
+ layeredPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);
}
- else
- {
- if (menuBar != null)
- {
- menuBarSize = menuBar.getPreferredSize();
- if (menuBarSize.height > containerSize.height)
- menuBarSize.height = containerSize.height;
- menuBar.setBounds(0, 0, containerSize.width, menuBarSize.height);
- int remainingHeight = containerSize.height - menuBarSize.height;
- glassPane.setBounds(0, menuBarSize.height, containerSize.width,
- containerSize.height - menuBarSize.height);
- contentPane.setBounds(0, menuBarSize.height,
- containerSize.width,
- (containerSize.height - menuBarSize.height));
- }
- else
- {
- glassPane.setBounds(0, 0, containerSize.width,
- containerSize.height);
- contentPane.setBounds(0, 0, containerSize.width,
- containerSize.height);
- }
- layeredPane.setSize(containerSize.width, containerSize.height);
- }
+ glassPane.setBounds(glassPaneBounds);
+ layeredPane.setBounds(layeredPaneBounds);
+ if (menuBar != null)
+ menuBar.setBounds(menuBarBounds);
+ contentPane.setBounds(contentPaneBounds);
}
/**
@@ -271,30 +287,29 @@ public class JRootPane extends JComponent
*/
public Dimension preferredLayoutSize(Container c)
{
- Dimension menuBarSize;
- Dimension prefSize;
-
- Dimension containerSize = c.getSize();
- Dimension contentPaneSize = contentPane.getPreferredSize();
-
- if (containerSize.width == 0 && containerSize.height == 0)
+ // We must synchronize here, otherwise we cannot guarantee that the
+ // prefSize is still non-null when returning.
+ synchronized (this)
{
- if (menuBar != null)
+ if (prefSize == null)
{
- int maxWidth;
- menuBarSize = menuBar.getPreferredSize();
- maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
- prefSize = new Dimension(maxWidth,
- contentPaneSize.height
- + menuBarSize.height);
+ Insets i = getInsets();
+ prefSize = new Dimension(i.left + i.right, i.top + i.bottom);
+ Dimension contentPrefSize = contentPane.getPreferredSize();
+ prefSize.width += contentPrefSize.width;
+ prefSize.height += contentPrefSize.height;
+ if (menuBar != null)
+ {
+ Dimension menuBarSize = menuBar.getPreferredSize();
+ if (menuBarSize.width > contentPrefSize.width)
+ prefSize.width += menuBarSize.width - contentPrefSize.width;
+ prefSize.height += menuBarSize.height;
+ }
}
- else
- prefSize = contentPaneSize;
- }
- else
- prefSize = c.getSize();
-
- return prefSize;
+ // Return a copy here so the cached value won't get trashed by some
+ // other component.
+ return new Dimension(prefSize);
+ }
}
/**
@@ -304,6 +319,7 @@ public class JRootPane extends JComponent
*/
public void removeLayoutComponent(Component comp)
{
+ // Nothing to do here.
}
}
@@ -335,6 +351,32 @@ public class JRootPane extends JComponent
protected JButton defaultButton;
/**
+ * This field is unused since JDK1.3. To override the default action you
+ * should modify the JRootPane's ActionMap.
+ *
+ * @deprecated since JDK1.3
+ *
+ * @specnote the specs indicate that the type of this field is
+ * a package private inner class
+ * javax.swing.JRootPane.DefaultAction. I assume that the closest
+ * public superclass is javax.swing.Action.
+ */
+ protected Action defaultPressAction;
+
+ /**
+ * This field is unused since JDK1.3. To override the default action you
+ * should modify the JRootPane's ActionMap.
+ *
+ * @deprecated since JDK1.3
+ *
+ * @specnote the specs indicate that the type of this field is
+ * a package private inner class
+ * javax.swing.JRootPane.DefaultAction. I assume that the closest
+ * public superclass is javax.swing.Action.
+ */
+ protected Action defaultReleaseAction;
+
+ /**
* @since 1.4
*/
private int windowDecorationStyle = NONE;
@@ -403,14 +445,25 @@ public class JRootPane extends JComponent
}
/**
- * DOCUMENT ME!
+ * Sets the JRootPane's content pane. The content pane should typically be
+ * opaque for painting to work properly. This method also
+ * removes the old content pane from the layered pane.
*
- * @param p DOCUMENT ME!
+ * @param p the Container that will be the content pane
+ * @throws IllegalComponentStateException if p is null
*/
public void setContentPane(Container p)
{
- contentPane = p;
- getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
+ if (p == null)
+ throw new IllegalComponentStateException ("cannot " +
+ "have a null content pane");
+ else
+ {
+ if (contentPane != null && contentPane.getParent() == layeredPane)
+ layeredPane.remove(contentPane);
+ contentPane = p;
+ getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
+ }
}
/**
@@ -488,7 +541,6 @@ public class JRootPane extends JComponent
getGlassPane();
getLayeredPane();
getContentPane();
- setDoubleBuffered(true);
updateUI();
}
@@ -524,7 +576,6 @@ public class JRootPane extends JComponent
{
JPanel p = new JPanel();
p.setName(this.getName() + ".glassPane");
- p.setLayout(new BorderLayout());
p.setVisible(false);
p.setOpaque(false);
return p;
@@ -615,7 +666,8 @@ public class JRootPane extends JComponent
&& style != COLOR_CHOOSER_DIALOG
&& style != FILE_CHOOSER_DIALOG
&& style != QUESTION_DIALOG
- && style != WARNING_DIALOG)
+ && style != WARNING_DIALOG
+ && style != PLAIN_DIALOG)
throw new IllegalArgumentException("invalid style");
int oldStyle = windowDecorationStyle;
diff --git a/libjava/classpath/javax/swing/JScrollPane.java b/libjava/classpath/javax/swing/JScrollPane.java
index e83513f07de..45dfbf50619 100644
--- a/libjava/classpath/javax/swing/JScrollPane.java
+++ b/libjava/classpath/javax/swing/JScrollPane.java
@@ -40,13 +40,14 @@ package javax.swing;
import java.awt.Component;
import java.awt.ComponentOrientation;
-import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
-import java.awt.Point;
import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -77,10 +78,73 @@ import javax.swing.plaf.UIResource;
* <tr><td>wheelScrollingEnabled </td><td>scrollPane </td><td>yes </td></tr>
* </table>
*/
-public class JScrollPane
- extends JComponent
+public class JScrollPane extends JComponent
implements Accessible, ScrollPaneConstants
{
+ /**
+ * Provides accessibility support for the <code>JScrollPane</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJScrollPane extends AccessibleJComponent
+ implements ChangeListener, PropertyChangeListener
+ {
+
+ /**
+ * The viewport of the underlying scrollpane.
+ */
+ protected JViewport viewPort;
+
+ /**
+ * Creates a new <code>AccessibleJScrollPane</code> object. This
+ * initializes the <code>viewport</code> field with the current viewport
+ * from the scrollpane associated with this
+ * <code>AccessibleJScrollPane</code>.
+ */
+ public AccessibleJScrollPane()
+ {
+ viewPort = getViewport();
+ viewPort.addChangeListener(this);
+ viewPort.addPropertyChangeListener(this);
+ }
+
+ /**
+ * Receives notification when the state of the viewport changes.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ // TODO: Figure out what should be done here, if anything.
+ }
+
+ /**
+ * Receives notification if any of the viewport's bound properties changes.
+ *
+ * @param e the propery change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ // TODO: Figure out what should be done here, if anything.
+ }
+
+ /**
+ * Resets the <code>viewPort</code> field when the scrollpane's viewport
+ * changes. This method is called by
+ * {@link JScrollPane#setViewport(JViewport)} in order to update the
+ * <code>viewPort</code> field and set up the listeners on this viewport
+ * correctly.
+ */
+ public void resetViewPort()
+ {
+ viewPort.removeChangeListener(this);
+ viewPort.removePropertyChangeListener(this);
+ viewPort = getViewport();
+ viewPort.addChangeListener(this);
+ viewPort.addPropertyChangeListener(this);
+ }
+ }
+
private static final long serialVersionUID = 5203525440012340014L;
protected JViewport columnHeader;
@@ -100,7 +164,6 @@ public class JScrollPane
Border viewportBorder;
boolean wheelScrollingEnabled;
- ChangeListener scrollListener;
public JViewport getColumnHeader()
{
@@ -228,10 +291,10 @@ public class JScrollPane
remove(c);
}
- private void addNonNull(Component c)
+ private void addNonNull(Component c, Object constraints)
{
if (c != null)
- add(c);
+ add(c, constraints);
}
public void setComponentOrientation(ComponentOrientation co)
@@ -250,7 +313,7 @@ public class JScrollPane
JViewport old = columnHeader;
removeNonNull(old);
columnHeader = h;
- addNonNull(h);
+ addNonNull(h, JScrollPane.COLUMN_HEADER);
firePropertyChange("columnHeader", old, h);
sync();
}
@@ -294,25 +357,25 @@ public class JScrollPane
{
removeNonNull(lowerRight);
lowerRight = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.LOWER_RIGHT_CORNER);
}
else if (key == UPPER_RIGHT_CORNER)
{
removeNonNull(upperRight);
upperRight = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.UPPER_RIGHT_CORNER);
}
else if (key == LOWER_LEFT_CORNER)
{
removeNonNull(lowerLeft);
lowerLeft = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.LOWER_LEFT_CORNER);
}
else if (key == UPPER_LEFT_CORNER)
{
removeNonNull(upperLeft);
upperLeft = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.UPPER_LEFT_CORNER);
}
else
throw new IllegalArgumentException("unknown corner " + key);
@@ -327,22 +390,10 @@ public class JScrollPane
JScrollBar old = horizontalScrollBar;
removeNonNull(old);
horizontalScrollBar = h;
- addNonNull(h);
+ addNonNull(h, JScrollPane.HORIZONTAL_SCROLLBAR);
firePropertyChange("horizontalScrollBar", old, h);
sync();
- if (old != null)
- {
- BoundedRangeModel model = old.getModel();
- if (model != null)
- model.removeChangeListener(scrollListener);
- }
- if (h != null)
- {
- BoundedRangeModel model = h.getModel();
- if (model != null)
- model.addChangeListener(scrollListener);
- }
}
public void setHorizontalScrollBarPolicy(int h)
@@ -359,6 +410,7 @@ public class JScrollPane
horizontalScrollBarPolicy = h;
firePropertyChange("horizontalScrollBarPolicy", old, h);
sync();
+ revalidate();
}
public void setLayout(LayoutManager l)
@@ -379,7 +431,7 @@ public class JScrollPane
JViewport old = rowHeader;
removeNonNull(old);
rowHeader = v;
- addNonNull(v);
+ addNonNull(v, JScrollPane.ROW_HEADER);
firePropertyChange("rowHeader", old, v);
sync();
}
@@ -400,22 +452,9 @@ public class JScrollPane
JScrollBar old = verticalScrollBar;
removeNonNull(old);
verticalScrollBar = v;
- addNonNull(v);
+ addNonNull(v, JScrollPane.VERTICAL_SCROLLBAR);
firePropertyChange("verticalScrollBar", old, v);
sync();
-
- if (old != null)
- {
- BoundedRangeModel model = old.getModel();
- if (model != null)
- model.removeChangeListener(scrollListener);
- }
- if (v != null)
- {
- BoundedRangeModel model = v.getModel();
- if (model != null)
- model.addChangeListener(scrollListener);
- }
}
public void setVerticalScrollBarPolicy(int v)
@@ -432,6 +471,7 @@ public class JScrollPane
verticalScrollBarPolicy = v;
firePropertyChange("verticalScrollBarPolicy", old, v);
sync();
+ revalidate();
}
public void setWheelScrollingEnabled(boolean b)
@@ -452,16 +492,17 @@ public class JScrollPane
JViewport old = viewport;
removeNonNull(old);
- if (old != null)
- old.removeChangeListener(scrollListener);
viewport = v;
- if (v != null)
- v.addChangeListener(scrollListener);
- addNonNull(v);
+ addNonNull(v, JScrollPane.VIEWPORT);
revalidate();
repaint();
firePropertyChange("viewport", old, v);
sync();
+ if (accessibleContext != null)
+ {
+ AccessibleJScrollPane asp = (AccessibleJScrollPane) accessibleContext;
+ asp.resetViewPort();
+ }
}
public void setViewportBorder(Border b)
@@ -494,79 +535,6 @@ public class JScrollPane
return true;
}
- ChangeListener createScrollListener()
- {
- return new ChangeListener()
- {
-
- public void stateChanged(ChangeEvent event)
- {
- JScrollBar vsb = JScrollPane.this.getVerticalScrollBar();
- JScrollBar hsb = JScrollPane.this.getHorizontalScrollBar();
- JViewport vp = JScrollPane.this.getViewport();
-
- if (vp != null && event.getSource() == vp)
- {
- // if the viewport changed, we should update the VSB / HSB
- // models according to the new vertical and horizontal sizes
-
- Rectangle vr = vp.getViewRect();
- Dimension vs = vp.getViewSize();
- if (vsb != null
- && (vsb.getMinimum() != 0
- || vsb.getMaximum() != vs.height
- || vsb.getValue() != vr.y
- || vsb.getVisibleAmount() != vr.height))
- vsb.setValues(vr.y, vr.height, 0, vs.height);
-
- if (hsb != null
- && (hsb.getMinimum() != 0
- || hsb.getMaximum() != vs.width
- || hsb.getValue() != vr.width
- || hsb.getVisibleAmount() != vr.height))
- hsb.setValues(vr.x, vr.width, 0, vs.width);
- }
- else
- {
- // otherwise we got a change update from either the VSB or
- // HSB model, and we need to update the viewport positions of
- // both the main viewport and any row or column headers to
- // match.
-
- int xpos = 0;
- int ypos = 0;
-
- if (vsb != null)
- ypos = vsb.getValue();
-
- if (hsb != null)
- xpos = hsb.getValue();
-
- Point pt = new Point(xpos, ypos);
-
- if (vp != null
- && vp.getViewPosition() != pt)
- vp.setViewPosition(pt);
-
- pt.x = 0;
-
- if (rowHeader != null
- && rowHeader.getViewPosition() != pt)
- rowHeader.setViewPosition(pt);
-
- pt.x = xpos;
- pt.y = 0;
-
- if (columnHeader != null
- && columnHeader.getViewPosition() != pt)
- columnHeader.setViewPosition(pt);
-
- }
- }
- };
- }
-
-
/**
* Creates a new <code>JScrollPane</code> without a view. The scrollbar
* policy is set to {@link #VERTICAL_SCROLLBAR_AS_NEEDED} and
@@ -627,7 +595,6 @@ public class JScrollPane
*/
public JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
{
- scrollListener = createScrollListener();
setVerticalScrollBarPolicy(vsbPolicy);
setVerticalScrollBar(createVerticalScrollBar());
setHorizontalScrollBarPolicy(hsbPolicy);
@@ -635,7 +602,6 @@ public class JScrollPane
viewport = createViewport();
if (view != null)
getViewport().setView(view);
- viewport.addChangeListener(scrollListener);
add(viewport,0);
setLayout(new ScrollPaneLayout());
setOpaque(false);
@@ -728,4 +694,18 @@ public class JScrollPane
}
}
}
+
+ /**
+ * Returns the accessible context associated with this
+ * <code>JScrollPane</code>.
+ *
+ * @return the accessible context associated with this
+ * <code>JScrollPane</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJScrollPane();
+ return accessibleContext;
+ }
}
diff --git a/libjava/classpath/javax/swing/JSeparator.java b/libjava/classpath/javax/swing/JSeparator.java
index 6a3b97d35c6..602af6a380c 100644
--- a/libjava/classpath/javax/swing/JSeparator.java
+++ b/libjava/classpath/javax/swing/JSeparator.java
@@ -62,6 +62,7 @@ public class JSeparator extends JComponent implements SwingConstants,
*/
protected AccessibleJSeparator()
{
+ // Nothing to do here.
}
/**
@@ -131,7 +132,6 @@ public class JSeparator extends JComponent implements SwingConstants,
public void updateUI()
{
setUI((SeparatorUI) UIManager.getUI(this));
- invalidate();
}
/**
diff --git a/libjava/classpath/javax/swing/JSlider.java b/libjava/classpath/javax/swing/JSlider.java
index 2caf509a1bb..b28b06abad7 100644
--- a/libjava/classpath/javax/swing/JSlider.java
+++ b/libjava/classpath/javax/swing/JSlider.java
@@ -118,6 +118,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented
+ // properly.
protected class AccessibleJSlider extends JComponent.AccessibleJComponent
implements AccessibleValue
{
@@ -128,6 +130,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
*/
protected AccessibleJSlider()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JSpinner.java b/libjava/classpath/javax/swing/JSpinner.java
index fc2b13e81a9..af34d9cf67d 100644
--- a/libjava/classpath/javax/swing/JSpinner.java
+++ b/libjava/classpath/javax/swing/JSpinner.java
@@ -108,10 +108,10 @@ public class JSpinner extends JComponent
/**
* DOCUMENT ME!
*/
- public void commitEdit()
- throws ParseException
+ public void commitEdit() throws ParseException
{
- } /* TODO */
+ // TODO: Implement this properly.
+ }
/**
* DOCUMENT ME!
@@ -184,7 +184,8 @@ public class JSpinner extends JComponent
*/
public void propertyChange(PropertyChangeEvent event)
{
- } /* TODO */
+ // TODO: Implement this properly.
+ }
/**
* DOCUMENT ME!
@@ -193,11 +194,12 @@ public class JSpinner extends JComponent
*/
public void stateChanged(ChangeEvent event)
{
- } /* TODO */
+ // TODO: Implement this properly.
+ }
- /* no-ops */
public void removeLayoutComponent(Component child)
{
+ // Nothing to do here.
}
/**
@@ -208,6 +210,7 @@ public class JSpinner extends JComponent
*/
public void addLayoutComponent(String name, Component child)
{
+ // Nothing to do here.
}
}
@@ -258,6 +261,31 @@ public class JSpinner extends JComponent
}
/**
+ * A <code>JSpinner</code> editor used for the {@link SpinnerListModel}.
+ * This editor uses a <code>JFormattedTextField</code> to edit the values
+ * of the spinner.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public static class ListEditor extends DefaultEditor
+ {
+ /**
+ * Creates a new instance of <code>ListEditor</code>.
+ *
+ * @param spinner the spinner for which this editor is used
+ */
+ public ListEditor(JSpinner spinner)
+ {
+ super(spinner);
+ }
+
+ public SpinnerListModel getModel()
+ {
+ return (SpinnerListModel) getSpinner().getModel();
+ }
+ }
+
+ /**
* An editor class for a <code>JSpinner</code> that is used
* for displaying and editing dates (e.g. that uses
* <code>SpinnerDateModel</code> as model).
@@ -307,7 +335,7 @@ public class JSpinner extends JComponent
/**
* Initializes the JFormattedTextField for this editor.
*
- * @param the date format to use in the formatted text field
+ * @param format the date format to use in the formatted text field
*/
private void init(SimpleDateFormat format)
{
diff --git a/libjava/classpath/javax/swing/JSplitPane.java b/libjava/classpath/javax/swing/JSplitPane.java
index cea5afef20a..cdab7bb6c4e 100644
--- a/libjava/classpath/javax/swing/JSplitPane.java
+++ b/libjava/classpath/javax/swing/JSplitPane.java
@@ -59,6 +59,8 @@ public class JSplitPane extends JComponent implements Accessible
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJSplitPane extends JComponent.AccessibleJComponent
implements AccessibleValue
{
@@ -69,6 +71,7 @@ public class JSplitPane extends JComponent implements Accessible
*/
protected AccessibleJSplitPane()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JTabbedPane.java b/libjava/classpath/javax/swing/JTabbedPane.java
index 828a69a24dc..27ba7bb82fc 100644
--- a/libjava/classpath/javax/swing/JTabbedPane.java
+++ b/libjava/classpath/javax/swing/JTabbedPane.java
@@ -56,8 +56,9 @@ import javax.swing.plaf.TabbedPaneUI;
import javax.swing.plaf.UIResource;
/**
- * This is a container for components. One component is displayed at a time.
- * Users can switch between components by clicking on tabs.
+ * This is a container for components where only one component is displayed at
+ * a given time and the displayed component can be switched by clicking on
+ * tabs.
*
* <p>
* Tabs can be oriented in several ways. They can be above, below, left and
@@ -72,12 +73,16 @@ public class JTabbedPane extends JComponent implements Serializable,
SwingConstants
{
/**
- * DOCUMENT ME!
+ * Accessibility support for <code>JTabbedPane</code>.
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent
implements AccessibleSelection, ChangeListener
{
- /** DOCUMENT ME! */
+ /**
+ * The serialization UID.
+ */
private static final long serialVersionUID = 7610530885966830483L;
/**
@@ -89,18 +94,21 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Receives notification when the selection state of the
+ * <code>JTabbedPane</code> changes.
*
- * @param e DOCUMENT ME!
+ * @param e the change event describing the change
*/
public void stateChanged(ChangeEvent e)
{
+ // Implement this properly.
}
/**
- * DOCUMENT ME!
+ * Returns the accessible role of the <code>JTabbedPane</code>, which is
+ * {@link AccessibleRole#PAGE_TAB_LIST}.
*
- * @return DOCUMENT ME!
+ * @return the accessible role of the <code>JTabbedPane</code>
*/
public AccessibleRole getAccessibleRole()
{
@@ -108,9 +116,11 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the number of accessible child components of the
+ * <code>JTabbedPane</code>.
*
- * @return DOCUMENT ME!
+ * @return the number of accessible child components of the
+ * <code>JTabbedPane</code>
*/
public int getAccessibleChildrenCount()
{
@@ -118,11 +128,11 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the accessible child component at the specified index.
*
- * @param i DOCUMENT ME!
+ * @param i the index of the child component to fetch
*
- * @return DOCUMENT ME!
+ * @return the accessible child component at the specified index
*/
public Accessible getAccessibleChild(int i)
{
@@ -130,9 +140,10 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the current selection state of the <code>JTabbedPane</code>
+ * as AccessibleSelection object.
*
- * @return DOCUMENT ME!
+ * @return the current selection state of the <code>JTabbedPane</code>
*/
public AccessibleSelection getAccessibleSelection()
{
@@ -140,11 +151,15 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the accessible child component at the specified coordinates.
+ * If there is no child component at this location, then return the
+ * currently selected tab.
*
- * @param p DOCUMENT ME!
+ * @param p the coordinates at which to look up the child component
*
- * @return DOCUMENT ME!
+ * @return the accessible child component at the specified coordinates or
+ * the currently selected tab if there is no child component at
+ * this location
*/
public Accessible getAccessibleAt(Point p)
{
@@ -152,9 +167,13 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * The number of selected child components of the
+ * <code>JTabbedPane</code>. This will be <code>0</code> if the
+ * <code>JTabbedPane</code> has no children, or <code>1</code> otherwise,
+ * since there is always exactly one tab selected.
*
- * @return DOCUMENT ME!
+ * @return number of selected child components of the
+ * <code>JTabbedPane</code>
*/
public int getAccessibleSelectionCount()
{
@@ -192,6 +211,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void addAccessibleSelection(int i)
{
+ // TODO: Implement this properly.
}
/**
@@ -201,6 +221,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void removeAccessibleSelection(int i)
{
+ // TODO: Implement this properly.
}
/**
@@ -208,6 +229,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void clearAccessibleSelection()
{
+ // TODO: Implement this properly.
}
/**
@@ -215,6 +237,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void selectAllAccessibleSelection()
{
+ // TODO: Implement this properly.
}
}
@@ -231,6 +254,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
protected ModelListener()
{
+ // Nothing to do here.
}
/**
@@ -313,9 +337,10 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void setComponent(Component c)
{
- remove(component);
- this.component = c;
- add(c);
+ int i = indexOfComponent(component);
+ insertTab(title, icon, c, tip, i);
+ component = c;
+ removeTabAt(i);
}
/**
@@ -596,7 +621,7 @@ public class JTabbedPane extends JComponent implements Serializable,
throw new IllegalArgumentException("tabLayoutPolicy is not valid.");
this.tabPlacement = tabPlacement;
layoutPolicy = tabLayoutPolicy;
-
+
changeEvent = new ChangeEvent(this);
changeListener = createChangeListener();
@@ -863,15 +888,17 @@ public class JTabbedPane extends JComponent implements Serializable,
* This method inserts tabs into JTabbedPane. This includes adding the
* component to the JTabbedPane and hiding it.
*
- * @param title The title of the tab.
- * @param icon The tab's icon.
- * @param component The component associated with the tab.
- * @param tip The tooltip for the tab.
- * @param index The index to insert the tab at.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param icon the tab's icon; may be <code>null</code>
+ * @param component the component associated with the tab
+ * @param tip the tooltip for the tab
+ * @param index the index to insert the tab at
*/
public void insertTab(String title, Icon icon, Component component,
String tip, int index)
{
+ if (title == null)
+ title = "";
Page p = new Page(title, icon, component, tip);
tabs.insertElementAt(p, index);
@@ -893,10 +920,10 @@ public class JTabbedPane extends JComponent implements Serializable,
/**
* This method adds a tab to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param icon The icon for the tab.
- * @param component The associated component.
- * @param tip The associated tooltip.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param icon the icon for the tab; may be <code>null</code>
+ * @param component the associated component
+ * @param tip the associated tooltip
*/
public void addTab(String title, Icon icon, Component component, String tip)
{
@@ -906,9 +933,9 @@ public class JTabbedPane extends JComponent implements Serializable,
/**
* This method adds a tab to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param icon The icon for the tab.
- * @param component The associated component.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param icon the icon for the tab; may be <code>null</code>
+ * @param component the associated component
*/
public void addTab(String title, Icon icon, Component component)
{
@@ -918,8 +945,8 @@ public class JTabbedPane extends JComponent implements Serializable,
/**
* This method adds a tab to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param component The associated component.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param component the associated component
*/
public void addTab(String title, Component component)
{
@@ -942,6 +969,7 @@ public class JTabbedPane extends JComponent implements Serializable,
super.add(component);
else
insertTab(component.getName(), null, component, null, tabs.size());
+
return component;
}
@@ -950,8 +978,8 @@ public class JTabbedPane extends JComponent implements Serializable,
* instance of UIResource, it doesn't add the tab and instead add the
* component directly to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param component The associated component.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param component the associated component
*
* @return The Component that was added.
*/
@@ -1025,45 +1053,37 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * The tab and it's associated component are removed. After the component
- * has been removed from the JTabbedPane, it's set visible to ensure that
- * it can be seen.
+ * Removes the tab at index. After the component associated with
+ * index is removed, its visibility is reset to true to ensure it
+ * will be visible if added to other containers.
*
* @param index The index of the tab to remove.
*/
public void removeTabAt(int index)
{
checkIndex(index, 0, tabs.size());
- Component c = getComponentAt(index);
- super.remove(index);
- c.show();
tabs.remove(index);
+ getComponentAt(index).show();
}
/**
- * This method removes the component from the JTabbedPane. After the
- * component has been removed from the JTabbedPane, it's set visible to
- * ensure that it can be seen.
+ * Removes the specified Component from the JTabbedPane.
*
* @param component The Component to remove.
*/
public void remove(Component component)
{
- // This simply removes the component.
- int index = indexOfComponent(component);
super.remove(component);
- component.show();
- setComponentAt(index, null);
}
/**
- * This method removes the tab and component from the JTabbedPane. It simply
- * calls removeTabAt(int index).
+ * Removes the tab and component which corresponds to the specified index.
*
* @param index The index of the tab to remove.
*/
public void remove(int index)
{
+ remove(getComponentAt(index));
removeTabAt(index);
}
diff --git a/libjava/classpath/javax/swing/JTable.java b/libjava/classpath/javax/swing/JTable.java
index 21680d567e2..69a865df9c0 100644
--- a/libjava/classpath/javax/swing/JTable.java
+++ b/libjava/classpath/javax/swing/JTable.java
@@ -40,22 +40,34 @@ package javax.swing;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;
import java.util.EventObject;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleExtendedTable;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleTable;
+import javax.accessibility.AccessibleTableModelChange;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ListSelectionEvent;
@@ -76,10 +88,874 @@ import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import javax.swing.text.Caret;
-public class JTable extends JComponent
+public class JTable
+ extends JComponent
implements TableModelListener, Scrollable, TableColumnModelListener,
ListSelectionListener, CellEditorListener, Accessible
{
+ /**
+ * Provides accessibility support for <code>JTable</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTable
+ extends AccessibleJComponent
+ implements AccessibleSelection, ListSelectionListener, TableModelListener,
+ TableColumnModelListener, CellEditorListener, PropertyChangeListener,
+ AccessibleExtendedTable
+ {
+
+ /**
+ * Provides accessibility support for table cells.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTableCell
+ extends AccessibleContext
+ implements Accessible, AccessibleComponent
+ {
+
+ /**
+ * The table of this cell.
+ */
+ private JTable table;
+
+ /**
+ * The row index of this cell.
+ */
+ private int row;
+
+ /**
+ * The column index of this cell.
+ */
+ private int column;
+
+ /**
+ * The index of this cell inside the AccessibleJTable parent.
+ */
+ private int index;
+
+ /**
+ * Creates a new <code>AccessibleJTableCell</code>.
+ *
+ * @param t the table
+ * @param r the row
+ * @param c the column
+ * @param i the index of this cell inside the accessible table parent
+ */
+ public AccessibleJTableCell(JTable t, int r, int c, int i)
+ {
+ table = t;
+ row = r;
+ column = c;
+ index = i;
+ }
+
+ /**
+ * Returns the accessible row for the table cell.
+ *
+ * @return the accessible row for the table cell
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ // TODO: What is the role of the table cell?
+ return AccessibleRole.UNKNOWN;
+ }
+
+ /**
+ * Returns the accessible state set of this accessible table cell.
+ *
+ * @return the accessible state set of this accessible table cell
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // TODO: What state shoiuld be returned here?
+ return new AccessibleStateSet();
+ }
+
+ /**
+ * Returns the index of this cell in the parent object.
+ *
+ * @return the index of this cell in the parent object
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return index;
+ }
+
+ /**
+ * Returns the number of children of this object. Table cells cannot have
+ * children, so we return <code>0</code> here.
+ *
+ * @return <code>0</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the accessible child at index <code>i</code>. Table cells
+ * don't have children, so we return <code>null</code> here.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the locale setting for this accessible table cell.
+ *
+ * @return the locale setting for this accessible table cell
+ */
+ public Locale getLocale()
+ {
+ // TODO: For now, we return english here. This must be fixed as soon
+ // as we have a localized Swing.
+ return Locale.ENGLISH;
+ }
+
+ /**
+ * Returns the accessible context of this table cell. Since accessible
+ * table cells are their own accessible context, we return
+ * <code>this</code>.
+ *
+ * @return the accessible context of this table cell
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the background color of this cell.
+ *
+ * @return the background color of this cell
+ */
+ public Color getBackground()
+ {
+ return table.getBackground();
+ }
+
+ /**
+ * Sets the background of the cell. Since table cells cannot have
+ * individual background colors, this method does nothing. Set the
+ * background directly on the table instead.
+ *
+ * @param color not used
+ */
+ public void setBackground(Color color)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the foreground color of the table cell.
+ *
+ * @return the foreground color of the table cell
+ */
+ public Color getForeground()
+ {
+ return table.getForeground();
+ }
+
+ /**
+ * Sets the foreground of the cell. Since table cells cannot have
+ * individual foreground colors, this method does nothing. Set the
+ * foreground directly on the table instead.
+ *
+ * @param color not used
+ */
+ public void setForeground(Color color)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the cursor for this table cell.
+ *
+ * @return the cursor for this table cell
+ */
+ public Cursor getCursor()
+ {
+ return table.getCursor();
+ }
+
+ /**
+ * Sets the cursor of the cell. Since table cells cannot have
+ * individual cursors, this method does nothing. Set the
+ * cursor directly on the table instead.
+ *
+ * @param cursor not used
+ */
+ public void setCursor(Cursor cursor)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the font of the table cell.
+ *
+ * @return the font of the table cell
+ */
+ public Font getFont()
+ {
+ return table.getFont();
+ }
+
+ /**
+ * Sets the font of the cell. Since table cells cannot have
+ * individual fonts, this method does nothing. Set the
+ * font directly on the table instead.
+ *
+ * @param font not used
+ */
+ public void setFont(Font font)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the font metrics for a specified font.
+ *
+ * @param font the font for which we return the metrics
+ *
+ * @return the font metrics for a specified font
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return table.getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is enabled,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this table cell is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean isEnabled()
+ {
+ return table.isEnabled();
+ }
+
+ /**
+ * Table cells cannot be disabled or enabled individually, so this method
+ * does nothing. Set the enabled flag on the table itself.
+ *
+ * @param b not used here
+ */
+ public void setEnabled(boolean b)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns <code>true</code> if this cell is visible, <code>false</code>
+ * otherwise.
+ *
+ * @return <code>true</code> if this cell is visible, <code>false</code>
+ * otherwise
+ */
+ public boolean isVisible()
+ {
+ return table.isVisible();
+ }
+
+ /**
+ * The visibility cannot be set on individual table cells, so this method
+ * does nothing. Set the visibility on the table itself.
+ *
+ * @param b not used
+ */
+ public void setVisible(boolean b)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is currently showing on
+ * screen.
+ *
+ * @return <code>true</code> if this table cell is currently showing on
+ * screen
+ */
+ public boolean isShowing()
+ {
+ return table.isShowing();
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell contains the location
+ * at <code>point</code>, <code>false</code> otherwise.
+ * <code>point</code> is interpreted as relative to the coordinate system
+ * of the table cell.
+ *
+ * @return <code>true</code> if this table cell contains the location
+ * at <code>point</code>, <code>false</code> otherwise
+ */
+ public boolean contains(Point point)
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ cellRect.x = 0;
+ cellRect.y = 0;
+ return cellRect.contains(point);
+ }
+
+ /**
+ * Returns the screen location of the table cell.
+ *
+ * @return the screen location of the table cell
+ */
+ public Point getLocationOnScreen()
+ {
+ Point tableLoc = table.getLocationOnScreen();
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ tableLoc.x += cellRect.x;
+ tableLoc.y += cellRect.y;
+ return tableLoc;
+ }
+
+ /**
+ * Returns the location of this cell relative to the table's bounds.
+ *
+ * @return the location of this cell relative to the table's bounds
+ */
+ public Point getLocation()
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ return new Point(cellRect.x, cellRect.y);
+ }
+
+ /**
+ * The location of the table cells cannot be manipulated directly, so
+ * this method does nothing.
+ *
+ * @param point not used
+ */
+ public void setLocation(Point point)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the bounds of the cell relative to its table.
+ *
+ * @return the bounds of the cell relative to its table
+ */
+ public Rectangle getBounds()
+ {
+ return table.getCellRect(row, column, true);
+ }
+
+ /**
+ * The bounds of the table cells cannot be manipulated directly, so
+ * this method does nothing.
+ *
+ * @param rectangle not used
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the size of the table cell.
+ *
+ * @return the size of the table cell
+ */
+ public Dimension getSize()
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ return new Dimension(cellRect.width, cellRect.height);
+ }
+
+ /**
+ * The size cannot be set on table cells directly, so this method does
+ * nothing.
+ *
+ * @param dimension not used
+ */
+ public void setSize(Dimension dimension)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Table cells have no children, so we return <code>null</code> here.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is focus traversable,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this table cell is focus traversable,
+ * <code>false</code> otherwise
+ */
+ public boolean isFocusTraversable()
+ {
+ return table.isFocusable();
+ }
+
+ /**
+ * Requests that this table cell gets the keyboard focus.
+ */
+ public void requestFocus()
+ {
+ // We first set the selection models' lead selection to this cell.
+ table.getColumnModel().getSelectionModel()
+ .setLeadSelectionIndex(column);
+ table.getSelectionModel().setLeadSelectionIndex(row);
+ // Now we request that the table receives focus.
+ table.requestFocus();
+ }
+
+ /**
+ * Adds a focus listener to this cell. The focus listener is really
+ * added to the table, so there is no way to find out when an individual
+ * cell changes the focus.
+ *
+ * @param listener the focus listener to add
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ table.addFocusListener(listener);
+ }
+
+ /**
+ * Removes a focus listener from the cell. The focus listener is really
+ * removed from the table.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ table.removeFocusListener(listener);
+ }
+
+ }
+
+ protected class AccessibleJTableModelChange
+ implements AccessibleTableModelChange
+ {
+ protected int type;
+ protected int firstRow;
+ protected int lastRow;
+ protected int firstColumn;
+ protected int lastColumn;
+
+ protected AccessibleJTableModelChange(int type, int firstRow,
+ int lastRow, int firstColumn,
+ int lastColumn)
+ {
+ this.type = type;
+ this.firstRow = firstRow;
+ this.lastRow = lastRow;
+ this.firstColumn = firstColumn;
+ this.lastColumn = lastColumn;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+
+ public int getFirstRow()
+ {
+ return firstRow;
+ }
+
+ public int getLastRow()
+ {
+ return lastRow;
+ }
+
+ public int getFirstColumn()
+ {
+ return firstColumn;
+ }
+
+ public int getLastColumn()
+ {
+ return lastColumn;
+ }
+ }
+
+ /**
+ * Creates a new <code>AccessibleJTable</code>.
+ *
+ * @since JDK1.5
+ */
+ protected AccessibleJTable()
+ {
+ getModel().addTableModelListener(this);
+ getSelectionModel().addListSelectionListener(this);
+ getColumnModel().addColumnModelListener(this);
+ getCellEditor().addCellEditorListener(this);
+ }
+
+ /**
+ * Returns the number of selected items in this table.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectedColumnCount();
+ }
+
+ public Accessible getAccessibleSelection(int i)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isAccessibleChildSelected(int i)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void addAccessibleSelection(int i)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeAccessibleSelection(int i)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void clearAccessibleSelection()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void selectAllAccessibleSelection()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void valueChanged(ListSelectionEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Receives notification when the table model changes. Depending on the
+ * type of change, this method calls {@link #tableRowsInserted} or
+ * {@link #tableRowsDeleted}.
+ *
+ * @param event the table model event
+ */
+ public void tableChanged(TableModelEvent event)
+ {
+ switch (event.getType())
+ {
+ case TableModelEvent.INSERT:
+ tableRowsInserted(event);
+ break;
+ case TableModelEvent.DELETE:
+ tableRowsDeleted(event);
+ break;
+ }
+ }
+
+ /**
+ * Receives notification when one or more rows have been inserted into the
+ * table.
+ *
+ * @param event the table model event
+ */
+ public void tableRowsInserted(TableModelEvent event)
+ {
+ // TODO: What to do here, if anything? This might be a hook method for
+ // subclasses...
+ }
+
+ /**
+ * Receives notification when one or more rows have been deleted from the
+ * table.
+ *
+ * @param event the table model event
+ */
+ public void tableRowsDeleted(TableModelEvent event)
+ {
+ // TODO: What to do here, if anything? This might be a hook method for
+ // subclasses...
+ }
+
+ public void columnAdded(TableColumnModelEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnMarginChanged(ChangeEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnMoved(TableColumnModelEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnRemoved(TableColumnModelEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnSelectionChanged(ListSelectionEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void editingCanceled(ChangeEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void editingStopped(ChangeEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Receives notification when any of the JTable's properties changes. This
+ * is used to replace the listeners on the table's model, selection model,
+ * column model and cell editor.
+ *
+ * @param e the property change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propName = e.getPropertyName();
+ if (propName.equals("tableModel"))
+ {
+ TableModel oldModel = (TableModel) e.getOldValue();
+ oldModel.removeTableModelListener(this);
+ TableModel newModel = (TableModel) e.getNewValue();
+ newModel.addTableModelListener(this);
+ }
+ else if (propName.equals("columnModel"))
+ {
+ TableColumnModel oldModel = (TableColumnModel) e.getOldValue();
+ oldModel.removeColumnModelListener(this);
+ TableColumnModel newModel = (TableColumnModel) e.getNewValue();
+ newModel.addColumnModelListener(this);
+ }
+ else if (propName.equals("selectionModel"))
+ {
+ ListSelectionModel oldModel = (ListSelectionModel) e.getOldValue();
+ oldModel.removeListSelectionListener(this);
+ ListSelectionModel newModel = (ListSelectionModel) e.getNewValue();
+ newModel.addListSelectionListener(this);
+ }
+ else if (propName.equals("cellEditor"))
+ {
+ CellEditor oldEd = (CellEditor) e.getOldValue();
+ oldEd.removeCellEditorListener(this);
+ CellEditor newEd = (CellEditor) e.getNewValue();
+ newEd.addCellEditorListener(this);
+ }
+ }
+
+ public int getAccessibleRow(int index)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleColumn(int index)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleIndex(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Accessible getAccessibleCaption()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleCaption(Accessible caption)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Accessible getAccessibleSummary()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleSummary(Accessible summary)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public int getAccessibleRowCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleColumnCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Accessible getAccessibleAt(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getAccessibleRowExtentAt(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleColumnExtentAt(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccessibleTable getAccessibleRowHeader()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleRowHeader(AccessibleTable header)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public AccessibleTable getAccessibleColumnHeader()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleColumnHeader(AccessibleTable header)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Accessible getAccessibleRowDescription(int r)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleRowDescription(int r, Accessible description)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Accessible getAccessibleColumnDescription(int c)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleColumnDescription(int c, Accessible description)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isAccessibleSelected(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isAccessibleRowSelected(int r)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isAccessibleColumnSelected(int c)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public int[] getSelectedAccessibleRows()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int[] getSelectedAccessibleColumns()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+ /**
+ * Handles property changes from the <code>TableColumn</code>s of this
+ * <code>JTable</code>.
+ *
+ * More specifically, this triggers a {@link #revalidate()} call if the
+ * preferredWidth of one of the observed columns changes.
+ */
+ class TableColumnPropertyChangeHandler implements PropertyChangeListener
+ {
+ /**
+ * Receives notification that a property of the observed TableColumns
+ * has changed.
+ *
+ * @param ev the property change event
+ */
+ public void propertyChange(PropertyChangeEvent ev)
+ {
+ if (ev.getPropertyName().equals("preferredWidth"))
+ {
+ JTableHeader header = getTableHeader();
+ TableColumn col = (TableColumn) ev.getSource();
+ header.setResizingColumn(col);
+ doLayout();
+ header.setResizingColumn(null);
+ }
+ }
+ }
/**
* A cell renderer for boolean values.
@@ -364,7 +1240,7 @@ public class JTable extends JComponent
* property when the {@link #dataModel} property is changed.
*
* @see #setModel(TableModel)
- * @see #createColumnsFromModel()
+ * @see #createDefaultColumnsFromModel()
* @see #setColumnModel(TableColumnModel)
* @see #setAutoCreateColumnsFromModel(boolean)
* @see #getAutoCreateColumnsFromModel()
@@ -480,11 +1356,6 @@ public class JTable extends JComponent
protected ListSelectionModel selectionModel;
/**
- * The accessibleContext property.
- */
- protected AccessibleContext accessibleContext;
-
- /**
* The current cell editor.
*/
protected TableCellEditor cellEditor;
@@ -492,7 +1363,7 @@ public class JTable extends JComponent
/**
* Whether or not drag-and-drop is enabled on this table.
*
- * @see #setDragEnabled()
+ * @see #setDragEnabled(boolean)
* @see #getDragEnabled()
*/
private boolean dragEnabled;
@@ -584,6 +1455,12 @@ public class JTable extends JComponent
Object oldCellValue;
/**
+ * The property handler for this table's columns.
+ */
+ TableColumnPropertyChangeHandler tableColumnPropertyChangeHandler =
+ new TableColumnPropertyChangeHandler();
+
+ /**
* Creates a new <code>JTable</code> instance.
*/
public JTable ()
@@ -643,15 +1520,28 @@ public class JTable extends JComponent
*/
public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm)
{
- setModel(dm == null ? createDefaultDataModel() : dm);
+ boolean autoCreate = false;
+ if (cm != null)
+ setColumnModel(cm);
+ else
+ {
+ setColumnModel(createDefaultColumnModel());
+ autoCreate = true;
+ }
setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);
-
- this.columnModel = cm;
+ setModel(dm == null ? createDefaultDataModel() : dm);
+ setAutoCreateColumnsFromModel(autoCreate);
initializeLocalVars();
- // The next two lines are for compliance with the JDK which starts
- // the JLists associated with a JTable with both lead selection
- // indices at 0, rather than -1 as in regular JLists
+ // The following four lines properly set the lead selection indices.
+ // After this, the UI will handle the lead selection indices.
+ // FIXME: this should probably not be necessary, if the UI is installed
+ // before the TableModel is set then the UI will handle things on its
+ // own, but certain variables need to be set before the UI can be installed
+ // so we must get the correct order for all the method calls in this
+ // constructor.
+ selectionModel.setAnchorSelectionIndex(0);
selectionModel.setLeadSelectionIndex(0);
+ columnModel.getSelectionModel().setAnchorSelectionIndex(0);
columnModel.getSelectionModel().setLeadSelectionIndex(0);
updateUI();
}
@@ -659,12 +1549,8 @@ public class JTable extends JComponent
protected void initializeLocalVars()
{
setTableHeader(createDefaultTableHeader());
- this.autoCreateColumnsFromModel = false;
- if (columnModel == null)
- {
- this.autoCreateColumnsFromModel = true;
- createColumnsFromModel();
- }
+ if (autoCreateColumnsFromModel)
+ createDefaultColumnsFromModel();
this.columnModel.addColumnModelListener(this);
this.defaultRenderersByColumnClass = new Hashtable();
@@ -754,6 +1640,7 @@ public class JTable extends JComponent
}
columnModel.addColumn(column);
+ column.addPropertyChangeListener(tableColumnPropertyChangeHandler);
}
protected void createDefaultEditors()
@@ -799,20 +1686,6 @@ public class JTable extends JComponent
return new JTableHeader(columnModel);
}
- private void createColumnsFromModel()
- {
- if (dataModel == null)
- return;
-
- TableColumnModel cm = createDefaultColumnModel();
-
- for (int i = 0; i < dataModel.getColumnCount(); ++i)
- {
- cm.addColumn(new TableColumn(i));
- }
- this.setColumnModel(cm);
- }
-
// listener support
public void columnAdded (TableColumnModelEvent event)
@@ -890,8 +1763,19 @@ public class JTable extends JComponent
if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)
&& autoCreateColumnsFromModel)
- createColumnsFromModel();
+ createDefaultColumnsFromModel();
+ // If the structure changes, we need to revalidate, since that might
+ // affect the size parameters of the JTable. Otherwise we only need
+ // to perform a repaint to update the view.
+ if (event.getType() == TableModelEvent.INSERT)
+ revalidate();
+ else if (event.getType() == TableModelEvent.DELETE)
+ {
+ if (dataModel.getRowCount() == 0)
+ clearSelection();
+ revalidate();
+ }
repaint();
}
@@ -944,8 +1828,7 @@ public class JTable extends JComponent
{
int y0 = getLocation().y;
int nrows = getRowCount();
- Dimension gap = getIntercellSpacing();
- int height = getRowHeight() + (gap == null ? 0 : gap.height);
+ int height = getRowHeight();
int y = point.y;
for (int i = 0; i < nrows; ++i)
@@ -990,10 +1873,7 @@ public class JTable extends JComponent
int y = (height + y_gap) * row;
for (int i = 0; i < column; ++i)
- {
- x += columnModel.getColumn(i).getWidth();
- x += x_gap;
- }
+ x += columnModel.getColumn(i).getWidth();
if (includeSpacing)
return new Rectangle(x, y, width, height);
@@ -1015,7 +1895,7 @@ public class JTable extends JComponent
* @return The current value of the selectedRow property
*/
public int getSelectedRow ()
- {
+ {
return selectionModel.getMinSelectionIndex();
}
@@ -1069,13 +1949,14 @@ public class JTable extends JComponent
// scroll direction.
if (orientation == SwingConstants.VERTICAL)
- return rowHeight;
+ return direction * rowHeight;
else
{
int sum = 0;
for (int i = 0; i < getColumnCount(); ++i)
sum += columnModel.getColumn(0).getWidth();
- return getColumnCount() == 0 ? 10 : sum / getColumnCount();
+ int inc = getColumnCount() == 0 ? 10 : sum / getColumnCount();
+ return direction * inc;
}
}
@@ -1656,24 +2537,29 @@ public class JTable extends JComponent
// Don't do anything if setting the current model again.
if (dataModel == m)
return;
-
+
+ TableModel oldModel = dataModel;
+
// Remove table as TableModelListener from old model.
if (dataModel != null)
dataModel.removeTableModelListener(this);
if (m != null)
{
- // Set property.
+ // Set property.
dataModel = m;
- // Add table as TableModelListener to new model.
- dataModel.addTableModelListener(this);
+ // Add table as TableModelListener to new model.
+ dataModel.addTableModelListener(this);
- // Automatically create columns.
- if (autoCreateColumnsFromModel)
- createColumnsFromModel();
+ // Automatically create columns.
+ if (autoCreateColumnsFromModel)
+ createDefaultColumnsFromModel();
}
-
+
+ // This property is bound, so we fire a property change event.
+ firePropertyChange("model", oldModel, dataModel);
+
// Repaint table.
revalidate();
repaint();
@@ -1959,7 +2845,8 @@ public class JTable extends JComponent
int average = spill / cols.length;
for (int i = 0; i < cols.length; i++)
{
- cols[i].setWidth(cols[i].getWidth() + average);
+ if (cols[i] != null)
+ cols[i].setWidth(cols[i].getWidth() + average);
}
}
@@ -2023,6 +2910,8 @@ public class JTable extends JComponent
case AUTO_RESIZE_OFF:
default:
+ int prefWidth = resizingColumn.getPreferredWidth();
+ resizingColumn.setWidth(prefWidth);
}
}
else
@@ -2258,6 +3147,8 @@ public class JTable extends JComponent
*/
public void createDefaultColumnsFromModel()
{
+ assert columnModel != null : "The columnModel must not be null.";
+
// remove existing columns
int columnIndex = columnModel.getColumnCount() - 1;
while (columnIndex >= 0)
@@ -2272,7 +3163,9 @@ public class JTable extends JComponent
{
TableColumn column = new TableColumn(c);
column.setIdentifier(dataModel.getColumnName(c));
+ column.setHeaderValue(dataModel.getColumnName(c));
columnModel.addColumn(column);
+ column.addPropertyChangeListener(tableColumnPropertyChangeHandler);
}
}
@@ -2372,4 +3265,13 @@ public class JTable extends JComponent
return editor.getTableCellEditorComponent
(this, getValueAt(row, column), isCellSelected(row, column), row, column);
}
+
+ /**
+ * This revalidates the <code>JTable</code> and queues a repaint.
+ */
+ protected void resizeAndRepaint()
+ {
+ revalidate();
+ repaint();
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextArea.java b/libjava/classpath/javax/swing/JTextArea.java
index 53591ffcc3a..2fa185b6207 100644
--- a/libjava/classpath/javax/swing/JTextArea.java
+++ b/libjava/classpath/javax/swing/JTextArea.java
@@ -42,6 +42,8 @@ import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Rectangle;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleStateSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
@@ -92,6 +94,35 @@ import javax.swing.text.View;
public class JTextArea extends JTextComponent
{
/**
+ * Provides accessibility support for <code>JTextArea</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTextArea extends AccessibleJTextComponent
+ {
+
+ /**
+ * Creates a new <code>AccessibleJTextArea</code> object.
+ */
+ protected AccessibleJTextArea()
+ {
+ super();
+ }
+
+ /**
+ * Returns the accessible state of this <code>AccessibleJTextArea</code>.
+ *
+ * @return the accessible state of this <code>AccessibleJTextArea</code>
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added here to the super's state.
+ return state;
+ }
+ }
+
+ /**
* Compatible with Sun's JDK
*/
private static final long serialVersionUID = -6141680179310439825L;
@@ -208,6 +239,8 @@ public class JTextArea extends JTextComponent
/* This shouldn't happen in theory -- but, if it does... */
throw new RuntimeException("Unexpected exception occurred.", exception);
}
+ if (toAppend != null && toAppend.length() > 0)
+ revalidate();
}
/**
@@ -312,8 +345,12 @@ public class JTextArea extends JTextComponent
{
if (columns < 0)
throw new IllegalArgumentException();
-
- this.columns = columns;
+
+ if (columns != this.columns)
+ {
+ this.columns = columns;
+ revalidate();
+ }
}
/**
@@ -337,8 +374,12 @@ public class JTextArea extends JTextComponent
{
if (rows < 0)
throw new IllegalArgumentException();
-
- this.rows = rows;
+
+ if (rows != this.rows)
+ {
+ this.rows = rows;
+ revalidate();
+ }
}
/**
@@ -547,4 +588,16 @@ public class JTextArea extends JTextComponent
return new Dimension(Math.max(reqWidth, neededWidth),
Math.max(reqHeight, neededHeight));
}
+
+ /**
+ * Returns the accessible context associated with the <code>JTextArea</code>.
+ *
+ * @return the accessible context associated with the <code>JTextArea</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJTextArea();
+ return accessibleContext;
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextField.java b/libjava/classpath/javax/swing/JTextField.java
index 5ae9c9f1a82..8dc2f256914 100644
--- a/libjava/classpath/javax/swing/JTextField.java
+++ b/libjava/classpath/javax/swing/JTextField.java
@@ -46,9 +46,8 @@ import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleStateSet;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;
@@ -69,15 +68,19 @@ public class JTextField extends JTextComponent
*/
protected AccessibleJTextField()
{
+ super();
}
/**
- * getAccessibleStateSet
- * @return AccessibleStateSet
+ * Returns the accessible state of this <code>AccessibleJTextField</code>.
+ *
+ * @return the accessible state of this <code>AccessibleJTextField</code>
*/
public AccessibleStateSet getAccessibleStateSet()
{
- return null;
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added here to the super's state.
+ return state;
}
}
@@ -92,17 +95,17 @@ public class JTextField extends JTextComponent
public static final String notifyAction = "notify-field-accept";
static
- {
- actions = new Action[1];
- actions[0] = new TextAction(notifyAction)
+ {
+ actions = new Action[1];
+ actions[0] = new TextAction(notifyAction)
{
- public void actionPerformed(ActionEvent event)
- {
- JTextField textField = (JTextField) event.getSource();
- textField.fireActionPerformed();
- }
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextField textField = (JTextField) event.getSource();
+ textField.fireActionPerformed();
+ }
};
- }
+ }
private int columns;
private int align;
@@ -117,6 +120,11 @@ public class JTextField extends JTextComponent
private PropertyChangeListener actionPropertyChangeListener;
/**
+ * The horizontal visibility of the textfield.
+ */
+ private BoundedRangeModel horizontalVisibility;
+
+ /**
* Creates a new instance of <code>JTextField</code>.
*/
public JTextField()
@@ -172,9 +180,9 @@ public class JTextField extends JTextComponent
{
if (columns < 0)
throw new IllegalArgumentException();
-
+
this.columns = columns;
-
+
setDocument(doc == null ? createDefaultModel() : doc);
if (text != null)
@@ -182,6 +190,9 @@ public class JTextField extends JTextComponent
// default value for alignment
align = LEADING;
+
+ // Initialize the horizontal visibility model.
+ horizontalVisibility = new DefaultBoundedRangeModel();
}
/**
@@ -192,15 +203,9 @@ public class JTextField extends JTextComponent
*/
protected Document createDefaultModel()
{
- // subclassed to swallow newlines
- return new PlainDocument() {
- public void insertString(int offset, String str, AttributeSet a)
- throws BadLocationException
- {
- if (str != null && str.indexOf('\n') == -1)
- super.insertString(offset, str, a);
- }
- };
+ PlainDocument doc = new PlainDocument();
+ doc.putProperty("filterNewlines", Boolean.TRUE);
+ return doc;
}
/**
@@ -268,6 +273,11 @@ public class JTextField extends JTextComponent
return columns;
}
+ /**
+ * Sets the number of columns and then invalidates the layout.
+ * @param columns the number of columns
+ * @throws IllegalArgumentException if columns < 0
+ */
public void setColumns(int columns)
{
if (columns < 0)
@@ -275,16 +285,31 @@ public class JTextField extends JTextComponent
this.columns = columns;
invalidate();
+ //FIXME: do we need this repaint call?
repaint();
}
+ /**
+ * Returns the horizontal alignment, which is one of: JTextField.LEFT,
+ * JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING,
+ * JTextField.TRAILING.
+ * @return the horizontal alignment
+ */
public int getHorizontalAlignment()
{
return align;
}
+ /**
+ * Sets the horizontal alignment of the text. Calls invalidate and repaint
+ * and fires a property change event.
+ * @param newAlign must be one of: JTextField.LEFT, JTextField.CENTER,
+ * JTextField.RIGHT, JTextField.LEADING, JTextField.TRAILING.
+ * @throws IllegalArgumentException if newAlign is not one of the above.
+ */
public void setHorizontalAlignment(int newAlign)
{
+ //FIXME: should throw an IllegalArgumentException if newAlign is invalid
if (align == newAlign)
return;
@@ -295,12 +320,20 @@ public class JTextField extends JTextComponent
repaint();
}
+ /**
+ * Sets the current font and revalidates so the font will take effect.
+ */
public void setFont(Font newFont)
{
super.setFont(newFont);
revalidate();
}
+ /**
+ * Returns the preferred size. If there is a non-zero number of columns,
+ * this is the number of columns multiplied by the column width, otherwise
+ * it returns super.getPreferredSize().
+ */
public Dimension getPreferredSize()
{
Dimension size = super.getPreferredSize();
@@ -318,6 +351,7 @@ public class JTextField extends JTextComponent
*/
public int getScrollOffset()
{
+ //FIXME: this should return horizontalVisibility's value
return scrollOffset;
}
@@ -328,9 +362,15 @@ public class JTextField extends JTextComponent
*/
public void setScrollOffset(int offset)
{
+ //FIXME: this should actualy scroll the field if needed
scrollOffset = offset;
}
+ /**
+ * Returns the set of Actions that are commands for the editor.
+ * This is the actions supported by this editor plus the actions
+ * of the UI (returned by JTextComponent.getActions()).
+ */
public Action[] getActions()
{
return TextAction.augmentList(super.getActions(), actions);
@@ -364,26 +404,27 @@ public class JTextField extends JTextComponent
if (action != null)
{
- removeActionListener(action);
- action.removePropertyChangeListener(actionPropertyChangeListener);
- actionPropertyChangeListener = null;
+ removeActionListener(action);
+ action.removePropertyChangeListener(actionPropertyChangeListener);
+ actionPropertyChangeListener = null;
}
-
+
Action oldAction = action;
action = newAction;
if (action != null)
{
- addActionListener(action);
- actionPropertyChangeListener =
- createActionPropertyChangeListener(action);
- action.addPropertyChangeListener(actionPropertyChangeListener);
+ addActionListener(action);
+ actionPropertyChangeListener = createActionPropertyChangeListener(action);
+ action.addPropertyChangeListener(actionPropertyChangeListener);
}
-
+
+ //FIXME: is this a hack? The horizontal alignment hasn't changed
firePropertyChange("horizontalAlignment", oldAction, newAction);
}
/**
+ * Sets the command string used in action events.
* @since 1.3
*/
public void setActionCommand(String command)
@@ -397,45 +438,79 @@ public class JTextField extends JTextComponent
protected PropertyChangeListener createActionPropertyChangeListener(Action action)
{
return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent event)
{
- public void propertyChange(PropertyChangeEvent event)
- {
- // Update properties "action" and "horizontalAlignment".
- String name = event.getPropertyName();
-
- if (name.equals("enabled"))
- {
- boolean enabled = ((Boolean) event.getNewValue()).booleanValue();
- JTextField.this.setEnabled(enabled);
- }
- else if (name.equals(Action.SHORT_DESCRIPTION))
- {
- JTextField.this.setToolTipText((String) event.getNewValue());
- }
- }
- };
+ // Update properties "action" and "horizontalAlignment".
+ String name = event.getPropertyName();
+
+ if (name.equals("enabled"))
+ {
+ boolean enabled = ((Boolean) event.getNewValue()).booleanValue();
+ JTextField.this.setEnabled(enabled);
+ }
+ else if (name.equals(Action.SHORT_DESCRIPTION))
+ {
+ JTextField.this.setToolTipText((String) event.getNewValue());
+ }
+ }
+ };
}
/**
+ *
* @since 1.3
*/
protected void configurePropertiesFromAction(Action action)
{
if (action != null)
{
- setEnabled(action.isEnabled());
- setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
+ setEnabled(action.isEnabled());
+ setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
}
else
{
- setEnabled(true);
- setToolTipText(null);
+ setEnabled(true);
+ setToolTipText(null);
}
}
+ /**
+ * Returns the column width, which is the width of the character m
+ * for the font in use.
+ * @return the width of the character m for the font in use.
+ */
protected int getColumnWidth()
{
FontMetrics metrics = getToolkit().getFontMetrics(getFont());
return metrics.charWidth('m');
}
+
+ /**
+ * Returns the accessible context associated with the <code>JTextField</code>.
+ *
+ * @return the accessible context associated with the <code>JTextField</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJTextField();
+ return accessibleContext;
+ }
+
+ /**
+ * Returns the bounded range model that describes the horizontal visibility
+ * of the text field in the case when the text does not fit into the
+ * available space. The actual values of this model are managed by the look
+ * and feel implementation.
+ *
+ * @return the bounded range model that describes the horizontal visibility
+ */
+ 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;
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextPane.java b/libjava/classpath/javax/swing/JTextPane.java
index 80632fff38e..1f5b99e43c5 100644
--- a/libjava/classpath/javax/swing/JTextPane.java
+++ b/libjava/classpath/javax/swing/JTextPane.java
@@ -39,8 +39,6 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
@@ -49,7 +47,6 @@ import javax.swing.text.Document;
import javax.swing.text.EditorKit;
import javax.swing.text.Element;
import javax.swing.text.MutableAttributeSet;
-import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.Style;
import javax.swing.text.StyledDocument;
import javax.swing.text.StyledEditorKit;
@@ -106,7 +103,7 @@ public class JTextPane
* @throws IllegalArgumentException if <code>document</code> is not an
* instance of <code>StyledDocument</code>
*
- * @see {@link #setStyledDocument}
+ * @see #setStyledDocument
*/
public void setDocument(Document document)
{
@@ -120,7 +117,7 @@ public class JTextPane
/**
* Returns the {@link StyledDocument} that is the content model for
* this <code>JTextPane</code>. This is a typed wrapper for
- * {@link #getDocument}.
+ * {@link #getDocument()}.
*
* @return the content model of this <code>JTextPane</code>
*/
@@ -179,8 +176,6 @@ public class JTextPane
doc.setCharacterAttributes(start, contentLength, getInputAttributes(),
true);
- // Set dot to new position.
- setCaretPosition(start + contentLength);
}
catch (BadLocationException e)
{
@@ -300,7 +295,7 @@ public class JTextPane
* @param replace if <code>true</code>, the attributes of the current
* selection are overridden, otherwise they are merged
*
- * @see {@link #getInputAttributes}
+ * @see #getInputAttributes
*/
public void setCharacterAttributes(AttributeSet attribute,
boolean replace)
diff --git a/libjava/classpath/javax/swing/JToggleButton.java b/libjava/classpath/javax/swing/JToggleButton.java
index 25d67f59e4f..077e5adb887 100644
--- a/libjava/classpath/javax/swing/JToggleButton.java
+++ b/libjava/classpath/javax/swing/JToggleButton.java
@@ -129,7 +129,7 @@ public class JToggleButton extends AbstractButton implements Accessible
* Compatible with Sun's JDK.
*/
private static final long serialVersionUID = -1589950750899943974L;
-
+
/**
* Sets the pressed state of the button. The selected state
* of the button also changes follwing the button being pressed.
@@ -174,8 +174,27 @@ public class JToggleButton extends AbstractButton implements Accessible
ActionEvent.ACTION_PERFORMED,
actionCommand));
}
-
}
+
+ /**
+ * Checks if the button is selected.
+ *
+ * @returns true if the button is selected
+ */
+ public boolean isSelected()
+ {
+ return super.isSelected();
+ }
+
+ /**
+ * Sets the selected state of the button.
+ *
+ * @param b true if button is selected
+ */
+ public void setSelected(boolean b)
+ {
+ super.setSelected(b);
+ }
}
/**
@@ -276,6 +295,7 @@ public class JToggleButton extends AbstractButton implements Accessible
setModel(new ToggleButtonModel());
model.setSelected(selected);
+ setAlignmentX(LEFT_ALIGNMENT);
}
/**
diff --git a/libjava/classpath/javax/swing/JToolBar.java b/libjava/classpath/javax/swing/JToolBar.java
index 649919e0618..a508ee6d8e7 100644
--- a/libjava/classpath/javax/swing/JToolBar.java
+++ b/libjava/classpath/javax/swing/JToolBar.java
@@ -68,6 +68,8 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
/**
* AccessibleJToolBar
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJToolBar extends AccessibleJComponent
{
/** DOCUMENT ME! */
@@ -78,6 +80,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
*/
protected AccessibleJToolBar()
{
+ // Nothing to do here.
}
/**
@@ -749,7 +752,6 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
{
AbstractButton b = (AbstractButton) component;
b.setRolloverEnabled(rollover);
- b.updateUI();
}
} // addImpl()
diff --git a/libjava/classpath/javax/swing/JToolTip.java b/libjava/classpath/javax/swing/JToolTip.java
index 8d774782780..6bc3e3fa287 100644
--- a/libjava/classpath/javax/swing/JToolTip.java
+++ b/libjava/classpath/javax/swing/JToolTip.java
@@ -58,6 +58,8 @@ public class JToolTip extends JComponent implements Accessible
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJToolTip extends AccessibleJComponent
{
private static final long serialVersionUID = -6222548177795408476L;
@@ -67,6 +69,7 @@ public class JToolTip extends JComponent implements Accessible
*/
protected AccessibleJToolTip()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JTree.java b/libjava/classpath/javax/swing/JTree.java
index bb24c7a459d..4422a193396 100644
--- a/libjava/classpath/javax/swing/JTree.java
+++ b/libjava/classpath/javax/swing/JTree.java
@@ -37,16 +37,32 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Color;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
+import javax.accessibility.AccessibleValue;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeModelEvent;
@@ -57,7 +73,6 @@ import javax.swing.event.TreeWillExpandListener;
import javax.swing.plaf.TreeUI;
import javax.swing.text.Position;
import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.ExpandVetoException;
@@ -68,1754 +83,2830 @@ import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
-public class JTree
- extends JComponent
- implements Scrollable, Accessible
+public class JTree extends JComponent implements Scrollable, Accessible
{
- /**
- * Listens to the model of the JTree and updates the property
- * <code>expandedState</code> if nodes are removed or changed.
- */
- protected class TreeModelHandler
- implements
- TreeModelListener
- {
-
- /**
- * Creates a new instance of TreeModelHandler.
- */
- protected TreeModelHandler()
- {
- }
-
- /**
- * Notifies when a node has changed in some ways. This does not include
- * that a node has changed its location or changed it's children. It
- * only means that some attributes of the node have changed that might
- * affect its presentation.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeNodesChanged(TreeModelEvent ev)
- {
- // nothing to do here
- }
-
- /**
- * Notifies when a node is inserted into the tree.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeNodesInserted(TreeModelEvent ev)
- {
- // nothing to do here
- }
-
- /**
- * Notifies when a node is removed from the tree.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeNodesRemoved(TreeModelEvent ev)
- {
- // TODO: The API docs suggest that this method should do something
- // but I cannot really see what has to be done here ...
- }
-
- /**
- * Notifies when the structure of the tree is changed.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeStructureChanged(TreeModelEvent ev)
- {
- // set state of new path
- TreePath path = ev.getTreePath();
- setExpandedState(path, isExpanded(path));
- }
- } // TreeModelHandler
-
- /**
- * This redirects TreeSelectionEvents and rewrites the source of it to be
- * this JTree. This is typically done when the tree model generates an
- * event, but the JTree object associated with that model should be listed
- * as the actual source of the event.
- */
- protected class TreeSelectionRedirector
- implements
- TreeSelectionListener,
- Serializable
- {
- /** The serial version UID. */
- private static final long serialVersionUID = -3505069663646241664L;
-
- /**
- * Creates a new instance of TreeSelectionRedirector
- */
- protected TreeSelectionRedirector()
- {
- }
-
- /**
- * Notifies when the tree selection changes.
- *
- * @param ev the TreeSelectionEvent that describes the change
- */
- public void valueChanged(TreeSelectionEvent ev)
- {
- TreeSelectionEvent rewritten = (TreeSelectionEvent) ev
- .cloneWithSource(JTree.this);
- fireValueChanged(rewritten);
- JTree.this.repaint();
- }
- } // TreeSelectionRedirector
-
- /**
- * A TreeModel that does not allow anything to be selected.
+
+ /**
+ * This class implements accessibility support for the JTree class. It
+ * provides an implementation of the Java Accessibility API appropriate
+ * to tree user-interface elements.
+ */
+ protected class AccessibleJTree extends JComponent.AccessibleJComponent
+ implements AccessibleSelection, TreeSelectionListener, TreeModelListener,
+ TreeExpansionListener
+ {
+
+ /**
+ * This class implements accessibility support for the JTree child. It provides
+ * an implementation of the Java Accessibility API appropriate to tree nodes.
+ */
+ protected class AccessibleJTreeNode extends AccessibleContext
+ implements Accessible, AccessibleComponent, AccessibleSelection,
+ AccessibleAction
+ {
+
+ private JTree tree;
+ private TreePath tp;
+ private Accessible acc;
+ private AccessibleStateSet states;
+ private Vector selectionList;
+ private Vector actionList;
+ private TreeModel mod;
+ private Cursor cursor;
+
+ /**
+ * Constructs an AccessibleJTreeNode
+ *
+ * @param t - the current tree
+ * @param p - the current path to be dealt with
+ * @param ap - the accessible object to use
+ */
+ public AccessibleJTreeNode(JTree t, TreePath p, Accessible ap)
+ {
+ states = new AccessibleStateSet();
+ selectionList = new Vector();
+ actionList = new Vector();
+ mod = tree.getModel();
+ cursor = JTree.this.getCursor();
+
+ tree = t;
+ tp = p;
+ acc = ap;
+
+ // Add all the children of this path that may already be
+ // selected to the selection list.
+ TreePath[] selected = tree.getSelectionPaths();
+ for (int i = 0; i < selected.length; i++)
+ {
+ TreePath sel = selected[i];
+ if ((sel.getParentPath()).equals(tp))
+ selectionList.add(sel);
+ }
+
+ // Add all the actions available for a node to
+ // the action list.
+ actionList.add("EXPAND");
+ actionList.add("COLLAPSE");
+ actionList.add("EDIT");
+ actionList.add("SELECT");
+ actionList.add("DESELECT");
+ }
+
+ /**
+ * Adds the specified selected item in the object to the object's
+ * selection.
+ *
+ * @param i - the i-th child of this node.
+ */
+ public void addAccessibleSelection(int i)
+ {
+ if (mod != null)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ {
+ if (!states.contains(AccessibleState.MULTISELECTABLE))
+ clearAccessibleSelection();
+ selectionList.add(child);
+ tree.addSelectionPath(tp.pathByAddingChild(child));
+ }
+ }
+ }
+
+ /**
+ * Adds the specified focus listener to receive focus events
+ * from this component.
+ *
+ * @param l - the new focus listener
+ */
+ public void addFocusListener(FocusListener l)
+ {
+ tree.addFocusListener(l);
+ }
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param l - the new property change listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Clears the selection in the object, so that nothing in the
+ * object is selected.
+ */
+ public void clearAccessibleSelection()
+ {
+ selectionList.clear();
+ }
+
+ /**
+ * Checks whether the specified point is within this object's
+ * bounds, where the point's x and y coordinates are defined to be
+ * relative to the coordinate system of the object.
+ *
+ * @param p - the point to check
+ * @return true if p is in the bounds
+ */
+ public boolean contains(Point p)
+ {
+ return getBounds().contains(p);
+ }
+
+ /**
+ * Perform the specified Action on the tree node.
+ *
+ * @param i - the i-th action to perform
+ * @return true if the the action was performed; else false.
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ if (i >= actionList.size() || i < 0)
+ return false;
+
+ if (actionList.get(i).equals("EXPAND"))
+ tree.expandPath(tp);
+ else if (actionList.get(i).equals("COLLAPSE"))
+ tree.collapsePath(tp);
+ else if (actionList.get(i).equals("SELECT"))
+ tree.addSelectionPath(tp);
+ else if (actionList.get(i).equals("DESELECT"))
+ tree.removeSelectionPath(tp);
+ else if (actionList.get(i).equals("EDIT"))
+ tree.startEditingAtPath(tp);
+ else
+ return false;
+ return true;
+ }
+
+ /**
+ * Get the AccessibleAction associated with this object.
+ *
+ * @return the action
+ */
+ public AccessibleAction getAccessibleAction()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the number of accessible actions available in this tree node.
+ *
+ * @return the number of actions
+ */
+ public int getAccessibleActionCount()
+ {
+ return actionList.size();
+ }
+
+ /**
+ * Return a description of the specified action of the tree node.
+ *
+ * @param i - the i-th action's description
+ * @return a description of the action
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ if (i < 0 || i >= actionList.size())
+ return (actionList.get(i)).toString();
+ return super.getAccessibleDescription();
+ }
+
+ /**
+ * Returns the Accessible child, if one exists, contained at the
+ * local coordinate Point.
+ *
+ * @param p - the point of the accessible
+ * @return the accessible at point p if it exists
+ */
+ public Accessible getAccessibleAt(Point p)
+ {
+ TreePath acc = tree.getClosestPathForLocation(p.x, p.y);
+ if (acc != null)
+ return new AccessibleJTreeNode(tree, acc, this);
+ return null;
+ }
+
+ /**
+ * Return the specified Accessible child of the object.
+ *
+ * @param i - the i-th child of the current path
+ * @return the child if it exists
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ if (mod != null)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ return new AccessibleJTreeNode(tree, tp.pathByAddingChild(child),
+ acc);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the number of accessible children in the object.
+ *
+ * @return the number of children the current node has
+ */
+ public int getAccessibleChildrenCount()
+ {
+ TreeModel mod = getModel();
+ if (mod != null)
+ return mod.getChildCount(tp.getLastPathComponent());
+ return 0;
+ }
+
+ /**
+ * Get the AccessibleComponent associated with this object.
+ *
+ * @return the accessible component if it is supported.
+ */
+ public AccessibleComponent getAccessibleComponent()
+ {
+ return this;
+ }
+
+ /**
+ * Get the AccessibleContext associated with this tree node.
+ *
+ * @return an instance of this class
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Get the accessible description of this object.
+ *
+ * @return the accessible description
+ */
+ public String getAccessibleDescription()
+ {
+ return super.getAccessibleDescription();
+ }
+
+ /**
+ * Get the index of this object in its accessible parent.
+ *
+ * @return the index of this in the parent.
+ */
+ public int getAccessibleIndexInParent()
+ {
+ AccessibleContext parent = getAccessibleParent().getAccessibleContext();
+ if (parent != null)
+ for (int i = 0; i < parent.getAccessibleChildrenCount(); i++)
+ {
+ if ((parent.getAccessibleChild(i)).equals(this))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Get the accessible name of this object.
+ *
+ * @return the accessible name
+ */
+ public String getAccessibleName()
+ {
+ return super.getAccessibleName();
+ }
+
+ /**
+ * Get the Accessible parent of this object.
+ *
+ * @return the accessible parent if it exists.
+ */
+ public Accessible getAccessibleParent()
+ {
+ return super.getAccessibleParent();
+ }
+
+ /**
+ * Get the role of this object.
+ *
+ * @return the accessible role
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleJTree.this.getAccessibleRole();
+ }
+
+ /**
+ * Get the AccessibleSelection associated with this object if one exists.
+ *
+ * @return the accessible selection for this.
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /**
+ * Returns an Accessible representing the specified selected item
+ * in the object.
+ *
+ * @return the accessible representing a certain selected item.
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ if (i > 0 && i < getAccessibleSelectionCount())
+ return new AccessibleJTreeNode(tree,
+ tp.pathByAddingChild(selectionList.get(i)), acc);
+ return null;
+ }
+
+ /**
+ * Returns the number of items currently selected.
+ *
+ * @return the number of items selected.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return selectionList.size();
+ }
+
+ /**
+ * Get the state set of this object.
+ *
+ * @return the state set for this object
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ if (isVisible())
+ states.add(AccessibleState.VISIBLE);
+ if (tree.isCollapsed(tp))
+ states.add(AccessibleState.COLLAPSED);
+ if (tree.isEditable())
+ states.add(AccessibleState.EDITABLE);
+ if (mod != null &&
+ !mod.isLeaf(tp.getLastPathComponent()))
+ states.add(AccessibleState.EXPANDABLE);
+ if (tree.isExpanded(tp))
+ states.add(AccessibleState.EXPANDED);
+ if (isFocusable())
+ states.add(AccessibleState.FOCUSABLE);
+ if (hasFocus())
+ states.add(AccessibleState.FOCUSED);
+ if (tree.getSelectionModel().getSelectionMode() !=
+ TreeSelectionModel.SINGLE_TREE_SELECTION)
+ states.add(AccessibleState.MULTISELECTABLE);
+ if (tree.isOpaque())
+ states.add(AccessibleState.OPAQUE);
+ if (tree.isPathSelected(tp))
+ states.add(AccessibleState.SELECTED);
+ if (isShowing())
+ states.add(AccessibleState.SHOWING);
+
+ states.add(AccessibleState.SELECTABLE);
+ return states;
+ }
+
+ /**
+ * Get the AccessibleText associated with this object if one exists.
+ *
+ * @return the accessible text
+ */
+ public AccessibleText getAccessibleText()
+ {
+ return super.getAccessibleText();
+ }
+
+ /**
+ * Get the AccessibleValue associated with this object if one exists.
+ *
+ * @return the accessible value if it exists
+ */
+ public AccessibleValue getAccessibleValue()
+ {
+ return super.getAccessibleValue();
+ }
+
+ /**
+ * Get the background color of this object.
+ *
+ * @return the color of the background.
+ */
+ public Color getBackground()
+ {
+ return tree.getBackground();
+ }
+
+ /**
+ * Gets the bounds of this object in the form of a Rectangle object.
+ *
+ * @return the bounds of the current node.
+ */
+ public Rectangle getBounds()
+ {
+ return tree.getPathBounds(tp);
+ }
+
+ /**
+ * Gets the Cursor of this object.
+ *
+ * @return the cursor for the current node
+ */
+ public Cursor getCursor()
+ {
+ return cursor;
+ }
+
+ /**
+ * Gets the Font of this object.
+ *
+ * @return the font for the current node
+ */
+ public Font getFont()
+ {
+ return tree.getFont();
+ }
+
+ /**
+ * Gets the FontMetrics of this object.
+ *
+ * @param f - the current font.
+ * @return the font metrics for the given font.
+ */
+ public FontMetrics getFontMetrics(Font f)
+ {
+ return tree.getFontMetrics(f);
+ }
+
+ /**
+ * Get the foreground color of this object.
+ *
+ * @return the foreground for this object.
+ */
+ public Color getForeground()
+ {
+ return tree.getForeground();
+ }
+
+ /**
+ * Gets the locale of the component.
+ *
+ * @return the locale of the component.
+ */
+ public Locale getLocale()
+ {
+ return tree.getLocale();
+ }
+
+ /**
+ * Gets the location of the object relative to the
+ * parent in the form of a point specifying the object's
+ * top-left corner in the screen's coordinate space.
+ *
+ * @return the location of the current node.
+ */
+ public Point getLocation()
+ {
+ return getLocationInJTree();
+ }
+
+ /**
+ * Returns the location in the tree.
+ *
+ * @return the location in the JTree.
+ */
+ protected Point getLocationInJTree()
+ {
+ Rectangle bounds = tree.getPathBounds(tp);
+ return new Point(bounds.x, bounds.y);
+ }
+
+ /**
+ * Returns the location of the object on the screen.
+ *
+ * @return the location of the object on the screen.
+ */
+ public Point getLocationOnScreen()
+ {
+ Point loc = getLocation();
+ SwingUtilities.convertPointToScreen(loc, tree);
+ return loc;
+ }
+
+ /**
+ * Returns the size of this object in the form of a Dimension object.
+ *
+ * @return the size of the object
+ */
+ public Dimension getSize()
+ {
+ Rectangle b = getBounds();
+ return b.getSize();
+ }
+
+ /**
+ * Returns true if the current child of this object is selected.
+ *
+ * @param i - the child of the current node
+ * @return true if the child is selected.
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ return tree.isPathSelected(tp.pathByAddingChild(child));
+ return false;
+ }
+
+ /**
+ * Determines if the object is enabled.
+ *
+ * @return true if the tree is enabled
+ */
+ public boolean isEnabled()
+ {
+ return tree.isEnabled();
+ }
+
+ /**
+ * Returns whether this object can accept focus or not.
+ *
+ * @return true, it is always focus traversable
+ */
+ public boolean isFocusTraversable()
+ {
+ return true;
+ }
+
+ /**
+ * Determines if the object is showing.
+ *
+ * @return true if the object is visible and the
+ * parent is visible.
+ */
+ public boolean isShowing()
+ {
+ return isVisible() && tree.isShowing();
+ }
+
+ /**
+ * Determines if the object is visible.
+ *
+ * @return true if the object is visible.
+ */
+ public boolean isVisible()
+ {
+ return tree.isVisible(tp);
+ }
+
+ /**
+ * Removes the specified selected item in the object from the
+ * object's selection.
+ *
+ * @param i - the specified item to remove
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ if (mod != null)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ {
+ if (!states.contains(AccessibleState.MULTISELECTABLE))
+ clearAccessibleSelection();
+ if (selectionList.contains(child))
+ {
+ selectionList.remove(child);
+ tree.removeSelectionPath(tp.pathByAddingChild(child));
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes the specified focus listener so it no longer receives focus
+ * events from this component.
+ *
+ * @param l - the focus listener to remove
+ */
+ public void removeFocusListener(FocusListener l)
+ {
+ tree.removeFocusListener(l);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ *
+ * @param l - the property change listener to remove.
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Requests focus for this object.
+ */
+ public void requestFocus()
+ {
+ tree.requestFocus();
+ }
+
+ /**
+ * Causes every selected item in the object to be selected if the object
+ * supports multiple selections.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ Object parent = tp.getLastPathComponent();
+ if (mod != null)
+ {
+ for (int i = 0; i < mod.getChildCount(parent); i++)
+ {
+ Object child = mod.getChild(parent, i);
+ if (child != null)
+ {
+ if (!states.contains(AccessibleState.MULTISELECTABLE))
+ clearAccessibleSelection();
+ if (selectionList.contains(child))
+ {
+ selectionList.add(child);
+ tree.addSelectionPath(tp.pathByAddingChild(child));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the accessible description of this object.
+ *
+ * @param s - the string to set the accessible description to.
+ */
+ public void setAccessibleDescription(String s)
+ {
+ super.setAccessibleDescription(s);
+ }
+
+ /**
+ * Set the localized accessible name of this object.
+ *
+ * @param s - the string to set the accessible name to.
+ */
+ public void setAccessibleName(String s)
+ {
+ super.setAccessibleName(s);
+ }
+
+ /**
+ * Set the background color of this object.
+ *
+ * @param c - the color to set the background to.
+ */
+ public void setBackground(Color c)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the bounds of this object in the form of a Rectangle object.
+ *
+ * @param r - the bounds to set the object o
+ */
+ public void setBounds(Rectangle r)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the Cursor of this object.
+ *
+ * @param c - the new cursor
+ */
+ public void setCursor(Cursor c)
+ {
+ cursor = c;
+ }
+
+ /**
+ * Sets the enabled state of the object.
+ *
+ * @param b - boolean to enable or disable object
+ */
+ public void setEnabled(boolean b)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the Font of this object.
+ *
+ * @param f - the new font.
+ */
+ public void setFont(Font f)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the foreground color of this object.
+ *
+ * @param c - the new foreground color.
+ */
+ public void setForeground(Color c)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the location of the object relative to the parent.
+ *
+ * @param p - the new location for the object.
+ */
+ public void setLocation(Point p)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Resizes this object so that it has width and height.
+ *
+ * @param d - the new size for the object.
+ */
+ public void setSize(Dimension d)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the visible state of the object.
+ *
+ * @param b - sets the objects visibility.
+ */
+ public void setVisible(boolean b)
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * Constructor
+ */
+ public AccessibleJTree()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Adds the specified selected item in the object to the object's selection.
+ *
+ * @param i - the row to add to the tree's selection
+ */
+ public void addAccessibleSelection(int i)
+ {
+ addSelectionInterval(i, i);
+ }
+
+ /**
+ * Clears the selection in the object, so that nothing in the object is selected.
+ */
+ public void clearAccessibleSelection()
+ {
+ clearSelection();
+ }
+
+ /**
+ * Fire a visible data property change notification.
+ */
+ public void fireVisibleDataPropertyChange()
+ {
+ treeDidChange();
+ }
+
+ /**
+ * Returns the Accessible child, if one exists, contained at the local
+ * coordinate Point.
+ *
+ * @param p - the point of the accessible to get.
+ * @return the accessible at point p.
+ */
+ public Accessible getAccessibleAt(Point p)
+ {
+ TreePath tp = getClosestPathForLocation(p.x, p.y);
+ if (tp != null)
+ return new AccessibleJTreeNode(JTree.this, tp, null);
+ return null;
+ }
+
+ /**
+ * Return the nth Accessible child of the object.
+ *
+ * @param i - the accessible child to get
+ * @return the i-th child
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the number of top-level children nodes of this JTree.
+ *
+ * @return the number of top-level children
+ */
+ public int getAccessibleChildrenCount()
+ {
+ TreeModel model = getModel();
+ if (model != null)
+ return model.getChildCount(model.getRoot());
+ return 0;
+ }
+
+ /**
+ * Get the index of this object in its accessible parent.
+ *
+ * @return the index of this object.
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return 0;
+ }
+
+ /**
+ * Get the role of this object.
+ *
+ * @return the role of this object
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.TREE;
+ }
+
+ /**
+ * Get the AccessibleSelection associated with this object.
+ *
+ * @return the accessible selection of the tree
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ TreeModel mod = getModel();
+ if (mod != null)
+ return (new AccessibleJTreeNode(JTree.this,
+ new TreePath(mod.getRoot()), null)).getAccessibleSelection();
+ return null;
+ }
+
+ /**
+ * Returns an Accessible representing the specified selected item in the object.
+ *
+ * @return the i-th accessible in the selection
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ TreeModel mod = getModel();
+ if (mod != null)
+ return (new AccessibleJTreeNode(JTree.this,
+ new TreePath(mod.getRoot()), null)).getAccessibleSelection(i);
+ return null;
+ }
+
+ /**
+ * Returns the number of items currently selected.
+ *
+ * @return the number of selected accessibles.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectionCount();
+ }
+
+ /**
+ * Returns true if the current child of this object is selected.
+ *
+ * @param i - the child of this object
+ * @return true if the i-th child is selected.
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ // Nothing to do here.
+ return false;
+ }
+
+ /**
+ * Removes the specified selected item in the object from the object's
+ * selection.
+ *
+ * @param i - the i-th selected item to remove
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ removeSelectionInterval(i, i);
+ }
+
+ /**
+ * Causes every selected item in the object to be selected if the object
+ * supports multiple selections.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ if (getSelectionModel().getSelectionMode() !=
+ TreeSelectionModel.SINGLE_TREE_SELECTION)
+ addSelectionInterval(0, getVisibleRowCount());
+ }
+
+ /**
+ * Tree Collapsed notification
+ *
+ * @param e - the event
+ */
+ public void treeCollapsed(TreeExpansionEvent e)
+ {
+ fireTreeCollapsed(e.getPath());
+ }
+
+ /**
+ * Tree Model Expansion notification.
+ *
+ * @param e - the event
+ */
+ public void treeExpanded(TreeExpansionEvent e)
+ {
+ fireTreeExpanded(e.getPath());
+ }
+
+ /**
+ * Tree Model Node change notification.
+ *
+ * @param e - the event
+ */
+ public void treeNodesChanged(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Model Node change notification.
+ *
+ * @param e - the event
+ */
+ public void treeNodesInserted(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Model Node change notification.
+ *
+ * @param e - the event
+ */
+ public void treeNodesRemoved(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Model structure change change notification.
+ *
+ * @param e - the event
+ */
+ public void treeStructureChanged(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Selection Listener value change method.
+ *
+ * @param e - the event
+ */
+ public void valueChanged(TreeSelectionEvent e)
+ {
+ fireValueChanged(e);
+ }
+ }
+
+ public static class DynamicUtilTreeNode extends DefaultMutableTreeNode
+ {
+ protected Object childValue;
+
+ protected boolean loadedChildren;
+
+ /**
+ * Currently not set or used by this class. It might be set and used in
+ * later versions of this class.
+ */
+ protected boolean hasChildren;
+
+ public DynamicUtilTreeNode(Object value, Object children)
+ {
+ super(value);
+ childValue = children;
+ loadedChildren = false;
+ }
+
+ public int getChildCount()
+ {
+ loadChildren();
+ return super.getChildCount();
+ }
+
+ protected void loadChildren()
+ {
+ if (!loadedChildren)
+ {
+ createChildren(this, childValue);
+ loadedChildren = true;
+ }
+ }
+
+ public Enumeration children()
+ {
+ loadChildren();
+ return super.children();
+ }
+
+ /**
+ * Returns the child node at position <code>pos</code>. Subclassed
+ * here to load the children if necessary.
+ *
+ * @param pos the position of the child node to fetch
+ *
+ * @return the childnode at the specified position
+ */
+ public TreeNode getChildAt(int pos)
+ {
+ loadChildren();
+ return super.getChildAt(pos);
+ }
+
+ public boolean isLeaf()
+ {
+ return (childValue == null || !(childValue instanceof Hashtable
+ || childValue instanceof Vector || childValue.getClass()
+ .isArray()));
+ }
+
+ public static void createChildren(DefaultMutableTreeNode parent,
+ Object children)
+ {
+ if (children instanceof Hashtable)
+ {
+ Hashtable tab = (Hashtable) children;
+ Enumeration e = tab.keys();
+ while (e.hasMoreElements())
+ {
+ Object key = e.nextElement();
+ Object val = tab.get(key);
+ parent.add(new DynamicUtilTreeNode(key, val));
+ }
+ }
+ else if (children instanceof Vector)
+ {
+ Iterator i = ((Vector) children).iterator();
+ while (i.hasNext())
+ {
+ Object n = i.next();
+ parent.add(new DynamicUtilTreeNode(n, n));
+ }
+ }
+ else if (children != null && children.getClass().isArray())
+ {
+ Object[] arr = (Object[]) children;
+ for (int i = 0; i < arr.length; ++i)
+ parent.add(new DynamicUtilTreeNode(arr[i], arr[i]));
+ }
+ }
+ }
+
+ /**
+ * Listens to the model of the JTree and updates the property
+ * <code>expandedState</code> if nodes are removed or changed.
+ */
+ protected class TreeModelHandler implements TreeModelListener
+ {
+
+ /**
+ * Creates a new instance of TreeModelHandler.
+ */
+ protected TreeModelHandler()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Notifies when a node has changed in some ways. This does not include
+ * that a node has changed its location or changed it's children. It
+ * only means that some attributes of the node have changed that might
+ * affect its presentation.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
+ */
+ public void treeNodesChanged(TreeModelEvent ev)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Notifies when a node is inserted into the tree.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
+ */
+ public void treeNodesInserted(TreeModelEvent ev)
+ {
+ // nothing to do here
+ }
+
+ /**
+ * Notifies when a node is removed from the tree.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
*/
- protected static class EmptySelectionModel
- extends
- DefaultTreeSelectionModel
- {
- /** The serial version UID. */
- private static final long serialVersionUID = -5815023306225701477L;
-
- /**
- * The shared instance of this model.
- */
- protected static final EmptySelectionModel sharedInstance = new EmptySelectionModel();
-
- /**
- * Creates a new instance of EmptySelectionModel.
- */
- protected EmptySelectionModel()
- {
- }
-
- /**
- * Returns the shared instance of EmptySelectionModel.
- *
- * @return the shared instance of EmptySelectionModel
- */
- public static EmptySelectionModel sharedInstance()
- {
- return sharedInstance;
- }
-
- /**
- * This catches attempts to set a selection and sets nothing instead.
- *
- * @param paths not used here
- */
- public void setSelectionPaths(TreePath[] paths)
- {
- // we don't allow selections in this class
- }
-
- /**
- * This catches attempts to add something to the selection.
- *
- * @param paths not used here
- */
- public void addSelectionPaths(TreePath[] paths)
- {
- // we don't allow selections in this class
- }
-
- /**
- * This catches attempts to remove something from the selection.
- *
- * @param paths not used here
- */
- public void removeSelectionPaths(TreePath[] paths)
- {
- // we don't allow selections in this class
- }
- }// EmptySelectionModel
-
- private static final long serialVersionUID = 7559816092864483649L;
- public static final String CELL_EDITOR_PROPERTY = "cellEditor";
- public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
- public static final String EDITABLE_PROPERTY = "editable";
- public static final String INVOKES_STOP_CELL_EDITING_PROPERTY = "invokesStopCellEditing";
- public static final String LARGE_MODEL_PROPERTY = "largeModel";
- public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
- public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
- public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
- public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
- public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
- public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
- public static final String TREE_MODEL_PROPERTY = "model";
- public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+ public void treeNodesRemoved(TreeModelEvent ev)
+ {
+ // TODO: The API docs suggest that this method should do something
+ // but I cannot really see what has to be done here ...
+ }
- /** @since 1.3 */
- public static final String ANCHOR_SELECTION_PATH_PROPERTY = "anchorSelectionPath";
+ /**
+ * Notifies when the structure of the tree is changed.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
+ */
+ public void treeStructureChanged(TreeModelEvent ev)
+ {
+ // Set state of new path.
+ TreePath path = ev.getTreePath();
+ setExpandedState(path, isExpanded(path));
+ }
+ }
- /** @since 1.3 */
- public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
+ /**
+ * This redirects TreeSelectionEvents and rewrites the source of it to be
+ * this JTree. This is typically done when the tree model generates an
+ * event, but the JTree object associated with that model should be listed
+ * as the actual source of the event.
+ */
+ protected class TreeSelectionRedirector implements TreeSelectionListener,
+ Serializable
+ {
+ /** The serial version UID. */
+ private static final long serialVersionUID = -3505069663646241664L;
+
+ /**
+ * Creates a new instance of TreeSelectionRedirector
+ */
+ protected TreeSelectionRedirector()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Notifies when the tree selection changes.
+ *
+ * @param ev the TreeSelectionEvent that describes the change
+ */
+ public void valueChanged(TreeSelectionEvent ev)
+ {
+ TreeSelectionEvent rewritten =
+ (TreeSelectionEvent) ev.cloneWithSource(JTree.this);
+ fireValueChanged(rewritten);
+ JTree.this.repaint();
+ }
+ }
+
+ /**
+ * A TreeModel that does not allow anything to be selected.
+ */
+ protected static class EmptySelectionModel extends DefaultTreeSelectionModel
+ {
+ /** The serial version UID. */
+ private static final long serialVersionUID = -5815023306225701477L;
+
+ /**
+ * The shared instance of this model.
+ */
+ protected static final EmptySelectionModel sharedInstance =
+ new EmptySelectionModel();
+
+ /**
+ * Creates a new instance of EmptySelectionModel.
+ */
+ protected EmptySelectionModel()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the shared instance of EmptySelectionModel.
+ *
+ * @return the shared instance of EmptySelectionModel
+ */
+ public static EmptySelectionModel sharedInstance()
+ {
+ return sharedInstance;
+ }
+
+ /**
+ * This catches attempts to set a selection and sets nothing instead.
+ *
+ * @param paths not used here
+ */
+ public void setSelectionPaths(TreePath[] paths)
+ {
+ // We don't allow selections in this class.
+ }
+
+ /**
+ * This catches attempts to add something to the selection.
+ *
+ * @param paths not used here
+ */
+ public void addSelectionPaths(TreePath[] paths)
+ {
+ // We don't allow selections in this class.
+ }
+
+ /**
+ * This catches attempts to remove something from the selection.
+ *
+ * @param paths not used here
+ */
+ public void removeSelectionPaths(TreePath[] paths)
+ {
+ // We don't allow selections in this class.
+ }
+ }
+
+ private static final long serialVersionUID = 7559816092864483649L;
+
+ public static final String CELL_EDITOR_PROPERTY = "cellEditor";
+
+ public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
+
+ public static final String EDITABLE_PROPERTY = "editable";
+
+ public static final String INVOKES_STOP_CELL_EDITING_PROPERTY =
+ "invokesStopCellEditing";
+
+ public static final String LARGE_MODEL_PROPERTY = "largeModel";
+
+ public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
+
+ public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
+
+ public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
+
+ public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+
+ public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
+
+ public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
+
+ public static final String TREE_MODEL_PROPERTY = "model";
+
+ public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+
+ /** @since 1.3 */
+ public static final String ANCHOR_SELECTION_PATH_PROPERTY =
+ "anchorSelectionPath";
/** @since 1.3 */
- public static final String EXPANDS_SELECTED_PATHS_PROPERTY = "expandsSelectedPaths";
- private static final Object EXPANDED = new Object();
- private static final Object COLLAPSED = new Object();
- private boolean dragEnabled;
- private boolean expandsSelectedPaths;
- private TreePath anchorSelectionPath;
- private TreePath leadSelectionPath;
-
- /*
- * This contains the state of all nodes in the tree. Al/ entries map the
- * TreePath of a note to to its state. Valid states are EXPANDED and
- * COLLAPSED. Nodes not in this Hashtable are assumed state COLLAPSED.
- */
- private Hashtable nodeStates = new Hashtable();
- protected transient TreeCellEditor cellEditor;
- protected transient TreeCellRenderer cellRenderer;
- protected boolean editable;
- protected boolean invokesStopCellEditing;
- protected boolean largeModel;
- protected boolean rootVisible;
- protected int rowHeight;
- protected boolean scrollsOnExpand;
- protected transient TreeSelectionModel selectionModel;
- protected boolean showsRootHandles;
- protected int toggleClickCount;
- protected transient TreeModel treeModel;
- protected int visibleRowCount;
-
- /**
- * Handles TreeModelEvents to update the expandedState.
- */
- protected transient TreeModelListener treeModelListener;
+ public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
- /**
- * Redirects TreeSelectionEvents so that the source is this JTree.
- */
- protected TreeSelectionRedirector selectionRedirector =
- new TreeSelectionRedirector();
+ /** @since 1.3 */
+ public static final String EXPANDS_SELECTED_PATHS_PROPERTY =
+ "expandsSelectedPaths";
- /**
- * Creates a new <code>JTree</code> object.
- */
- public JTree()
- {
- this(createTreeModel(null));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param value the initial nodes in the tree
- */
- public JTree(Hashtable value)
- {
- this(createTreeModel(value));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param value the initial nodes in the tree
- */
- public JTree(Object[] value)
- {
- this(createTreeModel(value));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param model the model to use
- */
- public JTree(TreeModel model)
- {
- setModel(model);
- setSelectionModel(EmptySelectionModel.sharedInstance());
- setCellRenderer(new DefaultTreeCellRenderer());
- updateUI();
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param root the root node
- */
- public JTree(TreeNode root)
- {
- this(root, false);
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param root the root node
- * @param asksAllowChildren if false, all nodes without children are leaf
- * nodes. If true, only nodes that do not allow children are leaf
- * nodes.
- */
- public JTree(TreeNode root, boolean asksAllowChildren)
- {
- this(new DefaultTreeModel(root, asksAllowChildren));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param value the initial nodes in the tree
- */
- public JTree(Vector value)
- {
- this(createTreeModel(value));
- }
-
- public static class DynamicUtilTreeNode
- extends
- DefaultMutableTreeNode
- {
- protected Object childValue;
- protected boolean loadedChildren;
-
- /**
- * Currently not set or used by this class. It might be set and used in
- * later versions of this class.
- */
- protected boolean hasChildren;
-
- public DynamicUtilTreeNode(Object value, Object children)
- {
- super(value);
- childValue = children;
- loadedChildren = false;
- }
-
- public int getChildCount()
- {
- loadChildren();
- return super.getChildCount();
- }
-
- protected void loadChildren()
- {
- if (!loadedChildren)
- {
- createChildren(this, childValue);
- loadedChildren = true;
- }
- }
-
- public Enumeration children()
- {
- loadChildren();
- return super.children();
- }
-
- /**
- * Returns the child node at position <code>pos</code>. Subclassed
- * here to load the children if necessary.
- *
- * @param pos the position of the child node to fetch
- *
- * @return the childnode at the specified position
- */
- public TreeNode getChildAt(int pos)
- {
- loadChildren();
- return super.getChildAt(pos);
- }
-
- public boolean isLeaf()
- {
- return (childValue == null || !(childValue instanceof Hashtable
- || childValue instanceof Vector || childValue.getClass()
- .isArray()));
- }
-
- public static void createChildren(DefaultMutableTreeNode parent,
- Object children)
- {
- if (children instanceof Hashtable)
- {
- Hashtable tab = (Hashtable) children;
- Enumeration e = tab.keys();
- while (e.hasMoreElements())
- {
- Object key = e.nextElement();
- Object val = tab.get(key);
- parent.add(new DynamicUtilTreeNode(key, val));
- }
- } else if (children instanceof Vector)
- {
- Iterator i = ((Vector) children).iterator();
- while (i.hasNext())
- {
- Object n = i.next();
- parent.add(new DynamicUtilTreeNode(n, n));
- }
- } else if (children != null && children.getClass().isArray())
- {
- Object[] arr = (Object[]) children;
- for (int i = 0; i < arr.length; ++i)
- parent.add(new DynamicUtilTreeNode(arr[i], arr[i]));
- }
- }
- }
-
- public int getRowForPath(TreePath path)
- {
- TreeUI ui = getUI();
-
- if (ui != null)
- return ui.getRowForPath(this, path);
-
- return -1;
- }
-
- public TreePath getPathForRow(int row)
- {
- TreeUI ui = getUI();
- return ui != null ? ui.getPathForRow(this, row) : null;
- }
-
- protected TreePath[] getPathBetweenRows(int index0, int index1)
- {
- TreeUI ui = getUI();
-
- if (ui == null)
- return null;
-
- int minIndex = Math.min(index0, index1);
- int maxIndex = Math.max(index0, index1);
- TreePath[] paths = new TreePath[maxIndex - minIndex + 1];
-
- for (int i = minIndex; i <= maxIndex; ++i)
- paths[i - minIndex] = ui.getPathForRow(this, i);
-
- return paths;
- }
-
- /**
- * Creates a new <code>TreeModel</code> object.
- *
- * @param value the values stored in the model
- */
- protected static TreeModel createTreeModel(Object value)
- {
- return new DefaultTreeModel(new DynamicUtilTreeNode(value, value));
- }
-
- /**
- * Return the UI associated with this <code>JTree</code> object.
- *
- * @return the associated <code>TreeUI</code> object
- */
- public TreeUI getUI()
- {
- return (TreeUI) ui;
- }
-
- /**
- * Sets the UI associated with this <code>JTree</code> object.
- *
- * @param ui the <code>TreeUI</code> to associate
- */
- public void setUI(TreeUI ui)
- {
- super.setUI(ui);
- }
+ private static final Object EXPANDED = new Object();
- /**
- * This method resets the UI used to the Look and Feel defaults..
- */
- public void updateUI()
- {
- setUI((TreeUI) UIManager.getUI(this));
- revalidate();
- repaint();
- }
-
- /**
- * This method returns the String ID of the UI class of Separator.
- *
- * @return The UI class' String ID.
- */
- public String getUIClassID()
- {
- return "TreeUI";
- }
-
- /**
- * Gets the AccessibleContext associated with this
- * <code>JToggleButton</code>.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- return null;
- }
-
- /**
- * Returns the preferred viewport size.
- *
- * @return the preferred size
- */
- public Dimension getPreferredScrollableViewportSize()
- {
- return new Dimension (getPreferredSize().width, getVisibleRowCount()*getRowHeight());
- }
-
- public int getScrollableUnitIncrement(Rectangle visibleRect,
- int orientation, int direction)
- {
- return 1;
- }
-
- public int getScrollableBlockIncrement(Rectangle visibleRect,
- int orientation, int direction)
- {
- return 1;
- }
+ private static final Object COLLAPSED = new Object();
- public boolean getScrollableTracksViewportWidth()
+ private boolean dragEnabled;
+
+ private boolean expandsSelectedPaths;
+
+ private TreePath anchorSelectionPath;
+
+ private TreePath leadSelectionPath;
+
+ /**
+ * This contains the state of all nodes in the tree. Al/ entries map the
+ * TreePath of a note to to its state. Valid states are EXPANDED and
+ * COLLAPSED. Nodes not in this Hashtable are assumed state COLLAPSED.
+ */
+ private Hashtable nodeStates = new Hashtable();
+
+ protected transient TreeCellEditor cellEditor;
+
+ protected transient TreeCellRenderer cellRenderer;
+
+ protected boolean editable;
+
+ protected boolean invokesStopCellEditing;
+
+ protected boolean largeModel;
+
+ protected boolean rootVisible;
+
+ protected int rowHeight;
+
+ protected boolean scrollsOnExpand;
+
+ protected transient TreeSelectionModel selectionModel;
+
+ protected boolean showsRootHandles;
+
+ protected int toggleClickCount;
+
+ protected transient TreeModel treeModel;
+
+ protected int visibleRowCount;
+
+ /**
+ * Handles TreeModelEvents to update the expandedState.
+ */
+ protected transient TreeModelListener treeModelListener;
+
+ /**
+ * Redirects TreeSelectionEvents so that the source is this JTree.
+ */
+ protected TreeSelectionRedirector selectionRedirector =
+ new TreeSelectionRedirector();
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ */
+ public JTree()
+ {
+ this(createTreeModel(null));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param value the initial nodes in the tree
+ */
+ public JTree(Hashtable value)
+ {
+ this(createTreeModel(value));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param value the initial nodes in the tree
+ */
+ public JTree(Object[] value)
+ {
+ this(createTreeModel(value));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param model the model to use
+ */
+ public JTree(TreeModel model)
+ {
+ updateUI();
+ setRootVisible(true);
+ setModel(model);
+ setSelectionModel(new EmptySelectionModel());
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param root the root node
+ */
+ public JTree(TreeNode root)
+ {
+ this(root, false);
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param root the root node
+ * @param asksAllowChildren if false, all nodes without children are leaf
+ * nodes. If true, only nodes that do not allow children are leaf
+ * nodes.
+ */
+ public JTree(TreeNode root, boolean asksAllowChildren)
+ {
+ this(new DefaultTreeModel(root, asksAllowChildren));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param value the initial nodes in the tree
+ */
+ public JTree(Vector value)
+ {
+ this(createTreeModel(value));
+ }
+
+ public int getRowForPath(TreePath path)
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.getRowForPath(this, path);
+
+ return -1;
+ }
+
+ public TreePath getPathForRow(int row)
+ {
+ TreeUI ui = getUI();
+ return ui != null ? ui.getPathForRow(this, row) : null;
+ }
+
+ protected TreePath[] getPathBetweenRows(int index0, int index1)
+ {
+ TreeUI ui = getUI();
+
+ if (ui == null)
+ return null;
+
+ int minIndex = Math.min(index0, index1);
+ int maxIndex = Math.max(index0, index1);
+ TreePath[] paths = new TreePath[maxIndex - minIndex + 1];
+
+ for (int i = minIndex; i <= maxIndex; ++i)
+ paths[i - minIndex] = ui.getPathForRow(this, i);
+
+ return paths;
+ }
+
+ /**
+ * Creates a new <code>TreeModel</code> object.
+ *
+ * @param value the values stored in the model
+ */
+ protected static TreeModel createTreeModel(Object value)
+ {
+ return new DefaultTreeModel(new DynamicUtilTreeNode(value, value));
+ }
+
+ /**
+ * Return the UI associated with this <code>JTree</code> object.
+ *
+ * @return the associated <code>TreeUI</code> object
+ */
+ public TreeUI getUI()
+ {
+ return (TreeUI) ui;
+ }
+
+ /**
+ * Sets the UI associated with this <code>JTree</code> object.
+ *
+ * @param ui the <code>TreeUI</code> to associate
+ */
+ public void setUI(TreeUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ /**
+ * This method resets the UI used to the Look and Feel defaults..
+ */
+ public void updateUI()
+ {
+ setUI((TreeUI) UIManager.getUI(this));
+ }
+
+ /**
+ * This method returns the String ID of the UI class of Separator.
+ *
+ * @return The UI class' String ID.
+ */
+ public String getUIClassID()
+ {
+ return "TreeUI";
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this
+ * <code>JTree</code>.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleJTree();
+ }
+
+ /**
+ * Returns the preferred viewport size.
+ *
+ * @return the preferred size
+ */
+ public Dimension getPreferredScrollableViewportSize()
+ {
+ return new Dimension (getPreferredSize().width, getVisibleRowCount()*getRowHeight());
+ }
+
+ public int getScrollableUnitIncrement(Rectangle visibleRect,
+ int orientation, int direction)
+ {
+ return 1;
+ }
+
+ public int getScrollableBlockIncrement(Rectangle visibleRect,
+ int orientation, int direction)
+ {
+ return 1;
+ }
+
+ public boolean getScrollableTracksViewportHeight()
{
if (getParent() instanceof JViewport)
return ((JViewport) getParent()).getHeight() > getPreferredSize().height;
return false;
}
-
- public boolean getScrollableTracksViewportHeight()
+
+ public boolean getScrollableTracksViewportWidth()
{
if (getParent() instanceof JViewport)
return ((JViewport) getParent()).getWidth() > getPreferredSize().width;
return false;
}
- /**
- * Adds a <code>TreeExpansionListener</code> object to the tree.
- *
- * @param listener the listener to add
- */
- public void addTreeExpansionListener(TreeExpansionListener listener)
- {
- listenerList.add(TreeExpansionListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeExpansionListener</code> object from the tree.
- *
- * @param listener the listener to remove
- */
- public void removeTreeExpansionListener(TreeExpansionListener listener)
- {
- listenerList.remove(TreeExpansionListener.class, listener);
- }
-
- /**
- * Returns all added <code>TreeExpansionListener</code> objects.
- *
- * @return an array of listeners
- */
- public TreeExpansionListener[] getTreeExpansionListeners()
- {
- return (TreeExpansionListener[]) getListeners(TreeExpansionListener.class);
- }
-
- /**
- * Notifies all listeners that the tree was collapsed.
- *
- * @param path the path to the node that was collapsed
- */
- public void fireTreeCollapsed(TreePath path)
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeExpansionListener[] listeners = getTreeExpansionListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeCollapsed(event);
- }
-
- /**
- * Notifies all listeners that the tree was expanded.
- *
- * @param path the path to the node that was expanded
- */
- public void fireTreeExpanded(TreePath path)
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeExpansionListener[] listeners = getTreeExpansionListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeExpanded(event);
- }
-
- /**
- * Adds a <code>TreeSelctionListener</code> object to the tree.
- *
- * @param listener the listener to add
- */
- public void addTreeSelectionListener(TreeSelectionListener listener)
- {
- listenerList.add(TreeSelectionListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeSelectionListener</code> object from the tree.
- *
- * @param listener the listener to remove
- */
- public void removeTreeSelectionListener(TreeSelectionListener listener)
- {
- listenerList.remove(TreeSelectionListener.class, listener);
- }
-
- /**
- * Returns all added <code>TreeSelectionListener</code> objects.
- *
- * @return an array of listeners
- */
- public TreeSelectionListener[] getTreeSelectionListeners()
- {
- return (TreeSelectionListener[])
- getListeners(TreeSelectionListener.class);
- }
-
- /**
- * Notifies all listeners when the selection of the tree changed.
- *
- * @param event the event to send
- */
- protected void fireValueChanged(TreeSelectionEvent event)
- {
- TreeSelectionListener[] listeners = getTreeSelectionListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].valueChanged(event);
- }
-
- /**
- * Adds a <code>TreeWillExpandListener</code> object to the tree.
- *
- * @param listener the listener to add
- */
- public void addTreeWillExpandListener(TreeWillExpandListener listener)
- {
- listenerList.add(TreeWillExpandListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeWillExpandListener</code> object from the tree.
- *
- * @param listener the listener to remove
- */
- public void removeTreeWillExpandListener(TreeWillExpandListener listener)
- {
- listenerList.remove(TreeWillExpandListener.class, listener);
- }
-
- /**
- * Returns all added <code>TreeWillExpandListener</code> objects.
- *
- * @return an array of listeners
- */
- public TreeWillExpandListener[] getTreeWillExpandListeners()
- {
- return (TreeWillExpandListener[])
- getListeners(TreeWillExpandListener.class);
- }
-
- /**
- * Notifies all listeners that the tree will collapse.
- *
- * @param path the path to the node that will collapse
- */
- public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeWillCollapse(event);
- }
-
- /**
- * Notifies all listeners that the tree will expand.
- *
- * @param path the path to the node that will expand
- */
- public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeWillExpand(event);
- }
-
- /**
- * Returns the model of this <code>JTree</code> object.
- *
- * @return the associated <code>TreeModel</code>
- */
- public TreeModel getModel()
- {
- return treeModel;
- }
-
- /**
- * Sets the model to use in <code>JTree</code>.
- *
- * @param model the <code>TreeModel</code> to use
- */
- public void setModel(TreeModel model)
- {
- if (treeModel == model)
- return;
-
- // add treeModelListener to the new model
- if (treeModelListener == null)
- treeModelListener = createTreeModelListener();
- if (model != null) // as setModel(null) is allowed
- model.addTreeModelListener(treeModelListener);
-
+ /**
+ * Adds a <code>TreeExpansionListener</code> object to the tree.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeExpansionListener(TreeExpansionListener listener)
+ {
+ listenerList.add(TreeExpansionListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeExpansionListener</code> object from the tree.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeExpansionListener(TreeExpansionListener listener)
+ {
+ listenerList.remove(TreeExpansionListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>TreeExpansionListener</code> objects.
+ *
+ * @return an array of listeners
+ */
+ public TreeExpansionListener[] getTreeExpansionListeners()
+ {
+ return (TreeExpansionListener[]) getListeners(TreeExpansionListener.class);
+ }
+
+ /**
+ * Notifies all listeners that the tree was collapsed.
+ *
+ * @param path the path to the node that was collapsed
+ */
+ public void fireTreeCollapsed(TreePath path)
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeExpansionListener[] listeners = getTreeExpansionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeCollapsed(event);
+ }
+
+ /**
+ * Notifies all listeners that the tree was expanded.
+ *
+ * @param path the path to the node that was expanded
+ */
+ public void fireTreeExpanded(TreePath path)
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeExpansionListener[] listeners = getTreeExpansionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeExpanded(event);
+ }
+
+ /**
+ * Adds a <code>TreeSelctionListener</code> object to the tree.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.add(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeSelectionListener</code> object from the tree.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.remove(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>TreeSelectionListener</code> objects.
+ *
+ * @return an array of listeners
+ */
+ public TreeSelectionListener[] getTreeSelectionListeners()
+ {
+ return (TreeSelectionListener[])
+ getListeners(TreeSelectionListener.class);
+ }
+
+ /**
+ * Notifies all listeners when the selection of the tree changed.
+ *
+ * @param event the event to send
+ */
+ protected void fireValueChanged(TreeSelectionEvent event)
+ {
+ TreeSelectionListener[] listeners = getTreeSelectionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].valueChanged(event);
+ }
+
+ /**
+ * Adds a <code>TreeWillExpandListener</code> object to the tree.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeWillExpandListener(TreeWillExpandListener listener)
+ {
+ listenerList.add(TreeWillExpandListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeWillExpandListener</code> object from the tree.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeWillExpandListener(TreeWillExpandListener listener)
+ {
+ listenerList.remove(TreeWillExpandListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>TreeWillExpandListener</code> objects.
+ *
+ * @return an array of listeners
+ */
+ public TreeWillExpandListener[] getTreeWillExpandListeners()
+ {
+ return (TreeWillExpandListener[])
+ getListeners(TreeWillExpandListener.class);
+ }
+
+ /**
+ * Notifies all listeners that the tree will collapse.
+ *
+ * @param path the path to the node that will collapse
+ */
+ public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeWillCollapse(event);
+ }
+
+ /**
+ * Notifies all listeners that the tree will expand.
+ *
+ * @param path the path to the node that will expand
+ */
+ public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeWillExpand(event);
+ }
+
+ /**
+ * Returns the model of this <code>JTree</code> object.
+ *
+ * @return the associated <code>TreeModel</code>
+ */
+ public TreeModel getModel()
+ {
+ return treeModel;
+ }
+
+ /**
+ * Sets the model to use in <code>JTree</code>.
+ *
+ * @param model the <code>TreeModel</code> to use
+ */
+ public void setModel(TreeModel model)
+ {
+ if (treeModel == model)
+ return;
+
+ // add treeModelListener to the new model
+ if (treeModelListener == null)
+ treeModelListener = createTreeModelListener();
+ if (model != null) // as setModel(null) is allowed
+ model.addTreeModelListener(treeModelListener);
+
TreeModel oldValue = treeModel;
treeModel = model;
firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
- }
+ updateUI();
+ }
- /**
- * Checks if this <code>JTree</code> object is editable.
- *
- * @return <code>true</code> if this tree object is editable,
- * <code>false</code> otherwise
- */
- public boolean isEditable()
- {
- return editable;
- }
-
- /**
- * Sets the <code>editable</code> property.
- *
- * @param flag <code>true</code> to make this tree object editable,
- * <code>false</code> otherwise
- */
- public void setEditable(boolean flag)
- {
- if (editable == flag)
- return;
-
- boolean oldValue = editable;
- editable = flag;
- firePropertyChange(EDITABLE_PROPERTY, oldValue, editable);
- }
-
- /**
- * Checks if the root element is visible.
- *
- * @return <code>true</code> if the root element is visible,
- * <code>false</code> otherwise
- */
- public boolean isRootVisible()
- {
- return rootVisible;
- }
-
- public void setRootVisible(boolean flag)
- {
- if (rootVisible == flag)
- return;
-
- boolean oldValue = rootVisible;
- rootVisible = flag;
- firePropertyChange(ROOT_VISIBLE_PROPERTY, oldValue, flag);
- }
-
- public boolean getShowsRootHandles()
- {
- return showsRootHandles;
- }
-
- public void setShowsRootHandles(boolean flag)
- {
- if (showsRootHandles == flag)
- return;
-
- boolean oldValue = showsRootHandles;
- showsRootHandles = flag;
- firePropertyChange(SHOWS_ROOT_HANDLES_PROPERTY, oldValue, flag);
- }
-
- public TreeCellEditor getCellEditor()
- {
-
- return cellEditor;
- }
-
- public void setCellEditor(TreeCellEditor editor)
- {
- if (cellEditor == editor)
- return;
-
- TreeCellEditor oldValue = cellEditor;
- cellEditor = editor;
- firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
- }
-
- public TreeCellRenderer getCellRenderer()
- {
- return cellRenderer;
- }
-
- public void setCellRenderer(TreeCellRenderer newRenderer)
- {
- if (cellRenderer == newRenderer)
- return;
-
- TreeCellRenderer oldValue = cellRenderer;
- cellRenderer = newRenderer;
- firePropertyChange(CELL_RENDERER_PROPERTY, oldValue, newRenderer);
- }
-
- public TreeSelectionModel getSelectionModel()
- {
- return selectionModel;
- }
-
- public void setSelectionModel(TreeSelectionModel model)
- {
- if (selectionModel == model)
- return;
-
- if (selectionModel != null)
- selectionModel.removeTreeSelectionListener(selectionRedirector);
-
- TreeSelectionModel oldValue = selectionModel;
- selectionModel = model;
-
- if (selectionModel != null)
- selectionModel.addTreeSelectionListener(selectionRedirector);
-
- firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model);
- revalidate();
- repaint();
- }
-
- public int getVisibleRowCount()
- {
- return visibleRowCount;
- }
-
- public void setVisibleRowCount(int rows)
- {
- if (visibleRowCount == rows)
- return;
-
- int oldValue = visibleRowCount;
- visibleRowCount = rows;
- firePropertyChange(VISIBLE_ROW_COUNT_PROPERTY, oldValue, rows);
- }
-
- public boolean isLargeModel()
- {
- return largeModel;
- }
-
- public void setLargeModel(boolean large)
- {
- if (largeModel == large)
- return;
-
- boolean oldValue = largeModel;
- largeModel = large;
- firePropertyChange(LARGE_MODEL_PROPERTY, oldValue, large);
- }
-
- public int getRowHeight()
- {
-
- return rowHeight;
- }
-
- public void setRowHeight(int height)
- {
- if (rowHeight == height)
- return;
-
- int oldValue = rowHeight;
- rowHeight = height;
- firePropertyChange(ROW_HEIGHT_PROPERTY, oldValue, height);
- }
-
- public boolean isFixedRowHeight()
- {
- return rowHeight > 0;
- }
-
- public boolean getInvokesStopCellEditing()
- {
- return invokesStopCellEditing;
- }
-
- public void setInvokesStopCellEditing(boolean invoke)
- {
- if (invokesStopCellEditing == invoke)
- return;
-
- boolean oldValue = invokesStopCellEditing;
- invokesStopCellEditing = invoke;
- firePropertyChange(INVOKES_STOP_CELL_EDITING_PROPERTY,
- oldValue, invoke);
- }
-
- /**
- * @since 1.3
- */
- public int getToggleClickCount()
- {
- return toggleClickCount;
- }
+ /**
+ * Checks if this <code>JTree</code> object is editable.
+ *
+ * @return <code>true</code> if this tree object is editable,
+ * <code>false</code> otherwise
+ */
+ public boolean isEditable()
+ {
+ return editable;
+ }
- /**
- * @since 1.3
- */
- public void setToggleClickCount(int count)
- {
- if (toggleClickCount == count)
- return;
-
- int oldValue = toggleClickCount;
- toggleClickCount = count;
- firePropertyChange(TOGGLE_CLICK_COUNT_PROPERTY, oldValue, count);
- }
-
- public void scrollPathToVisible(TreePath path)
- {
- if (path == null)
- return;
+ /**
+ * Sets the <code>editable</code> property.
+ *
+ * @param flag <code>true</code> to make this tree object editable,
+ * <code>false</code> otherwise
+ */
+ public void setEditable(boolean flag)
+ {
+ if (editable == flag)
+ return;
- Rectangle rect = getPathBounds(path);
-
- if (rect == null)
- return;
-
- scrollRectToVisible(rect);
- }
+ boolean oldValue = editable;
+ editable = flag;
+ firePropertyChange(EDITABLE_PROPERTY, oldValue, editable);
+ }
- public void scrollRowToVisible(int row)
- {
- scrollPathToVisible(getPathForRow(row));
- }
-
- public boolean getScrollsOnExpand()
- {
- return scrollsOnExpand;
- }
-
- public void setScrollsOnExpand(boolean scroll)
- {
- if (scrollsOnExpand == scroll)
- return;
-
- boolean oldValue = scrollsOnExpand;
- scrollsOnExpand = scroll;
- firePropertyChange(SCROLLS_ON_EXPAND_PROPERTY, oldValue, scroll);
- }
-
- public void setSelectionPath(TreePath path)
- {
- selectionModel.setSelectionPath(path);
- }
-
- public void setSelectionPaths(TreePath[] paths)
- {
- selectionModel.setSelectionPaths(paths);
- }
-
- public void setSelectionRow(int row)
- {
- TreePath path = getPathForRow(row);
-
- if (path != null)
- selectionModel.setSelectionPath(path);
- }
-
- public void setSelectionRows(int[] rows)
- {
- // Make sure we have an UI so getPathForRow() does not return null.
- if (rows == null || getUI() == null)
- return;
-
- TreePath[] paths = new TreePath[rows.length];
-
- for (int i = rows.length - 1; i >= 0; --i)
- paths[i] = getPathForRow(rows[i]);
-
- setSelectionPaths(paths);
- }
-
- public void setSelectionInterval(int index0, int index1)
- {
- TreePath[] paths = getPathBetweenRows(index0, index1);
-
- if (paths != null)
- setSelectionPaths(paths);
- }
-
- public void addSelectionPath(TreePath path)
- {
- selectionModel.addSelectionPath(path);
- }
-
- public void addSelectionPaths(TreePath[] paths)
- {
- selectionModel.addSelectionPaths(paths);
- }
-
- public void addSelectionRow(int row)
- {
- TreePath path = getPathForRow(row);
-
- if (path != null)
- selectionModel.addSelectionPath(path);
- }
-
- public void addSelectionRows(int[] rows)
- {
- // Make sure we have an UI so getPathForRow() does not return null.
- if (rows == null || getUI() == null)
- return;
-
- TreePath[] paths = new TreePath[rows.length];
+ /**
+ * Checks if the root element is visible.
+ *
+ * @return <code>true</code> if the root element is visible,
+ * <code>false</code> otherwise
+ */
+ public boolean isRootVisible()
+ {
+ return rootVisible;
+ }
- for (int i = rows.length - 1; i >= 0; --i)
- paths[i] = getPathForRow(rows[i]);
-
- addSelectionPaths(paths);
- }
+ public void setRootVisible(boolean flag)
+ {
+ if (rootVisible == flag)
+ return;
- public void addSelectionInterval(int index0, int index1)
- {
- TreePath[] paths = getPathBetweenRows(index0, index1);
-
- if (paths != null)
- addSelectionPaths(paths);
- }
-
- public void removeSelectionPath(TreePath path)
- {
- selectionModel.removeSelectionPath(path);
- }
-
- public void removeSelectionPaths(TreePath[] paths)
- {
- selectionModel.removeSelectionPaths(paths);
- }
+ boolean oldValue = rootVisible;
+ rootVisible = flag;
+ firePropertyChange(ROOT_VISIBLE_PROPERTY, oldValue, flag);
+ }
- public void removeSelectionRow(int row)
- {
- TreePath path = getPathForRow(row);
+ public boolean getShowsRootHandles()
+ {
+ return showsRootHandles;
+ }
- if (path != null)
- selectionModel.removeSelectionPath(path);
- }
+ public void setShowsRootHandles(boolean flag)
+ {
+ if (showsRootHandles == flag)
+ return;
+
+ boolean oldValue = showsRootHandles;
+ showsRootHandles = flag;
+ firePropertyChange(SHOWS_ROOT_HANDLES_PROPERTY, oldValue, flag);
+ }
- public void removeSelectionRows(int[] rows)
- {
- if (rows == null || getUI() == null)
- return;
+ public TreeCellEditor getCellEditor()
+ {
+ return cellEditor;
+ }
- TreePath[] paths = new TreePath[rows.length];
+ public void setCellEditor(TreeCellEditor editor)
+ {
+ if (cellEditor == editor)
+ return;
- for (int i = rows.length - 1; i >= 0; --i)
- paths[i] = getPathForRow(rows[i]);
+ TreeCellEditor oldValue = cellEditor;
+ cellEditor = editor;
+ firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
+ }
- removeSelectionPaths(paths);
- }
+ public TreeCellRenderer getCellRenderer()
+ {
+ return cellRenderer;
+ }
- public void removeSelectionInterval(int index0, int index1)
- {
- TreePath[] paths = getPathBetweenRows(index0, index1);
+ public void setCellRenderer(TreeCellRenderer newRenderer)
+ {
+ if (cellRenderer == newRenderer)
+ return;
- if (paths != null)
- removeSelectionPaths(paths);
- }
+ TreeCellRenderer oldValue = cellRenderer;
+ cellRenderer = newRenderer;
+ firePropertyChange(CELL_RENDERER_PROPERTY, oldValue, newRenderer);
+ }
- public void clearSelection()
- {
- selectionModel.clearSelection();
- setLeadSelectionPath(null);
- }
+ public TreeSelectionModel getSelectionModel()
+ {
+ return selectionModel;
+ }
- public TreePath getLeadSelectionPath()
- {
- return leadSelectionPath;
- }
+ public void setSelectionModel(TreeSelectionModel model)
+ {
+ if (selectionModel == model)
+ return;
- /**
- * @since 1.3
- */
- public void setLeadSelectionPath(TreePath path)
- {
- if (leadSelectionPath == path)
- return;
-
- TreePath oldValue = leadSelectionPath;
- leadSelectionPath = path;
- firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path);
- }
-
- /**
- * @since 1.3
- */
- public TreePath getAnchorSelectionPath()
- {
- return anchorSelectionPath;
- }
+ if (selectionModel != null)
+ selectionModel.removeTreeSelectionListener(selectionRedirector);
- /**
- * @since 1.3
- */
- public void setAnchorSelectionPath(TreePath path)
- {
- if (anchorSelectionPath == path)
- return;
-
- TreePath oldValue = anchorSelectionPath;
- anchorSelectionPath = path;
- firePropertyChange(ANCHOR_SELECTION_PATH_PROPERTY, oldValue, path);
- }
-
- public int getLeadSelectionRow()
- {
- return selectionModel.getLeadSelectionRow();
- }
-
- public int getMaxSelectionRow()
- {
- return selectionModel.getMaxSelectionRow();
- }
-
- public int getMinSelectionRow()
- {
- return selectionModel.getMinSelectionRow();
- }
-
- public int getSelectionCount()
- {
- return selectionModel.getSelectionCount();
- }
-
- public TreePath getSelectionPath()
- {
- return selectionModel.getSelectionPath();
- }
-
- public TreePath[] getSelectionPaths()
- {
- return selectionModel.getSelectionPaths();
- }
-
- public int[] getSelectionRows()
- {
- return selectionModel.getSelectionRows();
- }
-
- public boolean isPathSelected(TreePath path)
- {
- return selectionModel.isPathSelected(path);
- }
-
- public boolean isRowSelected(int row)
- {
- return selectionModel.isPathSelected(getPathForRow(row));
- }
-
- public boolean isSelectionEmpty()
- {
- return selectionModel.isSelectionEmpty();
- }
-
- /**
- * Return the value of the <code>dragEnabled</code> property.
- *
- * @return the value
- *
- * @since 1.4
- */
- public boolean getDragEnabled()
- {
- return dragEnabled;
- }
-
- /**
- * Set the <code>dragEnabled</code> property.
- *
- * @param enabled new value
- *
- * @since 1.4
- */
- public void setDragEnabled(boolean enabled)
- {
+ TreeSelectionModel oldValue = selectionModel;
+ selectionModel = model;
- dragEnabled = enabled;
- }
+ if (selectionModel != null)
+ selectionModel.addTreeSelectionListener(selectionRedirector);
- public int getRowCount()
- {
- TreeUI ui = getUI();
+ firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model);
+ revalidate();
+ repaint();
+ }
- if (ui != null)
- return ui.getRowCount(this);
+ public int getVisibleRowCount()
+ {
+ return visibleRowCount;
+ }
- return 0;
- }
+ public void setVisibleRowCount(int rows)
+ {
+ if (visibleRowCount == rows)
+ return;
- public void collapsePath(TreePath path)
- {
- try
- {
- fireTreeWillCollapse(path);
- }
- catch (ExpandVetoException ev)
- {
- }
- setExpandedState(path, false);
- fireTreeCollapsed(path);
- }
+ int oldValue = visibleRowCount;
+ visibleRowCount = rows;
+ firePropertyChange(VISIBLE_ROW_COUNT_PROPERTY, oldValue, rows);
+ }
- public void collapseRow(int row)
- {
- if (row < 0 || row >= getRowCount())
- return;
+ public boolean isLargeModel()
+ {
+ return largeModel;
+ }
- TreePath path = getPathForRow(row);
+ public void setLargeModel(boolean large)
+ {
+ if (largeModel == large)
+ return;
- if (path != null)
- collapsePath(path);
- }
+ boolean oldValue = largeModel;
+ largeModel = large;
+ firePropertyChange(LARGE_MODEL_PROPERTY, oldValue, large);
+ }
- public void expandPath(TreePath path)
- {
- // Don't expand if last path component is a leaf node.
- if ((path == null) || (treeModel.isLeaf(path.getLastPathComponent())))
- return;
-
- try
- {
- fireTreeWillExpand(path);
- }
- catch (ExpandVetoException ev)
- {
- }
-
- setExpandedState(path, true);
- fireTreeExpanded(path);
- }
+ public int getRowHeight()
+ {
+ return rowHeight;
+ }
- public void expandRow(int row)
- {
- if (row < 0 || row >= getRowCount())
- return;
+ public void setRowHeight(int height)
+ {
+ if (rowHeight == height)
+ return;
- TreePath path = getPathForRow(row);
+ int oldValue = rowHeight;
+ rowHeight = height;
+ firePropertyChange(ROW_HEIGHT_PROPERTY, oldValue, height);
+ }
- if (path != null)
- expandPath(path);
- }
+ public boolean isFixedRowHeight()
+ {
+ return rowHeight > 0;
+ }
- public boolean isCollapsed(TreePath path)
- {
- return !isExpanded(path);
- }
+ public boolean getInvokesStopCellEditing()
+ {
+ return invokesStopCellEditing;
+ }
- public boolean isCollapsed(int row)
- {
- if (row < 0 || row >= getRowCount())
- return false;
+ public void setInvokesStopCellEditing(boolean invoke)
+ {
+ if (invokesStopCellEditing == invoke)
+ return;
- TreePath path = getPathForRow(row);
+ boolean oldValue = invokesStopCellEditing;
+ invokesStopCellEditing = invoke;
+ firePropertyChange(INVOKES_STOP_CELL_EDITING_PROPERTY,
+ oldValue, invoke);
+ }
- if (path != null)
- return isCollapsed(path);
+ /**
+ * @since 1.3
+ */
+ public int getToggleClickCount()
+ {
+ return toggleClickCount;
+ }
- return false;
- }
+ /**
+ * @since 1.3
+ */
+ public void setToggleClickCount(int count)
+ {
+ if (toggleClickCount == count)
+ return;
- public boolean isExpanded(TreePath path)
- {
- if (path == null)
- return false;
+ int oldValue = toggleClickCount;
+ toggleClickCount = count;
+ firePropertyChange(TOGGLE_CLICK_COUNT_PROPERTY, oldValue, count);
+ }
- Object state = nodeStates.get(path);
+ public void scrollPathToVisible(TreePath path)
+ {
+ if (path == null)
+ return;
+
+ Object[] oPath = path.getPath();
+ TreePath temp = new TreePath(oPath[0]);
+ boolean stop = false;
+ int i = 1;
+ while (!stop)
+ {
+ while (isVisible(temp))
+ if (i < oPath.length)
+ temp = temp.pathByAddingChild(oPath[i++]);
+ else
+ {
+ stop = true;
+ break;
+ }
+ makeVisible(temp);
+ }
+ Rectangle rect = getPathBounds(path);
+ scrollRectToVisible(rect);
+ revalidate();
+ repaint();
+ }
- if ((state == null) || (state != EXPANDED))
- return false;
+ public void scrollRowToVisible(int row)
+ {
+ scrollPathToVisible(getPathForRow(row));
+ }
- TreePath parent = path.getParentPath();
+ public boolean getScrollsOnExpand()
+ {
+ return scrollsOnExpand;
+ }
- if (parent != null)
- return isExpanded(parent);
+ public void setScrollsOnExpand(boolean scroll)
+ {
+ if (scrollsOnExpand == scroll)
+ return;
- return true;
- }
+ boolean oldValue = scrollsOnExpand;
+ scrollsOnExpand = scroll;
+ firePropertyChange(SCROLLS_ON_EXPAND_PROPERTY, oldValue, scroll);
+ }
- public boolean isExpanded(int row)
- {
- if (row < 0 || row >= getRowCount())
- return false;
+ public void setSelectionPath(TreePath path)
+ {
+ selectionModel.setSelectionPath(path);
+ }
- TreePath path = getPathForRow(row);
+ public void setSelectionPaths(TreePath[] paths)
+ {
+ selectionModel.setSelectionPaths(paths);
+ }
- if (path != null)
- return isExpanded(path);
+ public void setSelectionRow(int row)
+ {
+ TreePath path = getPathForRow(row);
- return false;
- }
+ if (path != null)
+ selectionModel.setSelectionPath(path);
+ }
- /**
- * @since 1.3
- */
- public boolean getExpandsSelectedPaths()
- {
- return expandsSelectedPaths;
- }
+ public void setSelectionRows(int[] rows)
+ {
+ // Make sure we have an UI so getPathForRow() does not return null.
+ if (rows == null || getUI() == null)
+ return;
- /**
- * @since 1.3
- */
- public void setExpandsSelectedPaths(boolean flag)
- {
- if (expandsSelectedPaths == flag)
- return;
+ TreePath[] paths = new TreePath[rows.length];
- boolean oldValue = expandsSelectedPaths;
- expandsSelectedPaths = flag;
- firePropertyChange(EXPANDS_SELECTED_PATHS_PROPERTY, oldValue, flag);
- }
+ for (int i = rows.length - 1; i >= 0; --i)
+ paths[i] = getPathForRow(rows[i]);
- public Rectangle getPathBounds(TreePath path)
- {
- TreeUI ui = getUI();
+ setSelectionPaths(paths);
+ }
- if (ui == null)
- return null;
+ public void setSelectionInterval(int index0, int index1)
+ {
+ TreePath[] paths = getPathBetweenRows(index0, index1);
- return ui.getPathBounds(this, path);
- }
+ if (paths != null)
+ setSelectionPaths(paths);
+ }
- public Rectangle getRowBounds(int row)
- {
- TreePath path = getPathForRow(row);
+ public void addSelectionPath(TreePath path)
+ {
+ selectionModel.addSelectionPath(path);
+ }
- if (path != null)
- return getPathBounds(path);
+ public void addSelectionPaths(TreePath[] paths)
+ {
+ selectionModel.addSelectionPaths(paths);
+ }
- return null;
- }
+ public void addSelectionRow(int row)
+ {
+ TreePath path = getPathForRow(row);
- public boolean isEditing()
- {
- TreeUI ui = getUI();
+ if (path != null)
+ selectionModel.addSelectionPath(path);
+ }
- if (ui != null)
- return ui.isEditing(this);
+ public void addSelectionRows(int[] rows)
+ {
+ // Make sure we have an UI so getPathForRow() does not return null.
+ if (rows == null || getUI() == null)
+ return;
- return false;
- }
+ TreePath[] paths = new TreePath[rows.length];
- public boolean stopEditing()
- {
- TreeUI ui = getUI();
+ for (int i = rows.length - 1; i >= 0; --i)
+ paths[i] = getPathForRow(rows[i]);
- if (ui != null)
- return ui.stopEditing(this);
+ addSelectionPaths(paths);
+ }
- return false;
- }
+ public void addSelectionInterval(int index0, int index1)
+ {
+ TreePath[] paths = getPathBetweenRows(index0, index1);
- public void cancelEditing()
- {
- TreeUI ui = getUI();
+ if (paths != null)
+ addSelectionPaths(paths);
+ }
- if (ui != null)
- ui.cancelEditing(this);
- }
+ public void removeSelectionPath(TreePath path)
+ {
+ selectionModel.removeSelectionPath(path);
+ }
- public void startEditingAtPath(TreePath path)
- {
- TreeUI ui = getUI();
+ public void removeSelectionPaths(TreePath[] paths)
+ {
+ selectionModel.removeSelectionPaths(paths);
+ }
- if (ui != null)
- ui.startEditingAtPath(this, path);
- }
+ public void removeSelectionRow(int row)
+ {
+ TreePath path = getPathForRow(row);
- public TreePath getEditingPath()
- {
- TreeUI ui = getUI();
+ if (path != null)
+ selectionModel.removeSelectionPath(path);
+ }
- if (ui != null)
- return ui.getEditingPath(this);
+ public void removeSelectionRows(int[] rows)
+ {
+ if (rows == null || getUI() == null)
+ return;
- return null;
- }
+ TreePath[] paths = new TreePath[rows.length];
- public TreePath getPathForLocation(int x, int y)
- {
- TreePath path = getClosestPathForLocation(x, y);
+ for (int i = rows.length - 1; i >= 0; --i)
+ paths[i] = getPathForRow(rows[i]);
- if (path != null)
- {
- Rectangle rect = getPathBounds(path);
+ removeSelectionPaths(paths);
+ }
- if ((rect != null) && rect.contains(x, y))
- return path;
- }
+ public void removeSelectionInterval(int index0, int index1)
+ {
+ TreePath[] paths = getPathBetweenRows(index0, index1);
- return null;
- }
+ if (paths != null)
+ removeSelectionPaths(paths);
+ }
- public int getRowForLocation(int x, int y)
- {
- TreePath path = getPathForLocation(x, y);
+ public void clearSelection()
+ {
+ selectionModel.clearSelection();
+ setLeadSelectionPath(null);
+ }
- if (path != null)
- return getRowForPath(path);
+ public TreePath getLeadSelectionPath()
+ {
+ return leadSelectionPath;
+ }
- return -1;
- }
+ /**
+ * @since 1.3
+ */
+ public void setLeadSelectionPath(TreePath path)
+ {
+ if (leadSelectionPath == path)
+ return;
+
+ TreePath oldValue = leadSelectionPath;
+ leadSelectionPath = path;
+ firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path);
+ }
- public TreePath getClosestPathForLocation(int x, int y)
- {
- TreeUI ui = getUI();
+ /**
+ * @since 1.3
+ */
+ public TreePath getAnchorSelectionPath()
+ {
+ return anchorSelectionPath;
+ }
- if (ui != null)
- return ui.getClosestPathForLocation(this, x, y);
+ /**
+ * @since 1.3
+ */
+ public void setAnchorSelectionPath(TreePath path)
+ {
+ if (anchorSelectionPath == path)
+ return;
- return null;
- }
+ TreePath oldValue = anchorSelectionPath;
+ anchorSelectionPath = path;
+ firePropertyChange(ANCHOR_SELECTION_PATH_PROPERTY, oldValue, path);
+ }
- public int getClosestRowForLocation(int x, int y)
- {
- TreePath path = getClosestPathForLocation(x, y);
+ public int getLeadSelectionRow()
+ {
+ return selectionModel.getLeadSelectionRow();
+ }
- if (path != null)
- return getRowForPath(path);
+ public int getMaxSelectionRow()
+ {
+ return selectionModel.getMaxSelectionRow();
+ }
- return -1;
- }
+ public int getMinSelectionRow()
+ {
+ return selectionModel.getMinSelectionRow();
+ }
- public Object getLastSelectedPathComponent()
- {
- TreePath path = getSelectionPath();
+ public int getSelectionCount()
+ {
+ return selectionModel.getSelectionCount();
+ }
- if (path != null)
- return path.getLastPathComponent();
+ public TreePath getSelectionPath()
+ {
+ return selectionModel.getSelectionPath();
+ }
- return null;
- }
+ public TreePath[] getSelectionPaths()
+ {
+ return selectionModel.getSelectionPaths();
+ }
- private void doExpandParents(TreePath path, boolean state)
- {
- TreePath parent = path.getParentPath();
-
- if (!isExpanded(parent) && parent != null)
- doExpandParents(parent, false);
+ public int[] getSelectionRows()
+ {
+ return selectionModel.getSelectionRows();
+ }
- nodeStates.put(path, state ? EXPANDED : COLLAPSED);
- }
+ public boolean isPathSelected(TreePath path)
+ {
+ return selectionModel.isPathSelected(path);
+ }
- protected void setExpandedState(TreePath path, boolean state)
- {
- if (path == null)
- return;
- TreePath parent = path.getParentPath();
+ public boolean isRowSelected(int row)
+ {
+ return selectionModel.isPathSelected(getPathForRow(row));
+ }
- doExpandParents(path, state);
- }
+ public boolean isSelectionEmpty()
+ {
+ return selectionModel.isSelectionEmpty();
+ }
- protected void clearToggledPaths()
- {
- nodeStates.clear();
- }
+ /**
+ * Return the value of the <code>dragEnabled</code> property.
+ *
+ * @return the value
+ *
+ * @since 1.4
+ */
+ public boolean getDragEnabled()
+ {
+ return dragEnabled;
+ }
- protected Enumeration getDescendantToggledPaths(TreePath parent)
- {
- if (parent == null)
- return null;
+ /**
+ * Set the <code>dragEnabled</code> property.
+ *
+ * @param enabled new value
+ *
+ * @since 1.4
+ */
+ public void setDragEnabled(boolean enabled)
+ {
+ dragEnabled = enabled;
+ }
- Enumeration nodes = nodeStates.keys();
- Vector result = new Vector();
+ public int getRowCount()
+ {
+ TreeUI ui = getUI();
- while (nodes.hasMoreElements())
- {
- TreePath path = (TreePath) nodes.nextElement();
+ if (ui != null)
+ return ui.getRowCount(this);
- if (path.isDescendant(parent))
- result.addElement(path);
- }
+ return 0;
+ }
- return result.elements();
- }
+ public void collapsePath(TreePath path)
+ {
+ try
+ {
+ fireTreeWillCollapse(path);
+ }
+ catch (ExpandVetoException ev)
+ {
+ // We do nothing if attempt has been vetoed.
+ }
+ setExpandedState(path, false);
+ fireTreeCollapsed(path);
+ }
- public boolean hasBeenExpanded(TreePath path)
- {
- if (path == null)
- return false;
+ public void collapseRow(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return;
- return nodeStates.get(path) != null;
- }
+ TreePath path = getPathForRow(row);
- public boolean isVisible(TreePath path)
- {
- if (path == null)
- return false;
+ if (path != null)
+ collapsePath(path);
+ }
- TreePath parent = path.getParentPath();
+ public void expandPath(TreePath path)
+ {
+ // Don't expand if path is null
+ if (path == null)
+ return;
+
+ try
+ {
+ fireTreeWillExpand(path);
+ }
+ catch (ExpandVetoException ev)
+ {
+ // We do nothing if attempt has been vetoed.
+ }
+
+ setExpandedState(path, true);
+ fireTreeExpanded(path);
+ }
- if (parent == null)
- return true; // Is root node.
+ public void expandRow(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return;
- return isExpanded(parent);
- }
+ TreePath path = getPathForRow(row);
- public void makeVisible(TreePath path)
- {
- if (path == null)
- return;
+ if (path != null)
+ expandPath(path);
+ }
- expandPath(path.getParentPath());
- }
+ public boolean isCollapsed(TreePath path)
+ {
+ return !isExpanded(path);
+ }
- public boolean isPathEditable(TreePath path)
- {
- return isEditable();
- }
+ public boolean isCollapsed(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return false;
- /**
- * Creates and returns an instance of {@link TreeModelHandler}.
- *
- * @returns an instance of {@link TreeModelHandler}
- */
- protected TreeModelListener createTreeModelListener()
- {
- return new TreeModelHandler();
- }
-
- /**
- * Returns a sample TreeModel that can be used in a JTree. This can be used
- * in Bean- or GUI-Builders to show something interesting.
- *
- * @return a sample TreeModel that can be used in a JTree
- */
- protected static TreeModel getDefaultTreeModel()
- {
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node");
- DefaultMutableTreeNode child1 = new DefaultMutableTreeNode(
- "Child node 1");
- DefaultMutableTreeNode child11 = new DefaultMutableTreeNode(
- "Child node 1.1");
- DefaultMutableTreeNode child12 = new DefaultMutableTreeNode(
- "Child node 1.2");
- DefaultMutableTreeNode child13 = new DefaultMutableTreeNode(
- "Child node 1.3");
- DefaultMutableTreeNode child2 = new DefaultMutableTreeNode(
- "Child node 2");
- DefaultMutableTreeNode child21 = new DefaultMutableTreeNode(
- "Child node 2.1");
- DefaultMutableTreeNode child22 = new DefaultMutableTreeNode(
- "Child node 2.2");
- DefaultMutableTreeNode child23 = new DefaultMutableTreeNode(
- "Child node 2.3");
- DefaultMutableTreeNode child24 = new DefaultMutableTreeNode(
- "Child node 2.4");
-
- DefaultMutableTreeNode child3 = new DefaultMutableTreeNode(
- "Child node 3");
- root.add(child1);
- root.add(child2);
- root.add(child3);
- child1.add(child11);
- child1.add(child12);
- child1.add(child13);
- child2.add(child21);
- child2.add(child22);
- child2.add(child23);
- child2.add(child24);
- return new DefaultTreeModel(root);
- }
-
- /**
- * Converts the specified value to a String. This is used by the renderers
- * of this JTree and its nodes.
- *
- * This implementation simply returns <code>value.toString()</code> and
- * ignores all other parameters. Subclass this method to control the
- * conversion.
- *
- * @param value the value that is converted to a String
- * @param selected indicates if that value is selected or not
- * @param expanded indicates if that value is expanded or not
- * @param leaf indicates if that value is a leaf node or not
- * @param row the row of the node
- * @param hasFocus indicates if that node has focus or not
- */
- public String convertValueToText(Object value, boolean selected,
- boolean expanded, boolean leaf, int row, boolean hasFocus)
- {
- return value.toString();
- }
-
- /**
- * A String representation of this JTree. This is intended to be used for
- * debugging. The returned string may be empty but may not be
- * <code>null</code>.
- *
- * @return a String representation of this JTree
- */
- public String paramString()
- {
- // TODO: this is completely legal, but it would possibly be nice
- // to return some more content, like the tree structure, some properties
- // etc ...
- return "";
- }
-
- /**
- * Returns all TreePath objects which are a descendants of the given path
- * and are exapanded at the moment of the execution of this method. If the
- * state of any node is beeing toggled while this method is executing this
- * change may be left unaccounted.
- *
- * @param path The parent of this request
- * @return An Enumeration containing TreePath objects
- */
- public Enumeration getExpandedDescendants(TreePath path)
- {
- Enumeration paths = nodeStates.keys();
- Vector relevantPaths = new Vector();
- while (paths.hasMoreElements())
- {
- TreePath nextPath = (TreePath) paths.nextElement();
- if (nodeStates.get(nextPath) == EXPANDED
- && path.isDescendant(nextPath))
- {
- relevantPaths.add(nextPath);
- }
- }
- return relevantPaths.elements();
- }
-
- /**
- * Returns the next table element (beginning from the row
- * <code>startingRow</code> that starts with <code>prefix</code>.
- * Searching is done in the direction specified by <code>bias</code>.
- *
- * @param prefix the prefix to search for in the cell values
- * @param startingRow the index of the row where to start searching from
- * @param bias the search direction, either {@link Position.Bias#Forward} or
- * {@link Position.Bias#Backward}
- *
- * @return the path to the found element or -1 if no such element has been
- * found
- *
- * @throws IllegalArgumentException if prefix is <code>null</code> or
- * startingRow is not valid
- *
- * @since 1.4
- */
- public TreePath getNextMatch(String prefix, int startingRow,
- Position.Bias bias)
- {
- if (prefix == null)
- throw new IllegalArgumentException(
- "The argument 'prefix' must not be" + " null.");
- if (startingRow < 0)
- throw new IllegalArgumentException(
- "The argument 'startingRow' must not"
- + " be less than zero.");
-
- int size = getRowCount();
- if (startingRow > size)
- throw new IllegalArgumentException(
- "The argument 'startingRow' must not"
- + " be greater than the number of"
- + " elements in the TreeModel.");
-
- TreePath foundPath = null;
- if (bias == Position.Bias.Forward)
- {
- for (int i = startingRow; i < size; i++)
- {
- TreePath path = getPathForRow(i);
- Object o = path.getLastPathComponent();
- // FIXME: in the following call to convertValueToText the
- // last argument (hasFocus) should be done right.
- String item = convertValueToText(o, isRowSelected(i),
- isExpanded(i), treeModel.isLeaf(o), i, false);
- if (item.startsWith(prefix))
- {
- foundPath = path;
- break;
- }
- }
- } else
- {
- for (int i = startingRow; i >= 0; i--)
- {
- TreePath path = getPathForRow(i);
- Object o = path.getLastPathComponent();
- // FIXME: in the following call to convertValueToText the
- // last argument (hasFocus) should be done right.
- String item = convertValueToText(o, isRowSelected(i),
- isExpanded(i), treeModel.isLeaf(o), i, false);
- if (item.startsWith(prefix))
- {
- foundPath = path;
- break;
- }
- }
- }
- return foundPath;
- }
-
- /**
- * Removes any paths in the current set of selected paths that are
- * descendants of <code>path</code>. If <code>includePath</code> is set
- * to <code>true</code> and <code>path</code> itself is selected, then
- * it will be removed too.
- *
- * @param path the path from which selected descendants are to be removed
- * @param includeSelected if <code>true</code> then <code>path</code> itself
- * will also be remove if it's selected
- *
- * @return <code>true</code> if something has been removed,
- * <code>false</code> otherwise
- *
- * @since 1.3
- */
- protected boolean removeDescendantSelectedPaths(TreePath path,
- boolean includeSelected)
- {
- boolean removedSomething = false;
- TreePath[] selected = getSelectionPaths();
- for (int index = 0; index < selected.length; index++)
- {
- if ((selected[index] == path && includeSelected)
- || (selected[index].isDescendant(path)))
- {
- removeSelectionPath(selected[index]);
- removedSomething = true;
- }
- }
- return removedSomething;
- }
+ TreePath path = getPathForRow(row);
+
+ if (path != null)
+ return isCollapsed(path);
+
+ return false;
+ }
+
+ public boolean isExpanded(TreePath path)
+ {
+ if (path == null)
+ return false;
+
+ Object state = nodeStates.get(path);
+
+ if ((state == null) || (state != EXPANDED))
+ return false;
+
+ TreePath parent = path.getParentPath();
+
+ if (parent != null)
+ return isExpanded(parent);
+
+ return true;
+ }
+
+ public boolean isExpanded(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return false;
+
+ TreePath path = getPathForRow(row);
+
+ if (path != null)
+ return isExpanded(path);
+
+ return false;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public boolean getExpandsSelectedPaths()
+ {
+ return expandsSelectedPaths;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setExpandsSelectedPaths(boolean flag)
+ {
+ if (expandsSelectedPaths == flag)
+ return;
+
+ boolean oldValue = expandsSelectedPaths;
+ expandsSelectedPaths = flag;
+ firePropertyChange(EXPANDS_SELECTED_PATHS_PROPERTY, oldValue, flag);
+ }
+
+ public Rectangle getPathBounds(TreePath path)
+ {
+ TreeUI ui = getUI();
+
+ if (ui == null)
+ return null;
+
+ return ui.getPathBounds(this, path);
+ }
+
+ public Rectangle getRowBounds(int row)
+ {
+ TreePath path = getPathForRow(row);
+
+ if (path != null)
+ return getPathBounds(path);
+
+ return null;
+ }
+
+ public boolean isEditing()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.isEditing(this);
+
+ return false;
+ }
+
+ public boolean stopEditing()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.stopEditing(this);
+
+ return false;
+ }
+
+ public void cancelEditing()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ ui.cancelEditing(this);
+ }
+
+ public void startEditingAtPath(TreePath path)
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ ui.startEditingAtPath(this, path);
+ }
+
+ public TreePath getEditingPath()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.getEditingPath(this);
+
+ return null;
+ }
+
+ public TreePath getPathForLocation(int x, int y)
+ {
+ TreePath path = getClosestPathForLocation(x, y);
+
+ if (path != null)
+ {
+ Rectangle rect = getPathBounds(path);
+
+ if ((rect != null) && rect.contains(x, y))
+ return path;
+ }
+
+ return null;
+ }
+
+ public int getRowForLocation(int x, int y)
+ {
+ TreePath path = getPathForLocation(x, y);
+
+ if (path != null)
+ return getRowForPath(path);
+
+ return -1;
+ }
+
+ public TreePath getClosestPathForLocation(int x, int y)
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.getClosestPathForLocation(this, x, y);
+
+ return null;
+ }
+
+ public int getClosestRowForLocation(int x, int y)
+ {
+ TreePath path = getClosestPathForLocation(x, y);
+
+ if (path != null)
+ return getRowForPath(path);
+
+ return -1;
+ }
+
+ public Object getLastSelectedPathComponent()
+ {
+ TreePath path = getSelectionPath();
+
+ if (path != null)
+ return path.getLastPathComponent();
+
+ return null;
+ }
+
+ private void doExpandParents(TreePath path, boolean state)
+ {
+ TreePath parent = path.getParentPath();
+
+ if (!isExpanded(parent) && parent != null)
+ doExpandParents(parent, false);
+
+ nodeStates.put(path, state ? EXPANDED : COLLAPSED);
+ }
+
+ protected void setExpandedState(TreePath path, boolean state)
+ {
+ if (path == null)
+ return;
+
+ doExpandParents(path, state);
+ }
+
+ protected void clearToggledPaths()
+ {
+ nodeStates.clear();
+ }
+
+ protected Enumeration getDescendantToggledPaths(TreePath parent)
+ {
+ if (parent == null)
+ return null;
+
+ Enumeration nodes = nodeStates.keys();
+ Vector result = new Vector();
+
+ while (nodes.hasMoreElements())
+ {
+ TreePath path = (TreePath) nodes.nextElement();
+
+ if (path.isDescendant(parent))
+ result.addElement(path);
+ }
+
+ return result.elements();
+ }
+
+ public boolean hasBeenExpanded(TreePath path)
+ {
+ if (path == null)
+ return false;
+
+ return nodeStates.get(path) != null;
+ }
+
+ public boolean isVisible(TreePath path)
+ {
+ if (path == null)
+ return false;
+
+ TreePath parent = path.getParentPath();
+
+ if (parent == null)
+ return true; // Is root node.
+
+ return isExpanded(parent);
+ }
+
+ public void makeVisible(TreePath path)
+ {
+ if (path == null)
+ return;
+
+ expandPath(path.getParentPath());
+ }
+
+ public boolean isPathEditable(TreePath path)
+ {
+ return isEditable();
+ }
+
+ /**
+ * Creates and returns an instance of {@link TreeModelHandler}.
+ *
+ * @return an instance of {@link TreeModelHandler}
+ */
+ protected TreeModelListener createTreeModelListener()
+ {
+ return new TreeModelHandler();
+ }
+
+ /**
+ * Returns a sample TreeModel that can be used in a JTree. This can be used
+ * in Bean- or GUI-Builders to show something interesting.
+ *
+ * @return a sample TreeModel that can be used in a JTree
+ */
+ protected static TreeModel getDefaultTreeModel()
+ {
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node");
+ DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child node 1");
+ DefaultMutableTreeNode child11 =
+ new DefaultMutableTreeNode("Child node 1.1");
+ DefaultMutableTreeNode child12 =
+ new DefaultMutableTreeNode("Child node 1.2");
+ DefaultMutableTreeNode child13 =
+ new DefaultMutableTreeNode("Child node 1.3");
+ DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child node 2");
+ DefaultMutableTreeNode child21 =
+ new DefaultMutableTreeNode("Child node 2.1");
+ DefaultMutableTreeNode child22 =
+ new DefaultMutableTreeNode("Child node 2.2");
+ DefaultMutableTreeNode child23 =
+ new DefaultMutableTreeNode("Child node 2.3");
+ DefaultMutableTreeNode child24 =
+ new DefaultMutableTreeNode("Child node 2.4");
+
+ DefaultMutableTreeNode child3 = new DefaultMutableTreeNode("Child node 3");
+ root.add(child1);
+ root.add(child2);
+ root.add(child3);
+ child1.add(child11);
+ child1.add(child12);
+ child1.add(child13);
+ child2.add(child21);
+ child2.add(child22);
+ child2.add(child23);
+ child2.add(child24);
+ return new DefaultTreeModel(root);
+ }
+
+ /**
+ * Converts the specified value to a String. This is used by the renderers
+ * of this JTree and its nodes.
+ *
+ * This implementation simply returns <code>value.toString()</code> and
+ * ignores all other parameters. Subclass this method to control the
+ * conversion.
+ *
+ * @param value the value that is converted to a String
+ * @param selected indicates if that value is selected or not
+ * @param expanded indicates if that value is expanded or not
+ * @param leaf indicates if that value is a leaf node or not
+ * @param row the row of the node
+ * @param hasFocus indicates if that node has focus or not
+ */
+ public String convertValueToText(Object value, boolean selected,
+ boolean expanded, boolean leaf, int row, boolean hasFocus)
+ {
+ return value.toString();
+ }
+
+ /**
+ * A String representation of this JTree. This is intended to be used for
+ * debugging. The returned string may be empty but may not be
+ * <code>null</code>.
+ *
+ * @return a String representation of this JTree
+ */
+ public String paramString()
+ {
+ // TODO: this is completely legal, but it would possibly be nice
+ // to return some more content, like the tree structure, some properties
+ // etc ...
+ return "";
+ }
+
+ /**
+ * Returns all TreePath objects which are a descendants of the given path
+ * and are exapanded at the moment of the execution of this method. If the
+ * state of any node is beeing toggled while this method is executing this
+ * change may be left unaccounted.
+ *
+ * @param path The parent of this request
+ *
+ * @return An Enumeration containing TreePath objects
+ */
+ public Enumeration getExpandedDescendants(TreePath path)
+ {
+ Enumeration paths = nodeStates.keys();
+ Vector relevantPaths = new Vector();
+ while (paths.hasMoreElements())
+ {
+ TreePath nextPath = (TreePath) paths.nextElement();
+ if (nodeStates.get(nextPath) == EXPANDED
+ && path.isDescendant(nextPath))
+ {
+ relevantPaths.add(nextPath);
+ }
+ }
+ return relevantPaths.elements();
+ }
+
+ /**
+ * Returns the next table element (beginning from the row
+ * <code>startingRow</code> that starts with <code>prefix</code>.
+ * Searching is done in the direction specified by <code>bias</code>.
+ *
+ * @param prefix the prefix to search for in the cell values
+ * @param startingRow the index of the row where to start searching from
+ * @param bias the search direction, either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward}
+ *
+ * @return the path to the found element or -1 if no such element has been
+ * found
+ *
+ * @throws IllegalArgumentException if prefix is <code>null</code> or
+ * startingRow is not valid
+ *
+ * @since 1.4
+ */
+ public TreePath getNextMatch(String prefix, int startingRow,
+ Position.Bias bias)
+ {
+ if (prefix == null)
+ throw new IllegalArgumentException("The argument 'prefix' must not be"
+ + " null.");
+ if (startingRow < 0)
+ throw new IllegalArgumentException("The argument 'startingRow' must not"
+ + " be less than zero.");
+
+ int size = getRowCount();
+ if (startingRow > size)
+ throw new IllegalArgumentException("The argument 'startingRow' must not"
+ + " be greater than the number of"
+ + " elements in the TreeModel.");
+
+ TreePath foundPath = null;
+ if (bias == Position.Bias.Forward)
+ {
+ for (int i = startingRow; i < size; i++)
+ {
+ TreePath path = getPathForRow(i);
+ Object o = path.getLastPathComponent();
+ // FIXME: in the following call to convertValueToText the
+ // last argument (hasFocus) should be done right.
+ String item = convertValueToText(o, isRowSelected(i),
+ isExpanded(i), treeModel.isLeaf(o),
+ i, false);
+ if (item.startsWith(prefix))
+ {
+ foundPath = path;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (int i = startingRow; i >= 0; i--)
+ {
+ TreePath path = getPathForRow(i);
+ Object o = path.getLastPathComponent();
+ // FIXME: in the following call to convertValueToText the
+ // last argument (hasFocus) should be done right.
+ String item = convertValueToText(o, isRowSelected(i),
+ isExpanded(i), treeModel.isLeaf(o), i, false);
+ if (item.startsWith(prefix))
+ {
+ foundPath = path;
+ break;
+ }
+ }
+ }
+ return foundPath;
+ }
+
+ /**
+ * Removes any paths in the current set of selected paths that are
+ * descendants of <code>path</code>. If <code>includePath</code> is set
+ * to <code>true</code> and <code>path</code> itself is selected, then
+ * it will be removed too.
+ *
+ * @param path the path from which selected descendants are to be removed
+ * @param includeSelected if <code>true</code> then <code>path</code> itself
+ * will also be remove if it's selected
+ *
+ * @return <code>true</code> if something has been removed,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ protected boolean removeDescendantSelectedPaths(TreePath path,
+ boolean includeSelected)
+ {
+ boolean removedSomething = false;
+ TreePath[] selected = getSelectionPaths();
+ for (int index = 0; index < selected.length; index++)
+ {
+ if ((selected[index] == path && includeSelected)
+ || (selected[index].isDescendant(path)))
+ {
+ removeSelectionPath(selected[index]);
+ removedSomething = true;
+ }
+ }
+ return removedSomething;
+ }
+
+ /**
+ * Removes any descendants of the TreePaths in toRemove that have been
+ * expanded.
+ *
+ * @param toRemove - Enumeration of TreePaths that need to be removed from
+ * cache of toggled tree paths.
+ */
+ protected void removeDescendantToggledPaths(Enumeration toRemove)
+ {
+ while (toRemove.hasMoreElements())
+ {
+ TreePath current = (TreePath) toRemove.nextElement();
+ Enumeration descendants = getDescendantToggledPaths(current);
+
+ while (descendants.hasMoreElements())
+ {
+ TreePath currentDes = (TreePath) descendants.nextElement();
+ if (isExpanded(currentDes))
+ nodeStates.remove(currentDes);
+ }
+ }
+ }
+
+ /**
+ * Sent when the tree has changed enough that we need to resize the bounds,
+ * but not enough that we need to remove the expanded node set (e.g nodes
+ * were expanded or collapsed, or nodes were inserted into the tree). You
+ * should never have to invoke this, the UI will invoke this as it needs to.
+ */
+ public void treeDidChange()
+ {
+ repaint();
+ }
}
diff --git a/libjava/classpath/javax/swing/JViewport.java b/libjava/classpath/javax/swing/JViewport.java
index d750bad29cc..5f20f0aa60a 100644
--- a/libjava/classpath/javax/swing/JViewport.java
+++ b/libjava/classpath/javax/swing/JViewport.java
@@ -41,6 +41,7 @@ package javax.swing;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Image;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Point;
@@ -49,6 +50,9 @@ import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.io.Serializable;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -95,17 +99,41 @@ import javax.swing.plaf.ViewportUI;
* the underlying child at position <code>(-VX,-VY)</code></p>
*
*/
-public class JViewport extends JComponent
+public class JViewport extends JComponent implements Accessible
{
+ /**
+ * Provides accessibility support for <code>JViewport</code>.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ protected class AccessibleJViewport extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJViewport</code>.
+ */
+ public AccessibleJViewport()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessible role of <code>JViewport</code>, which is
+ * {@link AccessibleRole#VIEWPORT}.
+ *
+ * @return the accessible role of <code>JViewport</code>
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.VIEWPORT;
+ }
+ }
/**
* A {@link java.awt.event.ComponentListener} that listens for
- * changes of the view's size. This class forbids changes of the view
- * component's size that would exceed the viewport's size.
+ * changes of the view's size. This triggers a revalidate() call on the
+ * viewport.
*/
- protected class ViewListener
- extends ComponentAdapter
- implements Serializable
+ protected class ViewListener extends ComponentAdapter implements Serializable
{
private static final long serialVersionUID = -2812489404285958070L;
@@ -114,57 +142,53 @@ public class JViewport extends JComponent
*/
protected ViewListener()
{
+ // Nothing to do here.
}
/**
* Receives notification when a component (in this case: the view
- * component) changes it's size.
+ * component) changes it's size. This simply triggers a revalidate() on the
+ * viewport.
*
* @param ev the ComponentEvent describing the change
*/
public void componentResized(ComponentEvent ev)
{
- // According to some tests that I did with Sun's implementation
- // this class is supposed to make sure that the view component
- // is not resized to a larger size than the viewport.
- // This is not documented anywhere. What I did is: I subclassed JViewport
- // and ViewListener and 'disabled' the componentResized method by
- // overriding it and not calling super.componentResized().
- // When this method is disabled I can set the size on the view component
- // normally, when it is enabled, it gets immediatly resized back,
- // after a resize attempt that would exceed the Viewport's size.
- Component comp = ev.getComponent();
- Dimension newSize = comp.getSize();
- Dimension viewportSize = getSize();
- boolean revert = false;
- if (newSize.width > viewportSize.width)
- {
- newSize.width = viewportSize.width;
- revert = true;
- }
- if (newSize.height > viewportSize.height)
- {
- newSize.height = viewportSize.height;
- revert = true;
- }
- if (revert == true)
- comp.setSize(newSize);
+ revalidate();
}
}
- private static final long serialVersionUID = -6925142919680527970L;
-
public static final int SIMPLE_SCROLL_MODE = 0;
public static final int BLIT_SCROLL_MODE = 1;
public static final int BACKINGSTORE_SCROLL_MODE = 2;
+ private static final long serialVersionUID = -6925142919680527970L;
+
+ protected boolean scrollUnderway;
+ protected boolean isViewSizeSet;
+
+ /**
+ * This flag indicates whether we use a backing store for drawing.
+ *
+ * @deprecated since JDK 1.3
+ */
+ protected boolean backingStore;
+
+ /**
+ * The backingstore image used for the backingstore and blit scroll methods.
+ */
+ protected Image backingStoreImage;
+
+ /**
+ * The position at which the view has been drawn the last time. This is used
+ * to determine the bittable area.
+ */
+ protected Point lastPaintPosition;
+
ChangeEvent changeEvent = new ChangeEvent(this);
int scrollMode;
- protected boolean scrollUnderway;
- protected boolean isViewSizeSet;
-
/**
* The width and height of the Viewport's area in terms of view
* coordinates. Typically this will be the same as the width and height
@@ -172,29 +196,75 @@ public class JViewport extends JComponent
* width and height, which it may do, for example if it magnifies or
* rotates its view.
*
- * @see #toViewCoordinates
+ * @see #toViewCoordinates(Dimension)
*/
Dimension extentSize;
/**
* The width and height of the view in its own coordinate space.
*/
-
Dimension viewSize;
- Point lastPaintPosition;
-
/**
* The ViewListener instance.
*/
ViewListener viewListener;
+ /**
+ * Stores the location from where to blit. This is a cached Point object used
+ * in blitting calculations.
+ */
+ Point cachedBlitFrom;
+
+ /**
+ * Stores the location where to blit to. This is a cached Point object used
+ * in blitting calculations.
+ */
+ Point cachedBlitTo;
+
+ /**
+ * Stores the width of the blitted area. This is a cached Dimension object
+ * used in blitting calculations.
+ */
+ Dimension cachedBlitSize;
+
+ /**
+ * Stores the bounds of the area that needs to be repainted. This is a cached
+ * Rectangle object used in blitting calculations.
+ */
+ Rectangle cachedBlitPaint;
+
+ boolean damaged = true;
+
+ /**
+ * A flag indicating if the size of the viewport has changed since the
+ * last repaint. This is used in double buffered painting to check if we
+ * need a new double buffer, or can reuse the old one.
+ */
+ boolean sizeChanged = true;
+
public JViewport()
{
setOpaque(true);
- setScrollMode(BLIT_SCROLL_MODE);
- setLayout(createLayoutManager());
+ String scrollModeProp =
+ System.getProperty("gnu.javax.swing.JViewport.scrollMode",
+ "BLIT");
+ int myScrollMode;
+ if (scrollModeProp.equalsIgnoreCase("simple"))
+ myScrollMode = SIMPLE_SCROLL_MODE;
+ else if (scrollModeProp.equalsIgnoreCase("backingstore"))
+ myScrollMode = BACKINGSTORE_SCROLL_MODE;
+ else
+ myScrollMode = BLIT_SCROLL_MODE;
+ setScrollMode(myScrollMode);
+
updateUI();
+ setLayout(createLayoutManager());
+ lastPaintPosition = new Point();
+ cachedBlitFrom = new Point();
+ cachedBlitTo = new Point();
+ cachedBlitSize = new Dimension();
+ cachedBlitPaint = new Rectangle();
}
public Dimension getExtentSize()
@@ -248,9 +318,14 @@ public class JViewport extends JComponent
viewSize = newSize;
Component view = getView();
if (view != null)
- view.setSize(viewSize);
+ {
+ if (newSize != view.getSize())
+ {
+ view.setSize(viewSize);
+ fireStateChanged();
+ }
+ }
isViewSizeSet = true;
- fireStateChanged();
}
/**
@@ -275,13 +350,17 @@ public class JViewport extends JComponent
public void setViewPosition(Point p)
{
+ if (getViewPosition().equals(p))
+ return;
Component view = getView();
if (view != null)
{
Point q = new Point(-p.x, -p.y);
view.setLocation(q);
+ isViewSizeSet = false;
fireStateChanged();
}
+ repaint();
}
public Rectangle getViewRect()
@@ -331,12 +410,8 @@ public class JViewport extends JComponent
public void setView(Component v)
{
- while (getComponentCount() > 0)
- {
- if (viewListener != null)
- getView().removeComponentListener(viewListener);
- remove(0);
- }
+ if (viewListener != null)
+ getView().removeComponentListener(viewListener);
if (v != null)
{
@@ -346,37 +421,25 @@ public class JViewport extends JComponent
add(v);
fireStateChanged();
}
- }
-
- public void revalidate()
- {
- fireStateChanged();
- super.revalidate();
+ revalidate();
+ repaint();
}
public void reshape(int x, int y, int w, int h)
{
- boolean changed =
- (x != getX())
- || (y != getY())
- || (w != getWidth())
- || (h != getHeight());
+ if (w != getWidth() || h != getHeight())
+ sizeChanged = true;
super.reshape(x, y, w, h);
- if (changed)
- fireStateChanged();
- }
-
- protected void addImpl(Component comp, Object constraints, int index)
- {
- if (getComponentCount() > 0)
- remove(getComponents()[0]);
-
- super.addImpl(comp, constraints, index);
+ if (sizeChanged)
+ {
+ damaged = true;
+ fireStateChanged();
+ }
}
- public final Insets getInsets()
+ public final Insets getInsets()
{
- return new Insets(0,0,0,0);
+ return new Insets(0, 0, 0, 0);
}
public final Insets getInsets(Insets insets)
@@ -390,6 +453,14 @@ public class JViewport extends JComponent
return insets;
}
+
+ /**
+ * Overridden to return <code>false</code>, so the JViewport's paint method
+ * gets called instead of directly calling the children. This is necessary
+ * in order to get a useful clipping and translation on the children.
+ *
+ * @return <code>false</code>
+ */
public boolean isOptimizedDrawingEnabled()
{
return false;
@@ -397,7 +468,36 @@ public class JViewport extends JComponent
public void paint(Graphics g)
{
- paintComponent(g);
+ Component view = getView();
+
+ if (view == null)
+ return;
+
+ Point pos = getViewPosition();
+ Rectangle viewBounds = view.getBounds();
+ Rectangle portBounds = getBounds();
+
+ if (viewBounds.width == 0
+ || viewBounds.height == 0
+ || portBounds.width == 0
+ || portBounds.height == 0)
+ return;
+
+ switch (getScrollMode())
+ {
+
+ case JViewport.BACKINGSTORE_SCROLL_MODE:
+ paintBackingStore(g);
+ break;
+ case JViewport.BLIT_SCROLL_MODE:
+ paintBlit(g);
+ break;
+ case JViewport.SIMPLE_SCROLL_MODE:
+ default:
+ paintSimple(g);
+ break;
+ }
+ damaged = false;
}
public void addChangeListener(ChangeListener listener)
@@ -415,13 +515,6 @@ public class JViewport extends JComponent
return (ChangeListener[]) getListeners(ChangeListener.class);
}
- protected void fireStateChanged()
- {
- ChangeListener[] listeners = getChangeListeners();
- for (int i = 0; i < listeners.length; ++i)
- listeners[i].stateChanged(changeEvent);
- }
-
/**
* This method returns the String ID of the UI class of Separator.
*
@@ -467,6 +560,90 @@ public class JViewport extends JComponent
}
/**
+ * Scrolls the view so that contentRect becomes visible.
+ *
+ * @param contentRect the rectangle to make visible within the view
+ */
+ public void scrollRectToVisible(Rectangle contentRect)
+ {
+ Component view = getView();
+ if (view == null)
+ return;
+
+ Point pos = getViewPosition();
+ Rectangle viewBounds = getView().getBounds();
+ Rectangle portBounds = getBounds();
+
+ if (isShowing())
+ getView().validate();
+
+ // If the bottom boundary of contentRect is below the port
+ // boundaries, scroll up as necessary.
+ if (contentRect.y + contentRect.height + viewBounds.y > portBounds.height)
+ pos.y = contentRect.y + contentRect.height - portBounds.height;
+ // If contentRect.y is above the port boundaries, scroll down to
+ // contentRect.y.
+ if (contentRect.y + viewBounds.y < 0)
+ pos.y = contentRect.y;
+ // If the right boundary of contentRect is right from the port
+ // boundaries, scroll left as necessary.
+ if (contentRect.x + contentRect.width + viewBounds.x > portBounds.width)
+ pos.x = contentRect.x + contentRect.width - portBounds.width;
+ // If contentRect.x is left from the port boundaries, scroll right to
+ // contentRect.x.
+ if (contentRect.x + viewBounds.x < 0)
+ pos.x = contentRect.x;
+ setViewPosition(pos);
+ }
+
+ /**
+ * Returns the accessible context for this <code>JViewport</code>. This
+ * will be an instance of {@link AccessibleJViewport}.
+ *
+ * @return the accessible context for this <code>JViewport</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJViewport();
+ return accessibleContext;
+ }
+
+ /**
+ * Forward repaint to parent to make sure only one paint is performed by the
+ * RepaintManager.
+ *
+ * @param tm number of milliseconds to defer the repaint request
+ * @param x the X coordinate of the upper left corner of the dirty area
+ * @param y the Y coordinate of the upper left corner of the dirty area
+ * @param w the width of the dirty area
+ * @param h the height of the dirty area
+ */
+ public void repaint(long tm, int x, int y, int w, int h)
+ {
+ Component parent = getParent();
+ if (parent != null)
+ {
+ parent.repaint(tm, x + getX(), y + getY(), w, h);
+ }
+ }
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ if (getComponentCount() > 0)
+ remove(getComponents()[0]);
+
+ super.addImpl(comp, constraints, index);
+ }
+
+ protected void fireStateChanged()
+ {
+ ChangeListener[] listeners = getChangeListeners();
+ for (int i = 0; i < listeners.length; ++i)
+ listeners[i].stateChanged(changeEvent);
+ }
+
+ /**
* Creates a {@link ViewListener} that is supposed to listen for
* size changes on the view component.
*
@@ -489,43 +666,217 @@ public class JViewport extends JComponent
}
/**
- * Scrolls the view so that contentRect becomes visible.
+ * Computes the parameters for the blitting scroll method. <code>dx</code>
+ * and <code>dy</code> specifiy the X and Y offset by which the viewport
+ * is scrolled. All other arguments are output parameters and are filled by
+ * this method.
*
- * @param contentRect the rectangle to make visible within the view
+ * <code>blitFrom</code> holds the position of the blit rectangle in the
+ * viewport rectangle before scrolling, <code>blitTo</code> where the blitArea
+ * is copied to.
+ *
+ * <code>blitSize</code> holds the size of the blit area and
+ * <code>blitPaint</code> is the area of the view that needs to be painted.
+ *
+ * This method returns <code>true</code> if blitting is possible and
+ * <code>false</code> if the viewport has to be repainted completetly without
+ * blitting.
+ *
+ * @param dx the horizontal delta
+ * @param dy the vertical delta
+ * @param blitFrom the position from where to blit; set by this method
+ * @param blitTo the position where to blit area is copied to; set by this
+ * method
+ * @param blitSize the size of the blitted area; set by this method
+ * @param blitPaint the area that needs repainting; set by this method
+ *
+ * @return <code>true</code> if blitting is possible,
+ * <code>false</code> otherwise
*/
- public void scrollRectToVisible(Rectangle contentRect)
+ protected boolean computeBlit(int dx, int dy, Point blitFrom, Point blitTo,
+ Dimension blitSize, Rectangle blitPaint)
+ {
+ if ((dx != 0 && dy != 0) || damaged)
+ // We cannot blit if the viewport is scrolled in both directions at
+ // once.
+ return false;
+
+ Rectangle portBounds = SwingUtilities.calculateInnerArea(this, getBounds());
+
+ // Compute the blitFrom and blitTo parameters.
+ blitFrom.x = portBounds.x;
+ blitFrom.y = portBounds.y;
+ blitTo.x = portBounds.x;
+ blitTo.y = portBounds.y;
+
+ if (dy > 0)
+ {
+ blitFrom.y = portBounds.y + dy;
+ }
+ else if (dy < 0)
+ {
+ blitTo.y = portBounds.y - dy;
+ }
+ else if (dx > 0)
+ {
+ blitFrom.x = portBounds.x + dx;
+ }
+ else if (dx < 0)
+ {
+ blitTo.x = portBounds.x - dx;
+ }
+
+ // Compute size of the blit area.
+ if (dx != 0)
+ {
+ blitSize.width = portBounds.width - Math.abs(dx);
+ blitSize.height = portBounds.height;
+ }
+ else if (dy != 0)
+ {
+ blitSize.width = portBounds.width;
+ blitSize.height = portBounds.height - Math.abs(dy);
+ }
+
+ // Compute the blitPaint parameter.
+ blitPaint.setBounds(portBounds);
+ if (dy > 0)
+ {
+ blitPaint.y = portBounds.y + portBounds.height - dy;
+ blitPaint.height = dy;
+ }
+ else if (dy < 0)
+ {
+ blitPaint.height = -dy;
+ }
+ if (dx > 0)
+ {
+ blitPaint.x = portBounds.x + portBounds.width - dx;
+ blitPaint.width = dx;
+ }
+ else if (dx < 0)
+ {
+ blitPaint.width = -dx;
+ }
+
+ return true;
+ }
+
+ /**
+ * Paints the viewport in case we have a scrollmode of
+ * {@link #SIMPLE_SCROLL_MODE}.
+ *
+ * This simply paints the view directly on the surface of the viewport.
+ *
+ * @param g the graphics context to use
+ */
+ void paintSimple(Graphics g)
{
Point pos = getViewPosition();
- Rectangle viewBounds = getView().getBounds();
- Rectangle portBounds = getBounds();
-
- // FIXME: should validate the view if it is not valid, however
- // this may cause excessive validation when the containment
- // hierarchy is being created.
-
- // if contentRect is larger than the portBounds, center the view
- if (contentRect.height > portBounds.height ||
- contentRect.width > portBounds.width)
+ Component view = getView();
+ boolean translated = false;
+ try
+ {
+ g.translate(-pos.x, -pos.y);
+ translated = true;
+ view.paint(g);
+ }
+ finally
{
- setViewPosition(new Point(contentRect.x, contentRect.y));
- return;
+ if (translated)
+ g.translate (pos.x, pos.y);
}
-
- // Y-DIRECTION
- if (contentRect.y < -viewBounds.y)
- setViewPosition(new Point(pos.x, contentRect.y));
- else if (contentRect.y + contentRect.height >
- -viewBounds.y + portBounds.height)
- setViewPosition (new Point(pos.x, contentRect.y -
- (portBounds.height - contentRect.height)));
-
- // X-DIRECTION
- pos = getViewPosition();
- if (contentRect.x < -viewBounds.x)
- setViewPosition(new Point(contentRect.x, pos.y));
- else if (contentRect.x + contentRect.width >
- -viewBounds.x + portBounds.width)
- setViewPosition (new Point(contentRect.x -
- (portBounds.width - contentRect.width), pos.y));
+ }
+
+ /**
+ * Paints the viewport in case we have a scroll mode of
+ * {@link #BACKINGSTORE_SCROLL_MODE}.
+ *
+ * This method uses a backing store image to paint the view to, which is then
+ * subsequently painted on the screen. This should make scrolling more
+ * smooth.
+ *
+ * @param g the graphics context to use
+ */
+ void paintBackingStore(Graphics g)
+ {
+ // If we have no backing store image yet or the size of the component has
+ // changed, we need to rebuild the backing store.
+ if (backingStoreImage == null || sizeChanged)
+ {
+ backingStoreImage = createImage(getWidth(), getHeight());
+ sizeChanged = false;
+ Graphics g2 = backingStoreImage.getGraphics();
+ paintSimple(g2);
+ g2.dispose();
+ }
+ // Otherwise we can perform the blitting on the backing store image:
+ // First we move the part that remains visible after scrolling, then
+ // we only need to paint the bit that becomes newly visible.
+ else
+ {
+ Graphics g2 = backingStoreImage.getGraphics();
+ Point viewPosition = getViewPosition();
+ int dx = viewPosition.x - lastPaintPosition.x;
+ int dy = viewPosition.y - lastPaintPosition.y;
+ boolean canBlit = computeBlit(dx, dy, cachedBlitFrom, cachedBlitTo,
+ cachedBlitSize, cachedBlitPaint);
+ if (canBlit)
+ {
+ // Copy the part that remains visible during scrolling.
+ g2.copyArea(cachedBlitFrom.x, cachedBlitFrom.y,
+ cachedBlitSize.width, cachedBlitSize.height,
+ cachedBlitTo.x - cachedBlitFrom.x,
+ cachedBlitTo.y - cachedBlitFrom.y);
+ // Now paint the part that becomes newly visible.
+ g2.setClip(cachedBlitPaint.x, cachedBlitPaint.y,
+ cachedBlitPaint.width, cachedBlitPaint.height);
+ paintSimple(g2);
+ }
+ // If blitting is not possible for some reason, fall back to repainting
+ // everything.
+ else
+ {
+ paintSimple(g2);
+ }
+ g2.dispose();
+ }
+ // Actually draw the backingstore image to the graphics context.
+ g.drawImage(backingStoreImage, 0, 0, this);
+ // Update the lastPaintPosition so that we know what is already drawn when
+ // we paint the next time.
+ lastPaintPosition.setLocation(getViewPosition());
+ }
+
+ /**
+ * Paints the viewport in case we have a scrollmode of
+ * {@link #BLIT_SCROLL_MODE}.
+ *
+ * This paints the viewport using a backingstore and a blitting algorithm.
+ * Only the newly exposed area of the view is painted from the view painting
+ * methods, the remainder is copied from the backing store.
+ *
+ * @param g the graphics context to use
+ */
+ void paintBlit(Graphics g)
+ {
+ // We cannot perform blitted painting as it is described in Sun's API docs.
+ // There it is suggested that this painting method should blit directly
+ // on the parent window's surface. This is not possible because when using
+ // Swing's double buffering (at least our implementation), it would
+ // immediatly be painted when the buffer is painted on the screen. For this
+ // to work we would need a kind of hole in the buffer image. And honestly
+ // I find this method not very elegant.
+ // The alternative, blitting directly on the buffer image, is also not
+ // possible because the buffer image gets cleared everytime when an opaque
+ // parent component is drawn on it.
+
+ // What we do instead is falling back to the backing store approach which
+ // is in fact a mixed blitting/backing store approach where the blitting
+ // is performed on the backing store image and this is then drawn to the
+ // graphics context. This is very robust and works independent of the
+ // painting mechanism that is used by Swing. And it should have comparable
+ // performance characteristics as the blitting method.
+ paintBackingStore(g);
}
}
diff --git a/libjava/classpath/javax/swing/JWindow.java b/libjava/classpath/javax/swing/JWindow.java
index 449900370c6..cc0ac7fd95a 100644
--- a/libjava/classpath/javax/swing/JWindow.java
+++ b/libjava/classpath/javax/swing/JWindow.java
@@ -60,6 +60,21 @@ import javax.accessibility.AccessibleContext;
*/
public class JWindow extends Window implements Accessible, RootPaneContainer
{
+ /**
+ * Provides accessibility support for <code>JWindow</code>.
+ */
+ protected class AccessibleJWindow extends Window.AccessibleAWTWindow
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJWindow</code>.
+ */
+ public AccessibleJWindow()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
private static final long serialVersionUID = 5420698392125238833L;
protected JRootPane rootPane;
@@ -71,13 +86,6 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
protected AccessibleContext accessibleContext;
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container.
- */
- private boolean initStageDone = false;
-
public JWindow()
{
super(SwingUtilities.getOwnerFrame());
@@ -113,7 +121,7 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
super.setLayout(new BorderLayout(1, 1));
getRootPane(); // will do set/create
// Now we're done init stage, adds and layouts go to content pane.
- initStageDone = true;
+ setRootPaneCheckingEnabled(true);
}
public Dimension getPreferredSize()
@@ -125,13 +133,8 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + " instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -192,15 +195,10 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
{
// If we're adding in the initialization stage use super.add.
// otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not use add() on JWindow directly. Use "
- + "getContentPane().add() instead");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp, constraints, index);
}
public void remove(Component comp)
@@ -235,7 +233,9 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJWindow();
+ return accessibleContext;
}
protected String paramString()
diff --git a/libjava/classpath/javax/swing/KeyStroke.java b/libjava/classpath/javax/swing/KeyStroke.java
index 12a280c217a..b57a7119207 100644
--- a/libjava/classpath/javax/swing/KeyStroke.java
+++ b/libjava/classpath/javax/swing/KeyStroke.java
@@ -51,6 +51,7 @@ public class KeyStroke
// Called by java.awt.AWTKeyStroke.registerSubclass via reflection.
private KeyStroke()
{
+ // Nothing to do here.
}
private KeyStroke(char keyChar, int keyCode, int modifiers,
diff --git a/libjava/classpath/javax/swing/KeyboardManager.java b/libjava/classpath/javax/swing/KeyboardManager.java
new file mode 100644
index 00000000000..d3868309d08
--- /dev/null
+++ b/libjava/classpath/javax/swing/KeyboardManager.java
@@ -0,0 +1,280 @@
+/* KeyboardManager.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.applet.Applet;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Window;
+import java.awt.event.KeyEvent;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This class maintains a mapping from top-level containers to a
+ * Hashtable. The Hashtable maps KeyStrokes to Components to be used when
+ * Components register keyboard actions with the condition
+ * JComponent.WHEN_IN_FOCUSED_WINDOW.
+ *
+ * @author Anthony Balkissoon <abalkiss@redhat.com>
+ *
+ */
+class KeyboardManager
+{
+ /** Shared instance of KeyboardManager **/
+ static KeyboardManager manager = new KeyboardManager();
+
+ /**
+ * A mapping between top level containers and Hashtables that
+ * map KeyStrokes to Components.
+ */
+ Hashtable topLevelLookup = new Hashtable();
+
+ /**
+ * A mapping between top level containers and Vectors of JMenuBars
+ * used to allow all the JMenuBars within a top level container
+ * a chance to consume key events.
+ */
+ Hashtable menuBarLookup = new Hashtable();
+ /**
+ * Returns the shared instance of KeyboardManager.
+ * @return the shared instance of KeybaordManager.
+ */
+ public static KeyboardManager getManager()
+ {
+ return manager;
+ }
+ /**
+ * Returns the top-level ancestor for the given JComponent.
+ * @param c the JComponent whose top-level ancestor we want
+ * @return the top-level ancestor for the given JComponent.
+ */
+ static Container findTopLevel (Component c)
+ {
+ Container topLevel = (c instanceof Container) ? (Container) c
+ : c.getParent();
+ while (topLevel != null &&
+ !(topLevel instanceof Window) &&
+ !(topLevel instanceof Applet) &&
+ !(topLevel instanceof JInternalFrame))
+ topLevel = topLevel.getParent();
+ return topLevel;
+ }
+
+ /**
+ * Returns the Hashtable that maps KeyStrokes to Components, for
+ * the specified top-level container c. If no Hashtable exists
+ * we create and register it here and return the newly created
+ * Hashtable.
+ *
+ * @param c the top-level container whose Hashtable we want
+ * @return the Hashtable mapping KeyStrokes to Components for the
+ * specified top-level container
+ */
+ Hashtable getHashtableForTopLevel (Container c)
+ {
+ Hashtable keyToComponent = (Hashtable)topLevelLookup.get(c);
+ if (keyToComponent == null)
+ {
+ keyToComponent = new Hashtable();
+ topLevelLookup.put(c, keyToComponent);
+ }
+ return keyToComponent;
+ }
+
+ /**
+ * Registers a KeyStroke with a Component. This does not register
+ * the KeyStroke to a specific Action. When searching for a
+ * WHEN_IN_FOCUSED_WINDOW binding we will first go up to the focused
+ * top-level Container, then get the Hashtable that maps KeyStrokes
+ * to components for that particular top-level Container, then
+ * call processKeyBindings on that component with the condition
+ * JComponent.WHEN_IN_FOCUSED_WINDOW.
+ * @param comp the JComponent associated with the KeyStroke
+ * @param key the KeyStroke
+ */
+ public void registerBinding(JComponent comp, KeyStroke key)
+ {
+ // This method associates a KeyStroke with a particular JComponent
+ // When the KeyStroke occurs, if this component's top-level ancestor
+ // has focus (one of its children is the focused Component) then
+ // comp.processKeyBindings will be called with condition
+ // JComponent.WHEN_IN_FOCUSED_WINDOW.
+
+ // Look for the JComponent's top-level parent and return if it is null
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return;
+
+ // Now get the Hashtable for this top-level container
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+
+ // And add the new binding to this Hashtable
+ // FIXME: should allow more than one JComponent to be associated
+ // with a KeyStroke, in case one of them is disabled
+ keyToComponent.put(key, comp);
+ }
+
+ public void clearBindingsForComp(JComponent comp)
+ {
+ // This method clears all the WHEN_IN_FOCUSED_WINDOW bindings associated
+ // with <code>comp</code>. This is used for a terribly ineffcient
+ // strategy in which JComponent.updateComponentInputMap simply clears
+ // all bindings associated with its component and then reloads all the
+ // bindings from the updated ComponentInputMap. This is only a preliminary
+ // strategy and should be improved upon once the WHEN_IN_FOCUSED_WINDOW
+ // bindings work.
+
+ // Find the top-level ancestor
+
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return;
+ // And now get its Hashtable
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+
+ Enumeration keys = keyToComponent.keys();
+ Object temp;
+
+ // Iterate through the keys and remove any key whose value is comp
+ while (keys.hasMoreElements())
+ {
+ temp = keys.nextElement();
+ if (comp == (JComponent)keyToComponent.get(temp))
+ keyToComponent.remove(temp);
+ }
+ }
+
+ /**
+ * This method registers all the bindings in the given ComponentInputMap.
+ * Rather than call registerBinding on all the keys, we do the work here
+ * so that we don't duplicate finding the top-level container and
+ * getting its Hashtable.
+ *
+ * @param map the ComponentInputMap whose bindings we want to register
+ */
+ public void registerEntireMap (ComponentInputMap map)
+ {
+ if (map == null)
+ return;
+ JComponent comp = map.getComponent();
+ KeyStroke[] keys = map.keys();
+ if (keys == null)
+ return;
+ // Find the top-level container associated with this ComponentInputMap
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return;
+
+ // Register the KeyStrokes in the top-level container's Hashtable
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+ for (int i = 0; i < keys.length; i++)
+ keyToComponent.put(keys[i], comp);
+ }
+
+ public boolean processKeyStroke (Component comp, KeyStroke key, KeyEvent e)
+ {
+ boolean pressed = e.getID() == KeyEvent.KEY_PRESSED;
+
+ // Look for the top-level ancestor
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return false;
+ // Now get the Hashtable for that top-level container
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+ Enumeration keys = keyToComponent.keys();
+ JComponent target = (JComponent)keyToComponent.get(key);
+ if (target != null && target.processKeyBinding
+ (key, e, JComponent.WHEN_IN_FOCUSED_WINDOW, pressed))
+ return true;
+
+ // Have to give all the JMenuBars a chance to consume the event
+ Vector menuBars = getVectorForTopLevel(topLevel);
+ for (int i = 0; i < menuBars.size(); i++)
+ if (((JMenuBar)menuBars.elementAt(i)).processKeyBinding(key, e, JComponent.WHEN_IN_FOCUSED_WINDOW, pressed))
+ return true;
+ return false;
+ }
+
+ /**
+ * Returns the Vector of JMenuBars associated with the top-level
+ * @param c the top-level container whose JMenuBar Vector we want
+ * @return the Vector of JMenuBars for this top level container
+ */
+ Vector getVectorForTopLevel(Container c)
+ {
+ Vector result = (Vector) menuBarLookup.get(c);
+ if (result == null)
+ {
+ result = new Vector();
+ menuBarLookup.put (c, result);
+ }
+ return result;
+ }
+
+ /**
+ * In processKeyStroke, KeyManager must give all JMenuBars in the
+ * focused top-level container a chance to process the event. So,
+ * JMenuBars must be registered in KeyManager and associated with a
+ * top-level container. That's what this method is for.
+ * @param menuBar the JMenuBar to register
+ */
+ public void registerJMenuBar (JMenuBar menuBar)
+ {
+ Container topLevel = findTopLevel(menuBar);
+ Vector menuBars = getVectorForTopLevel(topLevel);
+ if (!menuBars.contains(menuBar))
+ menuBars.add(menuBar);
+ }
+
+ /**
+ * Unregisters a JMenuBar from its top-level container. This is
+ * called before the JMenuBar is actually removed from the container
+ * so findTopLevel will still find us the correct top-level container.
+ * @param menuBar the JMenuBar to unregister.
+ */
+ public void unregisterJMenuBar (JMenuBar menuBar)
+ {
+ Container topLevel = findTopLevel(menuBar);
+ Vector menuBars = getVectorForTopLevel(topLevel);
+ if (menuBars.contains(menuBar))
+ menuBars.remove(menuBar);
+ }
+}
diff --git a/libjava/classpath/javax/swing/ListCellRenderer.java b/libjava/classpath/javax/swing/ListCellRenderer.java
index 6ce115ea70c..e234d184dfd 100644
--- a/libjava/classpath/javax/swing/ListCellRenderer.java
+++ b/libjava/classpath/javax/swing/ListCellRenderer.java
@@ -44,9 +44,7 @@ import java.awt.Component;
*/
public interface ListCellRenderer
{
- Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus);
+ Component getListCellRendererComponent(JList list, Object value, int index,
+ boolean isSelected,
+ boolean cellHasFocus);
}
diff --git a/libjava/classpath/javax/swing/ListSelectionModel.java b/libjava/classpath/javax/swing/ListSelectionModel.java
index f4680d737fb..324c056431b 100644
--- a/libjava/classpath/javax/swing/ListSelectionModel.java
+++ b/libjava/classpath/javax/swing/ListSelectionModel.java
@@ -46,41 +46,51 @@ import javax.swing.event.ListSelectionListener;
*/
public interface ListSelectionModel
{
+
int SINGLE_SELECTION = 0;
+
int SINGLE_INTERVAL_SELECTION = 1;
+
int MULTIPLE_INTERVAL_SELECTION = 2;
void setSelectionMode(int a);
+
int getSelectionMode();
-
+
void clearSelection();
-
+
int getMinSelectionIndex();
+
int getMaxSelectionIndex();
boolean isSelectedIndex(int a);
boolean isSelectionEmpty();
+
void setSelectionInterval(int index0, int index1);
- void addSelectionInterval(int index0,
- int index1);
- void removeSelectionInterval(int index0,
- int index1);
- void insertIndexInterval(int index,
- int length,
- boolean before);
- void removeIndexInterval(int index0,
- int index1);
+
+ void addSelectionInterval(int index0, int index1);
+
+ void removeSelectionInterval(int index0, int index1);
+
+ void insertIndexInterval(int index, int length, boolean before);
+
+ void removeIndexInterval(int index0, int index1);
int getAnchorSelectionIndex();
+
void setAnchorSelectionIndex(int index);
+
int getLeadSelectionIndex();
+
void setLeadSelectionIndex(int index);
void setValueIsAdjusting(boolean valueIsAdjusting);
+
boolean getValueIsAdjusting();
void addListSelectionListener(ListSelectionListener listener);
- void removeListSelectionListener(ListSelectionListener listener);
+
+ void removeListSelectionListener(ListSelectionListener listener);
}
diff --git a/libjava/classpath/javax/swing/LookAndFeel.java b/libjava/classpath/javax/swing/LookAndFeel.java
index 8858742711d..1a67e849735 100644
--- a/libjava/classpath/javax/swing/LookAndFeel.java
+++ b/libjava/classpath/javax/swing/LookAndFeel.java
@@ -38,9 +38,17 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Color;
import java.awt.Component;
+import java.awt.Font;
import java.awt.Toolkit;
+import java.net.URL;
+import javax.swing.border.Border;
+import javax.swing.plaf.ComponentInputMapUIResource;
+import javax.swing.plaf.IconUIResource;
+import javax.swing.plaf.InputMapUIResource;
+import javax.swing.plaf.UIResource;
import javax.swing.text.JTextComponent;
public abstract class LookAndFeel
@@ -104,6 +112,8 @@ public abstract class LookAndFeel
*/
public void initialize()
{
+ // We do nothing here. This method is meant to be overridden by
+ // LookAndFeel implementations.
}
/**
@@ -113,14 +123,27 @@ public abstract class LookAndFeel
*/
public static void installBorder(JComponent c, String defaultBorderName)
{
+ Border b = c.getBorder();
+ if (b == null || b instanceof UIResource)
+ c.setBorder(UIManager.getBorder(defaultBorderName));
}
/**
* Convenience method for initializing a component's foreground and
* background color properties with values from the current defaults table.
*/
- public static void installColors(JComponent c, String defaultBgName, String defaultFgName)
+ public static void installColors(JComponent c, String defaultBgName,
+ String defaultFgName)
{
+ // Install background.
+ Color bg = c.getBackground();
+ if (bg == null || bg instanceof UIResource)
+ c.setBackground(UIManager.getColor(defaultBgName));
+
+ // Install foreground.
+ Color fg = c.getForeground();
+ if (fg == null || fg instanceof UIResource)
+ c.setForeground(UIManager.getColor(defaultFgName));
}
/**
@@ -128,10 +151,16 @@ public abstract class LookAndFeel
* and font properties with values from the current defaults table.
*/
public static void installColorsAndFont(JComponent component,
- String defaultBgName,
- String defaultFgName,
- String defaultFontName)
+ String defaultBgName,
+ String defaultFgName,
+ String defaultFontName)
{
+ // Install colors.
+ installColors(component, defaultBgName, defaultFgName);
+ // Install font.
+ Font f = component.getFont();
+ if (f == null || f instanceof UIResource)
+ component.setFont(UIManager.getFont(defaultFontName));
}
/**
@@ -156,19 +185,47 @@ public abstract class LookAndFeel
public abstract boolean isSupportedLookAndFeel();
/**
- * Loads the bindings in keys into retMap.
+ * Loads the bindings in keys into retMap. Does not remove existing entries
+ * from retMap. <code>keys</code> describes the InputMap, every even indexed
+ * item is either a KeyStroke or a String representing a KeyStroke and every
+ * odd indexed item is the Object associated with that KeyStroke in an
+ * ActionMap.
+ *
+ * @param retMap the InputMap into which we load bindings
+ * @param keys the Object array describing the InputMap as above
*/
public static void loadKeyBindings(InputMap retMap, Object[] keys)
{
+ if (keys == null)
+ return;
+ for (int i = 0; i < keys.length - 1; i+= 2)
+ {
+ Object key = keys[i];
+ KeyStroke keyStroke;
+ if (key instanceof KeyStroke)
+ keyStroke = (KeyStroke)key;
+ else
+ keyStroke = KeyStroke.getKeyStroke((String)key);
+ retMap.put(keyStroke, keys[i+1]);
+ }
}
/**
- * Creates a ComponentInputMap from keys.
+ * Creates a ComponentInputMap from keys.
+ * <code>keys</code> describes the InputMap, every even indexed
+ * item is either a KeyStroke or a String representing a KeyStroke and every
+ * odd indexed item is the Object associated with that KeyStroke in an
+ * ActionMap.
+ *
+ * @param c the JComponent associated with the ComponentInputMap
+ * @param keys the Object array describing the InputMap as above
*/
public static ComponentInputMap makeComponentInputMap(JComponent c,
Object[] keys)
{
- return null;
+ ComponentInputMap retMap = new ComponentInputMapUIResource(c);
+ loadKeyBindings(retMap, keys);
+ return retMap;
}
/**
@@ -177,23 +234,55 @@ public abstract class LookAndFeel
*/
public static Object makeIcon(Class baseClass, String gifFile)
{
- return null;
+ final URL file = baseClass.getResource(gifFile);
+ return new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults table)
+ {
+ return new IconUIResource(new ImageIcon(file));
+ }
+ };
}
/**
* Creates a InputMap from keys.
+ * <code>keys</code> describes the InputMap, every even indexed
+ * item is either a KeyStroke or a String representing a KeyStroke and every
+ * odd indexed item is the Object associated with that KeyStroke in an
+ * ActionMap.
+ *
+ * @param keys the Object array describing the InputMap as above
*/
public static InputMap makeInputMap(Object[] keys)
{
- return null;
+ InputMap retMap = new InputMapUIResource();
+ loadKeyBindings(retMap, keys);
+ return retMap;
}
/**
- * Convenience method for building lists of KeyBindings.
+ * Convenience method for building lists of KeyBindings.
+ * <code>keyBindingList</code> is an array of KeyStroke-Action pairs where
+ * even indexed elements are KeyStrokes or Strings representing KeyStrokes
+ * and odd indexed elements are the associated Actions.
+ *
+ * @param keyBindingList the array of KeyStroke-Action pairs
+ * @return a JTextComponent.KeyBinding array
*/
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
{
- return null;
+ JTextComponent.KeyBinding[] retBindings =
+ new JTextComponent.KeyBinding[keyBindingList.length / 2];
+ for (int i = 0; i < keyBindingList.length - 1; i+= 2)
+ {
+ KeyStroke stroke;
+ if (keyBindingList[i] instanceof KeyStroke)
+ stroke = (KeyStroke)keyBindingList[i];
+ else
+ stroke = KeyStroke.getKeyStroke((String)keyBindingList[i]);
+ retBindings[i/2] = new JTextComponent.KeyBinding(stroke, (String)keyBindingList[i+1]);
+ }
+ return retBindings;
}
/**
@@ -224,6 +313,8 @@ public abstract class LookAndFeel
*/
public void uninitialize()
{
+ // We do nothing here. This method is meant to be overridden by
+ // LookAndFeel implementations.
}
/**
@@ -232,5 +323,7 @@ public abstract class LookAndFeel
*/
public static void uninstallBorder(JComponent c)
{
+ if (c.getBorder() instanceof UIResource)
+ c.setBorder(null);
}
}
diff --git a/libjava/classpath/javax/swing/MenuElement.java b/libjava/classpath/javax/swing/MenuElement.java
index 46eb8c2a5fe..dab7b9cf1ad 100644
--- a/libjava/classpath/javax/swing/MenuElement.java
+++ b/libjava/classpath/javax/swing/MenuElement.java
@@ -47,47 +47,43 @@ import java.awt.event.MouseEvent;
*
* @author Andrew Selkirk
*/
-public interface MenuElement {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * processMouseEvent
- * @param event TODO
- * @param path TODO
- * @param manager TODO
- */
- void processMouseEvent(MouseEvent event,
- MenuElement[] path, MenuSelectionManager manager);
-
- /**
- * processKeyEvent
- * @param event TODO
- * @param path TODO
- * @param manager TODO
- */
- void processKeyEvent(KeyEvent event,
- MenuElement[] path, MenuSelectionManager manager);
-
- /**
- * menuSelectionChanged
- * @param included TODO
- */
- void menuSelectionChanged(boolean included);
-
- /**
- * getSubElements
- * @returns MenuElement[]
- */
- MenuElement[] getSubElements();
-
- /**
- * getComponent
- * @returns Component
- */
- Component getComponent();
-
-
-} // MenuElement
+public interface MenuElement
+{
+
+ /**
+ * processMouseEvent
+ * @param event TODO
+ * @param path TODO
+ * @param manager TODO
+ */
+ void processMouseEvent(MouseEvent event, MenuElement[] path,
+ MenuSelectionManager manager);
+
+ /**
+ * processKeyEvent
+ * @param event TODO
+ * @param path TODO
+ * @param manager TODO
+ */
+ void processKeyEvent(KeyEvent event, MenuElement[] path,
+ MenuSelectionManager manager);
+
+ /**
+ * menuSelectionChanged
+ * @param included TODO
+ */
+ void menuSelectionChanged(boolean included);
+
+ /**
+ * getSubElements
+ * @returns MenuElement[]
+ */
+ MenuElement[] getSubElements();
+
+ /**
+ * getComponent
+ * @returns Component
+ */
+ Component getComponent();
+
+}
diff --git a/libjava/classpath/javax/swing/MenuSelectionManager.java b/libjava/classpath/javax/swing/MenuSelectionManager.java
index 32d56b958a1..4e52751065a 100644
--- a/libjava/classpath/javax/swing/MenuSelectionManager.java
+++ b/libjava/classpath/javax/swing/MenuSelectionManager.java
@@ -146,7 +146,9 @@ public class MenuSelectionManager
{
// Convert sourcePoint to screen coordinates.
Point sourcePointOnScreen = sourcePoint;
- SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
+
+ if (source.isShowing())
+ SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
Point compPointOnScreen;
Component resultComp = null;
@@ -168,7 +170,10 @@ public class MenuSelectionManager
&& sourcePointOnScreen.y < compPointOnScreen.y + size.height)
{
Point p = sourcePointOnScreen;
- SwingUtilities.convertPointFromScreen(p, comp);
+
+ if (comp.isShowing())
+ SwingUtilities.convertPointFromScreen(p, comp);
+
resultComp = SwingUtilities.getDeepestComponentAt(comp, p.x, p.y);
break;
}
diff --git a/libjava/classpath/javax/swing/MutableComboBoxModel.java b/libjava/classpath/javax/swing/MutableComboBoxModel.java
index ee79dac03a5..93091786e53 100644
--- a/libjava/classpath/javax/swing/MutableComboBoxModel.java
+++ b/libjava/classpath/javax/swing/MutableComboBoxModel.java
@@ -76,7 +76,7 @@ public interface MutableComboBoxModel extends ComboBoxModel
/**
* This method removes given element from the data model
*
- * @param element to remove.
+ * @param object element to remove.
*/
void removeElement(Object object);
-} // MutableComboBoxModel
+}
diff --git a/libjava/classpath/javax/swing/OverlayLayout.java b/libjava/classpath/javax/swing/OverlayLayout.java
index e8aef98a521..56b8c8bb67a 100644
--- a/libjava/classpath/javax/swing/OverlayLayout.java
+++ b/libjava/classpath/javax/swing/OverlayLayout.java
@@ -1,5 +1,5 @@
-/* OverlayLayout.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* OverlayLayout.java -- A layout manager
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,155 +37,376 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTError;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.Insets;
import java.awt.LayoutManager2;
import java.io.Serializable;
/**
- * OverlayLayout
- * @author Andrew Selkirk
- * @version 1.0
+ * A layout manager that lays out the components of a container one over
+ * another.
+ *
+ * The components take as much space as is available in the container, but not
+ * more than specified by their maximum size.
+ *
+ * The overall layout is mainly affected by the components
+ * <code>alignmentX</code> and <code>alignmentY</code> properties. All
+ * components are aligned, so that their alignment points (for either
+ * direction) are placed in one line (the baseline for this direction).
+ *
+ * For example: An X alignment of 0.0 means that the component's alignment
+ * point is at it's left edge, an X alignment of 0.5 means that the alignment
+ * point is in the middle, an X alignment of 1.0 means, the aligment point is
+ * at the right edge. So if you have three components, the first with 0.0, the
+ * second with 0.5 and the third with 1.0, then they are laid out like this:
+ *
+ * <pre>
+ * +-------+
+ * | 1 |
+ * +-------+
+ * +-------+
+ * | 2 |
+ * +-------+
+ * +---------+
+ * | 3 +
+ * +---------+
+ * </pre>
+ * The above picture shows the X alignment between the components. An Y
+ * alignment like shown above cannot be achieved with this layout manager. The
+ * components are place on top of each other, with the X alignment shown above.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ * @author Andrew Selkirk
*/
-public class OverlayLayout
- implements LayoutManager2, Serializable
+public class OverlayLayout implements LayoutManager2, Serializable
{
private static final long serialVersionUID = 18082829169631543L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * target
- */
- private Container target;
-
- /**
- * xChildren
- */
- private SizeRequirements[] xChildren;
-
- /**
- * yChildren
- */
- private SizeRequirements[] yChildren;
-
- /**
- * xTotal
- */
- private SizeRequirements xTotal;
-
- /**
- * yTotal
- */
- private SizeRequirements yTotal;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor OverlayLayout
- * @param target TODO
- */
- public OverlayLayout(Container target) {
- // TODO
- } // OverlayLayout()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * invalidateLayout
- * @param target TODO
- */
- public void invalidateLayout(Container target) {
- // TODO
- } // invalidateLayout()
-
- /**
- * addLayoutComponent
- * @param string TODO
- * @param component TODO
- */
- public void addLayoutComponent(String string, Component component) {
- // TODO
- } // addLayoutComponent()
-
- /**
- * addLayoutComponent
- * @param component TODO
- * @param constraints TODO
- */
- public void addLayoutComponent(Component component, Object constraints) {
- // TODO
- } // addLayoutComponent()
-
- /**
- * removeLayoutComponent
- * @param component TODO
- */
- public void removeLayoutComponent(Component component) {
- // TODO
- } // removeLayoutComponent()
-
- /**
- * preferredLayoutSize
- * @param target TODO
- * @returns Dimension
- */
- public Dimension preferredLayoutSize(Container target) {
- return null; // TODO
- } // preferredLayoutSize()
-
- /**
- * minimumLayoutSize
- * @param target TODO
- * @returns Dimension
- */
- public Dimension minimumLayoutSize(Container target) {
- return null; // TODO
- } // minimumLayoutSize()
-
- /**
- * maximumLayoutSize
- * @param target TODO
- * @returns Dimension
- */
- public Dimension maximumLayoutSize(Container target) {
- return null; // TODO
- } // maximumLayoutSize()
-
- /**
- * getLayoutAlignmentX
- * @param target TODO
- * @returns float
- */
- public float getLayoutAlignmentX(Container target) {
- return (float) 0.0; // TODO
- } // getLayoutAlignmentX()
-
- /**
- * getLayoutAlignmentY
- * @param target TODO
- * @returns float
- */
- public float getLayoutAlignmentY(Container target) {
- return (float) 0.0; // TODO
- } // getLayoutAlignmentY()
-
- /**
- * layoutContainer
- * @param target TODO
- */
- public void layoutContainer(Container target) {
- // TODO
- } // layoutContainer()
-
-
-} // OverlayLayout
+ /**
+ * The container to be laid out.
+ */
+ private Container target;
+
+ /**
+ * The size requirements of the containers children for the X direction.
+ */
+ private SizeRequirements[] xChildren;
+
+ /**
+ * The size requirements of the containers children for the Y direction.
+ */
+ private SizeRequirements[] yChildren;
+
+ /**
+ * The size requirements of the container to be laid out for the X direction.
+ */
+ private SizeRequirements xTotal;
+
+ /**
+ * The size requirements of the container to be laid out for the Y direction.
+ */
+ private SizeRequirements yTotal;
+
+ /**
+ * The offsets of the child components in the X direction.
+ */
+ private int[] offsetsX;
+
+ /**
+ * The offsets of the child components in the Y direction.
+ */
+ private int[] offsetsY;
+
+ /**
+ * The spans of the child components in the X direction.
+ */
+ private int[] spansX;
+
+ /**
+ * The spans of the child components in the Y direction.
+ */
+ private int[] spansY;
+
+ /**
+ * Creates a new OverlayLayout for the specified container.
+ *
+ * @param target the container to be laid out
+ */
+ public OverlayLayout(Container target)
+ {
+ this.target = target;
+ }
+
+ /**
+ * Notifies the layout manager that the layout has become invalid. It throws
+ * away cached layout information and recomputes it the next time it is
+ * requested.
+ *
+ * @param target not used here
+ */
+ public void invalidateLayout(Container target)
+ {
+ xChildren = null;
+ yChildren = null;
+ xTotal = null;
+ yTotal = null;
+ offsetsX = null;
+ offsetsY = null;
+ spansX = null;
+ spansY = null;
+ }
+
+ /**
+ * This method is not used in this layout manager.
+ *
+ * @param string not used here
+ * @param component not used here
+ */
+ public void addLayoutComponent(String string, Component component)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * This method is not used in this layout manager.
+ *
+ * @param component not used here
+ * @param constraints not used here
+ */
+ public void addLayoutComponent(Component component, Object constraints)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * This method is not used in this layout manager.
+ *
+ * @param component not used here
+ */
+ public void removeLayoutComponent(Component component)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the preferred size of the container that is laid out. This is
+ * computed by the children's preferred sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the preferred size of the container that is laid out
+ */
+ public Dimension preferredLayoutSize(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return new Dimension(xTotal.preferred, yTotal.preferred);
+ }
+
+ /**
+ * Returns the minimum size of the container that is laid out. This is
+ * computed by the children's minimum sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the minimum size of the container that is laid out
+ */
+ public Dimension minimumLayoutSize(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return new Dimension(xTotal.minimum, yTotal.minimum);
+ }
+
+ /**
+ * Returns the maximum size of the container that is laid out. This is
+ * computed by the children's maximum sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the maximum size of the container that is laid out
+ */
+ public Dimension maximumLayoutSize(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return new Dimension(xTotal.maximum, yTotal.maximum);
+ }
+
+ /**
+ * Returns the X alignment of the container that is laid out. This is
+ * computed by the children's preferred sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the X alignment of the container that is laid out
+ */
+ public float getLayoutAlignmentX(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return xTotal.alignment;
+ }
+
+ /**
+ * Returns the Y alignment of the container that is laid out. This is
+ * computed by the children's preferred sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the X alignment of the container that is laid out
+ */
+ public float getLayoutAlignmentY(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return yTotal.alignment;
+ }
+
+ /**
+ * Lays out the container and it's children.
+ *
+ * The children are laid out one over another.
+ *
+ * The components take as much space as is available in the container, but
+ * not more than specified by their maximum size.
+ *
+ * The overall layout is mainly affected by the components
+ * <code>alignmentX</code> and <code>alignmentY</code> properties. All
+ * components are aligned, so that their alignment points (for either
+ * direction) are placed in one line (the baseline for this direction).
+ *
+ * For example: An X alignment of 0.0 means that the component's alignment
+ * point is at it's left edge, an X alignment of 0.5 means that the alignment
+ * point is in the middle, an X alignment of 1.0 means, the aligment point is
+ * at the right edge. So if you have three components, the first with 0.0,
+ * the second with 0.5 and the third with 1.0, then they are laid out like
+ * this:
+ *
+ * <pre>
+ * +-------+
+ * | 1 |
+ * +-------+
+ * +-------+
+ * | 2 |
+ * +-------+
+ * +---------+
+ * | 3 +
+ * +---------+
+ * </pre>
+ * The above picture shows the X alignment between the components. An Y
+ * alignment like shown above cannot be achieved with this layout manager.
+ * The components are place on top of each other, with the X alignment shown
+ * above.
+ *
+ * @param target not used here
+ */
+ public void layoutContainer(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkLayout();
+ Component[] children = target.getComponents();
+ for (int i = 0; i < children.length; i++)
+ children[i].setBounds(offsetsX[i], offsetsY[i], spansX[i], spansY[i]);
+ }
+
+ /**
+ * Makes sure that the xChildren and yChildren fields are correctly set up.
+ * A call to {@link #invalidateLayout(Container)} sets these fields to null,
+ * so they have to be set up again.
+ */
+ private void checkRequirements()
+ {
+ if (xChildren == null || yChildren == null)
+ {
+ Component[] children = target.getComponents();
+ xChildren = new SizeRequirements[children.length];
+ yChildren = new SizeRequirements[children.length];
+ for (int i = 0; i < children.length; i++)
+ {
+ if (! children[i].isVisible())
+ {
+ xChildren[i] = new SizeRequirements();
+ yChildren[i] = new SizeRequirements();
+ }
+ else
+ {
+ xChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().width,
+ children[i].getPreferredSize().width,
+ children[i].getMaximumSize().width,
+ children[i].getAlignmentX());
+ yChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().height,
+ children[i].getPreferredSize().height,
+ children[i].getMaximumSize().height,
+ children[i].getAlignmentY());
+ }
+ }
+ }
+ }
+
+ /**
+ * Makes sure that the xTotal and yTotal fields are set up correctly. A call
+ * to {@link #invalidateLayout} sets these fields to null and they have to be
+ * recomputed.
+ */
+ private void checkTotalRequirements()
+ {
+ if (xTotal == null || yTotal == null)
+ {
+ checkRequirements();
+ xTotal = SizeRequirements.getAlignedSizeRequirements(xChildren);
+ yTotal = SizeRequirements.getAlignedSizeRequirements(yChildren);
+ }
+ }
+
+ /**
+ * Makes sure that the offsetsX, offsetsY, spansX and spansY fields are set
+ * up correctly. A call to {@link #invalidateLayout} sets these fields
+ * to null and they have to be recomputed.
+ */
+ private void checkLayout()
+ {
+ if (offsetsX == null || offsetsY == null || spansX == null
+ || spansY == null)
+ {
+ checkRequirements();
+ checkTotalRequirements();
+ int len = target.getComponents().length;
+ offsetsX = new int[len];
+ offsetsY = new int[len];
+ spansX = new int[len];
+ spansY = new int[len];
+
+ Insets in = target.getInsets();
+ int width = target.getWidth() - in.left - in.right;
+ int height = target.getHeight() - in.top - in.bottom;
+
+ SizeRequirements.calculateAlignedPositions(width, xTotal,
+ xChildren, offsetsX, spansX);
+ SizeRequirements.calculateAlignedPositions(height, yTotal,
+ yChildren, offsetsY, spansY);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/Popup.java b/libjava/classpath/javax/swing/Popup.java
index 69e1f516802..cbb243e285a 100644
--- a/libjava/classpath/javax/swing/Popup.java
+++ b/libjava/classpath/javax/swing/Popup.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.Point;
/**
@@ -89,6 +91,7 @@ public class Popup
*/
protected Popup()
{
+ // Nothing to do here.
}
@@ -129,6 +132,7 @@ public class Popup
*/
JWindow window;
+ private Component contents;
/**
* Constructs a new <code>JWindowPopup</code> given its owner,
@@ -155,10 +159,11 @@ public class Popup
/* Checks whether contents is null. */
super(owner, contents, x, y);
+ this.contents = contents;
window = new JWindow();
- window.getRootPane().add(contents);
+ window.getContentPane().add(contents);
window.setLocation(x, y);
- window.pack();
+ window.setFocusableWindowState(false);
}
@@ -168,6 +173,7 @@ public class Popup
*/
public void show()
{
+ window.setSize(contents.getSize());
window.show();
}
@@ -186,4 +192,106 @@ public class Popup
window.dispose();
}
}
+
+ /**
+ * A popup that displays itself within the JLayeredPane of a JRootPane of
+ * the containment hierarchy of the owner component.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ static class LightweightPopup extends Popup
+ {
+ /**
+ * The owner component for this popup.
+ */
+ Component owner;
+
+ /**
+ * The contents that should be shown.
+ */
+ Component contents;
+
+ /**
+ * The X location in screen coordinates.
+ */
+ int x;
+
+ /**
+ * The Y location in screen coordinates.
+ */
+ int y;
+
+ /**
+ * The panel that holds the content.
+ */
+ private JPanel panel;
+
+ /**
+ * The layered pane of the owner.
+ */
+ private JLayeredPane layeredPane;
+
+ /**
+ * Constructs a new <code>LightweightPopup</code> given its owner,
+ * contents and the screen position where the popup
+ * will appear.
+ *
+ * @param owner the component that should own the popup window; this
+ * provides the JRootPane in which we place the popup window
+ *
+ * @param contents the contents that will be displayed inside
+ * the <code>Popup</code>.
+ *
+ * @param x the horizontal position where the Popup will appear in screen
+ * coordinates
+ *
+ * @param y the vertical position where the Popup will appear in screen
+ * coordinates
+ *
+ * @throws IllegalArgumentException if <code>contents</code>
+ * is <code>null</code>.
+ */
+ public LightweightPopup(Component owner, Component contents, int x, int y)
+ {
+ super(owner, contents, x, y);
+ this.owner = owner;
+ this.contents = contents;
+ this.x = x;
+ this.y = y;
+
+ JRootPane rootPane = SwingUtilities.getRootPane(owner);
+ JLayeredPane layeredPane = rootPane.getLayeredPane();
+ this.layeredPane = layeredPane;
+ }
+
+ /**
+ * Places the popup within the JLayeredPane of the owner component and
+ * makes it visible.
+ */
+ public void show()
+ {
+ // We insert a JPanel between the layered pane and the contents so we
+ // can fiddle with the setLocation() method without disturbing a
+ // JPopupMenu (which overrides setLocation in an unusual manner).
+ if (panel == null)
+ {
+ panel = new JPanel();
+ panel.setLayout(new FlowLayout(0, 0, 0));
+ }
+
+ panel.add(contents);
+ panel.setSize(contents.getSize());
+ Point layeredPaneLoc = layeredPane.getLocationOnScreen();
+ panel.setLocation(x - layeredPaneLoc.x, y - layeredPaneLoc.y);
+ layeredPane.add(panel, JLayeredPane.POPUP_LAYER);
+ }
+
+ /**
+ * Removes the popup from the JLayeredPane thus making it invisible.
+ */
+ public void hide()
+ {
+ layeredPane.remove(panel);
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/PopupFactory.java b/libjava/classpath/javax/swing/PopupFactory.java
index 29cf86d5530..7bb2529cd54 100644
--- a/libjava/classpath/javax/swing/PopupFactory.java
+++ b/libjava/classpath/javax/swing/PopupFactory.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Point;
/**
@@ -55,8 +57,8 @@ public class PopupFactory
/**
* The shared factory object.
*
- * @see #getSharedFactory
- * @see #setSharedFactory
+ * @see #getSharedInstance
+ * @see #setSharedInstance
*/
private static PopupFactory sharedFactory;
@@ -69,6 +71,7 @@ public class PopupFactory
*/
public PopupFactory()
{
+ // Nothing to do here.
}
@@ -134,6 +137,30 @@ public class PopupFactory
public Popup getPopup(Component owner, Component contents,
int x, int y)
{
- return new Popup.JWindowPopup(owner, contents, x, y);
+ Popup popup = null;
+ // By default we enable lightweight popups since they are more efficient
+ // than heavyweight popups.
+ boolean lightweightEnabled = true;
+ // Special case JPopupMenu here, since it supports a lightweightEnabled
+ // flag that we must respect.
+ if (contents instanceof JPopupMenu)
+ {
+ JPopupMenu menu = (JPopupMenu) contents;
+ lightweightEnabled = menu.isLightWeightPopupEnabled();
+ }
+
+ // If we have a root pane and the contents fits within the root pane and
+ // lightweight popups are enabled, than we can use a lightweight popup.
+ JRootPane root = SwingUtilities.getRootPane(owner);
+ Point rootLoc = root.getLocationOnScreen();
+ Dimension contentsSize = contents.getSize();
+ Dimension rootSize = root.getSize();
+ if (x >= rootLoc.x && y > rootLoc.y
+ && (x - rootLoc.x) + contentsSize.width < rootSize.width
+ && (y - rootLoc.y) + contentsSize.height < rootSize.height)
+ popup = new Popup.LightweightPopup(owner, contents, x, y);
+ else
+ popup = new Popup.JWindowPopup(owner, contents, x, y);
+ return popup;
}
}
diff --git a/libjava/classpath/javax/swing/ProgressMonitor.java b/libjava/classpath/javax/swing/ProgressMonitor.java
index 844258f1b90..60f1c7145c0 100644
--- a/libjava/classpath/javax/swing/ProgressMonitor.java
+++ b/libjava/classpath/javax/swing/ProgressMonitor.java
@@ -1,5 +1,5 @@
/* ProgressMonitor.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,191 +38,386 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
/**
- * ProgressMonitor
- * @author Andrew Selkirk
- * @version 1.0
+ * <p>Using this class you can easily monitor tasks where you cannot
+ * estimate the duration exactly.</p>
+ *
+ * <p>A ProgressMonitor instance waits until the first time setProgress
+ * is called. When <code>millisToDecideToPopup</code> time elapsed the
+ * instance estimates the duration until the whole operation is completed.
+ * If this duration exceeds <code>millisToPopup</code> a non-modal dialog
+ * with a message and a progress bar is shown.</p>
+ *
+ * <p>The value of <code>millisToDecideToPopup</code> defaults to
+ * <code>500</code> and <code>millisToPopup</code> to
+ * <code>2000</code>.</p>
+ *
+ * @author Andrew Selkirk
+ * @author Robert Schuster (robertschuster@fsfe.org)
+ * @since 1.2
+ * @status updated to 1.2
*/
-public class ProgressMonitor {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * parentComponent
- */
- private Component component;
-
- /**
- * note
- */
- private String note;
-
- /**
- * message
- */
- private Object message;
-
- /**
- * millisToDecideToPopup
- */
- private int millisToDecideToPopup;
-
- /**
- * millisToPopup
- */
- private int millisToPopup;
-
- /**
- * min
- */
- private int minimum;
-
- /**
- * max
- */
- private int maximum;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ProgressMonitor
- * @param component TODO
- * @param message TODO
- * @param note TODO
- * @param minimum TODO
- * @param maximum TODO
- */
- public ProgressMonitor(Component component, Object message,
- String note, int minimum, int maximum) {
-
- // Set Data
- this.component = component;
- this.message = message;
- this.note = note;
- this.minimum = minimum;
- this.maximum = maximum;
-
- // TODO
- } // ProgressMonitor()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * close
- */
- public void close() {
- // TODO
- } // close()
-
- /**
- * setProgress
- * @param progress TODO
- */
- public void setProgress(int progress) {
- // TODO
- } // setProgress()
-
- /**
- * getMinimum
- * @returns int
- */
- public int getMinimum() {
- return minimum; // TODO
- } // getMinimum()
-
- /**
- * setMinimum
- * @param minimum TODO
- */
- public void setMinimum(int minimum) {
- this.minimum = minimum;
- // TODO
- } // setMinimum()
-
- /**
- * getMaximum
- * @returns int
- */
- public int getMaximum() {
- return maximum; // TODO
- } // getMaximum()
-
- /**
- * setMaximum
- * @param maximum TODO
- */
- public void setMaximum(int maximum) {
- this.maximum = maximum;
- // TODO
- } // setMaximum()
-
- /**
- * isCanceled
- * @returns boolean
- */
- public boolean isCanceled() {
- return false; // TODO
- } // isCanceled()
-
- /**
- * getMillisToDecideToPopup
- * @returns int
- */
- public int getMillisToDecideToPopup() {
- return millisToDecideToPopup; // TODO
- } // getMillisToDecideToPopup()
-
- /**
- * setMillisToDecideToPopup
- * @param time TODO
- */
- public void setMillisToDecideToPopup(int time) {
- millisToDecideToPopup = time;
- // TODO
- } // setMillisToDecideToPopup()
-
- /**
- * getMillisToPopup
- * @returns int
- */
- public int getMillisToPopup() {
- return millisToPopup; // TODO
- } // getMillisToPopup()
-
- /**
- * setMillisToPopup
- * @param time TODO
- */
- public void setMillisToPopup(int time) {
- millisToPopup = time;
- // TODO
- } // setMillisToPopup()
-
- /**
- * getNote
- * @returns String
- */
- public String getNote() {
- return note; // TODO
- } // getNote()
-
- /**
- * setNote
- * @param note TODO
- */
- public void setNote(String note) {
- this.note = note;
- // TODO
- } // setNote()
-
-
-} // ProgressMonitor
+public class ProgressMonitor
+{
+ /**
+ * parentComponent
+ */
+ Component component;
+
+ /**
+ * note
+ */
+ String note;
+
+ /**
+ * message
+ */
+ Object message;
+
+ /**
+ * millisToDecideToPopup
+ */
+ int millisToDecideToPopup = 500;
+
+ /**
+ * millisToPopup
+ */
+ int millisToPopup = 2000;
+
+ int min, max, progress;
+
+ JProgressBar progressBar;
+
+ JLabel noteLabel;
+
+ JDialog progressDialog;
+
+ Timer timer;
+
+ boolean canceled;
+
+ /**
+ * Constructor ProgressMonitor
+ * @param component The parent component of the progress dialog or <code>null</code>.
+ * @param message A constant message object which works in the way it does in <code>JOptionPane</code>.
+ * @param note A string message which can be changed while the operation goes on.
+ * @param minimum The minimum value for the operation (start value).
+ * @param maximum The maximum value for the operation (end value).
+ */
+ public ProgressMonitor(Component component, Object message,
+ String note, int minimum, int maximum)
+ {
+
+ // Set data.
+ this.component = component;
+ this.message = message;
+ this.note = note;
+
+ min = minimum;
+ max = maximum;
+ }
+
+ /**
+ * <p>Hides the dialog and stops any measurements.</p>
+ *
+ * <p>Has no effect when <code>setProgress</code> is not at least
+ * called once.</p>
+ */
+ public void close()
+ {
+ if ( progressDialog != null )
+ {
+ progressDialog.setVisible(false);
+ }
+
+ if ( timer != null )
+ {
+ timer.stop();
+ timer = null;
+ }
+ }
+
+ /**
+ * <p>Updates the progress value.</p>
+ *
+ * <p>When called for the first time this initializes a timer
+ * which decides after <code>millisToDecideToPopup</code> time
+ * whether to show a progress dialog or not.</p>
+ *
+ * <p>If the progress value equals or exceeds the maximum
+ * value the progress dialog is closed automatically.</p>
+ *
+ * @param progress New progress value.
+ */
+ public void setProgress(int progress)
+ {
+ this.progress = progress;
+
+ // Initializes and starts a timer with a task
+ // which measures the duration and displays
+ // a progress dialog if neccessary.
+ if ( timer == null && progressDialog == null )
+ {
+ timer = new Timer(25, null);
+ timer.addActionListener(new TimerListener());
+ timer.start();
+ }
+
+ // Cancels timer and hides progress dialog if the
+ // maximum value is reached.
+ if ( progressBar != null && this.progress >= progressBar.getMaximum() )
+ {
+ // The reason for using progressBar.getMaximum() instead of max is that
+ // we want to prevent that changes to the value have any effect after the
+ // progress dialog is visible (This is how the JDK behaves.).
+ close();
+ }
+
+ }
+
+ /** Returns the minimum or start value of the operation.
+ *
+ * @returns Minimum or start value of the operation.
+ */
+ public int getMinimum()
+ {
+ return min;
+ }
+
+ /**
+ * <p>Use this method to set the minimum or start value of
+ * your operation.</p>
+ *
+ * <p>For typical application like copy operation this will be
+ * zero.</p>
+ *
+ * <p>Keep in mind that changing this value after the progress
+ * dialog is made visible has no effect upon the progress bar.</p>
+ *
+ * @param minimum The new minimum value.
+ */
+ public void setMinimum(int minimum)
+ {
+ min = minimum;
+ }
+
+ /**
+ * Return the maximum or end value of your operation.
+ *
+ * @returns Maximum or end value.
+ */
+ public int getMaximum()
+ {
+ return max;
+ }
+
+ /**
+ * <p>Sets the maximum or end value of the operation to the
+ * given integer.</p>
+ *
+ * @param maximum
+ */
+ public void setMaximum(int maximum)
+ {
+ max = maximum;
+ }
+
+ /**
+ * Returns whether the user canceled the operation.
+ *
+ * @returns Whether the operation was canceled.
+ */
+ public boolean isCanceled()
+ {
+ // The value is predefined to false
+ // and changes only when the user clicks
+ // the cancel button in the progress dialog.
+ return canceled;
+ }
+
+ /**
+ * Returns the amount of milliseconds to wait
+ * until the ProgressMonitor should decide whether
+ * a progress dialog is to be shown or not.
+ *
+ * @returns The duration in milliseconds.
+ */
+ public int getMillisToDecideToPopup()
+ {
+ return millisToDecideToPopup;
+ }
+
+ /**
+ * Sets the amount of milliseconds to wait until the
+ * ProgressMonitor should decide whether a progress dialog
+ * is to be shown or not.
+ *
+ * <p>This method has no effect when the progress dialog
+ * is already visible.</p>
+ *
+ * @param time The duration in milliseconds.
+ */
+ public void setMillisToDecideToPopup(int time)
+ {
+ millisToDecideToPopup = time;
+ }
+
+ /**
+ * getMillisToPopup
+ * @returns int
+ */
+ public int getMillisToPopup()
+ {
+ return millisToPopup;
+ }
+
+ /**
+ * setMillisToPopup
+ * @param time TODO
+ */
+ public void setMillisToPopup(int time)
+ {
+ millisToPopup = time;
+ }
+
+ /**
+ * Returns a message which is shown in the progress dialog.
+ *
+ * @returns The changeable message visible in the progress dialog.
+ */
+ public String getNote()
+ {
+ return note;
+ }
+
+ /**
+ * <p>Set the message shown in the progess dialog.</p>
+ *
+ * <p>Changing the note while the progress dialog is visible
+ * is possible.</p>
+ *
+ * @param note A message shown in the progress dialog.
+ */
+ public void setNote(String note)
+ {
+ if ( noteLabel != null )
+ {
+ noteLabel.setText(note);
+ }
+ else
+ {
+ this.note = note;
+ }
+ }
+
+ /** Internal method that creates the progress dialog.
+ */
+ void createDialog()
+ {
+ // If there is no note we suppress the generation of the
+ // label.
+ Object[] tmp = (note == null) ?
+ new Object[]
+ {
+ message,
+ progressBar = new JProgressBar(min, max)
+ }
+ :
+ new Object[]
+ {
+ message,
+ noteLabel = new JLabel(note),
+ progressBar = new JProgressBar(min, max)
+ };
+
+ JOptionPane pane = new JOptionPane(tmp, JOptionPane.INFORMATION_MESSAGE);
+
+ // FIXME: Internationalize the button
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ canceled = true;
+ }
+ });
+
+ pane.setOptions(new Object[] { cancelButton });
+
+ // FIXME: Internationalize the title
+ progressDialog = pane.createDialog(component, "Progress ...");
+ progressDialog.setModal(false);
+ progressDialog.setResizable(true);
+
+ progressDialog.pack();
+ progressDialog.setVisible(true);
+
+ }
+
+ /** An ActionListener implementation which does the measurements
+ * and estimations of the ProgressMonitor.
+ */
+ class TimerListener implements ActionListener
+ {
+ long timestamp;
+
+ int lastProgress;
+
+ boolean first = true;
+
+ TimerListener()
+ {
+ timestamp = System.currentTimeMillis();
+ }
+
+ public void actionPerformed(ActionEvent ae)
+ {
+ long now = System.currentTimeMillis();
+
+ if ( first )
+ {
+ if (( now - timestamp ) > millisToDecideToPopup )
+ {
+ first = false;
+ long expected = ( now - timestamp ) * ( max - min ) / ( progress - min );
+
+ if ( expected > millisToPopup )
+ {
+ createDialog();
+ }
+ }
+ else
+ {
+ // We have not waited long enough to make a decision,
+ // so return and try again when the timer is invoked.
+ return;
+ }
+ }
+ else if ( progressDialog != null )
+ {
+ // The progress dialog is being displayed. We now calculate
+ // whether setting the progress bar to the current progress
+ // value would result in a visual difference.
+ int delta = progress - progressBar.getValue();
+
+ if ( ( delta * progressBar.getWidth() / (max - min) ) > 0 )
+ {
+ // At least one pixel would change.
+ progressBar.setValue(progress);
+ }
+ }
+ else
+ {
+ // No dialog necessary
+ timer.stop();
+ timer = null;
+ }
+
+ timestamp = now;
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/ProgressMonitorInputStream.java b/libjava/classpath/javax/swing/ProgressMonitorInputStream.java
index 2022a1c24a3..02ac597b3a4 100644
--- a/libjava/classpath/javax/swing/ProgressMonitorInputStream.java
+++ b/libjava/classpath/javax/swing/ProgressMonitorInputStream.java
@@ -1,5 +1,5 @@
/* ProgressMonitorInputStream.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,122 +39,187 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+
import java.io.FilterInputStream;
-import java.io.IOException;
import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.io.IOException;
/**
* ProgressMonitorInputStream
* @author Andrew Selkirk
- * @version 1.0
+ * @author Robert Schuster (robertschuster@fsfe.org)
+ * @status updated to 1.2
+ * @since 1.2
*/
-public class ProgressMonitorInputStream extends FilterInputStream {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * monitor
- */
- private ProgressMonitor monitor;
-
- /**
- * nread
- */
- private int nread;
-
- /**
- * size
- */
- private int size;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ProgressMonitorInputStream
- * @param component TODO
- * @param message TODO
- * @param stream TODO
- */
- public ProgressMonitorInputStream(Component component, Object message,
- InputStream stream) {
- super(stream);
- // TODO
- } // ProgressMonitorInputStream()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * reset
- * @exception IOException TODO
- */
- public synchronized void reset() throws IOException {
- // TODO
- } // reset()
-
- /**
- * read
- * @exception IOException TODO
- * @returns int
- */
- public int read() throws IOException {
- return 0; // TODO
- } // read()
-
- /**
- * read
- * @param data TODO
- * @exception IOException TODO
- * @returns int
- */
- public int read(byte[] data) throws IOException {
- return 0; // TODO
- } // read()
-
- /**
- * read
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @exception IOException TODO
- * @returns int
- */
- public int read(byte[] data, int offset, int length) throws IOException {
- return 0; // TODO
- } // read()
-
- /**
- * skip
- * @param length TODO
- * @exception IOException TODO
- * @returns long
- */
- public long skip(long length) throws IOException {
- return 0; // TODO
- } // skip()
-
- /**
- * close
- * @exception IOException TODO
- */
- public void close() throws IOException {
- // TODO
- } // close()
-
- /**
- * getProgressMonitor
- * @returns ProgressMonitor
- */
- public ProgressMonitor getProgressMonitor() {
- return null; // TODO
- } // getProgressMonitor()
-
-
-} // ProgressMonitorInputStream
+public class ProgressMonitorInputStream extends FilterInputStream
+{
+
+ /**
+ * monitor
+ */
+ private ProgressMonitor monitor;
+
+ /**
+ * read
+ */
+ private int read;
+
+ /**
+ * Constructor ProgressMonitorInputStream
+ * @param component TODO
+ * @param message TODO
+ * @param stream TODO
+ */
+ public ProgressMonitorInputStream(Component component, Object message,
+ InputStream stream)
+ {
+ super(stream);
+
+ int max = 0;
+
+ try
+ {
+ max = stream.available();
+ }
+ catch ( IOException ioe )
+ {
+ // Behave like the JDK here.
+ }
+
+ monitor = new ProgressMonitor(
+ component, message, null, 0, max );
+ }
+
+ /**
+ * reset
+ * @exception IOException TODO
+ */
+ public void reset() throws IOException
+ {
+ super.reset();
+
+ checkMonitorCanceled();
+
+ // TODO: The docs says the monitor should be resetted. But to which
+ // value? (mark is not overridden)
+ }
+
+ /**
+ * read
+ * @exception IOException TODO
+ * @returns int
+ */
+ public int read() throws IOException
+ {
+ int t = super.read();
+
+ monitor.setProgress(++read);
+
+ checkMonitorCanceled();
+
+ return t;
+ }
+
+ /**
+ * read
+ * @param data TODO
+ * @exception IOException TODO
+ * @returns int
+ */
+ public int read(byte[] data) throws IOException
+ {
+ int t = super.read(data);
+
+ if ( t > 0 )
+ {
+ read += t;
+ monitor.setProgress(read);
+
+ checkMonitorCanceled();
+ }
+ else
+ {
+ monitor.close();
+ }
+
+ return t;
+ }
+
+ /**
+ * read
+ * @param data TODO
+ * @param offset TODO
+ * @param length TODO
+ * @exception IOException TODO
+ * @returns int
+ */
+ public int read(byte[] data, int offset, int length) throws IOException
+ {
+ int t = super.read(data, offset, length);
+
+ if ( t > 0 )
+ {
+ read += t;
+ monitor.setProgress(read);
+
+ checkMonitorCanceled();
+ }
+ else
+ {
+ monitor.close();
+ }
+
+ return t;
+ }
+
+ /**
+ * skip
+ * @param length TODO
+ * @exception IOException TODO
+ * @returns long
+ */
+ public long skip(long length) throws IOException
+ {
+ long t = super.skip(length);
+
+ // 'read' may overflow here in rare situations.
+ assert ( (long) read + t <= (long) Integer.MAX_VALUE );
+
+ read += (int) t;
+
+ monitor.setProgress(read);
+
+ checkMonitorCanceled();
+
+ return t;
+ }
+
+ /**
+ * close
+ * @exception IOException TODO
+ */
+ public void close() throws IOException
+ {
+ super.close();
+ monitor.close();
+ }
+
+ /**
+ * getProgressMonitor
+ * @returns ProgressMonitor
+ */
+ public ProgressMonitor getProgressMonitor()
+ {
+ return monitor;
+ }
+
+ private void checkMonitorCanceled() throws InterruptedIOException
+ {
+ if ( monitor.isCanceled() )
+ {
+ throw new InterruptedIOException("ProgressMonitor was canceled");
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/Renderer.java b/libjava/classpath/javax/swing/Renderer.java
index c803e38fcc0..9a0e81a9f36 100644
--- a/libjava/classpath/javax/swing/Renderer.java
+++ b/libjava/classpath/javax/swing/Renderer.java
@@ -49,24 +49,20 @@ import java.awt.Component;
*
* @author Andrew Selkirk
*/
-public interface Renderer {
+public interface Renderer
+{
+ /**
+ * setValue
+ * @param value TODO
+ * @param selected TODO
+ */
+ void setValue(Object value, boolean selected);
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ /**
+ * getComponent
+ * @returns Component
+ */
+ Component getComponent();
- /**
- * setValue
- * @param value TODO
- * @param selected TODO
- */
- void setValue(Object value, boolean selected);
- /**
- * getComponent
- * @returns Component
- */
- Component getComponent();
-
-
-} // Renderer
+}
diff --git a/libjava/classpath/javax/swing/RepaintManager.java b/libjava/classpath/javax/swing/RepaintManager.java
index 698dbe8e898..b857b126180 100644
--- a/libjava/classpath/javax/swing/RepaintManager.java
+++ b/libjava/classpath/javax/swing/RepaintManager.java
@@ -1,5 +1,5 @@
/* RepaintManager.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,12 +43,11 @@ import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.VolatileImage;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
/**
* <p>The repaint manager holds a set of dirty regions, invalid components,
@@ -66,7 +65,11 @@ import java.util.Vector;
*/
public class RepaintManager
{
-
+ /**
+ * The current repaint managers, indexed by their ThreadGroups.
+ */
+ static HashMap currentRepaintManagers;
+
/**
* <p>A helper class which is placed into the system event queue at
* various times in order to facilitate repainting and layout. There is
@@ -80,33 +83,95 @@ public class RepaintManager
* swing paint thread, which revalidates all invalid components and
* repaints any damage in the swing scene.</p>
*/
-
protected class RepaintWorker
implements Runnable
{
+
boolean live;
+
public RepaintWorker()
{
live = false;
}
+
public synchronized void setLive(boolean b)
{
live = b;
}
+
public synchronized boolean isLive()
{
return live;
}
+
public void run()
{
- RepaintManager rm = RepaintManager.globalManager;
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ RepaintManager rm =
+ (RepaintManager) currentRepaintManagers.get(threadGroup);
setLive(false);
rm.validateInvalidComponents();
rm.paintDirtyRegions();
}
+
+ }
+
+ /**
+ * Compares two components using their depths in the component hierarchy.
+ * A component with a lesser depth (higher level components) are sorted
+ * before components with a deeper depth (low level components). This is used
+ * to order paint requests, so that the higher level components are painted
+ * before the low level components get painted.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class ComponentComparator implements Comparator
+ {
+
+ /**
+ * Compares two components.
+ *
+ * @param o1 the first component
+ * @param o2 the second component
+ *
+ * @return a negative integer, if <code>o1</code> is higher in the
+ * hierarchy than <code>o2</code>, zero, if both are at the same
+ * level and a positive integer, if <code>o1</code> is deeper in
+ * the hierarchy than <code>o2</code>
+ */
+ public int compare(Object o1, Object o2)
+ {
+ if (o1 instanceof JComponent && o2 instanceof JComponent)
+ {
+ JComponent c1 = (JComponent) o1;
+ JComponent c2 = (JComponent) o2;
+ return getDepth(c1) - getDepth(c2);
+ }
+ else
+ throw new ClassCastException("This comparator can only be used with "
+ + "JComponents");
+ }
+
+ /**
+ * Computes the depth for a given JComponent.
+ *
+ * @param c the component to compute the depth for
+ *
+ * @return the depth of the component
+ */
+ private int getDepth(JComponent c)
+ {
+ Component comp = c;
+ int depth = 0;
+ while (comp != null)
+ {
+ comp = comp.getParent();
+ depth++;
+ }
+ return depth;
+ }
}
-
/**
* A table storing the dirty regions of components. The keys of this
* table are components, the values are rectangles. Each component maps
@@ -119,7 +184,20 @@ public class RepaintManager
* @see #markCompletelyClean
* @see #markCompletelyDirty
*/
- Hashtable dirtyComponents;
+ HashMap dirtyComponents;
+
+ HashMap workDirtyComponents;
+
+ /**
+ * Stores the order in which the components get repainted.
+ */
+ ArrayList repaintOrder;
+ ArrayList workRepaintOrder;
+
+ /**
+ * The comparator used for ordered inserting into the repaintOrder list.
+ */
+ Comparator comparator;
/**
* A single, shared instance of the helper class. Any methods which mark
@@ -142,14 +220,15 @@ public class RepaintManager
* @see #removeInvalidComponent
* @see #validateInvalidComponents
*/
- Vector invalidComponents;
+ ArrayList invalidComponents;
+ ArrayList workInvalidComponents;
/**
* Whether or not double buffering is enabled on this repaint
* manager. This is merely a hint to clients; the RepaintManager will
* always return an offscreen buffer when one is requested.
*
- * @see #getDoubleBufferingEnabled
+ * @see #isDoubleBufferingEnabled
* @see #setDoubleBufferingEnabled
*/
boolean doubleBufferingEnabled;
@@ -176,53 +255,62 @@ public class RepaintManager
/**
- * The global, shared RepaintManager instance. This is reused for all
- * components in all windows. This is package-private to avoid an accessor
- * method.
- *
- * @see #currentManager
- * @see #setCurrentManager
- */
- static RepaintManager globalManager;
-
- /**
* Create a new RepaintManager object.
*/
public RepaintManager()
{
- dirtyComponents = new Hashtable();
- invalidComponents = new Vector();
+ dirtyComponents = new HashMap();
+ workDirtyComponents = new HashMap();
+ repaintOrder = new ArrayList();
+ workRepaintOrder = new ArrayList();
+ invalidComponents = new ArrayList();
+ workInvalidComponents = new ArrayList();
repaintWorker = new RepaintWorker();
doubleBufferMaximumSize = new Dimension(2000,2000);
doubleBufferingEnabled = true;
}
/**
- * Get the value of the shared {@link #globalManager} instance, possibly
- * returning a special manager associated with the specified
- * component. The default implementaiton ignores the component parameter.
+ * Returns the <code>RepaintManager</code> for the current thread's
+ * thread group. The default implementation ignores the
+ * <code>component</code> parameter and returns the same repaint manager
+ * for all components.
*
- * @param component A component to look up the manager of
+ * @param component a component to look up the manager of
*
- * @return The current repaint manager
+ * @return the current repaint manager for the calling thread's thread group
+ * and the specified component
*
* @see #setCurrentManager
*/
public static RepaintManager currentManager(Component component)
{
- if (globalManager == null)
- globalManager = new RepaintManager();
- return globalManager;
+ if (currentRepaintManagers == null)
+ currentRepaintManagers = new HashMap();
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ RepaintManager currentManager =
+ (RepaintManager) currentRepaintManagers.get(threadGroup);
+ if (currentManager == null)
+ {
+ currentManager = new RepaintManager();
+ currentRepaintManagers.put(threadGroup, currentManager);
+ }
+ return currentManager;
}
/**
- * Get the value of the shared {@link #globalManager} instance, possibly
- * returning a special manager associated with the specified
- * component. The default implementaiton ignores the component parameter.
+ * Returns the <code>RepaintManager</code> for the current thread's
+ * thread group. The default implementation ignores the
+ * <code>component</code> parameter and returns the same repaint manager
+ * for all components.
*
- * @param component A component to look up the manager of
+ * This method is only here for backwards compatibility with older versions
+ * of Swing and simply forwards to {@link #currentManager(Component)}.
*
- * @return The current repaint manager
+ * @param component a component to look up the manager of
+ *
+ * @return the current repaint manager for the calling thread's thread group
+ * and the specified component
*
* @see #setCurrentManager
*/
@@ -232,15 +320,20 @@ public class RepaintManager
}
/**
- * Set the value of the shared {@link #globalManager} instance.
+ * Sets the repaint manager for the calling thread's thread group.
*
- * @param manager The new value of the shared instance
+ * @param manager the repaint manager to set for the current thread's thread
+ * group
*
- * @see #currentManager(JComponent)
+ * @see #currentManager(Component)
*/
public static void setCurrentManager(RepaintManager manager)
{
- globalManager = manager;
+ if (currentRepaintManagers == null)
+ currentRepaintManagers = new HashMap();
+
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ currentRepaintManagers.put(threadGroup, manager);
}
/**
@@ -287,7 +380,7 @@ public class RepaintManager
*/
public synchronized void removeInvalidComponent(JComponent component)
{
- invalidComponents.removeElement(component);
+ invalidComponents.remove(component);
}
/**
@@ -311,12 +404,13 @@ public class RepaintManager
public synchronized void addDirtyRegion(JComponent component, int x, int y,
int w, int h)
{
- if (w == 0 || h == 0)
+ if (w == 0 || h == 0 || !component.isShowing())
return;
-
Rectangle r = new Rectangle(x, y, w, h);
if (dirtyComponents.containsKey(component))
r = r.union((Rectangle)dirtyComponents.get(component));
+ else
+ insertInRepaintOrder(component);
dirtyComponents.put(component, r);
if (! repaintWorker.isLive())
{
@@ -324,7 +418,23 @@ public class RepaintManager
SwingUtilities.invokeLater(repaintWorker);
}
}
-
+
+ /**
+ * Inserts a component into the repaintOrder list in an ordered fashion,
+ * using a binary search.
+ *
+ * @param c the component to be inserted
+ */
+ private void insertInRepaintOrder(JComponent c)
+ {
+ if (comparator == null)
+ comparator = new ComponentComparator();
+ int insertIndex = Collections.binarySearch(repaintOrder, c, comparator);
+ if (insertIndex < 0)
+ insertIndex = -(insertIndex + 1);
+ repaintOrder.add(insertIndex, c);
+ }
+
/**
* Get the dirty region associated with a component, or <code>null</code>
* if the component has no dirty region.
@@ -341,7 +451,10 @@ public class RepaintManager
*/
public Rectangle getDirtyRegion(JComponent component)
{
- return (Rectangle) dirtyComponents.get(component);
+ Rectangle dirty = (Rectangle) dirtyComponents.get(component);
+ if (dirty == null)
+ dirty = new Rectangle();
+ return dirty;
}
/**
@@ -359,6 +472,7 @@ public class RepaintManager
{
Rectangle r = component.getBounds();
addDirtyRegion(component, r.x, r.y, r.width, r.height);
+ component.isCompletelyDirty = true;
}
/**
@@ -374,7 +488,11 @@ public class RepaintManager
*/
public void markCompletelyClean(JComponent component)
{
- dirtyComponents.remove(component);
+ synchronized (this)
+ {
+ dirtyComponents.remove(component);
+ }
+ component.isCompletelyDirty = false;
}
/**
@@ -393,13 +511,9 @@ public class RepaintManager
*/
public boolean isCompletelyDirty(JComponent component)
{
- Rectangle dirty = (Rectangle) dirtyComponents.get(component);
- if (dirty == null)
+ if (! dirtyComponents.containsKey(component))
return false;
- Rectangle r = component.getBounds();
- if (r == null)
- return true;
- return dirty.contains(r);
+ return component.isCompletelyDirty;
}
/**
@@ -408,58 +522,56 @@ public class RepaintManager
*/
public void validateInvalidComponents()
{
- for (Enumeration e = invalidComponents.elements(); e.hasMoreElements(); )
+ // In order to keep the blocking of application threads minimal, we switch
+ // the invalidComponents field with the workInvalidComponents field and
+ // work with the workInvalidComponents field.
+ synchronized(this)
+ {
+ ArrayList swap = invalidComponents;
+ invalidComponents = workInvalidComponents;
+ workInvalidComponents = swap;
+ }
+ for (Iterator i = workInvalidComponents.iterator(); i.hasNext(); )
{
- JComponent comp = (JComponent) e.nextElement();
+ JComponent comp = (JComponent) i.next();
if (! (comp.isVisible() && comp.isShowing()))
continue;
comp.validate();
}
- invalidComponents.clear();
+ workInvalidComponents.clear();
}
/**
* Repaint all regions of all components which have been marked dirty in
* the {@link #dirtyComponents} table.
*/
- public void paintDirtyRegions()
+ public synchronized void paintDirtyRegions()
{
- // step 1: pull out roots and calculate spanning damage
-
- HashMap roots = new HashMap();
- for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); )
+ // In order to keep the blocking of application threads minimal, we switch
+ // the dirtyComponents field with the workdirtyComponents field and the
+ // repaintOrder field with the workRepaintOrder field and work with the
+ // work* fields.
+ synchronized(this)
+ {
+ ArrayList swap = workRepaintOrder;
+ workRepaintOrder = repaintOrder;
+ repaintOrder = swap;
+ HashMap swap2 = workDirtyComponents;
+ workDirtyComponents = dirtyComponents;
+ dirtyComponents = swap2;
+ }
+ for (Iterator i = workRepaintOrder.iterator(); i.hasNext();)
{
- JComponent comp = (JComponent) e.nextElement();
- if (! (comp.isVisible() && comp.isShowing()))
- continue;
- Rectangle damaged = getDirtyRegion(comp);
- if (damaged.width == 0 || damaged.height == 0)
+ JComponent comp = (JComponent) i.next();
+ // If a component is marked completely clean in the meantime, then skip
+ // it.
+ Rectangle damaged = (Rectangle) workDirtyComponents.get(comp);
+ if (damaged == null || damaged.isEmpty())
continue;
- JRootPane root = comp.getRootPane();
- // If the component has no root, no repainting will occur.
- if (root == null)
- continue;
- Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root);
- if (! roots.containsKey(root))
- {
- roots.put(root, rootDamage);
- }
- else
- {
- roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage));
- }
- }
- dirtyComponents.clear();
-
- // step 2: paint those roots
- Iterator i = roots.entrySet().iterator();
- while(i.hasNext())
- {
- Map.Entry ent = (Map.Entry) i.next();
- JRootPane root = (JRootPane) ent.getKey();
- Rectangle rect = (Rectangle) ent.getValue();
- root.paintImmediately(rect);
+ comp.paintImmediately(damaged);
}
+ workRepaintOrder.clear();
+ workDirtyComponents.clear();
}
/**
diff --git a/libjava/classpath/javax/swing/RootPaneContainer.java b/libjava/classpath/javax/swing/RootPaneContainer.java
index b121f958a92..4b1bece214d 100644
--- a/libjava/classpath/javax/swing/RootPaneContainer.java
+++ b/libjava/classpath/javax/swing/RootPaneContainer.java
@@ -48,53 +48,49 @@ import java.awt.Container;
*
* @author Andrew Selkirk
*/
-public interface RootPaneContainer {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getRootPane
- * @returns JRootPane
- */
- JRootPane getRootPane();
-
- /**
- * setContentPane
- * @param contentPane TODO
- */
- void setContentPane(Container contentPane);
-
- /**
- * getContentPane
- * @returns Container
- */
- Container getContentPane();
-
- /**
- * setLayeredPane
- * @param layeredPane TODO
- */
- void setLayeredPane(JLayeredPane layeredPane);
-
- /**
- * getLayeredPane
- * @returns JLayeredPane
- */
- JLayeredPane getLayeredPane();
-
- /**
- * setGlassPane
- * @param glassPane TODO
- */
- void setGlassPane(Component glassPane);
-
- /**
- * getGlassPane
- * @returns Component
- */
- Component getGlassPane();
-
-
-} // RootPaneContainer
+public interface RootPaneContainer
+{
+
+ /**
+ * getRootPane
+ * @returns JRootPane
+ */
+ JRootPane getRootPane();
+
+ /**
+ * setContentPane
+ * @param contentPane TODO
+ */
+ void setContentPane(Container contentPane);
+
+ /**
+ * getContentPane
+ * @returns Container
+ */
+ Container getContentPane();
+
+ /**
+ * setLayeredPane
+ * @param layeredPane TODO
+ */
+ void setLayeredPane(JLayeredPane layeredPane);
+
+ /**
+ * getLayeredPane
+ * @returns JLayeredPane
+ */
+ JLayeredPane getLayeredPane();
+
+ /**
+ * setGlassPane
+ * @param glassPane TODO
+ */
+ void setGlassPane(Component glassPane);
+
+ /**
+ * getGlassPane
+ * @returns Component
+ */
+ Component getGlassPane();
+
+}
diff --git a/libjava/classpath/javax/swing/ScrollPaneLayout.java b/libjava/classpath/javax/swing/ScrollPaneLayout.java
index 75a6f9aa208..edf1f1f4292 100644
--- a/libjava/classpath/javax/swing/ScrollPaneLayout.java
+++ b/libjava/classpath/javax/swing/ScrollPaneLayout.java
@@ -43,12 +43,9 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
-import java.awt.Point;
import java.awt.Rectangle;
import java.io.Serializable;
-import javax.swing.border.Border;
-
/**
* ScrollPaneLayout
* @author Andrew Selkirk
@@ -60,8 +57,11 @@ public class ScrollPaneLayout
private static final long serialVersionUID = -4480022884523193743L;
public static class UIResource extends ScrollPaneLayout
- implements javax.swing.plaf.UIResource {
- public UIResource() {
+ implements javax.swing.plaf.UIResource
+ {
+ public UIResource()
+ {
+ super();
}
}
@@ -77,8 +77,9 @@ public class ScrollPaneLayout
protected int vsbPolicy;
protected int hsbPolicy;
- public ScrollPaneLayout() {
-
+ public ScrollPaneLayout()
+ {
+ // Nothing to do here.
}
public void syncWithScrollPane(JScrollPane scrollPane) {
@@ -95,11 +96,31 @@ public class ScrollPaneLayout
upperRight = scrollPane.getCorner(UPPER_RIGHT_CORNER);
}
+ /**
+ * Removes an existing component. If oldComponent is not null
+ * and is not equal to newComponent, oldComponent must be removed
+ * from its parent.
+ * @param oldComponent the old Component that may need to be removed.
+ * @param newComponent the Component to add.
+ * @return the newComponent
+ */
protected Component addSingletonComponent(Component oldComponent,
- Component newComponent) {
- return null;
+ Component newComponent)
+ {
+ if (oldComponent != null && oldComponent != newComponent)
+ oldComponent.getParent().remove(oldComponent);
+ return newComponent;
}
+ /**
+ * Add the specified component to the layout.
+ * @param key must be one of VIEWPORT, VERTICAL_SCROLLBAR,
+ * HORIZONTAL_SCROLLBAR, ROW_HEADER, COLUMN_HEADER,
+ * LOWER_RIGHT_CORNER, LOWER_LEFT_CORNER, UPPER_RIGHT_CORNER,
+ * UPPER_LEFT_CORNER.
+ * @param component the Component to add
+ * @throws IllegalArgumentException if key is not as above
+ */
public void addLayoutComponent(String key, Component component)
{
if (key == VIEWPORT)
@@ -120,6 +141,8 @@ public class ScrollPaneLayout
lowerLeft = component;
else if (key == UPPER_LEFT_CORNER)
upperLeft = component;
+ else
+ throw new IllegalArgumentException();
}
public void removeLayoutComponent(Component component) {
@@ -147,9 +170,20 @@ public class ScrollPaneLayout
{
return vsbPolicy;
}
-
+
+ /**
+ * Sets the vertical scrollbar policy.
+ * @param policy must be one of VERTICAL_SCROLLBAR_AS_NEEDED,
+ * VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS.
+ * @throws IllegalArgumentException if policy is not one of the valid
+ * JScrollBar policies.
+ */
public void setVerticalScrollBarPolicy(int policy)
{
+ if (policy != VERTICAL_SCROLLBAR_AS_NEEDED &&
+ policy != VERTICAL_SCROLLBAR_NEVER &&
+ policy != VERTICAL_SCROLLBAR_ALWAYS)
+ throw new IllegalArgumentException("Illegal Scrollbar Policy");
vsbPolicy = policy;
}
@@ -158,8 +192,19 @@ public class ScrollPaneLayout
return hsbPolicy;
}
+ /**
+ * Sets the horizontal scrollbar policy.
+ * @param policy must be one of HORIZONTAL_SCROLLBAR_AS_NEEDED,
+ * HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS.
+ * @throws IllegalArgumentException if policy is not one of the valid
+ * JScrollbar policies.
+ */
public void setHorizontalScrollBarPolicy(int policy)
{
+ if (policy != HORIZONTAL_SCROLLBAR_AS_NEEDED &&
+ policy != HORIZONTAL_SCROLLBAR_NEVER &&
+ policy != HORIZONTAL_SCROLLBAR_ALWAYS)
+ throw new IllegalArgumentException("Illegal Scrollbar Policy");
hsbPolicy = policy;
}
@@ -188,6 +233,12 @@ public class ScrollPaneLayout
return colHead;
}
+ /**
+ * Returns the Component at the specified corner.
+ * @param key the corner.
+ * @return the Component at the specified corner, or null if
+ * key is not one of the four valid corners.
+ */
public Component getCorner(String key)
{
if (key == LOWER_RIGHT_CORNER)
@@ -201,151 +252,53 @@ public class ScrollPaneLayout
return null;
}
- private static void maybeSetPreferredSize(JComponent src, Dimension dim)
- {
- Dimension tmp = null;
- if (src != null)
- tmp = src.getPreferredSize();
- if (tmp != null)
- dim.setSize(tmp);
- }
-
- private static void maybeSetMinimumSize(JComponent src, Dimension dim)
- {
- Dimension tmp = null;
- if (src != null)
- tmp = src.getMinimumSize();
- if (tmp != null)
- dim.setSize(tmp);
- }
-
public Dimension preferredLayoutSize(Container parent)
{
- if (parent != null && parent instanceof JScrollPane)
- {
- JScrollPane sc = (JScrollPane) parent;
- synchronized (sc.getTreeLock ())
- {
- Dimension insetsSize = new Dimension(0,0);
- Dimension viewportSize = new Dimension(0,0);
- Dimension viewportInsetsSize = new Dimension(0,0);
- Dimension columnHeaderSize = new Dimension(0,0);
- Dimension rowHeaderSize = new Dimension(0,0);
- Dimension verticalScrollBarSize = new Dimension(0,0);
- Dimension horizontalScrollBarSize = new Dimension(0,0);
-
- Insets insets = sc.getInsets();
- Border viewportBorder = sc.getViewportBorder();
- Insets viewportInsets = null;
-
- if (viewportBorder != null)
- {
- viewportInsets = viewportBorder.getBorderInsets(parent);
- if (viewportInsets != null)
- viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right,
- viewportInsets.top + viewportInsets.bottom);
- }
-
- if (insets != null)
- insetsSize.setSize(insets.left + insets.right,
- insets.top + insets.bottom);
-
- if (viewport != null)
- {
- Component view = null;
- Scrollable scr = null;
- Dimension pref = null;
-
- view = viewport.getView();
- if (view != null && view instanceof Scrollable)
- scr = (Scrollable) view;
- if (scr != null)
- pref = scr.getPreferredScrollableViewportSize();
- if (pref == null)
- pref = viewport.getPreferredSize();
- if (pref != null)
- viewportSize.setSize(pref);
- }
-
- maybeSetPreferredSize(colHead, columnHeaderSize);
- maybeSetPreferredSize(rowHead, rowHeaderSize);
- maybeSetPreferredSize(vsb, verticalScrollBarSize);
- maybeSetPreferredSize(hsb, horizontalScrollBarSize);
-
- return new Dimension(insetsSize.width
- + viewportSize.width
- + viewportInsetsSize.width
- + rowHeaderSize.width
- + verticalScrollBarSize.width,
- insetsSize.height
- + viewportSize.height
- + viewportInsetsSize.height
- + columnHeaderSize.height
- + horizontalScrollBarSize.height);
- }
- }
- else
- {
- return new Dimension(0,0);
- }
+ // Sun's implementation simply throws a ClassCastException if
+ // parent is no JScrollPane, so do we.
+ JScrollPane sc = (JScrollPane) parent;
+ Dimension viewportSize = viewport.getPreferredSize();
+ Dimension viewSize = viewport.getViewSize();
+ int width = viewportSize.width;
+ int height = viewportSize.height;
+
+ // horizontal scrollbar needed if the view's preferred width
+ // is larger than the viewport's preferred width
+ if (hsb != null && viewSize.width > viewportSize.width)
+ height += hsb.getPreferredSize().height;
+
+ // vertical scrollbar needed if the view's preferred height
+ // is larger than the viewport's preferred height
+ if (vsb != null && viewSize.height > viewportSize.height)
+ width += vsb.getPreferredSize().width;
+ if (rowHead != null && rowHead.isVisible())
+ width += rowHead.getPreferredSize().width;
+ if (colHead != null && colHead.isVisible())
+ height += colHead.getPreferredSize().height;
+ Insets i = sc.getInsets();
+ return new Dimension(width + i.left + i.right,
+ height + i.left + i.right);
}
public Dimension minimumLayoutSize(Container parent)
{
- if (parent instanceof JScrollPane)
- {
- JScrollPane sc = (JScrollPane) parent;
- synchronized (sc.getTreeLock ())
- {
- Dimension insetsSize = new Dimension(0,0);
- Dimension viewportSize = new Dimension(0,0);
- Dimension viewportInsetsSize = new Dimension(0,0);
- Dimension columnHeaderSize = new Dimension(0,0);
- Dimension rowHeaderSize = new Dimension(0,0);
- Dimension verticalScrollBarSize = new Dimension(0,0);
- Dimension horizontalScrollBarSize = new Dimension(0,0);
-
- Insets insets = sc.getInsets();
- Border viewportBorder = sc.getViewportBorder();
- Insets viewportInsets = null;
-
- if (viewportBorder != null)
- {
- viewportInsets = viewportBorder.getBorderInsets(parent);
- if (viewportInsets != null)
- viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right,
- viewportInsets.top + viewportInsets.bottom);
- }
-
- if (insets != null)
- insetsSize.setSize(insets.left + insets.right,
- insets.top + insets.bottom);
-
- maybeSetMinimumSize(colHead, columnHeaderSize);
- maybeSetMinimumSize(rowHead, rowHeaderSize);
-
- if (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)
- maybeSetMinimumSize(vsb, verticalScrollBarSize);
-
- if (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)
- maybeSetMinimumSize(hsb, horizontalScrollBarSize);
-
- return new Dimension(insetsSize.width
- + viewportSize.width
- + viewportInsetsSize.width
- + rowHeaderSize.width
- + verticalScrollBarSize.width,
- insetsSize.height
- + viewportSize.height
- + viewportInsetsSize.height
- + columnHeaderSize.height
- + horizontalScrollBarSize.height);
- }
- }
- else
- {
- return new Dimension(0,0);
- }
+ // Sun's implementation simply throws a ClassCastException if
+ // parent is no JScrollPane, so do we.
+ JScrollPane sc = (JScrollPane) parent;
+ Dimension viewportSize = viewport.getMinimumSize();
+ int width = viewportSize.width;
+ int height = viewportSize.height;
+ if (hsb != null && hsb.isVisible())
+ height += hsb.getMinimumSize().height;
+ if (vsb != null && vsb.isVisible())
+ width += vsb.getMinimumSize().width;
+ if (rowHead != null && rowHead.isVisible())
+ width += rowHead.getMinimumSize().width;
+ if (colHead != null && colHead.isVisible())
+ height += colHead.getMinimumSize().height;
+ Insets i = sc.getInsets();
+ return new Dimension(width + i.left + i.right,
+ height + i.top + i.bottom);
}
/**
@@ -371,100 +324,91 @@ public class ScrollPaneLayout
*/
public void layoutContainer(Container parent)
{
- if (parent instanceof JScrollPane)
+ // Sun's implementation simply throws a ClassCastException if
+ // parent is no JScrollPane, so do we.
+ JScrollPane sc = (JScrollPane) parent;
+ JViewport viewport = sc.getViewport();
+ Dimension viewSize = viewport.getViewSize();
+
+ int x1 = 0, x2 = 0, x3 = 0, x4 = 0;
+ int y1 = 0, y2 = 0, y3 = 0, y4 = 0;
+ Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null);
+
+ x1 = scrollPaneBounds.x;
+ y1 = scrollPaneBounds.y;
+ x4 = scrollPaneBounds.x + scrollPaneBounds.width;
+ y4 = scrollPaneBounds.y + scrollPaneBounds.height;
+ if (colHead != null)
+ y2 = y1 + colHead.getPreferredSize().height;
+ else
+ y2 = y1;
+
+ if (rowHead != null)
+ x2 = x1 + rowHead.getPreferredSize().width;
+ else
+ x2 = x1;
+
+ int vsbPolicy = sc.getVerticalScrollBarPolicy();
+ int hsbPolicy = sc.getHorizontalScrollBarPolicy();
+
+ boolean showVsb =
+ (vsb != null)
+ && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS)
+ || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED
+ && viewSize.height > (y4 - y2)));
+ boolean showHsb =
+ (hsb != null)
+ && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS)
+ || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED
+ && viewSize.width > (x4 - x2)));
+
+ if (!showVsb)
+ x3 = x4;
+ else
+ x3 = x4 - vsb.getPreferredSize().width;
+
+ if (!showHsb)
+ y3 = y4;
+ else
+ y3 = y4 - hsb.getPreferredSize().height;
+
+ // now set the layout
+ if (viewport != null)
+ viewport.setBounds(new Rectangle(x2, y2, x3 - x2, y3 - y2));
+
+ if (colHead != null)
+ colHead.setBounds(new Rectangle(x2, y1, x3 - x2, y2 - y1));
+
+ if (rowHead != null)
+ rowHead.setBounds(new Rectangle(x1, y2, x2 - x1, y3 - y2));
+
+ if (showVsb)
+ {
+ vsb.setVisible(true);
+ vsb.setBounds(new Rectangle(x3, y2, x4 - x3, y3 - y2));
+ }
+ else if (vsb != null)
+ vsb.setVisible(false);
+
+ if (showHsb)
{
- JScrollPane sc = (JScrollPane) parent;
- synchronized (sc.getTreeLock ())
- {
- JViewport viewport = sc.getViewport();
- Dimension viewSize = viewport.getViewSize();
- Point viewPos = viewport.getViewPosition();
-
- int x1 = 0, x2 = 0, x3 = 0, x4 = 0;
- int y1 = 0, y2 = 0, y3 = 0, y4 = 0;
-
- Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null);
-
- x1 = scrollPaneBounds.x;
- y1 = scrollPaneBounds.y;
- x4 = scrollPaneBounds.x + scrollPaneBounds.width;
- y4 = scrollPaneBounds.y + scrollPaneBounds.height;
-
- if (colHead != null)
- y2 = y1 + colHead.getPreferredSize().height;
- else
- y2 = y1;
-
- if (rowHead != null)
- x2 = x1 + rowHead.getPreferredSize().width;
- else
- x2 = x1;
-
- int vsbPolicy = sc.getVerticalScrollBarPolicy();
- int hsbPolicy = sc.getHorizontalScrollBarPolicy();
-
- x3 = x4 - vsb.getPreferredSize().width;
- y3 = y4 - hsb.getPreferredSize().height;
-
- boolean showVsb =
- (vsb != null)
- && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS)
- || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED
- && viewSize.height > (y3 - y2)));
-
- boolean showHsb =
- (hsb != null)
- && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS)
- || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED
- && viewSize.width > (x3 - x2)));
-
- if (!showVsb)
- x3 = x4;
-
- if (!showHsb)
- y3 = y4;
-
- // now set the layout
-
- if (viewport != null)
- viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2));
-
- if (colHead != null)
- colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1));
-
- if (rowHead != null)
- rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2));
-
- if (showVsb)
- {
- vsb.setVisible(true);
- vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2));
- }
- else if (vsb != null)
- vsb.setVisible(false);
-
- if (showHsb)
- {
- hsb.setVisible(true);
- hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3));
- }
- else if (hsb != null)
- hsb.setVisible(false);
-
- if (upperLeft != null)
- upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1));
-
- if (upperRight != null)
- upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1));
-
- if (lowerLeft != null)
- lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3));
-
- if (lowerRight != null)
- lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3));
-
- }
+ hsb.setVisible(true);
+ hsb.setBounds(new Rectangle(x2, y3, x3 - x2, y4 - y3));
}
+ else if (hsb != null)
+ hsb.setVisible(false);
+
+ if (upperLeft != null)
+ upperLeft.setBounds(new Rectangle(x1, y1, x2 - x1, y2 - y1));
+
+ if (upperRight != null)
+ upperRight.setBounds(new Rectangle(x3, y1, x4 - x3, y2 - y1));
+
+ if (lowerLeft != null)
+ lowerLeft.setBounds(new Rectangle(x1, y3, x2 - x1, y4 - y3));
+
+ if (lowerRight != null)
+ lowerRight.setBounds(new Rectangle(x3, y3, x4 - x3, y4 - y3));
}
/**
diff --git a/libjava/classpath/javax/swing/Scrollable.java b/libjava/classpath/javax/swing/Scrollable.java
index 19732192330..9dce665d626 100644
--- a/libjava/classpath/javax/swing/Scrollable.java
+++ b/libjava/classpath/javax/swing/Scrollable.java
@@ -48,9 +48,16 @@ import java.awt.Rectangle;
*/
public interface Scrollable
{
- Dimension getPreferredScrollableViewportSize();
- int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction);
- int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction);
- boolean getScrollableTracksViewportWidth();
- boolean getScrollableTracksViewportHeight();
+ Dimension getPreferredScrollableViewportSize();
+
+ int getScrollableUnitIncrement(Rectangle visibleRect, int orientation,
+ int direction);
+
+ int getScrollableBlockIncrement(Rectangle visibleRect, int orientation,
+ int direction);
+
+ boolean getScrollableTracksViewportWidth();
+
+ boolean getScrollableTracksViewportHeight();
+
}
diff --git a/libjava/classpath/javax/swing/SingleSelectionModel.java b/libjava/classpath/javax/swing/SingleSelectionModel.java
index b5380c857a3..d57443b56bb 100644
--- a/libjava/classpath/javax/swing/SingleSelectionModel.java
+++ b/libjava/classpath/javax/swing/SingleSelectionModel.java
@@ -46,46 +46,41 @@ import javax.swing.event.ChangeListener;
*
* @author Andrew Selkirk
*/
-public interface SingleSelectionModel {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getSelectedIndex
- * @returns int
- */
- int getSelectedIndex();
-
- /**
- * setSelectedIndex
- * @param index TODO
- */
- void setSelectedIndex(int index);
-
- /**
- * clearSelection
- */
- void clearSelection();
-
- /**
- * isSelected
- * @returns boolean
- */
- boolean isSelected();
-
- /**
- * addChangeListener
- * @param listener TODO
- */
- void addChangeListener(ChangeListener listener);
-
- /**
- * removeChangeListener
- * @param listener TODO
- */
- void removeChangeListener(ChangeListener listener);
-
-
-} // SingleSelectionModel
+public interface SingleSelectionModel
+{
+ /**
+ * getSelectedIndex
+ * @returns int
+ */
+ int getSelectedIndex();
+
+ /**
+ * setSelectedIndex
+ * @param index TODO
+ */
+ void setSelectedIndex(int index);
+
+ /**
+ * clearSelection
+ */
+ void clearSelection();
+
+ /**
+ * isSelected
+ * @returns boolean
+ */
+ boolean isSelected();
+
+ /**
+ * addChangeListener
+ * @param listener TODO
+ */
+ void addChangeListener(ChangeListener listener);
+
+ /**
+ * removeChangeListener
+ * @param listener TODO
+ */
+ void removeChangeListener(ChangeListener listener);
+
+}
diff --git a/libjava/classpath/javax/swing/SizeRequirements.java b/libjava/classpath/javax/swing/SizeRequirements.java
index 77b42db1ce9..b9b5c322379 100644
--- a/libjava/classpath/javax/swing/SizeRequirements.java
+++ b/libjava/classpath/javax/swing/SizeRequirements.java
@@ -116,7 +116,17 @@ public class SizeRequirements implements Serializable
*/
public String toString()
{
- return null; // TODO
+ StringBuilder b = new StringBuilder();
+ b.append("<[");
+ b.append(minimum);
+ b.append(',');
+ b.append(preferred);
+ b.append(',');
+ b.append(maximum);
+ b.append("]@");
+ b.append(alignment);
+ b.append('>');
+ return b.toString();
}
/**
@@ -132,13 +142,26 @@ public class SizeRequirements implements Serializable
public static SizeRequirements
getTiledSizeRequirements(SizeRequirements[] children)
{
- SizeRequirements result = new SizeRequirements();
+ long minimum = 0;
+ long preferred = 0;
+ long maximum = 0;
for (int i = 0; i < children.length; i++)
{
- result.minimum += children[i].minimum;
- result.preferred += children[i].preferred;
- result.maximum += children[i].maximum;
+ minimum += children[i].minimum;
+ preferred += children[i].preferred;
+ maximum += children[i].maximum;
}
+ // Overflow check.
+ if (minimum > Integer.MAX_VALUE)
+ minimum = Integer.MAX_VALUE;
+ if (preferred > Integer.MAX_VALUE)
+ preferred = Integer.MAX_VALUE;
+ if (maximum > Integer.MAX_VALUE)
+ maximum = Integer.MAX_VALUE;
+ SizeRequirements result = new SizeRequirements((int) minimum,
+ (int) preferred,
+ (int) maximum,
+ 0.5F);
return result;
}
@@ -156,7 +179,34 @@ public class SizeRequirements implements Serializable
public static SizeRequirements
getAlignedSizeRequirements(SizeRequirements[] children)
{
- return null; // TODO
+ float minLeft = 0;
+ float minRight = 0;
+ float prefLeft = 0;
+ float prefRight = 0;
+ float maxLeft = 0;
+ float maxRight = 0;
+ for (int i = 0; i < children.length; i++)
+ {
+ float myMinLeft = children[i].minimum * children[i].alignment;
+ float myMinRight = children[i].minimum - myMinLeft;
+ minLeft = Math.max(myMinLeft, minLeft);
+ minRight = Math.max(myMinRight, minRight);
+ float myPrefLeft = children[i].preferred * children[i].alignment;
+ float myPrefRight = children[i].preferred - myPrefLeft;
+ prefLeft = Math.max(myPrefLeft, prefLeft);
+ prefRight = Math.max(myPrefRight, prefRight);
+ float myMaxLeft = children[i].maximum * children[i].alignment;
+ float myMaxRight = children[i].maximum - myMaxLeft;
+ maxLeft = Math.max(myMaxLeft, maxLeft);
+ maxRight = Math.max(myMaxRight, maxRight);
+ }
+ int minSize = (int) (minLeft + minRight);
+ int prefSize = (int) (prefLeft + prefRight);
+ int maxSize = (int) (maxLeft + maxRight);
+ float align = prefLeft / (prefRight + prefLeft);
+ if (Float.isNaN(align))
+ align = 0;
+ return new SizeRequirements(minSize, prefSize, maxSize, align);
}
/**
@@ -222,6 +272,7 @@ public class SizeRequirements implements Serializable
int[] offsets, int[] spans,
boolean forward)
{
+ int span = 0;
if (forward)
{
int offset = 0;
@@ -229,6 +280,7 @@ public class SizeRequirements implements Serializable
{
offsets[i] = offset;
spans[i] = children[i].preferred;
+ span += spans[i];
offset += children[i].preferred;
}
}
@@ -239,9 +291,84 @@ public class SizeRequirements implements Serializable
{
offset -= children[i].preferred;
offsets[i] = offset;
+ span += spans[i];
spans[i] = children[i].preferred;
}
}
+ // Adjust spans so that we exactly fill the allocated region. If
+ if (span > allocated)
+ adjustSmaller(allocated, children, spans, span);
+ else if (span < allocated)
+ adjustGreater(allocated, children, spans, span);
+
+ // Adjust offsets.
+ if (forward)
+ {
+ int offset = 0;
+ for (int i = 0; i < children.length; i++)
+ {
+ offsets[i] = offset;
+ offset += spans[i];
+ }
+ }
+ else
+ {
+ int offset = allocated;
+ for (int i = 0; i < children.length; i++)
+ {
+ offset -= spans[i];
+ offsets[i] = offset;
+ }
+ }
+ }
+
+ private static void adjustSmaller(int allocated, SizeRequirements[] children,
+ int[] spans, int span)
+ {
+ // Sum up (prefSize - minSize) over all children
+ int sumDelta = 0;
+ for (int i = 0; i < children.length; i++)
+ sumDelta += children[i].preferred - children[i].minimum;
+
+ // If we have sumDelta == 0, then all components have prefSize == maxSize
+ // and we can't do anything about it.
+ if (sumDelta == 0)
+ return;
+
+ // Adjust all sizes according to their preferred and minimum sizes.
+ for (int i = 0; i < children.length; i++)
+ {
+ double factor = ((double) (children[i].preferred - children[i].minimum))
+ / ((double) sumDelta);
+ // In case we have a sumDelta of 0, the factor should also be 0.
+ if (Double.isNaN(factor))
+ factor = 0;
+ spans[i] -= factor * (span - allocated);
+ }
+ }
+
+ private static void adjustGreater(int allocated, SizeRequirements[] children,
+ int[] spans, int span)
+ {
+ // Sum up (maxSize - prefSize) over all children
+ long sumDelta = 0;
+ for (int i = 0; i < children.length; i++)
+ {
+ sumDelta += children[i].maximum - children[i].preferred;
+ }
+
+ // If we have sumDelta == 0, then all components have prefSize == maxSize
+ // and we can't do anything about it.
+ if (sumDelta == 0)
+ return;
+
+ // Adjust all sizes according to their preferred and minimum sizes.
+ for (int i = 0; i < children.length; i++)
+ {
+ double factor = ((double) (children[i].maximum - children[i].preferred))
+ / ((double) sumDelta);
+ spans[i] += factor * (allocated - span);
+ }
}
/**
@@ -271,7 +398,8 @@ public class SizeRequirements implements Serializable
SizeRequirements[] children,
int[] offsets, int[] spans)
{
- calculateTiledPositions(allocated, total, children, offsets, spans, true);
+ calculateAlignedPositions(allocated, total, children, offsets, spans,
+ true);
}
/**
@@ -306,7 +434,74 @@ public class SizeRequirements implements Serializable
int[] offset, int[] spans,
boolean forward)
{
- // TODO
+ // First we compute the position of the baseline.
+ float baseline = allocated * total.alignment;
+
+ // Now we can layout the components along the baseline.
+ for (int i = 0; i < children.length; i++)
+ {
+ float align = children[i].alignment;
+ // Try to fit the component into the available space.
+ int[] spanAndOffset = new int[2];
+ if (align < .5F || baseline == 0)
+ adjustFromRight(children[i], baseline, allocated, spanAndOffset);
+ else
+ adjustFromLeft(children[i], baseline, allocated, spanAndOffset);
+ spans[i] = spanAndOffset[0];
+ offset[i] = spanAndOffset[1];
+ }
+ }
+
+ /**
+ * Adjusts the span and offset of a component for the aligned layout.
+ *
+ * @param reqs
+ * @param baseline
+ * @param allocated
+ * @param spanAndOffset
+ */
+ private static void adjustFromRight(SizeRequirements reqs, float baseline,
+ int allocated, int[] spanAndOffset)
+ {
+ float right = allocated - baseline;
+ // If the resulting span exceeds the maximum of the component, then adjust
+ // accordingly.
+ float maxRight = ((float) reqs.maximum) * (1.F - reqs.alignment);
+ if (right / (1.F - reqs.alignment) > reqs.maximum)
+ right = maxRight;
+ // If we have not enough space on the left side, then adjust accordingly.
+ if (right / (1.F - reqs.alignment) * reqs.alignment > allocated - baseline)
+ right = ((float) (allocated - baseline))
+ / reqs.alignment * (1.F - reqs.alignment);
+
+ spanAndOffset[0] = (int) (right / (1.F - reqs.alignment));
+ spanAndOffset[1] = (int) (baseline - spanAndOffset[0] * reqs.alignment);
+ }
+
+ /**
+ * Adjusts the span and offset of a component for the aligned layout.
+ *
+ * @param reqs
+ * @param baseline
+ * @param allocated
+ * @param spanAndOffset
+ */
+ private static void adjustFromLeft(SizeRequirements reqs, float baseline,
+ int allocated, int[] spanAndOffset)
+ {
+ float left = baseline;
+ // If the resulting span exceeds the maximum of the component, then adjust
+ // accordingly.
+ float maxLeft = ((float) reqs.maximum) * reqs.alignment;
+ if (left / reqs.alignment > reqs.maximum)
+ left = maxLeft;
+ // If we have not enough space on the right side, then adjust accordingly.
+ if (left / reqs.alignment * (1.F - reqs.alignment) > allocated - baseline)
+ left = ((float) (allocated - baseline))
+ / (1.F - reqs.alignment) * reqs.alignment;
+
+ spanAndOffset[0] = (int) (left / reqs.alignment);
+ spanAndOffset[1] = (int) (baseline - spanAndOffset[0] * reqs.alignment);
}
/**
diff --git a/libjava/classpath/javax/swing/SizeSequence.java b/libjava/classpath/javax/swing/SizeSequence.java
index cf6e5f042a1..dff966b3e35 100644
--- a/libjava/classpath/javax/swing/SizeSequence.java
+++ b/libjava/classpath/javax/swing/SizeSequence.java
@@ -42,208 +42,197 @@ package javax.swing;
* @author Andrew Selkirk
* @version 1.0
*/
-public class SizeSequence {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * sizes
- */
- private int[] sizes = new int[0];
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor SizeSequence
- */
- public SizeSequence() {
- sizes = new int[0];
- } // SizeSequence()
-
- /**
- * Constructor SizeSequence
- * @param numEntries TODO
- */
- public SizeSequence(int numEntries) {
- this(numEntries, 0);
- } // SizeSequence()
-
- /**
- * Constructor SizeSequence
- * @param numEntries TODO
- * @param value TODO
- */
- public SizeSequence(int numEntries, int value) {
- insertEntries(0, numEntries, value);
- } // SizeSequence()
-
- /**
- * Constructor SizeSequence
- * @param sizes TODO
- */
- public SizeSequence(int[] sizes) {
- setSizes(sizes);
- } // SizeSequence()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * setSize
- * @param index TODO
- * @param size TODO
- */
- public void setSize(int index, int size) {
- sizes[index] = size;
- } // setSize()
-
- /**
- * getIndex
- * @param position TODO
- * @returns int
- */
- public int getIndex(int position) {
- return 0; // TODO
- } // getIndex()
-
- /**
- * getSize
- * @param index TODO
- * @returns int
- */
- public int getSize(int index) {
- return sizes[index];
- } // getSize()
-
- /**
- * setSizes
- * @param sizes TODO
- */
- public void setSizes(int[] sizes) {
-
- // Variables
- int index;
-
- // Initialize Sizes
- this.sizes = new int[sizes.length];
- for (index = 0; index < sizes.length; index++) {
- this.sizes[index] = sizes[index];
- } // for
-
- } // setSizes()
-
- /**
- * getSizes
- * @returns int[]
- */
- public int[] getSizes() {
-
- // Variables
- int[] array;
- int index;
-
- // Create New Array
- array = new int[sizes.length];
- for (index = 0; index < sizes.length; index++) {
- array[index] = sizes[index];
- } // for
-
- // Return Newly created array
- return array;
-
- } // getSizes()
-
- /**
- * getPosition
- * @param index TODO
- * @returns int
- */
- public int getPosition(int index) {
-
- // Variables
- int position;
- int loop;
-
- // Process Sizes
- position = 0;
- for (loop = 0; loop < index; loop++) {
- position += sizes[loop];
- } // for
-
- // Return Position
- return position;
-
- } // getPosition()
-
- /**
- * insertEntries
- * @param start TODO
- * @param length TODO
- * @param value TODO
- */
- public void insertEntries(int start, int length, int value) {
-
- // Variables
- 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++;
- } // for
- } else {
- array[arrayIndex] = sizes[index];
- arrayIndex++;
- } // if
- } // for
-
- } // insertEntries()
-
- /**
- * removeEntries
- * @param start TODO
- * @param length TODO
- */
- public void removeEntries(int start, int length) {
-
- // Variables
- 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");
- } // if
-
- // 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++;
- } // if
- } // for
-
- } // removeEntries()
-
-
-} // SizeSequence
+public class SizeSequence
+{
+
+ /**
+ * sizes
+ */
+ private int[] sizes = new int[0];
+
+ /**
+ * Constructor SizeSequence
+ */
+ public SizeSequence()
+ {
+ sizes = new int[0];
+ }
+
+ /**
+ * Constructor SizeSequence
+ * @param numEntries TODO
+ */
+ public SizeSequence(int numEntries)
+ {
+ this(numEntries, 0);
+ }
+
+ /**
+ * Constructor SizeSequence
+ * @param numEntries TODO
+ * @param value TODO
+ */
+ public SizeSequence(int numEntries, int value)
+ {
+ insertEntries(0, numEntries, value);
+ }
+
+ /**
+ * Constructor SizeSequence
+ * @param sizes TODO
+ */
+ public SizeSequence(int[] sizes)
+ {
+ setSizes(sizes);
+ }
+
+ /**
+ * setSize
+ * @param index TODO
+ * @param size TODO
+ */
+ public void setSize(int index, int size)
+ {
+ sizes[index] = size;
+ }
+
+ /**
+ * getIndex
+ * @param position TODO
+ * @returns int
+ */
+ public int getIndex(int position)
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * getSize
+ * @param index TODO
+ * @returns int
+ */
+ public int getSize(int index)
+ {
+ return sizes[index];
+ }
+
+ /**
+ * setSizes
+ * @param sizes TODO
+ */
+ 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];
+
+ }
+
+ /**
+ * getSizes
+ * @returns int[]
+ */
+ 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;
+
+ }
+
+ /**
+ * getPosition
+ * @param index TODO
+ * @returns int
+ */
+ 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
+ */
+ 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++;
+ }
+ }
+
+ }
+
+ /**
+ * removeEntries
+ * @param start TODO
+ * @param length TODO
+ */
+ 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++;
+ }
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java b/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
index fada17c6339..96ef3832955 100644
--- a/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
+++ b/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
@@ -72,7 +72,7 @@ public class SortingFocusTraversalPolicy
* simply advance within the containing focus cycle, subject to the
* {@link #comparator} order and the {@link #accept} judgment.</p>
*
- * @see #getNextFocusableComponent
+ * @see #getImplicitDownCycleTraversal()
*/
boolean implicitDownCycleTraversal = true;
diff --git a/libjava/classpath/javax/swing/SpinnerListModel.java b/libjava/classpath/javax/swing/SpinnerListModel.java
index 85dc4efa6f1..d8e2f22d585 100644
--- a/libjava/classpath/javax/swing/SpinnerListModel.java
+++ b/libjava/classpath/javax/swing/SpinnerListModel.java
@@ -68,231 +68,228 @@ import javax.swing.event.ChangeEvent;
* @since 1.4
*/
-public class SpinnerListModel
- extends AbstractSpinnerModel
- implements Serializable
+public class SpinnerListModel extends AbstractSpinnerModel
+ implements Serializable
{
- /**
- * For compatability with Sun's JDK
- */
- private static final long serialVersionUID = 3358804052191994516L;
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 3358804052191994516L;
- /**
- * The backing list for this model.
- */
- private List list;
+ /**
+ * The backing list for this model.
+ */
+ private List list;
- /**
- * The current index in the list.
- */
- private transient int index;
+ /**
+ * The current index in the list.
+ */
+ private transient int index;
- /**
- * Constructs a default <code>SpinnerListModel</code>. This
- * is a model backed by a list containing only the single
- * <code>String</code> element, "empty".
- */
- public SpinnerListModel()
- {
- List defaultList;
+ /**
+ * Constructs a default <code>SpinnerListModel</code>. This
+ * is a model backed by a list containing only the single
+ * <code>String</code> element, "empty".
+ */
+ public SpinnerListModel()
+ {
+ List defaultList;
- /* Create an empty list */
- defaultList = new ArrayList();
- /* Add the string "empty" */
- defaultList.add("empty");
- /* Set the list */
- setList(defaultList);
- }
+ // Create an empty list.
+ defaultList = new ArrayList();
+ // Add the string "empty".
+ defaultList.add("empty");
+ // Set the list.
+ setList(defaultList);
+ }
- /**
- * Constructs a <code>SpinnerListModel</code> using the supplied list.
- * The model maintains a reference to this list, and returns
- * consecutive elements in response to calls to <code>getNextValue()</code>.
- * The initial value is that at position 0, so an initial call
- * to <code>getValue()</code> returns the same as <code>list.get(0)</code>.
- *
- * @param list The list to use for this model.
- * @throws IllegalArgumentException if the list is null or contains no
- * elements.
- * @see SpinnerListModel#getNextValue()
- * @see SpinnerListModel#getValue()
- */
- public SpinnerListModel(List list)
- {
- /* Retain a reference to the valid list */
- setList(list);
- }
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied list.
+ * The model maintains a reference to this list, and returns
+ * consecutive elements in response to calls to <code>getNextValue()</code>.
+ * The initial value is that at position 0, so an initial call
+ * to <code>getValue()</code> returns the same as <code>list.get(0)</code>.
+ *
+ * @param list The list to use for this model.
+ *
+ * @throws IllegalArgumentException if the list is null or contains no
+ * elements.
+ *
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(List list)
+ {
+ // Retain a reference to the valid list.
+ setList(list);
+ }
- /**
- * Constructs a <code>SpinnerListModel</code> using the supplied array.
- * The model stores a reference to the wrapper list returned by
- * <code>Arrays.asList()</code>. The wrapper list reflects modifications
- * in the underlying array, so these changes will also be reflected
- * by the model. The model produces consecutive elements from the array
- * in response to calls to <code>getNextValue()</code>. The initial
- * value returned by <code>getValue()</code> is the same as
- * <code>array[0]</code>.
- *
- * @param array The array to use for this model.
- * @throws IllegalArgumentException if the array is null or contains
- * no elements.
- * @see Arrays#asList(Object[])
- * @see SpinnerListModel#getNextValue()
- * @see SpinnerListModel#getValue()
- */
- public SpinnerListModel(Object[] array)
- {
- /* Check for a null or zero-sized array */
- if (array == null || array.length == 0)
- {
- throw new IllegalArgumentException("The supplied array was invalid.");
- }
- /*
- Retain a reference to a wrapper around the valid array
- The array, in list form, will be tested again here, but we can't really
- avoid this -- a null value to Arrays.asList will throw a NullPointerException
- */
- setList(Arrays.asList(array));
- }
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied array.
+ * The model stores a reference to the wrapper list returned by
+ * <code>Arrays.asList()</code>. The wrapper list reflects modifications
+ * in the underlying array, so these changes will also be reflected
+ * by the model. The model produces consecutive elements from the array
+ * in response to calls to <code>getNextValue()</code>. The initial
+ * value returned by <code>getValue()</code> is the same as
+ * <code>array[0]</code>.
+ *
+ * @param array The array to use for this model.
+ *
+ * @throws IllegalArgumentException if the array is null or contains
+ * no elements.
+ *
+ * @see Arrays#asList(Object[])
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(Object[] array)
+ {
+ // Check for a null or zero-sized array.
+ if (array == null || array.length == 0)
+ {
+ throw new IllegalArgumentException("The supplied array was invalid.");
+ }
- /**
- * Returns the backing list for this model.
- *
- * @return The backing list.
- */
- public List getList()
- {
- return list;
- }
+ // Retain a reference to a wrapper around the valid array.
+ // The array, in list form, will be tested again here, but we can't really
+ // avoid this -- a null value to Arrays.asList will throw a
+ // NullPointerException.
+ setList(Arrays.asList(array));
+ }
+
+ /**
+ * Returns the backing list for this model.
+ *
+ * @return The backing list.
+ */
+ public List getList()
+ {
+ return list;
+ }
- /**
- * Returns the next value from the list, which is the same as the element
- * stored at the current index + 1. Null is returned if there are no more
- * values to be returned (the end of the list has been reached). An
- * ambiguity can occur here, as null may also be returned as a valid list
- * element. This operation does not change the current value.
- *
- * @return The next value from the list or null.
- */
- public Object getNextValue()
- {
- /* Check for a next value */
- if (index < (list.size() - 1))
- {
- /* Return the element at the next index */
- return list.get(index + 1);
- }
- else
- {
- /* Return null as this is the end of the list */
- return null;
- }
+ /**
+ * Returns the next value from the list, which is the same as the element
+ * stored at the current index + 1. Null is returned if there are no more
+ * values to be returned (the end of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The next value from the list or null.
+ */
+ public Object getNextValue()
+ {
+ // Check for a next value.
+ if (index < (list.size() - 1))
+ // Return the element at the next index.
+ return list.get(index + 1);
+ else
+ // Return null as this is the end of the list.
+ return null;
}
- /**
- * Returns the previous value from the list, which is the same as the element
- * stored at the current index - 1. Null is returned if there are no more
- * values to be returned (the start of the list has been reached). An
- * ambiguity can occur here, as null may also be returned as a valid list
- * element. This operation does not change the current value.
- *
- * @return The previous value from the list or null.
- */
- public Object getPreviousValue()
- {
- /* Check for a previous value. */
- if (index > 0)
- {
- /* Return the element at the previous position */
- return list.get(index - 1);
- }
+ /**
+ * Returns the previous value from the list, which is the same as the element
+ * stored at the current index - 1. Null is returned if there are no more
+ * values to be returned (the start of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The previous value from the list or null.
+ */
+ public Object getPreviousValue()
+ {
+ // Check for a previous value.
+ if (index > 0)
+ // Return the element at the previous position.
+ return list.get(index - 1);
else
- {
- /* Return null as this is the start of the list */
- return null;
- }
+ // Return null as this is the start of the list.
+ return null;
}
- /**
- * Returns the current value of the model. Initially, this will
- * be the element at position 0. On later invocations, this will
- * be the last element returned by <code>getNextValue()</code>
- * or <code>getPreviousValue()</code>.
- *
- * @return The current value.
- * @see SpinnerListModel#getPreviousValue()
- * @see SpinnerListModel#getNextValue()
- */
- public Object getValue()
- {
- return list.get(index);
- }
+ /**
+ * Returns the current value of the model. Initially, this will
+ * be the element at position 0. On later invocations, this will
+ * be the last element returned by <code>getNextValue()</code>
+ * or <code>getPreviousValue()</code>.
+ *
+ * @return The current value.
+ *
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public Object getValue()
+ {
+ return list.get(index);
+ }
- /**
- * Changes the backing list for this model. The model only stores
- * a reference to the list, so any changes made to the list elsewhere
- * will be reflected in the values returned by the model. A
- * <code>ChangeEvent</code> is fired if the list being used actually
- * changes (i.e. the new list is not referentially equal (!=) to the
- * old one).
- *
- * @param list The new list to use.
- * @throws IllegalArgumentException if the list is null or contains
- * no elements.
- * @see ChangeEvent
- */
- public void setList(List list)
- {
- /* Check for null or zero size list */
- if (list == null || list.size() == 0)
- {
- throw new IllegalArgumentException("The supplied list was invalid.");
- }
- /* Check for a change of referenced list */
- if (this.list != list)
- {
- /* Store the new list */
- this.list = list;
- /* Notify listeners of a change */
- fireStateChanged();
- }
- /* We reset the other values in either case */
- /* Set the index to 0 */
- index = 0;
- }
+ /**
+ * Changes the backing list for this model. The model only stores
+ * a reference to the list, so any changes made to the list elsewhere
+ * will be reflected in the values returned by the model. A
+ * <code>ChangeEvent</code> is fired if the list being used actually
+ * changes (i.e. the new list is not referentially equal (!=) to the
+ * old one).
+ *
+ * @param list The new list to use.
+ *
+ * @throws IllegalArgumentException if the list is null or contains
+ * no elements.
+ *
+ * @see ChangeEvent
+ */
+ public void setList(List list)
+ {
+ // Check for null or zero size list.
+ if (list == null || list.size() == 0)
+ throw new IllegalArgumentException("The supplied list was invalid.");
- /**
- * Sets the current value of the model to be the one supplied.
- * The value must exist within the backing list in order for
- * the change to take place. Otherwise, an exception is thrown.
- * The value used is the first occurrence of the value within
- * the backing list. Listeners are notified of this change.
- * Following the change, <code>getNextValue()</code> and
- * <code>getPreviousValue()</code> return the objects following
- * and prior to the supplied value, respectively.
- *
- * @param value The requested new value of the list.
- * @throws IllegalArgumentException if the supplied value does
- * not exist in the backing list.
- * @see SpinnerListModel#getPreviousValue()
- * @see SpinnerListModel#getNextValue()
- */
- public void setValue(Object value)
- {
- int valueIndex;
+ // Check for a change of referenced list.
+ if (this.list != list)
+ {
+ // Store the new list.
+ this.list = list;
+ // Notify listeners of a change.
+ fireStateChanged();
+ }
+ // We reset the other values in either case.
+ // Set the index to 0.
+ index = 0;
+ }
- /* Search for the value in the list */
- valueIndex = list.indexOf(value);
- /* Check for the value being found */
- if (valueIndex == -1)
- {
- throw new IllegalArgumentException("The supplied value does not "
- + "exist in this list");
- }
- /* Make the indices match */
- index = valueIndex;
- /* Notify the listeners */
- fireStateChanged();
- }
+ /**
+ * Sets the current value of the model to be the one supplied.
+ * The value must exist within the backing list in order for
+ * the change to take place. Otherwise, an exception is thrown.
+ * The value used is the first occurrence of the value within
+ * the backing list. Listeners are notified of this change.
+ * Following the change, <code>getNextValue()</code> and
+ * <code>getPreviousValue()</code> return the objects following
+ * and prior to the supplied value, respectively.
+ *
+ * @param value The requested new value of the list.
+ *
+ * @throws IllegalArgumentException if the supplied value does
+ * not exist in the backing list.
+ *
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public void setValue(Object value)
+ {
+ int valueIndex;
+
+ // Search for the value in the list.
+ valueIndex = list.indexOf(value);
+ // Check for the value being found.
+ if (valueIndex == -1)
+ throw new IllegalArgumentException("The supplied value does not "
+ + "exist in this list");
+ // Make the indices match.
+ index = valueIndex;
+ // Notify the listeners.
+ fireStateChanged();
+ }
}
diff --git a/libjava/classpath/javax/swing/Spring.java b/libjava/classpath/javax/swing/Spring.java
index 69c88c77d96..8f7105d496d 100644
--- a/libjava/classpath/javax/swing/Spring.java
+++ b/libjava/classpath/javax/swing/Spring.java
@@ -65,6 +65,7 @@ public abstract class Spring
*/
protected Spring()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/SpringLayout.java b/libjava/classpath/javax/swing/SpringLayout.java
index df9ddffb654..592cc0e02a9 100644
--- a/libjava/classpath/javax/swing/SpringLayout.java
+++ b/libjava/classpath/javax/swing/SpringLayout.java
@@ -395,46 +395,40 @@ public class SpringLayout implements LayoutManager2
public SpringLayout.Constraints getConstraints(Component c)
{
Constraints constraints = (Constraints) constraintsMap.get(c);
+
if (constraints == null)
{
Container parent = c.getParent();
constraints = new Constraints();
+
if (parent != null)
{
- constraints.setX
- (Spring.constant(parent.getInsets().left));
- constraints.setY
- (Spring.constant(parent.getInsets().top));
+ constraints.setX(Spring.constant(parent.getInsets().left));
+ constraints.setY(Spring.constant(parent.getInsets().top));
}
else
{
- constraints.setX
- (Spring.constant(0));
- constraints.setY
- (Spring.constant(0));
-
+ constraints.setX(Spring.constant(0));
+ constraints.setY(Spring.constant(0));
}
- constraints.setWidth
- (Spring.constant(c.getMinimumSize().width,
- c.getPreferredSize().width,
- c.getMaximumSize().width));
- constraints.setHeight
- (Spring.constant(c.getMinimumSize().height,
- c.getPreferredSize().height,
- c.getMaximumSize().height));
-
- constraintsMap.put(c, constraints);
-
}
+ constraints.setWidth(Spring.constant(c.getMinimumSize().width,
+ c.getPreferredSize().width,
+ c.getMaximumSize().width));
+ constraints.setHeight(Spring.constant(c.getMinimumSize().height,
+ c.getPreferredSize().height,
+ c.getMaximumSize().height));
+ constraintsMap.put(c, constraints);
return constraints;
}
/**
* Returns the X alignment of the Container <code>p</code>.
- *
- * @param p the {@link java.awt.Container} for which to determine the X
- * alignment.
+ *
+ * @param p
+ * the {@link java.awt.Container} for which to determine the X
+ * alignment.
* @return always 0.0
*/
public float getLayoutAlignmentX(Container p)
@@ -480,6 +474,7 @@ public class SpringLayout implements LayoutManager2
for (int index = 0; index < components.length; index++)
{
Component c = components[index];
+
Constraints constraints = getConstraints(c);
int x = constraints.getX().getValue();
int y = constraints.getY().getValue();
@@ -597,7 +592,6 @@ public class SpringLayout implements LayoutManager2
if (bottomEdge > maxY)
maxY = bottomEdge;
}
-
return new Dimension(maxX, maxY);
}
@@ -621,7 +615,6 @@ public class SpringLayout implements LayoutManager2
Spring strut = Spring.constant(pad);
Spring otherEdge = constraints2.getConstraint(e2);
constraints1.setConstraint(e1, Spring.sum(strut, otherEdge));
-
}
/**
diff --git a/libjava/classpath/javax/swing/SwingUtilities.java b/libjava/classpath/javax/swing/SwingUtilities.java
index ee5fa74d47a..58b3a78d7aa 100644
--- a/libjava/classpath/javax/swing/SwingUtilities.java
+++ b/libjava/classpath/javax/swing/SwingUtilities.java
@@ -840,7 +840,7 @@ public class SwingUtilities
iconR.width = icon.getIconWidth();
iconR.height = icon.getIconHeight();
}
- if (text == null)
+ if (text == null || text.equals(""))
{
textIconGap = 0;
textR.width = 0;
@@ -890,7 +890,7 @@ public class SwingUtilities
iconR.y = 0;
textR.y = (horizontalTextPosition == CENTER
? iconR.height + textIconGap
- : iconR.height - textR.height);
+ : Math.max(iconR.height - textR.height, 0));
break;
case CENTER:
int centerLine = Math.max(textR.height, iconR.height) / 2;
@@ -1116,7 +1116,7 @@ public class SwingUtilities
* <pre>
* [{@link javax.swing.JComponent#getActionMap()}]
* --&gt; [{@link javax.swing.ActionMap}]
- * parent --&gt; [{@link javax.swing.text.KeymapActionMap}]
+ * parent --&gt; [{@link javax.swing.text.JTextComponent.KeymapActionMap}]
* parent --&gt; [{@link javax.swing.plaf.ActionMapUIResource}]
* </pre>
*
@@ -1138,14 +1138,12 @@ public class SwingUtilities
else
{
ActionMap parent = child.getParent();
- while(parent != null)
+ while (parent != null && !(parent instanceof ActionMapUIResource))
{
child = parent;
parent = child.getParent();
}
-
- if (child != null)
- child.setParent(uiActionMap);
+ child.setParent(uiActionMap);
}
}
@@ -1159,7 +1157,7 @@ public class SwingUtilities
* <pre>
* [{@link javax.swing.JComponent#getInputMap()}]
* --&gt; [{@link javax.swing.InputMap}]
- * parent --&gt; [{@link javax.swing.text.KeymapWrapper}]
+ * parent --&gt; [{@link javax.swing.text.JTextComponent.KeymapWrapper}]
* parent --&gt; [{@link javax.swing.plaf.InputMapUIResource}]
* </pre>
*
@@ -1181,11 +1179,13 @@ public class SwingUtilities
component.setInputMap(condition, uiInputMap);
else
{
- while(child.getParent() != null
- && !(child.getParent() instanceof InputMapUIResource))
- child = child.getParent();
- if (child != null)
- child.setParent(uiInputMap);
+ InputMap parent = child.getParent();
+ while (parent != null && !(parent instanceof InputMapUIResource))
+ {
+ child = parent;
+ parent = parent.getParent();
+ }
+ child.setParent(uiInputMap);
}
}
diff --git a/libjava/classpath/javax/swing/Timer.java b/libjava/classpath/javax/swing/Timer.java
index 87f420a4367..cf91c23e8ec 100644
--- a/libjava/classpath/javax/swing/Timer.java
+++ b/libjava/classpath/javax/swing/Timer.java
@@ -46,7 +46,12 @@ import java.util.EventListener;
import javax.swing.event.EventListenerList;
/**
- * Fires one or more action events after the specified delay.
+ * Fires one or more action events after the specified delay. This is
+ * a specialised version of <code>java.util.Timer</code> just for
+ * firing <code>ActionEvent</code>s. All Timers share one (daemon)
+ * Thread (or java.util.Timer). All events are fired from the event
+ * queue.
+ *
* @author Ronald Veldema
* @author Audrius Meskauskas (audriusa@Bionformatics.org) - bug fixes
* and documentation comments
@@ -55,48 +60,19 @@ public class Timer
implements Serializable
{
/**
- * The timer thread
+ * Given to the shared java.util.Timer to (possibly repeatedly) call
+ * queueEvent().
*/
- private class Waker
- extends Thread
+ private class Task extends java.util.TimerTask
{
- /**
- * Fires events, pausing for required intervals.
- */
public void run()
{
- running = true;
- try
- {
- sleep(initialDelay);
-
- queueEvent();
-
- while (running)
- {
- try
- {
- sleep(delay);
- }
- catch (InterruptedException e)
- {
- return;
- }
- queueEvent();
-
- if (logTimers)
- System.out.println("javax.swing.Timer -> clocktick");
-
- if ( ! repeats)
- break;
- }
- running = false;
- }
- catch (Exception e)
- {
- // The timer is no longer running.
- running = false;
- }
+ if (logTimers)
+ System.out.println("javax.swing.Timer -> queueEvent()");
+ queueEvent();
+
+ if (!repeats)
+ task = null;
}
}
@@ -118,6 +94,14 @@ public class Timer
};
/**
+ * The static java.util.Timer daemon which will be used to schedule
+ * all javax.swing.Timer.Task objects. The daemon will always be
+ * running, even if there's no task scheduled in it.
+ */
+ private static java.util.Timer timer = new java.util.Timer("swing.Timer",
+ true);
+
+ /**
* If <code>true</code>, the timer prints a message to
* {@link System#out} when firing each event.
*/
@@ -139,12 +123,6 @@ public class Timer
boolean repeats = true;
/**
- * <code>true</code> if the timer is currently active, firing events
- * as scheduled.
- */
- boolean running;
-
- /**
* The delay between subsequent repetetive events.
*/
int delay;
@@ -162,10 +140,9 @@ public class Timer
int ticks;
/**
- * Stores the thread that posts events to the queue at required time
- * intervals.
+ * The task that calls queueEvent(). When null this Timer is stopped.
*/
- private Waker waker;
+ private Task task;
/**
* This object manages a "queue" of virtual actionEvents, maintained as a
@@ -360,7 +337,7 @@ public class Timer
*/
public boolean isRunning()
{
- return running;
+ return task != null;
}
/**
@@ -398,10 +375,16 @@ public class Timer
*/
public void start()
{
- if (isRunning())
- return;
- waker = new Waker();
- waker.start();
+ Task t = task;
+ if (t == null)
+ {
+ t = new Task();
+ if (isRepeats())
+ timer.schedule(t, getInitialDelay(), getDelay());
+ else
+ timer.schedule(t, getInitialDelay());
+ task = t;
+ }
}
/**
@@ -409,12 +392,11 @@ public class Timer
*/
public void stop()
{
- running = false;
- if (waker != null)
- waker.interrupt();
- synchronized (queueLock)
+ Task t = task;
+ if (t != null)
{
- queue = 0;
+ t.cancel();
+ task = null;
}
}
@@ -475,11 +457,11 @@ public class Timer
*/
void queueEvent()
{
- synchronized (queueLock)
+ synchronized(queueLock)
{
- queue++;
- if (queue == 1)
- SwingUtilities.invokeLater(drainer);
+ queue++;
+ if (queue == 1)
+ SwingUtilities.invokeLater(drainer);
}
}
}
diff --git a/libjava/classpath/javax/swing/ToolTipManager.java b/libjava/classpath/javax/swing/ToolTipManager.java
index 61693763898..03835794b68 100644
--- a/libjava/classpath/javax/swing/ToolTipManager.java
+++ b/libjava/classpath/javax/swing/ToolTipManager.java
@@ -44,7 +44,6 @@ import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.Panel;
import java.awt.Point;
-import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -68,6 +67,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected stillInsideTimerAction()
{
+ // Nothing to do here.
}
/**
@@ -93,6 +93,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected outsideTimerAction()
{
+ // Nothing to do here.
}
/**
@@ -103,6 +104,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
public void actionPerformed(ActionEvent event)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -118,6 +120,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected insideTimerAction()
{
+ // Nothing to do here.
}
/**
@@ -129,8 +132,6 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
public void actionPerformed(ActionEvent event)
{
showTip();
- if (insideTimer != null)
- insideTimer.start();
}
}
@@ -183,7 +184,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
* The window used when the tooltip doesn't fit inside the current
* container.
*/
- private static JWindow tooltipWindow;
+ private static JDialog tooltipWindow;
/**
* Creates a new ToolTipManager and sets up the timers.
@@ -373,7 +374,6 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
if (exitTimer.isRunning())
{
exitTimer.stop();
- showTip();
insideTimer.start();
return;
}
@@ -424,13 +424,6 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
insideTimer.stop();
hideTip();
}
-
- if (currentComponent == null)
- currentComponent = (Component) event.getSource();
-
- currentComponent.invalidate();
- currentComponent.validate();
- currentComponent.repaint();
}
/**
@@ -455,16 +448,8 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
public void mouseMoved(MouseEvent event)
{
currentPoint = event.getPoint();
- if (currentTip != null)
- {
- if (currentComponent == null)
- currentComponent = (Component) event.getSource();
-
- String text = ((JComponent) currentComponent).getToolTipText(event);
- currentTip.setTipText(text);
- }
if (enterTimer.isRunning())
- enterTimer.restart();
+ enterTimer.restart();
}
/**
@@ -474,70 +459,103 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
void showTip()
{
- if (! enabled || currentComponent == null)
+ if (!enabled || currentComponent == null || !currentComponent.isEnabled()
+ || (currentTip != null && currentTip.isVisible()))
return;
- if (currentTip == null
- || currentTip.getComponent() != currentComponent
+ if (currentTip == null || currentTip.getComponent() != currentComponent
&& currentComponent instanceof JComponent)
currentTip = ((JComponent) currentComponent).createToolTip();
+
+ currentTip.setVisible(true);
+ Container parent = currentComponent.getParent();
Point p = currentPoint;
Dimension dims = currentTip.getPreferredSize();
- if (canToolTipFit(currentTip))
- {
- JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class,
- currentComponent))
- .getLayeredPane();
-
- // This should never happen, but just in case.
- if (pane == null)
- return;
-
- if (containerPanel != null)
- hideTip();
- if (isLightWeightPopupEnabled())
- {
- containerPanel = new Panel();
- JRootPane root = new JRootPane();
- root.getContentPane().add(currentTip);
- containerPanel.add(root);
- }
- else
- {
- containerPanel = new JPanel();
- containerPanel.add(currentTip);
- }
- LayoutManager lm = containerPanel.getLayout();
- if (lm instanceof FlowLayout)
- {
- FlowLayout fm = (FlowLayout) lm;
- fm.setVgap(0);
- fm.setHgap(0);
- }
-
- p = getGoodPoint(p, pane, currentTip, dims);
-
- pane.add(containerPanel);
- containerPanel.setBounds(p.x, p.y, dims.width, dims.height);
- currentTip.setBounds(0, 0, dims.width, dims.height);
-
- pane.revalidate();
- pane.repaint();
- }
+
+ if (parent instanceof JPopupMenu)
+ setLightWeightPopupEnabled(((JPopupMenu) parent).isLightWeightPopupEnabled());
else
+ setLightWeightPopupEnabled(true);
+
+ if (isLightWeightPopupEnabled())
{
- SwingUtilities.convertPointToScreen(p, currentComponent);
- tooltipWindow = new JWindow();
- tooltipWindow.getContentPane().add(currentTip);
- tooltipWindow.setFocusable(false);
- tooltipWindow.pack();
- tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height);
- tooltipWindow.show();
+ JLayeredPane pane = null;
+ JRootPane r = ((JRootPane) SwingUtilities.
+ getAncestorOfClass(JRootPane.class, currentComponent));
+ if (r != null)
+ pane = r.getLayeredPane();
+ if (pane == null)
+ return;
+
+ if (containerPanel != null)
+ hideTip();
+
+ containerPanel = new Panel();
+ JRootPane root = new JRootPane();
+ root.getContentPane().add(currentTip);
+ containerPanel.add(root);
+
+ LayoutManager lm = containerPanel.getLayout();
+ if (lm instanceof FlowLayout)
+ {
+ FlowLayout fm = (FlowLayout) lm;
+ fm.setVgap(0);
+ fm.setHgap(0);
+ }
+
+ p = SwingUtilities.convertPoint(currentComponent, p, pane);
+ p = adjustLocation(p, pane, dims);
+
+ pane.add(containerPanel);
+ containerPanel.setBounds(p.x, p.y, dims.width, dims.height);
+ currentTip.setBounds(0, 0, dims.width, dims.height);
+ containerPanel.validate();
+ containerPanel.repaint();
+ }
+ else if (currentComponent.isShowing())
+ {
+ SwingUtilities.convertPointToScreen(p, currentComponent);
+ p = adjustLocation(p, SwingUtilities.getWindowAncestor(currentComponent),
+ dims);
+
+ tooltipWindow = new JDialog();
+ tooltipWindow.setContentPane(currentTip);
+ tooltipWindow.setUndecorated(true);
+ tooltipWindow.getRootPane().
+ setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
+ tooltipWindow.pack();
+ tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height);
+ tooltipWindow.show();
+ tooltipWindow.validate();
+ tooltipWindow.repaint();
+ currentTip.revalidate();
+ currentTip.repaint();
}
- currentTip.setVisible(true);
}
/**
+ * Adjusts the point to a new location on the component,
+ * using the currentTip's dimensions.
+ *
+ * @param p - the point to convert.
+ * @param c - the component the point is on.
+ * @param d - the dimensions of the currentTip.
+ */
+ private Point adjustLocation(Point p, Component c, Dimension d)
+ {
+ if (p.x + d.width > c.getWidth())
+ p.x -= d.width;
+ if (p.x < 0)
+ p.x = 0;
+ if (p.y + d.height < c.getHeight())
+ p.y += d.height;
+ if (p.y + d.height > c.getHeight())
+ p.y -= d.height*2;
+
+ return p;
+ }
+
+ /**
* This method hides the ToolTip.
* This is package-private to avoid an accessor method.
*/
@@ -552,15 +570,11 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
if (parent == null)
return;
parent.remove(containerPanel);
- parent.invalidate();
- parent.validate();
- parent.repaint();
parent = currentTip.getParent();
if (parent == null)
return;
parent.remove(currentTip);
-
containerPanel = null;
}
if (tooltipWindow != null)
@@ -569,35 +583,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
tooltipWindow.dispose();
tooltipWindow = null;
}
- }
-
- /**
- * This method returns a point in the LayeredPane where the ToolTip can be
- * shown. The point returned (if the ToolTip is to be displayed at the
- * preferred dimensions) will always place the ToolTip inside the
- * currentComponent if possible.
- *
- * @param p The last known good point for the mouse.
- * @param c The JLayeredPane in the first RootPaneContainer up from the
- * currentComponent.
- * @param tip The ToolTip to display.
- * @param dims The ToolTip preferred dimensions (can be null).
- *
- * @return A good point to place the ToolTip.
- */
- private Point getGoodPoint(Point p, JLayeredPane c, JToolTip tip,
- Dimension dims)
- {
- if (dims == null)
- dims = tip.getPreferredSize();
- Rectangle bounds = currentComponent.getBounds();
- if (p.x + dims.width > bounds.width)
- p.x = bounds.width - dims.width;
- if (p.y + dims.height > bounds.height)
- p.y = bounds.height - dims.height;
-
- p = SwingUtilities.convertPoint(currentComponent, p, c);
- return p;
+ currentTip = null;
}
/**
@@ -622,25 +608,4 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
Component target = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
return target;
}
-
- /**
- * This method returns whether the ToolTip can fit in the first
- * RootPaneContainer up from the currentComponent.
- *
- * @param tip The ToolTip.
- *
- * @return Whether the ToolTip can fit.
- */
- private boolean canToolTipFit(JToolTip tip)
- {
- JRootPane root = (JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class,
- currentComponent);
- if (root == null)
- return false;
- Dimension pref = tip.getPreferredSize();
- Dimension rootSize = root.getSize();
- if (rootSize.width > pref.width && rootSize.height > pref.height)
- return true;
- return false;
- }
}
diff --git a/libjava/classpath/javax/swing/TransferHandler.java b/libjava/classpath/javax/swing/TransferHandler.java
index 96cb9d42abf..4828fdbfa98 100644
--- a/libjava/classpath/javax/swing/TransferHandler.java
+++ b/libjava/classpath/javax/swing/TransferHandler.java
@@ -75,30 +75,38 @@ public class TransferHandler implements Serializable
}
}
+ /**
+ * Get the system cliboard. If not available, create and return the VM-local
+ * clipboard.
+ *
+ * @param component a component, used to get the toolkit.
+ * @return the clipboard
+ */
private static Clipboard getClipboard(JComponent component)
{
- SecurityManager sm = System.getSecurityManager();
-
- if (sm != null)
- {
- try
- {
- sm.checkSystemClipboardAccess();
-
- // We may access system clipboard.
- return component.getToolkit().getSystemClipboard();
- }
- catch (SecurityException e)
- {
- // We may not access system clipboard.
- }
- }
-
- // Create VM-local clipboard if non exists yet.
- if (clipboard == null)
- clipboard = new Clipboard("Clipboard");
-
- return clipboard;
+ // Avoid throwing exception if the system clipboard access failed
+ // in the past.
+ if (clipboard != null)
+ return clipboard;
+ else
+ {
+ try
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSystemClipboardAccess();
+
+ // We may access system clipboard.
+ return component.getToolkit().getSystemClipboard();
+ }
+ catch (Exception e)
+ {
+ // We may not access system clipboard.
+ // Create VM-local clipboard if none exists yet.
+ clipboard = new Clipboard("Clipboard");
+ return clipboard;
+ }
+ }
}
}
@@ -162,15 +170,18 @@ public class TransferHandler implements Serializable
}
public void exportAsDrag (JComponent c, InputEvent e, int action)
- {
+ {
+ // TODO: Implement this properly
}
protected void exportDone (JComponent c, Transferable data, int action)
{
+ // TODO: Implement this properly
}
public void exportToClipboard(JComponent c, Clipboard clip, int action)
{
+ // TODO: Implement this properly
}
public int getSourceActions (JComponent c)
diff --git a/libjava/classpath/javax/swing/UIDefaults.java b/libjava/classpath/javax/swing/UIDefaults.java
index ab78ca6442f..f6aee1b944c 100644
--- a/libjava/classpath/javax/swing/UIDefaults.java
+++ b/libjava/classpath/javax/swing/UIDefaults.java
@@ -577,8 +577,8 @@ public class UIDefaults extends Hashtable
*
* @param key the key to the requested entry
*
- * @return the boolean entry for <code>key</code> or null if no such entry
- * exists
+ * @return The boolean entry for <code>key</code> or <code>false</code> if no
+ * such entry exists.
*/
public boolean getBoolean(Object key)
{
@@ -674,9 +674,9 @@ public class UIDefaults extends Hashtable
return null;
try
{
- if (loader != null)
- return loader.loadClass (className);
- return Class.forName (className);
+ if (loader == null)
+ loader = ClassLoader.getSystemClassLoader();
+ return loader.loadClass (className);
}
catch (Exception e)
{
diff --git a/libjava/classpath/javax/swing/UIManager.java b/libjava/classpath/javax/swing/UIManager.java
index f4648f1e219..15a78190303 100644
--- a/libjava/classpath/javax/swing/UIManager.java
+++ b/libjava/classpath/javax/swing/UIManager.java
@@ -146,19 +146,29 @@ public class UIManager implements Serializable
LookAndFeel laf = (LookAndFeel) lafClass.newInstance();
setLookAndFeel(laf);
}
+ else
+ {
+ setLookAndFeel(new MetalLookAndFeel());
+ }
}
catch (Exception ex)
{
System.err.println("cannot initialize Look and Feel: " + defaultlaf);
- System.err.println("error: " + ex.getMessage());
+ System.err.println("error: " + ex.toString());
System.err.println("falling back to Metal Look and Feel");
+ try
+ {
+ setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception ex2)
+ {
+ throw (Error) new AssertionError("There must be no problem installing"
+ + " the MetalLookAndFeel.")
+ .initCause(ex2);
+ }
}
- currentLookAndFeel = new MetalLookAndFeel();
- currentLookAndFeel.initialize();
- currentUIDefaults = currentLookAndFeel.getDefaults();
-
}
-
+
/**
* Creates a new instance of the <code>UIManager</code>. There is no need
* to construct an instance of this class, since all methods are static.
diff --git a/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java b/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java
index 5abe45fe117..f99c0ac19f7 100644
--- a/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java
+++ b/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java
@@ -40,8 +40,8 @@ package javax.swing;
public class UnsupportedLookAndFeelException extends Exception
{
- public UnsupportedLookAndFeelException(String a)
- {
- super(a);
- }
+ public UnsupportedLookAndFeelException(String a)
+ {
+ super(a);
+ }
}
diff --git a/libjava/classpath/javax/swing/ViewportLayout.java b/libjava/classpath/javax/swing/ViewportLayout.java
index 19735839387..884f7cb27a8 100644
--- a/libjava/classpath/javax/swing/ViewportLayout.java
+++ b/libjava/classpath/javax/swing/ViewportLayout.java
@@ -56,12 +56,17 @@ public class ViewportLayout implements LayoutManager, Serializable
public ViewportLayout()
{
+ // Nothing to do here.
}
+
public void addLayoutComponent(String name, Component c)
{
+ // Nothing to do here.
}
+
public void removeLayoutComponent(Component c)
{
+ // Nothing to do here.
}
public Dimension preferredLayoutSize(Container parent)
diff --git a/libjava/classpath/javax/swing/WindowConstants.java b/libjava/classpath/javax/swing/WindowConstants.java
index 5e364434484..aaa0cb9a3ab 100644
--- a/libjava/classpath/javax/swing/WindowConstants.java
+++ b/libjava/classpath/javax/swing/WindowConstants.java
@@ -43,31 +43,26 @@ package javax.swing;
*
* @author Andrew Selkirk
*/
-public interface WindowConstants {
+public interface WindowConstants
+{
+ /**
+ * DO_NOTHING_ON_CLOSE
+ */
+ int DO_NOTHING_ON_CLOSE = 0;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
+ /**
+ * HIDE_ON_CLOSE
+ */
+ int HIDE_ON_CLOSE = 1;
- /**
- * DO_NOTHING_ON_CLOSE
- */
- int DO_NOTHING_ON_CLOSE = 0;
+ /**
+ * DISPOSE_ON_CLOSE
+ */
+ int DISPOSE_ON_CLOSE = 2;
- /**
- * HIDE_ON_CLOSE
- */
- int HIDE_ON_CLOSE = 1;
+ /**
+ * EXIT_ON_CLOSE
+ */
+ int EXIT_ON_CLOSE =3;
- /**
- * DISPOSE_ON_CLOSE
- */
- int DISPOSE_ON_CLOSE = 2;
-
- /**
- * EXIT_ON_CLOSE
- */
- int EXIT_ON_CLOSE =3;
-
-
-} // WindowConstants
+}
diff --git a/libjava/classpath/javax/swing/border/AbstractBorder.java b/libjava/classpath/javax/swing/border/AbstractBorder.java
index 951debd5207..7cbbcdaa83b 100644
--- a/libjava/classpath/javax/swing/border/AbstractBorder.java
+++ b/libjava/classpath/javax/swing/border/AbstractBorder.java
@@ -52,20 +52,18 @@ import java.io.Serializable;
* @author Sascha Brawer (brawer@dandelis.ch)
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public abstract class AbstractBorder
- implements Border, Serializable
+public abstract class AbstractBorder implements Border, Serializable
{
static final long serialVersionUID = -545885975315191844L;
-
/**
* Constructs a new AbstractBorder.
*/
- public AbstractBorder ()
+ public AbstractBorder()
{
+ // Nothing to do here.
}
-
/**
* Performs nothing, because the default implementation provided by
* this class is an invisible, zero-width border. Subclasses will
@@ -79,17 +77,15 @@ public abstract class AbstractBorder
* @param width the width of the available area for painting the border.
* @param height the height of the available area for painting the border.
*/
- public void paintBorder (Component c, Graphics g,
- int x, int y, int width, int height)
+ public void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height)
{
- /* A previous version of Classpath had emitted a warning when
- * this method was called. The warning was removed because it is
- * perfectly legal for a subclass to not override the paintBorder
- * method. An example would be EmptyBorder.
- */
+ // A previous version of Classpath had emitted a warning when
+ // this method was called. The warning was removed because it is
+ // perfectly legal for a subclass to not override the paintBorder
+ // method. An example would be EmptyBorder.
}
-
/**
* Measures the width of this border.
*
@@ -102,31 +98,29 @@ public abstract class AbstractBorder
*
* @see #getBorderInsets(java.awt.Component, java.awt.Insets)
*/
- public Insets getBorderInsets (Component c)
+ public Insets getBorderInsets(Component c)
{
- return new Insets (0, 0, 0, 0);
+ return new Insets(0, 0, 0, 0);
}
-
/**
* Determines the insets of this border. The implementation provided
* by AbstractButton sets the <code>left</code>, <code>right</code>,
* <code>top</code> and <code>bottom</code> fields of the passed
* <code>insets</code> parameter to zero.
*
- * @param c the component whose border is to be measured.
+ * @param c the component whose border is to be measured
*
- * @return the same object that was passed for <code>insets</code>.
+ * @return the same object that was passed for <code>insets</code>
*
* @see #getBorderInsets(Component)
*/
- public Insets getBorderInsets (Component c, Insets insets)
+ public Insets getBorderInsets(Component c, Insets insets)
{
insets.left = insets.right = insets.top = insets.bottom = 0;
return insets;
}
-
/**
* Determines whether or not this border is opaque. An opaque border
* fills every pixel in its area when painting. Partially
@@ -136,12 +130,11 @@ public abstract class AbstractBorder
*
* @return <code>false</code>.
*/
- public boolean isBorderOpaque ()
+ public boolean isBorderOpaque()
{
return false;
}
-
/**
* Returns a rectangle that covers the specified area minus this
* border. Components that wish to determine an area into which
@@ -154,12 +147,11 @@ public abstract class AbstractBorder
* @param width the width of the available area for the border.
* @param height the height of the available area for the border.
*/
- public Rectangle getInteriorRectangle (Component c,
- int x, int y, int width, int height)
+ public Rectangle getInteriorRectangle(Component c, int x, int y, int width,
+ int height)
{
return getInteriorRectangle (c, this, x, y, width, height);
}
-
/**
* Returns a rectangle that covers the specified area minus a
@@ -173,8 +165,8 @@ public abstract class AbstractBorder
* @param width the width of the available area for the border.
* @param height the height of the available area for the border.
*/
- public static Rectangle getInteriorRectangle (Component c, Border b,
- int x, int y, int width, int height)
+ public static Rectangle getInteriorRectangle(Component c, Border b, int x,
+ int y, int width, int height)
{
Insets borderInsets;
diff --git a/libjava/classpath/javax/swing/border/BevelBorder.java b/libjava/classpath/javax/swing/border/BevelBorder.java
index fcdc1c64675..45b758cae41 100644
--- a/libjava/classpath/javax/swing/border/BevelBorder.java
+++ b/libjava/classpath/javax/swing/border/BevelBorder.java
@@ -55,8 +55,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class BevelBorder
- extends AbstractBorder
+public class BevelBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -508,11 +507,11 @@ public class BevelBorder
* Paints a two-pixel bevel in four colors.
*
* <pre>
- * @@@@@@@@@@@@
- * @..........# @ = color a
- * @. X# . = color b
- * @. X# X = color c
- * @.XXXXXXXXX# # = color d
+ * ++++++++++++
+ * +..........# + = color a
+ * +. X# . = color b
+ * +. X# X = color c
+ * +.XXXXXXXXX# # = color d
* ############</pre>
*
* @param g the graphics for painting.
diff --git a/libjava/classpath/javax/swing/border/Border.java b/libjava/classpath/javax/swing/border/Border.java
index 11bddfe78b3..f4af3fb38bb 100644
--- a/libjava/classpath/javax/swing/border/Border.java
+++ b/libjava/classpath/javax/swing/border/Border.java
@@ -77,9 +77,8 @@ public interface Border
* @param width the width of the available area for painting the border.
* @param height the height of the available area for painting the border.
*/
- void paintBorder(Component c, Graphics g,
- int x, int y, int width, int height);
-
+ void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height);
/**
* Measures the width of this border.
@@ -92,7 +91,6 @@ public interface Border
*/
Insets getBorderInsets(Component c);
-
/**
* Determines whether this border fills every pixel in its area
* when painting.
diff --git a/libjava/classpath/javax/swing/border/CompoundBorder.java b/libjava/classpath/javax/swing/border/CompoundBorder.java
index 2130a0e3447..998a9bab3bd 100644
--- a/libjava/classpath/javax/swing/border/CompoundBorder.java
+++ b/libjava/classpath/javax/swing/border/CompoundBorder.java
@@ -48,8 +48,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class CompoundBorder
- extends AbstractBorder
+public class CompoundBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -57,7 +56,6 @@ public class CompoundBorder
*/
static final long serialVersionUID = 9054540377030555103L;
-
/**
* The inside border, which is painted between the bordered
* Component and the outside border. It is valid for
@@ -65,7 +63,6 @@ public class CompoundBorder
*/
protected Border insideBorder;
-
/**
* The outside border, which is painted outside both the
* bordered Component and the inside border. It is valid for
@@ -73,7 +70,6 @@ public class CompoundBorder
*/
protected Border outsideBorder;
-
/**
* Constructs a CompoundBorder whose inside and outside borders
* are both <code>null</code>. While this does not really make
@@ -83,12 +79,11 @@ public class CompoundBorder
*
* @see EmptyBorder
*/
- public CompoundBorder ()
+ public CompoundBorder()
{
this (null, null);
}
-
/**
* Constructs a CompoundBorder with the specified inside and
* outside borders.
@@ -103,13 +98,12 @@ public class CompoundBorder
* component. It is acceptable to pass <code>null</code>, in
* which case no inside border is painted.
*/
- public CompoundBorder (Border outsideBorder, Border insideBorder)
+ public CompoundBorder(Border outsideBorder, Border insideBorder)
{
this.outsideBorder = outsideBorder;
this.insideBorder = insideBorder;
}
-
/**
* Determines whether or not this border is opaque. An opaque
* border fills every pixel in its area when painting. Partially
@@ -119,20 +113,18 @@ public class CompoundBorder
* @return <code>true</code> if both the inside and outside borders
* are opaque, or <code>false</code> otherwise.
*/
- public boolean isBorderOpaque ()
+ public boolean isBorderOpaque()
{
- /* While it would be safe to assume true for the opacity of
- * a null border, this behavior would not be according to
- * the API specification. Also, it is pathological to have
- * null borders anyway.
- */
+ // While it would be safe to assume true for the opacity of
+ // a null border, this behavior would not be according to
+ // the API specification. Also, it is pathological to have
+ // null borders anyway.
if ((insideBorder == null) || (outsideBorder == null))
return false;
return insideBorder.isBorderOpaque()
&& outsideBorder.isBorderOpaque();
}
-
/**
* Paints the compound border by first painting the outside border,
@@ -148,9 +140,9 @@ public class CompoundBorder
public void paintBorder(Component c, Graphics g,
int x, int y, int width, int height)
{
- /* If there is an outside border, paint it and reduce the
- * bounding box by its insets.
- */
+ // If there is an outside border, paint it and reduce the
+ // bounding box by its insets.
+ //
if (outsideBorder != null)
{
Insets outsideInsets;
@@ -161,9 +153,8 @@ public class CompoundBorder
x += outsideInsets.left;
y += outsideInsets.top;
- /* Reduce width and height by the respective extent of the
- * outside border.
- */
+ // Reduce width and height by the respective extent of the
+ // outside border.
width -= outsideInsets.left + outsideInsets.right;
height -= outsideInsets.top + outsideInsets.bottom;
}
@@ -172,7 +163,6 @@ public class CompoundBorder
insideBorder.paintBorder(c, g, x, y, width, height);
}
-
/**
* Changes the specified insets to the insets of this border,
* which is the sum of the insets of the inside and the outside
@@ -192,7 +182,7 @@ public class CompoundBorder
else
insets.left = insets.right = insets.top = insets.bottom = 0;
- /* If there is an outside border, add it to insets. */
+ // If there is an outside border, add it to insets.
if (outsideBorder != null)
{
borderInsets = outsideBorder.getBorderInsets(c);
@@ -202,7 +192,7 @@ public class CompoundBorder
insets.bottom += borderInsets.bottom;
}
- /* If there is an inside border, add it to insets. */
+ // If there is an inside border, add it to insets.
if (insideBorder != null)
{
borderInsets = insideBorder.getBorderInsets(c);
@@ -215,35 +205,31 @@ public class CompoundBorder
return insets;
}
-
/**
* Determines the insets of this border, which is the sum of the
* insets of the inside and the outside border.
*
* @param c the component in the center of this border.
*/
- public Insets getBorderInsets (Component c)
+ public Insets getBorderInsets(Component c)
{
- /* It is not clear why CompoundBorder does not simply inherit
- * the implementation from AbstractBorder. However, we want
- * to be compatible with the API specification, which overrides
- * the getBorderInsets(Component) method.
- */
+ // It is not clear why CompoundBorder does not simply inherit
+ // the implementation from AbstractBorder. However, we want
+ // to be compatible with the API specification, which overrides
+ // the getBorderInsets(Component) method.
return getBorderInsets (c, null);
}
-
/**
* Returns the outside border, which is painted outside both the
* bordered Component and the inside border. It is valid for the
* result to be <code>null</code>.
*/
- public Border getOutsideBorder ()
+ public Border getOutsideBorder()
{
return outsideBorder;
}
-
/**
* Returns the inside border, which is painted between the bordered
* Component and the outside border. It is valid for the result to
@@ -254,4 +240,3 @@ public class CompoundBorder
return insideBorder;
}
}
-
diff --git a/libjava/classpath/javax/swing/border/EmptyBorder.java b/libjava/classpath/javax/swing/border/EmptyBorder.java
index 0f3b7b6931c..c8e9c604469 100644
--- a/libjava/classpath/javax/swing/border/EmptyBorder.java
+++ b/libjava/classpath/javax/swing/border/EmptyBorder.java
@@ -53,8 +53,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class EmptyBorder
- extends AbstractBorder
+public class EmptyBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -142,6 +141,7 @@ public class EmptyBorder
public void paintBorder(Component c, Graphics g,
int x, int y, int width, int height)
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/border/EtchedBorder.java b/libjava/classpath/javax/swing/border/EtchedBorder.java
index 0bd76ff0fb6..22882b78cb1 100644
--- a/libjava/classpath/javax/swing/border/EtchedBorder.java
+++ b/libjava/classpath/javax/swing/border/EtchedBorder.java
@@ -56,8 +56,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class EtchedBorder
- extends AbstractBorder
+public class EtchedBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -199,8 +198,8 @@ public class EtchedBorder
* @param width the width of the available area for painting the border.
* @param height the height of the available area for painting the border.
*/
- public void paintBorder(Component c, Graphics g,
- int x, int y, int width, int height)
+ public void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height)
{
switch (etchType)
{
@@ -270,16 +269,14 @@ public class EtchedBorder
*/
public boolean isBorderOpaque()
{
- /* If the colors are to be drived from the enclosed Component's
- * background color, the border is guaranteed to be fully opaque
- * because Color.brighten() and Color.darken() always return an
- * opaque color.
- */
+ // If the colors are to be derived from the enclosed Component's
+ // background color, the border is guaranteed to be fully opaque
+ // because Color.brighten() and Color.darken() always return an
+ // opaque color.
return
((highlight == null) || (highlight.getAlpha() == 255))
&& ((shadow == null) || (shadow.getAlpha() == 255));
}
-
/**
* Returns the appearance of this EtchedBorder, which is either
@@ -310,8 +307,7 @@ public class EtchedBorder
else
return c.getBackground().brighter();
}
-
-
+
/**
* Returns the color that will be used for highlighted parts when
* painting the border, or <code>null</code> if that color will be
@@ -359,11 +355,11 @@ public class EtchedBorder
* Paints a two-pixel etching in two colors.
*
* <pre>
- * @@@@@@@@@@@.
- * @.........@. @ = color a
- * @. @. . = color b
- * @. @.
- * @@@@@@@@@@@.
+ * +++++++++++.
+ * +.........+. + = color a
+ * +. +. . = color b
+ * +. +.
+ * +++++++++++.
* ............</pre>
*
* @param g the graphics for painting.
@@ -374,9 +370,8 @@ public class EtchedBorder
* @param a one of the two colors.
* @param b the second of the two colors.
*/
- private static void paintEtchedBorder(Graphics g,
- int x, int y, int width, int height,
- Color a, Color b)
+ private static void paintEtchedBorder(Graphics g, int x, int y, int width,
+ int height, Color a, Color b)
{
Color oldColor;
@@ -387,11 +382,10 @@ public class EtchedBorder
try
{
- /* To understand this code, it might be helpful to look at the
- * images that are included with the JavaDoc. They are located
- * in the "doc-files" subdirectory. EtchedBorder-2.png might
- * be especially informative.
- */
+ // To understand this code, it might be helpful to look at the
+ // images that are included with the JavaDoc. They are located
+ // in the "doc-files" subdirectory. EtchedBorder-2.png might
+ // be especially informative.
g.setColor(a);
g.drawRect(0, 0, width - 1, height - 1);
@@ -408,4 +402,3 @@ public class EtchedBorder
}
}
}
-
diff --git a/libjava/classpath/javax/swing/border/LineBorder.java b/libjava/classpath/javax/swing/border/LineBorder.java
index c34e38c5789..36abddd915d 100644
--- a/libjava/classpath/javax/swing/border/LineBorder.java
+++ b/libjava/classpath/javax/swing/border/LineBorder.java
@@ -50,8 +50,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class LineBorder
- extends AbstractBorder
+public class LineBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -71,7 +70,7 @@ public class LineBorder
/**
* A shared instance of a gray, one pixel thick, plain LineBorder.
* The singleton object is lazily created by {@link
- * #createBlackGrayBorder()} upon its first invocation.
+ * #createGrayLineBorder()} upon its first invocation.
*/
private static LineBorder grayLineBorder;
@@ -213,29 +212,27 @@ public class LineBorder
{
g.setColor(lineColor);
- /* If width and height were not adjusted, the border would
- * appear one pixel too large in both directions.
- */
+ // If width and height were not adjusted, the border would
+ // appear one pixel too large in both directions.
width -= 1;
height -= 1;
- /* Blurred, too large appearance
- * -----------------------------
- * While Java 2D has introduced line strokes of arbitrary width,
- * it seems desirable to keep this code independent of Java 2D.
- * Therefore, multiple nested rectangles (or rounded rectangles)
- * are drawn in order to simulate a line whose thickness is
- * greater than one pixel.
- *
- * This hack causes a blurred appearance when anti-aliasing is
- * on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
- * on MacOS X 10.1.5) shows exactly the same appearance under
- * this condition. It thus seems likely that Sun does the same
- * hack for simulating thick lines. For this reason, the
- * blurred appearance seems acceptable -- especially since GNU
- * Classpath tries to be compatible with the Sun reference
- * implementation.
- */
+ // Blurred, too large appearance
+ // -----------------------------
+ // While Java 2D has introduced line strokes of arbitrary width,
+ // it seems desirable to keep this code independent of Java 2D.
+ // Therefore, multiple nested rectangles (or rounded rectangles)
+ // are drawn in order to simulate a line whose thickness is
+ // greater than one pixel.
+ //
+ // This hack causes a blurred appearance when anti-aliasing is
+ // on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
+ // on MacOS X 10.1.5) shows exactly the same appearance under
+ // this condition. It thus seems likely that Sun does the same
+ // hack for simulating thick lines. For this reason, the
+ // blurred appearance seems acceptable -- especially since GNU
+ // Classpath tries to be compatible with the Sun reference
+ // implementation.
for (int i = 0; i < thickness; i++)
{
if (roundedCorners)
@@ -340,4 +337,3 @@ public class LineBorder
return (!roundedCorners) && (lineColor.getAlpha() == 255);
}
}
-
diff --git a/libjava/classpath/javax/swing/border/MatteBorder.java b/libjava/classpath/javax/swing/border/MatteBorder.java
index f7ff1ca01c3..4d5b8c25360 100644
--- a/libjava/classpath/javax/swing/border/MatteBorder.java
+++ b/libjava/classpath/javax/swing/border/MatteBorder.java
@@ -54,8 +54,7 @@ import javax.swing.Icon;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class MatteBorder
- extends EmptyBorder
+public class MatteBorder extends EmptyBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -401,4 +400,3 @@ public class MatteBorder
}
}
}
-
diff --git a/libjava/classpath/javax/swing/border/SoftBevelBorder.java b/libjava/classpath/javax/swing/border/SoftBevelBorder.java
index 379ecb65a35..028fd00e021 100644
--- a/libjava/classpath/javax/swing/border/SoftBevelBorder.java
+++ b/libjava/classpath/javax/swing/border/SoftBevelBorder.java
@@ -55,8 +55,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class SoftBevelBorder
- extends BevelBorder
+public class SoftBevelBorder extends BevelBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -264,10 +263,10 @@ public class SoftBevelBorder
* Paints a soft bevel in four colors.
*
* <pre>
- * @@@@@@@@@@@.
- * @@.........# @ = color a
- * @.. # . = color b
- * @. # X = color c
+ * +++++++++++.
+ * ++.........# + = color a
+ * +.. # . = color b
+ * +. # X = color c
* .. X# # = color d
* . ##########</pre>
*
@@ -326,4 +325,3 @@ public class SoftBevelBorder
}
}
}
-
diff --git a/libjava/classpath/javax/swing/border/TitledBorder.java b/libjava/classpath/javax/swing/border/TitledBorder.java
index ceae2b1c9e3..8d3ee13d4bb 100644
--- a/libjava/classpath/javax/swing/border/TitledBorder.java
+++ b/libjava/classpath/javax/swing/border/TitledBorder.java
@@ -1,5 +1,5 @@
/* TitledBorder.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +46,9 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Shape;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.awt.geom.AffineTransform;
import javax.swing.UIManager;
@@ -55,8 +58,7 @@ import javax.swing.UIManager;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class TitledBorder
- extends AbstractBorder
+public class TitledBorder extends AbstractBorder
{
/**
* A value for the <code>titlePosition</code> property that vertically
@@ -301,7 +303,7 @@ public class TitledBorder
public TitledBorder(String title)
{
this(/* border */ null,
- title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ title, LEADING, TOP,
/* titleFont */ null, /* titleColor */ null);
}
@@ -314,7 +316,7 @@ public class TitledBorder
*/
public TitledBorder(Border border)
{
- this(border, /* title */ "", DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ this(border, /* title */ "", LEADING, TOP,
/* titleFont */ null, /* titleColor */ null);
}
@@ -330,7 +332,7 @@ public class TitledBorder
*/
public TitledBorder(Border border, String title)
{
- this(border, title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ this(border, title, LEADING, TOP,
/* titleFont */ null, /* titleColor */ null);
}
@@ -504,7 +506,7 @@ public class TitledBorder
public void paint(Graphics g)
{
if (b != null)
- b.paintBorder(c, g, x, y, width - 1, height - 1);
+ b.paintBorder(c, g, x, y, width, height);
}
@@ -562,7 +564,7 @@ public class TitledBorder
if (stripeHeight > 0)
{
paint(g, x, holeY, holeX - x, stripeHeight); // patches #2 and #3
- paint(g, holeX + holeWidth, holeY, width - (holeX + holeWidth), stripeHeight);
+ paint(g, holeX + holeWidth, holeY, x + width - (holeX + holeWidth), stripeHeight);
}
stripeHeight = height - (holeY - y + holeHeight);
@@ -574,16 +576,16 @@ public class TitledBorder
BorderPainter bp;
int textX, textY, borderWidth, borderHeight;
- borderWidth = width - (mes.borderSpacing.left + mes.borderSpacing.right);
- borderHeight = height - (mes.borderSpacing.top + mes.borderSpacing.bottom);
+ borderWidth = width - (mes.outerSpacing.left + mes.outerSpacing.right);
+ borderHeight = height - (mes.outerSpacing.top + mes.outerSpacing.bottom);
bp = new BorderPainter(c, getBorder(),
- x + mes.borderSpacing.left, y + mes.borderSpacing.top,
+ x + mes.outerSpacing.left, y + mes.outerSpacing.top,
borderWidth, borderHeight);
switch (getRealTitleJustification(c))
{
case LEFT:
- textX = x + TEXT_INSET_H;
+ textX = x + EDGE_SPACING + TEXT_INSET_H;
break;
case CENTER:
@@ -601,21 +603,22 @@ public class TitledBorder
switch (titlePosition)
{
case ABOVE_TOP:
- textY = y;
+ textY = y + EDGE_SPACING;
break;
case TOP:
case DEFAULT_POSITION:
default:
- textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent;
+ textY = y + mes.outerSpacing.top + mes.borderInsets.top - mes.textAscent
+ + mes.lineHeight;
break;
case BELOW_TOP:
- textY = y + mes.borderSpacing.top + mes.borderInsets.top + TEXT_SPACING;
+ textY = y + mes.outerSpacing.top + mes.borderInsets.top + TEXT_SPACING;
break;
case ABOVE_BOTTOM:
- textY = y + height - mes.borderSpacing.bottom - mes.borderInsets.bottom
+ textY = y + height - mes.outerSpacing.bottom - mes.borderInsets.bottom
- TEXT_SPACING - (mes.textAscent + mes.textDescent);
break;
@@ -640,8 +643,8 @@ public class TitledBorder
g.setFont(oldFont);
g.setColor(oldColor);
}
- bp.paintExcept(g, textX - 2, textY,
- mes.textWidth + 2, mes.textAscent + mes.textDescent);
+ bp.paintExcept(g, textX, textY,
+ mes.textWidth, mes.textAscent + mes.textDescent);
}
}
@@ -998,39 +1001,63 @@ public class TitledBorder
m.trimmedText = null;
}
- m.textAscent = fmet.getAscent();
- m.textDescent = fmet.getDescent();
if (m.trimmedText != null)
- m.textWidth = fmet.stringWidth(m.trimmedText) + 3;
+ {
+ m.textAscent = fmet.getAscent();
+ m.textDescent = fmet.getDescent() + fmet.getLeading();
+
+ FontRenderContext frc = new FontRenderContext(new AffineTransform(),
+ false, false);
+ LineMetrics lmet = m.font.getLineMetrics(m.trimmedText, 0,
+ m.trimmedText.length(), frc);
+ m.lineHeight = (int) lmet.getStrikethroughOffset();
+
+ // Fallback in case that LineMetrics is not available/working.
+ if (m.lineHeight == 0)
+ m.lineHeight = (int) (0.3333 * (double) m.textAscent);
+ m.textWidth = fmet.stringWidth(m.trimmedText) + 3;
+ }
+ else
+ {
+ m.textAscent = 0;
+ m.textDescent = 0;
+ }
- m.edgeSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING, EDGE_SPACING);
- m.borderSpacing = new Insets(0, 0, 0, 0);
+ m.innerSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING,
+ EDGE_SPACING);
+ m.outerSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING,
+ EDGE_SPACING);
switch (titlePosition)
{
case ABOVE_TOP:
- m.borderSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.outerSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
break;
+ case TOP:
+ m.outerSpacing.top += m.textDescent + m.lineHeight;
+ m.innerSpacing.top += m.textAscent - m.lineHeight;
+ break;
+
case BELOW_TOP:
- m.edgeSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.innerSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
break;
case ABOVE_BOTTOM:
- m.edgeSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.innerSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
break;
case BOTTOM:
- m.edgeSpacing.bottom += Math.max(m.textAscent - m.borderInsets.bottom, 0);
- m.borderSpacing.bottom += m.textDescent;
+ m.innerSpacing.bottom += Math.max(m.textAscent - m.lineHeight, 0);
+ m.outerSpacing.bottom += m.textDescent + m.lineHeight;
break;
case BELOW_BOTTOM:
- m.borderSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.outerSpacing.bottom += m.textAscent + m.textDescent;
break;
default:
- m.borderSpacing.top += m.textAscent;
+ m.outerSpacing.top += m.textAscent;
}
return m;
@@ -1053,7 +1080,7 @@ public class TitledBorder
* which means that the font is to be retrieved from the current
* LookAndFeel. In this case, this <code>font</code> field will
* contain the result of the retrieval. Therefore, it is safe
- * to assume that his <code>font</code> field will never have
+ * to assume that this <code>font</code> field will never have
* a <code>null</code> value.
*/
Font font;
@@ -1072,6 +1099,11 @@ public class TitledBorder
*/
int textDescent;
+ /**
+ * The number of pixels between the base line and the height where
+ * a strike-through would be drawn.
+ */
+ int lineHeight;
/**
* The title text after removing leading and trailing white space
@@ -1088,7 +1120,7 @@ public class TitledBorder
/**
- * The border that constitues the interior border
+ * The border that constitutes the interior border
* underneath the title text.
*/
Border border;
@@ -1097,8 +1129,7 @@ public class TitledBorder
/**
* The distance between the TitledBorder and the interior border.
*/
- Insets borderSpacing;
-
+ Insets outerSpacing;
/**
* The width of the interior border, as returned by
@@ -1111,7 +1142,7 @@ public class TitledBorder
* The distance between the interior border and the nested
* Component for which this TitledBorder is a border.
*/
- Insets edgeSpacing;
+ Insets innerSpacing;
/**
@@ -1130,10 +1161,10 @@ public class TitledBorder
{
if (i == null)
i = new Insets(0, 0, 0, 0);
- i.left = borderSpacing.left + borderInsets.left + edgeSpacing.left;
- i.right = borderSpacing.right + borderInsets.right + edgeSpacing.right;
- i.top = borderSpacing.top + borderInsets.top + edgeSpacing.top;
- i.bottom = borderSpacing.bottom + borderInsets.bottom + edgeSpacing.bottom;
+ i.left = outerSpacing.left + borderInsets.left + innerSpacing.left;
+ i.right = outerSpacing.right + borderInsets.right + innerSpacing.right;
+ i.top = outerSpacing.top + borderInsets.top + innerSpacing.top;
+ i.bottom = outerSpacing.bottom + borderInsets.bottom + innerSpacing.bottom;
return i;
}
@@ -1148,7 +1179,8 @@ public class TitledBorder
Insets insets;
insets = getContentInsets(null);
- width = Math.max(insets.left + insets.right, textWidth + 2 * TEXT_INSET_H);
+ width = Math.max(insets.left + insets.right, textWidth + 2
+ * TEXT_INSET_H);
return new Dimension(width, insets.top + insets.bottom);
}
}
diff --git a/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java b/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java
index d55346aaf2c..efb527725fa 100644
--- a/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java
+++ b/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java
@@ -1,5 +1,5 @@
/* AbstractColorChooserPanel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,8 @@ public abstract class AbstractColorChooserPanel extends JPanel
*/
public AbstractColorChooserPanel()
{
- } // AbstractColorChooserPanel()
+ // Nothing to do here.
+ }
/**
* This method returns the name displayed in the tab for this chooser panel.
@@ -74,6 +75,36 @@ public abstract class AbstractColorChooserPanel extends JPanel
public abstract String getDisplayName();
/**
+ * Returns the key code for the mnemonic for this panel. This method returns
+ * zero to indicate no mnemonic, subclasses can override this.
+ *
+ * @return <code>0</code>, to indicate no mnemonic key code.
+ *
+ * @see #getDisplayedMnemonicIndex()
+ * @since 1.4
+ */
+ public int getMnemonic()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the index of the character in the display name that is the
+ * mnemonic. This method returns <code>-1</code> to indicate no mnemonic,
+ * subclasses can override.
+ *
+ * @return <code>-1</code>, to indicate no mnemonic.
+ *
+ * @see #getDisplayName()
+ * @see #getMnemonic()
+ * @since 1.4
+ */
+ public int getDisplayedMnemonicIndex()
+ {
+ return -1;
+ }
+
+ /**
* This method updates the chooser panel when the JColorChooser's color has
* changed.
*/
diff --git a/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java b/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java
index 77e319c70e4..923ea531ffb 100644
--- a/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java
+++ b/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java
@@ -53,7 +53,8 @@ public class ColorChooserComponentFactory
*/
private ColorChooserComponentFactory()
{
- } // ColorChooserComponentFactory()
+ // Nothing to do here.
+ }
/**
* This method returns the three default chooser panels to be used in
diff --git a/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java b/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
index f28af4cac7c..ff3436808ec 100644
--- a/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
+++ b/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
@@ -587,6 +587,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
*/
public void addLayoutComponent(String name, Component comp)
{
+ // Nothing to do here.
}
/**
@@ -634,6 +635,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
*/
public void removeLayoutComponent(Component comp)
{
+ // Nothing to do here.
}
/**
@@ -786,6 +788,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
*/
public void updateChooser()
{
+ // Nothing to do here yet.
}
/**
diff --git a/libjava/classpath/javax/swing/event/EventListenerList.java b/libjava/classpath/javax/swing/event/EventListenerList.java
index 3b9f4c807de..ee3f220f4d5 100644
--- a/libjava/classpath/javax/swing/event/EventListenerList.java
+++ b/libjava/classpath/javax/swing/event/EventListenerList.java
@@ -119,6 +119,7 @@ public class EventListenerList
*/
public EventListenerList()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/event/InternalFrameAdapter.java b/libjava/classpath/javax/swing/event/InternalFrameAdapter.java
index a2878e76e79..dfa88c3d4fd 100644
--- a/libjava/classpath/javax/swing/event/InternalFrameAdapter.java
+++ b/libjava/classpath/javax/swing/event/InternalFrameAdapter.java
@@ -39,75 +39,88 @@ exception statement from your version. */
package javax.swing.event;
/**
- * InternalFrameAdapter
+ * InternalFrameAdapter.
+ *
* @author Andrew Selkirk
*/
public abstract class InternalFrameAdapter implements InternalFrameListener
{
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * InternalFrameAdapter constructor
- */
- public InternalFrameAdapter() {
- } // InternalFrameAdapter()
-
-
- //-------------------------------------------------------------
- // Interface: InternalFrameListener ---------------------------
- //-------------------------------------------------------------
+ /**
+ * InternalFrameAdapter constructor.
+ */
+ public InternalFrameAdapter()
+ {
+ // Nothing to do here.
+ }
- /**
- * Internal frame activated
- * @param event Internal frame event
- */
- public void internalFrameActivated(InternalFrameEvent event) {
- } // internalFrameActivated()
-
- /**
- * Internal frame closed
- * @param event Internal frame event
- */
- public void internalFrameClosed(InternalFrameEvent event) {
- } // internalFrameClosed()
-
- /**
- * Internal frame closing
- * @param event Internal frame event
- */
- public void internalFrameClosing(InternalFrameEvent event) {
- } // internalFrameClosing()
-
- /**
- * Internal frame deactivated
- * @param event Internal frame event
- */
- public void internalFrameDeactivated(InternalFrameEvent event) {
- } // internalFrameDeactivated()
-
- /**
- * Internal frame deiconified
- * @param event Internal frame event
- */
- public void internalFrameDeiconified(InternalFrameEvent event) {
- } // internalFrameDeiconified()
-
- /**
- * Internal frame iconified
- * @param event Internal frame event
- */
- public void internalFrameIconified(InternalFrameEvent event) {
- } // internalFrameIconified()
-
- /**
- * Internal frame opened
- * @param event Internal frame event
- */
- public void internalFrameOpened(InternalFrameEvent event) {
- } // internalFrameOpened()
-
-
-} // InternalFrameAdapter
+ /**
+ * Internal frame activated.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameActivated(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame closed.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameClosed(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame closing.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameClosing(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame deactivated.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameDeactivated(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame deiconified.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameDeiconified(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame iconified.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameIconified(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame opened.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameOpened(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/event/ListDataListener.java b/libjava/classpath/javax/swing/event/ListDataListener.java
index 7ce17d86fa6..f42777d09d6 100644
--- a/libjava/classpath/javax/swing/event/ListDataListener.java
+++ b/libjava/classpath/javax/swing/event/ListDataListener.java
@@ -1,5 +1,5 @@
/* ListDataListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,33 +37,46 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventListener;
+import javax.swing.ListModel;
+
/**
- * ListDataListener public interface
+ * A <code>ListDataListener</code> can register with a {@link ListModel} and
+ * receive notification of updates to the model.
+ *
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public interface ListDataListener extends EventListener {
-
- /**
- * Contents Changed
- * @param event ListDataEvent Event
- */
- void contentsChanged(ListDataEvent event);
+public interface ListDataListener extends EventListener
+{
- /**
- * Interval Added
- * @param event ListDataEvent Event
- */
- void intervalAdded(ListDataEvent event);
+ /**
+ * Notifies the listener that the contents of the list have changed
+ * in some way. This method will be called if the change cannot be
+ * notified via the {@link #intervalAdded(ListDataEvent)} or the
+ * {@link #intervalRemoved(ListDataEvent)} methods.
+ *
+ * @param event the event.
+ */
+ void contentsChanged(ListDataEvent event);
- /**
- * Interval Removed
- * @param event ListDataEvent Event
- */
- void intervalRemoved(ListDataEvent event);
+ /**
+ * Notifies the listener that one or more items have been added to the
+ * list. The <code>event</code> argument can supply the indices for the
+ * range of items added.
+ *
+ * @param event the event.
+ */
+ void intervalAdded(ListDataEvent event);
+ /**
+ * Notifies the listener that one or more items have been removed from
+ * the list. The <code>event</code> argument can supply the indices for
+ * the range of items removed.
+ *
+ * @param event the event.
+ */
+ void intervalRemoved(ListDataEvent event);
-} // ListDataListener
+}
diff --git a/libjava/classpath/javax/swing/event/MouseInputListener.java b/libjava/classpath/javax/swing/event/MouseInputListener.java
index 3c3ca2347fe..3d879b9e746 100644
--- a/libjava/classpath/javax/swing/event/MouseInputListener.java
+++ b/libjava/classpath/javax/swing/event/MouseInputListener.java
@@ -37,16 +37,17 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
/**
- * MouseInputListener public interface
+ * MouseInputListener public interface.
+ *
* @author Andrew Selkirk
*/
public interface MouseInputListener extends MouseListener,
- MouseMotionListener {
-
-} // MouseInputListener
-
+ MouseMotionListener
+{
+ // This interface only pulls together MouseListener and MouseMotionListener
+ // without adding any methods on its own.
+}
diff --git a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
index 408ca957e95..7e8ff0dc2e9 100644
--- a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
+++ b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
@@ -289,10 +289,9 @@ public final class SwingPropertyChangeSupport
int index;
PropertyChangeListener listener;
- // Check Values if they are equal
- if (event.getOldValue() == null && event.getNewValue() == null ||
- (event.getOldValue() != null && event.getNewValue() != null &&
- event.getOldValue().equals(event.getNewValue())))
+ // if the old and new values are non-null and equal, don't notify listeners
+ if (event.getOldValue() != null && event.getNewValue() != null &&
+ event.getOldValue().equals(event.getNewValue()))
return;
// Process Main Listener List
diff --git a/libjava/classpath/javax/swing/event/TreeModelEvent.java b/libjava/classpath/javax/swing/event/TreeModelEvent.java
index a217e3b4053..8fa28a7eadb 100644
--- a/libjava/classpath/javax/swing/event/TreeModelEvent.java
+++ b/libjava/classpath/javax/swing/event/TreeModelEvent.java
@@ -55,12 +55,12 @@ public class TreeModelEvent extends EventObject {
/**
* childIndices
*/
- protected int[] childIndices = new int[0];
+ protected int[] childIndices = null;
/**
* children
*/
- protected Object[] children = new Object[0];
+ protected Object[] children = null;
/**
* path
@@ -164,7 +164,9 @@ public class TreeModelEvent extends EventObject {
* @returns String representation
*/
public String toString() {
- return null; // TODO
+ return getClass() + " [Source: " + getSource() + ", TreePath: " + getTreePath() +
+ ", Child Indicies: " + getChildIndices() + ", Children: " + getChildren() +
+ ", Path: " + getPath() +"]";
} // toString()
diff --git a/libjava/classpath/javax/swing/filechooser/FileFilter.java b/libjava/classpath/javax/swing/filechooser/FileFilter.java
index 42770d98186..ecfa54b5814 100644
--- a/libjava/classpath/javax/swing/filechooser/FileFilter.java
+++ b/libjava/classpath/javax/swing/filechooser/FileFilter.java
@@ -1,5 +1,5 @@
/* FileFilter.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,41 +40,46 @@ package javax.swing.filechooser;
import java.io.File;
+import javax.swing.JFileChooser;
+
/**
- * FileFilter
+ * The base class for filters that control the visibility of files in the
+ * {@link JFileChooser} component.
+ *
+ * @see JFileChooser#addChoosableFileFilter(FileFilter)
+ *
* @author Andrew Selkirk
- * @version 1.0
*/
-public abstract class FileFilter {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor FileFilter
- */
- public FileFilter() {
- // TODO
- } // FileFilter()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * accept
- * @param file TODO
- * @returns boolean
- */
- public abstract boolean accept(File file);
-
- /**
- * getDescription
- * @returns String
- */
- public abstract String getDescription();
-
-
-} // FileFilter
+public abstract class FileFilter
+{
+
+ /**
+ * Default constructor.
+ */
+ public FileFilter()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns <code>true</code> if the specified file matches the filter, and
+ * <code>false</code> otherwise.
+ *
+ * @param file the file.
+ *
+ * @returns A boolean.
+ */
+ public abstract boolean accept(File file);
+
+ /**
+ * Returns a description of the files that will be selected by the filter
+ * (for example, "Java source files"). This description will usually be
+ * displayed on the {@link JFileChooser} component, often in a combo box that
+ * is used to select the appropriate filter (in cases where more than one
+ * filter is available).
+ *
+ * @returns A description of the filter.
+ */
+ public abstract String getDescription();
+
+}
diff --git a/libjava/classpath/javax/swing/filechooser/FileSystemView.java b/libjava/classpath/javax/swing/filechooser/FileSystemView.java
index ffa41ca07de..f51b745c892 100644
--- a/libjava/classpath/javax/swing/filechooser/FileSystemView.java
+++ b/libjava/classpath/javax/swing/filechooser/FileSystemView.java
@@ -40,21 +40,27 @@ package javax.swing.filechooser;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+
import javax.swing.Icon;
+import javax.swing.JFileChooser;
/**
- * DOCUMENT ME!
+ * The base class providing a view of the file system for use by the
+ * {@link JFileChooser} component.
*/
public abstract class FileSystemView
{
+ /** The instance returned by {@link #getFileSystemView()}. */
+ private static FileSystemView defaultFileSystemView;
+
/**
- * DOCUMENT ME!
+ * Creates a new file object with the given name in the specified directory.
*
- * @param dir DOCUMENT ME!
- * @param filename DOCUMENT ME!
+ * @param dir the directory (<code>null</code> permitted).
+ * @param filename the file name.
*
- * @return DOCUMENT ME!
+ * @return A new file object.
*/
public File createFileObject(File dir, String filename)
{
@@ -62,11 +68,11 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Creates a new file object from the specified path.
*
- * @param path DOCUMENT ME!
+ * @param path the path.
*
- * @return DOCUMENT ME!
+ * @return A new file object.
*/
public File createFileObject(String path)
{
@@ -89,13 +95,16 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Creates a new folder with a unique name in the specified directory and
+ * returns a {@link File} object representing the new directory.
*
- * @param containingDir DOCUMENT ME!
+ * @param containingDir the directory to contain the new folder
+ * (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return A {@link File} object representing the new directory.
*
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an exception occurs while creating the new
+ * directory.
*/
public abstract File createNewFolder(File containingDir)
throws IOException;
@@ -115,9 +124,9 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the default directory.
*
- * @return DOCUMENT ME!
+ * @return The default directory.
*/
public File getDefaultDirectory()
{
@@ -125,12 +134,16 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns an array containing the files in the given directory. The
+ * <code>useFileHiding</code> controls whether or not hidden files are
+ * included in the result.
*
- * @param dir DOCUMENT ME!
- * @param useFileHiding DOCUMENT ME!
+ * @param dir the directory (if <code>null</code>
+ * @param useFileHiding a flag that controls whether or not hidden files are
+ * included in the result (pass in <code>true</code> to
+ * exclude hidden files).
*
- * @return DOCUMENT ME!
+ * @return The files in the given directory (possibly <code>null</code>).
*/
public File[] getFiles(File dir, boolean useFileHiding)
{
@@ -143,31 +156,34 @@ public abstract class FileSystemView
for (int i = 0; i < files.length; i++)
if (! files[i].isHidden())
trim.add(files[i]);
- File[] value = (File[]) trim.toArray(new File[0]);
+ File[] value = (File[]) trim.toArray(new File[trim.size()]);
return value;
}
/**
- * DOCUMENT ME!
+ * Returns a default {@link FileSystemView} appropriate for the platform.
*
- * @return DOCUMENT ME!
+ * @return A default {@link FileSystemView} appropriate for the platform.
*/
public static FileSystemView getFileSystemView()
{
- if (File.separator.equals("/"))
- return new UnixFileSystemView();
-
- // else if (File.Separator.equals("\"))
- // return new Win32FileSystemView();
- // else
- // return new GenericFileSystemView();
- return null;
+ if (defaultFileSystemView == null)
+ {
+ if (File.separator.equals("/"))
+ defaultFileSystemView = new UnixFileSystemView();
+ // FIXME: need to implement additional views
+ // else if (File.Separator.equals("\"))
+ // return new Win32FileSystemView();
+ // else
+ // return new GenericFileSystemView();
+ }
+ return defaultFileSystemView;
}
/**
- * DOCUMENT ME!
+ * Returns the home directory for the current user.
*
- * @return DOCUMENT ME!
+ * @return The home directory for the current user.
*/
public File getHomeDirectory()
{
@@ -175,11 +191,12 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the parent directory for the given file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The parent directory (or <code>null</code> if there is no parent
+ * directory).
*/
public File getParentDirectory(File f)
{
@@ -189,9 +206,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns an array containing the file system roots. On Unix-like platforms,
+ * this array will contain just a single item ("/"), while other platforms
+ * may return multiple roots.
+ * <p>
+ * This method is implemented to return <code>null</code>, subclasses must
+ * override this method.
+ *
+ * @return An array containing the file system roots.
*/
public File[] getRoots()
{
@@ -200,11 +222,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the name of a file as it would be displayed by the underlying
+ * system. This implementation returns <code>null</code>, subclasses must
+ * override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemDisplayName(File f)
{
@@ -212,11 +236,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the icon that would be displayed for the given file by the
+ * underlying system. This implementation returns <code>null</code>,
+ * subclasses must override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public Icon getSystemIcon(File f)
{
@@ -224,11 +250,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the type description of a file that would be displayed by the
+ * underlying system. This implementation returns <code>null</code>,
+ * subclasses must override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemTypeDescription(File f)
{
@@ -248,11 +276,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory represents a disk
+ * drive, and <code>false</code> otherwise. This default implementation
+ * always returns <code>false</code>.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>false</code>.
*/
public boolean isDrive(File dir)
{
@@ -260,11 +290,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if <code>f</code> is a file or directory, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if <code>f</code> is a file or directory, and
+ * <code>false</code> otherwise.
*/
public boolean isFileSystem(File f)
{
@@ -272,11 +304,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory is a file system root,
+ * and <code>false</code> otherwise.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the given directory is a file system root,
+ * and <code>false</code> otherwise.
*/
public boolean isFileSystemRoot(File dir)
{
@@ -291,11 +325,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory represents a floppy
+ * drive, and <code>false</code> otherwise. This default implementation
+ * always returns <code>false</code>.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>false</code>.
*/
public boolean isFloppyDrive(File dir)
{
@@ -303,11 +339,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given file is hidden, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the given file is hidden, and
+ * <code>false</code> otherwise.
*/
public boolean isHiddenFile(File f)
{
@@ -315,12 +353,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if <code>folder</code> is the parent of
+ * <code>file</code>, and <code>false</code> otherwise.
*
- * @param folder DOCUMENT ME!
- * @param file DOCUMENT ME!
+ * @param folder the folder (<code>null</code> not permitted).
+ * @param file the file (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if <code>folder</code> is the parent of
+ * <code>file</code>, and <code>false</code> otherwise.
*/
public boolean isParent(File folder, File file)
{
@@ -344,11 +384,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise. Here, all directories are considered
+ * traversable, and files are considered non-traversable.
*
- * @param f DOCUMENT ME!
+ * @param f the file or directory (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise.
*/
public Boolean isTraversable(File f)
{
@@ -356,6 +399,6 @@ public abstract class FileSystemView
// traversable. (No files are listed when you traverse the directory)
// My best guess is that as long as it's a directory, the file is
// traversable.
- return new Boolean(f.isDirectory());
+ return Boolean.valueOf(f.isDirectory());
}
}
diff --git a/libjava/classpath/javax/swing/filechooser/FileView.java b/libjava/classpath/javax/swing/filechooser/FileView.java
index c431fd46127..ea1989f9353 100644
--- a/libjava/classpath/javax/swing/filechooser/FileView.java
+++ b/libjava/classpath/javax/swing/filechooser/FileView.java
@@ -1,5 +1,5 @@
/* FileView.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,72 +43,86 @@ import java.io.File;
import javax.swing.Icon;
/**
- * FileView
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract class that provides presentation information about files and
+ * directories. .
+ *
+ * @author Andrew Selkirk
*/
-public abstract class FileView {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor FileView
- */
- public FileView() {
- // TODO
- } // FileView()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getName
- * @param file TODO
- * @returns String
- */
- public String getName(File file) {
- return null; // TODO
- } // getName()
-
- /**
- * getDescription
- * @param value0 TODO
- * @returns String
- */
- public String getDescription(File value0) {
- return null; // TODO
- } // getDescription()
-
- /**
- * getTypeDescription
- * @param value0 TODO
- * @returns String
- */
- public String getTypeDescription(File value0) {
- return null; // TODO
- } // getTypeDescription()
-
- /**
- * getIcon
- * @param value0 TODO
- * @returns Icon
- */
- public Icon getIcon(File value0) {
- return null; // TODO
- } // getIcon()
-
- /**
- * isTraversable
- * @param value0 TODO
- * @returns Boolean
- */
- public Boolean isTraversable(File value0) {
- return null; // TODO
- } // isTraversable()
-
-
-} // FileView
+public abstract class FileView
+{
+
+ /**
+ * Creates a new <code>FileView</code> instance.
+ */
+ public FileView()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the name for the specified file. This method always returns
+ * <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public String getName(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns a description for the specified file. This method always returns
+ * <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public String getDescription(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns a description for the type of the specified file. This method
+ * always returns <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public String getTypeDescription(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns an {@link Icon} to represent the specified file. This method
+ * always returns <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public Icon getIcon(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns {@link Boolean#TRUE} if the given directory is traversable, and
+ * {@link Boolean#FALSE} if it is not. This method always returns
+ * <code>null</code> and should be overridden by subclasses.
+ *
+ * @param directory the directory.
+ *
+ * @returns Always <code>null</code>.
+ */
+ public Boolean isTraversable(File directory)
+ {
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java b/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java
index f2360ec52f8..c2f65965e09 100644
--- a/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java
+++ b/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java
@@ -43,21 +43,31 @@ import javax.swing.Icon;
/**
- * DOCUMENT ME!
+ * A concrete implementation of {@link FileSystemView} that is appropriate for
+ * Unix-like systems.
+ *
+ * @see FileSystemView#getFileSystemView()
*/
class UnixFileSystemView extends FileSystemView
{
- /** DOCUMENT ME! */
+ /** The default name for new folders. */
private static final String NEW_FOLDER_NAME = "NewFolder";
/**
- * DOCUMENT ME!
+ * Creates a new folder with a unique name in the specified directory and
+ * returns a {@link File} object representing the new directory. The name
+ * of the new folder is <code>NewFolder</code> or, if a directory or file
+ * with that name already exists, <code>NewFolder.n</code> where
+ * <code>n</code> is the lowest integer greater than zero that results in
+ * a unique directory name.
*
- * @param containingDir DOCUMENT ME!
+ * @param containingDir the directory to contain the new folder
+ * (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return A {@link File} object representing the new directory.
*
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an exception occurs while creating the new
+ * directory.
*/
public File createNewFolder(File containingDir) throws IOException
{
@@ -82,9 +92,9 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns an array containing the file system root.
*
- * @return DOCUMENT ME!
+ * @return An array containing the file system root.
*/
public File[] getRoots()
{
@@ -92,11 +102,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the name of a file as it would be displayed by the underlying
+ * system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemDisplayName(File f)
{
@@ -105,11 +116,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the icon that would be displayed for the given file by the
+ * underlying system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public Icon getSystemIcon(File f)
{
@@ -118,11 +130,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the description of a file that would be displayed by the
+ * underlying system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemTypeDescription(File f)
{
diff --git a/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java b/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java
index f6af0880ddb..07292fe24a4 100644
--- a/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java
@@ -50,9 +50,7 @@ import javax.swing.ActionMap;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ActionMapUIResource
- extends ActionMap
- implements UIResource
+public class ActionMapUIResource extends ActionMap implements UIResource
{
/**
* Constructs a new ActionMapUIResource.
diff --git a/libjava/classpath/javax/swing/plaf/BorderUIResource.java b/libjava/classpath/javax/swing/plaf/BorderUIResource.java
index 4402bbb48b6..317cb09ac57 100644
--- a/libjava/classpath/javax/swing/plaf/BorderUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/BorderUIResource.java
@@ -71,9 +71,7 @@ import javax.swing.border.TitledBorder;
* @author Brian Jones (cbj@gnu.org)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class BorderUIResource
- extends Object
- implements Border, UIResource, Serializable
+public class BorderUIResource implements Border, UIResource, Serializable
{
/**
* Verified using the <code>serialver</code> tool
diff --git a/libjava/classpath/javax/swing/plaf/ButtonUI.java b/libjava/classpath/javax/swing/plaf/ButtonUI.java
index 197299e0c95..6910e42989d 100644
--- a/libjava/classpath/javax/swing/plaf/ButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/ButtonUI.java
@@ -46,7 +46,7 @@ package javax.swing.plaf;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ButtonUI
- extends ComponentUI
+public abstract class ButtonUI extends ComponentUI
{
+ // This abstract class does not define any methods of its own.
}
diff --git a/libjava/classpath/javax/swing/plaf/ColorChooserUI.java b/libjava/classpath/javax/swing/plaf/ColorChooserUI.java
index 68ffd916d21..16091416a32 100644
--- a/libjava/classpath/javax/swing/plaf/ColorChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/ColorChooserUI.java
@@ -46,8 +46,7 @@ package javax.swing.plaf;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ColorChooserUI
- extends ComponentUI
+public abstract class ColorChooserUI extends ComponentUI
{
/**
* Constructs a ColorChooserUI.
diff --git a/libjava/classpath/javax/swing/plaf/ColorUIResource.java b/libjava/classpath/javax/swing/plaf/ColorUIResource.java
index 33b1676e0fd..36e10f2d186 100644
--- a/libjava/classpath/javax/swing/plaf/ColorUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/ColorUIResource.java
@@ -50,9 +50,7 @@ import java.awt.Color;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ColorUIResource
- extends Color
- implements UIResource
+public class ColorUIResource extends Color implements UIResource
{
/**
* Constructs a <code>ColorUIResource</code> using the specified
diff --git a/libjava/classpath/javax/swing/plaf/ComboBoxUI.java b/libjava/classpath/javax/swing/plaf/ComboBoxUI.java
index 9498a48153a..3e81ed75a6b 100644
--- a/libjava/classpath/javax/swing/plaf/ComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/ComboBoxUI.java
@@ -48,14 +48,14 @@ import javax.swing.JComboBox;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ComboBoxUI
- extends ComponentUI
+public abstract class ComboBoxUI extends ComponentUI
{
/**
* Constructs a new <code>ComboBoxUI</code>.
*/
public ComboBoxUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java b/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java
index e1418710fb2..cfc43e4fc78 100644
--- a/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java
@@ -52,8 +52,7 @@ import javax.swing.JComponent;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ComponentInputMapUIResource
- extends ComponentInputMap
+public class ComponentInputMapUIResource extends ComponentInputMap
implements UIResource
{
/**
diff --git a/libjava/classpath/javax/swing/plaf/ComponentUI.java b/libjava/classpath/javax/swing/plaf/ComponentUI.java
index 0e7680542f7..6a736f258a2 100644
--- a/libjava/classpath/javax/swing/plaf/ComponentUI.java
+++ b/libjava/classpath/javax/swing/plaf/ComponentUI.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package javax.swing.plaf;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Rectangle;
import javax.accessibility.Accessible;
import javax.swing.JComponent;
@@ -86,6 +88,7 @@ public abstract class ComponentUI
*/
public ComponentUI()
{
+ // Nothing to do here.
}
@@ -157,6 +160,8 @@ public abstract class ComponentUI
*/
public void paint(Graphics g, JComponent c)
{
+ // Nothing is done here. This method is meant to be overridden by
+ // subclasses.
}
@@ -181,13 +186,14 @@ public abstract class ComponentUI
{
if (c.isOpaque())
{
+ Color oldColor = g.getColor();
g.setColor(c.getBackground());
g.fillRect(0, 0, c.getWidth(), c.getHeight());
+ g.setColor(oldColor);
}
paint(g, c);
}
-
-
+
/**
* Determines the preferred size of a component. The default
* implementation returns <code>null</code>, which means that
diff --git a/libjava/classpath/javax/swing/plaf/DesktopIconUI.java b/libjava/classpath/javax/swing/plaf/DesktopIconUI.java
index 2e44088cadd..676233ec2cf 100644
--- a/libjava/classpath/javax/swing/plaf/DesktopIconUI.java
+++ b/libjava/classpath/javax/swing/plaf/DesktopIconUI.java
@@ -44,13 +44,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class DesktopIconUI
- extends ComponentUI
+public abstract class DesktopIconUI extends ComponentUI
{
/**
* Constructs a new <code>DesktopIconUI</code>.
*/
public DesktopIconUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java
index de553eaf4de..3d4cfc830f5 100644
--- a/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java
@@ -46,14 +46,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class DesktopPaneUI
- extends ComponentUI
+public abstract class DesktopPaneUI extends ComponentUI
{
/**
* Constructs a new <code>DesktopPaneUI</code>.
*/
public DesktopPaneUI()
{
+ // Nothing to do here.
}
}
-
diff --git a/libjava/classpath/javax/swing/plaf/DimensionUIResource.java b/libjava/classpath/javax/swing/plaf/DimensionUIResource.java
index 63c6838c4d1..618c220369e 100644
--- a/libjava/classpath/javax/swing/plaf/DimensionUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/DimensionUIResource.java
@@ -51,9 +51,7 @@ import java.awt.Dimension;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class DimensionUIResource
- extends Dimension
- implements UIResource
+public class DimensionUIResource extends Dimension implements UIResource
{
/**
* Constructs a new DimensionUIResource, given its width and height.
diff --git a/libjava/classpath/javax/swing/plaf/FileChooserUI.java b/libjava/classpath/javax/swing/plaf/FileChooserUI.java
index 8b661e399a5..e9be8f2ba49 100644
--- a/libjava/classpath/javax/swing/plaf/FileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/FileChooserUI.java
@@ -53,14 +53,14 @@ import javax.swing.filechooser.FileView;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class FileChooserUI
- extends ComponentUI
+public abstract class FileChooserUI extends ComponentUI
{
/**
* Constructs a new <code>FileChooserUI</code>.
*/
public FileChooserUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/FontUIResource.java b/libjava/classpath/javax/swing/plaf/FontUIResource.java
index 1c1731048e8..c54f987fdb7 100644
--- a/libjava/classpath/javax/swing/plaf/FontUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/FontUIResource.java
@@ -50,9 +50,7 @@ import java.awt.Font;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class FontUIResource
- extends Font
- implements UIResource
+public class FontUIResource extends Font implements UIResource
{
/**
* Constructs a new <code>FontUIResource</code> given
diff --git a/libjava/classpath/javax/swing/plaf/IconUIResource.java b/libjava/classpath/javax/swing/plaf/IconUIResource.java
index 1b09ed31f39..659c8e7bab7 100644
--- a/libjava/classpath/javax/swing/plaf/IconUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/IconUIResource.java
@@ -53,8 +53,7 @@ import javax.swing.Icon;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class IconUIResource
- implements Icon, UIResource, Serializable
+public class IconUIResource implements Icon, UIResource, Serializable
{
/**
* Verified using the <code>serialver</code> tool of Sun JDK 1.4.1_01
diff --git a/libjava/classpath/javax/swing/plaf/InputMapUIResource.java b/libjava/classpath/javax/swing/plaf/InputMapUIResource.java
index ae032e51fa8..0c5f6f9e97e 100644
--- a/libjava/classpath/javax/swing/plaf/InputMapUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/InputMapUIResource.java
@@ -49,15 +49,13 @@ import javax.swing.InputMap;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class InputMapUIResource
- extends InputMap
- implements UIResource
+public class InputMapUIResource extends InputMap implements UIResource
{
/**
* Constructs a new <code>InputMapUIResource</code>.
*/
public InputMapUIResource()
{
+ // Nothing to do here.
}
}
-
diff --git a/libjava/classpath/javax/swing/plaf/InsetsUIResource.java b/libjava/classpath/javax/swing/plaf/InsetsUIResource.java
index 755d8add1b2..d64feb44c1a 100644
--- a/libjava/classpath/javax/swing/plaf/InsetsUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/InsetsUIResource.java
@@ -50,8 +50,7 @@ import java.io.Serializable;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class InsetsUIResource
- extends Insets
+public class InsetsUIResource extends Insets
implements Cloneable, UIResource, Serializable
{
/**
diff --git a/libjava/classpath/javax/swing/plaf/InternalFrameUI.java b/libjava/classpath/javax/swing/plaf/InternalFrameUI.java
index fd1e3374c13..0b2f77caa15 100644
--- a/libjava/classpath/javax/swing/plaf/InternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/InternalFrameUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class InternalFrameUI
- extends ComponentUI
+public abstract class InternalFrameUI extends ComponentUI
{
/**
* Constructs a new <code>InternalFrameUI</code>.
*/
public InternalFrameUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/LabelUI.java b/libjava/classpath/javax/swing/plaf/LabelUI.java
index 8fc1d711b0e..f4b74d59e81 100644
--- a/libjava/classpath/javax/swing/plaf/LabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/LabelUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class LabelUI
- extends ComponentUI
+public abstract class LabelUI extends ComponentUI
{
/**
* Constructs a new <code>LabelUI</code>.
*/
public LabelUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ListUI.java b/libjava/classpath/javax/swing/plaf/ListUI.java
index 66d5cf588bb..bdfe4b3078f 100644
--- a/libjava/classpath/javax/swing/plaf/ListUI.java
+++ b/libjava/classpath/javax/swing/plaf/ListUI.java
@@ -49,14 +49,14 @@ import javax.swing.JList;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ListUI
- extends ComponentUI
+public abstract class ListUI extends ComponentUI
{
/**
* Constructs a new <code>ListUI</code>.
*/
public ListUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/MenuBarUI.java b/libjava/classpath/javax/swing/plaf/MenuBarUI.java
index 8835571ac75..2c82adfa0a0 100644
--- a/libjava/classpath/javax/swing/plaf/MenuBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/MenuBarUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class MenuBarUI
- extends ComponentUI
+public abstract class MenuBarUI extends ComponentUI
{
/**
* Constructs a new <code>MenuBarUI</code>.
*/
public MenuBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/MenuItemUI.java b/libjava/classpath/javax/swing/plaf/MenuItemUI.java
index 31d73194a18..83ad52fb103 100644
--- a/libjava/classpath/javax/swing/plaf/MenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/MenuItemUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class MenuItemUI
- extends ButtonUI
+public abstract class MenuItemUI extends ButtonUI
{
/**
* Constructs a new <code>MenuItemUI</code>.
*/
public MenuItemUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/PanelUI.java b/libjava/classpath/javax/swing/plaf/PanelUI.java
index b1171b80d30..12a6f52cfa8 100644
--- a/libjava/classpath/javax/swing/plaf/PanelUI.java
+++ b/libjava/classpath/javax/swing/plaf/PanelUI.java
@@ -46,13 +46,13 @@ package javax.swing.plaf;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class PanelUI
- extends ComponentUI
+public abstract class PanelUI extends ComponentUI
{
/**
* Constructs a new <code>PanelUI</code>.
*/
public PanelUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/PopupMenuUI.java b/libjava/classpath/javax/swing/plaf/PopupMenuUI.java
index c70ad2a4e9b..de351f2ef79 100644
--- a/libjava/classpath/javax/swing/plaf/PopupMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/PopupMenuUI.java
@@ -53,14 +53,14 @@ import javax.swing.PopupFactory;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class PopupMenuUI
- extends ComponentUI
+public abstract class PopupMenuUI extends ComponentUI
{
/**
* Constructs a new <code>PopupMenuUI</code>.
*/
public PopupMenuUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/ProgressBarUI.java b/libjava/classpath/javax/swing/plaf/ProgressBarUI.java
index 79c1b95a34a..013b8c5c2e7 100644
--- a/libjava/classpath/javax/swing/plaf/ProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/ProgressBarUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ProgressBarUI
- extends ComponentUI
+public abstract class ProgressBarUI extends ComponentUI
{
/**
* Constructs a new <code>ProgressBarUI</code>.
*/
public ProgressBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/RootPaneUI.java b/libjava/classpath/javax/swing/plaf/RootPaneUI.java
index ff7d0a6e78a..9637c9cf218 100644
--- a/libjava/classpath/javax/swing/plaf/RootPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/RootPaneUI.java
@@ -46,13 +46,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class RootPaneUI
- extends ComponentUI
+public abstract class RootPaneUI extends ComponentUI
{
/**
* Constructs a new <code>RootPaneUI</code>.
*/
public RootPaneUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ScrollBarUI.java b/libjava/classpath/javax/swing/plaf/ScrollBarUI.java
index 3cad3932720..51b4bf2d853 100644
--- a/libjava/classpath/javax/swing/plaf/ScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/ScrollBarUI.java
@@ -46,13 +46,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ScrollBarUI
- extends ComponentUI
+public abstract class ScrollBarUI extends ComponentUI
{
/**
* Constructs a new <code>ScrollBarUI</code>.
*/
public ScrollBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java
index 14d2ac61ef2..8b37fed2246 100644
--- a/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ScrollPaneUI
- extends ComponentUI
+public abstract class ScrollPaneUI extends ComponentUI
{
/**
* Constructs a new <code>ScrollPaneUI</code>.
*/
public ScrollPaneUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SeparatorUI.java b/libjava/classpath/javax/swing/plaf/SeparatorUI.java
index 6855bd0357e..8a9f8cf4d49 100644
--- a/libjava/classpath/javax/swing/plaf/SeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/SeparatorUI.java
@@ -54,5 +54,6 @@ public abstract class SeparatorUI
*/
public SeparatorUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SliderUI.java b/libjava/classpath/javax/swing/plaf/SliderUI.java
index 775f19620a8..570e962aa3e 100644
--- a/libjava/classpath/javax/swing/plaf/SliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/SliderUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SliderUI
- extends ComponentUI
+public abstract class SliderUI extends ComponentUI
{
/**
* Constructs a new <code>SliderUI</code>.
*/
public SliderUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SpinnerUI.java b/libjava/classpath/javax/swing/plaf/SpinnerUI.java
index fb4a3b13a93..ca29ddb8e4f 100644
--- a/libjava/classpath/javax/swing/plaf/SpinnerUI.java
+++ b/libjava/classpath/javax/swing/plaf/SpinnerUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SpinnerUI
- extends ComponentUI
+public abstract class SpinnerUI extends ComponentUI
{
/**
* Constructs a new <code>SpinnerUI</code>.
*/
public SpinnerUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SplitPaneUI.java b/libjava/classpath/javax/swing/plaf/SplitPaneUI.java
index ea9af2b1716..59ededf5847 100644
--- a/libjava/classpath/javax/swing/plaf/SplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/SplitPaneUI.java
@@ -51,14 +51,14 @@ import javax.swing.JSplitPane;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SplitPaneUI
- extends ComponentUI
+public abstract class SplitPaneUI extends ComponentUI
{
/**
* Constructs a new <code>SplitPaneUI</code>.
*/
public SplitPaneUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java
index 6ab823b50a8..01a7720148f 100644
--- a/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java
@@ -51,14 +51,14 @@ import javax.swing.JTabbedPane;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TabbedPaneUI
- extends ComponentUI
+public abstract class TabbedPaneUI extends ComponentUI
{
/**
* Constructs a new <code>TabbedPaneUI</code>.
*/
public TabbedPaneUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/TableHeaderUI.java b/libjava/classpath/javax/swing/plaf/TableHeaderUI.java
index f23ca74d7ed..34ac0e0fc55 100644
--- a/libjava/classpath/javax/swing/plaf/TableHeaderUI.java
+++ b/libjava/classpath/javax/swing/plaf/TableHeaderUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TableHeaderUI
- extends ComponentUI
+public abstract class TableHeaderUI extends ComponentUI
{
/**
* Constructs a new <code>TableHeaderUI</code>.
*/
public TableHeaderUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/TableUI.java b/libjava/classpath/javax/swing/plaf/TableUI.java
index e56bcd13160..a8c6bf909d9 100644
--- a/libjava/classpath/javax/swing/plaf/TableUI.java
+++ b/libjava/classpath/javax/swing/plaf/TableUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TableUI
- extends ComponentUI
+public abstract class TableUI extends ComponentUI
{
/**
* Constructs a new <code>TableUI</code>.
*/
public TableUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/TextUI.java b/libjava/classpath/javax/swing/plaf/TextUI.java
index dcabdfcdbf3..9f2737cc26f 100644
--- a/libjava/classpath/javax/swing/plaf/TextUI.java
+++ b/libjava/classpath/javax/swing/plaf/TextUI.java
@@ -57,14 +57,14 @@ import javax.swing.text.View;
* @author Ronald Veldema (rveldema@cs.vu.nl)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TextUI
- extends ComponentUI
+public abstract class TextUI extends ComponentUI
{
/**
* Constructs a new <code>TextUI</code>.
*/
public TextUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/ToolBarUI.java b/libjava/classpath/javax/swing/plaf/ToolBarUI.java
index 730cf4887db..9a26e7b59d5 100644
--- a/libjava/classpath/javax/swing/plaf/ToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/ToolBarUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ToolBarUI
- extends ComponentUI
+public abstract class ToolBarUI extends ComponentUI
{
/**
* Constructs a new <code>ToolBarUI</code>.
*/
public ToolBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ToolTipUI.java b/libjava/classpath/javax/swing/plaf/ToolTipUI.java
index 4383d0edd11..ae2d465e51c 100644
--- a/libjava/classpath/javax/swing/plaf/ToolTipUI.java
+++ b/libjava/classpath/javax/swing/plaf/ToolTipUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ToolTipUI
- extends ComponentUI
+public abstract class ToolTipUI extends ComponentUI
{
/**
* Constructs a new <code>ToolTipUI</code>.
*/
public ToolTipUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/TreeUI.java b/libjava/classpath/javax/swing/plaf/TreeUI.java
index e32952de70f..308ec63e2a8 100644
--- a/libjava/classpath/javax/swing/plaf/TreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/TreeUI.java
@@ -51,14 +51,14 @@ import javax.swing.tree.TreePath;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TreeUI
- extends ComponentUI
+public abstract class TreeUI extends ComponentUI
{
/**
* Constructs a new <code>TreeUI</code>.
*/
public TreeUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/UIResource.java b/libjava/classpath/javax/swing/plaf/UIResource.java
index 59edf566605..fe398fe5474 100644
--- a/libjava/classpath/javax/swing/plaf/UIResource.java
+++ b/libjava/classpath/javax/swing/plaf/UIResource.java
@@ -50,6 +50,10 @@ package javax.swing.plaf;
* they are initialized or set to <code>null</code>.
*
* @author Brian Jones
+ *
* @see ComponentUI
*/
-public interface UIResource { }
+public interface UIResource
+{
+ // This is a marker interface and declares no methods.
+}
diff --git a/libjava/classpath/javax/swing/plaf/ViewportUI.java b/libjava/classpath/javax/swing/plaf/ViewportUI.java
index 087938f1ed2..db514de1a4e 100644
--- a/libjava/classpath/javax/swing/plaf/ViewportUI.java
+++ b/libjava/classpath/javax/swing/plaf/ViewportUI.java
@@ -48,13 +48,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ViewportUI
- extends ComponentUI
+public abstract class ViewportUI extends ComponentUI
{
/**
* Constructs a new <code>ViewportUI</code>.
*/
public ViewportUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
index 836ef223494..69d4415371f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
@@ -39,42 +39,30 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.Polygon;
import java.awt.Rectangle;
+import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.SwingConstants;
-import javax.swing.border.Border;
/**
- * This class draws simple arrow buttons for the Basic Look and Feel.
+ * A button that displays an arrow (triangle) that points {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} or {@link #WEST}. This button is used by
+ * the {@link BasicComboBoxUI} class.
+ *
+ * @see BasicComboBoxUI#createArrowButton
*/
public class BasicArrowButton extends JButton implements SwingConstants
{
- /** The default size of the Arrow buttons. */
- private static int defaultSize = 12;
- /** The Polygon that points up. */
- private static Polygon upIcon = new Polygon(new int[] { 0, 5, 9 },
- new int[] { 7, 2, 7 }, 3);
-
- /** The Polygon that points down. */
- private static Polygon downIcon = new Polygon(new int[] { 1, 5, 9 },
- new int[] { 3, 7, 3 }, 3);
-
- /** The Polygon that points left. */
- private static Polygon leftIcon = new Polygon(new int[] { 7, 3, 7 },
- new int[] { 1, 5, 9 }, 3);
-
- /** The Polygon that points right. */
- private static Polygon rightIcon = new Polygon(new int[] { 3, 7, 3 },
- new int[] { 1, 5, 9 }, 3);
-
- /** The direction to point in. */
+ /**
+ * The direction that the arrow points.
+ *
+ * @see #getDirection()
+ */
protected int direction;
/**
@@ -89,7 +77,7 @@ public class BasicArrowButton extends JButton implements SwingConstants
* edges of the button.
* This is package-private to avoid an accessor method.
*/
- transient Color darkShadow = Color.DARK_GRAY;
+ transient Color darkShadow = new Color(102, 102, 102);
/**
* The top and left edges of the button.
@@ -97,51 +85,15 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
transient Color highlight = Color.WHITE;
- /** The border around the ArrowButton. */
- private transient Border buttonBorder = new Border()
- {
- public Insets getBorderInsets(Component c)
- {
- return new Insets(2, 2, 2, 2);
- }
-
- public boolean isBorderOpaque()
- {
- return true;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int w,
- int h)
- {
- Color saved = g.getColor();
- g.setColor(highlight);
-
- g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
- g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
-
- g.setColor(shadow);
-
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
-
- g.setColor(darkShadow);
-
- g.drawLine(x, y + h, x + w, y + h);
- g.drawLine(x + w, y, x + w, y + h);
-
- g.setColor(saved);
- }
- };
-
/**
- * Creates a new BasicArrowButton object.
+ * Creates a new <code>BasicArrowButton</code> object.
*
- * @param direction The direction the arrow points in.
+ * @param direction The direction the arrow points in (one of:
+ * {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
*/
public BasicArrowButton(int direction)
{
super();
- setBorder(buttonBorder);
setDirection(direction);
}
@@ -149,7 +101,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
* Creates a new BasicArrowButton object with the given colors and
* direction.
*
- * @param direction The direction to point in.
+ * @param direction The direction to point in (one of:
+ * {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
* @param background The background color.
* @param shadow The shadow color.
* @param darkShadow The dark shadow color.
@@ -166,9 +119,10 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method returns whether the focus can traverse to this component.
+ * Returns whether the focus can traverse to this component. This method
+ * always returns <code>false</code>.
*
- * @return Whether the focus can traverse to this component.
+ * @return <code>false</code>.
*/
public boolean isFocusTraversable()
{
@@ -176,7 +130,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method returns the direction of the arrow.
+ * Returns the direction of the arrow (one of: {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
*
* @return The direction of the arrow.
*/
@@ -186,9 +141,10 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method changes the direction of the arrow.
+ * Sets the direction of the arrow.
*
- * @param dir The new direction of the arrow.
+ * @param dir The new direction of the arrow (one of: {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
*/
public void setDirection(int dir)
{
@@ -196,7 +152,7 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method paints the arrow button. The painting is delegated to the
+ * Paints the arrow button. The painting is delegated to the
* paintTriangle method.
*
* @param g The Graphics object to paint with.
@@ -204,147 +160,257 @@ public class BasicArrowButton extends JButton implements SwingConstants
public void paint(Graphics g)
{
super.paint(g);
- Insets insets = getInsets();
Rectangle bounds = getBounds();
- int x = insets.left
- + (bounds.width - insets.left - insets.right - defaultSize) / 2;
- int y = insets.top
- + (bounds.height - insets.left - insets.right - defaultSize) / 2;
- paintTriangle(g, x, y, defaultSize, direction, isEnabled());
+ int size = bounds.height / 4;
+ int x = (bounds.width - size) / 2;
+ int y = (bounds.height - size) / 2;
+ ButtonModel m = getModel();
+ if (m.isArmed())
+ {
+ x++;
+ y++;
+ }
+ paintTriangle(g, x, y, size, direction, isEnabled());
}
+ /** The preferred size for the button. */
+ private static final Dimension PREFERRED_SIZE = new Dimension(16, 16);
+
+ /** The minimum size for the button. */
+ private static final Dimension MINIMUM_SIZE = new Dimension(5, 5);
+
+ /** The maximum size for the button. */
+ private static final Dimension MAXIMUM_SIZE
+ = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+
/**
- * This method returns the preferred size of the arrow button.
+ * Returns the preferred size of the arrow button.
*
- * @return The preferred size.
+ * @return The preferred size (always 16 x 16).
*/
public Dimension getPreferredSize()
{
- Insets insets = getInsets();
- int w = defaultSize + insets.left + insets.right;
- int h = defaultSize + insets.top + insets.bottom;
-
- return new Dimension(w, h);
+ return PREFERRED_SIZE;
}
/**
- * This method returns the minimum size of the arrow button.
+ * Returns the minimum size of the arrow button.
*
- * @return The minimum size.
+ * @return The minimum size (always 5 x 5).
*/
public Dimension getMinimumSize()
{
- return getPreferredSize();
+ return MINIMUM_SIZE;
}
/**
- * This method returns the maximum size of the arrow button.
+ * Returns the maximum size of the arrow button.
*
* @return The maximum size.
*/
public Dimension getMaximumSize()
{
- return getPreferredSize();
+ return MAXIMUM_SIZE;
}
/**
- * The method paints a triangle with the given size and direction at the
- * given x and y coordinates.
+ * Paints a triangle with the given size, location and direction. It is
+ * difficult to explain the rationale behind the positioning of the triangle
+ * relative to the given (x, y) position - by trial and error we seem to
+ * match the behaviour of the reference implementation (which is missing a
+ * specification for this method).
*
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to paint at.
- * @param y The y coordinate to paint at.
- * @param size The size of the icon.
- * @param direction The direction of the icon.
- * @param isEnabled Whether it is enabled.
+ * @param g the graphics device.
+ * @param x the x-coordinate for the triangle's location.
+ * @param y the y-coordinate for the triangle's location.
+ * @param size the arrow size (depth).
+ * @param direction the direction of the arrow (one of: {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
*/
public void paintTriangle(Graphics g, int x, int y, int size, int direction,
boolean isEnabled)
{
- Polygon arrow = null;
- switch (direction)
- {
- case NORTH:
- arrow = upIcon;
- break;
- case SOUTH:
- arrow = downIcon;
- break;
- case EAST:
- case RIGHT:
- arrow = rightIcon;
- break;
- case WEST:
- case LEFT:
- arrow = leftIcon;
- break;
- }
-
- int[] xPoints = arrow.xpoints;
- int[] yPoints = arrow.ypoints;
- int x1;
- int y1;
- int x2;
- int y2;
- x1 = y1 = x2 = y2 = 0;
-
- if (size != defaultSize)
- {
- float scale = size * 1f / defaultSize;
- for (int i = 0; i < 3; i++)
- {
- xPoints[i] *= scale;
- yPoints[i] *= scale;
- }
- }
- g.translate(x, y);
-
+ Color savedColor = g.getColor();
switch (direction)
{
case NORTH:
- x1 = xPoints[0] + 2;
- y1 = yPoints[0];
- y2 = y1;
- x2 = xPoints[2] - 1;
- break;
+ paintTriangleNorth(g, x, y, size, isEnabled);
+ break;
case SOUTH:
- x1 = xPoints[1];
- y1 = yPoints[1] + 1;
- x2 = xPoints[2] - 1;
- y2 = yPoints[2];
- break;
+ paintTriangleSouth(g, x, y, size, isEnabled);
+ break;
case LEFT:
case WEST:
- x1 = xPoints[0] + 1;
- y1 = yPoints[0] + 1;
- x2 = x1;
- y2 = yPoints[2] + 1;
- break;
+ paintTriangleWest(g, x, y, size, isEnabled);
+ break;
case RIGHT:
case EAST:
- x1 = xPoints[2];
- y1 = yPoints[2] + 1;
- x2 = xPoints[1] - 1;
- y2 = yPoints[1] + 1;
- break;
+ paintTriangleEast(g, x, y, size, isEnabled);
+ break;
}
- Color saved = g.getColor();
-
+ g.setColor(savedColor);
+ }
+
+ /**
+ * Paints an upward-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleNorth(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x + (size - 2) / 2;
+ int tipY = y;
+ int baseX1 = tipX - (size - 1);
+ int baseX2 = tipX + (size - 1);
+ int baseY = y + (size - 1);
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX1, baseY);
+ triangle.addPoint(baseX2, baseY);
if (isEnabled)
- {
- g.setColor(Color.DARK_GRAY);
-
- if (arrow != null)
- g.fillPolygon(xPoints, yPoints, 3);
- }
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
else
- {
- g.setColor(Color.GRAY);
- g.fillPolygon(xPoints, yPoints, 3);
- g.setColor(Color.WHITE);
- g.drawLine(x1, y1, x2, y2);
- }
- g.setColor(saved);
- g.translate(-x, -y);
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(baseX1 + 1, baseY + 1, baseX2 + 1, baseY + 1);
+ }
+ }
+
+ /**
+ * Paints an downward-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleSouth(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x + (size - 2) / 2;
+ int tipY = y + (size - 1);
+ int baseX1 = tipX - (size - 1);
+ int baseX2 = tipX + (size - 1);
+ int baseY = y;
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX1, baseY);
+ triangle.addPoint(baseX2, baseY);
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(tipX + 1, tipY, baseX2, baseY + 1);
+ g.drawLine(tipX + 1, tipY + 1, baseX2 + 1, baseY + 1);
+ }
+ }
+
+ /**
+ * Paints a right-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleEast(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x + (size - 1);
+ int tipY = y + (size - 2) / 2;
+ int baseX = x;
+ int baseY1 = tipY - (size - 1);
+ int baseY2 = tipY + (size - 1);
+
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX, baseY1);
+ triangle.addPoint(baseX, baseY2);
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(baseX + 1, baseY2, tipX, tipY + 1);
+ g.drawLine(baseX + 1, baseY2 + 1, tipX + 1, tipY + 1);
+ }
+ }
+
+ /**
+ * Paints a left-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleWest(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x;
+ int tipY = y + (size - 2) / 2;
+ int baseX = x + (size - 1);
+ int baseY1 = tipY - (size - 1);
+ int baseY2 = tipY + (size - 1);
+
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX, baseY1);
+ triangle.addPoint(baseX, baseY2);
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(baseX + 1, baseY1 + 1, baseX + 1, baseY2 + 1);
+ }
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java b/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java
index e7d6e433877..cec7bec8501 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java
@@ -806,9 +806,9 @@ public class BasicBorders
*/
public MarginBorder()
{
+ // Nothing to do here.
}
-
/**
* Measures the width of this border.
*
@@ -1313,33 +1313,32 @@ public class BasicBorders
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
- public static class SplitPaneBorder
- implements Border, UIResource
+ public static class SplitPaneBorder implements Border, UIResource
{
/**
* Indicates that the top edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_TOP = 1;
/**
* Indicates that the left edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_LEFT = 2;
/**
* Indicates that the bottom edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_BOTTOM = 4;
/**
* Indicates that the right edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_RIGHT = 8;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java
index 5349f524049..1fca694519f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java
@@ -55,9 +55,8 @@ import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-public class BasicButtonListener
- implements MouseListener, MouseMotionListener, FocusListener,
- ChangeListener, PropertyChangeListener
+public class BasicButtonListener implements MouseListener, MouseMotionListener,
+ FocusListener, ChangeListener, PropertyChangeListener
{
public BasicButtonListener(AbstractButton b)
{
@@ -66,10 +65,12 @@ public class BasicButtonListener
public void propertyChange(PropertyChangeEvent e)
{
+ // TODO: What should be done here, if anything?
}
protected void checkOpacity(AbstractButton b)
{
+ // TODO: What should be done here?
}
public void focusGained(FocusEvent e)
@@ -129,18 +130,22 @@ public class BasicButtonListener
public void stateChanged(ChangeEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mouseDragged(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mouseClicked(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
index 6c80f14b6fc..2d3dbd350e0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
@@ -49,13 +48,19 @@ import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.InputMap;
+import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ButtonUI;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
+/**
+ * A UI delegate for the {@link JButton} component.
+ */
public class BasicButtonUI extends ButtonUI
{
/**
@@ -72,13 +77,11 @@ public class BasicButtonUI extends ButtonUI
private int textShiftOffset;
- private Color focusColor;
-
/**
* Factory method to create an instance of BasicButtonUI for a given
* {@link JComponent}, which should be an {@link AbstractButton}.
*
- * @param c The component to create a UI got
+ * @param c The component.
*
* @return A new UI capable of drawing the component
*/
@@ -87,21 +90,46 @@ public class BasicButtonUI extends ButtonUI
return new BasicButtonUI();
}
+ /**
+ * Returns the default gap between the button's text and icon (in pixels).
+ *
+ * @param b the button (ignored).
+ *
+ * @return The gap.
+ */
public int getDefaultTextIconGap(AbstractButton b)
{
return defaultTextIconGap;
}
+ /**
+ * Sets the text shift offset to zero.
+ *
+ * @see #setTextShiftOffset()
+ */
protected void clearTextShiftOffset()
{
textShiftOffset = 0;
}
+ /**
+ * Returns the text shift offset.
+ *
+ * @return The text shift offset.
+ *
+ * @see #clearTextShiftOffset()
+ * @see #setTextShiftOffset()
+ */
protected int getTextShiftOffset()
{
return textShiftOffset;
}
+ /**
+ * Sets the text shift offset to the value in {@link #defaultTextShiftOffset}.
+ *
+ * @see #clearTextShiftOffset()
+ */
protected void setTextShiftOffset()
{
textShiftOffset = defaultTextShiftOffset;
@@ -118,23 +146,33 @@ public class BasicButtonUI extends ButtonUI
return "Button.";
}
+ /**
+ * Installs the default settings.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void installDefaults(AbstractButton b)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
String prefix = getPropertyPrefix();
- focusColor = defaults.getColor(prefix + "focus");
- b.setForeground(defaults.getColor(prefix + "foreground"));
- b.setBackground(defaults.getColor(prefix + "background"));
- b.setMargin(defaults.getInsets(prefix + "margin"));
- b.setBorder(defaults.getBorder(prefix + "border"));
- b.setIconTextGap(defaults.getInt(prefix + "textIconGap"));
+ LookAndFeel.installColorsAndFont(b, prefix + "background",
+ prefix + "foreground", prefix + "font");
+ LookAndFeel.installBorder(b, prefix + "border");
+ b.setMargin(UIManager.getInsets(prefix + "margin"));
+ b.setIconTextGap(UIManager.getInt(prefix + "textIconGap"));
b.setInputMap(JComponent.WHEN_FOCUSED,
- (InputMap) defaults.get(prefix + "focusInputMap"));
- b.setOpaque(true);
+ (InputMap) UIManager.get(prefix + "focusInputMap"));
+ b.setRolloverEnabled(UIManager.getBoolean(prefix + "rollover"));
}
+ /**
+ * Removes the defaults added by {@link #installDefaults(AbstractButton)}.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void uninstallDefaults(AbstractButton b)
{
+ if (b.getFont() instanceof UIResource)
+ b.setFont(null);
b.setForeground(null);
b.setBackground(null);
b.setBorder(null);
@@ -144,11 +182,25 @@ public class BasicButtonUI extends ButtonUI
protected BasicButtonListener listener;
+ /**
+ * Creates and returns a new instance of {@link BasicButtonListener}. This
+ * method provides a hook to make it easy for subclasses to install a
+ * different listener.
+ *
+ * @param b the button.
+ *
+ * @return A new listener.
+ */
protected BasicButtonListener createButtonListener(AbstractButton b)
{
return new BasicButtonListener(b);
}
+ /**
+ * Installs listeners for the button.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void installListeners(AbstractButton b)
{
listener = createButtonListener(b);
@@ -159,6 +211,11 @@ public class BasicButtonUI extends ButtonUI
b.addMouseMotionListener(listener);
}
+ /**
+ * Uninstalls listeners for the button.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void uninstallListeners(AbstractButton b)
{
b.removeChangeListener(listener);
@@ -215,12 +272,12 @@ public class BasicButtonUI extends ButtonUI
return d;
}
- private static Icon currentIcon(AbstractButton b)
+ static Icon currentIcon(AbstractButton b)
{
Icon i = b.getIcon();
ButtonModel model = b.getModel();
- if (model.isPressed() && b.getPressedIcon() != null)
+ if (model.isPressed() && b.getPressedIcon() != null && b.isEnabled())
i = b.getPressedIcon();
else if (model.isRollover())
@@ -231,7 +288,7 @@ public class BasicButtonUI extends ButtonUI
i = b.getRolloverIcon();
}
- else if (b.isSelected())
+ else if (b.isSelected() && b.isEnabled())
{
if (b.isEnabled() && b.getSelectedIcon() != null)
i = b.getSelectedIcon();
@@ -264,7 +321,10 @@ public class BasicButtonUI extends ButtonUI
g.setFont(f);
- SwingUtilities.calculateInnerArea(b, vr);
+ if (b.isBorderPainted())
+ SwingUtilities.calculateInnerArea(b, vr);
+ else
+ vr = SwingUtilities.getLocalBounds(b);
String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
b.getText(),
currentIcon(b),
@@ -279,13 +339,11 @@ public class BasicButtonUI extends ButtonUI
if ((b.getModel().isArmed() && b.getModel().isPressed())
|| b.isSelected())
paintButtonPressed(g, b);
- else
- paintButtonNormal(g, vr, c);
paintIcon(g, c, ir);
if (text != null)
paintText(g, b, tr, text);
- if (b.isFocusOwner())
+ if (b.isFocusOwner() && b.isFocusPainted())
paintFocus(g, b, vr, tr, ir);
}
@@ -331,44 +389,25 @@ public class BasicButtonUI extends ButtonUI
/**
* Paints the background area of an {@link AbstractButton} in the pressed
- * state. This means filling the supplied area with the {@link
- * pressedBackgroundColor}.
+ * state. This means filling the supplied area with a darker than normal
+ * background.
*
* @param g The graphics context to paint with
* @param b The button to paint the state of
*/
protected void paintButtonPressed(Graphics g, AbstractButton b)
{
- if (b.isContentAreaFilled())
- {
- Rectangle area = new Rectangle();
- SwingUtilities.calculateInnerArea(b, area);
- g.setColor(b.getBackground().darker());
- g.fillRect(area.x, area.y, area.width, area.height);
- }
- }
-
- /**
- * Paints the background area of an {@link AbstractButton} in the normal,
- * non-pressed state. This means filling the supplied area with the
- * {@link normalBackgroundColor}.
- *
- * @param g The graphics context to paint with
- * @param area The area in which to paint
- * @param b The component to paint the state of
- */
- private void paintButtonNormal(Graphics g, Rectangle area, JComponent b)
- {
- if (((AbstractButton)b).isContentAreaFilled() && b.isOpaque())
+ if (b.isContentAreaFilled() && b.isOpaque())
{
- g.setColor(b.getBackground());
+ Rectangle area = new Rectangle();
+ SwingUtilities.calculateInnerArea(b, area);
+ g.setColor(UIManager.getColor(getPropertyPrefix() + "shadow"));
g.fillRect(area.x, area.y, area.width, area.height);
}
}
/**
- * Paints the "text" property of an {@link AbstractButton}, using the
- * {@link textColor} color.
+ * Paints the "text" property of an {@link AbstractButton}.
*
* @param g The graphics context to paint with
* @param c The component to paint the state of
@@ -382,8 +421,7 @@ public class BasicButtonUI extends ButtonUI
}
/**
- * Paints the "text" property of an {@link AbstractButton}, using the
- * {@link textColor} color.
+ * Paints the "text" property of an {@link AbstractButton}.
*
* @param g The graphics context to paint with
* @param b The button to paint the state of
@@ -401,15 +439,15 @@ public class BasicButtonUI extends ButtonUI
if (b.isEnabled())
{
- g.setColor(b.getForeground());
- g.drawString(text, textRect.x, textRect.y + fm.getAscent());
+ g.setColor(b.getForeground());
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
}
else
{
- g.setColor(b.getBackground().brighter());
- g.drawString(text, textRect.x, textRect.y + fm.getAscent());
- g.setColor(b.getBackground().darker());
- g.drawString(text, textRect.x + 1, textRect.y + fm.getAscent() + 1);
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ String prefix = getPropertyPrefix();
+ g.setColor(defaults.getColor(prefix + "disabledText"));
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
index 945aea53dc3..95e0dc98257 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
@@ -53,6 +53,15 @@ import javax.swing.plaf.ComponentUI;
*/
public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
{
+
+ /**
+ * Creates a new BasicCheckBoxMenuItemUI object.
+ */
+ public BasicCheckBoxMenuItemUI()
+ {
+ super();
+ }
+
/**
* Factory method to create a BasicCheckBoxMenuItemUI for the given {@link
* JComponent}, which should be a JCheckBoxMenuItem
@@ -77,18 +86,6 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
}
/**
- * This method installs the defaults that are defined in the Basic look and
- * feel for this JRadioButtonMenuItem
- */
- protected void installDefaults()
- {
- super.installDefaults();
-
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- checkIcon = defaults.getIcon("CheckBoxMenuItem.checkIcon");
- }
-
- /**
* DOCUMENT ME!
*
* @param item DOCUMENT ME!
@@ -100,5 +97,7 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
MenuElement[] path,
MenuSelectionManager manager)
{
+ // TODO: May not be implemented properly.
+ item.processMouseEvent(e, path, manager);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java
index 4e6d3815453..5a872ae6368 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java
@@ -47,8 +47,7 @@ import javax.swing.JColorChooser;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
import javax.swing.colorchooser.AbstractColorChooserPanel;
import javax.swing.colorchooser.ColorChooserComponentFactory;
import javax.swing.event.ChangeEvent;
@@ -243,12 +242,21 @@ public class BasicColorChooserUI extends ColorChooserUI
{
uninstallListeners();
uninstallDefaults();
+ uninstallDefaultChoosers();
pane = null;
chooser = null;
}
/**
+ * Uninstalls the default color choosers that have been installed by this UI.
+ */
+ protected void uninstallDefaultChoosers()
+ {
+ defaultChoosers = null;
+ }
+
+ /**
* This method installs the preview panel for the JColorChooser.
*/
protected void installPreviewPanel()
@@ -281,11 +289,9 @@ public class BasicColorChooserUI extends ColorChooserUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- chooser.setFont(defaults.getFont("ColorChooser.font"));
- chooser.setForeground(defaults.getColor("ColorChooser.foreground"));
- chooser.setBackground(defaults.getColor("ColorChooser.background"));
+ LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background",
+ "ColorChooser.foreground",
+ "ColorChooser.font");
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
index dd867f0dc55..831dde8c336 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -45,35 +45,34 @@ import java.awt.event.FocusListener;
import javax.swing.ComboBoxEditor;
import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
/**
- * This is a component that is responsible for displaying/editting selected
- * item in comboBox. By default, the JTextField is returned as
- * BasicComboBoxEditor.
+ * An editor used by the {@link BasicComboBoxUI} class. This editor uses a
+ * {@link JTextField} as the editor component.
*
* @author Olga Rodimina
*/
public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
FocusListener
{
+ /** The editor component. */
protected JTextField editor;
/**
- * Creates a new BasicComboBoxEditor object.
+ * Creates a new <code>BasicComboBoxEditor</code> instance.
*/
public BasicComboBoxEditor()
{
editor = new JTextField();
- editor.setBorder(new EmptyBorder(1, 1, 1, 1));
+ editor.setBorder(null);
+ editor.setColumns(9);
}
/**
- * This method returns textfield that will be used by the combo box to
- * display/edit currently selected item in the combo box.
+ * Returns the component that will be used by the combo box to display and
+ * edit the currently selected item in the combo box.
*
- * @return textfield that will be used by the combo box to display/edit
- * currently selected item
+ * @return The editor component, which is a {@link JTextField} in this case.
*/
public Component getEditorComponent()
{
@@ -98,15 +97,18 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
}
/**
- * This method returns item that is currently editable.
+ * Returns the text from the editor component.
*
- * @return item in the combo box that is currently editable
+ * @return The text from the editor component.
*/
public Object getItem()
{
return editor.getText();
}
+ /**
+ * Selects all the text in the editor component.
+ */
public void selectAll()
{
editor.selectAll();
@@ -136,8 +138,8 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
}
/**
- * This method adds actionListener to the editor. If the user will edit
- * currently selected item in the textfield and pressEnter, then action
+ * Adds an {@link ActionListener} to the editor component. If the user will
+ * edit currently selected item in the textfield and pressEnter, then action
* will be performed. The actionPerformed of this ActionListener should
* change the selected item of the comboBox to the newly editted selected
* item.
@@ -147,27 +149,32 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
*/
public void addActionListener(ActionListener l)
{
- // FIXME: Need to implement
+ editor.addActionListener(l);
}
/**
- * This method removes actionListener from the textfield.
+ * Removes the {@link ActionListener} from the editor component.
*
- * @param l the ActionListener to remove from the textfield.
+ * @param l the listener to remove.
*/
public void removeActionListener(ActionListener l)
{
- // FIXME: Need to implement
+ editor.removeActionListener(l);
}
+ /**
+ * A subclass of {@link BasicComboBoxEditor} that implements the
+ * {@link UIResource} interface.
+ */
public static class UIResource extends BasicComboBoxEditor
implements javax.swing.plaf.UIResource
{
/**
- * Creates a new UIResource object.
+ * Creates a new <code>BasicComboBoxEditor.UIResource</code> instance.
*/
public UIResource()
{
+ // Nothing to do here.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
index e4fbb8352a9..8115605b77a 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
@@ -1,5 +1,5 @@
/* BasicComboBoxRenderer.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,36 +40,39 @@ package javax.swing.plaf.basic;
import java.awt.Component;
import java.awt.Dimension;
+import java.awt.FontMetrics;
import java.io.Serializable;
+import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
/**
- * This class is renderer for the combo box.
+ * A renderer for a {@link JComboBox}.
*
* @author Olga Rodimina
*/
-public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
- Serializable
+public class BasicComboBoxRenderer
+ extends JLabel
+ implements ListCellRenderer, Serializable
{
/**
- * This border is used whenever renderer doesn't have a focus.
+ * A shared border instance for all renderers.
*/
protected static Border noFocusBorder = new EmptyBorder(0, 0, 0, 0);
/**
- * Creates a new BasicComboBoxRenderer object.
+ * Creates a new <code>BasicComboBoxRenderer</code> object.
*/
public BasicComboBoxRenderer()
{
setHorizontalAlignment(SwingConstants.LEFT);
+ setBorder(noFocusBorder);
}
/**
@@ -83,7 +86,8 @@ public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
}
/**
- * getListCellRendererComponent
+ * Returns a component that has been configured to display the given
+ * <code>value</code>.
*
* @param list List of items for which to the background and foreground
* colors
@@ -100,43 +104,59 @@ public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
boolean cellHasFocus)
{
String s = value.toString();
- setText(s);
+
+ // String maybe larger than comboBox.
+ FontMetrics fm = getToolkit().getFontMetrics(list.getFont());
+ int strWidth = SwingUtilities.computeStringWidth(fm, s);
+ int cbWidth = getSize().width;
+ if (cbWidth != 0 && strWidth > cbWidth)
+ {
+ char[] str = s.toCharArray();
+ int currWidth = 0;
+ int i = 0;
+ String postStr = "... ";
+ cbWidth -= SwingUtilities.computeStringWidth(fm, postStr);
+ while (i < str.length && currWidth < cbWidth)
+ {
+ ++i;
+ currWidth = SwingUtilities.computeStringWidth(fm, new String(str, 0, i));
+ }
+ setText(new String(str, 0, i) + postStr);
+ }
+ else
+ setText(s);
+
setOpaque(true);
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- if (isSelected)
+ if (isSelected || cellHasFocus)
{
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
}
else
{
- setBackground(list.getBackground());
- setForeground(list.getForeground());
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
}
setEnabled(list.isEnabled());
setFont(list.getFont());
-
- // Use focusCellHighlightBorder when renderer has focus and
- // noFocusBorder otherwise
- if (cellHasFocus)
- setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
- else
- setBorder(noFocusBorder);
-
return this;
}
+ /**
+ * A subclass of {@link BasicComboBoxRenderer} that implements the
+ * {@link javax.swing.plaf.UIResource} interface.
+ */
public static class UIResource extends BasicComboBoxRenderer
implements javax.swing.plaf.UIResource
{
/**
- * Creates a new UIResource object.
+ * Creates a new <code>UIResource</code> object.
*/
public UIResource()
{
+ // Nothing to do here.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
index 68e18a6ab01..464c8dd9f63 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -42,6 +42,8 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.LayoutManager;
@@ -69,15 +71,17 @@ import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
/**
- * UI Delegate for JComboBox
+ * A UI delegate for the {@link JComboBox} component.
*
* @author Olga Rodimina
* @author Robert Schuster
@@ -85,52 +89,54 @@ import javax.swing.plaf.ComponentUI;
public class BasicComboBoxUI extends ComboBoxUI
{
/**
- * This arrow button that is displayed in the rigth side of JComboBox. This
- * button is used to hide and show combo box's list of items
+ * The arrow button that is displayed in the right side of JComboBox. This
+ * button is used to hide and show combo box's list of items.
*/
protected JButton arrowButton;
/**
- * The combo box for which this UI delegate is for
+ * The combo box represented by this UI delegate.
*/
protected JComboBox comboBox;
/**
- * Component that is responsible for displaying/editting selected item of
- * the combo box. By default JTextField is used as an editor for the
- * JComboBox
+ * The component that is responsible for displaying/editing the selected
+ * item of the combo box.
+ *
+ * @see BasicComboBoxEditor#getEditorComponent()
*/
protected Component editor;
/**
- * Listener listening to focus events occuring in the JComboBox
+ * A listener listening to focus events occurring in the {@link JComboBox}.
*/
protected FocusListener focusListener;
/**
- * tells whether JComboBox currently has focus
+ * A flag indicating whether JComboBox currently has the focus.
*/
protected boolean hasFocus;
/**
- * Listener listening to item events fired by the JComboBox
+ * A listener listening to item events fired by the {@link JComboBox}.
*/
protected ItemListener itemListener;
/**
- * KeyListener listening to key events that occur while JComboBox has focus
+ * A listener listening to key events that occur while {@link JComboBox} has
+ * the focus.
*/
protected KeyListener keyListener;
/**
- * MouseListener listening to mouse events occuring in the combo box
+ * A listener listening to mouse events occuring in the {@link JComboBox}.
*/
private MouseListener mouseListener;
/**
* List used when rendering selected item of the combo box. The selection
- * and foreground colors for combo box renderer are configured from this
- * list
+ * and foreground colors for combo box renderer are configured from this
+ * list.
*/
protected JList listBox;
@@ -140,11 +146,14 @@ public class BasicComboBoxUI extends ComboBoxUI
protected ListDataListener listDataListener;
/**
- * Popup list containing combo box's menu items
+ * Popup list containing the combo box's menu items.
*/
protected ComboPopup popup;
+
protected KeyListener popupKeyListener;
+
protected MouseListener popupMouseListener;
+
protected MouseMotionListener popupMouseMotionListener;
/**
@@ -152,30 +161,34 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
protected PropertyChangeListener propertyChangeListener;
+ /**
+ * The button background.
+ * @see #installDefaults()
+ */
+ private Color buttonBackground;
+
+ /**
+ * The button shadow.
+ * @see #installDefaults()
+ */
+ private Color buttonShadow;
+
/**
- * Colors that are used to render selected item in the combo box.
+ * The button dark shadow.
+ * @see #installDefaults()
*/
- private Color shadow;
- private Color darkShadow;
- private Color highlight;
- private Color lightHighlight;
+ private Color buttonDarkShadow;
+
+ /**
+ * The button highlight.
+ * @see #installDefaults()
+ */
+ private Color buttonHighlight;
/* Size of the largest item in the comboBox
* This is package-private to avoid an accessor method.
*/
- Dimension largestItemSize;
-
- // It seems that JComboBox doesn't have a border set explicitely. So we just
- // paint the border everytime combo box is displayed.
-
- /* border insets for this JComboBox
- * This is package-private to avoid an accessor method. */
- static final Insets borderInsets = new Insets(2, 2, 2, 2);
-
- // Width of the arrow button
- // This is package-private to avoid an accessor method.
- // FIXME: has wrong name for a constant.
- static final int arrowButtonWidth = 15;
+ Dimension displaySize;
// FIXME: This fields aren't used anywhere at this moment.
protected Dimension cachedMinimumSize;
@@ -183,19 +196,20 @@ public class BasicComboBoxUI extends ComboBoxUI
protected boolean isMinimumSizeDirty;
/**
- * Creates a new BasicComboBoxUI object.
+ * Creates a new <code>BasicComboBoxUI</code> object.
*/
public BasicComboBoxUI()
{
+ // Nothing to do here.
}
/**
- * Factory method to create a BasicComboBoxUI for the given {@link
- * JComponent}, which should be a {@link JComboBox}.
+ * A factory method to create a UI delegate for the given
+ * {@link JComponent}, which should be a {@link JComboBox}.
*
* @param c The {@link JComponent} a UI is being created for.
*
- * @return A BasicComboBoxUI for the {@link JComponent}.
+ * @return A UI delegate for the {@link JComponent}.
*/
public static ComponentUI createUI(JComponent c)
{
@@ -203,9 +217,11 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method installs the UI for the given JComponent.
+ * Installs the UI for the given {@link JComponent}.
*
- * @param c The JComponent to install a UI for.
+ * @param c the JComponent to install a UI for.
+ *
+ * @see #uninstallUI(JComponent)
*/
public void installUI(JComponent c)
{
@@ -213,20 +229,22 @@ public class BasicComboBoxUI extends ComboBoxUI
if (c instanceof JComboBox)
{
- comboBox = (JComboBox) c;
- comboBox.setOpaque(true);
- comboBox.setLayout(createLayoutManager());
- installDefaults();
- installComponents();
- installListeners();
- installKeyboardActions();
+ comboBox = (JComboBox) c;
+ comboBox.setOpaque(true);
+ comboBox.setLayout(createLayoutManager());
+ installDefaults();
+ installComponents();
+ installListeners();
+ installKeyboardActions();
}
}
/**
- * This method uninstalls the UI.
+ * Uninstalls the UI for the given {@link JComponent}.
*
* @param c The JComponent that is having this UI removed.
+ *
+ * @see #installUI(JComponent)
*/
public void uninstallUI(JComponent c)
{
@@ -238,27 +256,27 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method installs the defaults that are defined in the Basic look and
- * feel for this {@link JComboBox}.
+ * Installs the defaults that are defined in the {@link BasicLookAndFeel}
+ * for this {@link JComboBox}.
+ *
+ * @see #uninstallDefaults()
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- comboBox.setBackground(defaults.getColor("ComboBox.background"));
- comboBox.setFont(defaults.getFont("ComboBox.font"));
- comboBox.setForeground(defaults.getColor("ComboBox.foreground"));
-
- // Set default color that should be used to to render selected item
- // of the combo box.
- shadow = defaults.getColor("Button.shadow");
- darkShadow = defaults.getColor("Button.darkShadow");
- lightHighlight = defaults.getColor("Button.light");
- highlight = defaults.getColor("Button.highlight");
+ LookAndFeel.installColorsAndFont(comboBox, "ComboBox.background",
+ "ComboBox.foreground", "ComboBox.font");
+
+ // fetch the button color scheme
+ buttonBackground = UIManager.getColor("ComboBox.buttonBackground");
+ buttonShadow = UIManager.getColor("ComboBox.buttonShadow");
+ buttonDarkShadow = UIManager.getColor("ComboBox.buttonDarkShadow");
+ buttonHighlight = UIManager.getColor("ComboBox.buttonHighlight");
}
/**
- * This method creates and installs the listeners for this UI.
+ * Creates and installs the listeners for this UI.
+ *
+ * @see #uninstallListeners()
*/
protected void installListeners()
{
@@ -268,6 +286,7 @@ public class BasicComboBoxUI extends ComboBoxUI
focusListener = createFocusListener();
comboBox.addFocusListener(focusListener);
+ listBox.addFocusListener(focusListener);
itemListener = createItemListener();
comboBox.addItemListener(itemListener);
@@ -276,35 +295,40 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.addKeyListener(keyListener);
mouseListener = createMouseListener();
- comboBox.addMouseListener(mouseListener);
+ arrowButton.addMouseListener(mouseListener);
// install listeners that listen to combo box model
listDataListener = createListDataListener();
comboBox.getModel().addListDataListener(listDataListener);
-
- configureArrowButton();
}
/**
- * This method uninstalls the defaults and sets any objects created during
- * install to null
+ * Uninstalls the defaults and sets any objects created during
+ * install to <code>null</code>.
+ *
+ * @see #installDefaults()
*/
protected void uninstallDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- comboBox.setBackground(null);
- comboBox.setFont(null);
- comboBox.setForeground(null);
-
- shadow = null;
- darkShadow = null;
- lightHighlight = null;
- highlight = null;
+ if (comboBox.getFont() instanceof UIResource)
+ comboBox.setFont(null);
+
+ if (comboBox.getForeground() instanceof UIResource)
+ comboBox.setForeground(null);
+
+ if (comboBox.getBackground() instanceof UIResource)
+ comboBox.setBackground(null);
+
+ buttonBackground = null;
+ buttonShadow = null;
+ buttonDarkShadow = null;
+ buttonHighlight = null;
}
/**
* Detaches all the listeners we attached in {@link #installListeners}.
+ *
+ * @see #installListeners()
*/
protected void uninstallListeners()
{
@@ -312,6 +336,7 @@ public class BasicComboBoxUI extends ComboBoxUI
propertyChangeListener = null;
comboBox.removeFocusListener(focusListener);
+ listBox.removeFocusListener(focusListener);
focusListener = null;
comboBox.removeItemListener(itemListener);
@@ -320,17 +345,15 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.removeKeyListener(keyListener);
keyListener = null;
- comboBox.removeMouseListener(mouseListener);
+ arrowButton.removeMouseListener(mouseListener);
mouseListener = null;
comboBox.getModel().removeListDataListener(listDataListener);
listDataListener = null;
-
- unconfigureArrowButton();
}
/**
- * This method creates popup that will contain list of combo box's items
+ * Creates the popup that will contain list of combo box's items.
*
* @return popup containing list of combo box's items
*/
@@ -340,7 +363,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Creates KeyListener to listen to key events.
+ * Creates a {@link KeyListener} to listen to key events.
*
* @return KeyListener that listens to key events.
*/
@@ -350,8 +373,8 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method create MouseListener that will listen to mouse event occuring
- * in combo box.
+ * Creates a {@link MouseListener} that will listen to mouse events occurring
+ * in the combo box.
*
* @return the MouseListener
*/
@@ -361,10 +384,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method create FocusListener that will listen to changes in this
+ * Creates the {@link FocusListener} that will listen to changes in this
* JComboBox's focus.
*
- * @return theFocusListener
+ * @return the FocusListener.
*/
protected FocusListener createFocusListener()
{
@@ -372,9 +395,9 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method create ListDataListener to listen to ComboBox's data model
+ * Creates a {@link ListDataListener} to listen to the combo box's data model.
*
- * @return ListDataListener
+ * @return The new listener.
*/
protected ListDataListener createListDataListener()
{
@@ -382,10 +405,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method creates ItemListener that will listen to to the changes in
+ * Creates an {@link ItemListener} that will listen to the changes in
* the JComboBox's selection.
*
- * @return the ItemListener
+ * @return The ItemListener
*/
protected ItemListener createItemListener()
{
@@ -393,10 +416,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method creates PropertyChangeListener to listen to the changes in
+ * Creates a {@link PropertyChangeListener} to listen to the changes in
* the JComboBox's bound properties.
*
- * @return the PropertyChangeListener
+ * @return The PropertyChangeListener
*/
protected PropertyChangeListener createPropertyChangeListener()
{
@@ -404,9 +427,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method returns layout manager for the combo box.
+ * Creates and returns a layout manager for the combo box. Subclasses can
+ * override this method to provide a different layout.
*
- * @return layout manager for the combo box
+ * @return a layout manager for the combo box.
*/
protected LayoutManager createLayoutManager()
{
@@ -414,10 +438,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method creates component that will be responsible for rendering the
+ * Creates a component that will be responsible for rendering the
* selected component in the combo box.
*
- * @return render for the combo box
+ * @return A renderer for the combo box.
*/
protected ListCellRenderer createRenderer()
{
@@ -425,58 +449,54 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Creates component that will be responsible for displaying/editting
- * selected item in the combo box. This editor is used only when combo box
- * is editable.
+ * Creates the component that will be responsible for displaying/editing
+ * the selected item in the combo box. This editor is used only when combo
+ * box is editable.
*
- * @return component that will be responsible for displaying/editting
- * selected item in the combo box.
+ * @return A new component that will be responsible for displaying/editing
+ * the selected item in the combo box.
*/
protected ComboBoxEditor createEditor()
{
- return new BasicComboBoxEditor();
+ return new BasicComboBoxEditor.UIResource();
}
/**
- * This method installs components for this JComboBox. ArrowButton, main
- * part of combo box (upper part) and popup list of items are created and
+ * Installs the components for this JComboBox. ArrowButton, main
+ * part of combo box (upper part) and popup list of items are created and
* configured here.
*/
protected void installComponents()
{
- // create and install arrow button
- arrowButton = createArrowButton();
-
- comboBox.add(arrowButton);
-
- // Set list that will be used by BasicComboBoxRender
- // in order to determine the right colors when rendering
- listBox = new JList();
-
- Color background = arrowButton.getBackground();
- listBox.setBackground(background);
- listBox.setSelectionBackground(background.darker());
-
- Color foreground = arrowButton.getForeground();
- listBox.setForeground(foreground);
- listBox.setSelectionForeground(foreground);
+ // create drop down list of items
+ popup = createPopup();
+ listBox = popup.getList();
// set editor and renderer for the combo box. Editor is used
// only if combo box becomes editable, otherwise renderer is used
// to paint the selected item; combobox is not editable by default.
comboBox.setRenderer(createRenderer());
- comboBox.setEditor(createEditor());
- editor = comboBox.getEditor().getEditorComponent();
+ // create and install arrow button
+ arrowButton = createArrowButton();
+ configureArrowButton();
+ comboBox.add(arrowButton);
- // create drop down list of items
- popup = createPopup();
+ ComboBoxEditor currentEditor = comboBox.getEditor();
+ if (currentEditor == null || currentEditor instanceof UIResource)
+ {
+ currentEditor = createEditor();
+ comboBox.setEditor(currentEditor);
+ }
+ editor = currentEditor.getEditorComponent();
comboBox.revalidate();
}
/**
- * This method uninstalls components from this JComboBox
+ * Uninstalls components from this {@link JComboBox}.
+ *
+ * @see #installComponents()
*/
protected void uninstallComponents()
{
@@ -490,12 +510,18 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.setRenderer(null);
- comboBox.setEditor(null);
- editor = null;
+ // if the editor is not an instanceof UIResource, it was not set by the
+ // UI delegate, so don't clear it...
+ ComboBoxEditor currentEditor = comboBox.getEditor();
+ if (currentEditor instanceof UIResource)
+ {
+ comboBox.setEditor(null);
+ editor = null;
+ }
}
/**
- * This method adds editor to the combo box
+ * Adds the current editor to the combo box.
*/
public void addEditor()
{
@@ -503,7 +529,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method removes editor from the combo box
+ * Removes the current editor from the combo box.
*/
public void removeEditor()
{
@@ -511,15 +537,17 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method configures editor for this combo box.
+ * Configures the editor for this combo box.
*/
protected void configureEditor()
{
+ editor.setFont(comboBox.getFont());
+ comboBox.getEditor().setItem(comboBox.getSelectedItem());
// FIXME: Need to implement. Set font and add listeners.
}
/**
- * This method removes all the listeners for the editor.
+ * Unconfigures the editor for this combo nox. This method is not implemented.
*/
protected void unconfigureEditor()
{
@@ -527,42 +555,50 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method adds listeners to the arrow button part of the combo box.
+ * Configures the arrow button.
+ *
+ * @see #configureArrowButton()
*/
public void configureArrowButton()
{
- arrowButton.addMouseListener(mouseListener);
+ arrowButton.setEnabled(comboBox.isEnabled());
+ arrowButton.setFont(comboBox.getFont());
}
/**
- * This method removes listeners from the arrow button part of the combo
- * box.
+ * Unconfigures the arrow button.
+ *
+ * @see #configureArrowButton()
+ *
+ * @specnote The specification says this method is implementation specific
+ * and should not be used or overridden.
*/
public void unconfigureArrowButton()
{
- arrowButton.removeMouseListener(mouseListener);
+ // Nothing to do here yet.
}
/**
- * This method create arrow button for this JComboBox. Arrow button is
- * responsible for displaying / hiding drop down list of items when it is
- * clicked.
+ * Creates an arrow button for this {@link JComboBox}. The arrow button is
+ * displayed at the right end of the combo box and is used to display/hide
+ * the drop down list of items.
*
- * @return JButton arrow button for this JComboBox.
+ * @return A new button.
*/
protected JButton createArrowButton()
{
- return new BasicArrowButton(BasicArrowButton.SOUTH);
+ return new BasicArrowButton(BasicArrowButton.SOUTH, buttonBackground,
+ buttonShadow, buttonDarkShadow, buttonHighlight);
}
/**
- * This method checks if popup part of the combo box is visible on the
- * screen
+ * Returns <code>true</code> if the popup is visible, and <code>false</code>
+ * otherwise.
*
* @param c The JComboBox to check
*
- * @return true if popup part of the JComboBox is visible and false
- * otherwise.
+ * @return <code>true</code> if popup part of the JComboBox is visible and
+ * <code>false</code> otherwise.
*/
public boolean isPopupVisible(JComboBox c)
{
@@ -570,7 +606,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Displays/Hides JComboBox's list of items on the screen.
+ * Displays/hides the {@link JComboBox}'s list of items on the screen.
*
* @param c The combo box, for which list of items should be
* displayed/hidden
@@ -579,7 +615,10 @@ public class BasicComboBoxUI extends ComboBoxUI
public void setPopupVisible(JComboBox c, boolean v)
{
if (v)
- popup.show();
+ {
+ popup.show();
+ popup.getList().requestFocus();
+ }
else
popup.hide();
}
@@ -593,7 +632,7 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public boolean isFocusTraversable(JComboBox c)
{
- if (comboBox.isEditable())
+ if (!comboBox.isEditable())
return true;
return false;
@@ -607,56 +646,28 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public void paint(Graphics g, JComponent c)
{
- if (c instanceof JComboBox)
- {
- JComboBox cb = (JComboBox) c;
-
- paintBorder(g, comboBox.getBounds(), hasFocus);
-
- Rectangle rect = rectangleForCurrentValue();
- paintCurrentValueBackground(g, rect, hasFocus);
- paintCurrentValue(g, rect, hasFocus);
- }
- }
-
- private void paintBorder(Graphics g, Rectangle bounds, boolean hasFocus)
- {
- int x = 0;
- int y = 0;
- int width = bounds.width;
- int height = bounds.height;
-
- Color oldColor = g.getColor();
-
- if (! arrowButton.getModel().isPressed())
- BasicGraphicsUtils.drawEtchedRect(g, x, y, width, height, Color.gray,
- Color.white, Color.gray, Color.white);
- else
- {
- g.setColor(darkShadow);
- g.drawRect(x, y, width, height);
- g.setColor(shadow);
- g.drawRect(x + 1, y + 1, width - 3, height - 3);
- }
- g.setColor(oldColor);
+ Rectangle rect = rectangleForCurrentValue();
+ paintCurrentValueBackground(g, rect, hasFocus);
+ paintCurrentValue(g, rect, hasFocus);
}
/**
- * Returns preferred size for the given menu item.
+ * Returns preferred size for the combo box.
*
* @param c comboBox for which to get preferred size
*
- * @return $Dimension$ preferred size for the given combo box
+ * @return The preferred size for the given combo box
*/
public Dimension getPreferredSize(JComponent c)
{
- // return null to indicate that combo box's layout will determin its
- // preferred size
- return null;
+ // note: overriding getMinimumSize() (for example in the MetalComboBoxUI
+ // class) affects the getPreferredSize() result, so it seems logical that
+ // this method is implemented by delegating to the getMinimumSize() method
+ return getMinimumSize(c);
}
/**
- * This method returns the minimum size for this {@link JComboBox} for this
+ * Returns the minimum size for this {@link JComboBox} for this
* look and feel.
*
* @param c The {@link JComponent} to find the minimum size for.
@@ -665,20 +676,26 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public Dimension getMinimumSize(JComponent c)
{
- return null;
+ Dimension d = getDisplaySize();
+ int arrowButtonWidth = d.height;
+ Dimension result = new Dimension(d.width + arrowButtonWidth, d.height);
+ return result;
}
+ /** The value returned by the getMaximumSize() method. */
+ private static final Dimension MAXIMUM_SIZE = new Dimension(32767, 32767);
+
/**
- * This method returns the maximum size for this {@link JComboBox} for this
+ * Returns the maximum size for this {@link JComboBox} for this
* look and feel.
*
* @param c The {@link JComponent} to find the maximum size for
*
- * @return The dimensions of the minimum size.
+ * @return The maximum size (<code>Dimension(32767, 32767)</code>).
*/
public Dimension getMaximumSize(JComponent c)
{
- return null;
+ return MAXIMUM_SIZE;
}
public int getAccessibleChildrenCount(JComponent c)
@@ -707,7 +724,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method selects next possible item relative to the current selection
+ * Selects next possible item relative to the current selection
* to be next selected item in the combo box.
*/
protected void selectNextPossibleValue()
@@ -718,7 +735,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method selects previous item relative to current selection to be
+ * Selects previous item relative to current selection to be
* next selected item.
*/
protected void selectPreviousPossibleValue()
@@ -729,8 +746,8 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method displays combo box popup if the popup is not currently shown
- * on the screen and hides it if it is currently shown
+ * Displays combo box popup if the popup is not currently shown
+ * on the screen and hides it if it is currently shown
*/
protected void toggleOpenClose()
{
@@ -738,34 +755,23 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method returns bounds in which comboBox's selected Item will be
- * displayed
+ * Returns the bounds in which comboBox's selected item will be
+ * displayed.
*
* @return rectangle bounds in which comboBox's selected Item will be
* displayed
*/
protected Rectangle rectangleForCurrentValue()
{
- Rectangle cbBounds = comboBox.getBounds();
-
- // Subtract width or the arrow button and border insets
- Rectangle rectForCurrentValue = new Rectangle(cbBounds.x
- + borderInsets.left,
- cbBounds.y
- + borderInsets.top,
- cbBounds.width
- - arrowButtonWidth
- - borderInsets.left
- - borderInsets.right,
- cbBounds.height
- - borderInsets.top
- - borderInsets.bottom);
-
+ Rectangle cbBounds = SwingUtilities.getLocalBounds(comboBox);
+ Rectangle abBounds = arrowButton.getBounds();
+ Rectangle rectForCurrentValue = new Rectangle(cbBounds.x, cbBounds.y,
+ cbBounds.width - abBounds.width, cbBounds.height);
return rectForCurrentValue;
}
/**
- * This method returns insets of the current border.
+ * Returns the insets of the current border.
*
* @return Insets representing space between combo box and its border
*/
@@ -775,7 +781,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method paints currently selected value in the main part of the combo
+ * Paints currently selected value in the main part of the combo
* box (part without popup).
*
* @param g graphics context
@@ -794,28 +800,29 @@ public class BasicComboBoxUI extends ComboBoxUI
* If there is currently no selected item we will take an empty
* String as replacement.
*/
- Component comp = comboBox.getRenderer()
- .getListCellRendererComponent(listBox,
- (currentValue != null ? currentValue : ""),
- -1,
- isPressed,
- hasFocus);
- if (! comboBox.isEnabled())
- comp.setEnabled(false);
-
- g.translate(borderInsets.left, borderInsets.top);
- comp.setBounds(0, 0, bounds.width, bounds.height);
- comp.paint(g);
- g.translate(-borderInsets.left, -borderInsets.top);
-
- comboBox.revalidate();
+ Component comp = comboBox.getRenderer().getListCellRendererComponent(
+ listBox, (currentValue != null ? currentValue : ""), -1,
+ isPressed, hasFocus);
+ if (! comboBox.isEnabled())
+ {
+ comp.setBackground(UIManager.getLookAndFeelDefaults().getColor(
+ "ComboBox.disabledBackground"));
+ comp.setForeground(UIManager.getLookAndFeelDefaults().getColor(
+ "ComboBox.disabledForeground"));
+ comp.setEnabled(false);
+ }
+ comp.setBounds(0, 0, bounds.width, bounds.height);
+ comp.setFont(comboBox.getFont());
+ comp.paint(g);
+
+ comboBox.revalidate();
}
else
comboBox.getEditor().setItem(comboBox.getSelectedItem());
}
/**
- * This method paints background of part of the combo box, where currently
+ * Paints the background of part of the combo box, where currently
* selected value is displayed. If the combo box has focus this method
* should also paint focus rectangle around the combo box.
*
@@ -832,58 +839,102 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Returns default size for the combo box that doesn't contain any elements
- * in it
+ * Returns the default size for the display area of a combo box that does
+ * not contain any elements. This method returns the width and height of
+ * a single space in the current font, plus a margin of 1 pixel.
*
- * @return Default size of the combo box with no elements in it.
+ * @return The default display size.
+ *
+ * @see #getDisplaySize()
*/
protected Dimension getDefaultSize()
{
- return new Dimension(6, 17);
+ // There is nothing in the spec to say how this method should be
+ // implemented...so I've done some guessing, written some Mauve tests,
+ // and written something that gives dimensions that are close to the
+ // reference implementation.
+ FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont());
+ int w = fm.charWidth(' ') + 2;
+ int h = fm.getHeight() + 2;
+ return new Dimension(w, h);
}
/**
- * Returns size of the largest item in the combo box. This size will be the
- * size of the combo box, not including the arrowButton.
+ * Returns the size of the display area for the combo box. This size will be
+ * the size of the combo box, not including the arrowButton.
*
- * @return dimensions of the largest item in the combo box.
+ * @return The size of the display area for the combo box.
*/
- protected Dimension getLargestItemSize()
+ protected Dimension getDisplaySize()
{
- ComboBoxModel model = comboBox.getModel();
- int numItems = model.getSize();
-
- // if combo box doesn't have any items then simply
- // return its default size
- if (numItems == 0)
+ if (!comboBox.isEditable())
{
- largestItemSize = getDefaultSize();
- return largestItemSize;
+ Object prototype = comboBox.getPrototypeDisplayValue();
+ if (prototype != null)
+ {
+ // calculate result based on prototype
+ ListCellRenderer renderer = comboBox.getRenderer();
+ Component comp = renderer.getListCellRendererComponent(listBox,
+ prototype, -1, false, false);
+ Dimension compSize = comp.getPreferredSize();
+ compSize.width += 2; // add 1 pixel margin around area
+ compSize.height += 2;
+ return compSize;
+ }
+ else
+ {
+ ComboBoxModel model = comboBox.getModel();
+ int numItems = model.getSize();
+
+ // if combo box doesn't have any items then simply
+ // return its default size
+ if (numItems == 0)
+ {
+ displaySize = getDefaultSize();
+ return displaySize;
+ }
+
+ Dimension size = new Dimension(0, 0);
+
+ // ComboBox's display size should be equal to the
+ // size of the largest item in the combo box.
+ ListCellRenderer renderer = comboBox.getRenderer();
+
+ for (int i = 0; i < numItems; i++)
+ {
+ Object item = model.getElementAt(i);
+ Component comp = renderer.getListCellRendererComponent(listBox,
+ item, -1, false, false);
+
+ Dimension compSize = comp.getPreferredSize();
+ if (compSize.width + 2 > size.width)
+ size.width = compSize.width + 2;
+ if (compSize.height + 2 > size.height)
+ size.height = compSize.height + 2;
+ }
+ displaySize = size;
+ return displaySize;
+ }
}
-
- Dimension size = new Dimension(0, 0);
-
- // ComboBox's display size should be equal to the
- // size of the largest item in the combo box.
- ListCellRenderer renderer = comboBox.getRenderer();
-
- for (int i = 0; i < numItems; i++)
+ else // an editable combo,
{
- Object item = model.getElementAt(i);
- String s = item.toString();
- Component comp = renderer.getListCellRendererComponent(listBox, item,
- -1, false, false);
-
- if (comp.getPreferredSize().getWidth() > size.getWidth())
- size = comp.getPreferredSize();
+ Component comp = comboBox.getEditor().getEditorComponent();
+ Dimension prefSize = comp.getPreferredSize();
+ int width = prefSize.width;
+ int height = prefSize.height + 2;
+ Object prototype = comboBox.getPrototypeDisplayValue();
+ if (prototype != null)
+ {
+ FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont());
+ width = Math.max(width, fm.stringWidth(prototype.toString()) + 2);
+ }
+ displaySize = new Dimension(width, height);
+ return displaySize;
}
-
- largestItemSize = size;
- return largestItemSize;
}
/**
- * This method installs the keyboard actions for the JComboBox as specified
+ * Installs the keyboard actions for the {@link JComboBox} as specified
* by the look and feel.
*/
protected void installKeyboardActions()
@@ -892,7 +943,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method uninstalls the keyboard actions for the JComboBox there were
+ * Uninstalls the keyboard actions for the {@link JComboBox} there were
* installed by in {@link #installListeners}.
*/
protected void uninstallKeyboardActions()
@@ -901,22 +952,39 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This class is Layout Manager for this combo box.
+ * A {@link LayoutManager} used to position the sub-components of the
+ * {@link JComboBox}.
+ *
+ * @see BasicComboBoxUI#createLayoutManager()
*/
- public class ComboBoxLayoutManager extends Object implements LayoutManager
+ public class ComboBoxLayoutManager implements LayoutManager
{
/**
* Creates a new ComboBoxLayoutManager object.
*/
public ComboBoxLayoutManager()
{
+ // Nothing to do here.
}
+ /**
+ * Adds a component to the layout. This method does nothing, since the
+ * layout manager doesn't need to track the components.
+ *
+ * @param name the name to associate the component with (ignored).
+ * @param comp the component (ignored).
+ */
public void addLayoutComponent(String name, Component comp)
{
// Do nothing
}
+ /**
+ * Removes a component from the layout. This method does nothing, since
+ * the layout manager doesn't need to track the components.
+ *
+ * @param comp the component.
+ */
public void removeLayoutComponent(Component comp)
{
// Do nothing
@@ -925,43 +993,30 @@ public class BasicComboBoxUI extends ComboBoxUI
/**
* Returns preferred layout size of the JComboBox.
*
- * @param parent Container for which preferred size should be calculated
+ * @param parent the Container for which the preferred size should be
+ * calculated.
*
- * @return preferred size for the given container
+ * @return The preferred size for the given container
*/
public Dimension preferredLayoutSize(Container parent)
{
- Dimension d = new Dimension(0, 0);
-
- if (largestItemSize == null)
- largestItemSize = getLargestItemSize();
-
- // add size for the area that will display selected item
- d.width += largestItemSize.getWidth();
- d.height += largestItemSize.getHeight();
-
- // add size of the arrow button
- d.width += arrowButtonWidth;
-
- // add width and height of the border
- d.width += borderInsets.left + borderInsets.right;
- d.height += borderInsets.left + borderInsets.right;
-
- // Add combo box's insets
- Insets insets = parent.getInsets();
- d.width += insets.left + insets.right;
- d.width += insets.left + insets.right;
-
- return d;
+ return getPreferredSize((JComponent) parent);
}
+ /**
+ * Returns the minimum layout size.
+ *
+ * @param parent the container.
+ *
+ * @return The minimum size.
+ */
public Dimension minimumLayoutSize(Container parent)
{
return preferredLayoutSize(parent);
}
/**
- * This method layouts out the components in the container. It puts arrow
+ * Arranges the components in the container. It puts arrow
* button right end part of the comboBox. If the comboBox is editable
* then editor is placed to the left of arrow button, starting from the
* beginning.
@@ -972,21 +1027,19 @@ public class BasicComboBoxUI extends ComboBoxUI
{
// Position editor component to the left of arrow button if combo box is
// editable
- int editorWidth = comboBox.getBounds().width - arrowButtonWidth - 2;
+ int arrowSize = comboBox.getHeight();
+ int editorWidth = comboBox.getBounds().width - arrowSize;
if (comboBox.isEditable())
- editor.setBounds(borderInsets.left, borderInsets.top, editorWidth,
- comboBox.getBounds().height - borderInsets.left
- - borderInsets.top);
-
- arrowButton.setBounds(editorWidth, 2, arrowButtonWidth,
- comboBox.getBounds().height - 4);
+ editor.setBounds(0, 0, editorWidth, comboBox.getBounds().height);
+
+ arrowButton.setBounds(editorWidth, 0, arrowSize, arrowSize);
comboBox.revalidate();
}
}
/**
- * This class handles focus changes occuring in the combo box. This class is
+ * Handles focus changes occuring in the combo box. This class is
* responsible for repainting combo box whenever focus is gained or lost
* and also for hiding popup list of items whenever combo box loses its
* focus.
@@ -998,11 +1051,12 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public FocusHandler()
{
+ // Nothing to do here.
}
/**
- * This mehtod is invoked when combo box gains focus. It repaints main
- * part of combo box accordingally.
+ * Invoked when combo box gains focus. It repaints main
+ * part of combo box accordingly.
*
* @param e the FocusEvent
*/
@@ -1013,22 +1067,22 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method is invoked when combo box loses focus It repaint main part
- * of combo box accordingally and hides popup list of items.
+ * Invoked when the combo box loses focus. It repaints the main part
+ * of the combo box accordingly and hides the popup list of items.
*
* @param e the FocusEvent
*/
public void focusLost(FocusEvent e)
{
hasFocus = false;
+ setPopupVisible(comboBox, false);
comboBox.repaint();
- popup.hide();
}
}
/**
- * This class handles ItemEvent fired by the JComboBox when its selected
- * item changes.
+ * Handles {@link ItemEvent}s fired by the {@link JComboBox} when its
+ * selected item changes.
*/
public class ItemHandler extends Object implements ItemListener
{
@@ -1037,16 +1091,19 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public ItemHandler()
{
+ // Nothing to do here.
}
/**
- * This method is invoked when selected item becomes deselected or when
+ * Invoked when selected item becomes deselected or when
* new item becomes selected.
*
* @param e the ItemEvent representing item's state change.
*/
public void itemStateChanged(ItemEvent e)
{
+ if (e.getStateChange() == ItemEvent.SELECTED && comboBox.isEditable())
+ comboBox.getEditor().setItem(e.getItem());
comboBox.repaint();
}
}
@@ -1058,11 +1115,11 @@ public class BasicComboBoxUI extends ComboBoxUI
{
public KeyHandler()
{
+ // Nothing to do here.
}
- /*
- * This method is invoked whenever key is pressed while JComboBox is in
- * focus.
+ /**
+ * Invoked whenever key is pressed while JComboBox is in focus.
*/
public void keyPressed(KeyEvent e)
{
@@ -1072,7 +1129,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This class handles to the changes occuring in the JComboBox's data model
+ * Handles the changes occurring in the JComboBox's data model.
*/
public class ListDataHandler extends Object implements ListDataListener
{
@@ -1081,10 +1138,11 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public ListDataHandler()
{
+ // Nothing to do here.
}
/**
- * This method is invoked content's of JComboBox's data model are changed
+ * Invoked if the content's of JComboBox's data model are changed.
*
* @param e ListDataEvent describing the change.
*/
@@ -1094,36 +1152,27 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method is invoked when items were added to the JComboBox's data
- * model.
+ * Invoked when items are added to the JComboBox's data model.
*
* @param e ListDataEvent describing the change.
*/
public void intervalAdded(ListDataEvent e)
{
- // must determine if the size of the combo box should change
- int start = e.getIndex0();
- int end = e.getIndex1();
-
ComboBoxModel model = comboBox.getModel();
ListCellRenderer renderer = comboBox.getRenderer();
- if (largestItemSize == null)
- largestItemSize = new Dimension(0, 0);
+ if (displaySize == null)
+ displaySize = getDisplaySize();
+ if (displaySize.width < getDefaultSize().width)
+ displaySize.width = getDefaultSize().width;
+ if (displaySize.height < getDefaultSize().height)
+ displaySize.height = getDefaultSize().height;
- for (int i = start; i < end; i++)
- {
- Object item = model.getElementAt(i);
- Component comp = renderer.getListCellRendererComponent(new JList(),
- item, -1,
- false, false);
- if (comp.getPreferredSize().getWidth() > largestItemSize.getWidth())
- largestItemSize = comp.getPreferredSize();
- }
+ comboBox.repaint();
}
/**
- * This method is invoked when items were removed from the JComboBox's
+ * Invoked when items are removed from the JComboBox's
* data model.
*
* @param e ListDataEvent describing the change.
@@ -1131,23 +1180,29 @@ public class BasicComboBoxUI extends ComboBoxUI
public void intervalRemoved(ListDataEvent e)
{
// recalculate display size of the JComboBox.
- largestItemSize = getLargestItemSize();
+ displaySize = getDisplaySize();
comboBox.repaint();
}
}
/**
- * This class handles PropertyChangeEvents fired by JComboBox.
+ * Handles {@link PropertyChangeEvent}s fired by the {@link JComboBox}.
*/
public class PropertyChangeHandler extends Object
implements PropertyChangeListener
{
+ /**
+ * Creates a new instance.
+ */
public PropertyChangeHandler()
{
+ // Nothing to do here.
}
/**
- * This method is invoked whenever bound property of JComboBox changes.
+ * Invoked whenever bound property of JComboBox changes.
+ *
+ * @param e the event.
*/
public void propertyChange(PropertyChangeEvent e)
{
@@ -1185,59 +1240,36 @@ public class BasicComboBoxUI extends ComboBoxUI
if ((ComboBoxModel) e.getNewValue() != null)
comboBox.getModel().addListDataListener(listDataListener);
}
+ else if (e.getPropertyName().equals("font"))
+ {
+ Font font = (Font) e.getNewValue();
+ editor.setFont(font);
+ listBox.setFont(font);
+ arrowButton.setFont(font);
+ comboBox.revalidate();
+ comboBox.repaint();
+ }
// FIXME: Need to handle changes in other bound properties.
}
}
/**
- * MouseHandler listens to mouse events occuring in the combo box. This
- * class is responsible for repainting this JComboBox whenever the mouse is
- * being pressed or released over it.
+ * A handler for mouse events occurring in the combo box. An instance of
+ * this class is returned by the <code>createMouseListener()</code> method.
*/
private class MouseHandler extends MouseAdapter
{
/**
- * This method is invoked when mouse is pressed over the combo box. It
- * repaints the combo box accordinglly
+ * Invoked when mouse is pressed over the combo box. It toggles the
+ * visibility of the popup list.
*
- * @param e the MouseEvent
+ * @param e the event
*/
public void mousePressed(MouseEvent e)
{
if (comboBox.isEnabled())
- {
- if (e.getSource() instanceof JComboBox)
- {
- arrowButton.getModel().setPressed(true);
- arrowButton.getModel().setArmed(true);
- }
-
- comboBox.repaint();
-
- if (e.getSource() instanceof BasicArrowButton)
- toggleOpenClose();
- }
- }
-
- /**
- * This method is invoked when mouse is released over the combo box. It
- * repaints the combo box accordinglly
- *
- * @param e the MouseEvent
- */
- public void mouseReleased(MouseEvent e)
- {
- if (comboBox.isEnabled())
- {
- if (e.getSource() instanceof JComboBox)
- {
- arrowButton.getModel().setPressed(false);
- arrowButton.getModel().setArmed(false);
- }
-
- comboBox.repaint();
- }
+ toggleOpenClose();
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
index 73aac8d4e65..73979bb89c1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
@@ -55,6 +56,7 @@ import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
@@ -178,8 +180,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
// to display number of rows equal to 'maximumRowCount' property
int popupHeight = getPopupHeightForRowCount(comboBox.getMaximumRowCount());
- list.setPreferredSize(new Dimension(cbBounds.width, popupHeight));
- super.setPopupSize(cbBounds.width, popupHeight);
+ scroller.setPreferredSize(new Dimension(cbBounds.width, popupHeight));
+ pack();
// Highlight selected item in the combo box's drop down list
if (comboBox.getSelectedIndex() != -1)
@@ -478,6 +480,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void configureScroller()
{
+ scroller.setBorder(null);
scroller.getViewport().setView(list);
scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
@@ -488,6 +491,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void configurePopup()
{
+ setBorder(BorderFactory.createLineBorder(Color.BLACK));
// initialize list that will be used to display combo box's items
this.list = createList();
((JLabel) list.getCellRenderer()).setHorizontalAlignment(SwingConstants.LEFT);
@@ -714,7 +718,11 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
protected void updateListBoxSelectionForEvent(MouseEvent anEvent,
boolean shouldScroll)
{
- // FIXME: Need to implement
+ // TODO: We need to handle the shouldScroll parameter somehow.
+ int index = list.locationToIndex(anEvent.getPoint());
+ // Check for valid index.
+ if (index >= 0)
+ list.setSelectedIndex(index);
}
/**
@@ -732,6 +740,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected InvocationMouseHandler()
{
+ // Nothing to do here.
}
/**
@@ -744,7 +753,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
public void mousePressed(MouseEvent e)
{
if (comboBox.isEnabled())
- togglePopup();
+ togglePopup();
}
/**
@@ -768,15 +777,15 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
// then change selection and close popup
if (! (releasedComponent instanceof JComboBox))
{
- // List model contains the item over which mouse is released,
- // since it is updated every time the mouse is moved over a different
- // item in the list. Now that the mouse is released we need to
- // update model of the combo box as well.
- comboBox.setSelectedIndex(list.getSelectedIndex());
-
- if (isAutoScrolling)
- stopAutoScrolling();
- hide();
+ // List model contains the item over which mouse is released,
+ // since it is updated every time the mouse is moved over a different
+ // item in the list. Now that the mouse is released we need to
+ // update model of the combo box as well.
+ comboBox.setSelectedIndex(list.getSelectedIndex());
+
+ if (isAutoScrolling)
+ stopAutoScrolling();
+ hide();
}
}
}
@@ -792,6 +801,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected InvocationMouseMotionHandler()
{
+ // Nothing to do here.
}
/**
@@ -868,6 +878,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected ItemHandler()
{
+ // Nothing to do here.
}
/**
@@ -877,6 +888,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
public void itemStateChanged(ItemEvent e)
{
+ // TODO: What should be done here?
}
}
@@ -890,16 +902,20 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected ListMouseHandler()
{
+ // Nothing to do here.
}
public void mousePressed(MouseEvent e)
{
+ // TODO: What should be do here?
}
public void mouseReleased(MouseEvent anEvent)
{
int index = list.locationToIndex(anEvent.getPoint());
- comboBox.setSelectedIndex(index);
+ // Check for valid index.
+ if (index >= 0)
+ comboBox.setSelectedIndex(index);
hide();
}
}
@@ -913,15 +929,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected ListMouseMotionHandler()
{
+ // Nothing to do here.
}
public void mouseMoved(MouseEvent anEvent)
{
- // Highlight list cells over which the mouse is located.
- // This changes list model, but has no effect on combo box's data model
- int index = list.locationToIndex(anEvent.getPoint());
- list.setSelectedIndex(index);
- list.repaint();
+ updateListBoxSelectionForEvent(anEvent, false);
}
}
@@ -934,6 +947,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected PropertyChangeHandler()
{
+ // Nothing to do here.
}
public void propertyChange(PropertyChangeEvent e)
@@ -1009,18 +1023,22 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
public ListDataHandler()
{
+ // Nothing to do here.
}
public void contentsChanged(ListDataEvent e)
{
+ // Nothing to do here.
}
public void intervalAdded(ListDataEvent e)
{
+ // Nothing to do here.
}
public void intervalRemoved(ListDataEvent e)
{
+ // Nothing to do here.
}
}
@@ -1032,10 +1050,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected ListSelectionHandler()
{
+ // Nothing to do here.
}
public void valueChanged(ListSelectionEvent e)
{
+ // Nothing to do here.
}
}
@@ -1046,10 +1066,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
public InvocationKeyHandler()
{
+ // Nothing to do here.
}
public void keyReleased(KeyEvent e)
{
+ // Nothing to do here.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java
index 561b497f1c3..3f8730249da 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java
@@ -365,6 +365,7 @@ public class BasicDesktopIconUI extends DesktopIconUI
*/
public BasicDesktopIconUI()
{
+ // Nothing to do here.
}
/**
@@ -585,6 +586,7 @@ public class BasicDesktopIconUI extends DesktopIconUI
}
catch (PropertyVetoException pve)
{
+ // We do nothing if the attempt has been vetoed.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
index b59261b17f3..4116858da9d 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.beans.PropertyVetoException;
@@ -49,10 +50,10 @@ import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.KeyStroke;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.DesktopPaneUI;
+import javax.swing.plaf.UIResource;
/**
* This class is the UI delegate for JDesktopPane for the Basic look and feel.
@@ -74,13 +75,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
if (desktop.getSelectedFrame() != null)
{
- try
- {
- desktop.getSelectedFrame().setClosed(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ desktop.getSelectedFrame().setClosed(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempts has been vetoed.
+ }
}
}
@@ -112,13 +114,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
if (desktop.getSelectedFrame() != null)
{
- try
- {
- desktop.getSelectedFrame().setMaximum(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ desktop.getSelectedFrame().setMaximum(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempts has been vetoed.
+ }
}
}
@@ -150,13 +153,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
if (desktop.getSelectedFrame() != null)
{
- try
- {
- desktop.getSelectedFrame().setIcon(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ desktop.getSelectedFrame().setIcon(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
@@ -236,16 +240,17 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
JInternalFrame frame = desktop.getSelectedFrame();
if (frame != null)
{
- try
- {
- if (frame.isIcon())
- frame.setIcon(false);
- else if (frame.isMaximum())
- frame.setMaximum(false);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ if (frame.isIcon())
+ frame.setIcon(false);
+ else if (frame.isMaximum())
+ frame.setMaximum(false);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
@@ -304,6 +309,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
*/
public BasicDesktopPaneUI()
{
+ // Nothing to do here.
}
/**
@@ -361,9 +367,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- desktop.setBackground(defaults.getColor("desktop"));
+ Color bg = desktop.getBackground();
+ if (bg == null || bg instanceof UIResource)
+ desktop.setBackground(UIManager.getColor("desktop"));
}
/**
@@ -381,7 +387,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
protected void installKeyboardActions()
{
// FIXME: create actions and keystrokes.
- registerKeyboardAction();
+ registerKeyboardActions();
}
/**
@@ -405,7 +411,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
* This method registers the actions to the appropriate Action and Input
* maps.
*/
- protected void registerKeyboardAction()
+ protected void registerKeyboardActions()
{
// FIXME: Do the binding.
// XXX: the gtk windows tend to intercept a lot of the
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
index f74e9229893..9c639656545 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
@@ -48,7 +48,6 @@ import java.awt.Point;
import java.awt.Polygon;
import java.awt.Window;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
@@ -60,9 +59,9 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;
+
import javax.swing.AbstractAction;
import javax.swing.Action;
-import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.JButton;
@@ -92,25 +91,31 @@ import javax.swing.plaf.FileChooserUI;
/**
- * DOCUMENT ME!
+ * A UI delegate for the {@link JFileChooser} component under the
+ * {@link BasicLookAndFeel}.
*/
public class BasicFileChooserUI extends FileChooserUI
{
/**
- * DOCUMENT ME!
+ * A file filter that accepts all files.
*/
protected class AcceptAllFileFilter extends FileFilter
{
+ /**
+ * Creates a new instance.
+ */
public AcceptAllFileFilter()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> always, as all files are accepted by this
+ * filter.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return Always <code>true</code>.
*/
public boolean accept(File f)
{
@@ -118,9 +123,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a description for this filter.
*
- * @return DOCUMENT ME!
+ * @return A description for the file filter.
*/
public String getDescription()
{
@@ -129,7 +134,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Handles a user action to approve the dialog selection.
+ *
+ * @see BasicFileChooserUI#getApproveSelectionAction()
*/
protected class ApproveSelectionAction extends AbstractAction
{
@@ -138,50 +145,55 @@ public class BasicFileChooserUI extends FileChooserUI
*/
protected ApproveSelectionAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ * Sets the current selection and closes the dialog.
+ *
+ * @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
- Object obj = filelist.getSelectedValue();
+ Object obj = new String(parentPath + entry.getText());
if (obj != null)
{
- File f = filechooser.getFileSystemView().createFileObject(obj
- .toString());
- if (filechooser.isTraversable(f) &&
- filechooser.getFileSelectionMode() == JFileChooser.FILES_ONLY)
+ File f = filechooser.getFileSystemView().createFileObject(
+ obj.toString());
+ if (filechooser.isTraversable(f)
+ && filechooser.isDirectorySelectionEnabled())
filechooser.setCurrentDirectory(f);
- else
- {
- filechooser.setSelectedFile(f);
- filechooser.approveSelection();
- closeDialog();
- }
+ else
+ {
+ filechooser.setSelectedFile(f);
+ filechooser.approveSelection();
+ closeDialog();
+ }
}
}
}
/**
- * DOCUMENT ME!
+ * Provides presentation information about files and directories.
*/
protected class BasicFileView extends FileView
{
- /** DOCUMENT ME! */
+ /** Storage for cached icons. */
protected Hashtable iconCache = new Hashtable();
+ /**
+ * Creates a new instance.
+ */
public BasicFileView()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Adds an icon to the cache, associating it with the given file/directory.
*
- * @param f DOCUMENT ME!
- * @param i DOCUMENT ME!
+ * @param f the file/directory.
+ * @param i the icon.
*/
public void cacheIcon(File f, Icon i)
{
@@ -189,7 +201,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Clears the icon cache.
*/
public void clearIconCache()
{
@@ -197,11 +209,12 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Retrieves the icon associated with the specified file/directory, if
+ * there is one.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The cached icon (or <code>null</code>).
*/
public Icon getCachedIcon(File f)
{
@@ -209,11 +222,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a description of the given file/directory. In this
+ * implementation, the description is the same as the name returned by
+ * {@link #getName(File)}.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return A description of the given file/directory.
*/
public String getDescription(File f)
{
@@ -221,11 +236,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns an icon appropriate for the given file or directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return An icon.
*/
public Icon getIcon(File f)
{
@@ -241,11 +256,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the name for the given file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The name of the file/directory.
*/
public String getName(File f)
{
@@ -253,11 +268,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a localised description for the type of file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return A type description for the given file/directory.
*/
public String getTypeDescription(File f)
{
@@ -268,34 +283,38 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns {@link Boolean#TRUE} if the given file/directory is hidden,
+ * and {@link Boolean#FALSE} otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*/
public Boolean isHidden(File f)
{
- return new Boolean(filechooser.getFileSystemView().isHiddenFile(f));
+ return Boolean.valueOf(filechooser.getFileSystemView().isHiddenFile(f));
}
}
/**
- * DOCUMENT ME!
+ * Handles an action to cancel the file chooser.
+ *
+ * @see BasicFileChooserUI#getCancelSelectionAction()
*/
protected class CancelSelectionAction extends AbstractAction
{
/**
- * Creates a new CancelSelectionAction object.
+ * Creates a new <code>CancelSelectionAction</code> object.
*/
protected CancelSelectionAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Cancels the selection and closes the dialog.
*
- * @param e DOCUMENT ME!
+ * @param e the action event (ignored).
*/
public void actionPerformed(ActionEvent e)
{
@@ -305,21 +324,25 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * An action to handle changes to the parent directory (for example, via
+ * a click on the "up folder" button).
+ *
+ * @see BasicFileChooserUI#getChangeToParentDirectoryAction()
*/
protected class ChangeToParentDirectoryAction extends AbstractAction
{
/**
- * Creates a new ChangeToParentDirectoryAction object.
+ * Creates a new <code>ChangeToParentDirectoryAction</code> object.
*/
protected ChangeToParentDirectoryAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Handles the action event.
*
- * @param e DOCUMENT ME!
+ * @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
@@ -330,11 +353,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * A mouse listener that handles double-click events.
+ *
+ * @see BasicFileChooserUI#createDoubleClickListener(JFileChooser, JList)
*/
protected class DoubleClickListener extends MouseAdapter
{
- /** DOCUMENT ME! */
+ /** A timer. */
private Timer timer = null;
/** DOCUMENT ME! */
@@ -358,54 +383,57 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ * Handles a mouse click event.
+ *
+ * @param e the event.
*/
public void mouseClicked(MouseEvent e)
{
if (list.getSelectedValue() == null)
- return;
+ return;
FileSystemView fsv = filechooser.getFileSystemView();
if (timer.isRunning()
&& list.getSelectedValue().toString().equals(lastSelected.toString()))
{
- File f = fsv.createFileObject(lastSelected.toString());
- timer.stop();
- if (filechooser.isTraversable(f))
- {
- filechooser.setCurrentDirectory(f);
- filechooser.rescanCurrentDirectory();
- }
- else
- {
- filechooser.setSelectedFile(f);
- filechooser.approveSelection();
- closeDialog();
- }
+ File f = fsv.createFileObject(lastSelected.toString());
+ timer.stop();
+ if (filechooser.isTraversable(f))
+ {
+ filechooser.setCurrentDirectory(f);
+ filechooser.rescanCurrentDirectory();
+ }
+ else
+ {
+ filechooser.setSelectedFile(f);
+ filechooser.approveSelection();
+ closeDialog();
+ }
}
else
{
- File f = fsv.createFileObject(list.getSelectedValue().toString());
- if (filechooser.isTraversable(f))
- {
- setDirectorySelected(true);
- setDirectory(f);
- }
- else
- {
- setDirectorySelected(false);
- setDirectory(null);
- }
- lastSelected = list.getSelectedValue().toString();
- timer.restart();
+ String path = list.getSelectedValue().toString();
+ File f = fsv.createFileObject(path);
+ if (filechooser.isTraversable(f))
+ {
+ setDirectorySelected(true);
+ setDirectory(f);
+ }
+ else
+ {
+ setDirectorySelected(false);
+ setDirectory(null);
+ }
+ lastSelected = path;
+ parentPath = path.substring(0, path.lastIndexOf("/") + 1);
+ entry.setText(path.substring(path.lastIndexOf("/") + 1));
+ timer.restart();
}
}
/**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ * Handles a mouse entered event (NOT IMPLEMENTED).
+ *
+ * @param e the mouse event.
*/
public void mouseEntered(MouseEvent e)
{
@@ -414,21 +442,26 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * An action that changes the file chooser to display the user's home
+ * directory.
+ *
+ * @see BasicFileChooserUI#getGoHomeAction()
*/
protected class GoHomeAction extends AbstractAction
{
/**
- * Creates a new GoHomeAction object.
+ * Creates a new <code>GoHomeAction</code> object.
*/
protected GoHomeAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Sets the directory to the user's home directory, and repaints the
+ * file chooser component.
*
- * @param e DOCUMENT ME!
+ * @param e the action event (ignored).
*/
public void actionPerformed(ActionEvent e)
{
@@ -440,21 +473,24 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * An action that handles the creation of a new folder/directory.
+ *
+ * @see BasicFileChooserUI#getNewFolderAction()
*/
protected class NewFolderAction extends AbstractAction
{
/**
- * Creates a new NewFolderAction object.
+ * Creates a new <code>NewFolderAction</code> object.
*/
protected NewFolderAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Handles the event by creating a new folder.
*
- * @param e DOCUMENT ME!
+ * @param e the action event (ignored).
*/
public void actionPerformed(ActionEvent e)
{
@@ -473,15 +509,18 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * A listener for selection events in the file list.
+ *
+ * @see BasicFileChooserUI#createListSelectionListener(JFileChooser)
*/
protected class SelectionListener implements ListSelectionListener
{
/**
- * Creates a new SelectionListener object.
+ * Creates a new <code>SelectionListener</code> object.
*/
protected SelectionListener()
{
+ // Nothing to do here.
}
/**
@@ -504,6 +543,8 @@ public class BasicFileChooserUI extends FileChooserUI
/**
* DOCUMENT ME!
+ *
+ * @see BasicFileChooserUI#getUpdateAction()
*/
protected class UpdateAction extends AbstractAction
{
@@ -512,28 +553,30 @@ public class BasicFileChooserUI extends FileChooserUI
*/
protected UpdateAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * NOT YET IMPLEMENTED.
*
- * @param e DOCUMENT ME!
+ * @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
+ // FIXME: implement this
}
}
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the cancel button. */
protected int cancelButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the cancel button. */
protected String cancelButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the cancel button. */
protected String cancelButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon representing a computer. */
protected Icon computerIcon = new Icon()
{
public int getIconHeight()
@@ -548,10 +591,11 @@ public class BasicFileChooserUI extends FileChooserUI
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // FIXME: is this not implemented, or is the icon intentionally blank?
}
};
- /** DOCUMENT ME! */
+ /** An icon for the "details view" button. */
protected Icon detailsViewIcon = new Icon()
{
public int getIconHeight()
@@ -580,7 +624,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon representing a directory. */
protected Icon directoryIcon = new Icon()
{
public int getIconHeight()
@@ -619,16 +663,16 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** The localised Mnemonic for the open button. */
protected int directoryOpenButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the open button. */
protected String directoryOpenButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the open button. */
protected String directoryOpenButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon representing a file. */
protected Icon fileIcon = new Icon()
{
public int getIconHeight()
@@ -668,7 +712,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon representing a floppy drive. */
protected Icon floppyDriveIcon = new Icon()
{
public int getIconHeight()
@@ -683,10 +727,11 @@ public class BasicFileChooserUI extends FileChooserUI
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // FIXME: is this not implemented, or is the icon intentionally blank?
}
};
- /** DOCUMENT ME! */
+ /** An icon representing a hard drive. */
protected Icon hardDriveIcon = new Icon()
{
public int getIconHeight()
@@ -701,19 +746,20 @@ public class BasicFileChooserUI extends FileChooserUI
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // FIXME: is this not implemented, or is the icon intentionally blank?
}
};
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "help" button. */
protected int helpButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "help" button. */
protected String helpButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the help button. */
protected String helpButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon representing the user's home folder. */
protected Icon homeFolderIcon = new Icon()
{
public int getIconHeight()
@@ -753,7 +799,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon for the "list view" button. */
protected Icon listViewIcon = new Icon()
{
public int getIconHeight()
@@ -795,37 +841,37 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon for the "new folder" button. */
protected Icon newFolderIcon = directoryIcon;
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "open" button. */
protected int openButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "open" button. */
protected String openButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the "open" button. */
protected String openButtonToolTipText;
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "save" button. */
protected int saveButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "save" button. */
protected String saveButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the save button. */
protected String saveButtonToolTipText;
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "update" button. */
protected int updateButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "update" button. */
protected String updateButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the "update" button. */
protected String updateButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon for the "up folder" button. */
protected Icon upFolderIcon = new Icon()
{
public int getIconHeight()
@@ -876,77 +922,84 @@ public class BasicFileChooserUI extends FileChooserUI
// -- begin private, but package local since used in inner classes --
+ /** The file chooser component represented by this UI delegate. */
JFileChooser filechooser;
- /** DOCUMENT ME! */
+ /** The file list. */
JList filelist;
- /** DOCUMENT ME! */
+ /** The combo box used to display/select file filters. */
JComboBox filters;
- /** DOCUMENT ME! */
+ /** The model for the directory list. */
BasicDirectoryModel model;
- /** DOCUMENT ME! */
+ /** The file filter for all files. */
FileFilter acceptAll = new AcceptAllFileFilter();
- /** DOCUMENT ME! */
+ /** The default file view. */
FileView fv = new BasicFileView();
- /** DOCUMENT ME! */
+ /** The icon size. */
static final int ICON_SIZE = 24;
- /** DOCUMENT ME! */
+ /** A combo box for display/selection of parent directories. */
JComboBox parents;
- /** DOCUMENT ME! */
+ /** The current file name. */
String filename;
- /** DOCUMENT ME! */
+ /** The accept (open/save) button. */
JButton accept;
- /** DOCUMENT ME! */
+ /** The cancel button. */
JButton cancel;
- /** DOCUMENT ME! */
+ /** The button to move up to the parent directory. */
JButton upFolderButton;
- /** DOCUMENT ME! */
+ /** The button to create a new directory. */
JButton newFolderButton;
- /** DOCUMENT ME! */
+ /** The button to move to the user's home directory. */
JButton homeFolderButton;
- /** DOCUMENT ME! */
+ /** An optional accessory panel. */
JPanel accessoryPanel;
- /** DOCUMENT ME! */
+ /** A property change listener. */
PropertyChangeListener propertyChangeListener;
- /** DOCUMENT ME! */
+ /** The text describing the filter for "all files". */
String acceptAllFileFilterText;
- /** DOCUMENT ME! */
+ /** The text describing a directory type. */
String dirDescText;
- /** DOCUMENT ME! */
+ /** The text describing a file type. */
String fileDescText;
- /** DOCUMENT ME! */
+ /** Is a directory selected? */
boolean dirSelected = false;
- /** DOCUMENT ME! */
+ /** The current directory. */
File currDir = null;
+ // FIXME: describe what is contained in the bottom panel
+ /** The bottom panel. */
JPanel bottomPanel;
-
- /** DOCUMENT ME! */
+
+ /** The close panel. */
JPanel closePanel;
+ /** Text box that displays file name */
+ JTextField entry;
+
+ /** Current parent path */
+ String parentPath;
+
// -- end private --
- private class ListLabelRenderer
- extends JLabel
- implements ListCellRenderer
+ private class ListLabelRenderer extends JLabel implements ListCellRenderer
{
/** DOCUMENT ME! */
final Color selected = new Color(153, 204, 255);
@@ -988,45 +1041,8 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Closes the dialog.
*/
- public class CBLabelRenderer extends JLabel implements ListCellRenderer
- {
- /**
- * Creates a new CBLabelRenderer object.
- */
- public CBLabelRenderer()
- {
- super();
- setOpaque(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param list DOCUMENT ME!
- * @param value DOCUMENT ME!
- * @param index DOCUMENT ME!
- * @param isSelected DOCUMENT ME!
- * @param cellHasFocus DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public Component getListCellRendererComponent(JList list, Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus)
- {
- setHorizontalAlignment(SwingConstants.LEFT);
- setIcon(directoryIcon);
- setText(value.toString());
- setForeground(Color.BLACK);
- setBackground(Color.WHITE);
-
- return this;
- }
- }
-
void closeDialog()
{
Window owner = SwingUtilities.windowForComponent(filechooser);
@@ -1035,9 +1051,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * Creates a new BasicFileChooserUI object.
+ * Creates a new <code>BasicFileChooserUI</code> object.
*
- * @param b DOCUMENT ME!
+ * @param b the file chooser component.
*/
public BasicFileChooserUI(JFileChooser b)
{
@@ -1045,11 +1061,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a UI delegate for the given component.
*
- * @param c DOCUMENT ME!
+ * @param c the component (should be a {@link JFileChooser}).
*
- * @return DOCUMENT ME!
+ * @return A new UI delegate.
*/
public static ComponentUI createUI(JComponent c)
{
@@ -1057,28 +1073,32 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
- *
- * @param c DOCUMENT ME!
+ * Installs the UI for the specified component.
+ *
+ * @param c the component (should be a {@link JFileChooser}).
*/
public void installUI(JComponent c)
{
if (c instanceof JFileChooser)
{
- JFileChooser fc = (JFileChooser) c;
- fc.resetChoosableFileFilters();
- createModel();
- clearIconCache();
- installDefaults(fc);
- installComponents(fc);
- installListeners(fc);
+ JFileChooser fc = (JFileChooser) c;
+ fc.resetChoosableFileFilters();
+ createModel();
+ clearIconCache();
+ installDefaults(fc);
+ installComponents(fc);
+ installListeners(fc);
+
+ Object path = filechooser.getCurrentDirectory();
+ if (path != null)
+ parentPath = path.toString().substring(path.toString().lastIndexOf("/"));
}
}
/**
- * DOCUMENT ME!
- *
- * @param c DOCUMENT ME!
+ * Uninstalls this UI from the given component.
+ *
+ * @param c the component (should be a {@link JFileChooser}).
*/
public void uninstallUI(JComponent c)
{
@@ -1185,16 +1205,16 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and install the subcomponents for the file chooser.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
public void installComponents(JFileChooser fc)
{
JLabel look = new JLabel("Look In:");
parents = new JComboBox();
- parents.setRenderer(new CBLabelRenderer());
+ parents.setRenderer(new BasicComboBoxRenderer());
boxEntries();
look.setLabelFor(parents);
JPanel parentsPanel = new JPanel();
@@ -1226,9 +1246,9 @@ public class BasicFileChooserUI extends FileChooserUI
buttonPanel.add(detailsViewButton);
JPanel topPanel = new JPanel();
- topPanel.setLayout(new java.awt.FlowLayout());
+ parentsPanel.add(buttonPanel);
+ topPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
topPanel.add(parentsPanel);
- topPanel.add(buttonPanel);
accessoryPanel = new JPanel();
if (filechooser.getAccessory() != null)
@@ -1260,7 +1280,7 @@ public class BasicFileChooserUI extends FileChooserUI
JLabel fileNameLabel = new JLabel("File Name:");
JLabel fileTypesLabel = new JLabel("Files of Type:");
- JTextField entry = new JTextField();
+ entry = new JTextField();
filters = new JComboBox();
filterEntries();
@@ -1309,9 +1329,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the components from the file chooser.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
public void uninstallComponents(JFileChooser fc)
{
@@ -1327,9 +1347,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the listeners required by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installListeners(JFileChooser fc)
{
@@ -1349,9 +1369,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the listeners previously installed by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallListeners(JFileChooser fc)
{
@@ -1360,9 +1380,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the defaults for this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installDefaults(JFileChooser fc)
{
@@ -1371,9 +1391,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the defaults previously added by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallDefaults(JFileChooser fc)
{
@@ -1382,9 +1402,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the icons for this UI delegate (NOT YET IMPLEMENTED).
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installIcons(JFileChooser fc)
{
@@ -1392,9 +1412,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the icons previously added by this UI delegate (NOT YET
+ * IMPLEMENTED).
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallIcons(JFileChooser fc)
{
@@ -1402,9 +1423,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the strings used by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installStrings(JFileChooser fc)
{
@@ -1432,9 +1453,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the strings previously added by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallStrings(JFileChooser fc)
{
@@ -1460,7 +1481,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates a new directory model.
*/
protected void createModel()
{
@@ -1468,9 +1489,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the directory model.
*
- * @return DOCUMENT ME!
+ * @return The directory model.
*/
public BasicDirectoryModel getModel()
{
@@ -1478,115 +1499,131 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
- *
- * @param fc DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Creates a listener to handle changes to the properties of the given
+ * file chooser component.
+ *
+ * @param fc the file chooser component.
+ *
+ * @return A new listener.
*/
public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
{
return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent e)
{
- public void propertyChange(PropertyChangeEvent e)
- {
- // FIXME: Multiple file selection waiting on JList multiple selection bug.
- if (e.getPropertyName().equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY))
- {
- if (filechooser.getSelectedFile() == null)
- setFileName(null);
- else
- setFileName(filechooser.getSelectedFile().toString());
- int index = -1;
- File file = filechooser.getSelectedFile();
- for (index = 0; index < model.getSize(); index++)
- if (((File) model.getElementAt(index)).equals(file))
- break;
- if (index == -1)
- return;
- filelist.setSelectedIndex(index);
- filelist.ensureIndexIsVisible(index);
- filelist.revalidate();
- filelist.repaint();
- }
- else if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY))
- {
- filelist.clearSelection();
- filelist.revalidate();
- filelist.repaint();
- setDirectorySelected(false);
- setDirectory(filechooser.getCurrentDirectory());
- boxEntries();
- }
- else if (e.getPropertyName().equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
- filterEntries();
- else if (e.getPropertyName().equals(JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY))
- {
- Window owner = SwingUtilities.windowForComponent(filechooser);
- if (owner instanceof JDialog)
- ((JDialog) owner).setTitle(getDialogTitle(filechooser));
- accept.setText(getApproveButtonText(filechooser));
- accept.setToolTipText(getApproveButtonToolTipText(filechooser));
- accept.setMnemonic(getApproveButtonMnemonic(filechooser));
- }
- else if (e.getPropertyName().equals(JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY))
- accept.setText(getApproveButtonText(filechooser));
- else if (e.getPropertyName().equals(JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY))
- accept.setToolTipText(getApproveButtonToolTipText(filechooser));
- else if (e.getPropertyName().equals(JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY))
- accept.setMnemonic(getApproveButtonMnemonic(filechooser));
- else if (e.getPropertyName().equals(JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY))
- {
- if (filechooser.getControlButtonsAreShown())
- {
- GridBagConstraints c = new GridBagConstraints();
- c.gridy = 1;
- bottomPanel.add(filters, c);
-
- c.fill = GridBagConstraints.BOTH;
- c.gridy = 2;
- c.anchor = GridBagConstraints.EAST;
- bottomPanel.add(closePanel, c);
- bottomPanel.revalidate();
- bottomPanel.repaint();
- bottomPanel.doLayout();
- }
- else
- bottomPanel.remove(closePanel);
- }
- else if (e.getPropertyName().equals(JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY))
- {
- if (filechooser.isAcceptAllFileFilterUsed())
- filechooser.addChoosableFileFilter(getAcceptAllFileFilter(filechooser));
- else
- filechooser.removeChoosableFileFilter(getAcceptAllFileFilter(filechooser));
- }
- else if (e.getPropertyName().equals(JFileChooser.ACCESSORY_CHANGED_PROPERTY))
- {
- JComponent old = (JComponent) e.getOldValue();
- if (old != null)
- getAccessoryPanel().remove(old);
- JComponent newval = (JComponent) e.getNewValue();
- if (newval != null)
- getAccessoryPanel().add(newval);
- }
- if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.FILE_HIDING_CHANGED_PROPERTY))
- rescanCurrentDirectory(filechooser);
-
- filechooser.revalidate();
- filechooser.repaint();
- }
- };
+ // FIXME: Multiple file selection waiting on JList multiple selection
+ // bug.
+ if (e.getPropertyName().equals(
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY))
+ {
+ if (filechooser.getSelectedFile() == null)
+ setFileName(null);
+ else
+ setFileName(filechooser.getSelectedFile().toString());
+ int index = -1;
+ File file = filechooser.getSelectedFile();
+ for (index = 0; index < model.getSize(); index++)
+ if (((File) model.getElementAt(index)).equals(file))
+ break;
+ if (index == -1)
+ return;
+ filelist.setSelectedIndex(index);
+ filelist.ensureIndexIsVisible(index);
+ filelist.revalidate();
+ filelist.repaint();
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.DIRECTORY_CHANGED_PROPERTY))
+ {
+ filelist.clearSelection();
+ filelist.revalidate();
+ filelist.repaint();
+ setDirectorySelected(false);
+ setDirectory(filechooser.getCurrentDirectory());
+ boxEntries();
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
+ filterEntries();
+ else if (e.getPropertyName().equals(
+ JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY))
+ {
+ Window owner = SwingUtilities.windowForComponent(filechooser);
+ if (owner instanceof JDialog)
+ ((JDialog) owner).setTitle(getDialogTitle(filechooser));
+ accept.setText(getApproveButtonText(filechooser));
+ accept.setToolTipText(getApproveButtonToolTipText(filechooser));
+ accept.setMnemonic(getApproveButtonMnemonic(filechooser));
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY))
+ accept.setText(getApproveButtonText(filechooser));
+ else if (e.getPropertyName().equals(
+ JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY))
+ accept.setToolTipText(getApproveButtonToolTipText(filechooser));
+ else if (e.getPropertyName().equals(
+ JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY))
+ accept.setMnemonic(getApproveButtonMnemonic(filechooser));
+ else if (e.getPropertyName().equals(
+ JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY))
+ {
+ if (filechooser.getControlButtonsAreShown())
+ {
+ GridBagConstraints c = new GridBagConstraints();
+ c.gridy = 1;
+ bottomPanel.add(filters, c);
+
+ c.fill = GridBagConstraints.BOTH;
+ c.gridy = 2;
+ c.anchor = GridBagConstraints.EAST;
+ bottomPanel.add(closePanel, c);
+ bottomPanel.revalidate();
+ bottomPanel.repaint();
+ bottomPanel.doLayout();
+ }
+ else
+ bottomPanel.remove(closePanel);
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY))
+ {
+ if (filechooser.isAcceptAllFileFilterUsed())
+ filechooser.addChoosableFileFilter(getAcceptAllFileFilter(filechooser));
+ else
+ filechooser.removeChoosableFileFilter(getAcceptAllFileFilter(filechooser));
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.ACCESSORY_CHANGED_PROPERTY))
+ {
+ JComponent old = (JComponent) e.getOldValue();
+ if (old != null)
+ getAccessoryPanel().remove(old);
+ JComponent newval = (JComponent) e.getNewValue();
+ if (newval != null)
+ getAccessoryPanel().add(newval);
+ }
+ if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.FILE_HIDING_CHANGED_PROPERTY))
+ rescanCurrentDirectory(filechooser);
+
+ filechooser.revalidate();
+ filechooser.repaint();
+ }
+ };
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the current file name.
+ *
+ * @return The current file name.
*/
public String getFileName()
{
@@ -1594,9 +1631,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the current directory name.
*
- * @return DOCUMENT ME!
+ * @return The directory name.
+ *
+ * @see #setDirectoryName(String)
*/
public String getDirectoryName()
{
@@ -1605,9 +1644,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the file name.
*
- * @param filename DOCUMENT ME!
+ * @param filename the file name.
+ *
+ * @see #getFileName()
*/
public void setFileName(String filename)
{
@@ -1615,9 +1656,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the directory name (NOT IMPLEMENTED).
*
- * @param dirname DOCUMENT ME!
+ * @param dirname the directory name.
+ *
+ * @see #getDirectoryName()
*/
public void setDirectoryName(String dirname)
{
@@ -1625,9 +1668,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Rescans the current directory.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
public void rescanCurrentDirectory(JFileChooser fc)
{
@@ -1636,10 +1679,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * NOT YET IMPLEMENTED.
*
- * @param fc DOCUMENT ME!
- * @param f DOCUMENT ME!
+ * @param fc the file chooser.
+ * @param f the file.
*/
public void ensureFileIsVisible(JFileChooser fc, File f)
{
@@ -1647,9 +1690,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the {@link JFileChooser} component that this UI delegate
+ * represents.
*
- * @return DOCUMENT ME!
+ * @return The component represented by this UI delegate.
*/
public JFileChooser getFileChooser()
{
@@ -1657,9 +1701,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the optional accessory panel.
*
- * @return DOCUMENT ME!
+ * @return The optional accessory panel.
*/
public JPanel getAccessoryPanel()
{
@@ -1667,11 +1711,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns an approve (open or save) button for the dialog.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*
- * @return DOCUMENT ME!
+ * @return The button.
*/
public JButton getApproveButton(JFileChooser fc)
{
@@ -1682,11 +1726,14 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the tool tip text for the approve (open/save) button. This first
+ * checks the file chooser to see if a value has been explicitly set - if
+ * not, a default value appropriate for the type of file chooser is
+ * returned.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*
- * @return DOCUMENT ME!
+ * @return The tool tip text.
*/
public String getApproveButtonToolTipText(JFileChooser fc)
{
@@ -1699,7 +1746,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Clears the icon cache.
*/
public void clearIconCache()
{
@@ -1708,11 +1755,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates a new listener to handle selections in the file list.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser component.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link SelectionListener}.
*/
public ListSelectionListener createListSelectionListener(JFileChooser fc)
{
@@ -1720,12 +1767,12 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates a new listener to handle double-click events.
*
- * @param fc DOCUMENT ME!
- * @param list DOCUMENT ME!
+ * @param fc the file chooser component.
+ * @param list the list.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link DoubleClickListener}.
*/
protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)
{
@@ -1733,9 +1780,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if a directory is selected, and
+ * <code>false</code> otherwise.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
*/
protected boolean isDirectorySelected()
{
@@ -1743,9 +1791,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the flag that indicates whether the current directory is selected.
*
- * @param selected DOCUMENT ME!
+ * @param selected the new flag value.
*/
protected void setDirectorySelected(boolean selected)
{
@@ -1753,9 +1801,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the current directory.
*
- * @return DOCUMENT ME!
+ * @return The current directory.
*/
protected File getDirectory()
{
@@ -1763,9 +1811,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the current directory.
*
- * @param f DOCUMENT ME!
+ * @param f the directory.
*/
protected void setDirectory(File f)
{
@@ -1773,11 +1821,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the "accept all" file filter.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser component.
*
- * @return DOCUMENT ME!
+ * @return The "accept all" file filter.
*/
public FileFilter getAcceptAllFileFilter(JFileChooser fc)
{
@@ -1785,25 +1833,29 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the file view for the file chooser. This returns either the
+ * file view that has been explicitly set for the {@link JFileChooser}, or
+ * a default file view.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser component.
*
- * @return DOCUMENT ME!
+ * @return The file view.
+ *
+ * @see JFileChooser#getFileView()
*/
public FileView getFileView(JFileChooser fc)
{
- if (fc.getFileView() != null)
- return fc.getFileView();
return fv;
}
/**
- * DOCUMENT ME!
+ * Returns the dialog title.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return The dialog title.
+ *
+ * @see JFileChooser#getDialogTitle()
*/
public String getDialogTitle(JFileChooser fc)
{
@@ -1828,11 +1880,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the approve button mnemonic.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return The approve button mnemonic.
+ *
+ * @see JFileChooser#getApproveButtonMnemonic()
*/
public int getApproveButtonMnemonic(JFileChooser fc)
{
@@ -1845,11 +1899,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the approve button text.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return The approve button text.
+ *
+ * @see JFileChooser#getApproveButtonText()
*/
public String getApproveButtonText(JFileChooser fc)
{
@@ -1862,9 +1918,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "new folder"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link GoHomeAction}.
*/
public Action getNewFolderAction()
{
@@ -1872,9 +1929,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "home folder"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link GoHomeAction}.
*/
public Action getGoHomeAction()
{
@@ -1882,9 +1940,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "up folder"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link ChangeToParentDirectoryAction}.
*/
public Action getChangeToParentDirectoryAction()
{
@@ -1892,9 +1951,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "approve"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link ApproveSelectionAction}.
*/
public Action getApproveSelectionAction()
{
@@ -1902,9 +1962,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "cancel"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link CancelSelectionAction}.
*/
public Action getCancelSelectionAction()
{
@@ -1912,9 +1973,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new instance of {@link UpdateAction}.
*
- * @return DOCUMENT ME!
+ * @return An action.
*/
public Action getUpdateAction()
{
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
index 3abd76fe2d3..9c7f1c4c5d1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
@@ -1,5 +1,5 @@
/* BasicFormattedTextFieldUI.java
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
/**
@@ -48,6 +49,7 @@ public class BasicFormattedTextFieldUI extends BasicTextFieldUI
{
public BasicFormattedTextFieldUI()
{
+ // Nothing to do here.
}
public static ComponentUI createUI(JComponent c)
@@ -55,6 +57,11 @@ public class BasicFormattedTextFieldUI extends BasicTextFieldUI
return new BasicFormattedTextFieldUI();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "FormattedTextField"
+ */
protected String getPropertyPrefix()
{
return "FormattedTextField";
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 757ac47c903..068de345bec 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -71,6 +71,7 @@ public class BasicGraphicsUtils
*/
public BasicGraphicsUtils()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
index 56a67b02935..6debd649509 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
@@ -41,7 +41,6 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
-import java.awt.Polygon;
import java.io.Serializable;
import javax.swing.Icon;
@@ -241,34 +240,33 @@ public class BasicIconFactory implements Serializable
{
return new DummyIcon();
}
+
+ /**
+ * Returns a new instance of a 4 x 8 icon showing a small black triangle that
+ * points to the right. This is displayed in menu items that have a
+ * sub menu.
+ *
+ * @return The icon.
+ */
public static Icon getMenuArrowIcon()
{
return new Icon()
{
public int getIconHeight()
{
- return 12;
+ return 8;
}
-
public int getIconWidth()
{
- return 12;
+ return 4;
}
-
public void paintIcon(Component c, Graphics g, int x, int y)
{
- g.translate(x, y);
-
Color saved = g.getColor();
-
g.setColor(Color.BLACK);
-
- g.fillPolygon(new Polygon(new int[] { 3, 9, 3 },
- new int[] { 2, 6, 10 },
- 3));
-
+ for (int i = 0; i < 4; i++)
+ g.drawLine(x + i, y + i, x + i, y + 7 - i);
g.setColor(saved);
- g.translate(-x, -y);
}
};
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index cc262948ded..73d3e6173d3 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -84,6 +84,14 @@ public class BasicInternalFrameTitlePane extends JComponent
public class CloseAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public CloseAction()
+ {
+ super("Close");
+ }
+
+ /**
* This method is called when something closes the JInternalFrame.
*
* @param e The ActionEvent.
@@ -92,13 +100,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
if (frame.isClosable())
{
- try
- {
- frame.setClosed(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ frame.setClosed(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
}
@@ -113,6 +122,14 @@ public class BasicInternalFrameTitlePane extends JComponent
public class IconifyAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public IconifyAction()
+ {
+ super("Minimize");
+ }
+
+ /**
* This method is called when the user wants to iconify the
* JInternalFrame.
*
@@ -122,13 +139,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
if (frame.isIconifiable() && ! frame.isIcon())
{
- try
- {
- frame.setIcon(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ frame.setIcon(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
}
@@ -143,6 +161,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class MaximizeAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public MaximizeAction()
+ {
+ super("Maximize");
+ }
+ /**
* This method is called when the user wants to maximize the
* JInternalFrame.
*
@@ -152,13 +177,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
try
{
- if (frame.isMaximizable() && ! frame.isMaximum())
- frame.setMaximum(true);
- else if (frame.isMaximum())
- frame.setMaximum(false);
+ if (frame.isMaximizable() && ! frame.isMaximum())
+ frame.setMaximum(true);
+ else if (frame.isMaximum())
+ frame.setMaximum(false);
}
catch (PropertyVetoException pve)
{
+ // We do nothing if the attempt has been vetoed.
}
}
}
@@ -173,6 +199,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class MoveAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public MoveAction()
+ {
+ super("Move");
+ }
+ /**
* This method is called when the user wants to drag the JInternalFrame.
*
* @param e The ActionEvent.
@@ -194,6 +227,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class RestoreAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public RestoreAction()
+ {
+ super("Restore");
+ }
+ /**
* This method is called when the user wants to restore the
* JInternalFrame.
*
@@ -203,13 +243,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
if (frame.isMaximum())
{
- try
- {
- frame.setMaximum(false);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ frame.setMaximum(false);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
}
@@ -224,6 +265,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class SizeAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public SizeAction()
+ {
+ super("Size");
+ }
+ /**
* This method is called when the user wants to resize the JInternalFrame.
*
* @param e The ActionEvent.
@@ -377,24 +425,26 @@ public class BasicInternalFrameTitlePane extends JComponent
int loc = width + insets.left - 1;
int top = insets.top + 1;
- int buttonWidth = height - 2;
int buttonHeight = height - 4;
if (closeButton.isVisible())
{
- loc -= buttonWidth + 2;
- closeButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ int buttonWidth = closeIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ closeButton.setBounds(loc, top, buttonWidth, buttonHeight);
}
if (maxButton.isVisible())
{
- loc -= buttonWidth + 2;
- maxButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ int buttonWidth = maxIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ maxButton.setBounds(loc, top, buttonWidth, buttonHeight);
}
if (iconButton.isVisible())
{
- loc -= buttonWidth + 2;
- iconButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ int buttonWidth = iconIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ iconButton.setBounds(loc, top, buttonWidth, buttonHeight);
}
if (title != null)
@@ -435,6 +485,7 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
public void removeLayoutComponent(Component c)
{
+ // Nothing to do here.
}
}
@@ -466,6 +517,7 @@ public class BasicInternalFrameTitlePane extends JComponent
// These buttons cannot be given focus.
return false;
}
+
}
/** The action command for the Close action. */
@@ -522,6 +574,9 @@ public class BasicInternalFrameTitlePane extends JComponent
/** The icon displayed in the iconify button. */
protected Icon iconIcon = BasicIconFactory.createEmptyFrameIcon();
+ /** The icon displayed in the close button. */
+ protected Icon closeIcon;
+
/** The JInternalFrame that this TitlePane is used in. */
protected JInternalFrame frame;
@@ -645,7 +700,7 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void installListeners()
{
- propertyChangeListener = new PropertyChangeHandler();
+ propertyChangeListener = createPropertyChangeListener();
frame.addPropertyChangeListener(propertyChangeListener);
}
@@ -663,14 +718,17 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void installDefaults()
{
- // FIXME: move icons to defaults.
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- setFont(defaults.getFont("InternalFrame.titleFont"));
+ title.setFont(defaults.getFont("InternalFrame.titleFont"));
selectedTextColor = defaults.getColor("InternalFrame.activeTitleForeground");
selectedTitleColor = defaults.getColor("InternalFrame.activeTitleBackground");
notSelectedTextColor = defaults.getColor("InternalFrame.inactiveTitleForeground");
notSelectedTitleColor = defaults.getColor("InternalFrame.inactiveTitleBackground");
+
+ closeIcon = UIManager.getIcon("InternalFrame.closeIcon");
+ iconIcon = UIManager.getIcon("InternalFrame.iconifyIcon");
+ maxIcon = UIManager.getIcon("InternalFrame.maximizeIcon");
}
/**
@@ -683,6 +741,10 @@ public class BasicInternalFrameTitlePane extends JComponent
selectedTitleColor = null;
notSelectedTextColor = null;
notSelectedTitleColor = null;
+
+ closeIcon = null;
+ iconIcon = null;
+ maxIcon = null;
}
/**
@@ -691,12 +753,15 @@ public class BasicInternalFrameTitlePane extends JComponent
protected void createButtons()
{
closeButton = new PaneButton(closeAction);
+ closeButton.setText(null);
if (!frame.isClosable())
closeButton.setVisible(false);
iconButton = new PaneButton(iconifyAction);
+ iconButton.setText(null);
if (!frame.isIconifiable())
iconButton.setVisible(false);
maxButton = new PaneButton(maximizeAction);
+ maxButton.setText(null);
if (!frame.isMaximizable())
maxButton.setVisible(false);
}
@@ -706,15 +771,12 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void setButtonIcons()
{
- Icon icon = UIManager.getIcon("InternalFrame.closeIcon");
- if (icon != null)
- closeButton.setIcon(icon);
- icon = UIManager.getIcon("InternalFrame.iconifyIcon");
- if (icon != null)
- iconButton.setIcon(icon);
- icon = UIManager.getIcon("InternalFrame.maximizeIcon");
- if (icon != null)
- maxButton.setIcon(icon);
+ if (closeIcon != null && closeButton != null)
+ closeButton.setIcon(closeIcon);
+ if (iconIcon != null && iconButton != null)
+ iconButton.setIcon(iconIcon);
+ if (maxIcon != null && maxButton != null)
+ maxButton.setIcon(maxIcon);
}
/**
@@ -816,11 +878,12 @@ public class BasicInternalFrameTitlePane extends JComponent
public void paintComponent(Graphics g)
{
paintTitleBackground(g);
- Font f = g.getFont();
- FontMetrics fm = g.getFontMetrics(f);
if (frame.getTitle() != null && title != null)
{
Color saved = g.getColor();
+ Font f = title.getFont();
+ g.setFont(f);
+ FontMetrics fm = g.getFontMetrics(f);
if (frame.isSelected())
g.setColor(selectedTextColor);
else
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
index 8f76ea0cc19..d9dadda688a 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
@@ -56,20 +56,17 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
-import javax.swing.BorderFactory;
import javax.swing.DefaultDesktopManager;
import javax.swing.DesktopManager;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
-import javax.swing.border.BevelBorder;
-import javax.swing.border.Border;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.event.MouseInputAdapter;
@@ -202,67 +199,66 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public void mouseDragged(MouseEvent e)
{
- // If the frame is maximized, there is nothing that
+ // If the frame is maximized, there is nothing that
// can be dragged around.
if (frame.isMaximum())
- return;
+ return;
DesktopManager dm = getDesktopManager();
Rectangle b = frame.getBounds();
Dimension min = frame.getMinimumSize();
if (min == null)
- min = new Dimension(0, 0);
+ min = new Dimension(0, 0);
Insets insets = frame.getInsets();
int x = e.getX();
int y = e.getY();
if (e.getSource() == frame && frame.isResizable())
{
- switch (direction)
- {
- case NORTH:
- cacheRect.setBounds(b.x,
- Math.min(b.y + y, b.y + b.height
- - min.height), b.width, b.height
- - y);
- break;
- case NORTH_EAST:
- cacheRect.setBounds(b.x,
- Math.min(b.y + y, b.y + b.height
- - min.height), x, b.height - y);
- break;
- case EAST:
- cacheRect.setBounds(b.x, b.y, x, b.height);
- break;
- case SOUTH_EAST:
- cacheRect.setBounds(b.x, b.y, x, y);
- break;
- case SOUTH:
- cacheRect.setBounds(b.x, b.y, b.width, y);
- break;
- case SOUTH_WEST:
- cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
- b.y, b.width - x, y);
- break;
- case WEST:
- cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
- b.y, b.width - x, b.height);
- break;
- case NORTH_WEST:
- cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
- Math.min(b.y + y, b.y + b.height
- - min.height), b.width - x,
- b.height - y);
- break;
- }
- dm.resizeFrame(frame, cacheRect.x, cacheRect.y,
- Math.max(min.width, cacheRect.width),
- Math.max(min.height, cacheRect.height));
+ switch (direction)
+ {
+ case NORTH:
+ cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height
+ - min.height),
+ b.width, b.height - y);
+ break;
+ case NORTH_EAST:
+ cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height
+ - min.height), x,
+ b.height - y);
+ break;
+ case EAST:
+ cacheRect.setBounds(b.x, b.y, x, b.height);
+ break;
+ case SOUTH_EAST:
+ cacheRect.setBounds(b.x, b.y, x, y);
+ break;
+ case SOUTH:
+ cacheRect.setBounds(b.x, b.y, b.width, y);
+ break;
+ case SOUTH_WEST:
+ cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
+ b.y, b.width - x, y);
+ break;
+ case WEST:
+ cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
+ b.y, b.width - x, b.height);
+ break;
+ case NORTH_WEST:
+ cacheRect.setBounds(
+ Math.min(b.x + x, b.x + b.width - min.width),
+ Math.min(b.y + y, b.y + b.height - min.height),
+ b.width - x, b.height - y);
+ break;
+ }
+ dm.resizeFrame(frame, cacheRect.x, cacheRect.y,
+ Math.max(min.width, cacheRect.width),
+ Math.max(min.height, cacheRect.height));
}
else if (e.getSource() == titlePane)
{
- Rectangle fBounds = frame.getBounds();
+ Rectangle fBounds = frame.getBounds();
- dm.dragFrame(frame, e.getX() - xOffset + b.x,
- e.getY() - yOffset + b.y);
+ dm.dragFrame(frame, e.getX() - xOffset + b.x, e.getY() - yOffset
+ + b.y);
}
}
@@ -304,17 +300,17 @@ public class BasicInternalFrameUI extends InternalFrameUI
if (e.getSource() == frame && frame.isResizable())
{
- direction = sectionOfClick(x, y);
- dm.beginResizingFrame(frame, direction);
+ direction = sectionOfClick(x, y);
+ dm.beginResizingFrame(frame, direction);
}
else if (e.getSource() == titlePane)
{
- Rectangle tBounds = titlePane.getBounds();
+ Rectangle tBounds = titlePane.getBounds();
- xOffset = e.getX() - tBounds.x + insets.left;
- yOffset = e.getY() - tBounds.y + insets.top;
+ xOffset = e.getX() - tBounds.x + insets.left;
+ yOffset = e.getY() - tBounds.y + insets.top;
- dm.beginDraggingFrame(frame);
+ dm.beginDraggingFrame(frame);
}
}
@@ -329,9 +325,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
xOffset = 0;
yOffset = 0;
if (e.getSource() == frame && frame.isResizable())
- dm.endResizingFrame(frame);
+ dm.endResizingFrame(frame);
else if (e.getSource() == titlePane)
- dm.endDraggingFrame(frame);
+ dm.endDraggingFrame(frame);
}
/**
@@ -348,21 +344,21 @@ public class BasicInternalFrameUI extends InternalFrameUI
Insets insets = frame.getInsets();
Rectangle b = frame.getBounds();
if (x < insets.left && y < insets.top)
- return NORTH_WEST;
+ return NORTH_WEST;
else if (x > b.width - insets.right && y < insets.top)
- return NORTH_EAST;
+ return NORTH_EAST;
else if (x > b.width - insets.right && y > b.height - insets.bottom)
- return SOUTH_EAST;
+ return SOUTH_EAST;
else if (x < insets.left && y > b.height - insets.bottom)
- return SOUTH_WEST;
+ return SOUTH_WEST;
else if (y < insets.top)
- return NORTH;
+ return NORTH;
else if (x < insets.left)
- return WEST;
+ return WEST;
else if (y > b.height - insets.bottom)
- return SOUTH;
+ return SOUTH;
else if (x > b.width - insets.right)
- return EAST;
+ return EAST;
return -1;
}
@@ -377,8 +373,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
/**
* This method is called when the JDesktopPane is hidden.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentHidden(ComponentEvent e)
{
@@ -387,8 +384,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the JDesktopPane is moved.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentMoved(ComponentEvent e)
{
@@ -397,22 +395,23 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the JDesktopPane is resized.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentResized(ComponentEvent e)
{
if (frame.isMaximum())
{
- JDesktopPane pane = (JDesktopPane) e.getSource();
- Insets insets = pane.getInsets();
- Rectangle bounds = pane.getBounds();
-
- frame.setBounds(bounds.x + insets.left, bounds.y + insets.top,
- bounds.width - insets.left - insets.right,
- bounds.height - insets.top - insets.bottom);
- frame.revalidate();
- frame.repaint();
+ JDesktopPane pane = (JDesktopPane) e.getSource();
+ Insets insets = pane.getInsets();
+ Rectangle bounds = pane.getBounds();
+
+ frame.setBounds(bounds.x + insets.left, bounds.y + insets.top,
+ bounds.width - insets.left - insets.right,
+ bounds.height - insets.top - insets.bottom);
+ frame.revalidate();
+ frame.repaint();
}
// Sun also resizes the icons. but it doesn't seem to do anything.
@@ -420,8 +419,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the JDesktopPane is shown.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentShown(ComponentEvent e)
{
@@ -435,21 +435,25 @@ public class BasicInternalFrameUI extends InternalFrameUI
public class InternalFrameLayout implements LayoutManager
{
/**
- * This method is called when the given Component is added to the
+ * This method is called when the given Component is added to the
* JInternalFrame.
- *
- * @param name The name of the Component.
- * @param c The Component added.
+ *
+ * @param name
+ * The name of the Component.
+ * @param c
+ * The Component added.
*/
public void addLayoutComponent(String name, Component c)
{
+ // Nothing to do here.
}
/**
* This method is used to set the bounds of the children of the
* JInternalFrame.
- *
- * @param c The Container to lay out.
+ *
+ * @param c
+ * The Container to lay out.
*/
public void layoutContainer(Container c)
{
@@ -468,38 +472,38 @@ public class BasicInternalFrameUI extends InternalFrameUI
if (northPane != null)
{
- Dimension nDims = northPane.getPreferredSize();
- nh = Math.min(nDims.height, dims.height);
+ Dimension nDims = northPane.getPreferredSize();
+ nh = Math.min(nDims.height, dims.height);
- northPane.setBounds(insets.left, insets.top, dims.width, nh);
+ northPane.setBounds(insets.left, insets.top, dims.width, nh);
}
if (southPane != null)
{
- Dimension sDims = southPane.getPreferredSize();
- sh = Math.min(sDims.height, dims.height - nh);
+ Dimension sDims = southPane.getPreferredSize();
+ sh = Math.min(sDims.height, dims.height - nh);
- southPane.setBounds(insets.left, insets.top + dims.height - sh,
- dims.width, sh);
+ southPane.setBounds(insets.left, insets.top + dims.height - sh,
+ dims.width, sh);
}
int remHeight = dims.height - sh - nh;
if (westPane != null)
{
- Dimension wDims = westPane.getPreferredSize();
- ww = Math.min(dims.width, wDims.width);
+ Dimension wDims = westPane.getPreferredSize();
+ ww = Math.min(dims.width, wDims.width);
- westPane.setBounds(insets.left, insets.top + nh, ww, remHeight);
+ westPane.setBounds(insets.left, insets.top + nh, ww, remHeight);
}
if (eastPane != null)
{
- Dimension eDims = eastPane.getPreferredSize();
- ew = Math.min(eDims.width, dims.width - ww);
+ Dimension eDims = eastPane.getPreferredSize();
+ ew = Math.min(eDims.width, dims.width - ww);
- eastPane.setBounds(insets.left + dims.width - ew, insets.top + nh,
- ew, remHeight);
+ eastPane.setBounds(insets.left + dims.width - ew, insets.top + nh,
+ ew, remHeight);
}
int remWidth = dims.width - ww - ew;
@@ -510,9 +514,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns the minimum layout size.
- *
- * @param c The Container to find a minimum layout size for.
- *
+ *
+ * @param c
+ * The Container to find a minimum layout size for.
* @return The minimum dimensions for the JInternalFrame.
*/
public Dimension minimumLayoutSize(Container c)
@@ -522,9 +526,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns the maximum layout size.
- *
- * @param c The Container to find a maximum layout size for.
- *
+ *
+ * @param c
+ * The Container to find a maximum layout size for.
* @return The maximum dimensions for the JInternalFrame.
*/
public Dimension maximumLayoutSize(Container c)
@@ -534,9 +538,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* Th8is method returns the preferred layout size.
- *
- * @param c The Container to find a preferred layout size for.
- *
+ *
+ * @param c
+ * The Container to find a preferred layout size for.
* @return The preferred dimensions for the JInternalFrame.
*/
public Dimension preferredLayoutSize(Container c)
@@ -546,10 +550,11 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* DOCUMENT ME!
- *
- * @param c DOCUMENT ME!
- * @param min DOCUMENT ME!
- *
+ *
+ * @param c
+ * DOCUMENT ME!
+ * @param min
+ * DOCUMENT ME!
* @return DOCUMENT ME!
*/
private Dimension getSize(Container c, boolean min)
@@ -558,7 +563,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
Dimension contentDims = frame.getContentPane().getPreferredSize();
if (min)
- contentDims.width = contentDims.height = 0;
+ contentDims.width = contentDims.height = 0;
int nWidth = 0;
int nHeight = 0;
int sWidth = 0;
@@ -571,42 +576,42 @@ public class BasicInternalFrameUI extends InternalFrameUI
if (northPane != null)
{
- dims = northPane.getPreferredSize();
- if (dims != null)
- {
- nWidth = dims.width;
- nHeight = dims.height;
- }
+ dims = northPane.getPreferredSize();
+ if (dims != null)
+ {
+ nWidth = dims.width;
+ nHeight = dims.height;
+ }
}
if (southPane != null)
{
- dims = southPane.getPreferredSize();
- if (dims != null)
- {
- sWidth = dims.width;
- sHeight = dims.height;
- }
+ dims = southPane.getPreferredSize();
+ if (dims != null)
+ {
+ sWidth = dims.width;
+ sHeight = dims.height;
+ }
}
if (eastPane != null)
{
- dims = eastPane.getPreferredSize();
- if (dims != null)
- {
- sWidth = dims.width;
- sHeight = dims.height;
- }
+ dims = eastPane.getPreferredSize();
+ if (dims != null)
+ {
+ sWidth = dims.width;
+ sHeight = dims.height;
+ }
}
if (westPane != null)
{
- dims = westPane.getPreferredSize();
- if (dims != null)
- {
- wWidth = dims.width;
- wHeight = dims.height;
- }
+ dims = westPane.getPreferredSize();
+ if (dims != null)
+ {
+ wWidth = dims.width;
+ wHeight = dims.height;
+ }
}
int width = Math.max(sWidth, nWidth);
@@ -630,6 +635,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public void removeLayoutComponent(Component c)
{
+ // Nothing to do here.
}
}
@@ -657,8 +663,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse enters the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseEntered(MouseEvent e)
{
@@ -667,8 +674,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse is clicked on the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseClicked(MouseEvent e)
{
@@ -677,8 +685,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse is dragged in the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseDragged(MouseEvent e)
{
@@ -687,8 +696,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse exits the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseExited(MouseEvent e)
{
@@ -697,8 +707,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse is moved in the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseMoved(MouseEvent e)
{
@@ -706,9 +717,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method is called when the mouse is pressed in the glass pane.
- *
- * @param e The MouseEvent.
+ * This method is called when the mouse is pressed in the glass pane.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mousePressed(MouseEvent e)
{
@@ -717,9 +729,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method is called when the mouse is released in the glass pane.
- *
- * @param e The MouseEvent.
+ * This method is called when the mouse is released in the glass pane.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseReleased(MouseEvent e)
{
@@ -727,10 +740,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method acquires a candidate component to dispatch the MouseEvent
- * to.
- *
- * @param me The MouseEvent to acquire a component for.
+ * This method acquires a candidate component to dispatch the MouseEvent to.
+ *
+ * @param me
+ * The MouseEvent to acquire a component for.
*/
private void acquireComponentForMouseEvent(MouseEvent me)
{
@@ -738,134 +751,137 @@ public class BasicInternalFrameUI extends InternalFrameUI
int y = me.getY();
// Find the candidate which should receive this event.
- Component parent = frame.getContentPane();
+ Component parent = frame.getLayeredPane();
if (parent == null)
- return;
+ return;
Component candidate = null;
Point p = me.getPoint();
while (candidate == null && parent != null)
{
- candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
- if (candidate == null)
- {
- p = SwingUtilities.convertPoint(parent, p.x, p.y,
- parent.getParent());
- parent = parent.getParent();
- }
+ candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
+ if (candidate == null)
+ {
+ p = SwingUtilities.convertPoint(parent, p.x, p.y,
+ parent.getParent());
+ parent = parent.getParent();
+ }
}
// If the only candidate we found was the native container itself,
- // don't dispatch any event at all. We only care about the lightweight
+ // don't dispatch any event at all. We only care about the lightweight
// children here.
if (candidate == frame.getContentPane())
- candidate = null;
+ candidate = null;
// If our candidate is new, inform the old target we're leaving.
if (lastComponentEntered != null && lastComponentEntered.isShowing()
&& lastComponentEntered != candidate)
{
- Point tp = SwingUtilities.convertPoint(frame.getContentPane(), x, y,
- lastComponentEntered);
- MouseEvent exited = new MouseEvent(lastComponentEntered,
- MouseEvent.MOUSE_EXITED,
- me.getWhen(), me.getModifiersEx(),
- tp.x, tp.y, me.getClickCount(),
- me.isPopupTrigger(),
- me.getButton());
+ Point tp = SwingUtilities.convertPoint(frame.getContentPane(), x, y,
+ lastComponentEntered);
+ MouseEvent exited = new MouseEvent(lastComponentEntered,
+ MouseEvent.MOUSE_EXITED,
+ me.getWhen(), me.getModifiersEx(),
+ tp.x, tp.y, me.getClickCount(),
+ me.isPopupTrigger(),
+ me.getButton());
tempComponent = lastComponentEntered;
- lastComponentEntered = null;
- tempComponent.dispatchEvent(exited);
+ lastComponentEntered = null;
+ tempComponent.dispatchEvent(exited);
}
// If we have a candidate, maybe enter it.
if (candidate != null)
{
- mouseEventTarget = candidate;
- if (candidate.isLightweight() && candidate.isShowing()
- && candidate != frame.getContentPane()
- && candidate != lastComponentEntered)
- {
- lastComponentEntered = mouseEventTarget;
- Point cp = SwingUtilities.convertPoint(frame.getContentPane(),
- x, y, lastComponentEntered);
- MouseEvent entered = new MouseEvent(lastComponentEntered,
- MouseEvent.MOUSE_ENTERED,
- me.getWhen(),
- me.getModifiersEx(), cp.x,
- cp.y, me.getClickCount(),
- me.isPopupTrigger(),
- me.getButton());
- lastComponentEntered.dispatchEvent(entered);
- }
+ mouseEventTarget = candidate;
+ if (candidate.isLightweight() && candidate.isShowing()
+ && candidate != frame.getContentPane()
+ && candidate != lastComponentEntered)
+ {
+ lastComponentEntered = mouseEventTarget;
+ Point cp = SwingUtilities.convertPoint(frame.getContentPane(), x,
+ y, lastComponentEntered);
+ MouseEvent entered = new MouseEvent(lastComponentEntered,
+ MouseEvent.MOUSE_ENTERED,
+ me.getWhen(),
+ me.getModifiersEx(), cp.x,
+ cp.y, me.getClickCount(),
+ me.isPopupTrigger(),
+ me.getButton());
+ lastComponentEntered.dispatchEvent(entered);
+ }
}
if (me.getID() == MouseEvent.MOUSE_RELEASED
|| me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0
|| me.getID() == MouseEvent.MOUSE_DRAGGED)
- // If any of the following events occur while a button is held down,
- // they should be dispatched to the same component to which the
- // original MOUSE_PRESSED event was dispatched:
- // - MOUSE_RELEASED
- // - MOUSE_PRESSED: another button pressed while the first is held down
- // - MOUSE_DRAGGED
- mouseEventTarget = pressedComponent;
+ // If any of the following events occur while a button is held down,
+ // they should be dispatched to the same component to which the
+ // original MOUSE_PRESSED event was dispatched:
+ // - MOUSE_RELEASED
+ // - MOUSE_PRESSED: another button pressed while the first is held down
+ // - MOUSE_DRAGGED
+ mouseEventTarget = pressedComponent;
else if (me.getID() == MouseEvent.MOUSE_CLICKED)
{
- // Don't dispatch CLICKED events whose target is not the same as the
- // target for the original PRESSED event.
- if (candidate != pressedComponent)
- mouseEventTarget = null;
- else if (pressCount == 0)
- pressedComponent = null;
+ // Don't dispatch CLICKED events whose target is not the same as the
+ // target for the original PRESSED event.
+ if (candidate != pressedComponent)
+ mouseEventTarget = null;
+ else if (pressCount == 0)
+ pressedComponent = null;
}
}
/**
- * This is a helper method that dispatches the GlassPane MouseEvents to
- * the proper component.
- *
- * @param e The AWTEvent to be dispatched. Usually an instance of
- * MouseEvent.
+ * This is a helper method that dispatches the GlassPane MouseEvents to the
+ * proper component.
+ *
+ * @param e
+ * The AWTEvent to be dispatched. Usually an instance of
+ * MouseEvent.
*/
private void handleEvent(AWTEvent e)
{
if (e instanceof MouseEvent)
{
- MouseEvent me = SwingUtilities.convertMouseEvent(frame.getRootPane()
- .getGlassPane(),
- (MouseEvent) e,
- frame.getRootPane()
- .getGlassPane());
-
- acquireComponentForMouseEvent(me);
-
- // Avoid dispatching ENTERED and EXITED events twice.
- if (mouseEventTarget != null && mouseEventTarget.isShowing()
- && e.getID() != MouseEvent.MOUSE_ENTERED
- && e.getID() != MouseEvent.MOUSE_EXITED)
- {
- MouseEvent newEvt = SwingUtilities.convertMouseEvent(frame
- .getContentPane(),
- me,
- mouseEventTarget);
- mouseEventTarget.dispatchEvent(newEvt);
-
- switch (e.getID())
- {
- case MouseEvent.MOUSE_PRESSED:
- if (pressCount++ == 0)
- pressedComponent = mouseEventTarget;
- break;
- case MouseEvent.MOUSE_RELEASED:
- // Clear our memory of the original PRESSED event, only if
- // we're not expecting a CLICKED event after this. If
- // there is a CLICKED event after this, it will do clean up.
- if (--pressCount == 0
- && mouseEventTarget != pressedComponent)
- pressedComponent = null;
- break;
- }
- }
+ MouseEvent me = (MouseEvent) e;
+ acquireComponentForMouseEvent(me);
+
+ //If there is no target, return
+ if (mouseEventTarget == null)
+ return;
+
+ //Avoid re-dispatching to ourselves and causing an infinite loop
+ if (mouseEventTarget.equals(frame.getGlassPane()))
+ return;
+
+ // Avoid dispatching ENTERED and EXITED events twice.
+ if (mouseEventTarget.isShowing()
+ && e.getID() != MouseEvent.MOUSE_ENTERED
+ && e.getID() != MouseEvent.MOUSE_EXITED)
+ {
+ MouseEvent newEvt = SwingUtilities.convertMouseEvent(
+ frame.getGlassPane(),
+ me,
+ mouseEventTarget);
+ mouseEventTarget.dispatchEvent(newEvt);
+
+ switch (e.getID())
+ {
+ case MouseEvent.MOUSE_PRESSED:
+ if (pressCount++ == 0)
+ pressedComponent = mouseEventTarget;
+ break;
+ case MouseEvent.MOUSE_RELEASED:
+ // Clear our memory of the original PRESSED event, only if
+ // we're not expecting a CLICKED event after this. If
+ // there is a CLICKED event after this, it will do clean up.
+ if (--pressCount == 0 && mouseEventTarget != pressedComponent)
+ pressedComponent = null;
+ break;
+ }
+ }
}
}
}
@@ -874,17 +890,18 @@ public class BasicInternalFrameUI extends InternalFrameUI
* This helper class listens for PropertyChangeEvents from the
* JInternalFrame.
*/
- public class InternalFramePropertyChangeListener
- implements PropertyChangeListener, VetoableChangeListener
+ public class InternalFramePropertyChangeListener implements
+ PropertyChangeListener, VetoableChangeListener
{
/**
- * This method is called when one of the JInternalFrame's properties
- * change. This method is to allow JInternalFrame to veto an attempt
- * to close the internal frame. This allows JInternalFrame to honour
- * its defaultCloseOperation if that is DO_NOTHING_ON_CLOSE.
+ * This method is called when one of the JInternalFrame's properties change.
+ * This method is to allow JInternalFrame to veto an attempt to close the
+ * internal frame. This allows JInternalFrame to honour its
+ * defaultCloseOperation if that is DO_NOTHING_ON_CLOSE.
*/
- public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException
+ public void vetoableChange(PropertyChangeEvent e)
+ throws PropertyVetoException
{
if (e.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY))
{
@@ -892,75 +909,78 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
frame.setVisible(false);
frame.getDesktopPane().repaint();
- throw new PropertyVetoException ("close operation is HIDE_ON_CLOSE\n", e);
+ throw new PropertyVetoException(
+ "close operation is HIDE_ON_CLOSE\n",
+ e);
}
else if (frame.getDefaultCloseOperation() == JInternalFrame.DISPOSE_ON_CLOSE)
closeFrame(frame);
else
- throw new PropertyVetoException ("close operation is DO_NOTHING_ON_CLOSE\n", e);
+ throw new PropertyVetoException(
+ "close operation is DO_NOTHING_ON_CLOSE\n",
+ e);
}
}
-
+
/**
- * This method is called when one of the JInternalFrame's properties
- * change.
- *
- * @param evt The PropertyChangeEvent.
+ * This method is called when one of the JInternalFrame's properties change.
+ *
+ * @param evt
+ * The PropertyChangeEvent.
*/
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals(JInternalFrame.IS_MAXIMUM_PROPERTY))
{
- if (frame.isMaximum())
- maximizeFrame(frame);
- else
- minimizeFrame(frame);
+ if (frame.isMaximum())
+ maximizeFrame(frame);
+ else
+ minimizeFrame(frame);
}
else if (evt.getPropertyName().equals(JInternalFrame.IS_ICON_PROPERTY))
{
- if (frame.isIcon())
- iconifyFrame(frame);
- else
- deiconifyFrame(frame);
+ if (frame.isIcon())
+ iconifyFrame(frame);
+ else
+ deiconifyFrame(frame);
}
else if (evt.getPropertyName().equals(JInternalFrame.IS_SELECTED_PROPERTY))
{
- if (frame.isSelected())
- activateFrame(frame);
- else
- getDesktopManager().deactivateFrame(frame);
+ if (frame.isSelected())
+ activateFrame(frame);
+ else
+ deactivateFrame(frame);
}
else if (evt.getPropertyName().equals(JInternalFrame.ROOT_PANE_PROPERTY)
- || evt.getPropertyName().equals(JInternalFrame.GLASS_PANE_PROPERTY))
+ || evt.getPropertyName().equals(
+ JInternalFrame.GLASS_PANE_PROPERTY))
{
- Component old = (Component) evt.getOldValue();
- old.removeMouseListener(glassPaneDispatcher);
- old.removeMouseMotionListener(glassPaneDispatcher);
+ Component old = (Component) evt.getOldValue();
+ old.removeMouseListener(glassPaneDispatcher);
+ old.removeMouseMotionListener(glassPaneDispatcher);
- Component newPane = (Component) evt.getNewValue();
- newPane.addMouseListener(glassPaneDispatcher);
- newPane.addMouseMotionListener(glassPaneDispatcher);
+ Component newPane = (Component) evt.getNewValue();
+ newPane.addMouseListener(glassPaneDispatcher);
+ newPane.addMouseMotionListener(glassPaneDispatcher);
- frame.revalidate();
+ frame.revalidate();
}
- /* FIXME: need to add ancestor properties to JComponents.
- else if (evt.getPropertyName().equals(JComponent.ANCESTOR_PROPERTY))
- {
- if (desktopPane != null)
- desktopPane.removeComponentListener(componentListener);
- desktopPane = frame.getDesktopPane();
- if (desktopPane != null)
- desktopPane.addComponentListener(componentListener);
- }
- */
+ /*
+ * FIXME: need to add ancestor properties to JComponents. else if
+ * (evt.getPropertyName().equals(JComponent.ANCESTOR_PROPERTY)) { if
+ * (desktopPane != null)
+ * desktopPane.removeComponentListener(componentListener); desktopPane =
+ * frame.getDesktopPane(); if (desktopPane != null)
+ * desktopPane.addComponentListener(componentListener); }
+ */
}
}
/**
* This helper class is the border for the JInternalFrame.
*/
- private class InternalFrameBorder extends AbstractBorder
- implements UIResource
+ private class InternalFrameBorder extends AbstractBorder implements
+ UIResource
{
/** The width of the border. */
private static final int bSize = 5;
@@ -970,7 +990,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns whether the border is opaque.
- *
+ *
* @return Whether the border is opaque.
*/
public boolean isBorderOpaque()
@@ -980,9 +1000,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns the insets of the border.
- *
- * @param c The Component to find border insets for.
- *
+ *
+ * @param c
+ * The Component to find border insets for.
* @return The border insets.
*/
public Insets getBorderInsets(Component c)
@@ -992,13 +1012,19 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method paints the border.
- *
- * @param c The Component that owns the border.
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to paint at.
- * @param y The y coordinate to paint at.
- * @param width The width of the Component.
- * @param height The height of the Component.
+ *
+ * @param c
+ * The Component that owns the border.
+ * @param g
+ * The Graphics object to paint with.
+ * @param x
+ * The x coordinate to paint at.
+ * @param y
+ * The y coordinate to paint at.
+ * @param width
+ * The width of the Component.
+ * @param height
+ * The height of the Component.
*/
public void paintBorder(Component c, Graphics g, int x, int y, int width,
int height)
@@ -1111,6 +1137,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public BasicInternalFrameUI(JInternalFrame b)
{
+ // Nothing to do here.
}
/**
@@ -1135,21 +1162,21 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
if (c instanceof JInternalFrame)
{
- frame = (JInternalFrame) c;
+ frame = (JInternalFrame) c;
- internalFrameLayout = createLayoutManager();
- frame.setLayout(internalFrameLayout);
+ internalFrameLayout = createLayoutManager();
+ frame.setLayout(internalFrameLayout);
- ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false);
- frame.getRootPane().getGlassPane().setVisible(true);
+ ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false);
+ frame.getRootPane().getGlassPane().setVisible(true);
- installDefaults();
- installListeners();
- installComponents();
- installKeyboardActions();
+ installDefaults();
+ installListeners();
+ installComponents();
+ installKeyboardActions();
- frame.setOpaque(true);
- frame.invalidate();
+ frame.setOpaque(true);
+ frame.invalidate();
}
}
@@ -1177,10 +1204,8 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- Border border = defaults.getBorder("InternalFrame.border");
- frame.setBorder(border);
- frame.setFrameIcon(defaults.getIcon("InternalFrame.icon"));
+ LookAndFeel.installBorder(frame, "InternalFrame.border");
+ frame.setFrameIcon(UIManager.getIcon("InternalFrame.icon"));
// InternalFrames are invisible by default.
frame.setVisible(false);
}
@@ -1343,14 +1368,14 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
if (currentPane != null)
{
- deinstallMouseHandlers(currentPane);
- frame.remove(currentPane);
+ deinstallMouseHandlers(currentPane);
+ frame.remove(currentPane);
}
if (newPane != null)
{
- installMouseHandlers(newPane);
- frame.add(newPane);
+ installMouseHandlers(newPane);
+ frame.add(newPane);
}
}
@@ -1678,6 +1703,16 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
+ * This is a convenience method that deactivates the JInternalFrame.
+ *
+ * @param f the JInternalFrame to deactivate
+ */
+ protected void deactivateFrame(JInternalFrame f)
+ {
+ getDesktopManager().deactivateFrame(f);
+ }
+
+ /**
* This method returns a new ComponentListener for the JDesktopPane.
*
* @return A new ComponentListener.
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
index bb9ce6cb1d9..c8f677fa0a0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
@@ -50,9 +50,8 @@ import java.beans.PropertyChangeListener;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
@@ -60,9 +59,7 @@ import javax.swing.plaf.LabelUI;
* This is the Basic Look and Feel class for the JLabel. One BasicLabelUI
* object is used to paint all JLabels that utilize the Basic Look and Feel.
*/
-public class BasicLabelUI
- extends LabelUI
- implements PropertyChangeListener
+public class BasicLabelUI extends LabelUI implements PropertyChangeListener
{
/** The labelUI that is shared by all labels. */
protected static BasicLabelUI labelUI;
@@ -345,11 +342,8 @@ public class BasicLabelUI
*/
protected void installDefaults(JLabel c)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- c.setForeground(defaults.getColor("Label.foreground"));
- c.setBackground(defaults.getColor("Label.background"));
- c.setFont(defaults.getFont("Label.font"));
+ LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground",
+ "Label.font");
//XXX: There are properties we don't use called disabledForeground
//and disabledShadow.
}
@@ -417,8 +411,6 @@ public class BasicLabelUI
*/
public void propertyChange(PropertyChangeEvent e)
{
- JLabel c = (JLabel) e.getSource();
- c.revalidate();
- c.repaint();
+ // What to do here?
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
index 841bd670f67..33932991473 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
@@ -38,31 +38,35 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
import javax.swing.CellRendererPane;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JViewport;
+import javax.swing.KeyStroke;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
+import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
@@ -70,7 +74,9 @@ import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.ListUI;
/**
@@ -125,8 +131,9 @@ public class BasicListUI extends ListUI
* Helper method to repaint the focused cell's
* lost or acquired focus state.
*/
- void repaintCellFocus()
+ protected void repaintCellFocus()
{
+ // TODO: Implement this properly.
}
}
@@ -183,141 +190,231 @@ public class BasicListUI extends ListUI
*/
public void valueChanged(ListSelectionEvent e)
{
+ int index1 = e.getFirstIndex();
+ int index2 = e.getLastIndex();
+ Rectangle damaged = getCellBounds(list, index1, index2);
+ list.repaint(damaged);
}
}
/**
- * A helper class which listens for {@link KeyEvents}s
- * from the {@link JList}.
+ * This class is used to mimmic the behaviour of the JDK when registering
+ * keyboard actions. It is the same as the private class used in JComponent
+ * for the same reason. This class receives an action event and dispatches
+ * it to the true receiver after altering the actionCommand property of the
+ * event.
*/
- private class KeyHandler extends KeyAdapter
+ private static class ActionListenerProxy
+ extends AbstractAction
{
- public KeyHandler()
+ ActionListener target;
+ String bindingCommandName;
+
+ public ActionListenerProxy(ActionListener li,
+ String cmd)
{
+ target = li;
+ bindingCommandName = cmd;
}
-
- public void keyPressed( KeyEvent evt )
+
+ public void actionPerformed(ActionEvent e)
+ {
+ ActionEvent derivedEvent = new ActionEvent(e.getSource(),
+ e.getID(),
+ bindingCommandName,
+ e.getModifiers());
+ target.actionPerformed(derivedEvent);
+ }
+ }
+
+ class ListAction extends AbstractAction
+ {
+ public void actionPerformed (ActionEvent e)
{
- int lead = BasicListUI.this.list.getLeadSelectionIndex();
- int max = BasicListUI.this.list.getModel().getSize() - 1;
+ int lead = list.getLeadSelectionIndex();
+ int max = list.getModel().getSize() - 1;
+ DefaultListSelectionModel selModel = (DefaultListSelectionModel)list.getSelectionModel();
+ String command = e.getActionCommand();
// Do nothing if list is empty
if (max == -1)
return;
-
- // Process the key event. Bindings can be found in
- // javax.swing.plaf.basic.BasicLookAndFeel.java
- if ((evt.getKeyCode() == KeyEvent.VK_DOWN)
- || (evt.getKeyCode() == KeyEvent.VK_KP_DOWN))
+
+ if (command.equals("selectNextRow"))
{
- if (evt.getModifiers() == 0)
- {
- BasicListUI.this.list.clearSelection();
- BasicListUI.this.list.setSelectedIndex(Math.min(lead+1,max));
- }
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
+ selectNextIndex();
+ }
+ else if (command.equals("selectPreviousRow"))
+ {
+ selectPreviousIndex();
+ }
+ else if (command.equals("clearSelection"))
+ {
+ list.clearSelection();
+ }
+ else if (command.equals("selectAll"))
+ {
+ list.setSelectionInterval(0, max);
+ // this next line is to restore the lead selection index to the old
+ // position, because select-all should not change the lead index
+ list.addSelectionInterval(lead, lead);
+ }
+ else if (command.equals("selectLastRow"))
+ {
+ list.setSelectedIndex(list.getModel().getSize() - 1);
+ }
+ else if (command.equals("selectLastRowChangeLead"))
+ {
+ selModel.moveLeadSelectionIndex(list.getModel().getSize() - 1);
+ }
+ else if (command.equals("scrollDownExtendSelection"))
+ {
+ int target;
+ if (lead == list.getLastVisibleIndex())
{
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(Math.min(lead+1,max));
+ target = Math.min
+ (max, lead + (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
+ else
+ target = list.getLastVisibleIndex();
+ selModel.setLeadSelectionIndex(target);
}
- else if ((evt.getKeyCode() == KeyEvent.VK_UP)
- || (evt.getKeyCode() == KeyEvent.VK_KP_UP))
+ else if (command.equals("scrollDownChangeLead"))
{
- if (evt.getModifiers() == 0)
+ int target;
+ if (lead == list.getLastVisibleIndex())
{
- BasicListUI.this.list.clearSelection();
- BasicListUI.this.list.setSelectedIndex(Math.max(lead-1,0));
+ target = Math.min
+ (max, lead + (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
+ else
+ target = list.getLastVisibleIndex();
+ selModel.moveLeadSelectionIndex(target);
+ }
+ else if (command.equals("scrollUpExtendSelection"))
+ {
+ int target;
+ if (lead == list.getFirstVisibleIndex())
{
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(Math.max(lead-1,0));
+ target = Math.max
+ (0, lead - (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
+ else
+ target = list.getFirstVisibleIndex();
+ selModel.setLeadSelectionIndex(target);
}
- else if (evt.getKeyCode() == KeyEvent.VK_PAGE_UP)
+ else if (command.equals("scrollUpChangeLead"))
{
int target;
- if (lead == BasicListUI.this.list.getFirstVisibleIndex())
+ if (lead == list.getFirstVisibleIndex())
{
target = Math.max
- (0, lead - (BasicListUI.this.list.getLastVisibleIndex() -
- BasicListUI.this.list.getFirstVisibleIndex() + 1));
+ (0, lead - (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
else
+ target = list.getFirstVisibleIndex();
+ selModel.moveLeadSelectionIndex(target);
+ }
+ else if (command.equals("selectNextRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(Math.min(lead + 1,max));
+ }
+ else if (command.equals("selectFirstRow"))
+ {
+ list.setSelectedIndex(0);
+ }
+ else if (command.equals("selectFirstRowChangeLead"))
+ {
+ selModel.moveLeadSelectionIndex(0);
+ }
+ else if (command.equals("selectFirstRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(0);
+ }
+ else if (command.equals("selectPreviousRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(Math.max(0,lead - 1));
+ }
+ else if (command.equals("scrollUp"))
+ {
+ int target;
+ if (lead == list.getFirstVisibleIndex())
{
- target = BasicListUI.this.list.getFirstVisibleIndex();
+ target = Math.max
+ (0, lead - (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
- if (evt.getModifiers() == 0)
- BasicListUI.this.list.setSelectedIndex(target);
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(target);
+ else
+ target = list.getFirstVisibleIndex();
+ list.setSelectedIndex(target);
}
- else if (evt.getKeyCode() == KeyEvent.VK_PAGE_DOWN)
+ else if (command.equals("selectLastRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(list.getModel().getSize() - 1);
+ }
+ else if (command.equals("scrollDown"))
{
int target;
- if (lead == BasicListUI.this.list.getLastVisibleIndex())
+ if (lead == list.getLastVisibleIndex())
{
target = Math.min
- (max, lead + (BasicListUI.this.list.getLastVisibleIndex() -
- BasicListUI.this.list.getFirstVisibleIndex() + 1));
+ (max, lead + (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
else
+ target = list.getLastVisibleIndex();
+ list.setSelectedIndex(target);
+ }
+ else if (command.equals("selectNextRowChangeLead"))
+ {
+ if (selModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ selectNextIndex();
+ else
+ {
+ selModel.moveLeadSelectionIndex(Math.min(max, lead + 1));
+ }
+ }
+ else if (command.equals("selectPreviousRowChangeLead"))
+ {
+ if (selModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ selectPreviousIndex();
+ else
{
- target = BasicListUI.this.list.getLastVisibleIndex();
+ selModel.moveLeadSelectionIndex(Math.max(0, lead - 1));
}
- if (evt.getModifiers() == 0)
- BasicListUI.this.list.setSelectedIndex(target);
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(target);
- }
- else if (evt.getKeyCode() == KeyEvent.VK_BACK_SLASH
- && (evt.getModifiers() == InputEvent.CTRL_MASK))
+ }
+ else if (command.equals("addToSelection"))
{
- BasicListUI.this.list.clearSelection();
+ list.addSelectionInterval(lead, lead);
}
- else if ((evt.getKeyCode() == KeyEvent.VK_HOME)
- || evt.getKeyCode() == KeyEvent.VK_END)
+ else if (command.equals("extendTo"))
{
- if (evt.getModifiers() != 0 &&
- evt.getModifiers() != InputEvent.SHIFT_MASK)
- return;
- // index is either 0 for HOME, or last cell for END
- int index = (evt.getKeyCode() == KeyEvent.VK_HOME) ? 0 : max;
-
- if (!evt.isShiftDown() ||(BasicListUI.this.list.getSelectionMode()
- == ListSelectionModel.SINGLE_SELECTION))
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_INTERVAL_SELECTION)
- BasicListUI.this.list.setSelectionInterval
- (BasicListUI.this.list.getAnchorSelectionIndex(), index);
- else
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(index);
+ selModel.setSelectionInterval(selModel.getAnchorSelectionIndex(),
+ lead);
}
- else if ((evt.getKeyCode() == KeyEvent.VK_A || evt.getKeyCode()
- == KeyEvent.VK_SLASH) && (evt.getModifiers() ==
- InputEvent.CTRL_MASK))
+ else if (command.equals("toggleAndAnchor"))
{
- BasicListUI.this.list.setSelectionInterval(0, max);
- // this next line is to restore the lead selection index to the old
- // position, because select-all should not change the lead index
- BasicListUI.this.list.addSelectionInterval(lead, lead);
+ if (!list.isSelectedIndex(lead))
+ list.addSelectionInterval(lead, lead);
+ else
+ list.removeSelectionInterval(lead, lead);
+ selModel.setAnchorSelectionIndex(lead);
}
- else if (evt.getKeyCode() == KeyEvent.VK_SPACE &&
- (evt.getModifiers() == InputEvent.CTRL_MASK))
+ else
{
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(Math.min(lead+1,max));
+ // DEBUG: uncomment the following line to print out
+ // key bindings that aren't implemented yet
+
+ // System.out.println ("not implemented: "+e.getActionCommand());
}
-
- BasicListUI.this.list.ensureIndexIsVisible
- (BasicListUI.this.list.getLeadSelectionIndex());
+
+ list.ensureIndexIsVisible(list.getLeadSelectionIndex());
}
}
-
+
/**
* A helper class which listens for {@link MouseEvent}s
* from the {@link JList}.
@@ -333,48 +430,46 @@ public class BasicListUI extends ListUI
public void mouseClicked(MouseEvent event)
{
Point click = event.getPoint();
- int index = BasicListUI.this.locationToIndex(list, click);
+ int index = locationToIndex(list, click);
if (index == -1)
return;
if (event.isShiftDown())
{
- if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_SELECTION)
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.getSelectionMode() ==
+ if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)
+ list.setSelectedIndex(index);
+ else if (list.getSelectionMode() ==
ListSelectionModel.SINGLE_INTERVAL_SELECTION)
// COMPAT: the IBM VM is compatible with the following line of code.
// However, compliance with Sun's VM would correspond to replacing
// getAnchorSelectionIndex() with getLeadSelectionIndex().This is
// both unnatural and contradictory to the way they handle other
// similar UI interactions.
- BasicListUI.this.list.setSelectionInterval
- (BasicListUI.this.list.getAnchorSelectionIndex(), index);
+ list.setSelectionInterval(list.getAnchorSelectionIndex(), index);
else
// COMPAT: both Sun and IBM are compatible instead with:
- // BasicListUI.this.list.setSelectionInterval
- // (BasicListUI.this.list.getLeadSelectionIndex(),index);
+ // list.setSelectionInterval
+ // (list.getLeadSelectionIndex(),index);
// Note that for IBM this is contradictory to what they did in
// the above situation for SINGLE_INTERVAL_SELECTION.
// The most natural thing to do is the following:
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(index);
+ if (list.isSelectedIndex(list.getAnchorSelectionIndex()))
+ list.getSelectionModel().setLeadSelectionIndex(index);
+ else
+ list.addSelectionInterval(list.getAnchorSelectionIndex(), index);
}
else if (event.isControlDown())
{
- if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_SELECTION)
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.isSelectedIndex(index))
- BasicListUI.this.list.removeSelectionInterval(index,index);
+ if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)
+ list.setSelectedIndex(index);
+ else if (list.isSelectedIndex(index))
+ list.removeSelectionInterval(index,index);
else
- BasicListUI.this.list.addSelectionInterval(index,index);
+ list.addSelectionInterval(index,index);
}
else
- BasicListUI.this.list.setSelectedIndex(index);
+ list.setSelectedIndex(index);
- BasicListUI.this.list.ensureIndexIsVisible
- (BasicListUI.this.list.getLeadSelectionIndex());
+ list.ensureIndexIsVisible(list.getLeadSelectionIndex());
}
/**
@@ -385,6 +480,7 @@ public class BasicListUI extends ListUI
*/
public void mousePressed(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -395,6 +491,7 @@ public class BasicListUI extends ListUI
*/
public void mouseReleased(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -405,6 +502,7 @@ public class BasicListUI extends ListUI
*/
public void mouseEntered(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -415,6 +513,7 @@ public class BasicListUI extends ListUI
*/
public void mouseExited(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -425,6 +524,7 @@ public class BasicListUI extends ListUI
*/
public void mouseDragged(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -435,6 +535,7 @@ public class BasicListUI extends ListUI
*/
public void mouseMoved(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -459,11 +560,61 @@ public class BasicListUI extends ListUI
if (e.getNewValue() != null && e.getNewValue() instanceof ListModel)
((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener);
}
+ // Update the updateLayoutStateNeeded flag.
+ if (e.getPropertyName().equals("model"))
+ updateLayoutStateNeeded += modelChanged;
+ else if (e.getPropertyName().equals("selectionModel"))
+ updateLayoutStateNeeded += selectionModelChanged;
+ else if (e.getPropertyName().equals("font"))
+ updateLayoutStateNeeded += fontChanged;
+ else if (e.getPropertyName().equals("fixedCellWidth"))
+ updateLayoutStateNeeded += fixedCellWidthChanged;
+ else if (e.getPropertyName().equals("fixedCellHeight"))
+ updateLayoutStateNeeded += fixedCellHeightChanged;
+ else if (e.getPropertyName().equals("prototypeCellValue"))
+ updateLayoutStateNeeded += prototypeCellValueChanged;
+ else if (e.getPropertyName().equals("cellRenderer"))
+ updateLayoutStateNeeded += cellRendererChanged;
BasicListUI.this.damageLayout();
}
}
/**
+ * A constant to indicate that the model has changed.
+ */
+ protected static final int modelChanged = 1;
+
+ /**
+ * A constant to indicate that the selection model has changed.
+ */
+ protected static final int selectionModelChanged = 2;
+
+ /**
+ * A constant to indicate that the font has changed.
+ */
+ protected static final int fontChanged = 4;
+
+ /**
+ * A constant to indicate that the fixedCellWidth has changed.
+ */
+ protected static final int fixedCellWidthChanged = 8;
+
+ /**
+ * A constant to indicate that the fixedCellHeight has changed.
+ */
+ protected static final int fixedCellHeightChanged = 16;
+
+ /**
+ * A constant to indicate that the prototypeCellValue has changed.
+ */
+ protected static final int prototypeCellValueChanged = 32;
+
+ /**
+ * A constant to indicate that the cellRenderer has changed.
+ */
+ protected static final int cellRendererChanged = 64;
+
+ /**
* Creates a new BasicListUI for the component.
*
* @param c The component to create a UI for
@@ -487,9 +638,6 @@ public class BasicListUI extends ListUI
/** The mouse listener listening to the list. */
protected MouseInputListener mouseInputListener;
- /** The key listener listening to the list */
- private KeyHandler keyListener;
-
/** The property change listener listening to the list. */
protected PropertyChangeListener propertyChangeListener;
@@ -501,7 +649,11 @@ public class BasicListUI extends ListUI
/** Saved reference to the list this UI was created for. */
protected JList list;
- /** The height of a single cell in the list. */
+ /**
+ * The height of a single cell in the list. This field is used when the
+ * fixedCellHeight property of the list is set. Otherwise this field is
+ * set to <code>-1</code> and {@link #cellHeights} is used instead.
+ */
protected int cellHeight;
/** The width of a single cell in the list. */
@@ -509,14 +661,25 @@ public class BasicListUI extends ListUI
/**
* An array of varying heights of cells in the list, in cases where each
- * cell might have a different height.
+ * cell might have a different height. This field is used when the
+ * <code>fixedCellHeight</code> property of the list is not set. Otherwise
+ * this field is <code>null</code> and {@link #cellHeight} is used.
*/
protected int[] cellHeights;
/**
- * A simple counter. When nonzero, indicates that the UI class is out of
+ * A bitmask that indicates which properties of the JList have changed.
+ * When nonzero, indicates that the UI class is out of
* date with respect to the underlying list, and must recalculate the
* list layout before painting or performing size calculations.
+ *
+ * @see #modelChanged
+ * @see #selectionModelChanged
+ * @see #fontChanged
+ * @see #fixedCellWidthChanged
+ * @see #fixedCellHeightChanged
+ * @see #prototypeCellValueChanged
+ * @see #cellRendererChanged
*/
protected int updateLayoutStateNeeded;
@@ -524,6 +687,9 @@ public class BasicListUI extends ListUI
* The {@link CellRendererPane} that is used for painting.
*/
protected CellRendererPane rendererPane;
+
+ /** The action bound to KeyStrokes. */
+ ListAction action;
/**
* Calculate the height of a particular row. If there is a fixed {@link
@@ -611,19 +777,51 @@ public class BasicListUI extends ListUI
* @param y0 The Y coordinate to calculate the row number for
*
* @return The row number containing the specified Y value, or <code>-1</code>
- * if the specified Y coordinate is invalid
+ * if the list model is empty
+ *
+ * @specnote This method is specified to return -1 for an invalid Y
+ * coordinate. However, some simple tests show that the behaviour
+ * is to return the index of the last list element for an Y
+ * coordinate that lies outside of the list bounds (even for
+ * negative indices). <code>-1</code>
+ * is only returned if the list model is empty.
*/
protected int convertYToRow(int y0)
{
- for (int row = 0; row < cellHeights.length; ++row)
- {
- int h = getRowHeight(row);
+ if (list.getModel().getSize() == 0)
+ return -1;
+
+ // When y0 < 0, then the JDK returns the maximum row index of the list. So
+ // do we.
+ if (y0 < 0)
+ return list.getModel().getSize() - 1;
+
+ // Update the layout if necessary.
+ maybeUpdateLayoutState();
+
+ int index = list.getModel().getSize() - 1;;
- if (y0 < h)
- return row;
- y0 -= h;
+ // If a fixed cell height is set, then we can work more efficient.
+ if (cellHeight > 0)
+ {
+ index = Math.max(y0 / cellHeight, index);
+ }
+ // If we have no fixed cell height, we must add up each cell height up
+ // to y0.
+ else
+ {
+ int h = 0;
+ for (int row = 0; row < cellHeights.length; ++row)
+ {
+ h += cellHeights[row];
+ if (y0 < h)
+ {
+ index = row;
+ break;
+ }
+ }
}
- return -1;
+ return index;
}
/**
@@ -638,29 +836,47 @@ public class BasicListUI extends ListUI
cellWidth = -1;
if (cellHeights == null || cellHeights.length != nrows)
cellHeights = new int[nrows];
- if (list.getFixedCellHeight() == -1 || list.getFixedCellWidth() == -1)
+ ListCellRenderer rend = list.getCellRenderer();
+ // Update the cellHeight(s) fields.
+ int fixedCellHeight = list.getFixedCellHeight();
+ if (fixedCellHeight > 0)
+ {
+ cellHeight = fixedCellHeight;
+ cellHeights = null;
+ }
+ else
{
- ListCellRenderer rend = list.getCellRenderer();
+ cellHeight = -1;
for (int i = 0; i < nrows; ++i)
{
- Component flyweight = rend.getListCellRendererComponent(list,
- list.getModel()
- .getElementAt(i),
- 0, false,
- false);
+ Component flyweight =
+ rend.getListCellRendererComponent(list,
+ list.getModel().getElementAt(i),
+ i, list.isSelectedIndex(i),
+ list.getSelectionModel().getAnchorSelectionIndex() == i);
Dimension dim = flyweight.getPreferredSize();
cellHeights[i] = dim.height;
- // compute average cell height (little hack here)
- cellHeight = (cellHeight * i + cellHeights[i]) / (i + 1);
- cellWidth = Math.max(cellWidth, dim.width);
- if (list.getLayoutOrientation() == JList.VERTICAL)
- cellWidth = Math.max(cellWidth, list.getSize().width);
}
}
+
+ // Update the cellWidth field.
+ int fixedCellWidth = list.getFixedCellWidth();
+ if (fixedCellWidth > 0)
+ cellWidth = fixedCellWidth;
else
{
- cellHeight = list.getFixedCellHeight();
- cellWidth = list.getFixedCellWidth();
+ for (int i = 0; i < nrows; ++i)
+ {
+ Component flyweight =
+ rend.getListCellRendererComponent(list,
+ list.getModel().getElementAt(i),
+ i, list.isSelectedIndex(i),
+ list.getSelectionModel().getAnchorSelectionIndex() == i);
+ Dimension dim = flyweight.getPreferredSize();
+ cellWidth = Math.max(cellWidth, dim.width);
+ }
+ if (list.getLayoutOrientation() == JList.VERTICAL)
+ cellWidth = Math.max(cellWidth, list.getSize().width);
}
}
@@ -694,13 +910,6 @@ public class BasicListUI extends ListUI
*/
public BasicListUI()
{
- focusListener = new FocusHandler();
- listDataListener = new ListDataHandler();
- listSelectionListener = new ListSelectionHandler();
- mouseInputListener = new MouseInputHandler();
- keyListener = new KeyHandler();
- propertyChangeListener = new PropertyChangeHandler();
- componentListener = new ComponentHandler();
updateLayoutStateNeeded = 1;
rendererPane = new CellRendererPane();
}
@@ -713,11 +922,10 @@ public class BasicListUI extends ListUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- list.setForeground(defaults.getColor("List.foreground"));
- list.setBackground(defaults.getColor("List.background"));
- list.setSelectionForeground(defaults.getColor("List.selectionForeground"));
- list.setSelectionBackground(defaults.getColor("List.selectionBackground"));
+ LookAndFeel.installColorsAndFont(list, "List.background",
+ "List.foreground", "List.font");
+ list.setSelectionForeground(UIManager.getColor("List.selectionForeground"));
+ list.setSelectionBackground(UIManager.getColor("List.selectionBackground"));
list.setOpaque(true);
}
@@ -727,7 +935,6 @@ public class BasicListUI extends ListUI
*/
protected void uninstallDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
list.setForeground(null);
list.setBackground(null);
list.setSelectionForeground(null);
@@ -742,14 +949,28 @@ public class BasicListUI extends ListUI
*/
protected void installListeners()
{
+ if (focusListener == null)
+ focusListener = createFocusListener();
list.addFocusListener(focusListener);
+ if (listDataListener == null)
+ listDataListener = createListDataListener();
list.getModel().addListDataListener(listDataListener);
+ if (listSelectionListener == null)
+ listSelectionListener = createListSelectionListener();
list.addListSelectionListener(listSelectionListener);
+ if (mouseInputListener == null)
+ mouseInputListener = createMouseInputListener();
list.addMouseListener(mouseInputListener);
- list.addKeyListener(keyListener);
list.addMouseMotionListener(mouseInputListener);
+ if (propertyChangeListener == null)
+ propertyChangeListener = createPropertyChangeListener();
list.addPropertyChangeListener(propertyChangeListener);
+
+ // FIXME: Are these two really needed? At least they are not documented.
+ //keyListener = new KeyHandler();
+ componentListener = new ComponentHandler();
list.addComponentListener(componentListener);
+ //list.addKeyListener(keyListener);
}
/**
@@ -761,16 +982,41 @@ public class BasicListUI extends ListUI
list.getModel().removeListDataListener(listDataListener);
list.removeListSelectionListener(listSelectionListener);
list.removeMouseListener(mouseInputListener);
- list.removeKeyListener(keyListener);
+ //list.removeKeyListener(keyListener);
list.removeMouseMotionListener(mouseInputListener);
list.removePropertyChangeListener(propertyChangeListener);
}
-
+
/**
* Installs keyboard actions for this UI in the {@link JList}.
*/
protected void installKeyboardActions()
{
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ InputMap focusInputMap = (InputMap)defaults.get("List.focusInputMap");
+ InputMapUIResource parentInputMap = new InputMapUIResource();
+ // FIXME: The JDK uses a LazyActionMap for parentActionMap
+ ActionMap parentActionMap = new ActionMapUIResource();
+ action = new ListAction();
+ Object keys[] = focusInputMap.allKeys();
+ // Register key bindings in the UI InputMap-ActionMap pair
+ for (int i = 0; i < keys.length; i++)
+ {
+ KeyStroke stroke = (KeyStroke)keys[i];
+ String actionString = (String) focusInputMap.get(stroke);
+ parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(),
+ stroke.getModifiers()),
+ actionString);
+
+ parentActionMap.put (actionString,
+ new ActionListenerProxy(action, actionString));
+ }
+ // Register the new InputMap-ActionMap as the parents of the list's
+ // InputMap and ActionMap
+ parentInputMap.setParent(list.getInputMap().getParent());
+ parentActionMap.setParent(list.getActionMap().getParent());
+ list.getInputMap().setParent(parentInputMap);
+ list.getActionMap().setParent(parentActionMap);
}
/**
@@ -778,6 +1024,7 @@ public class BasicListUI extends ListUI
*/
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
/**
@@ -855,22 +1102,6 @@ public class BasicListUI extends ListUI
}
/**
- * Paints the packground of the list using the background color
- * of the specified component.
- *
- * @param g The graphics context to paint in
- * @param c The component to paint the background of
- */
- private void paintBackground(Graphics g, JComponent c)
- {
- Dimension size = getPreferredSize(c);
- Color save = g.getColor();
- g.setColor(c.getBackground());
- g.fillRect(0, 0, size.width, size.height);
- g.setColor(save);
- }
-
- /**
* Paints a single cell in the list.
*
* @param g The graphics context to paint in
@@ -892,14 +1123,12 @@ public class BasicListUI extends ListUI
Component comp = rend.getListCellRendererComponent(list,
data.getElementAt(row),
0, isSel, hasFocus);
- //comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height));
- //comp.paint(g);
rendererPane.paintComponent(g, comp, list, bounds);
}
/**
- * Paints the list by calling {@link #paintBackground} and then repeatedly
- * calling {@link #paintCell} for each visible cell in the list.
+ * Paints the list by repeatedly calling {@link #paintCell} for each visible
+ * cell in the list.
*
* @param g The graphics context to paint with
* @param c Ignored; uses the saved {@link JList} reference
@@ -916,9 +1145,12 @@ public class BasicListUI extends ListUI
ListSelectionModel sel = list.getSelectionModel();
int lead = sel.getLeadSelectionIndex();
Rectangle clip = g.getClipBounds();
- paintBackground(g, list);
- for (int row = 0; row < nrows; ++row)
+ int startIndex = list.locationToIndex(new Point(clip.x, clip.y));
+ int endIndex = list.locationToIndex(new Point(clip.x + clip.width,
+ clip.y + clip.height));
+
+ for (int row = startIndex; row <= endIndex; ++row)
{
Rectangle bounds = getCellBounds(list, row, row);
if (bounds.intersects(clip))
@@ -927,13 +1159,15 @@ public class BasicListUI extends ListUI
}
/**
- * Computes the index of a list cell given a point within the list.
+ * Computes the index of a list cell given a point within the list. If the
+ * location lies outside the bounds of the list, the greatest index in the
+ * list model is returned.
*
* @param list the list which on which the computation is based on
* @param location the coordinates
*
* @return the index of the list item that is located at the given
- * coordinates or <code>null</code> if the location is invalid
+ * coordinates or <code>-1</code> if the list model is empty
*/
public int locationToIndex(JList list, Point location)
{
@@ -983,7 +1217,6 @@ public class BasicListUI extends ListUI
int numberOfItems2 = list.getModel().getSize();
int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1;
- Dimension listDim2 = list.getSize();
int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1);
int gridY2 = Math.min(location.y / cellHeight, visibleRows2);
index = gridY2 + gridX2 * visibleRows2;
@@ -1045,4 +1278,82 @@ public class BasicListUI extends ListUI
}
return loc;
}
+
+ /**
+ * Creates and returns the focus listener for this UI.
+ *
+ * @return the focus listener for this UI
+ */
+ protected FocusListener createFocusListener()
+ {
+ return new FocusHandler();
+ }
+
+ /**
+ * Creates and returns the list data listener for this UI.
+ *
+ * @return the list data listener for this UI
+ */
+ protected ListDataListener createListDataListener()
+ {
+ return new ListDataHandler();
+ }
+
+ /**
+ * Creates and returns the list selection listener for this UI.
+ *
+ * @return the list selection listener for this UI
+ */
+ protected ListSelectionListener createListSelectionListener()
+ {
+ return new ListSelectionHandler();
+ }
+
+ /**
+ * Creates and returns the mouse input listener for this UI.
+ *
+ * @return the mouse input listener for this UI
+ */
+ protected MouseInputListener createMouseInputListener()
+ {
+ return new MouseInputHandler();
+ }
+
+ /**
+ * Creates and returns the property change listener for this UI.
+ *
+ * @return the property change listener for this UI
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * Selects the next list item and force it to be visible.
+ */
+ protected void selectNextIndex()
+ {
+ int index = list.getSelectionModel().getLeadSelectionIndex();
+ if (index < list.getModel().getSize() - 1)
+ {
+ index++;
+ list.setSelectedIndex(index);
+ }
+ list.ensureIndexIsVisible(index);
+ }
+
+ /**
+ * Selects the previous list item and force it to be visible.
+ */
+ protected void selectPreviousIndex()
+ {
+ int index = list.getSelectionModel().getLeadSelectionIndex();
+ if (index > 0)
+ {
+ index--;
+ list.setSelectedIndex(index);
+ }
+ list.ensureIndexIsVisible(index);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
index d35ac9eb926..8ebe650350c 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -273,7 +273,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Button.foreground", new ColorUIResource(Color.BLACK),
"Button.highlight", new ColorUIResource(Color.WHITE),
"Button.light", new ColorUIResource(Color.LIGHT_GRAY),
- "Button.margin", new InsetsUIResource(2, 2, 2, 2),
+ "Button.margin", new InsetsUIResource(2, 14, 2, 14),
"Button.shadow", new ColorUIResource(Color.GRAY),
"Button.textIconGap", new Integer(4),
"Button.textShiftOffset", new Integer(0),
@@ -362,16 +362,16 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"HOME", "homePassThrough",
"END", "endPassThrough"
}),
- "ComboBox.background", new ColorUIResource(light),
+ "ComboBox.background", new ColorUIResource(Color.white),
"ComboBox.buttonBackground", new ColorUIResource(light),
- "ComboBox.buttonDarkShadow", new ColorUIResource(shadow),
+ "ComboBox.buttonDarkShadow", new ColorUIResource(darkShadow),
"ComboBox.buttonHighlight", new ColorUIResource(highLight),
"ComboBox.buttonShadow", new ColorUIResource(shadow),
"ComboBox.disabledBackground", new ColorUIResource(light),
"ComboBox.disabledForeground", new ColorUIResource(Color.gray),
"ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12),
"ComboBox.foreground", new ColorUIResource(Color.black),
- "ComboBox.selectionBackground", new ColorUIResource(Color.black),
+ "ComboBox.selectionBackground", new ColorUIResource(0, 0, 128),
"ComboBox.selectionForeground", new ColorUIResource(Color.white),
"Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"KP_LEFT", "left",
@@ -397,7 +397,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
"EditorPane.background", new ColorUIResource(Color.white),
- "EditorPane.border", new BasicBorders.MarginBorder(),
+ "EditorPane.border", BasicBorders.getMarginBorder(),
"EditorPane.caretBlinkRate", new Integer(500),
"EditorPane.caretForeground", new ColorUIResource(Color.black),
"EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
@@ -466,6 +466,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"FocusManagerClassName", "TODO",
"FormattedTextField.background", new ColorUIResource(light),
"FormattedTextField.caretForeground", new ColorUIResource(Color.black),
+ "FormattedTextField.font",
+ new FontUIResource("SansSerif", Font.PLAIN, 12),
"FormattedTextField.foreground", new ColorUIResource(Color.black),
"FormattedTextField.inactiveBackground", new ColorUIResource(light),
"FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray),
@@ -528,30 +530,74 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Label.disabledShadow", new ColorUIResource(shadow),
"Label.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Label.foreground", new ColorUIResource(darkShadow),
- "List.background", new ColorUIResource(light),
+ "List.background", new ColorUIResource(Color.white),
"List.border", new BasicBorders.MarginBorder(),
"List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "PAGE_UP", "scrollUp",
- "ctrl \\", "clearSelection",
- "PAGE_DOWN", "scrollDown",
- "shift PAGE_DOWN","scrollDownExtendSelection",
+ "ctrl DOWN", "selectNextRowChangeLead",
+ "shift UP", "selectPreviousRowExtendSelection",
+ "ctrl RIGHT", "selectNextColumnChangeLead",
+ "shift ctrl LEFT", "selectPreviousColumnExtendSelection",
+ "shift KP_UP", "selectPreviousRowChangeLead",
+ "DOWN", "selectNextRow",
+ "ctrl UP", "selectPreviousRowChangeLead",
+ "ctrl LEFT", "selectPreviousColumnChangeLead",
+ "CUT", "cut",
"END", "selectLastRow",
- "HOME", "selectFirstRow",
- "shift END", "selectLastRowExtendSelection",
+ "shift PAGE_UP","scrollUpExtendSelection",
+ "KP_UP", "selectPreviousRow",
+ "shift ctrl UP", "selectPreviousRowExtendSelection",
+ "ctrl HOME", "selectFirstRowChangeLead",
+ "shift LEFT", "selectPreviousColumnExtendSelection",
+ "ctrl END", "selectLastRowChangeLead",
+ "ctrl PAGE_DOWN", "scrollDownChangeLead",
+ "shift ctrl RIGHT", "selectNextColumnExtendSelection",
+ "LEFT", "selectPreviousColumn",
+ "ctrl PAGE_UP", "scrollUpChangeLead",
+ "KP_LEFT", "selectPreviousColumn",
+ "shift KP_RIGHT", "selectNextColumnExtendSelection",
+ "SPACE", "addToSelection",
+ "ctrl SPACE", "toggleAndAnchor",
+ "shift SPACE", "extendTo",
+ "shift ctrl SPACE", "moveSelectionTo",
+ "shift ctrl DOWN", "selectNextRowExtendSelection",
+ "ctrl BACK_SLASH", "clearSelection",
"shift HOME", "selectFirstRowExtendSelection",
- "UP", "selectPreviousRow",
- "ctrl /", "selectAll",
- "ctrl A", "selectAll",
- "DOWN", "selectNextRow",
- "shift UP", "selectPreviousRowExtendSelection",
- "ctrl SPACE", "selectNextRowExtendSelection",
+ "RIGHT", "selectNextColumn",
+ "shift ctrl PAGE_UP", "scrollUpExtendSelection",
"shift DOWN", "selectNextRowExtendSelection",
- "KP_UP", "selectPreviousRow",
- "shift PAGE_UP","scrollUpExtendSelection",
- "KP_DOWN", "selectNextRow"
+ "PAGE_DOWN", "scrollDown",
+ "shift ctrl KP_UP", "selectPreviousRowExtendSelection",
+ "shift KP_LEFT", "selectPreviousColumnExtendSelection",
+ "ctrl X", "cut",
+ "shift ctrl PAGE_DOWN", "scrollDownExtendSelection",
+ "ctrl SLASH", "selectAll",
+ "ctrl C", "copy",
+ "ctrl KP_RIGHT", "selectNextColumnChangeLead",
+ "shift END", "selectLastRowExtendSelection",
+ "shift ctrl KP_DOWN", "selectNextRowExtendSelection",
+ "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
+ "HOME", "selectFirstRow",
+ "ctrl V", "paste",
+ "KP_DOWN", "selectNextRow",
+ "ctrl KP_DOWN", "selectNextRowChangeLead",
+ "shift RIGHT", "selectNextColumnExtendSelection",
+ "ctrl A", "selectAll",
+ "shift ctrl END", "selectLastRowExtendSelection",
+ "COPY", "copy",
+ "ctrl KP_UP", "selectPreviousRowChangeLead",
+ "shift ctrl KP_LEFT", "selectPreviousColumnExtendSelection",
+ "shift KP_DOWN", "selectNextRowExtendSelection",
+ "UP", "selectPreviousRow",
+ "shift ctrl HOME", "selectFirstRowExtendSelection",
+ "shift PAGE_DOWN", "scrollDownExtendSelection",
+ "KP_RIGHT", "selectNextColumn",
+ "shift ctrl KP_RIGHT", "selectNextColumnExtendSelection",
+ "PAGE_UP", "scrollUp",
+ "PASTE", "paste"
}),
- "List.foreground", new ColorUIResource(darkShadow),
- "List.selectionBackground", new ColorUIResource(Color.black),
+ "List.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "List.foreground", new ColorUIResource(Color.black),
+ "List.selectionBackground", new ColorUIResource(0, 0, 128),
"List.selectionForeground", new ColorUIResource(Color.white),
"List.focusCellHighlightBorder",
new BorderUIResource.
@@ -601,7 +647,6 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"MenuItem.background", new ColorUIResource(light),
"MenuItem.border", new BasicBorders.MarginBorder(),
"MenuItem.borderPainted", Boolean.FALSE,
- "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(),
"MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"MenuItem.foreground", new ColorUIResource(darkShadow),
"MenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
@@ -624,7 +669,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"OptionPane.messageAreaBorder",
new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0),
"OptionPane.messageForeground", new ColorUIResource(darkShadow),
- "OptionPane.minimumSize", new DimensionUIResource(262, 90),
+ "OptionPane.minimumSize",
+ new DimensionUIResource(BasicOptionPaneUI.MinimumWidth,
+ BasicOptionPaneUI.MinimumHeight),
"OptionPane.noButtonText", "No",
"OptionPane.okButtonText", "OK",
// XXX Don't use gif
@@ -660,16 +707,17 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0),
"PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"PopupMenu.foreground", new ColorUIResource(darkShadow),
- "ProgressBar.background", new ColorUIResource(light),
- "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray),
+ "ProgressBar.background", new ColorUIResource(Color.LIGHT_GRAY),
+ "ProgressBar.border",
+ new BorderUIResource.LineBorderUIResource(Color.GREEN, 2),
"ProgressBar.cellLength", new Integer(1),
"ProgressBar.cellSpacing", new Integer(0),
"ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "ProgressBar.foreground", new ColorUIResource(Color.black),
- "ProgressBar.selectionBackground", new ColorUIResource(Color.black),
- "ProgressBar.selectionForeground", new ColorUIResource(light),
- "ProgressBar.repaintInterval", new Integer(250),
- "ProgressBar.cycleTime", new Integer(6000),
+ "ProgressBar.foreground", new ColorUIResource(0, 0, 128),
+ "ProgressBar.selectionBackground", new ColorUIResource(0, 0, 128),
+ "ProgressBar.selectionForeground", new ColorUIResource(Color.LIGHT_GRAY),
+ "ProgressBar.repaintInterval", new Integer(50),
+ "ProgressBar.cycleTime", new Integer(3000),
"RadioButton.background", new ColorUIResource(light),
"RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
@@ -742,6 +790,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ScrollBar.thumbShadow", new ColorUIResource(shadow),
"ScrollBar.track", new ColorUIResource(light),
"ScrollBar.trackHighlight", new ColorUIResource(shadow),
+ "ScrollBar.width", new Integer(16),
"ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"PAGE_UP", "scrollUp",
"KP_LEFT", "unitScrollLeft",
@@ -846,6 +895,24 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TabbedPane.tabRunOverlay", new Integer(2),
"TabbedPane.textIconGap", new Integer(4),
"Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
+ "ctrl DOWN", "selectNextRowChangeLead",
+ "ctrl RIGHT", "selectNextColumnChangeLead",
+ "ctrl UP", "selectPreviousRowChangeLead",
+ "ctrl LEFT", "selectPreviousColumnChangeLead",
+ "CUT", "cut",
+ "SPACE", "addToSelection",
+ "ctrl SPACE", "toggleAndAnchor",
+ "shift SPACE", "extendTo",
+ "shift ctrl SPACE", "moveSelectionTo",
+ "ctrl X", "cut",
+ "ctrl C", "copy",
+ "ctrl KP_RIGHT", "selectNextColumnChangeLead",
+ "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
+ "ctrl V", "paste",
+ "ctrl KP_DOWN", "selectNextRowChangeLead",
+ "COPY", "copy",
+ "ctrl KP_UP", "selectPreviousRowChangeLead",
+ "PASTE", "paste",
"shift PAGE_DOWN","scrollDownExtendSelection",
"PAGE_DOWN", "scrollDownChangeSelection",
"END", "selectLastColumn",
@@ -896,25 +963,26 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ctrl SLASH", "selectAll",
"ctrl shift KP_DOWN", "selectNextRowExtendSelection",
}),
- "Table.background", new ColorUIResource(light),
- "Table.focusCellBackground", new ColorUIResource(light),
- "Table.focusCellForeground", new ColorUIResource(darkShadow),
+ "Table.background", new ColorUIResource(new ColorUIResource(255, 255, 255)),
+ "Table.focusCellBackground", new ColorUIResource(new ColorUIResource(255, 255, 255)),
+ "Table.focusCellForeground", new ColorUIResource(new ColorUIResource(0, 0, 0)),
"Table.focusCellHighlightBorder",
new BorderUIResource.LineBorderUIResource(
new ColorUIResource(255, 255, 0)),
"Table.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "Table.foreground", new ColorUIResource(darkShadow),
- "Table.gridColor", new ColorUIResource(Color.gray),
+ "Table.foreground", new ColorUIResource(new ColorUIResource(0, 0, 0)),
+ "Table.gridColor", new ColorUIResource(new ColorUIResource(128, 128, 128)),
"Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0),
- "Table.selectionBackground", new ColorUIResource(Color.black),
- "Table.selectionForeground", new ColorUIResource(Color.white),
- "TableHeader.background", new ColorUIResource(light),
+ "Table.selectionBackground", new ColorUIResource(new ColorUIResource(0, 0, 128)),
+ "Table.selectionForeground", new ColorUIResource(new ColorUIResource(255, 255, 255)),
+ "TableHeader.background", new ColorUIResource(new ColorUIResource(192, 192, 192)),
"TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0),
"TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "TableHeader.foreground", new ColorUIResource(darkShadow),
+ "TableHeader.foreground", new ColorUIResource(new ColorUIResource(0, 0, 0)),
"TextArea.background", new ColorUIResource(light),
- "TextArea.border", new BasicBorders.MarginBorder(),
+ "TextArea.border",
+ new BorderUIResource(BasicBorders.getMarginBorder()),
"TextArea.caretBlinkRate", new Integer(500),
"TextArea.caretForeground", new ColorUIResource(Color.black),
"TextArea.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12),
@@ -945,8 +1013,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12),
"TextField.foreground", new ColorUIResource(Color.black),
"TextField.highlight", new ColorUIResource(highLight),
- "TextField.inactiveBackground", new ColorUIResource(light),
- "TextField.inactiveForeground", new ColorUIResource(Color.gray),
+ "TextField.inactiveBackground", new ColorUIResource(Color.LIGHT_GRAY),
+ "TextField.inactiveForeground", new ColorUIResource(Color.GRAY),
"TextField.light", new ColorUIResource(highLight),
"TextField.highlight", new ColorUIResource(light),
"TextField.keyBindings", new JTextComponent.KeyBinding[] {
@@ -964,7 +1032,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TextField.selectionBackground", new ColorUIResource(Color.black),
"TextField.selectionForeground", new ColorUIResource(Color.white),
"TextPane.background", new ColorUIResource(Color.white),
- "TextPane.border", new BasicBorders.MarginBorder(),
+ "TextPane.border", BasicBorders.getMarginBorder(),
"TextPane.caretBlinkRate", new Integer(500),
"TextPane.caretForeground", new ColorUIResource(Color.black),
"TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
@@ -1036,7 +1104,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"ESCAPE", "cancel"
}),
- "Tree.background", new ColorUIResource(light),
+ "Tree.background", new ColorUIResource(new Color(255, 255, 255)),
"Tree.changeSelectionWithFocus", Boolean.TRUE,
// "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),
// "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")),
@@ -1086,20 +1154,20 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"PAGE_UP", "scrollUpChangeSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead"
}),
- "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)),
+ "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Tree.foreground", new ColorUIResource(Color.black),
"Tree.hash", new ColorUIResource(new Color(128, 128, 128)),
"Tree.leftChildIndent", new Integer(7),
"Tree.rightChildIndent", new Integer(13),
- "Tree.rowHeight", new Integer(20), // FIXME
+ "Tree.rowHeight", new Integer(16),
"Tree.scrollsOnExpand", Boolean.TRUE,
"Tree.selectionBackground", new ColorUIResource(Color.black),
- "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)),
+ "Tree.nonSelectionBackground", new ColorUIResource(new Color(255, 255, 255)),
"Tree.selectionBorderColor", new ColorUIResource(Color.black),
"Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black),
"Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)),
- "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)),
- "Tree.textForeground", new ColorUIResource(Color.black),
+ "Tree.textBackground", new ColorUIResource(new Color(192, 192, 192)),
+ "Tree.textForeground", new ColorUIResource(new Color(0, 0, 0)),
"Viewport.background", new ColorUIResource(light),
"Viewport.foreground", new ColorUIResource(Color.black),
"Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12)
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java
index 95f6b84fb7c..daa9b0d6b63 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java
@@ -41,16 +41,19 @@ package javax.swing.plaf.basic;
import java.awt.Dimension;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
+import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
+import javax.swing.JMenu;
import javax.swing.JMenuBar;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
+import javax.swing.MenuElement;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuBarUI;
@@ -63,12 +66,15 @@ public class BasicMenuBarUI extends MenuBarUI
/*ContainerListener that listens to the ContainerEvents fired from menu bar*/
protected ContainerListener containerListener;
-
+
/*Property change listeners that listener to PropertyChangeEvent from menu bar*/
protected PropertyChangeListener propertyChangeListener;
/* menu bar for which this UI delegate is for*/
protected JMenuBar menuBar;
+
+ /* MouseListener that listens to the mouseEvents fired from menu bar*/
+ private MouseInputListener mouseListener;
/**
* Creates a new BasicMenuBarUI object.
@@ -78,6 +84,7 @@ public class BasicMenuBarUI extends MenuBarUI
changeListener = createChangeListener();
containerListener = createContainerListener();
propertyChangeListener = new PropertyChangeHandler();
+ mouseListener = new MouseInputHandler();
}
/**
@@ -159,12 +166,9 @@ public class BasicMenuBarUI extends MenuBarUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- menuBar.setBackground(defaults.getColor("MenuBar.background"));
- menuBar.setBorder(defaults.getBorder("MenuBar.border"));
- menuBar.setFont(defaults.getFont("MenuBar.font"));
- menuBar.setForeground(defaults.getColor("MenuBar.foreground"));
+ LookAndFeel.installBorder(menuBar, "MenuBar.border");
+ LookAndFeel.installColorsAndFont(menuBar, "MenuBar.background",
+ "MenuBar.foreground", "MenuBar.font");
menuBar.setOpaque(true);
}
@@ -183,6 +187,7 @@ public class BasicMenuBarUI extends MenuBarUI
{
menuBar.addContainerListener(containerListener);
menuBar.addPropertyChangeListener(propertyChangeListener);
+ menuBar.addMouseListener(mouseListener);
}
/**
@@ -229,6 +234,7 @@ public class BasicMenuBarUI extends MenuBarUI
{
menuBar.removeContainerListener(containerListener);
menuBar.removePropertyChangeListener(propertyChangeListener);
+ menuBar.removeMouseListener(mouseListener);
}
/**
@@ -250,6 +256,7 @@ public class BasicMenuBarUI extends MenuBarUI
{
public void stateChanged(ChangeEvent event)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -301,4 +308,84 @@ public class BasicMenuBarUI extends MenuBarUI
menuBar.repaint();
}
}
+
+ private class MouseInputHandler implements MouseInputListener
+ {
+ /**
+ * Handles mouse clicked event
+ *
+ * @param e Mouse event
+ */
+ public void mouseClicked(MouseEvent e)
+ {
+ MenuElement[] me = menuBar.getSubElements();
+
+ for (int i = 0; i < me.length; i++)
+ {
+ JMenu menu = menuBar.getMenu(i);
+ if (menu != null)
+ menu.setSelected(false);
+ }
+ }
+
+ /**
+ * Handles mouse pressed event
+ *
+ * @param e Mouse event
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse released event
+ *
+ * @param e Mouse event
+ */
+ public void mouseReleased(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse exited event
+ *
+ * @param e Mouse event
+ */
+ public void mouseExited(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse dragged event
+ *
+ * @param e Mouse event
+ */
+ public void mouseDragged(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse moved event
+ *
+ * @param e Mouse event
+ */
+ public void mouseMoved(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse entered event
+ *
+ * @param e Mouse event
+ */
+ public void mouseEntered(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
index 8aa1193bcc4..2a3556a5db9 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -7,7 +7,7 @@ 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
@@ -46,18 +46,27 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.ButtonModel;
import javax.swing.Icon;
+import javax.swing.InputMap;
+import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingConstants;
@@ -69,6 +78,8 @@ import javax.swing.event.MenuDragMouseListener;
import javax.swing.event.MenuKeyEvent;
import javax.swing.event.MenuKeyListener;
import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ActionMapUIResource;
+import javax.swing.plaf.ComponentInputMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuItemUI;
@@ -109,7 +120,7 @@ public class BasicMenuItemUI extends MenuItemUI
* Number of spaces between icon and text.
*/
protected int defaultTextIconGap = 4;
-
+
/**
* Color of the text when menu item is disabled
*/
@@ -156,16 +167,69 @@ public class BasicMenuItemUI extends MenuItemUI
private String acceleratorDelimiter;
/**
- * PropertyChangeListener to listen for property changes in the menu item
+ * ItemListener to listen for item changes in the menu item
*/
- private PropertyChangeListener propertyChangeListener;
+ private ItemListener itemListener;
/**
* Number of spaces between accelerator and menu item's label.
*/
- private int defaultAcceleratorLabelGap = 4;
+ private int defaultAcceleratorLabelGap = 10;
/**
+ * The gap between different menus on the MenuBar.
+ */
+ private int MenuGap = 10;
+
+ /** A PropertyChangeListener to make UI updates after property changes **/
+ PropertyChangeHandler propertyChangeListener;
+
+ /**
+ * A class to handle PropertChangeEvents for the JMenuItem
+ * @author Anthony Balkissoon abalkiss at redhat dot com.
+ */
+ class PropertyChangeHandler implements PropertyChangeListener
+ {
+ /**
+ * This method is called when a property of the menuItem is changed.
+ * Currently it is only used to update the accelerator key bindings.
+ *
+ * @param e
+ * the PropertyChangeEvent
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName() == "accelerator")
+ {
+ InputMap map = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
+ if (map != null)
+ map.remove((KeyStroke)e.getOldValue());
+ else
+ map = new ComponentInputMapUIResource(menuItem);
+ map.put((KeyStroke)e.getNewValue(), "doClick");
+ }
+ }
+ }
+
+ /**
+ * A class to handle accelerator keys. This is the Action we will
+ * perform when the accelerator key for this JMenuItem is pressed.
+ * @author Anthony Balkissoon abalkiss at redhat dot com
+ *
+ */
+ class ClickAction extends AbstractAction
+ {
+ /**
+ * This is what is done when the accelerator key for the JMenuItem is
+ * pressed.
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ doClick(MenuSelectionManager.defaultManager());
+ }
+ }
+
+ /**
* Creates a new BasicMenuItemUI object.
*/
public BasicMenuItemUI()
@@ -173,14 +237,15 @@ public class BasicMenuItemUI extends MenuItemUI
mouseInputListener = createMouseInputListener(menuItem);
menuDragMouseListener = createMenuDragMouseListener(menuItem);
menuKeyListener = createMenuKeyListener(menuItem);
+ itemListener = new ItemHandler();
propertyChangeListener = new PropertyChangeHandler();
}
/**
* Create MenuDragMouseListener to listen for mouse dragged events.
- *
- * @param c menu item to listen to
- *
+ *
+ * @param c
+ * menu item to listen to
* @return The MenuDragMouseListener
*/
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
@@ -189,11 +254,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Creates MenuKeyListener to listen to key events occuring when menu item
- * is visible on the screen.
- *
- * @param c menu item to listen to
- *
+ * Creates MenuKeyListener to listen to key events occuring when menu item is
+ * visible on the screen.
+ *
+ * @param c
+ * menu item to listen to
* @return The MenuKeyListener
*/
protected MenuKeyListener createMenuKeyListener(JComponent c)
@@ -203,9 +268,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Handles mouse input events occuring for this menu item
- *
- * @param c menu item to listen to
- *
+ *
+ * @param c
+ * menu item to listen to
* @return The MouseInputListener
*/
protected MouseInputListener createMouseInputListener(JComponent c)
@@ -216,9 +281,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Factory method to create a BasicMenuItemUI for the given {@link
* JComponent}, which should be a {@link JMenuItem}.
- *
- * @param c The {@link JComponent} a UI is being created for.
- *
+ *
+ * @param c
+ * The {@link JComponent} a UI is being created for.
* @return A BasicMenuItemUI for the {@link JComponent}.
*/
public static ComponentUI createUI(JComponent c)
@@ -228,8 +293,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Programatically clicks menu item.
- *
- * @param msm MenuSelectionManager for the menu hierarchy
+ *
+ * @param msm
+ * MenuSelectionManager for the menu hierarchy
*/
protected void doClick(MenuSelectionManager msm)
{
@@ -239,9 +305,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns maximum size for the specified menu item
- *
- * @param c component for which to get maximum size
- *
+ *
+ * @param c
+ * component for which to get maximum size
* @return Maximum size for the specified menu item.
*/
public Dimension getMaximumSize(JComponent c)
@@ -251,9 +317,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns minimum size for the specified menu item
- *
- * @param c component for which to get minimum size
- *
+ *
+ * @param c
+ * component for which to get minimum size
* @return Minimum size for the specified menu item.
*/
public Dimension getMinimumSize(JComponent c)
@@ -263,9 +329,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns path to this menu item.
- *
- * @return $MenuElement[]$ Returns array of menu elements
- * that constitute a path to this menu item.
+ *
+ * @return $MenuElement[]$ Returns array of menu elements that constitute a
+ * path to this menu item.
*/
public MenuElement[] getPath()
{
@@ -278,12 +344,12 @@ public class BasicMenuItemUI extends MenuItemUI
Component c = menuItem;
while (c instanceof MenuElement)
{
- path.add(0, (MenuElement) c);
+ path.add(0, (MenuElement) c);
- if (c instanceof JPopupMenu)
- c = ((JPopupMenu) c).getInvoker();
- else
- c = c.getParent();
+ if (c instanceof JPopupMenu)
+ c = ((JPopupMenu) c).getInvoker();
+ else
+ c = c.getParent();
}
MenuElement[] pathArray = new MenuElement[path.size()];
@@ -293,12 +359,15 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns preferred size for the given menu item.
- *
- * @param c menu item for which to get preferred size
- * @param checkIcon check icon displayed in the given menu item
- * @param arrowIcon arrow icon displayed in the given menu item
- * @param defaultTextIconGap space between icon and text in the given menuItem
- *
+ *
+ * @param c
+ * menu item for which to get preferred size
+ * @param checkIcon
+ * check icon displayed in the given menu item
+ * @param arrowIcon
+ * arrow icon displayed in the given menu item
+ * @param defaultTextIconGap
+ * space between icon and text in the given menuItem
* @return $Dimension$ preferred size for the given menu item
*/
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,
@@ -308,7 +377,7 @@ public class BasicMenuItemUI extends MenuItemUI
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();
@@ -316,52 +385,57 @@ public class BasicMenuItemUI extends MenuItemUI
if (accelerator != null)
{
- rect = getAcceleratorRect(accelerator,
- m.getToolkit().getFontMetrics(acceleratorFont));
+ rect = getAcceleratorRect(
+ accelerator,
+ m.getToolkit().getFontMetrics(acceleratorFont));
- // add width of accelerator's text
- d.width = d.width + rect.width + defaultAcceleratorLabelGap;
+ // add width of accelerator's text
+ d.width += rect.width + defaultAcceleratorLabelGap;
- // adjust the heigth of the preferred size if necessary
- if (d.height < rect.height)
- d.height = rect.height;
+ // adjust the heigth of the preferred size if necessary
+ if (d.height < rect.height)
+ d.height = rect.height;
}
if (checkIcon != null)
{
- d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap;
+ d.width += checkIcon.getIconWidth() + defaultTextIconGap;
- if (checkIcon.getIconHeight() > d.height)
- d.height = checkIcon.getIconHeight();
+ if (checkIcon.getIconHeight() > d.height)
+ d.height = checkIcon.getIconHeight();
}
if (arrowIcon != null && (c instanceof JMenu))
{
- d.width = d.width + arrowIcon.getIconWidth() + defaultTextIconGap;
-
- if (arrowIcon.getIconHeight() > d.height)
- d.height = arrowIcon.getIconHeight();
+ 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;
}
/**
* Returns preferred size of the given component
- *
- * @param c component for which to return preferred size
- *
+ *
+ * @param c
+ * component for which to return preferred size
* @return $Dimension$ preferred size for the given component
*/
public Dimension getPreferredSize(JComponent c)
{
- return getPreferredMenuItemSize(c, checkIcon, arrowIcon,
- defaultTextIconGap);
+ return getPreferredMenuItemSize(c, checkIcon, arrowIcon, defaultTextIconGap);
}
/**
* Returns the prefix for entries in the {@link UIDefaults} table.
- *
+ *
* @return "MenuItem"
*/
protected String getPropertyPrefix()
@@ -371,8 +445,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* This method installs the components for this {@link JMenuItem}.
- *
- * @param menuItem The {@link JMenuItem} to install components for.
+ *
+ * @param menuItem
+ * The {@link JMenuItem} to install components for.
*/
protected void installComponents(JMenuItem menuItem)
{
@@ -380,28 +455,27 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method installs the defaults that are defined in the Basic look and
+ * This method installs the defaults that are defined in the Basic look and
* feel for this {@link JMenuItem}.
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- menuItem.setBackground(defaults.getColor("MenuItem.background"));
- menuItem.setBorder(defaults.getBorder("MenuItem.border"));
- menuItem.setFont(defaults.getFont("MenuItem.font"));
- menuItem.setForeground(defaults.getColor("MenuItem.foreground"));
- menuItem.setMargin(defaults.getInsets("MenuItem.margin"));
- menuItem.setOpaque(true);
- acceleratorFont = defaults.getFont("MenuItem.acceleratorFont");
- acceleratorForeground = defaults.getColor("MenuItem.acceleratorForeground");
- acceleratorSelectionForeground = defaults.getColor("MenuItem.acceleratorSelectionForeground");
- selectionBackground = defaults.getColor("MenuItem.selectionBackground");
- selectionForeground = defaults.getColor("MenuItem.selectionForeground");
- acceleratorDelimiter = defaults.getString("MenuItem.acceleratorDelimiter");
-
+ String prefix = getPropertyPrefix();
+ LookAndFeel.installBorder(menuItem, prefix + ".border");
+ LookAndFeel.installColorsAndFont(menuItem, prefix + ".background",
+ prefix + ".foreground", prefix + ".font");
+ menuItem.setMargin(UIManager.getInsets(prefix + ".margin"));
+ acceleratorFont = UIManager.getFont(prefix + ".acceleratorFont");
+ acceleratorForeground = UIManager.getColor(prefix + ".acceleratorForeground");
+ acceleratorSelectionForeground = UIManager.getColor(prefix + ".acceleratorSelectionForeground");
+ selectionBackground = UIManager.getColor(prefix + ".selectionBackground");
+ selectionForeground = UIManager.getColor(prefix + ".selectionForeground");
+ acceleratorDelimiter = UIManager.getString(prefix + ".acceleratorDelimiter");
+ checkIcon = UIManager.getIcon(prefix + ".checkIcon");
+
menuItem.setHorizontalTextPosition(SwingConstants.TRAILING);
menuItem.setHorizontalAlignment(SwingConstants.LEADING);
+ menuItem.setOpaque(true);
}
/**
@@ -409,7 +483,17 @@ public class BasicMenuItemUI extends MenuItemUI
*/
protected void installKeyboardActions()
{
- // FIXME: Need to implement
+ InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
+ if (focusedWindowMap == null)
+ focusedWindowMap = new ComponentInputMapUIResource(menuItem);
+ focusedWindowMap.put(menuItem.getAccelerator(), "doClick");
+ SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap);
+
+ ActionMap UIActionMap = SwingUtilities.getUIActionMap(menuItem);
+ if (UIActionMap == null)
+ UIActionMap = new ActionMapUIResource();
+ UIActionMap.put("doClick", new ClickAction());
+ SwingUtilities.replaceUIActionMap(menuItem, UIActionMap);
}
/**
@@ -421,15 +505,17 @@ public class BasicMenuItemUI extends MenuItemUI
menuItem.addMouseMotionListener(mouseInputListener);
menuItem.addMenuDragMouseListener(menuDragMouseListener);
menuItem.addMenuKeyListener(menuKeyListener);
+ menuItem.addItemListener(itemListener);
menuItem.addPropertyChangeListener(propertyChangeListener);
}
/**
- * Installs and initializes all fields for this UI delegate. Any properties
- * of the UI that need to be initialized and/or set to defaults will be
- * done now. It will also install any listeners necessary.
- *
- * @param c The {@link JComponent} that is having this UI installed.
+ * Installs and initializes all fields for this UI delegate. Any properties of
+ * the UI that need to be initialized and/or set to defaults will be done now.
+ * It will also install any listeners necessary.
+ *
+ * @param c
+ * The {@link JComponent} that is having this UI installed.
*/
public void installUI(JComponent c)
{
@@ -438,13 +524,16 @@ public class BasicMenuItemUI extends MenuItemUI
installDefaults();
installComponents(menuItem);
installListeners();
+ installKeyboardActions();
}
/**
* Paints given menu item using specified graphics context
- *
- * @param g The graphics context used to paint this menu item
- * @param c Menu Item to paint
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param c
+ * Menu Item to paint
*/
public void paint(Graphics g, JComponent c)
{
@@ -454,10 +543,13 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Paints background of the menu item
- *
- * @param g The graphics context used to paint this menu item
- * @param menuItem menu item to paint
- * @param bgColor Background color to use when painting menu item
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param menuItem
+ * menu item to paint
+ * @param bgColor
+ * Background color to use when painting menu item
*/
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
{
@@ -470,15 +562,21 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Paints specified menu item
- *
- * @param g The graphics context used to paint this menu item
- * @param c menu item to paint
- * @param checkIcon check icon to use when painting menu item
- * @param arrowIcon arrow icon to use when painting menu item
- * @param background Background color of the menu item
- * @param foreground Foreground color of the menu item
- * @param defaultTextIconGap space to use between icon and
- * text when painting menu item
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param c
+ * menu item to paint
+ * @param checkIcon
+ * check icon to use when painting menu item
+ * @param arrowIcon
+ * arrow icon to use when painting menu item
+ * @param background
+ * Background color of the menu item
+ * @param foreground
+ * Foreground color of the menu item
+ * @param defaultTextIconGap
+ * space to use between icon and text when painting menu item
*/
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon,
Icon arrowIcon, Color background,
@@ -496,7 +594,7 @@ public class BasicMenuItemUI extends MenuItemUI
int horAlign = m.getHorizontalAlignment();
int vertTextPos = m.getVerticalTextPosition();
int horTextPos = m.getHorizontalTextPosition();
-
+
Font f = m.getFont();
g.setFont(f);
FontMetrics fm = g.getFontMetrics(f);
@@ -504,8 +602,10 @@ public class BasicMenuItemUI extends MenuItemUI
SwingUtilities.calculateInsetArea(br, m.getInsets(), vr);
paintBackground(g, m, m.getBackground());
- /* MenuItems insets are equal to menuItems margin, space between text and
- menuItems border. We need to paint insets region as well. */
+ /*
+ * 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;
@@ -514,89 +614,93 @@ 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
- if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() &&
- (m.getParent() instanceof MenuElement))
+ ButtonModel mod = m.getModel();
+ if ((m.isSelected() && checkIcon == null) || (mod != null &&
+ mod.isArmed())
+ && (m.getParent() instanceof MenuElement))
{
- if (m.isContentAreaFilled())
- {
- g.setColor(selectionBackground);
- g.fillRect(br.x, br.y, br.width, br.height);
- }
+ if (m.isContentAreaFilled())
+ {
+ g.setColor(selectionBackground);
+ g.fillRect(br.x, br.y, br.width, br.height);
+ }
}
else
{
- if (m.isContentAreaFilled())
- {
- g.setColor(m.getBackground());
- g.fillRect(br.x, br.y, br.width, br.height);
- }
+ if (m.isContentAreaFilled())
+ {
+ g.setColor(m.getBackground());
+ g.fillRect(br.x, br.y, br.width, br.height);
+ }
}
// If this menu item is a JCheckBoxMenuItem then paint check icon
if (checkIcon != null)
{
- SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign,
- horAlign, vertTextPos, horTextPos,
- vr, cr, tr, defaultTextIconGap);
+ 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;
+ // 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;
}
// if this is a submenu, then paint arrow icon to indicate it.
if (arrowIcon != null && (c instanceof JMenu))
{
- if (! ((JMenu) c).isTopLevelMenu())
- {
- int width = arrowIcon.getIconWidth();
- int height = arrowIcon.getIconHeight();
-
- arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap,
- vr.y + 2);
- }
+ if (!((JMenu) c).isTopLevelMenu())
+ {
+ int width = arrowIcon.getIconWidth();
+ int height = arrowIcon.getIconHeight();
+ int offset = (vr.height - height) / 2;
+ arrowIcon.paintIcon(m, g, vr.width - width, vr.y + offset);
+ }
}
- // paint text and user menu icon if it exists
+ // 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);
+ 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
+ // paint accelerator
String acceleratorText = "";
if (m.getAccelerator() != null)
{
- 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;
-
- SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null,
- vertAlign, horAlign, vertTextPos,
- horTextPos, vr, ir, ar,
- defaultTextIconGap);
-
- paintAccelerator(g, m, ar, acceleratorText);
+ 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);
}
}
/**
* Paints label for the given menu item
- *
- * @param g The graphics context used to paint this menu item
- * @param menuItem menu item for which to draw its label
- * @param textRect rectangle specifiying position of the text relative to
- * the given menu item
- * @param text label of the menu item
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param menuItem
+ * menu item for which to draw its label
+ * @param textRect
+ * rectangle specifiying position of the text relative to the given
+ * menu item
+ * @param text
+ * label of the menu item
*/
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect,
String text)
@@ -605,43 +709,46 @@ public class BasicMenuItemUI extends MenuItemUI
g.setFont(f);
FontMetrics fm = g.getFontMetrics(f);
- if (text != null && ! text.equals(""))
+ if (text != null && !text.equals(""))
{
- if (menuItem.isEnabled())
+ if (menuItem.isEnabled())
{
// Menu item is considered to be highlighted when it is selected.
// But not if it's a JCheckBoxMenuItem
- if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() &&
- (menuItem.getParent() instanceof MenuElement))
+ ButtonModel mod = menuItem.getModel();
+ if ((menuItem.isSelected() && checkIcon == null)
+ || (mod != null && mod.isArmed())
+ && (menuItem.getParent() instanceof MenuElement))
g.setColor(selectionForeground);
else
g.setColor(menuItem.getForeground());
}
- else
- // FIXME: should fix this to use 'disabledForeground', but its
- // default value in BasicLookAndFeel is null.
-
+ else
+ // FIXME: should fix this to use 'disabledForeground', but its
+ // default value in BasicLookAndFeel is null.
+
// FIXME: should there be different foreground colours for selected
// or deselected, when disabled?
g.setColor(Color.gray);
- int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();
+ int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();
- if (mnemonicIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex,
- textRect.x,
- textRect.y
- + fm.getAscent());
- else
- BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
- textRect.y + fm.getAscent());
+ if (mnemonicIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex,
+ textRect.x,
+ textRect.y
+ + fm.getAscent());
+ else
+ BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
+ textRect.y + fm.getAscent());
}
}
/**
* This method uninstalls the components for this {@link JMenuItem}.
- *
- * @param menuItem The {@link JMenuItem} to uninstall components for.
+ *
+ * @param menuItem
+ * The {@link JMenuItem} to uninstall components for.
*/
protected void uninstallComponents(JMenuItem menuItem)
{
@@ -676,8 +783,9 @@ public class BasicMenuItemUI extends MenuItemUI
* Uninstalls any keyboard actions.
*/
protected void uninstallKeyboardActions()
- {
- // FIXME: need to implement
+ {
+ SwingUtilities.replaceUIInputMap(menuItem,
+ JComponent.WHEN_IN_FOCUSED_WINDOW, null);
}
/**
@@ -688,15 +796,17 @@ public class BasicMenuItemUI extends MenuItemUI
menuItem.removeMouseListener(mouseInputListener);
menuItem.removeMenuDragMouseListener(menuDragMouseListener);
menuItem.removeMenuKeyListener(menuKeyListener);
+ menuItem.removeItemListener(itemListener);
menuItem.removePropertyChangeListener(propertyChangeListener);
}
/**
* Performs the opposite of installUI. Any properties or resources that need
- * to be cleaned up will be done now. It will also uninstall any listeners
- * it has. In addition, any properties of this UI will be nulled.
- *
- * @param c The {@link JComponent} that is having this UI uninstalled.
+ * to be cleaned up will be done now. It will also uninstall any listeners it
+ * has. In addition, any properties of this UI will be nulled.
+ *
+ * @param c
+ * The {@link JComponent} that is having this UI uninstalled.
*/
public void uninstallUI(JComponent c)
{
@@ -708,9 +818,11 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* This method calls paint.
- *
- * @param g The graphics context used to paint this menu item
- * @param c The menu item to paint
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param c
+ * The menu item to paint
*/
public void update(Graphics g, JComponent c)
{
@@ -719,9 +831,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Return text representation of the specified accelerator
- *
- * @param accelerator Accelerator for which to return string representation
- *
+ *
+ * @param accelerator
+ * Accelerator for which to return string representation
* @return $String$ Text representation of the given accelerator
*/
private String getAcceleratorText(KeyStroke accelerator)
@@ -744,10 +856,11 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Calculates and return rectange in which accelerator should be displayed
- *
- * @param accelerator accelerator for which to return the display rectangle
- * @param fm The font metrics used to measure the text
- *
+ *
+ * @param accelerator
+ * accelerator for which to return the display rectangle
+ * @param fm
+ * The font metrics used to measure the text
* @return $Rectangle$ reactangle which will be used to display accelerator
*/
private Rectangle getAcceleratorRect(KeyStroke accelerator, FontMetrics fm)
@@ -759,12 +872,16 @@ 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
+ *
+ * @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,
@@ -785,10 +902,9 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * 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.
- *
+ * 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.
*/
protected class MouseInputHandler implements MouseInputListener
{
@@ -797,13 +913,15 @@ public class BasicMenuItemUI extends MenuItemUI
*/
protected MouseInputHandler()
{
+ // Nothing to do here.
}
/**
- * This method is called when mouse is clicked on the menu item.
- * It forwards this event to MenuSelectionManager.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse is clicked on the menu item. It forwards
+ * this event to MenuSelectionManager.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseClicked(MouseEvent e)
{
@@ -812,10 +930,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method is called when mouse is dragged inside the menu item.
- * It forwards this event to MenuSelectionManager.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse is dragged inside the menu item. It
+ * forwards this event to MenuSelectionManager.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseDragged(MouseEvent e)
{
@@ -824,29 +943,31 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method is called when mouse enters menu item.
- * When this happens menu item is considered to be selected and selection path
- * in MenuSelectionManager is set. This event is also forwarded to MenuSelection
- * Manager for further processing.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse enters menu item. When this happens menu
+ * item is considered to be selected and selection path in
+ * MenuSelectionManager is set. This event is also forwarded to
+ * MenuSelection Manager for further processing.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseEntered(MouseEvent e)
{
Component source = (Component) e.getSource();
if (source.getParent() instanceof MenuElement)
{
- MenuSelectionManager manager = MenuSelectionManager.defaultManager();
- manager.setSelectedPath(getPath());
- manager.processMouseEvent(e);
+ MenuSelectionManager manager = MenuSelectionManager.defaultManager();
+ manager.setSelectedPath(getPath());
+ manager.processMouseEvent(e);
}
}
/**
- * This method is called when mouse exits menu item. The event is
- * forwarded to MenuSelectionManager for processing.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse exits menu item. The event is forwarded
+ * to MenuSelectionManager for processing.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseExited(MouseEvent e)
{
@@ -855,10 +976,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method is called when mouse is inside the menu item.
- * This event is forwarder to MenuSelectionManager for further processing.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse is inside the menu item. This event is
+ * forwarder to MenuSelectionManager for further processing.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseMoved(MouseEvent e)
{
@@ -869,8 +991,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* This method is called when mouse is pressed. This event is forwarded to
* MenuSelectionManager for further processing.
- *
- * @param e A {@link MouseEvent}.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mousePressed(MouseEvent e)
{
@@ -882,8 +1005,9 @@ public class BasicMenuItemUI extends MenuItemUI
* This method is called when mouse is released. If the mouse is released
* inside this menuItem, then this menu item is considered to be chosen and
* the menu hierarchy should be closed.
- *
- * @param e A {@link MouseEvent}.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseReleased(MouseEvent e)
{
@@ -892,24 +1016,25 @@ public class BasicMenuItemUI extends MenuItemUI
if (e.getX() > 0 && e.getX() < size.width && e.getY() > 0
&& e.getY() < size.height)
{
- manager.clearSelectedPath();
- menuItem.doClick();
+ manager.clearSelectedPath();
+ menuItem.doClick();
}
else
- manager.processMouseEvent(e);
+ manager.processMouseEvent(e);
}
}
/**
* This class handles mouse dragged events.
*/
- protected class MenuDragMouseHandler implements MenuDragMouseListener
+ private class MenuDragMouseHandler implements MenuDragMouseListener
{
/**
* Tbis method is invoked when mouse is dragged over the menu item.
- *
- * @param e The MenuDragMouseEvent
+ *
+ * @param e
+ * The MenuDragMouseEvent
*/
public void menuDragMouseDragged(MenuDragMouseEvent e)
{
@@ -918,10 +1043,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Tbis method is invoked when mouse enters the menu item while it is
- * being dragged.
- *
- * @param e The MenuDragMouseEvent
+ * Tbis method is invoked when mouse enters the menu item while it is being
+ * dragged.
+ *
+ * @param e
+ * The MenuDragMouseEvent
*/
public void menuDragMouseEntered(MenuDragMouseEvent e)
{
@@ -930,27 +1056,29 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Tbis method is invoked when mouse exits the menu item while
- * it is being dragged
- *
- * @param e The MenuDragMouseEvent
+ * Tbis method is invoked when mouse exits the menu item while it is being
+ * dragged
+ *
+ * @param e the MenuDragMouseEvent
*/
public void menuDragMouseExited(MenuDragMouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
- * Tbis method is invoked when mouse was dragged and released
- * inside the menu item.
- *
- * @param e The MenuDragMouseEvent
+ * Tbis method is invoked when mouse was dragged and released inside the
+ * menu item.
+ *
+ * @param e
+ * The MenuDragMouseEvent
*/
public void menuDragMouseReleased(MenuDragMouseEvent e)
{
MenuElement[] path = e.getPath();
if (path[path.length - 1] instanceof JMenuItem)
- ((JMenuItem) path[path.length - 1]).doClick();
+ ((JMenuItem) path[path.length - 1]).doClick();
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
manager.clearSelectedPath();
@@ -961,50 +1089,63 @@ public class BasicMenuItemUI extends MenuItemUI
* This class handles key events occuring when menu item is visible on the
* screen.
*/
- protected class MenuKeyHandler implements MenuKeyListener
+ private class MenuKeyHandler implements MenuKeyListener
{
/**
* This method is invoked when key has been pressed
- *
- * @param e A {@link MenuKeyEvent}.
+ *
+ * @param e
+ * A {@link MenuKeyEvent}.
*/
public void menuKeyPressed(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
* This method is invoked when key has been pressed
- *
- * @param e A {@link MenuKeyEvent}.
+ *
+ * @param e
+ * A {@link MenuKeyEvent}.
*/
public void menuKeyReleased(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
- * This method is invoked when key has been typed
- * It handles the mnemonic key for the menu item.
- *
- * @param e A {@link MenuKeyEvent}.
+ * This method is invoked when key has been typed It handles the mnemonic
+ * key for the menu item.
+ *
+ * @param e
+ * A {@link MenuKeyEvent}.
*/
public void menuKeyTyped(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
}
-
+
/**
- * Helper class that listens for changes to the properties of the {@link
+ * Helper class that listens for item changes to the properties of the {@link
* JMenuItem}.
*/
- protected class PropertyChangeHandler implements PropertyChangeListener
+ private class ItemHandler implements ItemListener
{
/**
- * This method is called when one of the menu item's properties change.
+ * This method is called when one of the menu item changes.
*
- * @param evt A {@link PropertyChangeEvent}.
+ * @param evt A {@link ItemEvent}.
*/
- public void propertyChange(PropertyChangeEvent evt)
+ public void itemStateChanged(ItemEvent evt)
{
+ boolean state = false;
+ if (menuItem instanceof JCheckBoxMenuItem)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ state = true;
+ ((JCheckBoxMenuItem) menuItem).setState(state);
+ }
menuItem.revalidate();
menuItem.repaint();
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
index 30be592ee79..827cbb0f50d 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
@@ -46,8 +47,8 @@ import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
+import javax.swing.LookAndFeel;
import javax.swing.MenuSelectionManager;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
@@ -92,7 +93,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
protected ChangeListener createChangeListener(JComponent c)
{
- return new ChangeHandler();
+ return new ChangeHandler((JMenu) c, this);
}
/**
@@ -180,12 +181,6 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public Dimension getMaximumSize(JComponent c)
{
- // If this menu is in a popup menu, treat it like a regular JMenuItem
- if (!((JMenu)c).isTopLevelMenu())
- {
- JMenuItem menuItem = new JMenuItem(((JMenu)c).getText(), ((JMenu)c).getIcon());
- return menuItem.getMaximumSize();
- }
return c.getPreferredSize();
}
@@ -205,20 +200,17 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- menuItem.setBackground(defaults.getColor("Menu.background"));
- menuItem.setBorder(defaults.getBorder("Menu.border"));
- menuItem.setFont(defaults.getFont("Menu.font"));
- menuItem.setForeground(defaults.getColor("Menu.foreground"));
- menuItem.setMargin(defaults.getInsets("Menu.margin"));
- acceleratorFont = defaults.getFont("Menu.acceleratorFont");
- acceleratorForeground = defaults.getColor("Menu.acceleratorForeground");
- acceleratorSelectionForeground = defaults.getColor("Menu.acceleratorSelectionForeground");
- selectionBackground = defaults.getColor("Menu.selectionBackground");
- selectionForeground = defaults.getColor("Menu.selectionForeground");
- arrowIcon = defaults.getIcon("Menu.arrowIcon");
- oldBorderPainted = defaults.getBoolean("Menu.borderPainted");
+ LookAndFeel.installBorder(menuItem, "Menu.border");
+ LookAndFeel.installColorsAndFont(menuItem, "Menu.background",
+ "Menu.foreground", "Menu.font");
+ menuItem.setMargin(UIManager.getInsets("Menu.margin"));
+ acceleratorFont = UIManager.getFont("Menu.acceleratorFont");
+ acceleratorForeground = UIManager.getColor("Menu.acceleratorForeground");
+ acceleratorSelectionForeground = UIManager.getColor("Menu.acceleratorSelectionForeground");
+ selectionBackground = UIManager.getColor("Menu.selectionBackground");
+ selectionForeground = UIManager.getColor("Menu.selectionForeground");
+ arrowIcon = UIManager.getIcon("Menu.arrowIcon");
+ oldBorderPainted = UIManager.getBoolean("Menu.borderPainted");
menuItem.setOpaque(true);
}
@@ -245,6 +237,7 @@ public class BasicMenuUI extends BasicMenuItemUI
protected void setupPostTimer(JMenu menu)
{
+ // TODO: Implement this properly.
}
/**
@@ -356,6 +349,7 @@ public class BasicMenuUI extends BasicMenuItemUI
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mousePressed(MouseEvent e)
@@ -421,10 +415,13 @@ public class BasicMenuUI extends BasicMenuItemUI
public void menuDeselected(MenuEvent e)
{
JMenu menu = (JMenu) menuItem;
- if (menu.isTopLevelMenu())
- ((JMenuBar) menu.getParent()).getSelectionModel().clearSelection();
- else
- ((JPopupMenu) menu.getParent()).getSelectionModel().clearSelection();
+ if (menu.getParent() != null)
+ {
+ if (menu.isTopLevelMenu())
+ ((JMenuBar) menu.getParent()).getSelectionModel().clearSelection();
+ else
+ ((JPopupMenu) menu.getParent()).getSelectionModel().clearSelection();
+ }
}
/**
@@ -456,6 +453,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void propertyChange(PropertyChangeEvent e)
{
+ // TODO: Implement this properly.
}
}
@@ -464,9 +462,40 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public class ChangeHandler implements ChangeListener
{
+ /**
+ * Not used.
+ */
+ public boolean isSelected;
+
+ /**
+ * Not used.
+ */
+ public JMenu menu;
+
+ /**
+ * Not used.
+ */
+ public BasicMenuUI ui;
+
+ /**
+ * Not used.
+ */
+ public Component wasFocused;
+
+ /**
+ * Not used.
+ */
+ public ChangeHandler(JMenu m, BasicMenuUI ui)
+ {
+ // Not used.
+ }
+
+ /**
+ * Not used.
+ */
public void stateChanged(ChangeEvent e)
{
- // FIXME: It seems that this class is not used anywhere
+ // Not used.
}
}
@@ -506,6 +535,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuDragMouseExited(MenuDragMouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -516,6 +546,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuDragMouseReleased(MenuDragMouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -532,6 +563,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuKeyPressed(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -541,6 +573,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuKeyReleased(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -551,6 +584,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuKeyTyped(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
index c9f623259ba..6b37d315fa8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -70,8 +70,8 @@ import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
@@ -141,13 +141,14 @@ public class BasicOptionPaneUI extends OptionPaneUI
optionPane);
if (inf != null)
{
- try
- {
- inf.setClosed(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ inf.setClosed(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if attempt has been vetoed.
+ }
}
}
}
@@ -405,16 +406,30 @@ public class BasicOptionPaneUI extends OptionPaneUI
|| e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)
|| e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))
{
- optionPane.removeAll();
- messageAreaContainer = createMessageArea();
- optionPane.add(messageAreaContainer);
- optionPane.add(buttonContainer);
+ optionPane.remove(messageAreaContainer);
+ messageAreaContainer = createMessageArea();
+ optionPane.add(messageAreaContainer);
+ Container newButtons = createButtonArea();
+ optionPane.remove(buttonContainer);
+ optionPane.add(newButtons);
+ buttonContainer = newButtons;
+ optionPane.add(buttonContainer);
}
optionPane.invalidate();
optionPane.repaint();
}
}
+ /**
+ * The minimum width for JOptionPanes.
+ */
+ public static final int MinimumWidth = 262;
+
+ /**
+ * The minimum height for JOptionPanes.
+ */
+ public static final int MinimumHeight = 90;
+
/** Whether the JOptionPane contains custom components. */
protected boolean hasCustomComponents = false;
@@ -433,12 +448,6 @@ public class BasicOptionPaneUI extends OptionPaneUI
/** The component that receives input when the JOptionPane needs it. */
protected JComponent inputComponent;
- /** The minimum height of the JOptionPane. */
- public static int minimumHeight;
-
- /** The minimum width of the JOptionPane. */
- public static int minimumWidth;
-
/** The minimum dimensions of the JOptionPane. */
protected Dimension minimumSize;
@@ -518,6 +527,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // Nothing to do here.
}
}
@@ -637,6 +647,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
public BasicOptionPaneUI()
{
+ // Nothing to do here.
}
/**
@@ -860,10 +871,10 @@ public class BasicOptionPaneUI extends OptionPaneUI
addIcon(messageArea);
JPanel rightSide = new JPanel();
- rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0));
+ rightSide.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
rightSide.setLayout(new GridBagLayout());
GridBagConstraints con = createConstraints();
-
+
addMessageComponents(rightSide, con, getMessage(),
getMaxCharactersPerLineCount(), false);
@@ -886,7 +897,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
}
}
- messageArea.add(rightSide, BorderLayout.EAST);
+ messageArea.add(rightSide, BorderLayout.CENTER);
return messageArea;
}
@@ -944,8 +955,14 @@ public class BasicOptionPaneUI extends OptionPaneUI
case JOptionPane.YES_NO_CANCEL_OPTION:
return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING };
case JOptionPane.OK_CANCEL_OPTION:
- case JOptionPane.DEFAULT_OPTION:
return new Object[] { OK_STRING, CANCEL_STRING };
+ case JOptionPane.DEFAULT_OPTION:
+ return (optionPane.getWantsInput() ) ?
+ new Object[] { OK_STRING, CANCEL_STRING } :
+ ( optionPane.getMessageType() == JOptionPane.QUESTION_MESSAGE ) ?
+ new Object[] { YES_STRING, NO_STRING, CANCEL_STRING } :
+ // ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, PLAIN_MESSAGE
+ new Object[] { OK_STRING };
}
return null;
}
@@ -1142,21 +1159,17 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- optionPane.setFont(defaults.getFont("OptionPane.font"));
- optionPane.setBackground(defaults.getColor("OptionPane.background"));
- optionPane.setForeground(defaults.getColor("OptionPane.foreground"));
- optionPane.setBorder(defaults.getBorder("OptionPane.border"));
+ LookAndFeel.installColorsAndFont(optionPane, "OptionPane.background",
+ "OptionPane.foreground",
+ "OptionPane.font");
+ LookAndFeel.installBorder(optionPane, "OptionPane.border");
optionPane.setOpaque(true);
- messageBorder = defaults.getBorder("OptionPane.messageAreaBorder");
- messageForeground = defaults.getColor("OptionPane.messageForeground");
- buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder");
+ messageBorder = UIManager.getBorder("OptionPane.messageAreaBorder");
+ messageForeground = UIManager.getColor("OptionPane.messageForeground");
+ buttonBorder = UIManager.getBorder("OptionPane.buttonAreaBorder");
- minimumSize = defaults.getDimension("OptionPane.minimumSize");
- minimumWidth = minimumSize.width;
- minimumHeight = minimumSize.height;
+ minimumSize = UIManager.getDimension("OptionPane.minimumSize");
// FIXME: Image icons don't seem to work properly right now.
// Once they do, replace the synthetic icons with these ones.
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
index b715c57b360..783cec473bc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
@@ -40,8 +40,7 @@ package javax.swing.plaf.basic;
import javax.swing.JComponent;
import javax.swing.JPanel;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.PanelUI;
@@ -64,8 +63,29 @@ public class BasicPanelUI extends PanelUI
public void installDefaults(JPanel p)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- p.setBackground(defaults.getColor("Panel.background"));
+ LookAndFeel.installColorsAndFont(p, "Panel.background", "Panel.foreground",
+ "Panel.font");
p.setOpaque(true);
}
+
+ /**
+ * Uninstalls this UI from the JPanel.
+ *
+ * @param c the JPanel from which to uninstall this UI
+ */
+ public void uninstallUI(JComponent c)
+ {
+ uninstallDefaults((JPanel) c);
+ }
+
+ /**
+ * Uninstalls the UI defaults that have been install through
+ * {@link #installDefaults}.
+ *
+ * @param p the panel from which to uninstall the UI defaults
+ */
+ protected void uninstallDefaults(JPanel p)
+ {
+ // Nothing to do here.
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java
index 044027b0b4a..76dcfc43559 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.PasswordView;
@@ -48,6 +49,7 @@ public class BasicPasswordFieldUI extends BasicTextFieldUI
{
public BasicPasswordFieldUI()
{
+ // Nothing to do here.
}
public View create(Element elem)
@@ -60,6 +62,11 @@ public class BasicPasswordFieldUI extends BasicTextFieldUI
return new BasicPasswordFieldUI();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "PasswordField"
+ */
protected String getPropertyPrefix()
{
return "PasswordField";
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java
index 247117bc983..e15a17bab28 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java
@@ -53,12 +53,11 @@ import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
+import javax.swing.LookAndFeel;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.event.MouseInputListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
@@ -131,12 +130,9 @@ public class BasicPopupMenuUI extends PopupMenuUI
*/
public void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- popupMenu.setBackground(defaults.getColor("PopupMenu.background"));
- popupMenu.setBorder(defaults.getBorder("PopupMenu.border"));
- popupMenu.setFont(defaults.getFont("PopupMenu.font"));
- popupMenu.setForeground(defaults.getColor("PopupMenu.foreground"));
+ LookAndFeel.installColorsAndFont(popupMenu, "PopupMenu.background",
+ "PopupMenu.foreground", "PopupMenu.font");
+ LookAndFeel.installBorder(popupMenu, "PopupMenu.border");
popupMenu.setOpaque(true);
}
@@ -277,23 +273,26 @@ public class BasicPopupMenuUI extends PopupMenuUI
RootPaneContainer rootContainer = (RootPaneContainer) SwingUtilities
.getRoot(invoker);
- ((Container) rootContainer).removeComponentListener(topWindowListener);
-
- // If this popup menu is the last popup menu visible on the screen, then
- // stop interrupting mouse events in the glass pane before hiding this
- // last popup menu.
- boolean topLevelMenu = (popupMenu.getInvoker() instanceof JMenu)
- && ((JMenu) popupMenu.getInvoker())
- .isTopLevelMenu();
-
- if (topLevelMenu || ! (popupMenu.getInvoker() instanceof MenuElement))
+ if (rootContainer != null)
{
- // set glass pane not to interrupt mouse events and remove
- // mouseInputListener
- Container glassPane = (Container) rootContainer.getGlassPane();
- glassPane.setVisible(false);
- glassPane.removeMouseListener(mouseInputListener);
- mouseInputListener = null;
+ ((Container) rootContainer).removeComponentListener(topWindowListener);
+
+ // If this popup menu is the last popup menu visible on the screen,
+ // then
+ // stop interrupting mouse events in the glass pane before hiding this
+ // last popup menu.
+ boolean topLevelMenu = (popupMenu.getInvoker() instanceof JMenu)
+ && ((JMenu) popupMenu.getInvoker()).isTopLevelMenu();
+
+ if (topLevelMenu || !(popupMenu.getInvoker() instanceof MenuElement))
+ {
+ // set glass pane not to interrupt mouse events and remove
+ // mouseInputListener
+ Container glassPane = (Container) rootContainer.getGlassPane();
+ glassPane.setVisible(false);
+ glassPane.removeMouseListener(mouseInputListener);
+ mouseInputListener = null;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
index d00628f53d4..88d949b1caf 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
@@ -46,21 +46,24 @@ import java.awt.Graphics;
import java.awt.Insets;
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.font.FontRenderContext;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
@@ -110,14 +113,56 @@ public class BasicProgressBarUI extends ProgressBarUI
{
// Only need to listen for indeterminate changes.
// All other things are done on a repaint.
- if (e.getPropertyName().equals("inderterminate"))
- if (((Boolean) e.getNewValue()).booleanValue())
- startAnimationTimer();
- else
- stopAnimationTimer();
- else
- progressBar.repaint();
+ if (e.getPropertyName().equals("indeterminate"))
+ if (((Boolean) e.getNewValue()).booleanValue()
+ && progressBar.isShowing())
+ startAnimationTimer();
+ else
+ stopAnimationTimer();
+ }
+ }
+
+ /**
+ * Receives notification when the progressbar is becoming visible or
+ * invisible and starts/stops the animation timer accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class AncestorHandler implements AncestorListener
+ {
+
+ /**
+ * Receives notification when the progressbar is becoming visible. This
+ * starts the animation timer if the progressbar is indeterminate.
+ *
+ * @param event the ancestor event
+ */
+ public void ancestorAdded(AncestorEvent event)
+ {
+ if (progressBar.isIndeterminate())
+ startAnimationTimer();
+ }
+
+ /**
+ * Receives notification when the progressbar is becoming invisible. This
+ * stops the animation timer if the progressbar is indeterminate.
+ *
+ * @param event the ancestor event
+ */
+ public void ancestorRemoved(AncestorEvent event)
+ {
+ stopAnimationTimer();
+ }
+
+ /**
+ * Receives notification when an ancestor has been moved. We don't need to
+ * do anything here.
+ */
+ public void ancestorMoved(AncestorEvent event)
+ {
+ // Nothing to do here.
}
+
}
/**
@@ -141,6 +186,35 @@ public class BasicProgressBarUI extends ProgressBarUI
}
}
+ /**
+ * Receives notification when the size of the progress bar changes and
+ * invalidates the layout information for the box calculation in
+ * {@link BasicProgressBarUI#getBox(Rectangle)}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class ComponentHandler extends ComponentAdapter
+ {
+ /**
+ * Receives notification when the size of the progress bar changes and
+ * invalidates the layout information for the box calculation in
+ * {@link BasicProgressBarUI#getBox}.
+ *
+ * @param e the component event
+ */
+ public void componentResized(ComponentEvent e)
+ {
+ boxDependent = -1;
+ boxIndependent = -1;
+ incr = -1;
+ }
+ }
+
+ /**
+ * Holds the value of the bouncing box that is returned by {@link #getBox}.
+ */
+ protected Rectangle boxRect;
+
/** The timer used to move the bouncing box. */
private transient Timer animationTimer;
@@ -172,6 +246,27 @@ public class BasicProgressBarUI extends ProgressBarUI
/** The progressBar for this UI. */
protected JProgressBar progressBar;
+
+ /**
+ * The size of the box returned by {@link #getBox} in the orientation
+ * direction of the progress bar. This is package private to avoid accessor
+ * method.
+ */
+ transient double boxDependent = - 1;
+
+ /**
+ * The size of the box returned by {@link #getBox} against the orientation
+ * direction of the progress bar. This is package private to avoid accessor
+ * method.
+ */
+ transient int boxIndependent = - 1;
+
+ /**
+ * The increment for box animation. This is package private to avoid accessor
+ * method.
+ */
+ transient double incr = -1;
+
/** The length of the cell. The cell is the painted part. */
private transient int cellLength;
@@ -185,6 +280,18 @@ public class BasicProgressBarUI extends ProgressBarUI
private transient Color selectionForeground;
/**
+ * Listens for notification when the component becomes showing and
+ * starts/stops the animation timer.
+ */
+ private AncestorListener ancestorListener;
+
+ /**
+ * Listens for resize events on the progress bar and invalidates some
+ * layout info.
+ */
+ private ComponentListener componentListener;
+
+ /**
* Creates a new BasicProgressBarUI object.
*/
public BasicProgressBarUI()
@@ -248,48 +355,49 @@ public class BasicProgressBarUI extends ProgressBarUI
{
if (!progressBar.isIndeterminate())
return null;
- //numFrames has to be an even number as defined by spec.
- int iterations = numFrames / 2 + 1;
+ if (r == null)
+ r = new Rectangle();
- double boxDependent;
- double boxIndependent;
+ Rectangle vr = new Rectangle();
+ SwingUtilities.calculateInnerArea(progressBar, vr);
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
+ // Recalculate the metrics only when size of the progressbar has changed.
+ if (incr == -1 || boxDependent == -1 || boxIndependent == -1)
{
- Dimension dims = getPreferredInnerHorizontal();
- boxDependent = (double) dims.width / iterations;
- boxIndependent = dims.height;
- }
- else
- {
- Dimension dims = getPreferredInnerVertical();
- boxDependent = (double) dims.height / iterations;
- boxIndependent = dims.width;
+ //numFrames has to be an even number as defined by spec.
+ int iterations = numFrames / 2;
+ if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
+ {
+ boxDependent = vr.width / 6.;
+ incr = ((double) (vr.width - boxDependent)) / (double) iterations;
+ boxIndependent = vr.height;
+ }
+ else
+ {
+ boxDependent = vr.height / 6.;
+ incr = ((double) (vr.height - boxDependent)) / (double) iterations;
+ boxIndependent = vr.width;
+ }
}
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(progressBar, vr);
-
int index = getAnimationIndex();
- if (animationIndex > (numFrames + 1) / 2)
+ if (animationIndex > (numFrames) / 2)
index = numFrames - getAnimationIndex();
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
{
- r.x = vr.x + (int) (index * boxDependent);
- r.y = vr.y;
- r.width = (int) boxDependent;
- r.height = (int) boxIndependent;
+ r.x = vr.x + (int) (incr * index);
+ r.y = vr.y;
+ r.width = (int) boxDependent;
+ r.height = (int) boxIndependent;
}
else
{
- index++;
- r.x = vr.x;
- r.y = vr.height - (int) (index * boxDependent) + vr.y;
- r.width = (int) boxIndependent;
- r.height = (int) boxDependent;
+ r.x = vr.x;
+ r.y = vr.height - (int) (incr * index) + vr.y - (int) boxDependent;
+ r.width = (int) boxIndependent;
+ r.height = (int) boxDependent;
}
-
return r;
}
@@ -324,7 +432,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
public Dimension getMaximumSize(JComponent c)
{
- return getPreferredSize(c);
+ Insets insets = c.getInsets();
+ Dimension ret;
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.VERTICAL)
+ {
+ ret = getPreferredInnerVertical();
+ ret.height = Short.MAX_VALUE;
+ ret.width += insets.left + insets.right;
+ }
+ else
+ {
+ ret = getPreferredInnerHorizontal();
+ ret.width = Short.MAX_VALUE;
+ ret.height += insets.top + insets.bottom;
+ }
+ return ret;
}
/**
@@ -338,7 +461,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
public Dimension getMinimumSize(JComponent c)
{
- return getPreferredSize(c);
+ Insets insets = c.getInsets();
+ Dimension ret;
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.VERTICAL)
+ {
+ ret = getPreferredInnerVertical();
+ ret.height = 10;
+ ret.width += insets.left + insets.right;
+ }
+ else
+ {
+ ret = getPreferredInnerHorizontal();
+ ret.width = 10;
+ ret.height += insets.top + insets.bottom;
+ }
+ return ret;
}
/**
@@ -351,11 +489,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
protected Dimension getPreferredInnerHorizontal()
{
- Rectangle vr = new Rectangle();
+ Font font = progressBar.getFont();
+ FontMetrics fm = progressBar.getFontMetrics(font);
- SwingUtilities.calculateInnerArea(progressBar, vr);
+ int stringWidth = 0;
+ String str = progressBar.getString();
+ if (str != null)
+ stringWidth = fm.stringWidth(progressBar.getString());
+ Insets i = progressBar.getInsets();
+ int prefWidth = Math.max(200 - i.left - i.right, stringWidth);
- return new Dimension(vr.width, vr.height);
+ int stringHeight = 0;
+ if (str != null)
+ stringHeight = fm.getHeight();
+ int prefHeight = Math.max(16 - i.top - i.bottom, stringHeight);
+
+ return new Dimension(prefWidth, prefHeight);
}
/**
@@ -368,11 +517,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
protected Dimension getPreferredInnerVertical()
{
- Rectangle vr = new Rectangle();
+ Font font = progressBar.getFont();
+ FontMetrics fm = progressBar.getFontMetrics(font);
- SwingUtilities.calculateInnerArea(progressBar, vr);
+ int stringWidth = 0;
+ String str = progressBar.getString();
+ if (str != null)
+ stringWidth = fm.stringWidth(progressBar.getString());
+ Insets i = progressBar.getInsets();
+ int prefHeight = Math.max(200 - i.left - i.right, stringWidth);
+
+ int stringHeight = 0;
+ if (str != null)
+ stringHeight = fm.getHeight();
+ int prefWidth = Math.max(16 - i.top - i.bottom, stringHeight);
- return new Dimension(vr.width, vr.height);
+ return new Dimension(prefWidth, prefHeight);
}
/**
@@ -386,36 +546,16 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
public Dimension getPreferredSize(JComponent c)
{
- // The only thing we need to worry about is
- // the text size.
Insets insets = c.getInsets();
-
- // make a fontrenderer context so that we can make assumptions about
- // the string bounds
- FontRenderContext ctx = new FontRenderContext(new AffineTransform(),
- false, false);
- Rectangle2D bounds = c.getFont().getStringBounds(progressBar.getString(),
- ctx);
- int textW = (int) bounds.getWidth();
- int textH = (int) bounds.getHeight();
-
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- if (textH < 20)
- textH = 20;
- if (textW < 200)
- textW = 200;
- }
+ Dimension ret;
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.VERTICAL)
+ ret = getPreferredInnerVertical();
else
- {
- if (textH < 200)
- textH = 200;
- if (textW < 20)
- textW = 20;
- }
- textW += insets.left + insets.right;
- textH += insets.top + insets.bottom;
- return new Dimension(textW, textH);
+ ret = getPreferredInnerHorizontal();
+ ret.width += insets.left + insets.right;
+ ret.height += insets.top + insets.bottom;
+ return ret;
}
/**
@@ -514,66 +654,22 @@ public class BasicProgressBarUI extends ProgressBarUI
int min = progressBar.getMinimum();
int value = progressBar.getValue();
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(c, vr);
-
- Rectangle or = c.getBounds();
-
+ Rectangle vr = SwingUtilities.calculateInnerArea(c, new Rectangle());
+ Rectangle or = progressBar.getBounds();
Insets insets = c.getInsets();
int amountFull = getAmountFull(insets, or.width, or.height);
- g.setColor(c.getBackground());
- g.fill3DRect(vr.x, vr.y, vr.width, vr.height, false);
-
- if (max != min && len != 0 && value > min)
- {
- int iterations = value / (space + len);
-
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
{
- double spaceInUnits = space * (double) vr.width / (max - min);
- double lenInUnits = len * (double) vr.width / (max - min);
- double currX = vr.x;
-
g.setColor(c.getForeground());
- g.fill3DRect(vr.x, vr.y, amountFull, vr.height, true);
-
- g.setColor(c.getBackground());
- if (spaceInUnits != 0)
- {
- for (int i = 0; i < iterations; i++)
- {
- currX += lenInUnits;
- g.fill3DRect((int) currX, vr.y, (int) spaceInUnits,
- vr.height, true);
- currX += spaceInUnits;
- }
- }
+ g.fillRect(vr.x, vr.y, amountFull, vr.height);
}
else
{
- double currY = vr.y;
- double spaceInUnits = space * (double) vr.height / (max - min);
- double lenInUnits = len * (double) vr.height / (max - min);
-
g.setColor(c.getForeground());
- g.fill3DRect(vr.x, vr.y + vr.height - amountFull, vr.width,
- amountFull, true);
-
- g.setColor(c.getBackground());
-
- if (spaceInUnits != 0)
- {
- for (int i = 0; i < iterations; i++)
- {
- currY -= lenInUnits + spaceInUnits;
- g.fill3DRect(vr.x, (int) currY, vr.width,
- (int) spaceInUnits, true);
- }
- }
+ g.fillRect(vr.x, vr.y + vr.height - amountFull, vr.width, amountFull);
}
- }
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
paintString(g, 0, 0, or.width, or.height, amountFull, insets);
@@ -599,13 +695,12 @@ public class BasicProgressBarUI extends ProgressBarUI
SwingUtilities.calculateInnerArea(c, vr);
g.setColor(c.getBackground());
- g.fill3DRect(vr.x, vr.y, vr.width, vr.height, false);
+ g.fillRect(vr.x, vr.y, vr.width, vr.height);
- Rectangle box = new Rectangle();
- getBox(box);
+ boxRect = getBox(boxRect);
g.setColor(c.getForeground());
- g.fill3DRect(box.x, box.y, box.width, box.height, true);
+ g.fillRect(boxRect.x, boxRect.y, boxRect.width, boxRect.height);
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
paintString(g, 0, 0, or.width, or.height,
@@ -628,23 +723,34 @@ public class BasicProgressBarUI extends ProgressBarUI
protected void paintString(Graphics g, int x, int y, int width, int height,
int amountFull, Insets b)
{
+ // FIXME: We do not support vertical text painting because Java2D is needed
+ // for this.
+ if (progressBar.getOrientation() == JProgressBar.VERTICAL)
+ return;
+
// We want to place in the exact center of the bar.
Point placement = getStringPlacement(g, progressBar.getString(),
x + b.left, y + b.top,
width - b.left - b.right,
height - b.top - b.bottom);
- Color saved = g.getColor();
-
- // FIXME: The Color of the text should use selectionForeground and selectionBackground
- // but that can't be done right now, so we'll use white in the mean time.
- g.setColor(Color.WHITE);
+ Color savedColor = g.getColor();
+ Shape savedClip = g.getClip();
FontMetrics fm = g.getFontMetrics(progressBar.getFont());
+ int full = getAmountFull(b, width, height);
+ String str = progressBar.getString();
- g.drawString(progressBar.getString(), placement.x,
- placement.y + fm.getAscent());
-
- g.setColor(saved);
+ // We draw this string two times with different clips so that the text
+ // over the filled area is painted with selectionForeground and over
+ // the clear area with selectionBackground.
+ g.setColor(getSelectionForeground());
+ g.setClip(0, 0, full + b.left, height);
+ g.drawString(str, placement.x, placement.y + fm.getAscent());
+ g.setColor(getSelectionBackground());
+ g.setClip(full + b.left, 0, width - full, height);
+ g.drawString(str, placement.x, placement.y + fm.getAscent());
+ g.setClip(savedClip);
+ g.setColor(savedColor);
}
/**
@@ -712,21 +818,19 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- progressBar.setFont(defaults.getFont("ProgressBar.font"));
- progressBar.setForeground(defaults.getColor("ProgressBar.foreground"));
- progressBar.setBackground(defaults.getColor("ProgressBar.background"));
- progressBar.setBorder(defaults.getBorder("ProgressBar.border"));
+ LookAndFeel.installColorsAndFont(progressBar, "ProgressBar.background",
+ "ProgressBar.foreground",
+ "ProgressBar.font");
+ LookAndFeel.installBorder(progressBar, "ProgressBar.border");
progressBar.setOpaque(true);
- selectionForeground = defaults.getColor("ProgressBar.selectionForeground");
- selectionBackground = defaults.getColor("ProgressBar.selectionBackground");
- cellLength = defaults.getInt("ProgressBar.cellLength");
- cellSpacing = defaults.getInt("ProgressBar.cellSpacing");
+ selectionForeground = UIManager.getColor("ProgressBar.selectionForeground");
+ selectionBackground = UIManager.getColor("ProgressBar.selectionBackground");
+ cellLength = UIManager.getInt("ProgressBar.cellLength");
+ cellSpacing = UIManager.getInt("ProgressBar.cellSpacing");
- int repaintInterval = defaults.getInt("ProgressBar.repaintInterval");
- int cycleTime = defaults.getInt("ProgressBar.cycleTime");
+ int repaintInterval = UIManager.getInt("ProgressBar.repaintInterval");
+ int cycleTime = UIManager.getInt("ProgressBar.cycleTime");
if (cycleTime % repaintInterval != 0
&& (cycleTime / repaintInterval) % 2 != 0)
@@ -768,6 +872,12 @@ public class BasicProgressBarUI extends ProgressBarUI
progressBar.addChangeListener(changeListener);
progressBar.addPropertyChangeListener(propertyListener);
animationTimer.addActionListener(animation);
+
+ ancestorListener = new AncestorHandler();
+ progressBar.addAncestorListener(ancestorListener);
+
+ componentListener = new ComponentHandler();
+ progressBar.addComponentListener(componentListener);
}
/**
@@ -783,6 +893,14 @@ public class BasicProgressBarUI extends ProgressBarUI
changeListener = null;
propertyListener = null;
animation = null;
+
+ if (ancestorListener != null)
+ progressBar.removeAncestorListener(ancestorListener);
+ ancestorListener = null;
+
+ if (componentListener != null)
+ progressBar.removeComponentListener(componentListener);
+ componentListener = null;
}
/**
@@ -806,6 +924,8 @@ public class BasicProgressBarUI extends ProgressBarUI
installDefaults();
installListeners();
}
+ if (progressBar.isIndeterminate())
+ startAnimationTimer();
}
/**
@@ -824,4 +944,5 @@ public class BasicProgressBarUI extends ProgressBarUI
animationTimer = null;
progressBar = null;
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
index fa74a008bae..8af5ff7f95c 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
@@ -59,8 +59,6 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
public BasicRadioButtonMenuItemUI()
{
super();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- checkIcon = defaults.getIcon("RadioButtonMenuItem.checkIcon");
}
/**
@@ -98,5 +96,7 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
MenuElement[] path,
MenuSelectionManager manager)
{
+ // TODO: May not be implemented properly.
+ item.processMouseEvent(e, path, manager);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
index fbd21241a0d..f3698e85908 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
@@ -93,6 +95,10 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
b.setIcon(icon);
if (b.getSelectedIcon() == null)
b.setSelectedIcon(icon);
+ if (b.getDisabledIcon() == null)
+ b.setDisabledIcon(icon);
+ if (b.getDisabledSelectedIcon() == null)
+ b.setDisabledSelectedIcon(icon);
}
/**
@@ -139,10 +145,14 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
g.setFont(f);
Icon currentIcon = null;
- if (b.isSelected())
+ if (b.isSelected() && b.isEnabled())
currentIcon = b.getSelectedIcon();
- else
+ else if (!b.isSelected() && b.isEnabled())
currentIcon = b.getIcon();
+ else if (b.isSelected() && !b.isEnabled())
+ currentIcon = b.getDisabledSelectedIcon();
+ else // (!b.isSelected() && !b.isEnabled())
+ currentIcon = b.getDisabledIcon();
SwingUtilities.calculateInnerArea(b, vr);
String text = SwingUtilities.layoutCompoundLabel
@@ -157,6 +167,25 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
}
if (text != null)
paintText(g, b, tr, text);
- paintFocus(g, b, vr, tr, ir);
+ // TODO: Figure out what is the size parameter?
+ if (b.hasFocus() && b.isFocusPainted() && b.isEnabled())
+ paintFocus(g, tr, null);
+ }
+
+ /**
+ * Paints the focus indicator for JRadioButtons.
+ *
+ * @param g the graphics context
+ * @param tr the rectangle for the text label
+ * @param size the size (??)
+ */
+ // TODO: Figure out what for is the size parameter.
+ protected void paintFocus(Graphics g, Rectangle tr, Dimension size)
+ {
+ Color focusColor = UIManager.getColor(getPropertyPrefix() + ".focus");
+ Color saved = g.getColor();
+ g.setColor(focusColor);
+ g.drawRect(tr.x, tr.y, tr.width, tr.height);
+ g.setColor(saved);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
index d97f7baea67..2a698e8a162 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
@@ -42,6 +42,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
+import javax.swing.JRootPane;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.RootPaneUI;
@@ -56,11 +57,127 @@ public class BasicRootPaneUI extends RootPaneUI
public void installUI(JComponent c)
{
- c.setBackground(UIManager.getColor("control"));
super.installUI(c);
+ if (c instanceof JRootPane)
+ {
+ JRootPane rp = (JRootPane) c;
+ installDefaults(rp);
+ installComponents(rp);
+ installListeners(rp);
+ installKeyboardActions(rp);
+ }
+ }
+
+ /**
+ * Installs the look and feel defaults for JRootPane.
+ *
+ * @param rp the root pane to install the defaults to
+ */
+ protected void installDefaults(JRootPane rp)
+ {
+ // Is this ok?
+ rp.setBackground(UIManager.getColor("control"));
+ }
+
+ /**
+ * Installs additional look and feel components to the root pane.
+ *
+ * @param rp the root pane to install the components to
+ */
+ protected void installComponents(JRootPane rp)
+ {
+ // All components are initialized in the JRootPane constructor, and since
+ // the createXXXPane methods are protected, I see no reasonable way,
+ // and no need to initialize them here. This method is here anyway
+ // for compatibility and to provide the necessary hooks to subclasses.
+ }
+
+ /**
+ * Installs any look and feel specific listeners on the root pane.
+ *
+ * @param rp the root pane to install the listeners to
+ */
+ protected void installListeners(JRootPane rp)
+ {
+ rp.addPropertyChangeListener(this);
+ }
+
+ /**
+ * Installs look and feel keyboard actions on the root pane.
+ *
+ * @param rp the root pane to install the keyboard actions to
+ */
+ protected void installKeyboardActions(JRootPane rp)
+ {
+ // We currently do not install any keyboard actions here.
+ // This method is here anyway for compatibility and to provide
+ // the necessary hooks to subclasses.
}
public void propertyChange(PropertyChangeEvent event)
{
+ // TODO: Implement this properly.
+ }
+
+ /**
+ * Uninstalls this UI from the root pane. This calls
+ * {@link #uninstallDefaults}, {@link #uninstallComponents},
+ * {@link #uninstallListeners}, {@link #uninstallKeyboardActions}
+ * in this order.
+ *
+ * @param c the root pane to uninstall the UI from
+ */
+ public void uninstallUI(JComponent c)
+ {
+ super.uninstallUI(c);
+ if (c instanceof JRootPane)
+ {
+ JRootPane rp = (JRootPane) c;
+ uninstallDefaults(rp);
+ uninstallComponents(rp);
+ uninstallListeners(rp);
+ uninstallKeyboardActions(rp);
+ }
+ }
+
+ /**
+ * Uninstalls the look and feel defaults that have been installed in
+ * {@link #installDefaults}.
+ *
+ * @param rp the root pane to uninstall the defaults from
+ */
+ protected void uninstallDefaults(JRootPane rp)
+ {
+ // We do nothing here.
+ }
+
+ /**
+ * Uninstalls look and feel components from the root pane.
+ *
+ * @param rp the root pane to uninstall the components from
+ */
+ protected void uninstallComponents(JRootPane rp)
+ {
+ // We do nothing here.
+ }
+
+ /**
+ * Uninstalls any look and feel specific listeners from the root pane.
+ *
+ * @param rp the root pane to uninstall the listeners from
+ */
+ protected void uninstallListeners(JRootPane rp)
+ {
+ rp.removePropertyChangeListener(this);
+ }
+
+ /**
+ * Uninstalls look and feel keyboard actions from the root pane.
+ *
+ * @param rp the root pane to uninstall the keyboard actions from
+ */
+ protected void uninstallKeyboardActions(JRootPane rp)
+ {
+ // We do nothing here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
index 22242afcd8a..2f5eaf391e1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -58,6 +58,7 @@ import javax.swing.BoundedRangeModel;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
@@ -80,6 +81,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected class ArrowButtonListener extends MouseAdapter
{
+
/**
* Move the thumb in the direction specified by the button's arrow. If
* this button is held down, then it should keep moving the thumb.
@@ -91,9 +93,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
scrollTimer.stop();
scrollListener.setScrollByBlock(false);
if (e.getSource() == incrButton)
- scrollListener.setDirection(POSITIVE_SCROLL);
- else
- scrollListener.setDirection(NEGATIVE_SCROLL);
+ scrollListener.setDirection(POSITIVE_SCROLL);
+ else if (e.getSource() == decrButton)
+ scrollListener.setDirection(NEGATIVE_SCROLL);
+ scrollTimer.setDelay(100);
scrollTimer.start();
}
@@ -105,6 +108,11 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
public void mouseReleased(MouseEvent e)
{
scrollTimer.stop();
+ scrollTimer.setDelay(300);
+ if (e.getSource() == incrButton)
+ scrollByUnit(POSITIVE_SCROLL);
+ else if (e.getSource() == decrButton)
+ scrollByUnit(NEGATIVE_SCROLL);
}
}
@@ -120,9 +128,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void stateChanged(ChangeEvent e)
{
- // System.err.println(this + ".stateChanged()");
calculatePreferredSize();
- getThumbBounds();
+ updateThumbRect();
scrollbar.repaint();
}
}
@@ -141,31 +148,27 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
if (e.getPropertyName().equals("model"))
{
- ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener);
- scrollbar.getModel().addChangeListener(modelListener);
- getThumbBounds();
+ ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener);
+ scrollbar.getModel().addChangeListener(modelListener);
+ updateThumbRect();
}
else if (e.getPropertyName().equals("orientation"))
{
- incrButton.removeMouseListener(buttonListener);
- decrButton.removeMouseListener(buttonListener);
- int orientation = scrollbar.getOrientation();
- switch (orientation)
- {
- case (JScrollBar.HORIZONTAL):
- incrButton = createIncreaseButton(EAST);
- decrButton = createDecreaseButton(WEST);
- break;
- default:
- incrButton = createIncreaseButton(SOUTH);
- decrButton = createDecreaseButton(NORTH);
- break;
- }
- incrButton.addMouseListener(buttonListener);
- decrButton.addMouseListener(buttonListener);
- calculatePreferredSize();
+ uninstallListeners();
+ uninstallComponents();
+ uninstallDefaults();
+ installDefaults();
+ installComponents();
+ installListeners();
+ }
+ else if (e.getPropertyName().equals("enabled"))
+ {
+ Boolean b = (Boolean) e.getNewValue();
+ if (incrButton != null)
+ incrButton.setEnabled(b.booleanValue());
+ if (decrButton != null)
+ decrButton.setEnabled(b.booleanValue());
}
- scrollbar.repaint();
}
}
@@ -233,19 +236,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
if (block)
{
- // Only need to check it if it's block scrolling
- // We only block scroll if the click occurs
- // in the track.
- if (! trackListener.shouldScroll(direction))
- {
- trackHighlight = NO_HIGHLIGHT;
- scrollbar.repaint();
- return;
- }
- scrollByBlock(direction);
+ // Only need to check it if it's block scrolling
+ // We only block scroll if the click occurs
+ // in the track.
+ if (!trackListener.shouldScroll(direction))
+ {
+ trackHighlight = NO_HIGHLIGHT;
+ scrollbar.repaint();
+ return;
+ }
+ scrollByBlock(direction);
}
else
- scrollByUnit(direction);
+ scrollByUnit(direction);
}
}
@@ -316,9 +319,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
else
value = valueForYPosition(currentMouseY);
- if (value == scrollbar.getValue())
- return;
-
if (! thumbRect.contains(e.getPoint()))
{
scrollTimer.stop();
@@ -333,6 +333,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
trackHighlight = DECREASE_HIGHLIGHT;
scrollListener.setDirection(NEGATIVE_SCROLL);
}
+ scrollTimer.setDelay(100);
scrollTimer.start();
}
else
@@ -343,8 +344,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// "lower" edge of the thumb. The value at which
// the cursor is at must be greater or equal
// to that value.
+
+ scrollListener.setScrollByBlock(false);
scrollbar.setValueIsAdjusting(true);
- offset = value - scrollbar.getValue();
+ offset = value - scrollbar.getValue();
}
scrollbar.repaint();
}
@@ -357,11 +360,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void mouseReleased(MouseEvent e)
{
- trackHighlight = NO_HIGHLIGHT;
scrollTimer.stop();
+ scrollTimer.setDelay(300);
+ currentMouseX = e.getX();
+ currentMouseY = e.getY();
- if (scrollbar.getValueIsAdjusting())
- scrollbar.setValueIsAdjusting(false);
+ if (shouldScroll(POSITIVE_SCROLL))
+ scrollByBlock(POSITIVE_SCROLL);
+ else if (shouldScroll(NEGATIVE_SCROLL))
+ scrollByBlock(NEGATIVE_SCROLL);
+
+ trackHighlight = NO_HIGHLIGHT;
+ scrollListener.setScrollByBlock(false);
+ scrollbar.setValueIsAdjusting(true);
scrollbar.repaint();
}
@@ -381,6 +392,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
else
value = valueForYPosition(currentMouseY);
+ if (thumbRect.contains(currentMouseX, currentMouseY))
+ return false;
+
if (direction == POSITIVE_SCROLL)
return (value > scrollbar.getValue());
else
@@ -517,11 +531,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected JButton createIncreaseButton(int orientation)
{
- if (incrButton == null)
- incrButton = new BasicArrowButton(orientation);
- else
- ((BasicArrowButton) incrButton).setDirection(orientation);
- return incrButton;
+ return new BasicArrowButton(orientation);
}
/**
@@ -534,11 +544,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected JButton createDecreaseButton(int orientation)
{
- if (decrButton == null)
- decrButton = new BasicArrowButton(orientation);
- else
- ((BasicArrowButton) decrButton).setDirection(orientation);
- return decrButton;
+ return new BasicArrowButton(orientation);
}
/**
@@ -602,7 +608,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public Dimension getMaximumSize(JComponent c)
{
- return getPreferredSize(c);
+ return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
/**
@@ -644,7 +650,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
void calculatePreferredSize()
{
- // System.err.println(this + ".calculatePreferredSize()");
int height;
int width;
height = width = 0;
@@ -707,48 +712,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected Rectangle getThumbBounds()
{
- int max = scrollbar.getMaximum();
- int min = scrollbar.getMinimum();
- int value = scrollbar.getValue();
- int extent = scrollbar.getVisibleAmount();
-
- // System.err.println(this + ".getThumbBounds()");
- if (max == min)
- {
- thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y;
- if (scrollbar.getOrientation() == HORIZONTAL)
- {
- thumbRect.width = getMinimumThumbSize().width;
- thumbRect.height = trackRect.height;
- }
- else
- {
- thumbRect.width = trackRect.width;
- thumbRect.height = getMinimumThumbSize().height;
- }
- return thumbRect;
- }
-
- if (scrollbar.getOrientation() == HORIZONTAL)
- {
- thumbRect.x = trackRect.x;
- thumbRect.x += (value - min) * trackRect.width / (max - min);
- thumbRect.y = trackRect.y;
-
- thumbRect.width = Math.max(extent * trackRect.width / (max - min),
- getMinimumThumbSize().width);
- thumbRect.height = trackRect.height;
- }
- else
- {
- thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y + value * trackRect.height / (max - min);
-
- thumbRect.width = trackRect.width;
- thumbRect.height = Math.max(extent * trackRect.height / (max - min),
- getMinimumThumbSize().height);
- }
return thumbRect;
}
@@ -760,22 +723,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected Rectangle getTrackBounds()
{
- SwingUtilities.calculateInnerArea(scrollbar, trackRect);
-
- if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
- {
- trackRect.width -= incrButton.getPreferredSize().getWidth();
- trackRect.width -= decrButton.getPreferredSize().getWidth();
-
- trackRect.x += decrButton.getPreferredSize().getWidth();
- }
- else
- {
- trackRect.height -= incrButton.getPreferredSize().getHeight();
- trackRect.height -= decrButton.getPreferredSize().getHeight();
-
- trackRect.y += incrButton.getPreferredSize().getHeight();
- }
return trackRect;
}
@@ -785,6 +732,18 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void installComponents()
{
+ if (incrButton != null)
+ scrollbar.add(incrButton);
+ if (decrButton != null)
+ scrollbar.add(decrButton);
+ }
+
+ /**
+ * This method installs the defaults for the scrollbar specified by the
+ * Basic Look and Feel.
+ */
+ protected void installDefaults()
+ {
int orientation = scrollbar.getOrientation();
switch (orientation)
{
@@ -797,31 +756,20 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
decrButton = createDecreaseButton(NORTH);
break;
}
- scrollbar.add(incrButton);
- scrollbar.add(decrButton);
- }
-
- /**
- * This method installs the defaults for the scrollbar specified by the
- * Basic Look and Feel.
- */
- protected void installDefaults()
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- scrollbar.setForeground(defaults.getColor("ScrollBar.foreground"));
- scrollbar.setBackground(defaults.getColor("ScrollBar.background"));
- scrollbar.setBorder(defaults.getBorder("ScrollBar.border"));
+ LookAndFeel.installColors(scrollbar, "ScrollBar.background",
+ "ScrollBar.foreground");
+ LookAndFeel.installBorder(scrollbar, "ScrollBar.border");
scrollbar.setOpaque(true);
scrollbar.setLayout(this);
- thumbColor = defaults.getColor("ScrollBar.thumb");
- thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
- thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight");
- thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow");
+ thumbColor = UIManager.getColor("ScrollBar.thumb");
+ thumbDarkShadowColor = UIManager.getColor("ScrollBar.thumbDarkShadow");
+ thumbHighlightColor = UIManager.getColor("ScrollBar.thumbHighlight");
+ thumbLightShadowColor = UIManager.getColor("ScrollBar.thumbShadow");
- maximumThumbSize = defaults.getDimension("ScrollBar.maximumThumbSize");
- minimumThumbSize = defaults.getDimension("ScrollBar.minimumThumbSize");
+ maximumThumbSize = UIManager.getDimension("ScrollBar.maximumThumbSize");
+ minimumThumbSize = UIManager.getDimension("ScrollBar.minimumThumbSize");
}
/**
@@ -873,11 +821,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
trackRect = new Rectangle();
thumbRect = new Rectangle();
- scrollTimer = new Timer(200, null);
- scrollTimer.setRepeats(true);
+ scrollTimer = new Timer(300, null);
+ installDefaults();
installComponents();
- installDefaults();
configureScrollBarColors();
installListeners();
@@ -908,17 +855,20 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void layoutHScrollbar(JScrollBar sb)
{
- // All we have to do is layout the 2 buttons?
Rectangle vr = new Rectangle();
SwingUtilities.calculateInnerArea(scrollbar, vr);
- // Update the rectangles.
- getTrackBounds();
- getThumbBounds();
-
Dimension incrDims = incrButton.getPreferredSize();
Dimension decrDims = decrButton.getPreferredSize();
+
+ // calculate and update the track bounds
+ SwingUtilities.calculateInnerArea(scrollbar, trackRect);
+ trackRect.width -= incrDims.getWidth();
+ trackRect.width -= decrDims.getWidth();
+ trackRect.x += decrDims.getWidth();
+ updateThumbRect();
+
decrButton.setBounds(vr.x, vr.y, decrDims.width, trackRect.height);
incrButton.setBounds(trackRect.x + trackRect.width, vr.y, incrDims.width,
trackRect.height);
@@ -934,12 +884,16 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
Rectangle vr = new Rectangle();
SwingUtilities.calculateInnerArea(scrollbar, vr);
- // Update rectangles
- getTrackBounds();
- getThumbBounds();
-
Dimension incrDims = incrButton.getPreferredSize();
Dimension decrDims = decrButton.getPreferredSize();
+
+ // Update rectangles
+ SwingUtilities.calculateInnerArea(scrollbar, trackRect);
+ trackRect.height -= incrDims.getHeight();
+ trackRect.height -= decrDims.getHeight();
+ trackRect.y += decrDims.getHeight();
+
+ updateThumbRect();
decrButton.setBounds(vr.x, vr.y, trackRect.width, decrDims.height);
incrButton.setBounds(vr.x, trackRect.y + trackRect.height,
@@ -947,6 +901,58 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
+ * Updates the thumb rect.
+ */
+ void updateThumbRect()
+ {
+ int max = scrollbar.getMaximum();
+ int min = scrollbar.getMinimum();
+ int value = scrollbar.getValue();
+ int extent = scrollbar.getVisibleAmount();
+ if (max - extent <= min)
+ {
+ if (scrollbar.getOrientation() == JScrollBar.HORIZONTAL)
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.y = trackRect.y;
+ thumbRect.width = getMinimumThumbSize().width;
+ thumbRect.height = trackRect.height;
+ }
+ else
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.y = trackRect.y;
+ thumbRect.width = trackRect.width;
+ thumbRect.height = getMinimumThumbSize().height;
+ }
+ }
+ else
+ {
+ if (scrollbar.getOrientation() == JScrollBar.HORIZONTAL)
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.width = Math.max(extent * trackRect.width / (max - min),
+ getMinimumThumbSize().width);
+ int availableWidth = trackRect.width - thumbRect.width;
+ thumbRect.x += (value - min) * availableWidth / (max - min - extent);
+ thumbRect.y = trackRect.y;
+ thumbRect.height = trackRect.height;
+ }
+ else
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.height = Math.max(extent * trackRect.height / (max - min),
+ getMinimumThumbSize().height);
+ int availableHeight = trackRect.height - thumbRect.height;
+ thumbRect.y = trackRect.y
+ + (value - min) * availableHeight / (max - min - extent);
+ thumbRect.width = trackRect.width;
+ }
+ }
+
+ }
+
+ /**
* This method returns the minimum size required for the layout.
*
* @param scrollbarContainer The Container that is laid out.
@@ -1124,10 +1130,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void uninstallComponents()
{
- scrollbar.remove(incrButton);
- scrollbar.remove(decrButton);
- incrButton = null;
- decrButton = null;
+ if (incrButton != null)
+ scrollbar.remove(incrButton);
+ if (decrButton != null)
+ scrollbar.remove(decrButton);
}
/**
@@ -1138,7 +1144,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
scrollbar.setForeground(null);
scrollbar.setBackground(null);
- scrollbar.setBorder(null);
+ LookAndFeel.uninstallBorder(scrollbar);
+ incrButton = null;
+ decrButton = null;
}
/**
@@ -1155,17 +1163,22 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void uninstallListeners()
{
- scrollTimer.removeActionListener(scrollListener);
+ if (scrollTimer != null)
+ scrollTimer.removeActionListener(scrollListener);
- scrollbar.getModel().removeChangeListener(modelListener);
- scrollbar.removePropertyChangeListener(propertyChangeListener);
-
- decrButton.removeMouseListener(buttonListener);
- incrButton.removeMouseListener(buttonListener);
-
- scrollbar.removeMouseListener(trackListener);
- scrollbar.removeMouseMotionListener(trackListener);
+ if (scrollbar != null)
+ {
+ scrollbar.getModel().removeChangeListener(modelListener);
+ scrollbar.removePropertyChangeListener(propertyChangeListener);
+ scrollbar.removeMouseListener(trackListener);
+ scrollbar.removeMouseMotionListener(trackListener);
+ }
+ if (decrButton != null)
+ decrButton.removeMouseListener(buttonListener);
+ if (incrButton != null)
+ incrButton.removeMouseListener(buttonListener);
+
propertyChangeListener = null;
modelListener = null;
buttonListener = null;
@@ -1182,8 +1195,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void uninstallUI(JComponent c)
{
- uninstallDefaults();
uninstallListeners();
+ uninstallDefaults();
uninstallComponents();
scrollTimer = null;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
index bd1576f37a5..808ed2763e9 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
@@ -40,13 +40,21 @@ package javax.swing.plaf.basic;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
+import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
+import javax.swing.JViewport;
+import javax.swing.LookAndFeel;
import javax.swing.ScrollPaneConstants;
import javax.swing.ScrollPaneLayout;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollPaneUI;
@@ -54,9 +62,207 @@ public class BasicScrollPaneUI extends ScrollPaneUI
implements ScrollPaneConstants
{
+ /**
+ * Listens for changes in the state of the horizontal scrollbar's model and
+ * updates the scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class HSBChangeListener implements ChangeListener
+ {
+
+ /**
+ * Receives notification when the state of the horizontal scrollbar
+ * model has changed.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ JScrollBar hsb = scrollpane.getHorizontalScrollBar();
+ JViewport vp = scrollpane.getViewport();
+ Point viewPosition = vp.getViewPosition();
+ int xpos = hsb.getValue();
+
+ if (xpos != viewPosition.x)
+ {
+ viewPosition.x = xpos;
+ vp.setViewPosition(viewPosition);
+ }
+
+ viewPosition.y = 0;
+ JViewport columnHeader = scrollpane.getColumnHeader();
+ if (columnHeader != null
+ && !columnHeader.getViewPosition().equals(viewPosition))
+ columnHeader.setViewPosition(viewPosition);
+ }
+
+ }
+
+ /**
+ * Listens for changes in the state of the vertical scrollbar's model and
+ * updates the scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class VSBChangeListener implements ChangeListener
+ {
+
+ /**
+ * Receives notification when the state of the vertical scrollbar
+ * model has changed.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ JScrollBar vsb = scrollpane.getVerticalScrollBar();
+ JViewport vp = scrollpane.getViewport();
+ Point viewPosition = vp.getViewPosition();
+ int ypos = vsb.getValue();
+ if (ypos != viewPosition.y)
+ {
+ viewPosition.y = ypos;
+ vp.setViewPosition(viewPosition);
+ }
+
+ viewPosition.x = 0;
+ JViewport rowHeader = scrollpane.getRowHeader();
+ if (rowHeader != null
+ && !rowHeader.getViewPosition().equals(viewPosition))
+ rowHeader.setViewPosition(viewPosition);
+ }
+
+ }
+
+ /**
+ * Listens for changes of the viewport's extent size and updates the
+ * scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class ViewportChangeHandler implements ChangeListener
+ {
+
+ /**
+ * Receives notification when the view's size, position or extent size
+ * changes. When the extents size has changed, this method calls
+ * {@link BasicScrollPaneUI#syncScrollPaneWithViewport()} to adjust the
+ * scrollbars extents as well.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ JViewport vp = scrollpane.getViewport();
+ JScrollBar hsb = scrollpane.getHorizontalScrollBar();
+ JScrollBar vsb = scrollpane.getVerticalScrollBar();
+ syncScrollPaneWithViewport();
+ }
+
+ }
+
+ /**
+ * Listens for property changes on the scrollpane and update the view
+ * accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class PropertyChangeHandler implements PropertyChangeListener
+ {
+
+ /**
+ * Receives notification when any of the scrollpane's bound property
+ * changes. This method calls the appropriate update method on the
+ * <code>ScrollBarUI</code>.
+ *
+ * @param e the property change event
+ *
+ * @see BasicScrollPaneUI#updateColumnHeader(PropertyChangeEvent)
+ * @see BasicScrollPaneUI#updateRowHeader(PropertyChangeEvent)
+ * @see BasicScrollPaneUI#updateScrollBarDisplayPolicy(PropertyChangeEvent)
+ * @see BasicScrollPaneUI#updateViewport(PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propName = e.getPropertyName();
+ if (propName.equals("viewport"))
+ updateViewport(e);
+ else if (propName.equals("rowHeader"))
+ updateRowHeader(e);
+ else if (propName.equals("columnHeader"))
+ updateColumnHeader(e);
+ else if (propName.equals("horizontalScrollBarPolicy")
+ || e.getPropertyName().equals("verticalScrollBarPolicy"))
+ updateScrollBarDisplayPolicy(e);
+ else if (propName.equals("verticalScrollBar"))
+ {
+ JScrollBar oldSb = (JScrollBar) e.getOldValue();
+ oldSb.getModel().removeChangeListener(vsbChangeListener);
+ JScrollBar newSb = (JScrollBar) e.getNewValue();
+ newSb.getModel().addChangeListener(vsbChangeListener);
+ }
+ else if (propName.equals("horizontalScrollBar"))
+ {
+ JScrollBar oldSb = (JScrollBar) e.getOldValue();
+ oldSb.getModel().removeChangeListener(hsbChangeListener);
+ JScrollBar newSb = (JScrollBar) e.getNewValue();
+ newSb.getModel().addChangeListener(hsbChangeListener);
+ }
+ }
+
+ }
+
+ /**
+ * Listens for mouse wheel events and update the scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ *
+ * @since 1.4
+ */
+ protected class MouseWheelHandler implements MouseWheelListener
+ {
+
+ /**
+ * Receives notification whenever the mouse wheel is moved.
+ *
+ * @param event the mouse wheel event
+ */
+ public void mouseWheelMoved(MouseWheelEvent event)
+ {
+ // TODO: Implement this properly.
+ }
+
+ }
+
/** The Scrollpane for which the UI is provided by this class. */
protected JScrollPane scrollpane;
+ /**
+ * The horizontal scrollbar listener.
+ */
+ protected ChangeListener hsbChangeListener;
+
+ /**
+ * The vertical scrollbar listener.
+ */
+ protected ChangeListener vsbChangeListener;
+
+ /**
+ * The viewport listener.
+ */
+ protected ChangeListener viewportChangeListener;
+
+ /**
+ * The scrollpane property change listener.
+ */
+ protected PropertyChangeListener spPropertyChangeListener;
+
+ /**
+ * The mousewheel listener for the scrollpane.
+ */
+ MouseWheelListener mouseWheelListener;
+
public static ComponentUI createUI(final JComponent c)
{
return new BasicScrollPaneUI();
@@ -65,11 +271,10 @@ public class BasicScrollPaneUI extends ScrollPaneUI
protected void installDefaults(JScrollPane p)
{
scrollpane = p;
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- p.setForeground(defaults.getColor("ScrollPane.foreground"));
- p.setBackground(defaults.getColor("ScrollPane.background"));
- p.setFont(defaults.getFont("ScrollPane.font"));
- p.setBorder(defaults.getBorder("ScrollPane.border"));
+ LookAndFeel.installColorsAndFont(p, "ScrollPane.background",
+ "ScrollPane.foreground",
+ "ScrollPane.font");
+ LookAndFeel.installBorder(p, "ScrollPane.border");
p.setOpaque(true);
}
@@ -85,16 +290,141 @@ public class BasicScrollPaneUI extends ScrollPaneUI
public void installUI(final JComponent c)
{
super.installUI(c);
- this.installDefaults((JScrollPane)c);
+ installDefaults((JScrollPane) c);
+ installListeners((JScrollPane) c);
+ installKeyboardActions((JScrollPane) c);
+ }
+
+ /**
+ * Installs the listeners on the scrollbars, the viewport and the scrollpane.
+ *
+ * @param sp the scrollpane on which to install the listeners
+ */
+ protected void installListeners(JScrollPane sp)
+ {
+ if (spPropertyChangeListener == null)
+ spPropertyChangeListener = createPropertyChangeListener();
+ sp.addPropertyChangeListener(spPropertyChangeListener);
+
+ if (hsbChangeListener == null)
+ hsbChangeListener = createHSBChangeListener();
+ sp.getHorizontalScrollBar().getModel().addChangeListener(hsbChangeListener);
+
+ if (vsbChangeListener == null)
+ vsbChangeListener = createVSBChangeListener();
+ sp.getVerticalScrollBar().getModel().addChangeListener(vsbChangeListener);
+
+ if (viewportChangeListener == null)
+ viewportChangeListener = createViewportChangeListener();
+ sp.getViewport().addChangeListener(viewportChangeListener);
+
+ if (mouseWheelListener == null)
+ mouseWheelListener = createMouseWheelListener();
+ sp.addMouseWheelListener(mouseWheelListener);
+ }
+
+ /**
+ * Installs additional keyboard actions on the scrollpane. This is a hook
+ * method provided to subclasses in order to install their own keyboard
+ * actions.
+ *
+ * @param sp the scrollpane to install keyboard actions on
+ */
+ protected void installKeyboardActions(JScrollPane sp)
+ {
+ // TODO: Is this only a hook method or should we actually do something
+ // here? If the latter, than figure out what and implement this.
+ }
+
+ /**
+ * Creates and returns the change listener for the horizontal scrollbar.
+ *
+ * @return the change listener for the horizontal scrollbar
+ */
+ protected ChangeListener createHSBChangeListener()
+ {
+ return new HSBChangeListener();
+ }
+
+ /**
+ * Creates and returns the change listener for the vertical scrollbar.
+ *
+ * @return the change listener for the vertical scrollbar
+ */
+ protected ChangeListener createVSBChangeListener()
+ {
+ return new VSBChangeListener();
+ }
+
+ /**
+ * Creates and returns the change listener for the viewport.
+ *
+ * @return the change listener for the viewport
+ */
+ protected ChangeListener createViewportChangeListener()
+ {
+ return new ViewportChangeHandler();
+ }
+
+ /**
+ * Creates and returns the property change listener for the scrollpane.
+ *
+ * @return the property change listener for the scrollpane
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * Creates and returns the mouse wheel listener for the scrollpane.
+ *
+ * @return the mouse wheel listener for the scrollpane
+ */
+ protected MouseWheelListener createMouseWheelListener()
+ {
+ return new MouseWheelHandler();
}
public void uninstallUI(final JComponent c)
{
super.uninstallUI(c);
this.uninstallDefaults((JScrollPane)c);
+ uninstallListeners((JScrollPane) c);
+ installKeyboardActions((JScrollPane) c);
+ }
+
+ /**
+ * Uninstalls all the listeners that have been installed in
+ * {@link #installListeners(JScrollPane)}.
+ *
+ * @param c the scrollpane from which to uninstall the listeners
+ */
+ protected void uninstallListeners(JComponent c)
+ {
+ JScrollPane sp = (JScrollPane) c;
+ sp.removePropertyChangeListener(spPropertyChangeListener);
+ sp.getHorizontalScrollBar().getModel()
+ .removeChangeListener(hsbChangeListener);
+ sp.getVerticalScrollBar().getModel()
+ .removeChangeListener(vsbChangeListener);
+ sp.getViewport().removeChangeListener(viewportChangeListener);
+ sp.removeMouseWheelListener(mouseWheelListener);
+ }
+
+ /**
+ * Uninstalls all keyboard actions from the JScrollPane that have been
+ * installed by {@link #installKeyboardActions}. This is a hook method
+ * provided to subclasses to add their own keyboard actions.
+ *
+ * @param sp the scrollpane to uninstall keyboard actions from
+ */
+ protected void uninstallKeyboardActions(JScrollPane sp)
+ {
+ // TODO: Is this only a hook method or should we actually do something
+ // here? If the latter, than figure out what and implement this.
}
-
public Dimension getMinimumSize(JComponent c)
{
JScrollPane p = (JScrollPane ) c;
@@ -107,6 +437,76 @@ public class BasicScrollPaneUI extends ScrollPaneUI
// do nothing; the normal painting-of-children algorithm, along with
// ScrollPaneLayout, does all the relevant work.
}
+
+ /**
+ * Synchronizes the scrollbars with the viewport's extents.
+ */
+ protected void syncScrollPaneWithViewport()
+ {
+ JViewport vp = scrollpane.getViewport();
+
+ // Update the horizontal scrollbar.
+ JScrollBar hsb = scrollpane.getHorizontalScrollBar();
+ hsb.setMaximum(vp.getViewSize().width);
+ hsb.setValue(vp.getViewPosition().x);
+ hsb.setVisibleAmount(vp.getExtentSize().width);
+
+ // Update the vertical scrollbar.
+ JScrollBar vsb = scrollpane.getVerticalScrollBar();
+ vsb.setMaximum(vp.getViewSize().height);
+ vsb.setValue(vp.getViewPosition().y);
+ vsb.setVisibleAmount(vp.getExtentSize().height);
+ }
+
+ /**
+ * Receives notification when the <code>columnHeader</code> property has
+ * changed on the scrollpane.
+ *
+ * @param ev the property change event
+ */
+ protected void updateColumnHeader(PropertyChangeEvent ev)
+ {
+ // TODO: Find out what should be done here. Or is this only a hook?
+ }
+
+ /**
+ * Receives notification when the <code>rowHeader</code> property has changed
+ * on the scrollpane.
+ *
+ * @param ev the property change event
+ */
+ protected void updateRowHeader(PropertyChangeEvent ev)
+ {
+ // TODO: Find out what should be done here. Or is this only a hook?
+ }
+
+ /**
+ * Receives notification when the <code>scrollBarDisplayPolicy</code>
+ * property has changed on the scrollpane.
+ *
+ * @param ev the property change event
+ */
+ protected void updateScrollBarDisplayPolicy(PropertyChangeEvent ev)
+ {
+ // TODO: Find out what should be done here. Or is this only a hook?
+ }
+
+ /**
+ * Receives notification when the <code>viewport</code> property has changed
+ * on the scrollpane.
+ *
+ * This method sets removes the viewportChangeListener from the old viewport
+ * and adds it to the new viewport.
+ *
+ * @param ev the property change event
+ */
+ protected void updateViewport(PropertyChangeEvent ev)
+ {
+ JViewport oldViewport = (JViewport) ev.getOldValue();
+ oldViewport.removeChangeListener(viewportChangeListener);
+ JViewport newViewport = (JViewport) ev.getNewValue();
+ oldViewport.addChangeListener(viewportChangeListener);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java
index 38c9c7a2820..97caa3af7bd 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java
@@ -41,13 +41,11 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.JComponent;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SeparatorUI;
@@ -121,10 +119,8 @@ public class BasicSeparatorUI extends SeparatorUI
*/
protected void installDefaults(JSeparator s)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- shadow = defaults.getColor("Separator.shadow");
- highlight = defaults.getColor("Separator.highlight");
+ shadow = UIManager.getColor("Separator.shadow");
+ highlight = UIManager.getColor("Separator.highlight");
s.setOpaque(false);
}
@@ -165,8 +161,8 @@ public class BasicSeparatorUI extends SeparatorUI
/**
* The separator is made of two lines. The top line will be
- * the highlight color (or left line if it's vertical). The bottom
- * or right line will be the shadow color. The two lines will
+ * the shadow color (or left line if it's vertical). The bottom
+ * or right line will be the highlight color. The two lines will
* be centered inside the bounds box. If the separator is horizontal,
* then it will be vertically centered, or if it's vertical, it will
* be horizontally centered.
@@ -180,9 +176,6 @@ public class BasicSeparatorUI extends SeparatorUI
SwingUtilities.calculateInnerArea(c, r);
Color saved = g.getColor();
- int midAB = r.width / 2 + r.x;
- int midAD = r.height / 2 + r.y;
-
JSeparator s;
if (c instanceof JSeparator)
s = (JSeparator) c;
@@ -190,21 +183,24 @@ public class BasicSeparatorUI extends SeparatorUI
return;
if (s.getOrientation() == JSeparator.HORIZONTAL)
- {
- g.setColor(highlight);
- g.drawLine(r.x, midAD, r.x + r.width, midAD);
-
- g.setColor(shadow);
- g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1);
- }
- else
- {
- g.setColor(highlight);
- g.drawLine(midAB, r.y, midAB, r.y + r.height);
-
- g.setColor(shadow);
- g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height);
- }
+ {
+ int midAB = r.height / 2;
+ g.setColor(shadow);
+ g.drawLine(r.x, r.y + midAB - 1, r.x + r.width, r.y + midAB - 1);
+
+ g.setColor(highlight);
+ g.fillRect(r.x, r.y + midAB, r.x + r.width, r.y + midAB);
+ }
+ else
+ {
+ int midAD = r.height / 2 + r.y;
+ g.setColor(shadow);
+ g.drawLine(r.x, r.y, r.x, r.y + r.height);
+
+ g.setColor(highlight);
+ g.fillRect(r.x + midAD, r.y + r.height, r.x + midAD, r.y + r.height);
+ }
+ g.setColor(saved);
}
/**
@@ -217,28 +213,14 @@ public class BasicSeparatorUI extends SeparatorUI
*/
public Dimension getPreferredSize(JComponent c)
{
- Dimension dims = new Dimension(0, 0);
- Insets insets = c.getInsets();
-
+ Dimension pref = new Dimension(2, 0);
if (c instanceof JSeparator)
{
JSeparator s = (JSeparator) c;
-
if (s.getOrientation() == JSeparator.HORIZONTAL)
- {
- dims.height = 2;
- dims.width = 40;
- }
- else
- {
- dims.width = 2;
- dims.height = 40;
- }
+ pref = new Dimension(0, 2);
}
- dims.width += insets.left + insets.right;
- dims.height += insets.top + insets.bottom;
-
- return dims;
+ return pref;
}
/**
@@ -251,7 +233,7 @@ public class BasicSeparatorUI extends SeparatorUI
*/
public Dimension getMinimumSize(JComponent c)
{
- return getPreferredSize(c);
+ return new Dimension(0, 0);
}
/**
@@ -264,6 +246,7 @@ public class BasicSeparatorUI extends SeparatorUI
*/
public Dimension getMaximumSize(JComponent c)
{
- return getPreferredSize(c);
+ return new Dimension(Short.MAX_VALUE,
+ Short.MAX_VALUE);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
index 0b4058429c5..26f58051902 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
@@ -60,13 +60,14 @@ import java.beans.PropertyChangeListener;
import java.util.Dictionary;
import java.util.Enumeration;
+import javax.swing.AbstractAction;
import javax.swing.BoundedRangeModel;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JSlider;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -470,6 +471,34 @@ public class BasicSliderUI extends SliderUI
}
}
+ /**
+ * This class is no longer used as of JDK1.3.
+ */
+ public class ActionScroller extends AbstractAction
+ {
+ /**
+ * Not used.
+ *
+ * @param slider not used
+ * @param dir not used
+ * @param block not used
+ */
+ public ActionScroller(JSlider slider, int dir, boolean block)
+ {
+ // Not used.
+ }
+
+ /**
+ * Not used.
+ *
+ * @param event not used
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ // Not used.
+ }
+ }
+
/** Listener for changes from the model. */
protected ChangeListener changeListener;
@@ -680,16 +709,14 @@ public class BasicSliderUI extends SliderUI
*/
protected void installDefaults(JSlider slider)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- slider.setForeground(defaults.getColor("Slider.foreground"));
- slider.setBackground(defaults.getColor("Slider.background"));
- shadowColor = defaults.getColor("Slider.shadow");
- highlightColor = defaults.getColor("Slider.highlight");
- focusColor = defaults.getColor("Slider.focus");
- slider.setBorder(defaults.getBorder("Slider.border"));
+ LookAndFeel.installColors(slider, "Slider.background",
+ "Slider.foreground");
+ LookAndFeel.installBorder(slider, "Slider.border");
+ shadowColor = UIManager.getColor("Slider.shadow");
+ highlightColor = UIManager.getColor("Slider.highlight");
+ focusColor = UIManager.getColor("Slider.focus");
+ focusInsets = UIManager.getInsets("Slider.focusInsets");
slider.setOpaque(true);
- focusInsets = defaults.getInsets("Slider.focusInsets");
}
/**
@@ -1465,7 +1492,7 @@ public class BasicSliderUI extends SliderUI
// FIXME: Move this to propertyChangeEvent handler, when we get those.
leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT;
// FIXME: This next line is only here because the above line is here.
- calculateThumbLocation();
+ calculateGeometry();
if (slider.getPaintTrack())
paintTrack(g);
@@ -1958,7 +1985,7 @@ public class BasicSliderUI extends SliderUI
public void paintThumb(Graphics g)
{
Color saved_color = g.getColor();
-
+
Point a = new Point(thumbRect.x, thumbRect.y);
Point b = new Point(a);
Point c = new Point(a);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java
index 97ab97b8972..3b7399eafaa 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -53,9 +53,8 @@ import java.beans.PropertyChangeListener;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JSpinner;
+import javax.swing.LookAndFeel;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SpinnerUI;
@@ -167,16 +166,9 @@ public class BasicSpinnerUI extends SpinnerUI
*/
protected void installDefaults()
{
- /* most of it copied from BasicLabelUI, I don't know what keys are
- available, so someone may want to update this. Hence: TODO
- */
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- /*
- spinner.setForeground(defaults.getColor("Spinner.foreground"));
- spinner.setBackground(defaults.getColor("Spinner.background"));
- spinner.setFont(defaults.getFont("Spinner.font"));
- spinner.setBorder(defaults.getBorder("Spinner.border"));
- */
+ LookAndFeel.installColorsAndFont(spinner, "Spinner.background",
+ "Spinner.foreground", "Spinner.font");
+ LookAndFeel.installBorder(spinner, "Spinner.border");
spinner.setLayout(createLayout());
spinner.setOpaque(true);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
index b8674ed2f08..69ed2be7c61 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
@@ -802,6 +802,7 @@ public class BasicSplitPaneDivider extends Container
*/
protected DividerLayout()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
index ef8e2282349..746f628df6f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
@@ -58,7 +58,7 @@ import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JSplitPane;
import javax.swing.KeyStroke;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SplitPaneUI;
@@ -404,7 +404,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
protected void setComponentToSize(Component c, int size, int location,
Insets insets, Dimension containerSize)
- {
+ {
int w = size;
int h = containerSize.height - insets.top - insets.bottom;
int x = location;
@@ -637,7 +637,6 @@ public class BasicSplitPaneUI extends SplitPaneUI
int x = insets.left;
int h = size;
int w = containerSize.width - insets.left - insets.right;
-
c.setBounds(x, y, w, h);
}
@@ -817,15 +816,12 @@ public class BasicSplitPaneUI extends SplitPaneUI
int newSize = splitPane.getDividerSize();
int[] tmpSizes = layoutManager.getSizes();
dividerSize = tmpSizes[2];
- Component left = splitPane.getLeftComponent();
- Component right = splitPane.getRightComponent();
- int newSpace = newSize - tmpSizes[2];
-
+ int newSpace = newSize - tmpSizes[2];
tmpSizes[2] = newSize;
tmpSizes[0] += newSpace / 2;
tmpSizes[1] += newSpace / 2;
-
+
layoutManager.setSizes(tmpSizes);
}
else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY))
@@ -942,6 +938,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public BasicSplitPaneUI()
{
+ // Nothing to do here.
}
/**
@@ -991,16 +988,16 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
protected void installDefaults()
{
+ LookAndFeel.installColors(splitPane, "SplitPane.background",
+ "SplitPane.foreground");
+ LookAndFeel.installBorder(splitPane, "SplitPane.border");
divider = createDefaultDivider();
resetLayoutManager();
nonContinuousLayoutDivider = createDefaultNonContinuousLayoutDivider();
splitPane.add(divider, JSplitPane.DIVIDER);
// There is no need to add the nonContinuousLayoutDivider
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- splitPane.setBackground(defaults.getColor("SplitPane.background"));
- splitPane.setBorder(defaults.getBorder("SplitPane.border"));
- splitPane.setDividerSize(defaults.getInt("SplitPane.dividerSize"));
+ splitPane.setDividerSize(UIManager.getInt("SplitPane.dividerSize"));
splitPane.setOpaque(true);
}
@@ -1301,15 +1298,41 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public void setDividerLocation(JSplitPane jc, int location)
{
+ location = validLocation(location);
+ Container p = jc.getParent();
+ Dimension rightPrefSize = jc.getRightComponent().getPreferredSize();
+ Dimension size = jc.getSize();
+ // check if the size has been set for the splitpane
+ if (size.width == 0 && size.height == 0)
+ size = jc.getPreferredSize();
+
+ if (getOrientation() == 0 && location > size.height)
+ {
+ location = size.height;
+ while (p != null)
+ {
+ p.setSize(p.getWidth(), p.getHeight() + rightPrefSize.height);
+ p = p.getParent();
+ }
+ }
+ else if (location > size.width)
+ {
+ location = size.width;
+ while (p != null)
+ {
+ p.setSize(p.getWidth() + rightPrefSize.width, p.getHeight());
+ p = p.getParent();
+ }
+ }
+
setLastDragLocation(getDividerLocation(splitPane));
splitPane.setLastDividerLocation(getDividerLocation(splitPane));
int[] tmpSizes = layoutManager.getSizes();
- tmpSizes[0] = location
+ tmpSizes[0] = location
- layoutManager.getInitialLocation(splitPane.getInsets());
tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(),
splitPane.getInsets())
- - tmpSizes[0] - tmpSizes[1];
-
+ - tmpSizes[0];
layoutManager.setSizes(tmpSizes);
splitPane.revalidate();
splitPane.repaint();
@@ -1338,11 +1361,9 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public int getMinimumDividerLocation(JSplitPane jc)
{
- int value = layoutManager.getInitialLocation(jc.getInsets())
- - layoutManager.getAvailableSize(jc.getSize(), jc.getInsets())
- + splitPane.getDividerSize();
- if (layoutManager.components[1] != null)
- value += layoutManager.minimumSizeOfComponent(1);
+ int value = layoutManager.getInitialLocation(jc.getInsets());
+ if (layoutManager.components[0] != null)
+ value -= layoutManager.minimumSizeOfComponent(0);
return value;
}
@@ -1388,6 +1409,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public void paint(Graphics g, JComponent jc)
{
+ // TODO: What should be done here?
}
/**
@@ -1550,10 +1572,12 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
private int validLocation(int location)
{
- if (location < getMinimumDividerLocation(splitPane))
- return getMinimumDividerLocation(splitPane);
- if (location > getMaximumDividerLocation(splitPane))
- return getMaximumDividerLocation(splitPane);
+ int min = getMinimumDividerLocation(splitPane);
+ int max = getMaximumDividerLocation(splitPane);
+ if (min > 0 && location < min)
+ return min;
+ if (max > 0 && location > max)
+ return max;
return location;
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index 7e9d9b9820c..ce9ea3ec7f1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -64,9 +64,9 @@ import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -136,36 +136,36 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
{
- if (e.getSource() == incrButton)
- {
- if (++currentScrollLocation >= tabCount)
- currentScrollLocation = tabCount - 1;
-
- int width = 0;
- for (int i = currentScrollLocation - 1; i < tabCount; i++)
- width += rects[i].width;
- if (width < viewport.getWidth())
- // FIXME: Still getting mouse events after the button is disabled.
- // incrButton.setEnabled(false);
- currentScrollLocation--;
- else if (! decrButton.isEnabled())
- decrButton.setEnabled(true);
- tabPane.revalidate();
- tabPane.repaint();
- return;
- }
- else if (e.getSource() == decrButton)
- {
- if (--currentScrollLocation < 0)
- currentScrollLocation = 0;
- if (currentScrollLocation == 0)
- decrButton.setEnabled(false);
- else if (! incrButton.isEnabled())
- incrButton.setEnabled(true);
- tabPane.revalidate();
- tabPane.repaint();
- return;
- }
+ if (e.getSource() == incrButton)
+ {
+ if (++currentScrollLocation >= tabCount)
+ currentScrollLocation = tabCount - 1;
+
+ int width = 0;
+ for (int i = currentScrollLocation - 1; i < tabCount; i++)
+ width += rects[i].width;
+ if (width < viewport.getWidth())
+ // FIXME: Still getting mouse events after the button is disabled.
+ // incrButton.setEnabled(false);
+ currentScrollLocation--;
+ else if (! decrButton.isEnabled())
+ decrButton.setEnabled(true);
+ tabPane.revalidate();
+ tabPane.repaint();
+ return;
+ }
+ else if (e.getSource() == decrButton)
+ {
+ if (--currentScrollLocation < 0)
+ currentScrollLocation = 0;
+ if (currentScrollLocation == 0)
+ decrButton.setEnabled(false);
+ else if (! incrButton.isEnabled())
+ incrButton.setEnabled(true);
+ tabPane.revalidate();
+ tabPane.repaint();
+ return;
+ }
}
int index = tabForCoordinate(tabPane, x, y);
@@ -173,7 +173,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// We need to check since there are areas where tabs cannot be
// e.g. in the inset area.
if (index != -1 && tabPane.isEnabledAt(index))
- tabPane.setSelectedIndex(index);
+ tabPane.setSelectedIndex(index);
tabPane.revalidate();
tabPane.repaint();
}
@@ -198,15 +198,15 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
if (e.getPropertyName().equals("tabLayoutPolicy"))
{
- layoutManager = createLayoutManager();
-
- tabPane.setLayout(layoutManager);
+ layoutManager = createLayoutManager();
+
+ tabPane.setLayout(layoutManager);
}
else if (e.getPropertyName().equals("tabPlacement")
- && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
{
- incrButton = createIncreaseButton();
- decrButton = createDecreaseButton();
+ incrButton = createIncreaseButton();
+ decrButton = createDecreaseButton();
}
tabPane.layout();
tabPane.repaint();
@@ -245,13 +245,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPane.getSelectedIndex() != -1)
{
- Component visible = getVisibleComponent();
- Insets insets = getContentBorderInsets(tabPane.getTabPlacement());
- if (visible != null)
- visible.setBounds(contentRect.x + insets.left,
- contentRect.y + insets.top,
- contentRect.width - insets.left - insets.right,
- contentRect.height - insets.top - insets.bottom);
+ Component visible = getVisibleComponent();
+ Insets insets = getContentBorderInsets(tabPane.getTabPlacement());
+ if (visible != null)
+ visible.setBounds(contentRect.x + insets.left,
+ contentRect.y + insets.top,
+ contentRect.width - insets.left - insets.right,
+ contentRect.height - insets.top - insets.bottom);
}
}
@@ -275,35 +275,35 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Dimension dims;
for (int i = 0; i < tabPane.getTabCount(); i++)
{
- c = tabPane.getComponentAt(i);
- if (c == null)
- continue;
- calcRect = c.getBounds();
- dims = c.getPreferredSize();
- if (dims != null)
- {
- componentHeight = Math.max(componentHeight, dims.height);
- componentWidth = Math.max(componentWidth, dims.width);
- }
+ c = tabPane.getComponentAt(i);
+ if (c == null)
+ continue;
+ calcRect = c.getBounds();
+ dims = c.getPreferredSize();
+ if (dims != null)
+ {
+ componentHeight = Math.max(componentHeight, dims.height);
+ componentWidth = Math.max(componentWidth, dims.width);
+ }
}
Insets insets = tabPane.getInsets();
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int min = calculateMaxTabWidth(tabPlacement);
- width = Math.max(min, componentWidth);
-
- int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width);
- height = tabAreaHeight + componentHeight;
+ int min = calculateMaxTabWidth(tabPlacement);
+ width = Math.max(min, componentWidth);
+
+ int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width);
+ height = tabAreaHeight + componentHeight;
}
else
{
- int min = calculateMaxTabHeight(tabPlacement);
- height = Math.max(min, componentHeight);
-
- int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height);
- width = tabAreaWidth + componentWidth;
+ int min = calculateMaxTabHeight(tabPlacement);
+ height = Math.max(min, componentHeight);
+
+ int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height);
+ width = tabAreaWidth + componentWidth;
}
return new Dimension(width, height);
@@ -330,7 +330,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected void calculateTabRects(int tabPlacement, int tabCount)
{
if (tabCount == 0)
- return;
+ return;
assureRectsCreated(tabCount);
FontMetrics fm = getFontMetrics();
@@ -343,113 +343,112 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int maxHeight = calculateMaxTabHeight(tabPlacement);
-
- calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
- max = calcRect.width + tabAreaInsets.left + insets.left;
- start += tabAreaInsets.left + insets.left;
- int width = 0;
- int runWidth = start;
-
- for (int i = 0; i < tabCount; i++)
- {
- width = calculateTabWidth(tabPlacement, i, fm);
-
- if (runWidth + width > max)
- {
- runWidth = tabAreaInsets.left + insets.left
- + getTabRunIndent(tabPlacement, ++runs);
- rects[i] = new Rectangle(runWidth,
- insets.top + tabAreaInsets.top,
- width, maxHeight);
- runWidth += width;
- if (runs > tabRuns.length - 1)
- expandTabRunsArray();
- tabRuns[runs] = i;
- }
- else
- {
- rects[i] = new Rectangle(runWidth,
- insets.top + tabAreaInsets.top,
- width, maxHeight);
- runWidth += width;
- }
- }
- runs++;
- tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
- tabAreaRect.height = runs * maxTabHeight
- - (runs - 1) * tabRunOverlay
- + tabAreaInsets.top + tabAreaInsets.bottom;
- contentRect.width = tabAreaRect.width;
- contentRect.height = tabPane.getHeight() - insets.top
- - insets.bottom - tabAreaRect.height;
- contentRect.x = insets.left;
- tabAreaRect.x = insets.left;
- if (tabPlacement == SwingConstants.BOTTOM)
- {
- contentRect.y = insets.top;
- tabAreaRect.y = contentRect.y + contentRect.height;
- }
- else
- {
- tabAreaRect.y = insets.top;
- contentRect.y = tabAreaRect.y + tabAreaRect.height;
- }
+ int maxHeight = calculateMaxTabHeight(tabPlacement);
+
+ calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
+ max = calcRect.width + tabAreaInsets.left + insets.left;
+ start += tabAreaInsets.left + insets.left;
+ int width = 0;
+ int runWidth = start;
+
+ for (int i = 0; i < tabCount; i++)
+ {
+ width = calculateTabWidth(tabPlacement, i, fm);
+ if (runWidth + width > max)
+ {
+ runWidth = tabAreaInsets.left + insets.left
+ + getTabRunIndent(tabPlacement, ++runs);
+ rects[i] = new Rectangle(runWidth,
+ insets.top + tabAreaInsets.top,
+ width, maxHeight);
+ runWidth += width;
+ if (runs > tabRuns.length - 1)
+ expandTabRunsArray();
+ tabRuns[runs] = i;
+ }
+ else
+ {
+ rects[i] = new Rectangle(runWidth,
+ insets.top + tabAreaInsets.top,
+ width, maxHeight);
+ runWidth += width;
+ }
+ }
+ runs++;
+ tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
+ tabAreaRect.height = runs * maxTabHeight
+ - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.top + tabAreaInsets.bottom;
+ contentRect.width = tabAreaRect.width;
+ contentRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom - tabAreaRect.height;
+ contentRect.x = insets.left;
+ tabAreaRect.x = insets.left;
+ if (tabPlacement == SwingConstants.BOTTOM)
+ {
+ contentRect.y = insets.top;
+ tabAreaRect.y = contentRect.y + contentRect.height;
+ }
+ else
+ {
+ tabAreaRect.y = insets.top;
+ contentRect.y = tabAreaRect.y + tabAreaRect.height;
+ }
}
else
{
- int maxWidth = calculateMaxTabWidth(tabPlacement);
- calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
- max = calcRect.height + tabAreaInsets.top + insets.top;
-
- int height = 0;
- start += tabAreaInsets.top + insets.top;
- int runHeight = start;
-
- int fontHeight = fm.getHeight();
-
- for (int i = 0; i < tabCount; i++)
- {
- height = calculateTabHeight(tabPlacement, i, fontHeight);
- if (runHeight + height > max)
- {
- runHeight = tabAreaInsets.top + insets.top
- + getTabRunIndent(tabPlacement, ++runs);
- rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
- runHeight, maxWidth, height);
- runHeight += height;
- if (runs > tabRuns.length - 1)
- expandTabRunsArray();
- tabRuns[runs] = i;
- }
- else
- {
- rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
- runHeight, maxWidth, height);
- runHeight += height;
- }
- }
- runs++;
-
- tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
- + tabAreaInsets.left + tabAreaInsets.right;
- tabAreaRect.height = tabPane.getHeight() - insets.top
- - insets.bottom;
- tabAreaRect.y = insets.top;
- contentRect.width = tabPane.getWidth() - insets.left - insets.right
- - tabAreaRect.width;
- contentRect.height = tabAreaRect.height;
- contentRect.y = insets.top;
- if (tabPlacement == SwingConstants.LEFT)
- {
- tabAreaRect.x = insets.left;
- contentRect.x = tabAreaRect.x + tabAreaRect.width;
- }
- else
- {
- contentRect.x = insets.left;
- tabAreaRect.x = contentRect.x + contentRect.width;
- }
+ int maxWidth = calculateMaxTabWidth(tabPlacement);
+ calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
+ max = calcRect.height + tabAreaInsets.top + insets.top;
+
+ int height = 0;
+ start += tabAreaInsets.top + insets.top;
+ int runHeight = start;
+
+ int fontHeight = fm.getHeight();
+
+ for (int i = 0; i < tabCount; i++)
+ {
+ height = calculateTabHeight(tabPlacement, i, fontHeight);
+ if (runHeight + height > max)
+ {
+ runHeight = tabAreaInsets.top + insets.top
+ + getTabRunIndent(tabPlacement, ++runs);
+ rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
+ runHeight, maxWidth, height);
+ runHeight += height;
+ if (runs > tabRuns.length - 1)
+ expandTabRunsArray();
+ tabRuns[runs] = i;
+ }
+ else
+ {
+ rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
+ runHeight, maxWidth, height);
+ runHeight += height;
+ }
+ }
+ runs++;
+
+ tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.left + tabAreaInsets.right;
+ tabAreaRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom;
+ tabAreaRect.y = insets.top;
+ contentRect.width = tabPane.getWidth() - insets.left - insets.right
+ - tabAreaRect.width;
+ contentRect.height = tabAreaRect.height;
+ contentRect.y = insets.top;
+ if (tabPlacement == SwingConstants.LEFT)
+ {
+ tabAreaRect.x = insets.left;
+ contentRect.x = tabAreaRect.x + tabAreaRect.width;
+ }
+ else
+ {
+ contentRect.x = insets.left;
+ tabAreaRect.x = contentRect.x + contentRect.width;
+ }
}
runCount = runs;
@@ -457,62 +456,62 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
normalizeTabRuns(tabPlacement, tabCount, start, max);
selectedRun = getRunForTab(tabCount, tabPane.getSelectedIndex());
if (shouldRotateTabRuns(tabPlacement))
- rotateTabRuns(tabPlacement, selectedRun);
+ rotateTabRuns(tabPlacement, selectedRun);
// Need to pad the runs and move them to the correct location.
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
- if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, i);
- if (shouldPadTabRun(tabPlacement, i))
- padTabRun(tabPlacement, first, last, max);
-
- // Done padding, now need to move it.
- if (tabPlacement == SwingConstants.TOP && i > 0)
- {
- for (int j = first; j <= last; j++)
- rects[j].y += (runCount - i) * maxTabHeight
- - (runCount - i) * tabRunOverlay;
- }
-
- if (tabPlacement == SwingConstants.BOTTOM)
- {
- int height = tabPane.getBounds().height - insets.bottom
- - tabAreaInsets.bottom;
- int adjustment;
- if (i == 0)
- adjustment = height - maxTabHeight;
- else
- adjustment = height - (runCount - i + 1) * maxTabHeight
- - (runCount - i) * tabRunOverlay;
-
- for (int j = first; j <= last; j++)
- rects[j].y = adjustment;
- }
-
- if (tabPlacement == SwingConstants.LEFT && i > 0)
- {
- for (int j = first; j <= last; j++)
- rects[j].x += (runCount - i) * maxTabWidth
- - (runCount - i) * tabRunOverlay;
- }
-
- if (tabPlacement == SwingConstants.RIGHT)
- {
- int width = tabPane.getBounds().width - insets.right
- - tabAreaInsets.right;
- int adjustment;
- if (i == 0)
- adjustment = width - maxTabWidth;
- else
- adjustment = width - (runCount - i + 1) * maxTabWidth
- + (runCount - i) * tabRunOverlay;
-
- for (int j = first; j <= last; j++)
- rects[j].x = adjustment;
- }
+ int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
+ if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, i);
+ if (shouldPadTabRun(tabPlacement, i))
+ padTabRun(tabPlacement, first, last, max);
+
+ // Done padding, now need to move it.
+ if (tabPlacement == SwingConstants.TOP && i > 0)
+ {
+ for (int j = first; j <= last; j++)
+ rects[j].y += (runCount - i) * maxTabHeight
+ - (runCount - i) * tabRunOverlay;
+ }
+
+ if (tabPlacement == SwingConstants.BOTTOM)
+ {
+ int height = tabPane.getBounds().height - insets.bottom
+ - tabAreaInsets.bottom;
+ int adjustment;
+ if (i == 0)
+ adjustment = height - maxTabHeight;
+ else
+ adjustment = height - (runCount - i + 1) * maxTabHeight
+ - (runCount - i) * tabRunOverlay;
+
+ for (int j = first; j <= last; j++)
+ rects[j].y = adjustment;
+ }
+
+ if (tabPlacement == SwingConstants.LEFT && i > 0)
+ {
+ for (int j = first; j <= last; j++)
+ rects[j].x += (runCount - i) * maxTabWidth
+ - (runCount - i) * tabRunOverlay;
+ }
+
+ if (tabPlacement == SwingConstants.RIGHT)
+ {
+ int width = tabPane.getBounds().width - insets.right
+ - tabAreaInsets.right;
+ int adjustment;
+ if (i == 0)
+ adjustment = width - maxTabWidth;
+ else
+ adjustment = width - (runCount - i + 1) * maxTabWidth
+ + (runCount - i) * tabRunOverlay;
+
+ for (int j = first; j <= last; j++)
+ rects[j].x = adjustment;
+ }
}
padSelectedTab(tabPlacement, tabPane.getSelectedIndex());
}
@@ -565,74 +564,74 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingUtilities.TOP
|| tabPlacement == SwingUtilities.BOTTOM)
{
- // We should only do this for runCount - 1, cause we can only shift that many times between
- // runs.
- for (int i = 1; i < runCount; i++)
- {
- Rectangle currRun = rects[lastTabInRun(tabCount, i)];
- Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
- int spaceInCurr = currRun.x + currRun.width;
- int spaceInNext = nextRun.x + nextRun.width;
-
- int diffNow = spaceInCurr - spaceInNext;
- int diffLater = (spaceInCurr - currRun.width)
- - (spaceInNext + currRun.width);
- while (Math.abs(diffLater) < Math.abs(diffNow)
- && spaceInNext + currRun.width < max)
- {
- tabRuns[i]--;
- spaceInNext += currRun.width;
- spaceInCurr -= currRun.width;
- currRun = rects[lastTabInRun(tabCount, i)];
- diffNow = spaceInCurr - spaceInNext;
- diffLater = (spaceInCurr - currRun.width)
- - (spaceInNext + currRun.width);
- }
-
- // Fix the bounds.
- int first = lastTabInRun(tabCount, i) + 1;
- int last = lastTabInRun(tabCount, getNextTabRun(i));
- int currX = tabAreaInsets.left;
- for (int j = first; j <= last; j++)
- {
- rects[j].x = currX;
- currX += rects[j].width;
- }
- }
+ // We should only do this for runCount - 1, cause we can only shift that many times between
+ // runs.
+ for (int i = 1; i < runCount; i++)
+ {
+ Rectangle currRun = rects[lastTabInRun(tabCount, i)];
+ Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
+ int spaceInCurr = currRun.x + currRun.width;
+ int spaceInNext = nextRun.x + nextRun.width;
+
+ int diffNow = spaceInCurr - spaceInNext;
+ int diffLater = (spaceInCurr - currRun.width)
+ - (spaceInNext + currRun.width);
+ while (Math.abs(diffLater) < Math.abs(diffNow)
+ && spaceInNext + currRun.width < max)
+ {
+ tabRuns[i]--;
+ spaceInNext += currRun.width;
+ spaceInCurr -= currRun.width;
+ currRun = rects[lastTabInRun(tabCount, i)];
+ diffNow = spaceInCurr - spaceInNext;
+ diffLater = (spaceInCurr - currRun.width)
+ - (spaceInNext + currRun.width);
+ }
+
+ // Fix the bounds.
+ int first = lastTabInRun(tabCount, i) + 1;
+ int last = lastTabInRun(tabCount, getNextTabRun(i));
+ int currX = tabAreaInsets.left;
+ for (int j = first; j <= last; j++)
+ {
+ rects[j].x = currX;
+ currX += rects[j].width;
+ }
+ }
}
else
{
- for (int i = 1; i < runCount; i++)
- {
- Rectangle currRun = rects[lastTabInRun(tabCount, i)];
- Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
- int spaceInCurr = currRun.y + currRun.height;
- int spaceInNext = nextRun.y + nextRun.height;
-
- int diffNow = spaceInCurr - spaceInNext;
- int diffLater = (spaceInCurr - currRun.height)
- - (spaceInNext + currRun.height);
- while (Math.abs(diffLater) < Math.abs(diffNow)
- && spaceInNext + currRun.height < max)
- {
- tabRuns[i]--;
- spaceInNext += currRun.height;
- spaceInCurr -= currRun.height;
- currRun = rects[lastTabInRun(tabCount, i)];
- diffNow = spaceInCurr - spaceInNext;
- diffLater = (spaceInCurr - currRun.height)
- - (spaceInNext + currRun.height);
- }
-
- int first = lastTabInRun(tabCount, i) + 1;
- int last = lastTabInRun(tabCount, getNextTabRun(i));
- int currY = tabAreaInsets.top;
- for (int j = first; j <= last; j++)
- {
- rects[j].y = currY;
- currY += rects[j].height;
- }
- }
+ for (int i = 1; i < runCount; i++)
+ {
+ Rectangle currRun = rects[lastTabInRun(tabCount, i)];
+ Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
+ int spaceInCurr = currRun.y + currRun.height;
+ int spaceInNext = nextRun.y + nextRun.height;
+
+ int diffNow = spaceInCurr - spaceInNext;
+ int diffLater = (spaceInCurr - currRun.height)
+ - (spaceInNext + currRun.height);
+ while (Math.abs(diffLater) < Math.abs(diffNow)
+ && spaceInNext + currRun.height < max)
+ {
+ tabRuns[i]--;
+ spaceInNext += currRun.height;
+ spaceInCurr -= currRun.height;
+ currRun = rects[lastTabInRun(tabCount, i)];
+ diffNow = spaceInCurr - spaceInNext;
+ diffLater = (spaceInCurr - currRun.height)
+ - (spaceInNext + currRun.height);
+ }
+
+ int first = lastTabInRun(tabCount, i) + 1;
+ int last = lastTabInRun(tabCount, getNextTabRun(i));
+ int currY = tabAreaInsets.top;
+ for (int j = first; j <= last; j++)
+ {
+ rects[j].y = currY;
+ currY += rects[j].height;
+ }
+ }
}
}
@@ -673,42 +672,42 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int runWidth = rects[end].x + rects[end].width;
- int spaceRemaining = max - runWidth;
- int numTabs = end - start + 1;
-
- // now divvy up the space.
- int spaceAllocated = spaceRemaining / numTabs;
- int currX = rects[start].x;
- for (int i = start; i <= end; i++)
- {
- rects[i].x = currX;
- rects[i].width += spaceAllocated;
- currX += rects[i].width;
- // This is used because since the spaceAllocated
- // variable is an int, it rounds down. Sometimes,
- // we don't fill an entire row, so we make it do
- // so now.
- if (i == end && rects[i].x + rects[i].width != max)
- rects[i].width = max - rects[i].x;
- }
+ int runWidth = rects[end].x + rects[end].width;
+ int spaceRemaining = max - runWidth;
+ int numTabs = end - start + 1;
+
+ // now divvy up the space.
+ int spaceAllocated = spaceRemaining / numTabs;
+ int currX = rects[start].x;
+ for (int i = start; i <= end; i++)
+ {
+ rects[i].x = currX;
+ rects[i].width += spaceAllocated;
+ currX += rects[i].width;
+ // This is used because since the spaceAllocated
+ // variable is an int, it rounds down. Sometimes,
+ // we don't fill an entire row, so we make it do
+ // so now.
+ if (i == end && rects[i].x + rects[i].width != max)
+ rects[i].width = max - rects[i].x;
+ }
}
else
{
- int runHeight = rects[end].y + rects[end].height;
- int spaceRemaining = max - runHeight;
- int numTabs = end - start + 1;
-
- int spaceAllocated = spaceRemaining / numTabs;
- int currY = rects[start].y;
- for (int i = start; i <= end; i++)
- {
- rects[i].y = currY;
- rects[i].height += spaceAllocated;
- currY += rects[i].height;
- if (i == end && rects[i].y + rects[i].height != max)
- rects[i].height = max - rects[i].y;
- }
+ int runHeight = rects[end].y + rects[end].height;
+ int spaceRemaining = max - runHeight;
+ int numTabs = end - start + 1;
+
+ int spaceAllocated = spaceRemaining / numTabs;
+ int currY = rects[start].y;
+ for (int i = start; i <= end; i++)
+ {
+ rects[i].y = currY;
+ rects[i].height += spaceAllocated;
+ currY += rects[i].height;
+ if (i == end && rects[i].y + rects[i].height != max)
+ rects[i].height = max - rects[i].y;
+ }
}
}
@@ -736,7 +735,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaHeight(int tabPlacement, int width)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 0;
int runWidth = 0;
@@ -758,14 +757,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// be IF we got our desired width.
for (int i = 0; i < tabPane.getTabCount(); i++)
{
- tabWidth = calculateTabWidth(tabPlacement, i, fm);
- if (runWidth + tabWidth > width)
- {
- runWidth = tabWidth;
- runs++;
- }
- else
- runWidth += tabWidth;
+ tabWidth = calculateTabWidth(tabPlacement, i, fm);
+ if (runWidth + tabWidth > width)
+ {
+ runWidth = tabWidth;
+ runs++;
+ }
+ else
+ runWidth += tabWidth;
}
runs++;
@@ -787,7 +786,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaWidth(int tabPlacement, int height)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 0;
int runHeight = 0;
@@ -804,14 +803,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
for (int i = 0; i < tabPane.getTabCount(); i++)
{
- tabHeight = calculateTabHeight(tabPlacement, i, fontHeight);
- if (runHeight + tabHeight > height)
- {
- runHeight = tabHeight;
- runs++;
- }
- else
- runHeight += tabHeight;
+ tabHeight = calculateTabHeight(tabPlacement, i, fontHeight);
+ if (runHeight + tabHeight > height)
+ {
+ runHeight = tabHeight;
+ runs++;
+ }
+ else
+ runHeight += tabHeight;
}
runs++;
@@ -831,19 +830,19 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected void rotateTabRuns(int tabPlacement, int selectedRun)
{
if (runCount == 1 || selectedRun == 1 || selectedRun == -1)
- return;
+ return;
int[] newTabRuns = new int[tabRuns.length];
int currentRun = selectedRun;
int i = 1;
do
{
- newTabRuns[i] = tabRuns[currentRun];
- currentRun = getNextTabRun(currentRun);
- i++;
+ newTabRuns[i] = tabRuns[currentRun];
+ currentRun = getNextTabRun(currentRun);
+ i++;
}
while (i < runCount);
if (runCount > 1)
- newTabRuns[0] = tabRuns[currentRun];
+ newTabRuns[0] = tabRuns[currentRun];
tabRuns = newTabRuns;
BasicTabbedPaneUI.this.selectedRun = 1;
@@ -902,7 +901,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaHeight(int tabPlacement, int width)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 1;
@@ -923,7 +922,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaWidth(int tabPlacement, int height)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 1;
@@ -944,7 +943,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected void calculateTabRects(int tabPlacement, int tabCount)
{
if (tabCount == 0)
- return;
+ return;
assureRectsCreated(tabCount);
FontMetrics fm = getFontMetrics();
@@ -958,76 +957,76 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int maxHeight = calculateMaxTabHeight(tabPlacement);
- calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
- max = calcRect.width + tabAreaInsets.left + insets.left;
- start = tabAreaInsets.left + insets.left;
- int width = 0;
- int runWidth = start;
- top = insets.top + tabAreaInsets.top;
- for (int i = 0; i < tabCount; i++)
- {
- width = calculateTabWidth(tabPlacement, i, fm);
-
- rects[i] = new Rectangle(runWidth, top, width, maxHeight);
- runWidth += width;
- }
- tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
- tabAreaRect.height = runs * maxTabHeight
- - (runs - 1) * tabRunOverlay
- + tabAreaInsets.top + tabAreaInsets.bottom;
- contentRect.width = tabAreaRect.width;
- contentRect.height = tabPane.getHeight() - insets.top
- - insets.bottom - tabAreaRect.height;
- contentRect.x = insets.left;
- tabAreaRect.x = insets.left;
- if (tabPlacement == SwingConstants.BOTTOM)
- {
- contentRect.y = insets.top;
- tabAreaRect.y = contentRect.y + contentRect.height;
- }
- else
- {
- tabAreaRect.y = insets.top;
- contentRect.y = tabAreaRect.y + tabAreaRect.height;
- }
+ int maxHeight = calculateMaxTabHeight(tabPlacement);
+ calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
+ max = calcRect.width + tabAreaInsets.left + insets.left;
+ start = tabAreaInsets.left + insets.left;
+ int width = 0;
+ int runWidth = start;
+ top = insets.top + tabAreaInsets.top;
+ for (int i = 0; i < tabCount; i++)
+ {
+ width = calculateTabWidth(tabPlacement, i, fm);
+
+ rects[i] = new Rectangle(runWidth, top, width, maxHeight);
+ runWidth += width;
+ }
+ tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
+ tabAreaRect.height = runs * maxTabHeight
+ - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.top + tabAreaInsets.bottom;
+ contentRect.width = tabAreaRect.width;
+ contentRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom - tabAreaRect.height;
+ contentRect.x = insets.left;
+ tabAreaRect.x = insets.left;
+ if (tabPlacement == SwingConstants.BOTTOM)
+ {
+ contentRect.y = insets.top;
+ tabAreaRect.y = contentRect.y + contentRect.height;
+ }
+ else
+ {
+ tabAreaRect.y = insets.top;
+ contentRect.y = tabAreaRect.y + tabAreaRect.height;
+ }
}
else
{
- int maxWidth = calculateMaxTabWidth(tabPlacement);
-
- calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
- max = calcRect.height + tabAreaInsets.top;
- int height = 0;
- start = tabAreaInsets.top + insets.top;
- int runHeight = start;
- int fontHeight = fm.getHeight();
- top = insets.left + tabAreaInsets.left;
- for (int i = 0; i < tabCount; i++)
- {
- height = calculateTabHeight(tabPlacement, i, fontHeight);
- rects[i] = new Rectangle(top, runHeight, maxWidth, height);
- runHeight += height;
- }
- tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
- + tabAreaInsets.left + tabAreaInsets.right;
- tabAreaRect.height = tabPane.getHeight() - insets.top
- - insets.bottom;
- tabAreaRect.y = insets.top;
- contentRect.width = tabPane.getWidth() - insets.left - insets.right
- - tabAreaRect.width;
- contentRect.height = tabAreaRect.height;
- contentRect.y = insets.top;
- if (tabPlacement == SwingConstants.LEFT)
- {
- tabAreaRect.x = insets.left;
- contentRect.x = tabAreaRect.x + tabAreaRect.width;
- }
- else
- {
- contentRect.x = insets.left;
- tabAreaRect.x = contentRect.x + contentRect.width;
- }
+ int maxWidth = calculateMaxTabWidth(tabPlacement);
+
+ calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
+ max = calcRect.height + tabAreaInsets.top;
+ int height = 0;
+ start = tabAreaInsets.top + insets.top;
+ int runHeight = start;
+ int fontHeight = fm.getHeight();
+ top = insets.left + tabAreaInsets.left;
+ for (int i = 0; i < tabCount; i++)
+ {
+ height = calculateTabHeight(tabPlacement, i, fontHeight);
+ rects[i] = new Rectangle(top, runHeight, maxWidth, height);
+ runHeight += height;
+ }
+ tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.left + tabAreaInsets.right;
+ tabAreaRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom;
+ tabAreaRect.y = insets.top;
+ contentRect.width = tabPane.getWidth() - insets.left - insets.right
+ - tabAreaRect.width;
+ contentRect.height = tabAreaRect.height;
+ contentRect.y = insets.top;
+ if (tabPlacement == SwingConstants.LEFT)
+ {
+ tabAreaRect.x = insets.left;
+ contentRect.x = tabAreaRect.x + tabAreaRect.width;
+ }
+ else
+ {
+ contentRect.x = insets.left;
+ tabAreaRect.x = contentRect.x + contentRect.width;
+ }
}
runCount = runs;
@@ -1047,68 +1046,68 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int tabCount = tabPane.getTabCount();
Point p = null;
if (tabCount == 0)
- return;
+ return;
int tabPlacement = tabPane.getTabPlacement();
incrButton.hide();
decrButton.hide();
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- if (tabAreaRect.x + tabAreaRect.width < rects[tabCount - 1].x
- + rects[tabCount - 1].width)
- {
- Dimension incrDims = incrButton.getPreferredSize();
- Dimension decrDims = decrButton.getPreferredSize();
-
- decrButton.setBounds(tabAreaRect.x + tabAreaRect.width
- - incrDims.width - decrDims.width,
- tabAreaRect.y, decrDims.width,
- tabAreaRect.height);
- incrButton.setBounds(tabAreaRect.x + tabAreaRect.width
- - incrDims.width, tabAreaRect.y,
- decrDims.width, tabAreaRect.height);
-
- tabAreaRect.width -= decrDims.width + incrDims.width;
- incrButton.show();
- decrButton.show();
- }
+ if (tabAreaRect.x + tabAreaRect.width < rects[tabCount - 1].x
+ + rects[tabCount - 1].width)
+ {
+ Dimension incrDims = incrButton.getPreferredSize();
+ Dimension decrDims = decrButton.getPreferredSize();
+
+ decrButton.setBounds(tabAreaRect.x + tabAreaRect.width
+ - incrDims.width - decrDims.width,
+ tabAreaRect.y, decrDims.width,
+ tabAreaRect.height);
+ incrButton.setBounds(tabAreaRect.x + tabAreaRect.width
+ - incrDims.width, tabAreaRect.y,
+ decrDims.width, tabAreaRect.height);
+
+ tabAreaRect.width -= decrDims.width + incrDims.width;
+ incrButton.show();
+ decrButton.show();
+ }
}
if (tabPlacement == SwingConstants.LEFT
|| tabPlacement == SwingConstants.RIGHT)
{
- if (tabAreaRect.y + tabAreaRect.height < rects[tabCount - 1].y
- + rects[tabCount - 1].height)
- {
- Dimension incrDims = incrButton.getPreferredSize();
- Dimension decrDims = decrButton.getPreferredSize();
-
- decrButton.setBounds(tabAreaRect.x,
- tabAreaRect.y + tabAreaRect.height
- - incrDims.height - decrDims.height,
- tabAreaRect.width, decrDims.height);
- incrButton.setBounds(tabAreaRect.x,
- tabAreaRect.y + tabAreaRect.height
- - incrDims.height, tabAreaRect.width,
- incrDims.height);
-
- tabAreaRect.height -= decrDims.height + incrDims.height;
- incrButton.show();
- decrButton.show();
- }
+ if (tabAreaRect.y + tabAreaRect.height < rects[tabCount - 1].y
+ + rects[tabCount - 1].height)
+ {
+ Dimension incrDims = incrButton.getPreferredSize();
+ Dimension decrDims = decrButton.getPreferredSize();
+
+ decrButton.setBounds(tabAreaRect.x,
+ tabAreaRect.y + tabAreaRect.height
+ - incrDims.height - decrDims.height,
+ tabAreaRect.width, decrDims.height);
+ incrButton.setBounds(tabAreaRect.x,
+ tabAreaRect.y + tabAreaRect.height
+ - incrDims.height, tabAreaRect.width,
+ incrDims.height);
+
+ tabAreaRect.height -= decrDims.height + incrDims.height;
+ incrButton.show();
+ decrButton.show();
+ }
}
viewport.setBounds(tabAreaRect.x, tabAreaRect.y, tabAreaRect.width,
tabAreaRect.height);
int tabC = tabPane.getTabCount() - 1;
if (tabCount > 0)
{
- int w = Math.max(rects[tabC].width + rects[tabC].x, tabAreaRect.width);
- int h = Math.max(rects[tabC].height, tabAreaRect.height);
- p = findPointForIndex(currentScrollLocation);
-
- // we want to cover that entire space so that borders that run under
- // the tab area don't show up when we move the viewport around.
- panel.setSize(w + p.x, h + p.y);
+ int w = Math.max(rects[tabC].width + rects[tabC].x, tabAreaRect.width);
+ int h = Math.max(rects[tabC].height, tabAreaRect.height);
+ p = findPointForIndex(currentScrollLocation);
+
+ // we want to cover that entire space so that borders that run under
+ // the tab area don't show up when we move the viewport around.
+ panel.setSize(w + p.x, h + p.y);
}
viewport.setViewPosition(p);
viewport.repaint();
@@ -1160,7 +1159,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
public void paint(Graphics g, JComponent c)
{
- paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
+ paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
}
}
@@ -1182,6 +1181,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
private class ScrollingViewport extends JViewport implements UIResource
{
+ // TODO: Maybe remove this inner class.
}
/**
@@ -1407,22 +1407,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == TOP || tabPlacement == BOTTOM)
{
- if (index > 0)
- {
- w += rects[index - 1].x + rects[index - 1].width;
- if (index > selectedIndex)
- w -= insets.left + insets.right;
- }
+ if (index > 0)
+ {
+ w += rects[index - 1].x + rects[index - 1].width;
+ if (index > selectedIndex)
+ w -= insets.left + insets.right;
+ }
}
else
{
- if (index > 0)
- {
- h += rects[index - 1].y + rects[index - 1].height;
- if (index > selectedIndex)
- h -= insets.top + insets.bottom;
- }
+ if (index > 0)
+ {
+ h += rects[index - 1].y + rects[index - 1].height;
+ if (index > selectedIndex)
+ h -= insets.top + insets.bottom;
+ }
}
Point p = new Point(w, h);
@@ -1451,16 +1451,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
super.installUI(c);
if (c instanceof JTabbedPane)
{
- tabPane = (JTabbedPane) c;
-
- installComponents();
- installDefaults();
- installListeners();
- installKeyboardActions();
-
- layoutManager = createLayoutManager();
- tabPane.setLayout(layoutManager);
- tabPane.layout();
+ tabPane = (JTabbedPane) c;
+
+ installComponents();
+ installDefaults();
+ installListeners();
+ installKeyboardActions();
+
+ layoutManager = createLayoutManager();
+ tabPane.setLayout(layoutManager);
+ tabPane.layout();
}
}
@@ -1495,23 +1495,23 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
return new TabbedPaneLayout();
else
{
- incrButton = createIncreaseButton();
- decrButton = createDecreaseButton();
- viewport = new ScrollingViewport();
- viewport.setLayout(null);
- panel = new ScrollingPanel();
- viewport.setView(panel);
- tabPane.add(incrButton);
- tabPane.add(decrButton);
- tabPane.add(viewport);
- currentScrollLocation = 0;
- decrButton.setEnabled(false);
- panel.addMouseListener(mouseListener);
- incrButton.addMouseListener(mouseListener);
- decrButton.addMouseListener(mouseListener);
- viewport.setBackground(Color.LIGHT_GRAY);
-
- return new TabbedPaneScrollLayout();
+ incrButton = createIncreaseButton();
+ decrButton = createDecreaseButton();
+ viewport = new ScrollingViewport();
+ viewport.setLayout(null);
+ panel = new ScrollingPanel();
+ viewport.setView(panel);
+ tabPane.add(incrButton);
+ tabPane.add(decrButton);
+ tabPane.add(viewport);
+ currentScrollLocation = 0;
+ decrButton.setEnabled(false);
+ panel.addMouseListener(mouseListener);
+ incrButton.addMouseListener(mouseListener);
+ decrButton.addMouseListener(mouseListener);
+ viewport.setBackground(Color.LIGHT_GRAY);
+
+ return new TabbedPaneScrollLayout();
}
}
@@ -1536,28 +1536,26 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- tabPane.setFont(defaults.getFont("TabbedPane.font"));
- tabPane.setForeground(defaults.getColor("TabbedPane.foreground"));
- tabPane.setBackground(defaults.getColor("TabbedPane.background"));
+ LookAndFeel.installColorsAndFont(tabPane, "TabbedPane.background",
+ "TabbedPane.foreground",
+ "TabbedPane.font");
tabPane.setOpaque(false);
- highlight = defaults.getColor("TabbedPane.highlight");
- lightHighlight = defaults.getColor("TabbedPane.lightHighlight");
+ highlight = UIManager.getColor("TabbedPane.highlight");
+ lightHighlight = UIManager.getColor("TabbedPane.lightHighlight");
- shadow = defaults.getColor("TabbedPane.shadow");
- darkShadow = defaults.getColor("TabbedPane.darkShadow");
+ shadow = UIManager.getColor("TabbedPane.shadow");
+ darkShadow = UIManager.getColor("TabbedPane.darkShadow");
- focus = defaults.getColor("TabbedPane.focus");
+ focus = UIManager.getColor("TabbedPane.focus");
- textIconGap = defaults.getInt("TabbedPane.textIconGap");
- tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay");
+ textIconGap = UIManager.getInt("TabbedPane.textIconGap");
+ tabRunOverlay = UIManager.getInt("TabbedPane.tabRunOverlay");
- tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets");
- selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets");
- tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets");
- contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets");
+ tabInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabInsets");
+ selectedTabPadInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabPadInsets");
+ tabAreaInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabAreaInsets");
+ contentBorderInsets = UIManager.getInsets("TabbedPane.tabbedPaneContentBorderInsets");
calcRect = new Rectangle();
tabRuns = new int[10];
@@ -1737,38 +1735,42 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// we WANT to paint the outermost run first and then work our way in.
int tabCount = tabPane.getTabCount();
int currRun = 1;
+
+ if (tabCount > runCount)
+ runCount = tabCount;
+
if (tabCount < 1)
return;
-
+
if (runCount > 1)
- currRun = 0;
+ currRun = 0;
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
- if (isScroll)
- first = currentScrollLocation;
- else if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, currRun);
- if (isScroll)
- {
- for (int k = first; k < tabCount; k++)
- {
- if (rects[k].x + rects[k].width - rects[first].x > viewport
- .getWidth())
- {
- last = k;
- break;
- }
- }
- }
-
- for (int j = first; j <= last; j++)
- {
- if (j != selectedIndex || isScroll)
- paintTab(g, tabPlacement, rects, j, ir, tr);
- }
- currRun = getPreviousTabRun(currRun);
+ int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
+ if (isScroll)
+ first = currentScrollLocation;
+ else if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, currRun);
+ if (isScroll)
+ {
+ for (int k = first; k < tabCount; k++)
+ {
+ if (rects[k].x + rects[k].width - rects[first].x > viewport
+ .getWidth())
+ {
+ last = k;
+ break;
+ }
+ }
+ }
+
+ for (int j = first; j <= last; j++)
+ {
+ if (j != selectedIndex || isScroll)
+ paintTab(g, tabPlacement, rects, j, ir, tr);
+ }
+ currRun = getPreviousTabRun(currRun);
}
if (! isScroll)
paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);
@@ -1800,24 +1802,24 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int h = calcRect.height;
if (getRunForTab(tabPane.getTabCount(), tabIndex) == 1)
{
- Insets insets = getTabAreaInsets(tabPlacement);
- switch (tabPlacement)
- {
- case TOP:
- h += insets.bottom;
- break;
- case LEFT:
- w += insets.right;
- break;
- case BOTTOM:
- y -= insets.top;
- h += insets.top;
- break;
- case RIGHT:
- x -= insets.left;
- w += insets.left;
- break;
- }
+ Insets insets = getTabAreaInsets(tabPlacement);
+ switch (tabPlacement)
+ {
+ case TOP:
+ h += insets.bottom;
+ break;
+ case LEFT:
+ w += insets.right;
+ break;
+ case BOTTOM:
+ y -= insets.top;
+ h += insets.top;
+ break;
+ case RIGHT:
+ x -= insets.left;
+ w += insets.left;
+ break;
+ }
}
layoutLabel(tabPlacement, fm, tabIndex, title, icon, calcRect, iconRect,
@@ -1856,7 +1858,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER,
- SwingConstants.CENTER, tabRect,
+ SwingConstants.RIGHT, tabRect,
iconRect, textRect, textIconGap);
int shiftX = getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
@@ -1904,8 +1906,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
View textView = getTextViewForTab(tabIndex);
if (textView != null)
{
- textView.paint(g, textRect);
- return;
+ textView.paint(g, textRect);
+ return;
}
Color fg = tabPane.getForegroundAt(tabIndex);
@@ -1921,37 +1923,37 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPane.isEnabledAt(tabIndex))
{
- g.setColor(fg);
+ g.setColor(fg);
- int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
+ int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
- if (mnemIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x,
- textRect.y
- + metrics.getAscent());
- else
- g.drawString(title, textRect.x, textRect.y + metrics.getAscent());
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
+ textRect.x,
+ textRect.y
+ + metrics.getAscent());
+ else
+ g.drawString(title, textRect.x, textRect.y + metrics.getAscent());
}
else
{
- g.setColor(bg.brighter());
-
- int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
-
- if (mnemIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x, textRect.y);
- else
- g.drawString(title, textRect.x, textRect.y);
-
- g.setColor(bg.darker());
- if (mnemIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x + 1,
- textRect.y + 1);
- else
- g.drawString(title, textRect.x + 1, textRect.y + 1);
+ g.setColor(bg.brighter());
+
+ int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
+
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
+ textRect.x, textRect.y);
+ else
+ g.drawString(title, textRect.x, textRect.y);
+
+ g.setColor(bg.darker());
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
+ textRect.x + 1,
+ textRect.y + 1);
+ else
+ g.drawString(title, textRect.x + 1, textRect.y + 1);
}
g.setColor(saved_color);
@@ -2037,30 +2039,30 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (! isSelected || tabPlacement != SwingConstants.TOP)
{
- g.setColor(shadow);
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
- g.drawLine(x, y + h, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x, y + h, x + w, y + h);
}
if (! isSelected || tabPlacement != SwingConstants.LEFT)
{
- g.setColor(darkShadow);
- g.drawLine(x + w, y, x + w, y + h);
- g.setColor(shadow);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x + w, y, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
}
if (! isSelected || tabPlacement != SwingConstants.RIGHT)
{
- g.setColor(lightHighlight);
- g.drawLine(x, y, x, y + h);
+ g.setColor(lightHighlight);
+ g.drawLine(x, y, x, y + h);
}
if (! isSelected || tabPlacement != SwingConstants.BOTTOM)
{
- g.setColor(lightHighlight);
- g.drawLine(x, y, x + w, y);
+ g.setColor(lightHighlight);
+ g.drawLine(x, y, x + w, y);
}
g.setColor(saved);
@@ -2087,10 +2089,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
g.setColor(Color.LIGHT_GRAY);
else
{
- Color bg = tabPane.getBackgroundAt(tabIndex);
- if (bg == null)
- bg = Color.GRAY;
- g.setColor(bg);
+ Color bg = tabPane.getBackgroundAt(tabIndex);
+ if (bg == null)
+ bg = Color.GRAY;
+ g.setColor(bg);
}
g.fillRect(x, y, w, h);
@@ -2144,14 +2146,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
- g.drawLine(x, y, startgap - diff, y);
- g.drawLine(endgap - diff, y, x + w, y);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
+ g.drawLine(x, y, startgap - diff, y);
+ g.drawLine(endgap - diff, y, x + w, y);
}
else
g.drawLine(x, y, x + w, y);
@@ -2184,14 +2186,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.LEFT)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
-
- g.drawLine(x, y, x, startgap - diff);
- g.drawLine(x, endgap - diff, x, y + h);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
+ g.drawLine(x, y, x, startgap - diff);
+ g.drawLine(x, endgap - diff, x, y + h);
}
else
g.drawLine(x, y, x, y + h);
@@ -2223,26 +2225,26 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.BOTTOM)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
- g.setColor(shadow);
- g.drawLine(x + 1, y + h - 1, startgap - diff, y + h - 1);
- g.drawLine(endgap - diff, y + h - 1, x + w - 1, y + h - 1);
-
- g.setColor(darkShadow);
- g.drawLine(x, y + h, startgap - diff, y + h);
- g.drawLine(endgap - diff, y + h, x + w, y + h);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 1, startgap - diff, y + h - 1);
+ g.drawLine(endgap - diff, y + h - 1, x + w - 1, y + h - 1);
+
+ g.setColor(darkShadow);
+ g.drawLine(x, y + h, startgap - diff, y + h);
+ g.drawLine(endgap - diff, y + h, x + w, y + h);
}
else
{
- g.setColor(shadow);
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
- g.drawLine(x, y + h, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x, y + h, x + w, y + h);
}
g.setColor(saved);
@@ -2271,26 +2273,26 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.RIGHT)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
-
- g.setColor(shadow);
- g.drawLine(x + w - 1, y + 1, x + w - 1, startgap - diff);
- g.drawLine(x + w - 1, endgap - diff, x + w - 1, y + h - 1);
-
- g.setColor(darkShadow);
- g.drawLine(x + w, y, x + w, startgap - diff);
- g.drawLine(x + w, endgap - diff, x + w, y + h);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
+ g.setColor(shadow);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, startgap - diff);
+ g.drawLine(x + w - 1, endgap - diff, x + w - 1, y + h - 1);
+
+ g.setColor(darkShadow);
+ g.drawLine(x + w, y, x + w, startgap - diff);
+ g.drawLine(x + w, endgap - diff, x + w, y + h);
}
else
{
- g.setColor(shadow);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
- g.drawLine(x + w, y, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x + w, y, x + w, y + h);
}
g.setColor(saved);
@@ -2337,16 +2339,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int currRun = 1;
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
- if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, currRun);
- for (int j = first; j <= last; j++)
- {
- if (getTabBounds(pane, j).contains(p))
- return j;
- }
- currRun = getNextTabRun(currRun);
+ int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
+ if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, currRun);
+ for (int j = first; j <= last; j++)
+ {
+ if (getTabBounds(pane, j).contains(p))
+ return j;
+ }
+ currRun = getNextTabRun(currRun);
}
return -1;
}
@@ -2400,10 +2402,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
return;
else
{
- int numToCopy = Math.min(tabCount, rects.length);
- Rectangle[] tmp = new Rectangle[tabCount];
- System.arraycopy(rects, 0, tmp, 0, numToCopy);
- rects = tmp;
+ int numToCopy = Math.min(tabCount, rects.length);
+ Rectangle[] tmp = new Rectangle[tabCount];
+ System.arraycopy(rects, 0, tmp, 0, numToCopy);
+ rects = tmp;
}
}
@@ -2418,9 +2420,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
tabRuns = new int[10];
else
{
- int[] newRuns = new int[tabRuns.length + 10];
- System.arraycopy(tabRuns, 0, newRuns, 0, tabRuns.length);
- tabRuns = newRuns;
+ int[] newRuns = new int[tabRuns.length + 10];
+ System.arraycopy(tabRuns, 0, newRuns, 0, tabRuns.length);
+ tabRuns = newRuns;
}
}
@@ -2438,12 +2440,12 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
return 1;
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
- if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, i);
- if (last >= tabIndex && first <= tabIndex)
- return i;
+ int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
+ if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, i);
+ if (last >= tabIndex && first <= tabIndex)
+ return i;
}
return -1;
}
@@ -2560,21 +2562,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Icon icon = getIconForTab(tabIndex);
Insets insets = getTabInsets(tabPlacement, tabIndex);
+ int height = 0;
if (icon != null)
{
- Rectangle vr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle tr = new Rectangle();
- layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
- tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
- tabIndex == tabPane.getSelectedIndex());
- calcRect = tr.union(ir);
+ Rectangle vr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+ layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
+ tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
+ tabIndex == tabPane.getSelectedIndex());
+ height = tr.union(ir).height;
}
else
- calcRect.height = fontHeight;
+ height = fontHeight;
- calcRect.height += insets.top + insets.bottom;
- return calcRect.height;
+ height += insets.top + insets.bottom;
+ return height;
}
/**
@@ -2614,21 +2617,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Icon icon = getIconForTab(tabIndex);
Insets insets = getTabInsets(tabPlacement, tabIndex);
+ int width = 0;
if (icon != null)
{
- Rectangle vr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle tr = new Rectangle();
- layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
- tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
- tabIndex == tabPane.getSelectedIndex());
- calcRect = tr.union(ir);
+ Rectangle vr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+ layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
+ tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
+ tabIndex == tabPane.getSelectedIndex());
+ width = tr.union(ir).width;
}
else
- calcRect.width = metrics.stringWidth(tabPane.getTitleAt(tabIndex));
+ width = metrics.stringWidth(tabPane.getTitleAt(tabIndex));
- calcRect.width += insets.left + insets.right;
- return calcRect.width;
+ width += insets.left + insets.right;
+ return width;
}
/**
@@ -2775,37 +2779,37 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- if (direction == SwingConstants.WEST)
- selectPreviousTabInRun(tabPane.getSelectedIndex());
- else if (direction == SwingConstants.EAST)
- selectNextTabInRun(tabPane.getSelectedIndex());
-
- else
- {
- int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
- tabPane.getSelectedIndex(),
- (tabPlacement == SwingConstants.RIGHT)
- ? true : false);
- selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
- offset);
- }
+ if (direction == SwingConstants.WEST)
+ selectPreviousTabInRun(tabPane.getSelectedIndex());
+ else if (direction == SwingConstants.EAST)
+ selectNextTabInRun(tabPane.getSelectedIndex());
+
+ else
+ {
+ int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
+ tabPane.getSelectedIndex(),
+ (tabPlacement == SwingConstants.RIGHT)
+ ? true : false);
+ selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
+ offset);
+ }
}
if (tabPlacement == SwingConstants.LEFT
|| tabPlacement == SwingConstants.RIGHT)
{
- if (direction == SwingConstants.NORTH)
- selectPreviousTabInRun(tabPane.getSelectedIndex());
- else if (direction == SwingConstants.SOUTH)
- selectNextTabInRun(tabPane.getSelectedIndex());
- else
- {
- int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
- tabPane.getSelectedIndex(),
- (tabPlacement == SwingConstants.RIGHT)
- ? true : false);
- selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
- offset);
- }
+ if (direction == SwingConstants.NORTH)
+ selectPreviousTabInRun(tabPane.getSelectedIndex());
+ else if (direction == SwingConstants.SOUTH)
+ selectNextTabInRun(tabPane.getSelectedIndex());
+ else
+ {
+ int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
+ tabPane.getSelectedIndex(),
+ (tabPlacement == SwingConstants.RIGHT)
+ ? true : false);
+ selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
+ offset);
+ }
}
}
@@ -2869,16 +2873,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int y = rects[tabIndex].y + rects[tabIndex].height / 2;
switch (tabPlacement)
- {
- case SwingConstants.TOP:
- case SwingConstants.BOTTOM:
- y += offset;
- break;
- case SwingConstants.RIGHT:
- case SwingConstants.LEFT:
- x += offset;
- break;
- }
+ {
+ case SwingConstants.TOP:
+ case SwingConstants.BOTTOM:
+ y += offset;
+ break;
+ case SwingConstants.RIGHT:
+ case SwingConstants.LEFT:
+ x += offset;
+ break;
+ }
int index = tabForCoordinate(tabPane, x, y);
if (index != -1)
@@ -3042,31 +3046,31 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// Sun's version will happily throw an NPE if params are null,
// so I won't check it either.
switch (targetPlacement)
- {
- case SwingConstants.TOP:
- targetInsets.top = topInsets.top;
- targetInsets.left = topInsets.left;
- targetInsets.right = topInsets.right;
- targetInsets.bottom = topInsets.bottom;
- break;
- case SwingConstants.LEFT:
- targetInsets.left = topInsets.top;
- targetInsets.top = topInsets.left;
- targetInsets.right = topInsets.bottom;
- targetInsets.bottom = topInsets.right;
- break;
- case SwingConstants.BOTTOM:
- targetInsets.top = topInsets.bottom;
- targetInsets.bottom = topInsets.top;
- targetInsets.left = topInsets.left;
- targetInsets.right = topInsets.right;
- break;
- case SwingConstants.RIGHT:
- targetInsets.top = topInsets.left;
- targetInsets.left = topInsets.bottom;
- targetInsets.bottom = topInsets.right;
- targetInsets.right = topInsets.top;
- break;
- }
+ {
+ case SwingConstants.TOP:
+ targetInsets.top = topInsets.top;
+ targetInsets.left = topInsets.left;
+ targetInsets.right = topInsets.right;
+ targetInsets.bottom = topInsets.bottom;
+ break;
+ case SwingConstants.LEFT:
+ targetInsets.left = topInsets.top;
+ targetInsets.top = topInsets.left;
+ targetInsets.right = topInsets.bottom;
+ targetInsets.bottom = topInsets.right;
+ break;
+ case SwingConstants.BOTTOM:
+ targetInsets.top = topInsets.bottom;
+ targetInsets.bottom = topInsets.top;
+ targetInsets.left = topInsets.left;
+ targetInsets.right = topInsets.right;
+ break;
+ case SwingConstants.RIGHT:
+ targetInsets.top = topInsets.left;
+ targetInsets.left = topInsets.bottom;
+ targetInsets.bottom = topInsets.right;
+ targetInsets.right = topInsets.top;
+ break;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
index 700b406d076..ec0467a74f3 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
@@ -46,7 +46,7 @@ import java.awt.event.MouseEvent;
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.MouseInputListener;
@@ -57,8 +57,7 @@ import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
-public class BasicTableHeaderUI
- extends TableHeaderUI
+public class BasicTableHeaderUI extends TableHeaderUI
{
public static ComponentUI createUI(JComponent h)
@@ -71,16 +70,42 @@ public class BasicTableHeaderUI
protected CellRendererPane rendererPane;
protected Border cellBorder;
- class MouseInputHandler
- implements MouseInputListener
+ public class MouseInputHandler implements MouseInputListener
{
- public void mouseClicked(MouseEvent e) {}
- public void mouseDragged(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {}
- public void mouseExited(MouseEvent e) {}
- public void mouseMoved(MouseEvent e) {}
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
+ public void mouseClicked(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseDragged(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseEntered(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseExited(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseMoved(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mousePressed(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseReleased(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
}
protected MouseInputListener createMouseInputListener()
@@ -95,15 +120,15 @@ public class BasicTableHeaderUI
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- header.setBackground(defaults.getColor("TableHeader.background"));
- header.setForeground(defaults.getColor("TableHeader.foreground"));
- header.setFont(defaults.getFont("TableHeader.font"));
- cellBorder = defaults.getBorder("TableHeader.cellBorder");
+ LookAndFeel.installColorsAndFont(header, "TableHeader.background",
+ "TableHeader.foreground",
+ "TableHeader.font");
+ cellBorder = UIManager.getBorder("TableHeader.cellBorder");
}
protected void installKeyboardActions()
{
+ // TODO: Implement this properly.
}
protected void installListeners()
@@ -128,6 +153,7 @@ public class BasicTableHeaderUI
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
protected void uninstallListeners()
@@ -157,6 +183,7 @@ public class BasicTableHeaderUI
Rectangle bounds = header.getHeaderRect(i);
if (bounds.intersects(clip))
{
+ Rectangle oldClip = gfx.getClipBounds();
TableColumn col = cmod.getColumn(i);
TableCellRenderer rend = col.getHeaderRenderer();
if (rend == null)
@@ -173,10 +200,12 @@ public class BasicTableHeaderUI
if (comp instanceof JComponent)
((JComponent)comp).setBorder(cellBorder);
gfx.translate(bounds.x, bounds.y);
+ gfx.setClip(0, 0, bounds.width, bounds.height);
comp.setSize(bounds.width, bounds.height);
comp.setLocation(0,0);
comp.paint(gfx);
gfx.translate(-bounds.x, -bounds.y);
+ gfx.setClip(oldClip);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
index 4559937eb69..25a845b36b8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
@@ -49,35 +49,38 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
-import javax.swing.BorderFactory;
import javax.swing.CellRendererPane;
+import javax.swing.DefaultListSelectionModel;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
+import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TableUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
-public class BasicTableUI
- extends TableUI
+public class BasicTableUI extends TableUI
{
public static ComponentUI createUI(JComponent comp)
{
@@ -93,23 +96,72 @@ public class BasicTableUI
/** The normal cell border. */
Border cellBorder;
- /** The cell border for selected/highlighted cells. */
- Border highlightCellBorder;
-
/** The action bound to KeyStrokes. */
TableAction action;
- class FocusHandler implements FocusListener
+ /**
+ * Listens for changes to the tables properties.
+ */
+ private PropertyChangeListener propertyChangeListener;
+
+ /**
+ * Handles key events for the JTable. Key events should be handled through
+ * the InputMap/ActionMap mechanism since JDK1.3. This class is only there
+ * for backwards compatibility.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class KeyHandler implements KeyListener
+ {
+
+ /**
+ * Receives notification that a key has been pressed and released.
+ *
+ * @param event the key event
+ */
+ public void keyTyped(KeyEvent event)
+ {
+ // Key events should be handled through the InputMap/ActionMap mechanism
+ // since JDK1.3. This class is only there for backwards compatibility.
+ }
+
+ /**
+ * Receives notification that a key has been pressed.
+ *
+ * @param event the key event
+ */
+ public void keyPressed(KeyEvent event)
+ {
+ // Key events should be handled through the InputMap/ActionMap mechanism
+ // since JDK1.3. This class is only there for backwards compatibility.
+ }
+
+ /**
+ * Receives notification that a key has been released.
+ *
+ * @param event the key event
+ */
+ public void keyReleased(KeyEvent event)
+ {
+ // Key events should be handled through the InputMap/ActionMap mechanism
+ // since JDK1.3. This class is only there for backwards compatibility.
+ }
+ }
+
+ public class FocusHandler implements FocusListener
{
public void focusGained(FocusEvent e)
{
+ // TODO: Implement this properly.
}
+
public void focusLost(FocusEvent e)
{
+ // TODO: Implement this properly.
}
}
- class MouseInputHandler implements MouseInputListener
+ public class MouseInputHandler implements MouseInputListener
{
Point begin, curr;
@@ -145,54 +197,123 @@ public class BasicTableUI
public void mouseClicked(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mouseDragged(MouseEvent e)
{
- curr = new Point(e.getX(), e.getY());
- updateSelection(e.isControlDown());
+ if (table.isEnabled())
+ {
+ curr = new Point(e.getX(), e.getY());
+ updateSelection(e.isControlDown());
+ }
}
+
public void mouseEntered(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mouseExited(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mousePressed(MouseEvent e)
{
- ListSelectionModel rowModel = table.getSelectionModel();
- ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
- int rowLead = rowModel.getLeadSelectionIndex();
- int colLead = colModel.getLeadSelectionIndex();
+ if (table.isEnabled())
+ {
+ ListSelectionModel rowModel = table.getSelectionModel();
+ ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+ int rowLead = rowModel.getLeadSelectionIndex();
+ int colLead = colModel.getLeadSelectionIndex();
- begin = new Point(e.getX(), e.getY());
- curr = new Point(e.getX(), e.getY());
- //if control is pressed and the cell is already selected, deselect it
- if (e.isControlDown() && table.
- isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin)))
- {
- table.getSelectionModel().
- removeSelectionInterval(table.rowAtPoint(begin),
- table.rowAtPoint(begin));
- table.getColumnModel().getSelectionModel().
- removeSelectionInterval(table.columnAtPoint(begin),
- table.columnAtPoint(begin));
- }
- else
- updateSelection(e.isControlDown());
+ begin = new Point(e.getX(), e.getY());
+ curr = new Point(e.getX(), e.getY());
+ //if control is pressed and the cell is already selected, deselect it
+ if (e.isControlDown() && table.
+ isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin)))
+ {
+ table.getSelectionModel().
+ removeSelectionInterval(table.rowAtPoint(begin),
+ table.rowAtPoint(begin));
+ table.getColumnModel().getSelectionModel().
+ removeSelectionInterval(table.columnAtPoint(begin),
+ table.columnAtPoint(begin));
+ }
+ else
+ updateSelection(e.isControlDown());
- // If we were editing, but the moved to another cell, stop editing
- if (rowLead != rowModel.getLeadSelectionIndex() ||
- colLead != colModel.getLeadSelectionIndex())
- if (table.isEditing())
- table.editingStopped(new ChangeEvent(e));
+ // If we were editing, but the moved to another cell, stop editing
+ if (rowLead != rowModel.getLeadSelectionIndex() ||
+ colLead != colModel.getLeadSelectionIndex())
+ if (table.isEditing())
+ table.editingStopped(new ChangeEvent(e));
+ }
}
+
public void mouseReleased(MouseEvent e)
{
- begin = null;
- curr = null;
+ if (table.isEnabled())
+ {
+ begin = null;
+ curr = null;
+ }
+ }
+ }
+
+ /**
+ * Listens for changes to the model property of the JTable and adjusts some
+ * settings.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class PropertyChangeHandler implements PropertyChangeListener
+ {
+ /**
+ * Receives notification if one of the JTable's properties changes.
+ *
+ * @param ev the property change event
+ */
+ public void propertyChange(PropertyChangeEvent ev)
+ {
+ String propName = ev.getPropertyName();
+ if (propName.equals("model"))
+ {
+ ListSelectionModel rowSel = table.getSelectionModel();
+ rowSel.clearSelection();
+ ListSelectionModel colSel = table.getColumnModel().getSelectionModel();
+ colSel.clearSelection();
+ TableModel model = table.getModel();
+
+ // Adjust lead and anchor selection indices of the row and column
+ // selection models.
+ if (model.getRowCount() > 0)
+ {
+ rowSel.setAnchorSelectionIndex(0);
+ rowSel.setLeadSelectionIndex(0);
+ }
+ else
+ {
+ rowSel.setAnchorSelectionIndex(-1);
+ rowSel.setLeadSelectionIndex(-1);
+ }
+ if (model.getColumnCount() > 0)
+ {
+ colSel.setAnchorSelectionIndex(0);
+ colSel.setLeadSelectionIndex(0);
+ }
+ else
+ {
+ colSel.setAnchorSelectionIndex(-1);
+ colSel.setLeadSelectionIndex(-1);
+ }
+ }
}
}
@@ -206,6 +327,17 @@ public class BasicTableUI
return new MouseInputHandler();
}
+
+ /**
+ * Creates and returns a key listener for the JTable.
+ *
+ * @return a key listener for the JTable
+ */
+ protected KeyListener createKeyListener()
+ {
+ return new KeyHandler();
+ }
+
/**
* Return the maximum size of the table. The maximum height is the row
* height times the number of rows. The maximum width is the sum of
@@ -255,47 +387,13 @@ public class BasicTableUI
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- table.setFont(defaults.getFont("Table.font"));
- table.setGridColor(defaults.getColor("Table.gridColor"));
- table.setForeground(defaults.getColor("Table.foreground"));
- table.setBackground(defaults.getColor("Table.background"));
- table.setSelectionForeground(defaults.getColor("Table.selectionForeground"));
- table.setSelectionBackground(defaults.getColor("Table.selectionBackground"));
+ LookAndFeel.installColorsAndFont(table, "Table.background",
+ "Table.foreground", "Table.font");
+ table.setGridColor(UIManager.getColor("Table.gridColor"));
+ table.setSelectionForeground(UIManager.getColor("Table.selectionForeground"));
+ table.setSelectionBackground(UIManager.getColor("Table.selectionBackground"));
table.setOpaque(true);
-
- highlightCellBorder = defaults.getBorder("Table.focusCellHighlightBorder");
- cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1);
- }
-
- private int convertModifiers(int mod)
- {
- if ((mod & KeyEvent.SHIFT_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.SHIFT_MASK;
- mod &= ~KeyEvent.SHIFT_DOWN_MASK;
- }
- if ((mod & KeyEvent.CTRL_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.CTRL_MASK;
- mod &= ~KeyEvent.CTRL_DOWN_MASK;
- }
- if ((mod & KeyEvent.META_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.META_MASK;
- mod &= ~KeyEvent.META_DOWN_MASK;
- }
- if ((mod & KeyEvent.ALT_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.ALT_MASK;
- mod &= ~KeyEvent.ALT_DOWN_MASK;
- }
- if ((mod & KeyEvent.ALT_GRAPH_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.ALT_GRAPH_MASK;
- mod &= ~KeyEvent.ALT_GRAPH_DOWN_MASK;
- }
- return mod;
+ rendererPane = new CellRendererPane();
}
protected void installKeyboardActions()
@@ -304,27 +402,21 @@ public class BasicTableUI
InputMap ancestorMap = (InputMap)defaults.get("Table.ancestorInputMap");
InputMapUIResource parentInputMap = new InputMapUIResource();
// FIXME: The JDK uses a LazyActionMap for parentActionMap
- ActionMap parentActionMap = new ActionMap();
+ ActionMap parentActionMap = new ActionMapUIResource();
action = new TableAction();
Object keys[] = ancestorMap.allKeys();
// Register key bindings in the UI InputMap-ActionMap pair
- // Note that we register key bindings with both the old and new modifier
- // masks: InputEvent.SHIFT_MASK and InputEvent.SHIFT_DOWN_MASK and so on.
for (int i = 0; i < keys.length; i++)
{
- parentInputMap.put(KeyStroke.getKeyStroke
- (((KeyStroke)keys[i]).getKeyCode(), convertModifiers
- (((KeyStroke)keys[i]).getModifiers())),
- (String)ancestorMap.get((KeyStroke)keys[i]));
+ KeyStroke stroke = (KeyStroke)keys[i];
+ String actionString = (String) ancestorMap.get(stroke);
- parentInputMap.put(KeyStroke.getKeyStroke
- (((KeyStroke)keys[i]).getKeyCode(),
- ((KeyStroke)keys[i]).getModifiers()),
- (String)ancestorMap.get((KeyStroke)keys[i]));
+ parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(),
+ stroke.getModifiers()),
+ actionString);
- parentActionMap.put
- ((String)ancestorMap.get((KeyStroke)keys[i]), new ActionListenerProxy
- (action, (String)ancestorMap.get((KeyStroke)keys[i])));
+ parentActionMap.put (actionString,
+ new ActionListenerProxy (action, actionString));
}
// Set the UI InputMap-ActionMap pair to be the parents of the
@@ -383,8 +475,8 @@ public class BasicTableUI
*/
public void actionPerformed (ActionEvent e)
{
- ListSelectionModel rowModel = table.getSelectionModel();
- ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+ DefaultListSelectionModel rowModel = (DefaultListSelectionModel) table.getSelectionModel();
+ DefaultListSelectionModel colModel = (DefaultListSelectionModel) table.getColumnModel().getSelectionModel();
int rowLead = rowModel.getLeadSelectionIndex();
int rowMax = table.getModel().getRowCount() - 1;
@@ -392,74 +484,75 @@ public class BasicTableUI
int colLead = colModel.getLeadSelectionIndex();
int colMax = table.getModel().getColumnCount() - 1;
- if (e.getActionCommand().equals("selectPreviousRowExtendSelection"))
+ String command = e.getActionCommand();
+
+ if (command.equals("selectPreviousRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0));
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectLastColumn"))
+ else if (command.equals("selectLastColumn"))
{
- table.clearSelection();
rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(colMax, colMax);
}
- else if (e.getActionCommand().equals("startEditing"))
+ else if (command.equals("startEditing"))
{
if (table.isCellEditable(rowLead, colLead))
table.editCellAt(rowLead,colLead);
}
- else if (e.getActionCommand().equals("selectFirstRowExtendSelection"))
+ else if (command.equals("selectFirstRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(0);
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectFirstColumn"))
+ else if (command.equals("selectFirstColumn"))
{
rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(0, 0);
}
- else if (e.getActionCommand().equals("selectFirstColumnExtendSelection"))
+ else if (command.equals("selectFirstColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(0);
rowModel.setLeadSelectionIndex(rowLead);
- }
- else if (e.getActionCommand().equals("selectLastRow"))
+ }
+ else if (command.equals("selectLastRow"))
{
rowModel.setSelectionInterval(rowMax,rowMax);
colModel.setSelectionInterval(colLead, colLead);
}
- else if (e.getActionCommand().equals("selectNextRowExtendSelection"))
+ else if (command.equals("selectNextRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectFirstRow"))
+ else if (command.equals("selectFirstRow"))
{
rowModel.setSelectionInterval(0,0);
colModel.setSelectionInterval(colLead, colLead);
}
- else if (e.getActionCommand().equals("selectNextColumnExtendSelection"))
+ else if (command.equals("selectNextColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax));
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectLastColumnExtendSelection"))
+ else if (command.equals("selectLastColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(colMax);
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection"))
+ else if (command.equals("selectPreviousColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0));
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectNextRow"))
+ else if (command.equals("selectNextRow"))
{
rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
Math.min(rowLead + 1, rowMax));
colModel.setSelectionInterval(colLead,colLead);
}
- else if (e.getActionCommand().equals("scrollUpExtendSelection"))
+ else if (command.equals("scrollUpExtendSelection"))
{
int target;
if (rowLead == getFirstVisibleRowIndex())
@@ -472,13 +565,13 @@ public class BasicTableUI
rowModel.setLeadSelectionIndex(target);
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectPreviousRow"))
+ else if (command.equals("selectPreviousRow"))
{
rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
Math.max(rowLead - 1, 0));
colModel.setSelectionInterval(colLead,colLead);
}
- else if (e.getActionCommand().equals("scrollRightChangeSelection"))
+ else if (command.equals("scrollRightChangeSelection"))
{
int target;
if (colLead == getLastVisibleColumnIndex())
@@ -491,13 +584,13 @@ public class BasicTableUI
colModel.setSelectionInterval(target, target);
rowModel.setSelectionInterval(rowLead, rowLead);
}
- else if (e.getActionCommand().equals("selectPreviousColumn"))
+ else if (command.equals("selectPreviousColumn"))
{
rowModel.setSelectionInterval(rowLead,rowLead);
colModel.setSelectionInterval(Math.max(colLead - 1, 0),
Math.max(colLead - 1, 0));
}
- else if (e.getActionCommand().equals("scrollLeftChangeSelection"))
+ else if (command.equals("scrollLeftChangeSelection"))
{
int target;
if (colLead == getFirstVisibleColumnIndex())
@@ -510,11 +603,11 @@ public class BasicTableUI
colModel.setSelectionInterval(target, target);
rowModel.setSelectionInterval(rowLead, rowLead);
}
- else if (e.getActionCommand().equals("clearSelection"))
+ else if (command.equals("clearSelection"))
{
table.clearSelection();
}
- else if (e.getActionCommand().equals("cancel"))
+ else if (command.equals("cancel"))
{
// FIXME: implement other parts of "cancel" like undo-ing last
// selection. Right now it just calls editingCancelled if
@@ -522,10 +615,10 @@ public class BasicTableUI
if (table.isEditing())
table.editingCanceled(new ChangeEvent("cancel"));
}
- else if (e.getActionCommand().equals("selectNextRowCell")
- || e.getActionCommand().equals("selectPreviousRowCell")
- || e.getActionCommand().equals("selectNextColumnCell")
- || e.getActionCommand().equals("selectPreviousColumnCell"))
+ else if (command.equals("selectNextRowCell")
+ || command.equals("selectPreviousRowCell")
+ || command.equals("selectNextColumnCell")
+ || command.equals("selectPreviousColumnCell"))
{
// If nothing is selected, select the first cell in the table
if (table.getSelectedRowCount() == 0 &&
@@ -561,13 +654,13 @@ public class BasicTableUI
// when you get to the edges of the table.
if (!multColsSelected && !multRowsSelected)
{
- if (e.getActionCommand().indexOf("Column") != -1)
+ if (command.indexOf("Column") != -1)
advanceSingleSelection(colModel, colMax, rowModel, rowMax,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousColumnCell")));
else
advanceSingleSelection(rowModel, rowMax, colModel, colMax,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousRowCell")));
return;
}
@@ -588,25 +681,25 @@ public class BasicTableUI
// If there are multiple rows and columns selected, select the next
// cell and wrap at the edges of the selection.
- if (e.getActionCommand().indexOf("Column") != -1)
+ if (command.indexOf("Column") != -1)
advanceMultipleSelection(colModel, colMinSelected, colMaxSelected,
rowModel, rowMinSelected, rowMaxSelected,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousColumnCell")), true);
else
advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected,
colModel, colMinSelected, colMaxSelected,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousRowCell")), false);
}
- else if (e.getActionCommand().equals("selectNextColumn"))
+ else if (command.equals("selectNextColumn"))
{
rowModel.setSelectionInterval(rowLead,rowLead);
colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
Math.min(colLead + 1, colMax));
}
- else if (e.getActionCommand().equals("scrollLeftExtendSelection"))
+ else if (command.equals("scrollLeftExtendSelection"))
{
int target;
if (colLead == getFirstVisibleColumnIndex())
@@ -619,7 +712,7 @@ public class BasicTableUI
colModel.setLeadSelectionIndex(target);
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("scrollDownChangeSelection"))
+ else if (command.equals("scrollDownChangeSelection"))
{
int target;
if (rowLead == getLastVisibleRowIndex())
@@ -632,7 +725,7 @@ public class BasicTableUI
rowModel.setSelectionInterval(target, target);
colModel.setSelectionInterval(colLead, colLead);
}
- else if (e.getActionCommand().equals("scrollRightExtendSelection"))
+ else if (command.equals("scrollRightExtendSelection"))
{
int target;
if (colLead == getLastVisibleColumnIndex())
@@ -645,16 +738,16 @@ public class BasicTableUI
colModel.setLeadSelectionIndex(target);
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectAll"))
+ else if (command.equals("selectAll"))
{
table.selectAll();
}
- else if (e.getActionCommand().equals("selectLastRowExtendSelection"))
+ else if (command.equals("selectLastRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(rowMax);
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("scrollDownExtendSelection"))
+ else if (command.equals("scrollDownExtendSelection"))
{
int target;
if (rowLead == getLastVisibleRowIndex())
@@ -666,8 +759,8 @@ public class BasicTableUI
rowModel.setLeadSelectionIndex(target);
colModel.setLeadSelectionIndex(colLead);
- }
- else if (e.getActionCommand().equals("scrollUpChangeSelection"))
+ }
+ else if (command.equals("scrollUpChangeSelection"))
{
int target;
if (rowLead == getFirstVisibleRowIndex())
@@ -680,22 +773,119 @@ public class BasicTableUI
rowModel.setSelectionInterval(target, target);
colModel.setSelectionInterval(colLead, colLead);
}
+ else if (command.equals("selectNextRowChangeLead"))
+ {
+ if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just "selectNextRow"
+ rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
+ Math.min(rowLead + 1, rowMax));
+ colModel.setSelectionInterval(colLead,colLead);
+ }
+ else
+ rowModel.moveLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
+ }
+ else if (command.equals("selectPreviousRowChangeLead"))
+ {
+ if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just selectPreviousRow
+ rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
+ Math.min(rowLead -1, 0));
+ colModel.setSelectionInterval(colLead,colLead);
+ }
+ else
+ rowModel.moveLeadSelectionIndex(Math.max(rowLead - 1, 0));
+ }
+ else if (command.equals("selectNextColumnChangeLead"))
+ {
+ if (colModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just selectNextColumn
+ rowModel.setSelectionInterval(rowLead,rowLead);
+ colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
+ Math.min(colLead + 1, colMax));
+ }
+ else
+ colModel.moveLeadSelectionIndex(Math.min(colLead + 1, colMax));
+ }
+ else if (command.equals("selectPreviousColumnChangeLead"))
+ {
+ if (colModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just selectPreviousColumn
+ rowModel.setSelectionInterval(rowLead,rowLead);
+ colModel.setSelectionInterval(Math.max(colLead - 1, 0),
+ Math.max(colLead - 1, 0));
+
+ }
+ else
+ colModel.moveLeadSelectionIndex(Math.max(colLead - 1, 0));
+ }
+ else if (command.equals("addToSelection"))
+ {
+ if (!table.isEditing())
+ {
+ int oldRowAnchor = rowModel.getAnchorSelectionIndex();
+ int oldColAnchor = colModel.getAnchorSelectionIndex();
+ rowModel.addSelectionInterval(rowLead, rowLead);
+ colModel.addSelectionInterval(colLead, colLead);
+ rowModel.setAnchorSelectionIndex(oldRowAnchor);
+ colModel.setAnchorSelectionIndex(oldColAnchor);
+ }
+ }
+ else if (command.equals("extendTo"))
+ {
+ rowModel.setSelectionInterval(rowModel.getAnchorSelectionIndex(),
+ rowLead);
+ colModel.setSelectionInterval(colModel.getAnchorSelectionIndex(),
+ colLead);
+ }
+ else if (command.equals("toggleAndAnchor"))
+ {
+ if (rowModel.isSelectedIndex(rowLead))
+ rowModel.removeSelectionInterval(rowLead, rowLead);
+ else
+ rowModel.addSelectionInterval(rowLead, rowLead);
+
+ if (colModel.isSelectedIndex(colLead))
+ colModel.removeSelectionInterval(colLead, colLead);
+ else
+ colModel.addSelectionInterval(colLead, colLead);
+
+ rowModel.setAnchorSelectionIndex(rowLead);
+ colModel.setAnchorSelectionIndex(colLead);
+ }
else
{
// If we're here that means we bound this TableAction class
// to a keyboard input but we either want to ignore that input
// or we just haven't implemented its action yet.
+
+ // Uncomment the following line to print the names of unused bindings
+ // when their keys are pressed
+
+ // System.out.println ("not implemented: "+e.getActionCommand());
}
- if (table.isEditing() && e.getActionCommand() != "startEditing")
- table.editingCanceled(new ChangeEvent("update"));
- table.repaint();
-
+ // Any commands whose keyStrokes should be used by the Editor should not
+ // cause editing to be stopped: ie, the SPACE sends "addToSelection" but
+ // if the table is in editing mode, the space should not cause us to stop
+ // editing because it should be used by the Editor.
+ if (table.isEditing() && command != "startEditing"
+ && command != "addToSelection")
+ table.editingStopped(new ChangeEvent("update"));
+
table.scrollRectToVisible
(table.getCellRect(rowModel.getLeadSelectionIndex(),
colModel.getLeadSelectionIndex(), false));
+ table.repaint();
}
+ /**
+ * Returns the column index of the first visible column.
+ * @return the column index of the first visible column.
+ */
int getFirstVisibleColumnIndex()
{
ComponentOrientation or = table.getComponentOrientation();
@@ -922,10 +1112,19 @@ public class BasicTableUI
protected void installListeners()
{
- table.addFocusListener(focusListener);
+ if (focusListener == null)
+ focusListener = createFocusListener();
+ table.addFocusListener(focusListener);
+ if (keyListener == null)
+ keyListener = createKeyListener();
table.addKeyListener(keyListener);
+ if (mouseInputListener == null)
+ mouseInputListener = createMouseInputListener();
table.addMouseListener(mouseInputListener);
table.addMouseMotionListener(mouseInputListener);
+ if (propertyChangeListener == null)
+ propertyChangeListener = new PropertyChangeHandler();
+ table.addPropertyChangeListener(propertyChangeListener);
}
protected void uninstallDefaults()
@@ -950,6 +1149,7 @@ public class BasicTableUI
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
protected void uninstallListeners()
@@ -958,13 +1158,13 @@ public class BasicTableUI
table.removeKeyListener(keyListener);
table.removeMouseListener(mouseInputListener);
table.removeMouseMotionListener(mouseInputListener);
+ table.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
}
public void installUI(JComponent comp)
{
table = (JTable)comp;
- focusListener = createFocusListener();
- mouseInputListener = createMouseInputListener();
installDefaults();
installKeyboardActions();
installListeners();
@@ -977,6 +1177,60 @@ public class BasicTableUI
uninstallDefaults();
}
+ /**
+ * Paints a single cell in the table.
+ *
+ * @param g The graphics context to paint in
+ * @param row The row number to paint
+ * @param col The column number to paint
+ * @param bounds The bounds of the cell to paint, assuming a coordinate
+ * system beginning at <code>(0,0)</code> in the upper left corner of the
+ * table
+ * @param rend A cell renderer to paint with
+ * @param data The data to provide to the cell renderer
+ * @param rowLead The lead selection for the rows of the table.
+ * @param colLead The lead selection for the columns of the table.
+ */
+ void paintCell(Graphics g, int row, int col, Rectangle bounds,
+ TableCellRenderer rend, TableModel data,
+ int rowLead, int colLead)
+ {
+ boolean rowSelAllowed = table.getRowSelectionAllowed();
+ boolean colSelAllowed = table.getColumnSelectionAllowed();
+ boolean isSel = false;
+ if (rowSelAllowed && colSelAllowed || !rowSelAllowed && !colSelAllowed)
+ isSel = table.isCellSelected(row, col);
+ else
+ isSel = table.isRowSelected(row) && table.getRowSelectionAllowed()
+ || table.isColumnSelected(col) && table.getColumnSelectionAllowed();
+
+ // Determine the focused cell. The focused cell is the cell at the
+ // leadSelectionIndices of the row and column selection model.
+ ListSelectionModel rowSel = table.getSelectionModel();
+ ListSelectionModel colSel = table.getColumnModel().getSelectionModel();
+ boolean hasFocus = table.hasFocus() && table.isEnabled()
+ && rowSel.getLeadSelectionIndex() == row
+ && colSel.getLeadSelectionIndex() == col;
+
+ Component comp = rend.getTableCellRendererComponent(table,
+ data.getValueAt(row, col),
+ isSel, hasFocus, row, col);
+
+ rendererPane.paintComponent(g, comp, table, bounds);
+
+ // FIXME: this is manual painting of the Caret, why doesn't the
+ // JTextField take care of this itself?
+ if (comp instanceof JTextField)
+ {
+ Rectangle oldClip = g.getClipBounds();
+ g.translate(bounds.x, bounds.y);
+ g.clipRect(0, 0, bounds.width, bounds.height);
+ ((JTextField)comp).getCaret().paint(g);
+ g.translate(-bounds.x, -bounds.y);
+ g.setClip(oldClip);
+ }
+ }
+
public void paint(Graphics gfx, JComponent ignored)
{
int ncols = table.getColumnCount();
@@ -1002,40 +1256,24 @@ public class BasicTableUI
y = y0;
TableColumn col = cols.getColumn(c);
int width = col.getWidth();
- int modelCol = col.getModelIndex();
-
+ int halfGapWidth = gap.width / 2;
+ int halfGapHeight = gap.height / 2;
for (int r = 0; r < nrows && y < ymax; ++r)
{
- Rectangle bounds = new Rectangle(x, y, width, height);
- if (bounds.intersects(clip))
- {
- TableCellRenderer rend = table.getCellRenderer(r, c);
- Component comp = table.prepareRenderer(rend, r, c);
- gfx.translate(x, y);
- comp.setBounds(new Rectangle(0, 0, width, height));
- // Set correct border on cell renderer.
- // Only the lead selection cell gets a border
- if (comp instanceof JComponent)
- {
- if (table.getSelectionModel().getLeadSelectionIndex() == r
- && table.getColumnModel().getSelectionModel().
- getLeadSelectionIndex() == c)
- ((JComponent) comp).setBorder(highlightCellBorder);
- else
- ((JComponent) comp).setBorder(cellBorder);
- }
- comp.paint(gfx);
- if (comp instanceof JTextField)
- ((JTextField)comp).getCaret().paint(gfx);
- gfx.translate(-x, -y);
+ Rectangle bounds = new Rectangle(x + halfGapWidth,
+ y + halfGapHeight + 1,
+ width - gap.width + 1,
+ height - gap.height);
+ if (bounds.intersects(clip))
+ {
+ paintCell(gfx, r, c, bounds, table.getCellRenderer(r, c),
+ table.getModel(),
+ table.getSelectionModel().getLeadSelectionIndex(),
+ table.getColumnModel().getSelectionModel().getLeadSelectionIndex());
}
- y += height;
- if (gap != null)
- y += gap.height;
+ y += height;
}
x += width;
- if (gap != null)
- x += gap.width;
}
// tighten up the x and y max bounds
@@ -1044,7 +1282,7 @@ public class BasicTableUI
Color grid = table.getGridColor();
- // paint vertical grid lines
+ // paint vertical grid lines
if (grid != null && table.getShowVerticalLines())
{
x = x0;
@@ -1053,9 +1291,7 @@ public class BasicTableUI
boolean paintedLine = false;
for (int c = 0; c < ncols && x < xmax; ++c)
{
- x += cols.getColumn(c).getWidth();;
- if (gap != null)
- x += gap.width;
+ x += cols.getColumn(c).getWidth();
gfx.drawLine(x, y0, x, ymax);
paintedLine = true;
}
@@ -1072,8 +1308,6 @@ public class BasicTableUI
for (int r = 0; r < nrows && y < ymax; ++r)
{
y += height;
- if (gap != null)
- y += gap.height;
gfx.drawLine(x0, y, xmax, y);
paintedLine = true;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java
index 97b0ccb6ee6..36854e07fe0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java
@@ -39,11 +39,16 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.beans.PropertyChangeEvent;
+
import javax.swing.JComponent;
+import javax.swing.JTextArea;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.PlainView;
import javax.swing.text.View;
+import javax.swing.text.WrappedPlainView;
public class BasicTextAreaUI extends BasicTextUI
{
@@ -54,15 +59,55 @@ public class BasicTextAreaUI extends BasicTextUI
public BasicTextAreaUI()
{
+ // Nothing to do here.
}
+ /**
+ * Create the view. Returns a WrappedPlainView if the text area
+ * has lineWrap set to true, otherwise returns a PlainView. If
+ * lineWrap is true has to check whether the wrap style is word
+ * or character and return an appropriate WrappedPlainView.
+ *
+ * @param elem the element to create a View for
+ * @return an appropriate View for the element
+ */
public View create(Element elem)
{
- return new PlainView(elem);
+ JTextArea comp = (JTextArea)getComponent();
+ if (comp.getLineWrap())
+ {
+ if (comp.getWrapStyleWord())
+ return new WrappedPlainView(elem, true);
+ else
+ return new WrappedPlainView(elem, false);
+ }
+ else
+ return new PlainView(elem);
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "TextArea"
+ */
protected String getPropertyPrefix()
{
return "TextArea";
}
+
+ /**
+ * Receives notification whenever one of the text component's bound
+ * properties changes. This changes the view to WrappedPlainView
+ * if setLineWrap(true) is called, and back to PlainView if
+ * setLineWrap(false) is called.
+ *
+ * @param ev the property change event
+ */
+ protected void propertyChange(PropertyChangeEvent ev)
+ {
+ JTextArea comp = (JTextArea)getComponent();
+ if (ev.getPropertyName() == "lineWrap"
+ || ev.getPropertyName() == "wrapStyleWord")
+ modelChanged();
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java
index a300446c262..4e2ca9f93df 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java
@@ -41,6 +41,7 @@ package javax.swing.plaf.basic;
import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.FieldView;
@@ -63,6 +64,11 @@ public class BasicTextFieldUI extends BasicTextUI
return new BasicTextFieldUI();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "TextField"
+ */
protected String getPropertyPrefix()
{
return "TextField";
@@ -73,8 +79,22 @@ public class BasicTextFieldUI extends BasicTextUI
super.installUI(c);
}
+ /**
+ * Receives notification whenever one of the text component's bound
+ * properties changes. Here we check for the editable and enabled
+ * properties and adjust the background color accordingly.
+ *
+ * @param event the property change event
+ */
protected void propertyChange(PropertyChangeEvent event)
{
- // Does nothing by default.
+ if (event.getPropertyName().equals("editable"))
+ {
+ boolean editable = ((Boolean) event.getNewValue()).booleanValue();
+ if (editable)
+ textComponent.setBackground(background);
+ else
+ textComponent.setBackground(inactiveBackground);
+ }
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java
index 55d908e1b88..decbed56829 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java
@@ -38,10 +38,18 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
+
import javax.swing.JComponent;
+import javax.swing.JTextPane;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.PlainView;
+import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
import javax.swing.text.View;
public class BasicTextPaneUI extends BasicEditorPaneUI
@@ -61,8 +69,32 @@ public class BasicTextPaneUI extends BasicEditorPaneUI
return new PlainView(elem);
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "TextPane"
+ */
protected String getPropertyPrefix()
{
return "TextPane";
}
+
+ /**
+ * Installs this UI on the specified <code>JTextPane</code>. This calls the
+ * super implementation and then adds a default style to the text pane.
+ *
+ * @param c the text pane to install the UI to
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ JTextPane tp = (JTextPane) c;
+ Style defaultStyle = tp.getStyle(StyleContext.DEFAULT_STYLE);
+ defaultStyle.addAttribute(StyleConstants.Foreground,
+ new ColorUIResource(Color.BLACK));
+ defaultStyle.addAttribute(StyleConstants.FontFamily, "Serif");
+ defaultStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
+ defaultStyle.addAttribute(StyleConstants.Bold, Boolean.FALSE);
+ defaultStyle.addAttribute(StyleConstants.FontSize, new Integer(12));
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
index 91ccb0056bb..b9de92640c8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -54,6 +55,8 @@ import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
@@ -73,7 +76,6 @@ import javax.swing.text.Element;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import javax.swing.text.Keymap;
-import javax.swing.text.PlainView;
import javax.swing.text.Position;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
@@ -92,11 +94,11 @@ public abstract class BasicTextUI extends TextUI
/**
* A {@link DefaultCaret} that implements {@link UIResource}.
*/
- public static class BasicCaret extends DefaultCaret
- implements UIResource
+ public static class BasicCaret extends DefaultCaret implements UIResource
{
public BasicCaret()
{
+ // Nothing to do here.
}
}
@@ -108,6 +110,7 @@ public abstract class BasicTextUI extends TextUI
{
public BasicHighlighter()
{
+ // Nothing to do here.
}
}
@@ -241,7 +244,7 @@ public abstract class BasicTextUI extends TextUI
public void paint(Graphics g, Shape s)
{
if (view != null)
- view.paint(g, s);
+ view.paint(g, s);
}
@@ -252,10 +255,10 @@ public abstract class BasicTextUI extends TextUI
*
* This is delegated to the real root view.
*
- * @param pos the position of the character in the model
+ * @param position the position of the character in the model
* @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param bias either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -327,12 +330,41 @@ public abstract class BasicTextUI extends TextUI
{
view.changedUpdate(ev, shape, vf);
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ return view.getNextVisualPositionFrom(c, pos, b, d, biasRet);
+ }
}
/**
* Receives notifications when properties of the text component change.
*/
- class UpdateHandler implements PropertyChangeListener
+ class PropertyChangeHandler implements PropertyChangeListener
{
/**
* Notifies when a property of the text component changes.
@@ -342,10 +374,12 @@ public abstract class BasicTextUI extends TextUI
public void propertyChange(PropertyChangeEvent event)
{
if (event.getPropertyName().equals("document"))
- {
+ {
// Document changed.
- modelChanged();
- }
+ modelChanged();
+ }
+
+ BasicTextUI.this.propertyChange(event);
}
}
@@ -364,11 +398,10 @@ public abstract class BasicTextUI extends TextUI
*/
public void changedUpdate(DocumentEvent ev)
{
- Dimension size = textComponent.getSize();
- rootView.changedUpdate(ev, new Rectangle(0, 0, size.width, size.height),
+ rootView.changedUpdate(ev, getVisibleEditorRect(),
rootView.getViewFactory());
}
-
+
/**
* Notification about a document insert event.
*
@@ -376,12 +409,8 @@ public abstract class BasicTextUI extends TextUI
*/
public void insertUpdate(DocumentEvent ev)
{
- Dimension size = textComponent.getSize();
- rootView.insertUpdate(ev, new Rectangle(0, 0, size.width, size.height),
+ rootView.insertUpdate(ev, getVisibleEditorRect(),
rootView.getViewFactory());
- int caretPos = textComponent.getCaretPosition();
- if (caretPos >= ev.getOffset())
- textComponent.setCaretPosition(caretPos + ev.getLength());
}
/**
@@ -391,12 +420,8 @@ public abstract class BasicTextUI extends TextUI
*/
public void removeUpdate(DocumentEvent ev)
{
- Dimension size = textComponent.getSize();
- rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height),
+ rootView.removeUpdate(ev, getVisibleEditorRect(),
rootView.getViewFactory());
- int caretPos = textComponent.getCaretPosition();
- if (caretPos >= ev.getOffset())
- textComponent.setCaretPosition(ev.getOffset());
}
}
@@ -419,16 +444,29 @@ public abstract class BasicTextUI extends TextUI
/**
* Receives notification when the model changes.
*/
- UpdateHandler updateHandler = new UpdateHandler();
+ PropertyChangeHandler updateHandler = new PropertyChangeHandler();
/** The DocumentEvent handler. */
DocumentHandler documentHandler = new DocumentHandler();
/**
+ * The standard background color. This is the color which is used to paint
+ * text in enabled text components.
+ */
+ Color background;
+
+ /**
+ * The inactive background color. This is the color which is used to paint
+ * text in disabled text components.
+ */
+ Color inactiveBackground;
+
+ /**
* Creates a new <code>BasicTextUI</code> instance.
*/
public BasicTextUI()
{
+ // Nothing to do here.
}
/**
@@ -506,14 +544,20 @@ public abstract class BasicTextUI extends TextUI
textComponent.setHighlighter(createHighlighter());
String prefix = getPropertyPrefix();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- textComponent.setBackground(defaults.getColor(prefix + ".background"));
- textComponent.setForeground(defaults.getColor(prefix + ".foreground"));
- textComponent.setMargin(defaults.getInsets(prefix + ".margin"));
- textComponent.setBorder(defaults.getBorder(prefix + ".border"));
- textComponent.setFont(defaults.getFont(prefix + ".font"));
-
- caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
+ LookAndFeel.installColorsAndFont(textComponent, prefix + ".background",
+ prefix + ".foreground", prefix + ".font");
+ LookAndFeel.installBorder(textComponent, prefix + ".border");
+ textComponent.setMargin(UIManager.getInsets(prefix + ".margin"));
+
+ caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate"));
+
+ // Fetch the colors for enabled/disabled text components.
+ background = UIManager.getColor(prefix + ".background");
+ inactiveBackground = UIManager.getColor(prefix + ".inactiveBackground");
+ textComponent.setDisabledTextColor
+ (UIManager.getColor(prefix + ".inactiveForeground"));
+ textComponent.setSelectedTextColor(UIManager.getColor(prefix + ".selectionForeground"));
+ textComponent.setSelectionColor(UIManager.getColor(prefix + ".selectionBackground"));
}
/**
@@ -704,6 +748,7 @@ public abstract class BasicTextUI extends TextUI
protected void uninstallListeners()
{
textComponent.removeFocusListener(focuslistener);
+ textComponent.getDocument().removeDocumentListener(documentHandler);
}
/**
@@ -757,6 +802,18 @@ public abstract class BasicTextUI extends TextUI
}
/**
+ * Returns the minimum size for text components. This returns the size
+ * of the component's insets.
+ *
+ * @return the minimum size for text components
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Insets i = c.getInsets();
+ return new Dimension(i.left + i.right, i.top + i.bottom);
+ }
+
+ /**
* Paints the text component.
*
* @param g the <code>Graphics</code> context to paint to
@@ -776,10 +833,10 @@ public abstract class BasicTextUI extends TextUI
{
Caret caret = textComponent.getCaret();
Highlighter highlighter = textComponent.getHighlighter();
-
+
if (textComponent.isOpaque())
paintBackground(g);
-
+
if (highlighter != null
&& textComponent.getSelectionStart() != textComponent.getSelectionEnd())
highlighter.paint(g);
@@ -797,8 +854,10 @@ public abstract class BasicTextUI extends TextUI
*/
protected void paintBackground(Graphics g)
{
- g.setColor(textComponent.getBackground());
- g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());
+ // This method does nothing. All the background filling is done by the
+ // ComponentUI update method. However, the method is called by paint
+ // to provide a way for subclasses to draw something different (e.g.
+ // background images etc) on the background.
}
/**
@@ -885,10 +944,10 @@ public abstract class BasicTextUI extends TextUI
/**
* Maps a position in the document into the coordinate space of the View.
* The output rectangle usually reflects the font height but has a width
- * of zero. A bias of {@link Position.Bias.Forward} is used in this method.
+ * of zero. A bias of {@link Position.Bias#Forward} is used in this method.
*
+ * @param t the text component
* @param pos the position of the character in the model
- * @param a the area that is occupied by the view
*
* @return a rectangle that gives the location of the document position
* inside the view coordinate space
@@ -908,10 +967,10 @@ public abstract class BasicTextUI extends TextUI
* The output rectangle usually reflects the font height but has a width
* of zero.
*
+ * @param t the text component
* @param pos the position of the character in the model
- * @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param bias either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -957,7 +1016,7 @@ public abstract class BasicTextUI extends TextUI
*/
public int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn)
{
- return 0; // FIXME: Implement me.
+ return rootView.viewToModel(pt.x, pt.y, getVisibleEditorRect(), biasReturn);
}
/**
@@ -999,16 +1058,17 @@ public abstract class BasicTextUI extends TextUI
*/
protected Rectangle getVisibleEditorRect()
{
+ JTextComponent textComponent = getComponent();
int width = textComponent.getWidth();
int height = textComponent.getHeight();
if (width <= 0 || height <= 0)
- return null;
+ return new Rectangle(0, 0, 0, 0);
Insets insets = textComponent.getInsets();
return new Rectangle(insets.left, insets.top,
- width - insets.left + insets.right,
- height - insets.top + insets.bottom);
+ width - insets.left - insets.right,
+ height - insets.top - insets.bottom);
}
/**
@@ -1020,6 +1080,8 @@ public abstract class BasicTextUI extends TextUI
{
rootView.setView(view);
view.setParent(rootView);
+ textComponent.revalidate();
+ textComponent.repaint();
}
/**
@@ -1043,4 +1105,17 @@ public abstract class BasicTextUI extends TextUI
View view = factory.create(elem);
setView(view);
}
+
+ /**
+ * Receives notification whenever one of the text component's bound
+ * properties changes. This default implementation does nothing.
+ * It is a hook that enables subclasses to react to property changes
+ * on the text component.
+ *
+ * @param ev the property change event
+ */
+ protected void propertyChange(PropertyChangeEvent ev)
+ {
+ // The default implementation does nothing.
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
index 9106b0b6673..896ea0c89dc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
@@ -38,7 +38,13 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
public class BasicToggleButtonUI extends BasicButtonUI
@@ -58,5 +64,62 @@ public class BasicToggleButtonUI extends BasicButtonUI
{
return "ToggleButton.";
}
-}
+ /**
+ * Paint the component, which is an {@link AbstractButton}, according to
+ * its current state.
+ *
+ * @param g The graphics context to paint with
+ * @param c The component to paint the state of
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ AbstractButton b = (AbstractButton) c;
+
+ Rectangle tr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle vr = new Rectangle();
+
+ Font f = c.getFont();
+
+ g.setFont(f);
+
+ if (b.isBorderPainted())
+ SwingUtilities.calculateInnerArea(b, vr);
+ else
+ vr = SwingUtilities.getLocalBounds(b);
+ String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
+ b.getText(),
+ currentIcon(b),
+ b.getVerticalAlignment(),
+ b.getHorizontalAlignment(),
+ b.getVerticalTextPosition(),
+ b.getHorizontalTextPosition(),
+ vr, ir, tr,
+ b.getIconTextGap()
+ + defaultTextShiftOffset);
+
+ if ((b.getModel().isArmed() && b.getModel().isPressed())
+ || b.isSelected())
+ paintButtonPressed(g, b);
+
+ paintIcon(g, b, ir);
+ if (text != null)
+ paintText(g, b, tr, text);
+ if (b.isFocusOwner() && b.isFocusPainted())
+ paintFocus(g, b, vr, tr, ir);
+ }
+
+ /**
+ * Paints the icon for the toggle button. This delegates to
+ * {@link BasicButtonUI#paintIcon(Graphics, JComponent, Rectangle)}.
+ *
+ * @param g the graphics context
+ * @param b the button to paint the icon for
+ * @param iconRect the area allocated for the icon
+ */
+ protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect)
+ {
+ super.paintIcon(g, b, iconRect);
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
index db29fdca583..79cf0b0c213 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
@@ -43,7 +43,6 @@ import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.JSeparator;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
@@ -73,9 +72,7 @@ public class BasicToolBarSeparatorUI extends BasicSeparatorUI
*/
protected void installDefaults(JSeparator s)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- size = defaults.getDimension("ToolBar.separatorSize");
+ size = UIManager.getDimension("ToolBar.separatorSize");
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
index 8be89efcfa6..ef4ed835f86 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -65,10 +65,11 @@ import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JToolBar;
+import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.RootPaneContainer;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.MouseInputListener;
@@ -133,6 +134,26 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
protected FocusListener toolBarFocusListener;
/**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke leftKey;
+
+ /**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke rightKey;
+
+ /**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke upKey;
+
+ /**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke downKey;
+
+ /**
* The floating window that is responsible for holding the JToolBar when it
* is dragged outside of its original parent.
*/
@@ -566,18 +587,16 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ LookAndFeel.installBorder(toolBar, "ToolBar.border");
+ LookAndFeel.installColorsAndFont(toolBar, "ToolBar.background",
+ "ToolBar.foreground", "ToolBar.font");
- toolBar.setBorder(new ToolBarBorder());
- toolBar.setBackground(defaults.getColor("ToolBar.background"));
- toolBar.setForeground(defaults.getColor("ToolBar.foreground"));
- toolBar.setFont(defaults.getFont("ToolBar.font"));
+ dockingBorderColor = UIManager.getColor("ToolBar.dockingForeground");
+ dockingColor = UIManager.getColor("ToolBar.dockingBackground");
- dockingBorderColor = defaults.getColor("ToolBar.dockingForeground");
- dockingColor = defaults.getColor("ToolBar.dockingBackground");
-
- floatingBorderColor = defaults.getColor("ToolBar.floatingForeground");
- floatingColor = defaults.getColor("ToolBar.floatingBackground");
+ floatingBorderColor = UIManager.getColor("ToolBar.floatingForeground");
+ floatingColor = UIManager.getColor("ToolBar.floatingBackground");
+ setRolloverBorders(toolBar.isRollover());
}
/**
@@ -591,10 +610,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
/**
* This method installs listeners for the JToolBar.
- *
- * @param toolbar The JToolBar to register listeners for.
*/
- protected void installListeners(JToolBar toolbar)
+ protected void installListeners()
{
dockingListener = createDockingListener();
toolBar.addMouseListener(dockingListener);
@@ -694,7 +711,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
toolBar.setOpaque(true);
installDefaults();
installComponents();
- installListeners(toolBar);
+ installListeners();
installKeyboardActions();
}
}
@@ -1000,6 +1017,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -1030,13 +1048,15 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
}
origin = new Point(0, 0);
- SwingUtilities.convertPointToScreen(ssd, toolBar);
+ if (toolBar.isShowing())
+ SwingUtilities.convertPointToScreen(ssd, toolBar);
if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource))
// Need to know who keeps the toolBar if it gets dragged back into it.
origParent = toolBar.getParent();
-
- SwingUtilities.convertPointToScreen(origin, toolBar);
+
+ if (toolBar.isShowing())
+ SwingUtilities.convertPointToScreen(origin, toolBar);
isDragging = true;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java
index b7a08aa728e..5cec2e33365 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java
@@ -1,5 +1,5 @@
/* BasicToolTipUI.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,20 +39,18 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
+import java.awt.Toolkit;
import javax.swing.JComponent;
import javax.swing.JToolTip;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ToolTipUI;
@@ -61,58 +59,12 @@ import javax.swing.plaf.ToolTipUI;
*/
public class BasicToolTipUI extends ToolTipUI
{
- /** The default Border around the JToolTip. */
- private static Border defaultBorder = new Border()
- {
- // FIXME: This needs to go into Basic Look and Feel
- // defaults.
- /**
- * This method returns the border insets.
- *
- * @param c The Component to find Border insets for.
- *
- * @return The Border insets.
- */
- public Insets getBorderInsets(Component c)
- {
- return new Insets(4, 4, 4, 4);
- }
+ /** The shared instance of BasicToolTipUI used for all ToolTips. */
+ private static BasicToolTipUI shared;
- /**
- * This method returns whether the border is opaque.
- *
- * @return Whether the border is opaque.
- */
- public boolean isBorderOpaque()
- {
- return false;
- }
-
- /**
- * This method paints the border.
- *
- * @param c The Component to paint this border around.
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to start painting at.
- * @param y The y coordinate to start painting at.
- * @param w The width of the Component.
- * @param h The height of the Component.
- */
- public void paintBorder(Component c, Graphics g, int x, int y, int w,
- int h)
- {
- Color saved = g.getColor();
- g.setColor(Color.BLACK);
-
- g.drawRect(0, 0, w - 1, h - 1);
-
- g.setColor(saved);
- }
- };
-
- /** The shared instance of BasicToolTipUI used for all ToolTips. */
- private static BasicToolTipUI shared;
+ /** The tooltip's text */
+ private String text;
/**
* Creates a new BasicToolTipUI object.
@@ -124,7 +76,7 @@ public class BasicToolTipUI extends ToolTipUI
/**
* This method creates a new BasicToolTip UI for the given
- * JComponent.
+ * JComponent.
*
* @param c The JComponent to create a UI for.
*
@@ -132,9 +84,9 @@ public class BasicToolTipUI extends ToolTipUI
*/
public static ComponentUI createUI(JComponent c)
{
- if (shared == null)
- shared = new BasicToolTipUI();
- return shared;
+ if (shared == null)
+ shared = new BasicToolTipUI();
+ return shared;
}
/**
@@ -171,12 +123,16 @@ public class BasicToolTipUI extends ToolTipUI
public Dimension getPreferredSize(JComponent c)
{
JToolTip tip = (JToolTip) c;
+ FontMetrics fm;
+ Toolkit g = tip.getToolkit();
+ text = tip.getTipText();
+
Rectangle vr = new Rectangle();
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
Insets insets = tip.getInsets();
- FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont());
- SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null,
+ fm = g.getFontMetrics(tip.getFont());
+ SwingUtilities.layoutCompoundLabel(tip, fm, text, null,
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER,
@@ -192,11 +148,9 @@ public class BasicToolTipUI extends ToolTipUI
*/
protected void installDefaults(JComponent c)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- c.setBackground(defaults.getColor("ToolTip.background"));
- c.setForeground(defaults.getColor("ToolTip.foreground"));
- c.setFont(defaults.getFont("ToolTip.font"));
- c.setBorder(defaultBorder);
+ LookAndFeel.installColorsAndFont(c, "ToolTip.background",
+ "ToolTip.foreground", "ToolTip.font");
+ LookAndFeel.installBorder(c, "ToolTip.border");
}
/**
@@ -206,6 +160,7 @@ public class BasicToolTipUI extends ToolTipUI
*/
protected void installListeners(JComponent c)
{
+ // TODO: Implement this properly.
}
/**
@@ -231,6 +186,7 @@ public class BasicToolTipUI extends ToolTipUI
JToolTip tip = (JToolTip) c;
String text = tip.getTipText();
+ Toolkit t = tip.getToolkit();
if (text == null)
return;
@@ -238,19 +194,19 @@ public class BasicToolTipUI extends ToolTipUI
vr = SwingUtilities.calculateInnerArea(tip, vr);
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
- FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont());
- SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null,
+ FontMetrics fm = t.getFontMetrics(tip.getFont());
+ int ascent = fm.getAscent();
+ SwingUtilities.layoutCompoundLabel(tip, fm, text, null,
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER, vr, ir, tr, 0);
-
Color saved = g.getColor();
g.setColor(Color.BLACK);
- g.drawString(text, vr.x, vr.y + fm.getAscent());
+ g.drawString(text, vr.x, vr.y + ascent);
- g.setColor(saved);
+ g.setColor(saved);
}
/**
@@ -273,6 +229,7 @@ public class BasicToolTipUI extends ToolTipUI
*/
protected void uninstallListeners(JComponent c)
{
+ // TODO: Implement this properly.
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
index 6f714a39cb2..e967cd424fc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
@@ -44,6 +44,7 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
@@ -62,6 +63,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.Enumeration;
import java.util.Hashtable;
import javax.swing.AbstractAction;
@@ -76,6 +78,7 @@ import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIDefaults;
@@ -89,6 +92,7 @@ import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TreeUI;
@@ -96,7 +100,6 @@ import javax.swing.text.Caret;
import javax.swing.tree.AbstractLayoutCache;
import javax.swing.tree.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.FixedHeightLayoutCache;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
@@ -110,11 +113,11 @@ import javax.swing.tree.TreeSelectionModel;
* the Basic look and feel.
*
* @see javax.swing.JTree
- * @author Sascha Brawer (brawer@dandelis.ch)
+ *
* @author Lillian Angel (langel@redhat.com)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class BasicTreeUI
- extends TreeUI
+public class BasicTreeUI extends TreeUI
{
/** Collapse Icon for the tree. */
protected transient Icon collapsedIcon;
@@ -136,9 +139,6 @@ public class BasicTreeUI
*/
protected int totalChildIndent;
- /** Minimum preferred size. */
- protected Dimension preferredMinsize;
-
/** Index of the row that was last selected. */
protected int lastSelectedRow;
@@ -174,6 +174,9 @@ public class BasicTreeUI
/** Size needed to completely display all the nodes. */
protected Dimension preferredSize;
+
+ /** Minimum size needed to completely display all the nodes. */
+ protected Dimension preferredMinSize;
/** Is the preferredSize valid? */
protected boolean validCachedPreferredSize;
@@ -223,38 +226,38 @@ public class BasicTreeUI
/** Set to true if the editor has a different size than the renderer. */
protected boolean editorHasDifferentSize;
-
+
/** The action listener for the editor's Timer. */
- private Timer editorTimer = new EditorUpdateTimer();
+ Timer editorTimer = new EditorUpdateTimer();
/** The new value of the node after editing. */
- private Object newVal;
+ Object newVal;
/** The action bound to KeyStrokes. */
- private TreeAction action;
+ TreeAction action;
/** Boolean to keep track of editing. */
- private boolean isEditing;
+ boolean isEditing;
+
+ /** The bounds of the current cell. */
+ Rectangle bounds;
+
+ /** The current path of the visible nodes in the tree. */
+ TreePath currentVisiblePath;
+
+ /** The gap between the icon and text. */
+ int gap = 4;
/** Listeners */
private PropertyChangeListener propertyChangeListener;
-
private FocusListener focusListener;
-
private TreeSelectionListener treeSelectionListener;
-
- private MouseInputListener mouseInputListener;
-
+ private MouseListener mouseListener;
private KeyListener keyListener;
-
private PropertyChangeListener selectionModelPropertyChangeListener;
-
private ComponentListener componentListener;
-
- private CellEditorListener cellEditorListener;
-
+ CellEditorListener cellEditorListener;
private TreeExpansionListener treeExpansionListener;
-
private TreeModelListener treeModelListener;
/**
@@ -262,6 +265,7 @@ public class BasicTreeUI
*/
public BasicTreeUI()
{
+ validCachedPreferredSize = false;
drawingCache = new Hashtable();
nodeDimensions = createNodeDimensions();
configureLayoutCache();
@@ -269,7 +273,7 @@ public class BasicTreeUI
propertyChangeListener = createPropertyChangeListener();
focusListener = createFocusListener();
treeSelectionListener = createTreeSelectionListener();
- mouseInputListener = new MouseInputHandler(null, null, null);
+ mouseListener = createMouseListener();
keyListener = createKeyListener();
selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();
componentListener = createComponentListener();
@@ -331,7 +335,7 @@ public class BasicTreeUI
*
* @return the indent value for the left child.
*/
- public int getLeftChildIndent(int newAmount)
+ public int getLeftChildIndent()
{
return leftChildIndent;
}
@@ -456,7 +460,6 @@ public class BasicTreeUI
protected void setCellRenderer(TreeCellRenderer tcr)
{
currentCellRenderer = tcr;
- tree.setCellRenderer(tcr);
updateRenderer();
}
@@ -625,14 +628,13 @@ public class BasicTreeUI
{
Object cell = path.getLastPathComponent();
- TreeModel mod = tree.getModel();
- if (mod != null)
+ if (treeModel != null)
{
- Object root = mod.getRoot();
+ Object root = treeModel.getRoot();
+
if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root)))
root = getNextNode(root);
-
- Point loc = getCellLocation(0, 0, tree, mod, cell, root);
+ Point loc = getCellLocation(0, 0, tree, treeModel, cell, root);
return getCellBounds(loc.x, loc.y, cell);
}
}
@@ -650,21 +652,11 @@ public class BasicTreeUI
*/
public TreePath getPathForRow(JTree tree, int row)
{
- TreeModel mod = tree.getModel();
- if (mod != null)
+ if (treeModel != null && currentVisiblePath != null)
{
- Object node = mod.getRoot();
- if (!tree.isRootVisible()
- && tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
- node = getNextNode(node);
-
- for (int i = 0; i < row; i++)
- node = getNextVisibleNode(node);
-
- if (node == null)
- return null;
-
- return new TreePath(getPathToRoot(node, 0));
+ Object[] nodes = currentVisiblePath.getPath();
+ if (row < nodes.length)
+ return new TreePath(getPathToRoot(nodes[row], 0));
}
return null;
}
@@ -683,17 +675,20 @@ public class BasicTreeUI
*/
public int getRowForPath(JTree tree, TreePath path)
{
- int row = path.getPathCount();
- if (tree.isVisible(path))
- return row;
-
- path = path.getParentPath();
- while (row > 0 && !tree.isVisible(path))
+ int row = 0;
+ Object dest = path.getLastPathComponent();
+ int rowCount = getRowCount(tree);
+ if (currentVisiblePath != null)
{
- path = path.getParentPath();
- row--;
+ Object[] nodes = currentVisiblePath.getPath();
+ while (row < rowCount)
+ {
+ if (dest.equals(nodes[row]))
+ return row;
+ row++;
+ }
}
- return row;
+ return -1;
}
/**
@@ -705,22 +700,10 @@ public class BasicTreeUI
*/
public int getRowCount(JTree tree)
{
- TreeModel mod = tree.getModel();
- int count = 0;
- if (mod != null)
- {
- Object node = mod.getRoot();
- if (!tree.isRootVisible()
- && tree.isExpanded(new TreePath((getPathToRoot(node, 0)))))
- node = getNextNode(node);
-
- while (node != null)
- {
- count++;
- node = getNextVisibleNode(node);
- }
- }
- return count;
+ updateCurrentVisiblePath();
+ if (currentVisiblePath != null)
+ return currentVisiblePath.getPathCount();
+ return 0;
}
/**
@@ -739,9 +722,6 @@ public class BasicTreeUI
*/
public TreePath getClosestPathForLocation(JTree tree, int x, int y)
{
- // FIXME: what if root is hidden? should not depend on (0,0)
- // should start counting rows from where root is.
-
int row = Math.round(y / getRowHeight());
TreePath path = getPathForRow(tree, row);
@@ -828,7 +808,7 @@ public class BasicTreeUI
*/
protected void prepareForUIInstall()
{
- // FIXME: not implemented
+ // TODO: Implement this properly.
}
/**
@@ -837,7 +817,7 @@ public class BasicTreeUI
*/
protected void completeUIInstall()
{
- // FIXME: not implemented
+ // TODO: Implement this properly.
}
/**
@@ -846,7 +826,7 @@ public class BasicTreeUI
*/
protected void completeUIUninstall()
{
- // FIXME: not implemented
+ // TODO: Implement this properly.
}
/**
@@ -854,7 +834,10 @@ public class BasicTreeUI
*/
protected void installComponents()
{
- // FIXME: not implemented
+ currentCellRenderer = createDefaultCellRenderer();
+ rendererPane = createCellRendererPane();
+ createdRenderer = true;
+ setCellRenderer(currentCellRenderer);
}
/**
@@ -865,8 +848,7 @@ public class BasicTreeUI
*/
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
{
- // FIXME: not implemented
- return null;
+ return new NodeDimensionsHandler();
}
/**
@@ -1035,7 +1017,7 @@ public class BasicTreeUI
tree.removePropertyChangeListener(propertyChangeListener);
tree.removeFocusListener(focusListener);
tree.removeTreeSelectionListener(treeSelectionListener);
- tree.removeMouseListener(mouseInputListener);
+ tree.removeMouseListener(mouseListener);
tree.removeKeyListener(keyListener);
tree.removePropertyChangeListener(selectionModelPropertyChangeListener);
tree.removeComponentListener(componentListener);
@@ -1044,9 +1026,8 @@ public class BasicTreeUI
TreeCellEditor tce = tree.getCellEditor();
if (tce != null)
tce.removeCellEditorListener(cellEditorListener);
- TreeModel tm = tree.getModel();
- if (tm != null)
- tm.removeTreeModelListener(treeModelListener);
+ if (treeModel != null)
+ treeModel.removeTreeModelListener(treeModelListener);
}
/**
@@ -1054,6 +1035,7 @@ public class BasicTreeUI
*/
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
/**
@@ -1061,7 +1043,10 @@ public class BasicTreeUI
*/
protected void uninstallComponents()
{
- // FIXME: not implemented
+ currentCellRenderer = null;
+ rendererPane = null;
+ createdRenderer = false;
+ setCellRenderer(currentCellRenderer);
}
/**
@@ -1072,8 +1057,7 @@ public class BasicTreeUI
*/
protected int getVerticalLegBuffer()
{
- // FIXME: not implemented
- return 0;
+ return getRowHeight() / 2;
}
/**
@@ -1085,17 +1069,17 @@ public class BasicTreeUI
*/
protected int getHorizontalLegBuffer()
{
- // FIXME: not implemented
- return 0;
+ return rightChildIndent / 2;
}
/**
* Make all the nodes that are expanded in JTree expanded in LayoutCache. This
- * invokes update ExpandedDescendants with the root path.
+ * invokes updateExpandedDescendants with the root path.
*/
protected void updateLayoutCacheExpandedNodes()
{
- // FIXME: not implemented
+ if (treeModel != null)
+ updateExpandedDescendants(new TreePath(treeModel.getRoot()));
}
/**
@@ -1108,7 +1092,9 @@ public class BasicTreeUI
*/
protected void updateExpandedDescendants(TreePath path)
{
- // FIXME: not implemented
+ Enumeration expanded = tree.getExpandedDescendants(path);
+ while (expanded.hasMoreElements())
+ treeState.setExpandedState(((TreePath) expanded.nextElement()), true);
}
/**
@@ -1128,7 +1114,7 @@ public class BasicTreeUI
*/
protected void updateDepthOffset()
{
- // FIXME: not implemented
+ depthOffset += getVerticalLegBuffer();
}
/**
@@ -1148,7 +1134,15 @@ public class BasicTreeUI
*/
protected void updateRenderer()
{
- // FIXME: not implemented
+ if (tree != null)
+ {
+ if(tree.getCellRenderer() == null)
+ {
+ if(currentCellRenderer == null)
+ currentCellRenderer = createDefaultCellRenderer();
+ tree.setCellRenderer(currentCellRenderer);
+ }
+ }
}
/**
@@ -1166,19 +1160,36 @@ public class BasicTreeUI
*/
protected void updateSize()
{
- // FIXME: not implemented
+ preferredSize = null;
+ updateCachedPreferredSize();
+ tree.treeDidChange();
}
/**
* Updates the <code>preferredSize</code> instance variable, which is
- * returned from <code>getPreferredSize()</code>. For left to right
- * orientations, the size is determined from the current AbstractLayoutCache.
- * For RTL orientations, the preferred size becomes the width minus the
- * minimum x position.
+ * returned from <code>getPreferredSize()</code>.
*/
protected void updateCachedPreferredSize()
{
- // FIXME: not implemented
+ int maxWidth = 0;
+ 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);
+ }
+ preferredSize = new Dimension(maxWidth, (getRowHeight() * path.length));
+ }
+ else preferredSize = new Dimension(0, 0);
+ validCachedPreferredSize = true;
}
/**
@@ -1189,7 +1200,9 @@ public class BasicTreeUI
*/
protected void pathWasExpanded(TreePath path)
{
- // FIXME: not implemented
+ validCachedPreferredSize = false;
+ tree.revalidate();
+ tree.repaint();
}
/**
@@ -1197,28 +1210,28 @@ public class BasicTreeUI
*/
protected void pathWasCollapsed(TreePath path)
{
- // FIXME: not implemented
+ validCachedPreferredSize = false;
+ tree.revalidate();
+ tree.repaint();
}
/**
* Install all defaults for the tree.
- *
- * @param tree
- * is the JTree to install defaults for
*/
- protected void installDefaults(JTree tree)
+ protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- tree.setFont(defaults.getFont("Tree.font"));
- tree.setForeground(defaults.getColor("Tree.foreground"));
- tree.setBackground(defaults.getColor("Tree.background"));
+ LookAndFeel.installColorsAndFont(tree, "Tree.background",
+ "Tree.foreground", "Tree.font");
tree.setOpaque(true);
- rightChildIndent = defaults.getInt("Tree.rightChildIndent");
- leftChildIndent = defaults.getInt("Tree.leftChildIndent");
- setRowHeight(defaults.getInt("Tree.rowHeight"));
+ rightChildIndent = UIManager.getInt("Tree.rightChildIndent");
+ leftChildIndent = UIManager.getInt("Tree.leftChildIndent");
+ setRowHeight(UIManager.getInt("Tree.rowHeight"));
+ tree.setRowHeight(UIManager.getInt("Tree.rowHeight"));
tree.requestFocusInWindow(false);
+ tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand"));
+ setExpandedIcon(UIManager.getIcon("Tree.expandedIcon"));
+ setCollapsedIcon(UIManager.getIcon("Tree.collapsedIcon"));
}
/**
@@ -1229,7 +1242,7 @@ public class BasicTreeUI
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
InputMap focusInputMap = (InputMap) defaults.get("Tree.focusInputMap");
InputMapUIResource parentInputMap = new InputMapUIResource();
- ActionMap parentActionMap = new ActionMap();
+ ActionMap parentActionMap = new ActionMapUIResource();
action = new TreeAction();
Object keys[] = focusInputMap.allKeys();
@@ -1308,7 +1321,7 @@ public class BasicTreeUI
tree.addPropertyChangeListener(propertyChangeListener);
tree.addFocusListener(focusListener);
tree.addTreeSelectionListener(treeSelectionListener);
- tree.addMouseListener(mouseInputListener);
+ tree.addMouseListener(mouseListener);
tree.addKeyListener(keyListener);
tree.addPropertyChangeListener(selectionModelPropertyChangeListener);
tree.addComponentListener(componentListener);
@@ -1325,37 +1338,36 @@ public class BasicTreeUI
*/
public void installUI(JComponent c)
{
- super.installUI(c);
- installDefaults((JTree) c);
tree = (JTree) c;
+ prepareForUIInstall();
+ super.installUI(c);
+ installDefaults();
- currentCellRenderer = createDefaultCellRenderer();
- rendererPane = createCellRendererPane();
- createdRenderer = true;
-
+ installComponents();
+ installKeyboardActions();
+ installListeners();
+
setCellEditor(createDefaultCellEditor());
createdCellEditor = true;
isEditing = false;
-
+
TreeModel mod = tree.getModel();
setModel(mod);
- tree.setRootVisible(true);
if (mod != null)
- tree.expandPath(new TreePath(mod.getRoot()));
+ {
+ TreePath path = new TreePath(mod.getRoot());
+ if (!tree.isExpanded(path))
+ toggleExpandState(path);
+ }
treeSelectionModel = tree.getSelectionModel();
- installKeyboardActions();
- installListeners();
completeUIInstall();
}
/**
* Uninstall the defaults for the tree
- *
- * @param tree
- * to uninstall defaults for
*/
- protected void uninstallDefaults(JTree tree)
+ protected void uninstallDefaults()
{
tree.setFont(null);
tree.setForeground(null);
@@ -1370,10 +1382,12 @@ public class BasicTreeUI
*/
public void uninstallUI(JComponent c)
{
- uninstallDefaults((JTree) c);
+ prepareForUIUninstall();
+ uninstallDefaults();
uninstallKeyboardActions();
uninstallListeners();
tree = null;
+ uninstallComponents();
completeUIUninstall();
}
@@ -1393,20 +1407,16 @@ public class BasicTreeUI
public void paint(Graphics g, JComponent c)
{
JTree tree = (JTree) c;
-
- TreeModel mod = tree.getModel();
-
- if (mod != null)
+ if (currentVisiblePath == null)
+ updateCurrentVisiblePath();
+
+ if (currentVisiblePath != null && treeModel != null)
{
- Object root = mod.getRoot();
-
- if (!tree.isRootVisible())
- tree.expandPath(new TreePath(root));
-
- paintRecursive(g, 0, 0, 0, 0, tree, mod, root);
-
+ Object root = treeModel.getRoot();
+ paintRecursive(g, 0, 0, 0, tree, treeModel, root);
+
if (hasControlIcons())
- paintControlIcons(g, 0, 0, 0, 0, tree, mod, root);
+ paintControlIcons(g, 0, 0, 0, tree, treeModel, root);
}
}
@@ -1420,7 +1430,19 @@ public class BasicTreeUI
*/
protected void ensureRowsAreVisible(int beginRow, int endRow)
{
- // FIXME: not implemented
+ if (beginRow < endRow)
+ {
+ int temp = endRow;
+ endRow = beginRow;
+ beginRow = temp;
+ }
+
+ for (int i = beginRow; i < endRow; i++)
+ {
+ TreePath path = getPathForRow(tree, i);
+ if (!tree.isVisible(path))
+ tree.makeVisible(path);
+ }
}
/**
@@ -1431,7 +1453,7 @@ public class BasicTreeUI
*/
public void setPreferredMinSize(Dimension newSize)
{
- // FIXME: not implemented
+ preferredMinSize = newSize;
}
/**
@@ -1441,8 +1463,7 @@ public class BasicTreeUI
*/
public Dimension getPreferredMinSize()
{
- // FIXME: not implemented
- return null;
+ return preferredMinSize;
}
/**
@@ -1472,28 +1493,10 @@ public class BasicTreeUI
*/
public Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
{
- // FIXME: checkConsistancy not implemented, c not used
- TreeModel model = tree.getModel();
- int maxWidth = 0;
- int count = 0;
- if (model != null)
- {
- Object node = model.getRoot();
- if (node != null)
- {
- maxWidth = (int) (getCellBounds(0, 0, node).getWidth());
- while (node != null)
- {
- count++;
- Object nextNode = getNextVisibleNode(node);
- if (nextNode != null)
- maxWidth = Math.max(maxWidth,
- (int) (getCellBounds(0, 0, nextNode).getWidth()));
- node = nextNode;
- }
- }
- }
- return new Dimension(maxWidth, (getRowHeight() * count));
+ // FIXME: checkConsistancy not implemented, c not used
+ if(!validCachedPreferredSize)
+ updateCachedPreferredSize();
+ return preferredSize;
}
/**
@@ -1506,8 +1509,10 @@ public class BasicTreeUI
*/
public Dimension getMinimumSize(JComponent c)
{
- // FIXME: not implemented
- return getPreferredSize(c);
+ Dimension min = getPreferredMinSize();
+ if (min == null)
+ return new Dimension();
+ return min;
}
/**
@@ -1520,8 +1525,9 @@ public class BasicTreeUI
*/
public Dimension getMaximumSize(JComponent c)
{
- // FIXME: not implemented
- return getPreferredSize(c);
+ if (c instanceof JTree)
+ return ((JTree) c).getPreferredSize();
+ return new Dimension();
}
/**
@@ -1565,7 +1571,7 @@ public class BasicTreeUI
}
if (messageTree)
- tree.getModel().valueForPathChanged(tree.getLeadSelectionPath(), newVal);
+ treeModel.valueForPathChanged(tree.getLeadSelectionPath(), newVal);
}
/**
@@ -1584,7 +1590,7 @@ public class BasicTreeUI
int y;
if (event == null)
{
- Rectangle bounds = getPathBounds(tree, path);
+ bounds = getPathBounds(tree, path);
x = bounds.x;
y = bounds.y;
}
@@ -1600,6 +1606,7 @@ public class BasicTreeUI
{
editingPath = path;
editingRow = tree.getRowForPath(editingPath);
+
Object val = editingPath.getLastPathComponent();
cellEditor.addCellEditorListener(cellEditorListener);
stopEditingInCompleteEditing = false;
@@ -1613,6 +1620,8 @@ public class BasicTreeUI
editingComponent.getParent().validate();
tree.add(editingComponent.getParent());
editingComponent.getParent().validate();
+ validCachedPreferredSize = false;
+ tree.revalidate();
((JTextField) editingComponent).requestFocusInWindow(false);
editorTimer.start();
return true;
@@ -1634,7 +1643,8 @@ public class BasicTreeUI
protected void checkForClickInExpandControl(TreePath path, int mouseX,
int mouseY)
{
- // FIXME: not implemented
+ if (isLocationInExpandControl(path, mouseX, mouseY))
+ toggleExpandState(path);
}
/**
@@ -1655,8 +1665,18 @@ public class BasicTreeUI
protected boolean isLocationInExpandControl(TreePath path, int mouseX,
int mouseY)
{
- // FIXME: not implemented
- return false;
+ boolean cntlClick = false;
+ int row = getRowForPath(tree, path);
+
+ if (!isLeaf(row))
+ {
+ bounds = getPathBounds(tree, path);
+
+ if (hasControlIcons() && (mouseX < bounds.x)
+ && (mouseX > (bounds.x - getCurrentControlIcon(path).getIconWidth() - gap)))
+ cntlClick = true;
+ }
+ return cntlClick;
}
/**
@@ -1672,7 +1692,7 @@ public class BasicTreeUI
*/
protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
{
- // FIXME: not implemented
+ toggleExpandState(path);
}
/**
@@ -1686,7 +1706,11 @@ public class BasicTreeUI
*/
protected void toggleExpandState(TreePath path)
{
- // FIXME: not implemented
+ if (tree.isExpanded(path))
+ tree.collapsePath(path);
+ else
+ tree.expandPath(path);
+ updateCurrentVisiblePath();
}
/**
@@ -1700,8 +1724,8 @@ public class BasicTreeUI
*/
protected boolean isToggleSelectionEvent(MouseEvent event)
{
- // FIXME: not implemented
- return false;
+ return (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.SINGLE_TREE_SELECTION);
}
/**
@@ -1715,8 +1739,8 @@ public class BasicTreeUI
*/
protected boolean isMultiSelectEvent(MouseEvent event)
{
- // FIXME: not implemented
- return false;
+ return (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
}
/**
@@ -1731,8 +1755,7 @@ public class BasicTreeUI
*/
protected boolean isToggleEvent(MouseEvent event)
{
- // FIXME: not implemented
- return false;
+ return true;
}
/**
@@ -1749,7 +1772,29 @@ public class BasicTreeUI
*/
protected void selectPathForEvent(TreePath path, MouseEvent event)
{
- // FIXME: not implemented
+ if (isToggleSelectionEvent(event))
+ {
+ if (tree.isPathSelected(path))
+ tree.removeSelectionPath(path);
+ else
+ {
+ tree.addSelectionPath(path);
+ tree.setAnchorSelectionPath(path);
+ }
+ }
+ else if (isMultiSelectEvent(event))
+ {
+ TreePath anchor = tree.getAnchorSelectionPath();
+ if (anchor != null)
+ {
+ int aRow = getRowForPath(tree, anchor);
+ tree.addSelectionInterval(aRow, getRowForPath(tree, path));
+ }
+ else
+ tree.addSelectionPath(path);
+ }
+ else
+ tree.addSelectionPath(path);
}
/**
@@ -1766,7 +1811,7 @@ public class BasicTreeUI
return true;
Object node = pathForRow.getLastPathComponent();
- return tree.getModel().isLeaf(node);
+ return treeModel.isLeaf(node);
}
/**
@@ -1800,9 +1845,9 @@ public class BasicTreeUI
(new TreeTraverseAction(0, "")).actionPerformed(e);
else if (e.getActionCommand().equals("selectAll"))
{
- TreePath[] paths = new TreePath[tree.getRowCount()];
+ TreePath[] paths = new TreePath[tree.getVisibleRowCount()];
- Object curr = getNextVisibleNode(tree.getModel().getRoot());
+ Object curr = getNextVisibleNode(treeModel.getRoot());
int i = 0;
while (curr != null && i < paths.length)
{
@@ -1822,13 +1867,8 @@ public class BasicTreeUI
{
Object last = lead.getLastPathComponent();
TreePath path = new TreePath(getPathToRoot(last, 0));
- if (!tree.getModel().isLeaf(last))
- {
- if (tree.isExpanded(path))
- tree.collapsePath(path);
- else
- tree.expandPath(path);
- }
+ if (!treeModel.isLeaf(last))
+ toggleExpandState(path);
}
}
else if (e.getActionCommand().equals("clearSelection"))
@@ -1920,8 +1960,7 @@ public class BasicTreeUI
/**
* Updates the preferred size when scrolling, if necessary.
*/
- public class ComponentHandler
- extends ComponentAdapter
+ public class ComponentHandler extends ComponentAdapter
implements ActionListener
{
/**
@@ -1937,6 +1976,7 @@ public class BasicTreeUI
*/
public ComponentHandler()
{
+ // Nothing to do here.
}
/**
@@ -1947,6 +1987,7 @@ public class BasicTreeUI
*/
public void componentMoved(ComponentEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -1955,6 +1996,7 @@ public class BasicTreeUI
*/
protected void startTimer()
{
+ // TODO: Implement this properly.
}
/**
@@ -1976,21 +2018,22 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent ae)
{
+ // TODO: Implement this properly.
}
- }// ComponentHandler
+ }
/**
* Listener responsible for getting cell editing events and updating the tree
* accordingly.
*/
- public class CellEditorHandler
- implements CellEditorListener
+ public class CellEditorHandler implements CellEditorListener
{
/**
* Constructor
*/
public CellEditorHandler()
{
+ // Nothing to do here.
}
/**
@@ -2023,6 +2066,9 @@ public class BasicTreeUI
isEditing = false;
tree.requestFocusInWindow(false);
editorTimer.stop();
+ validCachedPreferredSize = false;
+ tree.revalidate();
+ tree.repaint();
}
/**
@@ -2051,6 +2097,8 @@ public class BasicTreeUI
tree.requestFocusInWindow(false);
editorTimer.stop();
isEditing = false;
+ validCachedPreferredSize = false;
+ tree.revalidate();
tree.repaint();
}
}// CellEditorHandler
@@ -2066,6 +2114,7 @@ public class BasicTreeUI
*/
public FocusHandler()
{
+ // Nothing to do here.
}
/**
@@ -2077,6 +2126,7 @@ public class BasicTreeUI
*/
public void focusGained(FocusEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2088,8 +2138,9 @@ public class BasicTreeUI
*/
public void focusLost(FocusEvent e)
{
+ // TODO: Implement this properly.
}
- }// FocusHandler
+ }
/**
* This is used to get multiple key down events to appropriately genereate
@@ -2109,6 +2160,7 @@ public class BasicTreeUI
*/
public KeyHandler()
{
+ // Nothing to do here.
}
/**
@@ -2122,6 +2174,7 @@ public class BasicTreeUI
*/
public void keyTyped(KeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2132,6 +2185,7 @@ public class BasicTreeUI
*/
public void keyPressed(KeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2142,22 +2196,22 @@ public class BasicTreeUI
*/
public void keyReleased(KeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
- }// KeyHandler
+ }
/**
* 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
*/
public MouseHandler()
{
+ // Nothing to do here.
}
/**
@@ -2168,6 +2222,57 @@ public class BasicTreeUI
*/
public void mousePressed(MouseEvent e)
{
+ Point click = e.getPoint();
+ TreePath path = getClosestPathForLocation(tree, click.x, click.y);
+
+ if (path != null)
+ {
+ bounds = getPathBounds(tree, path);
+ int row = getRowForPath(tree, path);
+ boolean cntlClick = isLocationInExpandControl(path, click.x, click.y);
+
+ boolean isLeaf = isLeaf(row);
+
+ TreeCellRenderer tcr = getCellRenderer();
+ Icon icon;
+ if (isLeaf)
+ icon = UIManager.getIcon("Tree.leafIcon");
+ else if (tree.isExpanded(path))
+ icon = UIManager.getIcon("Tree.openIcon");
+ else
+ icon = UIManager.getIcon("Tree.closedIcon");
+
+ if (tcr instanceof DefaultTreeCellRenderer)
+ {
+ Icon tmp = ((DefaultTreeCellRenderer) tcr).getIcon();
+ if (tmp != null)
+ icon = tmp;
+ }
+
+ // add gap*2 for the space before and after the text
+ if (icon != null)
+ bounds.width += icon.getIconWidth() + gap*2;
+
+ boolean inBounds = bounds.contains(click.x, click.y);
+ if ((inBounds || cntlClick) && tree.isVisible(path))
+ {
+ if (inBounds)
+ {
+ selectPath(tree, path);
+ if (e.getClickCount() == 2 && !isLeaf(row))
+ toggleExpandState(path);
+ }
+
+ if (cntlClick)
+ {
+ handleExpandControlClick(path, click.x, click.y);
+ if (cellEditor != null)
+ cellEditor.cancelCellEditing();
+ }
+ else if (tree.isEditable())
+ startEditing(path, e);
+ }
+ }
}
/**
@@ -2181,6 +2286,7 @@ public class BasicTreeUI
*/
public void mouseDragged(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2192,6 +2298,7 @@ public class BasicTreeUI
*/
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2202,16 +2309,16 @@ public class BasicTreeUI
*/
public void mouseReleased(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
- }// MouseHandler
+ }
/**
* MouseInputHandler handles passing all mouse events, including mouse motion
* events, until the mouse is released to the destination it is constructed
* with.
*/
- public class MouseInputHandler
- implements MouseInputListener
+ public class MouseInputHandler implements MouseInputListener
{
/** Source that events are coming from */
protected Component source;
@@ -2232,6 +2339,8 @@ public class BasicTreeUI
public MouseInputHandler(Component source, Component destination,
MouseEvent e)
{
+ this.source = source;
+ this.destination = destination;
}
/**
@@ -2243,6 +2352,7 @@ public class BasicTreeUI
*/
public void mouseClicked(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2253,42 +2363,7 @@ public class BasicTreeUI
*/
public void mousePressed(MouseEvent e)
{
- Point click = e.getPoint();
- int row = Math.round(click.y / getRowHeight());
- TreePath path = getClosestPathForLocation(tree, click.x, click.y);
-
- if (path != null)
- {
- boolean inBounds = false;
- boolean cntlClick = false;
- Rectangle bounds = getPathBounds(tree, path);
-
- bounds.x -= rightChildIndent - 4;
- bounds.width += rightChildIndent + 4;
-
- if (bounds.contains(click.x, click.y))
- inBounds = true;
- else if (hasControlIcons()
- && (click.x < (bounds.x - rightChildIndent + 5) &&
- click.x > (bounds.x - rightChildIndent - 5)))
- cntlClick = true;
-
- if ((inBounds || cntlClick) && tree.isVisible(path))
- {
- selectPath(tree, path);
-
- if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row))
- {
- if (tree.isExpanded(path))
- tree.collapsePath(path);
- else
- tree.expandPath(path);
- }
-
- if (!cntlClick && tree.isEditable())
- startEditing(path, e);
- }
- }
+ // TODO: What should be done here, if anything?
}
/**
@@ -2299,6 +2374,7 @@ public class BasicTreeUI
*/
public void mouseReleased(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2309,6 +2385,7 @@ public class BasicTreeUI
*/
public void mouseEntered(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2319,6 +2396,7 @@ public class BasicTreeUI
*/
public void mouseExited(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2332,6 +2410,7 @@ public class BasicTreeUI
*/
public void mouseDragged(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2343,6 +2422,7 @@ public class BasicTreeUI
*/
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2350,8 +2430,9 @@ public class BasicTreeUI
*/
protected void removeFromSource()
{
+ // TODO: Implement this properly.
}
- }// MouseInputHandler
+ }
/**
* Class responsible for getting size of node, method is forwarded to
@@ -2366,6 +2447,7 @@ public class BasicTreeUI
*/
public NodeDimensionsHandler()
{
+ // Nothing to do here.
}
/**
@@ -2413,6 +2495,7 @@ public class BasicTreeUI
*/
public PropertyChangeHandler()
{
+ // Nothing to do here.
}
/**
@@ -2424,8 +2507,15 @@ public class BasicTreeUI
*/
public void propertyChange(PropertyChangeEvent event)
{
+ if ((event.getPropertyName()).equals("rootVisible"))
+ {
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
+ tree.repaint();
+ }
}
- }// PropertyChangeHandler
+ }
/**
* Listener on the TreeSelectionModel, resets the row selection if any of the
@@ -2440,6 +2530,7 @@ public class BasicTreeUI
*/
public SelectionModelPropertyChangeHandler()
{
+ // Nothing to do here.
}
/**
@@ -2451,8 +2542,9 @@ public class BasicTreeUI
*/
public void propertyChange(PropertyChangeEvent event)
{
+ // TODO: What should be done here, if anything?
}
- }// SelectionModelPropertyChangeHandler
+ }
/**
* ActionListener that invokes cancelEditing when action performed.
@@ -2464,8 +2556,9 @@ public class BasicTreeUI
/**
* Constructor
*/
- public TreeCancelEditingAction()
+ public TreeCancelEditingAction(String name)
{
+ // TODO: Implement this properly.
}
/**
@@ -2476,6 +2569,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2485,9 +2579,10 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly.
return false;
}
- }// TreeCancelEditingAction
+ }
/**
* Updates the TreeState in response to nodes expanding/collapsing.
@@ -2501,6 +2596,7 @@ public class BasicTreeUI
*/
public TreeExpansionHandler()
{
+ // Nothing to do here.
}
/**
@@ -2511,6 +2607,9 @@ public class BasicTreeUI
*/
public void treeExpanded(TreeExpansionEvent event)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2522,6 +2621,9 @@ public class BasicTreeUI
*/
public void treeCollapsed(TreeExpansionEvent event)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
}// TreeExpansionHandler
@@ -2547,6 +2649,7 @@ public class BasicTreeUI
*/
public TreeHomeAction(int direction, String name)
{
+ // TODO: Implement this properly
}
/**
@@ -2557,6 +2660,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly
}
/**
@@ -2566,9 +2670,10 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly
return false;
}
- }// TreeHomeAction
+ }
/**
* TreeIncrementAction is used to handle up/down actions. Selection is moved
@@ -2591,6 +2696,7 @@ public class BasicTreeUI
*/
public TreeIncrementAction(int direction, String name)
{
+ // TODO: Implement this properly
}
/**
@@ -2606,11 +2712,11 @@ public class BasicTreeUI
if (e.getActionCommand().equals("selectPreviousChangeLead"))
{
Object prev = getPreviousVisibleNode(last);
-
+
if (prev != null)
{
TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- selectPath(tree, new TreePath(getPathToRoot(prev, 0)));
+ selectPath(tree, newPath);
tree.setLeadSelectionPath(newPath);
}
}
@@ -2627,15 +2733,17 @@ public class BasicTreeUI
else if (e.getActionCommand().equals("selectPrevious"))
{
Object prev = getPreviousVisibleNode(last);
+
if (prev != null)
{
TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- selectPath(tree, new TreePath(getPathToRoot(prev, 0)));
+ selectPath(tree, newPath);
}
}
else if (e.getActionCommand().equals("selectNext"))
{
Object next = getNextVisibleNode(last);
+
if (next != null)
{
TreePath newPath = new TreePath(getPathToRoot(next, 0));
@@ -2671,21 +2779,22 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly
return false;
}
- }// TreeIncrementAction
+ }
/**
* Forwards all TreeModel events to the TreeState.
*/
- public class TreeModelHandler
- implements TreeModelListener
+ public class TreeModelHandler implements TreeModelListener
{
/**
* Constructor
*/
public TreeModelHandler()
{
+ // Nothing to do here.
}
/**
@@ -2703,6 +2812,9 @@ public class BasicTreeUI
*/
public void treeNodesChanged(TreeModelEvent e)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2716,6 +2828,9 @@ public class BasicTreeUI
*/
public void treeNodesInserted(TreeModelEvent e)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2732,6 +2847,9 @@ public class BasicTreeUI
*/
public void treeNodesRemoved(TreeModelEvent e)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2747,6 +2865,12 @@ public class BasicTreeUI
*/
public void treeStructureChanged(TreeModelEvent e)
{
+ if (e.getPath().length == 1
+ && !e.getPath()[0].equals(treeModel.getRoot()))
+ tree.expandPath(new TreePath(treeModel.getRoot()));
+ updateCurrentVisiblePath();
+ validCachedPreferredSize = false;
+ tree.revalidate();
tree.repaint();
}
}// TreeModelHandler
@@ -2754,8 +2878,7 @@ public class BasicTreeUI
/**
* 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;
@@ -2770,6 +2893,7 @@ public class BasicTreeUI
*/
public TreePageAction(int direction, String name)
{
+ this.direction = direction;
}
/**
@@ -2780,6 +2904,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2797,14 +2922,14 @@ public class BasicTreeUI
* Listens for changes in the selection model and updates the display
* accordingly.
*/
- public class TreeSelectionHandler
- implements TreeSelectionListener
+ public class TreeSelectionHandler implements TreeSelectionListener
{
/**
* Constructor
*/
public TreeSelectionHandler()
{
+ // Nothing to do here.
}
/**
@@ -2824,8 +2949,7 @@ public class BasicTreeUI
/**
* For the first selected row expandedness will be toggled.
*/
- public class TreeToggleAction
- extends AbstractAction
+ public class TreeToggleAction extends AbstractAction
{
/**
* Constructor
@@ -2835,6 +2959,7 @@ public class BasicTreeUI
*/
public TreeToggleAction(String name)
{
+ // Nothing to do here.
}
/**
@@ -2845,6 +2970,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2862,8 +2988,7 @@ public class BasicTreeUI
* 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.
@@ -2880,6 +3005,7 @@ public class BasicTreeUI
*/
public TreeTraverseAction(int direction, String name)
{
+ this.direction = direction;
}
/**
@@ -2890,16 +3016,15 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
- TreeModel mod = tree.getModel();
Object last = tree.getLeadSelectionPath().getLastPathComponent();
if (e.getActionCommand().equals("selectParent"))
{
TreePath path = new TreePath(getPathToRoot(last, 0));
- Object p = getParent(mod.getRoot(), last);
+ Object p = getParent(treeModel.getRoot(), last);
- if (!mod.isLeaf(last) && tree.isExpanded(path))
- tree.collapsePath(path);
+ if (!treeModel.isLeaf(last))
+ toggleExpandState(path);
else if (p != null)
selectPath(tree, new TreePath(getPathToRoot(p, 0)));
}
@@ -2907,8 +3032,8 @@ public class BasicTreeUI
{
TreePath path = new TreePath(getPathToRoot(last, 0));
- if (!mod.isLeaf(last) && tree.isCollapsed(path))
- tree.expandPath(path);
+ if (!treeModel.isLeaf(last))
+ toggleExpandState(path);
else
{
Object next = getNextVisibleNode(last);
@@ -2926,9 +3051,10 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly
return false;
}
- } // TreeTraverseAction
+ }
/**
* Returns the cell bounds for painting selected cells Package private for use
@@ -2951,8 +3077,7 @@ public class BasicTreeUI
FontMetrics fm = tree.getToolkit().getFontMetrics(f);
if (s != null)
- return new Rectangle(x, y,
- SwingUtilities.computeStringWidth(fm, s) + 4,
+ return new Rectangle(x, y, SwingUtilities.computeStringWidth(fm, s),
fm.getHeight());
}
return new Rectangle(x, y, 0, 0);
@@ -2982,80 +3107,19 @@ public class BasicTreeUI
int rowHeight = getRowHeight();
if (startNode == null || startNode.equals(node))
{
- if (!tree.isRootVisible()
- && tree.isExpanded(new TreePath(mod.getRoot())))
- return new Point(x + ((getLevel(node)) * rightChildIndent), y);
-
- return new Point(x + ((getLevel(node) + 1) * rightChildIndent), y);
- }
-
- if (!mod.isLeaf(startNode)
- && tree.isExpanded(new TreePath(getPathToRoot(startNode, 0)))
- && !mod.isLeaf(startNode) && mod.getChildCount(startNode) > 0)
- {
- Object child = mod.getChild(startNode, 0);
- if (child != null)
- return getCellLocation(x, y + rowHeight, tree, mod, node, child);
+ int level = getLevel(node);
+ if (level == 0)
+ return new Point(x, y);
+ if (!tree.isRootVisible() &&
+ tree.isExpanded(new TreePath(mod.getRoot())))
+ return new Point(x + ((level - 1) * rightChildIndent), y);
+ return new Point(x + (level * rightChildIndent), y);
}
-
return getCellLocation(x, y + rowHeight, tree, mod, node,
getNextVisibleNode(startNode));
}
/**
- * Paints a node in the tree Package private for use in inner classes.
- *
- * @param g
- * the Graphics context in which to paint
- * @param x
- * the x location of the node
- * @param y
- * the y location of the node
- * @param tree
- * the tree to draw on
- * @param node
- * the object to draw
- */
- void paintNode(Graphics g, int x, int y, JTree tree, Object node,
- boolean isLeaf)
- {
- TreePath curr = new TreePath(getPathToRoot(node, 0));
- boolean selected = tree.isPathSelected(curr);
- boolean expanded = false;
- boolean hasIcons = false;
-
- if (tree.isVisible(curr))
- {
- if (!isLeaf)
- expanded = tree.isExpanded(curr);
-
- if (editingComponent != null && editingPath != null && isEditing(tree)
- && node.equals(editingPath.getLastPathComponent()))
- {
- Rectangle bounds = getPathBounds(tree, editingPath);
- rendererPane.paintComponent(g, editingComponent.getParent(), null,
- new Rectangle(0, 0, bounds.width,
- bounds.height));
- }
- else
- {
- TreeCellRenderer dtcr = tree.getCellRenderer();
- if (dtcr == null)
- dtcr = createDefaultCellRenderer();
-
- int row = getRowForPath(tree, curr);
-
- Component c = dtcr.getTreeCellRendererComponent(tree, node,
- selected, expanded,
- isLeaf, row, false);
-
- rendererPane.paintComponent(g, c, c.getParent(),
- getCellBounds(x, y, node));
- }
- }
- }
-
- /**
* Recursively paints all elements of the tree Package private for use in
* inner classes.
*
@@ -3065,8 +3129,6 @@ public class BasicTreeUI
* of the current object
* @param descent
* is the number of elements drawn
- * @param childNumber
- * is the index of the current child in the tree
* @param depth
* is the depth of the current object in the tree
* @param tree
@@ -3077,71 +3139,79 @@ public class BasicTreeUI
* is the current object to draw
* @return int - current descent of the tree
*/
- int paintRecursive(Graphics g, int indentation, int descent, int childNumber,
+ int paintRecursive(Graphics g, int indentation, int descent,
int depth, JTree tree, TreeModel mod, Object curr)
{
- Rectangle clip = g.getClipBounds();
+ Rectangle clip = tree.getVisibleRect();
if (indentation > clip.x + clip.width + rightChildIndent
|| descent > clip.y + clip.height + getRowHeight())
return descent;
+ TreePath path = new TreePath(getPathToRoot(curr, 0));
int halfHeight = getRowHeight() / 2;
int halfWidth = rightChildIndent / 2;
int y0 = descent + halfHeight;
int heightOfLine = descent + halfHeight;
+ int row = getRowForPath(tree, path);
boolean isRootVisible = tree.isRootVisible();
-
- if (mod.isLeaf(curr))
+ boolean isExpanded = tree.isExpanded(path);
+ boolean isLeaf = mod.isLeaf(curr);
+ Rectangle bounds = getPathBounds(tree, path);
+ Object root = mod.getRoot();
+
+ if (isLeaf)
{
- paintNode(g, indentation + 4, descent, tree, curr, true);
+ paintRow(g, clip, null, bounds, path, row, true, false, true);
descent += getRowHeight();
}
else
{
if (depth > 0 || isRootVisible)
{
- paintNode(g, indentation + 4, descent, tree, curr, false);
+ paintRow(g, clip, null, bounds, path, row, isExpanded, false, false);
descent += getRowHeight();
y0 += halfHeight;
}
-
- int max = 0;
- if (!mod.isLeaf(curr))
- max = mod.getChildCount(curr);
- if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0))))
+
+ if (isExpanded)
{
+ int max = mod.getChildCount(curr);
for (int i = 0; i < max; i++)
{
+ Object child = mod.getChild(curr, i);
+ boolean childVis = tree.isVisible(new TreePath
+ (getPathToRoot(child, 0)));
int indent = indentation + rightChildIndent;
if (!isRootVisible && depth == 0)
indent = 0;
- else if ((!isRootVisible && !curr.equals(mod.getRoot()))
- || isRootVisible)
+ else if (isRootVisible ||
+ (!isRootVisible && !curr.equals(root)) && childVis)
{
g.setColor(getHashColor());
heightOfLine = descent + halfHeight;
- g.drawLine(indentation + halfWidth, heightOfLine,
- indentation + rightChildIndent, heightOfLine);
+ paintHorizontalLine(g, (JComponent) tree, heightOfLine,
+ indentation + halfWidth, indentation + rightChildIndent);
}
- descent = paintRecursive(g, indent, descent, i, depth + 1,
- tree, mod, mod.getChild(curr, i));
+ descent = paintRecursive(g, indent, descent, depth + 1,
+ tree, mod, child);
}
}
}
- if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0))))
- if (y0 != heightOfLine && !mod.isLeaf(curr)
- && mod.getChildCount(curr) > 0)
+ if (isExpanded)
+ if (y0 != heightOfLine
+ && (mod.getChildCount(curr) > 0 &&
+ tree.isVisible(new TreePath(getPathToRoot(mod.getChild
+ (curr, 0), 0)))))
{
g.setColor(getHashColor());
- g.drawLine(indentation + halfWidth, y0, indentation + halfWidth,
- heightOfLine);
+ paintVerticalLine(g, (JComponent) tree, indentation + halfWidth, y0,
+ heightOfLine);
}
-
return descent;
}
-
+
/**
* Recursively paints all the control icons on the tree. Package private for
* use in inner classes.
@@ -3152,76 +3222,99 @@ public class BasicTreeUI
* of the current object
* @param descent
* is the number of elements drawn
- * @param childNumber
- * is the index of the current child in the tree
* @param depth
* is the depth of the current object in the tree
* @param tree
* is the tree to draw to
* @param mod
* is the TreeModel we are using to draw
- * @param curr
+ * @param node
* is the current object to draw
- * @return int - current descent of the tree
+ * @return int current descent of the tree
*/
int paintControlIcons(Graphics g, int indentation, int descent,
- int childNumber, int depth, JTree tree, TreeModel mod,
+ int depth, JTree tree, TreeModel mod,
Object node)
{
- int h = descent;
int rowHeight = getRowHeight();
- Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon");
- Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon");
- Rectangle clip = g.getClipBounds();
+ TreePath path = new TreePath(getPathToRoot(node, 0));
+ Icon icon = getCurrentControlIcon(path);
+
+ Rectangle clip = tree.getVisibleRect();
if (indentation > clip.x + clip.width + rightChildIndent
|| descent > clip.y + clip.height + getRowHeight())
return descent;
-
+
if (mod.isLeaf(node))
descent += rowHeight;
else
- {
+ {
+ if (!node.equals(mod.getRoot()) &&
+ (tree.isRootVisible() || getLevel(node) != 1))
+ {
+ int width = icon.getIconWidth();
+ int height = icon.getIconHeight() + 2;
+ int posX = indentation - rightChildIndent;
+ int posY = descent;
+ if (width > rightChildIndent)
+ posX -= gap;
+ else posX += width/2;
+
+ if (height < rowHeight)
+ posY += height/2;
+
+ icon.paintIcon(tree, g, posX, posY);
+ }
+
if (depth > 0 || tree.isRootVisible())
descent += rowHeight;
-
- int max = 0;
- if (!mod.isLeaf(node))
- max = mod.getChildCount(node);
- if (tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
+
+ if (tree.isExpanded(path))
{
- if (!node.equals(mod.getRoot()))
- ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h);
-
+ int max = 0;
+ if (!mod.isLeaf(node))
+ max = mod.getChildCount(node);
+
for (int i = 0; i < max; i++)
{
int indent = indentation + rightChildIndent;
+ Object child = mod.getChild(node, i);
if (depth == 0 && !tree.isRootVisible())
- indent = -1;
-
- descent = paintControlIcons(g, indent, descent, i, depth + 1,
- tree, mod, mod.getChild(node, i));
+ indent = 1;
+ if (tree.isVisible(new TreePath(getPathToRoot(child, 0))))
+ descent = paintControlIcons(g, indent, descent, depth + 1,
+ tree, mod, child);
}
}
- else if (!node.equals(mod.getRoot()))
- ci.paintIcon(tree, g, indentation - rightChildIndent - 3,
- descent - getRowHeight());
}
-
+
return descent;
}
/**
- * Returns true if the LookAndFeel implements the control icons Package
+ * Returns true if the LookAndFeel implements the control icons. Package
* private for use in inner classes.
*
- * @return true if control icons are visible
+ * @returns true if there are control icons
*/
boolean hasControlIcons()
{
- if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null
- || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null)
- return false;
- return true;
+ if (expandedIcon != null || collapsedIcon != null)
+ return true;
+ return false;
+ }
+
+ /**
+ * Returns control icon. It is null if the LookAndFeel does not implements the
+ * control icons. Package private for use in inner classes.
+ *
+ * @return control icon if it exists.
+ */
+ Icon getCurrentControlIcon(TreePath path)
+ {
+ if (tree.isExpanded(path))
+ return expandedIcon;
+ return collapsedIcon;
}
/**
@@ -3235,8 +3328,10 @@ public class BasicTreeUI
*/
Object getParent(Object root, Object node)
{
- if (root == null || node == null)
+ if (root == null || node == null ||
+ root.equals(node))
return null;
+
if (node instanceof TreeNode)
return ((TreeNode) node).getParent();
return findNode(root, node);
@@ -3253,113 +3348,69 @@ public class BasicTreeUI
*/
private Object findNode(Object root, Object node)
{
- TreeModel mod = tree.getModel();
- int size = 0;
- if (!mod.isLeaf(root))
- size = mod.getChildCount(root);
- for (int i = 0; i < size; i++)
- {
- if (mod.getIndexOfChild(root, node) != -1)
- return root;
-
- Object n = findNode(mod.getChild(root, i), node);
- if (n != null)
- return n;
- }
- return null;
- }
-
- /**
- * Get next visible node in the tree. Package private for use in inner
- * classes.
- *
- * @param the
- * current node
- * @return the next visible node in the JTree. Return null if there are no
- * more.
- */
- Object getNextVisibleNode(Object node)
- {
- Object next = null;
- TreePath current = null;
-
- if (node != null)
- next = getNextNode(node);
-
- if (next != null)
+ if (!treeModel.isLeaf(root) && !root.equals(node))
{
- current = new TreePath(getPathToRoot(next, 0));
- if (tree.isVisible(current))
- return next;
-
- while (next != null && !tree.isVisible(current))
+ int size = treeModel.getChildCount(root);
+ for (int j = 0; j < size; j++)
{
- next = getNextNode(next);
+ Object child = treeModel.getChild(root, j);
+ if (node.equals(child))
+ return root;
- if (next != null)
- current = new TreePath(getPathToRoot(next, 0));
+ Object n = findNode(child, node);
+ if (n != null)
+ return n;
}
}
- return next;
+ return null;
}
-
+
/**
* Get previous visible node in the tree. Package private for use in inner
* classes.
*
- * @param the
+ * @param node -
* current node
* @return the next visible node in the JTree. Return null if there are no
* more.
*/
Object getPreviousVisibleNode(Object node)
{
- Object prev = null;
- TreePath current = null;
-
- if (node != null)
- prev = getPreviousNode(node);
-
- if (prev != null)
+ updateCurrentVisiblePath();
+ if (currentVisiblePath != null)
{
- current = new TreePath(getPathToRoot(prev, 0));
- if (tree.isVisible(current))
- return prev;
-
- while (prev != null && !tree.isVisible(current))
- {
- prev = getPreviousNode(prev);
-
- if (prev != null)
- current = new TreePath(getPathToRoot(prev, 0));
- }
+ 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 prev;
+ return null;
}
/**
* Returns the next node in the tree Package private for use in inner classes.
*
- * @param the
+ * @param curr -
* current node
* @return the next node in the tree
*/
Object getNextNode(Object curr)
{
- TreeModel mod = tree.getModel();
- if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0)
- return mod.getChild(curr, 0);
+ 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(mod.getRoot(), node);
+ node = getParent(treeModel.getRoot(), node);
}
while (sibling == null && node != null);
-
+
return sibling;
}
@@ -3367,14 +3418,13 @@ public class BasicTreeUI
* Returns the previous node in the tree Package private for use in inner
* classes.
*
- * @param the
+ * @param node
* current node
* @return the previous node in the tree
*/
Object getPreviousNode(Object node)
{
- TreeModel mod = tree.getModel();
- Object parent = getParent(mod.getRoot(), node);
+ Object parent = getParent(treeModel.getRoot(), node);
if (parent == null)
return null;
@@ -3384,13 +3434,13 @@ public class BasicTreeUI
return parent;
int size = 0;
- if (!mod.isLeaf(sibling))
- size = mod.getChildCount(sibling);
+ if (!treeModel.isLeaf(sibling))
+ size = treeModel.getChildCount(sibling);
while (size > 0)
{
- sibling = mod.getChild(sibling, size - 1);
- if (!mod.isLeaf(sibling))
- size = mod.getChildCount(sibling);
+ sibling = treeModel.getChild(sibling, size - 1);
+ if (!treeModel.isLeaf(sibling))
+ size = treeModel.getChildCount(sibling);
else
size = 0;
}
@@ -3402,52 +3452,50 @@ public class BasicTreeUI
* Returns the next sibling in the tree Package private for use in inner
* classes.
*
- * @param the
+ * @param node -
* current node
* @return the next sibling in the tree
*/
Object getNextSibling(Object node)
{
- TreeModel mod = tree.getModel();
- Object parent = getParent(mod.getRoot(), node);
+ Object parent = getParent(treeModel.getRoot(), node);
if (parent == null)
return null;
- int index = mod.getIndexOfChild(parent, node) + 1;
+ int index = treeModel.getIndexOfChild(parent, node) + 1;
int size = 0;
- if (!mod.isLeaf(parent))
- size = mod.getChildCount(parent);
+ if (!treeModel.isLeaf(parent))
+ size = treeModel.getChildCount(parent);
if (index == 0 || index >= size)
return null;
- return mod.getChild(parent, index);
+ return treeModel.getChild(parent, index);
}
-
+
/**
* Returns the previous sibling in the tree Package private for use in inner
* classes.
*
- * @param the
+ * @param node -
* current node
* @return the previous sibling in the tree
*/
Object getPreviousSibling(Object node)
{
- TreeModel mod = tree.getModel();
- Object parent = getParent(mod.getRoot(), node);
+ Object parent = getParent(treeModel.getRoot(), node);
if (parent == null)
return null;
- int index = mod.getIndexOfChild(parent, node) - 1;
+ int index = treeModel.getIndexOfChild(parent, node) - 1;
int size = 0;
- if (!mod.isLeaf(parent))
- size = mod.getChildCount(parent);
+ if (!treeModel.isLeaf(parent))
+ size = treeModel.getChildCount(parent);
if (index < 0 || index >= size)
return null;
- return mod.getChild(parent, index);
+ return treeModel.getChild(parent, index);
}
/**
@@ -3463,22 +3511,24 @@ public class BasicTreeUI
{
if (path != null)
{
- if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
+ if (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.SINGLE_TREE_SELECTION)
{
+ tree.getSelectionModel().clearSelection();
tree.addSelectionPath(path);
tree.setLeadSelectionPath(path);
}
- else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
+ else if (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
{
// TODO
}
else
{
- tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-
- tree.getSelectionModel().clearSelection();
tree.addSelectionPath(path);
tree.setLeadSelectionPath(path);
+ tree.getSelectionModel().setSelectionMode
+ (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
}
}
@@ -3495,7 +3545,6 @@ public class BasicTreeUI
*/
Object[] getPathToRoot(Object node, int depth)
{
- TreeModel mod = tree.getModel();
if (node == null)
{
if (depth == 0)
@@ -3504,7 +3553,7 @@ public class BasicTreeUI
return new Object[depth];
}
- Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1);
+ Object[] path = getPathToRoot(getParent(treeModel.getRoot(), node), depth + 1);
path[path.length - depth - 1] = node;
return path;
}
@@ -3512,22 +3561,23 @@ public class BasicTreeUI
/**
* Returns the level of the node in the tree.
*
- * @param the
+ * @param node -
* current node
* @return the number of the level
*/
int getLevel(Object node)
{
int count = -1;
+
Object current = node;
do
{
- current = getParent(tree.getModel().getRoot(), current);
+ current = getParent(treeModel.getRoot(), current);
count++;
}
while (current != null);
-
+
return count;
}
@@ -3586,10 +3636,271 @@ public class BasicTreeUI
* is the center position in y-direction FIXME what to do if x <
* (icon.width / 2). Same with y
*/
- protected void drawCentered(JComponent c, Graphics g, Icon icon, int x, int y)
+ protected void drawCentered(Component c, Graphics g, Icon icon, int x, int y)
{
int beginPositionX = x - icon.getIconWidth() / 2;
int beginPositionY = y - icon.getIconHeight() / 2;
icon.paintIcon(c, g, beginPositionX, beginPositionY);
}
+
+ /**
+ * 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
+ */
+ protected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
+ {
+ for (int i = x1; i < x2; i += 2)
+ g.drawLine(i, y, i + 1, y);
+ }
+
+ /**
+ * 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
+ */
+ protected void drawDashedVerticalLine(Graphics g, int x, int y1, int y2)
+ {
+ for (int i = y1; i < y2; i += 2)
+ g.drawLine(x, i, x, i + 1);
+ }
+
+ /**
+ * Paints the expand (toggle) part of a row. The receiver should NOT modify
+ * clipBounds, or insets.
+ *
+ * @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
+ */
+ protected void paintExpandControl(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ if (treeModel != null && hasControlIcons())
+ paintControlIcons(g, 0, 0, 0, tree, treeModel, path.getLastPathComponent());
+ }
+
+ /**
+ * Paints the horizontal part of the leg. The receiver should NOT modify
+ * clipBounds, or insets.
+ * NOTE: parentRow can be -1 if the root is not visible.
+ *
+ * @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
+ */
+ protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Paints the vertical part of the leg. The receiver should NOT modify
+ * clipBounds, insets.
+ *
+ * @param g - the graphics configuration.
+ * @param clipBounds -
+ * @param insets -
+ * @param path - the path to draw the vertical part for.
+ */
+ protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, TreePath path)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Paints the renderer part of a row. The receiver should NOT modify clipBounds,
+ * or insets.
+ *
+ * @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
+ */
+ protected void paintRow(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ boolean selected = tree.isPathSelected(path);
+ boolean hasIcons = false;
+ Object node = path.getLastPathComponent();
+
+ if (tree.isVisible(path))
+ {
+ if (!validCachedPreferredSize)
+ updateCachedPreferredSize();
+ bounds.x += gap;
+ bounds.width = preferredSize.width + bounds.x;
+
+ if (editingComponent != null && editingPath != null && isEditing(tree)
+ && node.equals(editingPath.getLastPathComponent()))
+ {
+ rendererPane.paintComponent(g, editingComponent.getParent(), null,
+ bounds);
+ }
+ else
+ {
+ 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);
+ }
+ }
+ }
+
+ /**
+ * Prepares for the UI to uninstall.
+ */
+ protected void prepareForUIUninstall()
+ {
+ // TODO: Implement this properly.
+ }
+
+ /**
+ * 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
+ */
+ protected boolean shouldPaintExpandControl(TreePath path, int row,
+ boolean isExpanded,
+ boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ Object node = path.getLastPathComponent();
+ if (treeModel != null && (!isLeaf && !node.equals(treeModel.getRoot())) &&
+ (tree.isRootVisible() || getLevel(node) != 1))
+ return true;
+ return false;
+ }
+
+ /**
+ * Updates the cached current TreePath of all visible
+ * nodes in the tree.
+ */
+ void updateCurrentVisiblePath()
+ {
+ if (treeModel == null)
+ return;
+
+ Object next = treeModel.getRoot();
+ Rectangle bounds = getCellBounds(0, 0, next);
+ boolean rootVisible = isRootVisible();
+
+ // 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) || (!rootVisible
+ && tree.isExpanded(new TreePath(next))))
+ next = getNextNode(next);
+
+ Object root = next;
+ TreePath current = null;
+ while (next != null)
+ {
+ if (current == null)
+ current = new TreePath(next);
+ 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(treeModel.getRoot(), next);
+ }
+ }
+ }
+ }
+ while (next != null &&
+ !tree.isVisible(new TreePath(getPathToRoot(next, 0))));
+ }
+
+ currentVisiblePath = current;
+ if (currentVisiblePath != null)
+ tree.setVisibleRowCount(currentVisiblePath.getPathCount());
+ else tree.setVisibleRowCount(0);
+
+ if (tree.getSelectionModel() != null && tree.getSelectionCount() == 0 &&
+ currentVisiblePath != null)
+ selectPath(tree, new TreePath(getPathToRoot(currentVisiblePath.
+ getPathComponent(0), 0)));
+ }
+
+ /**
+ * 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.
+ */
+ 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;
+ }
} // BasicTreeUI
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
index 0d461332a70..51b902d6443 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
@@ -38,61 +38,22 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.image.ImageObserver;
-
import javax.swing.JComponent;
-import javax.swing.JViewport;
-import javax.swing.ViewportLayout;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
+import javax.swing.LookAndFeel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ViewportUI;
public class BasicViewportUI extends ViewportUI
{
-
- ChangeListener changeListener;
- Image backingStoreImage;
- int backingStoreWidth = -1;
- int backingStoreHeight = -1;
-
- class ChangeHandler implements ChangeListener
+ protected void installDefaults(JComponent c)
{
- public void stateChanged(ChangeEvent event)
- {
- JViewport v = (JViewport) event.getSource();
- v.repaint();
- }
- }
-
- void installDefaults(JComponent c)
- {
c.setOpaque(true);
+ LookAndFeel.installColorsAndFont(c, "Viewport.background",
+ "Viewport.foreground", "Viewport.font");
}
-
- void uninstallDefaults(JComponent c)
- {
- }
-
- void installListeners(JComponent c)
+ protected void uninstallDefaults(JComponent c)
{
- ((JViewport)c).addChangeListener(changeListener);
- }
-
- void uninstallListeners(JComponent c)
- {
- ((JViewport)c).removeChangeListener(changeListener);
- }
-
- public BasicViewportUI()
- {
- changeListener = new ChangeHandler();
+ // TODO: Implement this properly.
}
public static ComponentUI createUI(JComponent c)
@@ -103,132 +64,12 @@ public class BasicViewportUI extends ViewportUI
public void installUI(JComponent c)
{
super.installUI(c);
- installListeners(c);
+ installDefaults(c);
}
public void uninstallUI(JComponent c)
{
- uninstallListeners(c);
- }
-
-
- public Dimension getPreferredSize(JComponent c)
- {
- // let the ViewportLayout decide
- return null;
- }
-
- public void paint(Graphics g, JComponent c)
- {
- JViewport port = (JViewport)c;
- Component view = port.getView();
-
- if (view == null)
- return;
-
- Point pos = port.getViewPosition();
- Rectangle viewBounds = view.getBounds();
- Rectangle portBounds = port.getBounds();
-
- if (viewBounds.width == 0
- || viewBounds.height == 0
- || portBounds.width == 0
- || portBounds.height == 0)
- return;
-
- switch (port.getScrollMode())
- {
-
- case JViewport.BACKINGSTORE_SCROLL_MODE:
- paintBackingStore(g, port, view, pos, viewBounds, portBounds);
- break;
-
- case JViewport.BLIT_SCROLL_MODE:
- // FIXME: implement separate blit mode
-
- case JViewport.SIMPLE_SCROLL_MODE:
- default:
- paintSimple(g, port, view, pos, viewBounds, portBounds);
- break;
- }
- }
-
- private void paintSimple(Graphics g,
- JViewport v,
- Component view,
- Point pos,
- Rectangle viewBounds,
- Rectangle portBounds)
- {
- Rectangle oldClip = g.getClipBounds();
- g.setClip(new Rectangle(0, 0, portBounds.width, portBounds.height));
- g.translate (-pos.x, -pos.y);
- try
- {
- view.paint(g);
- }
- finally
- {
- g.translate (pos.x, pos.y);
- g.setClip (oldClip);
- }
- }
-
- private void paintBackingStore(Graphics g,
- JViewport v,
- Component view,
- Point pos,
- Rectangle viewBounds,
- Rectangle portBounds)
- {
- if (backingStoreImage == null
- || backingStoreWidth != viewBounds.width
- || backingStoreHeight != viewBounds.height)
- {
- backingStoreImage = v.createImage(viewBounds.width, viewBounds.height);
- backingStoreWidth = viewBounds.width;
- backingStoreHeight = viewBounds.height;
- }
-
- Graphics g2 = backingStoreImage.getGraphics();
-
- if (v.getBackground() != null)
- {
- // fill the backing store background
- java.awt.Color save = g2.getColor();
- g2.setColor(v.getBackground());
- g2.fillRect (0, 0, backingStoreWidth, backingStoreHeight);
- g2.setColor(save);
-
- // fill the viewport background
- save = g.getColor();
- g.setColor(v.getBackground());
- g.fillRect (0, 0, portBounds.width, portBounds.height);
- g.setColor(save);
-
- }
- else
- {
- // clear the backing store background
- g2.clearRect(0, 0, backingStoreWidth, backingStoreHeight);
-
- // clear the viewport background
- g.clearRect(0, 0, portBounds.width, portBounds.height);
- }
-
- g2.setClip(g.getClipBounds());
- g2.translate(-pos.x, -pos.y);
- try
- {
- view.paint(g2);
- }
- finally
- {
- g2.translate(pos.x, pos.y);
- }
- g2 = null;
- g.drawImage(backingStoreImage,
- 0, 0,
- (ImageObserver)null);
+ super.uninstallUI(c);
+ uninstallDefaults(c);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java b/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
index f55510684c6..4fa3b364056 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
@@ -45,21 +45,29 @@ import java.awt.Insets;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
+import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
import javax.swing.JTextField;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
import javax.swing.border.Border;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicBorders;
+import javax.swing.text.JTextComponent;
/**
- * This factory class creates borders for the different Swing components
- * UI.
+ * A factory class that creates borders for the different Swing components.
*
* @author Roman Kennke (roman@kennke.org)
*/
@@ -69,12 +77,24 @@ public class MetalBorders
/** The shared instance for getButtonBorder(). */
private static Border buttonBorder;
+ /** The shared instance for getToggleButtonBorder(). */
+ private static Border toggleButtonBorder;
+
+ /** The shared instance for getDesktopIconBorder(). */
+ private static Border desktopIconBorder;
+
/** The shared instance for getRolloverButtonBorder(). */
private static Border toolbarButtonBorder;
/** The shared instance for getTextFieldBorder(). */
private static Border textFieldBorder;
+ /** The shared instance for getTextBorder(). */
+ private static Border textBorder;
+
+ /** The shared instance for getRolloverBorder(). */
+ private static Border rolloverBorder;
+
/**
* A MarginBorder that gets shared by multiple components.
* Created on demand by the private helper function {@link
@@ -83,20 +103,19 @@ public class MetalBorders
private static BasicBorders.MarginBorder marginBorder;
/**
- * The border that is drawn around Swing buttons.
+ * A border used for {@link JButton} components.
*/
- public static class ButtonBorder
- extends AbstractBorder
- implements UIResource
+ public static class ButtonBorder extends AbstractBorder implements UIResource
{
/** The borders insets. */
protected static Insets borderInsets = new Insets(3, 3, 3, 3);
/**
- * Creates a new instance of ButtonBorder.
+ * Creates a new instance of <code>ButtonBorder</code>.
*/
public ButtonBorder()
{
+ // Nothing to do here.
}
/**
@@ -122,46 +141,55 @@ public class MetalBorders
Color light = MetalLookAndFeel.getWhite();
Color middle = MetalLookAndFeel.getControl();
- // draw dark border
- g.setColor(darkShadow);
- g.drawRect(x, y, w - 2, h - 2);
-
- if (!bmodel.isPressed())
- {
- // draw light border
- g.setColor(light);
- g.drawRect(x + 1, y + 1, w - 2, h - 2);
+ if (c.isEnabled())
+ {
+ // draw dark border
+ g.setColor(darkShadow);
+ g.drawRect(x, y, w - 2, h - 2);
- // draw crossing pixels of both borders
- g.setColor(middle);
- g.drawRect(x + 1, y + h - 2, 0, 0);
- g.drawRect(x + w - 2, y + 1, 0, 0);
- }
- else
- {
- // draw light border
- g.setColor(light);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ if (!bmodel.isPressed())
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawRect(x + 1, y + 1, w - 2, h - 2);
- // draw shadow border
- g.setColor(middle);
- g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
- g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+ // draw crossing pixels of both borders
+ g.setColor(middle);
+ g.drawRect(x + 1, y + h - 2, 0, 0);
+ g.drawRect(x + w - 2, y + 1, 0, 0);
+ }
+ else
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- // draw crossing pixels of both borders
- g.setColor(shadow);
- g.drawRect(x + 1, y + h - 2, 0, 0);
- g.drawRect(x + w - 2, y + 1, 0, 0);
+ // draw shadow border
+ g.setColor(middle);
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+ // draw crossing pixels of both borders
+ g.setColor(shadow);
+ g.drawRect(x + 1, y + h - 2, 0, 0);
+ g.drawRect(x + w - 2, y + 1, 0, 0);
+ }
+ }
+ else
+ {
+ // draw disabled border
+ g.setColor(MetalLookAndFeel.getInactiveControlTextColor());
+ g.drawRect(x, y, w - 2, h - 2);
}
}
/**
- * Returns the insets of the ButtonBorder.
+ * Returns the insets of the <code>ButtonBorder</code>.
*
* @param c the component for which the border is used
*
- * @return the insets of the ButtonBorder
+ * @return The insets of the ButtonBorder
*/
public Insets getBorderInsets(Component c)
{
@@ -169,19 +197,20 @@ public class MetalBorders
}
/**
- * Returns the insets of the ButtonBorder in the specified Insets object.
+ * Returns the insets of the <code>ButtonBorder</code> in the specified
+ * <code>newInsets</code> object.
*
* @param c the component for which the border is used
- * @param newInsets the insets object where to put the values
+ * @param newInsets the insets object where to put the values (if
+ * <code>null</code>, a new instance is created).
*
- * @return the insets of the ButtonBorder
+ * @return The insets.
*/
public Insets getBorderInsets(Component c, Insets newInsets)
{
if (newInsets == null)
newInsets = new Insets(0, 0, 0, 0);
- AbstractButton b = (AbstractButton) c;
newInsets.bottom = borderInsets.bottom;
newInsets.left = borderInsets.left;
newInsets.right = borderInsets.right;
@@ -191,6 +220,71 @@ public class MetalBorders
}
/**
+ * A border used when painting {@link JInternalFrame} instances.
+ */
+ static class DesktopIconBorder extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public DesktopIconBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(3, 3, 2, 3);
+ else
+ {
+ newInsets.top = 3;
+ newInsets.left = 3;
+ newInsets.bottom = 2;
+ newInsets.right = 3;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawRect(x, y, w - 1, h - 1);
+ }
+
+ }
+
+ /**
* A simple 3D border.
*/
public static class Flush3DBorder extends AbstractBorder
@@ -201,6 +295,7 @@ public class MetalBorders
*/
public Flush3DBorder()
{
+ // Nothing to do here.
}
/**
@@ -262,6 +357,88 @@ public class MetalBorders
}
/**
+ * A border used for a {@link JInternalFrame} when it is being used as a
+ * palette.
+ *
+ * @since 1.3
+ */
+ public static class PaletteBorder extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new <code>PaletteBorder</code>.
+ */
+ public PaletteBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @param newInsets the insets object that, if non-<code>null</code>, will
+ * be populated with the result from this method.
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(1, 1, 1, 1);
+ else
+ {
+ newInsets.top = 1;
+ newInsets.left = 1;
+ newInsets.bottom = 1;
+ newInsets.right = 1;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color savedColor = g.getColor();
+
+ // draw the outline
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawRect(x, y, w - 1, h - 1);
+
+ // put a dot in each corner
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x, y, 1, 1);
+ g.fillRect(x + w - 1, y, 1, 1);
+ g.fillRect(x + w - 1, y + h - 1, 1, 1);
+ g.fillRect(x, y + h - 1, 1, 1);
+ g.setColor(savedColor);
+ }
+
+ }
+
+ /**
* A border used for the {@link JTextField} component.
*/
public static class TextFieldBorder extends Flush3DBorder
@@ -272,6 +449,7 @@ public class MetalBorders
*/
public TextFieldBorder()
{
+ // Nothing to do here.
}
/**
@@ -286,8 +464,17 @@ public class MetalBorders
*/
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
- {
- if (c.isEnabled())
+ {
+ boolean enabledTextBorder;
+ if (c instanceof JTextComponent)
+ {
+ JTextComponent tc = (JTextComponent) c;
+ enabledTextBorder = tc.isEnabled() && tc.isEditable();
+ }
+ else
+ enabledTextBorder = false;
+
+ if (enabledTextBorder)
super.paintBorder(c, g, x, y, w, h);
else
{
@@ -301,7 +488,7 @@ public class MetalBorders
}
/**
- * A border used when painting {@link JInternalFrame} instances.
+ * A border used for the {@link JInternalFrame} component.
*/
public static class InternalFrameBorder extends AbstractBorder
implements UIResource
@@ -311,6 +498,7 @@ public class MetalBorders
*/
public InternalFrameBorder()
{
+ // Nothing to do here.
}
/**
@@ -386,7 +574,10 @@ public class MetalBorders
g.drawLine(x + w - 3, y + 14, x + w - 3, y + h - 15);
// draw the line highlights
- g.setColor(MetalLookAndFeel.getControl());
+ if (f.isSelected())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlShadow());
g.drawLine(x + 15, y + 3, x + w - 14, y + 3);
g.drawLine(x + 15, y + h - 2, x + w - 14, y + h - 2);
g.drawLine(x + 3, y + 15, x + 3, y + h - 14);
@@ -396,24 +587,129 @@ public class MetalBorders
}
/**
+ * A border used for {@link JInternalFrame} components that are
+ * presented as dialogs (by the {@link JOptionPane} class).
+ */
+ public static class OptionDialogBorder extends AbstractBorder
+ implements UIResource
+ {
+
+ /**
+ * Creates a new border instance.
+ */
+ public OptionDialogBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(3, 3, 3, 3);
+ else
+ {
+ newInsets.top = 3;
+ newInsets.left = 3;
+ newInsets.bottom = 3;
+ newInsets.right = 3;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+
+ JInternalFrame f = (JInternalFrame) c;
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ if (f.getContentPane() instanceof JOptionPane)
+ {
+ JOptionPane pane = (JOptionPane) f.getContentPane();
+ int type = pane.getMessageType();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ if (type == JOptionPane.QUESTION_MESSAGE)
+ {
+ Color bc = defaults.getColor(
+ "OptionPane.questionDialog.border.background");
+ if (bc != null)
+ g.setColor(bc);
+ }
+ if (type == JOptionPane.WARNING_MESSAGE)
+ {
+ Color bc = defaults.getColor(
+ "OptionPane.warningDialog.border.background");
+ if (bc != null)
+ g.setColor(bc);
+ }
+ else if (type == JOptionPane.ERROR_MESSAGE)
+ {
+ Color bc = defaults.getColor(
+ "OptionPane.errorDialog.border.background");
+ if (bc != null)
+ g.setColor(bc);
+ }
+ }
+
+ // fill the border background
+ g.fillRect(x, y, w, 3);
+ g.fillRect(x, y, 3, h);
+ g.fillRect(x + w - 3, y, 3, h);
+ g.fillRect(x, y + h - 3, w, 3);
+
+ // draw a dot in each corner
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x, y, 1, 1);
+ g.fillRect(x + w - 1, y, 1, 1);
+ g.fillRect(x + w - 1, y + h - 1, 1, 1);
+ g.fillRect(x, y + h - 1, 1, 1);
+
+ }
+
+ }
+
+ /**
* A border used for {@link JMenu} and {@link JMenuItem} components.
*/
- public static class MenuItemBorder
- extends AbstractBorder
- implements UIResource
+ public static class MenuItemBorder extends AbstractBorder
+ implements UIResource
{
/** The border insets. */
- protected static Insets borderInsets = new Insets(2, 2, 2, 2);
-
- // TODO: find where the real colors come from
- private static Color borderColorDark = new Color(102, 102, 153);
- private static Color borderColorLight = new Color(255, 255, 255);
+ protected static Insets borderInsets = new Insets(1, 1, 1, 1);
/**
* Creates a new border instance.
*/
public MenuItemBorder()
{
+ // Nothing to do here.
}
/**
@@ -430,15 +726,17 @@ public class MetalBorders
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
{
+ Color dark = MetalLookAndFeel.getPrimaryControlDarkShadow();
+ Color light = MetalLookAndFeel.getPrimaryControlHighlight();
if (c instanceof JMenu) {
JMenu menu = (JMenu) c;
if (menu.isSelected())
{
- g.setColor(borderColorDark);
+ g.setColor(dark);
g.drawLine(x, y, x, y + h);
g.drawLine(x, y, x + w, y);
g.drawLine(x + w - 2, y + 1, x + w - 2, y + h);
- g.setColor(borderColorLight);
+ g.setColor(light);
g.drawLine(x + w - 1, y + 1, x + w - 1, y + h);
}
}
@@ -446,12 +744,18 @@ public class MetalBorders
{
JMenuItem item = (JMenuItem) c;
if (item.isArmed())
- {
- g.setColor(borderColorDark);
- g.drawLine(x, y, x + w, y);
- g.setColor(borderColorLight);
- g.drawLine(x, y + h - 1, x + w, y + h - 1);
- }
+ {
+ g.setColor(dark);
+ g.drawLine(x, y, x + w, y);
+ g.setColor(light);
+ g.drawLine(x, y + h - 1, x + w, y + h - 1);
+ }
+ else
+ {
+ // Normally we draw a light line on the left.
+ g.setColor(light);
+ g.drawLine(x, y, x, y + h);
+ }
}
}
@@ -505,6 +809,7 @@ public class MetalBorders
*/
public MenuBarBorder()
{
+ // Nothing to do here.
}
/**
@@ -558,7 +863,7 @@ public class MetalBorders
}
/**
- * A border for JScrollPanes.
+ * A border for {@link JScrollPane} components.
*/
public static class ScrollPaneBorder
extends AbstractBorder
@@ -572,6 +877,7 @@ public class MetalBorders
*/
public ScrollPaneBorder()
{
+ // Nothing to do here.
}
/**
@@ -634,6 +940,45 @@ public class MetalBorders
}
/**
+ * A button border that is only visible when the mouse pointer is within
+ * the button's bounds.
+ */
+ public static class RolloverButtonBorder
+ extends MetalBorders.ButtonBorder
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public RolloverButtonBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the border.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ boolean mouseIsOver = false;
+ if (c instanceof AbstractButton)
+ {
+ ButtonModel bmodel = ((AbstractButton) c).getModel();
+ mouseIsOver = bmodel.isRollover();
+ }
+ if (mouseIsOver)
+ super.paintBorder(c, g, x, y, w, h);
+ }
+ }
+
+ /**
* This border is used in Toolbar buttons as inner border.
*/
static class RolloverMarginBorder extends AbstractBorder
@@ -646,6 +991,7 @@ public class MetalBorders
*/
public RolloverMarginBorder()
{
+ // Nothing to do here.
}
/**
@@ -693,13 +1039,14 @@ public class MetalBorders
{
/** The border's insets. */
- protected static Insets borderInsets = new Insets(2, 2, 1, 1);
+ protected static Insets borderInsets = new Insets(3, 1, 2, 1);
/**
* Constructs a new PopupMenuBorder.
*/
public PopupMenuBorder()
{
+ // Nothing to do here.
}
/**
@@ -763,13 +1110,258 @@ public class MetalBorders
// draw highlighted inner border (only top and left)
g.setColor(light);
- g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
}
}
/**
+ * A border used for the {@link JToggleButton} component.
+ *
+ * @since 1.3
+ */
+ public static class ToggleButtonBorder
+ extends ButtonBorder
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public ToggleButtonBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the toggle button border.
+ *
+ * @param c the component for which we paint the border
+ * @param g the Graphics context to use
+ * @param x the X coordinate of the upper left corner of c
+ * @param y the Y coordinate of the upper left corner of c
+ * @param w the width of c
+ * @param h the height of c
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ ButtonModel bmodel = null;
+
+ if (c instanceof AbstractButton)
+ bmodel = ((AbstractButton) c).getModel();
+
+ Color darkShadow = MetalLookAndFeel.getControlDarkShadow();
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ Color light = MetalLookAndFeel.getWhite();
+ Color middle = MetalLookAndFeel.getControl();
+
+ if (c.isEnabled())
+ {
+ // draw dark border
+ g.setColor(darkShadow);
+ g.drawRect(x, y, w - 2, h - 2);
+
+ if (!bmodel.isArmed())
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ if (bmodel.isSelected())
+ g.setColor(middle);
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+
+ // draw crossing pixels of both borders
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
+ }
+ else
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+
+ // draw shadow border
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+ // draw crossing pixels of both borders
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
+
+ }
+ // draw corners
+ g.setColor(middle);
+ g.drawLine(x, y + h - 1, x, y + h - 1);
+ g.drawLine(x + w - 1, y, x + w - 1, y);
+ }
+ else
+ {
+ // draw disabled border
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawRect(x, y, w - 2, h - 2);
+ }
+ }
+ }
+
+ /**
+ * A border used for the {@link JToolBar} component.
+ */
+ public static class ToolBarBorder extends AbstractBorder
+ implements UIResource, SwingConstants
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public ToolBarBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ JToolBar tb = (JToolBar) c;
+ if (tb.getOrientation() == JToolBar.HORIZONTAL)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(2, 16, 2, 2);
+ else
+ {
+ newInsets.top = 2;
+ newInsets.left = 16;
+ newInsets.bottom = 2;
+ newInsets.right = 2;
+ }
+ return newInsets;
+ }
+ else // assume JToolBar.VERTICAL
+ {
+ if (newInsets == null)
+ newInsets = new Insets(16, 2, 2, 2);
+ else
+ {
+ newInsets.top = 16;
+ newInsets.left = 2;
+ newInsets.bottom = 2;
+ newInsets.right = 2;
+ }
+ return newInsets;
+ }
+
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+
+ JToolBar tb = (JToolBar) c;
+ if (tb.getOrientation() == JToolBar.HORIZONTAL)
+ {
+ MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + 11, y + h - 5,
+ MetalLookAndFeel.getControlHighlight(),
+ MetalLookAndFeel.getControlDarkShadow());
+ }
+ else
+ {
+ MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + w - 5, y + 11,
+ MetalLookAndFeel.getControlHighlight(),
+ MetalLookAndFeel.getControlDarkShadow());
+ }
+ }
+
+ }
+
+ /**
+ * A border for table header cells.
+ *
+ * @since 1.3
+ */
+ public static class TableHeaderBorder extends AbstractBorder
+ {
+ /**
+ * The insets of this border.
+ */
+ // TODO: According to tests that I have done, this is really the border
+ // that should be returned by getBorderInsets(). However, the name
+ // is very distracting. Is there any deeper meaning in it?
+ protected Insets editorBorderInsets;
+
+ /**
+ * Creates a new instance of <code>TableHeaderBorder</code>.
+ */
+ public TableHeaderBorder()
+ {
+ editorBorderInsets = new Insets(1, 1, 1, 1);
+ }
+
+ /**
+ * Return the insets of this border.
+ *
+ * @return the insets of this border
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return editorBorderInsets;
+ }
+
+ /**
+ * Paints the border.
+ *
+ * @param c the component for which to paint the border
+ * @param g the graphics context to use
+ * @param x the x cooridinate of the border rectangle
+ * @param y the y cooridinate of the border rectangle
+ * @param w the width of the border rectangle
+ * @param h the height of the border rectangle
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
+ {
+ Color dark = MetalLookAndFeel.getControlDarkShadow();
+ Color light = MetalLookAndFeel.getWhite();
+ Color old = g.getColor();
+ g.setColor(light);
+ g.drawLine(x, y, x + w - 2, y);
+ g.drawLine(x, y, x, y + h - 2);
+ g.setColor(dark);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(old);
+ }
+ }
+
+ /**
* Returns a border for Swing buttons in the Metal Look &amp; Feel.
*
* @return a border for Swing buttons in the Metal Look &amp; Feel
@@ -785,6 +1377,40 @@ public class MetalBorders
}
return buttonBorder;
}
+
+ /**
+ * Returns a border for use with {@link JToggleButton} components.
+ *
+ * @return A border.
+ *
+ * @since 1.3
+ */
+ public static Border getToggleButtonBorder()
+ {
+ if (toggleButtonBorder == null)
+ {
+ Border outer = new ToggleButtonBorder();
+ Border inner = getMarginBorder();
+ toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource
+ (outer, inner);
+ }
+ return toggleButtonBorder;
+ }
+
+ /**
+ * Returns a border instance that is used with a {@link JInternalFrame} when
+ * it is in the iconified state.
+ *
+ * @return A border.
+ *
+ * @since 1.3
+ */
+ public static Border getDesktopIconBorder()
+ {
+ if (desktopIconBorder == null)
+ desktopIconBorder = new DesktopIconBorder();
+ return desktopIconBorder;
+ }
/**
* Returns a border for use by the {@link JTextField} component.
@@ -796,11 +1422,36 @@ public class MetalBorders
public static Border getTextFieldBorder()
{
if (textFieldBorder == null)
- textFieldBorder = new TextFieldBorder();
+ {
+ Border inner = getMarginBorder();
+ Border outer = new TextFieldBorder();
+ textFieldBorder =
+ new BorderUIResource.CompoundBorderUIResource(outer, inner);
+ }
return textFieldBorder;
}
/**
+ * Returns the border that is used for text components (except text fields,
+ * which use {@link #getTextFieldBorder}.
+ *
+ * @return the border that is used for text components
+ *
+ * @since 1.3
+ */
+ public static Border getTextBorder()
+ {
+ if (textBorder == null)
+ {
+ Border inner = getMarginBorder();
+ Border outer = new Flush3DBorder();
+ textBorder =
+ new BorderUIResource.CompoundBorderUIResource(outer, inner);
+ }
+ return textBorder;
+ }
+
+ /**
* Returns a border for Toolbar buttons in the Metal Look &amp; Feel.
*
* @return a border for Toolbar buttons in the Metal Look &amp; Feel
@@ -828,4 +1479,22 @@ public class MetalBorders
marginBorder = new BasicBorders.MarginBorder();
return marginBorder;
}
+
+ /**
+ * Returns a shared instance of a compound border for rollover buttons.
+ *
+ * @return A shared border instance.
+ */
+ static Border getRolloverBorder()
+ {
+ if (rolloverBorder == null)
+ {
+ Border outer = new MetalBorders.RolloverButtonBorder();
+ Border inner = MetalBorders.getMarginBorder();
+ rolloverBorder = new BorderUIResource.CompoundBorderUIResource(outer,
+ inner);
+ }
+ return rolloverBorder;
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java
new file mode 100644
index 00000000000..e6fb22e929f
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java
@@ -0,0 +1,86 @@
+/* MetalButtonListener.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.beans.PropertyChangeEvent;
+
+import javax.swing.AbstractButton;
+import javax.swing.plaf.UIResource;
+import javax.swing.plaf.basic.BasicButtonListener;
+
+/**
+ * A listener for buttons under the {@link MetalLookAndFeel}.
+ *
+ * @see MetalButtonUI#createButtonListener
+ */
+class MetalButtonListener extends BasicButtonListener
+{
+
+ /**
+ * Creates a new instance.
+ *
+ * @param button the button.
+ */
+ public MetalButtonListener(AbstractButton button)
+ {
+ super(button);
+ }
+
+ /**
+ * Handles property change events.
+ *
+ * @param e the event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ super.propertyChange(e);
+ if (e.getPropertyName().equals(
+ AbstractButton.ROLLOVER_ENABLED_CHANGED_PROPERTY))
+ {
+ AbstractButton b = (AbstractButton) e.getSource();
+ if (b.getBorder() instanceof UIResource)
+ {
+ if (Boolean.TRUE.equals(e.getNewValue()))
+ b.setBorder(MetalBorders.getRolloverBorder());
+ else if (Boolean.FALSE.equals(e.getNewValue()))
+ b.setBorder(MetalBorders.getButtonBorder());
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
index 0dac5ec3953..02c39c1499e 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
@@ -39,18 +39,23 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
import javax.swing.AbstractButton;
+import javax.swing.JButton;
import javax.swing.JComponent;
-import javax.swing.JToolBar;
import javax.swing.UIDefaults;
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;
/**
- * The Metal Look &amp; Feel implementation for
- * {@link javax.swing.AbstractButton}s.
+ * A UI delegate for the {@link JButton} component.
*
* @author Roman Kennke (roman@kennke.org)
*/
@@ -58,27 +63,25 @@ public class MetalButtonUI
extends BasicButtonUI
{
- /** The cached MetalButtonUI instance. */
- private static MetalButtonUI instance = null;
-
- /** The color for the focus border. */
+ /** The color used to draw the focus rectangle around the text and/or icon. */
protected Color focusColor;
-
- /** The color that indicates a selected button. */
+
+ /** The background color for the button when it is pressed. */
protected Color selectColor;
/** The color for disabled button labels. */
protected Color disabledTextColor;
/**
- * Creates a new instance of MetalButtonUI.
+ * Creates a new instance.
*/
public MetalButtonUI()
{
super();
- focusColor = getFocusColor();
- selectColor = getSelectColor();
- disabledTextColor = getDisabledTextColor();
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ focusColor = def.getColor(getPropertyPrefix() + "focus");
+ selectColor = def.getColor(getPropertyPrefix() + "select");
+ disabledTextColor = def.getColor(getPropertyPrefix() + "disabledText");
}
/**
@@ -88,8 +91,7 @@ public class MetalButtonUI
*/
protected Color getFocusColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".focus");
+ return focusColor;
}
/**
@@ -99,8 +101,7 @@ public class MetalButtonUI
*/
protected Color getSelectColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".select");
+ return selectColor;
}
/**
@@ -110,36 +111,123 @@ public class MetalButtonUI
*/
protected Color getDisabledTextColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".disabledText");
+ return disabledTextColor;
}
/**
- * Returns an instance of MetalButtonUI.
- *
- * @param component a button for which a UI instance should be returned
+ * Returns a UI delegate for the specified component.
+ *
+ * @param c the component (should be a subclass of {@link AbstractButton}).
+ *
+ * @return A new instance of <code>MetalButtonUI</code>.
*/
- public static ComponentUI createUI(JComponent component)
- {
- if (instance == null)
- instance = new MetalButtonUI();
- return instance;
+ public static ComponentUI createUI(JComponent c) {
+ return new MetalButtonUI();
}
/**
- * Install the Look &amp; Feel defaults for Buttons.
- *
- * @param button the button for which to install the Look &amp; Feel
+ * Installs the default settings for the specified button.
+ *
+ * @param button the button.
+ *
+ * @see #uninstallDefaults(AbstractButton)
*/
public void installDefaults(AbstractButton button)
{
super.installDefaults(button);
+ if (button.isRolloverEnabled())
+ {
+ if (button.getBorder() instanceof UIResource)
+ button.setBorder(MetalBorders.getRolloverBorder());
+ }
+ }
+
+ /**
+ * Removes the defaults added by {@link #installDefaults(AbstractButton)}.
+ */
+ public void uninstallDefaults(AbstractButton button)
+ {
+ super.uninstallDefaults(button);
+ if (button.getBorder() instanceof UIResource)
+ button.setBorder(null);
+ }
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- button.setFont(defaults.getFont("Button.font"));
+ /**
+ * Returns a button listener for the specified button.
+ *
+ * @param button the button.
+ *
+ * @return A button listener.
+ */
+ protected BasicButtonListener createButtonListener(AbstractButton button)
+ {
+ return new MetalButtonListener(button);
+ }
- if (button.getParent() instanceof JToolBar)
- button.setBorder(MetalBorders.getToolbarButtonBorder());
+ /**
+ * Paints the background of the button to indicate that it is in the "pressed"
+ * state.
+ *
+ * @param g the graphics context.
+ * @param b the button.
+ */
+ protected void paintButtonPressed(Graphics g, AbstractButton b)
+ {
+ if (b.isContentAreaFilled())
+ {
+ Rectangle area = b.getVisibleRect();
+ g.setColor(selectColor);
+ g.fillRect(area.x, area.y, area.width, area.height);
+ }
+ }
+
+ /**
+ * Paints the focus rectangle around the button text and/or icon.
+ *
+ * @param g the graphics context.
+ * @param b the button.
+ * @param viewRect the button bounds.
+ * @param textRect the text bounds.
+ * @param iconRect the icon bounds.
+ */
+ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect,
+ Rectangle textRect, Rectangle iconRect) {
+ if (b.isEnabled() && b.hasFocus() && b.isFocusPainted())
+ {
+ Color savedColor = g.getColor();
+ g.setColor(getFocusColor());
+ Rectangle focusRect = iconRect.union(textRect);
+ g.drawRect(focusRect.x - 1, focusRect.y,
+ focusRect.width + 1, focusRect.height);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * Paints the button text.
+ *
+ * @param g the graphics context.
+ * @param c the button.
+ * @param textRect the text bounds.
+ * @param text the text to display.
+ */
+ protected void paintText(Graphics g, JComponent c, Rectangle textRect,
+ String text)
+ {
+ AbstractButton b = (AbstractButton) c;
+ Font f = b.getFont();
+ g.setFont(f);
+ FontMetrics fm = g.getFontMetrics(f);
+
+ if (b.isEnabled())
+ {
+ g.setColor(b.getForeground());
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
+ }
+ else
+ {
+ g.setColor(getDisabledTextColor());
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
+ }
}
-
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
index 3f3c9ce58b3..6b9f31b85b6 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
@@ -38,10 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
-
import java.io.Serializable;
import javax.swing.Icon;
@@ -49,8 +47,7 @@ import javax.swing.JCheckBox;
import javax.swing.plaf.UIResource;
/**
- * An {@link Icon} implementation for {@link JCheckBox}es in the
- * Metal Look &amp; Feel.
+ * An {@link Icon} used by the {@link MetalCheckBoxUI} class.
*
* @author Roman Kennke (roman@kennke.org)
*/
@@ -79,7 +76,10 @@ public class MetalCheckBoxIcon
*/
protected void drawCheck(Component c, Graphics g, int x, int y)
{
- g.setColor(Color.BLACK);
+ if (c.isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
index c46cb5f2fb1..b4f6f0a56cd 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
@@ -44,8 +44,7 @@ import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
/**
- * A UI delegate for the {@link JCheckBox} component under the
- * {@link MetalLookAndFeel}.
+ * A UI delegate for the {@link JCheckBox} component.
*/
public class MetalCheckBoxUI
extends MetalRadioButtonUI
@@ -64,11 +63,11 @@ public class MetalCheckBoxUI
}
/**
- * Returns an instance of MetalCheckBoxUI.
+ * Returns a shared instance of <code>MetalCheckBoxUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalCheckBoxUI
+ * @return A shared instance of <code>MetalCheckBoxUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java
new file mode 100644
index 00000000000..6993e18e9b9
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java
@@ -0,0 +1,241 @@
+/* MetalComboBoxButton.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import javax.swing.CellRendererPane;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JList;
+import javax.swing.SwingUtilities;
+
+/**
+ * A button used by the {@link MetalComboBoxUI} class.
+ */
+public class MetalComboBoxButton extends JButton {
+
+ /** A reference to the JComboBox that the button belongs to. */
+ protected JComboBox comboBox;
+
+ /** A reference to the JList. */
+ protected JList listBox;
+
+ /** ??? */
+ protected CellRendererPane rendererPane;
+
+ /** The button icon. */
+ protected Icon comboIcon;
+
+ /** Display just the icon, or the icon plus the label. */
+ protected boolean iconOnly;
+
+ /**
+ * Creates a new button.
+ *
+ * @param cb the combo that the button is used for (<code>null</code> not
+ * permitted).
+ * @param i the icon displayed on the button.
+ * @param pane the rendering pane.
+ * @param list the list.
+ */
+ public MetalComboBoxButton(JComboBox cb, Icon i, CellRendererPane pane,
+ JList list)
+ {
+ this(cb, i, cb.isEditable(), pane, list);
+ }
+
+ /**
+ * Creates a new button.
+ *
+ * @param cb the combo that the button is used for (<code>null</code> not
+ * permitted).
+ * @param i the icon displayed on the button.
+ * @parma onlyIcon a flag that specifies whether the button displays only an
+ * icon, or text as well.
+ * @param pane the rendering pane.
+ * @param list the list.
+ */
+ public MetalComboBoxButton(JComboBox cb, Icon i, boolean onlyIcon,
+ CellRendererPane pane, JList list)
+ {
+ super();
+ if (cb == null)
+ throw new NullPointerException("Null 'cb' argument");
+ comboBox = cb;
+ comboIcon = i;
+ iconOnly = onlyIcon;
+ listBox = list;
+ rendererPane = pane;
+ }
+
+ /**
+ * Returns the combo box that the button is used with.
+ *
+ * @return The combo box.
+ */
+ public final JComboBox getComboBox()
+ {
+ return comboBox;
+ }
+
+ /**
+ * Sets the combo box that the button is used with.
+ *
+ * @param cb the combo box.
+ */
+ public final void setComboBox(JComboBox cb)
+ {
+ comboBox = cb;
+ }
+
+ /**
+ * Returns the icon displayed by the button. By default, this will be an
+ * instance of {@link MetalComboBoxIcon}.
+ *
+ * @return The icon displayed by the button.
+ */
+ public final Icon getComboIcon()
+ {
+ return comboIcon;
+ }
+
+ /**
+ * Sets the icon displayed by the button.
+ *
+ * @param i the icon.
+ */
+ public final void setComboIcon(Icon i)
+ {
+ comboIcon = i;
+ }
+
+ /**
+ * Returns a flag that controls whether the button displays an icon only,
+ * or text as well.
+ *
+ * @return A boolean.
+ */
+ public final boolean isIconOnly()
+ {
+ return iconOnly;
+ }
+
+ /**
+ * Sets the flag that controls whether the button displays an icon only,
+ * or text as well.
+ *
+ * @param isIconOnly the flag.
+ */
+ public final void setIconOnly(boolean isIconOnly)
+ {
+ iconOnly = isIconOnly;
+ }
+
+ /**
+ * Returns <code>false</code>, to indicate that this component is not part
+ * of the focus traversal group.
+ *
+ * @return <code>false</code>
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
+ * Enables or disables the button.
+ *
+ * @param enabled the new status.
+ */
+ public void setEnabled(boolean enabled)
+ {
+ super.setEnabled(enabled);
+ // TODO: figure out what this might need to be used for
+ // perhaps it has something to do with the button's icon and/or border?
+ }
+
+ /**
+ * Paints the component.
+ *
+ * @param g the graphics device.
+ */
+ public void paintComponent(Graphics g)
+ {
+ super.paintComponent(g);
+ if (iconOnly)
+ {
+ Rectangle bounds = getBounds();
+ int x = (bounds.width - comboIcon.getIconWidth()) / 2;
+ int y = (bounds.height - comboIcon.getIconHeight()) / 2;
+ comboIcon.paintIcon(comboBox, g, x, y);
+ }
+ else
+ {
+ Object selected = comboBox.getModel().getSelectedItem();
+ if (selected == null)
+ selected = "";
+ Rectangle bounds = comboBox.getBounds();
+ Rectangle innerArea = SwingUtilities.calculateInnerArea(this, null);
+ Insets insets = comboBox.getInsets();
+ Rectangle renderArea = new Rectangle(innerArea.x, innerArea.y,
+ innerArea.width - comboIcon.getIconWidth() - 4, innerArea.height);
+ Component cellRenderer
+ = comboBox.getRenderer().getListCellRendererComponent(this.listBox,
+ selected, comboBox.getSelectedIndex(), false, false);
+ cellRenderer.setBackground(comboBox.getBackground());
+ cellRenderer.setEnabled(comboBox.isEnabled());
+ rendererPane.paintComponent(g, cellRenderer, this, renderArea);
+ if (comboBox.hasFocus())
+ {
+ g.setColor(MetalLookAndFeel.getFocusColor());
+ g.drawRect(innerArea.x, innerArea.y - 1, innerArea.width - 1,
+ innerArea.height);
+ }
+ int iconX = bounds.width - insets.right - comboIcon.getIconWidth() - 7;
+ int iconY = insets.top
+ + (bounds.height - comboIcon.getIconHeight()) / 2;
+ comboIcon.paintIcon(comboBox, g, iconX, iconY);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java
new file mode 100644
index 00000000000..a531079cb1d
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java
@@ -0,0 +1,143 @@
+/* MetalComboBoxEditor.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
+import javax.swing.JTextField;
+import javax.swing.plaf.basic.BasicComboBoxEditor;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.MetalBorders.Flush3DBorder;
+
+/**
+ * An editor used by the {@link MetalComboBoxUI} class.
+ */
+public class MetalComboBoxEditor extends BasicComboBoxEditor
+{
+ /**
+ * A border used for the {@link JTextField} component.
+ */
+ static class MetalComboBoxEditorBorder extends Flush3DBorder
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public MetalComboBoxEditorBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color savedColor = g.getColor();
+ if (c.isEnabled())
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 2);
+ g.drawLine(x + 2, y + h - 2, x + w - 1, y + h - 2);
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(savedColor);
+ }
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge, which is zero
+ * for the default implementation provided by AbstractButton.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return editorBorderInsets;
+ }
+ }
+
+ /**
+ * A subclass of {@link MetalComboBoxEditor} that implements the
+ * {@link javax.swing.plaf.UIResource} interface.
+ */
+ public static class UIResource extends MetalComboBoxEditor
+ implements javax.swing.plaf.UIResource
+ {
+ /**
+ * Creates a new instance.
+ */
+ public UIResource()
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /** The editor's border insets. */
+ protected static Insets editorBorderInsets = new Insets(4, 2, 4, 0);
+
+ /**
+ * Creates a new editor.
+ */
+ public MetalComboBoxEditor()
+ {
+ super();
+ editor.setBorder(new MetalComboBoxEditorBorder());
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java
index ce4fa7d32ce..f21c5af6136 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java
@@ -1,4 +1,4 @@
-/* MetalComboBoxButton.java
+/* MetalComboBoxIcon.java
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,10 +88,11 @@ public class MetalComboBoxIcon implements Icon, Serializable {
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- // TODO: work out whether/how the icon changes with different component
- // states (and also different metal themes)
Color savedColor = g.getColor();
- g.setColor(Color.black);
+ if (c.isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
for (int i = 0; i < 5; i++)
g.drawLine(x + i, y + i, x + 9 - i, y + i);
g.setColor(savedColor);
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
index 28c279d8ed6..a43ee3cb04f 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
@@ -38,20 +38,134 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.CellRendererPane;
+import javax.swing.ComboBoxEditor;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.basic.BasicComboPopup;
+import javax.swing.plaf.basic.ComboPopup;
-public class MetalComboBoxUI
- extends BasicComboBoxUI
-{
- /** The UI instances for JComboBoxes. */
- private static HashMap instances = null;
+/**
+ * A UI delegate for the {@link JComboBox} component.
+ */
+public class MetalComboBoxUI extends BasicComboBoxUI
+{
+ /**
+ * A layout manager that arranges the editor component (if active) and the
+ * button that make up the combo box.
+ */
+ public class MetalComboBoxLayoutManager
+ extends BasicComboBoxUI.ComboBoxLayoutManager
+ {
+ /**
+ * Creates a new instance of the layout manager.
+ */
+ public MetalComboBoxLayoutManager()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Arranges the editor (if visible) and button that comprise the combo
+ * box.
+ *
+ * @param parent the parent.
+ */
+ public void layoutContainer(Container parent)
+ {
+ JComboBox cb = (JComboBox) parent;
+ if (!cb.isEditable())
+ {
+ Rectangle bounds = parent.getBounds();
+ arrowButton.setBounds(0, 0, bounds.width, bounds.height);
+ }
+ else
+ superLayout(parent);
+ }
+
+ /**
+ * Calls the <code>layoutContainer(Container)</code> method in the super
+ * class.
+ *
+ * @param parent the container.
+ */
+ public void superLayout(Container parent)
+ {
+ super.layoutContainer(parent);
+ }
+ }
+
+ /**
+ * A listener used to handle property changes in the {@link JComboBox}
+ * component, to ensure that the UI delegate accurately reflects the current
+ * state in the rendering onscreen.
+ */
+ public class MetalPropertyChangeListener
+ extends BasicComboBoxUI.PropertyChangeHandler
+ {
+ /**
+ * Creates a new listener.
+ */
+ public MetalPropertyChangeListener()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles a property change event, updating the UI components as
+ * appropriate.
+ *
+ * @param e the event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals("editable"))
+ editablePropertyChanged(e);
+ super.propertyChange(e);
+ }
+ }
/**
+ * A popup menu for the combo-box.
+ *
+ * @see #createPopup()
+ *
+ * @deprecated 1.4
+ */
+ public class MetalComboPopup extends BasicComboPopup
+ {
+ /**
+ * Creates a new popup.
+ *
+ * @param cBox the combo box.
+ */
+ public MetalComboPopup(JComboBox cBox)
+ {
+ super(cBox);
+ }
+
+ public void delegateFocus(MouseEvent e)
+ {
+ super.delegateFocus(e);
+ }
+ }
+
+ /**
* Constructs a new instance of MetalComboBoxUI.
*/
public MetalComboBoxUI()
@@ -68,19 +182,135 @@ public class MetalComboBoxUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalComboBoxUI instance;
- if (o == null)
+ return new MetalComboBoxUI();
+ }
+
+ /**
+ * Creates an editor for the combo box.
+ *
+ * @return An editor.
+ */
+ protected ComboBoxEditor createEditor()
+ {
+ return new MetalComboBoxEditor.UIResource();
+ }
+
+ /**
+ * Creates a popup for the combo box.
+ *
+ * @return A popup.
+ */
+ protected ComboPopup createPopup()
+ {
+ return new MetalComboPopup(comboBox);
+ }
+
+ /**
+ * Creates a new button for use in rendering the JComboBox.
+ *
+ * @return A button.
+ */
+ protected JButton createArrowButton()
+ {
+ JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),
+ new CellRendererPane(), listBox);
+ button.setMargin(new Insets(0, 1, 1, 3));
+ return button;
+ }
+
+ /**
+ * Creates a new property change listener.
+ *
+ * @return A new property change listener.
+ */
+ public PropertyChangeListener createPropertyChangeListener()
+ {
+ return new MetalPropertyChangeListener();
+ }
+
+ public void paint(Graphics g, JComponent c)
+ {
+ // do nothing, the button and text field are painted elsewhere
+ }
+
+ /**
+ * Updates the button and text field to reflect a change in the 'editable'
+ * property.
+ *
+ * @param e the event.
+ *
+ * @deprecated 1.4
+ */
+ protected void editablePropertyChanged(PropertyChangeEvent e)
+ {
+ if (arrowButton instanceof MetalComboBoxButton)
+ {
+ MetalComboBoxButton b = (MetalComboBoxButton) arrowButton;
+ b.setIconOnly(comboBox.isEditable());
+ }
+ if (comboBox.isEditable())
{
- instance = new MetalComboBoxUI();
- instances.put(component, instance);
+ arrowButton.setText(null);
+ if (editor != null)
+ editor.setVisible(true);
}
else
- instance = (MetalComboBoxUI) o;
-
- return instance;
+ {
+ String text = "";
+ Object selected = comboBox.getSelectedItem();
+ if (selected != null)
+ text = selected.toString();
+ arrowButton.setText(text);
+ if (editor != null)
+ editor.setVisible(true);
+ }
+ }
+
+ /**
+ * Creates a new layout manager for the UI delegate.
+ *
+ * @return A new layout manager.
+ */
+ protected LayoutManager createLayoutManager()
+ {
+ return new MetalComboBoxLayoutManager();
+ }
+
+ /**
+ * Not used in Classpath.
+ *
+ * @deprecated 1.4
+ */
+ protected void removeListeners()
+ {
+ // no longer used in JDK 1.4
+ }
+
+ /**
+ * Returns the minimum size for the combo.
+ *
+ * @param c the component
+ *
+ * @return The minimum size for the combo box.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension d = getDisplaySize();
+ MetalComboBoxButton b = (MetalComboBoxButton) arrowButton;
+ Insets insets = b.getInsets();
+ int insetsH = insets.top + insets.bottom;
+ int insetsW = insets.left + insets.right;
+ if (!comboBox.isEditable())
+ {
+ Icon icon = b.getComboIcon();
+ int iconWidth = icon.getIconWidth() + 6;
+ return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH);
+ }
+ else
+ // FIXME: the following dimensions pass most of the Mauve tests, but
+ // I don't yet understand the logic behind this...it is probably wrong
+ return new Dimension(d.width + insetsW + (d.height + insetsH) - 4,
+ d.height + insetsH + 1);
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java
index 00870545bc6..ecbb76e6e7a 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java
@@ -39,9 +39,13 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JInternalFrame;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicDesktopIconUI;
+/**
+ * A UI delegate for the {@link JInternalFrame.JDesktopIcon} component.
+ */
public class MetalDesktopIconUI
extends BasicDesktopIconUI
{
@@ -51,7 +55,7 @@ public class MetalDesktopIconUI
private static MetalDesktopIconUI instance = null;
/**
- * Constructs a new instance of MetalDesktopIconUI.
+ * Constructs a new instance of <code>MetalDesktopIconUI</code>.
*/
public MetalDesktopIconUI()
{
@@ -59,11 +63,11 @@ public class MetalDesktopIconUI
}
/**
- * Returns an instance of MetalDesktopIconUI.
+ * Returns a shared instance of <code>MetalDesktopIconUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalDesktopIconUI
+ * @return A shared instance of <code>MetalDesktopIconUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java
new file mode 100644
index 00000000000..3a2e1c13508
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java
@@ -0,0 +1,430 @@
+/* MetalFileChooserUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JList;
+import javax.swing.UIManager;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileSystemView;
+import javax.swing.filechooser.FileView;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+
+/**
+ * A UI delegate for the {@link JFileChooser} component. This class is only
+ * partially implemented and is not usable yet.
+ */
+public class MetalFileChooserUI extends BasicFileChooserUI
+{
+ /**
+ * A combo box model containing the selected directory and all its parent
+ * directories.
+ */
+ protected class DirectoryComboBoxModel extends AbstractListModel
+ implements ComboBoxModel
+ {
+ /** Storage for the items in the model. */
+ private List items;
+
+ /** The index of the selected item. */
+ private int selectedIndex;
+
+ /**
+ * Creates a new model.
+ */
+ public DirectoryComboBoxModel()
+ {
+ items = new java.util.ArrayList();
+ selectedIndex = -1;
+ }
+
+ /**
+ * Returns the number of items in the model.
+ *
+ * @return The number of items in the model.
+ */
+ public int getSize()
+ {
+ return items.size();
+ }
+
+ /**
+ * Returns the item at the specified index.
+ *
+ * @param index the item index.
+ *
+ * @return The item.
+ */
+ public Object getElementAt(int index)
+ {
+ return items.get(index);
+ }
+
+ /**
+ * Returns the depth of the item at the given <code>index</code>.
+ *
+ * @param index the item index.
+ *
+ * @return The depth.
+ */
+ public int getDepth(int index)
+ {
+ return Math.max(index, 0);
+ }
+
+ /**
+ * Returns the selected item, or <code>null</code> if no item is selected.
+ *
+ * @return The selected item, or <code>null</code>.
+ */
+ public Object getSelectedItem()
+ {
+ if (selectedIndex >= 0)
+ return items.get(selectedIndex);
+ else
+ return null;
+ }
+
+ /**
+ * Sets the selected item. This clears all the directories from the
+ * existing list, and repopulates it with the new selected directory
+ * and all its parent directories.
+ *
+ * @param selectedDirectory the selected directory.
+ */
+ public void setSelectedItem(Object selectedDirectory)
+ {
+ items.clear();
+ FileSystemView fsv = getFileChooser().getFileSystemView();
+ File parent = (File) selectedDirectory;
+ while (parent != null)
+ {
+ items.add(0, parent);
+ parent = fsv.getParentDirectory(parent);
+ }
+ selectedIndex = items.indexOf(selectedDirectory);
+ fireContentsChanged(this, 0, items.size() - 1);
+ }
+
+ }
+
+ /**
+ * Handles changes to the selection in the directory combo box.
+ */
+ protected class DirectoryComboBoxAction extends AbstractAction
+ {
+ /**
+ * Creates a new action.
+ */
+ protected DirectoryComboBoxAction()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles the action event.
+ *
+ * @param e the event.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ JFileChooser fc = getFileChooser();
+ fc.setCurrentDirectory((File) directoryModel.getSelectedItem());
+ }
+ }
+
+ /**
+ * A renderer for the files and directories in the file chooser.
+ */
+ protected class FileRenderer extends DefaultListCellRenderer
+ {
+
+ /**
+ * Creates a new renderer.
+ */
+ protected FileRenderer()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns a component that can render the specified value.
+ *
+ * @param list the list.
+ * @param value the value (a {@link File}).
+ * @param index the index.
+ * @param isSelected is the item selected?
+ * @param cellHasFocus does the item have the focus?
+ *
+ * @return The renderer.
+ */
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus)
+ {
+ FileView v = getFileView(getFileChooser());
+ File f = (File) value;
+ setText(v.getName(f));
+ setIcon(v.getIcon(f));
+ if (isSelected)
+ {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ }
+ else
+ {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+
+ setEnabled(list.isEnabled());
+ setFont(list.getFont());
+
+ if (cellHasFocus)
+ setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
+ else
+ setBorder(noFocusBorder);
+ return this;
+ }
+ }
+
+ /**
+ * A combo box model for the file selection filters.
+ */
+ protected class FilterComboBoxModel
+ extends AbstractListModel
+ implements ComboBoxModel, PropertyChangeListener
+ {
+
+ /** Storage for the filters in the model. */
+ protected FileFilter[] filters;
+
+ /** The index of the selected file filter. */
+ private int selectedIndex;
+
+ /**
+ * Creates a new model.
+ */
+ protected FilterComboBoxModel()
+ {
+ filters = new FileFilter[1];
+ filters[0] = getAcceptAllFileFilter(getFileChooser());
+ selectedIndex = 0;
+ }
+
+ /**
+ * Handles property changes.
+ *
+ * @param e the property change event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
+ {
+ selectedIndex = -1;
+ FileFilter selected = (FileFilter) e.getNewValue();
+ for (int i = 0; i < filters.length; i++)
+ if (filters[i].equals(selected))
+ selectedIndex = i;
+ fireContentsChanged(this, -1, -1);
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY))
+ {
+ // repopulate list
+ JFileChooser fc = getFileChooser();
+ FileFilter[] choosableFilters = fc.getChoosableFileFilters();
+ filters = choosableFilters;
+ fireContentsChanged(this, 0, filters.length);
+ }
+ }
+
+ /**
+ * Sets the selected filter.
+ *
+ * @param filter the filter.
+ */
+ public void setSelectedItem(Object filter)
+ {
+ // change the filter in the file chooser and let the property change
+ // event trigger the change to the selected item
+ getFileChooser().setFileFilter((FileFilter) filter);
+ }
+
+ /**
+ * Returns the selected file filter.
+ *
+ * @return The selected file filter.
+ */
+ public Object getSelectedItem()
+ {
+ if (selectedIndex >= 0)
+ return filters[selectedIndex];
+ return null;
+ }
+
+ /**
+ * Returns the number of items in the model.
+ *
+ * @return The number of items in the model.
+ */
+ public int getSize()
+ {
+ return filters.length;
+ }
+
+ /**
+ * Returns the item at the specified index.
+ *
+ * @param index the item index.
+ *
+ * @return The item at the specified index.
+ */
+ public Object getElementAt(int index)
+ {
+ return filters[index];
+ }
+
+ }
+
+ /**
+ * A renderer for the items in the file filter combo box.
+ */
+ public class FilterComboBoxRenderer extends DefaultListCellRenderer
+ {
+ /**
+ * Creates a new renderer.
+ */
+ public FilterComboBoxRenderer()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns a component that can be used to paint the given value within
+ * the list.
+ *
+ * @param list the list.
+ * @param value the value (a {@link FileFilter}).
+ * @param index the item index.
+ * @param isSelected is the item selected?
+ * @param cellHasFocus does the list cell have focus?
+ *
+ * @return A component.
+ */
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus)
+ {
+ FileFilter filter = (FileFilter) value;
+ return super.getListCellRendererComponent(list, filter.getDescription(),
+ index, isSelected, cellHasFocus);
+ }
+ }
+
+ /** The model for the directory combo box. */
+ DirectoryComboBoxModel directoryModel;
+
+ /**
+ * A factory method that returns a UI delegate for the specified
+ * component.
+ *
+ * @param c the component (which should be a {@link JFileChooser}).
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ JFileChooser chooser = (JFileChooser) c;
+ return new MetalFileChooserUI(chooser);
+ }
+
+ /**
+ * Creates a new instance of this UI delegate.
+ *
+ * @param filechooser the file chooser component.
+ */
+ public MetalFileChooserUI(JFileChooser filechooser)
+ {
+ super(filechooser);
+ }
+
+ /**
+ * Creates and returns a new instance of {@link DirectoryComboBoxModel}.
+ *
+ * @return A new instance of {@link DirectoryComboBoxModel}.
+ */
+ protected MetalFileChooserUI.DirectoryComboBoxModel
+ createDirectoryComboBoxModel(JFileChooser fc)
+ {
+ return new DirectoryComboBoxModel();
+ }
+
+ /**
+ * Creates and returns a new instance of {@link FilterComboBoxModel}.
+ *
+ * @return A new instance of {@link FilterComboBoxModel}.
+ */
+ protected FilterComboBoxModel createFilterComboBoxModel()
+ {
+ return new FilterComboBoxModel();
+ }
+
+ /**
+ * Creates and returns a new instance of {@link FilterComboBoxRenderer}.
+ *
+ * @return A new instance of {@link FilterComboBoxRenderer}.
+ */
+ protected MetalFileChooserUI.FilterComboBoxRenderer
+ createFilterComboBoxRenderer()
+ {
+ return new FilterComboBoxRenderer();
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
index d8c77432653..6f4feccfc37 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
@@ -43,9 +43,11 @@ import java.awt.Component;
import java.awt.Graphics;
import java.io.Serializable;
+import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;
@@ -75,6 +77,7 @@ public class MetalIconFactory implements Serializable
*/
public CheckBoxMenuItemIcon()
{
+ // Nothing to do here.
}
/**
@@ -137,6 +140,385 @@ public class MetalIconFactory implements Serializable
}
/**
+ * An icon used for the "detail view" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserDetailViewIcon()
+ */
+ private static class FileChooserDetailViewIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserDetailViewIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ // file 1 outline
+ g.drawLine(x + 2, y + 2, x + 5, y + 2);
+ g.drawLine(x + 6, y + 3, x + 6, y + 7);
+ g.drawLine(x + 2, y + 7, x + 6, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 7);
+
+ // file 2 outline
+ g.drawLine(x + 2, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 11, x + 6, y + 15);
+ g.drawLine(x + 2, y + 15, x + 6, y + 15);
+ g.drawLine(x + 2, y + 10, x + 2, y + 15);
+
+ // detail lines
+ g.drawLine(x + 8, y + 5, x + 15, y + 5);
+ g.drawLine(x + 8, y + 13, x + 15, y + 13);
+
+ // fill files
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 3, y + 3, 3, 4);
+ g.fillRect(x + 3, y + 11, 3, 4);
+
+ // highlight files
+ g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
+ g.drawLine(x + 4, y + 4, x + 4, y + 5);
+ g.drawLine(x + 4, y + 12, x + 4, y + 13);
+
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "home folder" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserHomeFolderIcon()
+ */
+ private static class FileChooserHomeFolderIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserHomeFolderIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ // roof
+ g.drawLine(x + 1, y + 8, x + 8, y + 1);
+ g.drawLine(x + 8, y + 1, x + 15, y + 8);
+
+ // base of house
+ g.drawLine(x + 3, y + 6, x + 3, y + 15);
+ g.drawLine(x + 3, y + 15, x + 13, y + 15);
+ g.drawLine(x + 13, y + 6, x + 13, y + 15);
+
+ // door frame
+ g.drawLine(x + 6, y + 9, x + 6, y + 15);
+ g.drawLine(x + 6, y + 9, x + 10, y + 9);
+ g.drawLine(x + 10, y + 9, x + 10, y + 15);
+
+ // chimney
+ g.drawLine(x + 11, y + 2, x + 11, y + 4);
+ g.drawLine(x + 12, y + 2, x + 12, y + 5);
+
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+
+ // roof paint
+ int xx = x + 8;
+ for (int i = 0; i < 4; i++)
+ g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
+ g.fillRect(x + 4, y + 6, 9, 2);
+
+ // door knob
+ g.drawLine(x + 9, y + 12, x + 9, y + 12);
+
+ // house paint
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.drawLine(x + 4, y + 8, x + 12, y + 8);
+ g.fillRect(x + 4, y + 9, 2, 6);
+ g.fillRect(x + 11, y + 9, 2, 6);
+
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "list view" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserListViewIcon()
+ */
+ private static class FileChooserListViewIcon implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserListViewIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ // file 1 outline
+ g.drawLine(x + 2, y + 2, x + 5, y + 2);
+ g.drawLine(x + 6, y + 3, x + 6, y + 7);
+ g.drawLine(x + 2, y + 7, x + 6, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 7);
+
+ // file 2 outline
+ g.drawLine(x + 2, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 11, x + 6, y + 15);
+ g.drawLine(x + 2, y + 15, x + 6, y + 15);
+ g.drawLine(x + 2, y + 10, x + 2, y + 15);
+
+ // file 3 outline
+ g.drawLine(x + 10, y + 2, x + 13, y + 2);
+ g.drawLine(x + 14, y + 3, x + 14, y + 7);
+ g.drawLine(x + 10, y + 7, x + 14, y + 7);
+ g.drawLine(x + 10, y + 2, x + 10, y + 7);
+
+ // file 4 outline
+ g.drawLine(x + 10, y + 10, x + 13, y + 10);
+ g.drawLine(x + 14, y + 11, x + 14, y + 15);
+ g.drawLine(x + 10, y + 15, x + 14, y + 15);
+ g.drawLine(x + 10, y + 10, x + 10, y + 15);
+
+ g.drawLine(x + 8, y + 5, x + 8, y + 5);
+ g.drawLine(x + 8, y + 13, x + 8, y + 13);
+ g.drawLine(x + 16, y + 5, x + 16, y + 5);
+ g.drawLine(x + 16, y + 13, x + 16, y + 13);
+
+ // fill files
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 3, y + 3, 3, 4);
+ g.fillRect(x + 3, y + 11, 3, 4);
+ g.fillRect(x + 11, y + 3, 3, 4);
+ g.fillRect(x + 11, y + 11, 3, 4);
+
+ // highlight files
+ g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
+ g.drawLine(x + 4, y + 4, x + 4, y + 5);
+ g.drawLine(x + 4, y + 12, x + 4, y + 13);
+ g.drawLine(x + 12, y + 4, x + 12, y + 5);
+ g.drawLine(x + 12, y + 12, x + 12, y + 13);
+
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "new folder" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserNewFolderIcon()
+ */
+ private static class FileChooserNewFolderIcon implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserNewFolderIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ g.drawLine(x + 2, y + 5, x + 9, y + 5);
+ g.drawLine(x + 10, y + 6, x + 15, y + 6);
+ g.drawLine(x + 15, y + 5, x + 15, y + 14);
+ g.drawLine(x + 2, y + 14, x + 15, y + 14);
+ g.drawLine(x + 1, y + 6, x + 1, y + 14);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawLine(x + 11, y + 3, x + 15, y + 3);
+ g.drawLine(x + 10, y + 4, x + 15, y + 4);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 3, y + 7, 7, 7);
+ g.fillRect(x + 10, y + 8, 5, 6);
+ g.drawLine(x + 10, y + 5, x + 14, y + 5);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
+ g.drawLine(x + 10, y + 7, x + 14, y + 7);
+ g.drawLine(x + 2, y + 6, x + 9, y + 6);
+ g.drawLine(x + 2, y + 6, x + 2, y + 13);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "up folder" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserNewFolderIcon()
+ */
+ private static class FileChooserUpFolderIcon extends FileChooserNewFolderIcon
+ implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserUpFolderIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+
+ // draw the folder
+ super.paintIcon(c, g, x, y);
+
+ // now draw the up arrow
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 8, y + 9, x + 8, y + 16);
+ int xx = x + 8;
+ for (int i = 0; i < 4; i++)
+ g.drawLine(xx - i, y + 9 + i, xx + i, y + 9 + i);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
* An icon representing a file (drawn as a piece of paper with the top-right
* corner turned down).
*/
@@ -153,13 +535,15 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the height of the icon, in pixels.
+ * Returns the height of the icon, in pixels. The height returned is
+ * <code>16</code> plus the value returned by
+ * {@link #getAdditionalHeight()}.
*
* @return The height of the icon.
*/
public int getIconHeight()
{
- return 16;
+ return 16 + getAdditionalHeight();
}
/**
@@ -192,9 +576,11 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for the icon. The
+ * {@link #getIconHeight()} method adds this value to the icon height it
+ * returns. Subclasses can override this method to adjust the icon height.
*
- * @return The additional height.
+ * @return The additional height (<code>0</code> unless overridden).
*/
public int getAdditionalHeight()
{
@@ -228,13 +614,15 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the height of the icon, in pixels.
+ * Returns the height of the icon, in pixels. The height returned is
+ * <code>16</code> plus the value returned by
+ * {@link #getAdditionalHeight()}.
*
* @return The height of the icon.
*/
public int getIconHeight()
{
- return 16;
+ return 16 + getAdditionalHeight();
}
/**
@@ -265,9 +653,11 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for the icon. The
+ * {@link #getIconHeight()} method adds this value to the icon height it
+ * returns. Subclasses can override this method to adjust the icon height.
*
- * @return The additional height.
+ * @return The additional height (<code>0</code> unless overridden).
*/
public int getAdditionalHeight()
{
@@ -285,29 +675,77 @@ public class MetalIconFactory implements Serializable
}
}
-
+
/**
- * An {@link Icon} implementation for {@link JCheckBox}es in the
- * Metal Look &amp; Feel.
- *
- * @author Roman Kennke (roman@kennke.org)
+ * An icon used by the {@link MetalInternalFrameUI} class when the frame
+ * is displayed as a palette.
+ *
+ * @since 1.3
*/
- static class RadioButtonIcon
- implements Icon, UIResource, Serializable
+ public static class PaletteCloseIcon
+ implements Icon, Serializable, UIResource
{
/**
- * Draws the check in the RadioButton.
- *
- * @param c the component to draw on
- * @param g the Graphics context to draw with
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
*/
- protected void drawCheck(Component c, Graphics g)
+ public int getIconWidth()
{
- g.setColor(MetalLookAndFeel.getBlack());
- g.fillRect(4, 3, 4, 6);
- g.drawLine(3, 4, 3, 7);
- g.drawLine(8, 4, 8, 7);
+ return 7;
}
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 7;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ AbstractButton button = (AbstractButton) c;
+ if (button.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.fillRect(x + 2, y + 2, 3, 3);
+ g.drawLine(x + 1, y, x + 1, y + 2);
+ g.drawLine(x, y + 1, x + 2, y + 1);
+ g.drawLine(x + 5, y, x + 5, y + 2);
+ g.drawLine(x + 4, y + 1, x + 6, y + 1);
+ g.drawLine(x + 1, y + 4, x + 1, y + 6);
+ g.drawLine(x, y + 5, x + 2, y + 5);
+ g.drawLine(x + 5, y + 4, x + 5, y + 6);
+ g.drawLine(x + 4, y + 5, x + 6, y + 5);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + 2, y + 6, x + 3, y + 5);
+ g.drawLine(x + 5, y + 3, x + 6, y + 2);
+ g.drawLine(x + 6, y + 6, x + 6, y + 6);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An {@link Icon} implementation for {@link JCheckBox}es in the
+ * Metal Look &amp; Feel.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ static class RadioButtonIcon implements Icon, UIResource, Serializable
+ {
/**
* Returns the width of the icon in pixels.
@@ -330,70 +768,104 @@ public class MetalIconFactory implements Serializable
}
/**
- * Paints the icon. This first paints the border of the RadioButton and
- * if the CheckBox is selected it calls {@link #drawCheck} to draw
- * the check.
+ * Paints the icon, taking into account whether or not the component is
+ * enabled, selected and/or armed.
*
- * @param c the Component to draw on (gets casted to JCheckBox)
+ * @param c the Component to draw on (must be an instance of
+ * {@link JRadioButton})
* @param g the Graphics context to draw with
* @param x the X position
* @param y the Y position
*/
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- Color dark = MetalLookAndFeel.getControlDarkShadow();
- Color light = MetalLookAndFeel.getWhite();
- g.translate(x, y);
-
- // The light 'circle'
- g.setColor(light);
- g.drawLine(4, 1, 10, 1);
- g.drawLine(2, 2, 3, 2);
- g.drawLine(8, 2, 11, 2);
- g.drawLine(2, 3, 2, 3);
- g.drawLine(11, 2, 11, 9);
- g.drawLine(1, 4, 1, 7);
- g.drawLine(12, 4, 12, 7);
- g.drawLine(2, 8, 2, 11);
- g.drawLine(11, 8, 11, 9);
- g.drawLine(10, 10, 10, 10);
- g.drawLine(2, 11, 9, 11);
- g.drawLine(4, 12, 7, 12);
-
- // The dark 'circle'
- g.setColor(dark);
- g.drawLine(4, 0, 7, 0);
- g.drawLine(2, 1, 3, 1);
- g.drawLine(8, 1, 9, 1);
- g.drawLine(1, 2, 1, 3);
- g.drawLine(10, 2, 10, 3);
- g.drawLine(0, 4, 0, 7);
- g.drawLine(11, 4, 11, 7);
- g.drawLine(1, 8, 1, 9);
- g.drawLine(10, 8, 10, 9);
- g.drawLine(2, 10, 3, 10);
- g.drawLine(8, 10, 9, 10);
- g.drawLine(4, 11, 7, 11);
-
- JRadioButton rb = (JRadioButton) c;
- if (rb.isSelected())
- drawCheck(c, g);
-
- g.translate(-x, -y);
- }
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ JRadioButton b = (JRadioButton) c;
+
+ // draw outer circle
+ if (b.isEnabled())
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(x + 2, y + 1, x + 3, y + 1);
+ g.drawLine(x + 4, y, x + 7, y);
+ g.drawLine(x + 8, y + 1, x + 9, y + 1);
+ g.drawLine(x + 10, y + 2, x + 10, y + 3);
+ g.drawLine(x + 11, y + 4, x + 11, y + 7);
+ g.drawLine(x + 10, y + 8, x + 10, y + 9);
+ g.drawLine(x + 8, y + 10, x + 9, y + 10);
+ g.drawLine(x + 4, y + 11, x + 7, y + 11);
+ g.drawLine(x + 2, y + 10, x + 3, y + 10);
+ g.drawLine(x + 1, y + 9, x + 1, y + 8);
+ g.drawLine(x, y + 7, x, y + 4);
+ g.drawLine(x + 1, y + 2, x + 1, y + 3);
+
+ if (b.getModel().isArmed())
+ {
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 4, y + 10, x + 7, y + 10);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 10, y + 4, x + 10, y + 7);
+ g.fillRect(x + 2, y + 2, 8, 8);
+ }
+ else
+ {
+ // only draw inner highlight if not filled
+ if (b.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getWhite());
+
+ g.drawLine(x + 2, y + 8, x + 2, y + 9);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 3);
+ g.drawLine(x + 3, y + 2, x + 3, y + 2);
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 8, y + 2, x + 9, y + 2);
+ }
+ }
+
+ // draw outer highlight
+ if (b.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getWhite());
+
+ // outer
+ g.drawLine(x + 10, y + 1, x + 10, y + 1);
+ g.drawLine(x + 11, y + 2, x + 11, y + 3);
+ g.drawLine(x + 12, y + 4, x + 12, y + 7);
+ g.drawLine(x + 11, y + 8, x + 11, y + 9);
+ g.drawLine(x + 10, y + 10, x + 10, y + 10);
+ g.drawLine(x + 8, y + 11, x + 9, y + 11);
+ g.drawLine(x + 4, y + 12, x + 7, y + 12);
+ g.drawLine(x + 2, y + 11, x + 3, y + 11);
+ }
+
+ if (b.isSelected())
+ {
+ if (b.isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(x + 4, y + 3, x + 7, y + 3);
+ g.fillRect(x + 3, y + 4, 6, 4);
+ g.drawLine(x + 4, y + 8, x + 7, y + 8);
+ }
+ g.setColor(savedColor);
+ }
}
/**
* An icon displayed for {@link JRadioButtonMenuItem} components.
*/
- private static class RadioButtonMenuItemIcon
- implements Icon, Serializable
+ private static class RadioButtonMenuItemIcon implements Icon, Serializable
{
/**
* Creates a new icon instance.
*/
public RadioButtonMenuItemIcon()
- {
+ {
+ // Nothing to do here.
}
/**
@@ -463,8 +935,7 @@ public class MetalIconFactory implements Serializable
* The icon used to display the thumb control on a horizontally oriented
* {@link JSlider} component.
*/
- private static class HorizontalSliderThumbIcon
- implements Icon, Serializable
+ private static class HorizontalSliderThumbIcon implements Icon, Serializable
{
/**
@@ -472,6 +943,7 @@ public class MetalIconFactory implements Serializable
*/
public HorizontalSliderThumbIcon()
{
+ // Nothing to do here.
}
/**
@@ -505,13 +977,19 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ boolean enabled = false;
boolean focus = false;
- if (c != null)
- focus = c.hasFocus();
- // TODO: pick up the colors from the look and feel
+ if (c != null)
+ {
+ enabled = c.isEnabled();
+ focus = c.hasFocus();
+ }
// draw the outline
- g.setColor(Color.black);
+ if (enabled)
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawLine(x + 1, y, x + 13, y);
g.drawLine(x + 14, y + 1, x + 14, y + 7);
g.drawLine(x + 14, y + 8, x + 7, y + 15);
@@ -519,8 +997,11 @@ public class MetalIconFactory implements Serializable
g.drawLine(x, y + 7, x, y + 1);
// fill the icon
- g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium
- g.fillRect(x + 2, y + 2, 12, 7);
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x + 1, y + 2, 13, 7);
g.drawLine(x + 2, y + 9, x + 12, y + 9);
g.drawLine(x + 3, y + 10, x + 11, y + 10);
g.drawLine(x + 4, y + 11, x + 10, y + 11);
@@ -528,33 +1009,42 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 6, y + 13, x + 8, y + 13);
g.drawLine(x + 7, y + 14, x + 7, y + 14);
- // draw highlights
- g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light
- g.drawLine(x + 1, y + 1, x + 13, y + 1);
- g.drawLine(x + 1, y + 2, x + 1, y + 8);
- g.drawLine(x + 2, y + 2, x + 2, y + 2);
- g.drawLine(x + 6, y + 2, x + 6, y + 2);
- g.drawLine(x + 10, y + 2, x + 10, y + 2);
-
- g.drawLine(x + 4, y + 4, x + 4, y + 4);
- g.drawLine(x + 8, y + 4, x + 8, y + 4);
+ // if the slider is enabled, draw dots and highlights
+ if (c.isEnabled())
+ {
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 3, y + 3, x + 3, y + 3);
+ g.drawLine(x + 7, y + 3, x + 7, y + 3);
+ g.drawLine(x + 11, y + 3, x + 11, y + 3);
- g.drawLine(x + 2, y + 6, x + 2, y + 6);
- g.drawLine(x + 6, y + 6, x + 6, y + 6);
- g.drawLine(x + 10, y + 6, x + 10, y + 6);
+ g.drawLine(x + 5, y + 5, x + 5, y + 5);
+ g.drawLine(x + 9, y + 5, x + 9, y + 5);
- // draw dots
- g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark
- g.drawLine(x + 3, y + 3, x + 3, y + 3);
- g.drawLine(x + 7, y + 3, x + 7, y + 3);
- g.drawLine(x + 11, y + 3, x + 11, y + 3);
+ g.drawLine(x + 3, y + 7, x + 3, y + 7);
+ g.drawLine(x + 7, y + 7, x + 7, y + 7);
+ g.drawLine(x + 11, y + 7, x + 11, y + 7);
- g.drawLine(x + 5, y + 5, x + 5, y + 5);
- g.drawLine(x + 9, y + 5, x + 9, y + 5);
+ // draw highlights
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ else
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 1, y + 1, x + 13, y + 1);
+ g.drawLine(x + 1, y + 2, x + 1, y + 8);
+ g.drawLine(x + 2, y + 2, x + 2, y + 2);
+ g.drawLine(x + 6, y + 2, x + 6, y + 2);
+ g.drawLine(x + 10, y + 2, x + 10, y + 2);
+
+ g.drawLine(x + 4, y + 4, x + 4, y + 4);
+ g.drawLine(x + 8, y + 4, x + 8, y + 4);
- g.drawLine(x + 3, y + 7, x + 3, y + 7);
- g.drawLine(x + 7, y + 7, x + 7, y + 7);
- g.drawLine(x + 11, y + 7, x + 11, y + 7);
+ g.drawLine(x + 2, y + 6, x + 2, y + 6);
+ g.drawLine(x + 6, y + 6, x + 6, y + 6);
+ g.drawLine(x + 10, y + 6, x + 10, y + 6);
+ }
}
}
@@ -563,7 +1053,7 @@ public class MetalIconFactory implements Serializable
* An icon used for the 'close' button in the title frame of a
* {@link JInternalFrame}.
*/
- private static class InternalFrameCloseIcon implements Icon, Serializable
+ private static class InternalFrameCloseIcon implements Icon, Serializable
{
/** The icon size in pixels. */
private int size;
@@ -601,25 +1091,53 @@ public class MetalIconFactory implements Serializable
/**
* Paints the icon.
*
- * @param c the component.
+ * @param c the component (an {@link JInternalFrame} is expected).
* @param g the graphics device.
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- // draw the gray areas first
- g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ Color savedColor = g.getColor();
+ AbstractButton b = (AbstractButton) c;
+
+ // fill the interior
+ if (b.getModel().isPressed())
+ // FIXME: also need to take into account whether the internal frame is
+ // selected
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 2, 10, 10);
+
+ // draw the outline box and the cross
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ {
+ // FIXME: also need to take into account whether the internal frame is
+ // selected
+ boolean selected = true;
+ if (selected)
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ }
g.drawLine(x + 1, y + 1, x + 13, y + 1);
g.drawLine(x + 1, y + 2, x + 1, y + 12);
g.drawLine(x + 1, y + 13, x + 13, y + 13);
g.drawLine(x + 13, y + 2, x + 13, y + 12);
+ g.drawLine(x + 2, y + 12, x + 2, y + 12);
+ g.drawLine(x + 12, y + 2, x + 12, y + 2);
g.fillRect(x + 4, y + 4, 2, 2);
- g.fillRect(x + 4, y + 9, 2, 2);
- g.fillRect(x + 9, y + 4, 2, 2);
- g.fillRect(x + 9, y + 9, 2, 2);
- g.fillRect(x + 5, y + 5, 5, 5);
+ g.fillRect(x + 5, y + 5, 4, 4);
+ g.drawLine(x + 9, y + 4, x + 10, y + 4);
+ g.drawLine(x + 9, y + 4, x + 9, y + 5);
+ g.drawLine(x + 4, y + 9, x + 4, y + 10);
+ g.drawLine(x + 4, y + 9, x + 5, y + 9);
+ g.drawLine(x + 9, y + 8, x + 9, y + 10);
+ g.drawLine(x + 8, y + 9, x + 10, y + 9);
g.setColor(MetalLookAndFeel.getBlack());
g.drawLine(x, y, x + 13, y);
@@ -635,20 +1153,24 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 1, y + 14, x + 14, y + 14);
g.drawLine(x + 14, y + 1, x + 14, y + 14);
- g.drawLine(x + 5, y + 10, x + 5, y + 10);
- g.drawLine(x + 6, y + 9, x + 7, y + 9);
- g.drawLine(x + 10, y + 5, x + 10, y + 5);
- g.drawLine(x + 9, y + 6, x + 9, y + 7);
- g.drawLine(x + 10, y + 10, x + 11, y + 10);
- g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ if (!b.getModel().isPressed())
+ {
+ g.drawLine(x + 5, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 9, x + 7, y + 9);
+ g.drawLine(x + 10, y + 5, x + 10, y + 5);
+ g.drawLine(x + 9, y + 6, x + 9, y + 7);
+ g.drawLine(x + 10, y + 10, x + 11, y + 10);
+ g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ }
+ g.setColor(savedColor);
}
}
/**
* The icon displayed at the top-left corner of a {@link JInternalFrame}.
*/
- private static class InternalFrameDefaultMenuIcon
- implements Icon, Serializable
+ private static class InternalFrameDefaultMenuIcon
+ implements Icon, Serializable
{
/**
@@ -656,6 +1178,7 @@ public class MetalIconFactory implements Serializable
*/
public InternalFrameDefaultMenuIcon()
{
+ // Nothing to do here.
}
/**
@@ -718,8 +1241,8 @@ public class MetalIconFactory implements Serializable
* maximise an internal frame, this icon will replace the 'maximise' icon to
* provide a 'restore' option.
*/
- private static class InternalFrameAltMaximizeIcon
- implements Icon, Serializable
+ private static class InternalFrameAltMaximizeIcon
+ implements Icon, Serializable
{
/** The icon size in pixels. */
private int size;
@@ -764,14 +1287,23 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- Color color = MetalLookAndFeel.getControlDarkShadow();
- if (c instanceof JInternalFrame)
- {
- JInternalFrame f = (JInternalFrame) c;
- if (f.isSelected())
- color = MetalLookAndFeel.getPrimaryControlShadow();
- }
- g.setColor(color);
+ Color savedColor = g.getColor();
+
+ AbstractButton b = (AbstractButton) c;
+
+ // fill the small box interior
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 6, 7, 7);
+
+
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+
g.drawLine(x + 12, y + 1, x + 13, y + 1);
g.drawLine(x + 11, y + 2, x + 12, y + 2);
g.drawLine(x + 10, y + 3, x + 11, y + 3);
@@ -803,10 +1335,16 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 13, y + 6, x + 13, y + 6);
g.drawLine(x + 8, y + 7, x + 13, y + 7);
g.drawLine(x + 6, y + 5, x + 6, y + 5);
- g.drawLine(x + 2, y + 6, x + 6, y + 6);
- g.drawLine(x + 2, y + 6, x + 2, y + 11);
g.drawLine(x + 10, y + 8, x + 10, y + 13);
g.drawLine(x + 1, y + 14, x + 10, y + 14);
+
+ if (!b.getModel().isPressed())
+ {
+ g.drawLine(x + 2, y + 6, x + 6, y + 6);
+ g.drawLine(x + 2, y + 6, x + 2, y + 11);
+ }
+
+ g.setColor(savedColor);
}
}
@@ -814,8 +1352,7 @@ public class MetalIconFactory implements Serializable
* An icon used for the 'maximize' button in the title frame of a
* {@link JInternalFrame}.
*/
- private static class InternalFrameMaximizeIcon
- implements Icon, Serializable
+ private static class InternalFrameMaximizeIcon implements Icon, Serializable
{
/**
@@ -823,6 +1360,7 @@ public class MetalIconFactory implements Serializable
*/
public InternalFrameMaximizeIcon()
{
+ // Nothing to do here.
}
/**
@@ -855,14 +1393,22 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- Color color = MetalLookAndFeel.getControlDarkShadow();
- if (c instanceof JInternalFrame)
- {
- JInternalFrame f = (JInternalFrame) c;
- if (f.isSelected())
- color = MetalLookAndFeel.getPrimaryControlShadow();
- }
- g.setColor(color);
+ Color savedColor = g.getColor();
+
+ AbstractButton b = (AbstractButton) c;
+
+ // fill the interior
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 6, 7, 7);
+
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+
g.drawLine(x + 9, y + 1, x + 10, y + 1);
g.fillRect(x + 11, y + 1, 3, 3);
g.fillRect(x + 12, y + 4, 2, 2);
@@ -897,9 +1443,12 @@ public class MetalIconFactory implements Serializable
// draw white
g.setColor(MetalLookAndFeel.getWhite());
- g.drawLine(x + 2, y + 6, x + 5, y + 6);
- g.drawLine(x + 2, y + 7, x + 2, y + 9);
- g.drawLine(x + 4, y + 11, x + 7, y + 8);
+ if (!b.getModel().isPressed())
+ {
+ g.drawLine(x + 2, y + 6, x + 5, y + 6);
+ g.drawLine(x + 2, y + 7, x + 2, y + 9);
+ g.drawLine(x + 4, y + 11, x + 7, y + 8);
+ }
g.drawLine(x + 1, y + 14, x + 10, y + 14);
g.drawLine(x + 10, y + 5, x + 10, y + 13);
@@ -908,14 +1457,14 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 11, y + 4, x + 11, y + 5);
g.drawLine(x + 13, y + 6, x + 14, y + 6);
g.drawLine(x + 14, y + 1, x + 14, y + 5);
+ g.setColor(savedColor);
}
}
/**
* An icon used in the title frame of a {@link JInternalFrame}.
*/
- private static class InternalFrameMinimizeIcon
- implements Icon, Serializable
+ private static class InternalFrameMinimizeIcon implements Icon, Serializable
{
/**
@@ -923,6 +1472,7 @@ public class MetalIconFactory implements Serializable
*/
public InternalFrameMinimizeIcon()
{
+ // Nothing to do here.
}
/**
@@ -955,14 +1505,17 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- Color color = MetalLookAndFeel.getControlDarkShadow();
- if (c instanceof JInternalFrame)
- {
- JInternalFrame f = (JInternalFrame) c;
- if (f.isSelected())
- color = MetalLookAndFeel.getPrimaryControlShadow();
- }
- g.setColor(color);
+ Color savedColor = g.getColor();
+
+ AbstractButton b = (AbstractButton) c;
+
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ // FIXME: here the color depends on whether or not the internal frame
+ // is selected
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+
g.drawLine(x + 12, y + 1, x + 13, y + 1);
g.drawLine(x + 11, y + 2, x + 12, y + 2);
g.drawLine(x + 10, y + 3, x + 11, y + 3);
@@ -993,10 +1546,21 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 11, y + 4, x + 13, y + 2);
g.drawLine(x + 13, y + 6, x + 13, y + 6);
g.drawLine(x + 8, y + 7, x + 13, y + 7);
- g.drawLine(x + 2, y + 9, x + 4, y + 9);
- g.drawLine(x + 2, y + 10, x + 2, y + 11);
g.drawLine(x + 7, y + 9, x + 7, y + 13);
g.drawLine(x + 1, y + 14, x + 7, y + 14);
+
+ if (b.getModel().isPressed())
+ {
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ g.fillRect(x + 2, y + 9, 3, 3);
+ }
+ else
+ {
+ g.drawLine(x + 2, y + 9, x + 4, y + 9);
+ g.drawLine(x + 2, y + 10, x + 2, y + 11);
+ }
+
+ g.setColor(savedColor);
}
}
@@ -1004,13 +1568,14 @@ public class MetalIconFactory implements Serializable
* The icon used to display the thumb control on a horizontally oriented
* {@link JSlider} component.
*/
- private static class VerticalSliderThumbIcon implements Icon, Serializable
+ private static class VerticalSliderThumbIcon implements Icon, Serializable
{
/**
* Creates a new instance.
*/
public VerticalSliderThumbIcon()
{
+ // Nothing to do here.
}
/**
@@ -1045,13 +1610,19 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ boolean enabled = false;
boolean focus = false;
- if (c != null)
- focus = c.hasFocus();
- // TODO: pick up the colors from the look and feel
+ if (c != null)
+ {
+ enabled = c.isEnabled();
+ focus = c.hasFocus();
+ }
// draw the outline
- g.setColor(Color.black);
+ if (enabled)
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawLine(x + 1, y, x + 7, y);
g.drawLine(x + 8, y, x + 15, y + 7);
g.drawLine(x + 14, y + 8, x + 8, y + 14);
@@ -1059,8 +1630,11 @@ public class MetalIconFactory implements Serializable
g.drawLine(x, y + 13, x, y + 1);
// fill the icon
- g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium
- g.fillRect(x + 2, y + 2, 7, 12);
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x + 2, y + 1, 7, 13);
g.drawLine(x + 9, y + 2, x + 9, y + 12);
g.drawLine(x + 10, y + 3, x + 10, y + 11);
g.drawLine(x + 11, y + 4, x + 11, y + 10);
@@ -1068,41 +1642,51 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 13, y + 6, x + 13, y + 8);
g.drawLine(x + 14, y + 7, x + 14, y + 7);
- // draw highlights
- g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light
- g.drawLine(x + 1, y + 1, x + 8, y + 1);
- g.drawLine(x + 1, y + 2, x + 1, y + 13);
- g.drawLine(x + 2, y + 2, x + 2, y + 2);
- g.drawLine(x + 2, y + 6, x + 2, y + 6);
- g.drawLine(x + 2, y + 10, x + 2, y + 10);
+ // if the slider is enabled, draw dots and highlights
+ if (enabled)
+ {
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 3, y + 3, x + 3, y + 3);
+ g.drawLine(x + 3, y + 7, x + 3, y + 7);
+ g.drawLine(x + 3, y + 11, x + 3, y + 11);
- g.drawLine(x + 4, y + 4, x + 4, y + 4);
- g.drawLine(x + 4, y + 8, x + 4, y + 8);
+ g.drawLine(x + 5, y + 5, x + 5, y + 5);
+ g.drawLine(x + 5, y + 9, x + 5, y + 9);
- g.drawLine(x + 6, y + 2, x + 6, y + 2);
- g.drawLine(x + 6, y + 6, x + 6, y + 6);
- g.drawLine(x + 6, y + 10, x + 6, y + 10);
+ g.drawLine(x + 7, y + 3, x + 7, y + 3);
+ g.drawLine(x + 7, y + 7, x + 7, y + 7);
+ g.drawLine(x + 7, y + 11, x + 7, y + 11);
- // draw dots
- g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark
- g.drawLine(x + 3, y + 3, x + 3, y + 3);
- g.drawLine(x + 3, y + 7, x + 3, y + 7);
- g.drawLine(x + 3, y + 11, x + 3, y + 11);
+ // draw highlights
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ else
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 1, y + 1, x + 8, y + 1);
+ g.drawLine(x + 1, y + 2, x + 1, y + 13);
+ g.drawLine(x + 2, y + 2, x + 2, y + 2);
+ g.drawLine(x + 2, y + 6, x + 2, y + 6);
+ g.drawLine(x + 2, y + 10, x + 2, y + 10);
- g.drawLine(x + 5, y + 5, x + 5, y + 5);
- g.drawLine(x + 5, y + 9, x + 5, y + 9);
+ g.drawLine(x + 4, y + 4, x + 4, y + 4);
+ g.drawLine(x + 4, y + 8, x + 4, y + 8);
- g.drawLine(x + 7, y + 3, x + 7, y + 3);
- g.drawLine(x + 7, y + 7, x + 7, y + 7);
- g.drawLine(x + 7, y + 11, x + 7, y + 11);
+ g.drawLine(x + 6, y + 2, x + 6, y + 2);
+ g.drawLine(x + 6, y + 6, x + 6, y + 6);
+ g.drawLine(x + 6, y + 10, x + 6, y + 10);
+
+ }
}
}
-
+
/**
* A tree control icon. This icon can be in one of two states: expanded and
* collapsed.
*/
- public static class TreeControlIcon implements Icon, Serializable
+ public static class TreeControlIcon implements Icon, Serializable
{
/** ???. */
@@ -1235,19 +1819,21 @@ public class MetalIconFactory implements Serializable
/**
* A tree folder icon.
*/
- public static class TreeFolderIcon extends FolderIcon16
+ public static class TreeFolderIcon extends FolderIcon16
{
/**
* Creates a new instance.
*/
public TreeFolderIcon()
- {
+ {
+ // Nothing to do here.
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for this icon, in this case <code>2</code>
+ * pixels.
*
- * @return The additional height.
+ * @return <code>2</code>.
*/
public int getAdditionalHeight()
{
@@ -1268,19 +1854,21 @@ public class MetalIconFactory implements Serializable
/**
* A tree leaf icon.
*/
- public static class TreeLeafIcon extends FileIcon16
+ public static class TreeLeafIcon extends FileIcon16
{
/**
* Creates a new instance.
*/
public TreeLeafIcon()
{
+ // Nothing to do here.
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for this icon, in this case <code>4</code>
+ * pixels.
*
- * @return The additional height.
+ * @return <code>4</code>.
*/
public int getAdditionalHeight()
{
@@ -1297,16 +1885,310 @@ public class MetalIconFactory implements Serializable
return 2;
}
}
+
+ /**
+ * An icon representing a hard disk.
+ *
+ * @see MetalIconFactory#getTreeHardDriveIcon()
+ */
+ private static class TreeHardDriveIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon instance.
+ */
+ public TreeHardDriveIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location, using colors from the
+ * current theme.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 1, y + 4, x + 1, y + 5);
+ g.drawLine(x + 14, y + 4, x + 14, y + 5);
+ g.drawLine(x + 1, y + 7, x + 1, y + 8);
+ g.drawLine(x + 14, y + 7, x + 14, y + 8);
+ g.drawLine(x + 1, y + 10, x + 1, y + 11);
+ g.drawLine(x + 14, y + 10, x + 14, y + 11);
+
+ g.drawLine(x + 2, y + 3, x + 3, y + 3);
+ g.drawLine(x + 12, y + 3, x + 13, y + 3);
+ g.drawLine(x + 2, y + 6, x + 3, y + 6);
+ g.drawLine(x + 12, y + 6, x + 13, y + 6);
+ g.drawLine(x + 2, y + 9, x + 3, y + 9);
+ g.drawLine(x + 12, y + 9, x + 13, y + 9);
+ g.drawLine(x + 2, y + 12, x + 3, y + 12);
+ g.drawLine(x + 12, y + 12, x + 13, y + 12);
+
+ g.drawLine(x + 4, y + 2, x + 11, y + 2);
+ g.drawLine(x + 4, y + 7, x + 11, y + 7);
+ g.drawLine(x + 4, y + 10, x + 11, y + 10);
+ g.drawLine(x + 4, y + 13, x + 11, y + 13);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.fillRect(x + 4, y + 3, 2, 2);
+ g.drawLine(x + 6, y + 4, x + 6, y + 4);
+ g.drawLine(x + 7, y + 3, x + 9, y + 3);
+ g.drawLine(x + 8, y + 4, x + 8, y + 4);
+ g.drawLine(x + 11, y + 3, x + 11, y + 3);
+ g.fillRect(x + 2, y + 4, 2, 2);
+ g.fillRect(x + 2, y + 7, 2, 2);
+ g.fillRect(x + 2, y + 10, 2, 2);
+ g.drawLine(x + 4, y + 6, x + 4, y + 6);
+ g.drawLine(x + 4, y + 9, x + 4, y + 9);
+ g.drawLine(x + 4, y + 12, x + 4, y + 12);
+
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x + 13, y + 4, x + 13, y + 4);
+ g.drawLine(x + 12, y + 5, x + 13, y + 5);
+ g.drawLine(x + 13, y + 7, x + 13, y + 7);
+ g.drawLine(x + 12, y + 8, x + 13, y + 8);
+ g.drawLine(x + 13, y + 10, x + 13, y + 10);
+ g.drawLine(x + 12, y + 11, x + 13, y + 11);
+
+ g.drawLine(x + 10, y + 5, x + 10, y + 5);
+ g.drawLine(x + 7, y + 6, x + 7, y + 6);
+ g.drawLine(x + 9, y + 6, x + 9, y + 6);
+ g.drawLine(x + 11, y + 6, x + 11, y + 6);
+
+ g.drawLine(x + 10, y + 8, x + 10, y + 8);
+ g.drawLine(x + 7, y + 9, x + 7, y + 9);
+ g.drawLine(x + 9, y + 9, x + 9, y + 9);
+ g.drawLine(x + 11, y + 9, x + 11, y + 9);
+
+ g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ g.drawLine(x + 7, y + 12, x + 7, y + 12);
+ g.drawLine(x + 9, y + 12, x + 9, y + 12);
+ g.drawLine(x + 11, y + 12, x + 11, y + 12);
+
+ g.setColor(saved);
+ }
+ }
+
+ /**
+ * An icon representing a floppy disk.
+ *
+ * @see MetalIconFactory#getTreeFloppyDriveIcon()
+ */
+ private static class TreeFloppyDriveIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon instance.
+ */
+ public TreeFloppyDriveIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location, using colors from the
+ * current theme.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 1, y + 1, x + 13, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + 14);
+ g.drawLine(x + 1, y + 14, x + 14, y + 14);
+ g.drawLine(x + 14, y + 2, x + 14, y + 14);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 2, 12, 12);
+
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.fillRect(x + 5, y + 2, 6, 5);
+ g.drawLine(x + 4, y + 8, x + 11, y + 8);
+ g.drawLine(x + 3, y + 9, x + 3, y + 13);
+ g.drawLine(x + 12, y + 9, x + 12, y + 13);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.fillRect(x + 8, y + 3, 2, 3);
+ g.fillRect(x + 4, y + 9, 8, 5);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ g.drawLine(x + 5, y + 10, x + 9, y + 10);
+ g.drawLine(x + 5, y + 12, x + 8, y + 12);
+
+ g.setColor(saved);
+ }
+ }
+
+ /**
+ * An icon representing a computer.
+ *
+ * @see MetalIconFactory#getTreeComputerIcon()
+ */
+ private static class TreeComputerIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon instance.
+ */
+ public TreeComputerIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location, using colors from the
+ * current theme.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 3, y + 1, x + 12, y + 1);
+ g.drawLine(x + 2, y + 2, x + 2, y + 8);
+ g.drawLine(x + 13, y + 2, x + 13, y + 8);
+ g.drawLine(x + 3, y + 9, x + 3, y + 9);
+ g.drawLine(x + 12, y + 9, x + 12, y + 9);
+ g.drawRect(x + 1, y + 10, 13, 4);
+ g.drawLine(x + 5, y + 3, x + 10, y + 3);
+ g.drawLine(x + 5, y + 8, x + 10, y + 8);
+ g.drawLine(x + 4, y + 4, x + 4, y + 7);
+ g.drawLine(x + 11, y + 4, x + 11, y + 7);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 5, y + 4, 6, 4);
+
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x + 6, y + 12, x + 8, y + 12);
+ g.drawLine(x + 10, y + 12, x + 12, y + 12);
+ g.setColor(saved);
+ }
+ }
+ /** The icon returned by {@link #getCheckBoxIcon()}. */
+ private static Icon checkBoxIcon;
+
+ /** The icon returned by {@link #getCheckBoxMenuItemIcon()}. */
+ private static Icon checkBoxMenuItemIcon;
+
+ /** The icon returned by {@link #getFileChooserDetailViewIcon()}. */
+ private static Icon fileChooserDetailViewIcon;
+
+ /** The icon returned by {@link #getFileChooserHomeFolderIcon()}. */
+ private static Icon fileChooserHomeFolderIcon;
+
+ /** The icon returned by {@link #getFileChooserListViewIcon()}. */
+ private static Icon fileChooserListViewIcon;
+
+ /** The icon returned by {@link #getFileChooserNewFolderIcon()}. */
+ private static Icon fileChooserNewFolderIcon;
+
+ /** The icon returned by {@link #getFileChooserUpFolderIcon()}. */
+ private static Icon fileChooserUpFolderIcon;
+
/** The cached RadioButtonIcon instance. */
private static RadioButtonIcon radioButtonIcon;
+ /** The icon returned by {@link #getRadioButtonMenuItemIcon()}. */
+ private static Icon radioButtonMenuItemIcon;
+
+ /** The icon returned by {@link #getInternalFrameDefaultMenuIcon()}. */
+ private static Icon internalFrameDefaultMenuIcon;
+
+ /** The icon returned by {@link #getTreeComputerIcon()}. */
+ private static Icon treeComputerIcon;
+
+ /** The icon instance returned by {@link #getTreeFloppyDriveIcon()}. */
+ private static Icon treeFloppyDriveIcon;
+
+ /** The icon instance returned by {@link #getTreeHardDriveIcon()}. */
+ private static Icon treeHardDriveIcon;
+
/**
* Creates a new instance. All the methods are static, so creating an
* instance isn't necessary.
*/
public MetalIconFactory()
- {
+ {
+ // Nothing to do here.
}
/**
@@ -1318,7 +2200,9 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getCheckBoxIcon()
{
- return new MetalCheckBoxIcon();
+ if (checkBoxIcon == null)
+ checkBoxIcon = new MetalCheckBoxIcon();
+ return checkBoxIcon;
}
/**
@@ -1329,7 +2213,69 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getCheckBoxMenuItemIcon()
{
- return new CheckBoxMenuItemIcon();
+ if (checkBoxMenuItemIcon == null)
+ checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
+ return checkBoxMenuItemIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserDetailViewIcon()
+ {
+ if (fileChooserDetailViewIcon == null)
+ fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
+ return fileChooserDetailViewIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserHomeFolderIcon()
+ {
+ if (fileChooserHomeFolderIcon == null)
+ fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
+ return fileChooserHomeFolderIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserListViewIcon()
+ {
+ if (fileChooserListViewIcon == null)
+ fileChooserListViewIcon = new FileChooserListViewIcon();
+ return fileChooserListViewIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserNewFolderIcon()
+ {
+ if (fileChooserNewFolderIcon == null)
+ fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
+ return fileChooserNewFolderIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserUpFolderIcon()
+ {
+ if (fileChooserUpFolderIcon == null)
+ fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
+ return fileChooserUpFolderIcon;
}
/**
@@ -1351,7 +2297,9 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getRadioButtonMenuItemIcon()
{
- return new RadioButtonMenuItemIcon();
+ if (radioButtonMenuItemIcon == null)
+ radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
+ return radioButtonMenuItemIcon;
}
/**
@@ -1386,7 +2334,9 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getInternalFrameDefaultMenuIcon()
{
- return new InternalFrameDefaultMenuIcon();
+ if (internalFrameDefaultMenuIcon == null)
+ internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
+ return internalFrameDefaultMenuIcon;
}
/**
@@ -1475,4 +2425,40 @@ public class MetalIconFactory implements Serializable
return new TreeControlIcon(isCollapsed);
}
+ /**
+ * Returns a <code>16x16</code> icon representing a computer.
+ *
+ * @return The icon.
+ */
+ public static Icon getTreeComputerIcon()
+ {
+ if (treeComputerIcon == null)
+ treeComputerIcon = new TreeComputerIcon();
+ return treeComputerIcon;
+ }
+
+ /**
+ * Returns a <code>16x16</code> icon representing a floppy disk.
+ *
+ * @return The icon.
+ */
+ public static Icon getTreeFloppyDriveIcon()
+ {
+ if (treeFloppyDriveIcon == null)
+ treeFloppyDriveIcon = new TreeFloppyDriveIcon();
+ return treeFloppyDriveIcon;
+ }
+
+ /**
+ * Returns a <code>16x16</code> icon representing a hard disk.
+ *
+ * @return The icon.
+ */
+ public static Icon getTreeHardDriveIcon()
+ {
+ if (treeHardDriveIcon == null)
+ treeHardDriveIcon = new TreeHardDriveIcon();
+ return treeHardDriveIcon;
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
index 20526eba8cd..33eb3491ad0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
@@ -38,30 +38,208 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.Icon;
import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
import javax.swing.JMenu;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
+
/**
- * The title pane for a {@link JInternalFrame}.
+ * The title pane for a {@link JInternalFrame} (see
+ * {@link MetalInternalFrameUI#createNorthPane(JInternalFrame)}). This can
+ * be displayed in two styles: one for regular internal frames, and the other
+ * for "palette" style internal frames.
*/
public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
{
+ /**
+ * A property change handler that listens for changes to the
+ * <code>JInternalFrame.isPalette</code> property and updates the title
+ * pane as appropriate.
+ */
+ class MetalInternalFrameTitlePanePropertyChangeHandler
+ extends PropertyChangeHandler
+ {
+ /**
+ * Creates a new handler.
+ */
+ public MetalInternalFrameTitlePanePropertyChangeHandler()
+ {
+ super();
+ }
+
+ /**
+ * Handles <code>JInternalFrame.isPalette</code> property changes, with all
+ * other property changes being passed to the superclass.
+ *
+ * @param e the event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propName = e.getPropertyName();
+ if (propName.equals("JInternalFrame.isPalette"))
+ {
+ if (e.getNewValue().equals(Boolean.TRUE))
+ setPalette(true);
+ else
+ setPalette(false);
+ }
+ else
+ super.propertyChange(e);
+ }
+ }
+
+ /**
+ * A layout manager for the title pane.
+ *
+ * @see #createLayout()
+ */
+ private class MetalTitlePaneLayout implements LayoutManager
+ {
+ /**
+ * Creates a new <code>TitlePaneLayout</code> object.
+ */
+ public MetalTitlePaneLayout()
+ {
+ // Do nothing.
+ }
+
+ /**
+ * Adds a Component to the Container.
+ *
+ * @param name The name to reference the added Component by.
+ * @param c The Component to add.
+ */
+ public void addLayoutComponent(String name, Component c)
+ {
+ // Do nothing.
+ }
+
+ /**
+ * This method is called to lay out the children of the Title Pane.
+ *
+ * @param c The Container to lay out.
+ */
+ public void layoutContainer(Container c)
+ {
+
+ Dimension size = c.getSize();
+ Insets insets = c.getInsets();
+ int width = size.width - insets.left - insets.right;
+ int height = size.height - insets.top - insets.bottom;
+
+
+ int loc = width - insets.right - 1;
+ int top = insets.top + 2;
+ int buttonHeight = height - 4;
+ if (closeButton.isVisible())
+ {
+ int buttonWidth = closeIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ closeButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ loc -= 6;
+ }
+
+ if (maxButton.isVisible())
+ {
+ int buttonWidth = maxIcon.getIconWidth();
+ loc -= buttonWidth + 4;
+ maxButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ }
+
+ if (iconButton.isVisible())
+ {
+ int buttonWidth = minIcon.getIconWidth();
+ loc -= buttonWidth + 4;
+ iconButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ loc -= 2;
+ }
+
+ Dimension titlePreferredSize = title.getPreferredSize();
+ title.setBounds(insets.left + 5, insets.top,
+ Math.min(titlePreferredSize.width, loc - insets.left - 10),
+ height);
+
+ }
+
+ /**
+ * This method returns the minimum size of the given Container given the
+ * children that it has.
+ *
+ * @param c The Container to get a minimum size for.
+ *
+ * @return The minimum size of the Container.
+ */
+ public Dimension minimumLayoutSize(Container c)
+ {
+ return preferredLayoutSize(c);
+ }
+
+ /**
+ * Returns the preferred size of the given Container taking
+ * into account the children that it has.
+ *
+ * @param c The Container to lay out.
+ *
+ * @return The preferred size of the Container.
+ */
+ public Dimension preferredLayoutSize(Container c)
+ {
+ if (isPalette)
+ return new Dimension(paletteTitleHeight, paletteTitleHeight);
+ else
+ return new Dimension(22, 22);
+ }
+
+ /**
+ * Removes a Component from the Container.
+ *
+ * @param c The Component to remove.
+ */
+ public void removeLayoutComponent(Component c)
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /** A flag indicating whether the title pane uses the palette style. */
protected boolean isPalette;
- protected Icon paletteCloseIcon = MetalIconFactory.getInternalFrameCloseIcon(16);
+ /**
+ * The icon used for the close button - this is fetched from the look and
+ * feel defaults using the key <code>InternalFrame.paletteCloseIcon</code>.
+ */
+ protected Icon paletteCloseIcon;
+
+ /**
+ * The height of the title pane when <code>isPalette</code> is
+ * <code>true</code>. This value is fetched from the look and feel defaults
+ * using the key <code>InternalFrame.paletteTitleHeight</code>.
+ */
+ protected int paletteTitleHeight;
+
+ /** The label used to display the title for the internal frame. */
+ JLabel title;
- protected int paletteTitleHeight = 12;
-
/**
- * Creates a new title pane.
+ * Creates a new title pane for the specified frame.
*
* @param f the internal frame.
*/
@@ -81,6 +259,15 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
selectedTitleColor = MetalLookAndFeel.getWindowTitleBackground();
notSelectedTextColor = MetalLookAndFeel.getInactiveControlTextColor();
notSelectedTitleColor = MetalLookAndFeel.getWindowTitleInactiveBackground();
+
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ paletteTitleHeight = defaults.getInt("InternalFrame.paletteTitleHeight");
+ paletteCloseIcon = defaults.getIcon("InternalFrame.paletteCloseIcon");
+ minIcon = MetalIconFactory.getInternalFrameAltMaximizeIcon(16);
+
+ title = new JLabel(frame.getTitle(),
+ MetalIconFactory.getInternalFrameDefaultMenuIcon(),
+ SwingConstants.LEFT);
}
/**
@@ -93,6 +280,9 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
selectedTitleColor = null;
notSelectedTextColor = null;
notSelectedTitleColor = null;
+ paletteCloseIcon = null;
+ minIcon = null;
+ title = null;
}
/**
@@ -128,44 +318,123 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
}
/**
- * Creates a layout manager for the components in the title pane.
+ * Adds the sub components of the title pane.
+ */
+ protected void addSubComponents()
+ {
+ // FIXME: this method is probably overridden to only add the required
+ // buttons
+ add(title);
+ add(closeButton);
+ add(iconButton);
+ add(maxButton);
+ }
+
+ /**
+ * Creates a new instance of {@link MetalTitlePaneLayout}.
*
- * @return A layout manager.
- */
+ * @return A new instance of {@link MetalTitlePaneLayout}.
+ */
protected LayoutManager createLayout()
{
- return new TitlePaneLayout()
- {
- public Dimension preferredLayoutSize(Container c)
- {
- return new Dimension(24, 24);
- }
- };
+ return new MetalTitlePaneLayout();
}
+ /**
+ * Draws the title pane in the palette style.
+ *
+ * @param g the graphics device.
+ *
+ * @see #paintComponent(Graphics)
+ */
public void paintPalette(Graphics g)
{
- // FIXME: needs implementing
- // most likely this is equivalent to paintComponent(g) when the isPalette
- // flag is true
+ Color savedColor = g.getColor();
+ Rectangle b = SwingUtilities.getLocalBounds(this);
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ g.fillRect(b.x, b.y, b.width, b.height);
+ MetalUtils.fillMetalPattern(this, g, b.x + 4, b.y + 2, b.width
+ - paletteCloseIcon.getIconWidth() - 13, b.height - 5,
+ MetalLookAndFeel.getPrimaryControlHighlight(),
+ MetalLookAndFeel.getBlack());
+
+ // draw a line separating the title pane from the frame content
+ Dimension d = getSize();
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+
+ g.setColor(savedColor);
}
-
+
+ /**
+ * Paints a representation of the current state of the internal frame.
+ *
+ * @param g the graphics device.
+ */
public void paintComponent(Graphics g)
{
- // probably need to check the isPalette flag here, if true pass over to
- // paintPalette(Graphics)
- super.paintComponent(g);
- Dimension d = getSize();
- if (frame.isSelected())
- g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ Color savedColor = g.getColor();
+ if (isPalette)
+ paintPalette(g);
else
- g.setColor(MetalLookAndFeel.getControlDarkShadow());
- g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+ {
+ paintTitleBackground(g);
+ paintChildren(g);
+ Dimension d = getSize();
+ if (frame.isSelected())
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+
+ // put a dot in each of the top corners
+ g.drawLine(0, 0, 0, 0);
+ g.drawLine(d.width - 1, 0, d.width - 1, 0);
+
+ g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+
+ // draw the metal pattern
+ Rectangle b = title.getBounds();
+ int startX = b.x + b.width + 5;
+ int endX = startX;
+ if (iconButton.isVisible())
+ endX = Math.max(iconButton.getX(), endX);
+ else if (maxButton.isVisible())
+ endX = Math.max(maxButton.getX(), endX);
+ else if (closeButton.isVisible())
+ endX = Math.max(closeButton.getX(), endX);
+ endX -= 7;
+ if (endX > startX)
+ MetalUtils.fillMetalPattern(this, g, startX, 3, endX - startX, getHeight() - 6, Color.white, Color.gray);
+ }
+ g.setColor(savedColor);
}
+ /**
+ * Sets the flag that controls whether the title pane is drawn in the
+ * palette style or the regular style.
+ *
+ * @param b the new value of the flag.
+ */
public void setPalette(boolean b)
{
- isPalette = b;
+ isPalette = b;
+ title.setVisible(!isPalette);
+ iconButton.setVisible(!isPalette && frame.isIconifiable());
+ maxButton.setVisible(!isPalette && frame.isMaximizable());
+ if (isPalette)
+ closeButton.setIcon(paletteCloseIcon);
+ else
+ closeButton.setIcon(closeIcon);
+ }
+
+ /**
+ * Creates and returns a property change handler for the title pane.
+ *
+ * @return The property change handler.
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new MetalInternalFrameTitlePanePropertyChangeHandler();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
index 7c7cb92e549..6be573f4bac 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
@@ -38,24 +38,31 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
-import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicInternalFrameUI;
-
+/**
+ * A UI delegate for the {@link JInternalFrame} component.
+ */
public class MetalInternalFrameUI
extends BasicInternalFrameUI
{
-
- /** The instances of MetalInternalFrameUI*/
- private static HashMap instances;
+ /**
+ * The key (<code>JInternalFrame.isPalette</code>) for the client property
+ * that controls whether the internal frame is displayed using the palette
+ * style.
+ */
+ protected static String IS_PALETTE = "JInternalFrame.isPalette";
/**
- * Constructs a new instance of MetalInternalFrameUI.
+ * Constructs a new instance of <code>MetalInternalFrameUI</code>.
+ *
+ * @param frame the frame.
*/
public MetalInternalFrameUI(JInternalFrame frame)
{
@@ -63,37 +70,96 @@ public class MetalInternalFrameUI
}
/**
- * Returns an instance of MetalInternalFrameUI.
+ * Returns an instance of <code>MetalInternalFrameUI</code>.
*
- * @param component the component for which we return an UI instance
+ * @param component the internal frame.
*
- * @return an instance of MetalInternalFrameUI
+ * @return an instance of <code>MetalInternalFrameUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
-
- Object o = instances.get(component);
- MetalInternalFrameUI instance;
- if (o == null)
- {
- instance = new MetalInternalFrameUI((JInternalFrame) component);
- instances.put(component, instance);
- }
- else
- instance = (MetalInternalFrameUI) o;
-
- return instance;
+ return new MetalInternalFrameUI((JInternalFrame) component);
}
+ /**
+ * Sets the fields and properties for the component.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ JInternalFrame f = (JInternalFrame) c;
+ boolean isPalette = false;
+ Boolean p = (Boolean) f.getClientProperty(IS_PALETTE);
+ if (p != null)
+ isPalette = p.booleanValue();
+ setPalette(isPalette);
+ }
+
+ /**
+ * Creates and returns the component that will be used for the north pane
+ * of the {@link JInternalFrame}.
+ *
+ * @param w the internal frame.
+ *
+ * @return A new instance of {@link MetalInternalFrameTitlePane}.
+ */
protected JComponent createNorthPane(JInternalFrame w)
{
titlePane = new MetalInternalFrameTitlePane(w);
- titlePane.setBorder(new EmptyBorder(2, 2, 2, 2));
return titlePane;
}
-
+ /**
+ * Sets the state of the {@link JInternalFrame} to reflect whether or not
+ * it is using the palette style. When a frame is displayed as a palette,
+ * it uses a different border and the title pane is drawn differently.
+ *
+ * @param isPalette use the palette style?
+ */
+ public void setPalette(boolean isPalette)
+ {
+ MetalInternalFrameTitlePane title = (MetalInternalFrameTitlePane) northPane;
+ title.setPalette(isPalette);
+ if (isPalette)
+ frame.setBorder(new MetalBorders.PaletteBorder());
+ else
+ frame.setBorder(new MetalBorders.InternalFrameBorder());
+ }
+
+ /** A listener that is used to handle IS_PALETTE property changes. */
+ private PropertyChangeListener paletteListener;
+
+ /**
+ * Adds the required listeners.
+ */
+ protected void installListeners()
+ {
+ super.installListeners();
+ paletteListener = new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(IS_PALETTE))
+ {
+ if (Boolean.TRUE.equals(e.getNewValue()))
+ setPalette(true);
+ else
+ setPalette(false);
+ }
+ }
+ };
+ frame.addPropertyChangeListener(paletteListener);
+ }
+
+ /**
+ * Removes the listeners used.
+ */
+ protected void uninstallListeners()
+ {
+ super.uninstallListeners();
+ frame.removePropertyChangeListener(IS_PALETTE, paletteListener);
+ paletteListener = null;
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
index fe8a9e4e4ea..e4eaa71724d 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
@@ -50,17 +50,17 @@ import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicLabelUI;
/**
- * A UI delegate used for {@link JLabel}s in the {@link MetalLookAndFeel}.
+ * A UI delegate for the {@link JLabel} component.
*/
public class MetalLabelUI
extends BasicLabelUI
{
- /** The shared UI instance for JLabels. */
+ /** The shared instance of the UI delegate. */
protected static MetalLabelUI metalLabelUI;
/**
- * Constructs a new instance of MetalLabelUI.
+ * Constructs a new instance of <code>MetalLabelUI</code>.
*/
public MetalLabelUI()
{
@@ -68,11 +68,11 @@ public class MetalLabelUI
}
/**
- * Returns an instance of MetalLabelUI.
+ * Returns a shared instance of <code>MetalLabelUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalLabelUI
+ * @return A shared instance of <code>MetalLabelUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
index d9cf7c6220c..ec8014b17b3 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -42,11 +42,14 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;
+import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.InsetsUIResource;
+import javax.swing.plaf.BorderUIResource.LineBorderUIResource;
import javax.swing.plaf.basic.BasicLookAndFeel;
@@ -69,7 +72,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
*/
public MetalLookAndFeel()
{
- createDefaultTheme();
+ if (theme == null)
+ createDefaultTheme();
}
/**
@@ -601,12 +605,21 @@ public class MetalLookAndFeel extends BasicLookAndFeel
}
/**
- * Sets the current theme for the look and feel.
+ * Sets the current theme for the look and feel. Note that the theme must be
+ * set <em>before</em> the look and feel is installed. To change the theme
+ * for an already running application that is using the
+ * {@link MetalLookAndFeel}, first set the theme with this method, then
+ * create a new instance of {@link MetalLookAndFeel} and install it in the
+ * usual way (see {@link UIManager#setLookAndFeel(LookAndFeel)}).
*
- * @param theme the theme.
+ * @param theme the theme (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>theme</code> is <code>null</code>.
*/
public static void setCurrentTheme(MetalTheme theme)
{
+ if (theme == null)
+ throw new NullPointerException("Null 'theme' not permitted.");
MetalLookAndFeel.theme = theme;
}
@@ -759,62 +772,206 @@ public class MetalLookAndFeel extends BasicLookAndFeel
{
super.initComponentDefaults(defaults);
Object[] myDefaults = new Object[] {
- "Button.background", new ColorUIResource(getControl()),
+ "Button.background", getControl(),
"Button.border", MetalBorders.getButtonBorder(),
- "Button.darkShadow", new ColorUIResource(getControlDarkShadow()),
- "Button.disabledText", new ColorUIResource(getControlDisabled()),
- "Button.focus", new ColorUIResource(getFocusColor()),
+ "Button.darkShadow", getControlDarkShadow(),
+ "Button.disabledText", getInactiveControlTextColor(),
+ "Button.focus", getFocusColor(),
"Button.font", getControlTextFont(),
- "Button.foreground", new ColorUIResource(getSystemTextColor()),
- "Button.highlight", new ColorUIResource(getControlHighlight()),
- "Button.light", new ColorUIResource(getControlHighlight()),
- "Button.margin", new Insets(2, 14, 2, 14),
- "Button.select", new ColorUIResource(getPrimaryControlShadow()),
- "Button.shadow", new ColorUIResource(getPrimaryControlShadow()),
- "CheckBox.background", new ColorUIResource(getControl()),
+ "Button.foreground", getControlTextColor(),
+ "Button.highlight", getControlHighlight(),
+ "Button.light", getControlHighlight(),
+ "Button.margin", new InsetsUIResource(2, 14, 2, 14),
+ "Button.select", getControlShadow(),
+ "Button.shadow", getControlShadow(),
+
+ "CheckBox.background", getControl(),
"CheckBox.border", MetalBorders.getButtonBorder(),
+ "CheckBox.disabledText", getInactiveControlTextColor(),
+ "CheckBox.focus", getFocusColor(),
+ "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "CheckBox.foreground", getControlTextColor(),
"CheckBox.icon",
new UIDefaults.ProxyLazyValue
("javax.swing.plaf.metal.MetalCheckBoxIcon"),
"CheckBox.checkIcon",
new UIDefaults.ProxyLazyValue
("javax.swing.plaf.metal.MetalCheckBoxIcon"),
- "CheckBoxMenuItem.background", new ColorUIResource(getControl()),
+ "Checkbox.select", getControlShadow(),
+
+ "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
+ "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
+ "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "CheckBoxMenuItem.background", getMenuBackground(),
+ "CheckBoxMenuItem.borderPainted", new Boolean(true),
+ "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
"CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
- "ToolBar.background", new ColorUIResource(getControl()),
- "Panel.background", new ColorUIResource(getControl()),
- "Slider.background", new ColorUIResource(getControl()),
- "OptionPane.background", new ColorUIResource(getControl()),
- "ProgressBar.background", new ColorUIResource(getControl()),
- "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
- "TabbedPane.background", new ColorUIResource(getControl()),
+ "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
+ "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "CheckBoxMenuItem.foreground", getMenuForeground(),
+ "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
+ "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
+
+ "ColorChooser.background", getControl(),
+ "ColorChooser.foreground", getControlTextColor(),
+ "ColorChooser.rgbBlueMnemonic", new Integer(0),
+ "ColorChooser.rgbGreenMnemonic", new Integer(0),
+ "ColorChooser.rgbRedMnemonic", new Integer(0),
+ "ColorChooser.swatchesDefaultRecentColor", getControl(),
+
+ "ComboBox.background", getControl(),
+ "ComboBox.buttonBackground", getControl(),
+ "ComboBox.buttonDarkShadow", getControlDarkShadow(),
+ "ComboBox.buttonHighlight", getControlHighlight(),
+ "ComboBox.buttonShadow", getControlShadow(),
+ "ComboBox.disabledBackground", getControl(),
+ "ComboBox.disabledForeground", getInactiveSystemTextColor(),
+ "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "ComboBox.foreground", getControlTextColor(),
+ "ComboBox.selectionBackground", getPrimaryControlShadow(),
+ "ComboBox.selectionForeground", getControlTextColor(),
+
+ "Desktop.background", getDesktopColor(),
+
+ "DesktopIcon.background", getControl(),
+ "DesktopIcon.foreground", getControlTextColor(),
+ "DesktopIcon.width", new Integer(160),
+ "DesktopIcon.border", MetalBorders.getDesktopIconBorder(),
+
+ "EditorPane.background", getWindowBackground(),
+ "EditorPane.caretForeground", getUserTextColor(),
+ "EditorPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "EditorPane.foreground", getUserTextColor(),
+ "EditorPane.inactiveForeground", getInactiveSystemTextColor(),
+ "EditorPane.selectionBackground", getTextHighlightColor(),
+ "EditorPane.selectionForeground", getHighlightedTextColor(),
+
+ "FormattedTextField.background", getWindowBackground(),
+ "FormattedTextField.border",
+ new BorderUIResource(MetalBorders.getTextFieldBorder()),
+ "FormattedTextField.caretForeground", getUserTextColor(),
+ "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "FormattedTextField.foreground", getUserTextColor(),
+ "FormattedTextField.inactiveBackground", getControl(),
+ "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(),
+ "FormattedTextField.selectionBackground", getTextHighlightColor(),
+ "FormattedTextField.selectionForeground", getHighlightedTextColor(),
+
+ "FileView.computerIcon", MetalIconFactory.getTreeComputerIcon(),
+ "FileView.directoryIcon", MetalIconFactory.getTreeFolderIcon(),
+ "FileView.fileIcon", MetalIconFactory.getTreeLeafIcon(),
+ "FileView.floppyDriveIcon", MetalIconFactory.getTreeFloppyDriveIcon(),
+ "FileView.hardDriveIcon", MetalIconFactory.getTreeHardDriveIcon(),
+
+ "InternalFrame.activeTitleBackground", getWindowTitleBackground(),
+ "InternalFrame.activeTitleForeground", getWindowTitleForeground(),
"InternalFrame.border", new MetalBorders.InternalFrameBorder(),
+ "InternalFrame.borderColor", getControl(),
+ "InternalFrame.borderDarkShadow", getControlDarkShadow(),
+ "InternalFrame.borderHighlight", getControlHighlight(),
+ "InternalFrame.borderLight", getControlHighlight(),
+ "InternalFrame.borderShadow", getControlShadow(),
"InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
"InternalFrame.closeIcon",
MetalIconFactory.getInternalFrameCloseIcon(16),
+ "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(),
+ "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(),
"InternalFrame.maximizeIcon",
MetalIconFactory.getInternalFrameMaximizeIcon(16),
"InternalFrame.iconifyIcon",
MetalIconFactory.getInternalFrameMinimizeIcon(16),
- "Label.background", new ColorUIResource(getControl()),
+ "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(),
+ "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(),
+ "InternalFrame.paletteTitleHeight", new Integer(11),
+
+ "Label.background", getControl(),
+ "Label.disabledForeground", getInactiveSystemTextColor(),
+ "Label.disabledShadow", getControlShadow(),
"Label.font", getControlTextFont(),
- "Label.disabledForeground", new ColorUIResource(getInactiveControlTextColor()),
- "Label.foreground", new ColorUIResource(getControlTextColor()),
- "Menu.background", new ColorUIResource(getControl()),
+ "Label.foreground", getSystemTextColor(),
+
+ "List.font", getControlTextFont(),
+ "List.background", getWindowBackground(),
+ "List.foreground", getUserTextColor(),
+ "List.selectionBackground", getTextHighlightColor(),
+ "List.selectionForeground", getHighlightedTextColor(),
+ "List.focusCellHighlightBorder",
+ new LineBorderUIResource(MetalLookAndFeel.getFocusColor()),
+
+ "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
+ "Menu.acceleratorForeground", getAcceleratorForeground(),
+ "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "Menu.background", getMenuBackground(),
"Menu.border", new MetalBorders.MenuItemBorder(),
"Menu.borderPainted", Boolean.TRUE,
+ "Menu.disabledForeground", getMenuDisabledForeground(),
"Menu.font", getControlTextFont(),
+ "Menu.foreground", getMenuForeground(),
"Menu.selectionBackground", getMenuSelectedBackground(),
"Menu.selectionForeground", getMenuSelectedForeground(),
- "MenuBar.background", new ColorUIResource(getControl()),
+
+ "MenuBar.background", getMenuBackground(),
"MenuBar.border", new MetalBorders.MenuBarBorder(),
"MenuBar.font", getControlTextFont(),
- "MenuItem.background", new ColorUIResource(getControl()),
+ "MenuBar.foreground", getMenuForeground(),
+ "MenuBar.highlight", getControlHighlight(),
+ "MenuBar.shadow", getControlShadow(),
+
+ "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
+ "MenuItem.acceleratorForeground", getAcceleratorForeground(),
+ "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "MenuItem.background", getMenuBackground(),
"MenuItem.border", new MetalBorders.MenuItemBorder(),
+ "MenuItem.disabledForeground", getMenuDisabledForeground(),
"MenuItem.font", getControlTextFont(),
+ "MenuItem.foreground", getMenuForeground(),
"MenuItem.selectionBackground", getMenuSelectedBackground(),
"MenuItem.selectionForeground", getMenuSelectedForeground(),
- "Panel.background", new ColorUIResource(getControl()),
+
+ "OptionPane.background", getControl(),
+ "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51),
+ "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153),
+ "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0),
+ "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102),
+ "OptionPane.foreground", getControlTextColor(),
+ "OptionPane.messageForeground", getControlTextColor(),
+ "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51),
+ "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153),
+ "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0),
+ "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102),
+ "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51),
+ "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153),
+ "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0),
+ "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102),
+
+ "Panel.background", getControl(),
+ "Panel.foreground", getUserTextColor(),
+
+ "PasswordField.background", getWindowBackground(),
+ "PasswordField.border",
+ new BorderUIResource(MetalBorders.getTextFieldBorder()),
+ "PasswordField.caretForeground", getUserTextColor(),
+ "PasswordField.foreground", getUserTextColor(),
+ "PasswordField.inactiveBackground", getControl(),
+ "PasswordField.inactiveForeground", getInactiveSystemTextColor(),
+ "PasswordField.selectionBackground", getTextHighlightColor(),
+ "PasswordField.selectionForeground", getHighlightedTextColor(),
+
+ "PopupMenu.background", getMenuBackground(),
+ "PopupMenu.border", new MetalBorders.PopupMenuBorder(),
+ "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "PopupMenu.foreground", getMenuForeground(),
+
+ "ProgressBar.background", getControl(),
+ "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
+ "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "ProgressBar.foreground", getPrimaryControlShadow(),
+ "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
+ "ProgressBar.selectionForeground", getControl(),
+
+ "RadioButton.background", getControl(),
+ "RadioButton.darkShadow", getControlDarkShadow(),
+ "RadioButton.disabledText", getInactiveControlTextColor(),
"RadioButton.icon",
new UIDefaults.LazyValue()
{
@@ -823,80 +980,199 @@ public class MetalLookAndFeel extends BasicLookAndFeel
return MetalIconFactory.getRadioButtonIcon();
}
},
-
+ "RadioButton.focus", MetalLookAndFeel.getFocusColor(),
+ "RadioButton.font", MetalLookAndFeel.getControlTextFont(),
+ "RadioButton.foreground", getControlTextColor(),
+ "RadioButton.highlight", getControlHighlight(),
+ "RadioButton.light", getControlHighlight(),
+ "RadioButton.select", getControlShadow(),
+ "RadioButton.shadow", getControlShadow(),
+
+ "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10),
+ "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
+ "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "RadioButtonMenuItem.background", getMenuBackground(),
"RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
"RadioButtonMenuItem.borderPainted", Boolean.TRUE,
"RadioButtonMenuItem.checkIcon",
MetalIconFactory.getRadioButtonMenuItemIcon(),
+ "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
"RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(),
+ "RadioButtonMenuItem.foreground", getMenuForeground(),
"RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
"RadioButtonMenuItem.selectionBackground",
MetalLookAndFeel.getMenuSelectedBackground(),
"RadioButtonMenuItem.selectionForeground",
MetalLookAndFeel.getMenuSelectedForeground(),
- "ScrollBar.background", new ColorUIResource(getControl()),
- "ScrollBar.shadow", new ColorUIResource(getControlShadow()),
- "ScrollBar.thumb", new ColorUIResource(getPrimaryControlShadow()),
- "ScrollBar.thumbDarkShadow",
- new ColorUIResource(getPrimaryControlDarkShadow()),
- "ScrollBar.thumbHighlight",
- new ColorUIResource(getPrimaryControl()),
+ "ScrollBar.background", getControl(),
+ "ScrollBar.darkShadow", getControlDarkShadow(),
+ "ScrollBar.foreground", getControl(),
+ "ScrollBar.highlight", getControlHighlight(),
+ "ScrollBar.shadow", getControlShadow(),
+ "ScrollBar.thumb", getPrimaryControlShadow(),
+ "ScrollBar.thumbDarkShadow", getControlDarkShadow(),
+ "ScrollBar.thumbHighlight", getPrimaryControl(),
+ "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
+ "ScrollBar.track", getControl(),
+ "ScrollBar.trackHighlight", getControlDarkShadow(),
+ "ScrollBar.width", new Integer(17),
+
+ "ScrollPane.background", getControl(),
+ "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
+ "ScrollPane.foreground", getControlTextColor(),
- "SplitPane.darkShadow",
- new ColorUIResource(getControlDarkShadow()),
- "SplitPane.highlight",
- new ColorUIResource(getControlHighlight()),
+ "Separator.background", getSeparatorBackground(),
+ "Separator.foreground", getSeparatorForeground(),
+ "Separator.highlight", getControlHighlight(),
+ "Separator.shadow", getControlShadow(),
+ "Slider.background", getControl(),
+ "Slider.focus", getFocusColor(),
"Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
+ "Slider.foreground", getPrimaryControlShadow(),
+ "Slider.highlight", getControlHighlight(),
"Slider.horizontalThumbIcon",
MetalIconFactory.getHorizontalSliderThumbIcon(),
+ "Slider.majorTickLength", new Integer(6),
+ "Slider.shadow", getControlShadow(),
+ "Slider.trackWidth", new Integer(7),
"Slider.verticalThumbIcon",
MetalIconFactory.getVerticalSliderThumbIcon(),
- "Slider.trackWidth", new Integer(7),
- "Slider.majorTickLength", new Integer(6),
-
+
+ "Spinner.background", getControl(),
+ "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "Spinner.foreground", getControl(),
+
+ "SplitPane.background", getControl(),
+ "SplitPane.darkShadow", getControlDarkShadow(),
+ "SplitPane.dividerFocusColor", getPrimaryControl(),
+ "SplitPane.highlight", getControlHighlight(),
+ "SplitPane.shadow", getControlShadow(),
+
+ "SplitPaneDivider.draggingColor", Color.DARK_GRAY,
+
+ "TabbedPane.background", getControlShadow(),
+ "TabbedPane.darkShadow", getControlDarkShadow(),
+ "TabbedPane.focus", getPrimaryControlDarkShadow(),
"TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
- "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
+ "TabbedPane.foreground", getControlTextColor(),
+ "TabbedPane.highlight", getControlHighlight(),
+ "TabbedPane.light", getControl(),
+ "TabbedPane.selected", getControl(),
+ "TabbedPane.selectHighlight", getControlHighlight(),
"TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
+ "TabbedPane.shadow", getControlShadow(),
+ "TabbedPane.tabAreaBackground", getControl(),
"TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
-
- "ToggleButton.background", new ColorUIResource(getControl()),
- "ToggleButton.border", MetalBorders.getButtonBorder(),
- "ToggleButton.darkShadow", new ColorUIResource(getControlDarkShadow()),
- "ToggleButton.disabledText", new ColorUIResource(getControlDisabled()),
- "ToggleButton.focus", new ColorUIResource(getFocusColor()),
+ "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
+
+ "Table.background", getWindowBackground(),
+ "Table.focusCellBackground", getWindowBackground(),
+ "Table.focusCellForeground", getControlTextColor(),
+ "Table.foreground", getControlTextColor(),
+ "Table.focusCellHighlightBorder",
+ new BorderUIResource.LineBorderUIResource(getControlShadow()),
+ "Table.focusCellBackground", getWindowBackground(),
+ "Table.gridColor", getControlDarkShadow(),
+ "Table.selectionBackground", new ColorUIResource(204, 204, 255),
+ "Table.selectionForeground", new ColorUIResource(0, 0, 0),
+
+ "TableHeader.background", getControl(),
+ "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(),
+ "TableHeader.foreground", getControlTextColor(),
+
+ "TextArea.background", getWindowBackground(),
+ "TextArea.caretForeground", getUserTextColor(),
+ "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "TextArea.foreground", getUserTextColor(),
+ "TextArea.inactiveForeground", getInactiveSystemTextColor(),
+ "TextArea.selectionBackground", getTextHighlightColor(),
+ "TextArea.selectionForeground", getHighlightedTextColor(),
+
+ "TextField.background", getWindowBackground(),
+ "TextField.border",
+ new BorderUIResource(MetalBorders.getTextFieldBorder()),
+ "TextField.caretForeground", getUserTextColor(),
+ "TextField.darkShadow", getControlDarkShadow(),
+ "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "TextField.foreground", getUserTextColor(),
+ "TextField.highlight", getControlHighlight(),
+ "TextField.inactiveBackground", getControl(),
+ "TextField.inactiveForeground", getInactiveSystemTextColor(),
+ "TextField.light", getControlHighlight(),
+ "TextField.selectionBackground", getTextHighlightColor(),
+ "TextField.selectionForeground", getHighlightedTextColor(),
+ "TextField.shadow", getControlShadow(),
+
+ "TextPane.background", getWindowBackground(),
+ "TextPane.caretForeground", getUserTextColor(),
+ "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "TextPane.foreground", getUserTextColor(),
+ "TextPane.inactiveForeground", getInactiveSystemTextColor(),
+ "TextPane.selectionBackground", getTextHighlightColor(),
+ "TextPane.selectionForeground", getHighlightedTextColor(),
+
+ "TitledBorder.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "TitledBorder.titleColor", getSystemTextColor(),
+
+ "ToggleButton.background", getControl(),
+ "ToggleButton.border", MetalBorders.getToggleButtonBorder(),
+ "ToggleButton.darkShadow", getControlDarkShadow(),
+ "ToggleButton.disabledText", getInactiveControlTextColor(),
+ "ToggleButton.focus", getFocusColor(),
"ToggleButton.font", getControlTextFont(),
- "ToggleButton.foreground", new ColorUIResource(getSystemTextColor()),
- "ToggleButton.highlight", new ColorUIResource(getControlHighlight()),
- "ToggleButton.light", new ColorUIResource(getControlHighlight()),
- "ToggleButton.margin", new Insets(2, 14, 2, 14),
- "ToggleButton.select", new ColorUIResource(getPrimaryControlShadow()),
- "ToggleButton.shadow", new ColorUIResource(getPrimaryControlShadow()),
-
- "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
+ "ToggleButton.foreground", getControlTextColor(),
+ "ToggleButton.highlight", getControlHighlight(),
+ "ToggleButton.light", getControlHighlight(),
+ "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
+ "ToggleButton.select", getControlShadow(),
+ "ToggleButton.shadow", getControlShadow(),
+
+ "ToolBar.background", getMenuBackground(),
+ "ToolBar.darkShadow", getControlDarkShadow(),
+ "ToolBar.dockingBackground", getMenuBackground(),
+ "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
+ "ToolBar.floatingBackground", getMenuBackground(),
+ "ToolBar.floatingForeground", getPrimaryControl(),
+ "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "ToolBar.foreground", getMenuForeground(),
+ "ToolBar.highlight", getControlHighlight(),
+ "ToolBar.light", getControlHighlight(),
+ "ToolBar.shadow", getControlShadow(),
+ "ToolBar.border", new MetalBorders.ToolBarBorder(),
+
+ "ToolTip.background", getPrimaryControl(),
+ "ToolTip.backgroundInactive", getControl(),
+ "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1),
+ "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
+ "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "ToolTip.foreground", getPrimaryControlInfo(),
+ "ToolTip.foregroundInactive", getControlDarkShadow(),
+
+ "Tree.background", getWindowBackground(),
"Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
- "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
"Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true),
"Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false),
- "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)),
- "Tree.background", new ColorUIResource(Color.white),
- "Tree.foreground", new ColorUIResource(new Color(204, 204, 255)),
- "Tree.hash", new ColorUIResource(new Color(204, 204, 255)),
+ "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "Tree.foreground", getUserTextColor(),
+ "Tree.hash", getPrimaryControl(),
+ "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
"Tree.leftChildIndent", new Integer(7),
+ "Tree.line", getPrimaryControl(),
+ "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
"Tree.rightChildIndent", new Integer(13),
"Tree.rowHeight", new Integer(20),
"Tree.scrollsOnExpand", Boolean.TRUE,
- "Tree.selectionBackground", new ColorUIResource(new Color(204, 204, 255)),
- "Tree.nonSelectionBackground", new ColorUIResource(Color.white),
- "Tree.selectionBorderColor", new ColorUIResource(new Color(102, 102, 153)),
+ "Tree.selectionBackground", getTextHighlightColor(),
"Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
- "Tree.nonSelectionBorder", new BorderUIResource.LineBorderUIResource(Color.white),
- "Tree.selectionForeground", new ColorUIResource(Color.black),
- "Tree.textBackground", new ColorUIResource(new Color(204, 204, 255)),
- "Tree.textForeground", new ColorUIResource(Color.black),
- "Tree.selectionForeground", new ColorUIResource(Color.black),
- "PopupMenu.border", new MetalBorders.PopupMenuBorder()
+ "Tree.selectionBorderColor", getFocusColor(),
+ "Tree.selectionForeground", getHighlightedTextColor(),
+ "Tree.textBackground", getWindowBackground(),
+ "Tree.textForeground", getUserTextColor(),
+
+ "Viewport.background", getControl(),
+ "Viewport.foreground", getUserTextColor()
};
defaults.putDefaults(myDefaults);
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
index ec9bf2b5586..44a2d3bcd6a 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
@@ -39,8 +39,12 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JPopupMenu;
import javax.swing.plaf.ComponentUI;
+/**
+ * A UI delegate for the {@link JPopupMenu.Separator} component.
+ */
public class MetalPopupMenuSeparatorUI
extends MetalSeparatorUI
{
@@ -50,7 +54,7 @@ public class MetalPopupMenuSeparatorUI
private static MetalPopupMenuSeparatorUI instance = null;
/**
- * Constructs a new instance of MetalPopupMenuSeparatorUI.
+ * Constructs a new instance of <code>MetalPopupMenuSeparatorUI</code>.
*/
public MetalPopupMenuSeparatorUI()
{
@@ -58,11 +62,11 @@ public class MetalPopupMenuSeparatorUI
}
/**
- * Returns an instance of MetalPopupMenuSeparatorUI.
+ * Returns a shared instance of <code>MetalPopupMenuSeparatorUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalPopupMenuSeparatorUI
+ * @return A shared instance of <code>MetalPopupMenuSeparatorUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java
index 96d1988fd3d..0f28818b96c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java
@@ -38,20 +38,22 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Insets;
+
import javax.swing.JComponent;
+import javax.swing.JProgressBar;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicProgressBarUI;
-public class MetalProgressBarUI
- extends BasicProgressBarUI
-{
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalProgressBarUIs */
- private static MetalProgressBarUI instance = null;
-
+/**
+ * A UI delegate for the {@link JProgressBar} component.
+ */
+public class MetalProgressBarUI extends BasicProgressBarUI
+{
/**
- * Constructs a new instance of MetalProgressBarUI.
+ * Constructs a new instance of <code>MetalProgressBarUI</code>.
*/
public MetalProgressBarUI()
{
@@ -59,16 +61,87 @@ public class MetalProgressBarUI
}
/**
- * Returns an instance of MetalProgressBarUI.
+ * Returns a new instance of <code>MetalProgressBarUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalProgressBarUI
+ * @return A new instance of <code>MetalProgressBarUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalProgressBarUI();
- return instance;
+ return new MetalProgressBarUI();
+ }
+
+ /**
+ * Performs the painting for determinate progress bars. This calls the
+ * superclass behaviour and then adds some highlighting to the upper and left
+ * edge of the progress bar.
+ *
+ * @param g the graphics context
+ * @param c not used here
+ */
+ public void paintDeterminate(Graphics g, JComponent c)
+ {
+ super.paintDeterminate(g, c);
+ Color saved = g.getColor();
+ Insets i = progressBar.getInsets();
+ int w = progressBar.getWidth();
+ int h = progressBar.getHeight();
+ int orientation = progressBar.getOrientation();
+
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ g.setColor(shadow);
+
+ g.drawLine(i.left, i.top, w - i.right, i.top);
+ g.drawLine(i.left, i.top, i.left, h - i.bottom);
+ int full = getAmountFull(i, w, h);
+ if (full > 0)
+ {
+ Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
+ g.setColor(darkShadow);
+ if (orientation == JProgressBar.HORIZONTAL)
+ {
+ g.drawLine(i.left, i.top, i.left, h - i.bottom);
+ g.drawLine(i.left, i.top, i.left + full - 1, i.top);
+ }
+ else
+ {
+ if (full >= (h - i.top - i.bottom))
+ g.drawLine(i.left, i.top, w - i.right, i.top);
+ g.drawLine(i.left, h - i.bottom, i.left, h - i.bottom - full);
+ }
+ }
+ g.setColor(saved);
+ }
+
+ /**
+ * Performs the painting for indeterminate progress bars. This calls the
+ * superclass behaviour and then adds some highlighting to the upper and left
+ * edge of the progress bar.
+ *
+ * @param g the graphics context
+ * @param c not used here
+ */
+ public void paintIndeterminate(Graphics g, JComponent c)
+ {
+ super.paintIndeterminate(g, c);
+ Color saved = g.getColor();
+ Insets i = progressBar.getInsets();
+ int w = progressBar.getWidth();
+ int h = progressBar.getHeight();
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ g.setColor(shadow);
+ g.drawLine(i.left, i.top, w - i.right, i.top);
+ g.drawLine(i.left, i.top, i.left, h - i.bottom);
+
+ boxRect = getBox(boxRect);
+ Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
+ g.setColor(darkShadow);
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.HORIZONTAL)
+ g.drawLine(boxRect.x, i.top, boxRect.x + boxRect.width - 1, i.top);
+ else
+ g.drawLine(i.left, boxRect.y, i.left, boxRect.y + boxRect.height - 1);
+ g.setColor(saved);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java
index a668f914e43..f37626e630f 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java
@@ -38,20 +38,38 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.JRadioButton;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRadioButtonUI;
+
+/**
+ * A UI delegate for the {@link JRadioButton} component.
+ */
public class MetalRadioButtonUI
extends BasicRadioButtonUI
{
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JRadioButtons. */
- private static MetalRadioButtonUI instance = null;
-
+ /** Used to draw the focus rectangle. */
+ protected Color focusColor;
+
+ /** Used to fill the icon when the button is pressed. */
+ protected Color selectColor;
+
+ /** Used to draw disabled text. */
+ protected Color disabledTextColor;
+
/**
- * Constructs a new instance of MetalRadioButtonUI.
+ * Constructs a new instance of <code>MetalRadioButtonUI</code>.
*/
public MetalRadioButtonUI()
{
@@ -59,16 +77,108 @@ public class MetalRadioButtonUI
}
/**
- * Returns an instance of MetalRadioButtonUI.
+ * Returns a new instance of <code>MetalRadioButtonUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalRadioButtonUI
+ * @return A new instance of <code>MetalRadioButtonUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalRadioButtonUI();
- return instance;
+ return new MetalRadioButtonUI();
+ }
+
+ /**
+ * Sets the default values for the specified button.
+ *
+ * @param b the button.
+ */
+ public void installDefaults(AbstractButton b)
+ {
+ super.installDefaults(b);
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ disabledTextColor = defaults.getColor("RadioButton.disabledText");
+ focusColor = defaults.getColor("RadioButton.focus");
+ selectColor = defaults.getColor("RadioButton.select");
+ }
+
+ /**
+ * Clears any defaults set in the installDefaults() method.
+ *
+ * @param b the {@link JRadioButton}.
+ */
+ protected void uninstallDefaults(AbstractButton b)
+ {
+ super.uninstallDefaults(b);
+ disabledTextColor = null;
+ focusColor = null;
+ selectColor = null;
+ }
+
+ /**
+ * Returns the color used to fill the {@link JRadioButton}'s icon when the
+ * button is pressed. The default color is obtained from the
+ * {@link UIDefaults} via an entry with the key
+ * <code>RadioButton.select</code>.
+ *
+ * @return The select color.
+ */
+ protected Color getSelectColor()
+ {
+ return selectColor;
+ }
+
+ /**
+ * Returns the color for the {@link JRadioButton}'s text when the button is
+ * disabled. The default color is obtained from the {@link UIDefaults} via
+ * an entry with the key <code>RadioButton.disabledText</code>.
+ *
+ * @return The disabled text color.
+ */
+ protected Color getDisabledTextColor()
+ {
+ return disabledTextColor;
+ }
+
+ /**
+ * Returns the color used to draw the focus rectangle when the
+ * {@link JRadioButton} has the focus. The default color is obtained from
+ * the {@link UIDefaults} via an entry with the key
+ * <code>RadioButton.focus</code>.
+ *
+ * @return The color used to draw the focus rectangle.
+ *
+ * @see #paintFocus(Graphics, Rectangle, Dimension)
+ */
+ protected Color getFocusColor()
+ {
+ return focusColor;
+ }
+
+ /**
+ * Paints the {@link JRadioButton}.
+ *
+ * @param g the graphics device.
+ * @param c the component (an instance of {@link JRadioButton}).
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ super.paint(g, c);
+ // FIXME: disabled text isn't being drawn correctly, it's possible that
+ // it could be done here...
+ }
+
+ /**
+ * Paints the focus rectangle for the {@link JRadioButton}.
+ *
+ * @param g the graphics device.
+ * @param t the bounding rectangle for the text.
+ * @param d ???
+ */
+ protected void paintFocus(Graphics g, Rectangle t, Dimension d)
+ {
+ g.setColor(focusColor);
+ g.drawRect(t.x - 1, t.y + 2, t.width + 2, t.height - 4);
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java
index 4196a4e477c..faed80382d0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java
@@ -39,9 +39,16 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JRootPane;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRootPaneUI;
+/**
+ * A UI delegate for the {@link JRootPane} component. This class is not fully
+ * implemented.
+ *
+ * @since 1.4
+ */
public class MetalRootPaneUI
extends BasicRootPaneUI
{
@@ -51,7 +58,7 @@ public class MetalRootPaneUI
private static MetalRootPaneUI instance = null;
/**
- * Constructs a new instance of MetalRootPaneUI.
+ * Constructs a shared instance of <code>MetalRootPaneUI</code>.
*/
public MetalRootPaneUI()
{
@@ -59,11 +66,11 @@ public class MetalRootPaneUI
}
/**
- * Returns an instance of MetalRootPaneUI.
+ * Returns a shared instance of <code>MetalRootPaneUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalRootPaneUI
+ * @return A shared instance of <code>MetalRootPaneUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
index 526dfb50ae2..9602ade9947 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
@@ -38,30 +38,106 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
-import java.util.HashMap;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.JScrollBar;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollBarUI;
-public class MetalScrollBarUI
- extends BasicScrollBarUI
+/**
+ * A UI delegate for the {@link JScrollBar} component.
+ */
+public class MetalScrollBarUI extends BasicScrollBarUI
{
+
+ /**
+ * A property change handler for the UI delegate that monitors for
+ * changes to the "JScrollBar.isFreeStanding" property, and updates
+ * the buttons and track rendering as appropriate.
+ */
+ class MetalScrollBarPropertyChangeHandler
+ extends BasicScrollBarUI.PropertyChangeHandler
+ {
+ /**
+ * Creates a new handler.
+ *
+ * @see #createPropertyChangeListener()
+ */
+ public MetalScrollBarPropertyChangeHandler()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles a property change event. If the event name is
+ * <code>JSlider.isFreeStanding</code>, this method updates the
+ * delegate, otherwise the event is passed up to the super class.
+ *
+ * @param e the property change event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(FREE_STANDING_PROP))
+ {
+ Boolean prop = (Boolean) e.getNewValue();
+ isFreeStanding = (prop == null ? true : prop.booleanValue());
+ if (increaseButton != null)
+ increaseButton.setFreeStanding(isFreeStanding);
+ if (decreaseButton != null)
+ decreaseButton.setFreeStanding(isFreeStanding);
+ }
+ else
+ super.propertyChange(e);
+ }
+ }
+
+ /** The name for the 'free standing' property. */
+ public static final String FREE_STANDING_PROP = "JScrollBar.isFreeStanding";
- /** The minimum thumb size */
- private static final Dimension MIN_THUMB_SIZE = new Dimension(18, 18);
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JScrollBars. */
- private static HashMap instances = null;
+ /** The minimum thumb size for a scroll bar that is not free standing. */
+ private static final Dimension MIN_THUMB_SIZE = new Dimension(15, 15);
+ /** The minimum thumb size for a scroll bar that is free standing. */
+ private static final Dimension MIN_THUMB_SIZE_FREE_STANDING
+ = new Dimension(17, 17);
+
+ /** The button that increases the value in the scroll bar. */
+ protected MetalScrollButton increaseButton;
+
+ /** The button that decreases the value in the scroll bar. */
+ protected MetalScrollButton decreaseButton;
+
+ /**
+ * The scroll bar width.
+ */
+ protected int scrollBarWidth;
+
+ /**
+ * A flag that indicates whether the scroll bar is "free standing", which
+ * means it has complete borders and can be used anywhere in the UI. A
+ * scroll bar which is not free standing has borders missing from one
+ * side, and relies on being part of another container with its own borders
+ * to look right visually. */
+ protected boolean isFreeStanding = true;
+
+ /**
+ * The color for the scroll bar shadow (this is read from the UIDefaults in
+ * the installDefaults() method).
+ */
+ Color scrollBarShadowColor;
+
/**
- * Constructs a new instance of MetalScrollBarUI.
+ * Constructs a new instance of <code>MetalScrollBarUI</code>, with no
+ * specific initialisation.
*/
public MetalScrollBarUI()
{
@@ -69,28 +145,192 @@ public class MetalScrollBarUI
}
/**
- * Returns an instance of MetalScrollBarUI.
+ * Returns a new instance of <code>MetalScrollBarUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalScrollBarUI
+ * @return An instance of MetalScrollBarUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
+ return new MetalScrollBarUI();
+ }
+
+ /**
+ * Installs the defaults.
+ */
+ protected void installDefaults()
+ {
+ // need to initialise isFreeStanding before calling the super class,
+ // so that the value is set when createIncreaseButton() and
+ // createDecreaseButton() are called (unless there is somewhere earlier
+ // that we can do this).
+ Boolean prop = (Boolean) scrollbar.getClientProperty(FREE_STANDING_PROP);
+ isFreeStanding = (prop == null ? true : prop.booleanValue());
+ scrollBarShadowColor = UIManager.getColor("ScrollBar.shadow");
+ super.installDefaults();
+ }
+
+ /**
+ * Creates a property change listener for the delegate to use. This
+ * overrides the method to provide a custom listener for the
+ * {@link MetalLookAndFeel} that can handle the
+ * <code>JScrollBar.isFreeStanding</code> property.
+ *
+ * @return A property change listener.
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new MetalScrollBarPropertyChangeHandler();
+ }
+
+ /**
+ * Creates a new button to use as the control at the lower end of the
+ * {@link JScrollBar}.
+ *
+ * @param orientation the orientation of the button ({@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} or {@link #WEST}).
+ *
+ * @return The button.
+ */
+ protected JButton createDecreaseButton(int orientation)
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ scrollBarWidth = defaults.getInt("ScrollBar.width");
+ decreaseButton = new MetalScrollButton(orientation, scrollBarWidth,
+ isFreeStanding);
+ return decreaseButton;
+ }
- Object o = instances.get(component);
- MetalScrollBarUI instance;
- if (o == null)
+ /**
+ * Creates a new button to use as the control at the upper end of the
+ * {@link JScrollBar}.
+ *
+ * @param orientation the orientation of the button ({@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} or {@link #WEST}).
+ *
+ * @return The button.
+ */
+ protected JButton createIncreaseButton(int orientation)
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ scrollBarWidth = defaults.getInt("ScrollBar.width");
+ increaseButton = new MetalScrollButton(orientation, scrollBarWidth,
+ isFreeStanding);
+ return increaseButton;
+ }
+
+ /**
+ * Paints the track for the scrollbar.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param trackBounds the track bounds.
+ */
+ protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
+ {
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width,
+ trackBounds.height);
+ if (scrollbar.getOrientation() == HORIZONTAL)
+ paintTrackHorizontal(g, c, trackBounds.x, trackBounds.y,
+ trackBounds.width, trackBounds.height);
+ else
+ paintTrackVertical(g, c, trackBounds.x, trackBounds.y,
+ trackBounds.width, trackBounds.height);
+
+ }
+
+ /**
+ * Paints the track for a horizontal scrollbar.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param x the x-coordinate for the track bounds.
+ * @param y the y-coordinate for the track bounds.
+ * @param w the width for the track bounds.
+ * @param h the height for the track bounds.
+ */
+ private void paintTrackHorizontal(Graphics g, JComponent c,
+ int x, int y, int w, int h)
+ {
+ if (c.isEnabled())
{
- instance = new MetalScrollBarUI();
- instances.put(component, instance);
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+
+ g.setColor(scrollBarShadowColor);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+
+ if (isFreeStanding)
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y + h - 2, x + w - 1, y + h - 2);
+ g.setColor(scrollBarShadowColor);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ }
}
else
- instance = (MetalScrollBarUI) o;
-
- return instance;
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 1, h - 1);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+ }
+ }
+ }
+
+ /**
+ * Paints the track for a vertical scrollbar.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param x the x-coordinate for the track bounds.
+ * @param y the y-coordinate for the track bounds.
+ * @param w the width for the track bounds.
+ * @param h the height for the track bounds.
+ */
+ private void paintTrackVertical(Graphics g, JComponent c,
+ int x, int y, int w, int h)
+ {
+ if (c.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+
+ g.setColor(scrollBarShadowColor);
+ g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+ if (isFreeStanding)
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x + w - 2, y, x + w - 2, y + h - 1);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+ }
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 1, h - 1);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ }
+ }
}
/**
@@ -102,45 +342,139 @@ public class MetalScrollBarUI
*/
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
{
- // first we fill the background
- g.setColor(thumbColor);
- g.fillRect(thumbBounds.x, thumbBounds.y, thumbBounds.width,
- thumbBounds.height);
+ // a disabled scrollbar has no thumb in the metal look and feel
+ if (!c.isEnabled())
+ return;
+ if (scrollbar.getOrientation() == HORIZONTAL)
+ paintThumbHorizontal(g, c, thumbBounds);
+ else
+ paintThumbVertical(g, c, thumbBounds);
- // draw the outer dark line
- g.setColor(thumbDarkShadowColor);
- g.drawRect(thumbBounds.x, thumbBounds.y, thumbBounds.width - 1,
- thumbBounds.height - 1);
+ // draw the pattern
+ MetalUtils.fillMetalPattern(c, g, thumbBounds.x + 3, thumbBounds.y + 3,
+ thumbBounds.width - 6, thumbBounds.height - 6,
+ thumbHighlightColor, thumbLightShadowColor);
+ }
- // draw the inner light line
+ /**
+ * Paints the thumb for a horizontal scroll bar.
+ *
+ * @param g the graphics device.
+ * @param c the scroll bar component.
+ * @param thumbBounds the thumb bounds.
+ */
+ private void paintThumbHorizontal(Graphics g, JComponent c,
+ Rectangle thumbBounds)
+ {
+ int x = thumbBounds.x;
+ int y = thumbBounds.y;
+ int w = thumbBounds.width;
+ int h = thumbBounds.height;
+
+ // first we fill the background
+ g.setColor(thumbColor);
+ if (isFreeStanding)
+ g.fillRect(x, y, w, h - 1);
+ else
+ g.fillRect(x, y, w, h);
+
+ // then draw the dark box
+ g.setColor(thumbLightShadowColor);
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 1, h - 2);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h -1);
+ }
+
+ // then the highlight
g.setColor(thumbHighlightColor);
- g.drawLine(thumbBounds.x + 1, thumbBounds.y + 1,
- thumbBounds.x + thumbBounds.width - 2,
- thumbBounds.y + 1);
- g.drawLine(thumbBounds.x + 1, thumbBounds.y + 1,
- thumbBounds.x + 1,
- thumbBounds.y + thumbBounds.height - 2);
-
+ if (isFreeStanding)
+ {
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+ }
+ else
+ {
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
+ }
+
// draw the shadow line
UIDefaults def = UIManager.getLookAndFeelDefaults();
g.setColor(def.getColor("ScrollBar.shadow"));
- g.drawLine(thumbBounds.x + 1, thumbBounds.y + thumbBounds.height,
- thumbBounds.x + thumbBounds.width,
- thumbBounds.y + thumbBounds.height);
+ g.drawLine(x + w, y + 1, x + w, y + h - 1);
- // draw the pattern
- MetalUtils.fillMetalPattern(g, thumbBounds.x + 3, thumbBounds.y + 3,
- thumbBounds.width - 6, thumbBounds.height - 6,
- thumbHighlightColor, thumbDarkShadowColor);
}
-
+
/**
- * This method returns the minimum thumb size.
+ * Paints the thumb for a vertical scroll bar.
+ *
+ * @param g the graphics device.
+ * @param c the scroll bar component.
+ * @param thumbBounds the thumb bounds.
+ */
+ private void paintThumbVertical(Graphics g, JComponent c,
+ Rectangle thumbBounds)
+ {
+ int x = thumbBounds.x;
+ int y = thumbBounds.y;
+ int w = thumbBounds.width;
+ int h = thumbBounds.height;
+
+ // first we fill the background
+ g.setColor(thumbColor);
+ if (isFreeStanding)
+ g.fillRect(x, y, w - 1, h);
+ else
+ g.fillRect(x, y, w, h);
+
+ // then draw the dark box
+ g.setColor(thumbLightShadowColor);
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 2, h - 1);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ }
+
+ // then the highlight
+ g.setColor(thumbHighlightColor);
+ if (isFreeStanding)
+ {
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+ }
+ else
+ {
+ g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+ }
+
+ // draw the shadow line
+ UIDefaults def = UIManager.getLookAndFeelDefaults();
+ g.setColor(def.getColor("ScrollBar.shadow"));
+ g.drawLine(x + 1, y + h, x + w - 2, y + h);
+ }
+
+ /**
+ * Returns the minimum thumb size. For a free standing scroll bar the
+ * minimum size is <code>17 x 17</code> pixels, whereas for a non free
+ * standing scroll bar the minimum size is <code>15 x 15</code> pixels.
*
* @return The minimum thumb size.
*/
protected Dimension getMinimumThumbSize()
{
- return MIN_THUMB_SIZE;
+ if (isFreeStanding)
+ return MIN_THUMB_SIZE_FREE_STANDING;
+ else
+ return MIN_THUMB_SIZE;
}
+
}
+
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
new file mode 100644
index 00000000000..84f9cfe494e
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
@@ -0,0 +1,483 @@
+/* MetalScrollButton.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.swing.SwingUtilities;
+import javax.swing.plaf.basic.BasicArrowButton;
+
+/**
+ * A button used by the {@link MetalScrollBarUI}. The button appearance
+ * varies according to the button direction, whether or not it is part of a
+ * "free standing" scroll bar, and the current state of the button.
+ */
+public class MetalScrollButton extends BasicArrowButton
+{
+
+ /**
+ * The maximum size for buttons.
+ * @see #getMaximumSize()
+ */
+ private static Dimension maximumSize;
+
+ /** The width of the button. */
+ private int buttonWidth;
+
+ /**
+ * A flag that indicates whether the button is part of a free standing
+ * scroll bar. This affects how the border is drawn.
+ */
+ private boolean freeStanding;
+
+ /**
+ * Creates a new button.
+ *
+ * @param direction the direction (this should be one of {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}, but
+ * this is not enforced).
+ * @param width the button width.
+ * @param freeStanding a flag indicating whether the scroll button is free
+ * standing or not.
+ */
+ public MetalScrollButton(int direction, int width, boolean freeStanding)
+ {
+ super(direction);
+ buttonWidth = width;
+ this.freeStanding = freeStanding;
+ }
+
+ /**
+ * Returns the button width.
+ *
+ * @return The button width.
+ */
+ public int getButtonWidth()
+ {
+ return buttonWidth;
+ }
+
+ /**
+ * Sets the free standing flag. This controls how the button border is
+ * drawn.
+ *
+ * @param freeStanding the new value of the flag.
+ */
+ public void setFreeStanding(boolean freeStanding)
+ {
+ this.freeStanding = freeStanding;
+ }
+
+ /**
+ * Paints the button.
+ *
+ * @param g the graphics device.
+ */
+ public void paint(Graphics g)
+ {
+ Rectangle bounds = SwingUtilities.getLocalBounds(this);
+
+ // fill the background
+ if (getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(0, 0, bounds.width, bounds.height);
+
+ paintArrow(g, bounds.width, bounds.height);
+
+ // paint a border manually - I tried using a real (custom) Border
+ // but couldn't get it to stay set for the button, something was
+ // overwriting it...
+ if (freeStanding)
+ {
+ if (direction == WEST)
+ paintWestBorderFreeStanding(g, bounds.width, bounds.height);
+ else if (direction == EAST)
+ paintEastBorderFreeStanding(g, bounds.width, bounds.height);
+ else if (direction == SOUTH)
+ paintSouthBorderFreeStanding(g, bounds.width, bounds.height);
+ else // asume NORTH
+ paintNorthBorderFreeStanding(g, bounds.width, bounds.height);
+ }
+ else
+ {
+ if (direction == WEST)
+ paintWestBorder(g, bounds.width, bounds.height);
+ else if (direction == EAST)
+ paintEastBorder(g, bounds.width, bounds.height);
+ else if (direction == SOUTH)
+ paintSouthBorder(g, bounds.width, bounds.height);
+ else // asume NORTH
+ paintNorthBorder(g, bounds.width, bounds.height);
+ }
+ }
+
+ private void paintArrow(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+
+ if (direction == SOUTH)
+ {
+ int x = w / 2;
+ int y = h / 2 + 2;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x - i, y - i, x + i - 1, y - i);
+ }
+ else if (direction == EAST)
+ {
+ int x = w / 2 + 2;
+ int y = h / 2;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x - i, y - i, x - i, y + i - 1);
+ }
+ else if (direction == WEST)
+ {
+ int x = w / 2 - 3;
+ int y = h / 2;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x + i, y - i, x + i, y + i - 1);
+ }
+ else // assume NORTH
+ {
+ int x = w / 2;
+ int y = h / 2 - 3;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x - i, y + i, x + i - 1, y + i);
+ }
+ }
+ /**
+ * Paints the border for a button with a {@link #NORTH} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintNorthBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 2, 0);
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(2, h - 1, w - 2, h - 1);
+ g.drawLine(w - 2, 2, w - 2, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 1, 1, h - 2);
+ g.drawLine(1, 1, w - 3, 1);
+ g.drawLine(w - 1, 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 1, 1, h - 1);
+ g.drawLine(w - 2, 1, w - 2, 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(w - 1, 0, w - 1, h - 1);
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #SOUTH} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintSouthBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 2, 0);
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(2, h - 1, w - 2, h - 1);
+ g.drawLine(w - 2, 2, w - 2, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 1, 1, h - 1);
+ g.drawLine(1, 1, w - 1, 1);
+ g.drawLine(w - 1, 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 1, 1, h - 1);
+ g.drawLine(w - 1, 1, w - 1, 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, h - 1, w - 1, h - 1);
+ g.drawLine(w - 1, 0, w - 1, h - 1);
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with an {@link #EAST} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintEastBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 2, 0);
+ g.drawLine(w - 2, 0, w - 2, h - 2);
+ g.drawLine(0, h - 2, w - 2, h - 2);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(0, 1, w - 1, 1);
+ g.drawLine(w - 1, 1, w - 1, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(w - 2, 1, w - 2, 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(w - 1, 0, w - 1, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #WEST} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintWestBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(0, 0, 0, h - 2);
+ g.drawLine(0, h - 2, w - 1, h - 2);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 1, w - 1, 1);
+ g.drawLine(1, 1, 1, h - 1);
+ g.drawLine(1, h - 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 2, 1, h - 2);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #NORTH} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintNorthBorder(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, 0, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 0, 1, h - 1);
+ g.drawLine(1, 0, w - 1, 0);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #SOUTH} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintSouthBorder(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 0, 1, h - 1);
+ g.drawLine(1, 0, w - 1, 0);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 1, 1, h - 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with an {@link #EAST} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintEastBorder(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(w - 1, 2, w - 1, h - 1);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(0, 1, w - 2, 1);
+ g.drawLine(0, 1, 0, h - 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #WEST} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintWestBorder(Graphics g, int w, int h)
+ {
+ Rectangle bounds = SwingUtilities.getLocalBounds(this);
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, bounds.width - 1, 0);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(0, 1, bounds.width - 1, 1);
+ g.drawLine(0, 1, 0, bounds.height - 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, bounds.width - 1, 0);
+ }
+ }
+
+ /**
+ * Returns the preferred size for the button, which varies depending on
+ * the direction of the button and whether or not it is free standing.
+ *
+ * @return The preferred size.
+ */
+ public Dimension getPreferredSize()
+ {
+ int adj = 1;
+ if (!freeStanding)
+ adj = 2;
+
+ if (direction == EAST)
+ return new Dimension(buttonWidth - adj, buttonWidth);
+ else if (direction == WEST)
+ return new Dimension(buttonWidth - 2, buttonWidth);
+ else if (direction == SOUTH)
+ return new Dimension(buttonWidth, buttonWidth - adj);
+ else // assume NORTH
+ return new Dimension(buttonWidth, buttonWidth - 2);
+ }
+
+ /**
+ * Returns the minimum size for the button.
+ *
+ * @return The minimum size for the button.
+ */
+ public Dimension getMinimumSize()
+ {
+ return getPreferredSize();
+ }
+
+ /**
+ * Returns the maximum size for the button.
+ *
+ * @return <code>Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)</code>.
+ */
+ public Dimension getMaximumSize()
+ {
+ if (maximumSize == null)
+ maximumSize = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ return maximumSize;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java
index 3e1198b398d..d5bf175f92d 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java
@@ -39,19 +39,18 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JScrollPane;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollPaneUI;
+/**
+ * A UI delegate for the {@link JScrollPane} component.
+ */
public class MetalScrollPaneUI
extends BasicScrollPaneUI
{
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JScrollPanes. */
- private static MetalScrollPaneUI instance = null;
-
/**
- * Constructs a new instance of MetalScrollPaneUI.
+ * Constructs a new instance of <code>MetalScrollPaneUI</code>.
*/
public MetalScrollPaneUI()
{
@@ -59,16 +58,14 @@ public class MetalScrollPaneUI
}
/**
- * Returns an instance of MetalScrollPaneUI.
+ * Returns a shared instance of <code>MetalScrollPaneUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalScrollPaneUI
+ * @return A shared instance of <code>MetalScrollPaneUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalScrollPaneUI();
- return instance;
+ return new MetalScrollPaneUI();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java
index 6e78ccb7071..1d48e9be2b0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java
@@ -38,10 +38,20 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
import javax.swing.JComponent;
+import javax.swing.JSeparator;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicSeparatorUI;
+/**
+ * A UI delegate for the {@link JSeparator} component.
+ */
public class MetalSeparatorUI
extends BasicSeparatorUI
{
@@ -51,7 +61,7 @@ public class MetalSeparatorUI
private static MetalSeparatorUI instance = null;
/**
- * Constructs a new instance of MetalSeparatorUI.
+ * Constructs a new instance of <code>MetalSeparatorUI</code>.
*/
public MetalSeparatorUI()
{
@@ -59,11 +69,11 @@ public class MetalSeparatorUI
}
/**
- * Returns an instance of MetalSeparatorUI.
+ * Returns a shared instance of <code>MetalSeparatorUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalSeparatorUI
+ * @return A shared instance of <code>MetalSeparatorUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
@@ -71,4 +81,51 @@ public class MetalSeparatorUI
instance = new MetalSeparatorUI();
return instance;
}
+
+ /**
+ * The separator is made of two lines. The top line will be
+ * the Metal theme color separatorForeground (or left line if it's vertical).
+ * The bottom or right line will be the Metal theme color
+ * separatorBackground.
+ * The two lines will
+ * be centered inside the bounds box. If the separator is horizontal,
+ * then it will be vertically centered, or if it's vertical, it will
+ * be horizontally centered.
+ *
+ * @param g The Graphics object to paint with
+ * @param c The JComponent to paint.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Rectangle r = new Rectangle();
+ SwingUtilities.calculateInnerArea(c, r);
+ Color saved = g.getColor();
+ Color c1 = UIManager.getColor("Separator.foreground");
+ Color c2 = UIManager.getColor("Separator.background");
+ JSeparator s;
+ if (c instanceof JSeparator)
+ s = (JSeparator) c;
+ else
+ return;
+
+ if (s.getOrientation() == JSeparator.HORIZONTAL)
+ {
+ int midAB = r.height / 2;
+ g.setColor(c1);
+ g.drawLine(r.x, r.y + midAB - 1, r.x + r.width, r.y + midAB - 1);
+
+ g.setColor(c2);
+ g.fillRect(r.x, r.y + midAB, r.x + r.width, r.y + midAB);
+ }
+ else
+ {
+ int midAD = r.height / 2 + r.y;
+ g.setColor(c1);
+ g.drawLine(r.x, r.y, r.x, r.y + r.height);
+
+ g.setColor(c2);
+ g.fillRect(r.x + midAD, r.y + r.height, r.x + midAD, r.y + r.height);
+ }
+ g.setColor(saved);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
index 4b52c4b0041..08fb99d216c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
@@ -42,8 +42,8 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.HashMap;
import javax.swing.Icon;
import javax.swing.JComponent;
@@ -56,16 +56,59 @@ import javax.swing.plaf.basic.BasicSliderUI;
/**
* A UI delegate for the {@link JSlider} component.
*/
-public class MetalSliderUI
- extends BasicSliderUI
+public class MetalSliderUI extends BasicSliderUI
{
- // TODO: find a use for this
+ /**
+ * A property change handler that updates the rendered component in response
+ * to specific property change events. This custom handler is used to
+ * intercept the "JSlider.isFilled" property, which is only recognised by
+ * the {@link MetalLookAndFeel}.
+ */
+ protected class MetalPropertyListener
+ extends BasicSliderUI.PropertyChangeHandler
+ {
+ /**
+ * Creates a new listener.
+ */
+ protected MetalPropertyListener()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles property change events. Events with the name "JSlider.isFilled"
+ * are handled here, and other events are passed to the superclass.
+ *
+ * @param e the property change event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(SLIDER_FILL))
+ {
+ Boolean b = (Boolean) e.getNewValue();
+ if (b == null)
+ filledSlider = false;
+ else
+ filledSlider = b.booleanValue();
+ }
+ else
+ super.propertyChange(e);
+ }
+ }
+
+ /** The thumb color (unused, because an icon is used to draw the thumb). */
protected static Color thumbColor;
- // TODO: find a use for this
+ /**
+ * The highlight color used for drawing the track rect when the slider is
+ * enabled.
+ */
protected static Color highlightColor;
- // TODO: find a use for this
+ /**
+ * The shadow color used for drawing the track rect when the slider is
+ * enabled.
+ */
protected static Color darkShadowColor;
/** The track width. */
@@ -85,17 +128,14 @@ public class MetalSliderUI
/** The gap between the track and the tick marks. */
protected final int TICK_BUFFER = 4;
+ /** A key to look up the filledSlider setting in the {@link UIManager}. */
+ protected final String SLIDER_FILL = "JSlider.isFilled";
+
/**
* A flag that controls whether or not the track is filled up to the value
* of the slider.
*/
protected boolean filledSlider;
-
- /** A key to look up the filledSlider setting in the {@link UIManager}. */
- protected final String SLIDER_FILL = "JSlider.isFilled";
-
- /** The UI instances for MetalSliderUIs */
- private static HashMap instances;
/**
* Constructs a new instance.
@@ -104,33 +144,27 @@ public class MetalSliderUI
{
super(null);
filledSlider = UIManager.getBoolean(SLIDER_FILL);
+ darkShadowColor = MetalLookAndFeel.getControlDarkShadow();
+ highlightColor = MetalLookAndFeel.getControlHighlight();
}
/**
- * Returns an instance of MetalSliderUI.
+ * Returns a new instance of <code>MetalSliderUI</code>.
*
- * @param component the component for which we return an UI instance
+ * @param component the component (ignored).
*
- * @return an instance of MetalSliderUI
+ * @return A new instance of <code>MetalSliderUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalSliderUI instance;
- if (o == null)
- {
- instance = new MetalSliderUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalSliderUI) o;
-
- return instance;
+ return new MetalSliderUI();
}
+ /**
+ * Installs the default for this UI delegate in the supplied component.
+ *
+ * @param c the component.
+ */
public void installUI(JComponent c)
{
super.installUI(c);
@@ -140,6 +174,18 @@ public class MetalSliderUI
}
/**
+ * Creates a property change listener for the slider.
+ *
+ * @param slider the slider.
+ *
+ * @return A new instance of {@link MetalPropertyListener}.
+ */
+ protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
+ {
+ return new MetalPropertyListener();
+ }
+
+ /**
* Paints the thumb icon for the slider.
*
* @param g the graphics device.
@@ -153,46 +199,79 @@ public class MetalSliderUI
}
/**
- * Creates a property change listener for the slider.
- *
- * @param slider the slider.
- */
- protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
- {
- // TODO: try to figure out why it might be necessary to override this
- // method as is done in Sun's implementation
- return super.createPropertyChangeListener(slider);
- }
-
- /**
* Paints the track along which the thumb control moves.
*
* @param g the graphics device.
*/
public void paintTrack(Graphics g)
{
+ Color shadowColor = MetalLookAndFeel.getControlShadow();
if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- if (filledSlider)
{
- // TODO: fill the track
+ int trackX = trackRect.x;
+ int trackY = trackRect.y + (trackRect.height - getTrackWidth()) / 2;
+ int trackW = trackRect.width - 1;
+ int trackH = getTrackWidth();
+
+ // draw border
+ if (slider.isEnabled())
+ BasicGraphicsUtils.drawEtchedRect(g, trackX, trackY, trackW, trackH,
+ darkShadowColor, shadowColor, darkShadowColor, highlightColor);
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawRect(trackX, trackY, trackW - 2, trackH - 2);
+ }
+
+ // fill track (if required)
+ if (filledSlider)
+ {
+ int xPos = xPositionForValue(slider.getValue());
+ int x = (slider.getInverted() ? xPos : trackRect.x);
+ int w = (slider.getInverted() ? trackX + trackW - xPos
+ : xPos - trackRect.x);
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.fillRect(x + 1, trackY + 1, w - 3, getTrackWidth() - 3);
+ if (slider.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(x + 1, trackY + 1, x + w - 3, trackY + 1);
+ g.drawLine(x + 1, trackY + 1, x + 1,
+ trackY + getTrackWidth() - 3);
+ }
+ }
}
- BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y
- + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1,
- getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray,
- Color.white);
- }
else
- {
- if (filledSlider)
{
- // TODO: fill the track
+ int trackX = trackRect.x + (trackRect.width - getTrackWidth()) / 2;
+ int trackY = trackRect.y;
+ int trackW = getTrackWidth();
+ int trackH = trackRect.height - 1;
+ if (slider.isEnabled())
+ BasicGraphicsUtils.drawEtchedRect(g, trackX, trackY, trackW, trackH,
+ darkShadowColor, shadowColor, darkShadowColor, highlightColor);
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawRect(trackX, trackY, trackW - 2, trackH - 2);
+ }
+
+ if (filledSlider)
+ {
+ int yPos = yPositionForValue(slider.getValue());
+ int y = (slider.getInverted() ? trackY : yPos);
+ int h = (slider.getInverted() ? yPos - trackY
+ : trackY + trackH - yPos);
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.fillRect(trackX + 1, y + 1, getTrackWidth() - 3, h - 3);
+ if (slider.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(trackX + 1, y + 1, trackX + trackW - 3, y + 1);
+ g.drawLine(trackX + 1, y + 1, trackX + 1, y + h - 3);
+ }
+ }
}
- BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width
- - getTrackWidth()) / 2, trackRect.y, getTrackWidth(),
- trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray,
- Color.white);
- }
}
/**
@@ -262,12 +341,13 @@ public class MetalSliderUI
*/
protected int getThumbOverhang()
{
- // TODO: figure out what this is used for
+ // FIXME: for what might this method be used?
return 0;
}
protected void scrollDueToClickInTrack(int dir)
{
+ // FIXME: for what might this method be overridden?
super.scrollDueToClickInTrack(dir);
}
@@ -283,8 +363,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength / 2);
}
@@ -300,8 +382,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength);
}
@@ -317,8 +401,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength / 2, y);
}
@@ -334,8 +420,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength, y);
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java
index 60e9c055952..016e09557d6 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java
@@ -78,7 +78,7 @@ class MetalSplitPaneDivider extends BasicSplitPaneDivider
{
//super.paint(g);
Dimension s = getSize();
- MetalUtils.fillMetalPattern(g, 2, 2, s.width - 4, s.height - 4,
+ MetalUtils.fillMetalPattern(splitPane, g, 2, 2, s.width - 4, s.height - 4,
light, dark);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java
index b7ea8984b43..b39fb23366e 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java
@@ -39,24 +39,22 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
-import java.util.HashMap;
import javax.swing.JComponent;
+import javax.swing.JSplitPane;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicSplitPaneUI;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
+import javax.swing.plaf.basic.BasicSplitPaneUI;
-public class MetalSplitPaneUI
- extends BasicSplitPaneUI
+/**
+ * A UI delegate for the {@link JSplitPane} component.
+ */
+public class MetalSplitPaneUI extends BasicSplitPaneUI
{
-
- /** The UI instances for MetalSplitPaneUIs */
- private static HashMap instances;
-
/**
- * Constructs a new instance of MetalSplitPaneUI.
+ * Constructs a new instance of <code>MetalSplitPaneUI</code>.
*/
public MetalSplitPaneUI()
{
@@ -64,28 +62,15 @@ public class MetalSplitPaneUI
}
/**
- * Returns an instance of MetalSplitPaneUI.
+ * Returns a new instance of <code>MetalSplitPaneUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalSplitPaneUI
+ * @return A new instance of <code>MetalSplitPaneUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalSplitPaneUI instance;
- if (o == null)
- {
- instance = new MetalSplitPaneUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalSplitPaneUI) o;
-
- return instance;
+ return new MetalSplitPaneUI();
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index 1b5fe144f6c..b1e02c7a6b0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -40,7 +40,6 @@ package javax.swing.plaf.metal;
import java.awt.Graphics;
import java.awt.LayoutManager;
-import java.util.HashMap;
import javax.swing.JComponent;
import javax.swing.JTabbedPane;
@@ -48,11 +47,9 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
/**
- * A UI delegate used for the {@link JTabbedPane} component in the
- * {@link MetalLookAndFeel}.
+ * A UI delegate for the {@link JTabbedPane} component.
*/
-public class MetalTabbedPaneUI
- extends BasicTabbedPaneUI
+public class MetalTabbedPaneUI extends BasicTabbedPaneUI
{
/**
@@ -65,13 +62,14 @@ public class MetalTabbedPaneUI
* public for compatibility.
*/
public class TabbedPaneLayout
- extends BasicTabbedPaneUI.TabbedPaneLayout
+ extends BasicTabbedPaneUI.TabbedPaneLayout
{
/**
* Creates a new instance of the layout manager.
*/
public TabbedPaneLayout()
{
+ // Nothing to do here.
}
/**
@@ -102,9 +100,6 @@ public class MetalTabbedPaneUI
}
}
- /** The shared UI instance for JTabbedPanes. */
- private static HashMap instances = null;
-
/**
* Constructs a new instance of MetalTabbedPaneUI.
*/
@@ -122,20 +117,7 @@ public class MetalTabbedPaneUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalTabbedPaneUI instance;
- if (o == null)
- {
- instance = new MetalTabbedPaneUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalTabbedPaneUI) o;
-
- return instance;
+ return new MetalTabbedPaneUI();
}
/**
@@ -145,7 +127,7 @@ public class MetalTabbedPaneUI
*/
protected LayoutManager createLayoutManager()
{
- return new TabbedPaneLayout();
+ return super.createLayoutManager();
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java
index d6e50e12239..6984daeccbe 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java
@@ -38,19 +38,16 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
-
import javax.swing.JComponent;
+import javax.swing.JTextField;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTextFieldUI;
-public class MetalTextFieldUI
- extends BasicTextFieldUI
+/**
+ * A UI delegate for the {@link JTextField} component.
+ */
+public class MetalTextFieldUI extends BasicTextFieldUI
{
-
- /** The UI instances for MetalTextFieldUIs */
- private static HashMap instances = null;
-
/**
* Constructs a new instance of MetalTextFieldUI.
*/
@@ -60,27 +57,14 @@ public class MetalTextFieldUI
}
/**
- * Returns an instance of MetalTextFieldUI.
+ * Returns a new instance of <code>MetalTextFieldUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalTextFieldUI
+ * @return A new instance of <code>MetalTextFieldUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalTextFieldUI instance;
- if (o == null)
- {
- instance = new MetalTextFieldUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalTextFieldUI) o;
-
- return instance;
+ return new MetalTextFieldUI();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
index be6d0c39ec8..46a19bdbe9e 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
@@ -39,13 +39,24 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.JToggleButton;
+import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicButtonUI;
import javax.swing.plaf.basic.BasicToggleButtonUI;
+/**
+ * A UI delegate for the {@link JToggleButton} component.
+ */
public class MetalToggleButtonUI
extends BasicToggleButtonUI
{
@@ -59,21 +70,26 @@ public class MetalToggleButtonUI
/** The color for disabled button labels. */
protected Color disabledTextColor;
- /** The shared UI instance for MetalToggleButtonUIs */
- private static MetalToggleButtonUI instance = null;
+ /**
+ * Returns a new instance of <code>MetalToggleButtonUI</code>.
+ *
+ * @param component the component for which we return an UI instance
+ *
+ * @return A new instance of <code>MetalToggleButtonUI</code>.
+ */
+ public static ComponentUI createUI(JComponent component)
+ {
+ return new MetalToggleButtonUI();
+ }
/**
- * Constructs a new instance of MetalToggleButtonUI.
+ * Constructs a new instance of <code>MetalToggleButtonUI</code>.
*/
public MetalToggleButtonUI()
{
super();
- focusColor = getFocusColor();
- selectColor = getSelectColor();
- disabledTextColor = getDisabledTextColor();
}
-
/**
* Returns the color for the focus border.
*
@@ -81,8 +97,7 @@ public class MetalToggleButtonUI
*/
protected Color getFocusColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".focus");
+ return focusColor;
}
/**
@@ -92,32 +107,98 @@ public class MetalToggleButtonUI
*/
protected Color getSelectColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".select");
+ return selectColor;
}
/**
- * Returns the color for the text label of disabled buttons.
+ * Returns the color for the text label of disabled buttons. The value
+ * is initialised in the {@link #installDefaults(AbstractButton)} method
+ * by reading the <code>ToggleButton.disabledText</code> item from the UI
+ * defaults.
*
- * @return the color for the text label of disabled buttons
+ * @return The color for the text label of disabled buttons.
*/
protected Color getDisabledTextColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".disabledText");
+ return disabledTextColor;
}
/**
- * Returns an instance of MetalToggleButtonUI.
- *
- * @param component the component for which we return an UI instance
- *
- * @return an instance of MetalToggleButtonUI
+ * Updates the button with the defaults for this look and feel.
+ *
+ * @param b the button.
*/
- public static ComponentUI createUI(JComponent component)
+ public void installDefaults(AbstractButton b)
+ {
+ super.installDefaults(b);
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ focusColor = defaults.getColor(getPropertyPrefix() + "focus");
+ selectColor = defaults.getColor(getPropertyPrefix() + "select");
+ disabledTextColor = defaults.getColor(getPropertyPrefix() + "disabledText");
+ }
+
+ /**
+ * Paints the button background when it is pressed/selected.
+ *
+ * @param g the graphics device.
+ * @param b the button.
+ */
+ protected void paintButtonPressed(Graphics g, AbstractButton b)
+ {
+ if (b.isContentAreaFilled() && b.isOpaque())
+ {
+ Color saved = g.getColor();
+ Rectangle bounds = SwingUtilities.getLocalBounds(b);
+ g.setColor(selectColor);
+ g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
+ g.setColor(saved);
+ }
+ }
+
+ /**
+ * Paints the text for the button.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param textRect the bounds for the text.
+ * @param text the text.
+ *
+ * @deprecated 1.4 Use {@link BasicButtonUI#paintText(java.awt.Graphics,
+ * javax.swing.AbstractButton, java.awt.Rectangle, java.lang.String)}.
+ */
+ protected void paintText(Graphics g, JComponent c, Rectangle textRect,
+ String text)
+ {
+ Font savedFont = g.getFont();
+ Color savedColor = g.getColor();
+ g.setFont(c.getFont());
+ if (c.isEnabled())
+ g.setColor(c.getForeground());
+ else
+ g.setColor(disabledTextColor);
+ FontMetrics fm = g.getFontMetrics(c.getFont());
+ int ascent = fm.getAscent();
+ g.drawString(text, textRect.x, textRect.y + ascent);
+ g.setFont(savedFont);
+ g.setColor(savedColor);
+ }
+
+ /**
+ * Draws the focus highlight around the text and icon.
+ *
+ * @param g the graphics device.
+ * @param b the button.
+ */
+ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect,
+ Rectangle textRect, Rectangle iconRect)
{
- if (instance == null)
- instance = new MetalToggleButtonUI();
- return instance;
+ if (!b.hasFocus())
+ return;
+ Color saved = g.getColor();
+ g.setColor(focusColor);
+ Rectangle fr = iconRect.union(textRect);
+ g.drawRect(fr.x - 1, fr.y - 1, fr.width + 1, fr.height + 1);
+ g.setColor(saved);
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java
index 39af0011ae6..c5ca91399ab 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java
@@ -38,20 +38,73 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.event.ContainerListener;
+import java.beans.PropertyChangeListener;
+
import javax.swing.JComponent;
+import javax.swing.JToolBar;
+import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToolBarUI;
-public class MetalToolBarUI
- extends BasicToolBarUI
+/**
+ * A UI delegate for the {@link JToolBar} component.
+ */
+public class MetalToolBarUI extends BasicToolBarUI
{
+
+ /**
+ * A listener (no longer used) that responds when components are added to or
+ * removed from the {@link JToolBar}. The required behaviour is now
+ * handled in the super class.
+ *
+ * @see MetalToolBarUI#createContainerListener()
+ */
+ protected class MetalContainerListener
+ extends BasicToolBarUI.ToolBarContListener
+ {
+ /**
+ * Creates a new instance.
+ */
+ protected MetalContainerListener()
+ {
+ // Nothing to do here.
+ }
+ }
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalToolBarUIs */
- private static MetalToolBarUI instance = null;
+ /**
+ * A listener (no longer used) that responds to property change events in a
+ * {@link JToolBar} component. The required behaviour is now handled in the
+ * super class.
+ *
+ * @see MetalToolBarUI#createRolloverListener()
+ */
+ protected class MetalRolloverListener
+ extends BasicToolBarUI.PropertyListener
+ {
+ /**
+ * Creates a new instance.
+ */
+ protected MetalRolloverListener()
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * The container listener (an implementation specific field, according to the
+ * spec, and not used in GNU Classpath).
+ */
+ protected ContainerListener contListener;
+
+ /**
+ * The rollover listener (an implementation specific field, according to the
+ * spec, and not used in GNU Classpath).
+ */
+ protected PropertyChangeListener rolloverListener;
/**
- * Constructs a new instance of MetalToolBarUI.
+ * Creates a new instance of this UI delegate.
*/
public MetalToolBarUI()
{
@@ -59,16 +112,51 @@ public class MetalToolBarUI
}
/**
- * Returns an instance of MetalToolBarUI.
+ * Returns a new instance of <code>MetalToolBarUI</code>.
*
- * @param component the component for which we return an UI instance
+ * @param component the component for which we return an UI instance
*
- * @return an instance of MetalToolBarUI
+ * @return A new instance of <code>MetalToolBarUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalToolBarUI();
- return instance;
+ return new MetalToolBarUI();
+ }
+
+ /**
+ * Returns <code>null</code> as permitted by recent versions of the API
+ * specification. Originally it seems this method returned a new instance of
+ * {@link MetalRolloverListener}, but this is now redundant.
+ *
+ * @return <code>null</code>.
+ */
+ protected PropertyChangeListener createRolloverListener()
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>null</code> as permitted by recent versions of the API
+ * specification. Originally it seems this method returned a new instance of
+ * {@link MetalContainerListener}, but this is now redundant.
+ *
+ * @return <code>null</code>.
+ */
+ protected ContainerListener createContainerListener()
+ {
+ return null;
+ }
+
+ /**
+ * Returns a border with no rollover effect for buttons in the tool bar.
+ *
+ * @return A border.
+ *
+ * @see MetalBorders#getToolbarButtonBorder()
+ */
+ protected Border createNonRolloverBorder()
+ {
+ return MetalBorders.getToolbarButtonBorder();
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java
index c88b6534ab7..5085d170ac2 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java
@@ -38,32 +38,92 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.JMenuItem;
+import javax.swing.JToolTip;
+import javax.swing.KeyStroke;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicToolTipUI;
+/**
+ * A UI delegate for the {@link JToolTip} component.
+ */
public class MetalToolTipUI
extends BasicToolTipUI
{
+ /**
+ * The amount of space between the tool tip text and the accelerator
+ * description (if visible).
+ */
+ public static final int padSpaceBetweenStrings = 12;
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalToolTipUIs */
+ /** The shared UI instance. */
private static MetalToolTipUI instance = null;
-
+
+ /** A flag controlling the visibility of the accelerator (if there is one). */
+ private boolean isAcceleratorHidden;
+
+ /** A string representing the accelerator key for the component. */
+ private String acceleratorString;
+
+ /**
+ * The delimiter for the accelerator string.
+ */
+ private String acceleratorDelimiter;
+
+ /** The font for the accelerator string. */
+ private Font acceleratorFont;
+
+ /** The color for the accelerator string. */
+ private Color acceleratorForeground;
+
+ /** The active border. */
+ private Border activeBorder;
+
+ /** The inactive border. */
+ private Border inactiveBorder;
+
/**
- * Constructs a new instance of MetalToolTipUI.
+ * Constructs a new instance of <code>MetalToolTipUI</code>.
*/
public MetalToolTipUI()
{
super();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ activeBorder = defaults.getBorder("ToolTip.border");
+ inactiveBorder = defaults.getBorder("ToolTip.borderInactive");
+ isAcceleratorHidden = defaults.getBoolean("ToolTip.hideAccelerator");
+ acceleratorFont = defaults.getFont("MenuItem.acceleratorFont");
+ acceleratorForeground = defaults.getColor("MenuItem.acceleratorForeground");
+ acceleratorDelimiter = defaults.getString("MenuItem.acceleratorDelimiter");
}
/**
- * Returns an instance of MetalToolTipUI.
+ * Returns a shared instance of the <code>MetalToolTipUI</code> class.
+ * Although this UI delegate does maintain state information, there is never
+ * more than one tool tip visible, so it is OK to use a shared instance.
*
- * @param component the component for which we return an UI instance
+ * @param component the component (a {@link JToolTip}).
*
- * @return an instance of MetalToolTipUI
+ * @return A shared instance of the <code>MetalToolTipUI</code> class.
*/
public static ComponentUI createUI(JComponent component)
{
@@ -71,4 +131,202 @@ public class MetalToolTipUI
instance = new MetalToolTipUI();
return instance;
}
+
+ /**
+ * Returns a string representing the accelerator key (if there is one) for
+ * the component that the tool tip belongs to.
+ *
+ * @return A string representing the accelerator key.
+ */
+ public String getAcceleratorString()
+ {
+ return acceleratorString;
+ }
+
+ /**
+ * Installs the UI for the specified component (a {@link JToolTip}).
+ *
+ * @param c the {@link JToolTip} component.
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ Border existingBorder = c.getBorder();
+ if (existingBorder == null || existingBorder instanceof UIResource)
+ {
+ if (c.isEnabled())
+ c.setBorder(activeBorder);
+ else
+ c.setBorder(inactiveBorder);
+ }
+ }
+
+ /**
+ * Clears the defaults set in {@link #installUI(JComponent)}.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ super.uninstallUI(c);
+ if (c.getBorder() instanceof UIResource)
+ c.setBorder(null);
+ }
+
+ /**
+ * Returns <code>true</code> if the accelerator string is hidden, and
+ * <code>false</code> otherwise. This setting is controlled by the
+ * <code>ToolTip.hideAccelerator</code> entry in the UI defaults table.
+ *
+ * @return A boolean.
+ */
+ protected boolean isAcceleratorHidden()
+ {
+ return isAcceleratorHidden;
+ }
+
+ /**
+ * Returns the preferred size for the {@link JToolTip} component.
+ *
+ * @param c the component (a {@link JToolTip}).
+ *
+ * @return The preferred size.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ if (isAcceleratorHidden())
+ return super.getPreferredSize(c);
+ else
+ {
+ Insets insets = c.getInsets();
+ JToolTip tt = (JToolTip) c;
+ String tipText = tt.getTipText();
+ if (tipText != null)
+ {
+ FontMetrics fm = c.getFontMetrics(c.getFont());
+ int prefH = fm.getHeight() + insets.top + insets.bottom;
+ int prefW = fm.stringWidth(tipText) + insets.left + insets.right;
+
+ // this seems to be the first opportunity we have to get the
+ // accelerator string from the component (if it has one)
+ acceleratorString = fetchAcceleratorString(c);
+ if (acceleratorString != null)
+ {
+ prefW += padSpaceBetweenStrings;
+ fm = c.getFontMetrics(acceleratorFont);
+ prefW += fm.stringWidth(acceleratorString);
+ }
+ return new Dimension(prefW, prefH);
+ }
+ else return new Dimension(0, 0);
+ }
+ }
+
+ /**
+ * Paints the tool tip.
+ *
+ * @param g the graphics context.
+ * @param c the {@link JToolTip} component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ JToolTip tip = (JToolTip) c;
+
+ String text = tip.getTipText();
+ Toolkit t = tip.getToolkit();
+ if (text == null)
+ return;
+
+ Rectangle vr = new Rectangle();
+ vr = SwingUtilities.calculateInnerArea(tip, vr);
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+ FontMetrics fm = t.getFontMetrics(tip.getFont());
+ int ascent = fm.getAscent();
+ SwingUtilities.layoutCompoundLabel(tip, fm, text, null,
+ SwingConstants.CENTER, SwingConstants.LEFT,
+ SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0);
+ Color saved = g.getColor();
+ g.setColor(Color.BLACK);
+
+ g.drawString(text, vr.x, vr.y + ascent);
+
+ // paint accelerator
+ if (acceleratorString != null)
+ {
+ g.setFont(acceleratorFont);
+ g.setColor(acceleratorForeground);
+ fm = t.getFontMetrics(acceleratorFont);
+ int width = fm.stringWidth(acceleratorString);
+ g.drawString(acceleratorString, vr.x + vr.width - width - padSpaceBetweenStrings/2,
+ vr.y + vr.height - fm.getDescent());
+ }
+
+ g.setColor(saved);
+ }
+
+ /**
+ * Returns a string representing the accelerator for the component, or
+ * <code>null</code> if the component has no accelerator.
+ *
+ * @param c the component.
+ *
+ * @return A string representing the accelerator (possibly
+ * <code>null</code>).
+ */
+ private String fetchAcceleratorString(JComponent c)
+ {
+ String result = null;
+ if (c instanceof JToolTip)
+ {
+ JToolTip toolTip = (JToolTip) c;
+ JComponent component = toolTip.getComponent();
+ KeyStroke ks = null;
+ int mne = 0;
+ if (component instanceof JMenuItem)
+ {
+ JMenuItem item = (JMenuItem) component;
+ ks = item.getAccelerator();
+ if (ks == null)
+ mne = item.getMnemonic();
+ }
+ else if (component instanceof AbstractButton)
+ {
+ AbstractButton button = (AbstractButton) component;
+ mne = button.getMnemonic();
+ }
+ if (mne > 0)
+ ks = KeyStroke.getKeyStroke(Character.toUpperCase((char) mne),
+ InputEvent.ALT_MASK, false);
+ if (ks != null)
+ result = acceleratorToString(ks);
+ }
+ return result;
+ }
+
+ /**
+ * Returns a string representing an accelerator.
+ *
+ * @param accelerator the accelerator (<code>null</code> not permitted).
+ *
+ * @return A string representing an accelerator.
+ */
+ private String acceleratorToString(KeyStroke accelerator)
+ {
+ // convert keystroke into string format
+ String modifiersText = "";
+ int modifiers = accelerator.getModifiers();
+ char keyChar = accelerator.getKeyChar();
+ int keyCode = accelerator.getKeyCode();
+
+ if (modifiers != 0)
+ modifiersText = KeyEvent.getKeyModifiersText(modifiers)
+ + acceleratorDelimiter;
+
+ if (keyCode == KeyEvent.VK_UNDEFINED)
+ return modifiersText + keyChar;
+ else
+ return modifiersText + KeyEvent.getKeyText(keyCode);
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
index 8d16f7463fe..0ffa0d17470 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
@@ -38,21 +38,50 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.event.ComponentListener;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseListener;
+import java.beans.PropertyChangeListener;
+import java.util.Hashtable;
import javax.swing.JComponent;
+import javax.swing.JTree;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.tree.TreeCellEditor;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeSelectionListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTreeUI;
-public class MetalTreeUI
- extends BasicTreeUI
+/**
+ * A UI delegate for the {@link JTree} component.
+ */
+public class MetalTreeUI extends BasicTreeUI
{
- /** The UI instances for MetalTreeUIs */
- private static HashMap instances = null;
-
+ /** Listeners */
+ private PropertyChangeListener propertyChangeListener;
+ private FocusListener focusListener;
+ private TreeSelectionListener treeSelectionListener;
+ private MouseListener mouseListener;
+ private KeyListener keyListener;
+ private PropertyChangeListener selectionModelPropertyChangeListener;
+ private ComponentListener componentListener;
+ private CellEditorListener cellEditorListener;
+ private TreeExpansionListener treeExpansionListener;
+ private TreeModelListener treeModelListener;
+
/**
- * Constructs a new instance of MetalTreeUI.
+ * Constructs a new instance of <code>MetalTreeUI</code>.
*/
public MetalTreeUI()
{
@@ -60,27 +89,238 @@ public class MetalTreeUI
}
/**
- * Returns an instance of MetalTreeUI.
+ * Returns a new instance of <code>MetalTreeUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalTreeUI
+ * @return A new instance of <code>MetalTreeUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
+ return new MetalTreeUI();
+ }
+
+ /**
+ * The horizontal element of legs between nodes starts at the right of the
+ * left-hand side of the child node by default. This method makes the
+ * leg end before that.
+ */
+ protected int getHorizontalLegBuffer()
+ {
+ return super.getHorizontalLegBuffer();
+ }
+
+ /**
+ * Configures the specified component appropriate for the look and feel.
+ * This method is invoked when the ComponentUI instance is being installed
+ * as the UI delegate on the specified component. This method should completely
+ * configure the component for the look and feel, including the following:
+ * 1. Install any default property values for color, fonts, borders, icons,
+ * opacity, etc. on the component. Whenever possible, property values
+ * initialized by the client program should not be overridden.
+ * 2. Install a LayoutManager on the component if necessary.
+ * 3. Create/add any required sub-components to the component.
+ * 4. Create/install event listeners on the component.
+ * 5. Create/install a PropertyChangeListener on the component in order
+ * to detect and respond to component property changes appropriately.
+ * 6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
+ * 7. Initialize any appropriate instance data.
+ */
+ public void installUI(JComponent c)
+ {
+ tree = (JTree) c;
+ configureLayoutCache();
+
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ tree.setFont(defaults.getFont("Tree.font"));
+ tree.setForeground(defaults.getColor("Tree.foreground"));
+ tree.setBackground(defaults.getColor("Tree.background"));
+ tree.setOpaque(true);
+ tree.setScrollsOnExpand(defaults.getBoolean("Tree.scrollsOnExpand"));
+ rightChildIndent = defaults.getInt("Tree.rightChildIndent");
+ leftChildIndent = defaults.getInt("Tree.leftChildIndent");
+ setRowHeight(defaults.getInt("Tree.rowHeight"));
+ tree.setRowHeight(defaults.getInt("Tree.rowHeight"));
+ tree.requestFocusInWindow(false);
+
+ setExpandedIcon(defaults.getIcon("Tree.expandedIcon"));
+ setCollapsedIcon(defaults.getIcon("Tree.collapsedIcon"));
+
+ currentCellRenderer = createDefaultCellRenderer();
+ rendererPane = createCellRendererPane();
+ createdRenderer = true;
+ setCellEditor(createDefaultCellEditor());
+ createdCellEditor = true;
+ TreeModel mod = tree.getModel();
+ setModel(mod);
+
+ treeSelectionModel = tree.getSelectionModel();
+ drawingCache = new Hashtable();
+ nodeDimensions = createNodeDimensions();
+
+ propertyChangeListener = createPropertyChangeListener();
+ focusListener = createFocusListener();
+ treeSelectionListener = createTreeSelectionListener();
+ mouseListener = createMouseListener();
+ keyListener = createKeyListener();
+ selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();
+ componentListener = createComponentListener();
+ cellEditorListener = createCellEditorListener();
+ treeExpansionListener = createTreeExpansionListener();
+ treeModelListener = createTreeModelListener();
- Object o = instances.get(component);
- MetalTreeUI instance;
- if (o == null)
+ editingRow = -1;
+ lastSelectedRow = -1;
+
+ installKeyboardActions();
+
+ tree.addPropertyChangeListener(propertyChangeListener);
+ tree.addFocusListener(focusListener);
+ tree.addTreeSelectionListener(treeSelectionListener);
+ tree.addMouseListener(mouseListener);
+ tree.addKeyListener(keyListener);
+ tree.addPropertyChangeListener(selectionModelPropertyChangeListener);
+ tree.addComponentListener(componentListener);
+ tree.addTreeExpansionListener(treeExpansionListener);
+ if (treeModel != null)
+ treeModel.addTreeModelListener(treeModelListener);
+
+ if (mod != null)
{
- instance = new MetalTreeUI();
- instances.put(component, instance);
+ TreePath path = new TreePath(mod.getRoot());
+ if (!tree.isExpanded(path))
+ toggleExpandState(path);
}
- else
- instance = (MetalTreeUI) o;
+
+ completeUIInstall();
+ }
+
+ /**
+ * Reverses configuration which was done on the specified component during
+ * installUI. This method is invoked when this UIComponent instance is being
+ * removed as the UI delegate for the specified component. This method should
+ * undo the configuration performed in installUI, being careful to leave the
+ * JComponent instance in a clean state (no extraneous listeners,
+ * look-and-feel-specific property objects, etc.). This should include
+ * the following:
+ * 1. Remove any UI-set borders from the component.
+ * 2. Remove any UI-set layout managers on the component.
+ * 3. Remove any UI-added sub-components from the component.
+ * 4. Remove any UI-added event/property listeners from the component.
+ * 5. Remove any UI-installed keyboard UI from the component.
+ * 6. Nullify any allocated instance data objects to allow for GC.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ tree.setFont(null);
+ tree.setForeground(null);
+ tree.setBackground(null);
+
+ uninstallKeyboardActions();
+
+ tree.removePropertyChangeListener(propertyChangeListener);
+ tree.removeFocusListener(focusListener);
+ tree.removeTreeSelectionListener(treeSelectionListener);
+ tree.removeMouseListener(mouseListener);
+ tree.removeKeyListener(keyListener);
+ tree.removePropertyChangeListener(selectionModelPropertyChangeListener);
+ tree.removeComponentListener(componentListener);
+ tree.removeTreeExpansionListener(treeExpansionListener);
+
+ TreeCellEditor tce = tree.getCellEditor();
+ if (tce != null)
+ tce.removeCellEditorListener(cellEditorListener);
+ TreeModel tm = tree.getModel();
+ if (tm != null)
+ tm.removeTreeModelListener(treeModelListener);
+
+ tree = null;
+ uninstallComponents();
+ completeUIUninstall();
+ }
+
+ /**
+ * This function converts between the string passed into the client
+ * property and the internal representation (currently an int).
+ *
+ * @param lineStyleFlag - String representation
+ */
+ protected void decodeLineStyle(Object lineStyleFlag)
+ {
+ // FIXME: not implemented
+ }
- return instance;
+ /**
+ * Checks if the location is in expand control.
+ *
+ * @param row - current row
+ * @param rowLevel - current level
+ * @param mouseX - current x location of the mouse click
+ * @param mouseY - current y location of the mouse click
+ */
+ protected boolean isLocationInExpandControl(int row, int rowLevel,
+ int mouseX, int mouseY)
+ {
+ return super.isLocationInExpandControl(tree.getPathForRow(row),
+ mouseX, mouseY);
+ }
+
+ /**
+ * Paints the specified component appropriate for the look and feel.
+ * This method is invoked from the ComponentUI.update method when the
+ * specified component is being painted. Subclasses should override this
+ * method and use the specified Graphics object to render the content of
+ * the component.
+ *
+ * @param g - the current graphics configuration.
+ * @param c - the current component to draw
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ // Calls BasicTreeUI's paint since it takes care of painting all
+ // types of icons.
+ super.paint(g, c);
+ }
+
+ /**
+ * Paints the horizontal separators.
+ *
+ * @param g - the current graphics configuration.
+ * @param c - the current component to draw
+ */
+ protected void paintHorizontalSeparators(Graphics g, JComponent c)
+ {
+ // FIXME: not implemented
+ }
+
+
+ /**
+ * Paints the vertical part of the leg. The receiver should NOT modify
+ * clipBounds, insets.
+ *
+ * @param g - the current graphics configuration.
+ * @param clipBounds -
+ * @param insets -
+ * @param path - the current path
+ */
+ protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, TreePath path)
+ {
+ super.paintVerticalPartOfLeg(g, clipBounds, insets, path);
+ }
+
+ /**
+ * Paints the horizontal part of the leg. The receiver should NOT \
+ * modify clipBounds, or insets.
+ * NOTE: parentRow can be -1 if the root is not visible.
+ */
+ protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ super.paintHorizontalPartOfLeg(g, clipBounds, insets, bounds, path, row,
+ isExpanded, hasBeenExpanded, isLeaf);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java b/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java
index a342ee02bd3..c0b4e657676 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java
@@ -1,4 +1,4 @@
-/* Metaltils.java
+/* MetalUtils.java
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,12 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.TexturePaint;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
/**
* Some utility and helper methods for the Metal Look &amp; Feel.
@@ -49,6 +54,21 @@ class MetalUtils
{
/**
+ * The typical metal pattern for use with Graphics2D.
+ */
+ static BufferedImage pattern2D;
+
+ /**
+ * The light color to draw the pattern.
+ */
+ static Color lightColor;
+
+ /**
+ * The dark color to draw to draw the pattern.
+ */
+ static Color darkColor;
+
+ /**
* Fills a rectangle with the typical Metal pattern.
*
* @param g the <code>Graphics</code> context to use
@@ -57,31 +77,78 @@ class MetalUtils
* @param y the Y coordinate of the upper left corner of the rectangle to
* fill
* @param w the width of the rectangle to fill
- * @param w the height of the rectangle to fill
+ * @param h the height of the rectangle to fill
* @param light the light color to use
* @param dark the dark color to use
*/
- static void fillMetalPattern(Graphics g, int x, int y, int w, int h,
+ static void fillMetalPattern(Component c, Graphics g, int x, int y, int w, int h,
Color light, Color dark)
{
- int xOff = 0;
- for (int mY = y; mY < (y + h); mY++)
+ if (g instanceof Graphics2D)
+ fillMetalPattern2D((Graphics2D) g, x, y, w, h, light, dark);
+ else
{
- // set color alternating with every line
- if ((mY % 2) == 0)
- g.setColor(light);
- else
- g.setColor(dark);
-
- for (int mX = x + (xOff); mX < (x + w); mX += 4)
+ int xOff = 0;
+ for (int mY = y; mY < (y + h); mY++)
{
- g.drawLine(mX, mY, mX, mY);
+ // set color alternating with every line
+ if (((mY - y) % 2) == 0)
+ g.setColor(light);
+ else
+ g.setColor(dark);
+
+ for (int mX = x + (xOff); mX < (x + w); mX += 4)
+ {
+ g.drawLine(mX, mY, mX, mY);
+ }
+
+ // increase x offset
+ xOff++;
+ if (xOff > 3)
+ xOff = 0;
}
+ }
+ }
+
+ /**
+ * Fills a rectangle with the typical Metal pattern using Java2D.
+ *
+ * @param g2d the <code>Graphics2D</code> context to use
+ * @param x the X coordinate of the upper left corner of the rectangle to
+ * fill
+ * @param y the Y coordinate of the upper left corner of the rectangle to
+ * fill
+ * @param w the width of the rectangle to fill
+ * @param h the height of the rectangle to fill
+ */
+ static void fillMetalPattern2D(Graphics2D g2d, int x, int y, int w, int h,
+ Color light, Color dark)
+ {
+ if (pattern2D == null || !darkColor.equals(dark) || !lightColor.equals(light))
+ initializePattern(light, dark);
+
+ // Prepare the texture.
+ TexturePaint texture =
+ new TexturePaint(pattern2D, new Rectangle2D.Double(0., 0., 4., 4.));
+ g2d.setPaint(texture);
+ g2d.fillRect(x, y, w, h);
+ }
- // increase x offset
- xOff++;
- if (xOff > 3)
- xOff = 0;
- }
+ /**
+ * Initializes the pattern image.
+ */
+ static void initializePattern(Color light, Color dark)
+ {
+ pattern2D = new BufferedImage(4, 4, BufferedImage.TYPE_INT_ARGB);
+ lightColor = light;
+ darkColor = dark;
+ Graphics g = pattern2D.getGraphics();
+ g.setColor(light);
+ g.fillRect(0, 0, 1, 1);
+ g.fillRect(2, 2, 1, 1);
+ g.setColor(dark);
+ g.fillRect(1, 1, 1, 1);
+ g.fillRect(3, 3, 1, 1);
+ g.dispose();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/OceanTheme.java b/libjava/classpath/javax/swing/plaf/metal/OceanTheme.java
new file mode 100644
index 00000000000..85a8cb1ff86
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/OceanTheme.java
@@ -0,0 +1,209 @@
+/* DefaultMetalTheme.java -- A modern theme for the Metal L&F
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.metal;
+
+import javax.swing.UIDefaults;
+import javax.swing.plaf.ColorUIResource;
+
+/**
+ * A modern theme for the Metal Look &amp; Feel.
+ * @since 1.5
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public class OceanTheme extends DefaultMetalTheme
+{
+ /**
+ * The OceanTheme value for black.
+ */
+ static final ColorUIResource BLACK = new ColorUIResource(51, 51, 51);
+
+ /**
+ * The OceanTheme value for primary1.
+ */
+ static final ColorUIResource PRIMARY1 = new ColorUIResource(99, 130, 191);
+
+ /**
+ * The OceanTheme value for primary1.
+ */
+ static final ColorUIResource PRIMARY2 = new ColorUIResource(163, 184, 204);
+
+ /**
+ * The OceanTheme value for primary1.
+ */
+ static final ColorUIResource PRIMARY3 = new ColorUIResource(184, 207, 229);
+
+ /**
+ * The OceanTheme value for secondary1.
+ */
+ static final ColorUIResource SECONDARY1 = new ColorUIResource(122, 138, 153);
+
+ /**
+ * The OceanTheme value for secondary2.
+ */
+ static final ColorUIResource SECONDARY2 = new ColorUIResource(184, 207, 229);
+
+ /**
+ * The OceanTheme value for secondary3.
+ */
+ static final ColorUIResource SECONDARY3 = new ColorUIResource(238, 238, 238);
+
+ /**
+ * The OceanTheme value for inactive control text.
+ */
+ static final ColorUIResource INACTIVE_CONTROL_TEXT =
+ new ColorUIResource(153, 153, 153);
+
+ /**
+ * Returns the name of this theme, &quot;Ocean&quot;
+ */
+ public String getName()
+ {
+ return "Ocean";
+ }
+
+ /**
+ * Returns the color for control text, which is the
+ * value of the theme's black value.
+ */
+ public ColorUIResource getControlTextColor()
+ {
+ return getBlack();
+ }
+
+ /**
+ * Returns the desktop color, which is the theme's white color.
+ */
+ public ColorUIResource getDesktopColor()
+ {
+ return getWhite();
+ }
+
+ /**
+ * Returns the color for inactive control text, which is the
+ * RGB value (153, 153, 153).
+ */
+ public ColorUIResource getInactiveControlTextColor()
+ {
+ return INACTIVE_CONTROL_TEXT;
+ }
+
+ /**
+ * Returns the OceanTheme's color for disabled menu foreground,
+ *
+ */
+ public ColorUIResource getMenuDisabledForeground()
+ {
+ return INACTIVE_CONTROL_TEXT;
+ }
+
+
+ /**
+ * Returns the OceanTheme's color for black, the RGB value
+ * (51, 51, 51).
+ *
+ * @return Returns the OceanTheme's value for black
+ */
+ protected ColorUIResource getBlack()
+ {
+ return BLACK;
+ }
+
+ /**
+ * Return the OceanTheme's value for primary 1, the RGB value
+ * (99, 130, 191).
+ */
+ protected ColorUIResource getPrimary1()
+ {
+ return PRIMARY1;
+ }
+
+ /**
+ * Return the OceanTheme's value for primary 2, the RGB value
+ * (163, 184, 204).
+ */
+ protected ColorUIResource getPrimary2()
+ {
+ return PRIMARY2;
+ }
+
+ /**
+ * Return the OceanTheme's value for primary 1, the RGB value
+ * (184, 207, 229).
+ */
+ protected ColorUIResource getPrimary3()
+ {
+ return PRIMARY3;
+ }
+
+ /**
+ * Return the OceanTheme's value for secondary 1, the RGB value
+ * (122, 138, 153).
+ */
+ protected ColorUIResource getSecondary1()
+ {
+ return SECONDARY1;
+ }
+
+ /**
+ * Return the OceanTheme's value for secondary 2, the RGB value
+ * (184, 207, 229).
+ */
+ protected ColorUIResource getSecondary2()
+ {
+ return SECONDARY2;
+ }
+ /**
+ * Return the OceanTheme's value for secondary 3, the RGB value
+ * (238, 238, 238).
+ */
+ protected ColorUIResource getSecondary3()
+ {
+ return SECONDARY3;
+ }
+
+ /**
+ * Adds customized entries to the UIDefaults table.
+ *
+ * @param defaults the UI defaults table
+ */
+ public void addCustomEntriesToTable(UIDefaults defaults)
+ {
+ defaults.put("Button.rollover", Boolean.TRUE);
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/package.html b/libjava/classpath/javax/swing/plaf/metal/package.html
index 2ea787bb5e2..8675493b68c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/package.html
+++ b/libjava/classpath/javax/swing/plaf/metal/package.html
@@ -40,7 +40,16 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.swing.plaf.metal</title></head>
<body>
-<p>Provides a cross-platform look and feel known as "Metal".</p>
-
+<p>Provides a cross-platform look and feel known as "Metal". To install this
+look and feel, add the following code (or something similar)
+near the start of your application:</p>
+<pre>try
+ {
+&nbsp;&nbsp;UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+catch (UnsupportedLookAndFeelException e)
+ {
+&nbsp;&nbsp;e.printStackTrace();
+ }</pre>
</body>
</html>
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java b/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
index a70a8ff690e..2bd358dd01e 100644
--- a/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
@@ -56,6 +56,7 @@ public class MultiLookAndFeel extends LookAndFeel {
*/
public MultiLookAndFeel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
index 349f4baad12..a187d74a686 100644
--- a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
+++ b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
@@ -43,8 +43,10 @@ import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serializable;
+import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTable;
+import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
@@ -64,10 +66,21 @@ public class DefaultTableCellRenderer extends JLabel
{
public UIResource()
{
+ super();
}
}
/**
+ * Stores the color set by setForeground().
+ */
+ Color foreground;
+
+ /**
+ * Stores the color set by setBackground().
+ */
+ Color background;
+
+ /**
* Creates a default table cell renderer with an empty border.
*/
public DefaultTableCellRenderer()
@@ -83,6 +96,7 @@ public class DefaultTableCellRenderer extends JLabel
public void setForeground(Color c)
{
super.setForeground(c);
+ foreground = c;
}
/**
@@ -93,6 +107,7 @@ public class DefaultTableCellRenderer extends JLabel
public void setBackground(Color c)
{
super.setBackground(c);
+ background = c;
}
/**
@@ -104,6 +119,8 @@ public class DefaultTableCellRenderer extends JLabel
public void updateUI()
{
super.updateUI();
+ background = null;
+ foreground = null;
}
/**
@@ -137,17 +154,41 @@ public class DefaultTableCellRenderer extends JLabel
if (isSelected)
{
- setBackground(table.getSelectionBackground());
- setForeground(table.getSelectionForeground());
+ super.setBackground(table.getSelectionBackground());
+ super.setForeground(table.getSelectionForeground());
}
else
{
- setBackground(table.getBackground());
- setForeground(table.getForeground());
+ if (background != null)
+ super.setBackground(background);
+ else
+ super.setBackground(table.getBackground());
+ if (foreground != null)
+ super.setForeground(foreground);
+ else
+ super.setForeground(table.getForeground());
}
+ if (hasFocus)
+ {
+ setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
+ if (table.isCellEditable(row, column))
+ {
+ super.setBackground(UIManager.getColor("Table.focusCellBackground"));
+ super.setForeground(UIManager.getColor("Table.focusCellForeground"));
+ }
+ }
+ else
+ setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
+
setEnabled(table.isEnabled());
setFont(table.getFont());
+
+ // If the current background is equal to the table's background, then we
+ // can avoid filling the background by setting the renderer opaque.
+ Color back = getBackground();
+ setOpaque(back != null && back.equals(table.getBackground()));
+
return this;
}
diff --git a/libjava/classpath/javax/swing/table/JTableHeader.java b/libjava/classpath/javax/swing/table/JTableHeader.java
index 45586da2009..163509a45c2 100644
--- a/libjava/classpath/javax/swing/table/JTableHeader.java
+++ b/libjava/classpath/javax/swing/table/JTableHeader.java
@@ -61,9 +61,14 @@ import javax.accessibility.AccessibleValue;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.UIManager;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.TableColumnModelEvent;
+import javax.swing.event.TableColumnModelListener;
import javax.swing.plaf.TableHeaderUI;
public class JTableHeader extends JComponent
+ implements TableColumnModelListener, Accessible
{
protected class AccessibleJTableHeader extends AccessibleJComponent
{
@@ -305,11 +310,6 @@ public class JTableHeader extends JComponent
private static final long serialVersionUID = 5144633983372967710L;
/**
- * The accessibleContext property.
- */
- AccessibleContext accessibleContext;
-
- /**
* The columnModel property.
*/
protected TableColumnModel columnModel;
@@ -373,17 +373,8 @@ public class JTableHeader extends JComponent
*/
public JTableHeader(TableColumnModel cm)
{
- accessibleContext = new AccessibleJTableHeader();
columnModel = cm == null ? createDefaultColumnModel() : cm;
- draggedColumn = null;
- draggedDistance = 0;
- opaque = true;
- reorderingAllowed = true;
- resizingAllowed = true;
- resizingColumn = null;
- table = null;
- updateTableInRealTime = true;
- cellRenderer = createDefaultRenderer();
+ initializeLocalVars();
updateUI();
}
@@ -504,7 +495,9 @@ public class JTableHeader extends JComponent
*/
public void setColumnModel(TableColumnModel c)
{
+ columnModel.removeColumnModelListener(this);
columnModel = c;
+ columnModel.addColumnModelListener(this);
}
/**
@@ -619,7 +612,7 @@ public class JTableHeader extends JComponent
public Rectangle getHeaderRect(int column)
{
- Rectangle r = getTable().getCellRect(-1, column, true);
+ Rectangle r = getTable().getCellRect(-1, column, false);
r.height = getHeight();
return r;
}
@@ -665,4 +658,88 @@ public class JTableHeader extends JComponent
return -1;
}
+
+ /**
+ * Receives notification when a column is added to the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnAdded(TableColumnModelEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when a column margin changes in the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnMarginChanged(ChangeEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when a column is moved within the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnMoved(TableColumnModelEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when a column is removed from the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnRemoved(TableColumnModelEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when the column selection has changed.
+ *
+ * @param event the table column model event
+ */
+ public void columnSelectionChanged(ListSelectionEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Validates the layout of this table header and repaints it. This is
+ * equivalent to <code>revalidate()</code> followed by
+ * <code>repaint()</code>.
+ */
+ public void resizeAndRepaint()
+ {
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Initializes the fields and properties of this class with default values.
+ * This is called by the constructors.
+ */
+ protected void initializeLocalVars()
+ {
+ accessibleContext = new AccessibleJTableHeader();
+ draggedColumn = null;
+ draggedDistance = 0;
+ opaque = true;
+ reorderingAllowed = true;
+ resizingAllowed = true;
+ resizingColumn = null;
+ table = null;
+ updateTableInRealTime = true;
+ cellRenderer = createDefaultRenderer();
+ }
}
diff --git a/libjava/classpath/javax/swing/table/TableColumn.java b/libjava/classpath/javax/swing/table/TableColumn.java
index 9c36bb05ab0..9f06c5b7fcc 100644
--- a/libjava/classpath/javax/swing/table/TableColumn.java
+++ b/libjava/classpath/javax/swing/table/TableColumn.java
@@ -402,7 +402,11 @@ public class TableColumn
if (width == oldWidth)
return;
- firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, width);
+ // We do have a constant field COLUMN_WIDTH_PROPERTY,
+ // however, tests show that the actual fired property name is 'width'
+ // and even Sun's API docs say that this constant field is obsolete and
+ // not used.
+ firePropertyChange("width", oldWidth, width);
}
/**
@@ -422,12 +426,16 @@ public class TableColumn
*/
public void setPreferredWidth(int preferredWidth)
{
+ int oldPrefWidth = this.preferredWidth;
+
if (preferredWidth < minWidth)
this.preferredWidth = minWidth;
else if (preferredWidth > maxWidth)
this.preferredWidth = maxWidth;
else
this.preferredWidth = preferredWidth;
+
+ firePropertyChange("preferredWidth", oldPrefWidth, this.preferredWidth);
}
/**
diff --git a/libjava/classpath/javax/swing/table/TableColumnModel.java b/libjava/classpath/javax/swing/table/TableColumnModel.java
index 76a145604db..b006f9ad4bb 100644
--- a/libjava/classpath/javax/swing/table/TableColumnModel.java
+++ b/libjava/classpath/javax/swing/table/TableColumnModel.java
@@ -50,6 +50,7 @@ import javax.swing.event.TableColumnModelListener;
*
* @author Andrew Selkirk
*/
+// FIXME: The API documentation in this class is incomplete.
public interface TableColumnModel
{
/**
@@ -107,7 +108,7 @@ public interface TableColumnModel
* @throws IllegalArgumentException if <code>identifier</code> is
* <code>null</code> or there is no column with that identifier.
*/
- int getColumnIndex(Object columnIdentifier);
+ int getColumnIndex(Object identifier);
/**
* Returns the <code>TableColumn</code> at the specified index.
@@ -169,7 +170,6 @@ public interface TableColumnModel
/**
* getSelectionModel
- * @param column TableColumn
*/
ListSelectionModel getSelectionModel();
diff --git a/libjava/classpath/javax/swing/text/AbstractDocument.java b/libjava/classpath/javax/swing/text/AbstractDocument.java
index 3c9a4d497a5..baf8608b888 100644
--- a/libjava/classpath/javax/swing/text/AbstractDocument.java
+++ b/libjava/classpath/javax/swing/text/AbstractDocument.java
@@ -65,11 +65,10 @@ import javax.swing.undo.UndoableEdit;
* @author original author unknown
* @author Roman Kennke (roman@kennke.org)
*/
-public abstract class AbstractDocument
- implements Document, Serializable
+public abstract class AbstractDocument implements Document, Serializable
{
- /** The serial version UID for this class as of JDK1.4. */
- private static final long serialVersionUID = -116069779446114664L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 6842927725919637215L;
/**
* Standard error message to indicate a bad location.
@@ -128,7 +127,28 @@ public abstract class AbstractDocument
* Manages event listeners for this <code>Document</code>.
*/
protected EventListenerList listenerList = new EventListenerList();
+
+ /**
+ * Stores the current writer thread. Used for locking.
+ */
+ private Thread currentWriter = null;
+
+ /**
+ * The number of readers. Used for locking.
+ */
+ private int numReaders = 0;
+
+ /**
+ * Tells if there are one or more writers waiting.
+ */
+ private int numWritersWaiting = 0;
+
+ /**
+ * A condition variable that readers and writers wait on.
+ */
+ Object documentCV = new Object();
+
/**
* Creates a new <code>AbstractDocument</code> with the specified
* {@link Content} model.
@@ -332,7 +352,7 @@ public abstract class AbstractDocument
* @see GapContent
* @see StringContent
*/
- protected Content getContent()
+ protected final Content getContent()
{
return content;
}
@@ -348,8 +368,7 @@ public abstract class AbstractDocument
*/
protected Thread getCurrentWriter()
{
- // FIXME: Implement locking!
- return null;
+ return currentWriter;
}
/**
@@ -516,13 +535,18 @@ public abstract class AbstractDocument
// Just return when no text to insert was given.
if (text == null || text.length() == 0)
return;
-
DefaultDocumentEvent event =
new DefaultDocumentEvent(offset, text.length(),
DocumentEvent.EventType.INSERT);
- content.insertString(offset, text);
+
+ writeLock();
+ UndoableEdit undo = content.insertString(offset, text);
insertUpdate(event, attributes);
+ writeUnlock();
+
fireInsertUpdate(event);
+ if (undo != null)
+ fireUndoableEditUpdate(new UndoableEditEvent(this, undo));
}
/**
@@ -566,10 +590,28 @@ public abstract class AbstractDocument
}
/**
- * Blocks until a read lock can be obtained.
+ * Blocks until a read lock can be obtained. Must block if there is
+ * currently a writer modifying the <code>Document</code>.
*/
public void readLock()
{
+ if (currentWriter != null && currentWriter.equals(Thread.currentThread()))
+ return;
+ synchronized (documentCV)
+ {
+ while (currentWriter != null || numWritersWaiting > 0)
+ {
+ try
+ {
+ documentCV.wait();
+ }
+ catch (InterruptedException ie)
+ {
+ throw new Error("interrupted trying to get a readLock");
+ }
+ }
+ numReaders++;
+ }
}
/**
@@ -578,6 +620,40 @@ public abstract class AbstractDocument
*/
public void readUnlock()
{
+ // Note we could have a problem here if readUnlock was called without a
+ // prior call to readLock but the specs simply warn users to ensure that
+ // balance by using a finally block:
+ // readLock()
+ // try
+ // {
+ // doSomethingHere
+ // }
+ // finally
+ // {
+ // readUnlock();
+ // }
+
+ // All that the JDK seems to check for is that you don't call unlock
+ // more times than you've previously called lock, but it doesn't make
+ // sure that the threads calling unlock were the same ones that called lock
+
+ // FIXME: the reference implementation throws a
+ // javax.swing.text.StateInvariantError here
+ if (numReaders == 0)
+ throw new IllegalStateException("document lock failure");
+
+ synchronized (documentCV)
+ {
+ // If currentWriter is not null, the application code probably had a
+ // writeLock and then tried to obtain a readLock, in which case
+ // numReaders wasn't incremented
+ if (currentWriter == null)
+ {
+ numReaders --;
+ if (numReaders == 0 && numWritersWaiting != 0)
+ documentCV.notify();
+ }
+ }
}
/**
@@ -595,10 +671,42 @@ public abstract class AbstractDocument
DefaultDocumentEvent event =
new DefaultDocumentEvent(offset, length,
DocumentEvent.EventType.REMOVE);
+
+ // Here we set up the parameters for an ElementChange, if one
+ // needs to be added to the DocumentEvent later
+ Element root = getDefaultRootElement();
+ int start = root.getElementIndex(offset);
+ int end = root.getElementIndex(offset + length);
+
+ Element[] removed = new Element[end - start + 1];
+ for (int i = start; i <= end; i++)
+ removed[i - start] = root.getElement(i);
+
removeUpdate(event);
- content.remove(offset, length);
+
+ Element[] added = new Element[1];
+ added[0] = root.getElement(start);
+ boolean shouldFire = content.getString(offset, length).length() != 0;
+
+ writeLock();
+ UndoableEdit temp = content.remove(offset, length);
+ writeUnlock();
+
postRemoveUpdate(event);
- fireRemoveUpdate(event);
+
+ GapContent.UndoRemove changes = null;
+ if (content instanceof GapContent)
+ changes = (GapContent.UndoRemove) temp;
+
+ if (changes != null && !(start == end))
+ {
+ // We need to add an ElementChange to our DocumentEvent
+ ElementEdit edit = new ElementEdit (root, start, removed, added);
+ event.addEdit(edit);
+ }
+
+ if (shouldFire)
+ fireRemoveUpdate(event);
}
/**
@@ -713,7 +821,15 @@ public abstract class AbstractDocument
*/
public void render(Runnable runnable)
{
- // FIXME: Implement me!
+ readLock();
+ try
+ {
+ runnable.run();
+ }
+ finally
+ {
+ readUnlock();
+ }
}
/**
@@ -725,6 +841,7 @@ public abstract class AbstractDocument
*/
public void setAsynchronousLoadPriority(int p)
{
+ // TODO: Implement this properly.
}
/**
@@ -739,11 +856,30 @@ public abstract class AbstractDocument
}
/**
- * Blocks until a write lock can be obtained.
+ * Blocks until a write lock can be obtained. Must wait if there are
+ * readers currently reading or another thread is currently writing.
*/
protected void writeLock()
{
- // FIXME: Implement me.
+ if (currentWriter!= null && currentWriter.equals(Thread.currentThread()))
+ return;
+ synchronized (documentCV)
+ {
+ numWritersWaiting++;
+ while (numReaders > 0)
+ {
+ try
+ {
+ documentCV.wait();
+ }
+ catch (InterruptedException ie)
+ {
+ throw new Error("interruped while trying to obtain write lock");
+ }
+ }
+ numWritersWaiting --;
+ currentWriter = Thread.currentThread();
+ }
}
/**
@@ -752,7 +888,14 @@ public abstract class AbstractDocument
*/
protected void writeUnlock()
{
- // FIXME: Implement me.
+ synchronized (documentCV)
+ {
+ if (Thread.currentThread().equals(currentWriter))
+ {
+ currentWriter = null;
+ documentCV.notifyAll();
+ }
+ }
}
/**
@@ -970,8 +1113,8 @@ public abstract class AbstractDocument
public abstract class AbstractElement
implements Element, MutableAttributeSet, TreeNode, Serializable
{
- /** The serial version UID for AbstractElement. */
- private static final long serialVersionUID = 1265312733007397733L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 1712240033321461704L;
/** The number of characters that this Element spans. */
int count;
@@ -1231,6 +1374,9 @@ public abstract class AbstractDocument
/**
* Returns the resolve parent of this element.
+ * This is taken from the AttributeSet, but if this is null,
+ * this method instead returns the Element's parent's
+ * AttributeSet
*
* @return the resolve parent of this element
*
@@ -1238,7 +1384,9 @@ public abstract class AbstractDocument
*/
public AttributeSet getResolveParent()
{
- return attributes.getResolveParent();
+ if (attributes.getResolveParent() != null)
+ return attributes.getResolveParent();
+ return element_parent.getAttributes();
}
/**
@@ -1355,49 +1503,6 @@ public abstract class AbstractDocument
public abstract int getStartOffset();
/**
- * Prints diagnostic information to the specified stream.
- *
- * @param stream the stream to dump to
- * @param indent the indentation level
- * @param element the element to be dumped
- */
- private void dumpElement(PrintStream stream, String indent,
- Element element)
- {
- // FIXME: Should the method be removed?
- System.out.println(indent + "<" + element.getName() +">");
-
- if (element.isLeaf())
- {
- int start = element.getStartOffset();
- int end = element.getEndOffset();
- String text = "";
- try
- {
- text = getContent().getString(start, end - start);
- }
- catch (BadLocationException e)
- {
- AssertionError error =
- new AssertionError("BadLocationException should not be "
- + "thrown here. start = " + start
- + ", end = " + end);
- error.initCause(e);
- throw error;
- }
- System.out.println(indent + " ["
- + start + ","
- + end + "]["
- + text + "]");
- }
- else
- {
- for (int i = 0; i < element.getElementCount(); ++i)
- dumpElement(stream, indent + " ", element.getElement(i));
- }
- }
-
- /**
* Prints diagnostic output to the specified stream.
*
* @param stream the stream to write to
@@ -1405,10 +1510,66 @@ public abstract class AbstractDocument
*/
public void dump(PrintStream stream, int indent)
{
- String indentStr = "";
+ StringBuffer b = new StringBuffer();
for (int i = 0; i < indent; ++i)
- indentStr += " ";
- dumpElement(stream, indentStr, this);
+ b.append(' ');
+ b.append('<');
+ b.append(getName());
+ // Dump attributes if there are any.
+ if (getAttributeCount() > 0)
+ {
+ b.append('\n');
+ Enumeration attNames = getAttributeNames();
+ while (attNames.hasMoreElements())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ Object attName = attNames.nextElement();
+ b.append(attName);
+ b.append('=');
+ Object attribute = getAttribute(attName);
+ b.append(attribute);
+ b.append('\n');
+ }
+ }
+ b.append(">\n");
+
+ // Dump element content for leaf elements.
+ if (isLeaf())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ int start = getStartOffset();
+ int end = getEndOffset();
+ b.append('[');
+ b.append(start);
+ b.append(',');
+ b.append(end);
+ b.append("][");
+ try
+ {
+ b.append(getDocument().getText(start, end - start));
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("BadLocationException "
+ + "must not be thrown "
+ + "here.");
+ err.initCause(ex);
+ throw err;
+ }
+ b.append("]\n");
+ }
+ stream.print(b.toString());
+
+ // Dump child elements if any.
+ int count = getElementCount();
+ for (int i = 0; i < count; ++i)
+ {
+ Element el = getElement(i);
+ if (el instanceof AbstractElement)
+ ((AbstractElement) el).dump(stream, indent + 2);
+ }
}
}
@@ -1418,8 +1579,8 @@ public abstract class AbstractDocument
*/
public class BranchElement extends AbstractElement
{
- /** The serial version UID for BranchElement. */
- private static final long serialVersionUID = -8595176318868717313L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6037216547466333183L;
/** The child elements of this BranchElement. */
private Element[] children = new Element[0];
@@ -1503,19 +1664,30 @@ public abstract class AbstractDocument
*/
public int getElementIndex(int offset)
{
- // If we have no children, return -1.
- if (getElementCount() == 0)
- return - 1;
-
+ // If offset is less than the start offset of our first child,
+ // return 0
+ if (offset < getStartOffset())
+ return 0;
+
// XXX: There is surely a better algorithm
// as beginning from first element each time.
- for (int index = 0; index < children.length; ++index)
+ for (int index = 0; index < children.length - 1; ++index)
{
Element elem = children[index];
if ((elem.getStartOffset() <= offset)
&& (offset < elem.getEndOffset()))
return index;
+ // If the next element's start offset is greater than offset
+ // then we have to return the closest Element, since no Elements
+ // will contain the offset
+ if (children[index + 1].getStartOffset() > offset)
+ {
+ if ((offset - elem.getEndOffset()) > (children[index + 1].getStartOffset() - offset))
+ return index + 1;
+ else
+ return index;
+ }
}
// If offset is greater than the index of the last element, return
@@ -1642,8 +1814,8 @@ public abstract class AbstractDocument
public class DefaultDocumentEvent extends CompoundEdit
implements DocumentEvent
{
- /** The serial version UID of DefaultDocumentEvent. */
- private static final long serialVersionUID = -7406103236022413522L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 5230037221564563284L;
/** The starting offset of the change. */
private int offset;
@@ -1748,7 +1920,7 @@ public abstract class AbstractDocument
return (DocumentEvent.ElementChange) changes.get(elem);
}
}
-
+
/**
* An implementation of {@link DocumentEvent.ElementChange} to be added
* to {@link DefaultDocumentEvent}s.
@@ -1843,8 +2015,8 @@ public abstract class AbstractDocument
*/
public class LeafElement extends AbstractElement
{
- /** The serial version UID of LeafElement. */
- private static final long serialVersionUID = 5115368706941283802L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -8906306331347768017L;
/** Manages the start offset of this element. */
Position startPos;
diff --git a/libjava/classpath/javax/swing/text/AttributeSet.java b/libjava/classpath/javax/swing/text/AttributeSet.java
index 2f1f1890bae..01d148c067b 100644
--- a/libjava/classpath/javax/swing/text/AttributeSet.java
+++ b/libjava/classpath/javax/swing/text/AttributeSet.java
@@ -58,6 +58,7 @@ public interface AttributeSet
*/
static interface CharacterAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -65,6 +66,7 @@ public interface AttributeSet
*/
static interface ColorAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -72,6 +74,7 @@ public interface AttributeSet
*/
static interface FontAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -79,6 +82,7 @@ public interface AttributeSet
*/
static interface ParagraphAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -99,7 +103,7 @@ public interface AttributeSet
* <code>false</code> otherwise.
*
* @param name the name of the requested attribute
- * @param the value of the requested attribute
+ * @param value the value of the requested attribute
*
* @return <code>true</code> if this <code>AttributeSet</code> contains
* an attribute with the specified <code>name</code> and
diff --git a/libjava/classpath/javax/swing/text/BoxView.java b/libjava/classpath/javax/swing/text/BoxView.java
index 0f8ba1ce15e..f201045dbdb 100644
--- a/libjava/classpath/javax/swing/text/BoxView.java
+++ b/libjava/classpath/javax/swing/text/BoxView.java
@@ -155,8 +155,9 @@ public class BoxView
* automatically when any of the child view changes its preferences
* via {@link #preferenceChanged(View, boolean, boolean)}.
*
- * The layout will be updated the next time when {@link #setSize()} is
- * called, typically from within the {@link #paint()} method.
+ * The layout will be updated the next time when
+ * {@link #setSize(float, float)} is called, typically from within the
+ * {@link #paint(Graphics, Shape)} method.
*
* Valid values for the axis are {@link View#X_AXIS} and
* {@link View#Y_AXIS}.
@@ -216,12 +217,11 @@ public class BoxView
* @param alloc the allocated region for the child to paint into
* @param index the index of the child to be painted
*
- * @see {@link #childAllocation}
+ * @see #childAllocation(int, Rectangle)
*/
protected void paintChild(Graphics g, Rectangle alloc, int index)
{
View child = getView(index);
- childAllocation(index, alloc);
child.paint(g, alloc);
}
@@ -301,18 +301,15 @@ public class BoxView
setSize(bounds.width, bounds.height);
Rectangle inside = getInsideAllocation(a);
-
Rectangle copy = new Rectangle(inside);
int count = getViewCount();
for (int i = 0; i < count; ++i)
{
- // TODO: Figure out if the parameter to paintChild is meant to
- // be the child allocation or the allocation of this BoxView.
- // I assume the second option here.
- // We pass this method a copy of the inside rectangle here because
- // it modifies the actual values.
copy.setBounds(inside);
- paintChild(g, copy, i);
+ childAllocation(i, copy);
+ if (!copy.isEmpty()
+ && g.hitClip(copy.x, copy.y, copy.width, copy.height))
+ paintChild(g, copy, i);
}
}
@@ -362,6 +359,24 @@ public class BoxView
}
/**
+ * Calculates the layout of the children of this <code>BoxView</code> along
+ * the specified axis.
+ *
+ * @param span the target span
+ * @param axis the axis that is examined
+ * @param offsets an empty array, filled with the offsets of the children
+ * @param spans an empty array, filled with the spans of the children
+ */
+ protected void baselineLayout(int span, int axis, int[] offsets,
+ int[] spans)
+ {
+ if (axis == myAxis)
+ layoutMajorAxis(span, axis, offsets, spans);
+ else
+ layoutMinorAxis(span, axis, offsets, spans);
+ }
+
+ /**
* Calculates the size requirements of this <code>BoxView</code> along
* its major axis, that is the axis specified in the constructor.
*
@@ -375,27 +390,8 @@ public class BoxView
protected SizeRequirements calculateMajorAxisRequirements(int axis,
SizeRequirements sr)
{
- if (sr == null)
- sr = new SizeRequirements();
- else
- {
- sr.maximum = 0;
- sr.minimum = 0;
- sr.preferred = 0;
- sr.alignment = 0.5F;
- }
-
- int count = getViewCount();
-
- // Sum up the sizes of the children along the specified axis.
- for (int i = 0; i < count; ++i)
- {
- View child = getView(i);
- sr.minimum += child.getMinimumSpan(axis);
- sr.preferred += child.getPreferredSpan(axis);
- sr.maximum += child.getMaximumSpan(axis);
- }
- return sr;
+ SizeRequirements[] childReqs = getChildRequirements(axis);
+ return SizeRequirements.getTiledSizeRequirements(childReqs);
}
/**
@@ -413,48 +409,8 @@ public class BoxView
protected SizeRequirements calculateMinorAxisRequirements(int axis,
SizeRequirements sr)
{
- if (sr == null)
- sr = new SizeRequirements();
- else
- {
- sr.maximum = 0;
- sr.minimum = 0;
- sr.preferred = 0;
- sr.alignment = 0.5F;
- }
-
- int count = getViewCount();
-
- int aboveBaseline = 0;
- int belowBaseline = 0;
- int aboveBaselineMin = 0;
- int belowBaselineMin = 0;
- int aboveBaselineMax = 0;
- int belowBaselineMax = 0;
-
- for (int i = 0; i < count; ++i)
- {
- View child = getView(i);
- float align = child.getAlignment(axis);
- int pref = (int) child.getPreferredSpan(axis);
- int min = (int) child.getMinimumSpan(axis);
- int max = (int) child.getMaximumSpan(axis);
- aboveBaseline += (int) (align * pref);
- belowBaseline += (int) ((1.F - align) * pref);
- aboveBaselineMin += (int) (align * min);
- belowBaselineMin += (int) ((1.F - align) * min);
- aboveBaselineMax += (int) (align * max);
- belowBaselineMax += (int) ((1.F - align) * max);
- }
- sr.minimum = aboveBaselineMin + belowBaselineMin;
- sr.maximum = aboveBaselineMax + belowBaselineMax;
- sr.preferred = aboveBaseline + belowBaseline;
- if (aboveBaseline == 0)
- sr.alignment = 1.0F;
- else
- sr.alignment = (float) (sr.preferred / aboveBaseline);
-
- return sr;
+ SizeRequirements[] childReqs = getChildRequirements(axis);
+ return SizeRequirements.getAlignedSizeRequirements(childReqs);
}
/**
@@ -569,19 +525,8 @@ public class BoxView
*/
protected void layout(int width, int height)
{
- this.width = width;
- this.height = height;
-
- if (myAxis == X_AXIS)
- {
- layoutMajorAxis(width, X_AXIS, offsetsX, spansX);
- layoutMinorAxis(height, Y_AXIS, offsetsY, spansY);
- }
- else
- {
- layoutMajorAxis(height, Y_AXIS, offsetsY, spansY);
- layoutMinorAxis(width, X_AXIS, offsetsX, spansX);
- }
+ baselineLayout(width, X_AXIS, offsetsX, spansX);
+ baselineLayout(height, Y_AXIS, offsetsY, spansY);
}
/**
@@ -591,28 +536,16 @@ public class BoxView
* to layout the children
* @param axis the axis along which the layout is performed
* @param offsets the array that holds the offsets of the children on exit
- * @param offsets the array that holds the spans of the children on exit
+ * @param spans the array that holds the spans of the children on exit
*/
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,
int[] spans)
{
- // Allocate SizeRequirements for each child view.
- int count = getViewCount();
- SizeRequirements[] childReqs = new SizeRequirements[count];
- for (int i = 0; i < count; ++i)
- {
- View view = getView(i);
- childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
- (int) view.getPreferredSpan(axis),
- (int) view.getMaximumSpan(axis),
- view.getAlignment(axis));
- }
-
+ SizeRequirements[] childReqs = getChildRequirements(axis);
// Calculate the spans and offsets using the SizeRequirements uility
// methods.
SizeRequirements.calculateTiledPositions(targetSpan, null, childReqs,
offsets, spans);
-
validateLayout(axis);
}
@@ -623,26 +556,21 @@ public class BoxView
* to layout the children
* @param axis the axis along which the layout is performed
* @param offsets the array that holds the offsets of the children on exit
- * @param offsets the array that holds the spans of the children on exit
+ * @param spans the array that holds the spans of the children on exit
*/
protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets,
int[] spans)
{
- // Allocate SizeRequirements for each child view.
- int count = getViewCount();
- SizeRequirements[] childReqs = new SizeRequirements[count];
- for (int i = 0; i < count; ++i)
- {
- View view = getView(i);
- childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
- (int) view.getPreferredSpan(axis),
- (int) view.getMaximumSpan(axis),
- view.getAlignment(axis));
- }
-
+ SizeRequirements[] childReqs = getChildRequirements(axis);
// Calculate the spans and offsets using the SizeRequirements uility
// methods.
- SizeRequirements.calculateAlignedPositions(targetSpan, null, childReqs,
+ // TODO: This might be an opportunity for performance optimization. Here
+ // we could use a cached instance of SizeRequirements instead of passing
+ // null to baselineRequirements. However, this would involve rewriting
+ // the baselineRequirements() method to not use the SizeRequirements
+ // utility method, since they cannot reuse a cached instance.
+ SizeRequirements total = baselineRequirements(axis, null);
+ SizeRequirements.calculateAlignedPositions(targetSpan, total, childReqs,
offsets, spans);
validateLayout(axis);
}
@@ -692,6 +620,9 @@ public class BoxView
layoutChanged(X_AXIS);
if (this.height != (int) height)
layoutChanged(Y_AXIS);
+
+ this.width = (int) width;
+ this.height = (int) height;
Rectangle outside = new Rectangle(0, 0, this.width, this.height);
Rectangle inside = getInsideAllocation(outside);
@@ -711,4 +642,99 @@ public class BoxView
if (axis == Y_AXIS)
yLayoutValid = true;
}
+
+ /**
+ * Returns the size requirements of this view's children for the major
+ * axis.
+ *
+ * @return the size requirements of this view's children for the major
+ * axis
+ */
+ SizeRequirements[] getChildRequirements(int axis)
+ {
+ // Allocate SizeRequirements for each child view.
+ int count = getViewCount();
+ SizeRequirements[] childReqs = new SizeRequirements[count];
+ for (int i = 0; i < count; ++i)
+ {
+ View view = getView(i);
+ childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
+ (int) view.getPreferredSpan(axis),
+ (int) view.getMaximumSpan(axis),
+ view.getAlignment(axis));
+ }
+ return childReqs;
+ }
+
+ /**
+ * Returns the span for the child view with the given index for the specified
+ * axis.
+ *
+ * @param axis the axis to examine, either <code>X_AXIS</code> or
+ * <code>Y_AXIS</code>
+ * @param childIndex the index of the child for for which to return the span
+ *
+ * @return the span for the child view with the given index for the specified
+ * axis
+ */
+ protected int getSpan(int axis, int childIndex)
+ {
+ if (axis == X_AXIS)
+ return spansX[childIndex];
+ else
+ return spansY[childIndex];
+ }
+
+ /**
+ * Returns the offset for the child view with the given index for the
+ * specified axis.
+ *
+ * @param axis the axis to examine, either <code>X_AXIS</code> or
+ * <code>Y_AXIS</code>
+ * @param childIndex the index of the child for for which to return the span
+ *
+ * @return the offset for the child view with the given index for the
+ * specified axis
+ */
+ protected int getOffset(int axis, int childIndex)
+ {
+ if (axis == X_AXIS)
+ return offsetsX[childIndex];
+ else
+ return offsetsY[childIndex];
+ }
+
+ /**
+ * Returns the alignment for this box view for the specified axis. The
+ * axis that is tiled (the major axis) will be requested to be aligned
+ * centered (0.5F). The minor axis alignment depends on the child view's
+ * total alignment.
+ *
+ * @param axis the axis which is examined
+ *
+ * @return the alignment for this box view for the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ if (axis == myAxis)
+ return 0.5F;
+ else
+ return baselineRequirements(axis, null).alignment;
+ }
+
+ /**
+ * Called by a child View when its preferred span has changed.
+ *
+ * @param width indicates that the preferred width of the child changed.
+ * @param height indicates that the preferred height of the child changed.
+ * @param child the child View.
+ */
+ public void preferenceChanged (View child, boolean width, boolean height)
+ {
+ if (width)
+ xLayoutValid = false;
+ if (height)
+ yLayoutValid = false;
+ super.preferenceChanged(child, width, height);
+ }
}
diff --git a/libjava/classpath/javax/swing/text/ComponentView.java b/libjava/classpath/javax/swing/text/ComponentView.java
index f6feda21513..16112c8f4de 100644
--- a/libjava/classpath/javax/swing/text/ComponentView.java
+++ b/libjava/classpath/javax/swing/text/ComponentView.java
@@ -1,5 +1,5 @@
/* ComponentView.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,65 +41,125 @@ import java.awt.Component;
import java.awt.Graphics;
import java.awt.Shape;
+import javax.swing.SwingConstants;
+
+/**
+ * A {@link View} implementation that is able to render arbitrary
+ * {@link Component}s. This uses the attribute
+ * {@link StyleConstants#ComponentAttribute} to determine the
+ * <code>Component</code> that should be rendered. This <code>Component</code>
+ * becomes a direct child of the <code>JTextComponent</code> that contains
+ * this <code>ComponentView</code>, so this view must not be shared between
+ * multiple <code>JTextComponent</code>s.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
+// FIXME: This class is a complete stub and needs to be implemented properly.
public class ComponentView extends View
{
- public ComponentView(Element elem)
- {
- super(elem);
- }
-
- protected Component createComponent()
- {
- return null;
- }
-
- public float getAlignment(int axis)
- {
- return 0;
- }
-
- public final Component getComponent()
- {
- return null;
- }
-
- public float getMaximumSpan(int axis)
- {
- return 0;
- }
-
- public float getMinimumSpan(int axis)
- {
- return 0;
- }
-
- public float getPreferredSpan(int axis)
- {
- return 0;
- }
-
- public Shape modelToView(int pos, Shape a, Position.Bias b)
- throws BadLocationException
- {
- return null;
- }
-
- public void paint(Graphics g, Shape a)
- {
- }
+ /**
+ * Creates a new instance of <code>ComponentView</code> for the specified
+ * <code>Element</code>.
+ *
+ * @param elem the element that this <code>View</code> is rendering
+ */
+ public ComponentView(Element elem)
+ {
+ super(elem);
+ }
+
+ /**
+ * Creates the <code>Component</code> that this <code>View</code> is
+ * rendering. The <code>Component</code> is determined using
+ * the {@link StyleConstants#ComponentAttribute} of the associated
+ * <code>Element</code>.
+ *
+ * @return the component that is rendered
+ */
+ protected Component createComponent()
+ {
+ return StyleConstants.getComponent(getElement().getAttributes());
+ }
+
+ /**
+ * Returns the alignment of this <code>View</code> along the specified axis.
+ *
+ * @param axis either {@link View#X_AXIS} or {@link View#Y_AXIS}
+ *
+ * @return the alignment of this <code>View</code> along the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the <code>Component</code> that is rendered by this
+ * <code>ComponentView</code>.
+ *
+ * @return the <code>Component</code> that is rendered by this
+ * <code>ComponentView</code>
+ */
+ public final Component getComponent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the maximum span of this <code>View</code> along the specified
+ * axis.
+ *
+ * This will return {@link Component#getMaximumSize()} for the specified
+ * axis.
+ *
+ * @return the maximum span of this <code>View</code> along the specified
+ * axis
+ */
+ public float getMaximumSpan(int axis)
+ {
+ return 0;
+ }
+
+ public float getMinimumSpan(int axis)
+ {
+ // TODO: Implement this properly.
+ return 0;
+ }
+
+ public float getPreferredSpan(int axis)
+ {
+ // TODO: Implement this properly.
+ return 0;
+ }
+
+ public Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ return null;
+ }
- public void setParent(View p)
- {
- }
+ public void paint(Graphics g, Shape a)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void setParent(View p)
+ {
+ // TODO: Implement this properly.
+ }
- public void setSize(float width, float height)
- {
- }
+ public void setSize(float width, float height)
+ {
+ // TODO: Implement this properly.
+ }
- public int viewToModel(float x, float y, Shape a, Position.Bias[] bias)
- {
- return 0;
- }
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] bias)
+ {
+ // TODO: Implement this properly.
+ return 0;
+ }
/**
* Maps coordinates from the <code>View</code>'s space into a position
@@ -118,4 +178,34 @@ public class ComponentView extends View
// FIXME: Implement this properly.
return 0;
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
}
diff --git a/libjava/classpath/javax/swing/text/CompositeView.java b/libjava/classpath/javax/swing/text/CompositeView.java
index 6776c95727a..bc626a40696 100644
--- a/libjava/classpath/javax/swing/text/CompositeView.java
+++ b/libjava/classpath/javax/swing/text/CompositeView.java
@@ -62,7 +62,7 @@ public abstract class CompositeView
/**
* The allocation of this <code>View</code> minus its insets. This is
* initialized in {@link #getInsideAllocation} and reused and modified in
- * {@link childAllocation}.
+ * {@link #childAllocation(int, Rectangle)}.
*/
Rectangle insideAllocation;
@@ -221,20 +221,17 @@ public abstract class CompositeView
if (childIndex != -1)
{
View child = getView(childIndex);
- Shape result = child.modelToView(pos, a, bias);
+ Rectangle r = a.getBounds();
+ childAllocation(childIndex, r);
+ Shape result = child.modelToView(pos, r, bias);
if (result == null)
throw new AssertionError("" + child.getClass().getName()
+ ".modelToView() must not return null");
return result;
}
else
- {
- // FIXME: Handle the case when we have no child view for the given
- // position.
- throw new AssertionError("No child views found where child views are "
- + "expected. pos = " + pos + ", bias = "
- + bias);
- }
+ throw new BadLocationException("No child view for the specified location",
+ pos);
}
/**
@@ -314,6 +311,7 @@ public abstract class CompositeView
*/
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
+ throws BadLocationException
{
int retVal = -1;
switch (direction)
@@ -433,10 +431,16 @@ public abstract class CompositeView
*/
protected int getViewIndexAtPosition(int pos)
{
- // We have one child view allocated for each child element in
- // loadChildren(), so this should work.
- Element el = getElement();
- int index = el.getElementIndex(pos);
+ int index = -1;
+ for (int i = 0; i < children.length; i++)
+ {
+ if (children[i].getStartOffset() <= pos
+ && children[i].getEndOffset() > pos)
+ {
+ index = i;
+ break;
+ }
+ }
return index;
}
@@ -473,8 +477,8 @@ public abstract class CompositeView
insideAllocation = inside;
}
}
- inside.x = alloc.x - insets.left;
- inside.y = alloc.y - insets.top;
+ inside.x = alloc.x + insets.left;
+ inside.y = alloc.y + insets.top;
inside.width = alloc.width - insets.left - insets.right;
inside.height = alloc.height - insets.top - insets.bottom;
return inside;
@@ -594,6 +598,7 @@ public abstract class CompositeView
protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
@@ -627,6 +632,7 @@ public abstract class CompositeView
protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
@@ -649,4 +655,34 @@ public abstract class CompositeView
{
return false;
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
}
diff --git a/libjava/classpath/javax/swing/text/DefaultCaret.java b/libjava/classpath/javax/swing/text/DefaultCaret.java
index 33c3ae3bf28..66e2f4723cf 100644
--- a/libjava/classpath/javax/swing/text/DefaultCaret.java
+++ b/libjava/classpath/javax/swing/text/DefaultCaret.java
@@ -40,15 +40,24 @@ package javax.swing.text;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.EventListener;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
import javax.swing.event.EventListenerList;
/**
@@ -60,12 +69,164 @@ import javax.swing.event.EventListenerList;
public class DefaultCaret extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener
{
+
+ /**
+ * Controls the blinking of the caret.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+ private class BlinkTimerListener implements ActionListener
+ {
+ /**
+ * Forces the next event to be ignored. The next event should be ignored
+ * if we force the caret to appear. We do not know how long will it take
+ * to fire the comming event; this may be near immediately. Better to leave
+ * the caret visible one iteration longer.
+ */
+ boolean ignoreNextEvent;
+
+ /**
+ * Receives notification when the blink timer fires and updates the visible
+ * state of the caret.
+ *
+ * @param event the action event
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ if (ignoreNextEvent)
+ ignoreNextEvent = false;
+ else
+ {
+ visible = !visible;
+ repaint();
+ }
+ }
+ }
+
+ /**
+ * Listens for changes in the text component's document and updates the
+ * caret accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class DocumentHandler implements DocumentListener
+ {
+ /**
+ * Receives notification that some text attributes have changed. No action
+ * is taken here.
+ *
+ * @param event the document event
+ */
+ public void changedUpdate(DocumentEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Receives notification that some text has been inserted from the text
+ * component. The caret is moved forward accordingly.
+ *
+ * @param event the document event
+ */
+ public void insertUpdate(DocumentEvent event)
+ {
+ if (policy == ALWAYS_UPDATE ||
+ (SwingUtilities.isEventDispatchThread() &&
+ policy == UPDATE_WHEN_ON_EDT))
+ {
+ int dot = getDot();
+ setDot(dot + event.getLength());
+ }
+ }
+
+ /**
+ * Receives notification that some text has been removed into the text
+ * component. The caret is moved backwards accordingly.
+ *
+ * @param event the document event
+ */
+ public void removeUpdate(DocumentEvent event)
+ {
+ if (policy == ALWAYS_UPDATE ||
+ (SwingUtilities.isEventDispatchThread() &&
+ policy == UPDATE_WHEN_ON_EDT))
+ {
+ int dot = getDot();
+ setDot(dot - event.getLength());
+ }
+ else if (policy == NEVER_UPDATE)
+ {
+ int docLength = event.getDocument().getLength();
+ if (getDot() > docLength)
+ setDot(docLength);
+ }
+ }
+ }
+
+ /**
+ * Listens for property changes on the text document. This is used to add and
+ * remove our document listener, if the document of the text component has
+ * changed.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class PropertyChangeHandler implements PropertyChangeListener
+ {
+
+ /**
+ * Receives notification when a property has changed on the text component.
+ * This adds/removes our document listener from the text component's
+ * document when the document changes.
+ *
+ * @param e the property change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals("document"))
+ {
+ Document oldDoc = (Document) e.getOldValue();
+ oldDoc.removeDocumentListener(documentListener);
+ Document newDoc = (Document) e.getNewValue();
+ newDoc.addDocumentListener(documentListener);
+ }
+ }
+
+ }
+
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4325555698756477346L;
+
/**
- * The serial version UID for DefaultCaret.
+ * Indicates the Caret position should always be updated after Document
+ * changes even if the updates are not performed on the Event Dispatching
+ * thread.
+ *
+ * @since 1.5
*/
- private static final long serialVersionUID = 228155774675466193L;
+ public static final int ALWAYS_UPDATE = 2;
/**
+ * Indicates the Caret position should not be changed unless the Document
+ * length becomes less than the Caret position, in which case the Caret
+ * is moved to the end of the Document.
+ *
+ * @since 1.5
+ */
+ public static final int NEVER_UPDATE = 1;
+
+ /**
+ * Indicates the Caret position should be updated only if Document changes
+ * are made on the Event Dispatcher thread.
+ *
+ * @since 1.5
+ */
+ public static final int UPDATE_WHEN_ON_EDT = 0;
+
+ /** Keeps track of the current update policy **/
+ int policy = UPDATE_WHEN_ON_EDT;
+
+ /**
* The <code>ChangeEvent</code> that is fired by {@link #fireStateChanged()}.
*/
protected ChangeEvent changeEvent = new ChangeEvent(this);
@@ -76,6 +237,16 @@ public class DefaultCaret extends Rectangle
protected EventListenerList listenerList = new EventListenerList();
/**
+ * Our document listener.
+ */
+ DocumentListener documentListener;
+
+ /**
+ * Our property listener.
+ */
+ PropertyChangeListener propertyChangeListener;
+
+ /**
* The text component in which this caret is installed.
*/
private JTextComponent textComponent;
@@ -106,15 +277,65 @@ public class DefaultCaret extends Rectangle
private Point magicCaretPosition = null;
/**
- * Indicates if this <code>Caret</code> is currently visible or not.
+ * Indicates if this <code>Caret</code> is currently visible or not. This is
+ * package private to avoid an accessor method.
*/
- private boolean visible = true;
+ boolean visible = false;
/**
* The current highlight entry.
*/
private Object highlightEntry;
+ private Timer blinkTimer;
+
+ private BlinkTimerListener blinkListener;
+
+ /**
+ * Creates a new <code>DefaultCaret</code> instance.
+ */
+ public DefaultCaret()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the Caret update policy.
+ *
+ * @param policy the new policy. Valid values are:
+ * ALWAYS_UPDATE: always update the Caret position, even when Document
+ * updates don't occur on the Event Dispatcher thread.
+ * NEVER_UPDATE: don't update the Caret position unless the Document
+ * length becomes less than the Caret position (then update the
+ * Caret to the end of the Document).
+ * UPDATE_WHEN_ON_EDT: update the Caret position when the
+ * Document updates occur on the Event Dispatcher thread. This is the
+ * default.
+ *
+ * @since 1.5
+ * @throws IllegalArgumentException if policy is not one of the above.
+ */
+ public void setUpdatePolicy (int policy)
+ {
+ if (policy != ALWAYS_UPDATE && policy != NEVER_UPDATE
+ && policy != UPDATE_WHEN_ON_EDT)
+ throw new
+ IllegalArgumentException
+ ("policy must be ALWAYS_UPDATE, NEVER__UPDATE, or UPDATE_WHEN_ON_EDT");
+ this.policy = policy;
+ }
+
+ /**
+ * Gets the caret update policy.
+ *
+ * @return the caret update policy.
+ * @since 1.5
+ */
+ public int getUpdatePolicy ()
+ {
+ return policy;
+ }
+
/**
* Moves the caret position when the mouse is dragged over the text
* component, modifying the selection accordingly.
@@ -123,7 +344,7 @@ public class DefaultCaret extends Rectangle
*/
public void mouseDragged(MouseEvent event)
{
- // FIXME: Implement this properly.
+ moveCaret(event);
}
/**
@@ -153,7 +374,7 @@ public class DefaultCaret extends Rectangle
*/
public void mouseClicked(MouseEvent event)
{
- // FIXME: Implement this properly.
+ // TODO: Implement double- and triple-click behaviour here.
}
/**
@@ -175,6 +396,7 @@ public class DefaultCaret extends Rectangle
*/
public void mouseExited(MouseEvent event)
{
+ // Nothing to do here.
}
/**
@@ -187,7 +409,7 @@ public class DefaultCaret extends Rectangle
*/
public void mousePressed(MouseEvent event)
{
- // FIXME: Implement this properly.
+ positionCaret(event);
}
/**
@@ -208,6 +430,7 @@ public class DefaultCaret extends Rectangle
*/
public void focusGained(FocusEvent event)
{
+ setVisible(true);
}
/**
@@ -217,6 +440,8 @@ public class DefaultCaret extends Rectangle
*/
public void focusLost(FocusEvent event)
{
+ if (event.isTemporary() == false)
+ setVisible(false);
}
/**
@@ -227,7 +452,8 @@ public class DefaultCaret extends Rectangle
*/
protected void moveCaret(MouseEvent event)
{
- // FIXME: Implement this properly.
+ int newDot = getComponent().viewToModel(event.getPoint());
+ moveDot(newDot);
}
/**
@@ -238,7 +464,8 @@ public class DefaultCaret extends Rectangle
*/
protected void positionCaret(MouseEvent event)
{
- // FIXME: Implement this properly.
+ int newDot = getComponent().viewToModel(event.getPoint());
+ setDot(newDot);
}
/**
@@ -253,7 +480,16 @@ public class DefaultCaret extends Rectangle
textComponent.removeFocusListener(this);
textComponent.removeMouseListener(this);
textComponent.removeMouseMotionListener(this);
+ textComponent.getDocument().removeDocumentListener(documentListener);
+ documentListener = null;
+ textComponent.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
textComponent = null;
+
+ // Deinstall blink timer if present.
+ if (blinkTimer != null)
+ blinkTimer.stop();
+ blinkTimer = null;
}
/**
@@ -269,6 +505,11 @@ public class DefaultCaret extends Rectangle
textComponent.addFocusListener(this);
textComponent.addMouseListener(this);
textComponent.addMouseMotionListener(this);
+ propertyChangeListener = new PropertyChangeHandler();
+ textComponent.addPropertyChangeListener(propertyChangeListener);
+ documentListener = new DocumentHandler();
+ textComponent.getDocument().addDocumentListener(documentListener);
+
repaint();
}
@@ -376,10 +617,7 @@ public class DefaultCaret extends Rectangle
*/
protected final void repaint()
{
- // FIXME: Is this good? This possibly causes alot of the component
- // hierarchy to be repainted on every caret blink.
- if (textComponent != null)
- textComponent.repaint();
+ getComponent().repaint(x, y, width, height);
}
/**
@@ -390,7 +628,8 @@ public class DefaultCaret extends Rectangle
*/
public void paint(Graphics g)
{
- if (textComponent == null)
+ JTextComponent comp = getComponent();
+ if (comp == null)
return;
int dot = getDot();
@@ -398,25 +637,33 @@ public class DefaultCaret extends Rectangle
try
{
- rect = textComponent.modelToView(dot);
+ rect = textComponent.modelToView(dot);
}
catch (BadLocationException e)
{
- // This should never happen as dot should be always valid.
- return;
+ assert false : "Unexpected bad caret location: " + dot;
+ return;
}
if (rect == null)
return;
-
- // First we need to delete the old caret.
- // FIXME: Implement deleting of old caret.
-
+
+ // Check if paint has possibly been called directly, without a previous
+ // call to damage(). In this case we need to do some cleanup first.
+ if ((x != rect.x) || (y != rect.y))
+ {
+ repaint(); // Erase previous location of caret.
+ x = rect.x;
+ y = rect.y;
+ width = 1;
+ height = rect.height;
+ }
+
// Now draw the caret on the new position if visible.
if (visible)
{
- g.setColor(textComponent.getCaretColor());
- g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height);
+ g.setColor(textComponent.getCaretColor());
+ g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height);
}
}
@@ -507,6 +754,8 @@ public class DefaultCaret extends Rectangle
*/
public void setBlinkRate(int rate)
{
+ if (blinkTimer != null)
+ blinkTimer.setDelay(rate);
blinkRate = rate;
}
@@ -534,7 +783,8 @@ public class DefaultCaret extends Rectangle
{
this.dot = dot;
handleHighlight();
- repaint();
+ adjustVisibility(this);
+ appear();
}
/**
@@ -551,8 +801,45 @@ public class DefaultCaret extends Rectangle
this.dot = dot;
this.mark = dot;
handleHighlight();
- repaint();
+ adjustVisibility(this);
+ appear();
}
+
+ /**
+ * Show the caret (may be hidden due blinking) and adjust the timer not to
+ * hide it (possibly immediately).
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+ void appear()
+ {
+ // All machinery is only required if the carret is blinking.
+ if (blinkListener != null)
+ {
+ blinkListener.ignoreNextEvent = true;
+
+ // If the caret is visible, erase the current position by repainting
+ // over.
+ if (visible)
+ repaint();
+
+ // Draw the caret in the new position.
+ visible = true;
+
+ Rectangle area = null;
+ try
+ {
+ area = getComponent().modelToView(getDot());
+ }
+ catch (BadLocationException ex)
+ {
+ assert false : "Unexpected bad caret location: " + getDot();
+ }
+ if (area != null)
+ damage(area);
+ }
+ repaint();
+ }
/**
* Returns <code>true</code> if this <code>Caret</code> is currently visible,
@@ -574,8 +861,33 @@ public class DefaultCaret extends Rectangle
*/
public void setVisible(boolean v)
{
- visible = v;
- repaint();
+ if (v != visible)
+ {
+ visible = v;
+ if (visible)
+ if (textComponent.isEnabled() && textComponent.isEditable())
+ {
+ if (blinkTimer == null)
+ initBlinkTimer();
+ blinkTimer.start();
+ }
+ else
+ {
+ if (blinkTimer != null)
+ blinkTimer.stop();
+ }
+ Rectangle area = null;
+ try
+ {
+ area = getComponent().modelToView(getDot());
+ }
+ catch (BadLocationException ex)
+ {
+ assert false: "Unexpected bad caret location: " + getDot();
+ }
+ if (area != null)
+ damage(area);
+ }
}
/**
@@ -589,4 +901,47 @@ public class DefaultCaret extends Rectangle
{
return DefaultHighlighter.DefaultPainter;
}
+
+ /**
+ * Updates the carets rectangle properties to the specified rectangle and
+ * repaints the caret.
+ *
+ * @param r the rectangle to set as the caret rectangle
+ */
+ protected void damage(Rectangle r)
+ {
+ if (r == null)
+ return;
+ x = r.x;
+ y = r.y;
+ width = 1;
+ // height is normally set in paint and we leave it untouched. However, we
+ // 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();
+ repaint();
+ }
+
+ /**
+ * Adjusts the text component so that the caret is visible. This default
+ * implementation simply calls
+ * {@link JComponent#scrollRectToVisible(Rectangle)} on the text component.
+ * Subclasses may wish to change this.
+ */
+ protected void adjustVisibility(Rectangle rect)
+ {
+ getComponent().scrollRectToVisible(rect);
+ }
+
+ /**
+ * Initializes the blink timer.
+ */
+ private void initBlinkTimer()
+ {
+ // Setup the blink timer.
+ blinkListener = new BlinkTimerListener();
+ blinkTimer = new Timer(getBlinkRate(), blinkListener);
+ blinkTimer.setRepeats(true);
+ }
}
diff --git a/libjava/classpath/javax/swing/text/DefaultEditorKit.java b/libjava/classpath/javax/swing/text/DefaultEditorKit.java
index a14f3ff4fe0..3b3fc1f7238 100644
--- a/libjava/classpath/javax/swing/text/DefaultEditorKit.java
+++ b/libjava/classpath/javax/swing/text/DefaultEditorKit.java
@@ -66,8 +66,7 @@ public class DefaultEditorKit extends EditorKit
*
* @see Toolkit#beep()
*/
- public static class BeepAction
- extends TextAction
+ public static class BeepAction extends TextAction
{
/**
* Creates a new <code>BeepAction</code>.
@@ -95,8 +94,7 @@ public class DefaultEditorKit extends EditorKit
* @see CutAction
* @see PasteAction
*/
- public static class CopyAction
- extends TextAction
+ public static class CopyAction extends TextAction
{
/**
@@ -128,8 +126,7 @@ public class DefaultEditorKit extends EditorKit
* @see CopyAction
* @see PasteAction
*/
- public static class CutAction
- extends TextAction
+ public static class CutAction extends TextAction
{
/**
@@ -159,8 +156,7 @@ public class DefaultEditorKit extends EditorKit
* @see CopyAction
* @see CutAction
*/
- public static class PasteAction
- extends TextAction
+ public static class PasteAction extends TextAction
{
/**
@@ -226,9 +222,6 @@ public class DefaultEditorKit extends EditorKit
{
t.getDocument().insertString(t.getCaret().getDot(),
event.getActionCommand(), null);
- t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
- t.getDocument().getEndPosition()
- .getOffset()));
}
catch (BadLocationException be)
{
@@ -243,8 +236,7 @@ public class DefaultEditorKit extends EditorKit
* of the text component. This is typically triggered by hitting
* ENTER on the keyboard.
*/
- public static class InsertBreakAction
- extends TextAction
+ public static class InsertBreakAction extends TextAction
{
/**
@@ -273,8 +265,7 @@ public class DefaultEditorKit extends EditorKit
*/
// FIXME: Figure out what this Action is supposed to do. Obviously text
// that is entered by the user is inserted through DefaultKeyTypedAction.
- public static class InsertContentAction
- extends TextAction
+ public static class InsertContentAction extends TextAction
{
/**
@@ -292,14 +283,15 @@ public class DefaultEditorKit extends EditorKit
*/
public void actionPerformed(ActionEvent event)
{
+ // FIXME: Figure out what this Action is supposed to do. Obviously text
+ // that is entered by the user is inserted through DefaultKeyTypedAction.
}
}
/**
* Inserts a TAB character into the text editor.
*/
- public static class InsertTabAction
- extends TextAction
+ public static class InsertTabAction extends TextAction
{
/**
@@ -699,6 +691,7 @@ public class DefaultEditorKit extends EditorKit
*/
public DefaultEditorKit()
{
+ // Nothing to do here.
}
/**
@@ -954,15 +947,23 @@ public class DefaultEditorKit extends EditorKit
* @param offset the beginning offset from where to write
* @param len the length of the fragment to write
*
- * @throws BadLocationException if <code>offset</code> or
- * <code>offset + len</code>is an invalid location inside
- * <code>document</code>
+ * @throws BadLocationException if <code>offset</code> is an
+ * invalid location inside <code>document</code>.
* @throws IOException if something goes wrong while writing to
* <code>out</code>
*/
public void write(Writer out, Document document, int offset, int len)
- throws BadLocationException, IOException
+ throws BadLocationException, IOException
{
- // TODO: Implement this properly.
+ // Throw a BLE if offset is invalid
+ if (offset < 0 || offset > document.getLength())
+ throw new BadLocationException("Tried to write to invalid location",
+ offset);
+
+ // If they gave an overly large len, just adjust it
+ if (offset + len > document.getLength())
+ len = document.getLength() - offset;
+
+ out.write(document.getText(offset, len));
}
}
diff --git a/libjava/classpath/javax/swing/text/DefaultFormatter.java b/libjava/classpath/javax/swing/text/DefaultFormatter.java
index c97d90703c7..f9e0f10e654 100644
--- a/libjava/classpath/javax/swing/text/DefaultFormatter.java
+++ b/libjava/classpath/javax/swing/text/DefaultFormatter.java
@@ -57,8 +57,7 @@ import javax.swing.JFormattedTextField;
*
* @author Roman Kennke (roman@kennke.org)
*/
-public class DefaultFormatter
- extends JFormattedTextField.AbstractFormatter
+public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
implements Cloneable, Serializable
{
@@ -156,9 +155,6 @@ public class DefaultFormatter
* Checks if the value in the input field is valid. If the
* property allowsInvalid is set to <code>false</code>, then
* the string in the input field is not allowed to be entered.
- *
- * @param doc the document of the input field
- * @param value the current (old) value of the input field
*/
private void checkValidInput()
{
@@ -179,15 +175,18 @@ public class DefaultFormatter
catch (ParseException pe)
{
// if that happens, something serious must be wrong
- throw new AssertionError("values must be parseable");
+ AssertionError ae;
+ ae = new AssertionError("values must be parseable");
+ ae.initCause(pe);
+ throw ae;
}
}
}
}
}
- /** The serialVersoinUID. */
- private static final long serialVersionUID = -7369196326612908900L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -355018354457785329L;
/**
* Indicates if the value should be committed after every
diff --git a/libjava/classpath/javax/swing/text/DefaultHighlighter.java b/libjava/classpath/javax/swing/text/DefaultHighlighter.java
index c8d874caa51..40ea4f80aab 100644
--- a/libjava/classpath/javax/swing/text/DefaultHighlighter.java
+++ b/libjava/classpath/javax/swing/text/DefaultHighlighter.java
@@ -168,6 +168,7 @@ public class DefaultHighlighter extends LayeredHighlighter
public DefaultHighlighter()
{
+ // Nothing to do here.
}
public boolean getDrawsLayeredHighlights()
@@ -238,6 +239,7 @@ public class DefaultHighlighter extends LayeredHighlighter
Shape viewBounds, JTextComponent editor,
View view)
{
+ // TODO: Implement this properly.
}
public void paint(Graphics g)
diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
index 3545e52c453..eb56bb0f8e5 100644
--- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
+++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
@@ -1,5 +1,5 @@
/* DefaultStyledDocument.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,8 +41,14 @@ package javax.swing.text;
import java.awt.Color;
import java.awt.Font;
import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
+import javax.swing.undo.AbstractUndoableEdit;
+import javax.swing.undo.UndoableEdit;
/**
* The default implementation of {@link StyledDocument}.
@@ -60,12 +66,359 @@ public class DefaultStyledDocument extends AbstractDocument
implements StyledDocument
{
/**
+ * An {@link UndoableEdit} that can undo attribute changes to an element.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public static class AttributeUndoableEdit
+ extends AbstractUndoableEdit
+ {
+ /**
+ * A copy of the old attributes.
+ */
+ protected AttributeSet copy;
+
+ /**
+ * The new attributes.
+ */
+ protected AttributeSet newAttributes;
+
+ /**
+ * If the new attributes replaced the old attributes or if they only were
+ * added to them.
+ */
+ protected boolean isReplacing;
+
+ /**
+ * The element that has changed.
+ */
+ protected Element element;
+
+ /**
+ * Creates a new <code>AttributeUndoableEdit</code>.
+ *
+ * @param el the element that changes attributes
+ * @param newAtts the new attributes
+ * @param replacing if the new attributes replace the old or only append to
+ * them
+ */
+ public AttributeUndoableEdit(Element el, AttributeSet newAtts,
+ boolean replacing)
+ {
+ element = el;
+ newAttributes = newAtts;
+ isReplacing = replacing;
+ copy = el.getAttributes().copyAttributes();
+ }
+
+ /**
+ * Undos the attribute change. The <code>copy</code> field is set as
+ * attributes on <code>element</code>.
+ */
+ public void undo()
+ {
+ super.undo();
+ AttributeSet atts = element.getAttributes();
+ if (atts instanceof MutableAttributeSet)
+ {
+ MutableAttributeSet mutable = (MutableAttributeSet) atts;
+ mutable.removeAttributes(atts);
+ mutable.addAttributes(copy);
+ }
+ }
+
+ /**
+ * Redos an attribute change. This adds <code>newAttributes</code> to the
+ * <code>element</code>'s attribute set, possibly clearing all attributes
+ * if <code>isReplacing</code> is true.
+ */
+ public void redo()
+ {
+ super.undo();
+ AttributeSet atts = element.getAttributes();
+ if (atts instanceof MutableAttributeSet)
+ {
+ MutableAttributeSet mutable = (MutableAttributeSet) atts;
+ if (isReplacing)
+ mutable.removeAttributes(atts);
+ mutable.addAttributes(newAttributes);
+ }
+ }
+ }
+
+ /**
+ * Carries specification information for new {@link Element}s that should
+ * be created in {@link ElementBuffer}. This allows the parsing process
+ * to be decoupled from the <code>Element</code> creation process.
+ */
+ public static class ElementSpec
+ {
+ /**
+ * This indicates a start tag. This is a possible value for
+ * {@link #getType}.
+ */
+ public static final short StartTagType = 1;
+
+ /**
+ * This indicates an end tag. This is a possible value for
+ * {@link #getType}.
+ */
+ public static final short EndTagType = 2;
+
+ /**
+ * This indicates a content element. This is a possible value for
+ * {@link #getType}.
+ */
+ public static final short ContentType = 3;
+
+ /**
+ * This indicates that the data associated with this spec should be joined
+ * with what precedes it. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short JoinPreviousDirection = 4;
+
+ /**
+ * This indicates that the data associated with this spec should be joined
+ * with what follows it. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short JoinNextDirection = 5;
+
+ /**
+ * This indicates that the data associated with this spec should be used
+ * to create a new element. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short OriginateDirection = 6;
+
+ /**
+ * This indicates that the data associated with this spec should be joined
+ * to the fractured element. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short JoinFractureDirection = 7;
+
+ /**
+ * The type of the tag.
+ */
+ short type;
+
+ /**
+ * The direction of the tag.
+ */
+ short direction;
+
+ /**
+ * The offset of the content.
+ */
+ int offset;
+
+ /**
+ * The length of the content.
+ */
+ int length;
+
+ /**
+ * The actual content.
+ */
+ char[] content;
+
+ /**
+ * The attributes for the tag.
+ */
+ AttributeSet attributes;
+
+ /**
+ * Creates a new <code>ElementSpec</code> with no content, length or
+ * offset. This is most useful for start and end tags.
+ *
+ * @param a the attributes for the element to be created
+ * @param type the type of the tag
+ */
+ public ElementSpec(AttributeSet a, short type)
+ {
+ this(a, type, 0);
+ }
+
+ /**
+ * Creates a new <code>ElementSpec</code> that specifies the length but
+ * not the offset of an element. Such <code>ElementSpec</code>s are
+ * processed sequentially from a known starting point.
+ *
+ * @param a the attributes for the element to be created
+ * @param type the type of the tag
+ * @param len the length of the element
+ */
+ public ElementSpec(AttributeSet a, short type, int len)
+ {
+ this(a, type, null, 0, len);
+ }
+
+ /**
+ * Creates a new <code>ElementSpec</code> with document content.
+ *
+ * @param a the attributes for the element to be created
+ * @param type the type of the tag
+ * @param txt the actual content
+ * @param offs the offset into the <code>txt</code> array
+ * @param len the length of the element
+ */
+ public ElementSpec(AttributeSet a, short type, char[] txt, int offs,
+ int len)
+ {
+ attributes = a;
+ this.type = type;
+ offset = offs;
+ length = len;
+ content = txt;
+ direction = OriginateDirection;
+ }
+
+ /**
+ * Sets the type of the element.
+ *
+ * @param type the type of the element to be set
+ */
+ public void setType(short type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Returns the type of the element.
+ *
+ * @return the type of the element
+ */
+ public short getType()
+ {
+ return type;
+ }
+
+ /**
+ * Sets the direction of the element.
+ *
+ * @param dir the direction of the element to be set
+ */
+ public void setDirection(short dir)
+ {
+ direction = dir;
+ }
+
+ /**
+ * Returns the direction of the element.
+ *
+ * @return the direction of the element
+ */
+ public short getDirection()
+ {
+ return direction;
+ }
+
+ /**
+ * Returns the attributes of the element.
+ *
+ * @return the attributes of the element
+ */
+ public AttributeSet getAttributes()
+ {
+ return attributes;
+ }
+
+ /**
+ * Returns the actual content of the element.
+ *
+ * @return the actual content of the element
+ */
+ public char[] getArray()
+ {
+ return content;
+ }
+
+ /**
+ * Returns the offset of the content.
+ *
+ * @return the offset of the content
+ */
+ public int getOffset()
+ {
+ return offset;
+ }
+
+ /**
+ * Returns the length of the content.
+ *
+ * @return the length of the content
+ */
+ public int getLength()
+ {
+ return length;
+ }
+
+ /**
+ * Returns a String representation of this <code>ElementSpec</code>
+ * describing the type, direction and length of this
+ * <code>ElementSpec</code>.
+ *
+ * @return a String representation of this <code>ElementSpec</code>
+ */
+ public String toString()
+ {
+ StringBuilder b = new StringBuilder();
+ b.append('<');
+ switch (type)
+ {
+ case StartTagType:
+ b.append("StartTag");
+ break;
+ case EndTagType:
+ b.append("EndTag");
+ break;
+ case ContentType:
+ b.append("Content");
+ break;
+ default:
+ b.append("??");
+ break;
+ }
+
+ b.append(':');
+
+ switch (direction)
+ {
+ case JoinPreviousDirection:
+ b.append("JoinPrevious");
+ break;
+ case JoinNextDirection:
+ b.append("JoinNext");
+ break;
+ case OriginateDirection:
+ b.append("Originate");
+ break;
+ case JoinFractureDirection:
+ b.append("Fracture");
+ break;
+ default:
+ b.append("??");
+ break;
+ }
+
+ b.append(':');
+ b.append(length);
+
+ return b.toString();
+ }
+ }
+
+ /**
* Performs all <em>structural</code> changes to the <code>Element</code>
* hierarchy.
*/
- public class ElementBuffer
- implements Serializable
+ public class ElementBuffer implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 1688745877691146623L;
+
/** The root element of the hierarchy. */
private Element root;
@@ -76,6 +429,19 @@ public class DefaultStyledDocument extends AbstractDocument
private int length;
/**
+ * Holds fractured elements during insertion of end and start tags.
+ * Inserting an end tag may lead to fracturing of the current paragraph
+ * element. The elements that have been cut off may be added to the
+ * next paragraph that is created in the next start tag.
+ */
+ Element[] fracture;
+
+ /**
+ * The ElementChange that describes the latest changes.
+ */
+ DefaultDocumentEvent documentEvent;
+
+ /**
* Creates a new <code>ElementBuffer</code> for the specified
* <code>root</code> element.
*
@@ -114,6 +480,7 @@ public class DefaultStyledDocument extends AbstractDocument
{
this.offset = offset;
this.length = length;
+ documentEvent = ev;
changeUpdate();
}
@@ -142,38 +509,352 @@ public class DefaultStyledDocument extends AbstractDocument
void split(Element el, int offset)
{
if (el instanceof AbstractElement)
- {
- AbstractElement ael = (AbstractElement) el;
- int startOffset = ael.getStartOffset();
- int endOffset = ael.getEndOffset();
- int len = endOffset - startOffset;
- if (startOffset != offset && endOffset != offset)
- {
- Element paragraph = ael.getParentElement();
- if (paragraph instanceof BranchElement)
- {
- BranchElement par = (BranchElement) paragraph;
- Element child1 = createLeafElement(par, ael, startOffset,
- offset);
- Element child2 = createLeafElement(par, ael, offset,
- endOffset);
- int index = par.getElementIndex(startOffset);
- par.replace(index, 1, new Element[]{ child1, child2 });
- }
+ {
+ AbstractElement ael = (AbstractElement) el;
+ int startOffset = ael.getStartOffset();
+ int endOffset = ael.getEndOffset();
+ int len = endOffset - startOffset;
+ if (startOffset != offset && endOffset != offset)
+ {
+ Element paragraph = ael.getParentElement();
+ if (paragraph instanceof BranchElement)
+ {
+ BranchElement par = (BranchElement) paragraph;
+ Element child1 = createLeafElement(par, ael, startOffset,
+ offset);
+ Element child2 = createLeafElement(par, ael, offset,
+ endOffset);
+ int index = par.getElementIndex(startOffset);
+ Element[] add = new Element[]{ child1, child2 };
+ par.replace(index, 1, add);
+ documentEvent.addEdit(new ElementEdit(par, index,
+ new Element[]{ el },
+ add));
+ }
else
throw new AssertionError("paragraph elements are expected to "
+ "be instances of "
+ "javax.swing.text.AbstractDocument.BranchElement");
- }
- }
+ }
+ }
else
- throw new AssertionError("content elements are expected to be "
- + "instances of "
+ throw new AssertionError("content elements are expected to be "
+ + "instances of "
+ "javax.swing.text.AbstractDocument.AbstractElement");
}
+
+ /**
+ * Inserts new <code>Element</code> in the document at the specified
+ * position.
+ *
+ * Most of the work is done by {@link #insertUpdate}, after some fields
+ * have been prepared for it.
+ *
+ * @param offset the location in the document at which the content is
+ * inserted
+ * @param length the length of the inserted content
+ * @param data the element specifications for the content to be inserted
+ * @param ev the document event that is updated to reflect the structural
+ * changes
+ */
+ public void insert(int offset, int length, ElementSpec[] data,
+ DefaultDocumentEvent ev)
+ {
+ this.offset = offset;
+ this.length = length;
+ documentEvent = ev;
+ insertUpdate(data);
+ }
+
+ /**
+ * Performs the actual structural change for {@link #insert}. This
+ * creates a bunch of {@link Element}s as specified by <code>data</code>
+ * and inserts it into the document as specified in the arguments to
+ * {@link #insert}.
+ *
+ * @param data the element specifications for the elements to be inserte
+ */
+ protected void insertUpdate(ElementSpec[] data)
+ {
+ for (int i = 0; i < data.length; i++)
+ {
+ switch (data[i].getType())
+ {
+ case ElementSpec.StartTagType:
+ insertStartTag(data[i]);
+ break;
+ case ElementSpec.EndTagType:
+ insertEndTag(data[i]);
+ break;
+ default:
+ insertContentTag(data[i]);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Insert a new paragraph after the paragraph at the current position.
+ *
+ * @param tag the element spec that describes the element to be inserted
+ */
+ void insertStartTag(ElementSpec tag)
+ {
+ BranchElement root = (BranchElement) getDefaultRootElement();
+ int index = root.getElementIndex(offset);
+ if (index == -1)
+ index = 0;
+
+ BranchElement newParagraph =
+ (BranchElement) createBranchElement(root, tag.getAttributes());
+ newParagraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
+
+ // Add new paragraph into document structure.
+ Element[] added = new Element[]{newParagraph};
+ root.replace(index + 1, 0, added);
+ ElementEdit edit = new ElementEdit(root, index + 1, new Element[0],
+ added);
+ documentEvent.addEdit(edit);
+
+ // Maybe add fractured elements.
+ if (tag.getDirection() == ElementSpec.JoinFractureDirection)
+ {
+ Element[] newFracture = new Element[fracture.length];
+ for (int i = 0; i < fracture.length; i++)
+ {
+ Element oldLeaf = fracture[i];
+ Element newLeaf = createLeafElement(newParagraph,
+ oldLeaf.getAttributes(),
+ oldLeaf.getStartOffset(),
+ oldLeaf.getEndOffset());
+ newFracture[i] = newLeaf;
+ }
+ newParagraph.replace(0, 0, newFracture);
+ edit = new ElementEdit(newParagraph, 0, new Element[0],
+ fracture);
+ documentEvent.addEdit(edit);
+ fracture = new Element[0];
+ }
+ }
+
+ /**
+ * Inserts an end tag into the document structure. This cuts of the
+ * current paragraph element, possibly fracturing it's child elements.
+ * The fractured elements are saved so that they can be joined later
+ * with a new paragraph element.
+ */
+ void insertEndTag(ElementSpec tag)
+ {
+ BranchElement root = (BranchElement) getDefaultRootElement();
+ int parIndex = root.getElementIndex(offset);
+ BranchElement paragraph = (BranchElement) root.getElement(parIndex);
+
+ int index = paragraph.getElementIndex(offset);
+ LeafElement content = (LeafElement) paragraph.getElement(index);
+ // We might have to split the element at offset.
+ split(content, offset);
+ index = paragraph.getElementIndex(offset);
+
+ int count = paragraph.getElementCount();
+ // Store fractured elements.
+ fracture = new Element[count - index];
+ for (int i = index; i < count; ++i)
+ fracture[i - index] = paragraph.getElement(i);
+
+ // Delete fractured elements.
+ paragraph.replace(index, count - index, new Element[0]);
+
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(paragraph, index, fracture,
+ new Element[0]);
+ documentEvent.addEdit(edit);
+ }
+
+ /**
+ * Inserts a content element into the document structure.
+ *
+ * @param tag the element spec
+ */
+ void insertContentTag(ElementSpec tag)
+ {
+ int len = tag.getLength();
+ int dir = tag.getDirection();
+ if (dir == ElementSpec.JoinPreviousDirection)
+ {
+ Element prev = getCharacterElement(offset);
+ BranchElement prevParent = (BranchElement) prev.getParentElement();
+ Element join = createLeafElement(prevParent, tag.getAttributes(),
+ prev.getStartOffset(),
+ Math.max(prev.getEndOffset(),
+ offset + len));
+ int ind = prevParent.getElementIndex(offset);
+ if (ind == -1)
+ ind = 0;
+ Element[] add = new Element[]{join};
+ prevParent.replace(ind, 1, add);
+
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(prevParent, ind,
+ new Element[]{prev}, add);
+ documentEvent.addEdit(edit);
+ }
+ else if (dir == ElementSpec.JoinNextDirection)
+ {
+ Element next = getCharacterElement(offset + len);
+ BranchElement nextParent = (BranchElement) next.getParentElement();
+ Element join = createLeafElement(nextParent, tag.getAttributes(),
+ offset,
+ next.getEndOffset());
+ int ind = nextParent.getElementIndex(offset + len);
+ if (ind == -1)
+ ind = 0;
+ Element[] add = new Element[]{join};
+ nextParent.replace(ind, 1, add);
+
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(nextParent, ind,
+ new Element[]{next}, add);
+ documentEvent.addEdit(edit);
+ }
+ else
+ {
+ BranchElement par = (BranchElement) getParagraphElement(offset);
+
+ int ind = par.getElementIndex(offset);
+
+ // Make room for the element.
+ // Cut previous element.
+ Element prev = par.getElement(ind);
+ if (prev != null && prev.getStartOffset() < offset)
+ {
+ Element cutPrev = createLeafElement(par, prev.getAttributes(),
+ prev.getStartOffset(),
+ offset);
+ Element[] remove = new Element[]{prev};
+ Element[] add = new Element[]{cutPrev};
+ if (prev.getEndOffset() > offset + len)
+ {
+ Element rem = createLeafElement(par, prev.getAttributes(),
+ offset + len,
+ prev.getEndOffset());
+ add = new Element[]{cutPrev, rem};
+ }
+
+ par.replace(ind, 1, add);
+ documentEvent.addEdit(new ElementEdit(par, ind, remove, add));
+ ind++;
+ }
+ // ind now points to the next element.
+
+ // Cut next element if necessary.
+ Element next = par.getElement(ind);
+ if (next != null && next.getStartOffset() < offset + len)
+ {
+ Element cutNext = createLeafElement(par, next.getAttributes(),
+ offset + len,
+ next.getEndOffset());
+ Element[] remove = new Element[]{next};
+ Element[] add = new Element[]{cutNext};
+ par.replace(ind, 1, add);
+ documentEvent.addEdit(new ElementEdit(par, ind, remove,
+ add));
+ }
+
+ // Insert new element.
+ Element newEl = createLeafElement(par, tag.getAttributes(),
+ offset, offset + len);
+ Element[] added = new Element[]{newEl};
+ par.replace(ind, 0, added);
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(par, ind, new Element[0],
+ added);
+ documentEvent.addEdit(edit);
+ }
+ offset += len;
+ }
+
+ /**
+ * Creates a copy of the element <code>clonee</code> that has the parent
+ * <code>parent</code>.
+ * @param parent the parent of the newly created Element
+ * @param clonee the Element to clone
+ * @return the cloned Element
+ */
+ public Element clone (Element parent, Element clonee)
+ {
+ // If the Element we want to clone is a leaf, then simply copy it
+ if (clonee.isLeaf())
+ return createLeafElement(parent, clonee.getAttributes(),
+ clonee.getStartOffset(), clonee.getEndOffset());
+
+ // Otherwise create a new BranchElement with the desired parent and
+ // the clonee's attributes
+ BranchElement result = (BranchElement) createBranchElement(parent, clonee.getAttributes());
+
+ // And clone all the of clonee's children
+ Element[] children = new Element[clonee.getElementCount()];
+ for (int i = 0; i < children.length; i++)
+ children[i] = clone(result, clonee.getElement(i));
+
+ // Make the cloned children the children of the BranchElement
+ result.replace(0, 0, children);
+ return result;
+ }
}
/**
+ * An element type for sections. This is a simple BranchElement with
+ * a unique name.
+ */
+ protected class SectionElement extends BranchElement
+ {
+ /**
+ * Creates a new SectionElement.
+ */
+ public SectionElement()
+ {
+ super(null, null);
+ }
+
+ /**
+ * Returns the name of the element. This method always returns
+ * &quot;section&quot;.
+ *
+ * @return the name of the element
+ */
+ public String getName()
+ {
+ return "section";
+ }
+ }
+
+ /**
+ * Receives notification when any of the document's style changes and calls
+ * {@link DefaultStyledDocument#styleChanged(Style)}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class StyleChangeListener
+ implements ChangeListener
+ {
+
+ /**
+ * Receives notification when any of the document's style changes and calls
+ * {@link DefaultStyledDocument#styleChanged(Style)}.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ Style style = (Style) event.getSource();
+ styleChanged(style);
+ }
+ }
+
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 940485415728614849L;
+
+ /**
* The default size to use for new content buffers.
*/
public static final int BUFFER_SIZE_DEFAULT = 4096;
@@ -185,6 +866,11 @@ public class DefaultStyledDocument extends AbstractDocument
protected DefaultStyledDocument.ElementBuffer buffer;
/**
+ * Listens for changes on this document's styles and notifies styleChanged().
+ */
+ private StyleChangeListener styleChangeListener;
+
+ /**
* Creates a new <code>DefaultStyledDocument</code>.
*/
public DefaultStyledDocument()
@@ -237,7 +923,14 @@ public class DefaultStyledDocument extends AbstractDocument
public Style addStyle(String nm, Style parent)
{
StyleContext context = (StyleContext) getAttributeContext();
- return context.addStyle(nm, parent);
+ Style newStyle = context.addStyle(nm, parent);
+
+ // Register change listener.
+ if (styleChangeListener == null)
+ styleChangeListener = new StyleChangeListener();
+ newStyle.addChangeListener(styleChangeListener);
+
+ return newStyle;
}
/**
@@ -250,9 +943,11 @@ public class DefaultStyledDocument extends AbstractDocument
Element[] tmp;
// FIXME: Create a SecionElement here instead of a BranchElement.
// Use createBranchElement() and createLeafElement instead.
- BranchElement section = new BranchElement(null, null);
-
- BranchElement paragraph = new BranchElement(section, null);
+ SectionElement section = new SectionElement();
+
+ BranchElement paragraph =
+ (BranchElement) createBranchElement(section, null);
+ paragraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
tmp = new Element[1];
tmp[0] = paragraph;
section.replace(0, 0, tmp);
@@ -261,7 +956,7 @@ public class DefaultStyledDocument extends AbstractDocument
tmp = new Element[1];
tmp[0] = leaf;
paragraph.replace(0, 0, tmp);
-
+
return section;
}
@@ -279,10 +974,10 @@ public class DefaultStyledDocument extends AbstractDocument
{
Element element = getDefaultRootElement();
- while (! element.isLeaf())
+ while (!element.isLeaf())
{
- int index = element.getElementIndex(position);
- element = element.getElement(index);
+ int index = element.getElementIndex(position);
+ element = element.getElement(index);
}
return element;
@@ -353,6 +1048,10 @@ public class DefaultStyledDocument extends AbstractDocument
/**
* Returns the paragraph element for the specified position.
+ * If the position is outside the bounds of the document's root element,
+ * then the closest element is returned. That is the last paragraph if
+ * <code>position >= endIndex</code> or the first paragraph if
+ * <code>position < startIndex</code>.
*
* @param position the position for which to query the paragraph element
*
@@ -360,8 +1059,18 @@ public class DefaultStyledDocument extends AbstractDocument
*/
public Element getParagraphElement(int position)
{
- Element element = getCharacterElement(position);
- return element.getParentElement();
+ BranchElement root = (BranchElement) getDefaultRootElement();
+ int start = root.getStartOffset();
+ int end = root.getEndOffset();
+ if (position >= end)
+ position = end - 1;
+ else if (position < start)
+ position = start;
+
+ Element par = root.positionToElement(position);
+
+ assert par != null : "The paragraph element must not be null";
+ return par;
}
/**
@@ -416,35 +1125,37 @@ public class DefaultStyledDocument extends AbstractDocument
int paragraphCount = root.getElementCount();
for (int pindex = 0; pindex < paragraphCount; pindex++)
{
- Element paragraph = root.getElement(pindex);
- // Skip paragraphs that lie outside the interval.
- if ((paragraph.getStartOffset() > offset + length)
- || (paragraph.getEndOffset() < offset))
- continue;
-
- // Visit content elements within this paragraph
- int contentCount = paragraph.getElementCount();
- for (int cindex = 0; cindex < contentCount; cindex++)
- {
- Element content = paragraph.getElement(cindex);
- // Skip content that lies outside the interval.
- if ((content.getStartOffset() > offset + length)
- || (content.getEndOffset() < offset))
- continue;
-
- if (content instanceof AbstractElement)
- {
- AbstractElement el = (AbstractElement) content;
- if (replace)
- el.removeAttributes(el);
- el.addAttributes(attributes);
- }
- else
- throw new AssertionError("content elements are expected to be"
- + "instances of "
+ Element paragraph = root.getElement(pindex);
+ // Skip paragraphs that lie outside the interval.
+ if ((paragraph.getStartOffset() > offset + length)
+ || (paragraph.getEndOffset() < offset))
+ continue;
+
+ // Visit content elements within this paragraph
+ int contentCount = paragraph.getElementCount();
+ for (int cindex = 0; cindex < contentCount; cindex++)
+ {
+ Element content = paragraph.getElement(cindex);
+ // Skip content that lies outside the interval.
+ if ((content.getStartOffset() > offset + length)
+ || (content.getEndOffset() < offset))
+ continue;
+
+ if (content instanceof AbstractElement)
+ {
+ AbstractElement el = (AbstractElement) content;
+ if (replace)
+ el.removeAttributes(el);
+ el.addAttributes(attributes);
+ }
+ else
+ throw new AssertionError("content elements are expected to be"
+ + "instances of "
+ "javax.swing.text.AbstractDocument.AbstractElement");
- }
+ }
}
+
+ fireChangedUpdate(ev);
}
/**
@@ -476,10 +1187,199 @@ public class DefaultStyledDocument extends AbstractDocument
* selection are overridden, otherwise they are merged
*/
public void setParagraphAttributes(int offset, int length,
- AttributeSet attributes,
- boolean replace)
+ AttributeSet attributes,
+ boolean replace)
+ {
+ int index = offset;
+ while (index < offset + length)
+ {
+ AbstractElement par = (AbstractElement) getParagraphElement(index);
+ AttributeContext ctx = getAttributeContext();
+ if (replace)
+ par.removeAttributes(par);
+ par.addAttributes(attributes);
+ index = par.getElementCount();
+ }
+ }
+
+ /**
+ * Called in response to content insert actions. This is used to
+ * update the element structure.
+ *
+ * @param ev the <code>DocumentEvent</code> describing the change
+ * @param attr the attributes for the change
+ */
+ protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr)
+ {
+ super.insertUpdate(ev, attr);
+ int offset = ev.getOffset();
+ int length = ev.getLength();
+ int endOffset = offset + length;
+ Segment txt = new Segment();
+ try
+ {
+ getText(offset, length, txt);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ex);
+ throw ae;
+ }
+
+ int len = 0;
+ Vector specs = new Vector();
+
+ Element prev = getCharacterElement(offset);
+ Element next = getCharacterElement(endOffset);
+
+ for (int i = offset; i < endOffset; ++i)
+ {
+ len++;
+ if (txt.array[i] == '\n')
+ {
+ ElementSpec spec = new ElementSpec(attr, ElementSpec.ContentType,
+ len);
+
+ // If we are at the last index, then check if we could probably be
+ // joined with the next element.
+ if (i == endOffset - 1)
+ {
+ if (next.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinNextDirection);
+ }
+ // If we are at the first new element, then check if it could be
+ // joined with the previous element.
+ else if (specs.size() == 0)
+ {
+ if (prev.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinPreviousDirection);
+ }
+
+ specs.add(spec);
+
+ // Add ElementSpecs for the newline.
+ ElementSpec endTag = new ElementSpec(null, ElementSpec.EndTagType);
+ specs.add(endTag);
+ ElementSpec startTag = new ElementSpec(null,
+ ElementSpec.StartTagType);
+ startTag.setDirection(ElementSpec.JoinFractureDirection);
+ specs.add(startTag);
+
+ len = 0;
+ offset += len;
+ }
+ }
+
+ // Create last element if last character hasn't been a newline.
+ if (len > 0)
+ {
+ ElementSpec spec = new ElementSpec(attr, ElementSpec.ContentType, len);
+ // If we are at the first new element, then check if it could be
+ // joined with the previous element.
+ if (specs.size() == 0)
+ {
+ if (prev.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinPreviousDirection);
+ }
+ // Check if we could probably be joined with the next element.
+ else if (next.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinNextDirection);
+
+ specs.add(spec);
+ }
+
+ ElementSpec[] elSpecs =
+ (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]);
+
+ buffer.insert(offset, length, elSpecs, ev);
+ }
+
+ /**
+ * Returns an enumeration of all style names.
+ *
+ * @return an enumeration of all style names
+ */
+ public Enumeration getStyleNames()
+ {
+ StyleContext context = (StyleContext) getAttributeContext();
+ return context.getStyleNames();
+ }
+
+ /**
+ * Called when any of this document's styles changes.
+ *
+ * @param style the style that changed
+ */
+ protected void styleChanged(Style style)
{
- // FIXME: Implement me.
- throw new Error("not implemented");
+ // Nothing to do here. This is intended to be overridden by subclasses.
+ }
+
+ /**
+ * Inserts a bulk of structured content at once.
+ *
+ * @param offset the offset at which the content should be inserted
+ * @param data the actual content spec to be inserted
+ */
+ protected void insert(int offset, ElementSpec[] data)
+ throws BadLocationException
+ {
+ writeLock();
+ // First we insert the content.
+ int index = offset;
+ for (int i = 0; i < data.length; i++)
+ {
+ ElementSpec spec = data[i];
+ if (spec.getArray() != null && spec.getLength() > 0)
+ {
+ String insertString = new String(spec.getArray(), spec.getOffset(),
+ spec.getLength());
+ content.insertString(index, insertString);
+ }
+ index += spec.getLength();
+ }
+ // Update the view structure.
+ DefaultDocumentEvent ev = new DefaultDocumentEvent(offset, index - offset,
+ DocumentEvent.EventType.INSERT);
+ for (int i = 0; i < data.length; i++)
+ {
+ ElementSpec spec = data[i];
+ AttributeSet atts = spec.getAttributes();
+ if (atts != null)
+ insertUpdate(ev, atts);
+ }
+
+ // Finally we must update the document structure and fire the insert update
+ // event.
+ buffer.insert(offset, index - offset, data, ev);
+ fireInsertUpdate(ev);
+ writeUnlock();
+ }
+
+ /**
+ * Initializes the <code>DefaultStyledDocument</code> with the specified
+ * data.
+ *
+ * @param data the specification of the content with which the document is
+ * initialized
+ */
+ protected void create(ElementSpec[] data)
+ {
+ try
+ {
+ // Clear content.
+ content.remove(0, content.length());
+ // Clear buffer and root element.
+ buffer = new ElementBuffer(createDefaultRoot());
+ // Insert the data.
+ insert(0, data);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("Unexpected bad location");
+ err.initCause(ex);
+ throw err;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/text/DefaultTextUI.java b/libjava/classpath/javax/swing/text/DefaultTextUI.java
new file mode 100644
index 00000000000..e7ff01845e6
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/DefaultTextUI.java
@@ -0,0 +1,61 @@
+/* DefaultTextUI.java -- Deprecated base UI for text components
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import javax.swing.plaf.basic.BasicTextUI;
+
+/**
+ * This class is deprecated and should not be used anymore. The base UI for
+ * all text components is now {@link BasicTextUI}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public abstract class DefaultTextUI extends BasicTextUI
+{
+ /**
+ * This class is deprecated and should not be used anymore. The base UI for
+ * all text components is now {@link BasicTextUI}.
+ *
+ * @deprecated use {@link BasicTextUI} instead
+ */
+ public DefaultTextUI()
+ {
+ // Nothing to do here.
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/EditorKit.java b/libjava/classpath/javax/swing/text/EditorKit.java
index bd51a866f68..8719aee595f 100644
--- a/libjava/classpath/javax/swing/text/EditorKit.java
+++ b/libjava/classpath/javax/swing/text/EditorKit.java
@@ -48,24 +48,24 @@ import java.io.Writer;
import javax.swing.Action;
import javax.swing.JEditorPane;
-public abstract class EditorKit
- implements Cloneable, Serializable
+public abstract class EditorKit implements Cloneable, Serializable
{
private static final long serialVersionUID = -5044124649345887822L;
public EditorKit()
{
+ // Nothing to do here.
}
public Object clone()
{
try
{
- return super.clone();
+ return super.clone();
}
catch (CloneNotSupportedException e)
{
- return null;
+ return null;
}
}
@@ -74,10 +74,12 @@ public abstract class EditorKit
*/
public void deinstall(JEditorPane c)
{
+ // This default implementation does nothing.
}
public void install(JEditorPane c)
{
+ // This default implementation does nothing.
}
public abstract Caret createCaret();
diff --git a/libjava/classpath/javax/swing/text/FieldView.java b/libjava/classpath/javax/swing/text/FieldView.java
index e2e04d7c495..2496418444e 100644
--- a/libjava/classpath/javax/swing/text/FieldView.java
+++ b/libjava/classpath/javax/swing/text/FieldView.java
@@ -118,22 +118,24 @@ public class FieldView extends PlainView
FontMetrics fm = getFontMetrics();
if (axis == Y_AXIS)
- return fm.getHeight();
+ return super.getPreferredSpan(axis);
String text;
Element elem = getElement();
try
{
- text = elem.getDocument().getText(elem.getStartOffset(),
- elem.getEndOffset());
+ text = elem.getDocument().getText(elem.getStartOffset(),
+ elem.getEndOffset());
}
catch (BadLocationException e)
{
- // This should never happen.
- text = "";
+ // Should never happen
+ AssertionError ae = new AssertionError();
+ ae.initCause(e);
+ throw ae;
}
-
+
return fm.stringWidth(text);
}
@@ -159,18 +161,21 @@ public class FieldView extends PlainView
{
Shape newAlloc = adjustAllocation(shape);
super.insertUpdate(ev, newAlloc, vf);
+ getContainer().repaint();
}
public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
Shape newAlloc = adjustAllocation(shape);
super.removeUpdate(ev, newAlloc, vf);
+ getContainer().repaint();
}
public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
Shape newAlloc = adjustAllocation(shape);
super.removeUpdate(ev, newAlloc, vf);
+ getContainer().repaint();
}
public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias)
diff --git a/libjava/classpath/javax/swing/text/FlowView.java b/libjava/classpath/javax/swing/text/FlowView.java
index a6ef89efb78..fd6785b6f18 100644
--- a/libjava/classpath/javax/swing/text/FlowView.java
+++ b/libjava/classpath/javax/swing/text/FlowView.java
@@ -42,8 +42,10 @@ import java.awt.Container;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.util.Iterator;
import java.util.Vector;
+import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
/**
@@ -71,6 +73,7 @@ public abstract class FlowView extends BoxView
*/
public FlowStrategy()
{
+ // Nothing to do here.
}
/**
@@ -137,7 +140,7 @@ public abstract class FlowView extends BoxView
* Performs the layout for the whole view. By default this rebuilds
* all the physical views from the logical views of the managed FlowView.
*
- * This is called by {@link FlowLayout#layout} to update the layout of
+ * This is called by {@link FlowView#layout} to update the layout of
* the view.
*
* @param fv the flow view for which we perform the layout
@@ -183,11 +186,17 @@ public abstract class FlowView extends BoxView
{
View child = createView(fv, offset, spanLeft, rowIndex);
if (child == null)
- break;
+ {
+ offset = -1;
+ break;
+ }
int span = (int) child.getPreferredSpan(flowAxis);
if (span > spanLeft)
- break;
+ {
+ offset = -1;
+ break;
+ }
row.append(child);
spanLeft -= span;
@@ -204,7 +213,7 @@ public abstract class FlowView extends BoxView
* not fit in the available span and also cannot be broken down).
*
* @param fv the flow view
- * @param startOffset the start offset for the view to be created
+ * @param offset the start offset for the view to be created
* @param spanLeft the available span
* @param rowIndex the index of the row
*
@@ -218,13 +227,15 @@ public abstract class FlowView extends BoxView
View logicalView = getLogicalView(fv);
int viewIndex = logicalView.getViewIndex(offset, Position.Bias.Forward);
+ if (viewIndex == -1)
+ return null;
+
View child = logicalView.getView(viewIndex);
int flowAxis = fv.getFlowAxis();
int span = (int) child.getPreferredSpan(flowAxis);
if (span <= spanLeft)
return child;
-
else if (child.getBreakWeight(flowAxis, offset, spanLeft)
> BadBreakWeight)
// FIXME: What to do with the pos parameter here?
@@ -326,7 +337,19 @@ public abstract class FlowView extends BoxView
*/
public int getViewIndex(int pos, Position.Bias b)
{
- return getElement().getElementIndex(pos);
+ int index = -1;
+ int i = 0;
+ for (Iterator it = children.iterator(); it.hasNext(); i++)
+ {
+ View child = (View) it.next();
+ if (child.getStartOffset() >= pos
+ && child.getEndOffset() < pos)
+ {
+ index = i;
+ break;
+ }
+ }
+ return index;
}
/**
@@ -373,6 +396,37 @@ public abstract class FlowView extends BoxView
throw new AssertionError("This method must not be called in "
+ "LogicalView.");
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ assert false : "getNextVisualPositionFrom() must not be called in "
+ + "LogicalView";
+ return 0;
+ }
}
/**
@@ -478,7 +532,7 @@ public abstract class FlowView extends BoxView
* The real children are created at layout time and each represent one
* row.
*
- * This method is called by {@link #setParent} in order to initialize
+ * This method is called by {@link View#setParent} in order to initialize
* the view.
*
* @param vf the view factory to use for creating the child views
@@ -502,7 +556,7 @@ public abstract class FlowView extends BoxView
/**
* Performs the layout of this view. If the span along the flow axis changed,
- * this first calls {@link FlowStrategy.layout} in order to rebuild the
+ * this first calls {@link FlowStrategy#layout} in order to rebuild the
* rows of this view. Then the superclass's behaviour is called to arrange
* the rows within the box.
*
diff --git a/libjava/classpath/javax/swing/text/GapContent.java b/libjava/classpath/javax/swing/text/GapContent.java
index 1dd46c4b0f4..4c65de0f5f4 100644
--- a/libjava/classpath/javax/swing/text/GapContent.java
+++ b/libjava/classpath/javax/swing/text/GapContent.java
@@ -39,10 +39,15 @@ exception statement from your version. */
package javax.swing.text;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
+import java.util.Iterator;
import java.util.ListIterator;
+import java.util.Vector;
+import javax.swing.undo.AbstractUndoableEdit;
+import javax.swing.undo.CannotRedoException;
+import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
/**
@@ -59,7 +64,6 @@ import javax.swing.undo.UndoableEdit;
public class GapContent
implements AbstractDocument.Content, Serializable
{
-
/**
* A {@link Position} implementation for <code>GapContent</code>.
*/
@@ -114,6 +118,11 @@ public class GapContent
*/
public int getOffset()
{
+ // Check precondition.
+ assert mark <= gapStart || mark >= gapEnd : "mark: " + mark
+ + ", gapStart: " + gapStart
+ + ", gapEnd: " + gapEnd;
+
if (mark <= gapStart)
return mark;
else
@@ -121,13 +130,91 @@ public class GapContent
}
}
- private static final long serialVersionUID = 8374645204155842629L;
+ class UndoInsertString extends AbstractUndoableEdit
+ {
+ public int where, length;
+ String text;
+ public UndoInsertString(int start, int len)
+ {
+ where = start;
+ length = len;
+ }
+
+ public void undo () throws CannotUndoException
+ {
+ super.undo();
+ try
+ {
+ text = getString(where, length);
+ remove(where, length);
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotUndoException();
+ }
+ }
+
+ public void redo () throws CannotUndoException
+ {
+ super.redo();
+ try
+ {
+ insertString(where, text);
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotRedoException();
+ }
+ }
+
+ }
+
+ class UndoRemove extends AbstractUndoableEdit
+ {
+ public int where;
+ String text;
+ public UndoRemove(int start, String removedText)
+ {
+ where = start;
+ text = removedText;
+ }
+
+ public void undo () throws CannotUndoException
+ {
+ super.undo();
+ try
+ {
+ insertString(where, text);
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotUndoException();
+ }
+ }
+
+ public void redo () throws CannotUndoException
+ {
+ super.redo();
+ try
+ {
+ remove(where, text.length());
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotRedoException();
+ }
+ }
+
+ }
+
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6226052713477823730L;
/**
* This is the default buffer size and the amount of bytes that a buffer is
* extended if it is full.
*/
- static final int DEFAULT_BUFSIZE = 64;
+ static final int DEFAULT_BUFSIZE = 10;
/**
* The text buffer.
@@ -148,7 +235,7 @@ public class GapContent
* The positions generated by this GapContent. They are kept in an ordered
* fashion, so they can be looked up easily.
*/
- LinkedList positions;
+ ArrayList positions;
/**
* Creates a new GapContent object.
@@ -166,10 +253,10 @@ public class GapContent
public GapContent(int size)
{
buffer = (char[]) allocateArray(size);
- gapStart = 0;
- gapEnd = size - 1;
- buffer[size - 1] = '\n';
- positions = new LinkedList();
+ gapStart = 1;
+ gapEnd = size;
+ buffer[0] = '\n';
+ positions = new ArrayList();
}
/**
@@ -211,8 +298,7 @@ public class GapContent
* @param where the position where the string is inserted
* @param str the string that is to be inserted
*
- * @return an UndoableEdit object (currently not supported, so
- * <code>null</code> is returned)
+ * @return an UndoableEdit object
*
* @throws BadLocationException if <code>where</code> is not a valid
* location in the buffer
@@ -228,9 +314,9 @@ public class GapContent
throw new BadLocationException("the where argument cannot be greater"
+ " than the content length", where);
- replace(where, 0, str.toCharArray(), str.length());
+ replace(where, 0, str.toCharArray(), strLen);
- return null;
+ return new UndoInsertString(where, strLen);
}
/**
@@ -239,8 +325,7 @@ public class GapContent
* @param where the position where the content is to be removed
* @param nitems number of characters to be removed
*
- * @return an UndoableEdit object (currently not supported, so
- * <code>null</code> is returned)
+ * @return an UndoableEdit object
*
* @throws BadLocationException if <code>where</code> is not a valid
* location in the buffer
@@ -257,9 +342,10 @@ public class GapContent
throw new BadLocationException("where + nitems cannot be greater"
+ " than the content length", where + nitems);
+ String removedText = getString(where, nitems);
replace(where, nitems, null, 0);
- return null;
+ return new UndoRemove(where, removedText);
}
/**
@@ -372,7 +458,6 @@ public class GapContent
if (index < 0)
index = -(index + 1);
positions.add(index, pos);
-
return pos;
}
@@ -386,7 +471,14 @@ public class GapContent
*/
protected void shiftEnd(int newSize)
{
- int delta = (gapEnd - gapStart) - newSize;
+ assert newSize > (gapEnd - gapStart) : "The new gap size must be greater "
+ + "than the old gap size";
+
+ int delta = newSize - gapEnd + gapStart;
+ // Update the marks after the gapEnd.
+ adjustPositionsInRange(gapEnd, buffer.length - gapEnd, delta);
+
+ // Copy the data around.
char[] newBuf = (char[]) allocateArray(length() + newSize);
System.arraycopy(buffer, 0, newBuf, 0, gapStart);
System.arraycopy(buffer, gapEnd, newBuf, gapStart + newSize, buffer.length
@@ -394,18 +486,6 @@ public class GapContent
gapEnd = gapStart + newSize;
buffer = newBuf;
- // Update the marks after the gapEnd.
- int index = Collections.binarySearch(positions, new GapContentPosition(
- gapEnd));
- if (index < 0)
- {
- index = -(index + 1);
- }
- for (ListIterator i = positions.listIterator(index); i.hasNext();)
- {
- GapContentPosition p = (GapContentPosition) i.next();
- p.mark += delta;
- }
}
/**
@@ -415,32 +495,15 @@ public class GapContent
*/
protected void shiftGap(int newGapStart)
{
- int newGapEnd = newGapStart + (gapEnd - gapStart);
-
- // Update the positions between newGapEnd and (old) gapEnd. The marks
- // must be shifted by (gapEnd - newGapEnd).
- int index1 = Collections.binarySearch(positions,
- new GapContentPosition(gapEnd));
- int index2 = Collections.binarySearch(positions,
- new GapContentPosition(newGapEnd));
- if (index1 > 0 && index2 > 0)
- {
- int i1 = Math.min(index1, index2);
- int i2 = Math.max(index1, index2);
- for (ListIterator i = positions.listIterator(i1); i.hasNext();)
- {
- if (i.nextIndex() > i2)
- break;
-
- GapContentPosition p = (GapContentPosition) i.next();
- p.mark += gapEnd - newGapEnd;
- }
- }
-
if (newGapStart == gapStart)
return;
- else if (newGapStart < gapStart)
+
+ int newGapEnd = newGapStart + gapEnd - gapStart;
+ if (newGapStart < gapStart)
{
+ // Update the positions between newGapStart and (old) gapStart. The marks
+ // must be shifted by (gapEnd - gapStart).
+ adjustPositionsInRange(newGapStart, gapStart - newGapStart, gapEnd - gapStart);
System.arraycopy(buffer, newGapStart, buffer, newGapEnd, gapStart
- newGapStart);
gapStart = newGapStart;
@@ -448,11 +511,54 @@ public class GapContent
}
else
{
+ // Update the positions between newGapEnd and (old) gapEnd. The marks
+ // must be shifted by (gapEnd - gapStart).
+ adjustPositionsInRange(gapEnd, newGapEnd - gapEnd, -(gapEnd - gapStart));
System.arraycopy(buffer, gapEnd, buffer, gapStart, newGapStart
- gapStart);
gapStart = newGapStart;
gapEnd = newGapEnd;
}
+ if (gapStart == 0)
+ resetMarksAtZero();
+ }
+
+ /**
+ * Shifts the gap start downwards. This does not affect the content of the
+ * buffer. This only updates the gap start and all the marks that are between
+ * the old gap start and the new gap start. They all are squeezed to the start
+ * of the gap, because their location has been removed.
+ *
+ * @param newGapStart the new gap start
+ */
+ protected void shiftGapStartDown(int newGapStart)
+ {
+ if (newGapStart == gapStart)
+ return;
+
+ assert newGapStart < gapStart : "The new gap start must be less than the "
+ + "old gap start.";
+ setPositionsInRange(newGapStart, gapStart - newGapStart, gapStart);
+ gapStart = newGapStart;
+ }
+
+ /**
+ * Shifts the gap end upwards. This does not affect the content of the
+ * buffer. This only updates the gap end and all the marks that are between
+ * the old gap end and the new end start. They all are squeezed to the end
+ * of the gap, because their location has been removed.
+ *
+ * @param newGapEnd the new gap start
+ */
+ protected void shiftGapEndUp(int newGapEnd)
+ {
+ if (newGapEnd == gapEnd)
+ return;
+
+ assert newGapEnd > gapEnd : "The new gap end must be greater than the "
+ + "old gap end.";
+ setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd + 1);
+ gapEnd = newGapEnd;
}
/**
@@ -476,13 +582,15 @@ public class GapContent
protected void replace(int position, int rmSize, Object addItems,
int addSize)
{
+ if (gapStart != position)
+ shiftGap(position);
// Remove content
- shiftGap(position);
- gapEnd += rmSize;
+ if (rmSize > 0)
+ shiftGapEndUp(gapEnd + rmSize);
// If gap is too small, enlarge the gap.
- if ((gapEnd - gapStart) < addSize)
- shiftEnd(addSize);
+ if ((gapEnd - gapStart) <= addSize)
+ shiftEnd((addSize - gapEnd + gapStart + 1) * 2 + gapEnd + DEFAULT_BUFSIZE);
// Add new items to the buffer.
if (addItems != null)
@@ -491,4 +599,164 @@ public class GapContent
gapStart += addSize;
}
}
+
+ /**
+ * Returns the start index of the gap within the buffer array.
+ *
+ * @return the start index of the gap within the buffer array
+ */
+ protected final int getGapStart()
+ {
+ return gapStart;
+ }
+
+ /**
+ * Returns the end index of the gap within the buffer array.
+ *
+ * @return the end index of the gap within the buffer array
+ */
+ protected final int getGapEnd()
+ {
+ return gapEnd;
+ }
+
+ /**
+ * Returns all <code>Position</code>s that are in the range specified by
+ * <code>offset</code> and </code>length</code> within the buffer array.
+ *
+ * @param v the vector to use; if <code>null</code>, a new Vector is allocated
+ * @param offset the start offset of the range to search
+ * @param length the length of the range to search
+ *
+ * @return the positions within the specified range
+ */
+ protected Vector getPositionsInRange(Vector v, int offset, int length)
+ {
+ Vector res = v;
+ if (res == null)
+ res = new Vector();
+ else
+ res.clear();
+
+ int endOffset = offset + length;
+
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(offset));
+ if (index1 < 0)
+ index1 = -(index1 + 1);
+ for (ListIterator i = positions.listIterator(index1); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ if (p.mark > endOffset)
+ break;
+ if (p.mark >= offset && p.mark <= endOffset)
+ res.add(p);
+ }
+ return res;
+ }
+
+ /**
+ * Sets the mark of all <code>Position</code>s that are in the range
+ * specified by <code>offset</code> and </code>length</code> within
+ * the buffer array to <code>value</code>
+ *
+ * @param offset the start offset of the range to search
+ * @param length the length of the range to search
+ * @param value the new value for each mark
+ */
+ void setPositionsInRange(int offset, int length, int value)
+ {
+ int endOffset = offset + length;
+
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(offset));
+ if (index1 < 0)
+ index1 = -(index1 + 1);
+ for (ListIterator i = positions.listIterator(index1); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ if (p.mark > endOffset)
+ break;
+
+ if (p.mark >= offset && p.mark <= endOffset)
+ p.mark = value;
+ }
+ }
+
+ /**
+ * Adjusts the mark of all <code>Position</code>s that are in the range
+ * specified by <code>offset</code> and </code>length</code> within
+ * the buffer array by <code>increment</code>
+ *
+ * @param offset the start offset of the range to search
+ * @param length the length of the range to search
+ * @param incr the increment
+ */
+ void adjustPositionsInRange(int offset, int length, int incr)
+ {
+ int endOffset = offset + length;
+
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(offset));
+ if (index1 < 0)
+ index1 = -(index1 + 1);
+ for (ListIterator i = positions.listIterator(index1); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ if (p.mark > endOffset)
+ break;
+
+ if (p.mark >= offset && p.mark <= endOffset)
+ p.mark += incr;
+ }
+ }
+
+ /**
+ * Resets all <code>Position</code> that have an offset of <code>0</code>,
+ * to also have an array index of <code>0</code>. This might be necessary
+ * after a call to <code>shiftGap(0)</code>, since then the marks at offset
+ * <code>0</code> get shifted to <code>gapEnd</code>.
+ */
+ protected void resetMarksAtZero()
+ {
+ if (gapStart != 0)
+ return;
+
+ setPositionsInRange(gapEnd, 0, 0);
+ }
+
+ /**
+ * Outputs debugging info to System.err. It prints out the buffer array,
+ * the gapStart is marked by a &lt; sign, the gapEnd is marked by a &gt;
+ * sign and each position is marked by a # sign.
+ */
+ private void dump()
+ {
+ System.err.println("GapContent debug information");
+ System.err.println("buffer length: " + buffer.length);
+ System.err.println("gap start: " + gapStart);
+ System.err.println("gap end: " + gapEnd);
+ for (int i = 0; i < buffer.length; i++)
+ {
+ if (i == gapStart)
+ System.err.print('<');
+ if (i == gapEnd)
+ System.err.print('>');
+
+ if (!Character.isISOControl(buffer[i]))
+ System.err.print(buffer[i]);
+ else
+ System.err.print('.');
+ }
+ System.err.println();
+ }
+
+ private void dumpPositions()
+ {
+ for (Iterator i = positions.iterator(); i.hasNext();)
+ {
+ GapContentPosition pos = (GapContentPosition) i.next();
+ System.err.println("position at: " + pos.mark);
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/text/GlyphView.java b/libjava/classpath/javax/swing/text/GlyphView.java
index f9e60972d84..eb1fadd4f2d 100644
--- a/libjava/classpath/javax/swing/text/GlyphView.java
+++ b/libjava/classpath/javax/swing/text/GlyphView.java
@@ -44,6 +44,12 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.awt.Toolkit;
+import java.text.BreakIterator;
+
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.text.Position.Bias;
/**
* Renders a run of styled text. This {@link View} subclass paints the
@@ -52,9 +58,7 @@ import java.awt.Shape;
*
* @author Roman Kennke (roman@kennke.org)
*/
-public class GlyphView
- extends View
- implements TabableView, Cloneable
+public class GlyphView extends View implements TabableView, Cloneable
{
/**
@@ -68,15 +72,47 @@ public class GlyphView
*/
public GlyphPainter()
{
+ // Nothing to do here.
}
/**
+ * Returns the ascent of the font that is used by this glyph painter.
+ *
+ * @param v the glyph view
+ *
+ * @return the ascent of the font that is used by this glyph painter
+ */
+ public abstract float getAscent(GlyphView v);
+
+ /**
+ * Returns the descent of the font that is used by this glyph painter.
+ *
+ * @param v the glyph view
+ *
+ * @return the descent of the font that is used by this glyph painter
+ */
+ public abstract float getDescent(GlyphView v);
+
+ /**
* Returns the full height of the rendered text.
*
* @return the full height of the rendered text
*/
public abstract float getHeight(GlyphView view);
-
+
+ /**
+ * Determines the model offset, so that the text between <code>p0</code>
+ * and this offset fits within the span starting at <code>x</code> with
+ * the length of <code>len</code>.
+ *
+ * @param v the glyph view
+ * @param p0 the starting offset in the model
+ * @param x the start location in the view
+ * @param len the length of the span in the view
+ */
+ public abstract int getBoundedPosition(GlyphView v, int p0, float x,
+ float len);
+
/**
* Paints the glyphs.
*
@@ -97,8 +133,8 @@ public class GlyphView
* @param view the glyph view
* @param pos the position of the character in the model
* @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -114,6 +150,20 @@ public class GlyphView
throws BadLocationException;
/**
+ * Maps a visual position into a document location.
+ *
+ * @param v the glyph view
+ * @param x the X coordinate of the visual position
+ * @param y the Y coordinate of the visual position
+ * @param a the allocated region
+ * @param biasRet filled with the bias of the model location on method exit
+ *
+ * @return the model location that represents the specified view location
+ */
+ public abstract int viewToModel(GlyphView v, float x, float y, Shape a,
+ Position.Bias[] biasRet);
+
+ /**
* Determine the span of the glyphs from location <code>p0</code> to
* location <code>p1</code>. If <code>te</code> is not <code>null</code>,
* then TABs are expanded using this <code>TabExpander</code>.
@@ -122,7 +172,7 @@ public class GlyphView
*
* @param view the glyph view
* @param p0 the starting location in the document model
- * @param p0 the end location in the document model
+ * @param p1 the end location in the document model
* @param te the tab expander to use
* @param x the location at which the view is located
*
@@ -132,6 +182,69 @@ public class GlyphView
public abstract float getSpan(GlyphView view, int p0, int p1,
TabExpander te, float x);
+
+ /**
+ * Returns the model location that should be used to place a caret when
+ * moving the caret through the document.
+ *
+ * @param v the glyph view
+ * @param pos the current model location
+ * @param b the bias for <code>p</code>
+ * @param a the allocated region for the glyph view
+ * @param direction the direction from the current position; Must be one of
+ * {@link SwingConstants#EAST}, {@link SwingConstants#WEST},
+ * {@link SwingConstants#NORTH} or {@link SwingConstants#SOUTH}
+ * @param biasRet filled with the bias of the resulting location when method
+ * returns
+ *
+ * @return the location within the document that should be used to place the
+ * caret when moving the caret around the document
+ *
+ * @throws BadLocationException if <code>pos</code> is an invalid model
+ * location
+ * @throws IllegalArgumentException if <code>d</code> is invalid
+ */
+ public int getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b,
+ Shape a, int direction,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+
+ {
+ int result = pos;
+ switch (direction)
+ {
+ case SwingConstants.EAST:
+ result = pos + 1;
+ break;
+ case SwingConstants.WEST:
+ result = pos - 1;
+ break;
+ case SwingConstants.NORTH:
+ case SwingConstants.SOUTH:
+ default:
+ // This should be handled in enclosing view, since the glyph view
+ // does not layout vertically.
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Returns a painter that can be used to render the specified glyph view.
+ * If this glyph painter is stateful, then it should return a new instance.
+ * However, if this painter is stateless it should return itself. The
+ * default behaviour is to return itself.
+ *
+ * @param v the glyph view for which to create a painter
+ * @param p0 the start offset of the rendered area
+ * @param p1 the end offset of the rendered area
+ *
+ * @return a painter that can be used to render the specified glyph view
+ */
+ public GlyphPainter getPainter(GlyphView v, int p0, int p1)
+ {
+ return this;
+ }
}
/**
@@ -147,7 +260,7 @@ public class GlyphView
public float getHeight(GlyphView view)
{
Font font = view.getFont();
- FontMetrics metrics = view.getContainer().getFontMetrics(font);
+ FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
float height = metrics.getHeight();
return height;
}
@@ -173,11 +286,40 @@ public class GlyphView
if (parent instanceof TabExpander)
tabEx = (TabExpander) parent;
- // FIXME: Set character attributes like font-family, font-size, colors.
- Color foreground = view.getForeground();
- g.setColor(foreground);
- Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx,
- txt.offset);
+ // Fill the background of the text run.
+ Color background = view.getBackground();
+ g.setColor(background);
+ int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(),
+ bounds.x, tabEx, txt.offset);
+ g.fillRect(bounds.x, bounds.y, width, height);
+
+ // Draw the actual text.
+ g.setColor(view.getForeground());
+ g.setFont(view.getFont());
+ if (view.isSuperscript())
+ // TODO: Adjust font for superscripting.
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y - height / 2, g, tabEx,
+ txt.offset);
+ else if (view.isSubscript())
+ // TODO: Adjust font for subscripting.
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y + height / 2, g, tabEx,
+ txt.offset);
+ else
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx,
+ txt.offset);
+
+ if (view.isStikeThrough())
+ {
+ int strikeHeight = (int) (getAscent(view) / 2);
+ g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width,
+ bounds.y + strikeHeight);
+ }
+ if (view.isUnderline())
+ {
+ int lineHeight = (int) getAscent(view);
+ g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width,
+ bounds.y + lineHeight);
+ }
}
/**
@@ -188,8 +330,8 @@ public class GlyphView
* @param view the glyph view
* @param pos the position of the character in the model
* @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -225,7 +367,7 @@ public class GlyphView
*
* @param view the glyph view
* @param p0 the starting location in the document model
- * @param p0 the end location in the document model
+ * @param p1 the end location in the document model
* @param te the tab expander to use
* @param x the location at which the view is located
*
@@ -237,11 +379,90 @@ public class GlyphView
{
Element el = view.getElement();
Font font = view.getFont();
- FontMetrics fm = view.getContainer().getFontMetrics(font);
+ FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
Segment txt = view.getText(p0, p1);
int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0);
return span;
}
+
+ /**
+ * Returns the ascent of the text run that is rendered by this
+ * <code>GlyphPainter</code>.
+ *
+ * @param v the glyph view
+ *
+ * @return the ascent of the text run that is rendered by this
+ * <code>GlyphPainter</code>
+ *
+ * @see FontMetrics#getAscent()
+ */
+ public float getAscent(GlyphView v)
+ {
+ Font font = v.getFont();
+ FontMetrics fm = v.getContainer().getFontMetrics(font);
+ return fm.getAscent();
+ }
+
+ /**
+ * Returns the descent of the text run that is rendered by this
+ * <code>GlyphPainter</code>.
+ *
+ * @param v the glyph view
+ *
+ * @return the descent of the text run that is rendered by this
+ * <code>GlyphPainter</code>
+ *
+ * @see FontMetrics#getDescent()
+ */
+ public float getDescent(GlyphView v)
+ {
+ Font font = v.getFont();
+ FontMetrics fm = v.getContainer().getFontMetrics(font);
+ return fm.getDescent();
+ }
+
+ /**
+ * Determines the model offset, so that the text between <code>p0</code>
+ * and this offset fits within the span starting at <code>x</code> with
+ * the length of <code>len</code>.
+ *
+ * @param v the glyph view
+ * @param p0 the starting offset in the model
+ * @param x the start location in the view
+ * @param len the length of the span in the view
+ */
+ public int getBoundedPosition(GlyphView v, int p0, float x, float len)
+ {
+ TabExpander te = v.getTabExpander();
+ Segment txt = v.getText(p0, v.getEndOffset());
+ Font font = v.getFont();
+ FontMetrics fm = v.getContainer().getFontMetrics(font);
+ int pos = Utilities.getTabbedTextOffset(txt, fm, (int) x,
+ (int) (x + len), te, p0, false);
+ return pos;
+ }
+
+ /**
+ * Maps a visual position into a document location.
+ *
+ * @param v the glyph view
+ * @param x the X coordinate of the visual position
+ * @param y the Y coordinate of the visual position
+ * @param a the allocated region
+ * @param biasRet filled with the bias of the model location on method exit
+ *
+ * @return the model location that represents the specified view location
+ */
+ public int viewToModel(GlyphView v, float x, float y, Shape a,
+ Bias[] biasRet)
+ {
+ Rectangle b = a.getBounds();
+ assert b.contains(x, y) : "The coordinates are expected to be within the "
+ + "view's bounds: x=" + x + ", y=" + y
+ + "a=" + a;
+ int pos = getBoundedPosition(v, v.getStartOffset(), b.x, x - b.x);
+ return pos;
+ }
}
/**
@@ -250,6 +471,16 @@ public class GlyphView
GlyphPainter glyphPainter;
/**
+ * The start offset within the document for this view.
+ */
+ int startOffset;
+
+ /**
+ * The end offset within the document for this view.
+ */
+ int endOffset;
+
+ /**
* Creates a new <code>GlyphView</code> for the given <code>Element</code>.
*
* @param element the element that is rendered by this GlyphView
@@ -257,6 +488,8 @@ public class GlyphView
public GlyphView(Element element)
{
super(element);
+ startOffset = element.getStartOffset();
+ endOffset = element.getEndOffset();
}
/**
@@ -319,16 +552,21 @@ public class GlyphView
*/
public float getPreferredSpan(int axis)
{
- Element el = getElement();
+ float span = 0;
checkPainter();
GlyphPainter painter = getGlyphPainter();
- TabExpander tabEx = null;
- View parent = getParent();
- if (parent instanceof TabExpander)
- tabEx = (TabExpander) parent;
- // FIXME: Figure out how to determine the x parameter.
- float span = painter.getSpan(this, el.getStartOffset(), el.getEndOffset(),
- tabEx, 0.F);
+ if (axis == X_AXIS)
+ {
+ Element el = getElement();
+ TabExpander tabEx = null;
+ View parent = getParent();
+ if (parent instanceof TabExpander)
+ tabEx = (TabExpander) parent;
+ span = painter.getSpan(this, getStartOffset(), getEndOffset(),
+ tabEx, 0.F);
+ }
+ else
+ span = painter.getHeight(this);
return span;
}
@@ -372,8 +610,9 @@ public class GlyphView
*/
public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
{
- // FIXME: not implemented
- return 0;
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ return painter.viewToModel(this, x, y, a, b);
}
/**
@@ -383,12 +622,11 @@ public class GlyphView
*/
public TabExpander getTabExpander()
{
- // TODO: Figure out if this is correct.
TabExpander te = null;
View parent = getParent();
- if (parent instanceof ParagraphView)
- te = (ParagraphView) parent;
+ if (parent instanceof TabExpander)
+ te = (TabExpander) parent;
return te;
}
@@ -428,23 +666,26 @@ public class GlyphView
}
catch (BadLocationException ex)
{
- throw new AssertionError("BadLocationException must not be thrown "
- + "here");
+ AssertionError ae;
+ ae = new AssertionError("BadLocationException must not be thrown "
+ + "here");
+ ae.initCause(ex);
+ throw ae;
}
FontMetrics fm = null; // Fetch font metrics somewhere.
return Utilities.getTabbedTextWidth(seg, fm, 0, null, p0);
}
/**
- * Returns the starting offset in the document model of the portion
+ * Returns the start offset in the document model of the portion
* of text that this view is responsible for.
*
- * @return the starting offset in the document model of the portion
+ * @return the start offset in the document model of the portion
* of text that this view is responsible for
*/
- public int getBeginIndex()
+ public int getStartOffset()
{
- return getElement().getStartOffset();
+ return startOffset;
}
/**
@@ -454,9 +695,9 @@ public class GlyphView
* @return the end offset in the document model of the portion
* of text that this view is responsible for
*/
- public int getEndIndex()
+ public int getEndOffset()
{
- return getElement().getEndOffset();
+ return endOffset;
}
/**
@@ -476,8 +717,11 @@ public class GlyphView
}
catch (BadLocationException ex)
{
- throw new AssertionError("BadLocationException should not be "
- + "thrown here. p0 = " + p0 + ", p1 = " + p1);
+ AssertionError ae;
+ ae = new AssertionError("BadLocationException should not be "
+ + "thrown here. p0 = " + p0 + ", p1 = " + p1);
+ ae.initCause(ex);
+ throw ae;
}
return txt;
@@ -518,4 +762,332 @@ public class GlyphView
AttributeSet atts = el.getAttributes();
return StyleConstants.getForeground(atts);
}
+
+ /**
+ * Returns the background color which should be used to paint the text.
+ * This is fetched from the associated element's text attributes using
+ * {@link StyleConstants#getBackground}.
+ *
+ * @return the background color which should be used to paint the text
+ */
+ public Color getBackground()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.getBackground(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered strike-through or not. This
+ * is determined using the method
+ * {@link StyleConstants#isStrikeThrough(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered strike-through or not
+ */
+ public boolean isStikeThrough()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isStrikeThrough(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered as subscript or not. This
+ * is determined using the method
+ * {@link StyleConstants#isSubscript(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered as subscript or not
+ */
+ public boolean isSubscript()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isSubscript(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered as superscript or not. This
+ * is determined using the method
+ * {@link StyleConstants#isSuperscript(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered as superscript or not
+ */
+ public boolean isSuperscript()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isSuperscript(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered as underlined or not. This
+ * is determined using the method
+ * {@link StyleConstants#isUnderline(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered as underlined or not
+ */
+ public boolean isUnderline()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isUnderline(atts);
+ }
+
+ /**
+ * Creates and returns a shallow clone of this GlyphView. This is used by
+ * the {@link #createFragment} and {@link #breakView} methods.
+ *
+ * @return a shallow clone of this GlyphView
+ */
+ protected final Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException ex)
+ {
+ AssertionError err = new AssertionError("CloneNotSupportedException "
+ + "must not be thrown here");
+ err.initCause(ex);
+ throw err;
+ }
+ }
+
+ /**
+ * Tries to break the view near the specified view span <code>len</code>.
+ * The glyph view can only be broken in the X direction. For Y direction it
+ * returns itself.
+ *
+ * @param axis the axis for breaking, may be {@link View#X_AXIS} or
+ * {@link View#Y_AXIS}
+ * @param p0 the model location where the fragment should start
+ * @param pos the view position along the axis where the fragment starts
+ * @param len the desired length of the fragment view
+ *
+ * @return the fragment view, or <code>this</code> if breaking was not
+ * possible
+ */
+ public View breakView(int axis, int p0, float pos, float len)
+ {
+ if (axis == Y_AXIS)
+ return this;
+
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ int breakLocation = painter.getBoundedPosition(this, p0, pos, len);
+ // Try to find a suitable line break.
+ BreakIterator lineBreaker = BreakIterator.getLineInstance();
+ Segment txt = new Segment();
+ try
+ {
+ getDocument().getText(getStartOffset(), getEndOffset(), txt);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("BadLocationException must not "
+ + "be thrown here.");
+ err.initCause(ex);
+ throw err;
+ }
+ lineBreaker.setText(txt);
+ int goodBreakLocation = lineBreaker.previous();
+ if (goodBreakLocation != BreakIterator.DONE)
+ breakLocation = goodBreakLocation;
+
+ View brokenView = createFragment(p0, breakLocation);
+ return brokenView;
+ }
+
+ /**
+ * Determines how well the specified view location is suitable for inserting
+ * a line break. If <code>axis</code> is <code>View.Y_AXIS</code>, then
+ * this method forwards to the superclass, if <code>axis</code> is
+ * <code>View.X_AXIS</code> then this method returns
+ * {@link View#ExcellentBreakWeight} if there is a suitable break location
+ * (usually whitespace) within the specified view span, or
+ * {@link View#GoodBreakWeight} if not.
+ *
+ * @param axis the axis along which the break weight is requested
+ * @param pos the starting view location
+ * @param len the length of the span at which the view should be broken
+ *
+ * @return the break weight
+ */
+ public int getBreakWeight(int axis, float pos, float len)
+ {
+ int weight;
+ if (axis == Y_AXIS)
+ weight = super.getBreakWeight(axis, pos, len);
+ else
+ {
+ // Determine the model locations at pos and pos + len.
+ int spanX = (int) getPreferredSpan(X_AXIS);
+ int spanY = (int) getPreferredSpan(Y_AXIS);
+ Rectangle dummyAlloc = new Rectangle(0, 0, spanX, spanY);
+ Position.Bias[] biasRet = new Position.Bias[1];
+ int offset1 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet);
+ int offset2 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet);
+ Segment txt = getText(offset1, offset2);
+ BreakIterator lineBreaker = BreakIterator.getLineInstance();
+ lineBreaker.setText(txt);
+ int breakLoc = lineBreaker.previous();
+ if (breakLoc == offset1)
+ weight = View.BadBreakWeight;
+ else if(breakLoc == BreakIterator.DONE)
+ weight = View.GoodBreakWeight;
+ else
+ weight = View.ExcellentBreakWeight;
+ }
+ return weight;
+ }
+
+ /**
+ * Receives notification that some text attributes have changed within the
+ * text fragment that this view is responsible for. This calls
+ * {@link View#preferenceChanged(View, boolean, boolean)} on the parent for
+ * both width and height.
+ *
+ * @param e the document event describing the change; not used here
+ * @param a the view allocation on screen; not used here
+ * @param vf the view factory; not used here
+ */
+ public void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ getParent().preferenceChanged(this, true, true);
+ }
+
+ /**
+ * Receives notification that some text has been inserted within the
+ * text fragment that this view is responsible for. This calls
+ * {@link View#preferenceChanged(View, boolean, boolean)} on the parent for
+ * width.
+ *
+ * @param e the document event describing the change; not used here
+ * @param a the view allocation on screen; not used here
+ * @param vf the view factory; not used here
+ */
+ public void insertUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ getParent().preferenceChanged(this, true, false);
+ }
+
+ /**
+ * Receives notification that some text has been removed within the
+ * text fragment that this view is responsible for. This calls
+ * {@link View#preferenceChanged(View, boolean, boolean)} on the parent for
+ * width.
+ *
+ * @param e the document event describing the change; not used here
+ * @param a the view allocation on screen; not used here
+ * @param vf the view factory; not used here
+ */
+ public void removeUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ getParent().preferenceChanged(this, true, false);
+ }
+
+ /**
+ * Creates a fragment view of this view that starts at <code>p0</code> and
+ * ends at <code>p1</code>.
+ *
+ * @param p0 the start location for the fragment view
+ * @param p1 the end location for the fragment view
+ *
+ * @return the fragment view
+ */
+ public View createFragment(int p0, int p1)
+ {
+ GlyphView fragment = (GlyphView) clone();
+ fragment.startOffset = p0;
+ fragment.endOffset = p1;
+ return fragment;
+ }
+
+ /**
+ * Returns the alignment of this view along the specified axis. For the Y
+ * axis this is <code>(height - descent) / height</code> for the used font,
+ * so that it is aligned along the baseline.
+ * For the X axis the superclass is called.
+ */
+ public float getAlignment(int axis)
+ {
+ float align;
+ if (axis == Y_AXIS)
+ {
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ float height = painter.getHeight(this);
+ float descent = painter.getDescent(this);
+ align = (height - descent) / height;
+ }
+ else
+ align = super.getAlignment(axis);
+
+ return align;
+ }
+
+ /**
+ * Returns the model location that should be used to place a caret when
+ * moving the caret through the document.
+ *
+ * @param pos the current model location
+ * @param bias the bias for <code>p</code>
+ * @param a the allocated region for the glyph view
+ * @param direction the direction from the current position; Must be one of
+ * {@link SwingConstants#EAST}, {@link SwingConstants#WEST},
+ * {@link SwingConstants#NORTH} or {@link SwingConstants#SOUTH}
+ * @param biasRet filled with the bias of the resulting location when method
+ * returns
+ *
+ * @return the location within the document that should be used to place the
+ * caret when moving the caret around the document
+ *
+ * @throws BadLocationException if <code>pos</code> is an invalid model
+ * location
+ * @throws IllegalArgumentException if <code>d</code> is invalid
+ */
+ public int getNextVisualPositionFrom(int pos, Position.Bias bias, Shape a,
+ int direction, Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ return painter.getNextVisualPositionFrom(this, pos, bias, a, direction,
+ biasRet);
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
}
diff --git a/libjava/classpath/javax/swing/text/IconView.java b/libjava/classpath/javax/swing/text/IconView.java
index c7e22b6c3eb..6dd0f7ad34a 100644
--- a/libjava/classpath/javax/swing/text/IconView.java
+++ b/libjava/classpath/javax/swing/text/IconView.java
@@ -41,6 +41,8 @@ package javax.swing.text;
import java.awt.Graphics;
import java.awt.Shape;
+import javax.swing.SwingConstants;
+
// TODO: Implement this class.
public class IconView
extends View
@@ -125,4 +127,34 @@ public class IconView
// FIXME: not implemented
return 0;
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
}
diff --git a/libjava/classpath/javax/swing/text/InternationalFormatter.java b/libjava/classpath/javax/swing/text/InternationalFormatter.java
index cedaf59feeb..86300a70d8e 100644
--- a/libjava/classpath/javax/swing/text/InternationalFormatter.java
+++ b/libjava/classpath/javax/swing/text/InternationalFormatter.java
@@ -57,9 +57,8 @@ import javax.swing.JFormattedTextField;
public class InternationalFormatter
extends DefaultFormatter
{
-
- /** The serialVersoinUID. */
- private static final long serialVersionUID = 6941977820906408656L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2436068675711756856L;
/** The format that handles value to string conversion. */
Format format;
diff --git a/libjava/classpath/javax/swing/text/JTextComponent.java b/libjava/classpath/javax/swing/text/JTextComponent.java
index b3fad79124c..83966bbdf47 100644
--- a/libjava/classpath/javax/swing/text/JTextComponent.java
+++ b/libjava/classpath/javax/swing/text/JTextComponent.java
@@ -50,9 +50,9 @@ import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.InputMethodListener;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
@@ -72,7 +72,6 @@ import javax.swing.JViewport;
import javax.swing.KeyStroke;
import javax.swing.Scrollable;
import javax.swing.SwingConstants;
-import javax.swing.Timer;
import javax.swing.TransferHandler;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
@@ -89,6 +88,7 @@ public abstract class JTextComponent extends JComponent
/**
* AccessibleJTextComponent
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented.
public class AccessibleJTextComponent extends AccessibleJComponent
implements AccessibleText, CaretListener, DocumentListener
{
@@ -99,6 +99,7 @@ public abstract class JTextComponent extends JComponent
*/
public AccessibleJTextComponent()
{
+ // Nothing to do here.
}
/**
@@ -301,50 +302,6 @@ public abstract class JTextComponent extends JComponent
}
/**
- * The timer that lets the caret blink.
- */
- private class CaretBlinkTimer
- extends Timer
- implements ActionListener
- {
- /**
- * Creates a new CaretBlinkTimer object with a default delay of 1 second.
- */
- public CaretBlinkTimer()
- {
- super(1000, null);
- addActionListener(this);
- }
-
- /**
- * Lets the caret blink.
- */
- public void actionPerformed(ActionEvent ev)
- {
- Caret c = caret;
- if (c != null)
- c.setVisible(!c.isVisible());
- }
-
- /**
- * Updates the blink delay according to the current caret.
- */
- public void update()
- {
- stop();
- Caret c = caret;
- if (c != null)
- {
- setDelay(c.getBlinkRate());
- if (editable)
- start();
- else
- c.setVisible(false);
- }
- }
- }
-
- /**
* According to <a
* href="http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html">this
* report</a>, a pair of private classes wraps a {@link
@@ -604,8 +561,7 @@ public abstract class JTextComponent extends JComponent
}
}
- class DefaultTransferHandler
- extends TransferHandler
+ class DefaultTransferHandler extends TransferHandler
{
public boolean canImport(JComponent component, DataFlavor[] flavors)
{
@@ -631,23 +587,23 @@ public abstract class JTextComponent extends JComponent
int end = textComponent.getSelectionEnd();
if (start == end)
- return;
+ return;
try
- {
- // Copy text to clipboard.
- String data = textComponent.getDocument().getText(start, end);
- StringSelection selection = new StringSelection(data);
- clipboard.setContents(selection, null);
-
- // Delete selected text on cut action.
- if (action == MOVE)
- doc.remove(start, end - start);
- }
+ {
+ // Copy text to clipboard.
+ String data = textComponent.getDocument().getText(start, end);
+ StringSelection selection = new StringSelection(data);
+ clipboard.setContents(selection, null);
+
+ // Delete selected text on cut action.
+ if (action == MOVE)
+ doc.remove(start, end - start);
+ }
catch (BadLocationException e)
- {
- // Ignore this and do nothing.
- }
+ {
+ // Ignore this and do nothing.
+ }
}
public int getSourceActions()
@@ -661,30 +617,30 @@ public abstract class JTextComponent extends JComponent
DataFlavor[] flavors = transferable.getTransferDataFlavors();
if (flavors == null)
- return false;
+ return false;
for (int i = 0; i < flavors.length; ++i)
- if (flavors[i].equals(DataFlavor.stringFlavor))
- flavor = flavors[i];
+ if (flavors[i].equals(DataFlavor.stringFlavor))
+ flavor = flavors[i];
if (flavor == null)
- return false;
+ return false;
try
- {
- JTextComponent textComponent = (JTextComponent) component;
- String data = (String) transferable.getTransferData(flavor);
- textComponent.replaceSelection(data);
- return true;
- }
+ {
+ JTextComponent textComponent = (JTextComponent) component;
+ String data = (String) transferable.getTransferData(flavor);
+ textComponent.replaceSelection(data);
+ return true;
+ }
catch (IOException e)
- {
- // Ignored.
- }
+ {
+ // Ignored.
+ }
catch (UnsupportedFlavorException e)
- {
- // Ignored.
- }
+ {
+ // Ignored.
+ }
return false;
}
@@ -701,8 +657,6 @@ public abstract class JTextComponent extends JComponent
private char focusAccelerator = '\0';
private NavigationFilter navigationFilter;
- private CaretBlinkTimer caretBlinkTimer;
-
/**
* Get a Keymap from the global keymap table, by name.
*
@@ -960,8 +914,6 @@ public abstract class JTextComponent extends JComponent
creatingKeymap = true;
}
- caretBlinkTimer = new CaretBlinkTimer();
-
setFocusable(true);
setEditable(true);
enableEvents(AWTEvent.KEY_EVENT_MASK);
@@ -1021,12 +973,17 @@ public abstract class JTextComponent extends JComponent
{
try
{
- doc.remove(0, doc.getLength());
- doc.insertString(0, text, null);
+ if (doc instanceof AbstractDocument)
+ ((AbstractDocument) doc).replace(0, doc.getLength(), text, null);
+ else
+ {
+ doc.remove(0, doc.getLength());
+ doc.insertString(0, text, null);
+ }
}
catch (BadLocationException e)
{
- // This can never happen.
+ // This can never happen.
}
}
@@ -1044,12 +1001,12 @@ public abstract class JTextComponent extends JComponent
try
{
- return doc.getText(0, doc.getLength());
+ return doc.getText(0, doc.getLength());
}
catch (BadLocationException e)
{
- // This should never happen.
- return "";
+ // This should never happen.
+ return "";
}
}
@@ -1080,12 +1037,12 @@ public abstract class JTextComponent extends JComponent
{
try
{
- return doc.getText(getSelectionStart(), getSelectionEnd());
+ return doc.getText(getSelectionStart(), getSelectionEnd());
}
catch (BadLocationException e)
{
- // This should never happen.
- return null;
+ // This should never happen.
+ return null;
}
}
@@ -1105,7 +1062,8 @@ public abstract class JTextComponent extends JComponent
*/
protected String paramString()
{
- return "JTextComponent";
+ // TODO: Do something useful here.
+ return super.paramString();
}
/**
@@ -1194,14 +1152,6 @@ public abstract class JTextComponent extends JComponent
if (editable == newValue)
return;
- if (newValue == true)
- caretBlinkTimer.start();
- else
- {
- caretBlinkTimer.stop();
- caret.setVisible(false);
- }
-
boolean oldValue = editable;
editable = newValue;
firePropertyChange("editable", oldValue, newValue);
@@ -1230,8 +1180,6 @@ public abstract class JTextComponent extends JComponent
Caret oldCaret = caret;
caret = newCaret;
- caretBlinkTimer.update();
-
if (caret != null)
caret.install(this);
@@ -1399,7 +1347,7 @@ public abstract class JTextComponent extends JComponent
start = Math.max(start, 0);
start = Math.min(start, length);
- end = Math.max(end, 0);
+ end = Math.max(end, start);
end = Math.min(end, length);
setCaretPosition(start);
@@ -1422,28 +1370,28 @@ public abstract class JTextComponent extends JComponent
// If content is empty delete selection.
if (content == null)
{
- caret.setDot(dot);
- return;
+ caret.setDot(dot);
+ return;
}
try
{
- int start = getSelectionStart();
- int end = getSelectionEnd();
-
- // Remove selected text.
- if (dot != mark)
- doc.remove(start, end - start);
-
- // Insert new text.
- doc.insertString(start, content, null);
-
- // Set dot to new position.
- setCaretPosition(start + content.length());
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+
+ // Remove selected text.
+ if (dot != mark)
+ doc.remove(start, end - start);
+
+ // Insert new text.
+ doc.insertString(start, content, null);
+
+ // Set dot to new position.
+ setCaretPosition(start + content.length());
}
catch (BadLocationException e)
{
- // This should never happen.
+ // This should never happen.
}
}
@@ -1577,15 +1525,15 @@ public abstract class JTextComponent extends JComponent
// Install default TransferHandler if none set.
if (getTransferHandler() == null)
{
- if (defaultTransferHandler == null)
- defaultTransferHandler = new DefaultTransferHandler();
-
- setTransferHandler(defaultTransferHandler);
+ if (defaultTransferHandler == null)
+ defaultTransferHandler = new DefaultTransferHandler();
+
+ setTransferHandler(defaultTransferHandler);
}
// Perform action.
ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
- action.getValue(Action.NAME).toString());
+ action.getValue(Action.NAME).toString());
action.actionPerformed(event);
}
@@ -1669,5 +1617,20 @@ public abstract class JTextComponent extends JComponent
throws IOException
{
output.write(getText());
- }
+ }
+
+ /**
+ * Returns the tooltip text for this text component for the given mouse
+ * event. This forwards the call to
+ * {@link TextUI#getToolTipText(JTextComponent, Point)}.
+ *
+ * @param ev the mouse event
+ *
+ * @return the tooltip text for this text component for the given mouse
+ * event
+ */
+ public String getToolTipText(MouseEvent ev)
+ {
+ return getUI().getToolTipText(this, ev.getPoint());
+ }
}
diff --git a/libjava/classpath/javax/swing/text/LabelView.java b/libjava/classpath/javax/swing/text/LabelView.java
index a10391613cd..4890735b925 100644
--- a/libjava/classpath/javax/swing/text/LabelView.java
+++ b/libjava/classpath/javax/swing/text/LabelView.java
@@ -38,10 +38,57 @@ exception statement from your version. */
package javax.swing.text;
-// TODO: Implement this class.
-public class LabelView
- extends GlyphView
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Shape;
+
+import javax.swing.event.DocumentEvent;
+
+/**
+ * A {@link GlyphView} that caches the textattributes for most effective
+ * rendering.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class LabelView extends GlyphView
{
+
+ /**
+ * The background color.
+ */
+ Color background;
+
+ /**
+ * The foreground color.
+ */
+ Color foreground;
+
+ /**
+ * The background color.
+ */
+ Font font;
+
+ /**
+ * The strikethrough flag.
+ */
+ boolean strikeThrough;
+
+ /**
+ * The underline flag.
+ */
+ boolean underline;
+
+ /**
+ * The subscript flag.
+ */
+ boolean subscript;
+
+ /**
+ * The superscript flag.
+ */
+ boolean superscript;
+
/**
* Creates a new <code>GlyphView</code> for the given <code>Element</code>.
*
@@ -50,5 +97,194 @@ public class LabelView
public LabelView(Element element)
{
super(element);
+ setPropertiesFromAttributes();
+ }
+
+ /**
+ * Loads the properties of this label view from the element's text
+ * attributes. This method is called from the constructor and the
+ * {@link #changedUpdate} method
+ */
+ protected void setPropertiesFromAttributes()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ background = StyleConstants.getBackground(atts);
+ foreground = StyleConstants.getForeground(atts);
+ strikeThrough = StyleConstants.isStrikeThrough(atts);
+ subscript = StyleConstants.isSubscript(atts);
+ superscript = StyleConstants.isSuperscript(atts);
+ underline = StyleConstants.isUnderline(atts);
+
+ // Determine the font.
+ String family = StyleConstants.getFontFamily(atts);
+ int size = StyleConstants.getFontSize(atts);
+ int style = Font.PLAIN;
+ if (StyleConstants.isBold(atts))
+ style |= Font.BOLD;
+ if (StyleConstants.isItalic(atts))
+ style |= Font.ITALIC;
+ font = new Font(family, style, size);
+ }
+
+ /**
+ * Receives notification when text attributes change in the chunk of
+ * text that this view is responsible for. This simply calls
+ * {@link #setPropertiesFromAttributes()}.
+ *
+ * @param e the document event
+ * @param a the allocation of this view
+ * @param vf the view factory to use for creating new views
+ */
+ public void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ setPropertiesFromAttributes();
+ }
+
+ /**
+ * Returns the background color for the glyphs.
+ *
+ * @return the background color for the glyphs
+ */
+ public Color getBackground()
+ {
+ return background;
+ }
+
+ /**
+ * Sets the background color for the glyphs. A value of <code>null</code>
+ * means the background of the parent view should shine through.
+ *
+ * @param bg the background to set or <code>null</code>
+ *
+ * @since 1.5
+ */
+ protected void setBackground(Color bg)
+ {
+ background = bg;
+ }
+
+ /**
+ * Returns the foreground color for the glyphs.
+ *
+ * @return the foreground color for the glyphs
+ */
+ public Color getForeground()
+ {
+ return foreground;
+ }
+
+ /**
+ * Returns the font for the glyphs.
+ *
+ * @return the font for the glyphs
+ */
+ public Font getFont()
+ {
+ return font;
+ }
+
+ /**
+ * Returns the font metrics of the current font.
+ *
+ * @return the font metrics of the current font
+ *
+ * @deprecated this is not used anymore
+ */
+ protected FontMetrics getFontMetrics()
+ {
+ return getContainer().getGraphics().getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered underlined,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered underlined,
+ * <code>false</code> otherwise
+ */
+ public boolean isUnderline()
+ {
+ return underline;
+ }
+
+ /**
+ * Sets the underline flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered underlined,
+ * <code>false</code> otherwise
+ */
+ protected void setUnderline(boolean flag)
+ {
+ underline = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered as subscript,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered as subscript,
+ * <code>false</code> otherwise
+ */
+ public boolean isSubscript()
+ {
+ return subscript;
+ }
+
+ /**
+ * Sets the subscript flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered as subscript,
+ * <code>false</code> otherwise
+ */
+ protected void setSubscript(boolean flag)
+ {
+ subscript = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered as superscript,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered as superscript,
+ * <code>false</code> otherwise
+ */
+ public boolean isSuperscript()
+ {
+ return superscript;
+ }
+
+ /**
+ * Sets the superscript flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered as superscript,
+ * <code>false</code> otherwise
+ */
+ protected void setSuperscript(boolean flag)
+ {
+ superscript = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered strike-through,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered strike-through,
+ * <code>false</code> otherwise
+ */
+ public boolean isStrikeThrough()
+ {
+ return strikeThrough;
+ }
+
+ /**
+ * Sets the strike-through flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered strike-through,
+ * <code>false</code> otherwise
+ */
+ protected void setStrikeThrough(boolean flag)
+ {
+ strikeThrough = flag;
}
}
diff --git a/libjava/classpath/javax/swing/text/LayoutQueue.java b/libjava/classpath/javax/swing/text/LayoutQueue.java
index 83433b6eef5..b0c84b972b2 100644
--- a/libjava/classpath/javax/swing/text/LayoutQueue.java
+++ b/libjava/classpath/javax/swing/text/LayoutQueue.java
@@ -57,6 +57,7 @@ public class LayoutQueue
*/
public LayoutQueue()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/ParagraphView.java b/libjava/classpath/javax/swing/text/ParagraphView.java
index 6c6006a2a0f..6fb121f949e 100644
--- a/libjava/classpath/javax/swing/text/ParagraphView.java
+++ b/libjava/classpath/javax/swing/text/ParagraphView.java
@@ -59,6 +59,11 @@ public class ParagraphView extends FlowView implements TabExpander
{
super(el, X_AXIS);
}
+ public float getAlignment(int axis)
+ {
+ // FIXME: This is very likely not 100% correct. Work this out.
+ return 0.0F;
+ }
}
/**
@@ -86,4 +91,29 @@ public class ParagraphView extends FlowView implements TabExpander
{
return new Row(getElement());
}
+
+ /**
+ * Returns the alignment for this paragraph view for the specified axis.
+ * For the X_AXIS the paragraph view will be aligned at it's left edge
+ * (0.0F). For the Y_AXIS the paragraph view will be aligned at the
+ * center of it's first row.
+ *
+ * @param axis the axis which is examined
+ *
+ * @return the alignment for this paragraph view for the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ if (axis == X_AXIS)
+ return 0.0F;
+ else if (getViewCount() > 0)
+ {
+
+ float prefHeight = getPreferredSpan(Y_AXIS);
+ float firstRowHeight = getView(0).getPreferredSpan(Y_AXIS);
+ return (firstRowHeight / 2.F) / prefHeight;
+ }
+ else
+ return 0.0F;
+ }
}
diff --git a/libjava/classpath/javax/swing/text/PlainDocument.java b/libjava/classpath/javax/swing/text/PlainDocument.java
index 71070e92da7..9e600c4c908 100644
--- a/libjava/classpath/javax/swing/text/PlainDocument.java
+++ b/libjava/classpath/javax/swing/text/PlainDocument.java
@@ -132,8 +132,8 @@ public class PlainDocument extends AbstractDocument
// collapse elements if the removal spans more than 1 line
Element newEl = createLeafElement(rootElement,
SimpleAttributeSet.EMPTY,
- start, end - len);
- rootElement.replace(i1, i2 - i1, new Element[]{ newEl });
+ start, end);
+ rootElement.replace(i1, i2 - i1 + 1, new Element[]{ newEl });
}
}
@@ -147,4 +147,28 @@ public class PlainDocument extends AbstractDocument
Element root = getDefaultRootElement();
return root.getElement(root.getElementIndex(pos));
}
+
+ /**
+ * Inserts a string into the document. If the document property
+ * '<code>filterNewLines</code>' is set to <code>Boolean.TRUE</code>, then
+ * all newlines in the inserted string are replaced by space characters,
+ * otherwise the superclasses behaviour is executed.
+ *
+ * Inserting content causes a write lock to be acquired during this method
+ * call.
+ *
+ * @param offs the offset at which to insert the string
+ * @param str the string to be inserted
+ * @param atts the text attributes of the string to be inserted
+ *
+ * @throws BadLocationException
+ */
+ public void insertString(int offs, String str, AttributeSet atts)
+ throws BadLocationException
+ {
+ String string = str;
+ if (Boolean.TRUE.equals(getProperty("filterNewlines")))
+ string = str.replaceAll("\n", " ");
+ super.insertString(offs, string, atts);
+ }
}
diff --git a/libjava/classpath/javax/swing/text/PlainView.java b/libjava/classpath/javax/swing/text/PlainView.java
index 91d7547e77c..9f5ee8ad3c8 100644
--- a/libjava/classpath/javax/swing/text/PlainView.java
+++ b/libjava/classpath/javax/swing/text/PlainView.java
@@ -46,15 +46,35 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
-public class PlainView extends View
- implements TabExpander
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentEvent.ElementChange;
+
+public class PlainView extends View implements TabExpander
{
Color selectedColor;
Color unselectedColor;
+
+ /**
+ * The color that is used to draw disabled text fields.
+ */
+ Color disabledColor;
+
Font font;
+ /** The length of the longest line in the Document **/
+ float maxLineLength = -1;
+
+ /** The longest line in the Document **/
+ Element longestLine = null;
+
protected FontMetrics metrics;
+ /**
+ * The instance returned by {@link #getLineBuffer()}.
+ */
+ private transient Segment lineBuffer;
+
public PlainView(Element elem)
{
super(elem);
@@ -104,7 +124,7 @@ public class PlainView extends View
// Get the rectangle for position.
Element line = getElement().getElement(lineIndex);
int lineStart = line.getStartOffset();
- Segment segment = new Segment();
+ Segment segment = getLineBuffer();
document.getText(lineStart, position - lineStart, segment);
int xoffset = Utilities.getTabbedTextWidth(segment, metrics, rect.x,
this, lineStart);
@@ -129,7 +149,9 @@ public class PlainView extends View
}
catch (BadLocationException e)
{
- // This should never happen.
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(e);
+ throw ae;
}
}
@@ -137,7 +159,7 @@ public class PlainView extends View
throws BadLocationException
{
g.setColor(selectedColor);
- Segment segment = new Segment();
+ Segment segment = getLineBuffer();
getDocument().getText(p0, p1 - p0, segment);
return Utilities.drawTabbedText(segment, x, y, g, this, 0);
}
@@ -145,8 +167,13 @@ public class PlainView extends View
protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
- g.setColor(unselectedColor);
- Segment segment = new Segment();
+ JTextComponent textComponent = (JTextComponent) getContainer();
+ if (textComponent.isEnabled())
+ g.setColor(unselectedColor);
+ else
+ g.setColor(disabledColor);
+
+ Segment segment = getLineBuffer();
getDocument().getText(p0, p1 - p0, segment);
return Utilities.drawTabbedText(segment, x, y, g, this, segment.offset);
}
@@ -161,7 +188,8 @@ public class PlainView extends View
g.setFont(textComponent.getFont());
selectedColor = textComponent.getSelectedTextColor();
unselectedColor = textComponent.getForeground();
-
+ disabledColor = textComponent.getDisabledTextColor();
+
Rectangle rect = s.getBounds();
// FIXME: Text may be scrolled.
@@ -176,9 +204,19 @@ public class PlainView extends View
}
}
+ /**
+ * Returns the tab size of a tab. Checks the Document's
+ * properties for PlainDocument.tabSizeAttribute and returns it if it is
+ * defined, otherwise returns 8.
+ *
+ * @return the tab size.
+ */
protected int getTabSize()
{
- return 8;
+ Object tabSize = getDocument().getProperty(PlainDocument.tabSizeAttribute);
+ if (tabSize == null)
+ return 8;
+ return ((Integer)tabSize).intValue();
}
/**
@@ -191,10 +229,54 @@ public class PlainView extends View
*/
public float nextTabStop(float x, int tabStop)
{
- float tabSizePixels = getTabSize() + metrics.charWidth('m');
+ float tabSizePixels = getTabSize() * metrics.charWidth('m');
return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels;
}
+ /**
+ * Returns the length of the longest line, used for getting the span
+ * @return the length of the longest line
+ */
+ float determineMaxLineLength()
+ {
+ // if the longest line is cached, return the cached value
+ if (maxLineLength != -1)
+ return maxLineLength;
+
+ // otherwise we have to go through all the lines and find it
+ Element el = getElement();
+ Segment seg = getLineBuffer();
+ float span = 0;
+ for (int i = 0; i < el.getElementCount(); i++)
+ {
+ Element child = el.getElement(i);
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ try
+ {
+ el.getDocument().getText(start, end - start, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ex);
+ throw ae;
+ }
+
+ if (seg == null || seg.array == null || seg.count == 0)
+ continue;
+
+ int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
+ if (width > span)
+ {
+ longestLine = child;
+ span = width;
+ }
+ }
+ maxLineLength = span;
+ return maxLineLength;
+ }
+
public float getPreferredSpan(int axis)
{
if (axis != X_AXIS && axis != Y_AXIS)
@@ -205,36 +287,16 @@ public class PlainView extends View
float span = 0;
Element el = getElement();
- Document doc = el.getDocument();
- Segment seg = new Segment();
switch (axis)
{
case X_AXIS:
- // calculate the maximum of the line's widths
- for (int i = 0; i < el.getElementCount(); i++)
- {
- Element child = el.getElement(i);
- int start = child.getStartOffset();
- int end = child.getEndOffset();
- try {
- doc.getText(start, start + end, seg);
- }
- catch (BadLocationException ex)
- {
- // throw new ClasspathAssertionError
- // ("no BadLocationException should be thrown here");
- }
- int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
- span = Math.max(span, width);
- }
- break;
+ span = determineMaxLineLength();
case Y_AXIS:
default:
span = metrics.getHeight() * el.getElementCount();
break;
}
-
return span;
}
@@ -252,8 +314,251 @@ public class PlainView extends View
*/
public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
{
- // FIXME: not implemented
- return 0;
+ Rectangle rec = a.getBounds();
+ Document doc = getDocument();
+ Element root = doc.getDefaultRootElement();
+
+ // PlainView doesn't support line-wrapping so we can find out which
+ // Element was clicked on just by the y-position
+ int lineClicked = (int) (y - rec.y) / metrics.getHeight();
+ if (lineClicked >= root.getElementCount())
+ return getEndOffset() - 1;
+
+ Element line = root.getElement(lineClicked);
+ Segment s = getLineBuffer();
+ int start = line.getStartOffset();
+ // We don't want the \n at the end of the line.
+ int end = line.getEndOffset() - 1;
+ try
+ {
+ doc.getText(start, end - start, s);
+ }
+ catch (BadLocationException ble)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ble);
+ throw ae;
+ }
+
+ int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start);
+ return Math.max (0, pos);
+ }
+
+ /**
+ * Since insertUpdate and removeUpdate each deal with children
+ * Elements being both added and removed, they both have to perform
+ * the same checks. So they both simply call this method.
+ * @param changes the DocumentEvent for the changes to the Document.
+ * @param a the allocation of the View.
+ * @param f the ViewFactory to use for rebuilding.
+ */
+ protected void updateDamage(DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ Element el = getElement();
+ ElementChange ec = changes.getChange(el);
+
+ // If ec is null then no lines were added or removed, just
+ // repaint the changed line
+ if (ec == null)
+ {
+ int line = getElement().getElementIndex(changes.getOffset());
+ damageLineRange(line, line, a, getContainer());
+ return;
+ }
+
+ Element[] removed = ec.getChildrenRemoved();
+ Element[] newElements = ec.getChildrenAdded();
+
+ // If no Elements were added or removed, we just want to repaint
+ // the area containing the line that was modified
+ if (removed == null && newElements == null)
+ {
+ int line = getElement().getElementIndex(changes.getOffset());
+ damageLineRange(line, line, a, getContainer());
+ return;
+ }
+
+ // Check to see if we removed the longest line, if so we have to
+ // search through all lines and find the longest one again
+ if (removed != null)
+ {
+ for (int i = 0; i < removed.length; i++)
+ if (removed[i].equals(longestLine))
+ {
+ // reset maxLineLength and search through all lines for longest one
+ maxLineLength = -1;
+ determineMaxLineLength();
+ ((JTextComponent)getContainer()).repaint();
+ return;
+ }
+ }
+
+ // If we've reached here, that means we haven't removed the longest line
+ if (newElements == null)
+ {
+ // No lines were added, just repaint the container and exit
+ ((JTextComponent)getContainer()).repaint();
+ return;
+ }
+
+ // Make sure we have the metrics
+ updateMetrics();
+
+ // If we've reached here, that means we haven't removed the longest line
+ // and we have added at least one line, so we have to check if added lines
+ // are longer than the previous longest line
+ Segment seg = getLineBuffer();
+ float longestNewLength = 0;
+ Element longestNewLine = null;
+
+ // Loop through the added lines to check their length
+ for (int i = 0; i < newElements.length; i++)
+ {
+ Element child = newElements[i];
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ try
+ {
+ el.getDocument().getText(start, end - start, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ex);
+ throw ae;
+ }
+
+ if (seg == null || seg.array == null || seg.count == 0)
+ continue;
+
+ int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
+ if (width > longestNewLength)
+ {
+ longestNewLine = child;
+ longestNewLength = width;
+ }
+ }
+
+ // Check if the longest of the new lines is longer than our previous
+ // longest line, and if so update our values
+ if (longestNewLength > maxLineLength)
+ {
+ maxLineLength = longestNewLength;
+ longestLine = longestNewLine;
+ }
+ // Repaint the container
+ ((JTextComponent)getContainer()).repaint();
+ }
+
+ /**
+ * This method is called when something is inserted into the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage(changes, a, f);
+ }
+
+ /**
+ * This method is called when something is removed from the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage(changes, a, f);
+ }
+
+ /**
+ * This method is called when attributes were changed in the
+ * Document in a location that this view is responsible for.
+ */
+ public void changedUpdate (DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage(changes, a, f);
+ }
+
+ /**
+ * Repaint the given line range. This is called from insertUpdate,
+ * changedUpdate, and removeUpdate when no new lines were added
+ * and no lines were removed, to repaint the line that was
+ * modified.
+ *
+ * @param line0 the start of the range
+ * @param line1 the end of the range
+ * @param a the rendering region of the host
+ * @param host the Component that uses this View (used to call repaint
+ * on that Component)
+ *
+ * @since 1.4
+ */
+ protected void damageLineRange (int line0, int line1, Shape a, Component host)
+ {
+ if (a == null)
+ return;
+
+ Rectangle rec0 = lineToRect(a, line0);
+ Rectangle rec1 = lineToRect(a, line1);
+
+ if (rec0 == null || rec1 == null)
+ // something went wrong, repaint the entire host to be safe
+ host.repaint();
+ else
+ {
+ Rectangle repaintRec = rec0.union(rec1);
+ host.repaint();
+ }
+ }
+
+ /**
+ * Provides a {@link Segment} object, that can be used to fetch text from
+ * the document.
+ *
+ * @returna {@link Segment} object, that can be used to fetch text from
+ * the document
+ */
+ protected Segment getLineBuffer()
+ {
+ if (lineBuffer == null)
+ lineBuffer = new Segment();
+ return lineBuffer;
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
}
}
diff --git a/libjava/classpath/javax/swing/text/Segment.java b/libjava/classpath/javax/swing/text/Segment.java
index 92d850016d9..84e0e700f2e 100644
--- a/libjava/classpath/javax/swing/text/Segment.java
+++ b/libjava/classpath/javax/swing/text/Segment.java
@@ -39,8 +39,7 @@ package javax.swing.text;
import java.text.CharacterIterator;
-public class Segment
- implements Cloneable, CharacterIterator
+public class Segment implements Cloneable, CharacterIterator
{
private boolean partialReturn;
private int current;
@@ -51,6 +50,7 @@ public class Segment
public Segment()
{
+ // Nothing to do here.
}
public Segment(char[] array, int offset, int count)
diff --git a/libjava/classpath/javax/swing/text/SimpleAttributeSet.java b/libjava/classpath/javax/swing/text/SimpleAttributeSet.java
index 3ef5db61d43..0c9f607b196 100644
--- a/libjava/classpath/javax/swing/text/SimpleAttributeSet.java
+++ b/libjava/classpath/javax/swing/text/SimpleAttributeSet.java
@@ -45,6 +45,9 @@ import java.util.Hashtable;
public class SimpleAttributeSet
implements MutableAttributeSet, Serializable, Cloneable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8267656273837665219L;
+
public static final AttributeSet EMPTY = new SimpleAttributeSet();
Hashtable tab;
@@ -84,12 +87,34 @@ public class SimpleAttributeSet
return s;
}
+ /**
+ * Returns true if the given name and value represent an attribute
+ * found either in this AttributeSet or in its resolve parent hierarchy.
+ * @param name the key for the attribute
+ * @param value the value for the attribute
+ * @return true if the attribute is found here or in this set's resolve
+ * parent hierarchy
+ */
public boolean containsAttribute(Object name, Object value)
{
+ return (tab.containsKey(name) && tab.get(name).equals(value)) ||
+ (getResolveParent() != null && getResolveParent().
+ containsAttribute(name, value));
+ }
+
+ /**
+ * Returns true if the given name and value are found in this AttributeSet.
+ * Does not check the resolve parent.
+ * @param name the key for the attribute
+ * @param value the value for the attribute
+ * @return true if the attribute is found in this AttributeSet
+ */
+ boolean containsAttributeLocally(Object name, Object value)
+ {
return tab.containsKey(name)
&& tab.get(name).equals(value);
}
-
+
public boolean containsAttributes(AttributeSet attributes)
{
Enumeration e = attributes.getAttributeNames();
@@ -110,9 +135,9 @@ public class SimpleAttributeSet
public boolean equals(Object obj)
{
- return (obj != null)
- && (obj instanceof SimpleAttributeSet)
- && ((SimpleAttributeSet)obj).tab.equals(this.tab);
+ return
+ (obj instanceof AttributeSet)
+ && this.isEqual((AttributeSet) obj);
}
public Object getAttribute(Object name)
@@ -157,10 +182,16 @@ public class SimpleAttributeSet
{
return tab.isEmpty();
}
-
+
+ /**
+ * Returns true if the given set has the same number of attributes
+ * as this set and <code>containsAttributes(attr)</code> returns
+ * true.
+ */
public boolean isEqual(AttributeSet attr)
{
- return this.equals(attr);
+ return getAttributeCount() == attr.getAttributeCount()
+ && this.containsAttributes(attr);
}
public void removeAttribute(Object name)
@@ -168,9 +199,21 @@ public class SimpleAttributeSet
tab.remove(name);
}
+ /**
+ * Removes attributes from this set if they are found in the
+ * given set. Only attributes whose key AND value are removed.
+ * Removes attributes only from this set, not from the resolving parent.
+ */
public void removeAttributes(AttributeSet attributes)
{
- removeAttributes(attributes.getAttributeNames());
+ Enumeration e = attributes.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ Object val = attributes.getAttribute(name);
+ if (containsAttributeLocally(name, val))
+ removeAttribute(name);
+ }
}
public void removeAttributes(Enumeration names)
diff --git a/libjava/classpath/javax/swing/text/StringContent.java b/libjava/classpath/javax/swing/text/StringContent.java
index bedf480d4ec..7db377a1c9b 100644
--- a/libjava/classpath/javax/swing/text/StringContent.java
+++ b/libjava/classpath/javax/swing/text/StringContent.java
@@ -56,6 +56,9 @@ import javax.swing.undo.UndoableEdit;
*/
public final class StringContent implements AbstractDocument.Content, Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4755994433709540381L;
+
// This is package-private to avoid an accessor method.
char[] content;
diff --git a/libjava/classpath/javax/swing/text/StyleConstants.java b/libjava/classpath/javax/swing/text/StyleConstants.java
index 3f973f22631..598eaf621bc 100644
--- a/libjava/classpath/javax/swing/text/StyleConstants.java
+++ b/libjava/classpath/javax/swing/text/StyleConstants.java
@@ -54,11 +54,13 @@ public class StyleConstants
public static final Object BidiLevel = CharacterConstants.BidiLevel;
public static final Object Bold = CharacterConstants.Bold;
public static final Object ComponentAttribute = CharacterConstants.ComponentAttribute;
- public static final Object FontFamily = CharacterConstants.Family;
+ public static final Object Family = CharacterConstants.Family;
+ public static final Object FontFamily = CharacterConstants.Family;
public static final Object FontSize = CharacterConstants.Size;
public static final Object Foreground = CharacterConstants.Foreground;
public static final Object IconAttribute = CharacterConstants.IconAttribute;
public static final Object Italic = CharacterConstants.Italic;
+ public static final Object Size = CharacterConstants.Size;
public static final Object StrikeThrough = CharacterConstants.StrikeThrough;
public static final Object Subscript = CharacterConstants.Subscript;
public static final Object Superscript = CharacterConstants.Superscript;
@@ -109,7 +111,7 @@ public class StyleConstants
if (a.isDefined(Background))
return (Color) a.getAttribute(Background);
else
- return Color.BLACK;
+ return Color.WHITE;
}
public static int getBidiLevel(AttributeSet a)
diff --git a/libjava/classpath/javax/swing/text/StyleContext.java b/libjava/classpath/javax/swing/text/StyleContext.java
index ae11622ffc6..6c4e299455f 100644
--- a/libjava/classpath/javax/swing/text/StyleContext.java
+++ b/libjava/classpath/javax/swing/text/StyleContext.java
@@ -57,9 +57,15 @@ import javax.swing.event.EventListenerList;
public class StyleContext
implements Serializable, AbstractDocument.AttributeContext
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8042858831190784241L;
+
public class NamedStyle
implements Serializable, Style
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6690628971806226374L;
+
protected ChangeEvent changeEvent;
protected EventListenerList listenerList;
@@ -288,7 +294,7 @@ public class StyleContext
public boolean equals(Object obj)
{
return
- (obj instanceof SmallAttributeSet)
+ (obj instanceof AttributeSet)
&& this.isEqual((AttributeSet)obj);
}
@@ -300,9 +306,14 @@ public class StyleContext
return attrs[i+1];
}
- Object p = getResolveParent();
- if (p != null && p instanceof AttributeSet)
- return (((AttributeSet)p).getAttribute(key));
+ // Check the resolve parent, unless we're looking for the
+ // ResolveAttribute, which would cause an infinite loop
+ if (!(key.equals(ResolveAttribute)))
+ {
+ Object p = getResolveParent();
+ if (p != null && p instanceof AttributeSet)
+ return (((AttributeSet)p).getAttribute(key));
+ }
return null;
}
diff --git a/libjava/classpath/javax/swing/text/StyledDocument.java b/libjava/classpath/javax/swing/text/StyledDocument.java
index ea277540f23..168e1b116f3 100644
--- a/libjava/classpath/javax/swing/text/StyledDocument.java
+++ b/libjava/classpath/javax/swing/text/StyledDocument.java
@@ -45,101 +45,96 @@ import java.awt.Font;
* @author Andrew Selkirk
* @version 1.0
*/
-public interface StyledDocument extends Document {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * addStyle
- * @param nm TODO
- * @param rent TODO
- * @returns Style
- */
- Style addStyle(String nm, Style parent);
-
- /**
- * removeStyle
- * @param nm TODO
- */
- void removeStyle(String nm);
-
- /**
- * getStyle
- * @param nm TODO
- * @returns Style
- */
- Style getStyle(String nm);
-
- /**
- * setCharacterAttributes
- * @param offset TODO
- * @param length TODO
- * @param set TODO
- * @param replace TODO
- */
- void setCharacterAttributes(int offset, int length,
- AttributeSet set, boolean replace);
-
- /**
- * setParagraphAttributes
- * @param offset TODO
- * @param length TODO
- * @param set TODO
- * @param replace TODO
- */
- void setParagraphAttributes(int offset, int length,
- AttributeSet set, boolean replace);
-
- /**
- * getLogicalStyle
- * @param position TODO
- * @returns Style
- */
- Style getLogicalStyle(int position);
-
- /**
- * setLogicalStyle
- * @param position TODO
- * @param style TODO
- */
- void setLogicalStyle(int position, Style style);
-
- /**
- * getParagraphElement
- * @param position TODO
- * @returns Element
- */
- Element getParagraphElement(int position);
-
- /**
- * getCharacterElement
- * @param position TODO
- * @returns Element
- */
- Element getCharacterElement(int position);
-
- /**
- * getForeground
- * @param set TODO
- * @returns Color
- */
- Color getForeground(AttributeSet set);
-
- /**
- * getBackground
- * @param set TODO
- * @returns Color
- */
- Color getBackground(AttributeSet set);
-
- /**
- * getFont
- * @param set TODO
- * @returns Font
- */
- Font getFont(AttributeSet set);
-
-
-} // StyledDocument
+public interface StyledDocument extends Document
+{
+ /**
+ * addStyle
+ * @param nm TODO
+ * @param parent TODO
+ * @returns Style
+ */
+ Style addStyle(String nm, Style parent);
+
+ /**
+ * removeStyle
+ * @param nm TODO
+ */
+ void removeStyle(String nm);
+
+ /**
+ * getStyle
+ * @param nm TODO
+ * @returns Style
+ */
+ Style getStyle(String nm);
+
+ /**
+ * setCharacterAttributes
+ * @param offset TODO
+ * @param length TODO
+ * @param set TODO
+ * @param replace TODO
+ */
+ void setCharacterAttributes(int offset, int length, AttributeSet set,
+ boolean replace);
+
+ /**
+ * setParagraphAttributes
+ * @param offset TODO
+ * @param length TODO
+ * @param set TODO
+ * @param replace TODO
+ */
+ void setParagraphAttributes(int offset, int length, AttributeSet set,
+ boolean replace);
+
+ /**
+ * getLogicalStyle
+ * @param position TODO
+ * @returns Style
+ */
+ Style getLogicalStyle(int position);
+
+ /**
+ * setLogicalStyle
+ * @param position TODO
+ * @param style TODO
+ */
+ void setLogicalStyle(int position, Style style);
+
+ /**
+ * getParagraphElement
+ * @param position TODO
+ * @returns Element
+ */
+ Element getParagraphElement(int position);
+
+ /**
+ * getCharacterElement
+ * @param position TODO
+ * @returns Element
+ */
+ Element getCharacterElement(int position);
+
+ /**
+ * getForeground
+ * @param set TODO
+ * @returns Color
+ */
+ Color getForeground(AttributeSet set);
+
+ /**
+ * getBackground
+ * @param set TODO
+ * @returns Color
+ */
+ Color getBackground(AttributeSet set);
+
+ /**
+ * getFont
+ * @param set TODO
+ * @returns Font
+ */
+ Font getFont(AttributeSet set);
+
+}
diff --git a/libjava/classpath/javax/swing/text/StyledEditorKit.java b/libjava/classpath/javax/swing/text/StyledEditorKit.java
index 89c4cf18ee4..e71f992b534 100644
--- a/libjava/classpath/javax/swing/text/StyledEditorKit.java
+++ b/libjava/classpath/javax/swing/text/StyledEditorKit.java
@@ -40,13 +40,9 @@ package javax.swing.text;
import java.awt.Color;
import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
import javax.swing.Action;
import javax.swing.JEditorPane;
-import javax.swing.JTextPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
@@ -460,11 +456,11 @@ public class StyledEditorKit extends DefaultEditorKit
* <code>StyledEditorKit</code>, namely the following types of Elements:
*
* <ul>
- * <li>{@link AbstractDocument.ContentElementName}</li>
- * <li>{@link AbstractDocument.ParagraphElementName}</li>
- * <li>{@link AbstractDocument.SectionElementName}</li>
- * <li>{@link StyleContext.ComponentElementName}</li>
- * <li>{@link StyleContext.IconElementName}</li>
+ * <li>{@link AbstractDocument#ContentElementName}</li>
+ * <li>{@link AbstractDocument#ParagraphElementName}</li>
+ * <li>{@link AbstractDocument#SectionElementName}</li>
+ * <li>{@link StyleConstants#ComponentElementName}</li>
+ * <li>{@link StyleConstants#IconElementName}</li>
* </ul>
*/
static class StyledViewFactory
@@ -667,11 +663,11 @@ public class StyledEditorKit extends DefaultEditorKit
* namely the following types of <code>Element</code>s:
*
* <ul>
- * <li>{@link AbstractDocument.ContentElementName}</li>
- * <li>{@link AbstractDocument.ParagraphElementName}</li>
- * <li>{@link AbstractDocument.SectionElementName}</li>
- * <li>{@link StyleContext.ComponentElementName}</li>
- * <li>{@link StyleContext.IconElementName}</li>
+ * <li>{@link AbstractDocument#ContentElementName}</li>
+ * <li>{@link AbstractDocument#ParagraphElementName}</li>
+ * <li>{@link AbstractDocument#SectionElementName}</li>
+ * <li>{@link StyleConstants#ComponentElementName}</li>
+ * <li>{@link StyleConstants#IconElementName}</li>
* </ul>
*
* @return a {@link ViewFactory} that is able to create {@link View}s
diff --git a/libjava/classpath/javax/swing/text/TabSet.java b/libjava/classpath/javax/swing/text/TabSet.java
index 146f545aac7..ecad9444ea5 100644
--- a/libjava/classpath/javax/swing/text/TabSet.java
+++ b/libjava/classpath/javax/swing/text/TabSet.java
@@ -41,6 +41,9 @@ import java.io.Serializable;
public class TabSet implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2367703481999080593L;
+
TabStop[] tabs;
public TabSet(TabStop[] t)
diff --git a/libjava/classpath/javax/swing/text/TabStop.java b/libjava/classpath/javax/swing/text/TabStop.java
index 032da8bca46..56f862fdae4 100644
--- a/libjava/classpath/javax/swing/text/TabStop.java
+++ b/libjava/classpath/javax/swing/text/TabStop.java
@@ -41,6 +41,9 @@ import java.io.Serializable;
public class TabStop implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -5381995917363605058L;
+
public static final int ALIGN_LEFT = 0;
public static final int ALIGN_RIGHT = 1;
public static final int ALIGN_CENTER = 2;
diff --git a/libjava/classpath/javax/swing/text/Utilities.java b/libjava/classpath/javax/swing/text/Utilities.java
index d40408ddc3f..7830b2fca04 100644
--- a/libjava/classpath/javax/swing/text/Utilities.java
+++ b/libjava/classpath/javax/swing/text/Utilities.java
@@ -40,6 +40,11 @@ package javax.swing.text;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.text.BreakIterator;
+
+import javax.swing.SwingConstants;
/**
* A set of utilities to deal with text. This is used by several other classes
@@ -195,4 +200,409 @@ public class Utilities
return maxWidth;
}
+
+ /**
+ * Provides a facility to map screen coordinates into a model location. For a
+ * given text fragment and start location within this fragment, this method
+ * determines the model location so that the resulting fragment fits best
+ * into the span <code>[x0, x]</code>.
+ *
+ * The parameter <code>round</code> controls which model location is returned
+ * if the view coordinates are on a character: If <code>round</code> is
+ * <code>true</code>, then the result is rounded up to the next character, so
+ * that the resulting fragment is the smallest fragment that is larger than
+ * the specified span. If <code>round</code> is <code>false</code>, then the
+ * resulting fragment is the largest fragment that is smaller than the
+ * specified span.
+ *
+ * @param s the text segment
+ * @param fm the font metrics to use
+ * @param x0 the starting screen location
+ * @param x the target screen location at which the requested fragment should
+ * end
+ * @param te the tab expander to use; if this is <code>null</code>, TABs are
+ * expanded to one space character
+ * @param p0 the starting model location
+ * @param round if <code>true</code> round up to the next location, otherwise
+ * round down to the current location
+ *
+ * @return the model location, so that the resulting fragment fits within the
+ * specified span
+ */
+ public static final int getTabbedTextOffset(Segment s, FontMetrics fm, int x0,
+ int x, TabExpander te, int p0,
+ boolean round)
+ {
+ // At the end of the for loop, this holds the requested model location
+ int pos;
+ int currentX = x0;
+
+ for (pos = p0; pos < s.count; pos++)
+ {
+ char nextChar = s.array[s.offset+pos];
+ if (nextChar == 0)
+ {
+ if (! round)
+ pos--;
+ break;
+ }
+ if (nextChar != '\t')
+ currentX += fm.charWidth(nextChar);
+ else
+ {
+ if (te == null)
+ currentX += fm.charWidth(' ');
+ else
+ currentX = (int) te.nextTabStop(currentX, pos);
+ }
+ if (currentX > x)
+ {
+ if (! round)
+ pos--;
+ break;
+ }
+ }
+ return pos;
+ }
+
+ /**
+ * Provides a facility to map screen coordinates into a model location. For a
+ * given text fragment and start location within this fragment, this method
+ * determines the model location so that the resulting fragment fits best
+ * into the span <code>[x0, x]</code>.
+ *
+ * This method rounds up to the next location, so that the resulting fragment
+ * will be the smallest fragment of the text, that is greater than the
+ * specified span.
+ *
+ * @param s the text segment
+ * @param fm the font metrics to use
+ * @param x0 the starting screen location
+ * @param x the target screen location at which the requested fragment should
+ * end
+ * @param te the tab expander to use; if this is <code>null</code>, TABs are
+ * expanded to one space character
+ * @param p0 the starting model location
+ *
+ * @return the model location, so that the resulting fragment fits within the
+ * specified span
+ */
+ public static final int getTabbedTextOffset(Segment s, FontMetrics fm, int x0,
+ int x, TabExpander te, int p0)
+ {
+ return getTabbedTextOffset(s, fm, x0, x, te, p0, true);
+ }
+
+ /**
+ * Finds the start of the next word for the given offset.
+ *
+ * @param c
+ * the text component
+ * @param offs
+ * the offset in the document
+ * @return the location in the model of the start of the next word.
+ * @throws BadLocationException
+ * if the offset is invalid.
+ */
+ public static final int getNextWord(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs > (c.getText().length() - 1))
+ throw new BadLocationException("invalid offset specified", offs);
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ int last = wb.following(offs);
+ int current = wb.next();
+ while (current != BreakIterator.DONE)
+ {
+ for (int i = last; i < current; i++)
+ {
+ // FIXME: Should use isLetter(int) and text.codePointAt(int)
+ // instead, but isLetter(int) isn't implemented yet
+ if (Character.isLetter(text.charAt(i)))
+ return last;
+ }
+ last = current;
+ current = wb.next();
+ }
+ return BreakIterator.DONE;
+ }
+
+ /**
+ * Finds the start of the previous word for the given offset.
+ *
+ * @param c
+ * the text component
+ * @param offs
+ * the offset in the document
+ * @return the location in the model of the start of the previous word.
+ * @throws BadLocationException
+ * if the offset is invalid.
+ */
+ public static final int getPreviousWord(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs > (c.getText().length() - 1))
+ throw new BadLocationException("invalid offset specified", offs);
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ int last = wb.preceding(offs);
+ int current = wb.previous();
+
+ while (current != BreakIterator.DONE)
+ {
+ for (int i = last; i < offs; i++)
+ {
+ // FIXME: Should use isLetter(int) and text.codePointAt(int)
+ // instead, but isLetter(int) isn't implemented yet
+ if (Character.isLetter(text.charAt(i)))
+ return last;
+ }
+ last = current;
+ current = wb.previous();
+ }
+ return 0;
+ }
+
+ /**
+ * Finds the start of a word for the given location.
+ * @param c the text component
+ * @param offs the offset location
+ * @return the location of the word beginning
+ * @throws BadLocationException if the offset location is invalid
+ */
+ public static final int getWordStart(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs >= c.getText().length())
+ throw new BadLocationException("invalid offset specified", offs);
+
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ if (wb.isBoundary(offs))
+ return offs;
+ return wb.preceding(offs);
+ }
+
+ /**
+ * Finds the end of a word for the given location.
+ * @param c the text component
+ * @param offs the offset location
+ * @return the location of the word end
+ * @throws BadLocationException if the offset location is invalid
+ */
+ public static final int getWordEnd(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs >= c.getText().length())
+ throw new BadLocationException("invalid offset specified", offs);
+
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ return wb.following(offs);
+ }
+
+ /**
+ * Get the model position of the end of the row that contains the
+ * specified model position. Return null if the given JTextComponent
+ * does not have a size.
+ * @param c the JTextComponent
+ * @param offs the model position
+ * @return the model position of the end of the row containing the given
+ * offset
+ * @throws BadLocationException if the offset is invalid
+ */
+ public static final int getRowEnd(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ String text = c.getText();
+ if (text == null)
+ return -1;
+
+ // Do a binary search for the smallest position X > offs
+ // such that that character at positino X is not on the same
+ // line as the character at position offs
+ int high = offs + ((text.length() - 1 - offs) / 2);
+ int low = offs;
+ int oldHigh = text.length() + 1;
+ while (true)
+ {
+ if (c.modelToView(high).y != c.modelToView(offs).y)
+ {
+ oldHigh = high;
+ high = low + ((high + 1 - low) / 2);
+ if (oldHigh == high)
+ return high - 1;
+ }
+ else
+ {
+ low = high;
+ high += ((oldHigh - high) / 2);
+ if (low == high)
+ return low;
+ }
+ }
+ }
+
+ /**
+ * Get the model position of the start of the row that contains the specified
+ * model position. Return null if the given JTextComponent does not have a
+ * size.
+ *
+ * @param c the JTextComponent
+ * @param offs the model position
+ * @return the model position of the start of the row containing the given
+ * offset
+ * @throws BadLocationException if the offset is invalid
+ */
+ public static final int getRowStart(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ String text = c.getText();
+ if (text == null)
+ return -1;
+
+ // Do a binary search for the greatest position X < offs
+ // such that the character at position X is not on the same
+ // row as the character at position offs
+ int high = offs;
+ int low = 0;
+ int oldLow = 0;
+ while (true)
+ {
+ if (c.modelToView(low).y != c.modelToView(offs).y)
+ {
+ oldLow = low;
+ low = high - ((high + 1 - low) / 2);
+ if (oldLow == low)
+ return low + 1;
+ }
+ else
+ {
+ high = low;
+ low -= ((low - oldLow) / 2);
+ if (low == high)
+ return low;
+ }
+ }
+ }
+
+ /**
+ * Determine where to break the text in the given Segment, attempting to find
+ * a word boundary.
+ * @param s the Segment that holds the text
+ * @param metrics the font metrics used for calculating the break point
+ * @param x0 starting view location representing the start of the text
+ * @param x the target view location
+ * @param e the TabExpander used for expanding tabs (if this is null tabs
+ * are expanded to 1 space)
+ * @param startOffset the offset in the Document of the start of the text
+ * @return the offset at which we should break the text
+ */
+ public static final int getBreakLocation(Segment s, FontMetrics metrics,
+ int x0, int x, TabExpander e,
+ int startOffset)
+ {
+ int mark = Utilities.getTabbedTextOffset(s, metrics, x0, x, e, startOffset);
+ BreakIterator breaker = BreakIterator.getWordInstance();
+ breaker.setText(s.toString());
+
+ // If mark is equal to the end of the string, just use that position
+ if (mark == s.count)
+ return mark;
+
+ // Try to find a word boundary previous to the mark at which we
+ // can break the text
+ int preceding = breaker.preceding(mark + 1);
+
+ if (preceding != 0)
+ return preceding;
+ else
+ // If preceding is 0 we couldn't find a suitable word-boundary so
+ // just break it on the character boundary
+ return mark;
+ }
+
+ /**
+ * Returns the paragraph element in the text component <code>c</code> at
+ * the specified location <code>offset</code>.
+ *
+ * @param c the text component
+ * @param offset the offset of the paragraph element to return
+ *
+ * @return the paragraph element at <code>offset</code>
+ */
+ public static final Element getParagraphElement(JTextComponent c, int offset)
+ {
+ Document doc = c.getDocument();
+ Element par = null;
+ if (doc instanceof StyledDocument)
+ {
+ StyledDocument styledDoc = (StyledDocument) doc;
+ par = styledDoc.getParagraphElement(offset);
+ }
+ else
+ {
+ Element root = c.getDocument().getDefaultRootElement();
+ int parIndex = root.getElementIndex(offset);
+ par = root.getElement(parIndex);
+ }
+ return par;
+ }
+
+ /**
+ * Returns the document position that is closest above to the specified x
+ * coordinate in the row containing <code>offset</code>.
+ *
+ * @param c the text component
+ * @param offset the offset
+ * @param x the x coordinate
+ *
+ * @return the document position that is closest above to the specified x
+ * coordinate in the row containing <code>offset</code>
+ *
+ * @throws BadLocationException if <code>offset</code> is not a valid offset
+ */
+ public static final int getPositionAbove(JTextComponent c, int offset, int x)
+ throws BadLocationException
+ {
+ View rootView = c.getUI().getRootView(c);
+ Rectangle r = c.modelToView(offset);
+ int offs = c.viewToModel(new Point(x, r.y));
+ int pos = rootView.getNextVisualPositionFrom(c, offs,
+ Position.Bias.Forward,
+ SwingConstants.NORTH,
+ new Position.Bias[1]);
+ return pos;
+ }
+
+ /**
+ * Returns the document position that is closest below to the specified x
+ * coordinate in the row containing <code>offset</code>.
+ *
+ * @param c the text component
+ * @param offset the offset
+ * @param x the x coordinate
+ *
+ * @return the document position that is closest above to the specified x
+ * coordinate in the row containing <code>offset</code>
+ *
+ * @throws BadLocationException if <code>offset</code> is not a valid offset
+ */
+ public static final int getPositionBelow(JTextComponent c, int offset, int x)
+ throws BadLocationException
+ {
+ View rootView = c.getUI().getRootView(c);
+ Rectangle r = c.modelToView(offset);
+ int offs = c.viewToModel(new Point(x, r.y));
+ int pos = rootView.getNextVisualPositionFrom(c, offs,
+ Position.Bias.Forward,
+ SwingConstants.SOUTH,
+ new Position.Bias[1]);
+ return pos;
+ }
}
diff --git a/libjava/classpath/javax/swing/text/View.java b/libjava/classpath/javax/swing/text/View.java
index 24efba9a1bc..daab347d731 100644
--- a/libjava/classpath/javax/swing/text/View.java
+++ b/libjava/classpath/javax/swing/text/View.java
@@ -43,7 +43,6 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
-import javax.swing.JComponent;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
@@ -87,9 +86,9 @@ public abstract class View implements SwingConstants
{
View parent = getParent();
if (parent == null)
- throw new AssertionError("The parent of a View must not be null.");
-
- return parent.getContainer();
+ return null;
+ else
+ return parent.getContainer();
}
public Document getDocument()
@@ -508,6 +507,30 @@ public abstract class View implements SwingConstants
}
/**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * This method is deprecated and calls
+ * {@link #modelToView(int, Position.Bias, int, Position.Bias, Shape)} with
+ * a bias of {@link Position.Bias#Forward}.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ *
+ * @deprecated Use {@link #modelToView(int, Shape, Position.Bias)} instead.
+ */
+ public Shape modelToView(int pos, Shape a) throws BadLocationException
+ {
+ return modelToView(pos, a, Position.Bias.Forward);
+ }
+
+ /**
* Maps coordinates from the <code>View</code>'s space into a position
* in the document model.
*
@@ -521,6 +544,25 @@ public abstract class View implements SwingConstants
*/
public abstract int viewToModel(float x, float y, Shape a, Position.Bias[] b);
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model. This method is deprecated and only there for
+ * compatibility.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ *
+ * @deprecated Use {@link #viewToModel(float, float, Shape, Position.Bias[])}
+ * instead.
+ */
+ public int viewToModel(float x, float y, Shape a)
+ {
+ return viewToModel(x, y, a, new Position.Bias[0]);
+ }
/**
* Dumps the complete View hierarchy. This method can be used for debugging
@@ -552,4 +594,30 @@ public abstract class View implements SwingConstants
for (int i = 0; i < count; ++i)
getView(i).dump(indent + 1);
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public abstract int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException;
}
diff --git a/libjava/classpath/javax/swing/text/WrappedPlainView.java b/libjava/classpath/javax/swing/text/WrappedPlainView.java
new file mode 100644
index 00000000000..b90519046ae
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/WrappedPlainView.java
@@ -0,0 +1,700 @@
+/* WrappedPlainView.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.text.Position.Bias;
+
+/**
+ * @author abalkiss
+ *
+ */
+public class WrappedPlainView extends BoxView implements TabExpander
+{
+ /** The color for selected text **/
+ Color selectedColor;
+
+ /** The color for unselected text **/
+ Color unselectedColor;
+
+ /** The color for disabled components **/
+ Color disabledColor;
+
+ /** Stores the font metrics **/
+ protected FontMetrics metrics;
+
+ /** Whether or not to wrap on word boundaries **/
+ boolean wordWrap;
+
+ /** A ViewFactory that creates WrappedLines **/
+ ViewFactory viewFactory = new WrappedLineCreator();
+
+ /** The start of the selected text **/
+ int selectionStart;
+
+ /** The end of the selected text **/
+ int selectionEnd;
+
+ /**
+ * The instance returned by {@link #getLineBuffer()}.
+ */
+ private transient Segment lineBuffer;
+
+ public WrappedPlainView (Element elem)
+ {
+ this (elem, false);
+ }
+
+ public WrappedPlainView (Element elem, boolean wordWrap)
+ {
+ super (elem, Y_AXIS);
+ this.wordWrap = wordWrap;
+ }
+
+ /**
+ * Provides access to the Segment used for retrievals from the Document.
+ * @return the Segment.
+ */
+ protected final Segment getLineBuffer()
+ {
+ if (lineBuffer == null)
+ lineBuffer = new Segment();
+ return lineBuffer;
+ }
+
+ /**
+ * Returns the next tab stop position after a given reference position.
+ *
+ * This implementation ignores the <code>tabStop</code> argument.
+ *
+ * @param x the current x position in pixels
+ * @param tabStop the position within the text stream that the tab occured at
+ */
+ public float nextTabStop(float x, int tabStop)
+ {
+ JTextComponent host = (JTextComponent)getContainer();
+ float tabSizePixels = getTabSize()
+ * host.getFontMetrics(host.getFont()).charWidth('m');
+ return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels;
+ }
+
+ /**
+ * Returns the tab size for the Document based on
+ * PlainDocument.tabSizeAttribute, defaulting to 8 if this property is
+ * not defined
+ *
+ * @return the tab size.
+ */
+ protected int getTabSize()
+ {
+ Object tabSize = getDocument().getProperty(PlainDocument.tabSizeAttribute);
+ if (tabSize == null)
+ return 8;
+ return ((Integer)tabSize).intValue();
+ }
+
+ /**
+ * Draws a line of text, suppressing white space at the end and expanding
+ * tabs. Calls drawSelectedText and drawUnselectedText.
+ * @param p0 starting document position to use
+ * @param p1 ending document position to use
+ * @param g graphics context
+ * @param x starting x position
+ * @param y starting y position
+ */
+ protected void drawLine(int p0, int p1, Graphics g, int x, int y)
+ {
+ try
+ {
+ // We have to draw both selected and unselected text. There are
+ // several cases:
+ // - entire range is unselected
+ // - entire range is selected
+ // - start of range is selected, end of range is unselected
+ // - start of range is unselected, end of range is selected
+ // - middle of range is selected, start and end of range is unselected
+
+ // entire range unselected:
+ if ((selectionStart == selectionEnd) ||
+ (p0 > selectionEnd || p1 < selectionStart))
+ drawUnselectedText(g, x, y, p0, p1);
+
+ // entire range selected
+ else if (p0 >= selectionStart && p1 <= selectionEnd)
+ drawSelectedText(g, x, y, p0, p1);
+
+ // start of range selected, end of range unselected
+ else if (p0 >= selectionStart)
+ {
+ x = drawSelectedText(g, x, y, p0, selectionEnd);
+ drawUnselectedText(g, x, y, selectionEnd, p1);
+ }
+
+ // start of range unselected, end of range selected
+ else if (selectionStart > p0 && selectionEnd > p1)
+ {
+ x = drawUnselectedText(g, x, y, p0, selectionStart);
+ drawSelectedText(g, x, y, selectionStart, p1);
+ }
+
+ // middle of range selected
+ else if (selectionStart > p0)
+ {
+ x = drawUnselectedText(g, x, y, p0, selectionStart);
+ x = drawSelectedText(g, x, y, selectionStart, selectionEnd);
+ drawUnselectedText(g, x, y, selectionEnd, p1);
+ }
+ }
+ catch (BadLocationException ble)
+ {
+ // shouldn't happen
+ }
+ }
+
+ /**
+ * Renders the range of text as selected text. Just paints the text
+ * in the color specified by the host component. Assumes the highlighter
+ * will render the selected background.
+ * @param g the graphics context
+ * @param x the starting X coordinate
+ * @param y the starting Y coordinate
+ * @param p0 the starting model location
+ * @param p1 the ending model location
+ * @return the X coordinate of the end of the text
+ * @throws BadLocationException if the given range is invalid
+ */
+ protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ g.setColor(selectedColor);
+ Segment segment = getLineBuffer();
+ getDocument().getText(p0, p1 - p0, segment);
+ return Utilities.drawTabbedText(segment, x, y, g, this, p0);
+ }
+
+ /**
+ * Renders the range of text as normal unhighlighted text.
+ * @param g the graphics context
+ * @param x the starting X coordinate
+ * @param y the starting Y coordinate
+ * @param p0 the starting model location
+ * @param p1 the end model location
+ * @return the X location of the end off the range
+ * @throws BadLocationException if the range given is invalid
+ */
+ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ JTextComponent textComponent = (JTextComponent) getContainer();
+ if (textComponent.isEnabled())
+ g.setColor(unselectedColor);
+ else
+ g.setColor(disabledColor);
+
+ Segment segment = getLineBuffer();
+ getDocument().getText(p0, p1 - p0, segment);
+ return Utilities.drawTabbedText(segment, x, y, g, this, p0);
+ }
+
+ /**
+ * Loads the children to initiate the view. Called by setParent.
+ * Creates a WrappedLine for each child Element.
+ */
+ protected void loadChildren (ViewFactory f)
+ {
+ Element root = getElement();
+ int numChildren = root.getElementCount();
+ if (numChildren == 0)
+ return;
+
+ View[] children = new View[numChildren];
+ for (int i = 0; i < numChildren; i++)
+ children[i] = new WrappedLine(root.getElement(i));
+ replace(0, 0, children);
+ }
+
+ /**
+ * Calculates the break position for the text between model positions
+ * p0 and p1. Will break on word boundaries or character boundaries
+ * depending on the break argument given in construction of this
+ * WrappedPlainView. Used by the nested WrappedLine class to determine
+ * when to start the next logical line.
+ * @param p0 the start model position
+ * @param p1 the end model position
+ * @return the model position at which to break the text
+ */
+ protected int calculateBreakPosition(int p0, int p1)
+ {
+ Container c = getContainer();
+ Rectangle alloc = c.isValid() ? c.getBounds()
+ : new Rectangle(c.getPreferredSize());
+ updateMetrics();
+ try
+ {
+ getDocument().getText(p0, p1 - p0, getLineBuffer());
+ }
+ catch (BadLocationException ble)
+ {
+ // this shouldn't happen
+ }
+ // FIXME: Should we account for the insets of the container?
+ if (wordWrap)
+ 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);
+ }
+ }
+
+ void updateMetrics()
+ {
+ Container component = getContainer();
+ metrics = component.getFontMetrics(component.getFont());
+ }
+
+ /**
+ * Determines the preferred span along the given axis. Implemented to
+ * cache the font metrics and then call the super classes method.
+ */
+ public float getPreferredSpan (int axis)
+ {
+ updateMetrics();
+ return super.getPreferredSpan(axis);
+ }
+
+ /**
+ * Determines the minimum span along the given axis. Implemented to
+ * cache the font metrics and then call the super classes method.
+ */
+ public float getMinimumSpan (int axis)
+ {
+ updateMetrics();
+ return super.getMinimumSpan(axis);
+ }
+
+ /**
+ * Determines the maximum span along the given axis. Implemented to
+ * cache the font metrics and then call the super classes method.
+ */
+ public float getMaximumSpan (int axis)
+ {
+ updateMetrics();
+ return super.getMaximumSpan(axis);
+ }
+
+ /**
+ * Called when something was inserted. Overridden so that
+ * the view factory creates WrappedLine views.
+ */
+ 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();
+ }
+
+ /**
+ * Called when something is removed. Overridden so that
+ * the view factory creates WrappedLine views.
+ */
+ 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();
+ }
+
+ /**
+ * Called when the portion of the Document that this View is responsible
+ * for changes. Overridden so that the view factory creates
+ * WrappedLine views.
+ */
+ 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();
+ }
+
+ class WrappedLineCreator implements ViewFactory
+ {
+ // Creates a new WrappedLine
+ public View create(Element elem)
+ {
+ return new WrappedLine(elem);
+ }
+ }
+
+ /**
+ * Renders the <code>Element</code> that is associated with this
+ * <code>View</code>. Caches the metrics and then calls
+ * super.paint to paint all the child views.
+ *
+ * @param g the <code>Graphics</code> context to render to
+ * @param a the allocated region for the <code>Element</code>
+ */
+ public void paint(Graphics g, Shape a)
+ {
+ JTextComponent comp = (JTextComponent)getContainer();
+ selectionStart = comp.getSelectionStart();
+ selectionEnd = comp.getSelectionEnd();
+ updateMetrics();
+ super.paint(g, a);
+ }
+
+ /**
+ * Sets the size of the View. Implemented to update the metrics
+ * and then call super method.
+ */
+ public void setSize (float width, float height)
+ {
+ updateMetrics();
+ if (width != getWidth())
+ preferenceChanged(null, true, true);
+ super.setSize(width, height);
+ }
+
+ class WrappedLine extends View
+ {
+ /** Used to cache the number of lines for this View **/
+ int numLines;
+
+ public WrappedLine(Element elem)
+ {
+ super(elem);
+ determineNumLines();
+ }
+
+ /**
+ * Renders this (possibly wrapped) line using the given Graphics object
+ * and on the given rendering surface.
+ */
+ 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();
+ int currEnd;
+ while (currStart < end)
+ {
+ currEnd = calculateBreakPosition(currStart, end);
+ drawLine(currStart, currEnd, g, rect.x, rect.y);
+ rect.y += lineHeight;
+ if (currEnd == currStart)
+ currStart ++;
+ else
+ currStart = currEnd;
+ }
+ }
+
+ /**
+ * Determines the number of logical lines that the Element
+ * needs to be displayed
+ * @return the number of lines needed to display the Element
+ */
+ int determineNumLines()
+ {
+ numLines = 0;
+ int end = getEndOffset();
+ if (end == 0)
+ return 0;
+
+ int breakPoint;
+ for (int i = getStartOffset(); i < end;)
+ {
+ numLines ++;
+ // careful: check that there's no off-by-one problem here
+ // depending on which position calculateBreakPosition returns
+ breakPoint = calculateBreakPosition(i, end);
+ if (breakPoint == i)
+ i ++;
+ else
+ i = breakPoint;
+ }
+ return numLines;
+ }
+
+ /**
+ * Determines the preferred span for this view along the given axis.
+ *
+ * @param axis the axis (either X_AXIS or Y_AXIS)
+ *
+ * @return the preferred span along the given axis.
+ * @throws IllegalArgumentException if axis is not X_AXIS or Y_AXIS
+ */
+ public float getPreferredSpan(int axis)
+ {
+ if (axis == X_AXIS)
+ return getWidth();
+ else if (axis == Y_AXIS)
+ return numLines * metrics.getHeight();
+
+ throw new IllegalArgumentException("Invalid axis for getPreferredSpan: "
+ + axis);
+ }
+
+ /**
+ * Provides a mapping from model space to view space.
+ *
+ * @param pos the position in the model
+ * @param a the region into which the view is rendered
+ * @param b the position bias (forward or backward)
+ *
+ * @return a box in view space that represents the given position
+ * in model space
+ * @throws BadLocationException if the given model position is invalid
+ */
+ public Shape modelToView(int pos, Shape a, Bias b)
+ throws BadLocationException
+ {
+ Segment s = getLineBuffer();
+ int lineHeight = metrics.getHeight();
+ Rectangle rect = a.getBounds();
+
+ // Return a rectangle with width 1 and height equal to the height
+ // of the text
+ rect.height = lineHeight;
+ rect.width = 1;
+
+ int currLineStart = getStartOffset();
+ int end = getEndOffset();
+
+ if (pos < currLineStart || pos >= end)
+ throw new BadLocationException("invalid offset", pos);
+
+ while (true)
+ {
+ int currLineEnd = calculateBreakPosition(currLineStart, end);
+ // 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)
+ {
+ try
+ {
+ getDocument().getText(currLineStart, pos - currLineStart, s);
+ }
+ catch (BadLocationException ble)
+ {
+ // Shouldn't happen
+ }
+ rect.x += Utilities.getTabbedTextWidth(s, metrics, rect.x,
+ WrappedPlainView.this,
+ currLineStart);
+ return rect;
+ }
+ // 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;
+ }
+
+ }
+
+ /**
+ * Provides a mapping from view space to model space.
+ *
+ * @param x the x coordinate in view space
+ * @param y the y coordinate in view space
+ * @param a the region into which the view is rendered
+ * @param b the position bias (forward or backward)
+ *
+ * @return the location in the model that best represents the
+ * given point in view space
+ */
+ public int viewToModel(float x, float y, Shape a, Bias[] b)
+ {
+ Segment s = getLineBuffer();
+ Rectangle rect = a.getBounds();
+ int currLineStart = getStartOffset();
+ int end = getEndOffset();
+ int lineHeight = metrics.getHeight();
+ if (y < rect.y)
+ return currLineStart;
+ if (y > rect.y + rect.height)
+ return end - 1;
+
+ while (true)
+ {
+ int currLineEnd = calculateBreakPosition(currLineStart, end);
+ // If we're at the right y-position that means we're on the right
+ // 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);
+ }
+ catch (BadLocationException ble)
+ {
+ // Shouldn't happen
+ }
+ int mark = Utilities.getTabbedTextOffset(s, metrics, rect.x,
+ (int) x,
+ WrappedPlainView.this,
+ currLineStart);
+ return currLineStart + mark;
+ }
+ // 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;
+ }
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset
+ * in the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
+
+ /**
+ * This method is called from insertUpdate and removeUpdate.
+ * If the number of lines in the document has changed, just repaint
+ * the whole thing (note, could improve performance by not repainting
+ * anything above the changes). If the number of lines hasn't changed,
+ * just repaint the given Rectangle.
+ * @param a the Rectangle to repaint if the number of lines hasn't changed
+ */
+ void updateDamage (Rectangle a)
+ {
+ int newNumLines = determineNumLines();
+ if (numLines != newNumLines)
+ {
+ numLines = newNumLines;
+ getContainer().repaint();
+ }
+ else
+ getContainer().repaint(a.x, a.y, a.width, a.height);
+ }
+
+ /**
+ * This method is called when something is inserted into the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void insertUpdate (DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage((Rectangle)a);
+ }
+
+ /**
+ * This method is called when something is removed from the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void removeUpdate (DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage((Rectangle)a);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/html/CSS.java b/libjava/classpath/javax/swing/text/html/CSS.java
new file mode 100644
index 00000000000..029ad26f8a9
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/html/CSS.java
@@ -0,0 +1,461 @@
+/* CSS.java -- Provides CSS attributes
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text.html;
+
+import java.util.HashMap;
+
+/**
+ * Provides CSS attributes to be used by the HTML view classes. The constants
+ * defined here are used as keys for text attributes for use in
+ * {@link javax.swing.text.AttributeSet}s of {@link javax.swing.text.Element}s.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class CSS
+{
+ /**
+ * Returns an array of all CSS attributes.
+ *
+ * @return All available CSS.Attribute objects.
+ */
+ public static CSS.Attribute[] getAllAttributeKeys()
+ {
+ Object[] src = Attribute.attributeMap.values().toArray();
+ CSS.Attribute[] dst = new CSS.Attribute[ src.length ];
+ System.arraycopy(src, 0, dst, 0, src.length);
+ return dst;
+ }
+
+ /**
+ * Returns an a given CSS attribute.
+ *
+ * @param name - The name of the attribute.
+ * @return The CSS attribute with the given name, or <code>null</code> if
+ * no attribute with that name exists.
+ */
+ public static CSS.Attribute getAttribute(String name)
+ {
+ return (CSS.Attribute)Attribute.attributeMap.get( name );
+ }
+
+ public static final class Attribute
+ {
+ /**
+ * The CSS attribute 'background'.
+ */
+ public static final Attribute BACKGROUND =
+ new Attribute("background", false, null);
+
+ /**
+ * The CSS attribute 'background-attachment'.
+ */
+ public static final Attribute BACKGROUND_ATTACHMENT =
+ new Attribute("background-attachment", false, "scroll");
+
+ /**
+ * The CSS attribute 'background-color'.
+ */
+ public static final Attribute BACKGROUND_COLOR =
+ new Attribute("background-color", false, "transparent");
+
+ /**
+ * The CSS attribute 'background-image'.
+ */
+ public static final Attribute BACKGROUND_IMAGE =
+ new Attribute("background-image", false, "none");
+
+ /**
+ * The CSS attribute 'background-position'.
+ */
+ public static final Attribute BACKGROUND_POSITION =
+ new Attribute("background-position", false, null);
+
+ /**
+ * The CSS attribute 'background-repeat'.
+ */
+ public static final Attribute BACKGROUND_REPEAT =
+ new Attribute("background-repeat", false, "repeat");
+
+ /**
+ * The CSS attribute 'border'.
+ */
+ public static final Attribute BORDER = new Attribute("border", false, null);
+
+ /**
+ * The CSS attribute 'border-bottom'.
+ */
+ public static final Attribute BORDER_BOTTOM =
+ new Attribute("border-bottom", false, null);
+
+ /**
+ * The CSS attribute 'border-bottom-width'.
+ */
+ public static final Attribute BORDER_BOTTOM_WIDTH =
+ new Attribute("border-bottom-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-color'.
+ */
+ public static final Attribute BORDER_COLOR =
+ new Attribute("border-color", false, "black");
+
+ /**
+ * The CSS attribute 'border-left'.
+ */
+ public static final Attribute BORDER_LEFT =
+ new Attribute("border-left", false, null);
+
+ /**
+ * The CSS attribute 'border-left-width'.
+ */
+ public static final Attribute BORDER_LEFT_WIDTH =
+ new Attribute("border-left-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-right'.
+ */
+ public static final Attribute BORDER_RIGHT =
+ new Attribute("border-right", false, null);
+
+ /**
+ * The CSS attribute 'border-right-width'.
+ */
+ public static final Attribute BORDER_RIGHT_WIDTH =
+ new Attribute("border-right-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-style'.
+ */
+ public static final Attribute BORDER_STYLE =
+ new Attribute("border-style", false, "none");
+
+ /**
+ * The CSS attribute 'border-top'.
+ */
+ public static final Attribute BORDER_TOP =
+ new Attribute("border-top", false, null);
+
+ /**
+ * The CSS attribute 'border-top-width'.
+ */
+ public static final Attribute BORDER_TOP_WIDTH =
+ new Attribute("border-top-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-width'.
+ */
+ public static final Attribute BORDER_WIDTH =
+ new Attribute("border-width", false, "medium");
+
+ /**
+ * The CSS attribute 'clear'.
+ */
+ public static final Attribute CLEAR = new Attribute("clear", false, "none");
+
+ /**
+ * The CSS attribute 'color'.
+ */
+ public static final Attribute COLOR = new Attribute("color", true, "black");
+
+ /**
+ * The CSS attribute 'display'.
+ */
+ public static final Attribute DISPLAY =
+ new Attribute("display", false, "block");
+
+ /**
+ * The CSS attribute 'float'.
+ */
+ public static final Attribute FLOAT = new Attribute("float", false, "none");
+
+ /**
+ * The CSS attribute 'font'.
+ */
+ public static final Attribute FONT = new Attribute("font", true, null);
+
+ /**
+ * The CSS attribute 'font-family'.
+ */
+ public static final Attribute FONT_FAMILY =
+ new Attribute("font-family", true, null);
+
+ /**
+ * The CSS attribute 'font-size'.
+ */
+ public static final Attribute FONT_SIZE =
+ new Attribute("font-size", true, "medium");
+
+ /**
+ * The CSS attribute 'font-style'.
+ */
+ public static final Attribute FONT_STYLE =
+ new Attribute("font-style", true, "normal");
+
+ /**
+ * The CSS attribute 'font-variant'.
+ */
+ public static final Attribute FONT_VARIANT =
+ new Attribute("font-variant", true, "normal");
+
+ /**
+ * The CSS attribute 'font-weight'.
+ */
+ public static final Attribute FONT_WEIGHT =
+ new Attribute("font-weight", true, "normal");
+
+ /**
+ * The CSS attribute 'height'.
+ */
+ public static final Attribute HEIGHT =
+ new Attribute("height", false, "auto");
+
+ /**
+ * The CSS attribute 'letter-spacing'.
+ */
+ public static final Attribute LETTER_SPACING =
+ new Attribute("letter-spacing", true, "normal");
+
+ /**
+ * The CSS attribute 'line-height'.
+ */
+ public static final Attribute LINE_HEIGHT =
+ new Attribute("line-height", true, "normal");
+
+ /**
+ * The CSS attribute 'list-style'.
+ */
+ public static final Attribute LIST_STYLE =
+ new Attribute("list-style", true, null);
+
+ /**
+ * The CSS attribute 'list-style-image'.
+ */
+ public static final Attribute LIST_STYLE_IMAGE =
+ new Attribute("list-style-image", true, "none");
+
+ /**
+ * The CSS attribute 'list-style-position'.
+ */
+ public static final Attribute LIST_STYLE_POSITION =
+ new Attribute("list-style-position", true, "outside");
+
+ /**
+ * The CSS attribute 'list-style-type'.
+ */
+ public static final Attribute LIST_STYLE_TYPE =
+ new Attribute("list-style-type", true, "disc");
+
+ /**
+ * The CSS attribute 'margin'.
+ */
+ public static final Attribute MARGIN = new Attribute("margin", false, null);
+
+ /**
+ * The CSS attribute 'margin-bottom'.
+ */
+ public static final Attribute MARGIN_BOTTOM =
+ new Attribute("margin-bottom", false, "0");
+
+ /**
+ * The CSS attribute 'margin-left'.
+ */
+ public static final Attribute MARGIN_LEFT =
+ new Attribute("margin-left", false, "0");
+
+ /**
+ * The CSS attribute 'margin-right'.
+ */
+ public static final Attribute MARGIN_RIGHT =
+ new Attribute("margin-right", false, "0");
+
+ /**
+ * The CSS attribute 'margin-top'.
+ */
+ public static final Attribute MARGIN_TOP =
+ new Attribute("margin-top", false, "0");
+
+ /**
+ * The CSS attribute 'padding'.
+ */
+ public static final Attribute PADDING =
+ new Attribute("padding", false, null);
+
+ /**
+ * The CSS attribute 'padding-bottom'.
+ */
+ public static final Attribute PADDING_BOTTOM =
+ new Attribute("padding-bottom", false, "0");
+
+ /**
+ * The CSS attribute 'padding-left'.
+ */
+ public static final Attribute PADDING_LEFT =
+ new Attribute("padding-left", false, "0");
+
+ /**
+ * The CSS attribute 'padding-right'.
+ */
+ public static final Attribute PADDING_RIGHT =
+ new Attribute("padding-right", false, "0");
+
+ /**
+ * The CSS attribute 'padding-top'.
+ */
+ public static final Attribute PADDING_TOP =
+ new Attribute("padding-top", false, "0");
+
+ /**
+ * The CSS attribute 'text-align'.
+ */
+ public static final Attribute TEXT_ALIGN =
+ new Attribute("text-align", true, null);
+
+ /**
+ * The CSS attribute 'text-decoration'.
+ */
+ public static final Attribute TEXT_DECORATION =
+ new Attribute("text-decoration", true, "none");
+
+ /**
+ * The CSS attribute 'text-indent'.
+ */
+ public static final Attribute TEXT_INDENT =
+ new Attribute("text-indent", true, "0");
+
+ /**
+ * The CSS attribute 'text-transform'.
+ */
+ public static final Attribute TEXT_TRANSFORM =
+ new Attribute("text-transform", true, "none");
+
+ /**
+ * The CSS attribute 'vertical-align'.
+ */
+ public static final Attribute VERTICAL_ALIGN =
+ new Attribute("vertical-align", false, "baseline");
+
+ /**
+ * The CSS attribute 'white-space'.
+ */
+ public static final Attribute WHITE_SPACE =
+ new Attribute("white-space", true, "normal");
+
+ /**
+ * The CSS attribute 'width'.
+ */
+ public static final Attribute WIDTH =
+ new Attribute("width", false, "auto");
+
+ /**
+ * The CSS attribute 'word-spacing'.
+ */
+ public static final Attribute WORD_SPACING =
+ new Attribute("word-spacing", true, "normal");
+
+ /**
+ * The attribute string.
+ */
+ String attStr;
+
+ /**
+ * Indicates if this attribute should be inherited from it's parent or
+ * not.
+ */
+ boolean isInherited;
+
+ /**
+ * A default value for this attribute if one exists, otherwise null.
+ */
+ String defaultValue;
+
+ /**
+ * A HashMap of all attributes.
+ */
+ static HashMap attributeMap;
+
+ /**
+ * Creates a new Attribute instance with the specified values.
+ *
+ * @param attr the attribute string
+ * @param inherited if the attribute should be inherited or not
+ * @param def a default value; may be <code>null</code>
+ */
+ Attribute(String attr, boolean inherited, String def)
+ {
+ attStr = attr;
+ isInherited = inherited;
+ defaultValue = def;
+ if( attributeMap == null)
+ attributeMap = new HashMap();
+ attributeMap.put( attr, this );
+ }
+
+ /**
+ * Returns the string representation of this attribute as specified
+ * in the CSS specification.
+ */
+ public String toString()
+ {
+ return attStr;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute should be inherited from
+ * the parent, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the attribute should be inherited from
+ * the parent, <code>false</code> otherwise
+ */
+ public boolean isInherited()
+ {
+ return isInherited;
+ }
+
+ /**
+ * Returns the default value of this attribute if one exists,
+ * <code>null</code> otherwise.
+ *
+ * @return the default value of this attribute if one exists,
+ * <code>null</code> otherwise
+ */
+ public String getDefaultValue()
+ {
+ return defaultValue;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/html/HTML.java b/libjava/classpath/javax/swing/text/html/HTML.java
index 3c03a63a471..0b758d2b873 100644
--- a/libjava/classpath/javax/swing/text/html/HTML.java
+++ b/libjava/classpath/javax/swing/text/html/HTML.java
@@ -945,22 +945,22 @@ public class HTML
* This tag is not included into the array, returned by getAllTags().
* toString() returns 'comment'. HTML reader synthesizes this tag.
*/
- public static final Tag COMMENT = new Tag("comment", SYNTETIC);
+ public static final Tag COMMENT = new Tag("comment", SYNTHETIC);
/**
* All text content is labeled with this tag.
* This tag is not included into the array, returned by getAllTags().
* toString() returns 'content'. HTML reader synthesizes this tag.
*/
- public static final Tag CONTENT = new Tag("content", SYNTETIC);
+ public static final Tag CONTENT = new Tag("content", SYNTHETIC);
/**
* All text content must be in a paragraph element.
* If a paragraph didn't exist when content was encountered,
* a paragraph is manufactured.
- * toString() returns 'implied'. HTML reader synthesizes this tag.
+ * toString() returns 'p-implied'. HTML reader synthesizes this tag.
*/
- public static final Tag IMPLIED = new Tag("implied", SYNTETIC);
+ public static final Tag IMPLIED = new Tag("p-implied", SYNTHETIC);
final String name;
final int flags;
@@ -1144,7 +1144,7 @@ public class HTML
*/
boolean isSyntetic()
{
- return (flags & SYNTETIC) != 0;
+ return (flags & SYNTHETIC) != 0;
}
private static void unexpected(Exception ex)
@@ -1185,7 +1185,7 @@ public class HTML
static final int BREAKS = 1;
static final int BLOCK = 2;
static final int PREFORMATTED = 4;
- static final int SYNTETIC = 8;
+ static final int SYNTHETIC = 8;
private static Map tagMap;
private static Map attrMap;
@@ -1196,6 +1196,7 @@ public class HTML
*/
public HTML()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/HTMLDocument.java b/libjava/classpath/javax/swing/text/html/HTMLDocument.java
index a95e496ec4d..d048a04e614 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLDocument.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLDocument.java
@@ -38,7 +38,14 @@ exception statement from your version. */
package javax.swing.text.html;
+import java.net.URL;
+
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.AttributeSet;
import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.Element;
+import javax.swing.text.ElementIterator;
+import javax.swing.text.html.HTML.Tag;
/**
* TODO: This class is not yet completetely implemented.
@@ -47,7 +54,215 @@ import javax.swing.text.DefaultStyledDocument;
*/
public class HTMLDocument extends DefaultStyledDocument
{
+ /** A key for document properies. The value for the key is
+ * a Vector of Strings of comments not found in the body.
+ */
+ public static final String AdditionalComments = "AdditionalComments";
+ URL baseURL = null;
+ boolean preservesUnknownTags = true;
+
+ /**
+ * Returns the location against which to resolve relative URLs.
+ * This is the document's URL if the document was loaded from a URL.
+ * If a <code>base</code> tag is found, it will be used.
+ * @return the base URL
+ */
+ public URL getBase()
+ {
+ return baseURL;
+ }
+
+ /**
+ * Sets the location against which to resolve relative URLs.
+ * @param u the new base URL
+ */
+ public void setBase(URL u)
+ {
+ baseURL = u;
+ //TODO: also set the base of the StyleSheet
+ }
+
+ /**
+ * Returns whether or not the parser preserves unknown HTML tags.
+ * @return true if the parser preserves unknown tags
+ */
+ public boolean getPreservesUnknownTags()
+ {
+ return preservesUnknownTags;
+ }
+
+ /**
+ * Sets the behaviour of the parser when it encounters unknown HTML tags.
+ * @param preservesTags true if the parser should preserve unknown tags.
+ */
+ public void setPreservesUnknownTags(boolean preservesTags)
+ {
+ preservesUnknownTags = preservesTags;
+ }
+
+ /**
+ * An iterator to iterate through LeafElements in the document.
+ */
+ class LeafIterator extends Iterator
+ {
+ HTML.Tag tag;
+ HTMLDocument doc;
+ ElementIterator it;
+
+ public LeafIterator (HTML.Tag t, HTMLDocument d)
+ {
+ doc = d;
+ tag = t;
+ it = new ElementIterator(doc);
+ }
+
+ /**
+ * Return the attributes for the tag associated with this iteartor
+ * @return the AttributeSet
+ */
+ public AttributeSet getAttributes()
+ {
+ if (it.current() != null)
+ return it.current().getAttributes();
+ return null;
+ }
+
+ /**
+ * Get the end of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the end of the range
+ */
+ public int getEndOffset()
+ {
+ if (it.current() != null)
+ return it.current().getEndOffset();
+ return -1;
+ }
+
+ /**
+ * Get the start of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the start of the range (-1 if it can't be found).
+ */
+
+ public int getStartOffset()
+ {
+ if (it.current() != null)
+ return it.current().getStartOffset();
+ return -1;
+ }
+
+ /**
+ * Advance the iterator to the next LeafElement .
+ */
+ public void next()
+ {
+ it.next();
+ while (it.current()!= null && !it.current().isLeaf())
+ it.next();
+ }
+
+ /**
+ * Indicates whether or not the iterator currently represents an occurrence
+ * of the tag.
+ * @return true if the iterator currently represents an occurrence of the
+ * tag.
+ */
+ public boolean isValid()
+ {
+ return it.current() != null;
+ }
+
+ /**
+ * Type of tag for this iterator.
+ */
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ }
+
public void processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent event)
{
+ // TODO: Implement this properly.
+ }
+
+ /**
+ * Gets an iterator for the given HTML.Tag.
+ * @param t the requested HTML.Tag
+ * @return the Iterator
+ */
+ public HTMLDocument.Iterator getIterator (HTML.Tag t)
+ {
+ return new HTMLDocument.LeafIterator(t, this);
+ }
+
+ /**
+ * An iterator over a particular type of tag.
+ */
+ public abstract static class Iterator
+ {
+ /**
+ * Return the attribute set for this tag.
+ * @return the <code>AttributeSet</code> (null if none found).
+ */
+ public abstract AttributeSet getAttributes();
+
+ /**
+ * Get the end of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the end of the range
+ */
+ public abstract int getEndOffset();
+
+ /**
+ * Get the start of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the start of the range (-1 if it can't be found).
+ */
+ public abstract int getStartOffset();
+
+ /**
+ * Move the iterator forward.
+ */
+ public abstract void next();
+
+ /**
+ * Indicates whether or not the iterator currently represents an occurrence
+ * of the tag.
+ * @return true if the iterator currently represents an occurrence of the
+ * tag.
+ */
+ public abstract boolean isValid();
+
+ /**
+ * Type of tag this iterator represents.
+ * @return the tag.
+ */
+ public abstract HTML.Tag getTag();
+ }
+
+ public class BlockElement extends AbstractDocument.BranchElement
+ {
+ public BlockElement (Element parent, AttributeSet a)
+ {
+ super (parent, a);
+ }
+
+ /**
+ * Gets the resolving parent. Since HTML attributes are not
+ * inherited at the model level, this returns null.
+ */
+ public AttributeSet getResolveParent()
+ {
+ return null;
+ }
+
+ public String getName()
+ {
+ //FIXME: this is supposed to do something different from the super class
+ return super.getName();
+ }
}
}
diff --git a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
index c0182fe6ac9..5189c777539 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
@@ -43,8 +43,10 @@ import java.io.Reader;
import java.io.Serializable;
import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.parser.ParserDelegator;
/**
* This class is NOT implemented. This file currently holds only
@@ -96,9 +98,9 @@ public class HTMLEditorKit
/**
* The parser calls this method after it finishes parsing the document.
*/
- public void flush()
- throws BadLocationException
+ public void flush() throws BadLocationException
{
+ // TODO: What to do here, if anything?
}
/**
@@ -108,6 +110,7 @@ public class HTMLEditorKit
*/
public void handleComment(char[] comment, int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -118,6 +121,7 @@ public class HTMLEditorKit
*/
public void handleEndOfLineString(String end_of_line)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -129,6 +133,7 @@ public class HTMLEditorKit
*/
public void handleEndTag(HTML.Tag tag, int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -139,6 +144,7 @@ public class HTMLEditorKit
*/
public void handleError(String message, int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -149,9 +155,9 @@ public class HTMLEditorKit
* @param position The tag position in the text being parsed.
*/
public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes,
- int position
- )
+ int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -165,6 +171,7 @@ public class HTMLEditorKit
int position
)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -174,6 +181,7 @@ public class HTMLEditorKit
*/
public void handleText(char[] text, int position)
{
+ // TODO: What to do here, if anything?
}
}
@@ -247,4 +255,26 @@ public class HTMLEditorKit
* The "ident paragraph right" action.
*/
public static final String PARA_INDENT_RIGHT = "html-para-indent-right";
+
+ /**
+ * Create a text storage model for this type of editor.
+ *
+ * @return the model
+ */
+ public Document createDefaultDocument()
+ {
+ HTMLDocument document = new HTMLDocument();
+ return document;
+ }
+
+ /**
+ * Get the parser that this editor kit uses for reading HTML streams. This
+ * method can be overridden to use the alternative parser.
+ *
+ * @return the HTML parser (by default, {@link ParserDelegator}).
+ */
+ protected Parser getParser()
+ {
+ return new ParserDelegator();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java b/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java
index dc0ab10a8f7..e146965d778 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java
@@ -41,7 +41,6 @@ package javax.swing.text.html;
import java.net.URL;
import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.text.Element;
/**
@@ -50,8 +49,7 @@ import javax.swing.text.Element;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class HTMLFrameHyperlinkEvent
- extends HyperlinkEvent
+public class HTMLFrameHyperlinkEvent extends HyperlinkEvent
{
private final String target_frame;
diff --git a/libjava/classpath/javax/swing/text/html/parser/ContentModel.java b/libjava/classpath/javax/swing/text/html/parser/ContentModel.java
index deb7b1602bb..70e9c2acbff 100644
--- a/libjava/classpath/javax/swing/text/html/parser/ContentModel.java
+++ b/libjava/classpath/javax/swing/text/html/parser/ContentModel.java
@@ -95,9 +95,12 @@ public final class ContentModel
*/
public int type;
- /** Create a content model initializing all fields to default values. */
+ /**
+ * Create a content model initializing all fields to default values.
+ */
public ContentModel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/parser/DTD.java b/libjava/classpath/javax/swing/text/html/parser/DTD.java
index f17ca011ea0..16bc5b0d6af 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DTD.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DTD.java
@@ -81,8 +81,9 @@ public class DTD
{
/**
* The version of the persistent data format.
+ * @specnote This was made <code>final</code> in 1.5.
*/
- public static int FILE_VERSION = 1;
+ public static final int FILE_VERSION = 1;
/**
* The table of existing available DTDs.
@@ -590,8 +591,7 @@ public class DTD
* @param name the name of the entity
* @param type the type of the entity, a bitwise combination
* of GENERAL, PARAMETER, SYSTEM and PUBLIC.
- * @throws an error if the parameter is both GENERAL and PARAMETER
- * of both PUBLIC and SYSTEM.
+ *
* @return the created entity
*/
private Entity newEntity(String name, int type)
diff --git a/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java b/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
index 164297f1882..062606d17ba 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
@@ -168,6 +168,7 @@ public class DocumentParser
* specific packages, write your own DTD or obtain the working instance
* of parser in other way, for example, by calling
* {@link javax.swing.text.html.HTMLEditorKit#getParser()}.
+ *
* @param a_dtd a DTD to use.
*/
public DocumentParser(DTD a_dtd)
@@ -212,6 +213,7 @@ public class DocumentParser
*/
protected void handleComment(char[] comment)
{
+ // This default implementation does nothing.
}
/**
@@ -224,6 +226,7 @@ public class DocumentParser
protected void handleEmptyTag(TagElement tag)
throws javax.swing.text.ChangedCharSetException
{
+ // This default implementation does nothing.
}
/**
@@ -234,11 +237,13 @@ public class DocumentParser
*/
protected void handleEndTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/* Handle error that has occured in the given line. */
protected void handleError(int line, String message)
{
+ // This default implementation does nothing.
}
/**
@@ -249,6 +254,7 @@ public class DocumentParser
*/
protected void handleStartTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/**
@@ -257,5 +263,6 @@ public class DocumentParser
*/
protected void handleText(char[] text)
{
+ // This default implementation does nothing.
}
}
diff --git a/libjava/classpath/javax/swing/text/html/parser/Element.java b/libjava/classpath/javax/swing/text/html/parser/Element.java
index 098983c6923..c07c07f5426 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Element.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Element.java
@@ -148,10 +148,10 @@ public final class Element
/**
* The default constructor must have package level access in this
* class. Use DTD.defineElement(..) to create an element when required.
- * @todo MAKE THIS PACKAGE in the final version. Now the Parser needs it!
*/
Element()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/parser/Parser.java b/libjava/classpath/javax/swing/text/html/parser/Parser.java
index 7ff6853da82..a88e9ce1953 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Parser.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Parser.java
@@ -256,6 +256,7 @@ public class Parser
*/
protected void endTag(boolean omitted)
{
+ // This default implementation does nothing.
}
/**
@@ -310,6 +311,7 @@ public class Parser
*/
protected void handleComment(char[] comment)
{
+ // This default implementation does nothing.
}
/**
@@ -333,6 +335,7 @@ public class Parser
protected void handleEmptyTag(TagElement tag)
throws ChangedCharSetException
{
+ // This default implementation does nothing.
}
/**
@@ -343,11 +346,13 @@ public class Parser
*/
protected void handleEndTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/* Handle error that has occured in the given line. */
protected void handleError(int line, String message)
{
+ // This default implementation does nothing.
}
/**
@@ -358,6 +363,7 @@ public class Parser
*/
protected void handleStartTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/**
@@ -376,6 +382,7 @@ public class Parser
*/
protected void handleText(char[] text)
{
+ // This default implementation does nothing.
}
/**
@@ -387,6 +394,7 @@ public class Parser
*/
protected void handleTitle(char[] title)
{
+ // This default implementation does nothing.
}
/**
@@ -420,6 +428,7 @@ public class Parser
*/
protected void markFirstTime(Element element)
{
+ // This default implementation does nothing.
}
/**
@@ -432,5 +441,6 @@ public class Parser
protected void startTag(TagElement tag)
throws ChangedCharSetException
{
+ // This default implementation does nothing.
}
}
diff --git a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
index e709e2a0449..d9747729317 100644
--- a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
+++ b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
@@ -45,7 +45,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.NoSuchElementException;
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
index 7a44e738338..2891a778ee9 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
@@ -47,7 +47,6 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
-import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
@@ -56,12 +55,8 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.EventObject;
-import javax.swing.CellRendererPane;
import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
@@ -354,9 +349,9 @@ public class DefaultTreeCellEditor
/**
* Configures the editing component whenever it is null.
*
- * @param tree- the tree to configure to component for.
- * @param renderer- the renderer used to set up the nodes
- * @param editor- the editor used
+ * @param tree the tree to configure to component for.
+ * @param renderer the renderer used to set up the nodes
+ * @param editor the editor used
*/
private void configureEditingComponent(JTree tree,
DefaultTreeCellRenderer renderer,
@@ -513,6 +508,8 @@ public class DefaultTreeCellEditor
// Cell may not be currently editable, but may need to start timer.
if (shouldStartEditingTimer(event))
startEditingTimer();
+ else if (timer.isRunning())
+ timer.stop();
return false;
}
@@ -605,7 +602,7 @@ public class DefaultTreeCellEditor
/**
* Messaged when the timer fires, this will start the editing session.
*
- * @param @param e - the event that characterizes the action.
+ * @param e the event that characterizes the action.
*/
public void actionPerformed(ActionEvent e)
{
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
index 4a353b30176..d1cb9c0e8b7 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -419,8 +419,7 @@ public class DefaultTreeCellRenderer
super.setBackground(getBackgroundSelectionColor());
setForeground(getTextSelectionColor());
- if (tree.getLeadSelectionPath() == null ||
- (tree.getLeadSelectionPath().getLastPathComponent()).equals(val))
+ if (hasFocus)
setBorderSelectionColor(UIManager.getLookAndFeelDefaults().
getColor("Tree.selectionBorderColor"));
else
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeModel.java b/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
index 5b5e0391478..5cf80986061 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
@@ -299,6 +299,7 @@ public class DefaultTreeModel
public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent,
int index)
{
+ newChild.setParent(parent);
parent.insert(newChild, index);
int[] childIndices = new int[1];
childIndices[0] = index;
diff --git a/libjava/classpath/javax/swing/tree/TreeCellRenderer.java b/libjava/classpath/javax/swing/tree/TreeCellRenderer.java
index ebbe3fa9133..a1808c9ee91 100644
--- a/libjava/classpath/javax/swing/tree/TreeCellRenderer.java
+++ b/libjava/classpath/javax/swing/tree/TreeCellRenderer.java
@@ -46,22 +46,24 @@ import javax.swing.JTree;
* TreeCellRenderer public interface
* @author Andrew Selkirk
*/
-public interface TreeCellRenderer {
+public interface TreeCellRenderer
+{
- /**
- * getTreeCellRendererComponent
- * @param tree TODO
- * @param value TODO
- * @param selected TODO
- * @param expanded TODO
- * @param leaf TODO
- * @param row TODO
- * @param us TODO
- * @returns TODO
- */
- Component getTreeCellRendererComponent(JTree tree,
- Object value, boolean selected, boolean expanded,
- boolean leaf, int row, boolean hasFocus);
+ /**
+ * getTreeCellRendererComponent
+ * @param tree TODO
+ * @param value TODO
+ * @param selected TODO
+ * @param expanded TODO
+ * @param leaf TODO
+ * @param row TODO
+ * @param hasFocus TODO
+ * @returns TODO
+ */
+ Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded,
+ boolean leaf, int row,
+ boolean hasFocus);
-} // TreeCellRenderer
+}
diff --git a/libjava/classpath/javax/swing/tree/TreeModel.java b/libjava/classpath/javax/swing/tree/TreeModel.java
index 759aaac588c..ec1884efdb7 100644
--- a/libjava/classpath/javax/swing/tree/TreeModel.java
+++ b/libjava/classpath/javax/swing/tree/TreeModel.java
@@ -44,66 +44,62 @@ import javax.swing.event.TreeModelListener;
* TreeModel public interface
* @author Andrew Selkirk
*/
-public interface TreeModel {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getRoot
- * @returns Object
- */
- Object getRoot();
-
- /**
- * getChild
- * @param parent TODO
- * @param index TODO
- * @returns Object
- */
- Object getChild(Object parent, int index);
-
- /**
- * getChildCount
- * @param parent TODO
- * @returns int
- */
- int getChildCount(Object parent);
-
- /**
- * isLeaf
- * @param node TODO
- * @returns boolean
- */
- boolean isLeaf(Object node);
-
- /**
- * valueForPathChanged
- * @param path TODO
- * @param newvalue TODO
- */
- void valueForPathChanged(TreePath path, Object newvalue);
-
- /**
- * getIndexOfChild
- * @param parent TODO
- * @param ild TODO
- * @returns int
- */
- int getIndexOfChild(Object parent, Object child);
-
- /**
- * addTreeModelListener
- * @param listener TODO
- */
- void addTreeModelListener(TreeModelListener listener);
-
- /**
- * removeTreeModelListener
- * @param listener TODO
- */
- void removeTreeModelListener(TreeModelListener listener);
-
-
-} // TreeModel
+public interface TreeModel
+{
+ /**
+ * getRoot
+ * @returns Object
+ */
+ Object getRoot();
+
+ /**
+ * getChild
+ * @param parent TODO
+ * @param index TODO
+ * @returns Object
+ */
+ Object getChild(Object parent, int index);
+
+ /**
+ * getChildCount
+ * @param parent TODO
+ * @returns int
+ */
+ int getChildCount(Object parent);
+
+ /**
+ * isLeaf
+ * @param node TODO
+ * @returns boolean
+ */
+ boolean isLeaf(Object node);
+
+ /**
+ * valueForPathChanged
+ * @param path TODO
+ * @param newvalue TODO
+ */
+ void valueForPathChanged(TreePath path, Object newvalue);
+
+ /**
+ * getIndexOfChild
+ * @param parent TODO
+ * @param child TODO
+ * @returns int
+ */
+ int getIndexOfChild(Object parent, Object child);
+
+ /**
+ * addTreeModelListener
+ * @param listener TODO
+ */
+ void addTreeModelListener(TreeModelListener listener);
+
+ /**
+ * removeTreeModelListener
+ * @param listener TODO
+ */
+ void removeTreeModelListener(TreeModelListener listener);
+
+
+}
diff --git a/libjava/classpath/javax/swing/undo/CannotRedoException.java b/libjava/classpath/javax/swing/undo/CannotRedoException.java
index 7d70a38c2c8..5f22648350a 100644
--- a/libjava/classpath/javax/swing/undo/CannotRedoException.java
+++ b/libjava/classpath/javax/swing/undo/CannotRedoException.java
@@ -44,13 +44,13 @@ package javax.swing.undo;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class CannotRedoException
- extends RuntimeException
+public class CannotRedoException extends RuntimeException
{
/**
* Constructs a new instance of a <code>CannotRedoException</code>.
*/
public CannotRedoException()
{
+ super();
}
}
diff --git a/libjava/classpath/javax/swing/undo/CannotUndoException.java b/libjava/classpath/javax/swing/undo/CannotUndoException.java
index 9fc0ec3bd3a..8d08cda6853 100644
--- a/libjava/classpath/javax/swing/undo/CannotUndoException.java
+++ b/libjava/classpath/javax/swing/undo/CannotUndoException.java
@@ -53,5 +53,6 @@ public class CannotUndoException
*/
public CannotUndoException()
{
+ super();
}
}
diff --git a/libjava/classpath/javax/xml/namespace/QName.java b/libjava/classpath/javax/xml/namespace/QName.java
index 7b8b194c33c..19700b32e41 100644
--- a/libjava/classpath/javax/xml/namespace/QName.java
+++ b/libjava/classpath/javax/xml/namespace/QName.java
@@ -1,5 +1,5 @@
/* QName.java - An XML qualified name.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.xml.namespace;
+import java.io.Serializable;
+
import javax.xml.XMLConstants;
/**
@@ -47,14 +49,15 @@ import javax.xml.XMLConstants;
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
* @since 1.3
*/
-public class QName
+public class QName implements Serializable
{
+ private static final long serialVersionUID = 4418622981026545151L;
private final String namespaceURI;
private final String localPart;
private final String prefix;
- private final String qName;
- int hashCode = -1;
+ private transient String qName;
+ transient int hashCode = -1;
public QName(String namespaceURI, String localPart)
{
@@ -78,21 +81,6 @@ public class QName
this.namespaceURI = namespaceURI;
this.localPart = localPart;
this.prefix = prefix;
-
- StringBuffer buf = new StringBuffer();
- if (namespaceURI.length() > 0)
- {
- buf.append('{');
- buf.append(namespaceURI);
- buf.append('}');
- }
- if (prefix.length() > 0)
- {
- buf.append(prefix);
- buf.append(':');
- }
- buf.append(localPart);
- qName = buf.toString();
}
public QName(String localPart)
@@ -115,7 +103,7 @@ public class QName
return prefix;
}
- public boolean equals(Object obj)
+ public final boolean equals(Object obj)
{
if (obj instanceof QName)
{
@@ -129,19 +117,29 @@ public class QName
public final int hashCode()
{
if (hashCode == -1)
- {
- StringBuffer buf = new StringBuffer();
- buf.append('{');
- buf.append(namespaceURI);
- buf.append('}');
- buf.append(localPart);
- hashCode = buf.toString().hashCode();
- }
+ hashCode = localPart.hashCode() ^ namespaceURI.hashCode();
return hashCode;
}
- public String toString()
+ public synchronized String toString()
{
+ if (qName == null)
+ {
+ StringBuffer buf = new StringBuffer();
+ if (namespaceURI.length() > 0)
+ {
+ buf.append('{');
+ buf.append(namespaceURI);
+ buf.append('}');
+ }
+ if (prefix.length() > 0)
+ {
+ buf.append(prefix);
+ buf.append(':');
+ }
+ buf.append(localPart);
+ qName = buf.toString();
+ }
return qName;
}
diff --git a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
index b2153c2cbf9..81db3bed913 100644
--- a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
+++ b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
@@ -45,9 +45,8 @@ package javax.xml.transform;
public class TransformerConfigurationException
extends TransformerException
{
+ private static final long serialVersionUID = 1285547467942875745L;
- private SourceLocator locator;
-
/**
* Constructor with no detail message.
*/
@@ -96,8 +95,7 @@ public class TransformerConfigurationException
SourceLocator locator,
Throwable e)
{
- super(message, e);
- this.locator = locator;
+ super(message, locator, e);
}
}
diff --git a/libjava/classpath/javax/xml/transform/TransformerException.java b/libjava/classpath/javax/xml/transform/TransformerException.java
index a72ee1c2f56..3d97eda1bbb 100644
--- a/libjava/classpath/javax/xml/transform/TransformerException.java
+++ b/libjava/classpath/javax/xml/transform/TransformerException.java
@@ -47,9 +47,11 @@ import java.io.PrintWriter;
public class TransformerException
extends Exception
{
+ private static final long serialVersionUID = 975798773772956428L;
+ // Field names fixed by serialization spec.
private SourceLocator locator;
- private Throwable cause;
+ private Throwable containedException;
/**
* Constructor with a detail message.
@@ -94,7 +96,7 @@ public class TransformerException
if (cause != null)
{
initCause(cause);
- this.cause = cause;
+ this.containedException = cause;
}
}
@@ -119,7 +121,7 @@ public class TransformerException
*/
public Throwable getException()
{
- return cause;
+ return containedException;
}
/**
@@ -127,7 +129,7 @@ public class TransformerException
*/
public Throwable getCause()
{
- return cause;
+ return containedException;
}
/**
@@ -143,7 +145,7 @@ public class TransformerException
*/
public Throwable initCause(Throwable cause)
{
- if (this.cause != null)
+ if (this.containedException != null)
{
throw new IllegalStateException();
}
@@ -151,7 +153,7 @@ public class TransformerException
{
throw new IllegalArgumentException();
}
- this.cause = cause;
+ this.containedException = cause;
return this;
}
@@ -221,20 +223,20 @@ public class TransformerException
public void printStackTrace(PrintStream s)
{
super.printStackTrace(s);
- if (cause != null)
+ if (containedException != null)
{
s.print("caused by ");
- cause.printStackTrace(s);
+ containedException.printStackTrace(s);
}
}
public void printStackTrace(PrintWriter s)
{
super.printStackTrace(s);
- if (cause != null)
+ if (containedException != null)
{
s.print("caused by ");
- cause.printStackTrace(s);
+ containedException.printStackTrace(s);
}
}
diff --git a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
index 9b16b2b2e4c..82afeeac750 100644
--- a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
+++ b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
@@ -44,7 +44,9 @@ package javax.xml.transform;
public class TransformerFactoryConfigurationError
extends Error
{
+ private static final long serialVersionUID = -6527718720676281516L;
+ // Name is fixed by the serialization spec.
private final Exception exception;
/**
diff --git a/libjava/classpath/javax/xml/xpath/XPathException.java b/libjava/classpath/javax/xml/xpath/XPathException.java
index 030d0a9c1d7..cf004c1791e 100644
--- a/libjava/classpath/javax/xml/xpath/XPathException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathException.java
@@ -49,7 +49,9 @@ import java.io.PrintWriter;
public class XPathException
extends Exception
{
+ private static final long serialVersionUID = -1837080260374986980L;
+ // Name is fixed by serialization spec.
Throwable cause;
public XPathException(String message)
diff --git a/libjava/classpath/javax/xml/xpath/XPathExpressionException.java b/libjava/classpath/javax/xml/xpath/XPathExpressionException.java
index 91716f1502f..6257adb474b 100644
--- a/libjava/classpath/javax/xml/xpath/XPathExpressionException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathExpressionException.java
@@ -46,6 +46,7 @@ package javax.xml.xpath;
public class XPathExpressionException
extends XPathException
{
+ private static final long serialVersionUID = -1837080260374986980L;
public XPathExpressionException(String message)
{
diff --git a/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java b/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java
index a89646336d8..0fc68a7634b 100644
--- a/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java
@@ -46,6 +46,7 @@ package javax.xml.xpath;
public class XPathFactoryConfigurationException
extends XPathException
{
+ private static final long serialVersionUID = -1837080260374986980L;
public XPathFactoryConfigurationException(String message)
{
diff --git a/libjava/classpath/javax/xml/xpath/XPathFunctionException.java b/libjava/classpath/javax/xml/xpath/XPathFunctionException.java
index ebc8ce7d341..db680ae65da 100644
--- a/libjava/classpath/javax/xml/xpath/XPathFunctionException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathFunctionException.java
@@ -46,6 +46,7 @@ package javax.xml.xpath;
public class XPathFunctionException
extends XPathExpressionException
{
+ private static final long serialVersionUID = -1837080260374986980L;
public XPathFunctionException(String message)
{
diff --git a/libjava/classpath/lib/Makefile.am b/libjava/classpath/lib/Makefile.am
index ada3b2bc95e..9d44ef0c531 100644
--- a/libjava/classpath/lib/Makefile.am
+++ b/libjava/classpath/lib/Makefile.am
@@ -29,7 +29,7 @@ if FOUND_GCJX
JAVAC = $(GCJX) -encoding UTF-8 -classpath .:$(USER_CLASSLIB) -d . @classes
else
if FOUND_ECJ
-JAVAC = $(ECJ) -encoding UTF-8 -warn:none -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+JAVAC = $(ECJ) -source 1.4 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
endif # FOUND_ECJ
endif # FOUND_GCJX
endif # FOUND_KJC
@@ -40,7 +40,7 @@ JAVAH = $(USER_JAVAH) -jni -classpath .:$(USER_CLASSLIB)
if INSTALL_GLIBJ_ZIP
-pkgdata_DATA = glibj.zip
+glibj_DATA = glibj.zip
endif # INSTALL_GLIBJ_ZIP
@@ -73,7 +73,7 @@ endif # INSTALL_CLASS_FILES
glibj.zip: classes compile-classes resources
if test "$(ZIP)" != ""; then $(ZIP) -r -D glibj.zip gnu java javax org META-INF > /dev/null; fi
-resources:
+resources: copy-vmresources.sh
if ! [ -e gnu ]; then mkdir gnu; fi
if ! [ -e gnu/java ]; then mkdir gnu/java; fi
if ! [ -e gnu/java/locale ]; then mkdir gnu/java/locale; fi
@@ -87,6 +87,7 @@ resources:
@list='$(metafiles)'; for p in $$list; do \
cp $(top_srcdir)/resource/$$p $$p; \
done
+ @$(SHELL) ./copy-vmresources.sh
@list='$(iconfiles)'; for p in $$list; do \
cp $(top_srcdir)/$$p $$p; \
done
@@ -145,6 +146,7 @@ clean-local:
-rm -rf java
-rm -rf javax
-rm -rf org
+ -rm -rf com
-rm -rf META-INF
-rm -rf lists
-rm -f Makefile.deps
diff --git a/libjava/classpath/lib/Makefile.in b/libjava/classpath/lib/Makefile.in
index c205407eaff..08db2de8eb9 100644
--- a/libjava/classpath/lib/Makefile.in
+++ b/libjava/classpath/lib/Makefile.in
@@ -39,12 +39,10 @@ host_triplet = @host@
target_triplet = @target@
subdir = lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/gen-classlist.sh.in
+ $(srcdir)/copy-vmresources.sh.in $(srcdir)/gen-classlist.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -53,7 +51,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES = gen-classlist.sh
+CONFIG_CLEAN_FILES = gen-classlist.sh copy-vmresources.sh
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -62,9 +60,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkgdatadir)"
-pkgdataDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(noinst_DATA) $(pkgdata_DATA)
+am__installdirs = "$(DESTDIR)$(glibjdir)"
+glibjDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(glibj_DATA) $(noinst_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
@@ -86,10 +84,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -226,6 +228,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -239,6 +242,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -257,7 +261,7 @@ propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org -name
metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -type f -print)
iconfiles := $(shell cd $(top_srcdir) && $(FIND) gnu/javax/swing/plaf/gtk/icons -name *.png -type f -print)
compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:.:$(USER_CLASSLIB)
-@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(ECJ) -encoding UTF-8 -warn:none -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(ECJ) -source 1.4 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
@FOUND_GCJX_TRUE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(GCJX) -encoding UTF-8 -classpath .:$(USER_CLASSLIB) -d . @classes
@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_TRUE@JAVAC = $(KJC) -classpath .:$(USER_CLASSLIB) -d . @classes
@FOUND_GCJ_FALSE@@FOUND_JIKES_TRUE@JAVAC = $(JIKES) +Pno-shadow +Pno-switchcheck +F $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(compile_classpath) -d . @classes
@@ -265,7 +269,7 @@ compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$
# handling source to bytecode compiler programs like gcj, jikes and kjc
@FOUND_GCJ_TRUE@JAVAC = exit 1
JAVAH = $(USER_JAVAH) -jni -classpath .:$(USER_CLASSLIB)
-@INSTALL_GLIBJ_ZIP_TRUE@pkgdata_DATA = glibj.zip
+@INSTALL_GLIBJ_ZIP_TRUE@glibj_DATA = glibj.zip
@BUILD_CLASS_FILES_TRUE@noinst_DATA = genclasses compile-classes resources
EXTRA_DIST = standard.omit mkcollections.pl.in Makefile.gcj split-for-gcj.sh
CLEANFILES = compile-classes resources classes \
@@ -307,6 +311,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
gen-classlist.sh: $(top_builddir)/config.status $(srcdir)/gen-classlist.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+copy-vmresources.sh: $(top_builddir)/config.status $(srcdir)/copy-vmresources.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@@ -317,22 +323,22 @@ clean-libtool:
distclean-libtool:
-rm -f libtool
uninstall-info-am:
-install-pkgdataDATA: $(pkgdata_DATA)
+install-glibjDATA: $(glibj_DATA)
@$(NORMAL_INSTALL)
- test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
- @list='$(pkgdata_DATA)'; for p in $$list; do \
+ test -z "$(glibjdir)" || $(mkdir_p) "$(DESTDIR)$(glibjdir)"
+ @list='$(glibj_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
- echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
- $(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
+ echo " $(glibjDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(glibjdir)/$$f'"; \
+ $(glibjDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(glibjdir)/$$f"; \
done
-uninstall-pkgdataDATA:
+uninstall-glibjDATA:
@$(NORMAL_UNINSTALL)
- @list='$(pkgdata_DATA)'; for p in $$list; do \
+ @list='$(glibj_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
- rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
+ echo " rm -f '$(DESTDIR)$(glibjdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(glibjdir)/$$f"; \
done
tags: TAGS
TAGS:
@@ -375,7 +381,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(pkgdatadir)"; do \
+ for dir in "$(DESTDIR)$(glibjdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -423,7 +429,7 @@ info: info-am
info-am:
-install-data-am: install-data-local install-pkgdataDATA
+install-data-am: install-data-local install-glibjDATA
install-exec-am:
@@ -449,18 +455,19 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-local uninstall-pkgdataDATA
+uninstall-am: uninstall-glibjDATA uninstall-info-am uninstall-local
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
clean-local dist-hook distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
- install-data-local install-exec install-exec-am install-info \
- install-info-am install-man install-pkgdataDATA install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
- uninstall-info-am uninstall-local uninstall-pkgdataDATA
+ install-data-local install-exec install-exec-am \
+ install-glibjDATA install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-glibjDATA uninstall-info-am \
+ uninstall-local
sinclude $(JAVA_DEPEND)
@@ -486,7 +493,7 @@ sinclude $(JAVA_DEPEND)
glibj.zip: classes compile-classes resources
if test "$(ZIP)" != ""; then $(ZIP) -r -D glibj.zip gnu java javax org META-INF > /dev/null; fi
-resources:
+resources: copy-vmresources.sh
if ! [ -e gnu ]; then mkdir gnu; fi
if ! [ -e gnu/java ]; then mkdir gnu/java; fi
if ! [ -e gnu/java/locale ]; then mkdir gnu/java/locale; fi
@@ -500,6 +507,7 @@ resources:
@list='$(metafiles)'; for p in $$list; do \
cp $(top_srcdir)/resource/$$p $$p; \
done
+ @$(SHELL) ./copy-vmresources.sh
@list='$(iconfiles)'; for p in $$list; do \
cp $(top_srcdir)/$$p $$p; \
done
@@ -541,6 +549,7 @@ clean-local:
-rm -rf java
-rm -rf javax
-rm -rf org
+ -rm -rf com
-rm -rf META-INF
-rm -rf lists
-rm -f Makefile.deps
diff --git a/libjava/classpath/lib/copy-vmresources.sh.in b/libjava/classpath/lib/copy-vmresources.sh.in
new file mode 100644
index 00000000000..9c3e882b250
--- /dev/null
+++ b/libjava/classpath/lib/copy-vmresources.sh.in
@@ -0,0 +1,41 @@
+#! @SHELL@
+# @configure_input@
+
+top_srcdir=@top_srcdir@
+vmdirs=`echo "@vm_classes@" | sed 's%:% %g'`
+destMetaDir=`pwd`/META-INF
+destResDir=`pwd`
+
+for p in ${vmdirs}; do
+ if test -d $p/META-INF; then
+ (cd $p/META-INF;
+ dirs=`find -name "CVS" -prune -o -type d -print`;
+ for u in ${dirs}; do
+ mkdir -p ${destMetaDir}/${u};
+ done;
+ files=`find -name "CVS" -prune -o -type f -print`;
+ for u in ${files}; do
+ cp ${u} ${destMetaDir}/${u};
+ done
+ );
+ fi;
+
+ (cd ${p};
+ resfiles=`find ${p} -name "*.properties"`
+ resdirs=
+ for i in ${resfiles}; do
+ a=`basename ${i}`;
+ b=`echo ${i} | sed "s%${a}%%g"`;
+ resdirs="${resdirs} ${b}";
+ done;
+ resnewdirs=`echo ${resdirs} | uniq`;
+
+ for u in ${resnewdirs}; do
+ mkdir -p ${destResDir}/${u};
+ done
+
+ for f in ${resfiles}; do
+ echo ${f} ${destResDir}/${f};
+ done
+ )
+done
diff --git a/libjava/classpath/lib/gen-classlist.sh.in b/libjava/classpath/lib/gen-classlist.sh.in
index 12845f2ccee..2f2dfc8a828 100755
--- a/libjava/classpath/lib/gen-classlist.sh.in
+++ b/libjava/classpath/lib/gen-classlist.sh.in
@@ -2,6 +2,8 @@
# @configure_input@
# Make sure sorting is done the same on all configurations
+# Note the use of sort -r below. This is done explicitly to work around
+# a gcj bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21418)
LC_ALL=C; export LC_ALL
LANG=C; export LANG
@@ -12,7 +14,7 @@ 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 \
- -follow -type f -print | sort | grep '\.java$' \
+ -follow -type f -print | sort -r | grep '\.java$' \
> ${top_builddir}/lib/classes.1
# Generate files for the VM classes.
@@ -22,7 +24,7 @@ vm_dirlist=`echo "@vm_classes@" | sed -e 's/:/ /g'`
echo "Adding java source files from VM directory $vm_dirlist"
for dir in $vm_dirlist; do
(cd $dir
- for subdir in java javax gnu org; do
+ for subdir in java javax gnu org com; do
if test -d $subdir; then
@FIND@ $subdir -name '*.java' -print
fi
diff --git a/libjava/classpath/lib/split-for-gcj.sh b/libjava/classpath/lib/split-for-gcj.sh
index 0f5ffaff285..f69b7979728 100755
--- a/libjava/classpath/lib/split-for-gcj.sh
+++ b/libjava/classpath/lib/split-for-gcj.sh
@@ -31,7 +31,7 @@ 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'`
+ 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
diff --git a/libjava/classpath/lib/standard.omit b/libjava/classpath/lib/standard.omit
index c95c4ed95b6..a518f7df828 100644
--- a/libjava/classpath/lib/standard.omit
+++ b/libjava/classpath/lib/standard.omit
@@ -1,4 +1 @@
../gnu/test/.*$
-../gnu/classpath/jdwp/.*$
-../gnu/xml/stream/.*$
-../javax/xml/stream/.*$
diff --git a/libjava/classpath/ltmain.sh b/libjava/classpath/ltmain.sh
index 9882b46c96b..474423aaf10 100644
--- a/libjava/classpath/ltmain.sh
+++ b/libjava/classpath/ltmain.sh
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -829,6 +829,7 @@ EOF
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
+ inst_prefix_dir=
avoid_version=no
dlfiles=
@@ -961,6 +962,11 @@ EOF
prev=
continue
;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
release)
release="-$arg"
prev=
@@ -1187,6 +1193,11 @@ EOF
continue
;;
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
@@ -2171,6 +2182,14 @@ EOF
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
@@ -2229,6 +2248,14 @@ EOF
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
add="-l$name"
fi
@@ -4460,7 +4487,7 @@ fi\
for tag in $taglist; do
tagopts="$tagopts --tag $tag"
done
- relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
+ relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
# Only create the output if not a dry run.
@@ -4761,6 +4788,27 @@ relink_command=\"$relink_command\""
dir="$dir$objdir"
if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit 1
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+ fi
+
$echo "$modename: warning: relinking \`$file'" 1>&2
$show "$relink_command"
if $run eval "$relink_command"; then :
diff --git a/libjava/classpath/m4/acattribute.m4 b/libjava/classpath/m4/acattribute.m4
new file mode 100644
index 00000000000..7b490d4b7cb
--- /dev/null
+++ b/libjava/classpath/m4/acattribute.m4
@@ -0,0 +1,25 @@
+dnl modified AC_C_INLINE from autoconf/c.m4
+
+AN_IDENTIFIER([attribute], [AC_C_ATTRIBUTE])
+AC_DEFUN([AC_C_ATTRIBUTE],
+[AC_CACHE_CHECK([for __attribute__], ac_cv_c_attribute,
+[
+AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[void foo(void) __attribute__ ((__noreturn__));]
+)],
+[ac_cv_c_attribute=yes],
+[ac_cv_c_attribute=no]
+)
+])
+AH_VERBATIM([attribute],
+[/* Define to `__attribute__' to nothing if it's not supported. */
+#undef __attribute__])
+case $ac_cv_c_attribute in
+ yes) ;;
+ no)
+ cat >>confdefs.h <<_ACEOF
+#define __attribute__(x) /* nothing */
+_ACEOF
+ ;;
+esac
+])# AC_C_ATTRIBUTE
diff --git a/libjava/classpath/m4/acinclude.m4 b/libjava/classpath/m4/acinclude.m4
index e05a2f8e7b5..e41321f89f3 100644
--- a/libjava/classpath/m4/acinclude.m4
+++ b/libjava/classpath/m4/acinclude.m4
@@ -63,48 +63,23 @@ AC_DEFUN([CLASSPATH_CHECK_GCJ],
else
AC_PATH_PROG(GCJ, "gcj")
fi
-
+ dnl Test the given GCJ, but use it as C (!) compiler to check version
if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 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.
- AC_MSG_CHECKING(gcj version)
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^@<:@^0-9@:>@*//' -e 's/@<:@^.0-9@:>@@<:@^.0-9@:>@*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
- if test "x$GCJ" != x; then
- AC_MSG_RESULT($GCJ_VERSION)
+ AC_MSG_CHECKING([gcj version 4.0])
+ AC_LANG_PUSH([C])
+ AC_LANG_CONFTEST(
+ [[#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+ ]])
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ AC_MSG_RESULT([4.0 or higher found])
else
- AC_MSG_WARN($GCJ_VERSION: gcj 3.3 or higher required)
+ AC_MSG_WARN([4.0 or higher required])
fi
+ AC_LANG_POP
fi
])
diff --git a/libjava/classpath/native/Makefile.in b/libjava/classpath/native/Makefile.in
index b8c2b89fa1b..bfa05c800d2 100644
--- a/libjava/classpath/native/Makefile.in
+++ b/libjava/classpath/native/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -83,10 +81,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -223,6 +225,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -236,6 +239,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/fdlibm/Makefile.in b/libjava/classpath/native/fdlibm/Makefile.in
index b3a4577595d..5d53fa66bc4 100644
--- a/libjava/classpath/native/fdlibm/Makefile.in
+++ b/libjava/classpath/native/fdlibm/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/fdlibm
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -102,10 +100,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -242,6 +244,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -255,6 +258,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/fdlibm/java-assert.h b/libjava/classpath/native/fdlibm/java-assert.h
index 6f178bd9e98..ad512ad137a 100644
--- a/libjava/classpath/native/fdlibm/java-assert.h
+++ b/libjava/classpath/native/fdlibm/java-assert.h
@@ -1,4 +1,4 @@
-// java-assert.h - Header file holding assertion definitions. -*- c++ -*-
+/* java-assert.h - Header file holding assertion definitions. -*- c++ -*- */
/* Copyright (C) 1998, 1999 Free Software Foundation
@@ -11,7 +11,9 @@ details. */
#ifndef __JAVA_ASSERT_H__
#define __JAVA_ASSERT_H__
-// This is a libgcj implementation header.
+#include <config.h>
+
+/* This is a libgcj implementation header. */
void _Jv_Abort (const char *, const char *, int, const char *)
__attribute__ ((__noreturn__));
diff --git a/libjava/classpath/native/fdlibm/mprec.h b/libjava/classpath/native/fdlibm/mprec.h
index d796b81de82..f250619b022 100644
--- a/libjava/classpath/native/fdlibm/mprec.h
+++ b/libjava/classpath/native/fdlibm/mprec.h
@@ -291,7 +291,12 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
#define MAX_BIGNUMS 16
+#ifdef Pack_32
#define MAX_BIGNUM_WDS 32
+#else
+ /* Note that this is a workaround for */
+#define MAX_BIGNUM_WDS 128
+#endif
struct _Jv_Bigint
{
diff --git a/libjava/classpath/native/jawt/Makefile.in b/libjava/classpath/native/jawt/Makefile.in
index feb30904be1..1fa178b10d9 100644
--- a/libjava/classpath/native/jawt/Makefile.in
+++ b/libjava/classpath/native/jawt/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jawt
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -96,10 +94,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -236,6 +238,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -249,6 +252,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/jawt/jawt.c b/libjava/classpath/native/jawt/jawt.c
index 6d26a0da9f3..a4178685054 100644
--- a/libjava/classpath/native/jawt/jawt.c
+++ b/libjava/classpath/native/jawt/jawt.c
@@ -176,11 +176,11 @@ static void
static void
(JNICALL _Jv_AWTLock) (JNIEnv* env __attribute__((unused)))
{
- classpath_jawt_lock ();
+ /* FIXME: what is this supposed to do? */
}
static void
(JNICALL _Jv_AWTUnlock) (JNIEnv* env __attribute__((unused)))
{
- classpath_jawt_unlock ();
+ /* FIXME: what is this supposed to do? */
}
diff --git a/libjava/classpath/native/jni/Makefile.am b/libjava/classpath/native/jni/Makefile.am
index fce6b1a6f42..64cd35a5156 100644
--- a/libjava/classpath/native/jni/Makefile.am
+++ b/libjava/classpath/native/jni/Makefile.am
@@ -4,6 +4,14 @@ if CREATE_CORE_JNI_LIBRARIES
JNIDIRS = java-io java-lang java-net java-nio java-util
endif
+if CREATE_ALSA_LIBRARIES
+ ALSADIR = midi-alsa
+endif
+
+if CREATE_DSSI_LIBRARIES
+ DSSIDIR = midi-dssi
+endif
+
if CREATE_GTK_PEER_LIBRARIES
GTKDIR = gtk-peer
endif
@@ -16,9 +24,10 @@ if CREATE_XMLJ_LIBRARY
XMLJDIR = xmlj
endif
-SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
+SUBDIRS = classpath $(JNIDIRS) \
+ $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
- gtk-peer qt-peer xmlj
+ gtk-peer qt-peer xmlj midi-alsa midi-dssi
all-local:
cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh
diff --git a/libjava/classpath/native/jni/Makefile.in b/libjava/classpath/native/jni/Makefile.in
index 46ae0aaba0f..79d9fa7ab50 100644
--- a/libjava/classpath/native/jni/Makefile.in
+++ b/libjava/classpath/native/jni/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/jni
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -83,10 +81,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -223,6 +225,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -236,6 +239,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -249,12 +253,16 @@ target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
@CREATE_CORE_JNI_LIBRARIES_TRUE@JNIDIRS = java-io java-lang java-net java-nio java-util
+@CREATE_ALSA_LIBRARIES_TRUE@ALSADIR = midi-alsa
+@CREATE_DSSI_LIBRARIES_TRUE@DSSIDIR = midi-dssi
@CREATE_GTK_PEER_LIBRARIES_TRUE@GTKDIR = gtk-peer
@CREATE_QT_PEER_LIBRARIES_TRUE@CLASSPATH_QT_PEER_DIR = qt-peer
@CREATE_XMLJ_LIBRARY_TRUE@XMLJDIR = xmlj
-SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
+SUBDIRS = classpath $(JNIDIRS) \
+ $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
+
DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
- gtk-peer qt-peer xmlj
+ gtk-peer qt-peer xmlj midi-alsa midi-dssi
all: all-recursive
diff --git a/libjava/classpath/native/jni/classpath/Makefile.am b/libjava/classpath/native/jni/classpath/Makefile.am
index 2baa60abcdc..a26ab832bd2 100644
--- a/libjava/classpath/native/jni/classpath/Makefile.am
+++ b/libjava/classpath/native/jni/classpath/Makefile.am
@@ -5,7 +5,6 @@ noinst_LTLIBRARIES = libclasspath.la
libclasspath_la_SOURCES = jcl.c jcl.h \
jnilink.c jnilink.h \
- primlib.c primlib.h \
native_state.c native_state.h
AM_LDFLAGS = @CLASSPATH_MODULE@
diff --git a/libjava/classpath/native/jni/classpath/Makefile.in b/libjava/classpath/native/jni/classpath/Makefile.in
index 6180577ba31..9531df7673c 100644
--- a/libjava/classpath/native/jni/classpath/Makefile.in
+++ b/libjava/classpath/native/jni/classpath/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/classpath
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -57,8 +55,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libclasspath_la_LIBADD =
-am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo primlib.lo \
- native_state.lo
+am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo native_state.lo
libclasspath_la_OBJECTS = $(am_libclasspath_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -96,10 +93,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -236,6 +237,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -249,6 +251,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -267,7 +270,6 @@ EXTRA_DIST = classpath_jawt.h
noinst_LTLIBRARIES = libclasspath.la
libclasspath_la_SOURCES = jcl.c jcl.h \
jnilink.c jnilink.h \
- primlib.c primlib.h \
native_state.c native_state.h
AM_LDFLAGS = @CLASSPATH_MODULE@
@@ -327,7 +329,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jnilink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/native_state.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primlib.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff --git a/libjava/classpath/native/jni/classpath/jcl.c b/libjava/classpath/native/jni/classpath/jcl.c
index 4821770ed05..aacbe8900a2 100644
--- a/libjava/classpath/native/jni/classpath/jcl.c
+++ b/libjava/classpath/native/jni/classpath/jcl.c
@@ -1,5 +1,5 @@
/* jcl.c
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -193,7 +193,8 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
{
if (rawDataClass == NULL)
{
-#ifdef POINTERS_ARE_64BIT
+ jclass tmp;
+#if SIZEOF_VOID_P == 8
rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
if (rawDataClass == NULL)
{
@@ -243,17 +244,18 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
}
#endif
- (*env)->DeleteLocalRef(env, rawDataClass);
- rawDataClass = (*env)->NewGlobalRef (env, rawDataClass);
- if (rawDataClass == NULL)
+ tmp = (*env)->NewGlobalRef (env, rawDataClass);
+ if (tmp == NULL)
{
JCL_ThrowException (env, "java/lang/InternalError",
"unable to create an internal global ref");
return NULL;
}
+ (*env)->DeleteLocalRef(env, rawDataClass);
+ rawDataClass = tmp;
}
-#ifdef POINTERS_ARE_64BIT
+#if SIZEOF_VOID_P == 8
return (*env)->NewObject (env, rawDataClass, rawData_mid, (jlong) data);
#else
return (*env)->NewObject (env, rawDataClass, rawData_mid, (jint) data);
@@ -263,7 +265,7 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
JNIEXPORT void * JNICALL
JCL_GetRawData (JNIEnv * env, jobject rawdata)
{
-#ifdef POINTERS_ARE_64BIT
+#if SIZEOF_VOID_P == 8
return (void *) (*env)->GetLongField (env, rawdata, rawData_fid);
#else
return (void *) (*env)->GetIntField (env, rawdata, rawData_fid);
diff --git a/libjava/classpath/native/jni/classpath/primlib.c b/libjava/classpath/native/jni/classpath/primlib.c
deleted file mode 100644
index e6773ba5353..00000000000
--- a/libjava/classpath/native/jni/classpath/primlib.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/* primlib.c
- Copyright (C) 1998 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. */
-
-#include <jnilink.h>
-#include <primlib.h>
-#include <jcl.h>
-
-static jclass nativeWrapClass[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static jclass nativeTypeClass[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static jmethodID nativeWrapClassConstructor[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static jmethodID nativeWrapClassAccessor[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static const char *nativeWrapClassName[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "java/lang/Boolean",
- "java/lang/Byte",
- "java/lang/Character",
- "java/lang/Short",
- "java/lang/Integer",
- "java/lang/Long",
- "java/lang/Float",
- "java/lang/Double",
- "java/lang/Void",
- NULL
-};
-
-static const char *nativeWrapClassConstructorSig[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "(Z)V",
- "(B)V",
- "(C)V",
- "(S)V",
- "(I)V",
- "(J)V",
- "(F)V",
- "(D)V",
- "()V",
- NULL
-};
-
-static const char *nativeWrapClassAccessorName[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "booleanValue",
- "byteValue",
- "charValue",
- "shortValue",
- "intValue",
- "longValue",
- "floatValue",
- "doubleValue",
- NULL,
- NULL
-};
-
-static const char *nativeWrapClassAccessorSig[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "()Z",
- "()B",
- "()C",
- "()S",
- "()I",
- "()J",
- "()F",
- "()D",
- NULL,
- NULL
-};
-
-
-JNIEXPORT jclass JNICALL
-PRIMLIB_GetNativeWrapClass (JNIEnv * env, int reflectType)
-{
- return LINK_LinkClass (env, nativeWrapClass[reflectType],
- nativeWrapClassName[reflectType]);
-}
-
-static jclass
-ActuallyGetNativeTypeClass (JNIEnv * env, int reflectType)
-{
- jclass wrapClass;
- jfieldID typeField;
-
- wrapClass = PRIMLIB_GetNativeWrapClass (env, reflectType);
- if (wrapClass == NULL)
- return NULL;
- typeField =
- (*env)->GetStaticFieldID (env, wrapClass, "TYPE", "Ljava/lang/Class");
- if (typeField == NULL)
- return NULL;
- return (*env)->GetStaticObjectField (env, wrapClass, typeField);
-}
-
-JNIEXPORT jclass JNICALL
-PRIMLIB_GetNativeTypeClass (JNIEnv * env, int reflectType)
-{
- return LINK_LinkKnownClass (env, nativeTypeClass[reflectType],
- ActuallyGetNativeTypeClass (env, reflectType));
-}
-
-JNIEXPORT jmethodID JNICALL
-PRIMLIB_GetNativeWrapClassConstructor (JNIEnv * env, int reflectType)
-{
- PRIMLIB_GetNativeWrapClass (env, reflectType);
- return LINK_LinkConstructor (env, nativeWrapClassConstructor[reflectType],
- nativeWrapClass[reflectType],
- nativeWrapClassConstructorSig[reflectType]);
-}
-
-JNIEXPORT jmethodID JNICALL
-PRIMLIB_GetNativeWrapClassAccessor (JNIEnv * env, int reflectType)
-{
- PRIMLIB_GetNativeWrapClass (env, reflectType);
- return LINK_LinkMethod (env, nativeWrapClassAccessor[reflectType],
- nativeWrapClass[reflectType],
- nativeWrapClassAccessorName[reflectType],
- nativeWrapClassAccessorSig[reflectType]);
-}
-
-
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapBoolean (JNIEnv * env, jboolean b)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_BOOLEAN);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BOOLEAN),
- construct, b);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapByte (JNIEnv * env, jbyte b)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_BYTE);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE),
- construct, b);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapChar (JNIEnv * env, jchar c)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_CHAR);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR),
- construct, c);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapShort (JNIEnv * env, jshort s)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_SHORT);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT),
- construct, s);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapInt (JNIEnv * env, jint i)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_INT);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT),
- construct, i);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapLong (JNIEnv * env, jlong l)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_LONG);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG),
- construct, l);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapFloat (JNIEnv * env, jfloat f)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_FLOAT);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT),
- construct, f);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapDouble (JNIEnv * env, jdouble d)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_DOUBLE);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_DOUBLE),
- construct, d);
-}
-
-
-JNIEXPORT jboolean JNICALL
-PRIMLIB_UnwrapBoolean (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BOOLEAN)))
- {
- return PRIMLIB_GetBooleanObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return JNI_FALSE;
- }
-}
-
-JNIEXPORT jbyte JNICALL
-PRIMLIB_UnwrapByte (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jshort JNICALL
-PRIMLIB_UnwrapShort (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jshort) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jchar JNICALL
-PRIMLIB_UnwrapChar (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return PRIMLIB_GetCharObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_UnwrapInt (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jint) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jint) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jint) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jlong JNICALL
-PRIMLIB_UnwrapLong (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG)))
- {
- return PRIMLIB_GetLongObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return (jlong) PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jlong) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jlong) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jlong) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jfloat JNICALL
-PRIMLIB_UnwrapFloat (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT)))
- {
- return PRIMLIB_GetFloatObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG)))
- {
- return (jfloat) PRIMLIB_GetLongObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return (jfloat) PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jfloat) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jfloat) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jfloat) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jdouble JNICALL
-PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_DOUBLE)))
- {
- return PRIMLIB_GetDoubleObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT)))
- {
- return (jdouble) PRIMLIB_GetFloatObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG)))
- {
- return (jdouble) PRIMLIB_GetLongObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return (jdouble) PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jdouble) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jdouble) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jdouble) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_GetReflectiveWrapperType (JNIEnv * env, jobject obj)
-{
- jclass typeClass;
- if (obj == NULL)
- {
- return PRIMLIB_NULL;
- }
-
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_DOUBLE);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_DOUBLE;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_FLOAT;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_LONG;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_INT;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_CHAR;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_SHORT;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_BYTE;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BOOLEAN);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_BOOLEAN;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_VOID);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_VOID;
- }
- return PRIMLIB_OBJECT;
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_GetReflectiveType (JNIEnv * env, jclass returnType)
-{
- jclass typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_DOUBLE);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_DOUBLE;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_FLOAT);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_FLOAT;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_LONG);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_LONG;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_INT);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_INT;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_CHAR);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_CHAR;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_SHORT);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_SHORT;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_BYTE);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_BYTE;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_BOOLEAN);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_BOOLEAN;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_VOID);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_VOID;
- }
- return PRIMLIB_OBJECT;
-}
-
-
-JNIEXPORT jboolean JNICALL
-PRIMLIB_GetBooleanObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_BOOLEAN);
- return (*env)->CallBooleanMethod (env, obj, acc);
-}
-
-JNIEXPORT jbyte JNICALL
-PRIMLIB_GetByteObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_BYTE);
- return (*env)->CallByteMethod (env, obj, acc);
-}
-
-JNIEXPORT jshort JNICALL
-PRIMLIB_GetShortObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_SHORT);
- return (*env)->CallShortMethod (env, obj, acc);
-}
-
-JNIEXPORT jchar JNICALL
-PRIMLIB_GetCharObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_CHAR);
- return (*env)->CallCharMethod (env, obj, acc);
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_GetIntObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_INT);
- return (*env)->CallIntMethod (env, obj, acc);
-}
-
-JNIEXPORT jlong JNICALL
-PRIMLIB_GetLongObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_LONG);
- return (*env)->CallLongMethod (env, obj, acc);
-}
-
-JNIEXPORT jfloat JNICALL
-PRIMLIB_GetFloatObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_FLOAT);
- return (*env)->CallFloatMethod (env, obj, acc);
-}
-
-JNIEXPORT jdouble JNICALL
-PRIMLIB_GetDoubleObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_DOUBLE);
- return (*env)->CallDoubleMethod (env, obj, acc);
-}
-
-
-
-JNIEXPORT jvalue JNICALL
-PRIMLIB_UnwrapJValue (JNIEnv * env, jobject obj, jclass classType)
-{
- jvalue retval;
- jint objType = PRIMLIB_GetReflectiveType (env, classType);
- if (objType == PRIMLIB_BOOLEAN)
- {
- retval.z = PRIMLIB_UnwrapBoolean (env, obj);
- }
- else if (objType == PRIMLIB_BYTE)
- {
- retval.b = PRIMLIB_UnwrapByte (env, obj);
- }
- else if (objType == PRIMLIB_CHAR)
- {
- retval.c = PRIMLIB_UnwrapChar (env, obj);
- }
- else if (objType == PRIMLIB_SHORT)
- {
- retval.s = PRIMLIB_UnwrapShort (env, obj);
- }
- else if (objType == PRIMLIB_INT)
- {
- retval.i = PRIMLIB_UnwrapInt (env, obj);
- }
- else if (objType == PRIMLIB_LONG)
- {
- retval.j = PRIMLIB_UnwrapLong (env, obj);
- }
- else if (objType == PRIMLIB_FLOAT)
- {
- retval.f = PRIMLIB_UnwrapFloat (env, obj);
- }
- else if (objType == PRIMLIB_DOUBLE)
- {
- retval.d = PRIMLIB_UnwrapDouble (env, obj);
- }
- else
- {
- if (obj != NULL && !(*env)->IsInstanceOf (env, obj, classType))
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct object type.");
- return retval;
- }
- retval.l = obj;
- }
- return retval;
-}
diff --git a/libjava/classpath/native/jni/classpath/primlib.h b/libjava/classpath/native/jni/classpath/primlib.h
deleted file mode 100644
index 3cdaaa4a148..00000000000
--- a/libjava/classpath/native/jni/classpath/primlib.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* primlib.h
- Copyright (C) 1998 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. */
-
-#ifndef __PRIMLIB_H__
-#define __PRIMLIB_H__
-
-#include <jni.h>
-
-#define PRIMLIB_UNKNOWN 0
-#define PRIMLIB_OBJECT 1
-#define PRIMLIB_BOOLEAN 2
-#define PRIMLIB_BYTE 3
-#define PRIMLIB_CHAR 4
-#define PRIMLIB_SHORT 5
-#define PRIMLIB_INT 6
-#define PRIMLIB_LONG 7
-#define PRIMLIB_FLOAT 8
-#define PRIMLIB_DOUBLE 9
-#define PRIMLIB_VOID 10
-#define PRIMLIB_NULL 11
-#define PRIMLIB_NUMTYPES 12
-
-/* Low-level primitive class accessor functions. */
-JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass (JNIEnv * env,
- int reflectType);
-JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass (JNIEnv * env,
- int reflectType);
-JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor (JNIEnv *
- env,
- int
- reflectType);
-JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor (JNIEnv * env,
- int
- reflectType);
-
-/* Type discovery functions: WrapperType finds out j.l.Boolean/Byte/etc., and
- Type finds out j.l.Boolean.TYPE, etc.
-*/
-JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType (JNIEnv * env,
- jobject obj);
-JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType (JNIEnv * env,
- jclass returnType);
-
-/* Constructor functions. */
-JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean (JNIEnv * env, jboolean b);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapByte (JNIEnv * env, jbyte b);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapChar (JNIEnv * env, jchar c);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapShort (JNIEnv * env, jshort s);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapInt (JNIEnv * env, jint i);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapLong (JNIEnv * env, jlong l);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat (JNIEnv * env, jfloat f);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d);
-
-/* Widening conversion unwrapping functions. */
-JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean (JNIEnv * env, jobject obj);
-JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte (JNIEnv * env, jobject obj);
-JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort (JNIEnv * env, jobject obj);
-JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar (JNIEnv * env, jobject obj);
-JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt (JNIEnv * env, jobject obj);
-JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong (JNIEnv * env, jobject obj);
-JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat (JNIEnv * env, jobject obj);
-JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj);
-
-/* Simple unwrapping functions. Objects *must* be of correct type. */
-JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue (JNIEnv * env, jobject obj);
-JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue (JNIEnv * env,
- jobject obj);
-
-/* jvalue conversion: Unwrap obj to the type of classType, with widening conversion. */
-JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue (JNIEnv * env, jobject obj,
- jclass classType);
-
-#endif
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.am b/libjava/classpath/native/jni/gtk-peer/Makefile.am
index e233357a163..453873037b4 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.am
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.am
@@ -55,10 +55,12 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
$(top_builddir)/native/jni/classpath/jcl.lo
-AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ -lXtst
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ \
+ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
# headers contain broken prototypes (by design, see gtkitemfactory.h).
AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
- @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@
+ @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@ \
+ @X_CFLAGS@
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.in b/libjava/classpath/native/jni/gtk-peer/Makefile.in
index 2b980d7fe2b..77ce68f0458 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.in
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/gtk-peer
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -173,10 +171,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -313,6 +315,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -326,6 +329,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -391,13 +395,16 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
$(top_builddir)/native/jni/classpath/jcl.lo
-AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ -lXtst
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ \
+ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst
+
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
# headers contain broken prototypes (by design, see gtkitemfactory.h).
AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
- @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@
+ @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@ \
+ @X_CFLAGS@
all: all-am
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 6f2a1ae7272..cd7eee614b0 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -65,6 +65,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState
glyphVector_class = (*env)->FindClass
(env, "gnu/java/awt/peer/gtk/GdkGlyphVector");
+ glyphVector_class = (*env)->NewGlobalRef
+ (env, glyphVector_class);
+
glyphVector_ctor = (*env)->GetMethodID
(env, glyphVector_class, "<init>",
"([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V");
@@ -98,7 +101,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
pfont = (struct peerfont *)NSA_DEL_FONT_PTR (env, self);
g_assert (pfont != NULL);
if (pfont->layout != NULL)
- g_object_unref (pfont->font);
+ g_object_unref (pfont->layout);
if (pfont->font != NULL)
g_object_unref (pfont->font);
if (pfont->ctx != NULL)
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index b122eb01544..4aca1cf57b9 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -116,11 +116,11 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
gdk_gc_copy (g->gc, g_old->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
- gdk_pixmap_ref (g->drawable);
+ g_object_ref (g->drawable);
else /* GDK_IS_WINDOW (g->drawable) */
- gdk_window_ref (g->drawable);
+ g_object_ref (g->drawable);
- gdk_colormap_ref (g->cm);
+ g_object_ref (g->cm);
NSA_SET_G_PTR (env, obj, g);
@@ -140,8 +140,8 @@ 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_cmap ();
- gdk_colormap_ref (g->cm);
+ g->cm = gdk_rgb_get_colormap ();
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -160,7 +160,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
pixmap = cp_gtk_image_get_pixmap (env, source);
g_assert(pixmap != NULL);
- gdk_pixmap_ref (pixmap);
+ g_object_ref (pixmap);
g = (struct graphics *) g_malloc (sizeof (struct graphics));
g->x_offset = g->y_offset = 0;
@@ -168,7 +168,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
g->drawable = (GdkDrawable *)pixmap;
g->cm = gdk_drawable_get_colormap (g->drawable);
- gdk_colormap_ref (g->cm);
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -193,9 +193,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
widget = GTK_WIDGET (ptr);
g->drawable = (GdkDrawable *) widget->window;
- gdk_window_ref (g->drawable);
+ g_object_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
- gdk_colormap_ref (g->cm);
+ 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];
@@ -254,14 +254,14 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
XFlush (GDK_DISPLAY ());
- gdk_gc_destroy (g->gc);
+ g_object_unref (g->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
- gdk_pixmap_unref (g->drawable);
+ g_object_unref (g->drawable);
else /* GDK_IS_WINDOW (g->drawable) */
- gdk_window_unref (g->drawable);
+ g_object_unref (g->drawable);
- gdk_colormap_unref (g->cm);
+ g_object_unref (g->cm);
g_free (g);
@@ -388,12 +388,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
- gdk_window_copy_area ((GdkWindow *)g->drawable,
- g->gc,
- x + g->x_offset + dx, y + g->y_offset + dy,
- (GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset,
- width, height);
+ gdk_draw_drawable ((GdkWindow *)g->drawable,
+ g->gc,
+ (GdkWindow *)g->drawable,
+ x + g->x_offset, y + g->y_offset,
+ x + g->x_offset + dx, y + g->y_offset + dy,
+ width, height);
gdk_flush ();
gdk_threads_leave ();
@@ -471,8 +471,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
color.blue = blue << 8;
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_color_alloc (g->cm, &color);
+
+ gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
gdk_gc_set_foreground (g->gc, &color);
gdk_threads_leave ();
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
index fe9980ffd02..7f51e534dd7 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
@@ -58,9 +58,12 @@ void
cp_gtk_graphics2d_init_jni (void)
{
jclass gdkgraphics2d;
+ JNIEnv *env = cp_gtk_gdk_env();
- gdkgraphics2d = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
- "gnu/java/awt/peer/gtk/GdkGraphics2D");
+ gdkgraphics2d = (*env)->FindClass (env,
+ "gnu/java/awt/peer/gtk/GdkGraphics2D");
+ if ((*env)->ExceptionOccurred(env))
+ return;
initComponentGraphics2DUnlockedID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics2d,
"initComponentGraphics2DUnlocked",
@@ -777,12 +780,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked
if (peer_is_disposed(env, obj))
return;
- if (gr->debug) printf ("setGradient (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n",
- x1, y1,
- x2, y2,
- r1, g1, b1, a1,
- r2, g2, b2, a2);
-
+ if (gr->debug)
+ printf ("setGradientUnlocked (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n",
+ x1, y1,
+ x2, y2,
+ r1, g1, b1, a1,
+ r2, g2, b2, a2);
+
if (cyclic)
surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 3, 2);
else
@@ -903,8 +907,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("setTexturePixels (%d pixels, %dx%d, stride: %d)\n",
- (*env)->GetArrayLength (env, jarr), w, h, stride);
+ if (gr->debug)
+ printf ("setTexturePixelsUnlocked (%d pixels, %dx%d, stride: %d)\n",
+ (*env)->GetArrayLength (env, jarr), w, h, stride);
if (gr->pattern)
cairo_pattern_destroy (gr->pattern);
@@ -931,9 +936,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
CAIRO_FORMAT_ARGB32,
w, h, stride * 4);
g_assert (gr->pattern_surface != NULL);
- cairo_pattern_set_extend (gr->pattern, 1);
gr->pattern = cairo_pattern_create_for_surface (gr->pattern_surface);
g_assert (gr->pattern != NULL);
+ cairo_pattern_set_extend (gr->pattern, CAIRO_EXTEND_REPEAT);
cairo_set_source (gr->cr, gr->pattern);
}
@@ -957,8 +962,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n",
- (*env)->GetArrayLength (env, java_pixels), w, h, stride);
+ if (gr->debug)
+ printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n",
+ (*env)->GetArrayLength (env, java_pixels), w, h, stride);
native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL);
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
@@ -1078,10 +1084,11 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked
g_assert (native_matrix != NULL);
g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
- if (gr->debug) printf ("cairo_set_matrix [ %f, %f, %f, %f, %f, %f ]\n",
- native_matrix[0], native_matrix[1],
- native_matrix[2], native_matrix[3],
- native_matrix[4], native_matrix[5]);
+ if (gr->debug)
+ printf ("cairo_matrix_init [ %f, %f, %f, %f, %f, %f ]\n",
+ native_matrix[0], native_matrix[1],
+ native_matrix[2], native_matrix[3],
+ native_matrix[4], native_matrix[5]);
{
cairo_matrix_t mat;
@@ -1269,7 +1276,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector
(*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
(*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
- begin_drawing_operation (env, gr);
+ begin_drawing_operation (env, gr);
cairo_show_glyphs (gr->cr, glyphs, n);
end_drawing_operation (env, gr);
@@ -1437,7 +1444,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked
draw to a PixBuf, you must exchange the R and B components of your
color. */
- if (gr->debug) printf ("cairo_set_source_rgb (%f, %f, %f)\n", r, g, b);
+ if (gr->debug)
+ printf ("cairo_set_source_rgba (%f, %f, %f, %f)\n", r, g, b, a);
if (gr->drawbuf)
cairo_set_source_rgba (gr->cr, b, g, r, a);
@@ -1728,7 +1736,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n", x1, y1, x2, y2, x3, y3);
+ if (gr->debug)
+ printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n",
+ x1, y1, x2, y2, x3, y3);
cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3);
gdk_threads_leave();
@@ -1794,7 +1804,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n", dx1, dy1, dx2, dy2, dx3, dy3);
+ if (gr->debug)
+ printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n",
+ dx1, dy1, dx2, dy2, dx3, dy3);
cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3);
gdk_threads_leave();
@@ -1822,7 +1834,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle
return;
}
- if (gr->debug) printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height);
+ if (gr->debug)
+ printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height);
cairo_rectangle (gr->cr, x, y, width, height);
gdk_threads_leave();
@@ -1952,7 +1965,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_surface_set_filter %d\n", filter);
+ if (gr->debug) printf ("cairo_pattern_set_filter %d\n", filter);
switch ((enum java_awt_rendering_hints_filter) filter)
{
case java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR:
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
index 918ecfd0a8e..edce3917d68 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
@@ -1,5 +1,5 @@
/* gnu_java_awt_GdkTextLayout.c
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,12 +38,28 @@
#include <jni.h>
#include <gtk/gtk.h>
+#include <string.h>
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+#include <pango/pangofc-font.h>
+#include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
#include "native_state.h"
#include "gdkfont.h"
#include "gnu_java_awt_peer_gtk_GdkTextLayout.h"
struct state_table *cp_gtk_native_text_layout_state_table;
+typedef struct gp
+{
+ JNIEnv *env;
+ jobject obj;
+ double px;
+ double py;
+ double sx;
+ double sy;
+} generalpath ;
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkTextLayout_initStaticState
(JNIEnv *env, jclass clazz)
@@ -190,3 +206,219 @@ Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose
gdk_threads_leave ();
}
+
+/* GetOutline code follows ****************************/
+/********* Freetype callback functions *****************************/
+
+static int _moveTo( FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[2];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+
+ values[0].f = (jfloat)(to->x * path->sx + path->px);
+ values[1].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "moveTo", "(FF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+static int _lineTo( FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[2];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+ values[0].f = (jfloat)(to->x * path->sx + path->px);
+ values[1].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "lineTo", "(FF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+static int _quadTo( FT_Vector* cp,
+ FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[4];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+ values[0].f = (jfloat)(cp->x * path->sx + path->px);
+ values[1].f = (jfloat)(cp->y * path->sy + path->py);
+ values[2].f = (jfloat)(to->x * path->sx + path->px);
+ values[3].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "quadTo", "(FFFF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+static int _curveTo( FT_Vector* cp1,
+ FT_Vector* cp2,
+ FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[6];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+ values[0].f = (jfloat)(cp1->x * path->sx + path->px);
+ values[1].f = (jfloat)(cp1->y * path->sy + path->py);
+ values[2].f = (jfloat)(cp2->x * path->sx + path->px);
+ values[3].f = (jfloat)(cp2->y * path->sy + path->py);
+ values[4].f = (jfloat)(to->x * path->sx + path->px);
+ values[5].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "curveTo", "(FFFFFF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline
+ (JNIEnv *env, jobject obj, jobject transform)
+{
+ struct textlayout *tl;
+ generalpath *path;
+ jobject gp;
+ GSList *current_run;
+ PangoLayoutLine *current_line;
+ FT_Outline_Funcs ftCallbacks =
+ {
+ _moveTo,
+ _lineTo,
+ _quadTo,
+ _curveTo,
+ 0,
+ 0
+ };
+ PangoLayoutIter* layoutIterator;
+
+ gdk_threads_enter ();
+
+ tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, obj);
+ g_assert(tl != NULL);
+ g_assert(tl->pango_layout != NULL);
+
+ path = g_malloc0 (sizeof (generalpath));
+ g_assert(path != NULL);
+ path->env = env;
+
+ /* Scaling factors */
+ path->sx = PANGO_SCALE/65536.0;
+ path->sy = -PANGO_SCALE/65536.0;
+
+ { /* create a GeneralPath instance */
+ jclass cls;
+ jmethodID method;
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "<init>", "()V");
+ gp = path->obj = (*env)->NewObject (env, cls, method);
+ }
+
+ layoutIterator = pango_layout_get_iter (tl->pango_layout);
+ g_assert (layoutIterator != NULL);
+
+ if (pango_layout_iter_get_line (layoutIterator))
+ do
+ {
+ PangoRectangle line_logical_rect;
+ current_line = pango_layout_iter_get_line (layoutIterator);
+ pango_layout_iter_get_line_extents (layoutIterator,
+ NULL,
+ &line_logical_rect);
+
+ path->px = line_logical_rect.x/(double)PANGO_SCALE;
+ path->py = line_logical_rect.y/(double)PANGO_SCALE;
+
+ current_run = current_line->runs;
+ while (current_run)
+ {
+ FT_Face ft_face;
+ int index;
+ PangoGlyphItem *run = current_run->data;
+ PangoGlyphString *glyphs = run->glyphs;
+
+ PangoAnalysis *analysis = &run->item->analysis;
+ g_assert (analysis != NULL);
+ g_assert (analysis->font != NULL);
+
+ ft_face = pango_fc_font_lock_face ((PangoFcFont *)analysis->font);
+ g_assert (ft_face != NULL);
+
+ for (index = 0; index < glyphs->num_glyphs; index++)
+ {
+ FT_Glyph glyph;
+ FT_Error fterror;
+ PangoGlyphGeometry pgg = glyphs->glyphs[index].geometry;
+
+ fterror = FT_Load_Glyph(ft_face,
+ (FT_UInt)(glyphs->glyphs[index].glyph),
+ FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
+ g_assert(fterror == 0);
+
+ FT_Get_Glyph (ft_face->glyph, &glyph);
+ FT_Outline_Decompose (&(((FT_OutlineGlyph)glyph)->outline),
+ &ftCallbacks, path);
+ FT_Done_Glyph (glyph);
+
+ path->px += pgg.width/(double)PANGO_SCALE;
+ }
+
+ pango_fc_font_unlock_face ((PangoFcFont *)analysis->font);
+ current_run = current_run->next;
+ }
+ } while (pango_layout_iter_next_line (layoutIterator));
+
+ g_free(path);
+ gdk_threads_leave ();
+
+ if (transform != NULL)
+ {
+ jclass cls;
+ jmethodID method;
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "transform",
+ "(Ljava/awt/geom/AffineTransform;)V");
+ (*env)->CallVoidMethod(env, gp, method, transform );
+ }
+
+ return gp;
+}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
index 52922ddb82e..ef9ac12076a 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
@@ -46,11 +46,11 @@ Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
gpointer widget;
gdk_threads_enter ();
-
+
/* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
- widget = gtk_type_new (gtk_drawing_area_get_type ());
+ widget = gtk_drawing_area_new ();
NSA_SET_PTR (env, obj, widget);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
index 4f28750921b..5ba300b7e20 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
@@ -64,7 +64,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
/* Update the group to point to some other widget in the group. We
have to do this because Gtk doesn't have a separate object to
represent a radio button's group. */
- for (list = gtk_radio_button_group (button); list != NULL;
+ for (list = gtk_radio_button_get_group (button); list != NULL;
list = list->next)
{
if (list->data != button)
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
index 7012bd82115..b74b0a265e0 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
@@ -130,7 +130,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
gtk_radio_button_set_group (button, NULL);
else
gtk_radio_button_set_group (button,
- gtk_radio_button_group
+ gtk_radio_button_get_group
(GTK_RADIO_BUTTON (native_group)));
/* If the native group wasn't set on the new CheckboxGroup, then set
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
index f10a80d580b..779be57235d 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
@@ -53,7 +53,11 @@ jstring cp_gtk_imageTarget;
jstring cp_gtk_filesTarget;
/* Simple id to keep track of the selection we are currently managing. */
+#if SIZEOF_VOID_P == 8
+static long current_selection = 0;
+#else
static int current_selection = 0;
+#endif
/* Whether we "own" the clipboard. And may clear it. */
static int owner = 0;
@@ -261,7 +265,11 @@ static void
clipboard_clear_func (GtkClipboard *clipboard __attribute__((unused)),
gpointer user_data)
{
+#if SIZEOF_VOID_P == 8
+ if (owner && (long) user_data == current_selection)
+#else
if (owner && (int) user_data == current_selection)
+#endif
{
JNIEnv *env = cp_gtk_gdk_env();
owner = 0;
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index f832da5a462..6de7b61b8e9 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -56,10 +56,6 @@ exception statement from your version. */
#define AWT_HAND_CURSOR 12
#define AWT_MOVE_CURSOR 13
-#define AWT_BUTTON1_DOWN_MASK (1 << 10)
-#define AWT_BUTTON2_DOWN_MASK (1 << 11)
-#define AWT_BUTTON3_DOWN_MASK (1 << 12)
-
/* FIXME: use gtk-double-click-time, gtk-double-click-distance */
#define MULTI_CLICK_TIME 250
/* as opposed to a MULTI_PASS_TIME :) */
@@ -135,11 +131,11 @@ button_to_awt_mods (int button)
switch (button)
{
case 1:
- return AWT_BUTTON1_MASK;
+ return AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
case 2:
- return AWT_BUTTON2_MASK;
+ return AWT_BUTTON2_DOWN_MASK | AWT_BUTTON2_MASK;
case 3:
- return AWT_BUTTON3_MASK;
+ return AWT_BUTTON3_DOWN_MASK | AWT_BUTTON3_MASK;
}
return 0;
@@ -151,11 +147,11 @@ cp_gtk_state_to_awt_mods (guint state)
jint result = 0;
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= (AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK);
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= (AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK);
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= (AWT_ALT_DOWN_MASK | AWT_ALT_MASK);
return result;
}
@@ -166,13 +162,13 @@ state_to_awt_mods_with_button_states (guint state)
jint result = 0;
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
if (state & GDK_BUTTON1_MASK)
- result |= AWT_BUTTON1_DOWN_MASK;
+ result |= AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
if (state & GDK_BUTTON2_MASK)
result |= AWT_BUTTON2_DOWN_MASK;
if (state & GDK_BUTTON3_MASK)
@@ -253,7 +249,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
gdk_cursor = gdk_cursor_new (gdk_cursor_type);
gdk_window_set_cursor (widget->window, gdk_cursor);
- gdk_cursor_destroy (gdk_cursor);
+ gdk_cursor_unref (gdk_cursor);
}
JNIEXPORT void JNICALL
@@ -276,9 +272,9 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
if (widget->parent == NULL)
{
if (GTK_IS_WINDOW (parent_widget))
- {
- GList *children = gtk_container_children
- (GTK_CONTAINER (parent_widget));
+ {
+ GList *children = gtk_container_get_children
+ (GTK_CONTAINER (parent_widget));
if (GTK_IS_MENU_BAR (children->data))
gtk_fixed_put (GTK_FIXED (children->next->data), widget, 0, 0);
@@ -458,24 +454,47 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetDispatchKeyEvent
* Find the origin of a widget's window.
*/
JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen
+ (JNIEnv * env, jobject obj, jintArray jpoint)
+{
+ void *ptr;
+ jint *point;
+
+ gdk_threads_enter ();
+
+ ptr = NSA_GET_PTR (env, obj);
+ point = (*env)->GetIntArrayElements (env, jpoint, 0);
+
+ gdk_window_get_root_origin (GTK_WIDGET (ptr)->window, point, point+1);
+
+ (*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
+
+ gdk_threads_leave ();
+}
+
+/*
+ * Find the origin of a widget
+ */
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
(JNIEnv * env, jobject obj, jintArray jpoint)
{
void *ptr;
jint *point;
+ GtkWidget *widget;
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
point = (*env)->GetIntArrayElements (env, jpoint, 0);
- gdk_window_get_origin (GTK_WIDGET (ptr)->window, point, point+1);
+ widget = GTK_WIDGET(ptr);
+ while(gtk_widget_get_parent(widget) != NULL)
+ widget = gtk_widget_get_parent(widget);
+ gdk_window_get_position (GTK_WIDGET(widget)->window, point, point+1);
- if (!GTK_IS_CONTAINER (ptr))
- {
- *point += GTK_WIDGET(ptr)->allocation.x;
- *(point+1) += GTK_WIDGET(ptr)->allocation.y;
- }
+ *point += GTK_WIDGET(ptr)->allocation.x;
+ *(point+1) += GTK_WIDGET(ptr)->allocation.y;
(*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
@@ -766,7 +785,10 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isRealized
ptr = NSA_GET_PTR (env, obj);
if (ptr == NULL)
- return FALSE;
+ {
+ gdk_threads_leave ();
+ return FALSE;
+ }
ret_val = GTK_WIDGET_REALIZED (GTK_WIDGET (ptr));
@@ -844,7 +866,7 @@ find_fg_color_widget (GtkWidget *widget)
if (GTK_IS_EVENT_BOX (widget)
|| (GTK_IS_BUTTON (widget)
- && !GTK_IS_OPTION_MENU (widget)))
+ && !GTK_IS_COMBO_BOX (widget)))
fg_color_widget = gtk_bin_get_child (GTK_BIN(widget));
else
fg_color_widget = widget;
@@ -974,7 +996,7 @@ component_button_release_cb (GtkWidget *widget __attribute__((unused)),
/* Generate an AWT click event only if the release occured in the
window it was pressed in, and the mouse has not been dragged since
the last time it was pressed. */
- gdk_window_get_size (event->window, &width, &height);
+ gdk_drawable_get_size (event->window, &width, &height);
if (! hasBeenDragged
&& event->x >= 0
&& event->y >= 0
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
index fdc73ccdba5..ae065763688 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
@@ -299,7 +299,7 @@ Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap(JNIEnv *env, jobject obj)
if (offScreen (env, obj) == JNI_FALSE)
gdk_pixbuf_unref ((GdkPixbuf *)getData (env, obj));
else
- gdk_pixmap_unref ((GdkPixmap *)getData (env, obj));
+ g_object_unref ((GdkPixmap *)getData (env, obj));
gdk_threads_leave ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
index 3e21a04024d..a5c0074c068 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
@@ -88,7 +88,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu
if (helpmenu != NULL)
{
- list = gtk_container_children (GTK_CONTAINER (mbar));
+ list = gtk_container_get_children (GTK_CONTAINER (mbar));
while (list != NULL && list->data != helpmenu)
list = list->next;
if (list != NULL && list->data == helpmenu)
@@ -110,7 +110,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
ptr = NSA_GET_PTR (env, obj);
- list = gtk_container_children (GTK_CONTAINER (ptr));
+ list = gtk_container_get_children (GTK_CONTAINER (ptr));
list = g_list_nth (list, index);
gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
index 16018f001e4..b61a55bee56 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
@@ -165,7 +165,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
ptr = NSA_GET_PTR (env, obj);
- list = gtk_container_children (GTK_CONTAINER (ptr));
+ list = gtk_container_get_children (GTK_CONTAINER (ptr));
list = g_list_nth (list, index);
gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
index 040cc92ff1e..59b56cf355b 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
@@ -160,9 +160,7 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
XSynchronize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True);
#endif
- gdk_rgb_init ();
- gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
- gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+ gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
/* Make sure queued calls don't get sent to GTK/GDK while
we're shutting down. */
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 0f623d1655f..d79bbecbaf6 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -952,29 +952,29 @@ keyevent_state_to_awt_mods (GdkEventKey *event)
if (event->keyval == GDK_Shift_L
|| event->keyval == GDK_Shift_R)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
else
{
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
}
if (event->keyval == GDK_Control_L
|| event->keyval == GDK_Control_R)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
else
{
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
}
if (event->keyval == GDK_Alt_L
|| event->keyval == GDK_Alt_R)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
else
{
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
}
}
else if (event->type == GDK_KEY_RELEASE)
@@ -985,20 +985,20 @@ keyevent_state_to_awt_mods (GdkEventKey *event)
&& event->keyval != GDK_Shift_R)
{
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
}
if (event->keyval != GDK_Control_L
&& event->keyval != GDK_Control_R)
{
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
}
if (event->keyval != GDK_Alt_L
&& event->keyval != GDK_Alt_R)
{
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
}
}
@@ -1028,9 +1028,6 @@ static gboolean window_delete_cb (GtkWidget *widget, GdkEvent *event,
static void window_destroy_cb (GtkWidget *widget, GdkEvent *event,
jobject peer);
static void window_show_cb (GtkWidget *widget, jobject peer);
-static void window_active_state_change_cb (GtkWidget *widget,
- GParamSpec *pspec,
- jobject peer);
static void window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec,
jobject peer);
@@ -1043,7 +1040,6 @@ static gboolean window_focus_out_cb (GtkWidget * widget,
static gboolean window_window_state_cb (GtkWidget *widget,
GdkEvent *event,
jobject peer);
-static jint window_get_new_state (GtkWidget *widget);
static gboolean window_property_changed_cb (GtkWidget *widget,
GdkEventProperty *event,
jobject peer);
@@ -1209,7 +1205,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable
ptr = NSA_GET_PTR (env, obj);
- gtk_window_set_policy (GTK_WINDOW (ptr), resizable, resizable, FALSE);
+ gtk_window_set_resizable (GTK_WINDOW (ptr), resizable);
gdk_threads_leave ();
}
@@ -1278,9 +1274,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
g_signal_connect (G_OBJECT (ptr), "show",
G_CALLBACK (window_show_cb), *gref);
- g_signal_connect (G_OBJECT (ptr), "notify::is-active",
- G_CALLBACK (window_active_state_change_cb), *gref);
-
g_signal_connect (G_OBJECT (ptr), "notify::has-toplevel-focus",
G_CALLBACK (window_focus_state_change_cb), *gref);
@@ -1592,31 +1585,6 @@ window_show_cb (GtkWidget *widget __attribute__((unused)),
}
static void
-window_active_state_change_cb (GtkWidget *widget __attribute__((unused)),
- GParamSpec *pspec __attribute__((unused)),
- jobject peer __attribute__((unused)))
-{
- /* FIXME: not sure if this is needed or not. */
- /* Remove the unused attributes if you fix the below. */
-#if 0
- gdk_threads_leave ();
-
- if (GTK_WINDOW (widget)->is_active)
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- postWindowEventID,
- (jint) AWT_WINDOW_GAINED_FOCUS,
- (jobject) NULL, (jint) 0);
- else
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- postWindowEventID,
- (jint) AWT_WINDOW_DEACTIVATED,
- (jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
-#endif
-}
-
-static void
window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec __attribute__((unused)),
jobject peer)
@@ -1660,7 +1628,7 @@ window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
}
static gboolean
-window_window_state_cb (GtkWidget *widget,
+window_window_state_cb (GtkWidget *widget __attribute__((unused)),
GdkEvent *event,
jobject peer)
{
@@ -1695,8 +1663,6 @@ window_window_state_cb (GtkWidget *widget,
if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
new_state |= AWT_FRAME_STATE_ICONIFIED;
- new_state |= window_get_new_state (widget);
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_STATE_CHANGED,
@@ -1705,47 +1671,6 @@ window_window_state_cb (GtkWidget *widget,
return TRUE;
}
-static jint
-window_get_new_state (GtkWidget *widget)
-{
- GdkDisplay *display = gtk_widget_get_display(widget);
- jint new_state = AWT_FRAME_STATE_NORMAL;
- Atom type;
- gint format;
- gulong atom_count;
- gulong bytes_after;
- Atom *atom_list = NULL;
- union atom_list_union alu;
- gulong i;
-
- alu.atom_list = &atom_list;
- XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XID (widget->window),
- gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
- 0, G_MAXLONG, False, XA_ATOM, &type, &format, &atom_count,
- &bytes_after, alu.gu_extents);
-
- if (type != None)
- {
- Atom maxvert = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT");
- Atom maxhorz = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
-
- i = 0;
- while (i < atom_count)
- {
- if (atom_list[i] == maxhorz)
- new_state |= AWT_FRAME_STATE_MAXIMIZED_HORIZ;
- else if (atom_list[i] == maxvert)
- new_state |= AWT_FRAME_STATE_MAXIMIZED_VERT;
-
- ++i;
- }
-
- XFree (atom_list);
- }
- return new_state;
-}
-
static gboolean
window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
GdkEventProperty *event,
diff --git a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
index 2b16d99b455..f332b62a156 100644
--- a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
+++ b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
@@ -111,15 +111,26 @@ struct graphics
jint x_offset, y_offset;
};
+/* New-style event masks. */
+#define AWT_BUTTON1_DOWN_MASK (1 << 10)
+#define AWT_BUTTON2_DOWN_MASK (1 << 11)
+#define AWT_BUTTON3_DOWN_MASK (1 << 12)
+
#define AWT_SHIFT_DOWN_MASK (1 << 6)
#define AWT_CTRL_DOWN_MASK (1 << 7)
#define AWT_META_DOWN_MASK (1 << 8)
#define AWT_ALT_DOWN_MASK (1 << 9)
+/* Old-style event masks. */
#define AWT_BUTTON1_MASK (1 << 4)
#define AWT_BUTTON2_MASK (1 << 3)
#define AWT_BUTTON3_MASK (1 << 2)
+#define AWT_SHIFT_MASK (1 << 0)
+#define AWT_CTRL_MASK (1 << 1)
+#define AWT_META_MASK (1 << 2)
+#define AWT_ALT_MASK (1 << 3)
+
#define AWT_ITEM_SELECTED 1
#define AWT_ITEM_DESELECTED 2
diff --git a/libjava/classpath/native/jni/java-io/Makefile.am b/libjava/classpath/native/jni/java-io/Makefile.am
index 5ed8a1baf4c..efa7d568839 100644
--- a/libjava/classpath/native/jni/java-io/Makefile.am
+++ b/libjava/classpath/native/jni/java-io/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavaio.la
+nativelib_LTLIBRARIES = libjavaio.la
libjavaio_la_SOURCES = javaio.h \
javaio.c \
diff --git a/libjava/classpath/native/jni/java-io/Makefile.in b/libjava/classpath/native/jni/java-io/Makefile.in
index 17b50e2a8cc..baa6217873c 100644
--- a/libjava/classpath/native/jni/java-io/Makefile.in
+++ b/libjava/classpath/native/jni/java-io/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-io
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavaio_la_DEPENDENCIES = \
$(top_builddir)/native/jni/classpath/jcl.lo
am_libjavaio_la_OBJECTS = javaio.lo java_io_VMFile.lo \
@@ -105,10 +103,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -245,6 +247,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -258,6 +261,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -270,7 +274,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavaio.la
+nativelib_LTLIBRARIES = libjavaio.la
libjavaio_la_SOURCES = javaio.h \
javaio.c \
java_io_VMFile.c \
@@ -314,35 +318,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavaio.la: $(libjavaio_la_OBJECTS) $(libjavaio_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavaio_la_LDFLAGS) $(libjavaio_la_OBJECTS) $(libjavaio_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavaio_la_LDFLAGS) $(libjavaio_la_OBJECTS) $(libjavaio_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -465,7 +469,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -494,7 +498,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -513,9 +517,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -541,20 +545,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.am b/libjava/classpath/native/jni/java-lang/Makefile.am
index 34ffe00fba7..fb8390f085c 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.am
+++ b/libjava/classpath/native/jni/java-lang/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+nativelib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
libjavalang_la_SOURCES = java_lang_VMSystem.c \
java_lang_VMFloat.c \
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.in b/libjava/classpath/native/jni/java-lang/Makefile.in
index 861eb9a86e9..4af83039dc0 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.in
+++ b/libjava/classpath/native/jni/java-lang/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-lang
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavalang_la_DEPENDENCIES = $(wildcard \
$(top_builddir)/native/fdlibm/*.lo) \
$(top_builddir)/native/jni/classpath/jcl.lo
@@ -110,10 +108,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -250,6 +252,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -263,6 +266,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -275,7 +279,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+nativelib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
libjavalang_la_SOURCES = java_lang_VMSystem.c \
java_lang_VMFloat.c \
java_lang_VMDouble.c \
@@ -322,37 +326,37 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavalang.la: $(libjavalang_la_OBJECTS) $(libjavalang_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
libjavalangreflect.la: $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -477,7 +481,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -506,7 +510,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -525,9 +529,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -553,20 +557,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
index c1090ed3736..169c7850172 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
@@ -1,5 +1,5 @@
/* java_lang_VMProcess.c -- native code for java.lang.VMProcess
- Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -351,7 +351,6 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
streams[0], streams[1], streams[2], (jlong) pid);
if ((*env)->ExceptionOccurred (env))
goto done;
- (*env)->DeleteLocalRef (env, clazz);
done:
/*
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c b/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
index 0bd23c16ffc..64ad202dba1 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
@@ -42,6 +42,7 @@ exception statement from your version. */
* Date: 2 Jun 1998
*/
+#include <config.h>
#include <stddef.h>
#include "java_lang_reflect_Array.h"
diff --git a/libjava/classpath/native/jni/java-net/Makefile.am b/libjava/classpath/native/jni/java-net/Makefile.am
index 3e8c863a9a9..bf7a92bbf00 100644
--- a/libjava/classpath/native/jni/java-net/Makefile.am
+++ b/libjava/classpath/native/jni/java-net/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavanet.la
+nativelib_LTLIBRARIES = libjavanet.la
libjavanet_la_SOURCES = javanet.c \
javanet.h \
diff --git a/libjava/classpath/native/jni/java-net/Makefile.in b/libjava/classpath/native/jni/java-net/Makefile.in
index 590b6d75e25..d1d678ebded 100644
--- a/libjava/classpath/native/jni/java-net/Makefile.in
+++ b/libjava/classpath/native/jni/java-net/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-net
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavanet_la_DEPENDENCIES = \
$(top_builddir)/native/jni/classpath/jcl.lo
am_libjavanet_la_OBJECTS = javanet.lo java_net_VMInetAddress.lo \
@@ -107,10 +105,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -247,6 +249,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -260,6 +263,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -272,7 +276,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavanet.la
+nativelib_LTLIBRARIES = libjavanet.la
libjavanet_la_SOURCES = javanet.c \
javanet.h \
java_net_VMInetAddress.c \
@@ -317,35 +321,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavanet.la: $(libjavanet_la_OBJECTS) $(libjavanet_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -469,7 +473,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -498,7 +502,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -517,9 +521,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -545,20 +549,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c b/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
index d33265cff7e..0ba00d1c3c6 100644
--- a/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
+++ b/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
@@ -181,7 +181,8 @@ Java_java_net_VMInetAddress_getHostByAddr (JNIEnv * env,
sizeof (hostname), result);
if (result != TARGET_NATIVE_OK)
{
- JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Bad IP address");
+ JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
return (jstring) NULL;
}
diff --git a/libjava/classpath/native/jni/java-net/javanet.c b/libjava/classpath/native/jni/java-net/javanet.c
index fdc1c22ecbf..31afbc86997 100644
--- a/libjava/classpath/native/jni/java-net/javanet.c
+++ b/libjava/classpath/native/jni/java-net/javanet.c
@@ -856,8 +856,12 @@ _javanet_accept (JNIEnv * env, jobject this, jobject impl)
&& (TARGET_NATIVE_LAST_ERROR ()
!= TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
{
- JCL_ThrowException (env, IO_EXCEPTION,
- "Internal error: _javanet_accept(): ");
+ if (TARGET_NATIVE_LAST_ERROR () == EAGAIN)
+ JCL_ThrowException (env, "java/net/SocketTimeoutException",
+ "Timeout");
+ else
+ JCL_ThrowException (env, IO_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
return;
}
}
@@ -1542,8 +1546,7 @@ _javanet_shutdownInput (JNIEnv * env, jobject this)
/* Shutdown input stream of socket. */
if (shutdown (fd, SHUT_RD) == -1)
{
- JCL_ThrowException (env, SOCKET_EXCEPTION,
- "Can't shutdown input of socket");
+ JCL_ThrowException (env, SOCKET_EXCEPTION, strerror (errno));
return;
}
}
@@ -1568,8 +1571,7 @@ _javanet_shutdownOutput (JNIEnv * env, jobject this)
/* Shutdown output stream of socket. */
if (shutdown (fd, SHUT_WR) == -1)
{
- JCL_ThrowException (env, SOCKET_EXCEPTION,
- "Can't shutdown output of socket");
+ JCL_ThrowException (env, SOCKET_EXCEPTION, strerror (errno));
return;
}
}
diff --git a/libjava/classpath/native/jni/java-nio/Makefile.am b/libjava/classpath/native/jni/java-nio/Makefile.am
index 9785fee6d9b..8fd5ba3aeb5 100644
--- a/libjava/classpath/native/jni/java-nio/Makefile.am
+++ b/libjava/classpath/native/jni/java-nio/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavanio.la
+nativelib_LTLIBRARIES = libjavanio.la
libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \
gnu_java_nio_VMSelector.c \
diff --git a/libjava/classpath/native/jni/java-nio/Makefile.in b/libjava/classpath/native/jni/java-nio/Makefile.in
index 052a175dc01..a082889c655 100644
--- a/libjava/classpath/native/jni/java-nio/Makefile.in
+++ b/libjava/classpath/native/jni/java-nio/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-nio
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libjavanio_la_DEPENDENCIES = \
$(top_builddir)/native/jni/classpath/jcl.lo \
@@ -112,10 +110,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -252,6 +254,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -265,6 +268,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -277,7 +281,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavanio.la
+nativelib_LTLIBRARIES = libjavanio.la
libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \
gnu_java_nio_VMSelector.c \
gnu_java_nio_channels_FileChannelImpl.c \
@@ -325,35 +329,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavanio.la: $(libjavanio_la_OBJECTS) $(libjavanio_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavanio_la_LDFLAGS) $(libjavanio_la_OBJECTS) $(libjavanio_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavanio_la_LDFLAGS) $(libjavanio_la_OBJECTS) $(libjavanio_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -479,7 +483,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -508,7 +512,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -527,9 +531,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -555,20 +559,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
index 2541e81ea44..b82cd2d900f 100644
--- a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
+++ b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
@@ -140,7 +140,7 @@ Java_gnu_java_nio_charset_iconv_IconvDecoder_decode (JNIEnv * env,
if (retval == (size_t) (-1))
{
- if (errno == EILSEQ || errno == EINVAL)
+ if (errno == EILSEQ)
retval = 1;
else
retval = 0;
diff --git a/libjava/classpath/native/jni/java-util/Makefile.am b/libjava/classpath/native/jni/java-util/Makefile.am
index da617f6a2b8..148e9ccbe29 100644
--- a/libjava/classpath/native/jni/java-util/Makefile.am
+++ b/libjava/classpath/native/jni/java-util/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavautil.la
+nativelib_LTLIBRARIES = libjavautil.la
libjavautil_la_SOURCES = java_util_VMTimeZone.c
diff --git a/libjava/classpath/native/jni/java-util/Makefile.in b/libjava/classpath/native/jni/java-util/Makefile.in
index a347072925c..bc5b3f634ce 100644
--- a/libjava/classpath/native/jni/java-util/Makefile.in
+++ b/libjava/classpath/native/jni/java-util/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-util
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavautil_la_LIBADD =
am_libjavautil_la_OBJECTS = java_util_VMTimeZone.lo
libjavautil_la_OBJECTS = $(am_libjavautil_la_OBJECTS)
@@ -103,10 +101,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -243,6 +245,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -256,6 +259,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -268,7 +272,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavautil.la
+nativelib_LTLIBRARIES = libjavautil.la
libjavautil_la_SOURCES = java_util_VMTimeZone.c
AM_LDFLAGS = @CLASSPATH_MODULE@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
@@ -306,35 +310,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavautil.la: $(libjavautil_la_OBJECTS) $(libjavautil_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavautil_la_LDFLAGS) $(libjavautil_la_OBJECTS) $(libjavautil_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavautil_la_LDFLAGS) $(libjavautil_la_OBJECTS) $(libjavautil_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -454,7 +458,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -483,7 +487,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -502,9 +506,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -530,20 +534,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/midi-alsa/.cvsignore b/libjava/classpath/native/jni/midi-alsa/.cvsignore
new file mode 100644
index 00000000000..483b2774465
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/.cvsignore
@@ -0,0 +1,9 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.depsMakefile
+Makefile.in
+Makefile
+.deps
diff --git a/libjava/classpath/native/jni/midi-alsa/Makefile.am b/libjava/classpath/native/jni/midi-alsa/Makefile.am
new file mode 100644
index 00000000000..b6498df2be5
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/Makefile.am
@@ -0,0 +1,11 @@
+nativelib_LTLIBRARIES = libgjsmalsa.la
+
+libgjsmalsa_la_SOURCES = gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c \
+gnu_javax_sound_midi_alsa_AlsaPortDevice.c \
+gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+
+libgjsmalsa_la_LIBADD = -lasound
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ `pkg-config --cflags-only-I alsa`
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ `pkg-config --cflags-only-other alsa`
diff --git a/libjava/classpath/native/jni/midi-alsa/Makefile.in b/libjava/classpath/native/jni/midi-alsa/Makefile.in
new file mode 100644
index 00000000000..5309d729e14
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/Makefile.in
@@ -0,0 +1,563 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SOURCES = $(libgjsmalsa_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/midi-alsa
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
+ $(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
+libgjsmalsa_la_DEPENDENCIES =
+am_libgjsmalsa_la_OBJECTS = \
+ gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo \
+ gnu_javax_sound_midi_alsa_AlsaPortDevice.lo \
+ gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.lo
+libgjsmalsa_la_OBJECTS = $(am_libgjsmalsa_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgjsmalsa_la_SOURCES)
+DIST_SOURCES = $(libgjsmalsa_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GJDOC = @GJDOC@
+GTK_CAIRO_ENABLED = @GTK_CAIRO_ENABLED@
+GTK_CAIRO_FALSE = @GTK_CAIRO_FALSE@
+GTK_CAIRO_TRUE = @GTK_CAIRO_TRUE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+vm_classes = @vm_classes@
+nativelib_LTLIBRARIES = libgjsmalsa.la
+libgjsmalsa_la_SOURCES = gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c \
+gnu_javax_sound_midi_alsa_AlsaPortDevice.c \
+gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+
+libgjsmalsa_la_LIBADD = -lasound
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ `pkg-config --cflags-only-I alsa`
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ `pkg-config --cflags-only-other alsa`
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/midi-alsa/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu native/jni/midi-alsa/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-nativelibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
+ done
+
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgjsmalsa.la: $(libgjsmalsa_la_OBJECTS) $(libgjsmalsa_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativelibdir) $(libgjsmalsa_la_LDFLAGS) $(libgjsmalsa_la_OBJECTS) $(libgjsmalsa_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaPortDevice.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nativelibLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-nativelibLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-nativelibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
new file mode 100644
index 00000000000..f740b276a60
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
@@ -0,0 +1,148 @@
+/* gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+ 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. */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h>
+
+#include <alsa/asoundlib.h>
+
+static snd_seq_t *seq;
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_init_1
+(JNIEnv *env __attribute__((unused)), jobject this __attribute__((unused)))
+{
+ int rc = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+ if (rc < 0)
+ abort ();
+ snd_seq_set_client_name(seq, "gnu.javax.sound.midi.alsa");
+}
+
+/**
+ * Return a CLAZZ[] filled with ports matching TYPE.
+ */
+static jobjectArray
+getPortDeviceInfo (JNIEnv *env, unsigned type, const char *clazz)
+{
+ jobjectArray rarray;
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+ int client;
+ int count = 0;
+ jclass icls;
+ jmethodID mid;
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+
+ /* First, count the number of input devices. */
+ snd_seq_client_info_set_client (cinfo, -1);
+ while (snd_seq_query_next_client (seq, cinfo) >= 0)
+ {
+ client = snd_seq_client_info_get_client (cinfo);
+ if (client == 0)
+ continue;
+ snd_seq_port_info_set_client (pinfo, client);
+ snd_seq_port_info_set_port (pinfo, -1);
+ while (snd_seq_query_next_port (seq, pinfo) >= 0)
+ {
+ if ((snd_seq_port_info_get_capability (pinfo) & type) != type)
+ continue;
+ count++;
+ }
+ }
+
+ icls = (*env)->FindClass(env, clazz);
+ mid = (*env)->GetMethodID(env, icls, "<init>",
+ "(Ljava/lang/String;Ljava/lang/String;JJ)V");
+
+ rarray = (jobjectArray) (*env)->NewObjectArray(env, count, icls, NULL);
+
+ /* Now, populate our array. */
+ count = 0;
+ snd_seq_client_info_set_client (cinfo, -1);
+ while (snd_seq_query_next_client (seq, cinfo) >= 0)
+ {
+ const char *client_name;
+ client = snd_seq_client_info_get_client (cinfo);
+ if (client == 0)
+ continue;
+ snd_seq_port_info_set_client (pinfo, client);
+ snd_seq_port_info_set_port (pinfo, -1);
+
+ client_name = snd_seq_client_info_get_name (cinfo);
+
+ while (snd_seq_query_next_port (seq, pinfo) >= 0)
+ {
+ const char *port_name;
+
+ if ((snd_seq_port_info_get_capability (pinfo) & type) != type)
+ continue;
+
+ port_name = snd_seq_port_info_get_name (pinfo);
+
+ (*env)->SetObjectArrayElement(env, rarray, count,
+ (*env)->NewObject (env, icls, mid,
+ (*env)->NewStringUTF (env, client_name),
+ (*env)->NewStringUTF (env, port_name),
+ (jlong) snd_seq_port_info_get_client(pinfo),
+ (jlong) snd_seq_port_info_get_port(pinfo)));
+ count++;
+ }
+ }
+
+ return rarray;
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getInputDeviceInfo_1
+ (JNIEnv *env, jobject this __attribute__((unused)))
+{
+ return getPortDeviceInfo (env,
+ (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ),
+ "gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider$AlsaInputPortInfo");
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getOutputDeviceInfo_1
+ (JNIEnv *env, jobject this __attribute__((unused)))
+{
+ return getPortDeviceInfo (env,
+ (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE),
+ "gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider$AlsaOutputPortInfo");
+}
+
diff --git a/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
new file mode 100644
index 00000000000..6e079d36c0e
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
@@ -0,0 +1,59 @@
+/* gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
+ 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. */
+
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h>
+
+JNIEXPORT jlong JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_open_1
+ (JNIEnv *env __attribute__((unused)), jobject this __attribute__((unused)))
+{
+ /* Nothing yet. */
+ return 555;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_close_1
+ (JNIEnv *env __attribute__((unused)),
+ jobject this __attribute__((unused)), jlong s __attribute__((unused)))
+{
+ /* Nothing. */
+}
+
+
diff --git a/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
new file mode 100644
index 00000000000..f4f8dd84a06
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
@@ -0,0 +1,150 @@
+/* gnu_javax_sound_midi_alsa_AlsaPortDevice.c - Native support
+ 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. */
+
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaPortDevice.h>
+#include <unistd.h>
+
+#include <alsa/asoundlib.h>
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1
+ (JNIEnv *env, jobject this __attribute__((unused)),
+ jlong client, jlong port, jobject receiver)
+{
+ int rc;
+ snd_seq_port_info_t *pinfo, *sinfo;
+ snd_seq_port_subscribe_t *subs;
+ snd_seq_addr_t sender, dest;
+ snd_seq_t *seq;
+
+ snd_seq_port_info_alloca (&pinfo);
+ snd_seq_port_info_alloca (&sinfo);
+ snd_seq_port_subscribe_alloca (&subs);
+
+ rc = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+
+ snd_seq_port_info_set_capability (pinfo, SND_SEQ_PORT_CAP_WRITE);
+ snd_seq_port_info_set_type (pinfo, SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+
+ rc = snd_seq_create_port (seq, pinfo);
+
+ sender.client = (int) client;
+ sender.port = (int) port;
+ dest.client = snd_seq_port_info_get_client(pinfo);
+ dest.port = snd_seq_port_info_get_port(pinfo);
+
+ snd_seq_port_subscribe_set_sender (subs, &sender);
+ snd_seq_port_subscribe_set_dest (subs, &dest);
+ rc = snd_seq_subscribe_port(seq, subs);
+
+ {
+ int npfd;
+ struct pollfd *pfd;
+ jclass smcls, rcls;
+ jmethodID sminit, rsend;
+ jbyteArray mba;
+ jbyte *ba;
+ jobject msg;
+ jlong jtimestamp;
+
+ npfd = snd_seq_poll_descriptors_count (seq, POLLIN);
+ pfd = (struct pollfd *) alloca (npfd * sizeof (struct pollfd));
+ snd_seq_poll_descriptors (seq, pfd, npfd, POLLIN);
+
+ smcls = (*env)->FindClass(env, "javax/sound/midi/ShortMessage");
+ sminit = (*env)->GetMethodID(env, smcls, "<init>", "([B)V");
+
+ rcls = (*env)->FindClass(env, "javax/sound/midi/Receiver");
+ rsend = (*env)->GetMethodID(env, rcls, "send", "(Ljavax/sound/midi/MidiMessage;J)V");
+
+ while (1)
+ {
+ if (poll (pfd, npfd, 100000) > 0)
+ {
+ snd_seq_event_t *ev;
+
+ do
+ {
+ snd_seq_event_input (seq, &ev);
+
+ if ((ev->flags & SND_SEQ_TIME_STAMP_MASK) == SND_SEQ_TIME_STAMP_TICK)
+ jtimestamp = (jlong) ev->time.tick;
+ else
+ jtimestamp = (jlong) ev->time.time.tv_sec * (jlong) 1000000000
+ + (jlong) ev->time.time.tv_nsec;
+
+ switch (ev->type)
+ {
+ case SND_SEQ_EVENT_NOTEON:
+ mba = (*env)->NewByteArray (env, 3);
+ ba = (*env)->GetByteArrayElements (env, mba, 0);
+ ba[0] = 0x90 + ev->data.control.channel;
+ ba[1] = ev->data.note.note;
+ ba[2] = ev->data.note.velocity;
+ (*env)->ReleaseByteArrayElements (env, mba, ba, 0);
+ msg = (*env)->NewObject(env, smcls, sminit, mba);
+ (*env)->CallObjectMethod(env, receiver,
+ rsend, msg, jtimestamp);
+ break;
+
+ case SND_SEQ_EVENT_CONTROLLER:
+ mba = (*env)->NewByteArray (env, 3);
+ ba = (*env)->GetByteArrayElements (env, mba, 0);
+ ba[0] = 0xB0 + ev->data.control.channel;
+ ba[1] = ev->data.control.param;
+ ba[2] = ev->data.control.value;
+ (*env)->ReleaseByteArrayElements (env, mba, ba, 0);
+ msg = (*env)->NewObject(env, smcls, sminit, mba);
+ (*env)->CallObjectMethod(env, receiver,
+ rsend, msg, jtimestamp);
+ break;
+
+ default:
+ printf ("UNKNOWN EVENT 0x%x\n", ev->type);
+ break;
+ }
+
+ snd_seq_free_event(ev);
+ }
+ while (snd_seq_event_input_pending (seq, 0) > 0);
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/native/jni/midi-dssi/.cvsignore b/libjava/classpath/native/jni/midi-dssi/.cvsignore
new file mode 100644
index 00000000000..ac18ca27297
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/.cvsignore
@@ -0,0 +1,9 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.depsMakefile
+Makefile.in
+.deps
+Makefile
diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.am b/libjava/classpath/native/jni/midi-dssi/Makefile.am
new file mode 100644
index 00000000000..6b1ef0407aa
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/Makefile.am
@@ -0,0 +1,11 @@
+nativelib_LTLIBRARIES = libgjsmdssi.la
+
+libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \
+ gnu_javax_sound_midi_dssi_DSSISynthesizer.c \
+ dssi_data.h
+
+libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.in b/libjava/classpath/native/jni/midi-dssi/Makefile.in
new file mode 100644
index 00000000000..c3b4b7ef007
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/Makefile.in
@@ -0,0 +1,562 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SOURCES = $(libgjsmdssi_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/midi-dssi
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
+ $(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
+libgjsmdssi_la_DEPENDENCIES = \
+ $(top_builddir)/native/jni/classpath/jcl.lo
+am_libgjsmdssi_la_OBJECTS = \
+ gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.lo \
+ gnu_javax_sound_midi_dssi_DSSISynthesizer.lo
+libgjsmdssi_la_OBJECTS = $(am_libgjsmdssi_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgjsmdssi_la_SOURCES)
+DIST_SOURCES = $(libgjsmdssi_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GJDOC = @GJDOC@
+GTK_CAIRO_ENABLED = @GTK_CAIRO_ENABLED@
+GTK_CAIRO_FALSE = @GTK_CAIRO_FALSE@
+GTK_CAIRO_TRUE = @GTK_CAIRO_TRUE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+vm_classes = @vm_classes@
+nativelib_LTLIBRARIES = libgjsmdssi.la
+libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \
+ gnu_javax_sound_midi_dssi_DSSISynthesizer.c \
+ dssi_data.h
+
+libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/midi-dssi/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu native/jni/midi-dssi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-nativelibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
+ done
+
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgjsmdssi.la: $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativelibdir) $(libgjsmdssi_la_LDFLAGS) $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSISynthesizer.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nativelibLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-nativelibLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-nativelibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libjava/classpath/native/jni/midi-dssi/README b/libjava/classpath/native/jni/midi-dssi/README
new file mode 100644
index 00000000000..6913414ffa6
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/README
@@ -0,0 +1,134 @@
+The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+contains two functions (get_port_default and set_control) derived from
+example code in the DSSI distribution (http://dssi.sourceforge.net).
+The original DSSI example code is distributed under the following
+terms:
+
+ Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+
+ Permission to use, copy, modify, distribute, and sell this software
+ for any purpose is hereby granted without fee, provided that the
+ above copyright notice and this permission notice are included in
+ all copies or substantial portions of the software.
+
+
+The rest of this file contain the original versions of these
+functions.
+
+
+LADSPA_Data get_port_default(const LADSPA_Descriptor *plugin, int port)
+{
+ LADSPA_PortRangeHint hint = plugin->PortRangeHints[port];
+ float lower = hint.LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+ float upper = hint.UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+
+ if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) {
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) ||
+ !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
+ /* No hint, its not bounded, wild guess */
+ return 0.0f;
+ }
+
+ if (lower <= 0.0f && upper >= 0.0f) {
+ /* It spans 0.0, 0.0 is often a good guess */
+ return 0.0f;
+ }
+
+ /* No clues, return minimum */
+ return lower;
+ }
+
+ /* Try all the easy ones */
+
+ if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor)) {
+ return 0.0f;
+ } else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) {
+ return 1.0f;
+ } else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) {
+ return 100.0f;
+ } else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) {
+ return 440.0f;
+ }
+
+ /* All the others require some bounds */
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
+ if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)) {
+ return lower;
+ }
+ }
+ if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
+ if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor)) {
+ return upper;
+ }
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
+ if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) {
+ return lower * 0.75f + upper * 0.25f;
+ } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) {
+ return lower * 0.5f + upper * 0.5f;
+ } else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) {
+ return lower * 0.25f + upper * 0.75f;
+ }
+ }
+ }
+
+ /* fallback */
+ return 0.0f;
+}
+
+
+void
+setControl(d3h_instance_t *instance, long controlIn, snd_seq_event_t *event)
+{
+ long port = pluginControlInPortNumbers[controlIn];
+
+ const LADSPA_Descriptor *p = instance->plugin->descriptor->LADSPA_Plugin;
+
+ LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor;
+
+ LADSPA_Data lb = p->PortRangeHints[port].LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ sample_rate : 1.0f);
+
+ LADSPA_Data ub = p->PortRangeHints[port].UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ sample_rate : 1.0f);
+
+ float value = (float)event->data.control.value;
+
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
+ /* unbounded: might as well leave the value alone. */
+ } else {
+ /* bounded above only. just shift the range. */
+ value = ub - 127.0f + value;
+ }
+ } else {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
+ /* bounded below only. just shift the range. */
+ value = lb + value;
+ } else {
+ /* bounded both ends. more interesting. */
+ if (LADSPA_IS_HINT_LOGARITHMIC(d)) {
+ const float llb = logf(lb);
+ const float lub = logf(ub);
+
+ value = expf(llb + ((lub - llb) * value / 127.0f));
+ } else {
+ value = lb + ((ub - lb) * value / 127.0f);
+ }
+ }
+ }
+
+ if (verbose) {
+ printf("%s: %s MIDI controller %d=%d -> control in %ld=%f\n", myName,
+ instance->friendly_name, event->data.control.param,
+ event->data.control.value, controlIn, value);
+ }
+
+ pluginControlIns[controlIn] = value;
+ pluginPortUpdated[controlIn] = 1;
+}
+
diff --git a/libjava/classpath/native/jni/midi-dssi/dssi_data.h b/libjava/classpath/native/jni/midi-dssi/dssi_data.h
new file mode 100644
index 00000000000..8278f7b9e18
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/dssi_data.h
@@ -0,0 +1,121 @@
+/* dssi_data.h - DSSI data
+ 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. */
+
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+#include <jni.h>
+#include <dssi.h>
+#include <jack/jack.h>
+#include <alsa/asoundlib.h>
+#include <alsa/seq.h>
+
+#include <stdio.h>
+
+#include "target_native.h"
+#include "target_native_misc.h"
+#include "../classpath/jcl.h"
+
+/* Specify the size of the circular buffer. It only needs to be big
+ enough to hold the events that happen between jack callbacks (~
+ 1/40th of a second). */
+#define EVENT_BUFFER_SIZE 1024
+
+/* Helper macros for going between pointers and jlongs. */
+#define JLONG_TO_PTR(T,P) ((T *)(long)P)
+#define PTR_TO_JLONG(P) ((jlong)(long)P)
+
+
+/* Every DSSI Synthesizer has one of these associated with it. The
+ Java class sees it as a "long" handle. */
+
+typedef struct
+{
+ /* This is a handle to the dlopen'ed .so file containing the DSSI
+ synthesizer. */
+ void *dlhandle;
+
+ /* The function to call to get the DSS_Descriptor. */
+ DSSI_Descriptor_Function fn;
+
+ /* The descriptor for this synthesizer. See the dssi.h system
+ header. */
+ const DSSI_Descriptor *desc;
+
+ /* We currently open a jack client connection for every
+ synthesizer. */
+ jack_client_t *jack_client;
+
+ /* We currently only handle stereo jack connections. Output from
+ mono synthesizers is sent to both left and right ports. */
+ jack_port_t *jack_left_output_port;
+ jack_port_t *jack_right_output_port;
+
+ /* We use a circular buffer to hold MIDI events before processing
+ them in the jack audio processing callback function. */
+ snd_seq_event_t midiEventBuffer[EVENT_BUFFER_SIZE];
+ int midiEventReadIndex;
+ int midiEventWriteIndex;
+
+ /* This is a handle the synthesizers underlying LADSPA structure.
+ See the ladspa.h system header for details. */
+ LADSPA_Handle plugin_handle;
+
+ /* These are buffers we pass to the DSSI Synthesizer for
+ filling. */
+ float *left_buffer;
+ float *right_buffer;
+
+ /* The number of input controls for this synth. */
+ unsigned control_count;
+
+ /* An array of control values, control_count in length. */
+ LADSPA_Data *control_values;
+
+ /* A mapping of MIDI controllers to control values. There are a
+ maximum of 128 MIDI controllers. */
+ unsigned control_value_map[128];
+
+ /* A mapping of MIDI controllers to LADSPA ports. There are a
+ maximum of 128 MIDI controllers. */
+ unsigned control_port_map[128];
+
+ /* The sample rate. */
+ jack_nframes_t sample_rate;
+
+} dssi_data;
+
diff --git a/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
new file mode 100644
index 00000000000..3cad45931bb
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
@@ -0,0 +1,139 @@
+/* gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c - DSSI Provider
+ 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. */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h>
+
+#include "dssi_data.h"
+
+void
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong sohandle)
+{
+ dssi_data *data = (dssi_data *) (long) sohandle;
+ dlclose (data->dlhandle);
+ JCL_free (env, data);
+}
+
+jlong
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jstring name)
+{
+ const char *filename;
+ void *handle;
+ DSSI_Descriptor_Function fn;
+ dssi_data *data = 0;
+
+ filename = JCL_jstring_to_cstring (env, name);
+ if (filename == NULL)
+ return (0);
+
+ handle = dlopen(filename, RTLD_NOW);
+
+ if (handle == 0)
+ goto done;
+
+ fn = (DSSI_Descriptor_Function) dlsym(handle, "dssi_descriptor");
+
+ if (fn == 0)
+ {
+ dlclose(handle);
+ goto done;
+ }
+
+ data = (dssi_data *) JCL_malloc(env, sizeof(dssi_data));
+ data->dlhandle = handle;
+ data->fn = fn;
+ data->midiEventReadIndex = 0;
+ data->midiEventWriteIndex = 0;
+
+ done:
+ JCL_free_cstring (env, name, filename);
+ return PTR_TO_JLONG(data);
+}
+
+jlong
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1
+ (JNIEnv *env __attribute__((unused)),
+ jclass clazz __attribute__((unused)), jlong handle, jlong index)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+ data->desc = (data->fn)(index);
+ return PTR_TO_JLONG(data->desc);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Name;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Copyright;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Maker;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Label;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+
diff --git a/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
new file mode 100644
index 00000000000..ec1477ec8db
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
@@ -0,0 +1,584 @@
+/* gnu_javax_sound_midi_dssi_DSSISynthesizer.c - DSSI Synth
+ 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. */
+
+/* The original get_port_default() and set_control() routines were
+ * copied from the DSSI source distribution and are covered by the
+ * following copyright and license...
+ *
+ * Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * for any purpose is hereby granted without fee, provided that the
+ * above copyright notice and this permission notice are included in
+ * all copies or substantial portions of the software.
+ */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_dssi_DSSISynthesizer.h>
+#include <math.h>
+
+#include "dssi_data.h"
+
+/* Define this for debug output. */
+#undef DEBUG_DSSI_PROVIDER
+
+static void set_control (dssi_data *data, snd_seq_event_t *event);
+
+
+/**
+ * The jack callback routine.
+ *
+ * This function is called by the jack audio system in its own thread
+ * whenever it needs new audio data.
+ *
+ */
+static int
+process (jack_nframes_t nframes, void *arg)
+{
+ dssi_data *data = (dssi_data *) arg;
+ int index;
+ jack_default_audio_sample_t *buffer;
+
+ /* Look through the event buffer to see if any control values
+ need changing. */
+ for ( index = data->midiEventReadIndex;
+ index != data->midiEventWriteIndex;
+ index = (index + 1) % EVENT_BUFFER_SIZE)
+ {
+ if (data->midiEventBuffer[index].type == SND_SEQ_EVENT_CONTROLLER)
+ set_control (data, & data->midiEventBuffer[index]);
+ }
+
+ if (data->desc->run_synth)
+ {
+ /* Call the synth audio processing routine. */
+ data->desc->run_synth
+ (data->plugin_handle,
+ nframes,
+ &data->midiEventBuffer[data->midiEventReadIndex],
+ data->midiEventWriteIndex - data->midiEventReadIndex);
+ }
+ else
+ if (data->desc->run_multiple_synths)
+ {
+ snd_seq_event_t *events =
+ &data->midiEventBuffer[data->midiEventReadIndex];
+ unsigned long event_count =
+ data->midiEventWriteIndex - data->midiEventReadIndex;
+
+ /* Call the synth audio processing routine. */
+ data->desc->run_multiple_synths
+ (1,
+ & (data->plugin_handle),
+ nframes,
+ &events,
+ &event_count);
+ }
+
+ /* Update the read index on our circular buffer. */
+ data->midiEventReadIndex = data->midiEventWriteIndex;
+
+ /* Copy output from the synth to jack.
+
+ FIXME: This is hack that only gets one channel from the synth and
+ send that to both jack ports (until we handle stero synths
+ properly).
+
+ FIXME: Can we avoid this copying? */
+ buffer = jack_port_get_buffer(data->jack_left_output_port, nframes);
+ memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data));
+ buffer = jack_port_get_buffer(data->jack_right_output_port, nframes);
+ memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data));
+
+ return 0;
+}
+
+
+/**
+ * Calculate a reasonable default value for a specific control port.
+ * This is mostly copied from the DSSI example code. Copyright info
+ * is found at the top of this file.
+ *
+ */
+static LADSPA_Data
+get_port_default (const LADSPA_Descriptor *plugin,
+ int port, jack_nframes_t sample_rate)
+{
+ LADSPA_PortRangeHint hint = plugin->PortRangeHints[port];
+ float lower = hint.LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+ float upper = hint.UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+
+ if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor))
+ {
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) ||
+ !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
+ {
+ /* No hint, its not bounded, wild guess */
+ return 0.0f;
+ }
+
+ if (lower <= 0.0f && upper >= 0.0f)
+ {
+ /* It spans 0.0, 0.0 is often a good guess */
+ return 0.0f;
+ }
+
+ /* No clues, return minimum */
+ return lower;
+ }
+
+ /* Try all the easy ones */
+
+ if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor))
+ return 0.0f;
+ else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor))
+ return 1.0f;
+ else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor))
+ return 100.0f;
+ else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor))
+ return 440.0f;
+
+ /* All the others require some bounds */
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)
+ && (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)))
+ return lower;
+
+ if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
+ {
+ if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor))
+ return upper;
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
+ {
+ if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor))
+ return lower * 0.75f + upper * 0.25f;
+ else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor))
+ return lower * 0.5f + upper * 0.5f;
+ else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor))
+ return lower * 0.25f + upper * 0.75f;
+ }
+ }
+
+ /* fallback */
+ return 0.0f;
+}
+
+/**
+ * Set a control value by mapping the MIDI event to a suitable value
+ * for this control.
+ * This is mostly copied from the DSSI example code. Copyright info
+ * is found at the top of this file.
+ *
+ */
+static void
+set_control(dssi_data *data, snd_seq_event_t *event)
+{
+ unsigned control = event->data.control.param;
+ unsigned port = data->control_port_map[control];
+
+ const LADSPA_Descriptor *p = data->desc->LADSPA_Plugin;
+
+ LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor;
+
+ LADSPA_Data lb = p->PortRangeHints[port].LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ data->sample_rate : 1.0f);
+
+ LADSPA_Data ub = p->PortRangeHints[port].UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ data->sample_rate : 1.0f);
+
+ float value = (float)event->data.control.value;
+
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(d))
+ {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d))
+ {
+ /* unbounded: might as well leave the value alone. */
+ }
+ else
+ {
+ /* bounded above only. just shift the range. */
+ value = ub - 127.0f + value;
+ }
+ }
+ else
+ {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d))
+ {
+ /* bounded below only. just shift the range. */
+ value = lb + value;
+ }
+ else
+ {
+ /* bounded both ends. more interesting. */
+ if (LADSPA_IS_HINT_LOGARITHMIC(d))
+ {
+ const float llb = logf(lb);
+ const float lub = logf(ub);
+
+ value = expf(llb + ((lub - llb) * value / 127.0f));
+ }
+ else
+ {
+ value = lb + ((ub - lb) * value / 127.0f);
+ }
+ }
+ }
+
+#ifdef DEBUG_DSSI_PROVIDER
+ printf("MIDI controller %d=%d -> control in %u=%f\n",
+ event->data.control.param,
+ event->data.control.value,
+ data->control_value_map[control], value);
+#endif
+
+ data->control_values[data->control_value_map[control]] = value;
+}
+
+/**
+ * Open a new synthesizer. This currently involves instantiating a
+ * new synth, creating a new jack client connection, and activating
+ * both.
+ *
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ unsigned int port_count, j, cindex;
+ const char **ports;
+ int controller = 0;
+ dssi_data *data = (dssi_data *) (long) handle;
+ if ((data->jack_client = jack_client_new (data->desc->LADSPA_Plugin->Label)) == 0)
+ {
+ /* JCL_ThrowException (env, "javax/sound/midi/MidiUnavailableException", */
+ JCL_ThrowException (env, "java/io/IOException",
+ "can't create jack client");
+ return;
+ }
+
+ /* Get the jack sample rate, which may be used in default control port
+ value calculations. */
+ data->sample_rate = jack_get_sample_rate (data->jack_client);
+
+ data->plugin_handle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ data->sample_rate);
+
+ if (jack_set_process_callback (data->jack_client, process, data) != 0)
+ {
+ JCL_ThrowException (env, "java/io/IOException",
+ "can't set jack process callback");
+ return;
+ }
+
+ data->jack_left_output_port =
+ jack_port_register (data->jack_client, "output_left",
+ JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+ data->jack_right_output_port =
+ jack_port_register (data->jack_client, "output_right",
+ JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+ /* Count the number of controls and audio ouput ports. */
+ port_count = data->control_count = 0;
+ for (j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++)
+ {
+ LADSPA_PortDescriptor pod =
+ data->desc->LADSPA_Plugin->PortDescriptors[j];
+
+ if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod))
+ port_count++;
+ else if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod))
+ data->control_count++;
+ }
+
+ /* Allocate the array of control values. */
+ data->control_values =
+ (LADSPA_Data *) JCL_malloc (env,
+ data->control_count * sizeof (LADSPA_Data));
+
+ /* Initialize the MIDI control map. */
+ memset (data->control_value_map, 0, data->control_count * sizeof(unsigned));
+
+ /* Create buffers for each port. */
+ for (cindex = 0, j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++)
+ {
+ LADSPA_PortDescriptor pod =
+ data->desc->LADSPA_Plugin->PortDescriptors[j];
+ if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod))
+ {
+ data->left_buffer =
+ (float *) calloc(jack_get_buffer_size(data->jack_client),
+ sizeof(float));
+ (data->desc->LADSPA_Plugin->connect_port)(data->plugin_handle, j,
+ data->left_buffer);
+ }
+ else
+ if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod))
+ {
+ /* This is an input control port. Connect it to a properly
+ initialized value in our controller value array. */
+ (data->desc->LADSPA_Plugin->connect_port)
+ (data->plugin_handle, j, &(data->control_values[cindex]));
+ data->control_values[cindex] =
+ get_port_default (data->desc->LADSPA_Plugin,
+ j, data->sample_rate);
+
+ /* Set up the mapping between MIDI controllers and this
+ contoller value. */
+ if (data->desc->get_midi_controller_for_port)
+ {
+ controller = data->desc->
+ get_midi_controller_for_port(data->plugin_handle, j);
+
+ if ((controller != DSSI_NONE) && DSSI_IS_CC(controller))
+ {
+ data->control_value_map[DSSI_CC_NUMBER(controller)] = cindex;
+ data->control_port_map[DSSI_CC_NUMBER(controller)] = j;
+
+#ifdef DEBUG_DSSI_PROVIDER
+ printf ("MIDI Controller 0x%x [%s] = %g\n",
+ DSSI_CC_NUMBER(controller),
+ data->desc->LADSPA_Plugin->PortNames[j],
+ data->control_values[cindex]);
+#endif
+ }
+ }
+
+ cindex++;
+ }
+ }
+
+ (data->desc->LADSPA_Plugin->activate)(data->plugin_handle);
+
+ if (jack_activate (data->jack_client))
+ JCL_ThrowException (env, "java/io/IOException",
+ "can't activate jack client");
+
+ /* Try to connect the synth output to hardware audio ports. */
+ ports = jack_get_ports (data->jack_client, NULL, NULL,
+ JackPortIsPhysical | JackPortIsInput);
+ if (ports)
+ {
+ if (ports[0] && ports[1])
+ {
+ /* Don't bother checking return values. Failing is OK. */
+ jack_connect (data->jack_client,
+ jack_port_name (data->jack_left_output_port),
+ ports[0]);
+ jack_connect (data->jack_client,
+ jack_port_name (data->jack_right_output_port),
+ ports[1]);
+ }
+ free(ports);
+ }
+}
+
+/**
+ * This is called when we receive a new MIDI CONTROL CHANGE message.
+ * Simply stick an appropriate event in the event buffer. This will
+ * get processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_controlChange_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint channel, jint control, jint value)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+ /* Insert this event in the event buffer. */
+ snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+ /* Set the event value. */
+ snd_seq_ev_set_controller (ev, channel, control, value);
+
+ data->midiEventWriteIndex =
+ (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+/**
+ * This is called when we receive a new MIDI NOTE ON message. Simply
+ * stick an appropriate event in the event buffer. This will get
+ * processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint channel, jint note, jint velocity)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+ /* Insert this event in the event buffer. */
+ snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+ ev->type = SND_SEQ_EVENT_NOTEON;
+ ev->data.control.channel = channel;
+ ev->data.note.note = note;
+ ev->data.note.velocity = velocity;
+
+ data->midiEventWriteIndex =
+ (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+/**
+ * This is called when we receive a new MIDI NOTE OFF message. Simply
+ * stick an appropriate event in the event buffer. This will get
+ * processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1
+ (JNIEnv *env __attribute__((unused)),
+ jclass clazz __attribute__((unused)),
+ jlong handle, jint channel, jint note, jint velocity)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+ /* Insert this event in the event buffer. */
+ snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+ ev->type = SND_SEQ_EVENT_NOTEOFF;
+ ev->data.control.channel = channel;
+ ev->data.note.note = note;
+ ev->data.note.velocity = velocity;
+
+ data->midiEventWriteIndex =
+ (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_setPolyPressure_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle __attribute__((unused)), jint channel __attribute__((unused)),
+ jint note __attribute__((unused)), jint velocity __attribute__((unused)))
+{
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getPolyPressure_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle __attribute__((unused)), jint channel __attribute__((unused)),
+ jint note __attribute__((unused)))
+{
+ return 0;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle __attribute__((unused)))
+{
+}
+
+/* FIXME: These next three functions are really inefficient because
+ we're instantiating and cleaning up plugin instances just to query
+ values. */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)),
+ jlong handle, jint index)
+{
+ LADSPA_Handle lhandle;
+ jstring name = (jstring) NULL;
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+ if (data->desc->get_program == NULL)
+ return NULL;
+ lhandle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ 48000);
+ const DSSI_Program_Descriptor *program =
+ (data->desc->get_program)(lhandle, (unsigned long) index);
+ if (program)
+ name = (*env)->NewStringUTF (env, program->Name);
+ (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+
+ return name;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint index)
+{
+ LADSPA_Handle lhandle;
+ jint result = -1;
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+ lhandle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ 48000);
+ const DSSI_Program_Descriptor *program =
+ (data->desc->get_program)(lhandle, (unsigned long) index);
+ if (program)
+ result = (jint) program->Bank;
+ (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint index)
+{
+ LADSPA_Handle lhandle;
+ jint result = -1;
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+ lhandle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ 48000);
+ const DSSI_Program_Descriptor *program =
+ (data->desc->get_program)(lhandle, (unsigned long) index);
+ if (program)
+ result = (jint) program->Program;
+ (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+ return result;
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint bank, jint program)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+
+ (data->desc->select_program)(data->plugin_handle,
+ (unsigned) bank, (unsigned) program);
+}
diff --git a/libjava/classpath/native/jni/qt-peer/Makefile.in b/libjava/classpath/native/jni/qt-peer/Makefile.in
index 266238fc321..ab3b23007d4 100644
--- a/libjava/classpath/native/jni/qt-peer/Makefile.in
+++ b/libjava/classpath/native/jni/qt-peer/Makefile.in
@@ -45,10 +45,8 @@ target_triplet = @target@
subdir = native/jni/qt-peer
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -121,10 +119,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -261,6 +263,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -274,6 +277,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/jni/qt-peer/componentevent.cpp b/libjava/classpath/native/jni/qt-peer/componentevent.cpp
index ff189e49e04..ae88af01929 100644
--- a/libjava/classpath/native/jni/qt-peer/componentevent.cpp
+++ b/libjava/classpath/native/jni/qt-peer/componentevent.cpp
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+#include <assert.h>
#include <QWidget>
#include <QPoint>
diff --git a/libjava/classpath/native/jni/xmlj/Makefile.in b/libjava/classpath/native/jni/xmlj/Makefile.in
index acac40d07a5..2fb6e202a25 100644
--- a/libjava/classpath/native/jni/xmlj/Makefile.in
+++ b/libjava/classpath/native/jni/xmlj/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/xmlj
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -97,10 +95,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -237,6 +239,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -250,6 +253,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/target/Linux/Makefile.in b/libjava/classpath/native/target/Linux/Makefile.in
index c7a0a2e4013..50579b9d206 100644
--- a/libjava/classpath/native/target/Linux/Makefile.in
+++ b/libjava/classpath/native/target/Linux/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/target/Linux
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/target/Makefile.in b/libjava/classpath/native/target/Makefile.in
index aaa7a15a5af..2dcc1f20830 100644
--- a/libjava/classpath/native/target/Makefile.in
+++ b/libjava/classpath/native/target/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/target
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -84,10 +82,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -224,6 +226,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -237,6 +240,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/target/generic/Makefile.in b/libjava/classpath/native/target/generic/Makefile.in
index 097f8da674a..13f2026f259 100644
--- a/libjava/classpath/native/target/generic/Makefile.in
+++ b/libjava/classpath/native/target/generic/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/target/generic
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/org/ietf/jgss/GSSCredential.java b/libjava/classpath/org/ietf/jgss/GSSCredential.java
index 724825d5eed..bdf14971006 100644
--- a/libjava/classpath/org/ietf/jgss/GSSCredential.java
+++ b/libjava/classpath/org/ietf/jgss/GSSCredential.java
@@ -331,4 +331,14 @@ public interface GSSCredential extends Cloneable
* @return True if this object equals the other.
*/
boolean equals(Object another);
+
+ /**
+ * Return the hash code of this credential. When overriding {@link #equals},
+ * it is necessary to override hashCode() as well.
+ *
+ * @return the hash code that must be the same for two credentials if
+ * {@link #equals} returns true.
+ */
+ int hashCode();
+
}
diff --git a/libjava/classpath/org/ietf/jgss/GSSException.java b/libjava/classpath/org/ietf/jgss/GSSException.java
index 5443f766cfe..9c352e3e937 100644
--- a/libjava/classpath/org/ietf/jgss/GSSException.java
+++ b/libjava/classpath/org/ietf/jgss/GSSException.java
@@ -1,5 +1,5 @@
/* GSSException.java -- a general exception in GSS.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -79,6 +79,9 @@ import java.util.ResourceBundle;
* the caller, this class performs the mapping from their numeric values
* to textual representations. All Java GSS-API methods are declared
* throwing this exception.
+ *
+ * @specnote Some of the constant values defined in this class were
+ * chosen to be compatible with J2SE 1.4, and not with RFC 2853.
*/
public class GSSException extends Exception
{
@@ -90,28 +93,29 @@ public class GSSException extends Exception
// Constants and fields.
// -------------------------------------------------------------------------
- // These values do not jive with the "Constant Field Values" in the J2SE
- // 1.4.1, but do follow RFC 2853. I trust the IETF, but not Sun.
-
/**
* Channel bindings mismatch error.
+ * @specnote Should be 4 according to RFC 2853.
*/
- public static final int BAD_BINDINGS = 4;
+ public static final int BAD_BINDINGS = 1;
/**
* Unsupported mechanism requested error.
+ * @specnote Should be 1 according to RFC 2853.
*/
- public static final int BAD_MECH = 1;
+ public static final int BAD_MECH = 2;
/**
* Invalid name provided error.
+ * @specnote Should be 2 according to RFC 2853.
*/
- public static final int BAD_NAME = 2;
+ public static final int BAD_NAME = 3;
/**
* Name of unsupported type provided error.
+ * @specnote Should be 3 according to RFC 2853.
*/
- public static final int BAD_NAMETYPE = 3;
+ public static final int BAD_NAMETYPE = 4;
/**
* Invalid status code error - this is the default status value.
@@ -125,38 +129,45 @@ public class GSSException extends Exception
/**
* Specified security context expired error.
+ * @specnote Should be 12 according to RFC 2853.
*/
- public static final int CONTEXT_EXPIRED = 12;
+ public static final int CONTEXT_EXPIRED = 7;
/**
* Expired credentials detected error.
+ * @specnote Should be 11 according to RFC 2853.
*/
- public static final int CREDENTIALS_EXPIRED = 11;
+ public static final int CREDENTIALS_EXPIRED = 8;
/**
* Defective credential error.
+ * @specnote Should be 10 according to RFC 2853.
*/
- public static final int DEFECTIVE_CREDENTIAL = 10;
+ public static final int DEFECTIVE_CREDENTIAL = 9;
/**
* Defective token error.
+ * @specnote Should be 9 according to RFC 2853.
*/
- public static final int DEFECTIVE_TOKEN = 9;
+ public static final int DEFECTIVE_TOKEN = 10;
/**
* General failure, unspecified at GSS-API level.
+ * @specnote Should be 13 according to RFC 2853.
*/
- public static final int FAILURE = 13;
+ public static final int FAILURE = 11;
/**
* Invalid security context error.
+ * @specnote Should be 8 according to RFC 2853.
*/
- public static final int NO_CONTEXT = 8;
+ public static final int NO_CONTEXT = 12;
/**
* Invalid credentials error.
+ * @specnote Should be 7 according to RFC 2853.
*/
- public static final int NO_CRED = 7;
+ public static final int NO_CRED = 13;
/**
* Unsupported QOP value error.
@@ -188,16 +199,18 @@ public class GSSException extends Exception
* code that may occur during context establishment. It is not used to
* indicate supplementary status values. The MessageProp object is used
* for that purpose.
+ * @specnote Should be 20 according to RFC 2853.
*/
- public static final int DUPLICATE_TOKEN = 20;
+ public static final int DUPLICATE_TOKEN = 19;
/**
* The token's validity period has expired. This is a fatal error code
* that may occur during context establishment. It is not used to
* indicate supplementary status values. The MessageProp object is used
* for that purpose.
+ * @specnote Should be 19 according to RFC 2853.
*/
- public static final int OLD_TOKEN = 19;
+ public static final int OLD_TOKEN = 20;
/**
* A later token has already been processed. This is a fatal error code
diff --git a/libjava/classpath/org/ietf/jgss/GSSName.java b/libjava/classpath/org/ietf/jgss/GSSName.java
index 5550697b5f0..ee3209dd0b4 100644
--- a/libjava/classpath/org/ietf/jgss/GSSName.java
+++ b/libjava/classpath/org/ietf/jgss/GSSName.java
@@ -201,6 +201,15 @@ public interface GSSName
boolean equals(Object another);
/**
+ * Return the hashcode of this GSSName. When overriding {@link #equals},
+ * it is normally necessary to override hashCode() as well.
+ *
+ * @return the hash code that must be the same for two names if {@link #equals}
+ * returns true.
+ */
+ int hashCode();
+
+ /**
* Creates a mechanism name (MN) from an arbitrary internal name. This
* is equivalent to using the factory methods {@link
* GSSManager#createName(java.lang.String,org.ietf.jgss.Oid,org.ietf.jgss.Oid)}
diff --git a/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java b/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java
new file mode 100644
index 00000000000..ea234e620c8
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java
@@ -0,0 +1,102 @@
+/* ACTIVITY_COMPLETED.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * The ACTIVITY_COMPLETED indicates that the Activity context in which the
+ * method call was made has been completed due to a timeout of either the
+ * Activity itself or a transaction that encompasses the Activity. It also
+ * may mean that the Activity is completed in a manner other than that
+ * originally requested.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ACTIVITY_COMPLETED
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 463786710302308798L;
+
+ /**
+ * Creates ACTIVITY_COMPLETED with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public ACTIVITY_COMPLETED(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates ACTIVITY_COMPLETED with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public ACTIVITY_COMPLETED()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a ACTIVITY_COMPLETED exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_COMPLETED(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created ACTIVITY_COMPLETED exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_COMPLETED(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java b/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java
new file mode 100644
index 00000000000..c0c72b524b1
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java
@@ -0,0 +1,100 @@
+/* ACTIVITY_REQUIRED.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * The ACTIVITY_REQUIRED system exception indicates that an Activity context was
+ * necessary to perform the invoked operation, but one was not found
+ * associated with the calling thread.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ACTIVITY_REQUIRED
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = -5684213471781455027L;
+
+ /**
+ * Creates ACTIVITY_REQUIRED with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public ACTIVITY_REQUIRED(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates ACTIVITY_REQUIRED with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public ACTIVITY_REQUIRED()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a ACTIVITY_REQUIRED exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_REQUIRED(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created ACTIVITY_REQUIRED exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_REQUIRED(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/AnyHolder.java b/libjava/classpath/org/omg/CORBA/AnyHolder.java
index 0055fdd7482..10f828aabe5 100644
--- a/libjava/classpath/org/omg/CORBA/AnyHolder.java
+++ b/libjava/classpath/org/omg/CORBA/AnyHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -55,7 +55,7 @@ public final class AnyHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_any = new primitiveTypeCode(TCKind.tk_any);
+ private static final TypeCode t_any = new PrimitiveTypeCode(TCKind.tk_any);
/**
* The instance of {@link Any} (not the "any value"), held by this holder.
diff --git a/libjava/classpath/org/omg/CORBA/AnySeqHelper.java b/libjava/classpath/org/omg/CORBA/AnySeqHelper.java
index 5c45bb3d83b..8ebae7a193f 100644
--- a/libjava/classpath/org/omg/CORBA/AnySeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/AnySeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -130,7 +130,7 @@ public abstract class AnySeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_any);
+ return new ArrayTypeCode(TCKind.tk_any);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/AnySeqHolder.java b/libjava/classpath/org/omg/CORBA/AnySeqHolder.java
index 905e05c8b03..b18a1457b15 100644
--- a/libjava/classpath/org/omg/CORBA/AnySeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/AnySeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class AnySeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_any);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_any);
/**
* Constructs an instance of AnySeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java b/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java
index 26b3406658f..2649f2a6dc4 100755
--- a/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java
+++ b/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java
@@ -41,8 +41,76 @@ package org.omg.CORBA;
import java.io.Serializable;
/**
- * Means that the object exists but does not support the operation that
- * was invoked on it.
+ * Means that the object exists but does not support the operation that was
+ * invoked on it.
+ *
+ * In GNU Classpath, this exception may have the following Minor codes:
+ *
+ * <table border="1">
+ * <tr>
+ * <th>Hex</th>
+ * <th>Dec</th>
+ * <th>Minor</th>
+ * <th>Name</th>
+ * <th>Case</th>
+ * </tr>
+ * <tr>
+ * <td>47430000</td>
+ * <td>1195573248 </td>
+ * <td>0</td>
+ * <td>Method</td>
+ * <td> The remote side requested to invoke the method that is not available on
+ * that target (client and server probably disagree in the object definition).
+ * This code is set when the problem arises in the Classpath core; the idlj and
+ * rmic may generate the user code that sets 0x0 or other value.</td>
+ * </tr>
+ * <tr>
+ * <td>47430009</td>
+ * <td>1195573257</td>
+ * <td>9</td>
+ * <td>Any</td>
+ * <td> Attempt to extract from the Any value of the different type that was
+ * stored into that Any. </td>
+ * </tr>
+ * <tr>
+ * <td>4743000a</td>
+ * <td>1195573258</td>
+ * <td>10</td>
+ * <td>Activation</td>
+ * <td>Failed to activate the inactive object due any reason.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000b</td>
+ * <td>1195573259</td>
+ * <td>11</td>
+ * <td>Policy</td>
+ * <td> The policies, applying to ORB or POA prevent the requested operation.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>4743000c</td>
+ * <td>1195573260</td>
+ * <td>12</td>
+ * <td>Socket</td>
+ * <td> Socket related errors like failure to open socket on the expected port.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000e</td>
+ * <td>1195573262</td>
+ * <td>14</td>
+ * <td>Enumeration</td>
+ * <td> The passed value for enumeration is outside the valid range for that
+ * enumeration. </td>
+ * </tr>
+ * <tr>
+ * <td>4743000f</td>
+ * <td>1195573263</td>
+ * <td>15</td>
+ * <td>PolicyType</td>
+ * <td> The passed policy code is outside the valid range of the possible
+ * policies for the given policy type. </td>
+ * </tr>
+ * </table>
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
@@ -50,14 +118,15 @@ public class BAD_OPERATION
extends SystemException
implements Serializable
{
- /**
- * Use serialVersionUID for interoperability.
+ /**
+ * Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1654621651720499682L;
/**
- * Creates a BAD_OPERATION with the default minor code of 0,
- * completion state COMPLETED_NO and the given explaining message.
+ * Creates a BAD_OPERATION with the default minor code of 0, completion state
+ * COMPLETED_NO and the given explaining message.
+ *
* @param reasom the explaining message.
*/
public BAD_OPERATION(String message)
@@ -66,16 +135,18 @@ public class BAD_OPERATION
}
/**
- * Creates BAD_OPERATION with the default minor code of 0 and a
- * completion state COMPLETED_NO.
+ * Creates BAD_OPERATION with the default minor code of 0 and a completion
+ * state COMPLETED_NO.
*/
public BAD_OPERATION()
{
super("", 0, CompletionStatus.COMPLETED_NO);
}
- /** Creates a BAD_OPERATION exception with the specified minor
- * code and completion status.
+ /**
+ * Creates a BAD_OPERATION exception with the specified minor code and
+ * completion status.
+ *
* @param minor additional error code.
* @param completed the method completion status.
*/
@@ -86,6 +157,7 @@ public class BAD_OPERATION
/**
* Created BAD_OPERATION exception, providing full information.
+ *
* @param reason explaining message.
* @param minor additional error code (the "minor").
* @param completed the method completion status.
diff --git a/libjava/classpath/org/omg/CORBA/BAD_QOS.java b/libjava/classpath/org/omg/CORBA/BAD_QOS.java
new file mode 100644
index 00000000000..ba8a0df3248
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/BAD_QOS.java
@@ -0,0 +1,99 @@
+/* BAD_QOS.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * The BAD_QOS is raised when the object cannot support the quality of
+ * service required by an invocation parameter.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class BAD_QOS
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 4746597571263117454L;
+
+ /**
+ * Creates BAD_QOS with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public BAD_QOS(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates BAD_QOS with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public BAD_QOS()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a BAD_QOS exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public BAD_QOS(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created BAD_QOS exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public BAD_QOS(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/BooleanHolder.java b/libjava/classpath/org/omg/CORBA/BooleanHolder.java
index eddc62933a9..73cfeb29613 100644
--- a/libjava/classpath/org/omg/CORBA/BooleanHolder.java
+++ b/libjava/classpath/org/omg/CORBA/BooleanHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class BooleanHolder
* The default type code for this holder.
*/
private static final TypeCode t_boolean =
- new primitiveTypeCode(TCKind.tk_boolean);
+ new PrimitiveTypeCode(TCKind.tk_boolean);
/**
* The <code>boolean</code> (CORBA <code>boolean</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java b/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java
index d1fde8b7726..41f93d10d73 100644
--- a/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class BooleanSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_boolean);
+ return new ArrayTypeCode(TCKind.tk_boolean);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java b/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java
index ac8224f92e6..bdec3b79273 100644
--- a/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class BooleanSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_boolean);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_boolean);
/**
* Constructs an instance of BooleanSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/ByteHolder.java b/libjava/classpath/org/omg/CORBA/ByteHolder.java
index 0cfd8f03cba..c440822e58c 100644
--- a/libjava/classpath/org/omg/CORBA/ByteHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ByteHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class ByteHolder
* The default type code for this holder.
*/
private static final TypeCode t_octet =
- new primitiveTypeCode(TCKind.tk_octet);
+ new PrimitiveTypeCode(TCKind.tk_octet);
/**
* The <code>byte</code> (CORBA <code>octet</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java b/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java
new file mode 100644
index 00000000000..41ccaf49248
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java
@@ -0,0 +1,103 @@
+/* CODESET_INCOMPATIBLE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when client and server are unable to reach any consensus on which
+ * code set should be used to represent the characters. This happens when
+ * neither server nor client cannot convert from the native code set of the
+ * corresponding side, there is no shared codeset from that both sides could
+ * convert and additionally the client and server* native sets are too
+ * different to communicate anyway without the massive data loss.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class CODESET_INCOMPATIBLE
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = -8784048396454171789L;
+
+ /**
+ * Creates CODESET_INCOMPATIBLE with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public CODESET_INCOMPATIBLE(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates CODESET_INCOMPATIBLE with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public CODESET_INCOMPATIBLE()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a CODESET_INCOMPATIBLE exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public CODESET_INCOMPATIBLE(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created CODESET_INCOMPATIBLE exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public CODESET_INCOMPATIBLE(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/CharHolder.java b/libjava/classpath/org/omg/CORBA/CharHolder.java
index 67eb2ee8741..b8d0a3d6a31 100644
--- a/libjava/classpath/org/omg/CORBA/CharHolder.java
+++ b/libjava/classpath/org/omg/CORBA/CharHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -61,7 +61,7 @@ public final class CharHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_char = new primitiveTypeCode(TCKind.tk_char);
+ private static final TypeCode t_char = new PrimitiveTypeCode(TCKind.tk_char);
/**
* The <code>char</code> (CORBA <code>char</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/CharSeqHelper.java b/libjava/classpath/org/omg/CORBA/CharSeqHelper.java
index b91306c2c3e..08406058ca8 100644
--- a/libjava/classpath/org/omg/CORBA/CharSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/CharSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class CharSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_char);
+ return new ArrayTypeCode(TCKind.tk_char);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/CharSeqHolder.java b/libjava/classpath/org/omg/CORBA/CharSeqHolder.java
index dc7d0a84050..a60483b5f0f 100644
--- a/libjava/classpath/org/omg/CORBA/CharSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/CharSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class CharSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_char);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_char);
/**
* Constructs an instance of CharSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/CompletionStatus.java b/libjava/classpath/org/omg/CORBA/CompletionStatus.java
index f9f3704430a..1ddcca2877a 100644
--- a/libjava/classpath/org/omg/CORBA/CompletionStatus.java
+++ b/libjava/classpath/org/omg/CORBA/CompletionStatus.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
+
import java.io.Serializable;
import org.omg.CORBA.portable.IDLEntity;
@@ -108,6 +110,7 @@ public class CompletionStatus
/**
* Returns the CompletionStatus, matching the given integer constant
+ *
* @param completion one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE.
* @return one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE.
* @throws BAD_PARAM if the parameter is not one of these three valid values.
@@ -116,11 +119,14 @@ public class CompletionStatus
{
try
{
- return states [ completion ];
+ return states[completion];
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid completion status " + completion);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid completion status "
+ + completion);
+ bad.minor = Minor.Enumeration;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java b/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java
index f6285744852..43b6b8c1099 100644
--- a/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java
+++ b/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -131,7 +131,7 @@ public abstract class CompletionStatusHelper
new String[] { "COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE" };
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "CompletionStatus",
+ OrbRestricted.Singleton.create_enum_tc(id(), "CompletionStatus",
members
);
}
diff --git a/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java b/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java
index 3faacdcb2dd..7261aae4684 100644
--- a/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java
+++ b/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java
@@ -44,6 +44,26 @@ import java.io.Serializable;
* Means that the ORB cannot convert between the marshalled and
* native data representation.
*
+ * In GNU Classpath, this exception may have the following minor codes:
+ *
+ * <table border="1">
+ * <tr>
+ * <td>Hex</td>
+ * <td>Dec</td>
+ * <td>Minor</td>
+ * <td>Name</td>
+ * <td>Case</td>
+ * </tr>
+ * <td>47430016</td>
+ * <td>1195573270</td>
+ * <td>22</td>
+ * <td>Missing_IOR</td>
+ * <td>The object URL is such that the IOR string must be read from some
+ * local or remote resource (file or network), but this resource is not
+ * reacheable.</td>
+ * </tr>
+ * </table>
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class DATA_CONVERSION
diff --git a/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java b/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java
index d9c7cc15a46..fddbb585a2e 100644
--- a/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java
+++ b/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java
@@ -39,9 +39,9 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.DefinitionKindHolder;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.gnuAny;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -97,7 +97,7 @@ public abstract class DefinitionKindHelper
};
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "DefinitionKind",
+ OrbRestricted.Singleton.create_enum_tc(id(), "DefinitionKind",
members
);
}
diff --git a/libjava/classpath/org/omg/CORBA/DoubleHolder.java b/libjava/classpath/org/omg/CORBA/DoubleHolder.java
index efee74b0faa..65c8ebaf5e0 100644
--- a/libjava/classpath/org/omg/CORBA/DoubleHolder.java
+++ b/libjava/classpath/org/omg/CORBA/DoubleHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class DoubleHolder
* The default type code for this holder.
*/
private static final TypeCode t_double =
- new primitiveTypeCode(TCKind.tk_double);
+ new PrimitiveTypeCode(TCKind.tk_double);
/**
* The <code>double</code> (CORBA <code>double</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java b/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java
index d8dffbf4cdb..2d9423fd095 100644
--- a/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class DoubleSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_double);
+ return new ArrayTypeCode(TCKind.tk_double);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java b/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java
index a6828e1c137..619e9215bb9 100644
--- a/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class DoubleSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_double);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_double);
/**
* Constructs an instance of DoubleSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/DynamicImplementation.java b/libjava/classpath/org/omg/CORBA/DynamicImplementation.java
index 3bcf93d422b..3b1b4431905 100644
--- a/libjava/classpath/org/omg/CORBA/DynamicImplementation.java
+++ b/libjava/classpath/org/omg/CORBA/DynamicImplementation.java
@@ -38,7 +38,12 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.gnuAny;
+import gnu.CORBA.gnuNVList;
+
import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
/**
* This class was probably originally thinked as a base of all CORBA
@@ -51,18 +56,110 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class DynamicImplementation
+public class DynamicImplementation
extends ObjectImpl
{
/**
- * Invoke the method of the CORBA object.
- *
+ * Invoke the method of the CORBA object. After converting the parameters,
+ * this method delegates call to the {@link ObjectImpl#invoke}.
+ *
* @deprecated since 1.4.
- *
- * @param request the container for both passing and returing the
- * parameters, also contains the method name and thrown exceptions.
+ *
+ * @param request the container for both passing and returing the parameters,
+ * also contains the method name and thrown exceptions.
*/
- public abstract void invoke(ServerRequest request);
+ public void invoke(ServerRequest request)
+ {
+ Request r = _request(request.operation());
+
+ // Copy the parameters.
+ NVList args = new gnuNVList();
+ request.arguments(args);
+ NamedValue v;
+ int i = 0;
+
+ try
+ {
+ // Set the arguments.
+ for (i = 0; i < args.count(); i++)
+ {
+ v = args.item(i);
+ Any n;
+ OutputStream out;
+
+ switch (v.flags())
+ {
+ case ARG_IN.value:
+ out = v.value().create_output_stream();
+ v.value().write_value(out);
+ n = r.add_named_in_arg(v.name());
+ n.read_value(out.create_input_stream(), v.value().type());
+ break;
+ case ARG_INOUT.value:
+ out = v.value().create_output_stream();
+ v.value().write_value(out);
+ n = r.add_named_inout_arg(v.name());
+ n.read_value(out.create_input_stream(), v.value().type());
+ break;
+ case ARG_OUT.value:
+ r.add_named_out_arg(v.name());
+ break;
+
+ default:
+ throw new InternalError("Invalid flags " + v.flags());
+ }
+ }
+ }
+ catch (Bounds b)
+ {
+ throw new Unexpected(args.count() + "[" + i + "]", b);
+ }
+
+ // Set context.
+ r.ctx(request.ctx());
+
+ // Set the return type (expects that the ServerRequest will initialise
+ // the passed Any.
+
+ gnuAny g = new gnuAny();
+ request.result(g);
+ r.set_return_type(g.type());
+
+ // Invoke the method.
+ r.invoke();
+
+ // Transfer the returned values.
+ NVList r_args = r.arguments();
+
+ try
+ {
+ // API states that the ServerRequest.arguments must be called only
+ // once. Hence we assume we can just modify the previously returned
+ // value <code>args</code>, and the ServerRequest will preserve the
+ // reference.
+ for (i = 0; i < args.count(); i++)
+ {
+ v = args.item(i);
+
+ if (v.flags() == ARG_OUT.value || v.flags() == ARG_INOUT.value)
+ {
+ OutputStream out = r_args.item(i).value().create_output_stream();
+ r_args.item(i).value().write_value(out);
+ v.value().read_value(out.create_input_stream(),
+ v.value().type());
+ }
+ }
+ }
+ catch (Bounds b)
+ {
+ throw new Unexpected(args.count() + "[" + i + "]", b);
+ }
+
+ // Set the returned result (if any).
+ NamedValue returns = r.result();
+ if (returns != null)
+ request.set_result(returns.value());
+ }
/**
* Returns the array of the repository ids, supported by this object.
diff --git a/libjava/classpath/org/omg/CORBA/FieldNameHelper.java b/libjava/classpath/org/omg/CORBA/FieldNameHelper.java
index a35df4f3565..6d6de43da67 100644
--- a/libjava/classpath/org/omg/CORBA/FieldNameHelper.java
+++ b/libjava/classpath/org/omg/CORBA/FieldNameHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class FieldNameHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/FixedHolder.java b/libjava/classpath/org/omg/CORBA/FixedHolder.java
index c3918a08d0d..8913acc1755 100644
--- a/libjava/classpath/org/omg/CORBA/FixedHolder.java
+++ b/libjava/classpath/org/omg/CORBA/FixedHolder.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.fixedTypeCode;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import java.math.BigDecimal;
@@ -108,7 +108,7 @@ public final class FixedHolder
*/
public TypeCode _type()
{
- return new fixedTypeCode(value);
+ return new FixedTypeCode(value);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/FloatHolder.java b/libjava/classpath/org/omg/CORBA/FloatHolder.java
index 059953faf83..1d6de16a192 100644
--- a/libjava/classpath/org/omg/CORBA/FloatHolder.java
+++ b/libjava/classpath/org/omg/CORBA/FloatHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class FloatHolder
* The default type code for this holder.
*/
private static final TypeCode t_float =
- new primitiveTypeCode(TCKind.tk_float);
+ new PrimitiveTypeCode(TCKind.tk_float);
/**
* The <code>float</code> (CORBA <code>float</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java b/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java
index 9f7630c3f95..1656dae440a 100644
--- a/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class FloatSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_float);
+ return new ArrayTypeCode(TCKind.tk_float);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java b/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java
index 24c7603336c..dbab1ec08ba 100644
--- a/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class FloatSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_float);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_float);
/**
* Constructs an instance of FloatSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java b/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java
index d9ca36496f5..635168eb82d 100644
--- a/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java
+++ b/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.InputStream;
@@ -84,7 +84,7 @@ public abstract class IDLTypeHelper
if (typeCode == null)
{
typeCode =
- Restricted_ORB.Singleton.create_interface_tc(IDLTypeHelper.id(),
+ OrbRestricted.Singleton.create_interface_tc(IDLTypeHelper.id(),
"IDLType"
);
}
diff --git a/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java b/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java
new file mode 100644
index 00000000000..a6e60d02ad4
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java
@@ -0,0 +1,100 @@
+/* INVALID_ACTIVITY.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when the transaction or Activity is resumed in a different context
+ * than from which it was suspended. It is also raised when the invocation is
+ * not incompatible with the Activity’s current state.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class INVALID_ACTIVITY
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 7907846629733712546L;
+
+ /**
+ * Creates INVALID_ACTIVITY with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public INVALID_ACTIVITY(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates INVALID_ACTIVITY with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public INVALID_ACTIVITY()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a INVALID_ACTIVITY exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public INVALID_ACTIVITY(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created INVALID_ACTIVITY exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public INVALID_ACTIVITY(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/IdentifierHelper.java b/libjava/classpath/org/omg/CORBA/IdentifierHelper.java
index fa204484125..5c055f81290 100644
--- a/libjava/classpath/org/omg/CORBA/IdentifierHelper.java
+++ b/libjava/classpath/org/omg/CORBA/IdentifierHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class IdentifierHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "Identifier", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/IntHolder.java b/libjava/classpath/org/omg/CORBA/IntHolder.java
index 19822ef766e..4729535a7ec 100644
--- a/libjava/classpath/org/omg/CORBA/IntHolder.java
+++ b/libjava/classpath/org/omg/CORBA/IntHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -61,7 +61,7 @@ public final class IntHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_long = new primitiveTypeCode(TCKind.tk_long);
+ private static final TypeCode t_long = new PrimitiveTypeCode(TCKind.tk_long);
/**
* The <code>int</code> (CORBA <code>long</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/LocalObject.java b/libjava/classpath/org/omg/CORBA/LocalObject.java
index 4b6ae68afda..7c06e18249d 100644
--- a/libjava/classpath/org/omg/CORBA/LocalObject.java
+++ b/libjava/classpath/org/omg/CORBA/LocalObject.java
@@ -49,6 +49,13 @@ import org.omg.CORBA.NamedValue;
import org.omg.CORBA.Policy;
import org.omg.CORBA.Request;
import org.omg.CORBA.SetOverrideType;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+import javax.rmi.CORBA.Util;
/**
* An object, formally implementing the CORBA {@link Object}, but actually
@@ -141,6 +148,17 @@ public class LocalObject
*
* @throws NO_IMPLEMENT, always.
*/
+ public org.omg.CORBA.Object _get_interface()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
public Policy _get_policy(int a_policy_type)
throws BAD_PARAM
{
@@ -232,4 +250,114 @@ public class LocalObject
{
throw new NO_IMPLEMENT(INAPPROPRIATE);
}
+
+ /**
+ * This method is called from <code>rmic</code> generated stubs if the
+ * {@link Util#isLocal()}, called passing <code>this</code> as parameter,
+ * returns true. If the method returns null, the requested method is then
+ * invoked on <code>this</code>. Else it is invoked on the returned object,
+ * casting it into the interface that the local object implements. In this
+ * case, the generated stub also later calls
+ * {@link _servant_postinvoke(ServantObject)}, passing that returned target
+ * as parameter.
+ *
+ * @param operation the name of the method being invoked.
+ * @param expectedType the interface that the returned servant
+ * object must implement.
+ *
+ * @throws NO_IMPLEMENT always. If used, the method must be overridden.
+ */
+ public ServantObject _servant_preinvoke(String operation, Class expectedType)
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+
+ /**
+ * This method is called from <code>rmic</code> generated stubs if the
+ * {@link Util#isLocal()}, called passing <code>this</code> as parameter,
+ * returns true, and the {@link #_servant_preinvoke} return non-null object.
+ * The stub then invokes the requrested method on that returned object and
+ * later calls _servant_postinvoke, passing that returned target as parameter.
+ *
+ * @param servant the object that has served as the invocation target for the
+ * current operation.
+ */
+ public void _servant_postinvoke(ServantObject servant)
+ {
+ }
+
+ /**
+ * Invokes the operation. This method takes the OutputStream that was previously
+ * returned by a {@link _request()} and returns an InputStream which
+ * contains the reply. Up till jdk 1.5 inclusive this method is marked as
+ * unimplemented.
+ *
+ * @throws NO_IMPLEMENT always.
+ */
+ public InputStream _invoke(OutputStream output)
+ throws ApplicationException, RemarshalException
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * While it may look that this should return true, the jdk 1.5 API states
+ * that it must throw NO_IMPLEMENT instead. The rmi stubs do not call this
+ * method to check if the object is local; they call {@link Util#isLocal()}
+ * instead (passing <code>this</code> as parameter).
+ *
+ * @return never.
+ *
+ * @throws NO_IMPLEMENT always.
+ */
+ public boolean _is_local()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public ORB _orb()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public void _releaseReply(InputStream input)
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public OutputStream _request(String operation, boolean responseExpected)
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public boolean validate_connection()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/LongHolder.java b/libjava/classpath/org/omg/CORBA/LongHolder.java
index c0b14d33be2..ac249fed3c6 100644
--- a/libjava/classpath/org/omg/CORBA/LongHolder.java
+++ b/libjava/classpath/org/omg/CORBA/LongHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class LongHolder
* The default type code for this holder.
*/
private static final TypeCode t_longlong =
- new primitiveTypeCode(TCKind.tk_longlong);
+ new PrimitiveTypeCode(TCKind.tk_longlong);
/**
* The <code>long</code> (CORBA <code>long long</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java b/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java
index 1d7cde01cbb..0e31c713647 100644
--- a/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class LongLongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_long);
+ return new ArrayTypeCode(TCKind.tk_long);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java b/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java
index 95579029673..e56acd4ad78 100644
--- a/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class LongLongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_longlong);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_longlong);
/**
* Constructs an instance of LongLongSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/LongSeqHelper.java b/libjava/classpath/org/omg/CORBA/LongSeqHelper.java
index e98c77920dd..26b4e91c2a5 100644
--- a/libjava/classpath/org/omg/CORBA/LongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/LongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class LongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_long);
+ return new ArrayTypeCode(TCKind.tk_long);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/LongSeqHolder.java b/libjava/classpath/org/omg/CORBA/LongSeqHolder.java
index ac571decdb6..2359eb0b2f6 100644
--- a/libjava/classpath/org/omg/CORBA/LongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/LongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -56,8 +56,8 @@ public final class LongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_long);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_long);
/**
* The <code>int[]</code> (CORBA <code>LongSeq</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/MARSHAL.java b/libjava/classpath/org/omg/CORBA/MARSHAL.java
index 34cfa78f637..2cd92f5a626 100644
--- a/libjava/classpath/org/omg/CORBA/MARSHAL.java
+++ b/libjava/classpath/org/omg/CORBA/MARSHAL.java
@@ -41,8 +41,230 @@ package org.omg.CORBA;
import java.io.Serializable;
/**
- * Means that some request or reply from the network has a wrong
- * size or is structurally invalid.
+ * Means that some request or reply from the network has a wrong size or is
+ * structurally invalid. In GNU Classpath, this exception may have the following
+ * minor codes (the high 20 bits being Classpath VMCID):
+ *
+ * <table border="1">
+ * <tr>
+ * <th>Hex</th>
+ * <th>Dec</th>
+ * <th>Minor</th>
+ * <th>Name</th>
+ * <th>Case</th>
+ * </tr>
+ * <tr>
+ * <td>47430001</td>
+ * <td>1195573249</td>
+ * <td>1</td>
+ * <td>Giop</td>
+ * <td>The message being received is not a GIOP message. It does not start from
+ * the expected magic sequence byte[] { 'G', 'I', 'O', 'P' }.</td>
+ * </tr>
+ * <tr>
+ * <td>47430002</td>
+ * <td>1195573250</td>
+ * <td>2</td>
+ * <td>Header</td>
+ * <td>The unexpected IOException while reading or writing the GIOP message
+ * header or the subsequent request or response header</td>
+ * </tr>
+ * <tr>
+ * <td>47430003</td>
+ * <td>1195573251</td>
+ * <td>3</td>
+ * <td>EOF</td>
+ * <td>The data stream ended before reading all expected values from it. This
+ * usually means that the CORBA message is corrupted, but may also indicate that
+ * the server expects the remote method being invoked to have more or different
+ * parameters</td>
+ * </tr>
+ * <tr>
+ * <td>47430005</td>
+ * <td>1195573253</td>
+ * <td>5</td>
+ * <td>CDR</td>
+ * <td>The unexpected IOException while reading or writing the data via Commond
+ * Data Representation stream</td>
+ * </tr>
+ * <tr>
+ * <td>47430006</td>
+ * <td>1195573254 </td>
+ * <td>6</td>
+ * <td>Value</td>
+ * <td>The unexpected IOException while reading or writing the Value type.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>47430007 </td>
+ * <td>1195573255</td>
+ * <td>7</td>
+ * <td>Forwarding</td>
+ * <td>The unexpected IOException while handling request forwarding.</td>
+ * </tr>
+ * <tr>
+ * <td>47430008</td>
+ * <td>1195573256</td>
+ * <td>8</td>
+ * <td>Encapsulation </td>
+ * <td>The unexpected IOException while handling data encapsulation, tagged
+ * components, tagged profiles, etc.</td>
+ * </tr>
+ * <tr>
+ * <td>47430009</td>
+ * <td>1195573257</td>
+ * <td>9 </td>
+ * <td>Any</td>
+ * <td>The unexpected IOException while inserting or extracting data to/from
+ * the Any.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000a</td>
+ * <td>1195573258 </td>
+ * <td>10</td>
+ * <td>UserException</td>
+ * <td>The unexpected UserException in the context where it cannot be handled
+ * as such and must be converted to the SystemException. </td>
+ * </tr>
+ * <tr>
+ * <td>4743000b</td>
+ * <td>1195573259</td>
+ * <td>11</td>
+ * <td>Inappropriate</td>
+ * <td>While the operation could formally be applied to the target, the OMG
+ * standard states that it is actually not applicable. For example, some CORBA
+ * objects like POA are always local and should not be passed to or returned
+ * from the remote side.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000c</td>
+ * <td>1195573260</td>
+ * <td>12</td>
+ * <td>Negative</td>
+ * <td>When reading data, it was discovered that size of the data structure
+ * like string, sequence or character is written as the negative number.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000e</td>
+ * <td>1195573262 </td>
+ * <td>14</td>
+ * <td>Graph</td>
+ * <td>Reference to non-existing node in the data grapth while reading the
+ * value types.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000f</td>
+ * <td>1195573263</td>
+ * <td>15</td>
+ * <td>Boxed</td>
+ * <td>Unexpected exception was thrown from the IDL type helper while handling
+ * the object of this type as a boxed value.</td>
+ * </tr>
+ * <tr>
+ * <td>47430010</td>
+ * <td>1195573264</td>
+ * <td>16</td>
+ * <td>Instantiation</td>
+ * <td>Unable to instantiate an value type object while reading it from the
+ * stream.</td>
+ * </tr>
+ * <tr>
+ * <td>47430011</td>
+ * <td>1195573265</td>
+ * <td>17</td>
+ * <td>ValueHeaderTag</td>
+ * <td>The header tag of the value type being read from the CDR stream contains
+ * an unexpected value outside 0x7fffff00 .. 0x7fffffff and also not null and
+ * not an indirection.</td>
+ * </tr>
+ * <tr>
+ * <td>47430012</td>
+ * <td>1195573266</td>
+ * <td>18</td>
+ * <td>ValueHeaderFlags</td>
+ * <td>The header tag flags of the value type being read from the CDR stream
+ * make the invalid combination (for instance, 0x7fffff04).</td>
+ * </tr>
+ * <tr>
+ * <td>47430013</td>
+ * <td>1195573267</td>
+ * <td>19</td>
+ * <td>ClassCast</td>
+ * <td>The value type class, written on the wire, is not compatible with the
+ * expected class, passed as a parameter to the InputStream.read_value.</td>
+ * </tr>
+ * <tr>
+ * <td>47430014</td>
+ * <td>1195573268</td>
+ * <td>20</td>
+ * <td>Offset</td>
+ * <td>Positive or otherwise invalid indirection offset when reading the data
+ * graph of the value type.</td>
+ * </tr>
+ * <tr>
+ * <td>47430015</td>
+ * <td>1195573269</td>
+ * <td>21</td>
+ * <td>Chunks</td>
+ * <td>Errors while reading the chunked value type.</td>
+ * </tr>
+ * <tr>
+ * <td>47430016</td>
+ * <td>1195573270</td>
+ * <td>22</td>
+ * <td>UnsupportedValue</td>
+ * <td>No means are provided to read or write this value type (not Streamable,
+ * not CustomMarshal, not Serializable, no factory, no helper.</td>
+ * </tr>
+ * <tr>
+ * <td>47430017</td>
+ * <td>1195573271</td>
+ * <td>23</td>
+ * <td>Factory</td>
+ * <td>The value factory, required for the operation being invoked, is not
+ * registered with this ORB.</td>
+ * </tr>
+ * <tr>
+ * <td>47430018</td>
+ * <td>1195573272</td>
+ * <td>24</td>
+ *
+ * <td>UnsupportedAddressing</td>
+ * <td>Unsupported object addressing method in GIOP request header.</td>
+ * </tr>
+ * <tr>
+ * <td>47430019</td>
+ * <td>1195573273</td>
+ * <td>25</td>
+ * <td>IOR</td>
+ * <td>Invalid object reference (IOR).</td>
+ * </tr>
+ * <tr>
+ * <td>4743001a</td>
+ * <td>1195573274</td>
+ * <td>26</td>
+ * <td>TargetConversion</td>
+ * <td>Problems with converting between stubs, ties, interfaces and
+ * implementations.</td>
+ *
+ * </tr>
+ * <tr>
+ * <td>4743001b</td>
+ * <td>1195573275</td>
+ * <td>27</td>
+ * <td>ValueFields</td>
+ * <td>Problems with reading or writing the fields of the value type object
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>4743001c</td>
+ * <td>1195573276</td>
+ * <td>28</td>
+ * <td>NonSerializable</td>
+ * <td>The instance of the value type, passed using RMI over IIOP, is not
+ * serializable</td>
+ * </tr>
+ * </table>
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
@@ -50,14 +272,15 @@ public class MARSHAL
extends SystemException
implements Serializable
{
- /**
+ /**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 7416408250336395546L;
/**
- * Creates a MARSHAL with the default minor code of 0,
- * completion state COMPLETED_NO and the given explaining message.
+ * Creates a MARSHAL with the default minor code of 0, completion state
+ * COMPLETED_NO and the given explaining message.
+ *
* @param reasom the explaining message.
*/
public MARSHAL(String message)
@@ -66,32 +289,35 @@ public class MARSHAL
}
/**
- * Creates MARSHAL with the default minor code of 0 and a
- * completion state COMPLETED_NO.
+ * Creates MARSHAL with the default minor code of 0 and a completion state
+ * COMPLETED_NO.
*/
public MARSHAL()
{
super("", 0, CompletionStatus.COMPLETED_NO);
}
- /** Creates a MARSHAL exception with the specified minor
- * code and completion status.
- * @param minor additional error code.
- * @param completed the method completion status.
+ /**
+ * Creates a MARSHAL exception with the specified minor code and completion
+ * status.
+ *
+ * @param minor_code additional error code.
+ * @param is_completed the method completion status.
*/
- public MARSHAL(int minor, CompletionStatus completed)
+ public MARSHAL(int minor_code, CompletionStatus is_completed)
{
- super("", minor, completed);
+ super("", minor_code, is_completed);
}
/**
* Created MARSHAL exception, providing full information.
+ *
* @param reason explaining message.
- * @param minor additional error code (the "minor").
- * @param completed the method completion status.
+ * @param minor_code additional error code (the "minor").
+ * @param is_completed the method completion status.
*/
- public MARSHAL(String reason, int minor, CompletionStatus completed)
+ public MARSHAL(String reason, int minor_code, CompletionStatus is_completed)
{
- super(reason, minor, completed);
+ super(reason, minor_code, is_completed);
}
}
diff --git a/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java b/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java
index 262b8ce1a6b..013bdb674ce 100644
--- a/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java
+++ b/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java
@@ -41,9 +41,39 @@ package org.omg.CORBA;
import java.io.Serializable;
/**
- * Means that the ORB has reached some general resource limitation like
- * maximal number of the opened connections.
- *
+ * Means that the ORB has reached some general resource limitation like maximal
+ * number of the opened connections.
+ *
+ * In GNU Classpath, this exception may have the following minor codes:
+ *
+ * <table border="1">
+ * <tr>
+ * <td>Hex</td>
+ * <td>Dec</td>
+ * <td>Minor</td>
+ * <td>Name</td>
+ * <td>Case</td>
+ * </tr>
+ * <tr>
+ * <td>47430014</td>
+ * <td>1195573268</td>
+ * <td>20</td>
+ * <td>Ports</td>
+ * <td>No more free ports available for the new objects. The port control, if
+ * turned on, prevents malicios client from knocking the server out by suddenly
+ * requiring to allocate a very large number of objects.</td>
+ * </tr>
+ * <tr>
+ * <td>47430015</td>
+ * <td>1195573269</td>
+ * <td>21</td>
+ * <td>Threads</td>
+ * <td> Too many parallel calls (too many parallel threads). The thread control,
+ * if turned on, prevents malicios client from knocking the server out by
+ * suddenly submitting a very large number of requests. </td>
+ * </tr>
+ * </table>
+ *
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NO_RESOURCES
@@ -56,8 +86,9 @@ public class NO_RESOURCES
private static final long serialVersionUID = 8129246118235803597L;
/**
- * Creates a NO_RESOURCES with the default minor code of 0,
- * completion state COMPLETED_NO and the given explaining message.
+ * Creates a NO_RESOURCES with the default minor code of 0, completion state
+ * COMPLETED_NO and the given explaining message.
+ *
* @param reasom the explaining message.
*/
public NO_RESOURCES(String message)
@@ -66,32 +97,35 @@ public class NO_RESOURCES
}
/**
- * Creates NO_RESOURCES with the default minor code of 0 and a
- * completion state COMPLETED_NO.
+ * Creates NO_RESOURCES with the default minor code of 0 and a completion
+ * state COMPLETED_NO.
*/
public NO_RESOURCES()
{
super("", 0, CompletionStatus.COMPLETED_NO);
}
- /** Creates a NO_RESOURCES exception with the specified minor
- * code and completion status.
- * @param minor additional error code.
- * @param completed the method completion status.
+ /**
+ * Creates a NO_RESOURCES exception with the specified minor code and
+ * completion status.
+ *
+ * @param a_minor additional error code.
+ * @param a_completed the method completion status.
*/
- public NO_RESOURCES(int minor, CompletionStatus completed)
+ public NO_RESOURCES(int a_minor, CompletionStatus a_completed)
{
- super("", minor, completed);
+ super("", a_minor, a_completed);
}
/**
* Created NO_RESOURCES exception, providing full information.
- * @param reason explaining message.
- * @param minor additional error code (the "minor").
- * @param completed the method completion status.
+ *
+ * @param a_reason explaining message.
+ * @param a_minor additional error code (the "minor").
+ * @param a_completed the method completion status.
*/
- public NO_RESOURCES(String reason, int minor, CompletionStatus completed)
+ public NO_RESOURCES(String a_reason, int a_minor, CompletionStatus a_completed)
{
- super(reason, minor, completed);
+ super(a_reason, a_minor, a_completed);
}
}
diff --git a/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java b/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java
index f40e570a79b..5d2430b23bb 100644
--- a/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java
+++ b/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java
@@ -39,9 +39,10 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.DynAn.NameValuePairHolder;
-import gnu.CORBA.aliasTypeCode;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.stringTypeCode;
+import gnu.CORBA.typecodes.AliasTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+import gnu.CORBA.Minor;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -75,7 +76,9 @@ public abstract class NameValuePairHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("NameValuePair expected");
+ BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
@@ -117,12 +120,12 @@ public abstract class NameValuePairHelper
StructMember[] members = new StructMember[ 2 ];
TypeCode t_id =
- new aliasTypeCode(new stringTypeCode(TCKind.tk_string), "", "id");
+ new AliasTypeCode(new StringTypeCode(TCKind.tk_string), "", "id");
members [ 0 ] = new StructMember("id", t_id, null);
members [ 1 ] =
- new StructMember("value", new primitiveTypeCode(TCKind.tk_any), null);
+ new StructMember("value", new PrimitiveTypeCode(TCKind.tk_any), null);
typeCode = ORB.init().create_struct_tc(id(), "NameValuePair", members);
}
diff --git a/libjava/classpath/org/omg/CORBA/OMGVMCID.java b/libjava/classpath/org/omg/CORBA/OMGVMCID.java
index 6c7b30810ef..2b2bd4bc3ef 100644
--- a/libjava/classpath/org/omg/CORBA/OMGVMCID.java
+++ b/libjava/classpath/org/omg/CORBA/OMGVMCID.java
@@ -1,54 +1,72 @@
/* OMGVMCID.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
package org.omg.CORBA;
/**
- * Holds a single constant, specifying, that
- * The vendor minor code ID reserved for the Object Management Group
- * (http://www.omg.org).
+ * </p>
+ * The higher 20 bits of any CORBA exception hold "Vendor Minor Codeset ID"
+ * (VMCID), for instance 0x4F4D0000 (OMG standard), 0x54410000 (TAO), 0x4A430000
+ * (JacORB), 0x49540000 (IONA), 0x53550000 (Sun).
+ * </p>
+ * <p>
+ * GNU Classpath official vendor minor code set id is 0x47430000 ("GC\x00\x00"),
+ * and the reserved space spans till 0x47430FFF, allowing to use up to 4096
+ * Classpath specific exceptions. It was assigned 30/09/2005 by OMG Vice President
+ * Andrew Watson.
+ * </p>
+ * <p>
+ * The standard minor codes for the standard system exceptions are prefaced by
+ * the VMCID assigned to OMG, defined as 0x4F4D0000 (the code of the minor field
+ * for the standard exception with minor code 1 is 0x4F4D0001). Within a vendor
+ * assigned space, the assignment of values to minor codes is left to the
+ * vendor.
+ * </p>
+ *
+ * <p>
+ * The VMCID 0 and 0xFFFFF0000 are reserved for experimental use.
+ * </p>
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public interface OMGVMCID
{
/**
- * The vendor minor code ID (1330446336) reserved for the Object
- * Management Group (http://www.omg.org).
+ * The OMG vendor minor code ID.
*/
- int value = 1330446336;
+ int value = 0x4F4D0000;
}
diff --git a/libjava/classpath/org/omg/CORBA/ORB.java b/libjava/classpath/org/omg/CORBA/ORB.java
index 9163736eb97..06259fafa32 100644
--- a/libjava/classpath/org/omg/CORBA/ORB.java
+++ b/libjava/classpath/org/omg/CORBA/ORB.java
@@ -38,15 +38,18 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.fixedTypeCode;
-import gnu.CORBA.generalTypeCode;
+import gnu.CORBA.OrbFocused;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.gnuContext;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.recordTypeCode;
-import gnu.CORBA.recursiveTypeCode;
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.RecursiveTypeCode;
import org.omg.CORBA.ORBPackage.InconsistentTypeCode;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
import java.applet.Applet;
@@ -58,17 +61,17 @@ import java.io.IOException;
import java.util.Properties;
/**
- * A central class in CORBA implementation, responsible for sending and
- * handling remote invocations. ORB also works as a factory for
- * creating instances of certain CORBA classes.
- *
- * Despite the core library contains the fully working CORBA implementation,
- * it also provides a simple way to plug-in the alternative CORBA support.
- * This is done by replacing the ORB. The alternative ORB can be specified
- * via properties, passed to ORB.Init(...).
- *
- * When creating an ORB instance, the class name
- * is searched in the following locations:
+ * A central class in CORBA implementation, responsible for sending and handling
+ * remote invocations. ORB also works as a factory for creating instances of
+ * certain CORBA classes.
+ *
+ * Despite the core library contains the fully working CORBA implementation, it
+ * also provides a simple way to plug-in the alternative CORBA support. This is
+ * done by replacing the ORB. The alternative ORB can be specified via
+ * properties, passed to ORB.Init(...).
+ *
+ * When creating an ORB instance, the class name is searched in the following
+ * locations:
* <p>
* 1. Applet parameter or application string array, if any.<br>
* 2. The properties parameter, if any.<br>
@@ -76,32 +79,72 @@ import java.util.Properties;
* 4. The orb.properties file located in the user.home directory (if any).<br>
* 5. The orb.properties file located in the java.home/lib directory (if any).
* </p>
- *
- * The supported properties are:
- * <table border="1">
- * <tr><td> org.omg.CORBA.ORBClass</td><td>The class,
- * implementing the functional ORB, returned by
- * {@link #init(Applet, Properties)} or
- * {@link #init(String[], Properties)} </td></tr>
- * <tr><td>org.omg.CORBA.ORBSingletonClass</td><td>The class,
- * implementing the restricted ORB, returned by
- * {@link #init()}.
- * </td></tr>
- * <tr><td>org.omg.CORBA.ORBInitRef</td><td>Specifies the
- * initial reference, accessible by name with the method
- * {@link resolve_initial_references(String)}.
- * </table>
- * The command line accepts the same properties as a keys. When specifying
- * in the command line, the prefix org.omg.CORBA can be omitted,
- * for instance<code> -ORBInitRef NameService=IOR:aabbccdd....</code>
- *
+ *
+ * The supported properties are: <table border="1">
+ * <tr>
+ * <td> org.omg.CORBA.ORBClass</td>
+ * <td>The class, implementing the functional ORB, returned by
+ * {@link #init(Applet, Properties)} or {@link #init(String[], Properties)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ORBSingletonClass</td>
+ * <td>The class, implementing the restricted ORB, returned by {@link #init()}.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ORBInitRef</td>
+ * <td>Specifies the initial reference, accessible by name with the method
+ * {@link #resolve_initial_references(String)}.</td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ORBid</td>
+ * <td>Specifies the name (ORB Id) of this ORB. The ORB Id is later accessible
+ * by {@link ObjectReferenceTemplate#orb_id}. The default value includes the
+ * hashcode of the ORB instance that is normally different for each ORB.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ServerId</td>
+ * <td>Specifies the name (Server Id) of this server. This property assigns
+ * value to the <i>static</i> field, ensuring that all ORB's on the same jre
+ * have the same Server Id. It is normally set as the system property. The
+ * server Id is later accessible as {@link ObjectReferenceTemplate#server_id}.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>gnu.CORBA.ListenerPort</td>
+ * <td>Specifies that this ORB should serve all its objects on a single port
+ * (for example, "1234") or on a specified port range (for example,
+ * "1100-1108"). The property is used when working with firewals and serves as a
+ * replacement for the proprietary properties like com.ibm.CORBA.ListenerPort
+ * or com.sun.CORBA.POA.ORBPersistentServerPort. The specified port or range
+ * should not overlap with the values, specified for other ORB's.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>gnu.Corba.SocketFactory</td>
+ * <td>Sets the user-defined server and client socket factory for the ORB being
+ * currently instantiated. Serves as a replacement of the proprietary
+ * property com.sun.CORBA.connection.ORBSocketFactoryClass. To have multiple
+ * types of sockets, instantiate several ORB's with this property each time
+ * set to the different value.
+ * The factory must implement gnu.CORBA.interfaces.SocketFactory.
+ * </td>
+ * </tr>
+ * </table>
+ * <p>The command line accepts the same properties as a keys. When
+ * specifying in the command line, the prefix org.omg.CORBA can be omitted, for
+ * instance<code> -ORBInitRef NameService=IOR:aabbccdd....</code>
+ * </p>
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ORB
{
/**
- * By default, {@link init(String[], Properties)} and
- * {@link init(Applet, Properties} return
+ * By default, {@link #init(String[], Properties)} and
+ * {@link #iinit(Applet, Properties)} return
* the built-in fully functional ORB is returned. If the
* <code>props</code> contains the property org.omg.CORBA.ORBClass,
* the value of this property is used as a class name to instantiate
@@ -114,18 +157,21 @@ public abstract class ORB
*/
private static final String RESTRICTED_ORB =
"org.omg.CORBA.ORBSingletonClass";
-
+
+ private static final String LISTENER_PORT =
+ OrbFocused.LISTENER_PORT;
+
/**
* The class, implementing the default fully functional ORB.
*/
private static final String DEFAULT_FUNCTIONAL_ORB =
gnu.CORBA.Poa.ORB_1_4.class.getName();
-
- /**
- * The class, implementing the default restricted ORB.
- */
- private static final String DEFAULT_RESTRICTED_ORB =
- gnu.CORBA.Restricted_ORB.class.getName();
+
+ private static final String DEFAULT_FOCUSED_ORB =
+ gnu.CORBA.OrbFocused.class.getName();
+
+ // There is no need for name of the default restricted ORB as it is
+ // singleton and it is more effectively referred directly.
/**
* Connect the given CORBA object to this ORB. After the object is
@@ -172,7 +218,7 @@ public abstract class ORB
/**
* Create an instance of the CORBA {@link Any} with the type, intialised
- * to {@link TCKind#tc_null}
+ * to {@link TCKind#tk_null}
*/
public abstract Any create_any();
@@ -359,7 +405,7 @@ public abstract class ORB
*/
public TypeCode create_fixed_tc(short digits, short scale)
{
- fixedTypeCode r = new fixedTypeCode();
+ FixedTypeCode r = new FixedTypeCode();
r.setDigits(digits);
r.setScale(scale);
return r;
@@ -394,7 +440,7 @@ public abstract class ORB
*
* @return the named value.
*/
- public abstract NamedValue create_named_value(String s, Any any, int flags);
+ public abstract NamedValue create_named_value(String name, Any any, int flags);
/**
* Send multiple prepared requests one way, do not caring about the answer.
@@ -466,7 +512,7 @@ public abstract class ORB
* However this method is oficially documented as not implemented at least
* till v1.4 inclusive.
*
- * @param peration_definition the operation definition, must be
+ * @param operation_definition the operation definition, must be
* CORBA <code>OperationDef</code>.
*
* @return never
@@ -482,7 +528,7 @@ public abstract class ORB
* <p>Creates the new policy of the specified type, having the given value.
* This method looks for the policy factory that was previously registered
* during ORB initialization by
- * {@link org.omg.PortableInterceptor.ORBInitialiser}.
+ * {@link org.omg.PortableInterceptor#ORBInitialiser}.
*
* If the suitable factory is found, this factory creates the requested policy,
* otherwise the PolicyError is thrown.
@@ -532,7 +578,7 @@ public abstract class ORB
*
* The TypeCode object is initialized with the given id, name, and members.
* @param id the Id of this type.
- * @param the name of this type.
+ * @param name the name of this type.
* @param members the member list.
*
* @return the typecode.
@@ -548,7 +594,7 @@ public abstract class ORB
* and members.
*
* @param id the Id of this type.
- * @param the name of this type.
+ * @param name the name of this type.
* @param discriminator the union discriminator.
* @param members the member list.
*
@@ -579,7 +625,7 @@ public abstract class ORB
*/
public TypeCode create_abstract_interface_tc(String id, String name)
{
- generalTypeCode t = new generalTypeCode(TCKind.tk_abstract_interface);
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_abstract_interface);
t.setName(name);
t.setId(id);
return t;
@@ -595,7 +641,7 @@ public abstract class ORB
*/
public TypeCode create_native_tc(String id, String name)
{
- generalTypeCode t = new generalTypeCode(TCKind.tk_native);
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_native);
t.setName(name);
t.setId(id);
return t;
@@ -629,11 +675,11 @@ public abstract class ORB
*/
public TypeCode create_recursive_sequence_tc(int bound, int offset)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_struct);
+ 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);
+ TypeCode recurs = new PrimitiveTypeCode(TCKind.tk_sequence);
r.add(new StructMember("", recurs, null));
return r;
@@ -648,7 +694,7 @@ public abstract class ORB
*/
public TypeCode create_recursive_tc(String id)
{
- return new recursiveTypeCode(id);
+ return new RecursiveTypeCode(id);
}
/**
@@ -658,7 +704,7 @@ public abstract class ORB
TypeCode boxed_type
)
{
- generalTypeCode t = new generalTypeCode(TCKind.tk_value_box);
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_value_box);
t.setName(name);
t.setId(id);
t.setContentType(boxed_type);
@@ -672,7 +718,7 @@ public abstract class ORB
TypeCode concrete_base, ValueMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_value);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_value);
r.setId(id);
r.setName(name);
r.setTypeModifier(type_modifier);
@@ -741,7 +787,7 @@ public abstract class ORB
* @return the default context of this ORB.
*
* @throws NO_IMPLEMENT for the Singleton ORB, returned by
- * the parameterless {@link init()}.
+ * the parameterless {@link #init()}.
*/
public Context get_default_context()
{
@@ -751,7 +797,7 @@ public abstract class ORB
/**
* Return thg typecode, representing the given primitive object type.
*
- * @param the kind of the primitive typecode.
+ * @param tcKind the kind of the primitive typecode.
*
* @return the typecode of the primitve typecode.
*/
@@ -779,9 +825,9 @@ public abstract class ORB
*/
public static ORB init()
{
- String orb_cn = getORBName(null, RESTRICTED_ORB);
+ String orb_cn = getCumulatedProperty(null, RESTRICTED_ORB);
if (orb_cn == null)
- return Restricted_ORB.Singleton;
+ return OrbRestricted.Singleton;
else
return createORB(null, orb_cn);
}
@@ -804,6 +850,11 @@ public abstract class ORB
public static ORB init(Applet applet, Properties props)
{
String ocn = applet.getParameter(FUNCTIONAL_ORB);
+ String lp = applet.getParameter(LISTENER_PORT);
+
+ if (ocn==null && lp!=null)
+ ocn = DEFAULT_FOCUSED_ORB;
+
ORB orb = createORB(props, ocn);
orb.set_parameters(applet, props);
@@ -811,40 +862,44 @@ public abstract class ORB
}
/**
- * Creates the working instance of ORB for a
- * standalone application.
- *
- * By default the built-in fully functional ORB is returned. The ORB class
- * is found as described in the header of this class.
- *
- * @param the parameters, passed to the applications
- * <code>main(String[] args)</code> method, may be <code>null</code>.
- * The parameter -org.omg.CORBA.ORBClass <class name>
- * if present, defines the used ORB implementation class. If this
- * property is not present, the ORB class is found as described in the
- * class header.
-
- *
+ * Creates the working instance of ORB for a standalone application.
+ *
+ * By default the built-in fully functional ORB is returned. The ORB class is
+ * found as described in the header of this class.
+ *
+ * @param args the parameters, passed to the applications
+ * <code>main(String[] args)</code> method, may be <code>null</code>. The
+ * parameter -org.omg.CORBA.ORBClass <class name> if present, defines the used
+ * ORB implementation class. If this property is not present, the ORB class is
+ * found as described in the class header.
+ *
* @param props application specific properties, may be <code>null</code>.
- *
+ *
* @return a newly created functional derivative of this abstract class.
*/
public static ORB init(String[] args, Properties props)
{
String ocn = null;
+ String lp = null;
String orbKey = "-" + FUNCTIONAL_ORB;
+ String lpKey = "-" + LISTENER_PORT;
if (args != null)
if (args.length >= 2)
{
for (int i = 0; i < args.length - 1; i++)
{
- if (args [ i ].equals(orbKey))
- ocn = args [ i + 1 ];
+ if (args[i].equals(orbKey))
+ ocn = args[i + 1];
+ if (args[i].equals(lpKey))
+ lp = args[i + 1];
}
}
+ if (lp != null && ocn == null)
+ ocn = DEFAULT_FOCUSED_ORB;
+
ORB orb = createORB(props, ocn);
orb.set_parameters(args, props);
@@ -853,10 +908,10 @@ public abstract class ORB
/**
* List the initially available CORBA objects (services).
- *
+ *
* @return a list of services.
- *
- * @see resolve_initial_references(String)
+ *
+ * @see #resolve_initial_references(String)
*/
public abstract String[] list_initial_services();
@@ -919,9 +974,9 @@ public abstract class ORB
* (key) inside the server, the communication protocol version,
* supported charsets and so on.
*
- * @param the CORBA object
+ * @param forObject the CORBA object
* @return the object IOR representation.
- * @see string_to_object(String)
+ * @see #string_to_object(String)
*/
public abstract String object_to_string(Object forObject);
@@ -985,6 +1040,12 @@ public abstract class ORB
* that runs on the given host at the given port. The ORB expects to find
* there the {@link org.omg.CosNaming.NamingContext} under the key
* "NameService.<br>
+ * 7. file://[file name] Read the object definition string from the
+ * file system<br>
+ * 8. http://[url] Read the object definition string from the provided
+ * url.<br>
+ * 9. ftp://[url] Read the object definition string from the provided
+ * url.<br>
*
* <p>The default port is always 2809. The default iiop version is 1.0
* that now may not always be supported, so we would recommend to specify
@@ -1016,7 +1077,7 @@ public abstract class ORB
* @throws DATA_CONVERSION if the string being parsed contains unsupported
* prefix or protocol.
*
- * @see object_to_string(org.omg.CORBA.Object)
+ * @see #object_to_string(org.omg.CORBA.Object)
*/
public abstract Object string_to_object(String IOR);
@@ -1056,7 +1117,7 @@ public abstract class ORB
* application.
*
* @param props application specific properties that were passed
- * as a second parameter in {@link init(String[], Properties)}).
+ * as a second parameter in {@link #init(String[], Properties)}).
* Can be <code>null</code>.
*/
protected abstract void set_parameters(String[] para, Properties props);
@@ -1074,23 +1135,10 @@ public abstract class ORB
protected abstract void set_parameters(Applet app, Properties props);
/**
- * Checks if the communication over network is allowed.
- * @throws java.lang.SecurityException
+ * Get the property with the given name, searching in the standard
+ * places for the ORB properties.
*/
- private static final void checkNetworkingPermission(String host, int port)
- throws SecurityException
- {
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkConnect(host, port);
- }
- }
-
- /**
- * Get the ORB class name.
- */
- private static String getORBName(Properties props, String property)
+ private static String getCumulatedProperty(Properties props, String property)
{
String orb_cn = null;
@@ -1105,7 +1153,7 @@ public abstract class ORB
if (orb_cn == null)
orb_cn = checkFile(property, "java.home", "lib");
-
+
return orb_cn;
}
@@ -1148,10 +1196,10 @@ public abstract class ORB
/**
* Create ORB when its name is possibly known.
- *
+ *
* @param props properties, possibly containing the ORB name.
- * @param orbClassName the direct ORB class name, overriding
- * other possible locations, or null if not specified.
+ * @param orbClassName the direct ORB class name, overriding other possible
+ * locations, or null if not specified.
*/
private static ORB createORB(Properties props, String orbClassName)
{
@@ -1159,15 +1207,21 @@ public abstract class ORB
if (orbClassName == null)
{
- orbClassName = getORBName(props, FUNCTIONAL_ORB);
+ orbClassName = getCumulatedProperty(props, FUNCTIONAL_ORB);
if (orbClassName == null)
- orbClassName = DEFAULT_FUNCTIONAL_ORB;
+ {
+ String lp = getCumulatedProperty(props, LISTENER_PORT);
+ if (lp != null)
+ orbClassName = DEFAULT_FOCUSED_ORB;
+ else
+ orbClassName = DEFAULT_FUNCTIONAL_ORB;
+ }
}
try
{
- orb = (ORB) Class.forName(orbClassName).newInstance();
+ orb = (ORB) ObjectCreator.forName(orbClassName).newInstance();
}
catch (ClassNotFoundException ex)
{
diff --git a/libjava/classpath/org/omg/CORBA/ObjectHelper.java b/libjava/classpath/org/omg/CORBA/ObjectHelper.java
index 1324c621f2b..220f2daced2 100644
--- a/libjava/classpath/org/omg/CORBA/ObjectHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ObjectHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.Minor;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -63,7 +64,9 @@ public abstract class ObjectHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("CORBA object expected");
+ BAD_OPERATION bad = new BAD_OPERATION("CORBA object expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/ObjectHolder.java b/libjava/classpath/org/omg/CORBA/ObjectHolder.java
index 27ae674167a..f79a89bef0d 100644
--- a/libjava/classpath/org/omg/CORBA/ObjectHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ObjectHolder.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.recordTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -63,11 +63,11 @@ public final class ObjectHolder
* The default type code for this holder if the object type code with
* the zero length string as id.
*/
- private static final recordTypeCode t_object;
+ private static final RecordTypeCode t_object;
static
{
- t_object = new recordTypeCode(TCKind.tk_objref);
+ t_object = new RecordTypeCode(TCKind.tk_objref);
t_object.setId("");
}
diff --git a/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java b/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java
index 0612ae4e2ff..df7b22ff52f 100644
--- a/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class OctetSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_octet);
+ return new ArrayTypeCode(TCKind.tk_octet);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java b/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java
index 5092d707eea..62ea7381920 100644
--- a/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class OctetSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_octet);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_octet);
/**
* Constructs an instance of OctetSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java b/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java
index 8aae9b3bcf6..df17cefa9e9 100644
--- a/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java
+++ b/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java
@@ -57,7 +57,7 @@ public class PERSIST_STORE
/**
* Creates a PERSIST_STORE with the default minor code of 0,
* completion state COMPLETED_NO and the given explaining message.
- * @param reasom the explaining message.
+ * @param message the explaining message.
*/
public PERSIST_STORE(String message)
{
diff --git a/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java b/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java
index ec75b2bcf72..ac17a9235ba 100644
--- a/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -87,7 +87,7 @@ public abstract class ParameterModeHelper
new String[] { "PARAM_IN", "PARAM_OUT", "PARAM_INOUT" };
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "ParameterMode", members);
+ OrbRestricted.Singleton.create_enum_tc(id(), "ParameterMode", members);
}
return typeCode;
}
diff --git a/libjava/classpath/org/omg/CORBA/PolicyError.java b/libjava/classpath/org/omg/CORBA/PolicyError.java
index 82ae4e45dc0..749868a992f 100644
--- a/libjava/classpath/org/omg/CORBA/PolicyError.java
+++ b/libjava/classpath/org/omg/CORBA/PolicyError.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import org.omg.CORBA.portable.IDLEntity;
+
import java.io.Serializable;
/**
@@ -75,7 +77,7 @@ public class PolicyError
/**
* Constructs the policy error with the given reason code.
- * @param reason a reason code, one of
+ * @param a_reason a reason code, one of
* {@link BAD_POLICY}, {@link BAD_POLICY_TYPE},
* {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY},
* {@link UNSUPPORTED_POLICY_VALUE}.
@@ -88,11 +90,11 @@ public class PolicyError
/**
* Constructs the policy error with the given reason code and the
* detailed message.
- * @param reason a reason code, one of
+ * @param a_details the detailed message.
+ * @param a_reason a reason code, one of
* {@link BAD_POLICY}, {@link BAD_POLICY_TYPE},
* {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY},
* {@link UNSUPPORTED_POLICY_VALUE}.
- * @param details the detailed message.
*/
public PolicyError(String a_details, short a_reason)
{
diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java b/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java
new file mode 100644
index 00000000000..ab7ac95479a
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java
@@ -0,0 +1,115 @@
+/* PolicyErrorCodeHelper.java --
+Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.omg.CORBA;
+
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper operations for the policy error code as an alias of
+ * <code>short</code>.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class PolicyErrorCodeHelper
+
+{
+
+ /**
+ * Delegates call to {@link Any.extract_short()}.
+ */
+ public static short extract(Any a)
+ {
+ return a.extract_short();
+ }
+
+ /**
+ * Returns policy error code repository id.
+ *
+ * @return "IDL:omg.org/CORBA/PolicyErrorCode:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/PolicyErrorCode:1.0";
+ }
+
+ /**
+ * Delegates call to {@link Any.insert_short(short)}.
+ */
+ public static void insert(Any a, short that)
+ {
+ a.insert_short(that);
+ }
+
+ /**
+ * Delegates call to {@link InputStream.read_short()}.
+ */
+ public static short read(InputStream istream)
+ {
+ return istream.read_short();
+ }
+
+ /**
+ * Returns a typecode of the policy error code, stating it is an alias of
+ * <code>short</code>, named "PolicyErrorCode".
+ *
+ * @return a typecode of synchronization scope.
+ */
+ public static TypeCode type()
+ {
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_alias);
+ r.setName("PolicyErrorCode");
+ r.setId(id());
+ r.setContentType(new PrimitiveTypeCode(TCKind.tk_short));
+ return r;
+ }
+
+ /**
+ * Delegates call to {@link OutputStream.write_short()}.
+ */
+ public static void write(OutputStream ostream, short value)
+ {
+ ostream.write_short(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java b/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java
new file mode 100644
index 00000000000..49db768cd3b
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java
@@ -0,0 +1,158 @@
+/* PolicyErrorHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+* The helper operations for the exception {@link PolicyError}.
+*
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public abstract class PolicyErrorHelper
+{
+ /**
+ * The cached typecode value, computed only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Create the PolicyError typecode. The typecode defines a structure, named
+ * "PolicyError", containing the {@link PolicyErrorCode} (alias int) field,
+ * named "reason".
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ {
+ ORB orb = ORB.init();
+ StructMember[] members = new StructMember[ 1 ];
+
+ TypeCode field;
+
+ field =
+ orb.create_alias_tc("IDL:omg.org/CORBA/PolicyErrorCode:1.0",
+ "PolicyErrorCode", orb.get_primitive_tc(TCKind.tk_short)
+ );
+ members [ 0 ] = new StructMember("reason", field, null);
+ typeCode = orb.create_exception_tc(id(), "PolicyError", members);
+ }
+ return typeCode;
+ }
+
+ /**
+ * Insert the PolicyError into the given Any.
+ * This method uses the PolicyErrorHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the PolicyError to insert.
+ */
+ public static void insert(Any any, PolicyError that)
+ {
+ any.insert_Streamable(new PolicyErrorHolder(that));
+ }
+
+ /**
+ * Extract the PolicyError from given Any.
+ * This method uses the PolicyErrorHolder.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain PolicyError.
+ */
+ public static PolicyError extract(Any any)
+ {
+ try
+ {
+ return ((PolicyErrorHolder) any.extract_Streamable()).value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("PolicyError expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the PolicyError repository id.
+ *
+ * @return "IDL:omg.org/CORBA/PolicyError:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/PolicyError:1.0";
+ }
+
+ /**
+ * Read the exception from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static PolicyError read(InputStream input)
+ {
+ // Read the exception repository id.
+ String id = input.read_string();
+ PolicyError value = new PolicyError();
+
+ value.reason = input.read_short();
+ return value;
+ }
+
+ /**
+ * Write the exception to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, PolicyError value)
+ {
+ // Write the exception repository id.
+ output.write_string(id());
+ output.write_short(value.reason);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java b/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java
new file mode 100644
index 00000000000..8e2c9a8d342
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java
@@ -0,0 +1,103 @@
+/* PolicyErrorHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+* A holder for the exception {@link PolicyError}.
+
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public class PolicyErrorHolder implements Streamable
+{
+ /**
+ * The stored PolicyError value.
+ */
+ public PolicyError value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public PolicyErrorHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public PolicyErrorHolder(PolicyError initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = PolicyErrorHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ PolicyErrorHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the PolicyError.
+ */
+ public TypeCode _type()
+ {
+ return PolicyErrorHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/PolicyHelper.java b/libjava/classpath/org/omg/CORBA/PolicyHelper.java
index 16b9d94c754..66fb0aa0868 100644
--- a/libjava/classpath/org/omg/CORBA/PolicyHelper.java
+++ b/libjava/classpath/org/omg/CORBA/PolicyHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -99,7 +101,9 @@ public abstract class PolicyHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("Policy expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Policy expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/PolicyListHelper.java b/libjava/classpath/org/omg/CORBA/PolicyListHelper.java
index f03836a4fcc..6e4d329b837 100644
--- a/libjava/classpath/org/omg/CORBA/PolicyListHelper.java
+++ b/libjava/classpath/org/omg/CORBA/PolicyListHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -97,7 +99,9 @@ public abstract class PolicyListHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("Policy[] expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Policy[] expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/PrincipalHolder.java b/libjava/classpath/org/omg/CORBA/PrincipalHolder.java
index 22501a0f794..270427f3fdd 100644
--- a/libjava/classpath/org/omg/CORBA/PrincipalHolder.java
+++ b/libjava/classpath/org/omg/CORBA/PrincipalHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -58,7 +58,7 @@ public final class PrincipalHolder
* The default type code for this holder.
*/
private static final TypeCode t_any =
- new primitiveTypeCode(TCKind.tk_Principal);
+ new PrimitiveTypeCode(TCKind.tk_Principal);
/**
* The instance of {@link Principal}, held by this holder.
diff --git a/libjava/classpath/org/omg/CORBA/REBIND.java b/libjava/classpath/org/omg/CORBA/REBIND.java
new file mode 100644
index 00000000000..9480906cc4d
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/REBIND.java
@@ -0,0 +1,99 @@
+/* REBIND.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised on the failure of the requested or implied attempt to
+ * rebind an object reference.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class REBIND
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 823920851143467547L;
+
+ /**
+ * Creates REBIND with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public REBIND(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates REBIND with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public REBIND()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a REBIND exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public REBIND(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created REBIND exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public REBIND(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java b/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java
index 42fb008521f..a392002fd23 100644
--- a/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java
+++ b/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class RepositoryIdHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "RepositoryId", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
index fe0135d975b..58000f2c5c7 100644
--- a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
import gnu.CORBA.ServiceDetailHolder;
import org.omg.CORBA.portable.InputStream;
@@ -78,7 +79,10 @@ public abstract class ServiceDetailHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java b/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java
index bfdad683e92..1fa1ef868d1 100644
--- a/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java
+++ b/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.SetOverrideTypeHolder;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -88,7 +88,7 @@ public abstract class SetOverrideTypeHelper
};
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "SetOverrideType",
+ OrbRestricted.Singleton.create_enum_tc(id(), "SetOverrideType",
members
);
}
diff --git a/libjava/classpath/org/omg/CORBA/ShortHolder.java b/libjava/classpath/org/omg/CORBA/ShortHolder.java
index c2e18cb2a8b..dfc4721f3f9 100644
--- a/libjava/classpath/org/omg/CORBA/ShortHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ShortHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class ShortHolder
* The default type code for this holder.
*/
private static final TypeCode t_short =
- new primitiveTypeCode(TCKind.tk_short);
+ new PrimitiveTypeCode(TCKind.tk_short);
/**
* The <code>short</code> (CORBA <code>short</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java b/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java
index 21eda87d110..40124f216e9 100644
--- a/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class ShortSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_short);
+ return new ArrayTypeCode(TCKind.tk_short);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java b/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java
index 183db3a5770..246d1ecf47e 100644
--- a/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class ShortSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_short);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_short);
/**
* Constructs an instance of ShortSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/StringHolder.java b/libjava/classpath/org/omg/CORBA/StringHolder.java
index 8a637c8e57f..ac45c562c70 100644
--- a/libjava/classpath/org/omg/CORBA/StringHolder.java
+++ b/libjava/classpath/org/omg/CORBA/StringHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.stringTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -61,8 +61,8 @@ public final class StringHolder
/**
* The default type code for this holder.
*/
- private static final stringTypeCode t_string =
- new stringTypeCode(TCKind.tk_string);
+ private static final StringTypeCode t_string =
+ new StringTypeCode(TCKind.tk_string);
/**
* The <code>String</code> (CORBA <code>string</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/StringSeqHelper.java b/libjava/classpath/org/omg/CORBA/StringSeqHelper.java
index 0ae2646795a..4225c0bd12b 100644
--- a/libjava/classpath/org/omg/CORBA/StringSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/StringSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class StringSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_string);
+ return new ArrayTypeCode(TCKind.tk_string);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/StringSeqHolder.java b/libjava/classpath/org/omg/CORBA/StringSeqHolder.java
index 8e419d23333..71ac887e27b 100755
--- a/libjava/classpath/org/omg/CORBA/StringSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/StringSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class StringSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_char);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_char);
/**
* Constructs an instance of StringSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/StringValueHelper.java b/libjava/classpath/org/omg/CORBA/StringValueHelper.java
index 97d0e7a5d06..24e79ce571b 100644
--- a/libjava/classpath/org/omg/CORBA/StringValueHelper.java
+++ b/libjava/classpath/org/omg/CORBA/StringValueHelper.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.gnuAny;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -75,7 +74,7 @@ public class StringValueHelper
* The String typecode.
*/
private static final TypeCode tString =
- Restricted_ORB.Singleton.create_string_tc(0);
+ OrbRestricted.Singleton.create_string_tc(0);
/**
* Returns the String Value repository Id.
@@ -121,7 +120,9 @@ public class StringValueHelper
}
catch (ClassCastException ex)
{
- throw new MARSHAL("String expected");
+ MARSHAL m = new MARSHAL("String expected");
+ m.minor = Minor.ClassCast;
+ throw m;
}
}
@@ -141,7 +142,11 @@ public class StringValueHelper
return an_any.extract_string();
}
else
- throw new BAD_OPERATION("Contains not a string value type");
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("String value type expected");
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
/**
@@ -177,7 +182,7 @@ public class StringValueHelper
{
if (typecode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
typecode =
orb.create_value_box_tc(id(), "StringValue", tString);
}
diff --git a/libjava/classpath/org/omg/CORBA/StructMemberHelper.java b/libjava/classpath/org/omg/CORBA/StructMemberHelper.java
index 72d66fa912f..01445129b67 100644
--- a/libjava/classpath/org/omg/CORBA/StructMemberHelper.java
+++ b/libjava/classpath/org/omg/CORBA/StructMemberHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.InputStream;
@@ -87,7 +88,7 @@ public abstract class StructMemberHelper
{
if (typeCode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
synchronized (TypeCode.class)
{
@@ -151,6 +152,7 @@ public abstract class StructMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
@@ -170,6 +172,7 @@ public abstract class StructMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/SystemException.java b/libjava/classpath/org/omg/CORBA/SystemException.java
index 85396ee534f..dd193627900 100644
--- a/libjava/classpath/org/omg/CORBA/SystemException.java
+++ b/libjava/classpath/org/omg/CORBA/SystemException.java
@@ -1,39 +1,39 @@
/* SystemException.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005 Free Software Foundation, Inc.
-This file is part of GNU Classpath.
+ This file is part of GNU Classpath.
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package org.omg.CORBA;
@@ -42,6 +42,7 @@ import java.io.Serializable;
/**
* The root class for all CORBA standard exceptions.
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class SystemException
@@ -49,8 +50,7 @@ public class SystemException
implements Serializable
{
/**
- * Use serialVersionUID for interoperability.
- * Using the version 1.4 UID.
+ * Use serialVersionUID for interoperability. Using the version 1.4 UID.
*/
private static final long serialVersionUID = -8486391734674855519L;
@@ -60,22 +60,35 @@ public class SystemException
public CompletionStatus completed;
/**
- * The additional exception error code ("minor").
+ * <p>
+ * Contains more details about the exception. The lower 12 bits contain a
+ * code, defining the reason why exception has been thrown. The higher 20 bits
+ * hold "Vendor Minor Codeset ID" (VMCID).
+ * </p>
+ * <p>
+ * The Classpath specifice minor exception codes are documented in the headers
+ * of the corresponding exceptions (for instance, {@link MARSHAL}).
+ * </p>
+ *
+ * The VMCID 0 and 0xfffff are reserved for experimental use.
+ *
+ * @see OMGVMCID
*/
public int minor;
/**
* Constructs an instance of the CORBA standard exception.
- * @param a_reason a string, explaining the reason why the
- * exceptions has been thrown.
+ *
+ * @param a_reason a string, explaining the reason why the exceptions has been
+ * thrown.
* @param a_minor an additional error code (known as the "minor")
* @param a_completed the task completion status.
*/
protected SystemException(String a_reason, int a_minor,
- CompletionStatus a_completed
- )
+ CompletionStatus a_completed)
{
- super(a_reason);
+ super(a_reason + " Minor: " + Integer.toHexString(a_minor) + " ("
+ + (a_minor & 0xFFF) + "). Completed: "+a_completed);
minor = a_minor;
completed = a_completed;
}
diff --git a/libjava/classpath/org/omg/CORBA/TIMEOUT.java b/libjava/classpath/org/omg/CORBA/TIMEOUT.java
new file mode 100644
index 00000000000..44ae8b31cb3
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/TIMEOUT.java
@@ -0,0 +1,98 @@
+/* TIMEOUT.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when no delivery has been made during the specified timeout duration.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TIMEOUT
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 4674850648191359518L;
+
+ /**
+ * Creates TIMEOUT with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public TIMEOUT(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates TIMEOUT with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public TIMEOUT()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a TIMEOUT exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public TIMEOUT(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created TIMEOUT exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public TIMEOUT(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java
new file mode 100644
index 00000000000..5f1981ba408
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java
@@ -0,0 +1,99 @@
+/* TRANSACTION_MODE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when the TransactionPolicy in the IOR is not the same as the current
+ * transaction mode.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TRANSACTION_MODE
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 681236728492128745L;
+
+ /**
+ * Creates TRANSACTION_MODE with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public TRANSACTION_MODE(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates TRANSACTION_MODE with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public TRANSACTION_MODE()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a TRANSACTION_MODE exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_MODE(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created TRANSACTION_MODE exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_MODE(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java
new file mode 100644
index 00000000000..dc808a23ce9
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java
@@ -0,0 +1,99 @@
+/* TRANSACTION_UNAVAILABLE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised in response to the abnormal termination of the transaction
+ * service.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TRANSACTION_UNAVAILABLE
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 6340246200933309385L;
+
+ /**
+ * Creates TRANSACTION_UNAVAILABLE with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public TRANSACTION_UNAVAILABLE(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates TRANSACTION_UNAVAILABLE with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public TRANSACTION_UNAVAILABLE()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a TRANSACTION_UNAVAILABLE exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_UNAVAILABLE(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created TRANSACTION_UNAVAILABLE exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_UNAVAILABLE(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java b/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java
index 276e8bf16e3..bb293376d1f 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -58,7 +58,7 @@ public class TypeCodeHolder
* The default type code for this holder.
*/
private static final TypeCode t_TypeCode =
- new primitiveTypeCode(TCKind.tk_TypeCode);
+ new PrimitiveTypeCode(TCKind.tk_TypeCode);
/**
* The <code>TypeCode</code> (CORBA <code>TypeCode</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java b/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java
index 88192f6ad8e..8ca659d7f4d 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java
@@ -40,8 +40,8 @@ package org.omg.CORBA.TypeCodePackage;
import java.io.Serializable;
-import org.omg.CORBA.IDLEntity;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
/**
* This exception is thrown when an inappropriate operation is invoked on
diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java b/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java
index cd48706bce5..16954e034f1 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java
@@ -40,8 +40,8 @@ package org.omg.CORBA.TypeCodePackage;
import java.io.Serializable;
-import org.omg.CORBA.IDLEntity;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
/**
* The {@link org.omg.CORBA.TypeCode#member_name(int) },
diff --git a/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java b/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java
index e92409bb0c4..1148cb40865 100644
--- a/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class ULongLongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_ulong);
+ return new ArrayTypeCode(TCKind.tk_ulong);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java b/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java
index 2d0fcf0b371..70b43bf7f45 100644
--- a/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class ULongLongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_ulonglong);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_ulonglong);
/**
* Constructs an instance of ULongLongSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java b/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java
index 846833c2a89..dddc1323d7e 100644
--- a/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class ULongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_long);
+ return new ArrayTypeCode(TCKind.tk_long);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java b/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java
index 8810e2159fc..64d9db6ceee 100644
--- a/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class ULongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_ulong);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_ulong);
/**
* Constructs an instance of ULongSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java b/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java
index 76371bc308a..d1fc440a90d 100644
--- a/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class UShortSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_short);
+ return new ArrayTypeCode(TCKind.tk_short);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java b/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java
index 8c6f7d19075..47e33b9be02 100644
--- a/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class UShortSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_ushort);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_ushort);
/**
* Constructs an instance of UShortSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java b/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java
index a4943564489..c599542fb96 100644
--- a/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java
+++ b/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.InputStream;
@@ -97,7 +98,7 @@ public abstract class UnionMemberHelper
}
active = true;
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
StructMember[] members = new StructMember[ 4 ];
TypeCode member;
@@ -152,6 +153,7 @@ public abstract class UnionMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
@@ -172,6 +174,7 @@ public abstract class UnionMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java
new file mode 100644
index 00000000000..e93dc740399
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java
@@ -0,0 +1,157 @@
+/* UnknownUserExceptionHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+* The helper operations for the exception {@link UnknownUserException}.
+*
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public abstract class UnknownUserExceptionHelper
+{
+ /**
+ * The cached typecode value, computed only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Create the UnknownUserException typecode (structure,
+ * named "UnknownUserException", containing a single field of
+ * type {@link Any}, named "except".
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ {
+ ORB orb = ORB.init();
+ StructMember[] members = new StructMember[ 1 ];
+
+ TypeCode field;
+
+ field = orb.get_primitive_tc(TCKind.tk_any);
+ members [ 0 ] = new StructMember("except", field, null);
+ typeCode =
+ orb.create_exception_tc(id(), "UnknownUserException", members);
+ }
+ return typeCode;
+ }
+
+ /**
+ * Insert the UnknownUserException into the given Any.
+ * This method uses the UnknownUserExceptionHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the UnknownUserException to insert.
+ */
+ public static void insert(Any any, UnknownUserException that)
+ {
+ any.insert_Streamable(new UnknownUserExceptionHolder(that));
+ }
+
+ /**
+ * Extract the UnknownUserException from given Any.
+ * This method uses the UnknownUserExceptionHolder.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain
+ * UnknownUserException.
+ */
+ public static UnknownUserException extract(Any any)
+ {
+ try
+ {
+ return ((UnknownUserExceptionHolder) any.extract_Streamable()).value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("UnknownUserException expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the UnknownUserException repository id.
+ *
+ * @return "IDL:omg.org/CORBA/UnknownUserException:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/UnknownUserException:1.0";
+ }
+
+ /**
+ * Read the exception from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static UnknownUserException read(InputStream input)
+ {
+ // Read the exception repository id.
+ String id = input.read_string();
+ UnknownUserException value = new UnknownUserException();
+
+ value.except = input.read_any();
+ return value;
+ }
+
+ /**
+ * Write the exception to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, UnknownUserException value)
+ {
+ // Write the exception repository id.
+ output.write_string(id());
+ output.write_any(value.except);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java
new file mode 100644
index 00000000000..d7b1ca006d4
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java
@@ -0,0 +1,103 @@
+/* UnknownUserExceptionHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+* A holder for the exception {@link UnknownUserException}.
+
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public class UnknownUserExceptionHolder implements Streamable
+{
+ /**
+ * The stored UnknownUserException value.
+ */
+ public UnknownUserException value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public UnknownUserExceptionHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public UnknownUserExceptionHolder(UnknownUserException initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = UnknownUserExceptionHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ UnknownUserExceptionHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the UnknownUserException.
+ */
+ public TypeCode _type()
+ {
+ return UnknownUserExceptionHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java b/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java
index 941e9d740fe..1699d912d61 100644
--- a/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.CDR.Vio;
-import gnu.CORBA.recordTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -109,7 +109,7 @@ public abstract class ValueBaseHelper
*/
public static TypeCode type()
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_value);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_value);
return r;
}
diff --git a/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java b/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java
index c6efed5eb04..6f57d17c3f1 100644
--- a/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java
@@ -79,7 +79,7 @@ public class ValueBaseHolder
/**
* Read fill in the value field by reading an instance from the
- * given input stream. Uses {@link ValueBaseHelper.}
+ * given input stream. Uses {@link ValueBaseHelper}
*
* @param input a stream to read from.
*/
@@ -89,7 +89,7 @@ public class ValueBaseHolder
}
/**
- * Get the typecode of the stored instance. Uses {@link ValueBaseHelper.}
+ * Get the typecode of the stored instance. Uses {@link ValueBaseHelper}
*/
public TypeCode _type()
{
@@ -97,10 +97,10 @@ public class ValueBaseHolder
}
/**
- * Write the stored instance to the given input stream.
- * Uses {@link ValueBaseHelper.}
+ * Write the stored instance to the given output stream.
+ * Uses {@link ValueBaseHelper}
*
- * @param input a stream to read from.
+ * @param output a stream to write to.
*/
public void _write(OutputStream output)
{
diff --git a/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java b/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java
index 208623c2e7b..3150af2aaf4 100644
--- a/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.InputStream;
@@ -91,7 +92,7 @@ public abstract class ValueMemberHelper
{
if (typeCode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
if (active)
{
@@ -177,6 +178,7 @@ public abstract class ValueMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
@@ -200,6 +202,7 @@ public abstract class ValueMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java b/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java
index dcdad34e4f5..9845702985a 100644
--- a/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java
+++ b/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class VersionSpecHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "VersionSpec", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/VisibilityHelper.java b/libjava/classpath/org/omg/CORBA/VisibilityHelper.java
index f2ed32f6371..a09e5b6867d 100644
--- a/libjava/classpath/org/omg/CORBA/VisibilityHelper.java
+++ b/libjava/classpath/org/omg/CORBA/VisibilityHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -59,7 +59,7 @@ public abstract class VisibilityHelper
/**
* Insert the Visibility into the given Any.
- * Uses {@link Any.insert_short}.
+ * Uses {@link Any#insert_short}.
*/
public static void insert(Any any, short that)
{
@@ -68,7 +68,7 @@ public abstract class VisibilityHelper
/**
* Extract the Visibility from the given Any.
- * Uses {@link Any.extract_short}.
+ * Uses {@link Any#extract_short}.
*/
public static short extract(Any any)
{
@@ -83,9 +83,9 @@ public abstract class VisibilityHelper
if (typeCode == null)
{
TypeCode tshort =
- Restricted_ORB.Singleton.get_primitive_tc(TCKind.tk_short);
+ OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_short);
typeCode =
- Restricted_ORB.Singleton.create_alias_tc(id(), "Visibility", tshort);
+ OrbRestricted.Singleton.create_alias_tc(id(), "Visibility", tshort);
}
return typeCode;
}
@@ -103,7 +103,7 @@ public abstract class VisibilityHelper
/**
* Read the visibility value (as short) from the CDR intput stream.
*
- * Uses {@link InputStream.read_short()}.
+ * Uses {@link InputStream#read_short()}.
*
* @param istream a stream to read from.
*/
@@ -115,7 +115,7 @@ public abstract class VisibilityHelper
/**
* Write the visibility value (as short) to the CDR output stream.
*
- * USes {@link OutputStream.write_short(short)}.
+ * USes {@link OutputStream#write_short(short)}.
*
* @param ostream a stream to write into.
* @param value a value to write.
diff --git a/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java b/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java
index c12c3de1c78..4bb92989d05 100644
--- a/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class WCharSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_char);
+ return new ArrayTypeCode(TCKind.tk_char);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java b/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java
index 1b11506a298..72a9cc8c1e3 100644
--- a/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class WCharSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_wchar);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_wchar);
/**
* Constructs an instance of WCharSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java b/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java
index 916c6a250da..356cf0dd21c 100644
--- a/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -127,7 +127,7 @@ public abstract class WStringSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_string);
+ return new ArrayTypeCode(TCKind.tk_string);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java b/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java
index 474d69a47ad..68b77ff6a3a 100755
--- a/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class WStringSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_wchar);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_wchar);
/**
* Constructs an instance of WStringSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/WStringValueHelper.java b/libjava/classpath/org/omg/CORBA/WStringValueHelper.java
index 7748a6c782d..1c63a408e3d 100644
--- a/libjava/classpath/org/omg/CORBA/WStringValueHelper.java
+++ b/libjava/classpath/org/omg/CORBA/WStringValueHelper.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.gnuAny;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -75,7 +74,7 @@ public class WStringValueHelper
* The Wide String typecode.
*/
private static final TypeCode twString =
- Restricted_ORB.Singleton.create_wstring_tc(0);
+ OrbRestricted.Singleton.create_wstring_tc(0);
/**
* Returns the String Value repository Id.
@@ -121,7 +120,9 @@ public class WStringValueHelper
}
catch (ClassCastException ex)
{
- throw new MARSHAL("String expected");
+ MARSHAL m = new MARSHAL("String expected");
+ m.minor = Minor.ClassCast;
+ throw m;
}
}
@@ -141,7 +142,11 @@ public class WStringValueHelper
return an_any.extract_wstring();
}
else
- throw new BAD_OPERATION("Contains not a wide string value type");
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("WString value type expected");
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
/**
@@ -177,7 +182,7 @@ public class WStringValueHelper
{
if (typecode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
typecode =
orb.create_value_box_tc(id(), "WStringValue", twString);
}
diff --git a/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java b/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java
new file mode 100644
index 00000000000..5bb5baff2eb
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java
@@ -0,0 +1,151 @@
+/* WrongTransactionHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+* The helper operations for the exception {@link WrongTransaction}.
+*
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public abstract class WrongTransactionHelper
+{
+ /**
+ * The cached typecode value, computed only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Create the WrongTransaction typecode (structure,
+ * named "WrongTransaction"), no fields.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ {
+ ORB orb = ORB.init();
+ StructMember[] members = new StructMember[ 0 ];
+ typeCode = orb.create_exception_tc(id(), "WrongTransaction", members);
+ }
+ return typeCode;
+ }
+
+ /* Every user exception with no user defined
+ fields can use EmptyExceptionHolder */
+
+ /**
+ * Insert the WrongTransaction into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the WrongTransaction to insert.
+ */
+ public static void insert(Any any, WrongTransaction that)
+ {
+ any.insert_Streamable(new EmptyExceptionHolder(that, type()));
+ }
+
+ /**
+ * Extract the WrongTransaction from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain WrongTransaction.
+ */
+ public static WrongTransaction extract(Any any)
+ {
+ try
+ {
+ EmptyExceptionHolder h =
+ (EmptyExceptionHolder) any.extract_Streamable();
+ return (WrongTransaction) h.value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("WrongTransaction expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the WrongTransaction repository id.
+ *
+ * @return "IDL:omg.org/CORBA/WrongTransaction:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/WrongTransaction:1.0";
+ }
+
+ /**
+ * Read the exception from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static WrongTransaction read(InputStream input)
+ {
+ // Read the exception repository id.
+ String id = input.read_string();
+ WrongTransaction value = new WrongTransaction(id);
+
+ return value;
+ }
+
+ /**
+ * Write the exception to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, WrongTransaction value)
+ {
+ // Write the exception repository id.
+ output.write_string(id());
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java b/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java
new file mode 100644
index 00000000000..103724f81dd
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java
@@ -0,0 +1,103 @@
+/* WrongTransactionHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for the exception {@link WrongTransaction}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class WrongTransactionHolder implements Streamable
+{
+ /**
+ * The stored WrongTransaction value.
+ */
+ public WrongTransaction value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public WrongTransactionHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public WrongTransactionHolder(WrongTransaction initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = WrongTransactionHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ WrongTransactionHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the WrongTransaction.
+ */
+ public TypeCode _type()
+ {
+ return WrongTransactionHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java b/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java
index db36fa78016..6661b0c4702 100644
--- a/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java
+++ b/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.ApplicationException;
@@ -52,7 +53,7 @@ import java.io.Serializable;
/**
* The stub for the IDL type. This stub can be used to access the
* remote IDL type object, if its IOR is known. To create the
- * working instance with the known IOR, pass {@link gnu.CORBA.IOR_Delegate}
+ * working instance with the known IOR, pass {@link gnu.CORBA.IorDelegate}
* to the constructor.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
@@ -78,7 +79,7 @@ public class _IDLTypeStub
/**
* Create an instance with the given delegate.
*
- * @see gnu.CORBA.IOR_Delegate
+ * @see gnu.CORBA.IorDelegate
*/
public _IDLTypeStub(Delegate delegate)
{
@@ -114,6 +115,7 @@ public class _IDLTypeStub
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
index 3cf1f49770d..f2f21a79e17 100644
--- a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
+++ b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
@@ -60,9 +60,9 @@ public abstract class ObjectImpl
implements org.omg.CORBA.Object
{
/**
- * The vendor - dependent delegate, responsible for the method implementations.
+ * The delegate, responsible for the method implementations.
*/
- private Delegate delegate;
+ transient Delegate delegate;
/**
* Create a request to invoke the method of this object, specifying
diff --git a/libjava/classpath/org/omg/CORBA_2_3/ORB.java b/libjava/classpath/org/omg/CORBA_2_3/ORB.java
index 7a9dc6a1a57..82660fea705 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/ORB.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/ORB.java
@@ -117,11 +117,9 @@ public abstract class ORB
}
/**
- * Up till OMG 3.0.3 inclusive and also in Suns API till 1.4
- * inclusive this is totally undocumented. No problem, though,
- * because is in addition not implemented.
- *
- * @throws NO_IMPLEMENT, always.
+ * This method is called by RMI-IIOP {@link javax.rmi.Tie#orb(ORB)},
+ * passing <code>this</code> as parameter. The ORB will try to connect
+ * that tie as one of its objects.
*/
public void set_delegate(java.lang.Object wrapper)
{
diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
index 06ee33e6616..23055ef2d4d 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
@@ -40,9 +40,9 @@ package org.omg.CORBA_2_3.portable;
import gnu.CORBA.CDR.Vio;
-import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.CustomMarshal;
import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.ValueFactory;
+import org.omg.CORBA.portable.StreamableValue;
import java.io.Serializable;
@@ -78,12 +78,12 @@ public abstract class InputStream
*/
public Object read_abstract_interface()
{
- boolean isValue = read_boolean();
+ boolean isObject = read_boolean();
- if (isValue)
- return read_value();
- else
+ if (isObject)
return read_Object();
+ else
+ return read_value();
}
/**
@@ -192,11 +192,7 @@ public abstract class InputStream
*/
public Serializable read_value(String repository_id)
{
- ValueFactory factory =
- ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
- if (factory == null)
- throw new MARSHAL("No factory");
- return (Serializable) Vio.read(this, null, factory);
+ return Vio.read(this, repository_id);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
index 2ff8c226a82..70f9a4913ba 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
@@ -64,40 +64,40 @@ public abstract class OutputStream
extends org.omg.CORBA.portable.OutputStream
{
/**
- * Writes an abstract interface to the stream. An abstract interface can
- * be eithe CORBA object or value type and is written as a union with
- * the boolean discriminator (false for objects, true for value types).
- *
- * The object from value is separated by fact that all values implement
- * the {@link ValueBase} interface. Also, the passed parameter is treated
- * as value it it does not implement CORBA Object.
- *
+ * Writes an abstract interface to the stream. An abstract interface can be
+ * eithe CORBA object or value type and is written as a union with the boolean
+ * discriminator (false for objects, true for value types).
+ *
+ * The object from value is separated by fact that all values implement the
+ * {@link ValueBase} interface. Also, the passed parameter is treated as value
+ * it it does not implement CORBA Object.
+ *
* @param an_interface an abstract interface to write.
*/
public void write_abstract_interface(java.lang.Object an_interface)
{
- boolean isValue =
- an_interface instanceof ValueBase ||
- (!(an_interface instanceof org.omg.CORBA.Object));
+ boolean isObject = !(an_interface instanceof ValueBase)
+ && an_interface instanceof org.omg.CORBA.Object;
- write_boolean(isValue);
+ write_boolean(isObject);
- if (isValue)
- write_value((ValueBase) an_interface);
- else
+ if (isObject)
write_Object((org.omg.CORBA.Object) an_interface);
+ else
+ write_value((Serializable) an_interface);
+
}
/**
* Writes a value type into the output stream.
- *
- * The value type must implement either {@link CustomValue}
- * (for user-defined writing method) or {@link StramableValue}
- * (for standard writing using code, generated by IDL compiler).
- *
- * The written record will have a repository id, matching the
- * class of the passed object. The codebase will not be written.
- *
+ *
+ * The value type must implement either {@link CustomValue} (for user-defined
+ * writing method) or {@link StramableValue} (for standard writing using code,
+ * generated by IDL compiler).
+ *
+ * The written record will have a repository id, matching the class of the
+ * passed object. The codebase will not be written.
+ *
* @param value a value type object to write.
*/
public void write_value(Serializable value)
@@ -124,7 +124,9 @@ public abstract class OutputStream
* Writes a value type into the output stream, stating it is an
* instance of the given class. The written record
* will have a repository id, matching the passed class.
- * The codebase will not be written.
+ * The codebase will not be written. It the object
+ * being written is an instance of the different class, this results
+ * writing two Id inheritance hierarchy.
*
* The value type must implement either {@link CustomValue}
* (for user-defined writing method) or {@link StramableValue}
@@ -138,15 +140,15 @@ public abstract class OutputStream
}
/**
- * Writes a value type into the output stream,
- * stating it has the given repository id.
- *
- * The value type must implement either {@link CustomValue}
- * (for user-defined writing method) or {@link StramableValue}
- * (for standard writing using code, generated by IDL compiler).
- *
+ * Writes a value type into the output stream, stating it has the given
+ * repository id.
+ *
+ * The value type must implement either {@link CustomValue} (for user-defined
+ * writing method) or {@link StramableValue} (for standard writing using code,
+ * generated by IDL compiler).
+ *
* @param repository_id a repository id of the value type.
- *
+ *
* @param value a value type object to write.
*/
public void write_value(Serializable value, String repository_id)
diff --git a/libjava/classpath/org/omg/CosNaming/BindingHelper.java b/libjava/classpath/org/omg/CosNaming/BindingHelper.java
index 1665464ec7e..b5b42077218 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -74,7 +76,10 @@ public abstract class BindingHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("Binding expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Binding expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
index 204d9f05872..64f7b4dfa51 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
@@ -78,6 +80,7 @@ public abstract class BindingIteratorHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Binding iterator expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -121,6 +124,35 @@ public abstract class BindingIteratorHelper
return new _BindingIteratorStub(delegate);
}
}
+
+ /**
+ * Narrow the given object to the BindingIterator. No type-checking is
+ * performed to verify that the object actually supports the requested type.
+ * The {@link BAD_OPERATION} will be thrown if unsupported operations are
+ * invoked on the new returned reference, but no failure is expected at the
+ * time of the unchecked_narrow.
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted binding iterator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static BindingIterator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof BindingIterator)
+ return (BindingIterator) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _BindingIteratorStub(delegate);
+ }
+ }
/**
* Read the exception from the given CDR stream.
diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java
index 1aa7521fbb2..988c4ee9126 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.portable.InputStream;
@@ -103,7 +105,8 @@ public abstract class BindingIteratorPOA
out = rh.createReply();
}
else
- throw new BAD_OPERATION(method, 0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(method, Minor.Method,
+ CompletionStatus.COMPLETED_MAYBE);
return out;
}
diff --git a/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java b/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java
index ede00008ea7..2f0dc71c4ef 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -71,6 +73,7 @@ public abstract class BindingTypeHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Binding type expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/IstringHelper.java b/libjava/classpath/org/omg/CosNaming/IstringHelper.java
index 83bbecee5af..b90b452e69f 100644
--- a/libjava/classpath/org/omg/CosNaming/IstringHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/IstringHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CosNaming;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -84,7 +84,7 @@ public abstract class IstringHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "Istring", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CosNaming/NameComponent.java b/libjava/classpath/org/omg/CosNaming/NameComponent.java
index a2db313e620..1e06caaeffe 100644
--- a/libjava/classpath/org/omg/CosNaming/NameComponent.java
+++ b/libjava/classpath/org/omg/CosNaming/NameComponent.java
@@ -40,6 +40,8 @@ package org.omg.CosNaming;
import org.omg.CORBA.portable.IDLEntity;
+import java.util.zip.Adler32;
+
/**
* The name component, a node in the multi-comonent name.
*
@@ -115,4 +117,14 @@ public final class NameComponent
{
return id + "." + kind;
}
-} \ No newline at end of file
+
+ /**
+ * Return the hashCode of this NameComponent.
+ */
+ public int hashCode()
+ {
+ Adler32 adler = new Adler32();
+ adler.update(toString().getBytes());
+ return (int) adler.getValue() & Integer.MAX_VALUE;
+ }
+}
diff --git a/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java b/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java
index 9f0e1287efd..8499edfe66e 100644
--- a/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -76,6 +78,7 @@ public abstract class NameComponentHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Name component expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NameHelper.java b/libjava/classpath/org/omg/CosNaming/NameHelper.java
index 047ad918f93..18faf31823b 100644
--- a/libjava/classpath/org/omg/CosNaming/NameHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NameHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -77,6 +79,7 @@ public abstract class NameHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Name expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java
index 6e2ef060b9a..86bf8c55dfd 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
@@ -78,6 +80,7 @@ public abstract class NamingContextExtHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NamingContextExt expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -122,6 +125,35 @@ public abstract class NamingContextExtHelper
return new _NamingContextExtStub(delegate);
}
}
+
+ /**
+ * Narrow the given object to the NamingContextExt. No type-checking is
+ * performed to verify that the object actually supports the requested type.
+ * The {@link BAD_OPERATION} will be thrown if unsupported operations are
+ * invoked on the new returned reference, but no failure is expected at the
+ * time of the unchecked_narrow.
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted NamingContextExt
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static NamingContextExt unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof NamingContextExt)
+ return (NamingContextExt) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _NamingContextExtStub(delegate);
+ }
+ }
/**
* Read the extended naming context from the given CDR input stream.
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java
index a6d3346f82c..cf5d7b3d808 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.ObjectHelper;
@@ -189,7 +191,7 @@ public abstract class NamingContextExtPOA
OutputStream out = null;
Integer call_method = (Integer) _NamingContextImplBase.methods.get(method);
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java
index 3a60d9cb4de..fb9b091a6a0 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
@@ -78,6 +80,7 @@ public abstract class NamingContextHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Naming context expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -130,6 +133,35 @@ public abstract class NamingContextHelper
else
throw new BAD_PARAM();
}
+
+ /**
+ * Narrow the given object to the NamingContext. No type-checking is performed
+ * to verify that the object actually supports the requested type. The
+ * {@link BAD_OPERATION} will be thrown if unsupported operations are invoked
+ * on the new returned reference, but no failure is expected at the time of
+ * the unchecked_narrow.
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted NamingContext.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static NamingContext unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof NamingContext)
+ return (NamingContext) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _NamingContextStub(delegate);
+ }
+ }
/**
* Read the naming context from the given CDR input stream.
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java
index a2db0ad3502..a9788827642 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.ObjectHelper;
@@ -92,7 +94,7 @@ public abstract class NamingContextPOA
OutputStream out = null;
Integer call_method = (Integer) _NamingContextImplBase.methods.get(method);
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java
index 9487895213c..6bf7bd7a6b3 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -75,7 +77,10 @@ public abstract class AlreadyBoundHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java
index d1a1da51e4e..1d0b6049b66 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -78,7 +80,10 @@ public abstract class CannotProceedHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java
index 434713b2d6f..8f1133602d7 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -75,7 +77,10 @@ public abstract class InvalidNameHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java
index e1f82994f9e..6333dfcbcd3 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -75,7 +77,10 @@ public abstract class NotEmptyHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java
index 544ab63776f..442b7db9e63 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -77,7 +79,10 @@ public abstract class NotFoundHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java
index b6eacf85f90..45a42a0ba70 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -74,7 +76,10 @@ public abstract class NotFoundReasonHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java b/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java
index 53c0dd3a656..9c7e1b34728 100644
--- a/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java
+++ b/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BooleanHolder;
import org.omg.CORBA.CompletionStatus;
@@ -114,7 +116,8 @@ public abstract class _BindingIteratorImplBase
out = rh.createReply();
}
else
- throw new BAD_OPERATION(method, 0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(method, Minor.Method,
+ CompletionStatus.COMPLETED_MAYBE);
return out;
}
diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java b/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java
index 3ad77203084..a0bc80ac08d 100644
--- a/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java
+++ b/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CosNaming;
-import gnu.CORBA.NamingService.snConverter;
+import gnu.CORBA.NamingService.NameTransformer;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ObjectHelper;
@@ -86,7 +86,7 @@ public class _NamingContextExtStub
/**
* The local name form converter.
*/
- private snConverter converter = new snConverter();
+ private NameTransformer converter = new NameTransformer();
/**
* Create the naming context stub.
diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
index 7c1fb3a1d1e..33bddef5d74 100644
--- a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
+++ b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.DynamicImplementation;
@@ -123,7 +125,7 @@ public abstract class _NamingContextImplBase
OutputStream out = null;
Integer call_method = (Integer) methods.get(method);
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
@@ -389,7 +391,7 @@ public abstract class _NamingContextImplBase
// The server request contains no required result type.
Integer call_method = (Integer) methods.get(request.operation());
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java
index 0c02916e542..b8e3aafef5b 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.ORB;
@@ -80,6 +82,25 @@ public abstract class DynAnyFactoryHelper
+ " is not a DynAnyFactory");
}
}
+
+ /**
+ * Narrow the given object to the DynAnyFactory. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynAnyFactory.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynAnyFactory unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the final_type code of the {@link DynAnyFactory}.
@@ -161,13 +182,8 @@ public abstract class DynAnyFactoryHelper
*/
static String not_applicable(String Id)
{
- try
- {
- throw new MARSHAL("The read/write are not applicable for " + Id);
- }
- catch (Exception e)
- {
- throw new MARSHAL();
- }
+ MARSHAL m = new MARSHAL("The read/write are not applicable for " + Id);
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
index c7b54bef89d..a9f45c4b73c 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny.DynAnyFactoryPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class InconsistentTypeCodeHelper
{
BAD_OPERATION bad = new BAD_OPERATION("InconsistentTypeCode expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java
index ca48cd4c5aa..73e2d9856a1 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java
@@ -79,6 +79,25 @@ public abstract class DynAnyHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynAny");
}
}
+
+ /**
+ * Narrow the given object to the DynAny. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynAny.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynAny unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynAny}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java
index 55e35eedc81..1b5004f072b 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny.DynAnyPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class InvalidValueHelper
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidValue expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java
index e15fb72c668..b09ab4db863 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny.DynAnyPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class TypeMismatchHelper
{
BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java
index 87e34452319..ec3f0c4815f 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
import gnu.CORBA.DynAnySeqHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class DynAnySeqHelper
{
BAD_OPERATION bad = new BAD_OPERATION("DynAnySeq expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java
index 0372b58518c..f2892c85692 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java
@@ -78,6 +78,25 @@ public abstract class DynArrayHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynArray");
}
}
+
+ /**
+ * Narrow the given object to the DynArray. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynArray.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynArray unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynArray}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java
index 944d4375739..8db1a20065e 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java
@@ -79,6 +79,25 @@ public abstract class DynEnumHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynEnum");
}
}
+
+ /**
+ * Narrow the given object to the DynEnum. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynEnum.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynEnum unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynEnum}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java
index 1d818d7b178..84bb59d9f3c 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java
@@ -79,6 +79,25 @@ public abstract class DynFixedHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynFixed");
}
}
+
+ /**
+ * Narrow the given object to the DynFixed. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynFixed.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynFixed unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynFixed}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java
index c38a51f0951..ad30133712e 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java
@@ -78,6 +78,25 @@ public abstract class DynSequenceHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynSequence");
}
}
+
+ /**
+ * Narrow the given object to the DynSequence. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynSequence.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynSequence unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynSequence}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java
index e4790b443ff..021c5d031a5 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java
@@ -78,6 +78,25 @@ public abstract class DynStructHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynStruct");
}
}
+
+ /**
+ * Narrow the given object to the DynStruct. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynStruct.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynStruct unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynStruct}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java
index 794098333e9..8f924c0864e 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java
@@ -78,6 +78,25 @@ public abstract class DynUnionHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynUnion");
}
}
+
+ /**
+ * Narrow the given object to the DynUnion. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynUnion.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynUnion unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynUnion}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java
index a6d7afaa9e3..026ca499077 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java
@@ -78,6 +78,25 @@ public abstract class DynValueHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynValue");
}
}
+
+ /**
+ * Narrow the given object to the DynValue. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynValue.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynValue unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynValue}.
diff --git a/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java
index 7c4cdbf4919..f15b8adfa4f 100644
--- a/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -84,7 +84,7 @@ public abstract class FieldNameHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java
index d649800b8b6..a0e5c6b85f9 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameDynAnyPairHolder;
import org.omg.CORBA.Any;
@@ -83,6 +84,7 @@ public abstract class NameDynAnyPairHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPair expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
index f110926b853..ec4f728228f 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameDynAnyPairSeqHolder;
import org.omg.CORBA.Any;
@@ -105,6 +106,7 @@ public abstract class NameDynAnyPairSeqHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPairSeq expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java
index a3d5bff4526..1e0f52b5946 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameValuePairHolder;
import org.omg.CORBA.Any;
@@ -118,6 +119,7 @@ public abstract class NameValuePairHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java
index 400708e18e0..62481534e1a 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameValuePairSeqHolder;
import org.omg.CORBA.Any;
@@ -98,6 +99,7 @@ public abstract class NameValuePairSeqHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameValuePairSeq expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java
index b0f6d6052a6..15f7c816b44 100644
--- a/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java
+++ b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TypeCode;
@@ -101,7 +103,9 @@ public class _DynAnyFactoryStub
public DynAny create_dyn_any(Any _0)
throws InconsistentTypeCode
{
- throw new MARSHAL(NOT_APPLICABLE);
+ MARSHAL m = new MARSHAL(NOT_APPLICABLE);
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -113,7 +117,9 @@ public class _DynAnyFactoryStub
public DynAny create_dyn_any_from_type_code(TypeCode _0)
throws InconsistentTypeCode
{
- throw new MARSHAL(NOT_APPLICABLE);
+ MARSHAL m = new MARSHAL(NOT_APPLICABLE);
+ m.minor = Minor.Inappropriate;
+ throw m;
}
static String NOT_APPLICABLE =
diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java b/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java
index d5c55a264cc..fea0b887bd9 100644
--- a/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java
@@ -120,6 +120,25 @@ public abstract class CodecFactoryHelper
throw bad;
}
}
+
+ /**
+ * Narrow the given object to the CodecFactory. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted CodecFactory.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static CodecFactory unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* This should read the CodecFactory from the CDR intput stream,
diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java
index a1082178c52..e036dbf1f42 100644
--- a/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecFactoryPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Any;
@@ -108,6 +109,7 @@ public abstract class UnknownEncodingHelper
{
BAD_OPERATION bad = new BAD_OPERATION("UnknownEncoding expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
index e5910ac57a0..e353be8f9ed 100644
--- a/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -103,6 +104,7 @@ public abstract class FormatMismatchHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("FormatMismatch expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java
index 6c4ce52f0b5..8a93c5895a0 100644
--- a/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class InvalidTypeForEncodingHelper
{
BAD_OPERATION bad =
new BAD_OPERATION("InvalidTypeForEncoding expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java
index 9f422863755..33951de701f 100644
--- a/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -103,6 +104,7 @@ public abstract class TypeMismatchHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java b/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java
new file mode 100644
index 00000000000..167ab1ac7e9
--- /dev/null
+++ b/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java
@@ -0,0 +1,60 @@
+/* ExceptionDetailMessage.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.IOP;
+
+/**
+ * <p>Defines the ExceptionDetailMessage (= 14) service context. This context
+ * may be included into reply message, having the SYSTEM_EXCEPTION or
+ * USER_EXCEPTION reply status, as the alternative to the stack trace
+ * that might contain sensitive or unwanted information. The service
+ * context contains the CDR-encapsulated wide string, usually
+ * returned by {@link Exception#getMessage}.
+ * </p><p>
+ * The applications may also send the more comprehensive UnknownExceptionInfo
+ * ( = 9 ) service context that contains the thrown exception, written
+ * as the Value type.
+ * </p>
+ */
+public interface ExceptionDetailMessage
+{
+ /**
+ * Specifies the ExceptionDetailMessage value, 14.
+ */
+ int value = 14;
+}
diff --git a/libjava/classpath/org/omg/IOP/IORHelper.java b/libjava/classpath/org/omg/IOP/IORHelper.java
index 5945bb75aa4..77f18d9b9cd 100644
--- a/libjava/classpath/org/omg/IOP/IORHelper.java
+++ b/libjava/classpath/org/omg/IOP/IORHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -111,6 +113,7 @@ public abstract class IORHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("IOR expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java
index bc26068c94c..6f5156fe223 100644
--- a/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java
+++ b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.ORB;
import org.omg.CORBA.Any;
import org.omg.CORBA.TypeCode;
@@ -96,6 +98,7 @@ public abstract class MultipleComponentProfileHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("MultipleComponentProfile expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java b/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java
new file mode 100644
index 00000000000..a071c848887
--- /dev/null
+++ b/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java
@@ -0,0 +1,56 @@
+/* RMICustomMaxStreamFormat.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.IOP;
+
+ /**
+ * A single constant interface, defining the RMICustomMaxStreamFormat (= 17)
+ * service context. This constant is used in the service contexts
+ * inside the message when the {@link TAG_RMI_CUSTOM_MAX_STREAM_FORMAT}
+ * are used in IOR references. Please note that these two constants have
+ * different values.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface RMICustomMaxStreamFormat
+{
+ /**
+ * Specifies the RMICustomMaxStreamFormat value, 17.
+ */
+ int value = 17;
+}
diff --git a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java
index a8224a64cdc..5693a32357a 100644
--- a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java
+++ b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -115,6 +117,7 @@ public abstract class ServiceContextHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ServiceContext expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java
index 11bbe253fea..fa436cbb885 100644
--- a/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java
+++ b/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -94,7 +96,10 @@ public abstract class ServiceContextListHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("ServiceContext[] expected.");
+ BAD_OPERATION bad = new BAD_OPERATION("ServiceContext[] expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java b/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java
new file mode 100644
index 00000000000..e13c759c954
--- /dev/null
+++ b/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java
@@ -0,0 +1,61 @@
+/* TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.IOP;
+
+/**
+ * A single constant interface, defining the
+ * TAG_RMI_CUSTOM_MAX_STREAM_FORMAT (= 38) tagged component.
+ *
+ * This component defines the format that has been used to write the RMI-IIOP
+ * value type objects in the message. It consists of the single byte,
+ * having the value of the used version. If this component is missing,
+ * the default value is assumed to be 1 for GIOP 1.2 and 2 for GIOP 1.3.
+ * The component can occur only once in the same IOR profile.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
+{
+ /**
+ * Specifies the TAG_RMI_CUSTOM_MAX_STREAM_FORMAT value, 38.
+ */
+ int value = 38;
+}
diff --git a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
index 906d6390a36..eaee120f081 100644
--- a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
+++ b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.MARSHAL;
@@ -115,6 +117,7 @@ public abstract class TaggedComponentHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("TaggedComponent expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
@@ -149,6 +152,7 @@ public abstract class TaggedComponentHelper
catch (IOException e)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(e);
throw m;
}
@@ -175,6 +179,7 @@ public abstract class TaggedComponentHelper
catch (IOException e)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(e);
throw m;
}
diff --git a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
index a23122eb975..2943657c01f 100644
--- a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
+++ b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
@@ -38,8 +38,9 @@ exception statement from your version. */
package org.omg.IOP;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.Minor;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -118,6 +119,7 @@ public abstract class TaggedProfileHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("TaggedProfile expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
@@ -143,10 +145,10 @@ public abstract class TaggedProfileHelper
TaggedProfile value = new TaggedProfile();
value.tag = input.read_long();
- if (input instanceof cdrBufInput)
+ if (input instanceof BufferredCdrInput)
{
// Highly probable.
- value.profile_data = ((cdrBufInput) input).read_sequence();
+ value.profile_data = ((BufferredCdrInput) input).read_sequence();
}
else
{
@@ -167,7 +169,7 @@ public abstract class TaggedProfileHelper
{
output.write_long(value.tag);
- if (output instanceof cdrBufOutput)
+ if (output instanceof BufferedCdrOutput)
{
// Highly probable.
output.write_long(value.profile_data.length);
@@ -178,6 +180,7 @@ public abstract class TaggedProfileHelper
catch (IOException e)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(e);
throw m;
}
diff --git a/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java b/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java
index 7d8b412fe5f..1d482c57950 100644
--- a/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java
+++ b/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package org.omg.Messaging;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.recordTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.TCKind;
@@ -104,10 +104,10 @@ public class SyncScopeHelper
*/
public static TypeCode type()
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_alias);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_alias);
r.setName("SyncScope");
r.setId(id());
- r.setContentType(new primitiveTypeCode(TCKind.tk_short));
+ r.setContentType(new PrimitiveTypeCode(TCKind.tk_short));
return r;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java b/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java
new file mode 100644
index 00000000000..d7e7e1487e9
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java
@@ -0,0 +1,55 @@
+/* ACTIVE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (ACTIVE) = 1.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ACTIVE
+{
+ /**
+ * Specifies the ACTIVE value, 1.
+ */
+ short value = 1;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java
new file mode 100644
index 00000000000..f3f7e64416a
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java
@@ -0,0 +1,119 @@
+/* AdapterManagerIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper operations for the adapter manager id. An adapter manager id is an
+ * integer constant and needs no helper, but the one is included anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class AdapterManagerIdHelper
+{
+ /**
+ * Create the AdapterManagerId typecode (alias of CORBA long (java int),
+ * named "AdapterManagerId").
+ */
+ public static TypeCode type()
+ {
+ ORB orb = ORB.init();
+ return orb.create_alias_tc(id(), "AdapterManagerId",
+ orb.get_primitive_tc(TCKind.tk_long)
+ );
+ }
+
+ /**
+ * Insert the int into the given Any.
+ */
+ public static void insert(Any any, int that)
+ {
+ any.insert_long(that);
+ }
+
+ /**
+ * Extract the int from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain int.
+ */
+ public static int extract(Any any)
+ {
+ return any.extract_long();
+ }
+
+ /**
+ * Get the adapter manager id repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/AdapterManagerId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/AdapterManagerId:1.0";
+ }
+
+ /**
+ * Read the int (adapter manager id) from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static int read(InputStream input)
+ {
+ return input.read_long();
+ }
+
+ /**
+ * Write the int (adapter manager id) to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, int value)
+ {
+ output.write_long(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java
new file mode 100644
index 00000000000..1cda311b23d
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java
@@ -0,0 +1,144 @@
+/* AdapterNameHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.StringSeqHolder;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * Provides static helper methods for working with the adapter name helper.
+ * The adapter name helper is an array of strings, so {@link StringSeqHelper}
+ * could be used for io operations. The separate helper is provided anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class AdapterNameHelper
+{
+
+ /**
+ * The cached typecode, computed once.
+ */
+ static TypeCode typecode;
+
+ /**
+ * Extract the adapter name (<code>String[]</code>) from the given {@link Any}.
+ *
+ * @param a an Any to extract the array from.
+ *
+ * @return the extracted array.
+ */
+ public static String[] extract(Any a)
+ {
+ StringSeqHolder h = (StringSeqHolder) a.extract_Streamable();
+ return h.value;
+ }
+
+ /**
+ * Returns the agreed Id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/AdapterName:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/AdapterName:1.0";
+ }
+
+ /**
+ * Insert into the given adapter name (<code>String[]</code>) into the
+ * given {@link Any}.
+ *
+ * @param into the target Any.
+ * @param that the array to insert.
+ */
+ public static void insert(Any into, String[] that)
+ {
+ StringSeqHolder holder = new StringSeqHolder(that);
+ into.insert_Streamable(holder);
+ into.type(type());
+ }
+
+ /**
+ * Reads the <code>String[]</code> from the CORBA input stream.
+ *
+ * @param input the CORBA stream to read from.
+ * @return the value from the stream.
+ */
+ public static String[] read(InputStream input)
+ {
+ return StringSeqHelper.read(input);
+ }
+
+ /**
+ * Creates and returns a new instance of the TypeCode,
+ * corresponding the adapter name.
+ *
+ * @return the alias of the string sequence, named "AdapterName".
+ */
+ public static TypeCode type()
+ {
+ if (typecode == null)
+ {
+ ORB orb = OrbRestricted.Singleton;
+
+ TypeCode component = orb.create_string_tc(0);
+ typecode = orb.create_alias_tc(id(), "AdapterName", component);
+ }
+ return typecode;
+ }
+
+ /**
+ * Writes the <code>String[]</code> into the given stream.
+ *
+ * @param output the CORBA output stream to write.
+ * @param value the value that must be written.
+ */
+ public static void write(OutputStream output, String[] value)
+ {
+ StringSeqHelper.write(output, value);
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java
new file mode 100644
index 00000000000..ceb7ac8d52a
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java
@@ -0,0 +1,119 @@
+/* AdapterStateHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper operations for the adapter state. An adapter state is an
+ * short integer constant and needs no helper, but the one is included anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class AdapterStateHelper
+{
+ /**
+ * Create the AdapterState typecode (alias of <code>short</code>,
+ * named "AdapterState").
+ */
+ public static TypeCode type()
+ {
+ ORB orb = ORB.init();
+ return orb.create_alias_tc(id(), "AdapterState",
+ orb.get_primitive_tc(TCKind.tk_short)
+ );
+ }
+
+ /**
+ * Insert the <code>short</code> into the given Any.
+ */
+ public static void insert(Any any, short that)
+ {
+ any.insert_short(that);
+ }
+
+ /**
+ * Extract the <code>short</code> from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain int.
+ */
+ public static short extract(Any any)
+ {
+ return any.extract_short();
+ }
+
+ /**
+ * Get the adapter state repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/AdapterState:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/AdapterState:1.0";
+ }
+
+ /**
+ * Read the <code>short</code> (adapter state) from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static short read(InputStream input)
+ {
+ return input.read_short();
+ }
+
+ /**
+ * Write the <code>short</code> (adapter state) to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, short value)
+ {
+ output.write_short(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java
index b7a5a541e93..df3bcaef72b 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.MARSHAL;
@@ -45,6 +47,7 @@ import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
+import org.omg.PortableServer.ServantActivator;
/**
* The helper operations for the CORBA object {@link Current}.
@@ -123,6 +126,25 @@ public abstract class CurrentHelper
throw new BAD_PARAM("Not a Current");
}
}
+
+ /**
+ * Narrow the given object to the Current. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted Current.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static Current unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Not supported for compatibility reasons.
@@ -133,7 +155,9 @@ public abstract class CurrentHelper
*/
public static Current read(InputStream input)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -145,6 +169,8 @@ public abstract class CurrentHelper
*/
public static void write(OutputStream output, Current value)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java b/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java
new file mode 100644
index 00000000000..bec0c25e0ac
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java
@@ -0,0 +1,55 @@
+/* DISCARDING.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (DISCARDING) = 2.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface DISCARDING
+{
+ /**
+ * Specifies the DISCARDING value, 2.
+ */
+ short value = 2;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java
index 11d6b7f0fd6..5db56d74560 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+import gnu.CORBA.Minor;
import gnu.CORBA.Interceptor.ForwardRequestHolder;
import org.omg.CORBA.Any;
@@ -106,6 +107,7 @@ public abstract class ForwardRequestHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION(id() + " expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java b/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java
new file mode 100644
index 00000000000..ce22a1f6860
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java
@@ -0,0 +1,55 @@
+/* HOLDING.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (HOLDING) = 0.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface HOLDING
+{
+ /**
+ * Specifies the HOLDING value, 0.
+ */
+ short value = 0;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java b/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java
new file mode 100644
index 00000000000..8a5cad1e124
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java
@@ -0,0 +1,57 @@
+/* INACTIVE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (INACTIVE) = 3.
+ * The adapter is shutting down, and will eventually end up in the
+ * NON_EXISTENT state.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface INACTIVE
+{
+ /**
+ * Specifies the INACTIVE value, 3.
+ */
+ short value = 3;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java
index 58ef02fb0c0..fdeb2973b8a 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java
@@ -73,7 +73,7 @@ public interface IORInfoOperations
void add_ior_component(TaggedComponent tagged_component);
/**
- * Get the server side policy for an IOR being constructed. The method returns
+ * Get the server side policy for an IOR being constructed. The method returns
* policies applying for POA where the object, represented by this IOR, is
* connected.
*
@@ -85,4 +85,54 @@ public interface IORInfoOperations
* @see org.omg.PortableServer.POAOperations#create_POA
*/
Policy get_effective_policy(int policy_type);
+
+ /**
+ * Get the adapter template that is associated with the object POA.
+ * The template is also a reference factory and can produce the new object
+ * references.
+ *
+ * @since 1.5
+ */
+ public ObjectReferenceTemplate adapter_template();
+
+ /**
+ * The current_factory is the factory, used by the adapter to create
+ * object references. This factory is initially the same as the
+ * adapter_template.
+ *
+ * @since 1.5
+ */
+ public ObjectReferenceFactory current_factory();
+
+ /**
+ * Set the current object reference factory, used to produce the new objects.
+ *
+ * The current factory can only be set during the call to the
+ * {@link IORInterceptor_3_0Operations#components_established(IORInfo)}.
+ *
+ * @since 1.5
+ */
+ public void current_factory(ObjectReferenceFactory factory);
+
+ /**
+ * Get the POA manager Id.
+ *
+ * @return Id that uniquely refers to the poa manager, used by this POA.
+ *
+ * @since 1.5
+ *
+ * @see IORInterceptor_3_0Operations#adapter_manager_state_changed
+ */
+ public int manager_id();
+
+ /**
+ * Get the state of the adapter manager.
+ *
+ * @since 1.5
+ *
+ * @return the state of the adapters to that the IOR being created belongs.
+ * One of the {@link HOLDING#value}, {@link DISCARDING#value},
+ * {@link INACTIVE#value} or {@link NON_EXISTENT#value}.
+ */
+ short state();
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java
index 868fcab6c62..746d139cf6f 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java
@@ -47,12 +47,12 @@ package org.omg.PortableInterceptor;
public interface IORInterceptorOperations extends InterceptorOperations
{
/**
- * A server side ORB calls this method on all registered IORInterceptor's when
+ * A server side ORB calls this method on all registered IORInterceptor's when
* creating the object reference (IOR). The interceptors have the possibility
* to add additional tags to the IOR being created.
*
- * @param info the interface class providing methods to insert additional tags
- * into IOR being constructed. The same instan
+ * @param info the interface class providing methods to insert additional tags
+ * into IOR being constructed.
*/
public void establish_components(IORInfo info);
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java
new file mode 100644
index 00000000000..4b2093d40c6
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java
@@ -0,0 +1,59 @@
+/* IORInterceptor_3_0.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * The IORInterceptor_3_0 adds to {@link Interceptor} functionality, available
+ * since CORBA 3.0. These new operations are defined separately in
+ * {@link IORInterceptor_3_0Operations}.
+ *
+ * IORInterceptor_3_0 is registered exactly in the same way as the
+ * {@link IORInterceptor}. The ORB calls the additional methods to all
+ * IOR interceptors that implement this extended interface.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface IORInterceptor_3_0
+ extends IORInterceptor_3_0Operations, IDLEntity, IORInterceptor
+{
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java
new file mode 100644
index 00000000000..565242477d9
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java
@@ -0,0 +1,195 @@
+/* IORInterceptor_3_0Helper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The helper operations for the CORBA object {@link IORInterceptor_3_0}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class IORInterceptor_3_0Helper
+{
+ /**
+ * The cached {@link IORInterceptor_3_0} typecode, computed once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Get the type code of the {@link IORInterceptor_3_0}.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ typeCode = ORB.init().create_interface_tc(id(), "IORInterceptor_3_0");
+ return typeCode;
+ }
+
+ /**
+ * Insert the IORInterceptor_3_0 into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the IORInterceptor_3_0 to insert.
+ */
+ public static void insert(Any any, IORInterceptor_3_0 that)
+ {
+ any.insert_Streamable(new IORInterceptor_3_0Holder(that));
+ }
+
+ /**
+ * Extract the IORInterceptor_3_0 from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain
+ * IORInterceptor_3_0.
+ */
+ public static IORInterceptor_3_0 extract(Any any)
+ {
+ try
+ {
+ IORInterceptor_3_0Holder holder = (IORInterceptor_3_0Holder)
+ any.extract_Streamable();
+ return holder.value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("IORInterceptor_3_0 expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the IORInterceptor_3_0 repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0";
+ }
+
+ /**
+ * Narrow the passed object into the IORInterceptor_3_0. If the object has a
+ * different java type, create an instance of the _IORInterceptor_3_0Stub,
+ * using the same delegate, as for the passed parameter. Hence, unlike java
+ * type cast, this method may return a different object, than has been passed.
+ *
+ * @param obj the object to narrow.
+ * @return narrowed instance.
+ * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0.
+ */
+ public static IORInterceptor_3_0 narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof IORInterceptor_3_0)
+ return (IORInterceptor_3_0) obj;
+ else if (!obj._is_a(id()))
+ throw new BAD_PARAM("Not a IORInterceptor_3_0");
+ else
+ {
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _IORInterceptor_3_0Stub(delegate);
+ }
+ }
+
+ /**
+ * Narrow the passed object into the IORInterceptor_3_0. No type-checking is
+ * performed to verify that the object actually supports the requested type.
+ * The {@link BAD_OPERATION} will be thrown if unsupported operations are
+ * invoked on the new returned reference, but no failure is expected at the
+ * time of the unchecked_narrow. For instance, the narrowing of the
+ * remote instance of the {@link IORInterceptor} will work as long as only the
+ * methods, inherited from this parent, are invoked.
+ *
+ *
+ * @param obj the object to narrow.
+ * @return narrowed instance.
+ * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0.
+ */
+ public static IORInterceptor_3_0 unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof IORInterceptor_3_0)
+ return (IORInterceptor_3_0) obj;
+ else
+ {
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _IORInterceptor_3_0Stub(delegate);
+ }
+ }
+
+
+ /**
+ * Read the IORInterceptor_3_0 from the CDR intput stream (IOR profile
+ * expected).
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static IORInterceptor_3_0 read(InputStream input)
+ {
+ return unchecked_narrow(input.read_Object());
+ }
+
+ /**
+ * Write the IORInterceptor_3_0 to the CDR output stream (as IOR profile).
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, IORInterceptor_3_0 value)
+ {
+ output.write_Object(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java
new file mode 100644
index 00000000000..dc7ecf23faa
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java
@@ -0,0 +1,106 @@
+/* IORInterceptor_3_0Holder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for the object {@link IORInterceptor_3_0}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class IORInterceptor_3_0Holder
+ implements Streamable
+{
+ /**
+ * The stored IORInterceptor_3_0 value.
+ */
+ public IORInterceptor_3_0 value;
+
+ /**
+ * Create the unitialised instance, leaving the value field with default
+ * <code>null</code> value.
+ */
+ public IORInterceptor_3_0Holder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ *
+ * @param initialValue the value that will be assigned to the
+ * <code>value</code> field.
+ */
+ public IORInterceptor_3_0Holder(IORInterceptor_3_0 initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = IORInterceptor_3_0Helper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ IORInterceptor_3_0Helper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the IORInterceptor_3_0.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return IORInterceptor_3_0Helper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java
new file mode 100644
index 00000000000..ce6575a4ce0
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java
@@ -0,0 +1,90 @@
+/* IORInterceptor_3_0Operations.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * Defines the operations, applicable to the IORInterceptor_3_0.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface IORInterceptor_3_0Operations
+ extends IORInterceptorOperations
+{
+ /**
+ * This method is invoked on all registered IORInterceptor_3_0 instances when
+ * the state of the adapter manager changes.
+ *
+ * @param adapterManagerId the Id of the adapter manager that has changed the
+ * state. The same value is returned by
+ * {@link IORInfoOperations#manager_id()}.
+ *
+ * @param adapterState the new state of the adapter manager, one of the
+ * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value}
+ * or {@link NON_EXISTENT#value}.
+ */
+ void adapter_manager_state_changed(int adapterManagerId, short adapterState);
+
+ /**
+ * Notifies the interceptor about the adapter state changes that are unrelated
+ * to adapter manager state changes. This method is invoked on all registered
+ * IORInterceptor_3_0 instances. The only currently possible change of state
+ * is when POA is destroyed. In this case, the method is invoked passing the
+ * single element array witn the reference template of the POA being destroyed
+ * and the {@link NON_EXISTENT#value} state.
+ *
+ * @param adapters identifies the object adapters that have changed they
+ * state.
+ * @param adaptersState the new state of the adapters, one of the
+ * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value}
+ * or {@link NON_EXISTENT#value}.
+ */
+ void adapter_state_changed(ObjectReferenceTemplate[] adapters,
+ short adaptersState);
+
+ /**
+ * This metod is invoked after the
+ * {@link IORInterceptorOperations#establish_components} have been called on
+ * all registered interceptor instances. At this stage, it is possible to set
+ * the object reference factory using
+ * {@link IORInfo#current_factory(ObjectReferenceFactory )}.
+ */
+ void components_established(IORInfo info);
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java
index c0aa0ee1bb4..98b2596771f 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class InvalidSlotHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java b/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java
new file mode 100644
index 00000000000..136b64fb008
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java
@@ -0,0 +1,57 @@
+/* NON_EXISTENT.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (NON_EXISTENT) = 4.
+ * NON_EXISTENT does not map directly to a particular POAManager state, but
+ * indicates that a POA has been destroyed. Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+
+public interface NON_EXISTENT
+{
+ /**
+ * Specifies the NON_EXISTENT value, 4.
+ */
+ short value = 4;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java
new file mode 100644
index 00000000000..8332845a662
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java
@@ -0,0 +1,119 @@
+/* ORBIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The ORB Id is defined in OMG specification just as a narrow (not wide)
+ * string. As such, the ORB Id needs no helper, but one is included in
+ * the API anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ORBIdHelper
+{
+ /**
+ * Insert the ORB Id into Any (uses {@link Any.insert_string}).
+ *
+ * @param a the Any to insert into.
+ * @param that the string to insert.
+ */
+ public static void insert(Any a, String that)
+ {
+ a.insert_string(that);
+ }
+
+ /**
+ * Extract the ORB Id from Any ((uses {@link Any.extract_string}).
+ *
+ * @param a the Any to extract from.
+ */
+ public static String extract(Any a)
+ {
+ return a.extract_string();
+ }
+
+ /**
+ * Return an alias typecode.
+ */
+ public static TypeCode type()
+ {
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ORBId", orb.create_string_tc(0));
+ }
+
+ /**
+ * Return the ORB Id repository id.
+ * @return "IDL:omg.org/PortableInterceptor/ORBId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ORBId:1.0";
+ }
+
+ /**
+ * Calls {@link InputStream#read_string()}.
+ *
+ * @param input the stream to read from.
+ */
+ public static String read(InputStream input)
+ {
+ return input.read_string();
+ }
+
+ /**
+ * Calls {@link OutputStream#write_string()}.
+ *
+ * @param output the stream to write into.
+ * @param value the string (ORB Id) value to write.
+ */
+ public static void write(OutputStream output, String value)
+ {
+ output.write_string(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java
index 9cffbe1b551..7b545ff8168 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java
@@ -55,7 +55,7 @@ public interface ORBInitInfoOperations
*
* @param interceptor the interceptor to register.
*
- * @throws DuplicateName if the interceptor name is not an empty string and an
+ * @throws DuplicateName if the interceptor name is not an empty string and an
* interceptor with this name is already registered with the ORB being
* created.
*/
@@ -63,11 +63,14 @@ public interface ORBInitInfoOperations
throws DuplicateName;
/**
- * Register the IOR (object reference) interceptor.
- *
+ * Register the IOR (object reference) interceptor. If the registered
+ * interceptor implements the extended {@link IORInterceptor_3_0} interface,
+ * ORB will call its additional methods, defined in the
+ * {@link IORInterceptor_3_0Operations}.
+ *
* @param interceptor the interceptor to register.
- *
- * @throws DuplicateName if the interceptor name is not an empty string and an
+ *
+ * @throws DuplicateName if the interceptor name is not an empty string and an
* interceptor with this name is already registered with the ORB being
* created.
*/
@@ -79,7 +82,7 @@ public interface ORBInitInfoOperations
*
* @param interceptor the interceptor to register.
*
- * @throws DuplicateName if the interceptor name is not an empty string and an
+ * @throws DuplicateName if the interceptor name is not an empty string and an
* interceptor with this name is already registered with the ORB being
* created.
*/
@@ -90,7 +93,7 @@ public interface ORBInitInfoOperations
* Allocate a slot on a {@link PortableInterceptor.Current}. While slots can
* be allocated by this method, they cannot be initialized.
* {@link CurrentOperations#get_slot} and {@link CurrentOperations#set_slot}
- * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor
+ * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor
* initializer.
*
* @return the index to the slot that has been allocated.
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
index a5c83fa80b0..648e9679b42 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
@@ -110,6 +110,7 @@ public abstract class DuplicateNameHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("DuplicateName expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
index 7f1132f98a3..f89f9d4c6db 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor.ORBInitInfoPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -103,6 +104,7 @@ public abstract class InvalidNameHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidName expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
index d0946e3fa00..c22d14a11fd 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor.ORBInitInfoPackage;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -81,8 +81,8 @@ public class ObjectIdHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
- return orb.create_alias_tc(id(), "Object Id", orb.create_string_tc(0));
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ObjectId", orb.create_string_tc(0));
}
/**
@@ -97,7 +97,7 @@ public class ObjectIdHelper
/**
* Calls {@link InputStream#read_string()}.
*
- * @param instream the stream to read from.
+ * @param input the stream to read from.
*/
public static String read(InputStream input)
{
@@ -107,7 +107,7 @@ public class ObjectIdHelper
/**
* Calls {@link OutputStream#write_string()}.
*
- * @param ostream the stream to write into.
+ * @param output the stream to write into.
* @param value the string (Object Id) value to write.
*/
public static void write(OutputStream output, String value)
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java
new file mode 100644
index 00000000000..600d0a0fb94
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java
@@ -0,0 +1,121 @@
+/* ObjectIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA.OctetSeqHolder;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Object Id of this package is defined in OMG specification as a byte array.
+ * As such, the Object Id needs no helper, but one is included in the API anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectIdHelper
+{
+ /**
+ * Insert the Object Id into Any.
+ *
+ * @param a the Any to insert into.
+ * @param that the string to insert.
+ */
+ public static void insert(Any a, byte[] that)
+ {
+ a.insert_Streamable(new OctetSeqHolder(that));
+ a.type(type());
+ }
+
+ /**
+ * Extract the Object Id from Any.
+ *
+ * @param a the Any to extract from.
+ */
+ public static byte[] extract(Any a)
+ {
+ return ((OctetSeqHolder) a.extract_Streamable()).value;
+ }
+
+ /**
+ * Return an alias typecode (an alias of the octet sequence).
+ */
+ public static TypeCode type()
+ {
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type());
+ }
+
+ /**
+ * Return the Object Id repository id.
+ * @return "IDL:omg.org/PortableInterceptor/ObjectId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectId:1.0";
+ }
+
+ /**
+ * Read the Object Id as a byte array.
+ *
+ * @param input the stream to read from.
+ */
+ public static byte[] read(InputStream input)
+ {
+ return OctetSeqHelper.read(input);
+ }
+
+ /**
+ * Write the Object Id as a byte array.
+ *
+ * @param output the stream to write into.
+ * @param value the Object Id value to write.
+ */
+ public static void write(OutputStream output, byte[] value)
+ {
+ OctetSeqHelper.write(output, value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java
new file mode 100644
index 00000000000..55cde585c5e
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java
@@ -0,0 +1,57 @@
+/* ObjectReferenceFactory.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * 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
+{
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java
new file mode 100644
index 00000000000..55ee0be18fc
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java
@@ -0,0 +1,150 @@
+/* ObjectReferenceFactoryHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.CDR.Vio;
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.VM_ABSTRACT;
+
+/**
+ * The helper operations for the CORBA object {@link ObjectReferenceFactory}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectReferenceFactoryHelper
+{
+ /**
+ * The cached {@link ObjectReferenceFactory} typecode, computed once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Get the type code of the {@link ObjectReferenceFactory}.
+ *
+ * @return value type code with the agreed id, named
+ * "ObjectReferenceFactory", abstract, no members, no base type.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ typeCode =
+ ORB.init().create_value_tc(id(), "ObjectReferenceFactory",
+ VM_ABSTRACT.value, null, new ValueMember[ 0 ]
+ );
+ return typeCode;
+ }
+
+ /**
+ * Insert the ObjectReferenceFactory into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the ObjectReferenceFactory to insert.
+ */
+ public static void insert(Any any, ObjectReferenceFactory that)
+ {
+ ObjectReferenceFactoryHolder h = new ObjectReferenceFactoryHolder(that);
+ any.insert_Streamable(h);
+ }
+
+ /**
+ * Extract the ObjectReferenceFactory from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain ObjectReferenceFactory.
+ */
+ public static ObjectReferenceFactory extract(Any any)
+ {
+ try
+ {
+ ObjectReferenceFactoryHolder h =
+ (ObjectReferenceFactoryHolder) (any.extract_Streamable());
+ return h.value;
+ }
+ catch (ClassCastException ex)
+ {
+ BAD_OPERATION bad =
+ new BAD_OPERATION("ObjectReferenceFactory expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the ObjectReferenceFactory repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceFactory:1.0",
+ * always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectReferenceFactory:1.0";
+ }
+
+ /**
+ * Read the ObjectReferenceFactory from the CDR intput stream
+ * (ValueBase type expected).
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static ObjectReferenceFactory read(InputStream input)
+ {
+ return (ObjectReferenceFactory) Vio.read(input);
+ }
+
+ /**
+ * Write the ObjectReferenceFactory to the CDR output stream (as a ValueBase).
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, ObjectReferenceFactory value)
+ {
+ Vio.write(output, value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java
new file mode 100644
index 00000000000..fc68ec5c148
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java
@@ -0,0 +1,105 @@
+/* ObjectReferenceFactoryHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for the object {@link ObjectReferenceFactory}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ObjectReferenceFactoryHolder
+ implements Streamable
+{
+ /**
+ * The stored ObjectReferenceFactory value.
+ */
+ public ObjectReferenceFactory value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public ObjectReferenceFactoryHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public ObjectReferenceFactoryHolder(ObjectReferenceFactory initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = ObjectReferenceFactoryHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ ObjectReferenceFactoryHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the ObjectReferenceFactory.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return ObjectReferenceFactoryHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java
new file mode 100644
index 00000000000..b5d912d12be
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java
@@ -0,0 +1,69 @@
+/* ObjectReferenceFactoryOperations.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.ValueBase;
+
+/**
+ * Defines the operations, applicable to the ObjectReferenceFactory.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ObjectReferenceFactoryOperations
+ extends ValueBase
+{
+ /**
+ * 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.
+ */
+ org.omg.CORBA.Object make_object(String repositoryId, byte[] objectId);
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java
new file mode 100644
index 00000000000..666735e7636
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java
@@ -0,0 +1,78 @@
+/* ObjectReferenceTemplate.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.PortableServer.POA;
+
+/**
+ * Defines the identity of the portable object adapter ({@link POA}}. The
+ * adapter name, orb id and server id together uniquely define the identity
+ * of this adapter.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ObjectReferenceTemplate
+ extends ObjectReferenceFactory
+{
+ /**
+ * Get the name of this adapter. This name can be set by specifying
+ * the org.omg.CORBA.ORBid property in the ORB.Init(.., Properties).
+ * The default value includes the hashcode of the ORB instance and hence
+ * should normally differ for each ORB.
+ *
+ * @return the name of adapter, represented in the form of the string array.
+ */
+ String[] adapter_name();
+
+ /**
+ * The id of the {@link org.omg.CORBA.ORB} of this adapter.
+ *
+ * @return the ORB id, represented in the form of string.
+ */
+ String orb_id();
+
+ /**
+ * Get the server id of of this adapter. This name can be set by specifying
+ * the org.omg.CORBA.ServerId property in the ORB.Init(.., Properties) or
+ * in the system property. All ORB's on the same jre share the same value.
+ *
+ * @return the server id, represented in the form of string.
+ */
+ String server_id();
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java
new file mode 100644
index 00000000000..258a73ae8a1
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java
@@ -0,0 +1,144 @@
+/* ObjectReferenceTemplateHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.VM_ABSTRACT;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The helper operations for the CORBA object
+ * {@link ObjectReferenceTemplate}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectReferenceTemplateHelper
+{
+ /**
+ * The cached {@link ObjectReferenceTemplate} typecode, computed once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Get the type code of the {@link ObjectReferenceTemplate}.
+ *
+ * @return value type type code, named ObjectReferenceTemplate,
+ * no members, abstract.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ typeCode =
+ ORB.init().create_value_tc(id(), "ObjectReferenceTemplate",
+ VM_ABSTRACT.value, null, new ValueMember[ 0 ]
+ );
+ return typeCode;
+ }
+
+ /**
+ * Insert the ObjectReferenceTemplate into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the ObjectReferenceTemplate to insert.
+ */
+ public static void insert(Any any, ObjectReferenceTemplate that)
+ {
+ any.insert_Streamable(new ObjectReferenceTemplateHolder(that));
+ }
+
+ /**
+ * Extract the ObjectReferenceTemplate from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not
+ * contain ObjectReferenceTemplate.
+ */
+ public static ObjectReferenceTemplate extract(Any any)
+ {
+ try
+ {
+ ObjectReferenceTemplateHolder h =
+ (ObjectReferenceTemplateHolder) any.extract_Streamable();
+ return h.value;
+ }
+ catch (ClassCastException ex)
+ {
+ BAD_OPERATION bad =
+ new BAD_OPERATION("ObjectReferenceTemplate expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the ObjectReferenceTemplate repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplate:1.0",
+ * always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplate:1.0";
+ }
+
+ /**
+ * Read the object reference template (as the value type).
+ */
+ public static ObjectReferenceTemplate read(InputStream input)
+ {
+ return (ObjectReferenceTemplate)
+ ((org.omg.CORBA_2_3.portable.InputStream) input).read_value();
+ }
+
+ /**
+ * Write the object reference template (as the value type).
+ */
+ public static void write(OutputStream output, ObjectReferenceTemplate value)
+ {
+ ((org.omg.CORBA_2_3.portable.OutputStream) output).
+ write_value(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java
new file mode 100644
index 00000000000..9658e1fa718
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java
@@ -0,0 +1,103 @@
+/* ObjectReferenceTemplateHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+ /**
+ * A holder for the object {@link ObjectReferenceTemplate}.
+ *
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ObjectReferenceTemplateHolder
+ implements Streamable
+{
+ /**
+ * The stored ObjectReferenceTemplate value.
+ */
+ public ObjectReferenceTemplate value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public ObjectReferenceTemplateHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public ObjectReferenceTemplateHolder(ObjectReferenceTemplate initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = ObjectReferenceTemplateHelper .read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ ObjectReferenceTemplateHelper .write(output, value);
+ }
+
+ /**
+ * Get the typecode of the ObjectReferenceTemplate.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return ObjectReferenceTemplateHelper .type();
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java
new file mode 100644
index 00000000000..c4f09896f97
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java
@@ -0,0 +1,169 @@
+/* ObjectReferenceTemplateSeqHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * Provides static helper methods for working with the array of object reference
+ * templates.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectReferenceTemplateSeqHelper
+{
+ /**
+ * The type code, computed once.
+ */
+ static TypeCode typecode;
+
+ /**
+ * Extract the <code>ObjectReferenceTemplate[]</code> from the given
+ * {@link Any}. This implementation expects the {@link Any} to hold the
+ * instance of {@link ObjectReferenceTemplateSeqHolder} that is returned by
+ * {@link Any#extract_Streamable() }.
+ *
+ * @param a an Any to extract the array from.
+ *
+ * @return the extracted array.
+ *
+ * @throws BAD_OPERATION if the Any contains something other than the the
+ * {@link ObjectReferenceTemplateSeqHolder}.
+ */
+ public static ObjectReferenceTemplate[] extract(Any a)
+ {
+ try
+ {
+ ObjectReferenceTemplateSeqHolder h = (ObjectReferenceTemplateSeqHolder)
+ a.extract_Streamable();
+ return h.value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION(
+ "ObjectReferenceTemplate[] expected");
+ bad.initCause(cex);
+ bad.minor = Minor.Any;
+ throw bad;
+ }
+ }
+
+ /**
+ * Returns the object reference template sequence repository Id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplateSeq:1.0",
+ * always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplateSeq:1.0";
+ }
+
+ /**
+ * Insert into the given <code>ObjectReferenceTemplate[]</code> into the
+ * given {@link Any}. This implementation first creates a
+ * {@link ObjectReferenceTemplateSeqHolder} and then calls
+ * {@link Any#insert_Streamable(Streamable)}.
+ *
+ * @param into the target Any.
+ * @param that the array to insert.
+ */
+ public static void insert(Any into, ObjectReferenceTemplate[] that)
+ {
+ ObjectReferenceTemplateSeqHolder holder =
+ new ObjectReferenceTemplateSeqHolder(that);
+ into.insert_Streamable(holder);
+ }
+
+ /**
+ * Reads the <code>ObjectReferenceTemplate[]</code> from the CORBA input
+ * stream.
+ *
+ * @param input the CORBA (not java.io) stream to read from.
+ * @return the value from the stream.
+ */
+ public static ObjectReferenceTemplate[] read(InputStream input)
+ {
+ ObjectReferenceTemplate[] value =
+ new ObjectReferenceTemplate[input.read_long()];
+ for (int i = 0; i < value.length; i++)
+ value[i] = ObjectReferenceTemplateHelper.read(input);
+ return value;
+ }
+
+ /**
+ * Creates and returns a new instance of the TypeCode, corresponding the CORBA
+ * <code>ObjectReferenceTemplate[]</code>. The length of the sequence is
+ * left with the initial value 0.
+ */
+ public static TypeCode type()
+ {
+ if (typecode == null)
+ {
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_sequence);
+ t.setId(id());
+ t.setLength(0);
+ t.setContentType(ObjectReferenceTemplateHelper.type());
+ typecode = t;
+ }
+ return typecode;
+ }
+
+ /**
+ * Writes the <code>ObjectReferenceTemplate[]</code> into the given stream.
+ *
+ * @param output the CORBA (not java.io) output stream to write.
+ * @param value the value that must be written.
+ */
+ public static void write(OutputStream output, ObjectReferenceTemplate[] value)
+ {
+ output.write_long(value.length);
+
+ for (int i = 0; i < value.length; i++)
+ ObjectReferenceTemplateHelper.write(output, value[i]);
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java
new file mode 100644
index 00000000000..d16f5cedd9f
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java
@@ -0,0 +1,104 @@
+/* ObjectReferenceTemplateSeqHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A holder for the array of {@link ObjectReferenceTemplate}s.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ObjectReferenceTemplateSeqHolder
+ implements Streamable
+{
+ /**
+ * The stored ObjectReferenceTemplate value.
+ */
+ public ObjectReferenceTemplate[] value;
+
+ /**
+ * Create the unitialised instance, leaving the value field with default
+ * <code>null</code> value.
+ */
+ public ObjectReferenceTemplateSeqHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ *
+ * @param initialValue the value that will be assigned to the
+ * <code>value</code> field.
+ */
+ public ObjectReferenceTemplateSeqHolder(ObjectReferenceTemplate[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = ObjectReferenceTemplateSeqHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ ObjectReferenceTemplateSeqHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the ObjectReferenceTemplate.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return ObjectReferenceTemplateSeqHelper.type();
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java
new file mode 100644
index 00000000000..e4f8fe9c28f
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java
@@ -0,0 +1,119 @@
+/* ServerIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Server Id is defined in OMG specification just as a narrow (not wide)
+ * string. As such, the Server Id needs no helper, but one is included in
+ * the API anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ServerIdHelper
+{
+ /**
+ * Insert the Server Id into Any (uses {@link Any.insert_string}).
+ *
+ * @param a the Any to insert into.
+ * @param that the string to insert.
+ */
+ public static void insert(Any a, String that)
+ {
+ a.insert_string(that);
+ }
+
+ /**
+ * Extract the Server Id from Any ((uses {@link Any.extract_string}).
+ *
+ * @param a the Any to extract from.
+ */
+ public static String extract(Any a)
+ {
+ return a.extract_string();
+ }
+
+ /**
+ * Return an alias typecode.
+ */
+ public static TypeCode type()
+ {
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ServerId", orb.create_string_tc(0));
+ }
+
+ /**
+ * Return the Server Id repository id.
+ * @return "IDL:omg.org/PortableInterceptor/ServerId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ServerId:1.0";
+ }
+
+ /**
+ * Calls {@link InputStream#read_string()}.
+ *
+ * @param input the stream to read from.
+ */
+ public static String read(InputStream input)
+ {
+ return input.read_string();
+ }
+
+ /**
+ * Calls {@link OutputStream#write_string()}.
+ *
+ * @param output the stream to write into.
+ * @param value the string (Server Id) value to write.
+ */
+ public static void write(OutputStream output, String value)
+ {
+ output.write_string(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java
index 7646253d134..a9ee7d92032 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java
@@ -216,7 +216,8 @@ import org.omg.IOP.ServiceContext;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface ServerRequestInfoOperations extends RequestInfoOperations
+public interface ServerRequestInfoOperations
+ extends RequestInfoOperations
{
/**
* Allows the interceptor to add service contexts to the request. Such added
@@ -231,9 +232,7 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @throws BAD_INV_ORDER minor 15 if the context with the same Id already
* exists and replace=false.
*/
- void add_reply_service_context(ServiceContext service_context,
- boolean replace
- );
+ void add_reply_service_context(ServiceContext service_context, boolean replace);
/**
* Get the identifier for the object adapter (POA).
@@ -257,14 +256,15 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @throws INV_POLICY minor 2 if no factory was registered to produce this
* type of policy or the policy is otherwise invalid.
*/
- Policy get_server_policy(int type) throws INV_POLICY;
+ Policy get_server_policy(int type)
+ throws INV_POLICY;
/**
* Get the exception to be returned to the client. If the returned Any cannot
* not support holding of that exception, it holds
* {@link org.omg.CORBA.UNKNOWN} minor 1 instead.
*
- * @return an Any, holding exception that has been thrown and will be returned
+ * @return an Any, holding exception that has been thrown and will be returned
* to client.
*/
Any sending_exception();
@@ -281,7 +281,8 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @see RequestInfoOperations#get_slot(int)
* @see org.omg.PortableInterceptor#Current
*/
- void set_slot(int id, Any data) throws InvalidSlot;
+ void set_slot(int id, Any data)
+ throws InvalidSlot;
/**
* Checks if the servant is the given repository id.
@@ -299,4 +300,27 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @return the repository id of the servant.
*/
String target_most_derived_interface();
+
+ /**
+ * Returns the name of the adapter that is handling the current request.
+ * The name is returned as a string array, representing full path from
+ * the root poa till the current poa, for instance
+ * {"RootPOA", "childPOA","grandchildPOA"}.
+ */
+ public String[] adapter_name();
+
+ /**
+ * Returns the id of the ORB that is handling the current request. The ORB
+ * id can be specified as the property org.omg.CORBA.ORBid when creating
+ * the ORB.
+ */
+ public String orb_id();
+
+ /**
+ * Returs the id of the server that is handling the current request. The server
+ * id is the same for all POAs and ORBs in the current virtual machine and
+ * can be set as the property org.omg.CORBA.ServerId when creating one of the
+ * ORBs.
+ */
+ public String server_id();
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java b/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java
new file mode 100644
index 00000000000..52856407a54
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java
@@ -0,0 +1,272 @@
+/* _IORInterceptor_3_0Stub.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+
+import java.io.Serializable;
+
+/**
+ * The IORInterceptor_3_0 stub (proxy), used on the client side. The
+ * {@link IORInterceptor_3_0} methods contain the code for remote invocaton. The
+ * stub is required by {@link IORInterceptor_3_0Helper} .read, .narrow and
+ * .unchecked_narrow methods.
+ *
+ * @specnote Being not specified in 1.5 API, this class is package private.
+ * From that happened to some other stubs, it will likely to appear in the 1.6
+ * or later. Because of this, it is placed here.
+ *
+ * @specnote The stub and the helper support the existence of the interceptor
+ * on the remote side only. To support the corresponding support on the side
+ * where the ORB is registered with this interceptor, you also need
+ * _IORInfoStub, IORInfoHelper and either servants or implementation bases
+ * for both POA and IORInfo. These classes are not defined in the 1.5 API,
+ * hence they are not included. You may need to generate the manually from
+ * the IDL descriptions, available from
+ * http://www.omg.org/docs/formal/04-03-12.pdf.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+class _IORInterceptor_3_0Stub
+ extends ObjectImpl
+ implements IORInterceptor_3_0, Serializable
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Create the IORInterceptor_3_0 stub. To get the stub working, you must later
+ * set the delegate with {@link ObjectImpl#_set_delegate(Delegate)}.
+ */
+ public _IORInterceptor_3_0Stub()
+ {
+ }
+
+ /**
+ * Create the naming context stub with the given delegate.
+ */
+ public _IORInterceptor_3_0Stub(Delegate delegate)
+ {
+ _set_delegate(delegate);
+ }
+
+ /**
+ * Return the array of repository ids for this object.
+ */
+ public String[] _ids()
+ {
+ return new String[] { IORInterceptor_3_0Helper.id() };
+ }
+
+ /** {@inheritDoc} */
+ public void adapter_manager_state_changed(int adapterManagerId,
+ short adapterState)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("adapter_manager_state_changed", true);
+ output.write_long(adapterManagerId);
+ output.write_short(adapterState);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ adapter_manager_state_changed(adapterManagerId, adapterState);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void adapter_state_changed(ObjectReferenceTemplate[] adapters,
+ short adaptersState)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("adapter_state_changed", true);
+ output.write_long(adapters.length);
+ for (int i0 = 0; i0 < adapters.length; i0++)
+ ObjectReferenceTemplateHelper.write(output, adapters[i0]);
+ output.write_short(adaptersState);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ adapter_state_changed(adapters, adaptersState);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void components_established(IORInfo info)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("components_established", true);
+ output.write_Object(info);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ components_established(info);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void establish_components(IORInfo info)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("establish_components", true);
+ output.write_Object(info);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ establish_components(info);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String name()
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("name", true);
+ input = _invoke(output);
+ String returns = input.read_string();
+
+ return returns;
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ return name();
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void destroy()
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("destroy", true);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ destroy();
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java
index 0ba6352001f..848a3c3d3f6 100644
--- a/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.CurrentPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -105,6 +106,7 @@ public abstract class NoContextHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("NoContext expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java
index 6f8d5ea6bf3..f4b0619b017 100644
--- a/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
import gnu.CORBA.Poa.ForwardRequestHolder;
import org.omg.CORBA.Any;
@@ -80,6 +81,7 @@ public abstract class ForwardRequestHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java
index 2dda0ef2b61..ac81d389cdd 100644
--- a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -129,7 +131,9 @@ public class IdAssignmentPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java
index d0992d9dbe2..c0f281249b0 100644
--- a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -129,7 +131,9 @@ public class IdUniquenessPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java
index 8d2913bf66f..9d81d5fab81 100644
--- a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -129,7 +131,9 @@ public class ImplicitActivationPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java
index 1e046c4e941..117eb5a3c9e 100644
--- a/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -126,7 +128,9 @@ public class LifespanPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAHelper.java b/libjava/classpath/org/omg/PortableServer/POAHelper.java
index 2928d9f0737..3712da00d69 100644
--- a/libjava/classpath/org/omg/PortableServer/POAHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.ORB;
@@ -126,7 +128,9 @@ public abstract class POAHelper
*/
public static POA read(InputStream input)
{
- throw new MARSHAL("Not applicable");
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -142,6 +146,8 @@ public abstract class POAHelper
*/
public static void write(OutputStream output, POA value)
{
- throw new MARSHAL("Not applicable");
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java
index db7b965bbad..2a587a4126b 100644
--- a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAManagerPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class AdapterInactiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("AdapterInactive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java
index 536189a0ce2..9e856098b0b 100644
--- a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java
+++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer.POAManagerPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -140,7 +142,7 @@ public class State
/**
* Returns the State, matching the given integer constant.
- *
+ *
* @param code one of _HOLDING, _ACTIVE, _DISCARDING, _INACTIVE.
* @return one of HOLDING, ACTIVE, DISCARDING, INACTIVE.
* @throws BAD_PARAM if the parameter is not one of the valid values.
@@ -149,16 +151,19 @@ public class State
{
try
{
- return enume [ code ];
+ return enume[code];
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid state " + code);
+ bad.minor = Minor.Enumeration;
+ throw bad;
}
}
/**
* Returns a short string representation.
+ *
* @return the name of the current enumeration value.
*/
public String toString()
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java
index 3ffee4ff85a..61a41089191 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class AdapterAlreadyExistsHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("AdapterAlreadyExists expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java
index f05daec3d83..dd318bf09cb 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class AdapterNonExistentHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("AdapterNonExistent expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java
index 15aa62d8201..5e9e627c73f 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
+import gnu.CORBA.Minor;
import gnu.CORBA.Poa.InvalidPolicyHolder;
import org.omg.CORBA.Any;
@@ -110,6 +111,7 @@ public abstract class InvalidPolicyHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidPolicy expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java
index 26b21ce6c10..fd2c189fc14 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class NoServantHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("NoServant expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java
index 99891dbe5c3..011867473ee 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class ObjectAlreadyActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ObjectAlreadyActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java
index 867d5f4f641..0d8ff473cf3 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class ObjectNotActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ObjectNotActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java
index 0db0e938b69..a74e674012a 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class ServantAlreadyActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ServantAlreadyActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
index 429421853ba..5fb52cf35b1 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class ServantNotActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ServantNotActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java
index ebba304a536..cd862b0814b 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class WrongAdapterHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("WrongAdapter expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java
index 5460d0ea79d..a1f27cbb0eb 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class WrongPolicyHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("WrongPolicy expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java
index 139010c86e8..0b1ce4d0bfa 100644
--- a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -151,7 +153,9 @@ public class RequestProcessingPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/Servant.java b/libjava/classpath/org/omg/PortableServer/Servant.java
index 745fc8a7ed4..5c99ee1a0e3 100644
--- a/libjava/classpath/org/omg/PortableServer/Servant.java
+++ b/libjava/classpath/org/omg/PortableServer/Servant.java
@@ -45,6 +45,8 @@ import org.omg.CORBA.ORB;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import org.omg.PortableServer.portable.Delegate;
+
+import gnu.CORBA.Minor;
import gnu.CORBA.Poa.ORB_1_4;
import gnu.CORBA.Poa.gnuPOA;
@@ -239,6 +241,7 @@ public abstract class Servant
catch (WrongPolicy unexp)
{
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.Policy;
bad.initCause(unexp);
throw bad;
}
@@ -253,6 +256,7 @@ public abstract class Servant
unexp.initCause(ex);
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.Activation;
bad.initCause(unexp);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java
index 1aab99cee4c..8aa58b2f627 100644
--- a/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java
@@ -38,7 +38,10 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ORB;
@@ -112,6 +115,26 @@ public abstract class ServantActivatorHelper
throw bad;
}
}
+
+ /**
+ * Narrow the given object to the ServantActivator. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted ServantActivator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static ServantActivator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
+
/**
* This should read the servant activator, but it cannot be transferred
@@ -125,7 +148,9 @@ public abstract class ServantActivatorHelper
*/
public static ServantActivator read(InputStream input)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -140,6 +165,8 @@ public abstract class ServantActivatorHelper
*/
public static void write(OutputStream output, ServantActivator value)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java
index 984abdffe69..082c4c586ee 100644
--- a/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.MARSHAL;
@@ -108,10 +110,30 @@ public abstract class ServantLocatorHelper
catch (ClassCastException ex)
{
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.ClassCast;
bad.initCause(ex);
throw bad;
}
}
+
+ /**
+ * Narrow the given object to the ServantLocator. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted ServantLocator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static ServantLocator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* This should read the servant locator, but it cannot be transferred
@@ -125,7 +147,9 @@ public abstract class ServantLocatorHelper
*/
public static ServantLocator read(InputStream input)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -140,6 +164,8 @@ public abstract class ServantLocatorHelper
*/
public static void write(OutputStream output, ServantLocator value)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java
index caf8132e638..0b6ecf62fe1 100644
--- a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -126,7 +128,9 @@ public class ServantRetentionPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java
index c7d4d636726..5c771a7d624 100644
--- a/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -139,7 +141,9 @@ public class ThreadPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider b/libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider
new file mode 100644
index 00000000000..c701be55b0e
--- /dev/null
+++ b/libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider
@@ -0,0 +1,3 @@
+gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider
+gnu.javax.sound.midi.dssi.DSSIMidiDeviceProvider
+
diff --git a/libjava/classpath/resource/Makefile.in b/libjava/classpath/resource/Makefile.in
index 57a3f79fbd3..841b3cab7e3 100644
--- a/libjava/classpath/resource/Makefile.in
+++ b/libjava/classpath/resource/Makefile.in
@@ -40,10 +40,8 @@ target_triplet = @target@
subdir = resource
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -85,10 +83,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -225,6 +227,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -238,6 +241,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/scripts/Makefile.in b/libjava/classpath/scripts/Makefile.in
index c49baa57d48..09ff6ca4d53 100644
--- a/libjava/classpath/scripts/Makefile.in
+++ b/libjava/classpath/scripts/Makefile.in
@@ -40,10 +40,8 @@ subdir = scripts
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/classpath.spec.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -76,10 +74,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -216,6 +218,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -229,6 +232,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/scripts/loc b/libjava/classpath/scripts/loc
new file mode 100755
index 00000000000..dc2f327035f
--- /dev/null
+++ b/libjava/classpath/scripts/loc
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# loc Find a class or package
+#
+# Usage: loc [-l] class-pattern [dirname]
+
+# -l Use system locate command instead of find. In that case, loc
+# will ignore any directory to be searched.
+
+# Example:
+#
+# $ loc -l org.objectweb.jonas.common.JProp
+# /var/lib/jonas/demoserver/ejbjars/autoload/mejb.jar
+# /var/lib/jonas/lib/common/ow_jonas_bootstrap.jar
+# /var/lib/jonas/eclipseserver/ejbjars/autoload/mejb.jar
+# /var/lib/jonas/ejbjars/autoload/mejb.jar
+# /var/cache/jonas/work/ejbjars/jonas/mejb_2005.09.15-17.01.52.jar
+# /usr/src/redhat/BUILD/jonas-4.3.3/jonas/classes/common/org/objectweb/jonas/common/JProp.class
+
+
+MODE=$1
+if test "$MODE" == "-l"; then
+ COMMAND='(locate \*.jar ; locate \*.war)'
+ shift
+else
+ COMMAND='(find "$FOO" -name \*.jar -follow ; find "$FOO" -name \*.war -follow)'
+fi
+
+FOO=$2
+if test "x$FOO" == "x"; then
+ FOO=/usr/share/java
+fi
+
+eval "$COMMAND" 2>/dev/null | while read i; do
+ if (fastjar tf $i 2>/dev/null | grep $1) > /dev/null 2>&1 ; then
+ echo $i
+ fi
+done
+
+if test "$MODE" != "-l"; then
+ find "$FOO" -name '*.class' 2>/dev/null | grep $1
+else
+ locate \*.class | grep $1
+fi
diff --git a/libjava/classpath/test/native/lib/PrimlibInterface.c b/libjava/classpath/test/native/lib/PrimlibInterface.c
deleted file mode 100644
index 47918470a87..00000000000
--- a/libjava/classpath/test/native/lib/PrimlibInterface.c
+++ /dev/null
@@ -1,162 +0,0 @@
-#include "PrimlibInterface.h"
-#include <primlib.h>
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapBoolean
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL Java_PrimlibInterface_unwrapBoolean
-(JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapBoolean(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapByte
- * Signature: (Ljava/lang/Object;)B
- */
-JNIEXPORT jbyte JNICALL Java_PrimlibInterface_unwrapByte
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapByte(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapShort
- * Signature: (Ljava/lang/Object;)S
- */
-JNIEXPORT jshort JNICALL Java_PrimlibInterface_unwrapShort
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapShort(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapChar
- * Signature: (Ljava/lang/Object;)C
- */
-JNIEXPORT jchar JNICALL Java_PrimlibInterface_unwrapChar
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapChar(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapInt
- * Signature: (Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL Java_PrimlibInterface_unwrapInt
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapInt(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapLong
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_PrimlibInterface_unwrapLong
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapLong(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapFloat
- * Signature: (Ljava/lang/Object;)F
- */
-JNIEXPORT jfloat JNICALL Java_PrimlibInterface_unwrapFloat
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapFloat(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapDouble
- * Signature: (Ljava/lang/Object;)D
- */
-JNIEXPORT jdouble JNICALL Java_PrimlibInterface_unwrapDouble
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapDouble(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapBoolean
- * Signature: (Z)Ljava/lang/Boolean;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapBoolean
-(JNIEnv * env, jclass thisClass, jboolean val) {
- return PRIMLIB_WrapBoolean(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapByte
- * Signature: (B)Ljava/lang/Byte;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapByte
-(JNIEnv * env, jclass thisClass, jbyte val) {
- return PRIMLIB_WrapByte(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapShort
- * Signature: (S)Ljava/lang/Short;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapShort
-(JNIEnv * env, jclass thisClass, jshort val) {
- return PRIMLIB_WrapShort(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapChar
- * Signature: (C)Ljava/lang/Character;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapChar
-(JNIEnv * env, jclass thisClass, jchar val) {
- return PRIMLIB_WrapChar(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapInt
- * Signature: (I)Ljava/lang/Integer;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapInt
-(JNIEnv * env, jclass thisClass, jint val) {
- return PRIMLIB_WrapInt(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapLong
- * Signature: (J)Ljava/lang/Long;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapLong
-(JNIEnv * env, jclass thisClass, jlong val) {
- return PRIMLIB_WrapLong(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapFloat
- * Signature: (F)Ljava/lang/Float;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapFloat
-(JNIEnv * env, jclass thisClass, jfloat val) {
- return PRIMLIB_WrapFloat(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapDouble
- * Signature: (D)Ljava/lang/Double;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapDouble
-(JNIEnv * env, jclass thisClass, jdouble val) {
- return PRIMLIB_WrapDouble(env, val);
-}
diff --git a/libjava/classpath/test/native/lib/PrimlibInterface.h b/libjava/classpath/test/native/lib/PrimlibInterface.h
deleted file mode 100644
index 2e0463cc2b8..00000000000
--- a/libjava/classpath/test/native/lib/PrimlibInterface.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class PrimlibInterface */
-
-#ifndef _Included_PrimlibInterface
-#define _Included_PrimlibInterface
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: PrimlibInterface
- * Method: unwrapBoolean
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL Java_PrimlibInterface_unwrapBoolean
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapByte
- * Signature: (Ljava/lang/Object;)B
- */
-JNIEXPORT jbyte JNICALL Java_PrimlibInterface_unwrapByte
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapShort
- * Signature: (Ljava/lang/Object;)S
- */
-JNIEXPORT jshort JNICALL Java_PrimlibInterface_unwrapShort
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapChar
- * Signature: (Ljava/lang/Object;)C
- */
-JNIEXPORT jchar JNICALL Java_PrimlibInterface_unwrapChar
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapInt
- * Signature: (Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL Java_PrimlibInterface_unwrapInt
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapLong
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_PrimlibInterface_unwrapLong
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapFloat
- * Signature: (Ljava/lang/Object;)F
- */
-JNIEXPORT jfloat JNICALL Java_PrimlibInterface_unwrapFloat
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapDouble
- * Signature: (Ljava/lang/Object;)D
- */
-JNIEXPORT jdouble JNICALL Java_PrimlibInterface_unwrapDouble
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapBoolean
- * Signature: (Z)Ljava/lang/Boolean;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapBoolean
- (JNIEnv *, jclass, jboolean);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapByte
- * Signature: (B)Ljava/lang/Byte;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapByte
- (JNIEnv *, jclass, jbyte);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapShort
- * Signature: (S)Ljava/lang/Short;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapShort
- (JNIEnv *, jclass, jshort);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapChar
- * Signature: (C)Ljava/lang/Character;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapChar
- (JNIEnv *, jclass, jchar);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapInt
- * Signature: (I)Ljava/lang/Integer;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapInt
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapLong
- * Signature: (J)Ljava/lang/Long;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapLong
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapFloat
- * Signature: (F)Ljava/lang/Float;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapFloat
- (JNIEnv *, jclass, jfloat);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapDouble
- * Signature: (D)Ljava/lang/Double;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapDouble
- (JNIEnv *, jclass, jdouble);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libjava/classpath/test/native/lib/PrimlibTest.java b/libjava/classpath/test/native/lib/PrimlibTest.java
deleted file mode 100644
index 94b2fb41c3e..00000000000
--- a/libjava/classpath/test/native/lib/PrimlibTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-public class PrimlibTest {
- static {
- System.loadLibrary("jnilinktest");
- }
-
- public static void main(String args[]) {
- Object[] o = new Object[8];
- o[0] = new Boolean(true);
- o[1] = new Byte((byte)1);
- o[2] = new Short((short)2);
- o[3] = new Character((char)3);
- o[4] = new Integer(4);
- o[5] = new Long(5L);
- o[6] = new Float(6F);
- o[7] = new Double(7D);
-
- String[] s = {"boolean", "byte", "short", "char", "int", "long", "float", "double"};
- for(int i=0;i<8;i++) {
- try {
- System.out.println(PrimlibInterface.unwrapBoolean(o[i]) ? "CONVERTED: UnwrapBoolean(" + s[i] + ")" : "INCORRECT: UnwrapBoolean(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapBoolean(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapByte(o[i]) == i ? "CONVERTED: UnwrapByte(" + s[i] + ")" : "INCORRECT: UnwrapByte(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapByte(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapShort(o[i]) == i ? "CONVERTED: UnwrapShort(" + s[i] + ")" : "INCORRECT: UnwrapShort(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapShort(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapChar(o[i]) == i ? "CONVERTED: UnwrapChar(" + s[i] + ")" : "INCORRECT: UnwrapChar(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapChar(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapInt(o[i]) == i ? "CONVERTED: UnwrapInt(" + s[i] + ")" : "INCORRECT: UnwrapInt(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapInt(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapLong(o[i]) == i ? "CONVERTED: UnwrapLong(" + s[i] + ")" : "INCORRECT: UnwrapLong(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapLong(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapFloat(o[i]) == i ? "CONVERTED: UnwrapFloat(" + s[i] + ")" : "INCORRECT: UnwrapFloat(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapFloat(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapDouble(o[i]) == i ? "CONVERTED: UnwrapDouble(" + s[i] + ")" : "INCORRECT: UnwrapDouble(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapDouble(" + s[i] + ")");
- }
- }
- }
-}
-
-class PrimlibInterface {
- static native boolean unwrapBoolean(Object o);
- static native byte unwrapByte(Object o);
- static native short unwrapShort(Object o);
- static native char unwrapChar(Object o);
- static native int unwrapInt(Object o);
- static native long unwrapLong(Object o);
- static native float unwrapFloat(Object o);
- static native double unwrapDouble(Object o);
-
- static native Boolean wrapBoolean(boolean val);
- static native Byte wrapByte(byte val);
- static native Short wrapShort(short val);
- static native Character wrapChar(char val);
- static native Integer wrapInt(int val);
- static native Long wrapLong(long val);
- static native Float wrapFloat(float val);
- static native Double wrapDouble(double val);
-}
diff --git a/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java b/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java
index 28e4ce36443..e995c46341d 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java
@@ -88,9 +88,9 @@ public final class VMStackWalker
/**
* Get the class loader associated with the Class returned by
- * <code>getCallingClass()</code>, or <code>null</code> if no
- * such class exists or it is the boot loader. This method is an optimization
- * for the expression <code>getClassContext()[1].getClassLoader()</code>
+ * <code>getCallingClass()</code>, or <code>null</code> if no such class
+ * exists or it is the boot loader. This method is an optimization for the
+ * expression <code>VMStackWalker.getClassLoader(getClassContext()[1])</code>
* and should return the same result.
*
* <p>
@@ -102,7 +102,15 @@ public final class VMStackWalker
Class[] ctx = getClassContext();
if (ctx.length < 3)
return null;
- return ctx[2].getClassLoader();
+ return getClassLoader(ctx[2]);
}
+
+ /**
+ * Retrieve the class's ClassLoader, or <code>null</code> if loaded
+ * by the bootstrap loader. I.e., this should return the same thing
+ * as {@link java.lang.VMClass#getClassLoader}. This duplicate version
+ * is here to work around access permissions.
+ */
+ public static native ClassLoader getClassLoader(Class cl);
}
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
index 09173fcf036..23cbb7b8ee3 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
@@ -138,6 +138,7 @@ public class VMIdManager
{
id.setId (++_lastId);
}
+ id.setReference (obj);
return id;
}
catch (InstantiationException ie)
@@ -162,7 +163,7 @@ public class VMIdManager
{
id.setId (++_lastId);
}
-
+ id.setReference (obj);
return id;
}
diff --git a/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java b/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java
index 7cd97192e74..93a42b1ca9a 100644
--- a/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java
+++ b/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.io;
+import gnu.classpath.Configuration;
import gnu.classpath.VMStackWalker;
import java.lang.reflect.Constructor;
import java.security.AccessController;
@@ -46,8 +47,13 @@ import java.security.PrivilegedAction;
final class VMObjectInputStream
{
- private static Class oisClass = ObjectInputStream.class;
- private static Class vmoisClass = VMObjectInputStream.class;
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javaio");
+ }
+ }
// PrivilegedAction needed for Class.getClassLoader()
private static PrivilegedAction loaderAction = new PrivilegedAction()
diff --git a/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java b/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java
index 2aee7a9e6a7..77470fa807f 100644
--- a/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java
+++ b/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java
@@ -1,5 +1,5 @@
/* VMObjectStreamClass.java -- VM helper functions for ObjectStreamClass
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,19 @@ exception statement from your version. */
package java.io;
+import gnu.classpath.Configuration;
import java.lang.reflect.Field;
final class VMObjectStreamClass
{
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javaio");
+ }
+ }
+
/**
* Returns true if CLAZZ has a static class initializer
* (a.k.a. <clinit>).
diff --git a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
index 4fe12403622..a777462aa36 100644
--- a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
+++ b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package java.lang;
import gnu.classpath.SystemProperties;
+import gnu.classpath.Configuration;
import java.io.File;
import java.io.IOException;
@@ -63,6 +64,48 @@ import java.util.zip.ZipFile;
*/
final class VMClassLoader
{
+
+
+ /** packages loaded by the bootstrap class loader */
+ static final HashMap definedPackages = new HashMap();
+
+ /**
+ * Converts the array string of native package names to
+ * Packages. The packages are then put into the
+ * definedPackages hashMap
+ */
+ static
+ {
+ String[] packages = getBootPackages();
+
+ if( packages != null)
+ {
+ String specName =
+ SystemProperties.getProperty("java.specification.name");
+ String vendor =
+ SystemProperties.getProperty("java.specification.vendor");
+ String version =
+ SystemProperties.getProperty("java.specification.version");
+
+ Package p;
+
+ for(int i = 0; i < packages.length; i++)
+ {
+ p = new Package(packages[i],
+ specName,
+ vendor,
+ version,
+ "GNU Classpath",
+ "GNU",
+ Configuration.CLASSPATH_VERSION,
+ null);
+
+ definedPackages.put(packages[i], p);
+ }
+ }
+ }
+
+
/**
* Helper to define a class using a string of bytes. This assumes that
* the security checks have already been performed, if necessary.
@@ -119,6 +162,9 @@ final class VMClassLoader
return null;
}
+ /** jars from property java.boot.class.path */
+ static final HashMap bootjars = new HashMap();
+
/**
* Helper to get a list of resources from the bootstrap class loader.
*
@@ -139,8 +185,9 @@ final class VMClassLoader
{
try
{
- v.add(new URL("file://"
- + new File(file, name).getAbsolutePath()));
+ File f = new File(file, name);
+ if (!f.exists()) continue;
+ v.add(new URL("file://" + f.getAbsolutePath()));
}
catch (MalformedURLException e)
{
@@ -150,30 +197,28 @@ final class VMClassLoader
else if (file.isFile())
{
ZipFile zip;
- try
- {
- zip = new ZipFile(file);
- }
- catch (IOException e)
- {
- continue;
- }
- String zname = name.startsWith("/") ? name.substring(1) : name;
- try
- {
- if (zip.getEntry(zname) == null)
+ synchronized(bootjars)
+ {
+ zip = (ZipFile) bootjars.get(file.getName());
+ }
+ if(zip == null)
+ {
+ try
+ {
+ zip = new ZipFile(file);
+ synchronized(bootjars)
+ {
+ bootjars.put(file.getName(), zip);
+ }
+ }
+ catch (IOException e)
+ {
continue;
- }
- finally
- {
- try
- {
- zip.close();
- }
- catch (IOException e)
- {
- }
- }
+ }
+ }
+ String zname = name.startsWith("/") ? name.substring(1) : name;
+ if (zip.getEntry(zname) == null)
+ continue;
try
{
v.add(new URL("jar:file://"
@@ -188,29 +233,41 @@ final class VMClassLoader
return v.elements();
}
+
+ /**
+ * Returns a String[] of native package names. The default
+ * implementation returns an empty array, or you may decide
+ * this needs native help.
+ */
+ private static String[] getBootPackages()
+ {
+ return new String[0];
+ }
+
+
/**
- * Helper to get a package from the bootstrap class loader. The default
- * implementation of returning null may be adequate, or you may decide
- * that this needs some native help.
+ * Helper to get a package from the bootstrap class loader.
*
* @param name the name to find
* @return the named package, if it exists
*/
static Package getPackage(String name)
{
- return null;
+ return (Package)definedPackages.get(name);
}
+
+
/**
- * Helper to get all packages from the bootstrap class loader. The default
- * implementation of returning an empty array may be adequate, or you may
- * decide that this needs some native help.
+ * Helper to get all packages from the bootstrap class loader.
*
* @return all named packages, if any exist
*/
static Package[] getPackages()
{
- return new Package[0];
+ Package[] packages = new Package[definedPackages.size()];
+ definedPackages.values().toArray(packages);
+ return packages;
}
/**
diff --git a/libjava/classpath/vm/reference/java/lang/VMThread.java b/libjava/classpath/vm/reference/java/lang/VMThread.java
index 6b9102b7071..aa0b8347a73 100644
--- a/libjava/classpath/vm/reference/java/lang/VMThread.java
+++ b/libjava/classpath/vm/reference/java/lang/VMThread.java
@@ -376,15 +376,11 @@ final class VMThread
*/
static void sleep(long ms, int ns) throws InterruptedException
{
-
- // Round up
- ms += (ns != 0) ? 1 : 0;
-
// Note: JDK treats a zero length sleep is like Thread.yield(),
// without checking the interrupted status of the thread.
// It's unclear if this is a bug in the implementation or the spec.
// See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203
- if (ms == 0)
+ if (ms == 0 && ns == 0)
{
if (Thread.interrupted())
throw new InterruptedException();
@@ -404,11 +400,12 @@ final class VMThread
{
while (true)
{
- vt.wait(ms);
+ vt.wait(ms, ns);
now = System.currentTimeMillis();
if (now >= end)
break;
ms = end - now;
+ ns = 0;
}
}
}
diff --git a/libjava/classpath/vm/reference/java/security/VMAccessController.java b/libjava/classpath/vm/reference/java/security/VMAccessController.java
index 7058a5e345c..da13c688946 100644
--- a/libjava/classpath/vm/reference/java/security/VMAccessController.java
+++ b/libjava/classpath/vm/reference/java/security/VMAccessController.java
@@ -76,7 +76,7 @@ final class VMAccessController
DEFAULT_CONTEXT = new AccessControlContext(domain);
}
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = gnu.classpath.Configuration.DEBUG;
private static void debug(String msg)
{
System.err.print(">>> VMAccessController: ");
@@ -108,6 +108,8 @@ final class VMAccessController
LinkedList stack = (LinkedList) contexts.get();
if (stack == null)
{
+ if (DEBUG)
+ debug("no stack... creating ");
stack = new LinkedList();
contexts.set(stack);
}
@@ -134,6 +136,10 @@ final class VMAccessController
if (stack.isEmpty())
contexts.set(null);
}
+ else if (DEBUG)
+ {
+ debug("no stack during pop?????");
+ }
}
/**
@@ -166,7 +172,7 @@ final class VMAccessController
String[] methods = (String[]) stack[1];
if (DEBUG)
- debug(">>> got trace of length " + classes.length);
+ debug("got trace of length " + classes.length);
HashSet domains = new HashSet();
HashSet seenDomains = new HashSet();
@@ -185,8 +191,9 @@ final class VMAccessController
if (DEBUG)
{
- debug(">>> checking " + clazz + "." + method);
- debug(">>> loader = " + clazz.getClassLoader());
+ debug("checking " + clazz + "." + method);
+ // subject to getClassLoader RuntimePermission
+ debug("loader = " + clazz.getClassLoader());
}
// If the previous frame was a call to doPrivileged, then this is
@@ -198,14 +205,16 @@ final class VMAccessController
&& method.equals ("doPrivileged"))
{
// If there was a call to doPrivileged with a supplied context,
- // return that context.
+ // return that context. If using JAAS doAs*, it should be
+ // a context with a SubjectDomainCombiner
LinkedList l = (LinkedList) contexts.get();
if (l != null)
context = (AccessControlContext) l.getFirst();
privileged = 1;
}
- ProtectionDomain domain = clazz.getProtectionDomain();
+ // subject to getProtectionDomain RuntimePermission
+ ProtectionDomain domain = clazz.getProtectionDomain();
if (domain == null)
continue;
@@ -225,14 +234,25 @@ final class VMAccessController
ProtectionDomain[] result = (ProtectionDomain[])
domains.toArray(new ProtectionDomain[domains.size()]);
- // Intersect the derived protection domain with the context supplied
- // to doPrivileged.
if (context != null)
- context = new AccessControlContext(result, context,
- IntersectingDomainCombiner.SINGLETON);
+ {
+ DomainCombiner dc = context.getDomainCombiner ();
+ // If the supplied context had no explicit DomainCombiner, use
+ // our private version, which computes the intersection of the
+ // context's domains with the derived set.
+ if (dc == null)
+ context = new AccessControlContext
+ (IntersectingDomainCombiner.SINGLETON.combine
+ (result, context.getProtectionDomains ()));
+ // Use the supplied DomainCombiner. This should be secure,
+ // because only trusted code may create an
+ // AccessControlContext with a custom DomainCombiner.
+ else
+ context = new AccessControlContext (result, context, dc);
+ }
// No context was supplied. Return the derived one.
else
- context = new AccessControlContext(result);
+ context = new AccessControlContext (result);
inGetContext.set(Boolean.FALSE);
return context;
diff --git a/libjava/classpath/vm/reference/standard.omit b/libjava/classpath/vm/reference/standard.omit
deleted file mode 100644
index c0499fe053f..00000000000
--- a/libjava/classpath/vm/reference/standard.omit
+++ /dev/null
@@ -1 +0,0 @@
-gnu/classpath/jdwp
diff --git a/libjava/scripts/makemake.tcl b/libjava/scripts/makemake.tcl
index a5c075a62a7..b09888fdf7f 100755
--- a/libjava/scripts/makemake.tcl
+++ b/libjava/scripts/makemake.tcl
@@ -166,7 +166,7 @@ proc scan_directory {basedir subdir} {
set files {}
set here [pwd]
cd $basedir/$subdir
- foreach file [lsort [glob *]] {
+ foreach file [lsort [glob -nocomplain *]] {
if {[string match *.java $file]} {
lappend files $subdir/$file
} elseif {[file isdirectory $file]} {
diff --git a/libjava/sources.am b/libjava/sources.am
index fec918a906d..a4600e0ea5d 100644
--- a/libjava/sources.am
+++ b/libjava/sources.am
@@ -66,6 +66,7 @@ gnu/awt/xlib.list: $(gnu_awt_xlib_source_files)
gnu_classpath_source_files = \
+classpath/gnu/classpath/ByteArray.java \
classpath/gnu/classpath/Configuration.java \
classpath/gnu/classpath/Pointer.java \
classpath/gnu/classpath/Pointer32.java \
@@ -105,6 +106,212 @@ gnu/classpath/debug.list: $(gnu_classpath_debug_source_files)
-include gnu/classpath/debug.deps
+gnu_classpath_jdwp_source_files = \
+classpath/gnu/classpath/jdwp/Jdwp.java \
+classpath/gnu/classpath/jdwp/JdwpConstants.java \
+gnu/classpath/jdwp/VMFrame.java \
+gnu/classpath/jdwp/VMIdManager.java \
+gnu/classpath/jdwp/VMVirtualMachine.java
+
+gnu_classpath_jdwp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_source_files)))
+
+gnu/classpath/jdwp.list: $(gnu_classpath_jdwp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp.list
+
+-include gnu/classpath/jdwp.deps
+
+
+gnu_classpath_jdwp_event_source_files = \
+classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java \
+classpath/gnu/classpath/jdwp/event/Event.java \
+classpath/gnu/classpath/jdwp/event/EventManager.java \
+classpath/gnu/classpath/jdwp/event/EventRequest.java \
+classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java \
+classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java \
+classpath/gnu/classpath/jdwp/event/VmDeathEvent.java \
+classpath/gnu/classpath/jdwp/event/VmInitEvent.java
+
+gnu_classpath_jdwp_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_source_files)))
+
+gnu/classpath/jdwp/event.list: $(gnu_classpath_jdwp_event_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event.list
+
+-include gnu/classpath/jdwp/event.deps
+
+
+gnu_classpath_jdwp_event_filters_source_files = \
+classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/CountFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/StepFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+
+gnu_classpath_jdwp_event_filters_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_filters_source_files)))
+
+gnu/classpath/jdwp/event/filters.list: $(gnu_classpath_jdwp_event_filters_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_filters_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event/filters.list
+
+-include gnu/classpath/jdwp/event/filters.deps
+
+
+gnu_classpath_jdwp_exception_source_files = \
+classpath/gnu/classpath/jdwp/exception/InvalidClassException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidEventTypeException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidFieldException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidLocationException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidMethodException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidObjectException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidStringException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpIllegalArgumentException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java \
+classpath/gnu/classpath/jdwp/exception/NotImplementedException.java \
+classpath/gnu/classpath/jdwp/exception/VmDeadException.java
+
+gnu_classpath_jdwp_exception_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_exception_source_files)))
+
+gnu/classpath/jdwp/exception.list: $(gnu_classpath_jdwp_exception_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_exception_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/exception.list
+
+-include gnu/classpath/jdwp/exception.deps
+
+
+gnu_classpath_jdwp_id_source_files = \
+classpath/gnu/classpath/jdwp/id/ArrayId.java \
+classpath/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/ClassLoaderId.java \
+classpath/gnu/classpath/jdwp/id/ClassObjectId.java \
+classpath/gnu/classpath/jdwp/id/ClassReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/JdwpId.java \
+classpath/gnu/classpath/jdwp/id/ObjectId.java \
+classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/StringId.java \
+classpath/gnu/classpath/jdwp/id/ThreadGroupId.java \
+classpath/gnu/classpath/jdwp/id/ThreadId.java
+
+gnu_classpath_jdwp_id_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_id_source_files)))
+
+gnu/classpath/jdwp/id.list: $(gnu_classpath_jdwp_id_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_id_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/id.list
+
+-include gnu/classpath/jdwp/id.deps
+
+
+gnu_classpath_jdwp_processor_source_files = \
+classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/CommandSet.java \
+classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/PacketProcessor.java \
+classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+
+gnu_classpath_jdwp_processor_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_processor_source_files)))
+
+gnu/classpath/jdwp/processor.list: $(gnu_classpath_jdwp_processor_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_processor_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/processor.list
+
+-include gnu/classpath/jdwp/processor.deps
+
+
+gnu_classpath_jdwp_transport_source_files = \
+classpath/gnu/classpath/jdwp/transport/ITransport.java \
+classpath/gnu/classpath/jdwp/transport/JdwpCommandPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpConnection.java \
+classpath/gnu/classpath/jdwp/transport/JdwpPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpReplyPacket.java \
+classpath/gnu/classpath/jdwp/transport/SocketTransport.java \
+classpath/gnu/classpath/jdwp/transport/TransportException.java \
+classpath/gnu/classpath/jdwp/transport/TransportFactory.java
+
+gnu_classpath_jdwp_transport_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_transport_source_files)))
+
+gnu/classpath/jdwp/transport.list: $(gnu_classpath_jdwp_transport_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_transport_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/transport.list
+
+-include gnu/classpath/jdwp/transport.deps
+
+
+gnu_classpath_jdwp_util_source_files = \
+classpath/gnu/classpath/jdwp/util/JdwpString.java \
+classpath/gnu/classpath/jdwp/util/LineTable.java \
+classpath/gnu/classpath/jdwp/util/Location.java \
+classpath/gnu/classpath/jdwp/util/MethodResult.java \
+classpath/gnu/classpath/jdwp/util/Signature.java \
+classpath/gnu/classpath/jdwp/util/Value.java \
+classpath/gnu/classpath/jdwp/util/VariableTable.java
+
+gnu_classpath_jdwp_util_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_util_source_files)))
+
+gnu/classpath/jdwp/util.list: $(gnu_classpath_jdwp_util_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_util_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/util.list
+
+-include gnu/classpath/jdwp/util.deps
+
+
gnu_gcj_source_files = \
gnu/gcj/Core.java \
gnu/gcj/RawData.java \
@@ -267,7 +474,6 @@ classpath/gnu/java/awt/ClasspathToolkit.java \
classpath/gnu/java/awt/ComponentDataBlitOp.java \
classpath/gnu/java/awt/EmbeddedWindow.java \
classpath/gnu/java/awt/EventModifier.java \
-classpath/gnu/java/awt/FocusManager.java \
classpath/gnu/java/awt/GradientPaintContext.java
gnu_java_awt_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_source_files)))
@@ -819,7 +1025,6 @@ gnu/java/net/protocol/ftp.list: $(gnu_java_net_protocol_ftp_source_files)
gnu_java_net_protocol_http_source_files = \
classpath/gnu/java/net/protocol/http/Authenticator.java \
classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java \
-classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ChunkedInputStream.java \
classpath/gnu/java/net/protocol/http/Cookie.java \
classpath/gnu/java/net/protocol/http/CookieManager.java \
@@ -829,10 +1034,10 @@ classpath/gnu/java/net/protocol/http/HTTPDateFormat.java \
classpath/gnu/java/net/protocol/http/HTTPURLConnection.java \
classpath/gnu/java/net/protocol/http/Handler.java \
classpath/gnu/java/net/protocol/http/Headers.java \
+classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java \
classpath/gnu/java/net/protocol/http/Request.java \
classpath/gnu/java/net/protocol/http/RequestBodyWriter.java \
classpath/gnu/java/net/protocol/http/Response.java \
-classpath/gnu/java/net/protocol/http/ResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java \
classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
@@ -849,25 +1054,6 @@ gnu/java/net/protocol/http.list: $(gnu_java_net_protocol_http_source_files)
-include gnu/java/net/protocol/http.deps
-gnu_java_net_protocol_http_event_source_files = \
-classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java \
-classpath/gnu/java/net/protocol/http/event/ConnectionListener.java \
-classpath/gnu/java/net/protocol/http/event/RequestEvent.java \
-classpath/gnu/java/net/protocol/http/event/RequestListener.java
-
-gnu_java_net_protocol_http_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_http_event_source_files)))
-
-gnu/java/net/protocol/http/event.list: $(gnu_java_net_protocol_http_event_source_files)
- @$(mkinstalldirs) $(dir $@)
- @for file in $(gnu_java_net_protocol_http_event_source_files); do \
- if test -f $(srcdir)/$$file; then \
- echo $(srcdir)/$$file; \
- else echo $$file; fi; \
- done > gnu/java/net/protocol/http/event.list
-
--include gnu/java/net/protocol/http/event.deps
-
-
gnu_java_net_protocol_https_source_files = \
classpath/gnu/java/net/protocol/https/Handler.java
@@ -1094,6 +1280,7 @@ gnu/java/rmi/registry.list: $(gnu_java_rmi_registry_source_files)
gnu_java_rmi_server_source_files = \
classpath/gnu/java/rmi/server/ConnectionRunnerPool.java \
classpath/gnu/java/rmi/server/ProtocolConstants.java \
+classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java \
classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java \
classpath/gnu/java/rmi/server/RMIHashes.java \
classpath/gnu/java/rmi/server/RMIIncomingThread.java \
@@ -1222,6 +1409,8 @@ classpath/gnu/java/security/provider/DSAParameterGenerator.java \
classpath/gnu/java/security/provider/DSAParameters.java \
classpath/gnu/java/security/provider/DSASignature.java \
classpath/gnu/java/security/provider/DefaultPolicy.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java \
classpath/gnu/java/security/provider/EncodedKeyFactory.java \
classpath/gnu/java/security/provider/Gnu.java \
classpath/gnu/java/security/provider/GnuDHPublicKey.java \
@@ -1386,6 +1575,67 @@ gnu/java/util/prefs.list: $(gnu_java_util_prefs_source_files)
-include gnu/java/util/prefs.deps
+gnu_javax_crypto_source_files = \
+classpath/gnu/javax/crypto/DiffieHellmanImpl.java \
+classpath/gnu/javax/crypto/GnuDHPrivateKey.java \
+classpath/gnu/javax/crypto/RSACipherImpl.java
+
+gnu_javax_crypto_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_crypto_source_files)))
+
+gnu/javax/crypto.list: $(gnu_javax_crypto_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_crypto_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/crypto.list
+
+-include gnu/javax/crypto.deps
+
+
+gnu_javax_imageio_bmp_source_files = \
+classpath/gnu/javax/imageio/bmp/BMPDecoder.java \
+classpath/gnu/javax/imageio/bmp/BMPException.java \
+classpath/gnu/javax/imageio/bmp/BMPFileHeader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java \
+classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF16.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF32.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB1.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB24.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB8.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
+
+gnu_javax_imageio_bmp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_imageio_bmp_source_files)))
+
+gnu/javax/imageio/bmp.list: $(gnu_javax_imageio_bmp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_imageio_bmp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/imageio/bmp.list
+
+-include gnu/javax/imageio/bmp.deps
+
+
+gnu_javax_sound_midi_source_files = \
+classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java \
+classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+
+gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files)
+ @find classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list
+ $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list
+ @rm -f gnu-javax-sound-midi.list
+
gnu_javax_swing_text_html_parser_source_files = \
classpath/gnu/javax/swing/text/html/parser/HTML_401F.java \
classpath/gnu/javax/swing/text/html/parser/gnuDTD.java \
@@ -1670,6 +1920,33 @@ classpath/gnu/xml/pipeline/ValidationConsumer.java \
classpath/gnu/xml/pipeline/WellFormednessFilter.java \
classpath/gnu/xml/pipeline/XIncludeFilter.java \
classpath/gnu/xml/pipeline/XsltFilter.java \
+classpath/gnu/xml/stream/AttributeImpl.java \
+classpath/gnu/xml/stream/CharactersImpl.java \
+classpath/gnu/xml/stream/CommentImpl.java \
+classpath/gnu/xml/stream/DTDImpl.java \
+classpath/gnu/xml/stream/EndDocumentImpl.java \
+classpath/gnu/xml/stream/EndElementImpl.java \
+classpath/gnu/xml/stream/EndEntityImpl.java \
+classpath/gnu/xml/stream/EntityDeclarationImpl.java \
+classpath/gnu/xml/stream/EntityReferenceImpl.java \
+classpath/gnu/xml/stream/FilteredEventReader.java \
+classpath/gnu/xml/stream/FilteredStreamReader.java \
+classpath/gnu/xml/stream/LocationImpl.java \
+classpath/gnu/xml/stream/NamespaceImpl.java \
+classpath/gnu/xml/stream/NotationDeclarationImpl.java \
+classpath/gnu/xml/stream/ProcessingInstructionImpl.java \
+classpath/gnu/xml/stream/StartDocumentImpl.java \
+classpath/gnu/xml/stream/StartElementImpl.java \
+classpath/gnu/xml/stream/StartEntityImpl.java \
+classpath/gnu/xml/stream/XMLEventAllocatorImpl.java \
+classpath/gnu/xml/stream/XMLEventFactoryImpl.java \
+classpath/gnu/xml/stream/XMLEventImpl.java \
+classpath/gnu/xml/stream/XMLEventReaderImpl.java \
+classpath/gnu/xml/stream/XMLEventWriterImpl.java \
+classpath/gnu/xml/stream/XMLInputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLOutputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLStreamReaderImpl.java \
+classpath/gnu/xml/stream/XMLStreamWriterImpl.java \
classpath/gnu/xml/transform/AbstractNumberNode.java \
classpath/gnu/xml/transform/ApplyImportsNode.java \
classpath/gnu/xml/transform/ApplyTemplatesNode.java \
@@ -2538,6 +2815,7 @@ classpath/java/lang/Comparable.java \
classpath/java/lang/Compiler.java \
java/lang/ConcreteProcess.java \
java/lang/Double.java \
+classpath/java/lang/EnumConstantNotPresentException.java \
classpath/java/lang/Error.java \
classpath/java/lang/Exception.java \
classpath/java/lang/ExceptionInInitializerError.java \
@@ -2967,6 +3245,7 @@ classpath/java/rmi/activation/ActivationException.java \
classpath/java/rmi/activation/ActivationGroup.java \
classpath/java/rmi/activation/ActivationGroupDesc.java \
classpath/java/rmi/activation/ActivationGroupID.java \
+classpath/java/rmi/activation/ActivationGroup_Stub.java \
classpath/java/rmi/activation/ActivationID.java \
classpath/java/rmi/activation/ActivationInstantiator.java \
classpath/java/rmi/activation/ActivationMonitor.java \
@@ -3393,6 +3672,7 @@ classpath/java/util/HashMap.java \
classpath/java/util/HashSet.java \
classpath/java/util/Hashtable.java \
classpath/java/util/IdentityHashMap.java \
+classpath/java/util/InvalidPropertiesFormatException.java \
classpath/java/util/Iterator.java \
classpath/java/util/LinkedHashMap.java \
classpath/java/util/LinkedHashSet.java \
@@ -3711,15 +3991,12 @@ classpath/javax/imageio/event/IIOReadUpdateListener.java \
classpath/javax/imageio/event/IIOReadWarningListener.java \
classpath/javax/imageio/event/IIOWriteProgressListener.java \
classpath/javax/imageio/event/IIOWriteWarningListener.java \
-classpath/javax/imageio/metadata/IIOAttr.java \
classpath/javax/imageio/metadata/IIOInvalidTreeException.java \
classpath/javax/imageio/metadata/IIOMetadata.java \
classpath/javax/imageio/metadata/IIOMetadataController.java \
classpath/javax/imageio/metadata/IIOMetadataFormat.java \
classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java \
classpath/javax/imageio/metadata/IIOMetadataNode.java \
-classpath/javax/imageio/metadata/IIONamedNodeMap.java \
-classpath/javax/imageio/metadata/IIONodeList.java \
classpath/javax/imageio/spi/IIORegistry.java \
classpath/javax/imageio/spi/IIOServiceProvider.java \
classpath/javax/imageio/spi/ImageInputStreamSpi.java \
@@ -4303,6 +4580,120 @@ javax/security/sasl.list: $(javax_security_sasl_source_files)
-include javax/security/sasl.deps
+javax_sound_midi_source_files = \
+classpath/javax/sound/midi/ControllerEventListener.java \
+classpath/javax/sound/midi/Instrument.java \
+classpath/javax/sound/midi/InvalidMidiDataException.java \
+classpath/javax/sound/midi/MetaEventListener.java \
+classpath/javax/sound/midi/MetaMessage.java \
+classpath/javax/sound/midi/MidiChannel.java \
+classpath/javax/sound/midi/MidiDevice.java \
+classpath/javax/sound/midi/MidiEvent.java \
+classpath/javax/sound/midi/MidiFileFormat.java \
+classpath/javax/sound/midi/MidiMessage.java \
+classpath/javax/sound/midi/MidiSystem.java \
+classpath/javax/sound/midi/MidiUnavailableException.java \
+classpath/javax/sound/midi/Patch.java \
+classpath/javax/sound/midi/Receiver.java \
+classpath/javax/sound/midi/Sequence.java \
+classpath/javax/sound/midi/Sequencer.java \
+classpath/javax/sound/midi/ShortMessage.java \
+classpath/javax/sound/midi/Soundbank.java \
+classpath/javax/sound/midi/SoundbankResource.java \
+classpath/javax/sound/midi/Synthesizer.java \
+classpath/javax/sound/midi/SysexMessage.java \
+classpath/javax/sound/midi/Track.java \
+classpath/javax/sound/midi/Transmitter.java \
+classpath/javax/sound/midi/VoiceStatus.java
+
+javax_sound_midi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_source_files)))
+
+javax/sound/midi.list: $(javax_sound_midi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi.list
+
+-include javax/sound/midi.deps
+
+
+javax_sound_midi_spi_source_files = \
+classpath/javax/sound/midi/spi/MidiDeviceProvider.java \
+classpath/javax/sound/midi/spi/MidiFileReader.java \
+classpath/javax/sound/midi/spi/MidiFileWriter.java \
+classpath/javax/sound/midi/spi/SoundbankReader.java
+
+javax_sound_midi_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_spi_source_files)))
+
+javax/sound/midi/spi.list: $(javax_sound_midi_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi/spi.list
+
+-include javax/sound/midi/spi.deps
+
+
+javax_sound_sampled_source_files = \
+classpath/javax/sound/sampled/AudioFileFormat.java \
+classpath/javax/sound/sampled/AudioFormat.java \
+classpath/javax/sound/sampled/AudioInputStream.java \
+classpath/javax/sound/sampled/AudioPermission.java \
+classpath/javax/sound/sampled/AudioSystem.java \
+classpath/javax/sound/sampled/BooleanControl.java \
+classpath/javax/sound/sampled/Clip.java \
+classpath/javax/sound/sampled/CompoundControl.java \
+classpath/javax/sound/sampled/Control.java \
+classpath/javax/sound/sampled/DataLine.java \
+classpath/javax/sound/sampled/EnumControl.java \
+classpath/javax/sound/sampled/FloatControl.java \
+classpath/javax/sound/sampled/Line.java \
+classpath/javax/sound/sampled/LineEvent.java \
+classpath/javax/sound/sampled/LineListener.java \
+classpath/javax/sound/sampled/LineUnavailableException.java \
+classpath/javax/sound/sampled/Mixer.java \
+classpath/javax/sound/sampled/Port.java \
+classpath/javax/sound/sampled/ReverbType.java \
+classpath/javax/sound/sampled/SourceDataLine.java \
+classpath/javax/sound/sampled/TargetDataLine.java \
+classpath/javax/sound/sampled/UnsupportedAudioFileException.java
+
+javax_sound_sampled_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_source_files)))
+
+javax/sound/sampled.list: $(javax_sound_sampled_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled.list
+
+-include javax/sound/sampled.deps
+
+
+javax_sound_sampled_spi_source_files = \
+classpath/javax/sound/sampled/spi/AudioFileReader.java \
+classpath/javax/sound/sampled/spi/AudioFileWriter.java \
+classpath/javax/sound/sampled/spi/FormatConversionProvider.java \
+classpath/javax/sound/sampled/spi/MixerProvider.java
+
+javax_sound_sampled_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_spi_source_files)))
+
+javax/sound/sampled/spi.list: $(javax_sound_sampled_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled/spi.list
+
+-include javax/sound/sampled/spi.deps
+
+
javax_sql_source_files = \
classpath/javax/sql/ConnectionEvent.java \
classpath/javax/sql/ConnectionEventListener.java \
@@ -4416,6 +4807,7 @@ classpath/javax/swing/JTree.java \
classpath/javax/swing/JViewport.java \
classpath/javax/swing/JWindow.java \
classpath/javax/swing/KeyStroke.java \
+classpath/javax/swing/KeyboardManager.java \
classpath/javax/swing/LayoutFocusTraversalPolicy.java \
classpath/javax/swing/ListCellRenderer.java \
classpath/javax/swing/ListModel.java \
@@ -4726,12 +5118,16 @@ javax/swing/plaf/basic.list: $(javax_swing_plaf_basic_source_files)
javax_swing_plaf_metal_source_files = \
classpath/javax/swing/plaf/metal/DefaultMetalTheme.java \
classpath/javax/swing/plaf/metal/MetalBorders.java \
+classpath/javax/swing/plaf/metal/MetalButtonListener.java \
classpath/javax/swing/plaf/metal/MetalButtonUI.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxButton.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java \
classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalComboBoxUI.java \
classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java \
+classpath/javax/swing/plaf/metal/MetalFileChooserUI.java \
classpath/javax/swing/plaf/metal/MetalIconFactory.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java \
@@ -4742,6 +5138,7 @@ classpath/javax/swing/plaf/metal/MetalProgressBarUI.java \
classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java \
classpath/javax/swing/plaf/metal/MetalRootPaneUI.java \
classpath/javax/swing/plaf/metal/MetalScrollBarUI.java \
+classpath/javax/swing/plaf/metal/MetalScrollButton.java \
classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java \
classpath/javax/swing/plaf/metal/MetalSeparatorUI.java \
classpath/javax/swing/plaf/metal/MetalSliderUI.java \
@@ -4754,7 +5151,8 @@ classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java \
classpath/javax/swing/plaf/metal/MetalToolBarUI.java \
classpath/javax/swing/plaf/metal/MetalToolTipUI.java \
classpath/javax/swing/plaf/metal/MetalTreeUI.java \
-classpath/javax/swing/plaf/metal/MetalUtils.java
+classpath/javax/swing/plaf/metal/MetalUtils.java \
+classpath/javax/swing/plaf/metal/OceanTheme.java
javax_swing_plaf_metal_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_plaf_metal_source_files)))
@@ -4856,6 +5254,7 @@ classpath/javax/swing/text/DefaultEditorKit.java \
classpath/javax/swing/text/DefaultFormatter.java \
classpath/javax/swing/text/DefaultHighlighter.java \
classpath/javax/swing/text/DefaultStyledDocument.java \
+classpath/javax/swing/text/DefaultTextUI.java \
classpath/javax/swing/text/Document.java \
classpath/javax/swing/text/DocumentFilter.java \
classpath/javax/swing/text/EditorKit.java \
@@ -4895,7 +5294,8 @@ classpath/javax/swing/text/TabableView.java \
classpath/javax/swing/text/TextAction.java \
classpath/javax/swing/text/Utilities.java \
classpath/javax/swing/text/View.java \
-classpath/javax/swing/text/ViewFactory.java
+classpath/javax/swing/text/ViewFactory.java \
+classpath/javax/swing/text/WrappedPlainView.java
javax_swing_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_text_source_files)))
@@ -4911,6 +5311,7 @@ javax/swing/text.list: $(javax_swing_text_source_files)
javax_swing_text_html_source_files = \
+classpath/javax/swing/text/html/CSS.java \
classpath/javax/swing/text/html/HTML.java \
classpath/javax/swing/text/html/HTMLDocument.java \
classpath/javax/swing/text/html/HTMLEditorKit.java \
@@ -5094,6 +5495,43 @@ classpath/javax/xml/parsers/FactoryConfigurationError.java \
classpath/javax/xml/parsers/ParserConfigurationException.java \
classpath/javax/xml/parsers/SAXParser.java \
classpath/javax/xml/parsers/SAXParserFactory.java \
+classpath/javax/xml/stream/EventFilter.java \
+classpath/javax/xml/stream/FactoryConfigurationError.java \
+classpath/javax/xml/stream/Location.java \
+classpath/javax/xml/stream/StreamFilter.java \
+classpath/javax/xml/stream/XMLEventFactory.java \
+classpath/javax/xml/stream/XMLEventReader.java \
+classpath/javax/xml/stream/XMLEventWriter.java \
+classpath/javax/xml/stream/XMLFilter.java \
+classpath/javax/xml/stream/XMLInputFactory.java \
+classpath/javax/xml/stream/XMLIterator.java \
+classpath/javax/xml/stream/XMLOutputFactory.java \
+classpath/javax/xml/stream/XMLReporter.java \
+classpath/javax/xml/stream/XMLResolver.java \
+classpath/javax/xml/stream/XMLStreamConstants.java \
+classpath/javax/xml/stream/XMLStreamException.java \
+classpath/javax/xml/stream/XMLStreamReader.java \
+classpath/javax/xml/stream/XMLStreamWriter.java \
+classpath/javax/xml/stream/events/Attribute.java \
+classpath/javax/xml/stream/events/Characters.java \
+classpath/javax/xml/stream/events/Comment.java \
+classpath/javax/xml/stream/events/DTD.java \
+classpath/javax/xml/stream/events/EndDocument.java \
+classpath/javax/xml/stream/events/EndElement.java \
+classpath/javax/xml/stream/events/EndEntity.java \
+classpath/javax/xml/stream/events/EntityDeclaration.java \
+classpath/javax/xml/stream/events/EntityReference.java \
+classpath/javax/xml/stream/events/Namespace.java \
+classpath/javax/xml/stream/events/NotationDeclaration.java \
+classpath/javax/xml/stream/events/ProcessingInstruction.java \
+classpath/javax/xml/stream/events/StartDocument.java \
+classpath/javax/xml/stream/events/StartElement.java \
+classpath/javax/xml/stream/events/StartEntity.java \
+classpath/javax/xml/stream/events/XMLEvent.java \
+classpath/javax/xml/stream/util/EventReaderDelegate.java \
+classpath/javax/xml/stream/util/ReaderDelegate.java \
+classpath/javax/xml/stream/util/XMLEventAllocator.java \
+classpath/javax/xml/stream/util/XMLEventConsumer.java \
classpath/javax/xml/transform/ErrorListener.java \
classpath/javax/xml/transform/OutputKeys.java \
classpath/javax/xml/transform/Result.java \
@@ -5363,6 +5801,14 @@ all_packages_source_files = \
gnu/awt/j2d.list \
gnu/classpath.list \
gnu/classpath/debug.list \
+ gnu/classpath/jdwp.list \
+ gnu/classpath/jdwp/event.list \
+ gnu/classpath/jdwp/event/filters.list \
+ gnu/classpath/jdwp/exception.list \
+ gnu/classpath/jdwp/id.list \
+ gnu/classpath/jdwp/processor.list \
+ gnu/classpath/jdwp/transport.list \
+ gnu/classpath/jdwp/util.list \
gnu/gcj.list \
gnu/gcj/convert.list \
gnu/gcj/io.list \
@@ -5381,7 +5827,6 @@ all_packages_source_files = \
gnu/java/net/protocol/file.list \
gnu/java/net/protocol/ftp.list \
gnu/java/net/protocol/http.list \
- gnu/java/net/protocol/http/event.list \
gnu/java/net/protocol/https.list \
gnu/java/net/protocol/jar.list \
gnu/java/nio.list \
@@ -5403,6 +5848,8 @@ all_packages_source_files = \
gnu/java/text.list \
gnu/java/util.list \
gnu/java/util/prefs.list \
+ gnu/javax/crypto.list \
+ gnu/javax/imageio/bmp.list \
gnu/javax/swing/text/html/parser.list \
gnu/javax/swing/text/html/parser/models.list \
gnu/javax/swing/text/html/parser/support.list \
@@ -5477,6 +5924,10 @@ all_packages_source_files = \
javax/security/auth/x500.list \
javax/security/cert.list \
javax/security/sasl.list \
+ javax/sound/midi.list \
+ javax/sound/midi/spi.list \
+ javax/sound/sampled.list \
+ javax/sound/sampled/spi.list \
javax/sql.list \
javax/swing.list \
javax/swing/border.list \
@@ -5503,6 +5954,14 @@ ordinary_header_files = \
$(gnu_awt_j2d_header_files) \
$(gnu_classpath_header_files) \
$(gnu_classpath_debug_header_files) \
+ $(gnu_classpath_jdwp_header_files) \
+ $(gnu_classpath_jdwp_event_header_files) \
+ $(gnu_classpath_jdwp_event_filters_header_files) \
+ $(gnu_classpath_jdwp_exception_header_files) \
+ $(gnu_classpath_jdwp_id_header_files) \
+ $(gnu_classpath_jdwp_processor_header_files) \
+ $(gnu_classpath_jdwp_transport_header_files) \
+ $(gnu_classpath_jdwp_util_header_files) \
$(gnu_gcj_header_files) \
$(gnu_gcj_convert_header_files) \
$(gnu_gcj_io_header_files) \
@@ -5521,7 +5980,6 @@ ordinary_header_files = \
$(gnu_java_net_protocol_file_header_files) \
$(gnu_java_net_protocol_ftp_header_files) \
$(gnu_java_net_protocol_http_header_files) \
- $(gnu_java_net_protocol_http_event_header_files) \
$(gnu_java_net_protocol_https_header_files) \
$(gnu_java_net_protocol_jar_header_files) \
$(gnu_java_nio_header_files) \
@@ -5543,6 +6001,8 @@ ordinary_header_files = \
$(gnu_java_text_header_files) \
$(gnu_java_util_header_files) \
$(gnu_java_util_prefs_header_files) \
+ $(gnu_javax_crypto_header_files) \
+ $(gnu_javax_imageio_bmp_header_files) \
$(gnu_javax_swing_text_html_parser_header_files) \
$(gnu_javax_swing_text_html_parser_models_header_files) \
$(gnu_javax_swing_text_html_parser_support_header_files) \
@@ -5617,6 +6077,10 @@ ordinary_header_files = \
$(javax_security_auth_x500_header_files) \
$(javax_security_cert_header_files) \
$(javax_security_sasl_header_files) \
+ $(javax_sound_midi_header_files) \
+ $(javax_sound_midi_spi_header_files) \
+ $(javax_sound_sampled_header_files) \
+ $(javax_sound_sampled_spi_header_files) \
$(javax_sql_header_files) \
$(javax_swing_header_files) \
$(javax_swing_border_header_files) \
@@ -5640,6 +6104,7 @@ ordinary_header_files = \
bc_objects = \
gnu-java-beans.lo \
+ gnu-javax-sound-midi.lo \
gnu-xml.lo \
javax-imageio.lo \
javax-xml.lo \