From 10d82f29a4d08acfa68e8988c07369f53a67e32f Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Thu, 19 Jun 2014 15:35:23 -0700 Subject: [PATCH 001/166] 8047724: @since tag cleanup in jaxws Reviewed-by: alanb, mkos --- .../javax/activation/CommandMap.java | 10 ++--- .../javax/activation/MailcapCommandMap.java | 4 +- .../internal/bind/DatatypeConverterImpl.java | 2 +- .../sun/xml/internal/bind/api/Messages.java | 2 +- .../internal/bind/marshaller/Messages.java | 2 +- .../internal/bind/marshaller/XMLWriter.java | 2 +- .../bind/unmarshaller/DOMScanner.java | 2 +- .../internal/bind/unmarshaller/Messages.java | 2 +- .../internal/bind/util/AttributesImpl.java | 2 +- .../xml/internal/txw2/output/XMLWriter.java | 2 +- .../javax/annotation/Generated.java | 2 +- .../javax/annotation/PostConstruct.java | 3 +- .../javax/annotation/PreDestroy.java | 2 +- .../javax/annotation/Resource.java | 4 +- .../javax/annotation/Resources.java | 2 +- .../jaxws_classes/javax/jws/HandlerChain.java | 3 ++ .../share/jaxws_classes/javax/jws/Oneway.java | 3 ++ .../jaxws_classes/javax/jws/WebMethod.java | 3 ++ .../jaxws_classes/javax/jws/WebParam.java | 3 ++ .../jaxws_classes/javax/jws/WebResult.java | 3 ++ .../jaxws_classes/javax/jws/WebService.java | 3 ++ .../javax/jws/soap/InitParam.java | 3 +- .../javax/jws/soap/SOAPBinding.java | 3 ++ .../javax/jws/soap/SOAPMessageHandler.java | 3 +- .../javax/jws/soap/SOAPMessageHandlers.java | 3 +- .../jaxws_classes/javax/xml/bind/Binder.java | 4 +- .../javax/xml/bind/DataBindingException.java | 2 +- .../javax/xml/bind/DatatypeConverter.java | 2 +- .../javax/xml/bind/DatatypeConverterImpl.java | 2 +- .../xml/bind/DatatypeConverterInterface.java | 2 +- .../jaxws_classes/javax/xml/bind/Element.java | 2 +- .../jaxws_classes/javax/xml/bind/JAXB.java | 2 +- .../javax/xml/bind/JAXBContext.java | 18 ++++----- .../javax/xml/bind/JAXBElement.java | 2 +- .../javax/xml/bind/JAXBException.java | 2 +- .../javax/xml/bind/JAXBIntrospector.java | 2 +- .../javax/xml/bind/JAXBPermission.java | 2 +- .../javax/xml/bind/MarshalException.java | 2 +- .../javax/xml/bind/Marshaller.java | 24 ++++++------ .../javax/xml/bind/NotIdentifiableEvent.java | 2 +- .../javax/xml/bind/ParseConversionEvent.java | 2 +- .../javax/xml/bind/PrintConversionEvent.java | 2 +- .../javax/xml/bind/PropertyException.java | 2 +- .../javax/xml/bind/SchemaOutputResolver.java | 1 + .../xml/bind/TypeConstraintException.java | 2 +- .../javax/xml/bind/UnmarshalException.java | 2 +- .../javax/xml/bind/Unmarshaller.java | 32 ++++++++-------- .../javax/xml/bind/UnmarshallerHandler.java | 2 +- .../javax/xml/bind/ValidationEvent.java | 2 +- .../xml/bind/ValidationEventHandler.java | 2 +- .../xml/bind/ValidationEventLocator.java | 2 +- .../javax/xml/bind/ValidationException.java | 2 +- .../javax/xml/bind/Validator.java | 2 +- .../javax/xml/bind/annotation/DomHandler.java | 2 +- .../xml/bind/annotation/W3CDomHandler.java | 2 +- .../xml/bind/annotation/XmlAccessOrder.java | 2 +- .../xml/bind/annotation/XmlAccessType.java | 2 +- .../xml/bind/annotation/XmlAccessorOrder.java | 2 +- .../xml/bind/annotation/XmlAccessorType.java | 2 +- .../xml/bind/annotation/XmlAnyAttribute.java | 2 +- .../xml/bind/annotation/XmlAnyElement.java | 2 +- .../xml/bind/annotation/XmlAttachmentRef.java | 2 +- .../xml/bind/annotation/XmlAttribute.java | 2 +- .../javax/xml/bind/annotation/XmlElement.java | 2 +- .../xml/bind/annotation/XmlElementDecl.java | 2 +- .../xml/bind/annotation/XmlElementRef.java | 4 +- .../xml/bind/annotation/XmlElementRefs.java | 2 +- .../bind/annotation/XmlElementWrapper.java | 4 +- .../xml/bind/annotation/XmlElements.java | 2 +- .../javax/xml/bind/annotation/XmlEnum.java | 2 +- .../xml/bind/annotation/XmlEnumValue.java | 2 +- .../javax/xml/bind/annotation/XmlID.java | 2 +- .../javax/xml/bind/annotation/XmlIDREF.java | 2 +- .../bind/annotation/XmlInlineBinaryData.java | 2 +- .../javax/xml/bind/annotation/XmlList.java | 2 +- .../xml/bind/annotation/XmlMimeType.java | 2 +- .../javax/xml/bind/annotation/XmlMixed.java | 2 +- .../javax/xml/bind/annotation/XmlNs.java | 2 +- .../javax/xml/bind/annotation/XmlNsForm.java | 2 +- .../xml/bind/annotation/XmlRegistry.java | 2 +- .../xml/bind/annotation/XmlRootElement.java | 2 +- .../javax/xml/bind/annotation/XmlSchema.java | 4 +- .../xml/bind/annotation/XmlSchemaType.java | 2 +- .../xml/bind/annotation/XmlSchemaTypes.java | 2 +- .../javax/xml/bind/annotation/XmlSeeAlso.java | 2 +- .../xml/bind/annotation/XmlTransient.java | 2 +- .../javax/xml/bind/annotation/XmlType.java | 2 +- .../javax/xml/bind/annotation/XmlValue.java | 2 +- .../adapters/CollapsedStringAdapter.java | 2 +- .../annotation/adapters/HexBinaryAdapter.java | 2 +- .../adapters/NormalizedStringAdapter.java | 2 +- .../bind/annotation/adapters/XmlAdapter.java | 2 +- .../adapters/XmlJavaTypeAdapter.java | 2 +- .../adapters/XmlJavaTypeAdapters.java | 2 +- .../javax/xml/bind/annotation/package.html | 2 +- .../bind/attachment/AttachmentMarshaller.java | 2 +- .../attachment/AttachmentUnmarshaller.java | 2 +- .../javax/xml/bind/attachment/package.html | 2 +- .../bind/helpers/AbstractMarshallerImpl.java | 2 +- .../helpers/AbstractUnmarshallerImpl.java | 2 +- .../DefaultValidationEventHandler.java | 2 +- .../helpers/NotIdentifiableEventImpl.java | 2 +- .../helpers/ParseConversionEventImpl.java | 2 +- .../helpers/PrintConversionEventImpl.java | 2 +- .../xml/bind/helpers/ValidationEventImpl.java | 2 +- .../helpers/ValidationEventLocatorImpl.java | 2 +- .../javax/xml/bind/util/JAXBResult.java | 1 + .../javax/xml/bind/util/JAXBSource.java | 1 + .../bind/util/ValidationEventCollector.java | 2 +- .../javax/xml/soap/AttachmentPart.java | 14 ++++--- .../jaxws_classes/javax/xml/soap/Detail.java | 4 +- .../javax/xml/soap/DetailEntry.java | 2 + .../javax/xml/soap/MessageFactory.java | 4 +- .../javax/xml/soap/MimeHeader.java | 1 + .../javax/xml/soap/MimeHeaders.java | 1 + .../jaxws_classes/javax/xml/soap/Name.java | 1 + .../jaxws_classes/javax/xml/soap/Node.java | 4 +- .../javax/xml/soap/SAAJMetaFactory.java | 2 +- .../javax/xml/soap/SAAJResult.java | 12 +++--- .../javax/xml/soap/SOAPBody.java | 15 ++++---- .../javax/xml/soap/SOAPBodyElement.java | 2 + .../javax/xml/soap/SOAPConnection.java | 4 +- .../javax/xml/soap/SOAPConnectionFactory.java | 2 + .../javax/xml/soap/SOAPConstants.java | 38 ++++++++++--------- .../javax/xml/soap/SOAPElement.java | 24 ++++++------ .../javax/xml/soap/SOAPElementFactory.java | 1 + .../javax/xml/soap/SOAPEnvelope.java | 2 + .../javax/xml/soap/SOAPException.java | 2 + .../javax/xml/soap/SOAPFactory.java | 11 +++--- .../javax/xml/soap/SOAPFault.java | 38 ++++++++++--------- .../javax/xml/soap/SOAPFaultElement.java | 2 + .../javax/xml/soap/SOAPHeader.java | 17 +++++---- .../javax/xml/soap/SOAPHeaderElement.java | 10 +++-- .../javax/xml/soap/SOAPMessage.java | 17 +++++---- .../javax/xml/soap/SOAPPart.java | 2 + .../jaxws_classes/javax/xml/soap/Text.java | 1 + .../jaxws_classes/javax/xml/ws/Action.java | 2 +- .../javax/xml/ws/AsyncHandler.java | 2 +- .../jaxws_classes/javax/xml/ws/Binding.java | 4 +- .../javax/xml/ws/BindingProvider.java | 6 +-- .../javax/xml/ws/BindingType.java | 2 +- .../jaxws_classes/javax/xml/ws/Dispatch.java | 2 +- .../jaxws_classes/javax/xml/ws/Endpoint.java | 16 ++++---- .../javax/xml/ws/EndpointContext.java | 2 +- .../javax/xml/ws/EndpointReference.java | 2 +- .../javax/xml/ws/FaultAction.java | 2 +- .../jaxws_classes/javax/xml/ws/Holder.java | 2 +- .../javax/xml/ws/LogicalMessage.java | 2 +- .../javax/xml/ws/ProtocolException.java | 2 +- .../jaxws_classes/javax/xml/ws/Provider.java | 2 +- .../javax/xml/ws/RequestWrapper.java | 4 +- .../javax/xml/ws/RespectBinding.java | 2 +- .../javax/xml/ws/RespectBindingFeature.java | 2 +- .../jaxws_classes/javax/xml/ws/Response.java | 2 +- .../javax/xml/ws/ResponseWrapper.java | 4 +- .../jaxws_classes/javax/xml/ws/Service.java | 20 +++++----- .../javax/xml/ws/ServiceMode.java | 2 +- .../javax/xml/ws/WebEndpoint.java | 2 +- .../jaxws_classes/javax/xml/ws/WebFault.java | 4 +- .../javax/xml/ws/WebServiceClient.java | 2 +- .../javax/xml/ws/WebServiceContext.java | 6 +-- .../javax/xml/ws/WebServiceException.java | 2 +- .../javax/xml/ws/WebServiceFeature.java | 2 +- .../javax/xml/ws/WebServicePermission.java | 1 + .../javax/xml/ws/WebServiceProvider.java | 2 +- .../javax/xml/ws/WebServiceRef.java | 4 +- .../javax/xml/ws/WebServiceRefs.java | 2 +- .../javax/xml/ws/handler/Handler.java | 2 +- .../javax/xml/ws/handler/HandlerResolver.java | 2 +- .../javax/xml/ws/handler/LogicalHandler.java | 2 +- .../xml/ws/handler/LogicalMessageContext.java | 2 +- .../javax/xml/ws/handler/MessageContext.java | 4 +- .../javax/xml/ws/handler/PortInfo.java | 2 +- .../xml/ws/handler/soap/SOAPHandler.java | 2 +- .../ws/handler/soap/SOAPMessageContext.java | 2 +- .../javax/xml/ws/http/HTTPBinding.java | 2 +- .../javax/xml/ws/http/HTTPException.java | 2 +- .../javax/xml/ws/soap/Addressing.java | 4 +- .../javax/xml/ws/soap/AddressingFeature.java | 8 ++-- .../jaxws_classes/javax/xml/ws/soap/MTOM.java | 2 +- .../javax/xml/ws/soap/MTOMFeature.java | 2 +- .../javax/xml/ws/soap/SOAPBinding.java | 2 +- .../javax/xml/ws/soap/SOAPFaultException.java | 2 +- .../javax/xml/ws/spi/Invoker.java | 2 +- .../javax/xml/ws/spi/Provider.java | 18 ++++----- .../javax/xml/ws/spi/ServiceDelegate.java | 16 ++++---- .../ws/spi/WebServiceFeatureAnnotation.java | 2 +- .../javax/xml/ws/spi/http/HttpContext.java | 2 +- .../javax/xml/ws/spi/http/HttpExchange.java | 2 +- .../javax/xml/ws/spi/http/HttpHandler.java | 2 +- .../javax/xml/ws/spi/http/package-info.java | 2 +- .../ws/wsaddressing/W3CEndpointReference.java | 2 +- .../W3CEndpointReferenceBuilder.java | 7 ++-- 193 files changed, 413 insertions(+), 342 deletions(-) diff --git a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java index d07ae3ec38b..acc194b5248 100644 --- a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java +++ b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java @@ -127,7 +127,7 @@ public abstract class CommandMap { * @param mimeType the MIME type * @param ds a DataSource for the data * @return the CommandInfo classes that represent the command Beans. - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public CommandInfo[] getPreferredCommands(String mimeType, DataSource ds) { return getPreferredCommands(mimeType); @@ -155,7 +155,7 @@ public abstract class CommandMap { * @param mimeType the MIME type * @param ds a DataSource for the data * @return the CommandInfo objects representing all the commands. - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public CommandInfo[] getAllCommands(String mimeType, DataSource ds) { return getAllCommands(mimeType); @@ -183,7 +183,7 @@ public abstract class CommandMap { * @param cmdName the command name * @param ds a DataSource for the data * @return the CommandInfo corresponding to the command. - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public CommandInfo getCommand(String mimeType, String cmdName, DataSource ds) { @@ -215,7 +215,7 @@ public abstract class CommandMap { * @param mimeType the MIME type * @param ds a DataSource for the data * @return the DataContentHandler for the MIME type - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public DataContentHandler createDataContentHandler(String mimeType, DataSource ds) { @@ -228,7 +228,7 @@ public abstract class CommandMap { * null is returned. * * @return array of MIME types as strings, or null if not supported - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public String[] getMimeTypes() { return null; diff --git a/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java b/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java index 91df5fe9afb..7d13a9b506f 100644 --- a/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java +++ b/jaxws/src/share/jaf_classes/javax/activation/MailcapCommandMap.java @@ -603,7 +603,7 @@ public class MailcapCommandMap extends CommandMap { * Get all the MIME types known to this command map. * * @return array of MIME types as strings - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public synchronized String[] getMimeTypes() { List mtList = new ArrayList(); @@ -639,7 +639,7 @@ public class MailcapCommandMap extends CommandMap { * MIME type are returned. * * @return array of native command entries - * @since JAF 1.1 + * @since 1.6, JAF 1.1 */ public synchronized String[] getNativeCommands(String mimeType) { List cmdList = new ArrayList(); diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java index 7f58b05f24f..8f5c7e66585 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java @@ -58,7 +58,7 @@ import javax.xml.stream.XMLStreamWriter; * This class is responsible for whitespace normalization. * * @author - * @since JAXB1.0 + * @since JAXB 1.0 * @deprecated in JAXB 2.2.4 - use javax.xml.bind.DatatypeConverterImpl instead * or let us know why you can't */ diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Messages.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Messages.java index 13e42bb6328..50554b51c15 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Messages.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Messages.java @@ -31,7 +31,7 @@ import java.util.ResourceBundle; /** * Formats error messages. * - * @since JAXB2.1.10 + * @since JAXB 2.1.10 */ enum Messages { diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/Messages.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/Messages.java index 97c98af4835..b736fd9cb45 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/Messages.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/Messages.java @@ -31,7 +31,7 @@ import java.util.ResourceBundle; /** * Formats error messages. * - * @since JAXB1.0 + * @since JAXB 1.0 */ public class Messages { diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/XMLWriter.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/XMLWriter.java index 6e1dd7b2359..3fbd954efa6 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/XMLWriter.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/marshaller/XMLWriter.java @@ -249,7 +249,7 @@ import org.xml.sax.helpers.XMLFilterImpl; * * @author David Megginson, david@megginson.com * @version 0.2 - * @since JAXB1.0 + * @since JAXB 1.0 * @see org.xml.sax.XMLFilter * @see org.xml.sax.ContentHandler */ diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/DOMScanner.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/DOMScanner.java index c43a3d9a402..8be5e51a980 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/DOMScanner.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/DOMScanner.java @@ -55,7 +55,7 @@ import org.xml.sax.helpers.NamespaceSupport; * classes like this. * * @author - * @since JAXB1.0 + * @since JAXB 1.0 */ public class DOMScanner implements LocatorEx,InfosetScanner/* --- but can't do this to protect 1.0 clients, or can I? */ { diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/Messages.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/Messages.java index 730fb17ddaa..b199f76a844 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/Messages.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/unmarshaller/Messages.java @@ -31,7 +31,7 @@ import java.util.ResourceBundle; /** * Formats error messages. * - * @since JAXB1.0 + * @since JAXB 1.0 */ public class Messages { diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/util/AttributesImpl.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/util/AttributesImpl.java index c0f345aaf2d..26a328556dc 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/util/AttributesImpl.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/util/AttributesImpl.java @@ -62,7 +62,7 @@ import org.xml.sax.Attributes; * AttributeList} interface, it also includes a much more efficient * implementation using a single array rather than a set of Vectors.

* - * @since JAXB1.0 + * @since JAXB 1.0 * @since SAX 2.0 * @author David Megginson * @version 2.0.1 (sax2r2) diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/txw2/output/XMLWriter.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/txw2/output/XMLWriter.java index 5ea7a6842f9..fe1d274df36 100644 --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/txw2/output/XMLWriter.java +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/txw2/output/XMLWriter.java @@ -262,7 +262,7 @@ import java.util.Map; * * @author David Megginson, david@megginson.com * @version 0.2 - * @since JAXB1.0 + * @since JAXB 1.0 * @see org.xml.sax.XMLFilter * @see org.xml.sax.ContentHandler */ diff --git a/jaxws/src/share/jaxws_classes/javax/annotation/Generated.java b/jaxws/src/share/jaxws_classes/javax/annotation/Generated.java index f9d34e4a398..b59595f98f8 100644 --- a/jaxws/src/share/jaxws_classes/javax/annotation/Generated.java +++ b/jaxws/src/share/jaxws_classes/javax/annotation/Generated.java @@ -43,7 +43,7 @@ import static java.lang.annotation.RetentionPolicy.*; *

The comment element is a place holder for any comments that the code * generator may want to include in the generated code.

* - * @since Common Annotations 1.0 + * @since 1.6, Common Annotations 1.0 */ @Documented diff --git a/jaxws/src/share/jaxws_classes/javax/annotation/PostConstruct.java b/jaxws/src/share/jaxws_classes/javax/annotation/PostConstruct.java index 4f2976ca617..fbe226ca42e 100644 --- a/jaxws/src/share/jaxws_classes/javax/annotation/PostConstruct.java +++ b/jaxws/src/share/jaxws_classes/javax/annotation/PostConstruct.java @@ -70,9 +70,10 @@ import static java.lang.annotation.RetentionPolicy.*; *
  • If the method throws an unchecked exception the class MUST NOT be put into * service except in the case of EJBs where the EJB can handle exceptions and * even recover from them.
  • - * @since Common Annotations 1.0 + * * @see javax.annotation.PreDestroy * @see javax.annotation.Resource + * @since 1.6, Common Annotations 1.0 */ @Documented @Retention (RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/annotation/PreDestroy.java b/jaxws/src/share/jaxws_classes/javax/annotation/PreDestroy.java index d24cd3f70ad..eff974a5e4a 100644 --- a/jaxws/src/share/jaxws_classes/javax/annotation/PreDestroy.java +++ b/jaxws/src/share/jaxws_classes/javax/annotation/PreDestroy.java @@ -72,7 +72,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * @see javax.annotation.PostConstruct * @see javax.annotation.Resource - * @since Common Annotations 1.0 + * @since 1.6, Common Annotations 1.0 */ @Documented diff --git a/jaxws/src/share/jaxws_classes/javax/annotation/Resource.java b/jaxws/src/share/jaxws_classes/javax/annotation/Resource.java index 7c6541139fa..0f29fa5e6b8 100644 --- a/jaxws/src/share/jaxws_classes/javax/annotation/Resource.java +++ b/jaxws/src/share/jaxws_classes/javax/annotation/Resource.java @@ -48,7 +48,7 @@ import static java.lang.annotation.RetentionPolicy.*; * appear on private fields and methods of superclasses; the container * is required to perform injection in these cases as well. * - * @since Common Annotations 1.0 + * @since 1.6, Common Annotations 1.0 */ @Target({TYPE, FIELD, METHOD}) @Retention(RUNTIME) @@ -66,7 +66,7 @@ public @interface Resource { * The name of the resource that the reference points to. It can * link to any compatible resource using the global JNDI names. * - * @since Common Annotations 1.1 + * @since 1.7, Common Annotations 1.1 */ String lookup() default ""; diff --git a/jaxws/src/share/jaxws_classes/javax/annotation/Resources.java b/jaxws/src/share/jaxws_classes/javax/annotation/Resources.java index 6bbe04e01c7..7b6e1dec589 100644 --- a/jaxws/src/share/jaxws_classes/javax/annotation/Resources.java +++ b/jaxws/src/share/jaxws_classes/javax/annotation/Resources.java @@ -32,7 +32,7 @@ import static java.lang.annotation.RetentionPolicy.*; * This class is used to allow multiple resources declarations. * * @see javax.annotation.Resource - * @since Common Annotations 1.0 + * @since 1.6, Common Annotations 1.0 */ @Documented diff --git a/jaxws/src/share/jaxws_classes/javax/jws/HandlerChain.java b/jaxws/src/share/jaxws_classes/javax/jws/HandlerChain.java index 497f8b5aa69..cb52ff235d3 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/HandlerChain.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/HandlerChain.java @@ -28,6 +28,9 @@ package javax.jws; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({TYPE, METHOD, FIELD}) public @interface HandlerChain { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/Oneway.java b/jaxws/src/share/jaxws_classes/javax/jws/Oneway.java index f5a4823211d..613e0940c8b 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/Oneway.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/Oneway.java @@ -27,6 +27,9 @@ package javax.jws; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({METHOD}) public @interface Oneway { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/WebMethod.java b/jaxws/src/share/jaxws_classes/javax/jws/WebMethod.java index ae3f3156140..f2eeaf08b03 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/WebMethod.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/WebMethod.java @@ -27,6 +27,9 @@ package javax.jws; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({METHOD}) public @interface WebMethod { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/WebParam.java b/jaxws/src/share/jaxws_classes/javax/jws/WebParam.java index ac7752fdbf0..df9f3d9bd58 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/WebParam.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/WebParam.java @@ -27,6 +27,9 @@ package javax.jws; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({PARAMETER}) public @interface WebParam { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/WebResult.java b/jaxws/src/share/jaxws_classes/javax/jws/WebResult.java index 800fa659029..c878433a077 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/WebResult.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/WebResult.java @@ -27,6 +27,9 @@ package javax.jws; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({METHOD}) public @interface WebResult { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/WebService.java b/jaxws/src/share/jaxws_classes/javax/jws/WebService.java index 8d29d21c947..c133f583547 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/WebService.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/WebService.java @@ -27,6 +27,9 @@ package javax.jws; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({TYPE}) public @interface WebService { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/soap/InitParam.java b/jaxws/src/share/jaxws_classes/javax/jws/soap/InitParam.java index 83acb8b4254..43088e25e20 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/soap/InitParam.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/soap/InitParam.java @@ -25,7 +25,8 @@ package javax.jws.soap; -/* +/** + * @since 1.6 * @Deprecated */ @Deprecated public @interface InitParam { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPBinding.java b/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPBinding.java index 5966f11032a..5fb23ba09bb 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPBinding.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPBinding.java @@ -27,6 +27,9 @@ package javax.jws.soap; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; +/** + * @since 1.6 + */ @Retention(value=RetentionPolicy.RUNTIME) @Target({TYPE,METHOD}) public @interface SOAPBinding { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandler.java b/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandler.java index b586c875e89..fe974e3e090 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandler.java @@ -25,7 +25,8 @@ package javax.jws.soap; -/* +/** + * @since 1.6 * @Deprecated */ @Deprecated public @interface SOAPMessageHandler { diff --git a/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandlers.java b/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandlers.java index 068df03cce3..c255f756c1a 100644 --- a/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandlers.java +++ b/jaxws/src/share/jaxws_classes/javax/jws/soap/SOAPMessageHandlers.java @@ -27,7 +27,8 @@ package javax.jws.soap; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; -/* +/** + * @since 1.6 * @Deprecated */ @Retention(value=RetentionPolicy.RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/Binder.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/Binder.java index a243aaaa1a9..70ec8ea8af0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/Binder.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/Binder.java @@ -76,7 +76,7 @@ import javax.xml.validation.Schema; * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) * Joseph Fialli * - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public abstract class Binder { /** @@ -153,7 +153,7 @@ public abstract class Binder { * binding. * @throws IllegalArgumentException * If any of the input parameters are null - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public abstract JAXBElement unmarshal( XmlNode xmlNode, Class declaredType ) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/DataBindingException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/DataBindingException.java index 2d0461ef16c..26c0e4e28ce 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/DataBindingException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/DataBindingException.java @@ -34,7 +34,7 @@ package javax.xml.bind; * is a checked exception. * * @see JAXB - * @since JAXB2.1 + * @since 1.6, JAXB 2.1 */ public class DataBindingException extends RuntimeException { public DataBindingException(String message, Throwable cause) { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverter.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverter.java index c7cc50943b0..a5c8e13dbc0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverter.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverter.java @@ -88,7 +88,7 @@ import javax.xml.namespace.NamespaceContext; * @see DatatypeConverterInterface * @see ParseConversionEvent * @see PrintConversionEvent - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ final public class DatatypeConverter { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterImpl.java index a2358500ae8..093c2899200 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterImpl.java @@ -49,7 +49,7 @@ import javax.xml.datatype.DatatypeConfigurationException; * This class is responsible for whitespace normalization. * * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    - * @since JAXB2.1 + * @since JAXB 2.1 */ final class DatatypeConverterImpl implements DatatypeConverterInterface { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterInterface.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterInterface.java index 228673bc764..0f4796e0db5 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterInterface.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/DatatypeConverterInterface.java @@ -78,7 +78,7 @@ package javax.xml.bind; * @see DatatypeConverter * @see ParseConversionEvent * @see PrintConversionEvent - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface DatatypeConverterInterface { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/Element.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/Element.java index 6e576d05548..9e2c7b99eeb 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/Element.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/Element.java @@ -35,7 +35,7 @@ package javax.xml.bind; * and 5.7.1 "Bind to Java Element Interface" of the specification. * * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Joe Fialli, Sun Microsystems, Inc.
    - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface Element { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXB.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXB.java index 3c16454697b..b6a16de0d18 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXB.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXB.java @@ -92,7 +92,7 @@ import java.net.URLConnection; * a non-null value. * * @author Kohsuke Kawaguchi - * @since 2.1 + * @since 1.6, JAXB 2.1 */ public final class JAXB { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBContext.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBContext.java index 2d3c1255cba..77d84390c93 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBContext.java @@ -257,7 +257,7 @@ import java.io.InputStream; * @see Marshaller * @see Unmarshaller * @see S 7.4.1 "Named Packages" in Java Language Specification - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public abstract class JAXBContext { @@ -423,7 +423,7 @@ public abstract class JAXBContext { *
  • failure to locate a value for the context factory provider property
  • *
  • mixing schema derived packages from different providers on the same contextPath
  • * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public static JAXBContext newInstance( String contextPath, ClassLoader classLoader, Map properties ) throws JAXBException { @@ -497,7 +497,7 @@ public abstract class JAXBContext { // * @throws IllegalArgumentException // * if the parameter contains {@code null} (i.e., {@code newInstance(null);}) // * -// * @since JAXB2.0 +// * @since JAXB 2.0 // */ // public static JAXBContext newInstance( Source[] externalBindings, Class... classesToBeBound ) // throws JAXBException { @@ -576,7 +576,7 @@ public abstract class JAXBContext { * @throws IllegalArgumentException * if the parameter contains {@code null} (i.e., {@code newInstance(null);}) * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public static JAXBContext newInstance( Class... classesToBeBound ) throws JAXBException { @@ -622,7 +622,7 @@ public abstract class JAXBContext { * @throws IllegalArgumentException * if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);}) * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public static JAXBContext newInstance( Class[] classesToBeBound, Map properties ) throws JAXBException { @@ -692,7 +692,7 @@ public abstract class JAXBContext { * if DOM API corresponding to domType is not supported by * the implementation. * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public Binder createBinder(Class domType) { // to make JAXB 1.0 implementations work, this method must not be @@ -705,7 +705,7 @@ public abstract class JAXBContext { * * @return always a new valid Binder object. * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public Binder createBinder() { return createBinder(Node.class); @@ -722,7 +722,7 @@ public abstract class JAXBContext { * Calling this method on JAXB 1.0 implementations will throw * an UnsupportedOperationException. * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public JAXBIntrospector createJAXBIntrospector() { // to make JAXB 1.0 implementations work, this method must not be @@ -744,7 +744,7 @@ public abstract class JAXBContext { * Calling this method on JAXB 1.0 implementations will throw * an UnsupportedOperationException. * - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public void generateSchema(SchemaOutputResolver outputResolver) throws IOException { // to make JAXB 1.0 implementations work, this method must not be diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBElement.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBElement.java index fa240af7b0d..bc0b5281d5a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBElement.java @@ -58,7 +58,7 @@ import java.io.Serializable; *

    * * @author Kohsuke Kawaguchi, Joe Fialli - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public class JAXBElement implements Serializable { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBException.java index 218dceb7ae3..432f0531d39 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBException.java @@ -34,7 +34,7 @@ import java.io.PrintWriter; * @see JAXBContext * @see Marshaller * @see Unmarshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class JAXBException extends Exception { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBIntrospector.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBIntrospector.java index 18a70ff6a3f..ed75427b442 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBIntrospector.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBIntrospector.java @@ -41,7 +41,7 @@ import javax.xml.namespace.QName; * {@link JAXBContext#createJAXBIntrospector()}. * * @see JAXBContext#createJAXBIntrospector() - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public abstract class JAXBIntrospector { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBPermission.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBPermission.java index 05b83450798..42dedafaaa6 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBPermission.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBPermission.java @@ -73,7 +73,7 @@ import java.security.BasicPermission; * @see java.lang.SecurityManager * * @author Joe Fialli - * @since JAXB 2.2 + * @since 1.7, JAXB 2.2 */ /* code was borrowed originally from java.lang.RuntimePermission. */ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/MarshalException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/MarshalException.java index f944d1d05af..e1f2cad20b8 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/MarshalException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/MarshalException.java @@ -38,7 +38,7 @@ package javax.xml.bind; * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    * @see JAXBException * @see Marshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class MarshalException extends JAXBException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/Marshaller.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/Marshaller.java index 6a469039a06..abb41042479 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/Marshaller.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/Marshaller.java @@ -311,7 +311,7 @@ import java.io.File; * @see JAXBContext * @see Validator * @see Unmarshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface Marshaller { @@ -421,7 +421,7 @@ public interface Marshaller { * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null - * @since JAXB2.1 + * @since 1.6, JAXB 2.1 */ public void marshal( Object jaxbElement, File output ) throws JAXBException; @@ -515,7 +515,7 @@ public interface Marshaller { * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer ) throws JAXBException; @@ -539,7 +539,7 @@ public interface Marshaller { * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public void marshal( Object jaxbElement, javax.xml.stream.XMLEventWriter writer ) throws JAXBException; @@ -655,7 +655,7 @@ public interface Marshaller { * if the adapter parameter is null. * @throws UnsupportedOperationException * if invoked agains a JAXB 1.0 implementation. - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public void setAdapter( XmlAdapter adapter ); @@ -684,7 +684,7 @@ public interface Marshaller { * if the type parameter is null. * @throws UnsupportedOperationException * if invoked agains a JAXB 1.0 implementation. - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public void setAdapter( Class type, A adapter ); @@ -697,7 +697,7 @@ public interface Marshaller { * if the type parameter is null. * @throws UnsupportedOperationException * if invoked agains a JAXB 1.0 implementation. - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public A getAdapter( Class type ); @@ -730,7 +730,7 @@ public interface Marshaller { * @throws UnsupportedOperationException could be thrown if this method is * invoked on an Marshaller created from a JAXBContext referencing * JAXB 1.0 mapped classes - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public void setSchema( Schema schema ); @@ -745,7 +745,7 @@ public interface Marshaller { * @throws UnsupportedOperationException could be thrown if this method is * invoked on an Marshaller created from a JAXBContext referencing * JAXB 1.0 mapped classes - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public Schema getSchema(); @@ -766,7 +766,7 @@ public interface Marshaller { * * @see Marshaller#setListener(Listener) * @see Marshaller#getListener() - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public static abstract class Listener { /** @@ -807,7 +807,7 @@ public interface Marshaller { * One can unregister current Listener by setting listener to null. * * @param listener an instance of a class that implements {@link Listener} - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public void setListener(Listener listener); @@ -815,7 +815,7 @@ public interface Marshaller { *

    Return {@link Listener} registered with this {@link Marshaller}. * * @return registered {@link Listener} or null if no Listener is registered with this Marshaller. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public Listener getListener(); } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/NotIdentifiableEvent.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/NotIdentifiableEvent.java index f4820c96da1..e2f547ed9c7 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/NotIdentifiableEvent.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/NotIdentifiableEvent.java @@ -32,7 +32,7 @@ package javax.xml.bind; * @author

    • Ryan Shoemaker, Sun Microsystems, Inc.
    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Joe Fialli, Sun Microsystems, Inc.
    * @see Validator * @see ValidationEventHandler - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface NotIdentifiableEvent extends ValidationEvent { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/ParseConversionEvent.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/ParseConversionEvent.java index b6ee5e69399..4c900b49184 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/ParseConversionEvent.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/ParseConversionEvent.java @@ -33,7 +33,7 @@ package javax.xml.bind; * @see ValidationEvent * @see ValidationEventHandler * @see Unmarshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface ParseConversionEvent extends ValidationEvent { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/PrintConversionEvent.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/PrintConversionEvent.java index c630cf62b08..b9146f4e310 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/PrintConversionEvent.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/PrintConversionEvent.java @@ -33,7 +33,7 @@ package javax.xml.bind; * @see ValidationEvent * @see ValidationEventHandler * @see Marshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface PrintConversionEvent extends ValidationEvent { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/PropertyException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/PropertyException.java index 65613b84bd1..60860e9bac7 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/PropertyException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/PropertyException.java @@ -35,7 +35,7 @@ package javax.xml.bind; * @see JAXBContext * @see Validator * @see Unmarshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class PropertyException extends JAXBException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/SchemaOutputResolver.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/SchemaOutputResolver.java index f911107ba99..c39b78c870d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/SchemaOutputResolver.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/SchemaOutputResolver.java @@ -42,6 +42,7 @@ import java.io.IOException; * * @author * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) + * @since 1.6 */ public abstract class SchemaOutputResolver { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java index 24a295b8d02..fa9ae393635 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java @@ -42,7 +42,7 @@ package javax.xml.bind; * * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    • Joe Fialli, Sun Microsystems, Inc.
    * @see ValidationEvent - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class TypeConstraintException extends java.lang.RuntimeException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshalException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshalException.java index 88746597953..239675fce2b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshalException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshalException.java @@ -40,7 +40,7 @@ package javax.xml.bind; * @see JAXBException * @see Unmarshaller * @see ValidationEventHandler - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class UnmarshalException extends JAXBException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/Unmarshaller.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/Unmarshaller.java index eb3090ab57b..19dfb6e6f4b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/Unmarshaller.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/Unmarshaller.java @@ -404,7 +404,7 @@ import java.io.Reader; * @see JAXBContext * @see Marshaller * @see Validator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface Unmarshaller { @@ -474,7 +474,7 @@ public interface Unmarshaller { * binding. See
    Unmarshalling XML Data * @throws IllegalArgumentException * If the InputStream parameter is null - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public Object unmarshal( Reader reader ) throws JAXBException; @@ -571,7 +571,7 @@ public interface Unmarshaller { * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public JAXBElement unmarshal( org.w3c.dom.Node node, Class declaredType ) throws JAXBException; @@ -660,7 +660,7 @@ public interface Unmarshaller { * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public JAXBElement unmarshal( javax.xml.transform.Source source, Class declaredType ) throws JAXBException; @@ -696,7 +696,7 @@ public interface Unmarshaller { * @throws IllegalStateException * If reader is not pointing to a START_DOCUMENT or * START_ELEMENT event. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see #unmarshal(javax.xml.stream.XMLStreamReader, Class) */ public Object unmarshal( javax.xml.stream.XMLStreamReader reader ) @@ -731,7 +731,7 @@ public interface Unmarshaller { * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public JAXBElement unmarshal( javax.xml.stream.XMLStreamReader reader, Class declaredType ) throws JAXBException; @@ -766,7 +766,7 @@ public interface Unmarshaller { * @throws IllegalStateException * If reader is not pointing to a START_DOCUMENT or * START_ELEMENT event. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see #unmarshal(javax.xml.stream.XMLEventReader, Class) */ public Object unmarshal( javax.xml.stream.XMLEventReader reader ) @@ -802,7 +802,7 @@ public interface Unmarshaller { * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public JAXBElement unmarshal( javax.xml.stream.XMLEventReader reader, Class declaredType ) throws JAXBException; @@ -962,7 +962,7 @@ public interface Unmarshaller { * @throws UnsupportedOperationException could be thrown if this method is * invoked on an Unmarshaller created from a JAXBContext referencing * JAXB 1.0 mapped classes - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public void setSchema( javax.xml.validation.Schema schema ); @@ -986,7 +986,7 @@ public interface Unmarshaller { * @throws UnsupportedOperationException could be thrown if this method is * invoked on an Unmarshaller created from a JAXBContext referencing * JAXB 1.0 mapped classes - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public javax.xml.validation.Schema getSchema(); @@ -1001,7 +1001,7 @@ public interface Unmarshaller { * if the adapter parameter is null. * @throws UnsupportedOperationException * if invoked agains a JAXB 1.0 implementation. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public void setAdapter( XmlAdapter adapter ); @@ -1030,7 +1030,7 @@ public interface Unmarshaller { * if the type parameter is null. * @throws UnsupportedOperationException * if invoked agains a JAXB 1.0 implementation. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public void setAdapter( Class type, A adapter ); @@ -1043,7 +1043,7 @@ public interface Unmarshaller { * if the type parameter is null. * @throws UnsupportedOperationException * if invoked agains a JAXB 1.0 implementation. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public A getAdapter( Class type ); @@ -1081,7 +1081,7 @@ public interface Unmarshaller { * (@link #setListener(Listener)} * (@link #getListener()} * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public static abstract class Listener { /** @@ -1128,7 +1128,7 @@ public interface Unmarshaller { * One can unregister current Listener by setting listener to null. * * @param listener provides unmarshal event callbacks for this {@link Unmarshaller} - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public void setListener(Listener listener); @@ -1136,7 +1136,7 @@ public interface Unmarshaller { *

    Return {@link Listener} registered with this {@link Unmarshaller}. * * @return registered {@link Listener} or null if no Listener is registered with this Unmarshaller. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public Listener getListener(); } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshallerHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshallerHandler.java index 0f2c7954ad0..cf7f7452996 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshallerHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/UnmarshallerHandler.java @@ -57,7 +57,7 @@ import org.xml.sax.ContentHandler; * * @author

    • Kohsuke KAWAGUCHI, Sun Microsystems, Inc.
    * @see Unmarshaller#getUnmarshallerHandler() - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface UnmarshallerHandler extends ContentHandler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEvent.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEvent.java index 5395904c234..9f21bf6c5e6 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEvent.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEvent.java @@ -34,7 +34,7 @@ package javax.xml.bind; * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Joe Fialli, Sun Microsystems, Inc.
    * @see Validator * @see ValidationEventHandler - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface ValidationEvent { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventHandler.java index 76ed5842416..1161fe89ba9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventHandler.java @@ -65,7 +65,7 @@ package javax.xml.bind; * @see Marshaller * @see ValidationEvent * @see javax.xml.bind.util.ValidationEventCollector - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface ValidationEventHandler { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventLocator.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventLocator.java index c45327eae7e..e9b325d0f63 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventLocator.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationEventLocator.java @@ -40,7 +40,7 @@ package javax.xml.bind; * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Joe Fialli, Sun Microsystems, Inc.
    * @see Validator * @see ValidationEvent - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public interface ValidationEventLocator { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationException.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationException.java index 32f2223ba2b..b06feb7777e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/ValidationException.java @@ -38,7 +38,7 @@ package javax.xml.bind; * @author
    • Ryan Shoemaker, Sun Microsystems, Inc.
    * @see JAXBException * @see Validator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class ValidationException extends JAXBException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/Validator.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/Validator.java index 830c30aecbd..18f7d6166c9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/Validator.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/Validator.java @@ -154,7 +154,7 @@ package javax.xml.bind; * @see ValidationEventHandler * @see ValidationEvent * @see javax.xml.bind.util.ValidationEventCollector - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 * @deprecated since JAXB 2.0 */ public interface Validator { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/DomHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/DomHandler.java index e9ab331101c..97d7ccbe909 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/DomHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/DomHandler.java @@ -49,7 +49,7 @@ import javax.xml.transform.Source; * be called from applications. * * @author Kohsuke Kawaguchi - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public interface DomHandler { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/W3CDomHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/W3CDomHandler.java index 113780e27f7..b5d973860f6 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/W3CDomHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/W3CDomHandler.java @@ -40,7 +40,7 @@ import javax.xml.transform.dom.DOMSource; * {@link DomHandler} implementation for W3C DOM (org.w3c.dom package.) * * @author Kohsuke Kawaguchi - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public class W3CDomHandler implements DomHandler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessOrder.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessOrder.java index 2235678ae0d..ec38d4e29c0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessOrder.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessOrder.java @@ -30,7 +30,7 @@ package javax.xml.bind.annotation; * fields in a JAXB bound class. * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see XmlAccessorOrder */ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessType.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessType.java index c53213a49cd..821c2244610 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessType.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessType.java @@ -32,7 +32,7 @@ package javax.xml.bind.annotation; * properties. * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see XmlAccessorType */ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorOrder.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorOrder.java index a72a9d2a7d2..483849c16e3 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorOrder.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorOrder.java @@ -70,7 +70,7 @@ import static java.lang.annotation.RetentionPolicy.*; * following annotations at the package level: {@link XmlJavaTypeAdapter}. * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see XmlAccessOrder */ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorType.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorType.java index e8f044f97c4..a4e5525c151 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorType.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAccessorType.java @@ -84,7 +84,7 @@ import static java.lang.annotation.RetentionPolicy.*; * following annotations at the package level: {@link XmlJavaTypeAdapter}. * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see XmlAccessType */ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyAttribute.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyAttribute.java index bf1a6ad2075..ff9c13778de 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyAttribute.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyAttribute.java @@ -66,7 +66,7 @@ import static java.lang.annotation.ElementType.METHOD; * map's key. The key's value is the String value of the attribute. * * @author Kohsuke Kawaguchi, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyElement.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyElement.java index 9613547c1dc..3ca62ccd61b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAnyElement.java @@ -243,7 +243,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * * * @author Kohsuke Kawaguchi - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttachmentRef.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttachmentRef.java index d15dc3691ef..e6cd4fcee93 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttachmentRef.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttachmentRef.java @@ -66,7 +66,7 @@ import java.lang.annotation.Target; * The above binding supports WS-I AP 1.0
    WS-I Attachments Profile Version 1.0. * * @author Kohsuke Kawaguchi - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttribute.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttribute.java index 13f52547e3c..b37ca5d2898 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttribute.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlAttribute.java @@ -122,7 +122,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlType - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD, METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElement.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElement.java index 6f2c7e5afb9..5254769d26f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElement.java @@ -134,7 +134,7 @@ import static java.lang.annotation.RetentionPolicy.*; * *

    * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementDecl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementDecl.java index d5c558de122..00b6782d8e8 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementDecl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementDecl.java @@ -130,7 +130,7 @@ import static java.lang.annotation.ElementType.METHOD; * name "foo". * * @see XmlRegistry - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRef.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRef.java index 0f5c7219d4e..00be7a5cc15 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRef.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRef.java @@ -216,7 +216,7 @@ import static java.lang.annotation.ElementType.METHOD; * * @author

    • Kohsuke Kawaguchi, Sun Microsystems,Inc.
    • Sekhar Vajjhala, Sun Microsystems, Inc.
    * @see XmlElementRefs - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD}) @@ -284,7 +284,7 @@ public @interface XmlElementRef { * For compatibility with JAXB 2.1, this property defaults to true, * despite the fact that {@link XmlElement#required()} defaults to false. * - * @since 2.2 + * @since 1.7, JAXB 2.2 */ boolean required() default true; } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRefs.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRefs.java index bb3633ed876..5f9b66c361b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRefs.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementRefs.java @@ -50,7 +50,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * * @see XmlElementWrapper * @see XmlElementRef - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementWrapper.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementWrapper.java index c6bebb2775f..71aeec1141a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementWrapper.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElementWrapper.java @@ -87,7 +87,7 @@ import java.lang.annotation.Target; * @see XmlElements * @see XmlElementRef * @see XmlElementRefs - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * */ @@ -139,7 +139,7 @@ public @interface XmlElementWrapper { * simply a mechanism to let users express their application constraints * better. * - * @since JAXB 2.1 + * @since 1.6, JAXB 2.1 */ boolean required() default false; } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElements.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElements.java index 2e5384600cc..4d52a73c037 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElements.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlElements.java @@ -166,7 +166,7 @@ import java.lang.annotation.Target; * @see XmlElementRef * @see XmlElementRefs * @see XmlJavaTypeAdapter - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD}) public @interface XmlElements { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnum.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnum.java index 544a21e12bb..f6059ffed9c 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnum.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnum.java @@ -62,7 +62,7 @@ import java.lang.annotation.Target; * *

    Examples: See examples in {@link XmlEnumValue} * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({TYPE}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnumValue.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnumValue.java index ea656abd7bb..1948f3670a2 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnumValue.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlEnumValue.java @@ -114,7 +114,7 @@ import static java.lang.annotation.ElementType.FIELD; * </xs:simpleType> * * - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlID.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlID.java index 13ce41d5ed1..8fc3542a5f8 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlID.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlID.java @@ -87,7 +87,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlIDREF - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD, METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlIDREF.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlIDREF.java index ef9e2c6bb9d..5789dcc3d33 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlIDREF.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlIDREF.java @@ -243,7 +243,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlID - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD, METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlInlineBinaryData.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlInlineBinaryData.java index 9390b0e3de6..d6beedba4a2 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlInlineBinaryData.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlInlineBinaryData.java @@ -51,7 +51,7 @@ import javax.activation.DataHandler; * ever called for the property. The binary data will always be inlined. * * @author Joseph Fialli - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD,TYPE}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlList.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlList.java index ef11b5b15f3..0576e7f61da 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlList.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlList.java @@ -104,7 +104,7 @@ import static java.lang.annotation.ElementType.PARAMETER; * * * @author

    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Sekhar Vajjhala, Sun Microsystems, Inc.
    - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER}) public @interface XmlList { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMimeType.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMimeType.java index 09506aae260..c7fabf524c4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMimeType.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMimeType.java @@ -47,7 +47,7 @@ import javax.xml.transform.Source; * the value of the attribute takes precedence and that will control the marshalling. * * @author Kohsuke Kawaguchi - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMixed.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMixed.java index 7b0462e61c0..8259b59540f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMixed.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlMixed.java @@ -124,7 +124,7 @@ import javax.xml.bind.JAXBElement; *

    See "Package Specification" in javax.xml.bind.package javadoc for * additional common information.

    * @author Kohsuke Kawaguchi - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNs.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNs.java index dc92cc55a66..7625b5175cc 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNs.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNs.java @@ -42,7 +42,7 @@ import java.lang.annotation.Target; * *

    Example:See XmlSchema annotation type for an example. * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNsForm.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNsForm.java index 68670a9c1b3..769df76146a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNsForm.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlNsForm.java @@ -61,6 +61,6 @@ package javax.xml.bind.annotation; * * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ public enum XmlNsForm {UNQUALIFIED, QUALIFIED, UNSET} diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRegistry.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRegistry.java index 1218061c051..61f5b520fb4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRegistry.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRegistry.java @@ -34,7 +34,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * Marks a class that has {@link XmlElementDecl}s. * * @author

    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    • Sekhar Vajjhala, Sun Microsystems, Inc.
    - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 * @see XmlElementDecl */ @Retention(RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRootElement.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRootElement.java index 4216d4a8c9f..80506a4d05a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRootElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlRootElement.java @@ -155,7 +155,7 @@ import static java.lang.annotation.ElementType.TYPE; * * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({TYPE}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchema.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchema.java index 80756f387ee..756c5f298e1 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchema.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchema.java @@ -114,7 +114,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target(PACKAGE) @@ -191,7 +191,7 @@ public @interface XmlSchema { * such attribute), for example so that the user can specify a local * copy of the resource through the command line interface. * - * @since JAXB2.1 + * @since 1.6, JAXB 2.1 */ String location() default NO_LOCATION; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaType.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaType.java index 7484cc1cbc8..eac31a6533f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaType.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaType.java @@ -83,7 +83,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; * } * * - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD,METHOD,PACKAGE}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaTypes.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaTypes.java index d32a6218ed0..deee2d408d6 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaTypes.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSchemaTypes.java @@ -50,7 +50,7 @@ import java.lang.annotation.Target; * * @author
    • Sekhar Vajjhala, Sun Microsystems, Inc.
    * @see XmlSchemaType - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({PACKAGE}) public @interface XmlSchemaTypes { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSeeAlso.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSeeAlso.java index 41bf41e3b26..02053ff2502 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSeeAlso.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlSeeAlso.java @@ -70,7 +70,7 @@ import java.lang.annotation.Target; * correctly bind Dog and Cat. * * @author Kohsuke Kawaguchi - * @since JAXB2.1 + * @since 1.6, JAXB 2.1 */ @Target({ElementType.TYPE}) @Retention(RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlTransient.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlTransient.java index 730dea19228..fbd4d6eaa3c 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlTransient.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlTransient.java @@ -88,7 +88,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD, METHOD, TYPE}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlType.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlType.java index 3802f978c3a..0f4b2506927 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlType.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlType.java @@ -379,7 +379,7 @@ import java.lang.annotation.Target; * @see XmlAttribute * @see XmlValue * @see XmlSchema - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({TYPE}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlValue.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlValue.java index dc18c2fcfe4..ecf23aceb49 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlValue.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/XmlValue.java @@ -124,7 +124,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * @author Sekhar Vajjhala, Sun Microsystems, Inc. * @see XmlType - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({FIELD, METHOD}) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java index b9c1b7d314b..9a589653c12 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java @@ -35,7 +35,7 @@ package javax.xml.bind.annotation.adapters; * sequnce of tab, CR, LF, and SP by a single whitespace character ' '. * * @author Kohsuke Kawaguchi - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public class CollapsedStringAdapter extends XmlAdapter { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java index 84704a68831..153378a788d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java @@ -34,7 +34,7 @@ import javax.xml.bind.DatatypeConverter; * This {@link XmlAdapter} binds byte[] to the hexBinary representation in XML. * * @author Kohsuke Kawaguchi - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public final class HexBinaryAdapter extends XmlAdapter { public byte[] unmarshal(String s) { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java index 1ec0b11ca0f..3c64dd48bb2 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java @@ -35,7 +35,7 @@ package javax.xml.bind.annotation.adapters; * as specified in the whitespace facet 'replace' * * @author Kohsuke Kawaguchi, Martin Grebac - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public final class NormalizedStringAdapter extends XmlAdapter { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlAdapter.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlAdapter.java index 8a047de8847..4ca79b0358d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlAdapter.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlAdapter.java @@ -160,7 +160,7 @@ package javax.xml.bind.annotation.adapters; * * @author
    • Sekhar Vajjhala, Sun Microsystems Inc.
    • Kohsuke Kawaguchi, Sun Microsystems Inc.
    * @see XmlJavaTypeAdapter - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 */ public abstract class XmlAdapter { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java index ab0cf949323..a296ae8e50e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java @@ -86,7 +86,7 @@ import static java.lang.annotation.ElementType.PACKAGE; *

    Example: See example in {@link XmlAdapter} * * @author

    • Sekhar Vajjhala, Sun Microsystems Inc.
    • Kohsuke Kawaguchi, Sun Microsystems Inc.
    - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 * @see XmlAdapter */ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java index c29493b42c8..6cebcf89dc9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java @@ -51,7 +51,7 @@ import java.lang.annotation.Target; * * @author
    • Sekhar Vajjhala, Sun Microsystems, Inc.
    * @see XmlJavaTypeAdapter - * @since JAXB2.0 + * @since 1.6, JAXB 2.0 */ @Retention(RUNTIME) @Target({PACKAGE}) public @interface XmlJavaTypeAdapters { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/package.html b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/package.html index 5e6a2a3d650..57f80e44acd 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/package.html +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/package.html @@ -279,7 +279,7 @@ - @since JAXB 2.0 + @since 1.6, JAXB 2.0 diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentMarshaller.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentMarshaller.java index 8d4892b61a5..dd291917a70 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentMarshaller.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentMarshaller.java @@ -50,7 +50,7 @@ import javax.xml.bind.Marshaller; * @author Marc Hadley * @author Kohsuke Kawaguchi * @author Joseph Fialli - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 * * @see Marshaller#setAttachmentMarshaller(AttachmentMarshaller) * diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java index 23d87215889..548f3c9bafe 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java @@ -56,7 +56,7 @@ import javax.activation.DataHandler; * @author Kohsuke Kawaguchi * @author Joseph Fialli * - * @since JAXB 2.0 + * @since 1.6, JAXB 2.0 * * @see javax.xml.bind.Unmarshaller#setAttachmentUnmarshaller(AttachmentUnmarshaller) * diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/package.html b/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/package.html index 5dca81dbd1a..c452cb9ad7f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/package.html +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/attachment/package.html @@ -61,7 +61,7 @@ - @since JAXB 2.0 + @since 1.6, JAXB 2.0 diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractMarshallerImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractMarshallerImpl.java index c2506d23a31..35d47b6c1c3 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractMarshallerImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractMarshallerImpl.java @@ -62,7 +62,7 @@ import java.io.IOException; * * @author
    • Kohsuke Kawaguchi, Sun Microsystems, Inc.
    * @see javax.xml.bind.Marshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public abstract class AbstractMarshallerImpl implements Marshaller { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java index 37e040881c0..e51d6338a8e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java @@ -68,7 +68,7 @@ import java.net.URL; *
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • * * @see javax.xml.bind.Unmarshaller - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public abstract class AbstractUnmarshallerImpl implements Unmarshaller { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/DefaultValidationEventHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/DefaultValidationEventHandler.java index 7fe68ef8c4c..b188eeaf1f3 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/DefaultValidationEventHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/DefaultValidationEventHandler.java @@ -52,7 +52,7 @@ import java.net.URL; * @see javax.xml.bind.Unmarshaller * @see javax.xml.bind.Validator * @see javax.xml.bind.ValidationEventHandler - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class DefaultValidationEventHandler implements ValidationEventHandler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/NotIdentifiableEventImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/NotIdentifiableEventImpl.java index e34c7889cac..c6e5311761d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/NotIdentifiableEventImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/NotIdentifiableEventImpl.java @@ -41,7 +41,7 @@ import javax.xml.bind.ValidationEventLocator; * @see javax.xml.bind.ValidationEventHandler * @see javax.xml.bind.ValidationEvent * @see javax.xml.bind.ValidationEventLocator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class NotIdentifiableEventImpl extends ValidationEventImpl diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ParseConversionEventImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ParseConversionEventImpl.java index 92b504848b2..4cfa28e0309 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ParseConversionEventImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ParseConversionEventImpl.java @@ -42,7 +42,7 @@ import javax.xml.bind.ValidationEventLocator; * @see javax.xml.bind.ValidationEventHandler * @see javax.xml.bind.ValidationEvent * @see javax.xml.bind.ValidationEventLocator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class ParseConversionEventImpl extends ValidationEventImpl diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/PrintConversionEventImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/PrintConversionEventImpl.java index 00de3b15a53..37d63a02e8d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/PrintConversionEventImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/PrintConversionEventImpl.java @@ -42,7 +42,7 @@ import javax.xml.bind.ValidationEventLocator; * @see javax.xml.bind.ValidationEventHandler * @see javax.xml.bind.ValidationEvent * @see javax.xml.bind.ValidationEventLocator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class PrintConversionEventImpl extends ValidationEventImpl diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventImpl.java index c357000617d..3b58bc5c9f0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventImpl.java @@ -43,7 +43,7 @@ import javax.xml.bind.ValidationEventLocator; * @see javax.xml.bind.ValidationEventHandler * @see javax.xml.bind.ValidationEvent * @see javax.xml.bind.ValidationEventLocator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class ValidationEventImpl implements ValidationEvent { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventLocatorImpl.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventLocatorImpl.java index 36da72658ee..306b9777358 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventLocatorImpl.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/helpers/ValidationEventLocatorImpl.java @@ -47,7 +47,7 @@ import org.xml.sax.SAXParseException; * @see javax.xml.bind.ValidationEventHandler * @see javax.xml.bind.ValidationEvent * @see javax.xml.bind.ValidationEventLocator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class ValidationEventLocatorImpl implements ValidationEventLocator { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBResult.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBResult.java index fbf7caac727..7dabf4fab56 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBResult.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBResult.java @@ -71,6 +71,7 @@ import javax.xml.transform.sax.SAXResult; * * @author * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) + * @since 1.6 */ public class JAXBResult extends SAXResult { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBSource.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBSource.java index 515894615fd..11b6c495c82 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBSource.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/util/JAXBSource.java @@ -87,6 +87,7 @@ import org.xml.sax.XMLFilter; * * @author * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) + * @since 1.6 */ public class JAXBSource extends SAXSource { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/bind/util/ValidationEventCollector.java b/jaxws/src/share/jaxws_classes/javax/xml/bind/util/ValidationEventCollector.java index 9cfd2abba16..48dfeea2f5c 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/bind/util/ValidationEventCollector.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/bind/util/ValidationEventCollector.java @@ -45,7 +45,7 @@ import java.util.List; * @see javax.xml.bind.ValidationEventHandler * @see javax.xml.bind.ValidationEvent * @see javax.xml.bind.ValidationEventLocator - * @since JAXB1.0 + * @since 1.6, JAXB 1.0 */ public class ValidationEventCollector implements ValidationEventHandler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/AttachmentPart.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/AttachmentPart.java index aa0f8565b4f..ae3390c82c1 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/AttachmentPart.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/AttachmentPart.java @@ -114,6 +114,8 @@ import javax.activation.DataHandler; *
      *     ap1.clearContent();
      * 
    + * + * @since 1.6 */ public abstract class AttachmentPart { @@ -190,7 +192,7 @@ public abstract class AttachmentPart { * AttachmentPart object or if there was a data * transformation error. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 * @see #getRawContentBytes */ public abstract InputStream getRawContent() throws SOAPException; @@ -208,7 +210,7 @@ public abstract class AttachmentPart { * AttachmentPart object or if there was a data * transformation error. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract byte[] getRawContentBytes() throws SOAPException; @@ -225,7 +227,7 @@ public abstract class AttachmentPart { * AttachmentPart object or if there was a data * transformation error. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract InputStream getBase64Content() throws SOAPException; @@ -267,7 +269,7 @@ public abstract class AttachmentPart { * * @exception SOAPException if an there is an error in setting the content * @exception NullPointerException if content is null - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract void setRawContent(InputStream content, String contentType) throws SOAPException; @@ -285,7 +287,7 @@ public abstract class AttachmentPart { * * @exception SOAPException if an there is an error in setting the content * or content is null - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract void setRawContentBytes( byte[] content, int offset, int len, String contentType) @@ -309,7 +311,7 @@ public abstract class AttachmentPart { * @exception SOAPException if an there is an error in setting the content * @exception NullPointerException if content is null * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract void setBase64Content( InputStream content, String contentType) throws SOAPException; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/Detail.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/Detail.java index 62f9973702b..d7d09bc34dc 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/Detail.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/Detail.java @@ -56,6 +56,8 @@ import javax.xml.namespace.QName; * d.addDetailEntry(name); * Iterator it = d.getDetailEntries(); * + * + * @since 1.6 */ public interface Detail extends SOAPFaultElement { @@ -85,7 +87,7 @@ public interface Detail extends SOAPFaultElement { * DetailEntry object to this Detail object. * * @see Detail#addDetailEntry(Name name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public DetailEntry addDetailEntry(QName qname) throws SOAPException; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/DetailEntry.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/DetailEntry.java index 6523ff660f3..6643dcbf7a2 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/DetailEntry.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/DetailEntry.java @@ -30,6 +30,8 @@ package javax.xml.soap; * a SOAPFault object. A DetailEntry object, * which carries information about errors related to the SOAPBody * object that contains it, is application-specific. + * + * @since 1.6 */ public interface DetailEntry extends SOAPElement { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java index 8501297f3dc..f2094daaa1b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java @@ -63,6 +63,8 @@ import java.io.InputStream; * This method can be used internally by a service implementation to * create a message that is a response to a request. * + * + * @since 1.6 */ public abstract class MessageFactory { @@ -140,7 +142,7 @@ public abstract class MessageFactory { * @exception SOAPException if there was an error in creating the * specified implementation of MessageFactory. * @see SAAJMetaFactory - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static MessageFactory newInstance(String protocol) throws SOAPException { return SAAJMetaFactory.getInstance().newMessageFactory(protocol); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeader.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeader.java index fa792036e37..b1416e7f813 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeader.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeader.java @@ -32,6 +32,7 @@ package javax.xml.soap; * object. * * @see MimeHeaders + * @since 1.6 */ public class MimeHeader { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeaders.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeaders.java index 282d5b30e18..b3ffa768137 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeaders.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/MimeHeaders.java @@ -39,6 +39,7 @@ import java.util.Vector; * API. * @see SOAPMessage#getAttachments * @see AttachmentPart + * @since 1.6 */ public class MimeHeaders { private Vector headers; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/Name.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/Name.java index 6ef60c2f6ec..7c227f19eb3 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/Name.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/Name.java @@ -73,6 +73,7 @@ package javax.xml.soap; * in favor of javax.xml.namespace.QName * @see SOAPEnvelope#createName(String, String, String) SOAPEnvelope.createName * @see SOAPFactory#createName(String, String, String) SOAPFactory.createName + * @since 1.6 */ public interface Name { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/Node.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/Node.java index 4488d92f3f2..1db693187cd 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/Node.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/Node.java @@ -30,6 +30,8 @@ package javax.xml.soap; * This interface extnends the standard DOM Node interface with methods for * getting and setting the value of a node, for * getting and setting the parent of a node, and for removing a node. + * + * @since 1.6 */ public interface Node extends org.w3c.dom.Node { /** @@ -61,7 +63,7 @@ public interface Node extends org.w3c.dom.Node { * node and either has more than one child node or has a child * node that is not a Text node. * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public void setValue(String value); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java index e7fcf813aeb..d6516fd33de 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java @@ -38,7 +38,7 @@ package javax.xml.soap; * class. * * @author SAAJ RI Development Team -* @since SAAJ 1.3 +* @since 1.6, SAAJ 1.3 */ public abstract class SAAJMetaFactory { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJResult.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJResult.java index 9899c81dd4a..f540940c102 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJResult.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SAAJResult.java @@ -35,7 +35,7 @@ import javax.xml.transform.dom.DOMResult; * * @author XWS-Security Development Team * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public class SAAJResult extends DOMResult { @@ -53,7 +53,7 @@ public class SAAJResult extends DOMResult { * * @throws SOAPException if there is a problem creating a SOAPMessage * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SAAJResult() throws SOAPException { this(MessageFactory.newInstance().createMessage()); @@ -79,7 +79,7 @@ public class SAAJResult extends DOMResult { * @throws SOAPException if a SOAPMessage supporting the * specified protocol cannot be created * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SAAJResult(String protocol) throws SOAPException { this(MessageFactory.newInstance(protocol).createMessage()); @@ -99,7 +99,7 @@ public class SAAJResult extends DOMResult { * populated as a result of some transformation or * marshalling operation * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SAAJResult(SOAPMessage message) { super(message.getSOAPPart()); @@ -116,7 +116,7 @@ public class SAAJResult extends DOMResult { * * @param rootNode - the root to which the results will be appended * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SAAJResult(SOAPElement rootNode) { super(rootNode); @@ -125,7 +125,7 @@ public class SAAJResult extends DOMResult { /** * @return the resulting Tree that was created under the specified root Node. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public javax.xml.soap.Node getResult() { return (javax.xml.soap.Node)super.getNode().getFirstChild(); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBody.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBody.java index 7ef27aed41c..ca4a9210f30 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBody.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBody.java @@ -42,6 +42,7 @@ import javax.xml.namespace.QName; * error information, is an example of a SOAPBodyElement object. * * @see SOAPFault + * @since 1.6 */ public interface SOAPBody extends SOAPElement { @@ -90,7 +91,7 @@ public interface SOAPBody extends SOAPElement { * @exception SOAPException if there is a SOAP error * @see SOAPFault#setFaultCode * @see SOAPFault#setFaultString - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException; @@ -127,7 +128,7 @@ public interface SOAPBody extends SOAPElement { * @see SOAPFault#setFaultString * @see SOAPBody#addFault(Name faultCode, String faultString, Locale locale) * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPFault addFault(QName faultCode, String faultString, Locale locale) throws SOAPException; @@ -164,7 +165,7 @@ public interface SOAPBody extends SOAPElement { * if there is a SOAP error * @see SOAPFault#setFaultCode * @see SOAPFault#setFaultString - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public SOAPFault addFault(Name faultCode, String faultString) throws SOAPException; @@ -202,7 +203,7 @@ public interface SOAPBody extends SOAPElement { * @see SOAPFault#setFaultCode * @see SOAPFault#setFaultString * @see SOAPBody#addFault(Name faultCode, String faultString) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPFault addFault(QName faultCode, String faultString) throws SOAPException; @@ -252,7 +253,7 @@ public interface SOAPBody extends SOAPElement { * @exception SOAPException * if a SOAP error occurs * @see SOAPBody#addBodyElement(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPBodyElement addBodyElement(QName qname) throws SOAPException; @@ -272,7 +273,7 @@ public interface SOAPBody extends SOAPElement { * that was added. * @exception SOAPException * if the Document cannot be added - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public SOAPBodyElement addDocument(org.w3c.dom.Document document) throws SOAPException; @@ -290,7 +291,7 @@ public interface SOAPBody extends SOAPElement { * if there is not exactly one child SOAPElement of the * SOAPBody. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public org.w3c.dom.Document extractContentAsDocument() throws SOAPException; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBodyElement.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBodyElement.java index 7f0eb8db86a..2fcec639180 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBodyElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPBodyElement.java @@ -38,6 +38,8 @@ package javax.xml.soap; *
      *    SOAPBodyElement sbe = sb.addBodyElement(myName);
      * 
    + * + * @since 1.6 */ public interface SOAPBodyElement extends SOAPElement { } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnection.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnection.java index ca06b1e7951..0151359b2af 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnection.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnection.java @@ -45,6 +45,8 @@ package javax.xml.soap; * directly to a URL following the request/response paradigm. That is, * messages are sent using the method call, which sends the * message and then waits until it gets a reply. + * + * @since 1.6 */ public abstract class SOAPConnection { @@ -78,7 +80,7 @@ public abstract class SOAPConnection { * @return the SOAPMessage object that is the response to the * get message request * @throws SOAPException if there is a SOAP error - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPMessage get(Object to) throws SOAPException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java index c1e51f098c1..849b5dc8be3 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java @@ -32,6 +32,8 @@ package javax.xml.soap; * SAAJ communication infrastructure. Otherwise {@link SOAPConnection} objects * can be created by calling createConnection() on the newly * created SOAPConnectionFactory object. + * + * @since 1.6 */ public abstract class SOAPConnectionFactory { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConstants.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConstants.java index 8f5ae0b2dec..fe84fcfa2e6 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConstants.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPConstants.java @@ -29,6 +29,8 @@ import javax.xml.namespace.QName; /** * The definition of constants pertaining to the SOAP protocol. + * + * @since 1.6 */ public interface SOAPConstants { /** @@ -41,7 +43,7 @@ public interface SOAPConstants { * argument version of createMessage, an * UnsupportedOperationException. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String DYNAMIC_SOAP_PROTOCOL = "Dynamic Protocol"; @@ -49,7 +51,7 @@ public interface SOAPConstants { * Used to create MessageFactory instances that create * SOAPMessages whose behavior supports the SOAP 1.1 specification. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String SOAP_1_1_PROTOCOL = "SOAP 1.1 Protocol"; @@ -58,26 +60,26 @@ public interface SOAPConstants { * SOAPMessages whose behavior supports the SOAP 1.2 * specification * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String SOAP_1_2_PROTOCOL = "SOAP 1.2 Protocol"; /** * The default protocol: SOAP 1.1 for backwards compatibility. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String DEFAULT_SOAP_PROTOCOL = SOAP_1_1_PROTOCOL; /** * The namespace identifier for the SOAP 1.1 envelope. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String URI_NS_SOAP_1_1_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/"; /** * The namespace identifier for the SOAP 1.2 envelope. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String URI_NS_SOAP_1_2_ENVELOPE = "http://www.w3.org/2003/05/soap-envelope"; @@ -102,21 +104,21 @@ public interface SOAPConstants { /** * The namespace identifier for the SOAP 1.2 encoding. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String URI_NS_SOAP_1_2_ENCODING = "http://www.w3.org/2003/05/soap-encoding"; /** * The media type of the Content-Type MIME header in SOAP 1.1. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String SOAP_1_1_CONTENT_TYPE = "text/xml"; /** * The media type of the Content-Type MIME header in SOAP 1.2. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String SOAP_1_2_CONTENT_TYPE = "application/soap+xml"; @@ -137,21 +139,21 @@ public interface SOAPConstants { * The URI identifying the next application processing a SOAP request as the intended * role for a SOAP 1.2 header entry (see section 2.2 of part 1 of the SOAP 1.2 * specification). - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String URI_SOAP_1_2_ROLE_NEXT = URI_NS_SOAP_1_2_ENVELOPE + "/role/next"; /** * The URI specifying the role None in SOAP 1.2. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String URI_SOAP_1_2_ROLE_NONE = URI_NS_SOAP_1_2_ENVELOPE + "/role/none"; /** * The URI identifying the ultimate receiver of the SOAP 1.2 message. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER = @@ -159,41 +161,41 @@ public interface SOAPConstants { /** * The default namespace prefix for http://www.w3.org/2003/05/soap-envelope - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final String SOAP_ENV_PREFIX = "env"; /** * SOAP 1.2 VersionMismatch Fault - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final QName SOAP_VERSIONMISMATCH_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "VersionMismatch", SOAP_ENV_PREFIX); /** * SOAP 1.2 MustUnderstand Fault - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final QName SOAP_MUSTUNDERSTAND_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "MustUnderstand", SOAP_ENV_PREFIX); /** * SOAP 1.2 DataEncodingUnknown Fault - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final QName SOAP_DATAENCODINGUNKNOWN_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "DataEncodingUnknown", SOAP_ENV_PREFIX); /** * SOAP 1.2 Sender Fault - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final QName SOAP_SENDER_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "Sender", SOAP_ENV_PREFIX); /** * SOAP 1.2 Receiver Fault - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static final QName SOAP_RECEIVER_FAULT = new QName(URI_NS_SOAP_1_2_ENVELOPE, "Receiver", SOAP_ENV_PREFIX); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElement.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElement.java index 4a55a60b22c..b4d8bca6006 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElement.java @@ -40,6 +40,8 @@ import javax.xml.namespace.QName; * objects of the correct type. See {@link #getChildElements()} and * {@link javax.xml.soap} * for details. + * + * @since 1.6 */ public interface SOAPElement extends Node, org.w3c.dom.Element { @@ -74,7 +76,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * @exception SOAPException if there is an error in creating the * SOAPElement object * @see SOAPElement#addChildElement(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPElement addChildElement(QName qname) throws SOAPException; @@ -173,7 +175,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * is also useful for recycling portions of a document within a SOAP * message. * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public abstract void removeContents(); @@ -224,7 +226,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { an attribute with QName qname on this SOAPElement. * @see SOAPElement#addAttribute(Name, String) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPElement addAttribute(QName qname, String value) throws SOAPException; @@ -261,7 +263,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * @return a String giving the value of the specified * attribute, Null if there is no such attribute * @see SOAPElement#getAttributeValue(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public String getAttributeValue(QName qname); @@ -287,7 +289,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * * @return an iterator over the QNames of the attributes * @see SOAPElement#getAllAttributes() - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public Iterator getAllAttributesAsQNames(); @@ -322,7 +324,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * @return an iterator over the namespace prefixes are within scope of this * SOAPElement object * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Iterator getVisibleNamespacePrefixes(); @@ -348,7 +350,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * * @exception SOAPException if the QName cannot be created. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public QName createQName(String localName, String prefix) throws SOAPException; @@ -366,7 +368,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * @return a QName object with the qname of this * SOAPElement object * @see SOAPElement#getElementName() - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public QName getElementQName(); @@ -386,7 +388,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * is not allowed. * @return The renamed Node * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPElement setElementQName(QName newName) throws SOAPException; @@ -409,7 +411,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * @return true if the attribute was * removed successfully; false if it was not * @see SOAPElement#removeAttribute(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public boolean removeAttribute(QName qname); @@ -496,7 +498,7 @@ public interface SOAPElement extends Node, org.w3c.dom.Element { * in this SOAPElement object with the * specified qname * @see SOAPElement#getChildElements(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public Iterator getChildElements(QName qname); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElementFactory.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElementFactory.java index ff6a8ddf314..a45a3db59e8 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElementFactory.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPElementFactory.java @@ -37,6 +37,7 @@ package javax.xml.soap; * inserted. * @deprecated - Use javax.xml.soap.SOAPFactory for creating SOAPElements. * @see javax.xml.soap.SOAPFactory + * @since 1.6 */ public class SOAPElementFactory { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPEnvelope.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPEnvelope.java index 0839e7fbe23..a32d535f3ec 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPEnvelope.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPEnvelope.java @@ -93,6 +93,8 @@ package javax.xml.soap; * Name name = se.createName("GetLastTradePrice", "WOMBAT", * "http://www.wombat.org/trader"); * + * + * @since 1.6 */ public interface SOAPEnvelope extends SOAPElement { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPException.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPException.java index 333c772e9e0..669130204e9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPException.java @@ -39,6 +39,8 @@ package javax.xml.soap; * the provider. Reasons for embedding a Throwable * object include problems such as input/output errors or a parsing * problem, such as an error in parsing a header. + * + * @since 1.6 */ public class SOAPException extends Exception { private Throwable cause; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java index 5f8778e7e5b..c32f6926519 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java @@ -43,6 +43,7 @@ import org.w3c.dom.Element; * javax.xml.soap.Detail objects as well as * java.xml.soap.Name objects. * + * @since 1.6 */ public abstract class SOAPFactory { @@ -77,7 +78,7 @@ public abstract class SOAPFactory { * @exception SOAPException if there is an error in creating the * SOAPElement object * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPElement createElement(Element domElement) throws SOAPException { throw new UnsupportedOperationException("createElement(org.w3c.dom.Element) must be overridden by all subclasses of SOAPFactory."); @@ -120,7 +121,7 @@ public abstract class SOAPFactory { * @exception SOAPException if there is an error in creating the * SOAPElement object * @see SOAPFactory#createElement(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPElement createElement(QName qname) throws SOAPException { throw new UnsupportedOperationException("createElement(QName) must be overridden by all subclasses of SOAPFactory."); @@ -188,7 +189,7 @@ public abstract class SOAPFactory { *@param faultCode the FaultCode for the fault *@return a SOAPFault object *@throws SOAPException if there is a SOAP error - *@since SAAJ 1.3 + *@since 1.6, SAAJ 1.3 */ public abstract SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException; @@ -196,7 +197,7 @@ public abstract class SOAPFactory { *Creates a new default SOAPFault object *@return a SOAPFault object *@throws SOAPException if there is a SOAP error - *@since SAAJ 1.3 + *@since 1.6, SAAJ 1.3 */ public abstract SOAPFault createFault() throws SOAPException; @@ -290,7 +291,7 @@ public abstract class SOAPFactory { * @exception SOAPException if there was an error creating the * specified SOAPFactory * @see SAAJMetaFactory - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public static SOAPFactory newInstance(String protocol) throws SOAPException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFault.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFault.java index ee05dfc2d6d..67d3c6004d3 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFault.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFault.java @@ -42,6 +42,8 @@ import javax.xml.namespace.QName; * Depending on the protocol specified while creating the * MessageFactory instance, a SOAPFault has * sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification. + * + * @since 1.6 */ public interface SOAPFault extends SOAPBodyElement { @@ -72,7 +74,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception SOAPException if there was an error in adding the * faultcode element to the underlying XML tree. * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public void setFaultCode(Name faultCodeQName) throws SOAPException; @@ -91,7 +93,7 @@ public interface SOAPFault extends SOAPBodyElement { * @see #setFaultCode(Name) * @see #getFaultCodeAsQName() * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void setFaultCode(QName faultCodeQName) throws SOAPException; @@ -128,7 +130,7 @@ public interface SOAPFault extends SOAPBodyElement { * @return a Name representing the faultcode * @see #setFaultCode(Name) * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Name getFaultCodeAsName(); @@ -141,7 +143,7 @@ public interface SOAPFault extends SOAPBodyElement { * * @see #setFaultCode(QName) * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public QName getFaultCodeAsQName(); @@ -158,7 +160,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Subcode. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public Iterator getFaultSubcodes(); @@ -171,7 +173,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Subcode. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void removeAllFaultSubcodes(); @@ -187,7 +189,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Subcode. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void appendFaultSubcode(QName subcode) throws SOAPException; @@ -270,7 +272,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception SOAPException if there was an error in adding the * faultString to the underlying XML tree. * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public void setFaultString(String faultString, Locale locale) throws SOAPException; @@ -315,7 +317,7 @@ public interface SOAPFault extends SOAPBodyElement { * the fault string or null if no locale was specified * @see #setFaultString(String, Locale) * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Locale getFaultStringLocale(); @@ -327,7 +329,7 @@ public interface SOAPFault extends SOAPBodyElement { * @return true if this SOAPFault has a Detail * subelement and false otherwise. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public boolean hasDetail(); @@ -377,7 +379,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Reason. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public Iterator getFaultReasonLocales() throws SOAPException; @@ -393,7 +395,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Reason. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public Iterator getFaultReasonTexts() throws SOAPException; @@ -414,7 +416,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Reason. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public String getFaultReasonText(Locale locale) throws SOAPException; @@ -441,7 +443,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Reason. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void addFaultReasonText(String text, java.util.Locale locale) throws SOAPException; @@ -457,7 +459,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Node. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public String getFaultNode(); @@ -472,7 +474,7 @@ public interface SOAPFault extends SOAPBodyElement { * support the SOAP 1.2 concept of Fault Node. * * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void setFaultNode(String uri) throws SOAPException; @@ -487,7 +489,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Role. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public String getFaultRole(); @@ -504,7 +506,7 @@ public interface SOAPFault extends SOAPBodyElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Role. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void setFaultRole(String uri) throws SOAPException; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFaultElement.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFaultElement.java index f89b4c04393..fcf3a02f80d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFaultElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPFaultElement.java @@ -32,6 +32,8 @@ package javax.xml.soap; *

    * Content is added to a SOAPFaultElement using the * SOAPElement method addTextNode. + * + * @since 1.6 */ public interface SOAPFaultElement extends SOAPElement { } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeader.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeader.java index dd10957f0ed..870b423c70b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeader.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeader.java @@ -66,6 +66,7 @@ import javax.xml.namespace.QName; * * * @see SOAPHeaderElement + * @since 1.6 */ public interface SOAPHeader extends SOAPElement { /** @@ -92,7 +93,7 @@ public interface SOAPHeader extends SOAPElement { * inserted into this SOAPHeader object * @exception SOAPException if a SOAP error occurs * @see SOAPHeader#addHeaderElement(Name) - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPHeaderElement addHeaderElement(QName qname) throws SOAPException; @@ -115,7 +116,7 @@ public interface SOAPHeader extends SOAPElement { * @see #extractHeaderElements * @see SOAPConstants#URI_SOAP_ACTOR_NEXT * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Iterator examineMustUnderstandHeaderElements(String actor); @@ -180,7 +181,7 @@ public interface SOAPHeader extends SOAPElement { * inserted into this SOAPHeader object * @exception SOAPException if a SOAP error occurs. * @exception UnsupportedOperationException if this is a SOAP 1.1 Header. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPHeaderElement addNotUnderstoodHeaderElement(QName name) throws SOAPException; @@ -196,7 +197,7 @@ public interface SOAPHeader extends SOAPElement { * @return the new SOAPHeaderElement object that was * inserted into this SOAPHeader object * @exception SOAPException if a SOAP error occurs. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPHeaderElement addUpgradeHeaderElement(Iterator supportedSOAPURIs) throws SOAPException; @@ -211,7 +212,7 @@ public interface SOAPHeader extends SOAPElement { * @return the new SOAPHeaderElement object that was * inserted into this SOAPHeader object * @exception SOAPException if a SOAP error occurs. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPHeaderElement addUpgradeHeaderElement(String[] supportedSoapUris) throws SOAPException; @@ -226,7 +227,7 @@ public interface SOAPHeader extends SOAPElement { * @return the new SOAPHeaderElement object that was * inserted into this SOAPHeader object * @exception SOAPException if a SOAP error occurs. - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public SOAPHeaderElement addUpgradeHeaderElement(String supportedSoapUri) throws SOAPException; @@ -240,7 +241,7 @@ public interface SOAPHeader extends SOAPElement { * SOAPHeader * @see #extractAllHeaderElements * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Iterator examineAllHeaderElements(); @@ -255,7 +256,7 @@ public interface SOAPHeader extends SOAPElement { * * @see #examineAllHeaderElements * - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Iterator extractAllHeaderElements(); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeaderElement.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeaderElement.java index 29f331964fc..f6755f1c372 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeaderElement.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPHeaderElement.java @@ -33,6 +33,8 @@ package javax.xml.soap; *

    * A SOAPHeaderElement object can have other * SOAPElement objects as its children. + * + * @since 1.6 */ public interface SOAPHeaderElement extends SOAPElement { @@ -65,7 +67,7 @@ public interface SOAPHeaderElement extends SOAPElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Role. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void setRole(String uri) throws SOAPException; @@ -89,7 +91,7 @@ public interface SOAPHeaderElement extends SOAPElement { * @exception UnsupportedOperationException if this message does not * support the SOAP 1.2 concept of Fault Role. * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public String getRole(); @@ -143,7 +145,7 @@ public interface SOAPHeaderElement extends SOAPElement { * @see #setMustUnderstand * @see #getRelay * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public void setRelay(boolean relay) throws SOAPException; @@ -160,7 +162,7 @@ public interface SOAPHeaderElement extends SOAPElement { * @see #getMustUnderstand * @see #setRelay * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public boolean getRelay(); } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPMessage.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPMessage.java index a86f73865b1..821c64817e9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPMessage.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPMessage.java @@ -100,6 +100,7 @@ import javax.activation.DataHandler; * * @see MessageFactory * @see AttachmentPart + * @since 1.6 */ public abstract class SOAPMessage { /** @@ -108,7 +109,7 @@ public abstract class SOAPMessage { * supported values. The default is "utf-8". * * @see SOAPMessage#setProperty(String, Object) SOAPMessage.setProperty - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public static final String CHARACTER_SET_ENCODING = "javax.xml.soap.character-set-encoding"; @@ -119,7 +120,7 @@ public abstract class SOAPMessage { * "false". * * @see SOAPMessage#setProperty(String, Object) SOAPMessage.setProperty - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public static final String WRITE_XML_DECLARATION = "javax.xml.soap.write-xml-declaration"; @@ -163,7 +164,7 @@ public abstract class SOAPMessage { * object * @exception SOAPException * if the SOAP Body does not exist or cannot be retrieved - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public SOAPBody getSOAPBody() throws SOAPException { throw new UnsupportedOperationException("getSOAPBody must be overridden by all subclasses of SOAPMessage"); @@ -178,7 +179,7 @@ public abstract class SOAPMessage { * object * @exception SOAPException * if the SOAP Header does not exist or cannot be retrieved - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public SOAPHeader getSOAPHeader() throws SOAPException { throw new UnsupportedOperationException("getSOAPHeader must be overridden by all subclasses of SOAPMessage"); @@ -230,7 +231,7 @@ public abstract class SOAPMessage { * @param headers * a MimeHeaders object containing the MIME * headers for which to search - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract void removeAttachments(MimeHeaders headers); @@ -258,7 +259,7 @@ public abstract class SOAPMessage { * @throws SOAPException if there is an error in the attempt to access the * attachment * - * @since SAAJ 1.3 + * @since 1.6, SAAJ 1.3 */ public abstract AttachmentPart getAttachment(SOAPElement element) throws SOAPException; @@ -432,7 +433,7 @@ public abstract class SOAPMessage { * the value to be associated with the specified property * @exception SOAPException * if the property name is not recognized. - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public void setProperty(String property, Object value) throws SOAPException { @@ -448,7 +449,7 @@ public abstract class SOAPMessage { * if no such property exists. * @exception SOAPException * if the property name is not recognized. - * @since SAAJ 1.2 + * @since 1.6, SAAJ 1.2 */ public Object getProperty(String property) throws SOAPException { throw new UnsupportedOperationException("getProperty must be overridden by all subclasses of SOAPMessage"); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPPart.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPPart.java index ab605b6f757..dc280fab60e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPPart.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/SOAPPart.java @@ -64,6 +64,8 @@ import javax.xml.transform.Source; * The SOAPPart method getEnvelope can be used * to retrieve the SOAPEnvelope object. *

    + * + * @since 1.6 */ public abstract class SOAPPart implements org.w3c.dom.Document, Node { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/soap/Text.java b/jaxws/src/share/jaxws_classes/javax/xml/soap/Text.java index c385e1646d5..49f0e2cb19f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/soap/Text.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/soap/Text.java @@ -29,6 +29,7 @@ package javax.xml.soap; * A representation of a node whose value is text. A Text object * may represent text that is content or text that is a comment. * + * @since 1.6 */ public interface Text extends Node, org.w3c.dom.Text { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Action.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Action.java index daadc48d1f6..f42190b295e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Action.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Action.java @@ -118,7 +118,7 @@ import java.lang.annotation.Target; * * @see FaultAction * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @Documented diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/AsyncHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/AsyncHandler.java index 6f553b0a5c6..66acc97af26 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/AsyncHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/AsyncHandler.java @@ -29,7 +29,7 @@ package javax.xml.ws; * clients that wish to receive callback notification of the completion of * service endpoint operations invoked asynchronously. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface AsyncHandler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Binding.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Binding.java index 9c92f1eed96..24be0222c67 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Binding.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Binding.java @@ -29,7 +29,7 @@ package javax.xml.ws; /** The Binding interface is the base interface * for JAX-WS protocol bindings. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface Binding { @@ -61,7 +61,7 @@ public interface Binding { * @return String The binding identifier for the port. * Never returns null * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ String getBindingID(); } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingProvider.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingProvider.java index bac4d26ccd9..11194fd5078 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingProvider.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingProvider.java @@ -33,7 +33,7 @@ import javax.xml.ws.wsaddressing.W3CEndpointReference; * protocol binding and associated context objects for request and * response message processing. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * * @see javax.xml.ws.Binding **/ @@ -154,7 +154,7 @@ public interface BindingProvider { * * @see W3CEndpointReference * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public EndpointReference getEndpointReference(); @@ -176,7 +176,7 @@ public interface BindingProvider { * @throws java.lang.UnsupportedOperationException If this * BindingProvider uses the XML/HTTP binding. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public T getEndpointReference(Class clazz); } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingType.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingType.java index 29ce8757287..0976add7606 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingType.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/BindingType.java @@ -39,7 +39,7 @@ import java.lang.annotation.RetentionPolicy; * This annotation may be overriden programmatically or via * deployment descriptors, depending on the platform in use. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * **/ @Target(ElementType.TYPE) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Dispatch.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Dispatch.java index f1f38a35883..7c96bab57d8 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Dispatch.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Dispatch.java @@ -33,7 +33,7 @@ import java.util.concurrent.Future; * class acts as a factory for the creation of Dispatch * instances. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface Dispatch extends BindingProvider { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Endpoint.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Endpoint.java index 484c6510e43..1cb19ea1590 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Endpoint.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Endpoint.java @@ -61,7 +61,7 @@ import org.w3c.dom.Element; * as possible instead of generating new ones based on the annotations * present on the implementor. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * * @see javax.xml.ws.Binding * @see javax.xml.ws.BindingType @@ -119,7 +119,7 @@ public abstract class Endpoint { * * * @return The newly created endpoint. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 * */ public static Endpoint create(Object implementor, WebServiceFeature ... features) { @@ -166,7 +166,7 @@ public abstract class Endpoint { * parameter will have their default values. * * @return The newly created endpoint. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public static Endpoint create(String bindingId, Object implementor, WebServiceFeature ... features) { return Provider.provider().createEndpoint(bindingId, implementor, features); @@ -266,7 +266,7 @@ public abstract class Endpoint { * If a java.lang.SecurityManger * is being used and the application doesn't have the * WebServicePermission("publishEndpoint") permission. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public static Endpoint publish(String address, Object implementor, WebServiceFeature ... features) { return Provider.provider().createAndPublishEndpoint(address, implementor, features); @@ -330,7 +330,7 @@ public abstract class Endpoint { * If a java.lang.SecurityManger * is being used and the application doesn't have the * WebServicePermission("publishEndpoint") permission. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public void publish(HttpContext serverContext) { throw new UnsupportedOperationException("JAX-WS 2.2 implementation must override this default behaviour."); @@ -446,7 +446,7 @@ public abstract class Endpoint { * * @see W3CEndpointReference * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract EndpointReference getEndpointReference(Element... referenceParameters); @@ -472,7 +472,7 @@ public abstract class Endpoint { * uses the XML/HTTP binding. * * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract T getEndpointReference(Class clazz, Element... referenceParameters); @@ -490,7 +490,7 @@ public abstract class Endpoint { * @throws java.lang.IllegalStateException * If the endpoint has been published already or it has been stopped. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public void setEndpointContext(EndpointContext ctxt) { throw new UnsupportedOperationException("JAX-WS 2.2 implementation must override this default behaviour."); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointContext.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointContext.java index 13bc527fc21..b1a4b49db59 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointContext.java @@ -42,7 +42,7 @@ import java.util.Set; * before {@link Endpoint#publish} methods. * * @author Jitendra Kotamraju - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public abstract class EndpointContext { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointReference.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointReference.java index 6ef626b4d17..3ed68c0511f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointReference.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/EndpointReference.java @@ -81,7 +81,7 @@ import java.io.StringWriter; * * @see W3CEndpointReference * @see Service - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @XmlTransient // to treat this class like Object as far as databinding is concerned (proposed JAXB 2.1 feature) public abstract class EndpointReference { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/FaultAction.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/FaultAction.java index 0e29a0aa858..43e37f608ea 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/FaultAction.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/FaultAction.java @@ -145,7 +145,7 @@ import java.lang.annotation.Target; * </definitions> * * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @Documented diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Holder.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Holder.java index 8eddf0575f9..8f58f34eda1 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Holder.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Holder.java @@ -30,7 +30,7 @@ import java.io.Serializable; /** * Holds a value of type T. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 */ public final class Holder implements Serializable { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/LogicalMessage.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/LogicalMessage.java index 19b5be1dfd0..4f50c1604b5 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/LogicalMessage.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/LogicalMessage.java @@ -32,7 +32,7 @@ import javax.xml.bind.JAXBContext; * protocol agnostic XML message and contains methods that * provide access to the payload of the message. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface LogicalMessage { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/ProtocolException.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/ProtocolException.java index 16ba0dae50d..5ea3926db9f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/ProtocolException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/ProtocolException.java @@ -30,7 +30,7 @@ package javax.xml.ws; * are used to communicate protocol level fault information to clients and may * be used on the server to control the protocol specific fault representation. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public class ProtocolException extends WebServiceException { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Provider.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Provider.java index 79d26450baa..78c7b717948 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Provider.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Provider.java @@ -38,7 +38,7 @@ package javax.xml.ws; * the Provider instance will receive entire protocol messages * or just message payloads. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * * @see javax.xml.transform.Source * @see javax.xml.soap.SOAPMessage diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/RequestWrapper.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/RequestWrapper.java index a33af7c3d33..34b6b6a33d4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/RequestWrapper.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/RequestWrapper.java @@ -40,7 +40,7 @@ import java.lang.annotation.RetentionPolicy; * overloading conflicts in document literal mode. Only the className * is required in this case. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ @Target(ElementType.METHOD) @@ -65,7 +65,7 @@ public @interface RequestWrapper { /** * wsdl:part name for the wrapper part * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public String partName() default ""; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBinding.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBinding.java index c71a3215e9a..e5357873ec1 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBinding.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBinding.java @@ -54,7 +54,7 @@ import javax.xml.ws.spi.WebServiceFeatureAnnotation; * * @see RespectBindingFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBindingFeature.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBindingFeature.java index 51320734bc4..5bf7bdd7ec0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBindingFeature.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/RespectBindingFeature.java @@ -80,7 +80,7 @@ import javax.xml.ws.soap.AddressingFeature; * * @see AddressingFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public final class RespectBindingFeature extends WebServiceFeature { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Response.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Response.java index 8d5451f3be2..e98ae8b20a0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Response.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Response.java @@ -39,7 +39,7 @@ import java.util.concurrent.Future; * {@link WebServiceException} that represents the error that occured during the * asynchronous method invocation.

    * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface Response extends Future { /** Gets the contained response context. diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/ResponseWrapper.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/ResponseWrapper.java index 3d7bb75051b..0bb891a9c66 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/ResponseWrapper.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/ResponseWrapper.java @@ -39,7 +39,7 @@ import java.lang.annotation.RetentionPolicy; * overloading conflicts in document literal mode. Only the className * is required in this case. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ @Target(ElementType.METHOD) @@ -65,7 +65,7 @@ public @interface ResponseWrapper { /** * wsdl:part name for the wrapper part * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public String partName() default ""; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/Service.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/Service.java index 77b77e23c63..a31df76c9df 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/Service.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/Service.java @@ -57,7 +57,7 @@ import javax.xml.ws.spi.Provider; * can be enabled by creating a ThreadPoolExecutor and * registering it with the service. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * * @see javax.xml.ws.spi.Provider * @see javax.xml.ws.handler.HandlerResolver @@ -153,7 +153,7 @@ public class Service { * @see java.lang.reflect.InvocationHandler * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public T getPort(QName portName, Class serviceEndpointInterface, WebServiceFeature... features) { @@ -219,7 +219,7 @@ public class Service { * * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public T getPort(Class serviceEndpointInterface, WebServiceFeature... features) { @@ -297,7 +297,7 @@ public class Service { * with this port or is unsupported. * * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features) { @@ -381,7 +381,7 @@ public class Service { * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public Dispatch createDispatch(QName portName, Class type, Service.Mode mode, WebServiceFeature... features) { @@ -456,7 +456,7 @@ public class Service { * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public Dispatch createDispatch(EndpointReference endpointReference, Class type, Service.Mode mode, @@ -514,7 +514,7 @@ public class Service { * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public Dispatch createDispatch(QName portName, JAXBContext context, Service.Mode mode, WebServiceFeature... features) { @@ -587,7 +587,7 @@ public class Service { * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public Dispatch createDispatch(EndpointReference endpointReference, JAXBContext context, Service.Mode mode, @@ -722,7 +722,7 @@ public class Service { * it must throw a WebServiceException. * @throws WebServiceException If any error in creation of the * specified service. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 **/ public static Service create( java.net.URL wsdlDocumentLocation, @@ -752,7 +752,7 @@ public class Service { * @throws WebServiceException If any error in creation of the * specified service * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public static Service create(QName serviceName, WebServiceFeature ... features) { return new Service(null, serviceName, features); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/ServiceMode.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/ServiceMode.java index a451cd5fbae..84624794734 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/ServiceMode.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/ServiceMode.java @@ -36,7 +36,7 @@ import java.lang.annotation.Inherited; * Used to indicate whether a {@link Provider} implementation wishes to work * with entire protocol messages or just with protocol message payloads. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebEndpoint.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebEndpoint.java index ebff61a1abc..3654ef202d0 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebEndpoint.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebEndpoint.java @@ -41,7 +41,7 @@ import java.lang.annotation.RetentionPolicy; * determined based on the value of the WebServiceClient * annotation on the generated service interface itself. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * * @see javax.xml.ws.WebServiceClient **/ diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebFault.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebFault.java index 7135c26f96b..f3abbee0358 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebFault.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebFault.java @@ -36,7 +36,7 @@ import java.lang.annotation.RetentionPolicy; * to the local and namespace name of the fault element and the name * of the fault bean. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @@ -60,7 +60,7 @@ public @interface WebFault { /** * wsdl:Message's name. Default name is the exception's class name. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public String messageName() default ""; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceClient.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceClient.java index d1e84128915..0d40a1fb47d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceClient.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceClient.java @@ -40,7 +40,7 @@ import java.lang.annotation.RetentionPolicy; * element represents the Web service for which the generated * service interface provides a client view. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceContext.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceContext.java index 618592ddbef..8ba63ab75a4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceContext.java @@ -41,7 +41,7 @@ import org.w3c.dom.Element; * into an endpoint implementation class using the * Resource annotation. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * * @see javax.annotation.Resource **/ @@ -120,7 +120,7 @@ public interface WebServiceContext { * * @see W3CEndpointReference * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public EndpointReference getEndpointReference(Element... referenceParameters); @@ -144,7 +144,7 @@ public interface WebServiceContext { * @throws WebServiceException If the clazz type of * EndpointReference is not supported. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public T getEndpointReference(Class clazz, Element... referenceParameters); diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceException.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceException.java index aaf116bf143..acd122b3a91 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceException.java @@ -28,7 +28,7 @@ package javax.xml.ws; /** The WebServiceException class is the base * exception class for all JAX-WS API runtime exceptions. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public class WebServiceException extends java.lang.RuntimeException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceFeature.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceFeature.java index a08f95dbbff..ea60d367ff5 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceFeature.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceFeature.java @@ -44,7 +44,7 @@ package javax.xml.ws; * @see javax.xml.ws.soap.AddressingFeature * @see javax.xml.ws.soap.MTOMFeature * - * @since 2.1 + * @since 1.6, JAX-WS 2.1 */ public abstract class WebServiceFeature { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServicePermission.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServicePermission.java index d0ecad9aa21..743243f22f6 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServicePermission.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServicePermission.java @@ -55,6 +55,7 @@ import java.security.BasicPermission; * @see java.security.Permissions * @see java.lang.SecurityManager * @see java.net.SocketPermission + * @since 1.6 */ public final class WebServicePermission extends BasicPermission { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceProvider.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceProvider.java index 4dfcaad9590..c2d48d2f5b9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceProvider.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceProvider.java @@ -33,7 +33,7 @@ import java.lang.annotation.RetentionPolicy; /** * Used to annotate a Provider implementation class. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * @see javax.xml.ws.Provider */ @Target(ElementType.TYPE) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java index fe01112906c..4d5c70e0a64 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java @@ -75,7 +75,7 @@ import java.lang.annotation.RetentionPolicy; * @see javax.annotation.Resource * @see WebServiceFeatureAnnotation * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 * **/ @@ -143,7 +143,7 @@ public @interface WebServiceRef { * A portable JNDI lookup name that resolves to the target * web service reference. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ String lookup() default ""; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRefs.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRefs.java index c77749bb510..10104f35d3e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRefs.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRefs.java @@ -69,7 +69,7 @@ import static java.lang.annotation.RetentionPolicy.*; * * * @see WebServiceRef - * @since 2.0 + * @since 1.6, JAX-WS 2.0 */ @Documented diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/Handler.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/Handler.java index ec278114012..dfd972b705c 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/Handler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/Handler.java @@ -31,7 +31,7 @@ import javax.xml.ws.handler.MessageContext; /** The Handler interface * is the base interface for JAX-WS handlers. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface Handler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/HandlerResolver.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/HandlerResolver.java index 3c3e04f8ce6..c0f2f97361b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/HandlerResolver.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/HandlerResolver.java @@ -39,7 +39,7 @@ package javax.xml.ws.handler; * * @see javax.xml.ws.Service#setHandlerResolver * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface HandlerResolver { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalHandler.java index cc95233c938..c5e9589d24b 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalHandler.java @@ -28,7 +28,7 @@ package javax.xml.ws.handler; /** The LogicalHandler extends * Handler to provide typesafety for the message context parameter. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface LogicalHandler extends Handler { } diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalMessageContext.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalMessageContext.java index 24c09dae3a5..0ae213ba063 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalMessageContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/LogicalMessageContext.java @@ -32,7 +32,7 @@ import javax.xml.ws.LogicalMessage; * provide access to a the contained message as a protocol neutral * LogicalMessage * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface LogicalMessageContext extends MessageContext { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/MessageContext.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/MessageContext.java index a893c749651..35525fc0440 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/MessageContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/MessageContext.java @@ -36,7 +36,7 @@ import java.util.Map; * enable handlers in a handler chain to share processing related * state. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 */ public interface MessageContext extends Map { @@ -168,7 +168,7 @@ public interface MessageContext extends Map { * wsa:IsReferenceParameter="true" attribute. *

    Type: List<Element> * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public static final String REFERENCE_PARAMETERS = "javax.xml.ws.reference.parameters"; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/PortInfo.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/PortInfo.java index ee91456abdf..5f1b2c2dad9 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/PortInfo.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/PortInfo.java @@ -35,7 +35,7 @@ import javax.xml.namespace.QName; * This interface is never implemented by an application, * only by a JAX-WS implementation. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface PortInfo { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPHandler.java index ba9232726c2..98a43cd181a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPHandler.java @@ -33,7 +33,7 @@ import java.util.Set; * to provide typesafety for the message context parameter and add a method * to obtain access to the headers that may be processed by the handler. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface SOAPHandler extends Handler { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPMessageContext.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPMessageContext.java index 2df709f7721..cf75e7d13fa 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPMessageContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/handler/soap/SOAPMessageContext.java @@ -38,7 +38,7 @@ import java.util.Set; * * @see javax.xml.soap.SOAPMessage * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface SOAPMessageContext extends javax.xml.ws.handler.MessageContext { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPBinding.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPBinding.java index 8d4e0d0de33..233a0a702f4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPBinding.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPBinding.java @@ -31,7 +31,7 @@ import javax.xml.ws.Binding; /** The HTTPBinding interface is an * abstraction for the XML/HTTP binding. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface HTTPBinding extends Binding { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPException.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPException.java index 4796394eb39..592e302f054 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/http/HTTPException.java @@ -32,7 +32,7 @@ package javax.xml.ws.http; *

    Since there is no standard format for faults or exceptions * in XML/HTTP messaging, only the HTTP status code is captured. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public class HTTPException extends javax.xml.ws.ProtocolException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/Addressing.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/Addressing.java index 163d0f538b1..5dbb42d26da 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/Addressing.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/Addressing.java @@ -57,7 +57,7 @@ import javax.xml.ws.spi.WebServiceFeatureAnnotation; * This annotation's behaviour is defined by the corresponding feature * {@link AddressingFeature}. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @@ -106,7 +106,7 @@ public @interface Addressing { * * 3.1.3 NonAnonymousResponses Assertion in the generated WSDL. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ Responses responses() default Responses.ALL; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/AddressingFeature.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/AddressingFeature.java index dfd95c739f0..8f9d730d797 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/AddressingFeature.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/AddressingFeature.java @@ -112,7 +112,7 @@ import javax.xml.ws.Service; * for more information on WS-Addressing. * * @see Addressing - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public final class AddressingFeature extends WebServiceFeature { @@ -151,7 +151,7 @@ public final class AddressingFeature extends WebServiceFeature { * * 3.1.3 NonAnonymousResponses Assertion in the generated WSDL. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public enum Responses { /** @@ -229,7 +229,7 @@ public final class AddressingFeature extends WebServiceFeature { * @param required true means requires the use of ws-addressing . * @param responses specifies what type of responses are required * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public AddressingFeature(boolean enabled, boolean required, Responses responses) { this.enabled = enabled; @@ -268,7 +268,7 @@ public final class AddressingFeature extends WebServiceFeature { * {@link Responses#NON_ANONYMOUS} when endpoint requires the use * of only non-anonymous responses * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public Responses getResponses() { return responses; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOM.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOM.java index 995727497dd..da6714e9a7e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOM.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOM.java @@ -54,7 +54,7 @@ import javax.xml.ws.WebServiceProvider; * This annotation's behaviour is defined by the corresponding feature * {@link MTOMFeature}. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOMFeature.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOMFeature.java index a9581070088..232f98f91c2 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOMFeature.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/MTOMFeature.java @@ -54,7 +54,7 @@ import javax.xml.ws.Service; * The {@link #threshold} property can be used to set the threshold * value used to determine when binary data should be XOP encoded. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public final class MTOMFeature extends WebServiceFeature { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPBinding.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPBinding.java index 104de2c1e35..4b9d88887f4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPBinding.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPBinding.java @@ -34,7 +34,7 @@ import javax.xml.soap.MessageFactory; /** The SOAPBinding interface is an abstraction for * the SOAP binding. * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public interface SOAPBinding extends Binding { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPFaultException.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPFaultException.java index 0ac01421bc6..575f840801c 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPFaultException.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/soap/SOAPFaultException.java @@ -48,7 +48,7 @@ import javax.xml.soap.SOAPFault; * @see javax.xml.ws.soap.SOAPBinding#getSOAPFactory * @see javax.xml.ws.ProtocolException * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 **/ public class SOAPFaultException extends javax.xml.ws.ProtocolException { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Invoker.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Invoker.java index b581fba1919..de719cabf53 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Invoker.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Invoker.java @@ -43,7 +43,7 @@ import java.lang.reflect.InvocationTargetException; * * @see Provider#createEndpoint(String, Class, Invoker, WebServiceFeature...) * @author Jitendra Kotamraju - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public abstract class Invoker { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java index f881048ed20..8c8b802130f 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java @@ -41,7 +41,7 @@ import org.w3c.dom.Element; * Endpoint objects. *

    * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 */ public abstract class Provider { @@ -161,7 +161,7 @@ public abstract class Provider { * it must throw a WebServiceException. * @return The newly created service delegate. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public ServiceDelegate createServiceDelegate( java.net.URL wsdlDocumentLocation, @@ -218,7 +218,7 @@ public abstract class Provider { * @throws NullPointerException If the null * eprInfoset value is given. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract EndpointReference readEndpointReference(javax.xml.transform.Source eprInfoset); @@ -271,7 +271,7 @@ public abstract class Provider { * * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, @@ -333,7 +333,7 @@ public abstract class Provider { * @throws WebServiceException If an error occurs while creating the * W3CEndpointReference. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public abstract W3CEndpointReference createW3CEndpointReference(String address, QName serviceName, QName portName, List metadata, String wsdlDocumentLocation, List referenceParameters); @@ -407,7 +407,7 @@ public abstract class Provider { * * @throws WebServiceException If an error occurs while creating the * W3CEndpointReference. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public W3CEndpointReference createW3CEndpointReference(String address, QName interfaceName, QName serviceName, QName portName, @@ -434,7 +434,7 @@ public abstract class Provider { * endpoint. Supported features not in the features * parameter will have their default values. * @return The newly created endpoint. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public Endpoint createAndPublishEndpoint(String address, Object implementor, WebServiceFeature ... features) { @@ -455,7 +455,7 @@ public abstract class Provider { * endpoint. Supported features not in the features * parameter will have their default values. * @return The newly created endpoint. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public Endpoint createEndpoint(String bindingId, Object implementor, WebServiceFeature ... features) { @@ -478,7 +478,7 @@ public abstract class Provider { * endpoint. Supported features not in the features * parameter will have their default values. * @return The newly created endpoint. - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public Endpoint createEndpoint(String bindingId, Class implementorClass, Invoker invoker, WebServiceFeature ... features) { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/ServiceDelegate.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/ServiceDelegate.java index dd181754e36..1c47536cf3a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/ServiceDelegate.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/ServiceDelegate.java @@ -47,7 +47,7 @@ import javax.xml.ws.WebServiceException; * @see javax.xml.ws.Service * @see javax.xml.ws.spi.Provider * - * @since JAX-WS 2.0 + * @since 1.6, JAX-WS 2.0 */ public abstract class ServiceDelegate { @@ -119,7 +119,7 @@ public abstract class ServiceDelegate { * @see java.lang.reflect.InvocationHandler * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract T getPort(QName portName, Class serviceEndpointInterface, WebServiceFeature... features); @@ -194,7 +194,7 @@ public abstract class ServiceDelegate { * with this port or is unsupported. * * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract T getPort(EndpointReference endpointReference, Class serviceEndpointInterface, WebServiceFeature... features); @@ -256,7 +256,7 @@ public abstract class ServiceDelegate { * * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract T getPort(Class serviceEndpointInterface, WebServiceFeature... features); @@ -334,7 +334,7 @@ public abstract class ServiceDelegate { * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract Dispatch createDispatch(QName portName, Class type, Service.Mode mode, WebServiceFeature... features); @@ -406,7 +406,7 @@ public abstract class ServiceDelegate { * @see javax.xml.soap.SOAPMessage * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract Dispatch createDispatch(EndpointReference endpointReference, Class type, Service.Mode mode, @@ -462,7 +462,7 @@ public abstract class ServiceDelegate { * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract Dispatch createDispatch(QName portName, JAXBContext context, Service.Mode mode, WebServiceFeature... features); @@ -532,7 +532,7 @@ public abstract class ServiceDelegate { * @see javax.xml.bind.JAXBContext * @see WebServiceFeature * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 **/ public abstract Dispatch createDispatch(EndpointReference endpointReference, JAXBContext context, Service.Mode mode, diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/WebServiceFeatureAnnotation.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/WebServiceFeatureAnnotation.java index c99a4e88260..39c0f25e3c4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/WebServiceFeatureAnnotation.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/WebServiceFeatureAnnotation.java @@ -65,7 +65,7 @@ import javax.xml.ws.soap.MTOM; * @see MTOM * @see RespectBinding * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ @Target(ElementType.ANNOTATION_TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpContext.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpContext.java index aca0e3fb487..f62458455ac 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpContext.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpContext.java @@ -37,7 +37,7 @@ import java.util.Set; * web service requests to corresponding HttpContext objects. * * @author Jitendra Kotamraju - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public abstract class HttpContext { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpExchange.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpExchange.java index 233a48d084d..7b275ffb176 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpExchange.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpExchange.java @@ -46,7 +46,7 @@ import java.security.Principal; * is undefined. * * @author Jitendra Kotamraju - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public abstract class HttpExchange { diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpHandler.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpHandler.java index 8d11ea35c83..cafc48ee47e 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpHandler.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/HttpHandler.java @@ -36,7 +36,7 @@ import java.io.IOException; * {@link Endpoint#publish(HttpContext) } * * @author Jitendra Kotamraju - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public abstract class HttpHandler { /** diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/package-info.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/package-info.java index 87f37c76bb9..d105948e7f4 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/package-info.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/http/package-info.java @@ -90,6 +90,6 @@ @author Jitendra Kotamraju - @since JAX-WS 2.2 + @since 1.7, JAX-WS 2.2 */ package javax.xml.ws.spi.http; diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java index a1bc3e2b9c2..3d58a30159d 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReference.java @@ -61,7 +61,7 @@ import java.util.Map; * WS-Addressing * for more information on WS-Addressing EndpointReferences. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ // XmlRootElement allows this class to be marshalled on its own diff --git a/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java b/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java index 5538a1e0261..fb33746531a 100644 --- a/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java +++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java @@ -62,7 +62,7 @@ import javax.xml.ws.spi.Provider; * endpointName (if specified) MUST match a service and port * in the WSDL document. * - * @since JAX-WS 2.1 + * @since 1.6, JAX-WS 2.1 */ public final class W3CEndpointReferenceBuilder { /** @@ -110,6 +110,7 @@ public final class W3CEndpointReferenceBuilder { * @return A W3CEndpointReferenceBuilder instance with * the interfaceName as wsam:InterfaceName * element added to the wsa:Metadata element + * @since 1.7 */ public W3CEndpointReferenceBuilder interfaceName(QName interfaceName) { this.interfaceName = interfaceName; @@ -253,7 +254,7 @@ public final class W3CEndpointReferenceBuilder { * @throws java.lang.IllegalArgumentException if element * is null. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public W3CEndpointReferenceBuilder element(Element element) { if (element == null) { @@ -277,7 +278,7 @@ public final class W3CEndpointReferenceBuilder { * @throws java.lang.IllegalArgumentException if name * or value is null. * - * @since JAX-WS 2.2 + * @since 1.7, JAX-WS 2.2 */ public W3CEndpointReferenceBuilder attribute(QName name, String value) { if (name == null || value == null) { From 89e241569b393b35b6d993097e3076dcd9c08ce9 Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Tue, 8 Jul 2014 16:01:18 +0400 Subject: [PATCH 002/166] 8043126: move awt automated functional tests from AWT_Events/Lw and AWT_Events/AWT to OpenJDK repository Reviewed-by: pchelko --- .../ExtendedModifiersTest.java | 271 +++++++ .../KeyEvent/KeyMaskTest/KeyMaskTest.java | 219 ++++++ .../MouseButtonsAndKeyMasksTest.java | 302 ++++++++ .../MouseButtonsTest/MouseButtonsTest.java | 254 ++++++ .../MultipleMouseButtonsTest.java | 237 ++++++ .../event/helpers/lwcomponents/LWButton.java | 418 ++++++++++ .../helpers/lwcomponents/LWComponent.java | 464 +++++++++++ .../event/helpers/lwcomponents/LWList.java | 726 ++++++++++++++++++ 8 files changed, 2891 insertions(+) create mode 100644 jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java create mode 100644 jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java create mode 100644 jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java create mode 100644 jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java create mode 100644 jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java create mode 100644 jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java create mode 100644 jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java create mode 100644 jdk/test/java/awt/event/helpers/lwcomponents/LWList.java diff --git a/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java new file mode 100644 index 00000000000..f6b00c4c1cf --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8043126 + * @summary Check whether + * 1. correct extended modifiers are returned + * by KeyEvent.getModifiersEx() + * 2. InputEvent.getModifiersExText() returns + * correct extended modifier keys description + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 ExtendedModifiersTest + */ + + +import java.awt.*; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + + +public class ExtendedModifiersTest implements KeyListener { + + Frame frame; + + Button button; + LWButton buttonLW; + TextField textField; + TextArea textArea; + List list; + LWList listLW; + + private final ExtendedRobot robot; + private final static int robotDelay = 1000; + private final static int waitDelay = 5000; + private final static int keyDelay = 500; + + private final Object lock; + + private boolean keyPressedFlag = false; + + private int modifiersEx = 0; + private String exText = ""; + + + @Override + public void keyTyped(KeyEvent e) {} + + @Override + public void keyPressed(KeyEvent e) { + + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + return; + } + + modifiersEx = e.getModifiersEx(); + exText = InputEvent.getModifiersExText(modifiersEx); + keyPressedFlag = true; + + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void keyReleased(KeyEvent e) {} + + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("ExtendedModifiersTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addKeyListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addKeyListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addKeyListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addKeyListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addKeyListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addKeyListener(this); + frame.add(listLW); + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + public ExtendedModifiersTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + + private void runScenario(int keys[], int refMask) { + + if (keys.length < 1) { return; } + + for (int k = 0; k < keys.length; ++k) { + + keyPressedFlag = false; + robot.keyPress(keys[k]); + robot.delay(keyDelay); + + if (!keyPressedFlag) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + if (!keyPressedFlag) { + robot.keyRelease(keys[k]); + robot.delay(keyDelay); + assertTrue(false, "key press event was not received"); + } + } + + int modEx = modifiersEx & refMask; + + for (int k = keys.length - 1; k >=0; --k) { + robot.keyRelease(keys[k]); + robot.delay(keyDelay); + } + + + assertEQ(modifiersEx, modEx, "invalid extended modifiers"); + + for (int k = 0; k < keys.length; ++k) { + String keyText = KeyEvent.getKeyText(keys[k]).toLowerCase(); + assertTrue(exText.toLowerCase().contains(keyText), "invalid extended modifier keys description"); + } + + System.out.println(exText + " : passed"); + + robot.type(KeyEvent.VK_ESCAPE); + + robot.delay(robotDelay); + } + + private void doTest() throws Exception { + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println(OS); + + for (Component c: components) { + + String className = c.getClass().getName(); + System.out.println("component class : " + className); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + // 1. shift + control + runScenario(new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}, + InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 2. alt + shift + control + runScenario(new int[]{KeyEvent.VK_ALT, KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}, + InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 3. shift + runScenario(new int[]{KeyEvent.VK_SHIFT}, + InputEvent.SHIFT_DOWN_MASK); + + // 4. alt + control + runScenario(new int[]{KeyEvent.VK_ALT, KeyEvent.VK_CONTROL}, + InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 5. shift + alt + runScenario(new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_ALT}, + InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK); + + + if (OS.contains("os x") || OS.contains("sunos")) { + // 6. meta + runScenario(new int[]{KeyEvent.VK_META}, InputEvent.META_DOWN_MASK); + + // 7. shift + ctrl + alt + meta + runScenario(new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META}, + InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK); + + // 8. meta + shift + ctrl + runScenario(new int[]{KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}, + InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK); + + // 9. meta + shift + alt + runScenario(new int[]{KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_ALT}, + InputEvent.META_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK); + + // 10. meta + ctrl + alt + runScenario(new int[]{KeyEvent.VK_META, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT}, + InputEvent.META_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK); + } + } + + robot.waitForIdle(); + frame.dispose(); + } + + public static void main(String[] args) throws Exception { + ExtendedModifiersTest test = new ExtendedModifiersTest(); + test.doTest(); + } +} + diff --git a/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java new file mode 100644 index 00000000000..3400444ebbd --- /dev/null +++ b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8043126 + * @summary Check whether KeyEvent.getModifiers() returns correct modifiers + * when Ctrl, Alt or Shift keys are pressed. + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 KeyMaskTest + */ + + +import java.awt.*; +import java.awt.event.InputEvent; + +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + + + +public class KeyMaskTest extends KeyAdapter { + + Frame frame; + + Button button; + LWButton buttonLW; + TextField textField; + TextArea textArea; + List list; + LWList listLW; + + int buttonPressedNumber; + int buttonReleasedNumber; + + ExtendedRobot robot; + + private final static int robotDelay = 1500; + private final static int waitDelay = 3500; + + final Object lock; + + private boolean keyPressReceived = false; + private int keyCode = -1; + + KeyMaskTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("KeyMaskTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addKeyListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addKeyListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addKeyListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addKeyListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addKeyListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addKeyListener(this); + frame.add(listLW); + + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + @Override + public void keyPressed(KeyEvent e) { + + keyPressReceived = true; + + int code = e.getKeyCode(); + + assertEQ(code, keyCode, "wrong key code"); + + int mask = 0; + + if (code == KeyEvent.VK_SHIFT) { + mask = InputEvent.SHIFT_MASK; + } else if (code == KeyEvent.VK_CONTROL) { + mask = InputEvent.CTRL_MASK; + } else if (code == KeyEvent.VK_ALT) { + mask = InputEvent.ALT_MASK; + } else if (code == KeyEvent.VK_META) { + mask = InputEvent.META_MASK; + } + + int mod = e.getModifiers() & mask; + assertEQ(mod, mask, "invalid key mask"); + + synchronized (lock) { lock.notifyAll(); } + } + + + void doTest() throws Exception { + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + int keys[]; + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println(OS); + if (OS.contains("os x") || OS.contains("sunos")) { + keys = new int[] {KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META}; + } else { + keys = new int[] {KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT}; + } + + for (Component c: components) { + + System.out.print(c.getClass().getName() + ": "); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + for (int k = 0; k < keys.length; ++k) { + + keyPressReceived = false; + + keyCode = keys[k]; + + robot.type(keyCode); + + robot.delay(robotDelay); + + if (!keyPressReceived) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException e) {} + } + } + + assertTrue(keyPressReceived, "key press event was not received"); + } + + System.out.println("passed"); + } + + robot.waitForIdle(); + frame.dispose(); + } + + + public static void main(String[] args) throws Exception { + + KeyMaskTest test = new KeyMaskTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java new file mode 100644 index 00000000000..850679c6d44 --- /dev/null +++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; + + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + + +/* + * @test + * @bug 8043126 + * @summary Check whether MouseEvent.getModifiers(), MouseEvent.getModifiersEx() + * and KeyEvent.getModifiers() return correct modifiers when pressing + * keys Ctrl, Alt, Shift, Meta and mouse buttons sequentially + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 MouseButtonsAndKeyMasksTest + */ + +public class MouseButtonsAndKeyMasksTest implements MouseListener, KeyListener { + + Frame frame; + + Button button; + LWButton buttonLW; + TextField textField; + TextArea textArea; + List list; + LWList listLW; + + ExtendedRobot robot; + + private final static int robotDelay = 1500; + private final static int keyDelay = 500; + private final static int waitDelay = 5000; + + int modMouse = 0, modMouseEx = 0, modKey = 0, modAction = 0; + + boolean mousePressFired = false; + boolean keyPressFired = false; + + final Object lock; + + MouseButtonsAndKeyMasksTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("MouseButtonsAndKeysTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addKeyListener(this); + button.addMouseListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addKeyListener(this); + buttonLW.addMouseListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addKeyListener(this); + textField.addMouseListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addKeyListener(this); + textArea.addMouseListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addKeyListener(this); + list.addMouseListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addKeyListener(this); + listLW.addMouseListener(this); + frame.add(listLW); + + + frame.setBackground(Color.gray); + frame.setSize(500, 80); + frame.setVisible(true); + frame.toFront(); + } + + + @Override + public void mouseClicked(MouseEvent e) {} + + @Override + public void mousePressed(MouseEvent e) { + + modMouse = e.getModifiers(); + modMouseEx = e.getModifiersEx(); + mousePressFired = true; + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void mouseReleased(MouseEvent e) {} + @Override + public void mouseEntered(MouseEvent e) {} + @Override + public void mouseExited(MouseEvent e) {} + + + @Override + public void keyTyped(KeyEvent e) {} + + @Override + public void keyPressed(KeyEvent e) { + + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { return; } + + keyPressFired = true; + modKey = e.getModifiers(); + + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void keyReleased(KeyEvent e) {} + + void doTest() throws Exception { + + int buttons[] = new int[]{ + InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}; + + int buttonsEx[] = new int[]{ + InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK}; + + String OS = System.getProperty("os.name").toLowerCase(); + System.out.println(OS); + + int keyMods[], keyModsEx[], keys[]; + + + if (OS.contains("linux")) { + keyMods = new int[]{InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK}; + keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL}; + } else if (OS.contains("os x")) { + keyMods = new int[]{ + InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK, InputEvent.META_MASK}; + keyModsEx = new int[]{ + InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK, InputEvent.META_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META}; + } else if (OS.contains("sunos")) { + keyMods = new int[]{InputEvent.SHIFT_MASK, InputEvent.META_MASK}; + keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.META_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_META}; + } else { + keyMods = new int[]{ + InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK}; + keyModsEx = new int[]{ + InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK}; + keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT}; + } + + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + for (Component c: components) { + + System.out.println(c.getClass().getName() + ":"); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + for (int b = 0; b < buttons.length; ++b) { + + int btn = buttons[b]; + + for (int k = 0; k < keys.length; ++k) { + + int key = keys[k]; + + System.out.print(KeyEvent.getKeyText(key) + " + button " + (b + 1)); + + robot.delay(robotDelay); + + robot.keyPress(key); + robot.delay(keyDelay); + + if (!keyPressFired) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + if (!keyPressFired) { + robot.keyRelease(key); + assertTrue(false, "key press event was not received"); + } + + robot.mousePress(btn); + robot.delay(robotDelay); + + if (!mousePressFired) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(mousePressFired, "mouse press event was not received"); + + robot.mouseRelease(btn); + robot.delay(robotDelay); + + // do checks + assertEQ(modMouse & btn, btn, "invalid mouse button mask"); + assertEQ(modKey & keyMods[k], keyMods[k], "invalid key mask"); + assertEQ(buttonsEx[b] | keyModsEx[k], modMouseEx, "invalid extended modifiers"); + + mousePressFired = false; + keyPressFired = false; + + robot.keyRelease(key); + robot.delay(keyDelay); + + robot.type(KeyEvent.VK_ESCAPE); + + robot.delay(robotDelay); + + System.out.println(" - passed"); + } + } + } + + robot.waitForIdle(); + frame.dispose(); + } + + + public static void main(String[] args) throws Exception { + + MouseButtonsAndKeyMasksTest test = new MouseButtonsAndKeyMasksTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java new file mode 100644 index 00000000000..cc36b0c35b8 --- /dev/null +++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + +import java.util.ArrayList; + +import static jdk.testlibrary.Asserts.*; + +/* + * @test + * @bug 8043126 + * @summary Check whether getButton() returns correct mouse button + * number when the mouse buttons are pressed and getModifiers() + * returns correct modifiers + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 MouseButtonsTest + */ + +public class MouseButtonsTest implements MouseListener { + + private Frame frame; + + private Button button; + private LWButton buttonLW; + private TextField textField; + private TextArea textArea; + private List list; + private LWList listLW; + + private int buttonPressedNumber = 0; + private int buttonReleasedNumber = 0; + private int modifiers = 0; + + + private final ExtendedRobot robot; + + private final static int robotDelay = 1000; + private final static int waitDelay = 3500; + + private boolean released = false; + private boolean pressed = false; + private final Object lock; + + + MouseButtonsTest() throws Exception { + lock = new Object(); + robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + public void createGUI() { + + frame = new Frame(); + frame.setTitle("MouseButtonsTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addMouseListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addMouseListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addMouseListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addMouseListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addMouseListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addMouseListener(this); + frame.add(listLW); + + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + + @Override + public void mouseClicked(MouseEvent e) {} + + @Override + public void mousePressed(MouseEvent e) { + + assertFalse(e.getButton() == MouseEvent.NOBUTTON, "invalid button"); + + buttonPressedNumber = e.getButton(); + modifiers = e.getModifiers(); + + pressed = true; + + synchronized (lock) { + try { + lock.notifyAll(); + } catch (Exception ex) {} + } + } + + @Override + public void mouseReleased(MouseEvent e) { + + assertFalse(e.getButton() == MouseEvent.NOBUTTON, "invalid button"); + + buttonReleasedNumber = e.getButton(); + modifiers = e.getModifiers(); + + released = true; + + synchronized (lock) { + try { + lock.notifyAll(); + } catch (Exception ex) {} + } + } + + @Override + public void mouseEntered(MouseEvent e) {} + + @Override + public void mouseExited(MouseEvent e) {} + + + void doTest() throws Exception { + + int masks[] = new int[]{ + InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}; + + int buttons[] = new int[]{ + MouseEvent.BUTTON1, MouseEvent.BUTTON2, MouseEvent.BUTTON3}; + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + for (Component c: components) { + + System.out.println(c.getClass().getName() + ":"); + + Point origin = c.getLocationOnScreen(); + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.glide(origin, center); + robot.click(); + robot.delay(robotDelay); + + for (int i = 0; i < masks.length; ++i) { + + pressed = false; + released = false; + + int mask = masks[i]; + robot.mousePress(mask); + robot.delay(robotDelay); + + if (!pressed) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(pressed, "mouse press event was not received"); + assertEQ((modifiers & mask), mask, "invalid mask modifiers"); + + robot.mouseRelease(mask); + robot.delay(robotDelay); + + if (!released) { + synchronized (lock) { + try { + lock.wait(waitDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(released, "mouse release event was not received"); + assertEQ((modifiers & mask), mask, "invalid mask modifiers"); + + assertEquals(buttonPressedNumber, buttons[i]); + assertEquals(buttonReleasedNumber, buttons[i]); + + robot.type(KeyEvent.VK_ESCAPE); + robot.delay(robotDelay); + + System.out.println("button " + buttons[i] + " - passed"); + } + } + + robot.waitForIdle(); + frame.dispose(); + } + + + public static void main(String[] args) throws Exception { + + MouseButtonsTest test = new MouseButtonsTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java new file mode 100644 index 00000000000..df143b78c05 --- /dev/null +++ b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; + +import test.java.awt.event.helpers.lwcomponents.LWButton; +import test.java.awt.event.helpers.lwcomponents.LWList; + +import static jdk.testlibrary.Asserts.*; + +/* + * @test + * @bug 8043126 + * @summary Check whether correct modifiers set when multiple mouse buttons were pressed; + * check number of received events. + * + * @library ../../../../../lib/testlibrary/ ../../helpers/lwcomponents/ + * @build LWComponent + * @build LWButton + * @build LWList + * @build ExtendedRobot + * @run main/timeout=600 MultipleMouseButtonsTest + */ + + +public class MultipleMouseButtonsTest implements MouseListener { + + private final static int robotDelay = 1000; + + private final ExtendedRobot robot; + private final Object lock = new Object(); + + private Frame frame; + + private Button button; + private LWButton buttonLW; + private TextField textField; + private TextArea textArea; + private List list; + private LWList listLW; + + private int eventCount; + private int testCount; + private boolean pressed = false; + private int modifiers = 0; + private int modifiersEx = 0; + + private boolean countEvents = false; + + + public void createGUI() { + + frame = new Frame("MultipleMouseButtonTest"); + frame.setLayout(new GridLayout(1, 6)); + + button = new Button(); + button.addMouseListener(this); + frame.add(button); + + buttonLW = new LWButton(); + buttonLW.addMouseListener(this); + frame.add(buttonLW); + + textField = new TextField(5); + textField.addMouseListener(this); + frame.add(textField); + + textArea = new TextArea(5, 5); + textArea.addMouseListener(this); + frame.add(textArea); + + list = new List(); + for (int i = 1; i <= 5; ++i) { list.add("item " + i); } + list.addMouseListener(this); + frame.add(list); + + listLW = new LWList(); + for (int i = 1; i <= 5; ++i) { listLW.add("item " + i); } + listLW.addMouseListener(this); + frame.add(listLW); + + frame.setBackground(Color.gray); + frame.setSize(500, 100); + frame.setVisible(true); + frame.toFront(); + } + + @Override + public void mouseClicked(MouseEvent e) {} + @Override + public void mouseEntered(MouseEvent e) {} + @Override + public void mouseExited (MouseEvent e) {} + + @Override + public void mousePressed(MouseEvent e) { + + if (!countEvents) { return; } + + ++eventCount; + + pressed = true; + modifiers = e.getModifiers(); + modifiersEx = e.getModifiersEx(); + + synchronized (lock) { lock.notifyAll(); } + } + + @Override + public void mouseReleased(MouseEvent e) { + + if (countEvents) { + ++eventCount; + } + } + + MultipleMouseButtonsTest() throws Exception { + this.robot = new ExtendedRobot(); + EventQueue.invokeAndWait( this::createGUI ); + } + + void doTest() throws Exception { + + int masks[] = new int[]{InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, InputEvent.BUTTON3_MASK}; + int masksEx[] = new int[]{InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK}; + + robot.waitForIdle(); + + ArrayList components = new ArrayList(); + components.add(button); + components.add(buttonLW); + components.add(textField); + components.add(textArea); + components.add(list); + components.add(listLW); + + for (Component c: components) { + + System.out.println(c.getClass().getName() + ": "); + + Point origin = c.getLocationOnScreen(); + + int xc = origin.x + c.getWidth() / 2; + int yc = origin.y + c.getHeight() / 2; + Point center = new Point(xc, yc); + + robot.delay(robotDelay); + robot.mouseMove(origin); + robot.delay(robotDelay); + robot.glide(origin, center); + robot.delay(robotDelay); + robot.click(); + robot.delay(robotDelay); + + testCount = 0; + eventCount = 0; + + for (int i = 0; i < masks.length; ++i) { + + for (int k = 0; k < masks.length; ++k) { + if (k == i) { continue; } + + countEvents = false; + robot.mousePress(masks[i]); + robot.delay(robotDelay); + + countEvents = true; + + pressed = false; + + robot.mousePress(masks[k]); + robot.delay(robotDelay); + ++testCount; + + if (!pressed) { + synchronized (lock) { + try { + lock.wait(3 * robotDelay); + } catch (InterruptedException ex) {} + } + } + + assertTrue(pressed, "mouse press event was not received"); + + assertEQ(modifiers & masks[k], masks[k], "invalid modifiers"); + assertEQ(modifiersEx & masksEx[i], masksEx[i], "invalid extended modifiers"); + + robot.mouseRelease(masks[k]); + robot.delay(robotDelay); + ++testCount; + + countEvents = false; + + robot.mouseRelease(masks[i]); + robot.delay(robotDelay); + + robot.type(KeyEvent.VK_ESCAPE); + robot.delay(robotDelay); + } //k + } //i + + assertEquals(testCount, eventCount, "different amount of sent and received events"); + System.out.println("passed"); + } //component + + robot.waitForIdle(); + frame.dispose(); + } + + public static void main(String[] args) throws Exception { + + MultipleMouseButtonsTest test = new MultipleMouseButtonsTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java b/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java new file mode 100644 index 00000000000..866844e1ce7 --- /dev/null +++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java @@ -0,0 +1,418 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.java.awt.event.helpers.lwcomponents; + +import java.awt.*; +import java.awt.event.*; + +/** + * Lightweight Button component with some nice features. This + * component provides the capabilities of Buttons, namely that you it + * displays a label string and, when clicked, causes the + * ActionListener method to be called.

    + * + * The look of the button is a little unusual. There are three + * rectangles drawn at the border that indicate various states + * of the button. These are (listed from outside in)

    + *

      + *
    1. Focus: Indicates that the LWButton has the focus. + *
    2. Mouse Over: Indicates that the mouse is over the component. + *
    3. Mouse Pressed: Indicates that the mouse has been pressed. + *
    + * + * In addition, when the button has been activated (mouse clicked or + * via keyboard activation) the button flashes briefly. + */ + +public class LWButton extends LWComponent { + + /* + * The button's Label. + * If Label is not specified it will default to "". + * @serial + * @see getLabel() + * @see setLabel() + */ + private String label; + private boolean isInClick = false; + + private static final String base = "LWButton"; + private static int nameCounter = 0; + + private transient ActionListener actionListener; + + /* + * The action to be performaed once a button has been + * pressed. + * actionCommand can be null. + * @serial + * @see getActionCommand() + * @see setActionCommand() + */ + String actionCommand; + + Color colMousePressed; + + public LWButton() { this(""); } + + public LWButton(String label) { + this(label, Color.red, Color.green, Color.white); + } + + /** + * Initialize the LWButton, fully specifying all parameters. + * @param label The string to display. + * @param fgnd The color to draw the label in. + * @param bkgnd The color of the button itself. + * @param mousePressed The Color of the MousePressed rectangle. + */ + public LWButton(String label, Color fgnd, Color bkgnd, Color mousePressed) { + super(); + this.label = label; + setBackground(fgnd); + setForeground(bkgnd); + colMousePressed = mousePressed; + setName(makeComponentName()); + + enableEvents( AWTEvent.MOUSE_EVENT_MASK + | AWTEvent.KEY_EVENT_MASK + | AWTEvent.ACTION_EVENT_MASK); + setEnabled(true); + } + + /** + * Make the component flash briefly. + */ + public void flash() { + isInClick = true; + repaint(); + + class unClicker implements Runnable { + @Override + public void run() { + try { Thread.sleep(100); } catch (InterruptedException ee) {} + isInClick = false; + repaint(); + } + } + try { + unClicker uc = new unClicker(); + new Thread(uc).start(); + } catch (Exception e) { + // In case we're in an applet and the security has not been + // turned off (in which case we can't start a new thread) + // we can catch that and set the flag back to how it should be. + isInClick = false; + repaint(); + } + } + + /** + * Set the MousePressed color (the color shown in the MousePressed rectangle + * when the mouse is over the component). + * @param c The color of the MousePressed rectangle. + */ + public void setMousePressedColor(Color c) { colMousePressed = c; } + + /** + * Get the MousePressed color. + * @return The color of the MousePressed rectangle. + */ + public Color getMousePressedColor() { return colMousePressed; } + + /** + * Used to dispatch out the ActionEvent for a corresponding InputEvent. + * @param e The InputEvent that is causing the ActionEvent dispatch. + */ + private void sendActionEvent(InputEvent e) { + + int modifiers = e.getModifiers(); + int aModifiers = 0; + + if ((modifiers & MouseEvent.SHIFT_MASK) != 0) { + aModifiers |= ActionEvent.SHIFT_MASK; + } + if ((modifiers & MouseEvent.CTRL_MASK) != 0) { + aModifiers |= ActionEvent.CTRL_MASK; + } + if ((modifiers & MouseEvent.META_MASK) != 0) { + aModifiers |= ActionEvent.META_MASK; + } + if ((modifiers & MouseEvent.ALT_MASK) != 0) { + aModifiers |= ActionEvent.ALT_MASK; + } + + ActionEvent ae = new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, + actionCommand, + aModifiers); + // XXX: What's the right way to send out the ActionEvent? + // My assumption was to put it into the system event queue + // and the it will be dispatched back into processEvent + // for us. However this doesn't happen...? + if (actionListener != null) { + actionListener.actionPerformed(ae); + } + //Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae); + } + + /** + * Set whether the component is enabled ({@code true}) or not. + * @param enabled If {@code true}, the component is to be enabled. + */ + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + + if (enabled) { + enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } else { + disableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } + repaint(1); + } + + /** + * Indicates that LWButton component can receive focus. + * @return {@code true} if the LWButton component can receive focus + */ + @Override + public boolean isFocusTraversable() { return true; } + + /** + * Construct a name for this component. Called by getName() when the + * name is null. + */ + String makeComponentName() { + synchronized (getClass()) { + return base + nameCounter++; + } + } + + /** + * Handle painting the enabled version of the component. + * + * ASSUMES: g.color may be changed + */ + @Override + public void paint(Graphics g) { + + super.paint(g); + restrictGraphicsToClientArea(g); + + Dimension dim = getClientSize(); + + int s = Math.min(dim.width - 1, dim.height - 1); + + if (isInClick) { + g.setColor(Color.white); + } else { + g.setColor(getBackground()); + } + + // In jdk 1.2 (pre-release) there was a bug using clearRect + // to paint the background of a lightweight. + //g.clearRect(loc.x, loc.y, dim.width, dim.height); + g.fillRect(0, 0, dim.width, dim.height); + + if (mouseB1Pressed) { + g.setColor(colMousePressed); + //LWComponent.traceMsg("paint mousePressed " + this.toString()); + g.drawRect(1, 1, dim.width - 3, dim.height - 3); + } + + Font f = getFont(); + if (f != null) { + FontMetrics fm = getFontMetrics(f); + g.setColor(getForeground()); + g.drawString(label, + s/2 - fm.stringWidth(label)/2, + s/2 + fm.getMaxDescent()); + } + + unrestrictGraphicsFromClientArea(g); + } + + @Override + public Dimension getPreferredSize() { + Font f = getFont(); + if (f != null) { + FontMetrics fm = getFontMetrics(f); + int max = Math.max(fm.stringWidth(label) + 40, fm.getHeight() + 40); + return new Dimension(max, max); + } else { + return new Dimension(100, 100); + } + } + + @Override + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + /** + * Get the text displayed in the LWButton. + * @return the text displayed in the LWButton + */ + public String getText() { return label; } + + /** + * Set the text displayed in the LWButton. + * @param s The text to be displayed. + */ + public void setText(String s) { + Font f = getFont(); + int oWidth = 0; + int oHeight = 0; + int nWidth = 0; + int nHeight = 0; + int invalidated = 0; + FontMetrics fm = null; + + if (f != null) { + fm = getFontMetrics(f); + oWidth = fm.stringWidth(label); + oHeight = fm.getHeight(); + } + + this.label = s; + + if (f != null) { + nWidth = fm.stringWidth(label); + nHeight = fm.getHeight(); + + if ((nWidth > oWidth) || (nHeight > oHeight)) { + invalidate(); + invalidated = 1; + } + } + + if (invalidated == 0) { + repaint(); + } + } + + /** + * Set the command name for the action event fired + * by this button. By default this action command is + * set to match the label of the button. + * @param command A string used to set the button's + * action command. + * If the string is null then the action command + * is set to match the label of the button. + * @see java.awt.event.ActionEvent + * @since JDK1.1 + */ + public void setActionCommand(String command) { + actionCommand = command; + } + + /** + * Returns the command name of the action event fired by this button. + * If the command name is {@code null} (default) then this method + * returns the label of the button. + * + * @return the command name of the action event fired by this button + * or the label of the button (in case of {@code null}) + */ + public String getActionCommand() { + return (actionCommand == null? label : actionCommand); + } + + /** + * Add the specified action listener to receive action events from + * this button. Action events occur when a user presses or releases + * the mouse over this button. + * @param l the action listener. + * @see java.awt.event.ActionListener + * @see #removeActionListener + * @since JDK1.1 + */ + public synchronized void addActionListener(ActionListener l) { + actionListener = AWTEventMulticaster.add(actionListener, l); + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + /** + * Remove the specified action listener so that it no longer + * receives action events from this button. Action events occur + * when a user presses or releases the mouse over this button. + * @param l the action listener. + * @see java.awt.event.ActionListener + * @see #addActionListener + * @since JDK1.1 + */ + public synchronized void removeActionListener(ActionListener l) { + actionListener = AWTEventMulticaster.remove(actionListener, l); + } + + @Override + protected void processKeyEvent(KeyEvent e) { + super.processKeyEvent(e); + if (!isEnabled()) { return; } + switch(e.getID()) { + case KeyEvent.KEY_TYPED: + switch (e.getKeyCode()) { + case KeyEvent.VK_ENTER: + case KeyEvent.VK_SPACE: + flash(); + sendActionEvent(e); + break; + } + break; + } + } + + @Override + protected void processMouseEvent(MouseEvent e) { + super.processMouseEvent(e); + if (!isEnabled()) { return; } + switch(e.getID()) { + case MouseEvent.MOUSE_PRESSED: + requestFocus(); + repaint(); + break; + case MouseEvent.MOUSE_RELEASED: + repaint(); + break; + case MouseEvent.MOUSE_CLICKED: + if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) { + flash(); + sendActionEvent(e); + } + break; + } + } + + /** + * Returns the parameter string representing the state of this + * button. This string is useful for debugging. + * @return the parameter string of this button. + */ + @Override + protected String paramString() { + return super.paramString() + ", label = " + label; + } + +} diff --git a/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java b/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java new file mode 100644 index 00000000000..2209d0c107a --- /dev/null +++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java @@ -0,0 +1,464 @@ +/* + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.java.awt.event.helpers.lwcomponents; + +import java.io.*; +import java.awt.*; +import java.awt.event.*; + +/** + * This is experimental - The idea is to subclass all the LW components + * from LWComponent to provide for some common capabilities. The main + * capability to be provided is the status rectangles as done for LWButton. + * In particular the Focus and MouseOver rectangles are generically + * useful, while other rectangles might be useful to other components.

    + * + * To implement that, here is the idea ... borrowed from Win32 ... Each + * of the LW components has both a client and non-client region. We + * call paintNC to paint the non-client region (Focus and MouseOver + * rectangles), and the subclass might be permitted to implement paintNC + * but for now they aren't.

    + * + * Then the paint{Enabled,Disabled} methods are called as appropriate. + * Note that paintDisabled is implemented in LWComponent to call paintEnabled + * then stipple over the top of it.

    + * + * So it is paintEnabled that the component should implement. This method + * needs to know the dimensions of the client area (getClientRegion?) and + * the Graphics needs to have it's clip region set appropriately.

    + * + * KVETCHING: Kvetch is a Yiddish word which means, basically, + * to complain very precisely. The LWComponent family tracks various pieces + * of information over time that are used to check closely for correct behavior + * in some circumstances. The method kvetch is where this code lives + * and is intended to check a broad range of conditions.

    + * + * To turn off specific kvetch's, one simply specifies a System property + * as in this table:

    + * + * + * + * + * + * + * + * + *
    Property nameValueDiscussion
    javasoft.awtsqe.lw.IGNORE_FOCUS_KVETCHtrue or falseSpecify whether the hasFocus kvetch is checked.

    + * + * XXX To implement - specifying colors. NCBackground, + * FocusRectColor, MouseOverColor are the threee colors. paintNC + * fills the NC region with NCBackground, and then pains the two + * colors as appropriate. There needs to be methods to get/specify + * these colors.

    + * + * XXX To implement - Specifying the component name and toString(). + * The subclass should only give the base class name, and a method + * in LWComponent should construct a name from that. For toString() + * there needs to be a small amount of infrastructure built.

    + */ + +public abstract class LWComponent extends Component { + + protected static Color ncBackgroundColor; + protected static Color focusColor; + protected static Color focusWrongColor; + protected static Color mouseOverColor; + + static { + ncBackgroundColor = Color.white; + focusColor = Color.black; + focusWrongColor = Color.magenta; + mouseOverColor = Color.blue; + } + + /** + * Flag indicating whether our records indicate that the component + * should have focus. + */ + protected boolean _shouldHaveFocus = false; + protected boolean _shouldBeShowing = false; + + protected boolean mouseB1Pressed = false; + protected boolean mouseB2Pressed = false; + protected boolean mouseB3Pressed = false; + protected boolean mouseInside = false; + + protected static boolean tracingOn = false; + protected static PrintStream traceOutput = null; + + // Uncommenting these lines turns on tracing for the package. + // static { + // tracingOn = true; + // traceOutput = System.err; + // } + + public LWComponent() { + enableEvents(AWTEvent.MOUSE_EVENT_MASK + /*| AWTEvent.MOUSE_MOTION_EVENT_MASK*/ + | AWTEvent.FOCUS_EVENT_MASK + | AWTEvent.COMPONENT_EVENT_MASK); + } + + /** + * Print out an error message. + * @param msg the message + */ + public static void errorMsg(String msg) { + System.err.println("ERROR: " + msg); + } + + /** + * Print out a tracing message + * @param msg the message + */ + public static void traceMsg(String msg) { + if (LWComponent.tracingOn) { + LWComponent.traceOutput.println(msg); + } + } + + ///////////////////////////////////////////// + /////// FLAGS FOR IGNORING KVETCH's ///////// + ///////////////////////////////////////////// + + static boolean bIgnFocus = false; + + static { + // Initialize the kvetch ignoring flags here. + String ignFocus = System.getProperty("javasoft.awtsqe.lw.IGNORE_FOCUS_KVETCH", + "false"); + bIgnFocus = ignFocus.trim().toLowerCase().equals("true"); + } + + /** + * Check the shoulds and return a string indicating which + * do not match the components actual state. + * + * @return the string indicating which do not match the components actual state + */ + public String kvetch() { + String ret = this.toString(); + boolean errors = false; + + if (!bIgnFocus) { + if (hasFocus()) { + if (!shouldHaveFocus()) { + ret += "\nERROR: hasFocus indicates we have Focus, when we shouldn't."; + errors = true; + } + } else { + if (shouldHaveFocus()) { + ret += "\nERROR: (see bug#4233658) hasFocus does not indicate we have Focus, when we should."; + errors = true; + } + } + } + + if (errors) { + return ret; + } else { + return null; + } + } + + /** + * Check the shoulds and return a string indicating which + * do not match the components actual state. Prints the output + * to the given PrintStream. + * @param out The PrintStream to print to. + */ + public void kvetch(PrintStream out) { + if (out != null) { + String s = kvetch(); + if (s != null) { + LWComponent.errorMsg(s); + } + } + } + + /** + * Turn on tracing for the LWComponent family. + * @param out the output stream + */ + public static void startTracing(PrintStream out) { + tracingOn = true; + traceOutput = out; + } + + /** + * Turn off tracing for the LWComponent family. + */ + public static void stopTracing() { tracingOn = false; traceOutput = null; } + + /** + * Indicate whether it is believed the component should have focus. + * @return {@code true} if the component should have focus + */ + public boolean shouldHaveFocus() { return _shouldHaveFocus; } + + /** + * Indicate whether it is believed the component should be showing. + * @return {@code true} if the component should be showing + */ + public boolean shouldBeShowing() { return _shouldBeShowing; } + + @Override + protected void processFocusEvent(FocusEvent e) { + super.processFocusEvent(e); + LWComponent.traceMsg("processFocusEvent " + e.toString()); + switch (e.getID()) { + case FocusEvent.FOCUS_GAINED: + _shouldHaveFocus = true; + repaint(); + break; + case FocusEvent.FOCUS_LOST: + _shouldHaveFocus = false; + repaint(); + break; + } + } + + @Override + protected void processComponentEvent(ComponentEvent e) { + super.processComponentEvent(e); + LWComponent.traceMsg("processComponentEvent " + e.toString()); + switch (e.getID()) { + case ComponentEvent.COMPONENT_MOVED: break; + case ComponentEvent.COMPONENT_RESIZED: break; + case ComponentEvent.COMPONENT_SHOWN: _shouldBeShowing = true; break; + case ComponentEvent.COMPONENT_HIDDEN: _shouldBeShowing = false; break; + } + } + + @Override + protected void processMouseEvent(MouseEvent e) { + int mod = e.getModifiers(); + super.processMouseEvent(e); + LWComponent.traceMsg("processMouseEvent " + e.toString()); + switch (e.getID()) { + case MouseEvent.MOUSE_PRESSED: + if ((mod & MouseEvent.BUTTON1_MASK) != 0) { + if (mouseB1Pressed) { + errorMsg("ERROR: MOUSE_PRESSED for B1 when already pressed, on " + + this.toString()); + } + mouseB1Pressed = true; + break; + } + if ((mod & MouseEvent.BUTTON2_MASK) != 0) { + if (mouseB2Pressed) { + errorMsg("ERROR: MOUSE_PRESSED for B2 when already pressed, on " + + this.toString()); + } + mouseB2Pressed = true; + break; + } + if ((mod & MouseEvent.BUTTON3_MASK) != 0) { + if (mouseB3Pressed) { + errorMsg("ERROR: MOUSE_PRESSED for B3 when already pressed, on " + + this.toString()); + } + mouseB3Pressed = true; + break; + } + repaint(); + break; + case MouseEvent.MOUSE_RELEASED: + if ((mod & MouseEvent.BUTTON1_MASK) != 0) { + if (!mouseB1Pressed) { + errorMsg("ERROR: MOUSE_RELEASED for B1 when not pressed, on " + + this.toString()); + } + mouseB1Pressed = false; + break; + } + if ((mod & MouseEvent.BUTTON2_MASK) != 0) { + if (!mouseB2Pressed) { + errorMsg("ERROR: MOUSE_RELEASED for B2 when not pressed, on " + + this.toString()); + } + mouseB2Pressed = false; + break; + } + if ((mod & MouseEvent.BUTTON3_MASK) != 0) { + if (!mouseB3Pressed) { + errorMsg("ERROR: MOUSE_RELEASED for B3 when not pressed, on " + + this.toString()); + } + mouseB3Pressed = false; + break; + } + repaint(); + break; + case MouseEvent.MOUSE_CLICKED: + break; + case MouseEvent.MOUSE_ENTERED: + if (mouseInside) { + errorMsg("ERROR: MOUSE_ENTERED when mouse already inside component, on " + + this.toString()); + } + mouseInside = true; + repaint(); + break; + case MouseEvent.MOUSE_EXITED: + if (!mouseInside) { + errorMsg("ERROR: MOUSE_EXITED when mouse not inside component, on " + + this.toString()); + } + mouseInside = false; + repaint(); + break; + case MouseEvent.MOUSE_MOVED: + break; + case MouseEvent.MOUSE_DRAGGED: + break; + } + } + + public Point getClientLocation() { + return new Point(5, 5); + } + + public Dimension getClientSize() { + Dimension dim = getSize(); + dim.width -= 10; + dim.height -= 10; + return dim; + } + + public Rectangle getClientBounds() { + Dimension dim = getClientSize(); + return new Rectangle(5, 5, dim.width, dim.height); + } + + public int getClientX() { return 5; } + public int getClientY() { return 5; } + + /** + * Set the color used for painting the non-client area of the component. + * The default for this is Color.white. + * + * @param c The new color to use. + */ + public void setNonClientColor(Color c) { + LWComponent.ncBackgroundColor = c; + } + + /** + * Handle painting for the component. + */ + @Override + public void paint(Graphics g) { + Dimension dim = getSize(); + + kvetch(System.err); + + Color saveColor = g.getColor(); + super.paint(g); + + // ------------------- Paint the background ----------------- + + // In jdk 1.2 (pre-release) there was a bug using clearRect + // to paint the background of a lightweight. + //g.clearRect(0, 0, dim.width, dim.height); + g.setColor(getBackground()); + g.fillRect(0, 0, dim.width, dim.height); + + // ------------------- Paint the non-client area ------------ + + g.setColor(ncBackgroundColor); + // x y width height + g.fillRect(0, 0, dim.width, 5); + g.fillRect(0, 5, 5, dim.height - 10); + g.fillRect(dim.width - 5, 5, 5, dim.height - 10); + g.fillRect(0, dim.height - 5, dim.width, 5); + + if (shouldHaveFocus() || hasFocus()) { + g.setColor(shouldHaveFocus() && hasFocus() + ? focusColor + : focusWrongColor); + g.drawRect(1, 1, dim.width - 3, dim.height - 3); + } + + if (mouseInside) { + g.setColor(mouseOverColor); + g.drawRect(3, 3, dim.width - 7, dim.height - 7); + } + + // ------------------- Paint disabledness, if true ----------- + + if (!isEnabled()) { + g.setColor(getBackground()); + Dimension size = getSize(); + int borderThickness = 0; + int startX = borderThickness; + int startY = borderThickness; + int endX = startX + size.width - 2 * borderThickness - 2; + int endY = startY + size.height - 2 * borderThickness - 2; + int x, y; + for (y = startY; y <= endY; y += 1) { + for (x = startX + (y % 2); x <= endX; x += 2) { + g.fillRect(x, y, 1, 1); + } // x + } // y + } + + g.setColor(saveColor); + } + + /** + * Restricts the Graphics to be within the "client area" of the + * component. Recall that the LWComponent series of components has + * a "non-client area" of 5 pixels wide in which it draws two + * status rectangles showing mouse-over and has-focus status.

    + * + * Child classes of LWComponent are to call {@code restrictGraphicsToClientArea} + * at the beginning of their {@code paint} method, and then call + * {@code unrestrictGraphicsFromClientArea} afterwards.

    + * + * In order to make those paint methods as convenient as possible, these + * two methods make it appear as if the Graphics available to the + * component is slightly smaller than it really is, by the amount + * used in the non-client area (5 pixel wide border).

    + * + * @param g The Graphics to restrict. + */ + public void restrictGraphicsToClientArea(Graphics g) { + Dimension dim = getSize(); + g.translate(5, 5); + g.setClip(0, 0, dim.width - 10, dim.height - 10); + } + + /** + * Undo the restriction done in restrictGraphicsToClientArea. + * + * @param g The Graphics to unrestrict. + */ + public void unrestrictGraphicsFromClientArea(Graphics g) { + g.translate(-5, -5); + Dimension dim = getSize(); + g.setClip(0, 0, dim.width, dim.height); + } + +} diff --git a/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java b/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java new file mode 100644 index 00000000000..d08a3141340 --- /dev/null +++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java @@ -0,0 +1,726 @@ +/* + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package test.java.awt.event.helpers.lwcomponents; + +import java.awt.*; +import java.awt.event.*; +import java.util.Vector; +import java.util.Enumeration; + +/** + * Remarks : Source for LightWeight component - List. + * + * Scroll bar support is not available for this component, so if the + * items exceeds visibility those items will be truncated. Also, here + * double buffering is not used so there will be little bit flickering + * while it repaints. Item listener support is not enabled in this + * component. Listeners handled were Mouse, Key and Focus. + * + * @author R.Govindarajan (govind@siptech.co.in), G.N.V.Sekhar (sekharv@siptech.co.in) + */ + +public class LWList extends LWComponent implements ItemSelectable { + + // Constants used for component size + private final int MIN_WIDTH = 100; + private final int MIN_HEIGHT = 100; + private final int PREF_WIDTH = 100; + private final int PREF_HEIGHT = 100; + + // Constants used for setting color for component + private final Color BACK_COLOR = Color.white; + private final Color FRONT_COLOR = Color.black; + private final Color BORDER_COLOR = Color.darkGray; + private final Color FOCUS_COLOR = Color.blue; + private final Color FOCUS_FORECOLOR = Color.white; + private final Color FOCUS_ENABLED_COLOR = Color.red; + private final int BORDER_WIDTH = 2; + + private Vector stringList; // List of items + private Vector selList; // List of selected items + private int rows; // Visible rows + private int focusIndex, prevfocusIndex; + private Dimension minSize; + private Dimension prefSize; + private boolean pressed, eventOccurred, focusEnabled; + private boolean multipleMode; + + // Listeners handled for this component + private ActionListener actionListener; + private KeyListener keyListener; + private FocusListener focusListener; + private ItemListener itemListener; + + private static int nameCounter = 0; + + /** + * Creates a new list. + */ + public LWList() { + this(0); + } + + /** + * Creates a new list with the specified number of rows; + * multiple selection mode is disabled. + * + * @param i the number of rows + */ + public LWList(int i) { + this(i, false); + } + + /** + * Creates a new list with the specified number of rows and multiple selection mode. + * + * @param rows the number of rows + * @param flag determines whether the list allows multiple selections + */ + public LWList(int rows, boolean flag) { + multipleMode = flag; + this.rows = rows; + minSize = new Dimension(MIN_WIDTH, MIN_HEIGHT); + prefSize = new Dimension(PREF_WIDTH, PREF_HEIGHT); + stringList = new Vector(); + selList = new Vector(); + selList.addElement(0); + focusIndex = -1; + prevfocusIndex = focusIndex; + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + enableEvents(AWTEvent.KEY_EVENT_MASK); + enableEvents(AWTEvent.FOCUS_EVENT_MASK); + enableEvents(AWTEvent.ITEM_EVENT_MASK); + setName(makeComponentName()); // set the name to the component + } + + String makeComponentName() { + String s = "LWList" + nameCounter++; + return s; + } + + /** + * Set whether the component is enabled or not. + * @param enabled if {@code true}, the component is to be enabled + */ + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + + if (enabled) { + enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } else { + disableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); + } + repaint(1); + } + + /** + * Set the selection mode. + * + * @param flag determines whether the list allows multiple selections + */ + public void setSelectionMode(boolean flag) { + multipleMode = flag; + } + + /** + * Check if the list allows multiple selections. + * + * @return {@code true} if the list allows multiple selections + */ + public boolean isMultipleMode() { + return multipleMode; + } + + /** + * Add the specified item. + * + * @param listItem the item + */ + public void add(String listItem) { + stringList.addElement(listItem); + invalidate(); + repaint(); + } + + /** + * Get minimum dimension for the list. + * + * @return the minimum dimensions for displaying + */ + @Override + public Dimension getMinimumSize() { + return minSize; + } + + /** + * Get the preferred size of the list. + * + * @return the preferred dimensions for displaying + */ + @Override + public Dimension getPreferredSize() { + return prefSize; + } + + /** + * Get the background color for the component. + * + * @return the background color for the component + */ + @Override + public Color getBackground() { + return BACK_COLOR; + } + + /** + * Get the foreground color for the component. + * + * @return the foreground color for the component + */ + @Override + public Color getForeground() { + return FRONT_COLOR; + } + + /** + * Get the border color for the component. + * + * @return the border color for the component + */ + public Color getBorder() { + return BORDER_COLOR; + } + + /** + * Get background color for the selected item. + * + * @return the color for the selected item + */ + public Color getFocusColor() { + return FOCUS_COLOR; + } + + /** + * Get foreground color for the selected item. + * + * @return the foreground color for the selected item + */ + public Color getFocusForeColor() { + return FOCUS_FORECOLOR; + } + + /** + * Get a "focus enabled" color - a small rectangle around the item + * should be drawn when the component got the focus. + * + * @return the "focus enabled" color + */ + public Color getFocusEnabledColor() { + return FOCUS_ENABLED_COLOR; + } + + /** + * Get border width. + * + * @return the border width + */ + public int getBorderWidth() { + return BORDER_WIDTH; + } + + /** + * Get the list item count. + * + * @return the count of items + */ + public int getItemCount() { + return stringList.size(); + } + + /** + * Get the specified item from the list. + * + * @param index the index + * @return the item string + */ + public String getItem(int index) { + return (String)stringList.elementAt(index); + } + + /** + * Get array of items from the list. + * + * @return the array of item strings + */ + public String[] getItems() { + String str[] = new String[getItemCount()]; + int count = 0; + for (Enumeration e = stringList.elements(); e.hasMoreElements(); ) { + str[count++] = (String)e.nextElement(); + } + return str; + } + + /** + * Check whether the component can be a focus owner (explicitly enabled here). + * + * @return {@code true} if the component is focusable + */ + @Override + public boolean isFocusTraversable() { + return true; + } + + /** + * Check whether mouse click point lies within the list of items. + * + * @param pt the click point + * @return {@code true} if the click point lies within the list of items + */ + @Override + public boolean contains(Point pt) { + Rectangle rect = new Rectangle(); + Dimension d = getSize(); + rect.x = getBorderWidth(); + rect.y = getBorderWidth(); + rect.width = d.width - (getBorderWidth() * 2); + rect.height = d.height - (getBorderWidth() * 2); + return rect.contains(pt); + } + + /** + * Given a click point the item that has to be selected is found from the list + * and focusIndex variable is set accordingly. + * + * @param pt the click point + */ + private void findSelectedIndex(Point pt) { + Font f = getFont(); + FontMetrics fm = getFontMetrics(f); + focusIndex = pt.y / fm.getHeight() - 1; + if (multipleMode) { + Integer fi = focusIndex; + if (selList.contains(fi)) { + int i = selList.indexOf(fi); + selList.removeElementAt(i); + } else { + selList.addElement(fi); + } + } + } + + /** + * Set index of the selected item. + * + * @param index the index + */ + public void setSelectedIndex(int index) { + prevfocusIndex = focusIndex; + focusIndex = index; + } + + /** + * Get the selected item index. + * + * @return the selected item index. + */ + public int getSelectedIndex() { + return focusIndex; + } + + /** + * Get an array of the selected Objects. + * + * @return array of the Objects + */ + @Override + public Object[] getSelectedObjects() { + int ai[] = getSelectedIndexes(); + Object aobj[] = new Object[selList.size()]; + for (int i = 0; i < selList.size(); i++) { + aobj[i] = stringList.elementAt(ai[i]); + } + return aobj; + } + + /** + * Get an array of the selected item indices. + * + * @return the array of the indices + */ + public int[] getSelectedIndexes() { + int ai[] = new int[selList.size()]; + for (int i = 0; i < selList.size(); i++) { + ai[i] = ((Integer)selList.elementAt(i)); + } + return ai; + } + + /** + * Add the specified item listener to receive item events from the list. + * + * @param itemlistener the item listener + */ + @Override + public synchronized void addItemListener(ItemListener itemlistener) { + itemListener = AWTEventMulticaster.add(itemListener, itemlistener); + enableEvents(AWTEvent.ITEM_EVENT_MASK); + } + + /** + * Remove the specified item listener so + * that it no longer receives item events from this list. + * + * @param itemlistener the item listener + */ + @Override + public synchronized void removeItemListener(ItemListener itemlistener) { + itemListener = AWTEventMulticaster.remove(itemListener, itemlistener); + } + + /** + * Add the specified action listener to receive action events from this list. + * + * @param listener the action listener + */ + public synchronized void addActionListener(ActionListener listener) { + actionListener = AWTEventMulticaster.add(actionListener, listener); + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + /** + * Remove the specified action listener so + * that it no longer receives action events from this list. + * + * @param listener the action listener + */ + public synchronized void removeActionListener(ActionListener listener) { + actionListener = AWTEventMulticaster.remove(actionListener, listener); + } + + /** + * Add the specified key listener to receive key events from this component. + * + * @param listener the key listener + */ + @Override + public synchronized void addKeyListener(KeyListener listener) { + keyListener = AWTEventMulticaster.add(keyListener, listener); + enableEvents(AWTEvent.KEY_EVENT_MASK); + } + + /** + * Remove the specified key listener so + * that it no longer receives key events from this component. + * + * @param listener the key listener + */ + @Override + public synchronized void removeKeyListener(KeyListener listener) { + keyListener = AWTEventMulticaster.remove(keyListener, listener); + } + + /** + * Add the specified focus listener to receive focus events + * from this component when it gains input focus. + * + * @param listener the focus listener + */ + @Override + public synchronized void addFocusListener(FocusListener listener) { + focusListener = AWTEventMulticaster.add(focusListener, listener); + enableEvents(AWTEvent.FOCUS_EVENT_MASK); + } + + /** + * Remove the specified focus listener so + * that it no longer receives focus events from this component. + * + * @param listener the focus listener + */ + @Override + public synchronized void removeFocusListener(FocusListener listener) { + focusListener = AWTEventMulticaster.remove(focusListener, listener); + } + + @Override + protected void processEvent(AWTEvent awtevent) { + + if (awtevent instanceof FocusEvent) { + processFocusEvent((FocusEvent)awtevent); + } else if (awtevent instanceof ItemEvent) { + processItemEvent((ItemEvent)awtevent); + } else if (awtevent instanceof KeyEvent) { + processKeyEvent((KeyEvent)awtevent); + } else if (awtevent instanceof MouseEvent) { + switch (awtevent.getID()) { + case MouseEvent.MOUSE_CLICKED: + case MouseEvent.MOUSE_PRESSED: + case MouseEvent.MOUSE_RELEASED: + case MouseEvent.MOUSE_ENTERED: + case MouseEvent.MOUSE_EXITED: + processMouseEvent((MouseEvent)awtevent); + break; + + case MouseEvent.MOUSE_MOVED: + case MouseEvent.MOUSE_DRAGGED: + super.processEvent((MouseEvent)awtevent); + break; + } + } else { + if (awtevent instanceof ComponentEvent) + super.processComponentEvent((ComponentEvent)awtevent); + else + super.processEvent(awtevent); + } + } + + protected void processItemEvent(ItemEvent itemevent) { + if (itemListener != null) { + itemListener.itemStateChanged(itemevent); + } + } + + @Override + protected void processFocusEvent(FocusEvent e) { + switch (e.getID()) { + case FocusEvent.FOCUS_GAINED: + if (focusListener != null) { focusListener.focusGained(e); } + if (getSelectedIndex() == -1) { setSelectedIndex(0); } + focusEnabled = true; + repaint(); + break; + case FocusEvent.FOCUS_LOST: + if (focusListener != null) { + focusListener.focusLost(e); + } + focusEnabled = false; + repaint(); + break; + } + super.processFocusEvent(e); + } + + @Override + protected void processKeyEvent(KeyEvent e) { + rows = getItemCount(); + + switch (e.getID()) { + + case KeyEvent.KEY_TYPED: + if (keyListener != null) { + keyListener.keyTyped(e); + } + break; + + case KeyEvent.KEY_PRESSED: + if (keyListener != null) { + keyListener.keyPressed(e); + } + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + prevfocusIndex = focusIndex; + int index = getSelectedIndex() + 1; + if (index > rows) { break; } + setSelectedIndex(index); + processItemEvent(new ItemEvent(this, 0, index, 0)); + eventOccurred = true; + repaint(); + } else if (e.getKeyCode() == KeyEvent.VK_UP) { + int index = getSelectedIndex()-1; + if (index >= 0) { + setSelectedIndex(index); + if (e.getID() != 400) { + processItemEvent(new ItemEvent(this, 0, index, 0)); + } + eventOccurred = true; + repaint(); + } + } + break; + + case KeyEvent.KEY_RELEASED: + if (keyListener != null) { + keyListener.keyReleased(e); + } + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + eventOccurred = true; + + // ActionEvent is fired here + if (actionListener != null) { + actionListener.actionPerformed( new ActionEvent( + this, ActionEvent.ACTION_PERFORMED, null)); + } + repaint(); + } + break; + } // switch + super.processKeyEvent(e); + } + + @Override + protected void processMouseEvent(MouseEvent e) { + switch (e.getID()) { + case MouseEvent.MOUSE_PRESSED: + pressed = true; + if (contains(e.getPoint())) { + findSelectedIndex(e.getPoint()); + processItemEvent(new ItemEvent(this, 0, focusIndex, 0)); + eventOccurred = true; + } + repaint(); + break; + + case MouseEvent.MOUSE_RELEASED: + if (pressed) { requestFocus(); } + + if (contains(e.getPoint())) { + findSelectedIndex(e.getPoint()); + eventOccurred = true; + } + // ActionEvent is fired here + if (actionListener != null) { + actionListener.actionPerformed(new ActionEvent( + this, ActionEvent.ACTION_PERFORMED, null)); + } + + if (pressed) { + pressed = false; + repaint(); + } + break; + } + super.processMouseEvent(e); + } + + @Override + /** + * Paint the list. + * + * @param g the graphics context to be used for testing + */ + public void paint(Graphics g) { + super.paint(g); + restrictGraphicsToClientArea(g); + + Point loc = getClientLocation(); + Dimension dim = getClientSize(); + Color prevColor = g.getColor(); + + // List border is drawn here + g.setColor(getBackground()); + g.fillRect(0, 0, dim.width - 2, dim.height - 2); + g.setColor(getBorder()); + g.drawRect(0, 0, dim.width - 2, dim.height - 2); + + if (getItemCount() > 0) { + Font f = getFont(); + if (f != null) { + String str[] = getItems(); + FontMetrics fm = getFontMetrics(f); + int drawRow = loc.x + getBorderWidth() + fm.getAscent(); + int drawCol = loc.y + getBorderWidth(); + int rectRow = loc.y + getBorderWidth(); + int i = 0; + + // Draw items (if the items exceeds visibility those items will be truncated + // as scrollbar support is not enabled + + for (; + i < str.length && drawRow < (dim.height - getBorderWidth()); + i++) { + if (fm.stringWidth(str[i]) < (dim.width - (getBorderWidth() * 2))) { + drawItem(g, i, drawCol, drawRow, rectRow, fm); + drawRow += fm.getHeight(); + rectRow += fm.getHeight(); + } else { + LWComponent.errorMsg("string width exceeds list width"); + LWComponent.errorMsg("Horizontal scrollbar support is not available"); + } + } // for + + if ( (drawRow > (dim.height - getBorderWidth())) && (str.length > i) ) { + //LWComponent.errorMsg("no of strings exceeds list height"); + //LWComponent.errorMsg("Vertical scrollbar support is not available"); + } + } else { LWComponent.errorMsg("Font not available.."); } + } + + eventOccurred = false; + g.setColor(prevColor); + unrestrictGraphicsFromClientArea(g); + } + + // Draw String items + private void drawItem(Graphics g, int listIndex, int drawCol, + int drawRow, int rectRow, FontMetrics fm) { + Point loc = getClientLocation(); + Dimension dim = getClientSize(); + String str = getItem(listIndex); + if (multipleMode) { + for (int i1 = 0; i1 < selList.size(); i1++) { + if (listIndex == ((Integer)selList.elementAt(i1))) { + g.setColor(getFocusColor()); + g.fillRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + g.setColor(getFocusEnabledColor()); + g.drawRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + } + } // for + } else { + if (listIndex == getSelectedIndex() && !multipleMode) { + g.setColor(getFocusColor()); + g.fillRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + g.setColor(getFocusForeColor()); + } + if ((listIndex == prevfocusIndex) && (prevfocusIndex != getSelectedIndex()) && !multipleMode) { + g.setColor(getBackground()); + g.fillRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + prevfocusIndex = getSelectedIndex(); + } + if (focusEnabled && listIndex == getSelectedIndex() && !multipleMode) { + g.setColor(getFocusEnabledColor()); + g.drawRect(loc.x + getBorderWidth(), + rectRow, + dim.width - getBorderWidth() * 2, + fm.getHeight()); + } + } + g.setColor(getForeground()); + g.drawString(str,drawCol,drawRow); + } + +} + From 021ffcfbdf66a374cf51c27d690ee50e46ed768e Mon Sep 17 00:00:00 2001 From: Anton Nashatyrev Date: Tue, 8 Jul 2014 16:42:23 +0400 Subject: [PATCH 003/166] 8047066: Test test/sun/awt/image/bug8038000.java fails with ClassCastException Reviewed-by: bae, prr --- .../share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java | 3 ++- jdk/test/sun/awt/image/bug8038000.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java index 1bcb05ccbb7..06f4ea6d99b 100644 --- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java +++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java @@ -384,7 +384,8 @@ class LCMSImageLayout { } public static LCMSImageLayout createImageLayout(Raster r) { LCMSImageLayout l = new LCMSImageLayout(); - if (r instanceof ByteComponentRaster) { + if (r instanceof ByteComponentRaster && + r.getSampleModel() instanceof ComponentSampleModel) { ByteComponentRaster br = (ByteComponentRaster)r; ComponentSampleModel csm = (ComponentSampleModel)r.getSampleModel(); diff --git a/jdk/test/sun/awt/image/bug8038000.java b/jdk/test/sun/awt/image/bug8038000.java index 2bfdc27d2b7..20affe806c2 100644 --- a/jdk/test/sun/awt/image/bug8038000.java +++ b/jdk/test/sun/awt/image/bug8038000.java @@ -23,11 +23,13 @@ /** * @test - * @bug 8038000 + * @bug 8038000 8047066 * * @summary Verifies that we could create different type of Rasters with height 1 * and strideline which exceeds raster width. * Also checks that a set of RasterOp work correctly with such kind of Rasters. + * For 8047066 verifies that ColorConvertOp could process + * Raster (ByteBuffer + SinglePixelPackedSampleModel) * * @run main bug8038000 */ From b8db13175e4a9fcf183b450a9f22b9f3a344339a Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Tue, 8 Jul 2014 09:19:29 -0700 Subject: [PATCH 004/166] 8047025: Fix raw and unchecked lint warnings in generated nimbus files Reviewed-by: henryjen, prr --- .../javax/swing/plaf/nimbus/Defaults.template | 14 ++++++++------ .../javax/swing/plaf/nimbus/StateImpl.template | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template index ee10c49bc47..8a27e35b208 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template @@ -398,7 +398,7 @@ ${UI_DEFAULT_INIT} @Override public Object createValue(UIDefaults table) { try { - Class c; + Class c; Object cl; // See if we should use a separate ClassLoader if (table == null || !((cl = table.get("ClassLoader")) @@ -412,7 +412,7 @@ ${UI_DEFAULT_INIT} } c = Class.forName(className, true, (ClassLoader)cl); - Constructor constructor = c.getConstructor( + Constructor constructor = c.getConstructor( AbstractRegionPainter.PaintContext.class, int.class); if (constructor == null) { throw new NullPointerException( @@ -564,7 +564,7 @@ ${UI_DEFAULT_INIT} //if c is not named, and parts[partIndex] has an expected class //type registered, then check to make sure c is of the //right type; - Class clazz = parts[partIndex].c; + Class clazz = parts[partIndex].c; if (clazz != null && clazz.isAssignableFrom(c.getClass())) { //so far so good, recurse return matches(c.getParent(), partIndex - 1); @@ -636,7 +636,7 @@ ${UI_DEFAULT_INIT} private String s; //true if this part represents a component name private boolean named; - private Class c; + private Class c; Part(String s) { named = s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"'; @@ -816,7 +816,7 @@ ${UI_DEFAULT_INIT} private static final class PainterBorder implements Border, UIResource { private Insets insets; - private Painter painter; + private Painter painter; private String painterKey; PainterBorder(String painterKey, Insets insets) { @@ -827,7 +827,9 @@ ${UI_DEFAULT_INIT} @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (painter == null) { - painter = (Painter)UIManager.get(painterKey); + @SuppressWarnings("unchecked") + Painter temp = (Painter)UIManager.get(painterKey); + painter = temp; if (painter == null) return; } diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template b/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template index 3323ab15581..dfff2ea59f5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template @@ -28,7 +28,7 @@ import java.awt.*; import javax.swing.*; -class ${STATE_NAME} extends State { +class ${STATE_NAME} extends State { ${STATE_NAME}() { super("${STATE_KEY}"); } From 2a84acf3dd07edc3fcb3de12a4072f958926a0ca Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Wed, 9 Jul 2014 12:56:03 +0400 Subject: [PATCH 005/166] 8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2 Reviewed-by: pchelko --- .../FocusTransferDWFAppModalTest.java | 49 ++++ .../FocusTransferDWFDocModalTest.java | 49 ++++ .../FocusTransferDWFModelessTest.java | 49 ++++ .../FocusTransferDWFNonModalTest.java | 48 ++++ .../FocusTransferDWFTest.java | 186 ++++++++++++ .../FocusTransferDialogsAppModalTest.java | 50 ++++ .../FocusTransferDialogsDocModalTest.java | 50 ++++ .../FocusTransferDialogsModelessTest.java | 50 ++++ .../FocusTransferDialogsNonModalTest.java | 49 ++++ .../FocusTransferDialogsTest.java | 193 +++++++++++++ .../FocusTransferFDWAppModalTest.java | 49 ++++ .../FocusTransferFDWDocModalTest.java | 49 ++++ .../FocusTransferFDWModelessTest.java | 49 ++++ .../FocusTransferFDWNonModalTest.java | 48 ++++ .../FocusTransferFDWTest.java | 152 ++++++++++ .../FocusTransferFWDAppModal1Test.java | 50 ++++ .../FocusTransferFWDAppModal2Test.java | 50 ++++ .../FocusTransferFWDAppModal3Test.java | 50 ++++ .../FocusTransferFWDAppModal4Test.java | 50 ++++ .../FocusTransferFWDDocModal1Test.java | 50 ++++ .../FocusTransferFWDDocModal2Test.java | 50 ++++ .../FocusTransferFWDDocModal3Test.java | 50 ++++ .../FocusTransferFWDDocModal4Test.java | 50 ++++ .../FocusTransferFWDModeless1Test.java | 50 ++++ .../FocusTransferFWDModeless2Test.java | 50 ++++ .../FocusTransferFWDModeless3Test.java | 50 ++++ .../FocusTransferFWDModeless4Test.java | 50 ++++ .../FocusTransferFWDNonModal1Test.java | 49 ++++ .../FocusTransferFWDNonModal2Test.java | 49 ++++ .../FocusTransferFWDNonModal3Test.java | 49 ++++ .../FocusTransferFWDNonModal4Test.java | 49 ++++ .../FocusTransferFWDTest.java | 201 +++++++++++++ .../FocusTransferWDFAppModal1Test.java | 51 ++++ .../FocusTransferWDFAppModal2Test.java | 52 ++++ .../FocusTransferWDFAppModal3Test.java | 52 ++++ .../FocusTransferWDFDocModal1Test.java | 51 ++++ .../FocusTransferWDFDocModal2Test.java | 52 ++++ .../FocusTransferWDFDocModal3Test.java | 51 ++++ .../FocusTransferWDFModeless1Test.java | 51 ++++ .../FocusTransferWDFModeless2Test.java | 52 ++++ .../FocusTransferWDFModeless3Test.java | 51 ++++ .../FocusTransferWDFNonModal1Test.java | 51 ++++ .../FocusTransferWDFNonModal2Test.java | 52 ++++ .../FocusTransferWDFNonModal3Test.java | 51 ++++ .../FocusTransferWDFTest.java | 272 ++++++++++++++++++ .../ModalitySettingsTest.java | 139 +++++++++ .../NullModalityDialogTest.java | 161 +++++++++++ .../java/awt/Modal/helpers/TestDialog.java | 38 ++- .../java/awt/Modal/helpers/TestFrame.java | 60 ++-- .../java/awt/Modal/helpers/TestWindow.java | 42 ++- 50 files changed, 3390 insertions(+), 56 deletions(-) create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java create mode 100644 jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java create mode 100644 jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java new file mode 100644 index 00000000000..20f15fbe4de --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when the following + * happens: an application modal dialog (D) having null frame owner is shown; + * a window having D as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFAppModalTest + */ + +public class FocusTransferDWFAppModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest( + Dialog.ModalityType.APPLICATION_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java new file mode 100644 index 00000000000..bb70a4fc090 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the + * following happens: a document modal dialog (D) having null frame owner is shown; + * a window having D as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFDocModalTest + */ + +public class FocusTransferDWFDocModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest( + Dialog.ModalityType.DOCUMENT_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java new file mode 100644 index 00000000000..eb2ca1ecd08 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the + * following happens: a modeless dialog (D) having null frame owner is shown; + * a window having D as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFModelessTest + */ + +public class FocusTransferDWFModelessTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest( + Dialog.ModalityType.MODELESS); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java new file mode 100644 index 00000000000..697c5c3d409 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following + * happens: a non-modal dialog (D) having null frame owner is shown; a window having D + * as owner is shown; a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDWFNonModalTest + */ + +public class FocusTransferDWFNonModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDWFTest test = new FocusTransferDWFTest(null); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java new file mode 100644 index 00000000000..c6097b74b92 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; + +import static jdk.testlibrary.Asserts.*; + +// DWF: Dialog -> Window -> Frame +public class FocusTransferDWFTest { + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (window != null) { + window.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomFrame extends TestFrame { + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Dialog d) { + super(d); + } + + @Override + public void doOpenAction() { + if (frame != null) { + frame.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private Dialog.ModalityType modalityType; + + FocusTransferDWFTest(Dialog.ModalityType modType) throws Exception { + + modalityType = modType; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + dialog = new CustomDialog((Frame) null); + if (modalityType == null) { + modalityType = Dialog.ModalityType.MODELESS; + } else { + dialog.setModalityType(modalityType); + } + dialog.setLocation(250, 50); + + window = new CustomWindow(dialog); + window.setLocation(450, 50); + dialog.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + dialog.checkCloseButtonFocusGained(true); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + window.clickOpenButton(robot); + robot.waitForIdle(delay); + + switch (modalityType) { + case APPLICATION_MODAL: + frame.checkCloseButtonFocusGained(false, 10); + window.checkOpenButtonFocusLost(false, 10); + + frame.closeGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + frame.checkCloseButtonFocusGained(true); + assertFalse(window.isVisible(), "window shouldn't be visible"); + + break; + + case DOCUMENT_MODAL: + case MODELESS: + frame.checkCloseButtonFocusGained(true); + window.checkOpenButtonFocusLost(true); + + window.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(true); + + dialog.openGained.reset(); + window.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog.checkOpenButtonFocusGained(true); + + break; + } + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java new file mode 100644 index 00000000000..900c3889786 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: an application modal dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsAppModalTest + */ + +public class FocusTransferDialogsAppModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest( + Dialog.ModalityType.APPLICATION_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java new file mode 100644 index 00000000000..62e04584dc6 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a document modal dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsDocModalTest + */ + +public class FocusTransferDialogsDocModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest( + Dialog.ModalityType.DOCUMENT_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java new file mode 100644 index 00000000000..2215b5a9b36 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a modeless dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsModelessTest + */ + +public class FocusTransferDialogsModelessTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest( + Dialog.ModalityType.MODELESS); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java new file mode 100644 index 00000000000..dc87c0f4268 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a non-modal dialog (D1) having a null + * frame owner is shown; a dialog (D2) having D1 owner is shown; a dialog + * with a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferDialogsNonModalTest + */ + +public class FocusTransferDialogsNonModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferDialogsTest test = new FocusTransferDialogsTest(null); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java new file mode 100644 index 00000000000..322dd6b94d4 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; + + +public class FocusTransferDialogsTest { + + class CustomDialog1 extends TestDialog { + + public CustomDialog1(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (dialog2 != null) { + dialog2.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog2 extends TestDialog { + + public CustomDialog2(Dialog d) { + super(d); + } + + @Override + public void doOpenAction() { + if (dialog3 != null) { + dialog3.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog3 extends TestDialog { + + public CustomDialog3(Frame f) { + super(f); + } + + public CustomDialog3(Dialog d) { + super(d); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + + private TestDialog dialog1, dialog2, dialog3; + private Frame parentFrame; + + private static final int delay = 1000; + private final ExtendedRobot robot; + private Dialog.ModalityType modalityType; + + FocusTransferDialogsTest(Dialog.ModalityType modType) throws Exception { + + modalityType = modType; + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + dialog1 = new CustomDialog1((Frame) null); + dialog1.setTitle("Dialog1"); + dialog1.setLocation(50, 50); + + if (modalityType != null) { + dialog1.setModalityType(modalityType); + } else { + modalityType = Dialog.ModalityType.MODELESS; + } + + dialog2 = new CustomDialog2(dialog1); + dialog2.setTitle("Dialog2"); + dialog2.setLocation(250, 50); + + parentFrame = new Frame(); + dialog3 = new CustomDialog3(parentFrame); + dialog3.setTitle("Dialog3"); + dialog3.setLocation(450, 50); + + dialog1.setVisible(true); + } + + private void closeAll() { + if (dialog1 != null) { dialog1.dispose(); } + if (dialog2 != null) { dialog2.dispose(); } + if (dialog3 != null) { dialog3.dispose(); } + if (parentFrame != null) { parentFrame.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + dialog1.checkCloseButtonFocusGained(true); + + dialog1.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog2.checkCloseButtonFocusGained(true); + dialog1.checkOpenButtonFocusLost(true); + + dialog1.openGained.reset(); + dialog2.clickOpenButton(robot); + robot.waitForIdle(delay); + + switch (modalityType) { + case APPLICATION_MODAL: + + dialog3.checkCloseButtonFocusGained(false, 10); + dialog2.checkOpenButtonFocusLost(true); + + dialog1.checkCloseButtonFocusGained(true); + dialog3.closeGained.reset(); + + dialog1.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog3.checkCloseButtonFocusGained(true); + + break; + + case DOCUMENT_MODAL: + case MODELESS: + + dialog3.checkCloseButtonFocusGained(true); + dialog2.checkOpenButtonFocusLost(true); + + dialog1.openGained.reset(); + + dialog2.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog1.checkOpenButtonFocusGained(true); + + break; + } + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java new file mode 100644 index 00000000000..f3fc961d460 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; an application modal dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWAppModalTest + */ + +public class FocusTransferFDWAppModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest( + Dialog.ModalityType.APPLICATION_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java new file mode 100644 index 00000000000..9a163e47bbc --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; a document modal dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWDocModalTest + */ + +public class FocusTransferFDWDocModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest( + Dialog.ModalityType.DOCUMENT_MODAL); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java new file mode 100644 index 00000000000..41dce55fea8 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; a modeless dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWModelessTest + */ + +public class FocusTransferFDWModelessTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest( + Dialog.ModalityType.MODELESS); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java new file mode 100644 index 00000000000..32117624ecb --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a frame is shown; a non-modal dialog (D) + * having a null frame owner is shown; a window having D as owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFDWNonModalTest + */ + +public class FocusTransferFDWNonModalTest { + + public static void main(String[] args) throws Exception { + FocusTransferFDWTest test = new FocusTransferFDWTest(null); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java new file mode 100644 index 00000000000..41e2fb086f2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; + +// FDW: Frame -> Dialog -> Window +public class FocusTransferFDWTest { + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Dialog d) { + super(d); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (window != null) { + window.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + + FocusTransferFDWTest(Dialog.ModalityType modType) throws Exception { + + modalityType = modType; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + dialog = new CustomDialog((Frame) null); + if (modalityType != null) { + dialog.setModalityType(modalityType); + } + dialog.setLocation(250, 50); + window = new CustomWindow(dialog); + window.setLocation(450, 50); + frame.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + frame.checkCloseButtonFocusGained(true); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.checkCloseButtonFocusGained(true); + + frame.checkOpenButtonFocusLost(true); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + dialog.openGained.reset(); + window.clickCloseButton(robot); + + dialog.checkOpenButtonFocusGained(true); + + frame.openGained.reset(); + dialog.clickCloseButton(robot); + + frame.checkOpenButtonFocusGained(true); + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java new file mode 100644 index 00000000000..121aeb5494f --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal1Test + */ + +public class FocusTransferFWDAppModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java new file mode 100644 index 00000000000..ba1ff589406 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal2Test + */ + +public class FocusTransferFWDAppModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java new file mode 100644 index 00000000000..5098658d7e9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal3Test + */ + +public class FocusTransferFWDAppModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java new file mode 100644 index 00000000000..f4ae06489aa --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; an application modal dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDAppModal4Test + */ + +public class FocusTransferFWDAppModal4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java new file mode 100644 index 00000000000..4f3958f98d4 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal1Test + */ + +public class FocusTransferFWDDocModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java new file mode 100644 index 00000000000..f68eb0e3a63 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal2Test + */ + +public class FocusTransferFWDDocModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java new file mode 100644 index 00000000000..7ad9e8e3d4a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal3Test + */ + +public class FocusTransferFWDDocModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java new file mode 100644 index 00000000000..d689b61be83 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a document modal dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDDocModal4Test + */ + +public class FocusTransferFWDDocModal4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java new file mode 100644 index 00000000000..bdf00c0ca24 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless1Test + */ + +public class FocusTransferFWDModeless1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java new file mode 100644 index 00000000000..a1d31e4328a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless2Test + */ + +public class FocusTransferFWDModeless2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java new file mode 100644 index 00000000000..6ed6f9eab21 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless3Test + */ + +public class FocusTransferFWDModeless3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java new file mode 100644 index 00000000000..956b69127bb --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a modeless dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDModeless4Test + */ + +public class FocusTransferFWDModeless4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + Dialog.ModalityType.MODELESS, + FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java new file mode 100644 index 00000000000..fd06036bce7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a hidden dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal1Test + */ + +public class FocusTransferFWDNonModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.HIDDEN_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java new file mode 100644 index 00000000000..82283113c8c --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a hidden frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal2Test + */ + +public class FocusTransferFWDNonModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.HIDDEN_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java new file mode 100644 index 00000000000..4475351ba43 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a null dialog owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal3Test + */ + +public class FocusTransferFWDNonModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.NULL_DIALOG); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java new file mode 100644 index 00000000000..6ceed537376 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8049339 + * @summary Check whether the focus transfer between windows occurs correctly when the following happens: + * a frame (F) is shown; a window having F as owner is shown; a non-modal dialog having + * a null frame owner is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferFWDNonModal4Test + */ + +public class FocusTransferFWDNonModal4Test { + + public static void main(String[] args) throws Exception { + FocusTransferFWDTest test = new FocusTransferFWDTest( + null, FocusTransferFWDTest.DialogParent.NULL_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java new file mode 100644 index 00000000000..2d7a37419d1 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + + +// FWD: Frame -> Window -> Dialog +public class FocusTransferFWDTest { + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (window != null) { + window.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + public CustomDialog(Dialog d) { + super(d); + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private Frame parentFrame; + private Dialog parentDialog; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + + public enum DialogParent {NULL_DIALOG, NULL_FRAME, HIDDEN_DIALOG, HIDDEN_FRAME}; + private DialogParent dialogParent; + + FocusTransferFWDTest(Dialog.ModalityType modType, + DialogParent dlgParent) throws Exception { + + modalityType = modType; + dialogParent = dlgParent; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + switch (dialogParent) { + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + case NULL_FRAME: + dialog = new CustomDialog((Frame) null); + break; + case HIDDEN_DIALOG: + parentDialog = new Dialog((Frame) null); + dialog = new CustomDialog(parentDialog); + break; + case HIDDEN_FRAME: + parentFrame = new Frame(); + dialog = new CustomDialog(parentFrame); + break; + } + + assertTrue(dialog != null, "error: null dialog"); + + if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + dialog.setLocation(250, 50); + window = new CustomWindow(frame); + window.setLocation(450, 50); + frame.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + + if (parentDialog != null) { parentDialog.dispose(); } + if (parentFrame != null) { parentFrame.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + try { + + frame.checkCloseButtonFocusGained(true); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(true); + frame.checkOpenButtonFocusLost(true); + + window.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.checkCloseButtonFocusGained(true); + window.checkOpenButtonFocusLost(true); + + window.openGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(true); + + frame.openGained.reset(); + + window.clickCloseButton(robot); + robot.waitForIdle(delay); + + frame.checkOpenButtonFocusGained(true); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java new file mode 100644 index 00000000000..d23593634c1 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * an application modal dialog having a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFAppModal1Test + */ + +public class FocusTransferWDFAppModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java new file mode 100644 index 00000000000..e37420f3cdb --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 8048263 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * an application modal dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFAppModal2Test + */ + +public class FocusTransferWDFAppModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferWDFTest.DialogParent.NULL_DIALOG, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java new file mode 100644 index 00000000000..f75c869272a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * an application modal dialog having F owner is shown; F is shown. + * + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFAppModal3Test + */ + +public class FocusTransferWDFAppModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.APPLICATION_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java new file mode 100644 index 00000000000..cd1e9e8f9d9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a document modal dialog with a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFDocModal1Test + */ + +public class FocusTransferWDFDocModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java new file mode 100644 index 00000000000..9f3a1f88cc8 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a document modal dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFDocModal2Test + */ + +public class FocusTransferWDFDocModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferWDFTest.DialogParent.NULL_DIALOG, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java new file mode 100644 index 00000000000..2c116b09677 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * a document modal dialog having F owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFDocModal3Test + */ + +public class FocusTransferWDFDocModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.DOCUMENT_MODAL, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java new file mode 100644 index 00000000000..73d36b65bf0 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a modeless dialog having a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFModeless1Test + */ + +public class FocusTransferWDFModeless1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.MODELESS, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java new file mode 100644 index 00000000000..e496e253f58 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a modeless dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFModeless2Test + */ + +public class FocusTransferWDFModeless2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.MODELESS, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java new file mode 100644 index 00000000000..df3ff81dc3d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * a modeless dialog having F owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFModeless3Test + */ + +public class FocusTransferWDFModeless3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + Dialog.ModalityType.MODELESS, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java new file mode 100644 index 00000000000..c700a054136 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a non-modal dialog having a frame (F) owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFNonModal1Test + */ + +public class FocusTransferWDFNonModal1Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + null, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java new file mode 100644 index 00000000000..5e36b8d50a7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a hidden frame owner is shown; + * a non-modal dialog having a null dialog owner is shown; + * a frame is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFNonModal2Test + */ + +public class FocusTransferWDFNonModal2Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + null, + FocusTransferWDFTest.DialogParent.NULL_DIALOG, + FocusTransferWDFTest.WindowParent.NEW_FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java new file mode 100644 index 00000000000..e0d3ebbb1f2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8047367 + * @summary Check whether the focus transfer between windows occurs correctly when + * the following happens: a window having a frame (F) owner is shown; + * a non-modal dialog having F owner is shown; F is shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main FocusTransferWDFNonModal3Test + */ + +public class FocusTransferWDFNonModal3Test { + + public static void main(String[] args) throws Exception { + FocusTransferWDFTest test = new FocusTransferWDFTest( + null, + FocusTransferWDFTest.DialogParent.FRAME, + FocusTransferWDFTest.WindowParent.FRAME); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java new file mode 100644 index 00000000000..d79e715bfe9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + +// WDF: Window -> Dialog -> Frame +public class FocusTransferWDFTest { + + class CustomDialog extends TestDialog { + + public CustomDialog(Frame f) { + super(f); + } + + public CustomDialog(Dialog d) { + super(d); + } + + @Override + public void doOpenAction() { + if (frame != null) { + frame.setVisible(true); + } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomFrame extends TestFrame { + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Frame f) { + super(f); + } + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } + + + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private Frame parentFrame; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + private Dialog.ModalityType modalityType; + + public enum DialogParent {FRAME, NULL_DIALOG}; + private DialogParent dialogParent; + + public enum WindowParent {FRAME, NEW_FRAME}; + private WindowParent windowParent; + + + FocusTransferWDFTest(Dialog.ModalityType modType, + DialogParent dlgParent, + WindowParent winParent) throws Exception { + + modalityType = modType; + dialogParent = dlgParent; + windowParent = winParent; + + robot = new ExtendedRobot(); + EventQueue.invokeLater( this::createGUI ); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + switch (dialogParent) { + case FRAME: + dialog = new CustomDialog(frame); + break; + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + } + assertTrue(dialog != null, "error: null dialog"); + + if (modalityType == null) { + modalityType = Dialog.ModalityType.MODELESS; + } else { + dialog.setModalityType(modalityType); + } + + dialog.setLocation(250, 50); + + switch (windowParent) { + case FRAME: + window = new CustomWindow(frame); + break; + case NEW_FRAME: + parentFrame = new Frame(); + window = new CustomWindow(parentFrame); + break; + } + assertTrue(window != null, "error: null window"); + + window.setLocation(450, 50); + window.setVisible(true); + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + + if (parentFrame != null) { parentFrame.dispose(); } + } + + private void ModalTest() throws Exception { + frame.checkCloseButtonFocusGained(false, 10); + dialog.checkOpenButtonFocusLost(false, 10); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + frame.checkCloseButtonFocusGained(true); + + window.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + window.checkCloseButtonFocusGained(false, 10); + + window.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.checkCloseButtonFocusGained(true); + window.checkOpenButtonFocusLost(false, 10); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + switch (modalityType) { + case APPLICATION_MODAL: + ModalTest(); + if (windowParent == WindowParent.FRAME) { + assertFalse(window.isVisible(), + "window shouldn't be visible"); + } else { // WindowParent.NEW_FRAME + window.checkOpenButtonFocusGained(false, 10); + } + + break; + + case DOCUMENT_MODAL: + if (dialogParent == DialogParent.FRAME) { + ModalTest(); + if (windowParent == WindowParent.FRAME) { // 10 + assertFalse(window.isVisible(), + "window shouldn't be visible"); + } else { // WindowParent.NEW_FRAME + window.checkOpenButtonFocusGained(false, 10); + } + } else { // DialogParent.NULL_DIALOG + frame.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + dialog.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + dialog.checkOpenButtonFocusGained(true); + + window.openGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(false, 10); + } + break; + + case MODELESS: + + frame.checkCloseButtonFocusGained(true); + dialog.checkOpenButtonFocusLost(true); + + dialog.openGained.reset(); + + frame.clickCloseButton(robot); + robot.waitForIdle(delay); + + if (dialogParent == DialogParent.NULL_DIALOG) { + dialog.checkOpenButtonFocusGained(true); + + window.openGained.reset(); + + dialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + window.checkOpenButtonFocusGained(false, 10); + } else { + assertFalse(dialog.isVisible(), + "dialog shouldn't be visible"); + + if (windowParent == WindowParent.FRAME) { + assertFalse(window.isVisible(), + "window shouldn't be visible"); + } + } + + break; + } + + } catch (Exception e) { + + // make screenshot before exit + Rectangle rect = new Rectangle(0, 0, 650, 250); + java.awt.image.BufferedImage img = robot.createScreenCapture(rect); + javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); + + throw e; + } + + robot.waitForIdle(delay); + EventQueue.invokeAndWait(this::closeAll); + } +} diff --git a/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java b/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java new file mode 100644 index 00000000000..614b32cd090 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + +/* + * @test + * @bug 8047367 + * @summary Check modality settings for Window and Dialog. + * + * @library ../../../../lib/testlibrary/ + * @run main ModalitySettingsTest + */ + + + +public class ModalitySettingsTest { + + private void doTest() throws Exception { + + Window w = new Window(new Frame()); + + boolean unexpectedExc = false; + + try { + Dialog d = new Dialog(w); + } catch (IllegalArgumentException iae) { + } catch (Exception e) { + unexpectedExc = true; + } + + assertFalse(unexpectedExc, "unexpected exception occured when a " + + "Window instance was passed to Dialog constructor"); + + Dialog d = new Dialog((Frame) null); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "the default modality type returned by Dialog " + + "differs from Dialog.ModalityType.MODELESS"); + + Frame f = new Frame(); + assertTrue(f.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "the default modality exclusion type returned by Frame" + + "differs from Dialog.ModalExclusionType.NO_EXCLUDE"); + + w = new Window((Frame) null); + assertTrue(w.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "the default modality exclusion type returned by Window " + + "differs from Dialog.ModalExclusionType.NO_EXCLUDE"); + + d = new Dialog((Frame) null); + assertTrue(d.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "the default modality exclusion type returned by Dialog " + + "differs from Dialog.ModalExclusionType.NO_EXCLUDE"); + + d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL); + assertTrue(d.getModalityType() == Dialog.ModalityType.TOOLKIT_MODAL, + "the modality type returned by Dialog " + + "differs from Dialog.ModalityType.TOOLKIT_MODAL " + + "after setting the modality type to that value"); + + d.setModal(false); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "the modality type returned by Dialog differs from " + + "Dialog.ModalityType.MODELESS after calling setModal(false)"); + + d.setModal(true); + assertTrue(d.getModalityType() == Dialog.ModalityType.APPLICATION_MODAL, + "the modality type returned by Dialog differs from " + + "Dialog.ModalityType.APPLICATION_MODAL after calling setModal(true)"); + + w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE); + assertTrue(w.getModalExclusionType() == + Dialog.ModalExclusionType.APPLICATION_EXCLUDE, + "getModalExclusionType method for Window did not return " + + "Dialog.ModalExclusionType.APPLICATION_EXCLUDE after " + + "setting it to that value"); + + d = new Dialog((Frame) null); + d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL); + assertTrue(d.isModal(), "method isModal for Dialog " + + "returned false when the Dialog is toolkit modal"); + + d.setModalityType(Dialog.ModalityType.MODELESS); + assertFalse(d.isModal(), "method isModal for Dialog " + + "returned true when the Dialog is MODELESS"); + + d = new Dialog((Frame) null, (Dialog.ModalityType) null); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "The modality type returned for a Dialog constructed " + + "with null modality type differs from MODELESS"); + + d = new Dialog((Frame) null); + d.setModalityType(null); + assertTrue(d.getModalityType() == Dialog.ModalityType.MODELESS, + "the modality type returned for a Dialog set with null " + + "modality type differs from MODELESS"); + + d.setModalExclusionType(null); + assertTrue(d.getModalExclusionType() == Dialog.ModalExclusionType.NO_EXCLUDE, + "The exlcusion type returned for a Dialog set with null " + + "exclusion type differs from NO_EXCLUDE"); + + try { + Dialog.ModalityType.valueOf("invalid"); + } catch (IllegalArgumentException iae) { + } catch (Exception e) { + unexpectedExc = true; + } + + assertFalse(unexpectedExc, "unexpected exception occured when an " + + "invalid value was passed to ModalityType.valueOf method"); + } + + public static void main(String[] args) throws Exception { + ModalitySettingsTest test = new ModalitySettingsTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java new file mode 100644 index 00000000000..f8632ff14df --- /dev/null +++ b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import java.awt.event.KeyEvent; + +import static jdk.testlibrary.Asserts.*; + + +/* + * @test + * @bug 8047367 + * @summary Check whether a Dialog set with null modality type + * behaves like a modeless dialog + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main NullModalityDialogTest + */ + + +public class NullModalityDialogTest { + + class CustomDialog extends TestDialog { + public CustomDialog(Frame f) { + super(f); + } + @Override + public void doOpenAction() { + if (frame != null) { + frame.setVisible(true); + } + if (window != null) { + window.setVisible(true); + } + } + } + + class CustomFrame extends TestFrame { + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } + + private TestFrame parent; + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + private static final int delay = 1000; + + private final ExtendedRobot robot; + + NullModalityDialogTest() throws Exception { + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + parent = new CustomFrame(); + parent.setTitle("Parent"); + parent.setLocation(50, 50); + + dialog = new CustomDialog(parent); + dialog.setTitle("Dialog"); + dialog.setModalityType((Dialog.ModalityType) null); + dialog.setLocation(250, 50); + + frame = new TestFrame(); + frame.setTitle("Frame"); + frame.setLocation(50, 250); + + window = new TestWindow(frame); + window.setLocation(250, 250); + + parent.setVisible(true); + } + + private void closeAll() { + if (parent != null) { parent.dispose(); } + if (dialog != null) { dialog.dispose(); } + if (frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + } + + public void doTest() throws Exception { + + robot.waitForIdle(delay); + + parent.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "the 1st button did not gain focus " + + "when the Dialog became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st button in the Dialog " + + "gained focus but lost it afterwards"); + + dialog.openGained.reset(); + + robot.type(KeyEvent.VK_TAB); + + dialog.openGained.waitForFlagTriggered(); + assertTrue(dialog.openGained.flag(), + "Tab navigation did not happen properly on Dialog. Open button " + + "did not gain focus on tab press when parent frame is visible"); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + frame.activated.waitForFlagTriggered(); + assertTrue(frame.activated.flag(), "Frame did not trigger activated when " + + "made visible. Dialog and its parent frame are visible"); + + frame.checkUnblockedFrame(robot, "Frame is the parent of a visible Dialog."); + window.checkUnblockedWindow(robot, "Frame and its child Dialog are visible."); + + robot.waitForIdle(delay); + + EventQueue.invokeAndWait(this::closeAll); + } + + public static void main(String[] args) throws Exception { + NullModalityDialogTest test = new NullModalityDialogTest(); + test.doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/helpers/TestDialog.java b/jdk/test/java/awt/Modal/helpers/TestDialog.java index a3791778bc1..d547886cddc 100644 --- a/jdk/test/java/awt/Modal/helpers/TestDialog.java +++ b/jdk/test/java/awt/Modal/helpers/TestDialog.java @@ -332,35 +332,47 @@ public class TestDialog extends Dialog implements ActionListener, "button did not gain focus. " + message); } - public void checkCloseButtonFocusGained() { - checkCloseButtonFocusGained(Flag.ATTEMPTS); + public void checkCloseButtonFocusGained(boolean refState) { + checkCloseButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkCloseButtonFocusGained(int attempts) { + public void checkCloseButtonFocusGained(boolean refState, int attempts) { try { closeGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(closeGained.flag(), - "dialog Close button did not gain focus"); + + String msg = "dialog Close button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(closeGained.flag() == refState, msg); } - public void checkOpenButtonFocusGained() { + public void checkOpenButtonFocusGained(boolean refState) { try { openGained.waitForFlagTriggered(); } catch (InterruptedException e) {} - assertTrue(openGained.flag(), - "dialog Open button did not gain focus"); + + String msg = "dialog Open button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(openGained.flag() == refState, msg); } - public void checkOpenButtonFocusLost() { - checkOpenButtonFocusLost(Flag.ATTEMPTS); + public void checkOpenButtonFocusLost(boolean refState) { + checkOpenButtonFocusLost(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusLost(int attempts) { + public void checkOpenButtonFocusLost(boolean refState, int attempts) { try { openLost.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openLost.flag(), - "dialog Open button did not lose focus"); + + String msg = "dialog Open button "; + msg += (refState ? "did not lose focus" : + "lost focus when it should not"); + + assertTrue(openLost.flag() == refState, msg); } } diff --git a/jdk/test/java/awt/Modal/helpers/TestFrame.java b/jdk/test/java/awt/Modal/helpers/TestFrame.java index 8b646f82291..7af2a3bf686 100644 --- a/jdk/test/java/awt/Modal/helpers/TestFrame.java +++ b/jdk/test/java/awt/Modal/helpers/TestFrame.java @@ -324,46 +324,50 @@ public class TestFrame extends Frame implements ActionListener, "button did not gain focus on tab press. " + message); } - public void checkCloseButtonFocusGained() { - checkCloseButtonFocusGained(Flag.ATTEMPTS); + public void checkCloseButtonFocusGained(boolean refState) { + checkCloseButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkCloseButtonFocusGained(int attempts) { - + public void checkCloseButtonFocusGained(boolean refState, int attempts) { try { closeGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - if (closeGained.flag()) { - Component focusOwner = - KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - assertTrue(closeButton.equals(focusOwner), - "close button gained focus, but it is not the current focus owner"); - } else { - assertTrue(false, "frame Close button did not gain focus"); - } + String msg = "frame Close button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(closeGained.flag() == refState, msg); } - public void checkOpenButtonFocusGained() { - try { - openGained.waitForFlagTriggered(); - } catch (InterruptedException e) {} - - if (openGained.flag()) { - Component focusOwner = - KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - assertTrue(openButton.equals(focusOwner), - "open button gained focus, but it is not the current focus owner"); - } else { - assertTrue(false, "frame Open button did not gain focus"); - } + public void checkOpenButtonFocusGained(boolean refState) { + checkOpenButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusLost() { + public void checkOpenButtonFocusGained(boolean refState, int attempts) { try { - openLost.waitForFlagTriggered(); + openGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openLost.flag(), "frame Open button did not lose focus"); + String msg = "frame Open button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(openGained.flag() == refState, msg); + } + + public void checkOpenButtonFocusLost(boolean refState) { + checkOpenButtonFocusLost(refState, Flag.ATTEMPTS); + } + + public void checkOpenButtonFocusLost(boolean refState, int attempts) { + try { + openLost.waitForFlagTriggered(attempts); + } catch (InterruptedException e) {} + + String msg = "frame Open button "; + msg += (refState ? "did not lose focus" : + "lost focus when it should not"); + assertTrue(openLost.flag()== refState, msg); } } diff --git a/jdk/test/java/awt/Modal/helpers/TestWindow.java b/jdk/test/java/awt/Modal/helpers/TestWindow.java index c929aefbf73..4e7cdb6fe79 100644 --- a/jdk/test/java/awt/Modal/helpers/TestWindow.java +++ b/jdk/test/java/awt/Modal/helpers/TestWindow.java @@ -295,39 +295,51 @@ public class TestWindow extends Window implements ActionListener, "button did not gain focus on tab press. " + message); } - public void checkCloseButtonFocusGained() { - checkCloseButtonFocusGained(Flag.ATTEMPTS); + public void checkCloseButtonFocusGained(boolean refState) { + checkCloseButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkCloseButtonFocusGained(int attempts) { + public void checkCloseButtonFocusGained(boolean refState, int attempts) { try { closeGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(closeGained.flag(), - "window Close button did not gain focus"); + + String msg = "window Close button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(closeGained.flag() == refState, msg); } - public void checkOpenButtonFocusGained() { - checkOpenButtonFocusGained(Flag.ATTEMPTS); + + public void checkOpenButtonFocusGained(boolean refState) { + checkOpenButtonFocusGained(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusGained(int attempts) { + public void checkOpenButtonFocusGained(boolean refState, int attempts) { try { openGained.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openGained.flag(), - "window Open button did not gain focus"); + + String msg = "window Open button "; + msg += (refState ? "did not gain focus" : + "gained focus when it should not"); + + assertTrue(openGained.flag() == refState, msg); } - public void checkOpenButtonFocusLost() { - checkOpenButtonFocusLost(Flag.ATTEMPTS); + public void checkOpenButtonFocusLost(boolean refState) { + checkOpenButtonFocusLost(refState, Flag.ATTEMPTS); } - public void checkOpenButtonFocusLost(int attempts) { + public void checkOpenButtonFocusLost(boolean refState, int attempts) { try { openLost.waitForFlagTriggered(attempts); } catch (InterruptedException e) {} - assertTrue(openLost.flag(), - "window Open button did not lose focus"); + + String msg = "window Open button "; + msg += (refState ? "did not lose focus" : + "lost focus when it should not"); + assertTrue(openLost.flag()== refState, msg); } } From 54e8ddf594b3be09d986973a9dc01a8c96b76a21 Mon Sep 17 00:00:00 2001 From: Steve Sides Date: Wed, 9 Jul 2014 15:14:06 +0400 Subject: [PATCH 006/166] 8046597: fix doclint issues in swing classes, part 4 of 4 Reviewed-by: pchelko --- .../classes/javax/swing/AbstractAction.java | 4 + .../classes/javax/swing/CellRendererPane.java | 27 ++++ .../classes/javax/swing/DebugGraphics.java | 48 ++++-- .../javax/swing/DefaultBoundedRangeModel.java | 6 + .../javax/swing/DefaultDesktopManager.java | 2 +- .../swing/DefaultSingleSelectionModel.java | 1 + .../classes/javax/swing/DesktopManager.java | 141 +++++++++++++----- .../share/classes/javax/swing/GrayFilter.java | 5 +- jdk/src/share/classes/javax/swing/Icon.java | 7 +- .../share/classes/javax/swing/JApplet.java | 11 +- .../share/classes/javax/swing/JComponent.java | 28 ++++ .../classes/javax/swing/JDesktopPane.java | 5 +- .../share/classes/javax/swing/JDialog.java | 6 + jdk/src/share/classes/javax/swing/JLabel.java | 12 ++ .../share/classes/javax/swing/JPopupMenu.java | 8 + .../classes/javax/swing/JScrollPane.java | 7 +- .../share/classes/javax/swing/JSpinner.java | 3 + .../share/classes/javax/swing/JTextField.java | 3 + .../share/classes/javax/swing/JWindow.java | 2 + .../classes/javax/swing/ProgressMonitor.java | 6 + .../classes/javax/swing/SpinnerModel.java | 1 + jdk/src/share/classes/javax/swing/Timer.java | 19 ++- 22 files changed, 290 insertions(+), 62 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/AbstractAction.java b/jdk/src/share/classes/javax/swing/AbstractAction.java index 1f0ef990243..5c8f6e6626f 100644 --- a/jdk/src/share/classes/javax/swing/AbstractAction.java +++ b/jdk/src/share/classes/javax/swing/AbstractAction.java @@ -269,6 +269,10 @@ public abstract class AbstractAction implements Action, Cloneable, Serializable * when a bound property has changed and it will send the appropriate * PropertyChangeEvent to any registered * PropertyChangeListeners. + * + * @param propertyName the name of the property that has changed + * @param oldValue the old value of the property + * @param newValue the new value of the property */ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (changeSupport == null || diff --git a/jdk/src/share/classes/javax/swing/CellRendererPane.java b/jdk/src/share/classes/javax/swing/CellRendererPane.java index 6050693eeeb..c21a282bf29 100644 --- a/jdk/src/share/classes/javax/swing/CellRendererPane.java +++ b/jdk/src/share/classes/javax/swing/CellRendererPane.java @@ -120,6 +120,18 @@ public class CellRendererPane extends Container implements Accessible * The Container p is the component we're actually drawing on, typically it's * equal to this.getParent(). If shouldValidate is true the component c will be * validated before painted. + * + * @param g the {@code Graphics} object to draw on + * @param c the {@code Component} to draw + * @param p the {@code Container} component actually drawn on + * @param x an int specifying the left side of the area draw in, in pixels, + * measured from the left edge of the graphics context + * @param y an int specifying the top of the area to draw in, in pixels + * measured down from the top edge of the graphics context + * @param w an int specifying the width of the area draw in, in pixels + * @param h an int specifying the height of the area draw in, in pixels + * @param shouldValidate if true, component {@code c} will be validated + * before being painted */ public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate) { if (c == null) { @@ -166,6 +178,16 @@ public class CellRendererPane extends Container implements Accessible /** * Calls this.paintComponent(g, c, p, x, y, w, h, false). + * + * @param g the {@code Graphics} object to draw on + * @param c the {@code Component} to draw + * @param p the {@code Container} component actually drawn on + * @param x an int specifying the left side of the area draw in, in pixels, + * measured from the left edge of the graphics context + * @param y an int specifying the top of the area to draw in, in pixels + * measured down from the top edge of the graphics context + * @param w an int specifying the width of the area draw in, in pixels + * @param h an int specifying the height of the area draw in, in pixels */ public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h) { paintComponent(g, c, p, x, y, w, h, false); @@ -174,6 +196,11 @@ public class CellRendererPane extends Container implements Accessible /** * Calls this.paintComponent() with the rectangles x,y,width,height fields. + * + * @param g the {@code Graphics} object to draw on + * @param c the {@code Component} to draw + * @param p the {@code Container} component actually drawn on + * @param r the {@code Rectangle} to draw in */ public void paintComponent(Graphics g, Component c, Container p, Rectangle r) { paintComponent(g, c, p, r.x, r.y, r.width, r.height); diff --git a/jdk/src/share/classes/javax/swing/DebugGraphics.java b/jdk/src/share/classes/javax/swing/DebugGraphics.java index 99a4f5b07ee..050ce604c69 100644 --- a/jdk/src/share/classes/javax/swing/DebugGraphics.java +++ b/jdk/src/share/classes/javax/swing/DebugGraphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,6 +139,8 @@ public class DebugGraphics extends Graphics { /** * Sets the Color used to flash drawing operations. + * + * @param flashColor the Color used to flash drawing operations */ public static void setFlashColor(Color flashColor) { info().flashColor = flashColor; @@ -146,6 +148,8 @@ public class DebugGraphics extends Graphics { /** * Returns the Color used to flash drawing operations. + * + * @return the Color used to flash drawing operations * @see #setFlashColor */ public static Color flashColor() { @@ -154,6 +158,8 @@ public class DebugGraphics extends Graphics { /** * Sets the time delay of drawing operation flashing. + * + * @param flashTime the time delay of drawing operation flashing */ public static void setFlashTime(int flashTime) { info().flashTime = flashTime; @@ -161,6 +167,8 @@ public class DebugGraphics extends Graphics { /** * Returns the time delay of drawing operation flashing. + * + * @return the time delay of drawing operation flashing * @see #setFlashTime */ public static int flashTime() { @@ -169,27 +177,38 @@ public class DebugGraphics extends Graphics { /** * Sets the number of times that drawing operations will flash. + * + * @param flashCount number of times that drawing operations will flash */ public static void setFlashCount(int flashCount) { info().flashCount = flashCount; } - /** Returns the number of times that drawing operations will flash. - * @see #setFlashCount - */ + /** + * Returns the number of times that drawing operations will flash. + * + * @return the number of times that drawing operations will flash + * @see #setFlashCount + */ public static int flashCount() { return info().flashCount; } - /** Sets the stream to which the DebugGraphics logs drawing operations. - */ + /** + * Sets the stream to which the DebugGraphics logs drawing operations. + * + * @param stream the stream to which the DebugGraphics logs drawing operations + */ public static void setLogStream(java.io.PrintStream stream) { info().stream = stream; } - /** Returns the stream to which the DebugGraphics logs drawing operations. - * @see #setLogStream - */ + /** + * Returns the stream to which the DebugGraphics logs drawing operations. + * + * @return the stream to which the DebugGraphics logs drawing operations + * @see #setLogStream + */ public static java.io.PrintStream logStream() { return info().stream; } @@ -1337,6 +1356,8 @@ public class DebugGraphics extends Graphics { * creates a new Frame that shows each operation on an * offscreen buffer. The value of options is bitwise OR'd into * the current value. To disable debugging use NONE_OPTION. + * + * @param options indicates how diagnostic information should be displayed */ public void setDebugOptions(int options) { if (options != 0) { @@ -1356,9 +1377,12 @@ public class DebugGraphics extends Graphics { } } - /** Returns the current debugging options for this DebugGraphics. - * @see #setDebugOptions - */ + /** + * Returns the current debugging options for this DebugGraphics. + * + * @return the current debugging options for this DebugGraphics + * @see #setDebugOptions + */ public int getDebugOptions() { return debugOptions; } diff --git a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java index b7b989e07fa..20f44a28ea3 100644 --- a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java +++ b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java @@ -88,6 +88,11 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable *

          * min <= value <= value+extent <= max
          * 
    + * + * @param value an int giving the current value + * @param extent the length of the inner range that begins at the model's value + * @param min an int giving the minimum value + * @param max an int giving the maximum value */ public DefaultBoundedRangeModel(int value, int extent, int min, int max) { @@ -403,6 +408,7 @@ public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable * If no such listeners exist, * this method returns an empty array. * + * @param the type of {@code EventListener} class being requested * @param listenerType the type of listeners requested; * this parameter should specify an interface * that descends from java.util.EventListener diff --git a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java index ebee71521d9..49eecf1e77c 100644 --- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java +++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java @@ -71,7 +71,7 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab private transient boolean didDrag; /** Normally this method will not be called. If it is, it - * try to determine the appropriate parent from the desktopIcon of the frame. + * tries to determine the appropriate parent from the desktopIcon of the frame. * Will remove the desktopIcon from its parent if it successfully adds the frame. */ public void openFrame(JInternalFrame f) { diff --git a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java index 75c522e79c9..532639c071f 100644 --- a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java +++ b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java @@ -155,6 +155,7 @@ Serializable { * If no such listeners exist, * this method returns an empty array. * + * @param the type of {@code EventListener} class being requested * @param listenerType the type of listeners requested; * this parameter should specify an interface * that descends from java.util.EventListener diff --git a/jdk/src/share/classes/javax/swing/DesktopManager.java b/jdk/src/share/classes/javax/swing/DesktopManager.java index edcfaf4fabb..5e08a6f139d 100644 --- a/jdk/src/share/classes/javax/swing/DesktopManager.java +++ b/jdk/src/share/classes/javax/swing/DesktopManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,73 +47,136 @@ package javax.swing; */ public interface DesktopManager { - /** If possible, display this frame in an appropriate location. - * Normally, this is not called, as the creator of the JInternalFrame - * will add the frame to the appropriate parent. - */ + /** + * If possible, display this frame in an appropriate location. + * Normally, this is not called, as the creator of the JInternalFrame + * will add the frame to the appropriate parent. + * + * @param f the {@code JInternalFrame} to be displayed + */ void openFrame(JInternalFrame f); - /** Generally, this call should remove the frame from it's parent. */ + /** + * Generally, this call should remove the frame from its parent. + * + * @param f the {@code JInternalFrame} to be removed + */ void closeFrame(JInternalFrame f); - /** Generally, the frame should be resized to match it's parents bounds. */ + /** + * Generally, the frame should be resized to match its parents bounds. + * + * @param f the {@code JInternalFrame} to be resized + */ void maximizeFrame(JInternalFrame f); - /** Generally, this indicates that the frame should be restored to it's - * size and position prior to a maximizeFrame() call. - */ + + /** + * Generally, this indicates that the frame should be restored to its + * size and position prior to a maximizeFrame() call. + * + * @param f the {@code JInternalFrame} to be restored + */ void minimizeFrame(JInternalFrame f); - /** Generally, remove this frame from it's parent and add an iconic representation. */ + + /** + * Generally, remove this frame from its parent and add an iconic representation. + * + * @param f the {@code JInternalFrame} to be iconified + */ void iconifyFrame(JInternalFrame f); - /** Generally, remove any iconic representation that is present and restore the - * frame to it's original size and location. - */ + + /** + * Generally, remove any iconic representation that is present and restore the + * frame to it's original size and location. + * + * @param f the {@code JInternalFrame} to be de-iconified + */ void deiconifyFrame(JInternalFrame f); /** * Generally, indicate that this frame has focus. This is usually called after * the JInternalFrame's IS_SELECTED_PROPERTY has been set to true. + * + * @param f the {@code JInternalFrame} to be activated */ void activateFrame(JInternalFrame f); /** * Generally, indicate that this frame has lost focus. This is usually called * after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false. + * + * @param f the {@code JInternalFrame} to be deactivated */ void deactivateFrame(JInternalFrame f); - /** This method is normally called when the user has indicated that - * they will begin dragging a component around. This method should be called - * prior to any dragFrame() calls to allow the DesktopManager to prepare any - * necessary state. Normally f will be a JInternalFrame. - */ + /** + * This method is normally called when the user has indicated that + * they will begin dragging a component around. This method should be called + * prior to any dragFrame() calls to allow the DesktopManager to prepare any + * necessary state. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being dragged + */ void beginDraggingFrame(JComponent f); - /** The user has moved the frame. Calls to this method will be preceded by calls - * to beginDraggingFrame(). - * Normally f will be a JInternalFrame. - */ + /** + * The user has moved the frame. Calls to this method will be preceded by calls + * to beginDraggingFrame(). + * Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being dragged + * @param newX the new x-coordinate + * @param newY the new y-coordinate + */ void dragFrame(JComponent f, int newX, int newY); - /** This method signals the end of the dragging session. Any state maintained by - * the DesktopManager can be removed here. Normally f will be a JInternalFrame. - */ + + /** + * This method signals the end of the dragging session. Any state maintained by + * the DesktopManager can be removed here. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being dragged + */ void endDraggingFrame(JComponent f); - /** This methods is normally called when the user has indicated that - * they will begin resizing the frame. This method should be called - * prior to any resizeFrame() calls to allow the DesktopManager to prepare any - * necessary state. Normally f will be a JInternalFrame. - */ + /** + * This method is normally called when the user has indicated that + * they will begin resizing the frame. This method should be called + * prior to any resizeFrame() calls to allow the DesktopManager to prepare any + * necessary state. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being resized + */ void beginResizingFrame(JComponent f, int direction); - /** The user has resized the component. Calls to this method will be preceded by calls - * to beginResizingFrame(). - * Normally f will be a JInternalFrame. - */ + + /** + * The user has resized the component. Calls to this method will be preceded by calls + * to beginResizingFrame(). + * Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being resized + * @param newX the new x-coordinate + * @param newY the new y-coordinate + * @param newWidth the new width + * @param newHeight the new height + */ void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight); - /** This method signals the end of the resize session. Any state maintained by - * the DesktopManager can be removed here. Normally f will be a JInternalFrame. - */ + + /** + * This method signals the end of the resize session. Any state maintained by + * the DesktopManager can be removed here. Normally f will be a JInternalFrame. + * + * @param f the {@code JComponent} being resized + */ void endResizingFrame(JComponent f); - /** This is a primitive reshape method.*/ + /** + * This is a primitive reshape method. + * + * @param f the {@code JComponent} being moved or resized + * @param newX the new x-coordinate + * @param newY the new y-coordinate + * @param newWidth the new width + * @param newHeight the new height + */ void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight); } diff --git a/jdk/src/share/classes/javax/swing/GrayFilter.java b/jdk/src/share/classes/javax/swing/GrayFilter.java index 573edbedb63..af5947e5eec 100644 --- a/jdk/src/share/classes/javax/swing/GrayFilter.java +++ b/jdk/src/share/classes/javax/swing/GrayFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,9 @@ public class GrayFilter extends RGBImageFilter { /** * Creates a disabled image + * + * @param i an {@code Image} to be created as disabled + * @return the new grayscale image created from {@code i} */ public static Image createDisabledImage (Image i) { GrayFilter filter = new GrayFilter(true, 50); diff --git a/jdk/src/share/classes/javax/swing/Icon.java b/jdk/src/share/classes/javax/swing/Icon.java index 87c53684711..4bad4d461d3 100644 --- a/jdk/src/share/classes/javax/swing/Icon.java +++ b/jdk/src/share/classes/javax/swing/Icon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,11 @@ public interface Icon * Draw the icon at the specified location. Icon implementations * may use the Component argument to get properties useful for * painting, e.g. the foreground or background color. + * + * @param c a {@code Component} to get properties useful for painting + * @param g the graphics context + * @param x the X coordinate of the icon's top-left corner + * @param y the Y coordinate of the icon's top-left corner */ void paintIcon(Component c, Graphics g, int x, int y); diff --git a/jdk/src/share/classes/javax/swing/JApplet.java b/jdk/src/share/classes/javax/swing/JApplet.java index 651d004660d..5f857076027 100644 --- a/jdk/src/share/classes/javax/swing/JApplet.java +++ b/jdk/src/share/classes/javax/swing/JApplet.java @@ -157,8 +157,11 @@ public class JApplet extends Applet implements Accessible, enableEvents(AWTEvent.KEY_EVENT_MASK); } - - /** Called by the constructor methods to create the default rootPane. */ + /** + * Called by the constructor methods to create the default rootPane. + * + * @return a new {@code JRootPane} + */ protected JRootPane createRootPane() { JRootPane rp = new JRootPane(); // NOTE: this uses setOpaque vs LookAndFeel.installProperty as there @@ -247,6 +250,7 @@ public class JApplet extends Applet implements Accessible, /** * Returns the menubar set on this applet. * + * @return the menubar set on this applet * @see #setJMenuBar */ public JMenuBar getJMenuBar() { @@ -542,6 +546,9 @@ public class JApplet extends Applet implements Accessible, // Accessibility support //////////////// + /** + * {@code AccessibleContext} associated with this {@code JApplet} + */ protected AccessibleContext accessibleContext = null; /** diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java index 7d0b876dc9d..765610ebbad 100644 --- a/jdk/src/share/classes/javax/swing/JComponent.java +++ b/jdk/src/share/classes/javax/swing/JComponent.java @@ -496,6 +496,7 @@ public abstract class JComponent extends Container implements Serializable, /** * Returns true if the JPopupMenu should be inherited from the parent. * + * @return true if the JPopupMenu should be inherited from the parent * @see #setComponentPopupMenu * @since 1.5 */ @@ -1302,6 +1303,7 @@ public abstract class JComponent extends Container implements Serializable, * SortingFocusTraversalPolicy from considering descendants * of this JComponent when computing a focus traversal cycle. * + * @return false * @see java.awt.Component#setFocusTraversalKeys * @see SortingFocusTraversalPolicy * @deprecated As of 1.4, replaced by @@ -2213,6 +2215,13 @@ public abstract class JComponent extends Container implements Serializable, * This method is now obsolete, please use a combination of * getActionMap() and getInputMap() for * similar behavior. + * + * @param anAction action to be registered to given keystroke and condition + * @param aKeyStroke a {@code KeyStroke} + * @param aCondition the condition to be associated with given keystroke + * and action + * @see #getActionMap + * @see #getInputMap(int) */ public void registerKeyboardAction(ActionListener anAction,KeyStroke aKeyStroke,int aCondition) { registerKeyboardAction(anAction,null,aKeyStroke,aCondition); @@ -2231,6 +2240,9 @@ public abstract class JComponent extends Container implements Serializable, * Unregisters a keyboard action. * This will remove the binding from the ActionMap * (if it exists) as well as the InputMaps. + * + * @param aKeyStroke the keystroke for which to unregister its + * keyboard action */ public void unregisterKeyboardAction(KeyStroke aKeyStroke) { ActionMap am = getActionMap(false); @@ -2286,6 +2298,8 @@ public abstract class JComponent extends Container implements Serializable, * conditions WHEN_FOCUSED and * WHEN_IN_FOCUSED_WINDOW condition. * + * @param aKeyStroke the keystroke for which to request an + * action-keystroke condition * @return the action-keystroke condition */ public int getConditionForKeyStroke(KeyStroke aKeyStroke) { @@ -2302,6 +2316,7 @@ public abstract class JComponent extends Container implements Serializable, * Returns the object that will perform the action registered for a * given keystroke. * + * @param aKeyStroke the keystroke for which to return a listener * @return the ActionListener * object invoked when the keystroke occurs */ @@ -2610,6 +2625,8 @@ public abstract class JComponent extends Container implements Serializable, * FocusTraversalPolicy of this JComponent's * focus-cycle-root ancestor is used. * + * @return true if this component can request to get the input focus, + * false if it can not * @see java.awt.FocusTraversalPolicy#getDefaultComponent * @deprecated As of 1.4, replaced by * FocusTraversalPolicy.getDefaultComponent(Container).requestFocus() @@ -2821,6 +2838,8 @@ public abstract class JComponent extends Container implements Serializable, * normally override this method if they process some * key events themselves. If the event is processed, * it should be consumed. + * + * @param e the event to be processed */ protected void processComponentKeyEvent(KeyEvent e) { } @@ -3032,6 +3051,10 @@ public abstract class JComponent extends Container implements Serializable, * setToolTipText. If a component provides * more extensive API to support differing tooltips at different locations, * this method should be overridden. + * + * @param event the {@code MouseEvent} that initiated the + * {@code ToolTip} display + * @return a string containing the tooltip */ public String getToolTipText(MouseEvent event) { return getToolTipText(); @@ -3774,6 +3797,10 @@ public abstract class JComponent extends Container implements Serializable, * but not very pretty outside borders in compound border situations. * It's rather arbitrary, but hopefully decent UI programmers will * not create multiple titled borders for the same component. + * + * @param b the {@code Border} for which to retrieve its title + * @return the border's title as a {@code String}, null if it has + * no title */ protected String getBorderTitle(Border b) { String s; @@ -4198,6 +4225,7 @@ public abstract class JComponent extends Container implements Serializable, * Returns true if this component is lightweight, that is, if it doesn't * have a native window system peer. * + * @param c the {@code Component} to be checked * @return true if this component is lightweight */ @SuppressWarnings("deprecation") diff --git a/jdk/src/share/classes/javax/swing/JDesktopPane.java b/jdk/src/share/classes/javax/swing/JDesktopPane.java index 35d53d2d918..54142344e37 100644 --- a/jdk/src/share/classes/javax/swing/JDesktopPane.java +++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java @@ -208,8 +208,11 @@ public class JDesktopPane extends JLayeredPane implements Accessible } /** - * Returns the DesktopManger that handles + * Returns the {@code DesktopManger} that handles * desktop-specific UI actions. + * + * @return the {@code DesktopManger} that handles desktop-specific + * UI actions */ public DesktopManager getDesktopManager() { return desktopManager; diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java index ae0a3519e93..00e8198b03e 100644 --- a/jdk/src/share/classes/javax/swing/JDialog.java +++ b/jdk/src/share/classes/javax/swing/JDialog.java @@ -664,6 +664,8 @@ public class JDialog extends Dialog implements WindowConstants, /** * Called by the constructor methods to create the default * {@code rootPane}. + * + * @return a new {@code JRootPane} */ protected JRootPane createRootPane() { JRootPane rp = new JRootPane(); @@ -854,6 +856,7 @@ public class JDialog extends Dialog implements WindowConstants, /** * Returns the menubar set on this dialog. * + * @return the menubar set on this dialog * @see #setJMenuBar */ public JMenuBar getJMenuBar() { @@ -1225,6 +1228,9 @@ public class JDialog extends Dialog implements WindowConstants, // Accessibility support //////////////// + /** + * {@code AccessibleContext} associated with this {@code JDialog} + */ protected AccessibleContext accessibleContext = null; /** diff --git a/jdk/src/share/classes/javax/swing/JLabel.java b/jdk/src/share/classes/javax/swing/JLabel.java index 2b0be80b1c7..3191f84ccf5 100644 --- a/jdk/src/share/classes/javax/swing/JLabel.java +++ b/jdk/src/share/classes/javax/swing/JLabel.java @@ -128,6 +128,10 @@ public class JLabel extends JComponent implements SwingConstants, Accessible private int horizontalTextPosition = TRAILING; private int iconTextGap = 4; + /** + * The Component this label is for; null if the label + * is not the label for a component + */ protected Component labelFor = null; /** @@ -310,6 +314,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible *

    * This is a JavaBeans bound property. * + * @param text the single line of text this component will display * @see #setVerticalTextPosition * @see #setHorizontalTextPosition * @see #setIcon @@ -366,6 +371,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible *

    * This is a JavaBeans bound property. * + * @param icon the default icon this component will display * @see #setVerticalTextPosition * @see #setHorizontalTextPosition * @see #getIcon @@ -476,6 +482,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * call the requestFocus method of the component specified by the * labelFor property when the mnemonic is activated. * + * @param key a keycode that indicates a mnemonic key * @see #getLabelFor * @see #setLabelFor * @beaninfo @@ -592,6 +599,8 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param key the property value to check * @param message the IllegalArgumentException detail message + * @return the key value if {@code key} is a a legal value for the + * horizontalAlignment properties * @exception IllegalArgumentException if key isn't LEFT, CENTER, RIGHT, * LEADING or TRAILING. * @see #setHorizontalTextPosition @@ -617,6 +626,8 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param key the property value to check * @param message the IllegalArgumentException detail message + * @return the key value if {@code key} is a legal value for the + * verticalAlignment or verticalTextPosition properties * @exception IllegalArgumentException if key isn't TOP, CENTER, or BOTTOM. * @see #setVerticalAlignment * @see #setVerticalTextPosition @@ -652,6 +663,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible *

    * This is a JavaBeans bound property. * + * @param iconTextGap the space between the icon and text properties * @see #getIconTextGap * @beaninfo * bound: true diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java index 3f2a57323a5..ca00144b774 100644 --- a/jdk/src/share/classes/javax/swing/JPopupMenu.java +++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java @@ -298,6 +298,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * it to the end of this menu. * * @param s the string for the menu item to be added + * @return a new {@code JMenuItem} created using {@code s} */ public JMenuItem add(String s) { return add(new JMenuItem(s)); @@ -452,6 +453,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { /** * Returns a properly configured PropertyChangeListener * which updates the control as changes to the Action occur. + * + * @param b the menu item for which to create a listener + * @return a properly configured {@code PropertyChangeListener} */ protected PropertyChangeListener createActionChangeListener(JMenuItem b) { return b.createActionPropertyChangeListener0(b.getAction()); @@ -1530,6 +1534,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { @SuppressWarnings("serial") static public class Separator extends JSeparator { + /** + * Constructs a popup menu-specific Separator. + */ public Separator( ) { super( JSeparator.HORIZONTAL ); @@ -1553,6 +1560,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * Returns true if the MouseEvent is considered a popup trigger * by the JPopupMenu's currently installed UI. * + * @param e a {@code MouseEvent} * @return true if the mouse event is a popup trigger * @since 1.3 */ diff --git a/jdk/src/share/classes/javax/swing/JScrollPane.java b/jdk/src/share/classes/javax/swing/JScrollPane.java index 373523e936e..39700a68429 100644 --- a/jdk/src/share/classes/javax/swing/JScrollPane.java +++ b/jdk/src/share/classes/javax/swing/JScrollPane.java @@ -1102,6 +1102,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * setColumnHeaderView * to add a column header component and its viewport to the scroll pane. * + * @param columnHeader a {@code JViewport} which is the new column header * @see #getColumnHeader * @see #setColumnHeaderView * @@ -1299,6 +1300,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * Indicates whether or not scrolling will take place in response to the * mouse wheel. Wheel scrolling is enabled by default. * + * @return true if mouse wheel scrolling is enabled, false otherwise * @see #setWheelScrollingEnabled * @since 1.4 * @beaninfo @@ -1448,9 +1450,12 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce protected class AccessibleJScrollPane extends AccessibleJComponent implements ChangeListener, PropertyChangeListener { + /** + * this {@code JScrollPane}'s current {@code JViewport} + */ protected JViewport viewPort = null; - /* + /** * Resets the viewport ChangeListener and PropertyChangeListener */ public void resetViewPort() { diff --git a/jdk/src/share/classes/javax/swing/JSpinner.java b/jdk/src/share/classes/javax/swing/JSpinner.java index 1643257dec5..2e51212ff3a 100644 --- a/jdk/src/share/classes/javax/swing/JSpinner.java +++ b/jdk/src/share/classes/javax/swing/JSpinner.java @@ -149,6 +149,7 @@ public class JSpinner extends JComponent implements Accessible * a set of previous/next buttons, and an editor appropriate * for the model. * + * @param model a model for the new spinner * @throws NullPointerException if the model is {@code null} */ public JSpinner(SpinnerModel model) { @@ -328,6 +329,7 @@ public class JSpinner extends JComponent implements Accessible * getModel().getValue() * * + * @return the current value of the model * @see #setValue * @see SpinnerModel#getValue */ @@ -349,6 +351,7 @@ public class JSpinner extends JComponent implements Accessible * getModel().setValue(value) * * + * @param value new value for the spinner * @throws IllegalArgumentException if value isn't allowed * @see #getValue * @see SpinnerModel#setValue diff --git a/jdk/src/share/classes/javax/swing/JTextField.java b/jdk/src/share/classes/javax/swing/JTextField.java index e90740362f5..94290052870 100644 --- a/jdk/src/share/classes/javax/swing/JTextField.java +++ b/jdk/src/share/classes/javax/swing/JTextField.java @@ -675,6 +675,9 @@ public class JTextField extends JTextComponent implements SwingConstants { * that of the Action. * * @param a the textfield's action + * @return a {@code PropertyChangeListener} that is responsible for + * listening for changes from the specified {@code Action} and + * updating the appropriate properties * @since 1.3 * @see Action * @see #setAction diff --git a/jdk/src/share/classes/javax/swing/JWindow.java b/jdk/src/share/classes/javax/swing/JWindow.java index cf95a417fd5..804d4e3edc7 100644 --- a/jdk/src/share/classes/javax/swing/JWindow.java +++ b/jdk/src/share/classes/javax/swing/JWindow.java @@ -272,6 +272,8 @@ public class JWindow extends Window implements Accessible, /** * Called by the constructor methods to create the default * rootPane. + * + * @return a new {@code JRootPane} */ protected JRootPane createRootPane() { JRootPane rp = new JRootPane(); diff --git a/jdk/src/share/classes/javax/swing/ProgressMonitor.java b/jdk/src/share/classes/javax/swing/ProgressMonitor.java index 506b443b4f5..e2af3ee44cd 100644 --- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java +++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java @@ -369,6 +369,8 @@ public class ProgressMonitor implements Accessible /** * Returns true if the user hits the Cancel button in the progress dialog. + * + * @return true if the user hits the Cancel button in the progress dialog */ public boolean isCanceled() { if (pane == null) return false; @@ -396,6 +398,8 @@ public class ProgressMonitor implements Accessible * Returns the amount of time this object waits before deciding whether * or not to popup a progress monitor. * + * @return the amount of time in milliseconds this object waits before + * deciding whether or not to popup a progress monitor * @see #setMillisToDecideToPopup */ public int getMillisToDecideToPopup() { @@ -419,6 +423,8 @@ public class ProgressMonitor implements Accessible /** * Returns the amount of time it will take for the popup to appear. * + * @return the amont of time in milliseconds it will take for the + * popup to appear * @see #setMillisToPopup */ public int getMillisToPopup() { diff --git a/jdk/src/share/classes/javax/swing/SpinnerModel.java b/jdk/src/share/classes/javax/swing/SpinnerModel.java index 7c060248eac..57af106271f 100644 --- a/jdk/src/share/classes/javax/swing/SpinnerModel.java +++ b/jdk/src/share/classes/javax/swing/SpinnerModel.java @@ -88,6 +88,7 @@ public interface SpinnerModel * that case, model.setValue(new Number(11)) * would throw an exception. * + * @param value new value for the spinner * @throws IllegalArgumentException if value isn't allowed * @see #getValue */ diff --git a/jdk/src/share/classes/javax/swing/Timer.java b/jdk/src/share/classes/javax/swing/Timer.java index 2c25598b88c..6caced7dd8d 100644 --- a/jdk/src/share/classes/javax/swing/Timer.java +++ b/jdk/src/share/classes/javax/swing/Timer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -154,6 +154,9 @@ public class Timer implements Serializable * NOTE: all fields need to be handled in readResolve */ + /** + * The collection of registered listeners + */ protected EventListenerList listenerList = new EventListenerList(); // The following field strives to maintain the following: @@ -335,6 +338,7 @@ public class Timer implements Serializable * If no such listeners exist, * this method returns an empty array. * + * @param the type of {@code EventListener} class being requested * @param listenerType the type of listeners requested; * this parameter should specify an interface * that descends from java.util.EventListener @@ -410,6 +414,7 @@ public class Timer implements Serializable * Returns the delay, in milliseconds, * between firings of action events. * + * @return the delay, in milliseconds, between firings of action events * @see #setDelay * @see #getInitialDelay */ @@ -441,8 +446,9 @@ public class Timer implements Serializable /** - * Returns the Timer's initial delay. + * Returns the {@code Timer}'s initial delay. * + * @return the {@code Timer}'s intial delay, in milliseconds * @see #setInitialDelay * @see #setDelay */ @@ -470,6 +476,8 @@ public class Timer implements Serializable * an action event * to its listeners multiple times. * + * @return true if the {@code Timer} will send an action event to its + * listeners multiple times * @see #setRepeats */ public boolean isRepeats() { @@ -506,9 +514,11 @@ public class Timer implements Serializable /** - * Returns true if the Timer coalesces + * Returns {@code true} if the {@code Timer} coalesces * multiple pending action events. * + * @return true if the {@code Timer} coalesces multiple pending + * action events * @see #setCoalesce */ public boolean isCoalesce() { @@ -555,8 +565,9 @@ public class Timer implements Serializable /** - * Returns true if the Timer is running. + * Returns {@code true} if the {@code Timer} is running. * + * @return true if the {@code Timer} is running, false otherwise * @see #start */ public boolean isRunning() { From 529b1b6422b88a3f590d88bf94d07ea6702cb2f5 Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Wed, 9 Jul 2014 17:11:53 +0400 Subject: [PATCH 007/166] 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7 Reviewed-by: pchelko --- .../swing/plaf/basic/BasicArrowButton.java | 2 + .../swing/plaf/basic/BasicButtonListener.java | 20 +++- .../plaf/basic/BasicCheckBoxMenuItemUI.java | 19 +++- .../swing/plaf/basic/BasicCheckBoxUI.java | 7 ++ .../swing/plaf/basic/BasicColorChooserUI.java | 47 +++++++++- .../swing/plaf/basic/BasicComboBoxEditor.java | 6 ++ .../plaf/basic/BasicComboBoxRenderer.java | 3 + .../swing/plaf/basic/BasicDesktopPaneUI.java | 40 ++++++++ .../swing/plaf/basic/BasicDirectoryModel.java | 43 ++++++++- .../swing/plaf/basic/BasicGraphicsUtils.java | 93 +++++++++++++++++-- .../javax/swing/plaf/basic/BasicHTML.java | 11 +++ .../swing/plaf/basic/BasicIconFactory.java | 40 ++++++++ .../swing/plaf/basic/BasicMenuBarUI.java | 48 +++++++++- .../javax/swing/plaf/basic/BasicMenuUI.java | 51 ++++++++++ .../javax/swing/plaf/basic/BasicPanelUI.java | 18 +++- .../plaf/basic/BasicPopupMenuSeparatorUI.java | 8 +- .../swing/plaf/basic/BasicPopupMenuUI.java | 38 +++++++- .../basic/BasicRadioButtonMenuItemUI.java | 16 +++- .../swing/plaf/basic/BasicRadioButtonUI.java | 24 ++++- .../swing/plaf/basic/BasicRootPaneUI.java | 48 +++++++++- .../swing/plaf/basic/BasicSeparatorUI.java | 39 +++++++- .../swing/plaf/basic/BasicSpinnerUI.java | 2 + .../swing/plaf/basic/BasicTableHeaderUI.java | 28 +++++- .../javax/swing/plaf/basic/BasicTextUI.java | 12 +++ .../swing/plaf/basic/BasicToggleButtonUI.java | 16 +++- .../plaf/basic/BasicToolBarSeparatorUI.java | 8 +- .../swing/plaf/basic/BasicToolTipUI.java | 39 +++++++- .../swing/plaf/basic/BasicViewportUI.java | 18 +++- .../javax/swing/plaf/basic/ComboPopup.java | 4 + .../swing/plaf/basic/DefaultMenuLayout.java | 11 +++ 30 files changed, 714 insertions(+), 45 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java index 750fe60c235..4c1e590779e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java @@ -99,6 +99,8 @@ public class BasicArrowButton extends JButton implements SwingConstants /** * Returns the direction of the arrow. + * + * @return the direction of the arrow */ public int getDirection() { return direction; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java index 1367e0c58a8..3278d33e4a9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,6 +58,11 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener, } + /** + * Constructs a new instance of {@code BasicButtonListener}. + * + * @param b an abstract button + */ public BasicButtonListener(AbstractButton b) { } @@ -76,13 +81,20 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener, } } + /** + * Checks the opacity of the {@code AbstractButton}. + * + * @param b an abstract button + */ protected void checkOpacity(AbstractButton b) { b.setOpaque( b.isContentAreaFilled() ); } /** * Register default key actions: pressing space to "click" a - * button and registring the keyboard mnemonic (if any). + * button and registering the keyboard mnemonic (if any). + * + * @param c a component */ public void installKeyboardActions(JComponent c) { AbstractButton b = (AbstractButton)c; @@ -98,7 +110,9 @@ public class BasicButtonListener implements MouseListener, MouseMotionListener, } /** - * Unregister's default key actions + * Unregister default key actions. + * + * @param c a component */ public void uninstallKeyboardActions(JComponent c) { SwingUtilities.replaceUIInputMap(c, JComponent. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java index 69a28c61723..99ffc834844 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,6 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.plaf.*; -import javax.swing.border.*; -import java.io.Serializable; - /** * BasicCheckboxMenuItem implementation @@ -42,6 +39,12 @@ import java.io.Serializable; */ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI { + /** + * Constructs a new instance of {@code BasicCheckBoxMenuItemUI}. + * + * @param c a component + * @return a new instance of {@code BasicCheckBoxMenuItemUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicCheckBoxMenuItemUI(); } @@ -50,6 +53,14 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI { return "CheckBoxMenuItem"; } + /** + * Invoked when mouse event occurs. + * + * @param item a menu item + * @param e a mouse event + * @param path an array of {@code MenuElement} + * @param manager an instance of {@code MenuSelectionManager} + */ public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) { Point p = e.getPoint(); if(p.x >= 0 && p.x < item.getWidth() && diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java index 256a3afbfcf..d0deeb59ca5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java @@ -59,6 +59,13 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI { // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code BasicCheckBoxUI}. + * + * @param b a component + * @return an instance of {@code BasicCheckBoxUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); BasicCheckBoxUI checkboxUI = diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java index 42b9a0b6c8b..7ad582a0792 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java @@ -61,21 +61,45 @@ public class BasicColorChooserUI extends ColorChooserUI boolean isMultiPanel = false; private static TransferHandler defaultTransferHandler = new ColorTransferHandler(); + /** + * The array of default color choosers. + */ protected AbstractColorChooserPanel[] defaultChoosers; + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener previewListener; + + /** + * The instance of {@code PropertyChangeListener}. + */ protected PropertyChangeListener propertyChangeListener; private Handler handler; + /** + * Returns a new instance of {@code BasicColorChooserUI}. + * + * @param c a component + * @return a new instance of {@code BasicColorChooserUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicColorChooserUI(); } + /** + * Returns an array of default color choosers. + * + * @return an array of default color choosers + */ protected AbstractColorChooserPanel[] createDefaultChoosers() { AbstractColorChooserPanel[] panels = ColorChooserComponentFactory.getDefaultChooserPanels(); return panels; } + /** + * Uninstalls default color choosers. + */ protected void uninstallDefaultChoosers() { AbstractColorChooserPanel[] choosers = chooser.getChooserPanels(); for( int i = 0 ; i < choosers.length; i++) { @@ -138,6 +162,9 @@ public class BasicColorChooserUI extends ColorChooserUI handler = null; } + /** + * Installs preview panel. + */ protected void installPreviewPanel() { JComponent previewPanel = this.chooser.getPreviewPanel(); if (previewPanel == null) { @@ -169,6 +196,9 @@ public class BasicColorChooserUI extends ColorChooserUI this.chooser.remove(this.previewPanelHolder); } + /** + * Installs default properties. + */ protected void installDefaults() { LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background", "ColorChooser.foreground", @@ -180,16 +210,21 @@ public class BasicColorChooserUI extends ColorChooserUI } } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { if (chooser.getTransferHandler() instanceof UIResource) { chooser.setTransferHandler(null); } } - + /** + * Registers listeners. + */ protected void installListeners() { propertyChangeListener = createPropertyChangeListener(); - chooser.addPropertyChangeListener( propertyChangeListener ); + chooser.addPropertyChangeListener(propertyChangeListener); previewListener = getHandler(); chooser.getSelectionModel().addChangeListener(previewListener); @@ -202,10 +237,18 @@ public class BasicColorChooserUI extends ColorChooserUI return handler; } + /** + * Returns an instance of {@code PropertyChangeListener}. + * + * @return an instance of {@code PropertyChangeListener} + */ protected PropertyChangeListener createPropertyChangeListener() { return getHandler(); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { chooser.removePropertyChangeListener( propertyChangeListener ); chooser.getSelectionModel().removeChangeListener(previewListener); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java index e9248631d1f..c7534c1e0c1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java @@ -41,9 +41,15 @@ import sun.reflect.misc.MethodUtil; * @author Mark Davidson */ public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener { + /** + * An instance of {@code JTextField}. + */ protected JTextField editor; private Object oldValue; + /** + * Constructs a new instance of {@code BasicComboBoxEditor}. + */ public BasicComboBoxEditor() { editor = createEditorComponent(); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java index 4b596dc4e19..231eced6f52 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java @@ -59,6 +59,9 @@ implements ListCellRenderer, Serializable { protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); private final static Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1); + /** + * Constructs a new instance of {@code BasicComboBoxRenderer}. + */ public BasicComboBoxRenderer() { super(); setOpaque(true); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java index 695eb87bded..fe71487bdea 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java @@ -55,7 +55,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { private Handler handler; private PropertyChangeListener pcl; + /** + * The instance of {@code JDesktopPane}. + */ protected JDesktopPane desktop; + + /** + * The instance of {@code DesktopManager}. + */ protected DesktopManager desktopManager; /** @@ -109,10 +116,19 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { @Deprecated protected KeyStroke navigateKey2; + /** + * Constructs a new instance of {@code BasicDesktopPaneUI}. + * + * @param c a component + * @return a new instance of {@code BasicDesktopPaneUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicDesktopPaneUI(); } + /** + * Constructs a new instance of {@code BasicDesktopPaneUI}. + */ public BasicDesktopPaneUI() { } @@ -133,6 +149,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { handler = null; } + /** + * Installs default properties. + */ protected void installDefaults() { if (desktop.getBackground() == null || desktop.getBackground() instanceof UIResource) { @@ -141,6 +160,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE); } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { } /** @@ -169,6 +191,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { pcl = null; } + /** + * Installs desktop manager. + */ protected void installDesktopManager() { desktopManager = desktop.getDesktopManager(); if(desktopManager == null) { @@ -177,6 +202,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { } } + /** + * Uninstalls desktop manager. + */ protected void uninstallDesktopManager() { if(desktop.getDesktopManager() instanceof UIResource) { desktop.setDesktopManager(null); @@ -184,6 +212,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { desktopManager = null; } + /** + * Installs keyboard actions. + */ protected void installKeyboardActions(){ InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); if (inputMap != null) { @@ -202,9 +233,15 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { registerKeyboardActions(); } + /** + * Registers keyboard actions. + */ protected void registerKeyboardActions(){ } + /** + * Unregisters keyboard actions. + */ protected void unregisterKeyboardActions(){ } @@ -253,6 +290,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI { map.put(new Actions(Actions.NAVIGATE_PREVIOUS)); } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions(){ unregisterKeyboardActions(); SwingUtilities.replaceUIInputMap(desktop, JComponent. diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java index 6875367c91e..c31332b15aa 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java @@ -55,6 +55,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr private boolean busy = false; + /** + * Constructs a new instance of {@code BasicDirectoryModel}. + * + * @param filechooser an instance of {JFileChooser} + */ public BasicDirectoryModel(JFileChooser filechooser) { this.filechooser = filechooser; validateFileCache(); @@ -93,6 +98,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } + /** + * Returns a list of directories. + * + * @return a list of directories + */ public Vector getDirectories() { synchronized(fileCache) { if (directories != null) { @@ -103,6 +113,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } + /** + * Returns a list of files. + * + * @return a list of files + */ public Vector getFiles() { synchronized(fileCache) { if (files != null) { @@ -126,6 +141,9 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } + /** + * Validates content of file cache. + */ public void validateFileCache() { File currentDirectory = filechooser.getCurrentDirectory(); if (currentDirectory == null) { @@ -163,20 +181,34 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr } } - + /** + * Invoked when a content is changed. + */ public void fireContentsChanged() { - // System.out.println("BasicDirectoryModel: firecontentschanged"); - fireContentsChanged(this, 0, getSize()-1); + fireContentsChanged(this, 0, getSize() - 1); } public int getSize() { return fileCache.size(); } + /** + * Returns {@code true} if an element {@code o} is in file cache, + * otherwise, returns {@code false}. + * + * @param o an element + * @return {@code true} if an element {@code o} is in file cache + */ public boolean contains(Object o) { return fileCache.contains(o); } + /** + * Returns an index of element {@code o} in file cache. + * + * @param o an element + * @return an index of element {@code o} in file cache + */ public int indexOf(Object o) { return fileCache.indexOf(o); } @@ -197,6 +229,11 @@ public class BasicDirectoryModel extends AbstractListModel implements Pr public void intervalRemoved(ListDataEvent e) { } + /** + * Sorts a list of files. + * + * @param v a list of files + */ protected void sort(Vector v){ ShellFolder.sort(v); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java index d3e0bb795ec..941f09b28fb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,16 +40,30 @@ import java.awt.event.InputEvent; import sun.swing.SwingUtilities2; -/* +/** + * Convenient util class. + * * @author Hans Muller */ - public class BasicGraphicsUtils { private static final Insets GROOVE_INSETS = new Insets(2, 2, 2, 2); private static final Insets ETCHED_INSETS = new Insets(2, 2, 2, 2); + /** + * Draws an etched rectangle. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color highlighting + * @param lightHighlight a color of light highlighting + */ public static void drawEtchedRect(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight) @@ -89,6 +103,17 @@ public class BasicGraphicsUtils } + /** + * Draws a groove. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param shadow a color of shadow + * @param highlight a color highlighting + */ public static void drawGroove(Graphics g, int x, int y, int w, int h, Color shadow, Color highlight) { @@ -120,6 +145,21 @@ public class BasicGraphicsUtils } + /** + * Draws a bezel. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param isPressed is component pressed + * @param isDefault is default drawing + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color highlighting + * @param lightHighlight a color of light highlighting + */ public static void drawBezel(Graphics g, int x, int y, int w, int h, boolean isPressed, boolean isDefault, Color shadow, Color darkShadow, @@ -176,6 +216,19 @@ public class BasicGraphicsUtils g.setColor(oldColor); } + /** + * Draws a lowered bezel. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color highlighting + * @param lightHighlight a color of light highlighting + */ public static void drawLoweredBezel(Graphics g, int x, int y, int w, int h, Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { @@ -197,11 +250,17 @@ public class BasicGraphicsUtils } - /** Draw a string with the graphics g at location (x,y) - * just like g.drawString would. - * The first occurrence of underlineChar - * in text will be underlined. The matching algorithm is - * not case sensitive. + /** + * Draw a string with the graphics {@code g} at location (x,y) + * just like {@code g.drawString} would. The first occurrence + * of {@code underlineChar} in text will be underlined. + * The matching algorithm is not case sensitive. + * + * @param g an instance of {@code Graphics} + * @param text a text + * @param underlinedChar an underlined char + * @param x an X coordinate + * @param y an Y coordinate */ public static void drawString(Graphics g,String text,int underlinedChar,int x,int y) { int index=-1; @@ -244,9 +303,18 @@ public class BasicGraphicsUtils public static void drawStringUnderlineCharAt(Graphics g, String text, int underlinedIndex, int x,int y) { SwingUtilities2.drawStringUnderlineCharAt(null, g, text, - underlinedIndex, x, y); + underlinedIndex, x, y); } + /** + * Draws dashed rectangle. + * + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param width a width of rectangle + * @param height a height of rectangle + */ public static void drawDashedRect(Graphics g,int x,int y,int width,int height) { int vx,vy; @@ -263,6 +331,13 @@ public class BasicGraphicsUtils } } + /** + * Returns the preferred size of the button. + * + * @param b an instance of {@code AbstractButton} + * @param textIconGap a gap between text and icon + * @return the preferred size of the button + */ public static Dimension getPreferredButtonSize(AbstractButton b, int textIconGap) { if(b.getComponentCount() > 0) { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java index 02719839496..0c0559948e5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java @@ -48,6 +48,10 @@ public class BasicHTML { /** * Create an html renderer for the given component and * string of html. + * + * @param c a component + * @param html an HTML string + * @return an HTML renderer */ public static View createHTMLView(JComponent c, String html) { BasicEditorKit kit = getFactory(); @@ -178,6 +182,10 @@ public class BasicHTML { * Check the given string to see if it should trigger the * html rendering logic in a non-text component that supports * html rendering. + * + * @param s a text + * @return {@code true} if the given string should trigger the + * html rendering logic in a non-text component */ public static boolean isHTMLString(String s) { if (s != null) { @@ -198,6 +206,9 @@ public class BasicHTML { * This method is useful for ComponentUI implementations * that are static (i.e. shared) and get their state * entirely from the JComponent. + * + * @param c a component + * @param text a text */ public static void updateRenderer(JComponent c, String text) { View value = null; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java index ec27f18dac1..638885127b2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java @@ -61,6 +61,11 @@ public class BasicIconFactory implements Serializable private static Icon menuItemArrowIcon; private static Icon menuArrowIcon; + /** + * Returns a menu item check icon. + * + * @return a menu item check icon + */ public static Icon getMenuItemCheckIcon() { if (menuItemCheckIcon == null) { menuItemCheckIcon = new MenuItemCheckIcon(); @@ -68,6 +73,11 @@ public class BasicIconFactory implements Serializable return menuItemCheckIcon; } + /** + * Returns a menu item arrow icon. + * + * @return a menu item arrow icon + */ public static Icon getMenuItemArrowIcon() { if (menuItemArrowIcon == null) { menuItemArrowIcon = new MenuItemArrowIcon(); @@ -75,6 +85,11 @@ public class BasicIconFactory implements Serializable return menuItemArrowIcon; } + /** + * Returns a menu arrow icon. + * + * @return a menu arrow icon + */ public static Icon getMenuArrowIcon() { if (menuArrowIcon == null) { menuArrowIcon = new MenuArrowIcon(); @@ -82,6 +97,11 @@ public class BasicIconFactory implements Serializable return menuArrowIcon; } + /** + * Returns a check box icon. + * + * @return a check box icon + */ public static Icon getCheckBoxIcon() { if (checkBoxIcon == null) { checkBoxIcon = new CheckBoxIcon(); @@ -89,6 +109,11 @@ public class BasicIconFactory implements Serializable return checkBoxIcon; } + /** + * Returns a radio button icon. + * + * @return a radio button icon + */ public static Icon getRadioButtonIcon() { if (radioButtonIcon == null) { radioButtonIcon = new RadioButtonIcon(); @@ -96,6 +121,11 @@ public class BasicIconFactory implements Serializable return radioButtonIcon; } + /** + * Returns a check box menu item icon. + * + * @return a check box menu item icon + */ public static Icon getCheckBoxMenuItemIcon() { if (checkBoxMenuItemIcon == null) { checkBoxMenuItemIcon = new CheckBoxMenuItemIcon(); @@ -103,6 +133,11 @@ public class BasicIconFactory implements Serializable return checkBoxMenuItemIcon; } + /** + * Returns a radio button menu item icon. + * + * @return a radio button menu item icon + */ public static Icon getRadioButtonMenuItemIcon() { if (radioButtonMenuItemIcon == null) { radioButtonMenuItemIcon = new RadioButtonMenuItemIcon(); @@ -110,6 +145,11 @@ public class BasicIconFactory implements Serializable return radioButtonMenuItemIcon; } + /** + * Returns an empty frame icon. + * + * @return an empty frame icon + */ public static Icon createEmptyFrameIcon() { if(frame_icon == null) frame_icon = new EmptyFrameIcon(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java index 75b10bef987..2892a49afc7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,11 +54,29 @@ import javax.swing.plaf.*; * @author Arnaud Weber */ public class BasicMenuBarUI extends MenuBarUI { + + /** + * The instance of {@code JMenuBar}. + */ protected JMenuBar menuBar = null; + + /** + * The instance of {@code ContainerListener}. + */ protected ContainerListener containerListener; + + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener changeListener; private Handler handler; + /** + * Returns a new instance of {@code BasicMenuBarUI}. + * + * @param x a component + * @return a new instance of {@code BasicMenuBarUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicMenuBarUI(); } @@ -76,6 +94,9 @@ public class BasicMenuBarUI extends MenuBarUI { } + /** + * Installs default properties. + */ protected void installDefaults() { if (menuBar.getLayout() == null || menuBar.getLayout() instanceof UIResource) { @@ -90,6 +111,9 @@ public class BasicMenuBarUI extends MenuBarUI { "MenuBar.font"); } + /** + * Registers listeners. + */ protected void installListeners() { containerListener = createContainerListener(); changeListener = createChangeListener(); @@ -102,6 +126,9 @@ public class BasicMenuBarUI extends MenuBarUI { menuBar.addContainerListener(containerListener); } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); @@ -131,12 +158,18 @@ public class BasicMenuBarUI extends MenuBarUI { menuBar = null; } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { if (menuBar!=null) { LookAndFeel.uninstallBorder(menuBar); } } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { menuBar.removeContainerListener(containerListener); @@ -151,16 +184,29 @@ public class BasicMenuBarUI extends MenuBarUI { handler = null; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIInputMap(menuBar, JComponent. WHEN_IN_FOCUSED_WINDOW, null); SwingUtilities.replaceUIActionMap(menuBar, null); } + /** + * Returns an instance of {@code ContainerListener}. + * + * @return an instance of {@code ContainerListener} + */ protected ContainerListener createContainerListener() { return getHandler(); } + /** + * Returns an instance of {@code ChangeListener}. + * + * @return an instance of {@code ChangeListener} + */ protected ChangeListener createChangeListener() { return getHandler(); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java index 2ea9fb920ab..7231ae2a570 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java @@ -48,7 +48,14 @@ import java.util.ArrayList; */ public class BasicMenuUI extends BasicMenuItemUI { + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener changeListener; + + /** + * The instance of {@code MenuListener}. + */ protected MenuListener menuListener; private int lastMnemonic = 0; @@ -63,6 +70,12 @@ public class BasicMenuUI extends BasicMenuItemUI private static boolean crossMenuMnemonic = true; + /** + * Constructs a new instance of {@code BasicMenuUI}. + * + * @param x a component + * @return a new instance of {@code BasicMenuUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicMenuUI(); } @@ -152,10 +165,22 @@ public class BasicMenuUI extends BasicMenuItemUI return getHandler(); } + /** + * Returns an instance of {@code MenuListener}. + * + * @param c a component + * @return an instance of {@code MenuListener} + */ protected MenuListener createMenuListener(JComponent c) { return null; } + /** + * Returns an instance of {@code ChangeListener}. + * + * @param c a component + * @return an instance of {@code ChangeListener} + */ protected ChangeListener createChangeListener(JComponent c) { return null; } @@ -208,6 +233,11 @@ public class BasicMenuUI extends BasicMenuItemUI return null; } + /** + * Sets timer to the {@code menu}. + * + * @param menu an instance of {@code JMenu}. + */ protected void setupPostTimer(JMenu menu) { Timer timer = new Timer(menu.getDelay(), new Actions( Actions.SELECT, menu,false)); @@ -388,11 +418,32 @@ public class BasicMenuUI extends BasicMenuItemUI * is now obsolete. KeyBindings are now managed by the popup menu. */ public class ChangeHandler implements ChangeListener { + /** + * The instance of {@code JMenu}. + */ public JMenu menu; + + /** + * The instance of {@code BasicMenuUI}. + */ public BasicMenuUI ui; + + /** + * {@code true} if an item of popup menu is selected. + */ public boolean isSelected = false; + + /** + * The component that was focused. + */ public Component wasFocused; + /** + * Constructs a new instance of {@code ChangeHandler}. + * + * @param m an instance of {@code JMenu} + * @param ui an instance of {@code BasicMenuUI} + */ public ChangeHandler(JMenu m, BasicMenuUI ui) { menu = m; this.ui = ui; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java index 985fae73f4f..46929bcca69 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,12 @@ public class BasicPanelUI extends PanelUI { // Shared UI object private static PanelUI panelUI; + /** + * Returns an instance of {@code BasicPanelUI}. + * + * @param c a component + * @return an instance of {@code BasicPanelUI} + */ public static ComponentUI createUI(JComponent c) { if(panelUI == null) { panelUI = new BasicPanelUI(); @@ -62,6 +68,11 @@ public class BasicPanelUI extends PanelUI { super.uninstallUI(c); } + /** + * Method for installing panel properties. + * + * @param p an instance of {@code JPanel} + */ protected void installDefaults(JPanel p) { LookAndFeel.installColorsAndFont(p, "Panel.background", @@ -71,6 +82,11 @@ public class BasicPanelUI extends PanelUI { LookAndFeel.installProperty(p, "opaque", Boolean.TRUE); } + /** + * Method for uninstalling panel properties. + * + * @param p an instance of {@code JPanel} + */ protected void uninstallDefaults(JPanel p) { LookAndFeel.uninstallBorder(p); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java index ded6ad243d2..9122beae1f0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,12 @@ import javax.swing.plaf.ComponentUI; public class BasicPopupMenuSeparatorUI extends BasicSeparatorUI { + /** + * Returns a new instance of {@code BasicPopupMenuSeparatorUI}. + * + * @param c a component + * @return a new instance of {@code BasicPopupMenuSeparatorUI} + */ public static ComponentUI createUI( JComponent c ) { return new BasicPopupMenuSeparatorUI(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java index 517615ac846..e9d878a2ca2 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,6 +66,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { static final StringBuilder MENU_KEYBOARD_HELPER_KEY = new StringBuilder( "javax.swing.plaf.basic.BasicPopupMenuUI.MenuKeyboardHelper"); + /** + * The instance of {@code JPopupMenu}. + */ protected JPopupMenu popupMenu = null; private transient PopupMenuListener popupMenuListener = null; private MenuKeyListener menuKeyListener = null; @@ -73,10 +76,19 @@ public class BasicPopupMenuUI extends PopupMenuUI { private static boolean checkedUnpostPopup; private static boolean unpostPopup; + /** + * Constructs a new instance of {@code BasicPopupMenuUI}. + * + * @param x a component + * @return a new instance of {@code BasicPopupMenuUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicPopupMenuUI(); } + /** + * Constructs a new instance of {@code BasicPopupMenuUI}. + */ public BasicPopupMenuUI() { BasicLookAndFeel.needsEventHelper = true; LookAndFeel laf = UIManager.getLookAndFeel(); @@ -93,6 +105,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { installKeyboardActions(); } + /** + * Installs default properties. + */ public void installDefaults() { if (popupMenu.getLayout() == null || popupMenu.getLayout() instanceof UIResource) @@ -101,11 +116,14 @@ public class BasicPopupMenuUI extends PopupMenuUI { LookAndFeel.installProperty(popupMenu, "opaque", Boolean.TRUE); LookAndFeel.installBorder(popupMenu, "PopupMenu.border"); LookAndFeel.installColorsAndFont(popupMenu, - "PopupMenu.background", - "PopupMenu.foreground", - "PopupMenu.font"); + "PopupMenu.background", + "PopupMenu.foreground", + "PopupMenu.font"); } + /** + * Registers listeners. + */ protected void installListeners() { if (popupMenuListener == null) { popupMenuListener = new BasicPopupMenuListener(); @@ -138,6 +156,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { } } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { } @@ -181,10 +202,16 @@ public class BasicPopupMenuUI extends PopupMenuUI { popupMenu = null; } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(popupMenu); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { if (popupMenuListener != null) { popupMenu.removePopupMenuListener(popupMenuListener); @@ -194,6 +221,9 @@ public class BasicPopupMenuUI extends PopupMenuUI { } } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIActionMap(popupMenu, null); SwingUtilities.replaceUIInputMap(popupMenu, diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java index 99c8e3aaabb..6030aa743e1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,12 @@ import javax.swing.border.*; */ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI { + /** + * Returns a new instance of {@code BasicRadioButtonMenuItemUI}. + * + * @param b a component + * @return a new instance of {@code BasicRadioButtonMenuItemUI} + */ public static ComponentUI createUI(JComponent b) { return new BasicRadioButtonMenuItemUI(); } @@ -47,6 +53,14 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI return "RadioButtonMenuItem"; } + /** + * Invoked when mouse event occurs. + * + * @param item a menu item + * @param e a mouse event + * @param path an array of {@code MenuElement} + * @param manager an instance of {@code MenuSelectionManager} + */ public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) { Point p = e.getPoint(); if(p.x >= 0 && p.x < item.getWidth() && diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java index 47c9b7d75f8..ec9e88defe1 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,9 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI { private static final Object BASIC_RADIO_BUTTON_UI_KEY = new Object(); + /** + * The icon. + */ protected Icon icon; private boolean defaults_initialized = false; @@ -53,6 +56,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code BasicRadioButtonUI}. + * + * @param b a component + * @return an instance of {@code BasicRadioButtonUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); BasicRadioButtonUI radioButtonUI = @@ -87,6 +97,11 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI defaults_initialized = false; } + /** + * Returns the default icon. + * + * @return the default icon + */ public Icon getDefaultIcon() { return icon; } @@ -195,6 +210,13 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI } } + /** + * Paints focused radio button. + * + * @param g an instance of {@code Graphics} + * @param textRect bounds + * @param size the size of radio button + */ protected void paintFocus(Graphics g, Rectangle textRect, Dimension size){ } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java index 5c999e0089d..300e46a2e7b 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java @@ -48,6 +48,12 @@ public class BasicRootPaneUI extends RootPaneUI implements PropertyChangeListener { private static RootPaneUI rootPaneUI = new BasicRootPaneUI(); + /** + * Returns a new instance of {@code BasicRootPaneUI}. + * + * @param c a component + * @return a new instance of {@code BasicRootPaneUI} + */ public static ComponentUI createUI(JComponent c) { return rootPaneUI; } @@ -67,17 +73,37 @@ public class BasicRootPaneUI extends RootPaneUI implements uninstallKeyboardActions((JRootPane)c); } + /** + * Installs default properties. + * + * @param c an instance of {@code JRootPane} + */ protected void installDefaults(JRootPane c){ LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); } + /** + * Installs components. + * + * @param root an instance of {@code JRootPane} + */ protected void installComponents(JRootPane root) { } + /** + * Registers listeners. + * + * @param root an instance of {@code JRootPane} + */ protected void installListeners(JRootPane root) { root.addPropertyChangeListener(this); } + /** + * Registers keyboard actions. + * + * @param root an instance of {@code JRootPane} + */ protected void installKeyboardActions(JRootPane root) { InputMap km = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, root); SwingUtilities.replaceUIInputMap(root, @@ -92,19 +118,39 @@ public class BasicRootPaneUI extends RootPaneUI implements updateDefaultButtonBindings(root); } + /** + * Uninstalls default properties. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallDefaults(JRootPane root) { } + /** + * Unregisters components. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallComponents(JRootPane root) { } + /** + * Unregisters listeners. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallListeners(JRootPane root) { root.removePropertyChangeListener(this); } + /** + * Unregisters keyboard actions. + * + * @param root an instance of {@code JRootPane} + */ protected void uninstallKeyboardActions(JRootPane root) { SwingUtilities.replaceUIInputMap(root, JComponent. - WHEN_IN_FOCUSED_WINDOW, null); + WHEN_IN_FOCUSED_WINDOW, null); SwingUtilities.replaceUIActionMap(root, null); } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java index 0a83867618c..8df41cb647a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,22 @@ import javax.swing.plaf.SeparatorUI; public class BasicSeparatorUI extends SeparatorUI { + /** + * The color of the shadow. + */ protected Color shadow; + + /** + * The color of the highlighting. + */ protected Color highlight; + /** + * Returns a new instance of {@code BasicSeparatorUI}. + * + * @param c a component + * @return a new instance of {@code BasicSeparatorUI} + */ public static ComponentUI createUI( JComponent c ) { return new BasicSeparatorUI(); @@ -65,20 +78,40 @@ public class BasicSeparatorUI extends SeparatorUI uninstallListeners( (JSeparator)c ); } + /** + * Installs default properties. + * + * @param s an instance of {@code JSeparator} + */ protected void installDefaults( JSeparator s ) { - LookAndFeel.installColors( s, "Separator.background", "Separator.foreground" ); - LookAndFeel.installProperty( s, "opaque", Boolean.FALSE); + LookAndFeel.installColors(s, "Separator.background", "Separator.foreground"); + LookAndFeel.installProperty(s, "opaque", Boolean.FALSE); } + /** + * Uninstalls default properties. + * + * @param s an instance of {@code JSeparator} + */ protected void uninstallDefaults( JSeparator s ) { } + /** + * Registers listeners. + * + * @param s an instance of {@code JSeparator} + */ protected void installListeners( JSeparator s ) { } + /** + * Unregisters listeners. + * + * @param s an instance of {@code JSeparator} + */ protected void uninstallListeners( JSeparator s ) { } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java index 01c408382cd..ee9cdefbe90 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java @@ -400,6 +400,8 @@ public class BasicSpinnerUI extends SpinnerUI * The implementation of replaceEditor should be coordinated * with the createEditor method. * + * @param oldEditor an old instance of editor + * @param newEditor a new instance of editor * @see #createEditor * @see #createPropertyChangeListener */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java index cdf38579fc8..4c8bb1d94d5 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java @@ -49,11 +49,19 @@ public class BasicTableHeaderUI extends TableHeaderUI { // Instance Variables // - /** The JTableHeader that is delegating the painting to this UI. */ + /** + * The {@code JTableHeader} that is delegating the painting to this UI. + */ protected JTableHeader header; + + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; - // Listeners that are attached to the JTable + /** + * Listeners that are attached to the {@code JTable} + */ protected MouseInputListener mouseInputListener; // The column header over which the mouse currently is. @@ -300,7 +308,9 @@ public class BasicTableHeaderUI extends TableHeaderUI { // /** - * Creates the mouse listener for the JTableHeader. + * Creates the mouse listener for the {@code JTableHeader}. + * + * @return the mouse listener for the {@code JTableHeader} */ protected MouseInputListener createMouseInputListener() { return new MouseInputHandler(); @@ -310,6 +320,12 @@ public class BasicTableHeaderUI extends TableHeaderUI { // The installation/uninstall procedures and support // + /** + * Returns a new instance of {@code BasicTableHeaderUI}. + * + * @param h a component. + * @return a new instance of {@code BasicTableHeaderUI} + */ public static ComponentUI createUI(JComponent h) { return new BasicTableHeaderUI(); } @@ -376,8 +392,14 @@ public class BasicTableHeaderUI extends TableHeaderUI { header = null; } + /** + * Uninstalls default properties + */ protected void uninstallDefaults() {} + /** + * Unregisters listeners. + */ protected void uninstallListeners() { header.removeMouseListener(mouseInputListener); header.removeMouseMotionListener(mouseInputListener); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java index 0965c77789f..2b23f9c0a0e 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java @@ -443,6 +443,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { protected void uninstallListeners() { } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { // backward compatibility support... keymaps for the UI // are now installed in the more friendly input map. @@ -637,6 +640,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { return map; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { editor.setKeymap(null); SwingUtilities.replaceUIInputMap(editor, JComponent. @@ -1280,8 +1286,14 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory { return null; } + /** + * Default implementation of the interface {@code Caret}. + */ public static class BasicCaret extends DefaultCaret implements UIResource {} + /** + * Default implementation of the interface {@code Highlighter}. + */ public static class BasicHighlighter extends DefaultHighlighter implements UIResource {} static class BasicCursor extends Cursor implements UIResource { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java index 163a5cd2b46..5f394dbbefb 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,6 +51,13 @@ public class BasicToggleButtonUI extends BasicButtonUI { // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code BasicToggleButtonUI}. + * + * @param b a component + * @return an instance of {@code BasicToggleButtonUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); BasicToggleButtonUI toggleButtonUI = @@ -127,6 +134,13 @@ public class BasicToggleButtonUI extends BasicButtonUI { } } + /** + * Paints an icon in the specified location. + * + * @param g an instance of {@code Graphics} + * @param b an instance of {@code Button} + * @param iconRect bounds of an icon + */ protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect) { ButtonModel model = b.getModel(); Icon icon = null; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java index 1f2aac7e597..4a5dd209df0 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,12 @@ import javax.swing.plaf.basic.BasicSeparatorUI; public class BasicToolBarSeparatorUI extends BasicSeparatorUI { + /** + * Returns a new instance of {@code BasicToolBarSeparatorUI}. + * + * @param c a component + * @return a new instance of {@code BasicToolBarSeparatorUI} + */ public static ComponentUI createUI( JComponent c ) { return new BasicToolBarSeparatorUI(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java index 95a951cc6f9..8f79c7566fe 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,10 +55,19 @@ public class BasicToolTipUI extends ToolTipUI private PropertyChangeListener propertyChangeListener; + /** + * Returns the instance of {@code BasicToolTipUI}. + * + * @param c a component + * @return the instance of {@code BasicToolTipUI} + */ public static ComponentUI createUI(JComponent c) { return sharedInstance; } + /** + * Constructs a new instance of {@code BasicToolTipUI}. + */ public BasicToolTipUI() { super(); } @@ -76,22 +85,32 @@ public class BasicToolTipUI extends ToolTipUI uninstallListeners(c); } + /** + * Installs default properties. + * + * @param c a component + */ protected void installDefaults(JComponent c){ LookAndFeel.installColorsAndFont(c, "ToolTip.background", - "ToolTip.foreground", - "ToolTip.font"); + "ToolTip.foreground", + "ToolTip.font"); LookAndFeel.installProperty(c, "opaque", Boolean.TRUE); componentChanged(c); } - protected void uninstallDefaults(JComponent c){ + /** + * Uninstalls default properties. + * + * @param c a component + */ + protected void uninstallDefaults(JComponent c){ LookAndFeel.uninstallBorder(c); } /* Unfortunately this has to remain private until we can make API additions. */ private void installComponents(JComponent c){ - BasicHTML.updateRenderer(c, ((JToolTip)c).getTipText()); + BasicHTML.updateRenderer(c, ((JToolTip) c).getTipText()); } /* Unfortunately this has to remain private until we can make API additions. @@ -100,12 +119,22 @@ public class BasicToolTipUI extends ToolTipUI BasicHTML.updateRenderer(c, ""); } + /** + * Registers listeners. + * + * @param c a component + */ protected void installListeners(JComponent c) { propertyChangeListener = createPropertyChangeListener(c); c.addPropertyChangeListener(propertyChangeListener); } + /** + * Unregisters listeners. + * + * @param c a component + */ protected void uninstallListeners(JComponent c) { c.removePropertyChangeListener(propertyChangeListener); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java index 70dad3c3c0d..3620bdbcff8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,12 @@ public class BasicViewportUI extends ViewportUI { // Shared UI object private static ViewportUI viewportUI; + /** + * Returns an instance of {@code BasicViewportUI}. + * + * @param c a component + * @return an instance of {@code BasicViewportUI} + */ public static ComponentUI createUI(JComponent c) { if(viewportUI == null) { viewportUI = new BasicViewportUI(); @@ -60,6 +66,11 @@ public class BasicViewportUI extends ViewportUI { super.uninstallUI(c); } + /** + * Installs view port properties. + * + * @param c a component + */ protected void installDefaults(JComponent c) { LookAndFeel.installColorsAndFont(c, "Viewport.background", @@ -68,6 +79,11 @@ public class BasicViewportUI extends ViewportUI { LookAndFeel.installProperty(c, "opaque", Boolean.TRUE); } + /** + * Uninstall view port properties. + * + * @param c a component + */ protected void uninstallDefaults(JComponent c) { } } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java b/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java index bd520c6e38e..f9c260d0653 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java @@ -69,6 +69,8 @@ public interface ComboPopup { * Returns the list that is being used to draw the items in the combo box. * This method is highly implementation specific and should not be used * for general list manipulation. + * + * @return the list that is being used to draw the items in the combo box */ public JList getList(); @@ -91,6 +93,8 @@ public interface ComboPopup { /** * Returns a key listener that will be added to the combo box or null. * If this method returns null then it will not be added to the combo box. + * + * @return a key listener that will be added to the combo box or null */ public KeyListener getKeyListener(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java index 627c3702a73..730897a93d8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java @@ -41,6 +41,17 @@ import java.awt.Dimension; */ @SuppressWarnings("serial") // Superclass is not serializable across versions public class DefaultMenuLayout extends BoxLayout implements UIResource { + + /** + * Constructs a new instance of {@code DefaultMenuLayout}. + * + * @param target the container that needs to be laid out + * @param axis the axis to lay out components along. Can be one of: + * {@code BoxLayout.X_AXIS}, + * {@code BoxLayout.Y_AXIS}, + * {@code BoxLayout.LINE_AXIS} or + * {@code BoxLayout.PAGE_AXIS} + */ public DefaultMenuLayout(Container target, int axis) { super(target, axis); } From 91a46ed171d2db67765dca7dabee2042a3acbcb5 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Fri, 27 Jun 2014 10:29:08 -0700 Subject: [PATCH 008/166] 8044862: Fix raw and unchecked lint warnings in macosx specific code Reviewed-by: darcy, pchelko --- .../classes/apple/security/KeychainStore.java | 32 +++++++-------- .../com/apple/eawt/_AppDockIconHandler.java | 2 +- .../classes/com/apple/laf/AquaBorder.java | 2 +- .../com/apple/laf/AquaComboBoxButton.java | 11 +++-- .../com/apple/laf/AquaComboBoxPopup.java | 8 ++-- .../com/apple/laf/AquaComboBoxRenderer.java | 4 +- .../laf/AquaComboBoxRendererInternal.java | 11 +++-- .../classes/com/apple/laf/AquaComboBoxUI.java | 29 ++++++------- .../com/apple/laf/AquaFileChooserUI.java | 41 +++++++++++-------- .../com/apple/laf/AquaFocusHandler.java | 4 +- .../classes/com/apple/laf/AquaListUI.java | 6 +-- .../laf/AquaTabbedPaneCopyFromBasicUI.java | 2 +- .../com/apple/laf/AquaTableHeaderUI.java | 1 + .../com/apple/laf/AquaUtilControlSize.java | 2 +- .../classes/com/apple/laf/AquaUtils.java | 6 ++- .../apple/laf/ClientPropertyApplicator.java | 1 + .../classes/com/apple/laf/ScreenMenuBar.java | 1 + .../lwawt/macosx/CDragSourceContextPeer.java | 6 +-- .../sun/lwawt/macosx/CInputMethod.java | 13 +++--- .../lwawt/macosx/CInputMethodDescriptor.java | 4 +- .../sun/lwawt/macosx/CPlatformWindow.java | 2 +- .../classes/sun/lwawt/macosx/LWCToolkit.java | 4 +- 22 files changed, 107 insertions(+), 85 deletions(-) diff --git a/jdk/src/macosx/classes/apple/security/KeychainStore.java b/jdk/src/macosx/classes/apple/security/KeychainStore.java index 8df45d7bea7..8d04ee976f6 100644 --- a/jdk/src/macosx/classes/apple/security/KeychainStore.java +++ b/jdk/src/macosx/classes/apple/security/KeychainStore.java @@ -74,19 +74,19 @@ public final class KeychainStore extends KeyStoreSpi { * Entries that have been deleted. When something calls engineStore we'll * remove them from the keychain. */ - private Hashtable deletedEntries = new Hashtable(); + private Hashtable deletedEntries = new Hashtable<>(); /** * Entries that have been added. When something calls engineStore we'll * add them to the keychain. */ - private Hashtable addedEntries = new Hashtable(); + private Hashtable addedEntries = new Hashtable<>(); /** * Private keys and certificates are stored in a hashtable. * Hash entries are keyed by alias names. */ - private Hashtable entries = new Hashtable(); + private Hashtable entries = new Hashtable<>(); /** * Algorithm identifiers and corresponding OIDs for the contents of the PKCS12 bag we get from the Keychain. @@ -471,7 +471,7 @@ public final class KeychainStore extends KeyStoreSpi { // This will be slow, but necessary. Enumerate the values and then see if the cert matches the one in the trusted cert entry. // Security framework doesn't support the same certificate twice in a keychain. - Collection allValues = entries.values(); + Collection allValues = entries.values(); for (Object value : allValues) { if (value instanceof TrustedCertEntry) { @@ -517,7 +517,7 @@ public final class KeychainStore extends KeyStoreSpi { * * @return enumeration of the alias names */ - public Enumeration engineAliases() { + public Enumeration engineAliases() { permissionCheck(); return entries.keys(); } @@ -598,8 +598,8 @@ public final class KeychainStore extends KeyStoreSpi { permissionCheck(); Certificate certElem; - for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = entries.get(alias); if (entry instanceof TrustedCertEntry) { certElem = ((TrustedCertEntry)entry).cert; @@ -634,8 +634,8 @@ public final class KeychainStore extends KeyStoreSpi { permissionCheck(); // Delete items that do have a keychain item ref. - for (Enumeration e = deletedEntries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = deletedEntries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = deletedEntries.get(alias); if (entry instanceof TrustedCertEntry) { if (((TrustedCertEntry)entry).certRef != 0) { @@ -664,8 +664,8 @@ public final class KeychainStore extends KeyStoreSpi { // Add all of the certs or keys in the added entries. // No need to check for 0 refs, as they are in the added list. - for (Enumeration e = addedEntries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = addedEntries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = addedEntries.get(alias); if (entry instanceof TrustedCertEntry) { TrustedCertEntry tce = (TrustedCertEntry)entry; @@ -730,8 +730,8 @@ public final class KeychainStore extends KeyStoreSpi { // Release any stray keychain references before clearing out the entries. synchronized(entries) { - for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { - String alias = (String)e.nextElement(); + for (Enumeration e = entries.keys(); e.hasMoreElements(); ) { + String alias = e.nextElement(); Object entry = entries.get(alias); if (entry instanceof TrustedCertEntry) { if (((TrustedCertEntry)entry).certRef != 0) { @@ -816,7 +816,7 @@ public final class KeychainStore extends KeyStoreSpi { // Next, create X.509 Certificate objects from the raw data. This is complicated // because a certificate's public key may be too long for Java's default encryption strength. - List createdCerts = new ArrayList(); + List createdCerts = new ArrayList<>(); try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); @@ -842,12 +842,12 @@ public final class KeychainStore extends KeyStoreSpi { // We have our certificates in the List, so now extract them into an array of // Certificates and SecCertificateRefs. - Object[] objArray = createdCerts.toArray(); + CertKeychainItemPair[] objArray = createdCerts.toArray(new CertKeychainItemPair[0]); Certificate[] certArray = new Certificate[objArray.length]; long[] certRefArray = new long[objArray.length]; for (int i = 0; i < objArray.length; i++) { - CertKeychainItemPair addedItem = (CertKeychainItemPair)objArray[i]; + CertKeychainItemPair addedItem = objArray[i]; certArray[i] = addedItem.mCert; certRefArray[i] = addedItem.mCertificateRef; } diff --git a/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java b/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java index e91efeaa009..76dea3a7ed3 100644 --- a/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java +++ b/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java @@ -95,7 +95,7 @@ class _AppDockIconHandler { static Creator getCImageCreator() { try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); + final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); getCreatorMethod.setAccessible(true); return (Creator)getCreatorMethod.invoke(null, new Object[] {}); } catch (final Throwable e) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java b/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java index dfb6fddd5ce..e9eda68094c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java @@ -75,7 +75,7 @@ public abstract class AquaBorder implements Border, UIResource { protected AquaBorder deriveBorderForSize(final Size size) { try { final Class clazz = getClass(); - final AquaBorder border = clazz.getConstructor(new Class[] { clazz }).newInstance(new Object[] { this }); + final AquaBorder border = clazz.getConstructor(new Class[] { clazz }).newInstance(new Object[] { this }); border.setSize(size); return border; } catch (final Throwable e) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java index 2867245ee1e..c87bcb78c04 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java @@ -35,8 +35,8 @@ import apple.laf.JRSUIConstants.*; @SuppressWarnings("serial") // Superclass is not serializable across versions class AquaComboBoxButton extends JButton { - final protected JComboBox comboBox; - final protected JList list; + final protected JComboBox comboBox; + final protected JList list; final protected CellRendererPane rendererPane; final protected AquaComboBoxUI ui; @@ -45,7 +45,10 @@ class AquaComboBoxButton extends JButton { boolean isSquare; @SuppressWarnings("serial") // anonymous class - protected AquaComboBoxButton(final AquaComboBoxUI ui, final JComboBox comboBox, final CellRendererPane rendererPane, final JList list) { + protected AquaComboBoxButton(final AquaComboBoxUI ui, + final JComboBox comboBox, + final CellRendererPane rendererPane, + final JList list) { super(""); putClientProperty("JButton.buttonType", "comboboxInternal"); @@ -163,7 +166,7 @@ class AquaComboBoxButton extends JButton { } protected void doRendererPaint(final Graphics g, final ButtonModel buttonModel, final boolean editable, final Insets insets, int left, int top, int width, int height) { - final ListCellRenderer renderer = comboBox.getRenderer(); + final ListCellRenderer renderer = comboBox.getRenderer(); // fake it out! not renderPressed final Component c = renderer.getListCellRendererComponent(list, comboBox.getSelectedItem(), -1, false, false); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java index dde9b1be337..0f466e188e6 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java @@ -43,7 +43,7 @@ class AquaComboBoxPopup extends BasicComboPopup { protected Component bottomStrut; protected boolean isPopDown = false; - public AquaComboBoxPopup(final JComboBox cBox) { + public AquaComboBoxPopup(final JComboBox cBox) { super(cBox); } @@ -93,7 +93,7 @@ class AquaComboBoxPopup extends BasicComboPopup { final int rowCount = Math.min(maxRowCount, currentElementCount); final Dimension popupSize = new Dimension(); - final ListCellRenderer renderer = list.getCellRenderer(); + final ListCellRenderer renderer = list.getCellRenderer(); for (int i = 0; i < rowCount; i++) { final Object value = list.getModel().getElementAt(i); @@ -149,8 +149,8 @@ class AquaComboBoxPopup extends BasicComboPopup { @Override @SuppressWarnings("serial") // anonymous class - protected JList createList() { - return new JList(comboBox.getModel()) { + protected JList createList() { + return new JList(comboBox.getModel()) { @Override public void processMouseEvent(MouseEvent e) { if (e.isMetaDown()) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java index 6161eb6447c..f4d4225efe0 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java @@ -29,8 +29,8 @@ import javax.swing.*; import javax.swing.plaf.UIResource; @SuppressWarnings("serial") // Superclass is not serializable across versions -class AquaComboBoxRenderer extends AquaComboBoxRendererInternal implements UIResource { - public AquaComboBoxRenderer(final JComboBox comboBox) { +class AquaComboBoxRenderer extends AquaComboBoxRendererInternal implements UIResource { + public AquaComboBoxRenderer(final JComboBox comboBox) { super(comboBox); } } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java index 2ed6dcfcf70..cf1025f6a85 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java @@ -31,8 +31,8 @@ import javax.swing.*; import java.awt.*; @SuppressWarnings("serial") // Superclass is not serializable across versions -class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { - final JComboBox fComboBox; +class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { + final JComboBox fComboBox; boolean fSelected; boolean fChecked; boolean fInList; @@ -40,7 +40,7 @@ class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { boolean fDrawCheckedItem = true; // Provides space for a checkbox, and is translucent - public AquaComboBoxRendererInternal(final JComboBox comboBox) { + public AquaComboBoxRendererInternal(final JComboBox comboBox) { super(); fComboBox = comboBox; } @@ -72,7 +72,10 @@ class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer { } // Really means is the one with the mouse over it - public Component getListCellRendererComponent(final JList list, final Object value, int index, final boolean isSelected, final boolean cellHasFocus) { + public Component getListCellRendererComponent(final JList list, + final E value, int index, + final boolean isSelected, + final boolean cellHasFocus) { fInList = (index >= 0); // When the button wants the item painted, it passes in -1 fSelected = isSelected; if (index < 0) { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java index 75c7babb58a..80ca6ff5b49 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java @@ -102,13 +102,13 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { if (now - 1000 < lastBlink) return; lastBlink = now; - final JList itemList = popup.getList(); + final JList itemList = popup.getList(); final ListUI listUI = itemList.getUI(); if (!(listUI instanceof AquaListUI)) return; final AquaListUI aquaListUI = (AquaListUI)listUI; final int selectedIndex = comboBox.getSelectedIndex(); - final ListModel dataModel = itemList.getModel(); + final ListModel dataModel = itemList.getModel(); if (dataModel == null) return; final Object value = dataModel.getElementAt(selectedIndex); @@ -125,7 +125,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { // this space intentionally left blank } - protected ListCellRenderer createRenderer() { + protected ListCellRenderer createRenderer() { return new AquaComboBoxRenderer(comboBox); } @@ -185,7 +185,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { final Object text = editor.getText(); - final ListModel model = listBox.getModel(); + final ListModel model = listBox.getModel(); final int items = model.getSize(); for (int i = 0; i < items; i++) { final Object element = model.getElementAt(i); @@ -423,7 +423,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { return; } - final JComboBox cb = (JComboBox)parent; + final JComboBox cb = (JComboBox) parent; final int width = cb.getWidth(); final int height = cb.getHeight(); @@ -450,11 +450,11 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { return Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.IS_TABLE_CELL_EDITOR)); } - protected static boolean isPopdown(final JComboBox c) { + protected static boolean isPopdown(final JComboBox c) { return c.isEditable() || Boolean.TRUE.equals(c.getClientProperty(AquaComboBoxUI.POPDOWN_CLIENT_PROPERTY_KEY)); } - protected static void triggerSelectionEvent(final JComboBox comboBox, final ActionEvent e) { + protected static void triggerSelectionEvent(final JComboBox comboBox, final ActionEvent e) { if (!comboBox.isEnabled()) return; final AquaComboBoxUI aquaUi = (AquaComboBoxUI)comboBox.getUI(); @@ -505,7 +505,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { @SuppressWarnings("serial") // anonymous class private static final Action toggleSelectionAction = new AbstractAction() { public void actionPerformed(final ActionEvent e) { - final JComboBox comboBox = (JComboBox)e.getSource(); + final JComboBox comboBox = (JComboBox) e.getSource(); if (!comboBox.isEnabled()) return; if (comboBox.isEditable()) return; @@ -525,7 +525,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { private final Action hideAction = new AbstractAction() { @Override public void actionPerformed(final ActionEvent e) { - final JComboBox comboBox = (JComboBox)e.getSource(); + final JComboBox comboBox = (JComboBox) e.getSource(); comboBox.firePopupMenuCanceled(); comboBox.setPopupVisible(false); } @@ -588,10 +588,11 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { } @SuppressWarnings("unchecked") - static final RecyclableSingleton> APPLICATOR = new RecyclableSingleton>() { + static final RecyclableSingleton, AquaComboBoxUI>> APPLICATOR = new + RecyclableSingleton, AquaComboBoxUI>>() { @Override - protected ClientPropertyApplicator getInstance() { - return new ClientPropertyApplicator( + protected ClientPropertyApplicator, AquaComboBoxUI> getInstance() { + return new ClientPropertyApplicator, AquaComboBoxUI>( new Property(AquaFocusHandler.FRAME_ACTIVE_PROPERTY) { public void applyProperty(final AquaComboBoxUI target, final Object value) { if (Boolean.FALSE.equals(value)) { @@ -633,7 +634,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { } } ) { - public AquaComboBoxUI convertJComponentToTarget(final JComboBox combo) { + public AquaComboBoxUI convertJComponentToTarget(final JComboBox combo) { final ComboBoxUI comboUI = combo.getUI(); if (comboUI instanceof AquaComboBoxUI) return (AquaComboBoxUI)comboUI; return null; @@ -641,7 +642,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable { }; } }; - static ClientPropertyApplicator getApplicator() { + static ClientPropertyApplicator, AquaComboBoxUI> getApplicator() { return APPLICATOR.get(); } } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java index 3fae5e20310..ebb3b4b6433 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java @@ -724,6 +724,7 @@ public class AquaFileChooserUI extends FileChooserUI { final Transferable transferable = dtde.getTransferable(); try { + @SuppressWarnings("unchecked") final java.util.List fileList = (java.util.List)transferable.getTransferData(DataFlavor.javaFileListFlavor); dropFiles(fileList.toArray(new File[fileList.size()])); dtde.dropComplete(true); @@ -1144,11 +1145,14 @@ public class AquaFileChooserUI extends FileChooserUI { } @SuppressWarnings("serial") // anonymous class - protected ListCellRenderer createDirectoryComboBoxRenderer(final JFileChooser fc) { - return new AquaComboBoxRendererInternal(directoryComboBox) { - public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - final File directory = (File)value; + protected ListCellRenderer createDirectoryComboBoxRenderer(final JFileChooser fc) { + return new AquaComboBoxRendererInternal(directoryComboBox) { + public Component getListCellRendererComponent(final JList list, + final File directory, + final int index, + final boolean isSelected, + final boolean cellHasFocus) { + super.getListCellRendererComponent(list, directory, index, isSelected, cellHasFocus); if (directory == null) { setText(""); return this; @@ -1173,7 +1177,7 @@ public class AquaFileChooserUI extends FileChooserUI { * Data model for a type-face selection combo-box. */ @SuppressWarnings("serial") // Superclass is not serializable across versions - protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel { + protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel { Vector fDirectories = new Vector(); int topIndex = -1; int fPathCount = 0; @@ -1248,7 +1252,7 @@ public class AquaFileChooserUI extends FileChooserUI { return fDirectories.size(); } - public Object getElementAt(final int index) { + public File getElementAt(final int index) { return fDirectories.elementAt(index); } } @@ -1257,11 +1261,14 @@ public class AquaFileChooserUI extends FileChooserUI { // Renderer for Types ComboBox // @SuppressWarnings("serial") // anonymous class - protected ListCellRenderer createFilterComboBoxRenderer() { - return new AquaComboBoxRendererInternal(filterComboBox) { - public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - final FileFilter filter = (FileFilter)value; + protected ListCellRenderer createFilterComboBoxRenderer() { + return new AquaComboBoxRendererInternal(filterComboBox) { + public Component getListCellRendererComponent(final JList list, + final FileFilter filter, + final int index, + final boolean isSelected, + final boolean cellHasFocus) { + super.getListCellRendererComponent(list, filter, index, isSelected, cellHasFocus); if (filter != null) setText(filter.getDescription()); return this; } @@ -1356,7 +1363,7 @@ public class AquaFileChooserUI extends FileChooserUI { } public void actionPerformed(final ActionEvent e) { - getFileChooser().setFileFilter((FileFilter)filterComboBox.getSelectedItem()); + getFileChooser().setFileFilter((FileFilter) filterComboBox.getSelectedItem()); } } @@ -1503,7 +1510,7 @@ public class AquaFileChooserUI extends FileChooserUI { fTextfieldPanel.add(tPanel, BorderLayout.CENTER); // DirectoryComboBox, left-justified, 200x20 not including drop shadow - directoryComboBox = new JComboBox(); + directoryComboBox = new JComboBox<>(); directoryComboBox.putClientProperty("JComboBox.lightweightKeyboardNavigation", "Lightweight"); fDirectoryComboBoxModel = createDirectoryComboBoxModel(fc); directoryComboBox.setModel(fDirectoryComboBoxModel); @@ -1551,7 +1558,7 @@ public class AquaFileChooserUI extends FileChooserUI { // Combobox filterComboBoxModel = createFilterComboBoxModel(); fc.addPropertyChangeListener(filterComboBoxModel); - filterComboBox = new JComboBox(filterComboBoxModel); + filterComboBox = new JComboBox<>(filterComboBoxModel); formatLabel.setLabelFor(filterComboBox); filterComboBox.setRenderer(createFilterComboBoxRenderer()); d = new Dimension(220, (int)filterComboBox.getMinimumSize().getHeight()); @@ -1788,7 +1795,7 @@ public class AquaFileChooserUI extends FileChooserUI { } } - JComboBox directoryComboBox; + JComboBox directoryComboBox; DirectoryComboBoxModel fDirectoryComboBoxModel; private final Action directoryComboBoxAction = new DirectoryComboBoxAction(); @@ -1797,7 +1804,7 @@ public class AquaFileChooserUI extends FileChooserUI { JTableExtension fFileList; private FilterComboBoxModel filterComboBoxModel; - JComboBox filterComboBox; + JComboBox filterComboBox; private final Action filterComboBoxAction = new FilterComboBoxAction(); private static final Dimension hstrut10 = new Dimension(10, 1); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java b/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java index d5fec4e292c..1438d2c118c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java @@ -131,7 +131,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener { c.setSelectionBackground(UIManager.getColor(bgName)); } - static void swapSelectionColors(final String prefix, final JList c, final Object value) { + static void swapSelectionColors(final String prefix, final JList c, final Object value) { if (!isComponentValid(c)) return; final Color bg = c.getSelectionBackground(); @@ -149,7 +149,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener { } } - static void setSelectionColors(final JList c, final String fgName, final String bgName) { + static void setSelectionColors(final JList c, final String fgName, final String bgName) { c.setSelectionForeground(UIManager.getColor(fgName)); c.setSelectionBackground(UIManager.getColor(bgName)); } diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java index 85d06468912..24217af311c 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java @@ -79,7 +79,7 @@ public class AquaListUI extends BasicListUI { * For a Home action, scrolls to the top. Otherwise, scroll to the end. */ public void actionPerformed(final ActionEvent e) { - final JList list = (JList)e.getSource(); + final JList list = (JList)e.getSource(); if (fHomeAction) { list.ensureIndexIsVisible(0); @@ -135,7 +135,7 @@ public class AquaListUI extends BasicListUI { }*/ } - JList getComponent() { + JList getComponent() { return list; } @@ -144,7 +144,7 @@ public class AquaListUI extends BasicListUI { final Rectangle rowBounds = getCellBounds(list, selectedIndex, selectedIndex); if (rowBounds == null) return; - final ListCellRenderer renderer = list.getCellRenderer(); + final ListCellRenderer renderer = list.getCellRenderer(); if (renderer == null) return; final Component rendererComponent = renderer.getListCellRendererComponent(list, value, selectedIndex, selected, true); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java index dd65433283f..8dd4fa60d2d 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java @@ -3820,7 +3820,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing _loader = null; final Class klass = (Class)loader; try { - final java.lang.reflect.Method method = klass.getDeclaredMethod("loadActionMap", new Class[] { LazyActionMap.class }); + final java.lang.reflect.Method method = klass.getDeclaredMethod("loadActionMap", new Class[] { LazyActionMap.class }); method.invoke(klass, new Object[] { this }); } catch (final NoSuchMethodException nsme) { assert false : "LazyActionMap unable to load actions " + klass; diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java b/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java index 5d847e98ef2..dbc8c8c86ad 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java @@ -69,6 +69,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI { final static RecyclableSingleton> TABLE_HEADER_APPLICATORS = new RecyclableSingleton>() { @Override + @SuppressWarnings("unchecked") protected ClientPropertyApplicator getInstance() { return new ClientPropertyApplicator( new Property("JTableHeader.selectedColumn") { diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java index b64595f4245..17b372af858 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java @@ -121,7 +121,7 @@ public class AquaUtilControlSize { try { // see if this component has a "getUI" method final Class clazz = c.getClass(); - final Method getUIMethod = clazz.getMethod("getUI", new Class[0]); + final Method getUIMethod = clazz.getMethod("getUI", new Class[0]); // see if that UI is one of ours that understands sizing final Object ui = getUIMethod.invoke(c, new Object[0]); diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java index 078435b161b..faa670345c7 100644 --- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java +++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java @@ -82,7 +82,8 @@ final class AquaUtils { @Override public Creator run() { try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); + final Method getCreatorMethod = CImage.class.getDeclaredMethod( + "getCreator", new Class[] {}); getCreatorMethod.setAccessible(true); return (Creator)getCreatorMethod.invoke(null, new Object[] {}); } catch (final Exception ignored) { @@ -383,7 +384,8 @@ final class AquaUtils { @Override public Method run() { try { - final Method method = JComponent.class.getDeclaredMethod("getFlag", new Class[] { int.class }); + final Method method = JComponent.class.getDeclaredMethod( + "getFlag", new Class[] { int.class }); method.setAccessible(true); return method; } catch (final Throwable ignored) { diff --git a/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java b/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java index 665c9319cc1..908c63c2c3e 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java +++ b/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java @@ -33,6 +33,7 @@ import javax.swing.JComponent; public class ClientPropertyApplicator implements PropertyChangeListener { private final Map> properties = new HashMap>(); + @SuppressWarnings("unchecked") public ClientPropertyApplicator(final Property... propertyList) { for (final Property p : propertyList) { properties.put(p.name, p); diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java index 1735b444ea5..f4c0aaf4ee8 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java @@ -273,6 +273,7 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM try { if (stolenFields == null) return m; + @SuppressWarnings("unchecked") final Vector menus = (Vector)stolenFields[0].get(this); menus.insertElementAt(m, index); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java index 67570c18a6f..c6c75bc82c6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java @@ -88,7 +88,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { super.startDrag(dsc, cursor, dragImage, dragImageOffset); } - protected void startDrag(Transferable transferable, long[] formats, Map formatMap) { + protected void startDrag(Transferable transferable, long[] formats, Map formatMap) { DragGestureEvent trigger = getTrigger(); InputEvent triggerEvent = trigger.getTriggerEvent(); @@ -311,7 +311,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { } } - private void setDefaultDragImage(JList component) { + private void setDefaultDragImage(JList component) { Rectangle selectedOutline = null; // This code actually works, even under the (non-existant) multiple-selections, because we only draw a union outline @@ -485,7 +485,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer { private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable, InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp, long nsDragImagePtr, int dragImageOffsetX, int dragImageOffsetY, - int sourceActions, long[] formats, Map formatMap); + int sourceActions, long[] formats, Map formatMap); private native void doDragging(long nativeDragSource); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java index eef5284175b..077b156d806 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java @@ -44,13 +44,14 @@ import sun.lwawt.*; public class CInputMethod extends InputMethodAdapter { private InputMethodContext fIMContext; private Component fAwtFocussedComponent; - private LWComponentPeer fAwtFocussedComponentPeer; + private LWComponentPeer fAwtFocussedComponentPeer; private boolean isActive; private static Map[] sHighlightStyles; // Intitalize highlight mapping table and its mapper. static { + @SuppressWarnings({"rawtypes", "unchecked"}) Map styles[] = new Map[4]; HashMap map; @@ -242,7 +243,7 @@ public class CInputMethod extends InputMethodAdapter { public void hideWindows() { } - long getNativeViewPtr(LWComponentPeer peer) { + long getNativeViewPtr(LWComponentPeer peer) { if (peer.getPlatformWindow() instanceof CPlatformWindow) { CPlatformWindow platformWindow = (CPlatformWindow) peer.getPlatformWindow(); CPlatformView platformView = platformWindow.getContentView(); @@ -272,7 +273,7 @@ public class CInputMethod extends InputMethodAdapter { * to talk to when responding to key events. */ protected void setAWTFocussedComponent(Component component) { - LWComponentPeer peer = null; + LWComponentPeer peer = null; long modelPtr = 0; CInputMethod imInstance = this; @@ -305,7 +306,7 @@ public class CInputMethod extends InputMethodAdapter { /** * @see java.awt.Toolkit#mapInputMethodHighlight */ - public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public static Map mapInputMethodHighlight(InputMethodHighlight highlight) { int index; int state = highlight.getState(); if (state == InputMethodHighlight.RAW_TEXT) { @@ -384,7 +385,7 @@ public class CInputMethod extends InputMethodAdapter { // java.awt.Toolkit#getNativeContainer() is not available // from this package - private LWComponentPeer getNearestNativePeer(Component comp) { + private LWComponentPeer getNearestNativePeer(Component comp) { if (comp==null) return null; @@ -796,7 +797,7 @@ public class CInputMethod extends InputMethodAdapter { // these calls will be ignored. private native void nativeNotifyPeer(long nativePeer, CInputMethod imInstance); private native void nativeEndComposition(long nativePeer); - private native void nativeHandleEvent(LWComponentPeer peer, AWTEvent event); + private native void nativeHandleEvent(LWComponentPeer peer, AWTEvent event); // Returns the locale of the active input method. static native Locale getNativeLocale(); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java index d922d029b33..3deba1e33f9 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java @@ -57,7 +57,7 @@ public class CInputMethodDescriptor implements InputMethodDescriptor { } static Object[] getAvailableLocalesInternal() { - List workList = nativeGetAvailableLocales(); + List workList = nativeGetAvailableLocales(); if (workList != null) { return workList.toArray(); @@ -119,5 +119,5 @@ public class CInputMethodDescriptor implements InputMethodDescriptor { } private static native void nativeInit(); - private static native List nativeGetAvailableLocales(); + private static native List nativeGetAvailableLocales(); } diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java index 534cf0dd744..5af2cdfe1d0 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java @@ -151,7 +151,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo return (bits & mask) != 0; } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) static ClientPropertyApplicator CLIENT_PROPERTY_APPLICATOR = new ClientPropertyApplicator(new Property[] { new Property(WINDOW_DOCUMENT_MODIFIED) { public void applyProperty(final CPlatformWindow c, final Object value) { c.setStyleBits(DOCUMENT_MODIFIED, value == null ? false : Boolean.parseBoolean(value.toString())); diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java index edbebbacb67..e2cafca01b6 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java @@ -32,6 +32,7 @@ import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.event.InputEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; +import java.awt.font.TextAttribute; import java.awt.im.InputMethodHighlight; import java.awt.im.spi.InputMethodDescriptor; import java.awt.peer.*; @@ -691,6 +692,7 @@ public final class LWCToolkit extends LWToolkit { } @Override + @SuppressWarnings("unchecked") public T createDragGestureRecognizer( Class abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl) { @@ -743,7 +745,7 @@ public final class LWCToolkit extends LWToolkit { * @since 1.3 */ @Override - public Map mapInputMethodHighlight(InputMethodHighlight highlight) { + public Map mapInputMethodHighlight(InputMethodHighlight highlight) { return CInputMethod.mapInputMethodHighlight(highlight); } From 61b92329697c34a6f0e13a70ffb6e651e5b89c1b Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Thu, 10 Jul 2014 12:21:29 +0400 Subject: [PATCH 009/166] 8049704: Fix doclint warnings from javax.swing.plaf.basic package, 2 of 7 Reviewed-by: pchelko --- .../javax/swing/plaf/basic/BasicButtonUI.java | 104 +++++++++++++++- .../swing/plaf/basic/BasicComboBoxUI.java | 66 ++++++++-- .../swing/plaf/basic/BasicComboPopup.java | 52 ++++++++ .../swing/plaf/basic/BasicDesktopIconUI.java | 61 ++++++++- .../javax/swing/plaf/basic/BasicLabelUI.java | 82 +++++++++++-- .../swing/plaf/basic/BasicScrollPaneUI.java | 116 +++++++++++++++--- .../plaf/basic/BasicSplitPaneDivider.java | 85 ++++++++++--- .../javax/swing/plaf/basic/BasicTableUI.java | 46 ++++++- 8 files changed, 556 insertions(+), 56 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java index 34595149b95..0e1aa403fac 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,6 +49,9 @@ public class BasicButtonUI extends ButtonUI{ // Visual constants // NOTE: This is not used or set any where. Were we allowed to remove // fields, this would be removed. + /** + * The default gap between a text and an icon. + */ protected int defaultTextIconGap; // Amount to offset text, the value of this comes from @@ -56,6 +59,9 @@ public class BasicButtonUI extends ButtonUI{ private int shiftOffset = 0; // Value that is set in shiftOffset once setTextShiftOffset has been // invoked. The value of this comes from the defaults table. + /** + * The default offset of a text. + */ protected int defaultTextShiftOffset; private final static String propertyPrefix = "Button" + "."; @@ -65,6 +71,12 @@ public class BasicButtonUI extends ButtonUI{ // ******************************** // Create PLAF // ******************************** + /** + * Returns an instance of {@code BasicButtonUI}. + * + * @param c a component + * @return an instance of {@code BasicButtonUI} + */ public static ComponentUI createUI(JComponent c) { AppContext appContext = AppContext.getAppContext(); BasicButtonUI buttonUI = @@ -76,6 +88,11 @@ public class BasicButtonUI extends ButtonUI{ return buttonUI; } + /** + * Returns the property prefix. + * + * @return the property prefix + */ protected String getPropertyPrefix() { return propertyPrefix; } @@ -91,6 +108,11 @@ public class BasicButtonUI extends ButtonUI{ BasicHTML.updateRenderer(c, ((AbstractButton) c).getText()); } + /** + * Installs default properties. + * + * @param b an abstract button + */ protected void installDefaults(AbstractButton b) { // load shared instance defaults String pp = getPropertyPrefix(); @@ -120,6 +142,11 @@ public class BasicButtonUI extends ButtonUI{ LookAndFeel.installProperty(b, "iconTextGap", Integer.valueOf(4)); } + /** + * Registers listeners. + * + * @param b an abstract button + */ protected void installListeners(AbstractButton b) { BasicButtonListener listener = createButtonListener(b); if(listener != null) { @@ -131,6 +158,11 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Registers keyboard actions. + * + * @param b an abstract button + */ protected void installKeyboardActions(AbstractButton b){ BasicButtonListener listener = getButtonListener(b); @@ -150,6 +182,11 @@ public class BasicButtonUI extends ButtonUI{ BasicHTML.updateRenderer(c, ""); } + /** + * Unregisters keyboard actions. + * + * @param b an abstract button + */ protected void uninstallKeyboardActions(AbstractButton b) { BasicButtonListener listener = getButtonListener(b); if(listener != null) { @@ -157,6 +194,11 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Unregisters listeners. + * + * @param b an abstract button + */ protected void uninstallListeners(AbstractButton b) { BasicButtonListener listener = getButtonListener(b); if(listener != null) { @@ -168,6 +210,11 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Uninstalls default properties. + * + * @param b an abstract button + */ protected void uninstallDefaults(AbstractButton b) { LookAndFeel.uninstallBorder(b); } @@ -175,10 +222,22 @@ public class BasicButtonUI extends ButtonUI{ // ******************************** // Create Listeners // ******************************** + /** + * Returns a new instance of {@code BasicButtonListener}. + * + * @param b an abstract button + * @return a new instance of {@code BasicButtonListener} + */ protected BasicButtonListener createButtonListener(AbstractButton b) { return new BasicButtonListener(b); } + /** + * Returns the default gap between a text and an icon. + * + * @param b an abstract button + * @return the default gap between text and an icon + */ public int getDefaultTextIconGap(AbstractButton b) { return defaultTextIconGap; } @@ -231,6 +290,13 @@ public class BasicButtonUI extends ButtonUI{ } } + /** + * Paints an icon of the current button. + * + * @param g an instance of {@code Graphics} + * @param c a component + * @param iconRect a bounding rectangle to render the icon + */ protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect){ AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); @@ -295,8 +361,15 @@ public class BasicButtonUI extends ButtonUI{ } /** + * Method which renders the text of the current button. + * * As of Java 2 platform v 1.4 this method should not be used or overriden. * Use the paintText method which takes the AbstractButton argument. + * + * @param g an instance of {@code Graphics} + * @param c a component + * @param textRect a bounding rectangle to render the text + * @param text a string to render */ protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) { AbstractButton b = (AbstractButton) c; @@ -328,7 +401,7 @@ public class BasicButtonUI extends ButtonUI{ * * @param g Graphics context * @param b Current button to render - * @param textRect Bounding rectangle to render the text. + * @param textRect Bounding rectangle to render the text * @param text String to render * @since 1.4 */ @@ -338,23 +411,48 @@ public class BasicButtonUI extends ButtonUI{ // Method signature defined here overriden in subclasses. // Perhaps this class should be abstract? + /** + * Paints a focused button. + * + * @param g an instance of {@code Graphics} + * @param b an abstract button + * @param viewRect a bounding rectangle to render the button + * @param textRect a bounding rectangle to render the text + * @param iconRect a bounding rectangle to render the icon + */ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect){ } - + /** + * Paints a pressed button. + * + * @param g an instance of {@code Graphics} + * @param b an abstract button + */ protected void paintButtonPressed(Graphics g, AbstractButton b){ } + /** + * Clears the offset of the text. + */ protected void clearTextShiftOffset(){ this.shiftOffset = 0; } + /** + * Sets the offset of the text. + */ protected void setTextShiftOffset(){ this.shiftOffset = defaultTextShiftOffset; } + /** + * Returns the offset of the text. + * + * @return the offset of the text + */ protected int getTextShiftOffset() { return shiftOffset; } diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java index de26e386efd..a144ce120e7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java @@ -61,6 +61,10 @@ import sun.swing.UIAction; * @author Mark Davidson */ public class BasicComboBoxUI extends ComboBoxUI { + + /** + * The instance of {@code JComboBox}. + */ protected JComboBox comboBox; /** * This protected field is implementation specific. Do not access directly @@ -73,20 +77,30 @@ public class BasicComboBoxUI extends ComboBoxUI { private boolean isTableCellEditor = false; private static final String IS_TABLE_CELL_EDITOR = "JComboBox.isTableCellEditor"; - // This list is for drawing the current item in the combo box. + /** + * This list is for drawing the current item in the combo box. + */ protected JList listBox; - // Used to render the currently selected item in the combo box. - // It doesn't have anything to do with the popup's rendering. + /** + * Used to render the currently selected item in the combo box. + * It doesn't have anything to do with the popup's rendering. + */ protected CellRendererPane currentValuePane = new CellRendererPane(); - // The implementation of ComboPopup that is used to show the popup. + /** + * The implementation of {@code ComboPopup} that is used to show the popup. + */ protected ComboPopup popup; - // The Component that the ComboBoxEditor uses for editing + /** + * The Component that the @{code ComboBoxEditor} uses for editing. + */ protected Component editor; - // The arrow button that invokes the popup. + /** + * The arrow button that invokes the popup. + */ protected JButton arrowButton; // Listeners that are attached to the JComboBox @@ -121,8 +135,19 @@ public class BasicComboBoxUI extends ComboBoxUI { protected ItemListener itemListener; // Listeners that the ComboPopup produces. + /** + * The {@code MouseListener} listens to events. + */ protected MouseListener popupMouseListener; + + /** + * The {@code MouseMotionListener} listens to events. + */ protected MouseMotionListener popupMouseMotionListener; + + /** + * The {@code KeyListener} listens to events. + */ protected KeyListener popupKeyListener; // This is used for knowing when to cache the minimum preferred size. @@ -160,10 +185,14 @@ public class BasicComboBoxUI extends ComboBoxUI { */ JComboBox.KeySelectionManager keySelectionManager; - // Flag for recalculating the minimum preferred size. + /** + * The flag for recalculating the minimum preferred size. + */ protected boolean isMinimumSizeDirty = true; - // Cached minimum preferred size. + /** + * The cached minimum preferred size. + */ protected Dimension cachedMinimumSize = new Dimension( 0, 0 ); // Flag for calculating the display size @@ -238,6 +267,12 @@ public class BasicComboBoxUI extends ComboBoxUI { // begin UI Initialization // + /** + * Constructs a new instance of {@code BasicComboBoxUI}. + * + * @param c a component + * @return a new instance of {@code BasicComboBoxUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicComboBoxUI(); } @@ -1090,6 +1125,9 @@ public class BasicComboBoxUI extends ComboBoxUI { * navigation. This is used for optimizing key input by only passing non- * navigation keys to the type-ahead mechanism. Subclasses should override this * if they change the navigation keys. + * + * @param keyCode a key code + * @return {@code true} if the supplied {@code keyCode} maps to a navigation key */ protected boolean isNavigationKey( int keyCode ) { return keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN || @@ -1167,6 +1205,8 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Returns the area that is reserved for drawing the currently selected item. + * + * @return the area that is reserved for drawing the currently selected item */ protected Rectangle rectangleForCurrentValue() { int width = comboBox.getWidth(); @@ -1190,6 +1230,8 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Gets the insets from the JComboBox. + * + * @return the insets */ protected Insets getInsets() { return comboBox.getInsets(); @@ -1206,6 +1248,10 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Paints the currently selected item. + * + * @param g an instance of {@code Graphics} + * @param bounds a bounding rectangle to render to + * @param hasFocus is focused */ public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) { ListCellRenderer renderer = comboBox.getRenderer(); @@ -1263,6 +1309,10 @@ public class BasicComboBoxUI extends ComboBoxUI { /** * Paints the background of the currently selected item. + * + * @param g an instance of {@code Graphics} + * @param bounds a bounding rectangle to render to + * @param hasFocus is focused */ public void paintCurrentValueBackground(Graphics g,Rectangle bounds,boolean hasFocus) { Color t = g.getColor(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java index 2f0cd03923d..9e06857d4b3 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java @@ -75,6 +75,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { private static Border LIST_BORDER = new LineBorder(Color.BLACK, 1); + /** + * The instance of {@code JComboBox}. + */ protected JComboBox comboBox; /** * This protected field is implementation specific. Do not access directly @@ -186,11 +189,30 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { * or override. */ protected Timer autoscrollTimer; + + /** + * {@code true} if the mouse cursor is in the popup. + */ protected boolean hasEntered = false; + + /** + * If {@code true} the auto-scrolling is enabled. + */ protected boolean isAutoScrolling = false; + + /** + * The direction of scrolling. + */ protected int scrollDirection = SCROLL_UP; + /** + * The direction of scrolling up. + */ protected static final int SCROLL_UP = 0; + + /** + * The direction of scrolling down. + */ protected static final int SCROLL_DOWN = 1; @@ -309,6 +331,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { } } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { // XXX - shouldn't call this method // comboBox.unregisterKeyboardAction( KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ) ); @@ -319,6 +344,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { //=================================================================== // begin Initialization routines // + + /** + * Constructs a new instance of {@code BasicComboPopup}. + * + * @param combo an instance of {@code JComboBox} + */ public BasicComboPopup( JComboBox combo ) { super(); setName("ComboPopup.popup"); @@ -555,6 +586,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * Creates the scroll pane which houses the scrollable list. + * + * @return the scroll pane which houses the scrollable list */ protected JScrollPane createScroller() { JScrollPane sp = new JScrollPane( list, @@ -616,6 +649,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { } } + /** + * Registers keyboard actions. + */ protected void installKeyboardActions() { /* XXX - shouldn't call this method. take it out for testing. @@ -1007,6 +1043,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * This protected method is implementation specific and should be private. * do not call or override. + * + * @param direction the direction of scrolling */ protected void startAutoScrolling( int direction ) { // XXX - should be a private method within InvocationMouseMotionHandler @@ -1107,6 +1145,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { * send the focus when the popup is brought up. The standard implementation * delegates the focus to the editor (if the combo box is editable) or to * the JComboBox if it is not editable. + * + * @param e a mouse event */ protected void delegateFocus( MouseEvent e ) { if ( comboBox.isEditable() ) { @@ -1150,6 +1190,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { } } + /** + * Converts mouse event. + * + * @param e a mouse event + * @return converted mouse event + */ protected MouseEvent convertMouseEvent( MouseEvent e ) { Point convertedPoint = SwingUtilities.convertPoint( (Component)e.getSource(), e.getPoint(), list ); @@ -1171,6 +1217,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * Retrieves the height of the popup based on the current * ListCellRenderer and the maximum row count. + * + * @param maxRowCount the row count + * @return the height of the popup */ protected int getPopupHeightForRowCount(int maxRowCount) { // Set the cached value of the minimum row count @@ -1272,6 +1321,9 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { /** * A utility method used by the event listeners. Given a mouse event, it changes * the list selection to the list item below the mouse. + * + * @param anEvent a mouse event + * @param shouldScroll if {@code true} list should be scrolled. */ protected void updateListBoxSelectionForEvent(MouseEvent anEvent,boolean shouldScroll) { // XXX - only seems to be called from this class. shouldScroll flag is diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java index 8d68668af6a..262f36ee7d8 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,14 @@ import java.beans.*; */ public class BasicDesktopIconUI extends DesktopIconUI { + /** + * The instance of {@code JInternalFrame.JDesktopIcon}. + */ protected JInternalFrame.JDesktopIcon desktopIcon; + + /** + * The instance of {@code JInternalFrame}. + */ protected JInternalFrame frame; /** @@ -53,12 +60,19 @@ public class BasicDesktopIconUI extends DesktopIconUI { protected JComponent iconPane; MouseInputListener mouseInputListener; - - + /** + * Constructs a new instance of {@code BasicDesktopIconUI}. + * + * @param c a component + * @return a new instance of {@code BasicDesktopIconUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicDesktopIconUI(); } + /** + * Constructs a new instance of {@code BasicDesktopIconUI}. + */ public BasicDesktopIconUI() { } @@ -108,39 +122,62 @@ public class BasicDesktopIconUI extends DesktopIconUI { desktopIcon = null; } + /** + * Registers components. + */ protected void installComponents() { iconPane = new BasicInternalFrameTitlePane(frame); desktopIcon.setLayout(new BorderLayout()); desktopIcon.add(iconPane, BorderLayout.CENTER); } + /** + * Unregisters components. + */ protected void uninstallComponents() { desktopIcon.remove(iconPane); desktopIcon.setLayout(null); iconPane = null; } + /** + * Registers listeners. + */ protected void installListeners() { mouseInputListener = createMouseInputListener(); desktopIcon.addMouseMotionListener(mouseInputListener); desktopIcon.addMouseListener(mouseInputListener); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { desktopIcon.removeMouseMotionListener(mouseInputListener); desktopIcon.removeMouseListener(mouseInputListener); mouseInputListener = null; } + /** + * Installs default properties. + */ protected void installDefaults() { LookAndFeel.installBorder(desktopIcon, "DesktopIcon.border"); LookAndFeel.installProperty(desktopIcon, "opaque", Boolean.TRUE); } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(desktopIcon); } + /** + * Returns a new instance of {@code MouseInputListener}. + * + * @return a new instance of {@code MouseInputListener} + */ protected MouseInputListener createMouseInputListener() { return new MouseInputHandler(); } @@ -170,6 +207,12 @@ public class BasicDesktopIconUI extends DesktopIconUI { return iconPane.getMaximumSize(); } + /** + * Returns the insets. + * + * @param c a component + * @return the insets + */ public Insets getInsets(JComponent c) { JInternalFrame iframe = desktopIcon.getInternalFrame(); Border border = iframe.getBorder(); @@ -179,6 +222,9 @@ public class BasicDesktopIconUI extends DesktopIconUI { return new Insets(0,0,0,0); } + /** + * De-iconifies the internal frame. + */ public void deiconize() { try { frame.setIcon(false); } catch (PropertyVetoException e2) { } } @@ -284,6 +330,15 @@ public class BasicDesktopIconUI extends DesktopIconUI { return; } + /** + * Moves and repaints a component {@code f}. + * + * @param f a component + * @param newX a new X coordinate + * @param newY a new Y coordinate + * @param newWidth a new width + * @param newHeight a new height + */ public void moveAndRepaint(JComponent f, int newX, int newY, int newWidth, int newHeight) { Rectangle r = f.getBounds(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java index 9c31265d180..e5576c2aca9 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,6 +80,14 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener * This method is here so that a subclass could do Label specific * layout and to shorten the method name a little. * + * @param label an instance of {@code JLabel} + * @param fontMetrics a font metrics + * @param text a text + * @param icon an icon + * @param viewR a bounding rectangle to lay out label + * @param iconR a bounding rectangle to lay out icon + * @param textR a bounding rectangle to lay out text + * @return a possibly clipped version of the compound labels string * @see SwingUtilities#layoutCompoundLabel */ protected String layoutCL( @@ -109,6 +117,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener /** * Paint clippedText at textX, textY with the labels foreground color. * + * @param l an instance of {@code JLabel} + * @param g an instance of {@code Graphics} + * @param s a text + * @param textX an X coordinate + * @param textY an Y coordinate * @see #paint * @see #paintDisabledText */ @@ -125,6 +138,11 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener * Paint clippedText at textX, textY with background.lighter() and then * shifted down and to the right by one pixel with background.darker(). * + * @param l an instance of {@code JLabel} + * @param g an instance of {@code Graphics} + * @param s a text + * @param textX an X coordinate + * @param textY an Y coordinate * @see #paint * @see #paintEnabledText */ @@ -329,26 +347,46 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener public void uninstallUI(JComponent c) { - uninstallDefaults((JLabel)c); - uninstallComponents((JLabel)c); - uninstallListeners((JLabel)c); - uninstallKeyboardActions((JLabel)c); + uninstallDefaults((JLabel) c); + uninstallComponents((JLabel) c); + uninstallListeners((JLabel) c); + uninstallKeyboardActions((JLabel) c); } - protected void installDefaults(JLabel c){ - LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font"); - LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); - } + /** + * Installs default properties. + * + * @param c an instance of {@code JLabel} + */ + protected void installDefaults(JLabel c){ + LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", "Label.font"); + LookAndFeel.installProperty(c, "opaque", Boolean.FALSE); + } + /** + * Registers listeners. + * + * @param c an instance of {@code JLabel} + */ protected void installListeners(JLabel c){ c.addPropertyChangeListener(this); } + /** + * Registers components. + * + * @param c an instance of {@code JLabel} + */ protected void installComponents(JLabel c){ BasicHTML.updateRenderer(c, c.getText()); c.setInheritsPopupMenu(true); } + /** + * Registers keyboard actions. + * + * @param l an instance of {@code JLabel} + */ protected void installKeyboardActions(JLabel l) { int dka = l.getDisplayedMnemonic(); Component lf = l.getLabelFor(); @@ -374,17 +412,37 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener } } + /** + * Uninstalls default properties. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallDefaults(JLabel c){ } + /** + * Unregisters listeners. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallListeners(JLabel c){ c.removePropertyChangeListener(this); } + /** + * Unregisters components. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallComponents(JLabel c){ BasicHTML.updateRenderer(c, ""); } + /** + * Unregisters keyboard actions. + * + * @param c an instance of {@code JLabel} + */ protected void uninstallKeyboardActions(JLabel c) { SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null); SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_IN_FOCUSED_WINDOW, @@ -392,6 +450,12 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener SwingUtilities.replaceUIActionMap(c, null); } + /** + * Returns an instance of {@code BasicLabelUI}. + * + * @param c a component + * @return an instance of {@code BasicLabelUI} + */ public static ComponentUI createUI(JComponent c) { if (System.getSecurityManager() != null) { AppContext appContext = AppContext.getAppContext(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java index 646282046b3..18df8abf202 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,21 +52,40 @@ import java.awt.event.*; public class BasicScrollPaneUI extends ScrollPaneUI implements ScrollPaneConstants { + /** + * The instance of {@code JScrollPane}. + */ protected JScrollPane scrollpane; + + /** + * {@code ChangeListener} installed on the vertical scrollbar. + */ protected ChangeListener vsbChangeListener; + + /** + * {@code ChangeListener} installed on the horizontal scrollbar. + */ protected ChangeListener hsbChangeListener; + + /** + * {@code ChangeListener} installed on the viewport. + */ protected ChangeListener viewportChangeListener; + + /** + * {@code PropertyChangeListener} installed on the scroll pane. + */ protected PropertyChangeListener spPropertyChangeListener; private MouseWheelListener mouseScrollListener; private int oldExtent = Integer.MIN_VALUE; /** - * PropertyChangeListener installed on the vertical scrollbar. + * {@code PropertyChangeListener} installed on the vertical scrollbar. */ private PropertyChangeListener vsbPropertyChangeListener; /** - * PropertyChangeListener installed on the horizontal scrollbar. + * {@code PropertyChangeListener} installed on the horizontal scrollbar. */ private PropertyChangeListener hsbPropertyChangeListener; @@ -79,7 +98,12 @@ public class BasicScrollPaneUI */ private boolean setValueCalled = false; - + /** + * Returns a new instance of {@code BasicScrollPaneUI}. + * + * @param x a component. + * @return a new instance of {@code BasicScrollPaneUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicScrollPaneUI(); } @@ -115,7 +139,11 @@ public class BasicScrollPaneUI return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE); } - + /** + * Installs default properties. + * + * @param scrollpane an instance of {@code JScrollPane} + */ protected void installDefaults(JScrollPane scrollpane) { LookAndFeel.installBorder(scrollpane, "ScrollPane.border"); @@ -132,7 +160,11 @@ public class BasicScrollPaneUI LookAndFeel.installProperty(scrollpane, "opaque", Boolean.TRUE); } - + /** + * Registers listeners. + * + * @param c an instance of {@code JScrollPane} + */ protected void installListeners(JScrollPane c) { vsbChangeListener = createVSBChangeListener(); @@ -165,6 +197,11 @@ public class BasicScrollPaneUI } + /** + * Registers keyboard actions. + * + * @param c an instance of {@code JScrollPane} + */ protected void installKeyboardActions(JScrollPane c) { InputMap inputMap = getInputMap(JComponent. WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); @@ -201,7 +238,11 @@ public class BasicScrollPaneUI installKeyboardActions(scrollpane); } - + /** + * Uninstalls default properties. + * + * @param c an instance of {@code JScrollPane} + */ protected void uninstallDefaults(JScrollPane c) { LookAndFeel.uninstallBorder(scrollpane); @@ -210,7 +251,11 @@ public class BasicScrollPaneUI } } - + /** + * Unregisters listeners. + * + * @param c a component + */ protected void uninstallListeners(JComponent c) { JViewport viewport = scrollpane.getViewport(); JScrollBar vsb = scrollpane.getVerticalScrollBar(); @@ -242,7 +287,11 @@ public class BasicScrollPaneUI handler = null; } - + /** + * Unregisters keyboard actions. + * + * @param c an instance of {@code JScrollPane} + */ protected void uninstallKeyboardActions(JScrollPane c) { SwingUtilities.replaceUIActionMap(c, null); SwingUtilities.replaceUIInputMap(c, JComponent. @@ -264,6 +313,9 @@ public class BasicScrollPaneUI return handler; } + /** + * Synchronizes the {@code JScrollPane} with {@code Viewport}. + */ protected void syncScrollPaneWithViewport() { JViewport viewport = scrollpane.getViewport(); @@ -453,6 +505,11 @@ public class BasicScrollPaneUI } } + /** + * Returns an instance of viewport {@code ChangeListener}. + * + * @return an instance of viewport {@code ChangeListener} + */ protected ChangeListener createViewportChangeListener() { return getHandler(); } @@ -483,6 +540,11 @@ public class BasicScrollPaneUI return getHandler(); } + /** + * Returns an instance of horizontal scroll bar {@code ChangeListener}. + * + * @return an instance of horizontal scroll bar {@code ChangeListener} + */ protected ChangeListener createHSBChangeListener() { return getHandler(); } @@ -514,6 +576,11 @@ public class BasicScrollPaneUI return getHandler(); } + /** + * Returns an instance of vertical scroll bar {@code ChangeListener}. + * + * @return an instance of vertical scroll bar {@code ChangeListener} + */ protected ChangeListener createVSBChangeListener() { return getHandler(); } @@ -565,12 +632,21 @@ public class BasicScrollPaneUI return getHandler(); } + /** + * Updates a scroll bar display policy. + * + * @param e the property change event + */ protected void updateScrollBarDisplayPolicy(PropertyChangeEvent e) { scrollpane.revalidate(); scrollpane.repaint(); } - + /** + * Updates viewport. + * + * @param e the property change event + */ protected void updateViewport(PropertyChangeEvent e) { JViewport oldViewport = (JViewport)(e.getOldValue()); @@ -599,7 +675,11 @@ public class BasicScrollPaneUI } } - + /** + * Updates row header. + * + * @param e the property change event + */ protected void updateRowHeader(PropertyChangeEvent e) { JViewport newRowHead = (JViewport)(e.getNewValue()); @@ -611,7 +691,11 @@ public class BasicScrollPaneUI } } - + /** + * Updates column header. + * + * @param e the property change event + */ protected void updateColumnHeader(PropertyChangeEvent e) { JViewport newColHead = (JViewport)(e.getNewValue()); @@ -679,9 +763,9 @@ public class BasicScrollPaneUI /** - * Creates an instance of PropertyChangeListener that's added to - * the JScrollPane by installUI(). Subclasses can override this method - * to return a custom PropertyChangeListener, e.g. + * Creates an instance of {@code PropertyChangeListener} that's added to + * the {@code JScrollPane} by {@code installUI()}. Subclasses can override + * this method to return a custom {@code PropertyChangeListener}, e.g. *
          * class MyScrollPaneUI extends BasicScrollPaneUI {
          *    protected PropertyChangeListener createPropertyChangeListener() {
    @@ -698,6 +782,8 @@ public class BasicScrollPaneUI
          * }
          * 
    * + * @return an instance of {@code PropertyChangeListener} + * * @see java.beans.PropertyChangeListener * @see #installUI */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java index 36b4129598c..34dfeb5710a 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java @@ -65,9 +65,13 @@ public class BasicSplitPaneDivider extends Container { /** * Width or height of the divider based on orientation - * BasicSplitPaneUI adds two to this. + * {@code BasicSplitPaneUI} adds two to this. */ protected static final int ONE_TOUCH_SIZE = 6; + + /** + * The offset of the divider. + */ protected static final int ONE_TOUCH_OFFSET = 2; /** @@ -136,8 +140,10 @@ public class BasicSplitPaneDivider extends Container /** - * Creates an instance of BasicSplitPaneDivider. Registers this + * Creates an instance of {@code BasicSplitPaneDivider}. Registers this * instance for mouse events and mouse dragged events. + * + * @param ui an instance of {@code BasicSplitPaneUI} */ public BasicSplitPaneDivider(BasicSplitPaneUI ui) { oneTouchSize = DefaultLookup.getInt(ui.getSplitPane(), ui, @@ -163,7 +169,9 @@ public class BasicSplitPaneDivider extends Container } /** - * Sets the SplitPaneUI that is using the receiver. + * Sets the {@code SplitPaneUI} that is using the receiver. + * + * @param newUI the new {@code SplitPaneUI} */ public void setBasicSplitPaneUI(BasicSplitPaneUI newUI) { if (splitPane != null) { @@ -198,8 +206,9 @@ public class BasicSplitPaneDivider extends Container /** - * Returns the SplitPaneUI the receiver is currently - * in. + * Returns the {@code SplitPaneUI} the receiver is currently in. + * + * @return the {@code SplitPaneUI} the receiver is currently in */ public BasicSplitPaneUI getBasicSplitPaneUI() { return splitPaneUI; @@ -207,9 +216,11 @@ public class BasicSplitPaneDivider extends Container /** - * Sets the size of the divider to newSize. That is - * the width if the splitpane is HORIZONTAL_SPLIT, or - * the height of VERTICAL_SPLIT. + * Sets the size of the divider to {@code newSize}. That is + * the width if the splitpane is {@code HORIZONTAL_SPLIT}, or + * the height of {@code VERTICAL_SPLIT}. + * + * @param newSize a new size */ public void setDividerSize(int newSize) { dividerSize = newSize; @@ -219,6 +230,8 @@ public class BasicSplitPaneDivider extends Container /** * Returns the size of the divider, that is the width if the splitpane * is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT. + * + * @return the size of the divider */ public int getDividerSize() { return dividerSize; @@ -227,6 +240,8 @@ public class BasicSplitPaneDivider extends Container /** * Sets the border of this component. + * + * @param border a new border * @since 1.3 */ public void setBorder(Border border) { @@ -382,8 +397,10 @@ public class BasicSplitPaneDivider extends Container /** - * Creates and return an instance of JButton that can be used to + * Creates and return an instance of {@code JButton} that can be used to * collapse the left component in the split pane. + * + * @return an instance of {@code JButton} */ protected JButton createLeftOneTouchButton() { JButton b = new JButton() { @@ -438,8 +455,10 @@ public class BasicSplitPaneDivider extends Container /** - * Creates and return an instance of JButton that can be used to + * Creates and return an instance of {@code JButton} that can be used to * collapse the right component in the split pane. + * + * @return an instance of {@code JButton} */ protected JButton createRightOneTouchButton() { JButton b = new JButton() { @@ -503,6 +522,8 @@ public class BasicSplitPaneDivider extends Container /** * Messages the BasicSplitPaneUI with dragDividerTo that this instance * is contained in. + * + * @param location a location */ protected void dragDividerTo(int location) { splitPaneUI.dragDividerTo(location); @@ -512,6 +533,8 @@ public class BasicSplitPaneDivider extends Container /** * Messages the BasicSplitPaneUI with finishDraggingTo that this instance * is contained in. + * + * @param location a location */ protected void finishDraggingTo(int location) { splitPaneUI.finishDraggingTo(location); @@ -694,7 +717,11 @@ public class BasicSplitPaneDivider extends Container */ int offset; - + /** + * Constructs a new instance of {@code DragController}. + * + * @param e a mouse event + */ protected DragController(MouseEvent e) { JSplitPane splitPane = splitPaneUI.getSplitPane(); Component leftC = splitPane.getLeftComponent(); @@ -741,7 +768,9 @@ public class BasicSplitPaneDivider extends Container /** - * Returns true if the dragging session is valid. + * Returns {@code true} if the dragging session is valid. + * + * @return {@code true} if the dragging session is valid */ protected boolean isValid() { return (maxX > 0); @@ -751,6 +780,9 @@ public class BasicSplitPaneDivider extends Container /** * Returns the new position to put the divider at based on * the passed in MouseEvent. + * + * @param e a mouse event + * @return the new position */ protected int positionForMouseEvent(MouseEvent e) { int newX = (e.getSource() == BasicSplitPaneDivider.this) ? @@ -764,6 +796,10 @@ public class BasicSplitPaneDivider extends Container /** * Returns the x argument, since this is used for horizontal * splits. + * + * @param x an X coordinate + * @param y an Y coordinate + * @return the X argument */ protected int getNeededLocation(int x, int y) { int newX; @@ -772,7 +808,13 @@ public class BasicSplitPaneDivider extends Container return newX; } - + /** + * Messages dragDividerTo with the new location for the mouse + * event. + * + * @param newX an X coordinate + * @param newY an Y coordinate + */ protected void continueDrag(int newX, int newY) { dragDividerTo(getNeededLocation(newX, newY)); } @@ -781,12 +823,20 @@ public class BasicSplitPaneDivider extends Container /** * Messages dragDividerTo with the new location for the mouse * event. + * + * @param e a mouse event */ protected void continueDrag(MouseEvent e) { dragDividerTo(positionForMouseEvent(e)); } - + /** + * Messages finishDraggingTo with the new location for the mouse + * event. + * + * @param x an X coordinate + * @param y an Y coordinate + */ protected void completeDrag(int x, int y) { finishDraggingTo(getNeededLocation(x, y)); } @@ -795,6 +845,8 @@ public class BasicSplitPaneDivider extends Container /** * Messages finishDraggingTo with the new location for the mouse * event. + * + * @param e a mouse event */ protected void completeDrag(MouseEvent e) { finishDraggingTo(positionForMouseEvent(e)); @@ -813,6 +865,11 @@ public class BasicSplitPaneDivider extends Container protected class VerticalDragController extends DragController { /* DragControllers ivars are now in terms of y, not x. */ + /** + * Constructs a new instance of {@code VerticalDragController}. + * + * @param e a mouse event + */ protected VerticalDragController(MouseEvent e) { super(e); JSplitPane splitPane = splitPaneUI.getSplitPane(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java index ba92184b436..bff514b57ff 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java @@ -64,12 +64,29 @@ public class BasicTableUI extends TableUI // // The JTable that is delegating the painting to this UI. + /** + * The instance of {@code JTable}. + */ protected JTable table; + + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; - // Listeners that are attached to the JTable + /** + * {@code KeyListener} that are attached to the {@code JTable}. + */ protected KeyListener keyListener; + + /** + * {@code FocusListener} that are attached to the {@code JTable}. + */ protected FocusListener focusListener; + + /** + * {@code MouseInputListener} that are attached to the {@code JTable}. + */ protected MouseInputListener mouseInputListener; private Handler handler; @@ -1350,21 +1367,27 @@ public class BasicTableUI extends TableUI } /** - * Creates the key listener for handling keyboard navigation in the JTable. + * Creates the key listener for handling keyboard navigation in the {@code JTable}. + * + * @return the key listener for handling keyboard navigation in the {@code JTable} */ protected KeyListener createKeyListener() { return null; } /** - * Creates the focus listener for handling keyboard navigation in the JTable. + * Creates the focus listener for handling keyboard navigation in the {@code JTable}. + * + * @return the focus listener for handling keyboard navigation in the {@code JTable} */ protected FocusListener createFocusListener() { return getHandler(); } /** - * Creates the mouse listener for the JTable. + * Creates the mouse listener for the {@code JTable}. + * + * @return the mouse listener for the {@code JTable} */ protected MouseInputListener createMouseInputListener() { return getHandler(); @@ -1374,6 +1397,12 @@ public class BasicTableUI extends TableUI // The installation/uninstall procedures and support // + /** + * Returns a new instance of {@code BasicTableUI}. + * + * @param c a component + * @return a new instance of {@code BasicTableUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicTableUI(); } @@ -1616,12 +1645,18 @@ public class BasicTableUI extends TableUI table = null; } + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { if (table.getTransferHandler() instanceof UIResource) { table.setTransferHandler(null); } } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { table.removeFocusListener(focusListener); table.removeKeyListener(keyListener); @@ -1638,6 +1673,9 @@ public class BasicTableUI extends TableUI handler = null; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIInputMap(table, JComponent. WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null); From f77b84ddc6fd4688ad15e53d4df9fbc388ff3f15 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Thu, 10 Jul 2014 15:08:50 +0400 Subject: [PATCH 010/166] 8049830: Remove reflection from ScreenMenuBar Reviewed-by: anthony, serb --- .../classes/com/apple/laf/ScreenMenuBar.java | 51 +++++-------------- .../share/classes/java/awt/MenuComponent.java | 8 +++ .../share/classes/sun/awt/AWTAccessor.java | 7 ++- 3 files changed, 26 insertions(+), 40 deletions(-) diff --git a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java index f4c0aaf4ee8..2d56499ebb3 100644 --- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java +++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java @@ -25,6 +25,9 @@ package com.apple.laf; +import sun.awt.AWTAccessor; +import sun.lwawt.macosx.CMenuBar; + import java.awt.*; import java.awt.event.*; import java.lang.reflect.*; @@ -243,55 +246,25 @@ public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenM fSubmenus.remove(menu); } - private static Field[] stolenFields = null; - - static { - stolenFields = AccessController.doPrivileged(new PrivilegedAction() { - public Field[] run() { - try { - final Field[] localFields = new Field[2]; - localFields[0] = MenuBar.class.getDeclaredField("menus"); - localFields[1] = MenuComponent.class.getDeclaredField("parent"); - AccessibleObject.setAccessible(localFields, true); - return localFields; - } catch (final NoSuchFieldException nsf) { - // If this happens, Sun changed the definition of MenuBar and MenuComponent! - nsf.printStackTrace(System.err); - return null; - } - } - }); - }; - public Menu add(final Menu m, final int index) { synchronized (getTreeLock()) { if (m.getParent() != null) { m.getParent().remove(m); } - // Use nasty reflection to get at the menus array and parent fields. - try { - if (stolenFields == null) return m; + final Vector menus = AWTAccessor.getMenuBarAccessor().getMenus(this); + menus.insertElementAt(m, index); + AWTAccessor.getMenuComponentAccessor().setParent(m, this); - @SuppressWarnings("unchecked") - final Vector menus = (Vector)stolenFields[0].get(this); - menus.insertElementAt(m, index); + final CMenuBar peer = (CMenuBar)getPeer(); + if (peer == null) return m; - stolenFields[1].set(m, this); - - final sun.lwawt.macosx.CMenuBar peer = (sun.lwawt.macosx.CMenuBar)getPeer(); - if (peer == null) return m; - - peer.setNextInsertionIndex(index); - if (m.getPeer() == null) { - m.addNotify(); - } - - peer.setNextInsertionIndex(-1); - } catch (final IllegalAccessException iae) { - iae.printStackTrace(System.err); + peer.setNextInsertionIndex(index); + if (m.getPeer() == null) { + m.addNotify(); } + peer.setNextInsertionIndex(-1); return m; } } diff --git a/jdk/src/share/classes/java/awt/MenuComponent.java b/jdk/src/share/classes/java/awt/MenuComponent.java index 4ea95bf5969..64b1db9bf06 100644 --- a/jdk/src/share/classes/java/awt/MenuComponent.java +++ b/jdk/src/share/classes/java/awt/MenuComponent.java @@ -132,16 +132,24 @@ public abstract class MenuComponent implements java.io.Serializable { static { AWTAccessor.setMenuComponentAccessor( new AWTAccessor.MenuComponentAccessor() { + @Override public AppContext getAppContext(MenuComponent menuComp) { return menuComp.appContext; } + @Override public void setAppContext(MenuComponent menuComp, AppContext appContext) { menuComp.appContext = appContext; } + @Override public MenuContainer getParent(MenuComponent menuComp) { return menuComp.parent; } + @Override + public void setParent(MenuComponent menuComp, MenuContainer menuContainer) { + menuComp.parent = menuContainer; + } + @Override public Font getFont_NoClientCode(MenuComponent menuComp) { return menuComp.getFont_NoClientCode(); } diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java index 0bec70b332a..ddf88d39c79 100644 --- a/jdk/src/share/classes/sun/awt/AWTAccessor.java +++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java @@ -481,10 +481,15 @@ public final class AWTAccessor { void setAppContext(MenuComponent menuComp, AppContext appContext); /** - * Returns the menu container of the menu component + * Returns the menu container of the menu component. */ MenuContainer getParent(MenuComponent menuComp); + /** + * Sets the menu container of the menu component. + */ + void setParent(MenuComponent menuComp, MenuContainer menuContainer); + /** * Gets the font used for this menu component. */ From 2194d4368fe67e9aca7092d22ccc2608373cb30f Mon Sep 17 00:00:00 2001 From: Andrei Eremeev Date: Thu, 10 Jul 2014 17:20:56 +0400 Subject: [PATCH 011/166] 8049808: Fix doclint warnings from javax.swing.plaf.basic package, 3 of 7 Reviewed-by: pchelko --- .../javax/swing/plaf/basic/BasicBorders.java | 150 ++++++++++++- .../javax/swing/plaf/basic/BasicListUI.java | 129 ++++++++--- .../swing/plaf/basic/BasicMenuItemUI.java | 138 +++++++++++- .../swing/plaf/basic/BasicProgressBarUI.java | 79 ++++++- .../swing/plaf/basic/BasicSplitPaneUI.java | 204 ++++++++++++------ 5 files changed, 599 insertions(+), 101 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java index 05a3093e254..633b2f91ee4 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java @@ -45,6 +45,11 @@ import java.awt.Graphics; public class BasicBorders { + /** + * Returns a border instance for a {@code JButton}. + * + * @return a border instance for a {@code JButton} + */ public static Border getButtonBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border buttonBorder = new BorderUIResource.CompoundBorderUIResource( @@ -57,6 +62,11 @@ public class BasicBorders { return buttonBorder; } + /** + * Returns a border instance for a {@code JRadioButton}. + * + * @return a border instance for a {@code JRadioButton} + */ public static Border getRadioButtonBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border radioButtonBorder = new BorderUIResource.CompoundBorderUIResource( @@ -69,6 +79,11 @@ public class BasicBorders { return radioButtonBorder; } + /** + * Returns a border instance for a {@code JToggleButton}. + * + * @return a border instance for a {@code JToggleButton} + */ public static Border getToggleButtonBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource( @@ -81,6 +96,11 @@ public class BasicBorders { return toggleButtonBorder; } + /** + * Returns a border instance for a {@code JMenuBar}. + * + * @return a border instance for a {@code JMenuBar} + */ public static Border getMenuBarBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border menuBarBorder = new BasicBorders.MenuBarBorder( @@ -90,6 +110,11 @@ public class BasicBorders { return menuBarBorder; } + /** + * Returns a border instance for a {@code JSplitPane}. + * + * @return a border instance for a {@code JSplitPane} + */ public static Border getSplitPaneBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border splitPaneBorder = new BasicBorders.SplitPaneBorder( @@ -99,7 +124,9 @@ public class BasicBorders { } /** - * Returns a border instance for a JSplitPane divider + * Returns a border instance for a {@code JSplitPane} divider. + * + * @return a border instance for a {@code JSplitPane} divider * @since 1.3 */ public static Border getSplitPaneDividerBorder() { @@ -110,6 +137,11 @@ public class BasicBorders { return splitPaneBorder; } + /** + * Returns a border instance for a {@code JTextField}. + * + * @return a border instance for a {@code JTextField} + */ public static Border getTextFieldBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border textFieldBorder = new BasicBorders.FieldBorder( @@ -120,12 +152,22 @@ public class BasicBorders { return textFieldBorder; } + /** + * Returns a border instance for a {@code JProgressBar}. + * + * @return a border instance for a {@code JProgressBar} + */ public static Border getProgressBarBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border progressBarBorder = new BorderUIResource.LineBorderUIResource(Color.green, 2); return progressBarBorder; } + /** + * Returns a border instance for a {@code JInternalFrame}. + * + * @return a border instance for a {@code JInternalFrame} + */ public static Border getInternalFrameBorder() { UIDefaults table = UIManager.getLookAndFeelDefaults(); Border internalFrameBorder = new BorderUIResource.CompoundBorderUIResource( @@ -147,6 +189,14 @@ public class BasicBorders { @SuppressWarnings("serial") // Superclass is not serializable across versions public static class RolloverButtonBorder extends ButtonBorder { + /** + * Constructs a new instance of a {@code RolloverButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public RolloverButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { super(shadow, darkShadow, highlight, lightHighlight); @@ -227,13 +277,36 @@ public class BasicBorders { } } + /** + * Draws a border around a button. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ButtonBorder extends AbstractBorder implements UIResource { + /** + * The color of shadow. + */ protected Color shadow; + /** + * The color of dark shadow. + */ protected Color darkShadow; + /** + * The color of highlight. + */ protected Color highlight; + /** + * The color of light highlight. + */ protected Color lightHighlight; + /** + * Constructs a new instance of a {@code ButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public ButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { this.shadow = shadow; @@ -270,9 +343,20 @@ public class BasicBorders { } + /** + * Draws the border around a toggle button. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ToggleButtonBorder extends ButtonBorder { + /** + * Constructs a new instance of a {@code ToggleButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public ToggleButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { super(shadow, darkShadow, highlight, lightHighlight); @@ -292,9 +376,20 @@ public class BasicBorders { } } + /** + * Draws the border around a radio button. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class RadioButtonBorder extends ButtonBorder { + /** + * Constructs a new instance of a {@code RadioButtonBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public RadioButtonBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { super(shadow, darkShadow, highlight, lightHighlight); @@ -329,11 +424,26 @@ public class BasicBorders { } } + /** + * Draws the border around a menu bar. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class MenuBarBorder extends AbstractBorder implements UIResource { + /** + * The color of shadow. + */ private Color shadow; + /** + * The color of highlight. + */ private Color highlight; + /** + * Constructs a new instance of a {@code MenuBarBorder}. + * + * @param shadow a color of shadow + * @param highlight a color of highlight + */ public MenuBarBorder(Color shadow, Color highlight) { this.shadow = shadow; this.highlight = highlight; @@ -356,6 +466,9 @@ public class BasicBorders { } } + /** + * Draws the border around components which support margins. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class MarginBorder extends AbstractBorder implements UIResource { public Insets getBorderInsets(Component c, Insets insets) { @@ -384,13 +497,36 @@ public class BasicBorders { } } + /** + * Draws the border around a field. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class FieldBorder extends AbstractBorder implements UIResource { + /** + * The color of shadow. + */ protected Color shadow; + /** + * The color of dark shadow. + */ protected Color darkShadow; + /** + * The color of highlight. + */ protected Color highlight; + /** + * The color of light highlight. + */ protected Color lightHighlight; + /** + * Constructs a new instance of a {@code FieldBorder}. + * + * @param shadow a color of shadow + * @param darkShadow a color of dark shadow + * @param highlight a color of highlight + * @param lightHighlight a color of light highlight + */ public FieldBorder(Color shadow, Color darkShadow, Color highlight, Color lightHighlight) { this.shadow = shadow; @@ -509,9 +645,21 @@ public class BasicBorders { * also install a border on the divider (property SplitPaneDivider.border). */ public static class SplitPaneBorder implements Border, UIResource { + /** + * The color of highlight + */ protected Color highlight; + /** + * The color of shadow + */ protected Color shadow; + /** + * Constructs a new instance of a {@code SplitPaneBorder}. + * + * @param highlight a color of highlight + * @param shadow a color of shadow + */ public SplitPaneBorder(Color highlight, Color shadow) { this.highlight = highlight; this.shadow = shadow; diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java index c66069e0ae6..fd4292e6350 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java @@ -59,20 +59,53 @@ public class BasicListUI extends ListUI private static final StringBuilder BASELINE_COMPONENT_KEY = new StringBuilder("List.baselineComponent"); + /** + * The instance of {@code JList}. + */ protected JList list = null; + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; // Listeners that this UI attaches to the JList + /** + * {@code FocusListener} that attached to {@code JList}. + */ protected FocusListener focusListener; + /** + * {@code MouseInputListener} that attached to {@code JList}. + */ protected MouseInputListener mouseInputListener; + /** + * {@code ListSelectionListener} that attached to {@code JList}. + */ protected ListSelectionListener listSelectionListener; + /** + * {@code ListDataListener} that attached to {@code JList}. + */ protected ListDataListener listDataListener; + /** + * {@code PropertyChangeListener} that attached to {@code JList}. + */ protected PropertyChangeListener propertyChangeListener; private Handler handler; + /** + * The array of cells' height + */ protected int[] cellHeights = null; + /** + * The height of cell. + */ protected int cellHeight = -1; + /** + * The width of cell. + */ protected int cellWidth = -1; + /** + * The value represents changes to {@code JList} model. + */ protected int updateLayoutStateNeeded = modelChanged; /** * Height of the list. When asked to paint, if the current size of @@ -131,12 +164,33 @@ public class BasicListUI extends ListUI * models length changed, are handled similarly, see DataListener. */ + /** + * The bit relates to model changed property. + */ protected final static int modelChanged = 1 << 0; + /** + * The bit relates to selection model changed property. + */ protected final static int selectionModelChanged = 1 << 1; + /** + * The bit relates to font changed property. + */ protected final static int fontChanged = 1 << 2; + /** + * The bit relates to fixed cell width changed property. + */ protected final static int fixedCellWidthChanged = 1 << 3; + /** + * The bit relates to fixed cell height changed property. + */ protected final static int fixedCellHeightChanged = 1 << 4; + /** + * The bit relates to prototype cell value changed property. + */ protected final static int prototypeCellValueChanged = 1 << 5; + /** + * The bit relates to cell renderer changed property. + */ protected final static int cellRendererChanged = 1 << 6; private final static int layoutOrientationChanged = 1 << 7; private final static int heightChanged = 1 << 8; @@ -187,9 +241,16 @@ public class BasicListUI extends ListUI /** * Paint one List cell: compute the relevant state, get the "rubber stamp" - * cell renderer component, and then use the CellRendererPane to paint it. - * Subclasses may want to override this method rather than paint(). + * cell renderer component, and then use the {@code CellRendererPane} to paint it. + * Subclasses may want to override this method rather than {@code paint()}. * + * @param g an instance of {@code Graphics} + * @param row a row + * @param rowBounds a bounding rectangle to render to + * @param cellRenderer a list of {@code ListCellRenderer} + * @param dataModel a list model + * @param selModel a selection model + * @param leadIndex a lead index * @see #paint */ protected void paintCell( @@ -916,10 +977,11 @@ public class BasicListUI extends ListUI /** - * Returns a new instance of BasicListUI. BasicListUI delegates are - * allocated one per JList. + * Returns a new instance of {@code BasicListUI}. + * {@code BasicListUI} delegates are allocated one per {@code JList}. * - * @return A new ListUI implementation for the Windows look and feel. + * @param list a component + * @return a new {@code ListUI} implementation for the Windows look and feel. */ public static ComponentUI createUI(JComponent list) { return new BasicListUI(); @@ -1046,7 +1108,8 @@ public class BasicListUI extends ListUI /** * Returns the height of the specified row based on the current layout. * - * @return The specified row height or -1 if row isn't valid. + * @param row a row + * @return the specified row height or -1 if row isn't valid * @see #convertYToRow * @see #convertRowToY * @see #updateLayoutState @@ -1058,11 +1121,12 @@ public class BasicListUI extends ListUI /** - * Convert the JList relative coordinate to the row that contains it, - * based on the current layout. If y0 doesn't fall within any row, + * Convert the {@code JList} relative coordinate to the row that contains it, + * based on the current layout. If {@code y0} doesn't fall within any row, * return -1. * - * @return The row that contains y0, or -1. + * @param y0 a relative Y coordinate + * @return the row that contains y0, or -1 * @see #getRowHeight * @see #updateLayoutState */ @@ -1073,10 +1137,11 @@ public class BasicListUI extends ListUI /** - * Return the JList relative Y coordinate of the origin of the specified + * Return the {@code JList} relative Y coordinate of the origin of the specified * row or -1 if row isn't valid. * - * @return The Y coordinate of the origin of row, or -1. + * @param row a row + * @return the Y coordinate of the origin of row, or -1 * @see #getRowHeight * @see #updateLayoutState */ @@ -1535,10 +1600,10 @@ public class BasicListUI extends ListUI /** - * Creates a delegate that implements MouseInputListener. - * The delegate is added to the corresponding java.awt.Component listener - * lists at installUI() time. Subclasses can override this method to return - * a custom MouseInputListener, e.g. + * Creates a delegate that implements {@code MouseInputListener}. + * The delegate is added to the corresponding {@code java.awt.Component} listener + * lists at {@code installUI()} time. Subclasses can override this method to return + * a custom {@code MouseInputListener}, e.g. *
          * class MyListUI extends BasicListUI {
          *    protected MouseInputListener createMouseInputListener() {
    @@ -1553,6 +1618,7 @@ public class BasicListUI extends ListUI
          * }
          * 
    * + * @return an instance of {@code MouseInputListener} * @see MouseInputHandler * @see #installUI */ @@ -1566,6 +1632,9 @@ public class BasicListUI extends ListUI */ public class FocusHandler implements FocusListener { + /** + * Repaints focused cells. + */ protected void repaintCellFocus() { getHandler().repaintCellFocus(); @@ -1584,6 +1653,11 @@ public class BasicListUI extends ListUI } } + /** + * Returns an instance of {@code FocusListener}. + * + * @return an instance of {@code FocusListener} + */ protected FocusListener createFocusListener() { return getHandler(); } @@ -1617,9 +1691,9 @@ public class BasicListUI extends ListUI /** - * Creates an instance of ListSelectionHandler that's added to - * the JLists by selectionModel as needed. Subclasses can override - * this method to return a custom ListSelectionListener, e.g. + * Creates an instance of {@code ListSelectionHandler} that's added to + * the {@code JLists} by selectionModel as needed. Subclasses can override + * this method to return a custom {@code ListSelectionListener}, e.g. *
          * class MyListUI extends BasicListUI {
          *    protected ListSelectionListener createListSelectionListener() {
    @@ -1634,6 +1708,7 @@ public class BasicListUI extends ListUI
          * }
          * 
    * + * @return an instance of {@code ListSelectionHandler} * @see ListSelectionHandler * @see #installUI */ @@ -1649,8 +1724,8 @@ public class BasicListUI extends ListUI /** - * The ListDataListener that's added to the JLists model at - * installUI time, and whenever the JList.model property changes. + * The {@code ListDataListener} that's added to the {@code JLists} model at + * {@code installUI time}, and whenever the JList.model property changes. *

    * Warning: * Serialized objects of this class will not be compatible with @@ -1687,9 +1762,9 @@ public class BasicListUI extends ListUI /** - * Creates an instance of ListDataListener that's added to - * the JLists by model as needed. Subclasses can override - * this method to return a custom ListDataListener, e.g. + * Creates an instance of {@code ListDataListener} that's added to + * the {@code JLists} by model as needed. Subclasses can override + * this method to return a custom {@code ListDataListener}, e.g. *

          * class MyListUI extends BasicListUI {
          *    protected ListDataListener createListDataListener() {
    @@ -1704,6 +1779,7 @@ public class BasicListUI extends ListUI
          * }
          * 
    * + * @return an instance of {@code ListDataListener} * @see ListDataListener * @see JList#getModel * @see #installUI @@ -1744,9 +1820,9 @@ public class BasicListUI extends ListUI /** - * Creates an instance of PropertyChangeHandler that's added to - * the JList by installUI(). Subclasses can override this method - * to return a custom PropertyChangeListener, e.g. + * Creates an instance of {@code PropertyChangeHandler} that's added to + * the {@code JList} by {@code installUI()}. Subclasses can override this method + * to return a custom {@code PropertyChangeListener}, e.g. *
          * class MyListUI extends BasicListUI {
          *    protected PropertyChangeListener createPropertyChangeListener() {
    @@ -1763,6 +1839,7 @@ public class BasicListUI extends ListUI
          * }
          * 
    * + * @return an instance of {@code PropertyChangeHandler} * @see PropertyChangeListener * @see #installUI */ diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java index 9562a2089d6..d8e73a71290 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,11 +47,29 @@ import sun.swing.*; */ public class BasicMenuItemUI extends MenuItemUI { + /** + * The instance of {@code JMenuItem}. + */ protected JMenuItem menuItem = null; + /** + * The color of the selection background. + */ protected Color selectionBackground; + /** + * The color of the selection foreground. + */ protected Color selectionForeground; + /** + * The color of the disabled foreground. + */ protected Color disabledForeground; + /** + * The color of the accelerator foreground. + */ protected Color acceleratorForeground; + /** + * The color of the accelerator selection. + */ protected Color acceleratorSelectionForeground; /** @@ -60,18 +78,33 @@ public class BasicMenuItemUI extends MenuItemUI */ protected String acceleratorDelimiter; + /** + * The gap between the text and the icon. + */ protected int defaultTextIconGap; + /** + * The accelerator font. + */ protected Font acceleratorFont; + /** + * The instance of {@code MouseInputListener}. + */ protected MouseInputListener mouseInputListener; + /** + * The instance of {@code MenuDragMouseListener}. + */ protected MenuDragMouseListener menuDragMouseListener; + /** + * The instance of {@code MenuKeyListener}. + */ protected MenuKeyListener menuKeyListener; /** - * PropertyChangeListener returned from - * createPropertyChangeListener. You should not + * {@code PropertyChangeListener} returned from + * {@code createPropertyChangeListener}. You should not * need to access this field, rather if you want to customize the - * PropertyChangeListener override - * createPropertyChangeListener. + * {@code PropertyChangeListener} override + * {@code createPropertyChangeListener}. * * @since 1.6 * @see #createPropertyChangeListener @@ -79,10 +112,17 @@ public class BasicMenuItemUI extends MenuItemUI protected PropertyChangeListener propertyChangeListener; // BasicMenuUI also uses this. Handler handler; - + /** + * The arrow icon. + */ protected Icon arrowIcon = null; + /** + * The check icon. + */ protected Icon checkIcon = null; - + /** + * The value represents if the old border is painted. + */ protected boolean oldBorderPainted; /* diagnostic aids -- should be false for production builds. */ @@ -97,6 +137,12 @@ public class BasicMenuItemUI extends MenuItemUI BasicLookAndFeel.installAudioActionMap(map); } + /** + * Returns a new instance of {@code BasicMenuItemUI}. + * + * @param c a component + * @return a new instance of {@code BasicMenuItemUI} + */ public static ComponentUI createUI(JComponent c) { return new BasicMenuItemUI(); } @@ -110,7 +156,9 @@ public class BasicMenuItemUI extends MenuItemUI installKeyboardActions(); } - + /** + * Installs default properties. + */ protected void installDefaults() { String prefix = getPropertyPrefix(); @@ -202,16 +250,26 @@ public class BasicMenuItemUI extends MenuItemUI } /** + * + * @param menuItem a menu item * @since 1.3 */ protected void installComponents(JMenuItem menuItem){ BasicHTML.updateRenderer(menuItem, menuItem.getText()); } + /** + * Returns a property prefix. + * + * @return a property prefix + */ protected String getPropertyPrefix() { return "MenuItem"; } + /** + * Registers listeners. + */ protected void installListeners() { if ((mouseInputListener = createMouseInputListener(menuItem)) != null) { menuItem.addMouseListener(mouseInputListener); @@ -228,6 +286,9 @@ public class BasicMenuItemUI extends MenuItemUI } } + /** + * Registers keyboard action. + */ protected void installKeyboardActions() { installLazyActionMap(); updateAcceleratorBinding(); @@ -248,7 +309,9 @@ public class BasicMenuItemUI extends MenuItemUI menuItem = null; } - + /** + * Uninstalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(menuItem); LookAndFeel.installProperty(menuItem, "borderPainted", oldBorderPainted); @@ -261,12 +324,18 @@ public class BasicMenuItemUI extends MenuItemUI } /** + * Unregisters components. + * + * @param menuItem a menu item * @since 1.3 */ protected void uninstallComponents(JMenuItem menuItem){ BasicHTML.updateRenderer(menuItem, ""); } + /** + * Unregisters listeners. + */ protected void uninstallListeners() { if (mouseInputListener != null) { menuItem.removeMouseListener(mouseInputListener); @@ -289,30 +358,52 @@ public class BasicMenuItemUI extends MenuItemUI handler = null; } + /** + * Unregisters keyboard actions. + */ protected void uninstallKeyboardActions() { SwingUtilities.replaceUIActionMap(menuItem, null); SwingUtilities.replaceUIInputMap(menuItem, JComponent. WHEN_IN_FOCUSED_WINDOW, null); } + /** + * Returns an instance of {@code MouseInputListener}. + * + * @param c a component + * @return an instance of {@code MouseInputListener} + */ protected MouseInputListener createMouseInputListener(JComponent c) { return getHandler(); } + /** + * Returns an instance of {@code MenuDragMouseListener}. + * + * @param c a component + * @return an instance of {@code MenuDragMouseListener} + */ protected MenuDragMouseListener createMenuDragMouseListener(JComponent c) { return getHandler(); } + /** + * Returns an instance of {@code MenuKeyListener}. + * + * @param c a component + * @return an instance of {@code MenuKeyListener} + */ protected MenuKeyListener createMenuKeyListener(JComponent c) { return null; } /** - * Creates a PropertyChangeListener which will be added to + * Creates a {@code PropertyChangeListener} which will be added to * the menu item. * If this method returns null then it will not be added to the menu item. * - * @return an instance of a PropertyChangeListener or null + * @param c a component + * @return an instance of a {@code PropertyChangeListener} or null * @since 1.6 */ protected PropertyChangeListener @@ -380,6 +471,15 @@ public class BasicMenuItemUI extends MenuItemUI return d; } + /** + * Returns the preferred size of a menu item. + * + * @param c a component + * @param checkIcon a check icon + * @param arrowIcon an arrow icon + * @param defaultTextIconGap a gap between a text and an icon + * @return the preferred size of a menu item + */ protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, @@ -477,6 +577,17 @@ public class BasicMenuItemUI extends MenuItemUI defaultTextIconGap); } + /** + * Paints a menu item. + * + * @param g an instance of {@code Graphics} + * @param c a component + * @param checkIcon a check icon + * @param arrowIcon an arrow icon + * @param background a background color + * @param foreground a foreground color + * @param defaultTextIconGap a gap between a text and an icon + */ protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, @@ -701,6 +812,11 @@ public class BasicMenuItemUI extends MenuItemUI } } + /** + * Returns a menu element path. + * + * @return a menu element path + */ public MenuElement[] getPath() { MenuSelectionManager m = MenuSelectionManager.defaultManager(); MenuElement oldPath[] = m.getSelectedPath(); diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java index 8c4dbb1126c..caebdfe1688 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,13 @@ public class BasicProgressBarUI extends ProgressBarUI { private Animator animator; + /** + * The instance of {@code JProgressBar}. + */ protected JProgressBar progressBar; + /** + * The instance of {@code ChangeListener}. + */ protected ChangeListener changeListener; private Handler handler; @@ -127,7 +133,12 @@ public class BasicProgressBarUI extends ProgressBarUI { private int maxPosition = 0; //maximum X (horiz) or Y box location - + /** + * Returns a new instance of {@code BasicProgressBarUI}. + * + * @param x a component + * @return a new instance of {@code BasicProgressBarUI} + */ public static ComponentUI createUI(JComponent x) { return new BasicProgressBarUI(); } @@ -150,6 +161,9 @@ public class BasicProgressBarUI extends ProgressBarUI { progressBar = null; } + /** + * Installs default properties. + */ protected void installDefaults() { LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE); LookAndFeel.installBorder(progressBar,"ProgressBar.border"); @@ -164,10 +178,16 @@ public class BasicProgressBarUI extends ProgressBarUI { selectionBackground = UIManager.getColor("ProgressBar.selectionBackground"); } + /** + * Unintalls default properties. + */ protected void uninstallDefaults() { LookAndFeel.uninstallBorder(progressBar); } + /** + * Registers listeners. + */ protected void installListeners() { //Listen for changes in the progress bar's data. changeListener = getHandler(); @@ -291,6 +311,11 @@ public class BasicProgressBarUI extends ProgressBarUI { // protected void installKeyboardActions() // protected void uninstallKeyboardActions() + /** + * Returns preferred size of the horizontal {@code JProgressBar}. + * + * @return preferred size of the horizontal {@code JProgressBar} + */ protected Dimension getPreferredInnerHorizontal() { Dimension horizDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.horizontalSize"); @@ -300,6 +325,11 @@ public class BasicProgressBarUI extends ProgressBarUI { return horizDim; } + /** + * Returns preferred size of the vertical {@code JProgressBar}. + * + * @return preferred size of the vertical {@code JProgressBar} + */ protected Dimension getPreferredInnerVertical() { Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.verticalSize"); @@ -312,6 +342,8 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * The "selectionForeground" is the color of the text when it is painted * over a filled area of the progress bar. + * + * @return the color of the selected foreground */ protected Color getSelectionForeground() { return selectionForeground; @@ -320,6 +352,8 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * The "selectionBackground" is the color of the text when it is painted * over an unfilled area of the progress bar. + * + * @return the color of the selected background */ protected Color getSelectionBackground() { return selectionBackground; @@ -352,6 +386,11 @@ public class BasicProgressBarUI extends ProgressBarUI { } } + /** + * Sets the cell length. + * + * @param cellLen a new cell length + */ protected void setCellLength(int cellLen) { this.cellLength = cellLen; } @@ -374,6 +413,11 @@ public class BasicProgressBarUI extends ProgressBarUI { } } + /** + * Sets the cell spacing. + * + * @param cellSpace a new cell spacing + */ protected void setCellSpacing(int cellSpace) { this.cellSpacing = cellSpace; } @@ -384,6 +428,11 @@ public class BasicProgressBarUI extends ProgressBarUI { * operation so it was abstracted out. It assumes that your progress bar * is linear. That is, if you are making a circular progress indicator, * you will want to override this method. + * + * @param b insets + * @param width a width + * @param height a height + * @return the amount of the progress bar that should be filled */ protected int getAmountFull(Insets b, int width, int height) { int amountFull = 0; @@ -577,6 +626,8 @@ public class BasicProgressBarUI extends ProgressBarUI { * Override this if you are making another kind of * progress bar. * + * @param g an instance of {@code Graphics} + * @param c a component * @see #paintDeterminate * * @since 1.4 @@ -628,6 +679,8 @@ public class BasicProgressBarUI extends ProgressBarUI { * Naturally, override this if you are making a circular or * semi-circular progress bar. * + * @param g an instance of {@code Graphics} + * @param c a component * @see #paintIndeterminate * * @since 1.4 @@ -703,7 +756,18 @@ public class BasicProgressBarUI extends ProgressBarUI { } } - + /** + * Paints the progress string. + * + * @param g an instance of {@code Graphics} + * @param x X location of bounding box + * @param y Y location of bounding box + * @param width width of bounding box + * @param height height of bounding box + * @param amountFull size of the fill region, either width or height + * depending upon orientation. + * @param b Insets of the progress bar. + */ protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) { @@ -793,6 +857,14 @@ public class BasicProgressBarUI extends ProgressBarUI { * bar (in both x and y). Override this if you want to right, * left, top, or bottom align the progress string or if you need * to nudge it around for any reason. + * + * @param g an instance of {@code Graphics} + * @param progressString a text + * @param x an X coordinate + * @param y an Y coordinate + * @param width a width + * @param height a height + * @return the place where the progress string will be painted */ protected Point getStringPlacement(Graphics g, String progressString, int x,int y,int width,int height) { @@ -894,6 +966,7 @@ public class BasicProgressBarUI extends ProgressBarUI { /** * Gets the index of the current animation frame. * + * @return the index of the current animation frame * @since 1.4 */ protected int getAnimationIndex() { diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java index 405795b985d..133325ff9b7 100644 --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java @@ -286,7 +286,10 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Creates a new BasicSplitPaneUI instance + * Creates a new instance of {@code BasicSplitPaneUI}. + * + * @param x a component + * @return a new instance of {@code BasicSplitPaneUI} */ public static ComponentUI createUI(JComponent x) { return new BasicSplitPaneUI(); @@ -503,7 +506,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Creates a PropertyChangeListener for the JSplitPane UI. + * Creates a {@code PropertyChangeListener} for the {@code JSplitPane} UI. + * + * @return an instance of {@code PropertyChangeListener} */ protected PropertyChangeListener createPropertyChangeListener() { return getHandler(); @@ -518,7 +523,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Creates a FocusListener for the JSplitPane UI. + * Creates a {@code FocusListener} for the {@code JSplitPane} UI. + * + * @return an instance of {@code FocusListener} */ protected FocusListener createFocusListener() { return getHandler(); @@ -526,16 +533,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

    - * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -545,16 +553,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

    - * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -564,16 +573,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

    - * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -583,16 +593,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

    - * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -602,16 +613,17 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * As of Java 2 platform v1.3 this method is no - * longer used. Subclassers previously using this method should - * instead create an Action wrapping the ActionListener, and register - * that Action by overriding installKeyboardActions and - * placing the Action in the SplitPane's ActionMap. Please refer to - * the key bindings specification for further details. + * As of Java 2 platform v1.3 this method is no longer used. + * Subclassers previously using this method should instead create + * an {@code Action} wrapping the {@code ActionListener}, and register + * that {@code Action} by overriding {@code installKeyboardActions} + * and placing the {@code Action} in the {@code SplitPane's ActionMap}. + * Please refer to the key bindings specification for further details. *

    - * Creates a ActionListener for the JSplitPane UI that listens for - * specific key presses. + * Creates an {@code ActionListener} for the {@code JSplitPane} UI that + * listens for specific key presses. * + * @return an instance of {@code ActionListener} * @deprecated As of Java 2 platform v1.3. */ @Deprecated @@ -621,7 +633,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the orientation for the JSplitPane. + * Returns the orientation for the {@code JSplitPane}. + * + * @return the orientation */ public int getOrientation() { return orientation; @@ -629,7 +643,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Set the orientation for the JSplitPane. + * Set the orientation for the {@code JSplitPane}. + * + * @param orientation the orientation */ public void setOrientation(int orientation) { this.orientation = orientation; @@ -637,7 +653,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Determines whether the JSplitPane is set to use a continuous layout. + * Determines whether the {@code JSplitPane} is set to use a continuous layout. + * + * @return {@code true} if a continuous layout is set */ public boolean isContinuousLayout() { return continuousLayout; @@ -646,6 +664,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Turn continuous layout on/off. + * + * @param b if {@code true} the continuous layout turns on */ public void setContinuousLayout(boolean b) { continuousLayout = b; @@ -653,7 +673,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the last drag location of the JSplitPane. + * Returns the last drag location of the {@code JSplitPane}. + * + * @return the last drag location */ public int getLastDragLocation() { return lastDragLocation; @@ -661,7 +683,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Set the last drag location of the JSplitPane. + * Set the last drag location of the {@code JSplitPane}. + * + * @param l the drag location */ public void setLastDragLocation(int l) { lastDragLocation = l; @@ -819,6 +843,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the divider between the top Components. + * + * @return the divider between the top Components */ public BasicSplitPaneDivider getDivider() { return divider; @@ -828,6 +854,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the default non continuous layout divider, which is an * instance of {@code Canvas} that fills in the background with dark gray. + * + * @return the default non continuous layout divider */ @SuppressWarnings("serial") // anonymous class protected Component createDefaultNonContinuousLayoutDivider() { @@ -849,10 +877,12 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Sets the divider to use when the splitPane is configured to + * Sets the divider to use when the {@code JSplitPane} is configured to * not continuously layout. This divider will only be used during a * dragging session. It is recommended that the passed in component * be a heavy weight. + * + * @param newDivider the new divider */ protected void setNonContinuousLayoutDivider(Component newDivider) { setNonContinuousLayoutDivider(newDivider, true); @@ -861,6 +891,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Sets the divider to use. + * + * @param newDivider the new divider + * @param rememberSizes if {@code true} the pane size is remembered */ protected void setNonContinuousLayoutDivider(Component newDivider, boolean rememberSizes) { @@ -903,9 +936,11 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the divider to use when the splitPane is configured to + * Returns the divider to use when the {@code JSplitPane} is configured to * not continuously layout. This divider will only be used during a * dragging session. + * + * @return the divider */ public Component getNonContinuousLayoutDivider() { return nonContinuousLayoutDivider; @@ -913,8 +948,10 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the splitpane this instance is currently contained + * Returns the {@code JSplitPane} this instance is currently contained * in. + * + * @return the instance of {@code JSplitPane} */ public JSplitPane getSplitPane() { return splitPane; @@ -923,6 +960,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Creates the default divider. + * + * @return the default divider */ public BasicSplitPaneDivider createDefaultDivider() { return new BasicSplitPaneDivider(this); @@ -1108,6 +1147,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the insets. The insets are returned from the border insets * of the current border. + * + * @param jc a component + * @return the insets */ public Insets getInsets(JComponent jc) { return null; @@ -1187,8 +1229,10 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Messaged during a dragging session to move the divider to the - * passed in location. If continuousLayout is true the location is - * reset and the splitPane validated. + * passed in {@code location}. If {@code continuousLayout} is {@code true} + * the location is reset and the splitPane validated. + * + * @param location the location of divider */ protected void dragDividerTo(int location) { if(getLastDragLocation() != location) { @@ -1230,7 +1274,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Messaged to finish the dragging session. If not continuous display - * the dividers location will be reset. + * the dividers {@code location} will be reset. + * + * @param location the location of divider */ protected void finishDraggingTo(int location) { dragDividerTo(location); @@ -1259,6 +1305,7 @@ public class BasicSplitPaneUI extends SplitPaneUI *

    * Returns the width of one side of the divider border. * + * @return the width of one side of the divider border * @deprecated As of Java 2 platform v1.3, instead set the border on the * divider. */ @@ -1275,7 +1322,13 @@ public class BasicSplitPaneUI extends SplitPaneUI public class BasicHorizontalLayoutManager implements LayoutManager2 { /* left, right, divider. (in this exact order) */ + /** + * The size of components. + */ protected int[] sizes; + /** + * The components. + */ protected Component[] components; /** Size of the splitpane the last time laid out. */ private int lastSplitPaneSize; @@ -1596,6 +1649,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Resets the size of the Component at the passed in location. + * + * @param index the index of a component */ protected void resetSizeAt(int index) { sizes[index] = 0; @@ -1604,7 +1659,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Sets the sizes to newSizes. + * Sets the sizes to {@code newSizes}. + * + * @param newSizes the new sizes */ protected void setSizes(int[] newSizes) { System.arraycopy(newSizes, 0, sizes, 0, 3); @@ -1613,6 +1670,8 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the sizes of the components. + * + * @return the sizes of the components */ protected int[] getSizes() { int[] retSizes = new int[3]; @@ -1624,6 +1683,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the width of the passed in Components preferred size. + * + * @param c a component + * @return the preferred width of the component */ protected int getPreferredSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getPreferredSize()); @@ -1632,6 +1694,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the width of the passed in Components minimum size. + * + * @param c a component + * @return the minimum width of the component */ int getMinimumSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getMinimumSize()); @@ -1640,6 +1705,9 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the width of the passed in component. + * + * @param c a component + * @return the width of the component */ protected int getSizeOfComponent(Component c) { return getSizeForPrimaryAxis(c.getSize()); @@ -1648,7 +1716,11 @@ public class BasicSplitPaneUI extends SplitPaneUI /** * Returns the available width based on the container size and - * Insets. + * {@code Insets}. + * + * @param containerSize a container size + * @param insets an insets + * @return the available width */ protected int getAvailableSize(Dimension containerSize, Insets insets) { @@ -1661,8 +1733,11 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Returns the left inset, unless the Insets are null in which case + * Returns the left inset, unless the {@code Insets} are null in which case * 0 is returned. + * + * @param insets the insets + * @return the left inset */ protected int getInitialLocation(Insets insets) { if(insets != null) @@ -1672,9 +1747,15 @@ public class BasicSplitPaneUI extends SplitPaneUI /** - * Sets the width of the component c to be size, placing its - * x location at location, y to the insets.top and height - * to the containersize.height less the top and bottom insets. + * Sets the width of the component {@code c} to be {@code size}, placing its + * x location at {@code location}, y to the {@code insets.top} and height + * to the {@code containerSize.height} less the top and bottom insets. + * + * @param c a component + * @param size a new width + * @param location a new X coordinate + * @param insets an insets + * @param containerSize a container size */ protected void setComponentToSize(Component c, int size, int location, Insets insets, @@ -2021,6 +2102,9 @@ public class BasicSplitPaneUI extends SplitPaneUI public class BasicVerticalLayoutManager extends BasicHorizontalLayoutManager { + /** + * Constructs a new instance of {@code BasicVerticalLayoutManager}. + */ public BasicVerticalLayoutManager() { super(1); } From cb14edb87e27fd501b7e32bb752d0be055a1921f Mon Sep 17 00:00:00 2001 From: Mikhail Cherkasov Date: Thu, 10 Jul 2014 18:46:40 +0400 Subject: [PATCH 012/166] 4991647: PNGMetadata.getAsTree() sets bitDepth to invalid value Reviewed-by: prr, bae --- .../sun/imageio/plugins/png/PNGMetadata.java | 7 +- .../imageio/plugins/png/PngDitDepthTest.java | 74 +++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java diff --git a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java index 11018ec4015..110bd9e2def 100644 --- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java +++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java @@ -1254,8 +1254,11 @@ public class PNGMetadata extends IIOMetadata implements Cloneable { if (name.equals("IHDR")) { IHDR_width = getIntAttribute(node, "width"); IHDR_height = getIntAttribute(node, "height"); - IHDR_bitDepth = getEnumeratedAttribute(node, "bitDepth", - IHDR_bitDepths); + IHDR_bitDepth = + Integer.valueOf(IHDR_bitDepths[ + getEnumeratedAttribute(node, + "bitDepth", + IHDR_bitDepths)]); IHDR_colorType = getEnumeratedAttribute(node, "colorType", IHDR_colorTypeNames); IHDR_compressionMethod = diff --git a/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java b/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java new file mode 100644 index 00000000000..7317f87c503 --- /dev/null +++ b/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* +* @test +* @bug 4991647 +* @summary PNGMetadata.getAsTree() sets bitDepth to invalid value +* @run main PngDitDepthTest +*/ + +import org.w3c.dom.Node; + +import javax.imageio.ImageIO; +import javax.imageio.ImageTypeSpecifier; +import javax.imageio.ImageWriter; +import javax.imageio.metadata.IIOInvalidTreeException; +import javax.imageio.metadata.IIOMetadata; +import java.awt.image.ColorModel; +import java.awt.image.SampleModel; +import java.util.Iterator; + +public class PngDitDepthTest { + + public static void main(String[] args) throws IIOInvalidTreeException { + + // getting the writer for the png format + Iterator iter = ImageIO.getImageWritersByFormatName("png"); + ImageWriter writer = (ImageWriter) iter.next(); + + // creating a color model + ColorModel colorModel = ColorModel.getRGBdefault(); + + // creating a sample model + SampleModel sampleModel = colorModel.createCompatibleSampleModel(640, 480); + + // creating a default metadata object + IIOMetadata metaData = writer.getDefaultImageMetadata(new ImageTypeSpecifier(colorModel, sampleModel), null); + String formatName = metaData.getNativeMetadataFormatName(); + + // first call + Node metaDataNode = metaData.getAsTree(formatName); + try { + metaData.setFromTree(formatName, metaDataNode); + } catch (Exception ex) { + ex.printStackTrace(); + } + + // second call (bitdepht is already set to an invalid value) + metaDataNode = metaData.getAsTree(formatName); + + metaData.setFromTree(formatName, metaDataNode); + + } +} From be41c05edc0bfafc89fb36956cc5fa434e44fc14 Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Thu, 10 Jul 2014 15:27:02 -0700 Subject: [PATCH 013/166] 8049797: Fix raw and unchecked lint warnings in javax.swing.SortingFocusTraversalPolicy Reviewed-by: prr --- .../classes/javax/swing/SortingFocusTraversalPolicy.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java index 797f6f35524..7199531c61b 100644 --- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java +++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java @@ -109,11 +109,12 @@ public class SortingFocusTraversalPolicy AccessController.doPrivileged(new PrivilegedAction() { public Method run() { try { - Class c = Class.forName("java.util.Arrays"); - Method m = c.getDeclaredMethod("legacyMergeSort", new Class[]{Object[].class, Comparator.class}); + Method m = java.util.Arrays.class.getDeclaredMethod("legacyMergeSort", + new Class[]{Object[].class, + Comparator.class}); m.setAccessible(true); return m; - } catch (ClassNotFoundException | NoSuchMethodException e) { + } catch (NoSuchMethodException e) { // using default sorting algo return null; } From f5a99dfd8f8355c507d0c95dc3d0b35ef9b08236 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Mon, 23 Jun 2014 10:54:10 -0700 Subject: [PATCH 014/166] 8042872: Fix raw and unchecked warnings in sun.applet Reviewed-by: darcy, herrick --- .../classes/sun/applet/AppletClassLoader.java | 39 +++++----- .../classes/sun/applet/AppletImageRef.java | 6 +- .../sun/applet/AppletObjectInputStream.java | 6 +- .../share/classes/sun/applet/AppletPanel.java | 50 ++++++------ .../share/classes/sun/applet/AppletProps.java | 8 +- .../classes/sun/applet/AppletSecurity.java | 63 +++++++-------- .../classes/sun/applet/AppletViewer.java | 76 ++++++++++--------- .../sun/applet/AppletViewerFactory.java | 3 +- .../classes/sun/applet/AppletViewerPanel.java | 6 +- jdk/src/share/classes/sun/applet/Main.java | 10 +-- 10 files changed, 138 insertions(+), 129 deletions(-) diff --git a/jdk/src/share/classes/sun/applet/AppletClassLoader.java b/jdk/src/share/classes/sun/applet/AppletClassLoader.java index fe3459771b2..83684cb36f2 100644 --- a/jdk/src/share/classes/sun/applet/AppletClassLoader.java +++ b/jdk/src/share/classes/sun/applet/AppletClassLoader.java @@ -137,7 +137,7 @@ public class AppletClassLoader extends URLClassLoader { * Override loadClass so that class loading errors can be caught in * order to print better error messages. */ - public synchronized Class loadClass(String name, boolean resolve) + public synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // First check if we have permission to access the package. This @@ -166,7 +166,7 @@ public class AppletClassLoader extends URLClassLoader { * Finds the applet class with the specified name. First searches * loaded JAR files then the applet code base for the class. */ - protected Class findClass(String name) throws ClassNotFoundException { + protected Class findClass(String name) throws ClassNotFoundException { int index = name.indexOf(';'); String cookie = ""; @@ -192,9 +192,9 @@ public class AppletClassLoader extends URLClassLoader { String encodedName = ParseUtil.encodePath(name.replace('.', '/'), false); final String path = (new StringBuffer(encodedName)).append(".class").append(cookie).toString(); try { - byte[] b = (byte[]) AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() throws IOException { + byte[] b = AccessController.doPrivileged( + new PrivilegedExceptionAction() { + public byte[] run() throws IOException { try { URL finalURL = new URL(base, path); @@ -556,9 +556,10 @@ public class AppletClassLoader extends URLClassLoader { * name. First checks loaded JAR files then the applet code base for all * available resources. */ - public Enumeration findResources(String name) throws IOException { + @Override + public Enumeration findResources(String name) throws IOException { - final Enumeration e = super.findResources(name); + final Enumeration e = super.findResources(name); // 6215746: Disable META-INF/* lookup from codebase in // applet/plugin classloader. [stanley.ho] @@ -576,9 +577,9 @@ public class AppletClassLoader extends URLClassLoader { } final URL url = u; - return new Enumeration() { + return new Enumeration() { private boolean done; - public Object nextElement() { + public URL nextElement() { if (!done) { if (e.hasMoreElements()) { return e.nextElement(); @@ -601,7 +602,7 @@ public class AppletClassLoader extends URLClassLoader { * attribute. The argument can either be the relative path * of the class file itself or just the name of the class. */ - Class loadCode(String name) throws ClassNotFoundException { + Class loadCode(String name) throws ClassNotFoundException { // first convert any '/' or native file separator to . name = name.replace('/', '.'); name = name.replace(File.separatorChar, '.'); @@ -646,7 +647,7 @@ public class AppletClassLoader extends URLClassLoader { public ThreadGroup getThreadGroup() { synchronized (threadGroupSynchronizer) { if (threadGroup == null || threadGroup.isDestroyed()) { - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { threadGroup = new AppletThreadGroup(base + "-threadGroup"); // threadGroup.setDaemon(true); @@ -770,8 +771,8 @@ public void grab() { // Hash map to store applet compatibility info - private HashMap jdk11AppletInfo = new HashMap(); - private HashMap jdk12AppletInfo = new HashMap(); + private HashMap jdk11AppletInfo = new HashMap<>(); + private HashMap jdk12AppletInfo = new HashMap<>(); /** * Set applet target level as JDK 1.1. @@ -780,7 +781,7 @@ public void grab() { * @param bool true if JDK is targeted for JDK 1.1; * false otherwise. */ - void setJDK11Target(Class clazz, boolean bool) + void setJDK11Target(Class clazz, boolean bool) { jdk11AppletInfo.put(clazz.toString(), Boolean.valueOf(bool)); } @@ -792,7 +793,7 @@ public void grab() { * @param bool true if JDK is targeted for JDK 1.2; * false otherwise. */ - void setJDK12Target(Class clazz, boolean bool) + void setJDK12Target(Class clazz, boolean bool) { jdk12AppletInfo.put(clazz.toString(), Boolean.valueOf(bool)); } @@ -805,9 +806,9 @@ public void grab() { * FALSE if applet is not; * null if applet is unknown. */ - Boolean isJDK11Target(Class clazz) + Boolean isJDK11Target(Class clazz) { - return (Boolean) jdk11AppletInfo.get(clazz.toString()); + return jdk11AppletInfo.get(clazz.toString()); } /** @@ -818,9 +819,9 @@ public void grab() { * FALSE if applet is not; * null if applet is unknown. */ - Boolean isJDK12Target(Class clazz) + Boolean isJDK12Target(Class clazz) { - return (Boolean) jdk12AppletInfo.get(clazz.toString()); + return jdk12AppletInfo.get(clazz.toString()); } private static AppletMessageHandler mh = diff --git a/jdk/src/share/classes/sun/applet/AppletImageRef.java b/jdk/src/share/classes/sun/applet/AppletImageRef.java index f264e890351..e3eb5a26fb1 100644 --- a/jdk/src/share/classes/sun/applet/AppletImageRef.java +++ b/jdk/src/share/classes/sun/applet/AppletImageRef.java @@ -65,7 +65,7 @@ class AppletImageRef { * invoke reconstitute(). */ public synchronized void flush() { - SoftReference s = soft; + SoftReference s = soft; if (s != null) s.clear(); soft = null; } @@ -74,9 +74,9 @@ class AppletImageRef { * Sets the thing to the specified object. * @param thing the specified object */ - public synchronized void setThing(Object thing) { + public synchronized void setThing(Image thing) { flush(); - soft = new SoftReference(thing); + soft = new SoftReference<>(thing); } /** diff --git a/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java b/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java index 36bd8156e5b..0906136bfec 100644 --- a/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java +++ b/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java @@ -59,7 +59,7 @@ class AppletObjectInputStream extends ObjectInputStream * Make a primitive array class */ - private Class primitiveType(char type) { + private Class primitiveType(char type) { switch (type) { case 'B': return byte.class; case 'C': return char.class; @@ -76,13 +76,13 @@ class AppletObjectInputStream extends ObjectInputStream /** * Use the given ClassLoader rather than using the system class */ - protected Class resolveClass(ObjectStreamClass classDesc) + protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { String cname = classDesc.getName(); if (cname.startsWith("[")) { // An array - Class component; // component class + Class component; // component class int dcount; // dimension for (dcount=1; cname.charAt(dcount)=='['; dcount++) ; if (cname.charAt(dcount) == 'L') { diff --git a/jdk/src/share/classes/sun/applet/AppletPanel.java b/jdk/src/share/classes/sun/applet/AppletPanel.java index 15ba72b288c..89514ddbcd3 100644 --- a/jdk/src/share/classes/sun/applet/AppletPanel.java +++ b/jdk/src/share/classes/sun/applet/AppletPanel.java @@ -179,7 +179,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { handler = new Thread(appletGroup, this, "thread " + nm); // set the context class loader for this thread - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { handler.setContextClassLoader(loader); @@ -253,7 +253,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { /** * AppletEvent Queue */ - private Queue queue = null; + private Queue queue = null; synchronized public void addAppletListener(AppletListener l) { @@ -282,7 +282,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { synchronized(this) { if (queue == null) { //System.out.println("SEND0= " + id); - queue = new Queue(); + queue = new Queue<>(); } Integer eventId = Integer.valueOf(id); queue.enqueue(eventId); @@ -309,7 +309,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { while (queue == null || queue.isEmpty()) { wait(); } - Integer eventId = (Integer)queue.dequeue(); + Integer eventId = queue.dequeue(); return new AppletEvent(this, eventId.intValue(), null); } @@ -631,14 +631,15 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * calls KeyboardFocusManager directly. */ private Component getMostRecentFocusOwnerForWindow(Window w) { - Method meth = (Method)AccessController.doPrivileged(new PrivilegedAction() { + Method meth = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { + public Method run() { Method meth = null; try { meth = KeyboardFocusManager.class.getDeclaredMethod( "getMostRecentFocusOwner", - new Class[]{Window.class}); + new Class[]{Window.class}); meth.setAccessible(true); } catch (Exception e) { // Must never happen @@ -988,7 +989,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { /** * The class loaders */ - private static HashMap classloaders = new HashMap(); + private static HashMap classloaders = new HashMap<>(); /** * Flush a class loader. @@ -1001,7 +1002,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * Flush all class loaders. */ public static synchronized void flushClassLoaders() { - classloaders = new HashMap(); + classloaders = new HashMap<>(); } /** @@ -1018,14 +1019,14 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * Get a class loader. Create in a restricted context */ synchronized AppletClassLoader getClassLoader(final URL codebase, final String key) { - AppletClassLoader c = (AppletClassLoader)classloaders.get(key); + AppletClassLoader c = classloaders.get(key); if (c == null) { AccessControlContext acc = getAccessControlContext(codebase); - c = (AppletClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { + c = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { + public AppletClassLoader run() { AppletClassLoader ac = createClassLoader(codebase); /* Should the creation of the classloader be * within the class synchronized block? Since @@ -1043,8 +1044,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { * (which timeout when called from the browser). */ synchronized (getClass()) { - AppletClassLoader res = - (AppletClassLoader)classloaders.get(key); + AppletClassLoader res = classloaders.get(key); if (res == null) { classloaders.put(key, ac); return ac; @@ -1066,10 +1066,10 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { */ private AccessControlContext getAccessControlContext(final URL codebase) { - PermissionCollection perms = (PermissionCollection) - AccessController.doPrivileged(new PrivilegedAction() { + PermissionCollection perms = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { + public PermissionCollection run() { Policy p = java.security.Policy.getPolicy(); if (p != null) { return p.getPermissions(new CodeSource(null, @@ -1172,13 +1172,15 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { // critical section of the window list in AppContext. synchronized (Window.class) { - WeakReference weakRef = null; + WeakReference weakRef = null; // Remove frame from the Window list in wrong AppContext { // Lookup current frame's AppContext - Vector> windowList = (Vector>)oldAppContext.get(Window.class); + @SuppressWarnings("unchecked") + Vector> windowList = + (Vector>)oldAppContext.get(Window.class); if (windowList != null) { - for (WeakReference ref : windowList) { + for (WeakReference ref : windowList) { if (ref.get() == frame) { weakRef = ref; break; @@ -1195,7 +1197,9 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { // Insert frame into the Window list in the applet's AppContext map { - Vector> windowList = (Vector)newAppContext.get(Window.class); + @SuppressWarnings("unchecked") + Vector> windowList = + (Vector>)newAppContext.get(Window.class); if (windowList == null) { windowList = new Vector>(); newAppContext.put(Window.class, windowList); @@ -1224,7 +1228,7 @@ abstract class AppletPanel extends Panel implements AppletStub, Runnable { // synchronized on applet class object, so calling from // different instances of the same applet will be // serialized. - Class appletClass = applet.getClass(); + Class appletClass = applet.getClass(); synchronized(appletClass) { // Determine if the JDK level of an applet has been diff --git a/jdk/src/share/classes/sun/applet/AppletProps.java b/jdk/src/share/classes/sun/applet/AppletProps.java index 466aa83735b..161bc79a8c3 100644 --- a/jdk/src/share/classes/sun/applet/AppletProps.java +++ b/jdk/src/share/classes/sun/applet/AppletProps.java @@ -105,9 +105,9 @@ class AppletProps extends Frame { String proxyPortValue = proxyPort.getText().trim(); // Get properties - final Properties props = (Properties) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + final Properties props = AccessController.doPrivileged( + new PrivilegedAction() { + public Properties run() { return System.getProperties(); } }); @@ -148,7 +148,7 @@ class AppletProps extends Frame { // Save properties try { reset(); - AccessController.doPrivileged(new PrivilegedExceptionAction() { + AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { File dotAV = Main.theUserPropertiesFile; FileOutputStream out = new FileOutputStream(dotAV); diff --git a/jdk/src/share/classes/sun/applet/AppletSecurity.java b/jdk/src/share/classes/sun/applet/AppletSecurity.java index 9fb20e9662e..2f11d43d19f 100644 --- a/jdk/src/share/classes/sun/applet/AppletSecurity.java +++ b/jdk/src/share/classes/sun/applet/AppletSecurity.java @@ -80,7 +80,7 @@ class AppletSecurity extends AWTSecurityManager { } // Cache to store known restricted packages - private HashSet restrictedPackages = new HashSet(); + private HashSet restrictedPackages = new HashSet<>(); /** * Reset from Properties @@ -90,11 +90,11 @@ class AppletSecurity extends AWTSecurityManager { // Clear cache restrictedPackages.clear(); - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // Enumerate system properties - Enumeration e = System.getProperties().propertyNames(); + Enumeration e = System.getProperties().propertyNames(); while (e.hasMoreElements()) { @@ -130,7 +130,7 @@ class AppletSecurity extends AWTSecurityManager { return (AppletClassLoader)loader; // if that fails, get all the classes on the stack and check them. - Class[] context = getClassContext(); + Class[] context = getClassContext(); for (int i = 0; i < context.length; i++) { loader = context[i].getClassLoader(); if (loader instanceof AppletClassLoader) @@ -148,37 +148,38 @@ class AppletSecurity extends AWTSecurityManager { final ClassLoader currentLoader = context[i].getClassLoader(); if (currentLoader instanceof URLClassLoader) { - loader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + loader = AccessController.doPrivileged( + new PrivilegedAction() { + public ClassLoader run() { - AccessControlContext acc = null; - ProtectionDomain[] pds = null; + AccessControlContext acc = null; + ProtectionDomain[] pds = null; - try { - acc = (AccessControlContext) facc.get(currentLoader); - if (acc == null) { - return null; + try { + acc = (AccessControlContext) facc.get(currentLoader); + if (acc == null) { + return null; + } + + pds = (ProtectionDomain[]) fcontext.get(acc); + if (pds == null) { + return null; + } + } catch (Exception e) { + throw new UnsupportedOperationException(e); } - pds = (ProtectionDomain[]) fcontext.get(acc); - if (pds == null) { - return null; + for (int i=0; i iter = restrictedPackages.iterator(); iter.hasNext();) { - String pkg = (String) iter.next(); + String pkg = iter.next(); // Prevent matching "sun" and "sunir" even if they // starts with similar beginning characters diff --git a/jdk/src/share/classes/sun/applet/AppletViewer.java b/jdk/src/share/classes/sun/applet/AppletViewer.java index 92c4fc17f77..b58579fd096 100644 --- a/jdk/src/share/classes/sun/applet/AppletViewer.java +++ b/jdk/src/share/classes/sun/applet/AppletViewer.java @@ -94,7 +94,7 @@ final class StdAppletViewerFactory implements AppletViewerFactory { @Override public AppletViewer createAppletViewer(int x, int y, - URL doc, Hashtable atts) { + URL doc, Hashtable atts) { return new AppletViewer(x, y, doc, atts, System.out, this); } @@ -156,7 +156,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * Create the applet viewer. */ - public AppletViewer(int x, int y, URL doc, Hashtable atts, + public AppletViewer(int x, int y, URL doc, Hashtable atts, PrintStream statusMsgStream, AppletViewerFactory factory) { this.factory = factory; this.statusMsgStream = statusMsgStream; @@ -350,7 +350,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * s. Whitespace not stripped. */ private String [] splitSeparator(String sep, String s) { - Vector v = new Vector(); + Vector v = new Vector<>(); int tokenStart = 0; int tokenEnd = 0; @@ -370,7 +370,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * Methods for java.applet.AppletContext */ - private static Map audioClips = new HashMap(); + private static Map audioClips = new HashMap<>(); /** * Get an audio clip. @@ -379,7 +379,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { public AudioClip getAudioClip(URL url) { checkConnect(url); synchronized (audioClips) { - AudioClip clip = (AudioClip)audioClips.get(url); + AudioClip clip = audioClips.get(url); if (clip == null) { audioClips.put(url, clip = new AppletAudioClip(url)); } @@ -387,7 +387,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } } - private static Map imageRefs = new HashMap(); + private static Map imageRefs = new HashMap<>(); /** * Get an image. @@ -403,7 +403,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { static Image getCachedImage(URL url) { // System.getSecurityManager().checkConnection(url.getHost(), url.getPort()); synchronized (imageRefs) { - AppletImageRef ref = (AppletImageRef)imageRefs.get(url); + AppletImageRef ref = imageRefs.get(url); if (ref == null) { ref = new AppletImageRef(url); imageRefs.put(url, ref); @@ -419,7 +419,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { imageRefs.clear(); } - static Vector appletPanels = new Vector(); + static Vector appletPanels = new Vector<>(); /** * Get an applet by name. @@ -430,8 +430,8 @@ public class AppletViewer extends Frame implements AppletContext, Printable { name = name.toLowerCase(); SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect"); - for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { - AppletPanel p = (AppletPanel)e.nextElement(); + for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { + AppletPanel p = e.nextElement(); String param = p.getParameter("name"); if (param != null) { param = param.toLowerCase(); @@ -455,14 +455,14 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * applets on this page. */ @Override - public Enumeration getApplets() { + public Enumeration getApplets() { AppletSecurity security = (AppletSecurity)System.getSecurityManager(); - Vector v = new Vector(); + Vector v = new Vector<>(); SocketPermission panelSp = new SocketPermission(panel.getCodeBase().getHost(), "connect"); - for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { - AppletPanel p = (AppletPanel)e.nextElement(); + for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { + AppletPanel p = e.nextElement(); if (p.getDocumentBase().equals(panel.getDocumentBase())) { SocketPermission sp = @@ -509,7 +509,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } @Override - public Iterator getStreamKeys(){ + public Iterator getStreamKeys(){ // We do nothing. return null; } @@ -517,7 +517,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * System parameters. */ - static Hashtable systemParam = new Hashtable(); + static Hashtable systemParam = new Hashtable<>(); static { systemParam.put("codebase", "codebase"); @@ -533,32 +533,32 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * Print the HTML tag. */ - public static void printTag(PrintStream out, Hashtable atts) { + public static void printTag(PrintStream out, Hashtable atts) { out.print(" e = atts.keys() ; e.hasMoreElements() ;) { + String param = e.nextElement(); int i = 0; for (; i < len ; i++) { if (params[i].compareTo(param) >= 0) { @@ -649,7 +649,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { * Save the applet to a well known file (for now) as a serialized object */ void appletSave() { - AccessController.doPrivileged(new PrivilegedAction() { + AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { @@ -702,8 +702,10 @@ public class AppletViewer extends Frame implements AppletContext, Printable { void appletClone() { Point p = location(); updateAtts(); + @SuppressWarnings("unchecked") + Hashtable tmp = (Hashtable) panel.atts.clone(); factory.createAppletViewer(p.x + XDELTA, p.y + YDELTA, - panel.documentURL, (Hashtable)panel.atts.clone()); + panel.documentURL, tmp); } /** @@ -884,8 +886,8 @@ public class AppletViewer extends Frame implements AppletContext, Printable { @Override public void run() { - for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { - AppletPanel p = (AppletPanel)e.nextElement(); + for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) { + AppletPanel p = e.nextElement(); appletShutdown(p); } appletSystemExit(); @@ -1016,8 +1018,8 @@ public class AppletViewer extends Frame implements AppletContext, Printable { /** * Scan tag */ - public static Hashtable scanTag(Reader in) throws IOException { - Hashtable atts = new Hashtable(); + public static Hashtable scanTag(Reader in) throws IOException { + Hashtable atts = new Hashtable<>(); skipSpace(in); while (c >= 0 && c != '>') { String att = scanIdentifier(in); @@ -1122,7 +1124,7 @@ public class AppletViewer extends Frame implements AppletContext, Printable { url = conn.getURL(); int ydisp = 1; - Hashtable atts = null; + Hashtable atts = null; while(true) { c = in.read(); @@ -1172,12 +1174,12 @@ public class AppletViewer extends Frame implements AppletContext, Printable { else { String nm = scanIdentifier(in); if (nm.equalsIgnoreCase("param")) { - Hashtable t = scanTag(in); - String att = (String)t.get("name"); + Hashtable t = scanTag(in); + String att = t.get("name"); if (att == null) { statusMsgStream.println(requiresNameWarning); } else { - String val = (String)t.get("value"); + String val = t.get("value"); if (val == null) { statusMsgStream.println(requiresNameWarning); } else if (atts != null) { @@ -1235,13 +1237,13 @@ public class AppletViewer extends Frame implements AppletContext, Printable { } else if (nm.equalsIgnoreCase("app")) { statusMsgStream.println(appNotLongerSupportedWarning); - Hashtable atts2 = scanTag(in); - nm = (String)atts2.get("class"); + Hashtable atts2 = scanTag(in); + nm = atts2.get("class"); if (nm != null) { atts2.remove("class"); atts2.put("code", nm + ".class"); } - nm = (String)atts2.get("src"); + nm = atts2.get("src"); if (nm != null) { atts2.remove("src"); atts2.put("codebase", nm); diff --git a/jdk/src/share/classes/sun/applet/AppletViewerFactory.java b/jdk/src/share/classes/sun/applet/AppletViewerFactory.java index 6fcfaa2ee44..16b6db4679d 100644 --- a/jdk/src/share/classes/sun/applet/AppletViewerFactory.java +++ b/jdk/src/share/classes/sun/applet/AppletViewerFactory.java @@ -35,7 +35,8 @@ import java.awt.MenuBar; public interface AppletViewerFactory { - public AppletViewer createAppletViewer(int x, int y, URL doc, Hashtable atts); + public AppletViewer createAppletViewer(int x, int y, URL doc, + Hashtable atts); public MenuBar getBaseMenuBar(); public boolean isStandalone(); } diff --git a/jdk/src/share/classes/sun/applet/AppletViewerPanel.java b/jdk/src/share/classes/sun/applet/AppletViewerPanel.java index 93f064bb36d..1a8354c0035 100644 --- a/jdk/src/share/classes/sun/applet/AppletViewerPanel.java +++ b/jdk/src/share/classes/sun/applet/AppletViewerPanel.java @@ -59,7 +59,7 @@ class AppletViewerPanel extends AppletPanel { /** * The attributes of the applet. */ - Hashtable atts; + Hashtable atts; /* * JDK 1.1 serialVersionUID @@ -69,7 +69,7 @@ class AppletViewerPanel extends AppletPanel { /** * Construct an applet viewer and start the applet. */ - AppletViewerPanel(URL documentURL, Hashtable atts) { + AppletViewerPanel(URL documentURL, Hashtable atts) { this.documentURL = documentURL; this.atts = atts; @@ -105,7 +105,7 @@ class AppletViewerPanel extends AppletPanel { * Get an applet parameter. */ public String getParameter(String name) { - return (String)atts.get(name.toLowerCase()); + return atts.get(name.toLowerCase()); } /** diff --git a/jdk/src/share/classes/sun/applet/Main.java b/jdk/src/share/classes/sun/applet/Main.java index a95a36f2688..d29ed5ffd23 100644 --- a/jdk/src/share/classes/sun/applet/Main.java +++ b/jdk/src/share/classes/sun/applet/Main.java @@ -84,7 +84,7 @@ public class Main { /** * The list of valid URLs passed in to AppletViewer. */ - private static Vector urlList = new Vector(1); + private static Vector urlList = new Vector<>(1); // This is used in init(). Getting rid of this is desirable but depends // on whether the property that uses it is necessary/standard. @@ -153,7 +153,7 @@ public class Main { // XXX 5/17 this parsing method should be changed/fixed so that // it doesn't do both parsing of the html file and launching of // the AppletPanel - AppletViewer.parse((URL) urlList.elementAt(i), encoding); + AppletViewer.parse(urlList.elementAt(i), encoding); } catch (IOException e) { System.err.println(lookup("main.err.io", e.getMessage())); return 1; @@ -307,10 +307,10 @@ public class Main { // 2) Reflection removes any build dependency between appletviewer // and jdb. try { - Class c = Class.forName("com.sun.tools.example.debug.tty.TTY", true, + Class c = Class.forName("com.sun.tools.example.debug.tty.TTY", true, ClassLoader.getSystemClassLoader()); Method m = c.getDeclaredMethod("main", - new Class[] { String[].class }); + new Class[] { String[].class }); m.invoke(null, new Object[] { newArgs }); } catch (ClassNotFoundException cnfe) { System.err.println(lookup("main.debug.cantfinddebug")); @@ -367,7 +367,7 @@ public class Main { // Read in the System properties. If something is going to be // over-written, warn about it. Properties sysProps = System.getProperties(); - for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements(); ) { + for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); String val = sysProps.getProperty(key); String oldVal; From 09fde7dc5d1f32648d9714500c00d16f0baf2d73 Mon Sep 17 00:00:00 2001 From: Henry Jen Date: Wed, 2 Jul 2014 14:38:36 -0700 Subject: [PATCH 015/166] 8049109: Add @since 1.9 to new packages added in jaxp Reviewed-by: darcy, joehw --- jaxp/src/org/w3c/dom/ranges/DocumentRange.java | 2 +- jaxp/src/org/w3c/dom/ranges/Range.java | 2 +- jaxp/src/org/w3c/dom/ranges/RangeException.java | 2 +- jaxp/src/org/w3c/dom/traversal/DocumentTraversal.java | 2 +- jaxp/src/org/w3c/dom/traversal/NodeFilter.java | 2 +- jaxp/src/org/w3c/dom/traversal/NodeIterator.java | 2 +- jaxp/src/org/w3c/dom/traversal/TreeWalker.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jaxp/src/org/w3c/dom/ranges/DocumentRange.java b/jaxp/src/org/w3c/dom/ranges/DocumentRange.java index 342f9e3ace8..ed51624fc11 100644 --- a/jaxp/src/org/w3c/dom/ranges/DocumentRange.java +++ b/jaxp/src/org/w3c/dom/ranges/DocumentRange.java @@ -43,7 +43,7 @@ package org.w3c.dom.ranges; /** *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public interface DocumentRange { /** diff --git a/jaxp/src/org/w3c/dom/ranges/Range.java b/jaxp/src/org/w3c/dom/ranges/Range.java index d42fad0c0fe..0efefe21945 100644 --- a/jaxp/src/org/w3c/dom/ranges/Range.java +++ b/jaxp/src/org/w3c/dom/ranges/Range.java @@ -47,7 +47,7 @@ import org.w3c.dom.DocumentFragment; /** *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public interface Range { /** diff --git a/jaxp/src/org/w3c/dom/ranges/RangeException.java b/jaxp/src/org/w3c/dom/ranges/RangeException.java index 198a135111c..69551a81c95 100644 --- a/jaxp/src/org/w3c/dom/ranges/RangeException.java +++ b/jaxp/src/org/w3c/dom/ranges/RangeException.java @@ -45,7 +45,7 @@ package org.w3c.dom.ranges; * Range operations may throw a RangeException as specified in * their method descriptions. *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public class RangeException extends RuntimeException { public RangeException(short code, String message) { diff --git a/jaxp/src/org/w3c/dom/traversal/DocumentTraversal.java b/jaxp/src/org/w3c/dom/traversal/DocumentTraversal.java index 80938886afe..bbb53740235 100644 --- a/jaxp/src/org/w3c/dom/traversal/DocumentTraversal.java +++ b/jaxp/src/org/w3c/dom/traversal/DocumentTraversal.java @@ -53,7 +53,7 @@ import org.w3c.dom.DOMException; * Traversal feature, DocumentTraversal will be implemented by * the same objects that implement the Document interface. *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public interface DocumentTraversal { /** diff --git a/jaxp/src/org/w3c/dom/traversal/NodeFilter.java b/jaxp/src/org/w3c/dom/traversal/NodeFilter.java index e6f22b2b917..5cc8177eeac 100644 --- a/jaxp/src/org/w3c/dom/traversal/NodeFilter.java +++ b/jaxp/src/org/w3c/dom/traversal/NodeFilter.java @@ -59,7 +59,7 @@ import org.w3c.dom.Node; * filter may be used with a number of different kinds of traversals, * encouraging code reuse. *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public interface NodeFilter { // Constants returned by acceptNode diff --git a/jaxp/src/org/w3c/dom/traversal/NodeIterator.java b/jaxp/src/org/w3c/dom/traversal/NodeIterator.java index 0f6aebf0821..70ef322254f 100644 --- a/jaxp/src/org/w3c/dom/traversal/NodeIterator.java +++ b/jaxp/src/org/w3c/dom/traversal/NodeIterator.java @@ -55,7 +55,7 @@ import org.w3c.dom.DOMException; * NodeIterators are created by calling * DocumentTraversal.createNodeIterator(). *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public interface NodeIterator { /** diff --git a/jaxp/src/org/w3c/dom/traversal/TreeWalker.java b/jaxp/src/org/w3c/dom/traversal/TreeWalker.java index f0876e5206d..262fd96d167 100644 --- a/jaxp/src/org/w3c/dom/traversal/TreeWalker.java +++ b/jaxp/src/org/w3c/dom/traversal/TreeWalker.java @@ -60,7 +60,7 @@ import org.w3c.dom.DOMException; * nodes will be siblings and appear as direct children of the root node, no * matter how deeply nested the structure of the original document. *

    See also the Document Object Model (DOM) Level 2 Traversal and Range Specification. - * @since DOM Level 2 + * @since 1.9, DOM Level 2 */ public interface TreeWalker { /** From f429e5b86c1bccd0472d42777b5d98b166cc14e3 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Fri, 11 Jul 2014 12:08:43 +0400 Subject: [PATCH 016/166] 8049198: [macosx] Incorrect thread access when showing splash screen Reviewed-by: serb, pchelko --- .../native/sun/awt/splashscreen/splashscreen_sys.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m index affb6577d64..25b00545a74 100644 --- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m +++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m @@ -45,6 +45,7 @@ #include #include +#import "ThreadUtilities.h" static NSScreen* SplashNSScreen() { @@ -130,8 +131,12 @@ char* SplashGetScaledImageName(const char* jar, const char* file, NSAutoreleasePool *pool = [NSAutoreleasePool new]; *scaleFactor = 1; char* scaledFile = nil; - float screenScaleFactor = [SplashNSScreen() backingScaleFactor]; - + __block float screenScaleFactor = 1; + + [ThreadUtilities performOnMainThreadWaiting:YES block:^(){ + screenScaleFactor = [SplashNSScreen() backingScaleFactor]; + }]; + if (screenScaleFactor > 1) { NSString *fileName = [NSString stringWithUTF8String: file]; NSUInteger length = [fileName length]; From a3d9307fb978fa1641c43e24c048689e10cb30a4 Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Fri, 11 Jul 2014 12:51:14 +0400 Subject: [PATCH 017/166] 8037511: Tidy warnings cleanup for java.awt - 2d part Reviewed-by: prr --- jdk/src/share/classes/java/awt/Color.java | 4 ++-- jdk/src/share/classes/java/awt/Font.java | 3 +-- jdk/src/share/classes/java/awt/Graphics.java | 4 ++-- jdk/src/share/classes/java/awt/Polygon.java | 4 ++-- jdk/src/share/classes/java/awt/Rectangle.java | 11 +++++------ .../share/classes/java/awt/color/ColorSpace.java | 10 +++++----- .../classes/java/awt/color/ICC_ColorSpace.java | 10 +++++----- .../share/classes/java/awt/font/TextAttribute.java | 2 +- jdk/src/share/classes/java/awt/geom/Arc2D.java | 6 +++--- .../classes/java/awt/image/AffineTransformOp.java | 2 +- .../classes/java/awt/image/BufferedImageFilter.java | 4 ++-- .../share/classes/java/awt/image/ImageFilter.java | 2 +- .../classes/java/awt/image/WritableRaster.java | 4 ++-- .../share/classes/java/awt/print/PrinterJob.java | 1 - jdk/src/share/classes/javax/imageio/package.html | 4 ++-- jdk/src/share/classes/javax/print/Doc.java | 6 +++--- jdk/src/share/classes/javax/print/DocFlavor.java | 13 ++----------- jdk/src/share/classes/javax/print/PrintService.java | 3 +-- .../classes/javax/print/PrintServiceLookup.java | 4 +--- jdk/src/share/classes/javax/print/ServiceUI.java | 5 ++--- .../share/classes/javax/print/ServiceUIFactory.java | 4 ++-- jdk/src/share/classes/javax/print/SimpleDoc.java | 6 +++--- .../javax/print/StreamPrintServiceFactory.java | 6 +++--- .../classes/javax/print/attribute/Attribute.java | 3 +-- .../javax/print/attribute/DateTimeSyntax.java | 3 +-- .../classes/javax/print/attribute/DocAttribute.java | 3 +-- .../javax/print/attribute/DocAttributeSet.java | 3 +-- .../classes/javax/print/attribute/EnumSyntax.java | 3 +-- .../javax/print/attribute/HashAttributeSet.java | 1 - .../javax/print/attribute/HashDocAttributeSet.java | 3 +-- .../print/attribute/HashPrintJobAttributeSet.java | 3 +-- .../attribute/HashPrintRequestAttributeSet.java | 3 +-- .../attribute/HashPrintServiceAttributeSet.java | 3 +-- .../javax/print/attribute/IntegerSyntax.java | 3 +-- .../javax/print/attribute/PrintJobAttribute.java | 3 +-- .../javax/print/attribute/PrintJobAttributeSet.java | 3 +-- .../print/attribute/PrintRequestAttribute.java | 3 +-- .../print/attribute/PrintRequestAttributeSet.java | 3 +-- .../print/attribute/PrintServiceAttribute.java | 3 +-- .../print/attribute/PrintServiceAttributeSet.java | 3 +-- .../javax/print/attribute/ResolutionSyntax.java | 3 +-- .../javax/print/attribute/SetOfIntegerSyntax.java | 3 +-- .../classes/javax/print/attribute/Size2DSyntax.java | 3 +-- .../print/attribute/SupportedValuesAttribute.java | 3 +-- .../classes/javax/print/attribute/TextSyntax.java | 3 +-- .../classes/javax/print/attribute/URISyntax.java | 3 +-- .../classes/javax/print/attribute/package.html | 4 ++-- .../print/attribute/standard/ColorSupported.java | 3 +-- .../javax/print/attribute/standard/Compression.java | 1 - .../print/attribute/standard/CopiesSupported.java | 3 +-- .../attribute/standard/DateTimeAtCompleted.java | 3 +-- .../attribute/standard/DateTimeAtCreation.java | 3 +-- .../attribute/standard/DateTimeAtProcessing.java | 3 +-- .../javax/print/attribute/standard/Destination.java | 3 +-- .../attribute/standard/DialogTypeSelection.java | 5 ++--- .../print/attribute/standard/DocumentName.java | 3 +-- .../print/attribute/standard/JobHoldUntil.java | 3 +-- .../print/attribute/standard/JobImpressions.java | 3 +-- .../attribute/standard/JobImpressionsCompleted.java | 3 +-- .../attribute/standard/JobImpressionsSupported.java | 3 +-- .../javax/print/attribute/standard/JobKOctets.java | 3 +-- .../attribute/standard/JobKOctetsProcessed.java | 3 +-- .../attribute/standard/JobKOctetsSupported.java | 3 +-- .../print/attribute/standard/JobMediaSheets.java | 3 +-- .../attribute/standard/JobMediaSheetsCompleted.java | 3 +-- .../attribute/standard/JobMediaSheetsSupported.java | 3 +-- .../attribute/standard/JobMessageFromOperator.java | 3 +-- .../javax/print/attribute/standard/JobName.java | 3 +-- .../attribute/standard/JobOriginatingUserName.java | 3 +-- .../javax/print/attribute/standard/JobPriority.java | 3 +-- .../attribute/standard/JobPrioritySupported.java | 3 +-- .../javax/print/attribute/standard/JobSheets.java | 1 - .../javax/print/attribute/standard/JobState.java | 3 +-- .../print/attribute/standard/JobStateReason.java | 1 - .../print/attribute/standard/JobStateReasons.java | 1 - .../javax/print/attribute/standard/Media.java | 3 +-- .../javax/print/attribute/standard/MediaSize.java | 3 +-- .../print/attribute/standard/NumberOfDocuments.java | 3 +-- .../attribute/standard/NumberOfInterveningJobs.java | 3 +-- .../print/attribute/standard/NumberUpSupported.java | 3 +-- .../attribute/standard/OrientationRequested.java | 3 +-- .../attribute/standard/OutputDeviceAssigned.java | 3 +-- .../attribute/standard/PDLOverrideSupported.java | 1 - .../print/attribute/standard/PagesPerMinute.java | 3 +-- .../attribute/standard/PagesPerMinuteColor.java | 3 +-- .../attribute/standard/PresentationDirection.java | 3 +-- .../print/attribute/standard/PrintQuality.java | 1 - .../javax/print/attribute/standard/PrinterInfo.java | 3 +-- .../attribute/standard/PrinterIsAcceptingJobs.java | 3 +-- .../print/attribute/standard/PrinterLocation.java | 3 +-- .../attribute/standard/PrinterMakeAndModel.java | 3 +-- .../standard/PrinterMessageFromOperator.java | 3 +-- .../print/attribute/standard/PrinterMoreInfo.java | 3 +-- .../standard/PrinterMoreInfoManufacturer.java | 3 +-- .../javax/print/attribute/standard/PrinterName.java | 3 +-- .../print/attribute/standard/PrinterResolution.java | 3 +-- .../print/attribute/standard/PrinterState.java | 3 +-- .../attribute/standard/PrinterStateReason.java | 1 - .../attribute/standard/PrinterStateReasons.java | 3 +-- .../javax/print/attribute/standard/PrinterURI.java | 3 +-- .../print/attribute/standard/QueuedJobCount.java | 3 +-- .../standard/ReferenceUriSchemesSupported.java | 3 +-- .../attribute/standard/RequestingUserName.java | 3 +-- .../javax/print/attribute/standard/Severity.java | 3 +-- .../print/attribute/standard/SheetCollate.java | 3 +-- .../javax/print/attribute/standard/package.html | 4 ++-- .../share/classes/javax/print/event/package.html | 4 ++-- jdk/src/share/classes/javax/print/package.html | 4 ++-- 108 files changed, 133 insertions(+), 230 deletions(-) diff --git a/jdk/src/share/classes/java/awt/Color.java b/jdk/src/share/classes/java/awt/Color.java index e80e991aa15..3a94d73ac74 100644 --- a/jdk/src/share/classes/java/awt/Color.java +++ b/jdk/src/share/classes/java/awt/Color.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ import java.awt.color.ColorSpace; * see * http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html * . - *

    + * * @version 10 Feb 1997 * @author Sami Shaio * @author Arthur van Hoff diff --git a/jdk/src/share/classes/java/awt/Font.java b/jdk/src/share/classes/java/awt/Font.java index 41d143522dc..d9faf3d3e80 100644 --- a/jdk/src/share/classes/java/awt/Font.java +++ b/jdk/src/share/classes/java/awt/Font.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -542,7 +542,6 @@ public class Font implements java.io.Serializable * compatible alternative, then the font system will map the Font * instance to "Dialog", such that for example, the family as reported * by {@link #getFamily() getFamily} will be "Dialog". - *

    * * @param name the font name. This can be a font face name or a font * family name, and may represent either a logical font or a physical diff --git a/jdk/src/share/classes/java/awt/Graphics.java b/jdk/src/share/classes/java/awt/Graphics.java index 4f03e1c61dd..3be860cab31 100644 --- a/jdk/src/share/classes/java/awt/Graphics.java +++ b/jdk/src/share/classes/java/awt/Graphics.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,7 +151,7 @@ public abstract class Graphics { * is specified by the width and height * arguments. * - *

    + * * @param x the x coordinate. * @param y the y coordinate. * @param width the width of the clipping rectangle. diff --git a/jdk/src/share/classes/java/awt/Polygon.java b/jdk/src/share/classes/java/awt/Polygon.java index e714428c0d1..0d89e6045be 100644 --- a/jdk/src/share/classes/java/awt/Polygon.java +++ b/jdk/src/share/classes/java/awt/Polygon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -351,7 +351,7 @@ public class Polygon implements Shape, java.io.Serializable { /** * Determines whether the specified coordinates are inside this * Polygon. - *

    + * * @param x the specified X coordinate to be tested * @param y the specified Y coordinate to be tested * @return {@code true} if this {@code Polygon} contains diff --git a/jdk/src/share/classes/java/awt/Rectangle.java b/jdk/src/share/classes/java/awt/Rectangle.java index d64deaf2f0e..727fe8e7ba8 100644 --- a/jdk/src/share/classes/java/awt/Rectangle.java +++ b/jdk/src/share/classes/java/awt/Rectangle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,14 +41,13 @@ import java.beans.Transient; *

    * * A {@code Rectangle} whose width or height is exactly zero has location - * along those axes with zero dimension, but is otherwise considered empty. + * along those axes with zero dimension, but is otherwise considered empty. * The {@link #isEmpty} method will return true for such a {@code Rectangle}. * Methods which test if an empty {@code Rectangle} contains or intersects * a point or rectangle will always return false if either dimension is zero. * Methods which combine such a {@code Rectangle} with a point or rectangle * will include the location of the {@code Rectangle} on that axis in the * result as if the {@link #add(Point)} method were being called. - * *

    * * A {@code Rectangle} whose width or height is negative has neither @@ -422,7 +421,7 @@ public class Rectangle extends Rectangle2D * Rectangle to the specified * x, y, width, * and height. - *

    + * * @param x the new X coordinate for the upper-left * corner of this Rectangle * @param y the new Y coordinate for the upper-left @@ -488,7 +487,7 @@ public class Rectangle extends Rectangle2D /** * Moves this Rectangle to the specified location. - *

    + * * @param x the X coordinate of the new location * @param y the Y coordinate of the new location * @deprecated As of JDK version 1.1, @@ -629,7 +628,7 @@ public class Rectangle extends Rectangle2D /** * Sets the size of this Rectangle to the specified * width and height. - *

    + * * @param width the new width for this Rectangle * @param height the new height for this Rectangle * @deprecated As of JDK version 1.1, diff --git a/jdk/src/share/classes/java/awt/color/ColorSpace.java b/jdk/src/share/classes/java/awt/color/ColorSpace.java index ac21273d415..08feedd844e 100644 --- a/jdk/src/share/classes/java/awt/color/ColorSpace.java +++ b/jdk/src/share/classes/java/awt/color/ColorSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -388,7 +388,7 @@ public abstract class ColorSpace implements java.io.Serializable { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

    + * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace * @return a float array of length 3 @@ -412,7 +412,7 @@ public abstract class ColorSpace implements java.io.Serializable { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

    + * * @param rgbvalue a float array with length of at least 3 * @return a float array with length equal to the number of * components in this ColorSpace @@ -439,7 +439,7 @@ public abstract class ColorSpace implements java.io.Serializable { * that would be measured using current CIE recommended practices. * See the {@link ICC_ColorSpace#toCIEXYZ(float[]) toCIEXYZ} method of * ICC_ColorSpace for further information. - *

    + * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace * @return a float array of length 3 @@ -467,7 +467,7 @@ public abstract class ColorSpace implements java.io.Serializable { * relative values before being passed to this method. * See the {@link ICC_ColorSpace#fromCIEXYZ(float[]) fromCIEXYZ} method of * ICC_ColorSpace for further information. - *

    + * * @param colorvalue a float array with length of at least 3 * @return a float array with length equal to the number of * components in this ColorSpace diff --git a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java index ee2ed1a43a5..c64177658f1 100644 --- a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java +++ b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -149,7 +149,7 @@ public class ICC_ColorSpace extends ColorSpace { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

    + * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace. * @return a float array of length 3. @@ -201,7 +201,7 @@ public class ICC_ColorSpace extends ColorSpace { * convert from CS_CIEXYZ to the output color space. * See {@link #toCIEXYZ(float[]) toCIEXYZ} and * {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information. - *

    + * * @param rgbvalue a float array with length of at least 3. * @return a float array with length equal to the number of * components in this ColorSpace. @@ -336,7 +336,7 @@ public class ICC_ColorSpace extends ColorSpace { * will result in a measured device XYZ value of D65. This will not * be the same as the media white point tag XYZ value in the ICC * profile for an sRGB device. - *

    + * * @param colorvalue a float array with length of at least the number * of components in this ColorSpace. * @return a float array of length 3. @@ -480,7 +480,7 @@ public class ICC_ColorSpace extends ColorSpace { * will result in a measured device XYZ value of D65. This will not * be the same as the media white point tag XYZ value in the ICC * profile for an sRGB device. - *

    + * * @param colorvalue a float array with length of at least 3. * @return a float array with length equal to the number of * components in this ColorSpace. diff --git a/jdk/src/share/classes/java/awt/font/TextAttribute.java b/jdk/src/share/classes/java/awt/font/TextAttribute.java index 3a7714ba1dd..280e1934693 100644 --- a/jdk/src/share/classes/java/awt/font/TextAttribute.java +++ b/jdk/src/share/classes/java/awt/font/TextAttribute.java @@ -96,7 +96,7 @@ import sun.misc.SharedSecrets; * * *

    Summary of attributes

    - * * diff --git a/jdk/src/share/classes/java/awt/geom/Arc2D.java b/jdk/src/share/classes/java/awt/geom/Arc2D.java index 3d92306f618..be51e8a4bc3 100644 --- a/jdk/src/share/classes/java/awt/geom/Arc2D.java +++ b/jdk/src/share/classes/java/awt/geom/Arc2D.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ import java.io.Serializable; *

    * * The arc is a partial section of a full ellipse which - * inscribes the framing rectangle of its parent {@link RectangularShape}. - * + * inscribes the framing rectangle of its parent {@link RectangularShape}. + * * * The angles are specified relative to the non-square * framing rectangle such that 45 degrees always falls on the line from diff --git a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java index 9e6a66eea5c..d9216606b73 100644 --- a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java +++ b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java @@ -324,7 +324,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp { * this part of the rectangle is not drawn. If the coordinates * of the rectangle are positive then the filtered image is drawn at * that position in the destination Raster. - *

    + * * @param src The Raster to transform. * @param dst The Raster in which to store the results of the * transformation. diff --git a/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java b/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java index bac63a8f066..e848fd9c206 100644 --- a/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,7 +85,7 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable { * an image should avoid calling this method directly since that * operation could result in problems with retrieving the requested * pixels. - *

    + * * @param width the width to which to set the width of this * BufferedImageFilter * @param height the height to which to set the height of this diff --git a/jdk/src/share/classes/java/awt/image/ImageFilter.java b/jdk/src/share/classes/java/awt/image/ImageFilter.java index 33198346e03..04077b6d6a5 100644 --- a/jdk/src/share/classes/java/awt/image/ImageFilter.java +++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java @@ -225,7 +225,7 @@ public class ImageFilter implements ImageConsumer, Cloneable { * *

  • * Override the method to simply send the data. - * This is appropriate if the filter can handle the request itself — + * This is appropriate if the filter can handle the request itself — * for example, * if the generated pixels have been saved in some sort of buffer. * diff --git a/jdk/src/share/classes/java/awt/image/WritableRaster.java b/jdk/src/share/classes/java/awt/image/WritableRaster.java index 6ad950288ee..65ff74aa4f9 100644 --- a/jdk/src/share/classes/java/awt/image/WritableRaster.java +++ b/jdk/src/share/classes/java/awt/image/WritableRaster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -394,7 +394,7 @@ public class WritableRaster extends Raster { * is first converted to a 32-bit int (if necessary), using the above * rules for integral types, and then the int is cast to float or * double. - *

    + * * @param srcRaster The Raster from which to copy pixels. * * @throws NullPointerException if srcRaster is null. diff --git a/jdk/src/share/classes/java/awt/print/PrinterJob.java b/jdk/src/share/classes/java/awt/print/PrinterJob.java index 0c80d1490d4..41d39ce10ec 100644 --- a/jdk/src/share/classes/java/awt/print/PrinterJob.java +++ b/jdk/src/share/classes/java/awt/print/PrinterJob.java @@ -546,7 +546,6 @@ public abstract class PrinterJob { * user settings returned from * printDialog(PrintRequestAttributeSet attributes to * this print() method. - *

    * * @param attributes a set of attributes for the job * @exception PrinterException an error in the print system diff --git a/jdk/src/share/classes/javax/imageio/package.html b/jdk/src/share/classes/javax/imageio/package.html index f0927fa147b..f8254b11284 100644 --- a/jdk/src/share/classes/javax/imageio/package.html +++ b/jdk/src/share/classes/javax/imageio/package.html @@ -131,8 +131,8 @@ standard plug-ins.

  • the number of bands is 1;
  • the number of bits per sample is not greater than 8;
  • the size of a color component is not greater than 8; -

    - + +

    By default the GIF writer plug-in creates version "89a" images. This can be changed to "87a" by explicitly setting the version in the diff --git a/jdk/src/share/classes/javax/print/Doc.java b/jdk/src/share/classes/javax/print/Doc.java index d28a3e565ef..873aac594a6 100644 --- a/jdk/src/share/classes/javax/print/Doc.java +++ b/jdk/src/share/classes/javax/print/Doc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -168,7 +168,7 @@ public interface Doc { * from the print data representation object. * However, if the print data representation object is itself a Reader, * then the print data representation object is simply returned. - *

    + * * @return Reader for reading the print data characters from this doc. * If a reader cannot be provided because this doc does not meet * the criteria stated above, null is returned. @@ -192,7 +192,7 @@ public interface Doc { * object as a stream of bytes is created and returned. However, if the * print data representation object is itself an input stream, then the * print data representation object is simply returned. - *

    + * * @return Input stream for reading the print data bytes from this doc. If * an input stream cannot be provided because this doc does not * meet the criteria stated above, null is returned. diff --git a/jdk/src/share/classes/javax/print/DocFlavor.java b/jdk/src/share/classes/javax/print/DocFlavor.java index eac9d38954d..cb00e00753b 100644 --- a/jdk/src/share/classes/javax/print/DocFlavor.java +++ b/jdk/src/share/classes/javax/print/DocFlavor.java @@ -381,7 +381,6 @@ import java.io.Serializable; *

  • * A line feed (LF) character standing by itself means * "go to column 1 of the next line." - *
  • * *

    * The client must itself perform all plain text print data formatting not @@ -436,7 +435,6 @@ import java.io.Serializable; * Java Print Service instance supports without having * to load the representation classes, which may be problematic for * limited-resource clients. - *

    * * @author Alan Kaminsky */ @@ -536,7 +534,7 @@ public class DocFlavor implements Serializable, Cloneable { * The charset for text types is a commonly useful example. * This convenience method will return the value of the specified * parameter if one was specified in the mime type for this flavor. - *

    + * * @param paramName the name of the paramater. This name is internally * converted to the canonical lower case format before performing * the match. @@ -638,7 +636,6 @@ public class DocFlavor implements Serializable, Cloneable { * Class DocFlavor.BYTE_ARRAY provides predefined static constant * DocFlavor objects for example doc flavors using a byte array * (byte[]) as the print data representation class. - *

    * * @author Alan Kaminsky */ @@ -836,7 +833,6 @@ public class DocFlavor implements Serializable, Cloneable { * DocFlavor objects for example doc flavors using a byte stream ({@link * java.io.InputStream java.io.InputStream}) as the print * data representation class. - *

    * * @author Alan Kaminsky */ @@ -1038,8 +1034,7 @@ public class DocFlavor implements Serializable, Cloneable { * objects. * For example doc flavors using a Uniform Resource Locator ({@link * java.net.URL java.net.URL}) as the print data - * representation class. - *

    + * representation class. * * @author Alan Kaminsky */ @@ -1229,7 +1224,6 @@ public class DocFlavor implements Serializable, Cloneable { * DocFlavor objects for example doc flavors using a character array * (char[]) as the print data representation class. As such, * the character set is Unicode. - *

    * * @author Alan Kaminsky */ @@ -1279,7 +1273,6 @@ public class DocFlavor implements Serializable, Cloneable { * objects for example doc flavors using a string ({@link java.lang.String * java.lang.String}) as the print data representation class. * As such, the character set is Unicode. - *

    * * @author Alan Kaminsky */ @@ -1327,7 +1320,6 @@ public class DocFlavor implements Serializable, Cloneable { * objects for example doc flavors using a character stream ({@link * java.io.Reader java.io.Reader}) as the print data * representation class. As such, the character set is Unicode. - *

    * * @author Alan Kaminsky */ @@ -1376,7 +1368,6 @@ public class DocFlavor implements Serializable, Cloneable { * Class DocFlavor.SERVICE_FORMATTED provides predefined static constant * DocFlavor objects for example doc flavors for service formatted print * data. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/PrintService.java b/jdk/src/share/classes/javax/print/PrintService.java index f52eb72a0d2..a003e730880 100644 --- a/jdk/src/share/classes/javax/print/PrintService.java +++ b/jdk/src/share/classes/javax/print/PrintService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -327,7 +327,6 @@ public interface PrintService { * that indicates bounds on the legal values -- used, for example, by an * integer-valued attribute that must lie within a certain range. * - *

    * * @param category Printing attribute category to test. It must be a * {@link java.lang.Class Class} that implements diff --git a/jdk/src/share/classes/javax/print/PrintServiceLookup.java b/jdk/src/share/classes/javax/print/PrintServiceLookup.java index aece5d1205a..70695a995f8 100644 --- a/jdk/src/share/classes/javax/print/PrintServiceLookup.java +++ b/jdk/src/share/classes/javax/print/PrintServiceLookup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -199,7 +199,6 @@ public abstract class PrintServiceLookup { * available that is not part of the installation. * If the lookup service is already registered, or cannot be registered, * the method returns false. - *

    * * @param sp an implementation of a lookup service. * @return true if the new lookup service is newly @@ -305,7 +304,6 @@ public abstract class PrintServiceLookup { *

    * Locates MultiDoc print services which can be positively confirmed * to support the combination of attributes and DocFlavors specified. - *

    * * @param flavors of documents required. If null or empty it is ignored. * @param attributes required to be supported. If null this diff --git a/jdk/src/share/classes/javax/print/ServiceUI.java b/jdk/src/share/classes/javax/print/ServiceUI.java index 20b23611ed1..c6ba370a064 100644 --- a/jdk/src/share/classes/javax/print/ServiceUI.java +++ b/jdk/src/share/classes/javax/print/ServiceUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,8 +131,7 @@ public class ServiceUI { * } * } * } - *

    - + * * @param gc used to select screen. null means primary or default screen. * @param x location of dialog including border in screen coordinates * @param y location of dialog including border in screen coordinates diff --git a/jdk/src/share/classes/javax/print/ServiceUIFactory.java b/jdk/src/share/classes/javax/print/ServiceUIFactory.java index d293a8cadc7..06deb02e5e8 100644 --- a/jdk/src/share/classes/javax/print/ServiceUIFactory.java +++ b/jdk/src/share/classes/javax/print/ServiceUIFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ public abstract class ServiceUIFactory { /** * Get a UI object which may be cast to the requested UI type * by the application and used in its user interface. - *

    + * * @param role requested. Must be one of the standard roles or * a private role supported by this factory. * @param ui type in which the role is requested. diff --git a/jdk/src/share/classes/javax/print/SimpleDoc.java b/jdk/src/share/classes/javax/print/SimpleDoc.java index 3cf0d779086..f73d794f76b 100644 --- a/jdk/src/share/classes/javax/print/SimpleDoc.java +++ b/jdk/src/share/classes/javax/print/SimpleDoc.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -176,7 +176,7 @@ public final class SimpleDoc implements Doc { * However, if the print data representation object is itself a * Reader then the print data representation object is * simply returned. - *

    + * * @return a Reader for reading the print data * characters from this doc. * If a reader cannot be provided because this doc does not meet @@ -224,7 +224,7 @@ public final class SimpleDoc implements Doc { * However, if the print data representation object is itself an * input stream then the print data representation object is simply * returned. - *

    + * * @return an InputStream for reading the print data * bytes from this doc. If an input stream cannot be * provided because this doc does not meet diff --git a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java index dfa91a70fcb..f1f7f28c410 100644 --- a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java +++ b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ public abstract class StreamPrintServiceFactory { * Although null is an acceptable value to use in the lookup of stream * printing services, it's typical to search for a particular * desired format, such as Postscript(TM). - *

    + * * @param flavor of the input document type - null means match all * types. * @param outputMimeType representing the required output format, used to @@ -153,7 +153,7 @@ public abstract class StreamPrintServiceFactory { * Implementations which allocate resources on construction should examine * the stream and may wish to only allocate resources if the stream is * non-null. - *

    + * * @param out destination stream for generated output. * @return a PrintService which will generate the format specified by the * DocFlavor supported by this Factory. diff --git a/jdk/src/share/classes/javax/print/attribute/Attribute.java b/jdk/src/share/classes/javax/print/attribute/Attribute.java index 5226f9cb80d..a6c58e6f933 100644 --- a/jdk/src/share/classes/javax/print/attribute/Attribute.java +++ b/jdk/src/share/classes/javax/print/attribute/Attribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ import java.io.Serializable; * Interface Attribute is the base interface implemented by any and every * printing attribute class to indicate that the class represents a * printing attribute. All printing attributes are serializable. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java index d78c8f2004a..72e583a0347 100644 --- a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,6 @@ import java.util.Date; * rather than a java.util.Calendar because it typically takes * less memory to store and less time to compare a java.util.Date * than a java.util.Calendar. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/DocAttribute.java b/jdk/src/share/classes/javax/print/attribute/DocAttribute.java index e99c09d6bcb..994208f0a9e 100644 --- a/jdk/src/share/classes/javax/print/attribute/DocAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/DocAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ package javax.print.attribute; * PrintRequestAttribute} as well as DocAttribute, the client may include the * attribute in a attribute set which specifies a print job * to specify a characteristic for all the docs in that job. - *

    * * @see DocAttributeSet * @see PrintRequestAttributeSet diff --git a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java index b4482d2e455..bacc1074f2c 100644 --- a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java index 85ee7d8b402..f774066e592 100644 --- a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -102,7 +102,6 @@ import java.io.Serializable; * uses some of the same integer values as the superclass. However, the * application in which the enumeration class and subclass are used may need to * have distinct integer values in the superclass and subclass. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java index 7956794d304..e4928a8196d 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java @@ -34,7 +34,6 @@ import java.util.HashMap; /** * Class HashAttributeSet provides an AttributeSet * implementation with characteristics of a hash map. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java index d4bc20e27d3..0b915ba2ca9 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.io.Serializable; * inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface {@link * DocAttributeSet DocAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java index 980693694e6..f39c85883d5 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.io.Serializable; * which inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface * {@link PrintJobAttributeSet PrintJobAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java index 53708f0259c..fde4ebb6945 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.io.Serializable; * class {@link HashAttributeSet HashAttributeSet} and enforces the * semantic restrictions of interface * {@link PrintRequestAttributeSet PrintRequestAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java index 64e5b9e48f3..d98430d0d75 100644 --- a/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ import java.io.Serializable; * which inherits its implementation from class {@link HashAttributeSet * HashAttributeSet} and enforces the semantic restrictions of interface * {@link PrintServiceAttributeSet PrintServiceAttributeSet}. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java index 7675a8327e7..1fbd3b2556d 100644 --- a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,6 @@ import java.io.Serializable; * established when it is constructed (see {@link #IntegerSyntax(int) * IntegerSyntax(int)}). Once constructed, an integer attribute's * value is immutable. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java b/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java index af8258090ba..ad9a0d7217a 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,6 @@ package javax.print.attribute; * PrintRequestAttribute PrintRequestAttribute} as well as PrintJobAttribute, * the client may include the attribute in a attribute set to * specify the attribute's value for the Print Job. - *

    * * @see PrintRequestAttributeSet * @see PrintJobAttributeSet diff --git a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java index 5bce73513e9..4c920a1b48a 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java index 78fe37ccb76..48249480e60 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,6 @@ package javax.print.attribute; * as well as PrintRequestAttribute, the client may include the * attribute in a Doc}'s attribute set to specify * a job setting which pertains just to that doc. - *

    * * @see DocAttributeSet * @see PrintRequestAttributeSet diff --git a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java index eac683b194c..bde6c0cce8b 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java index 8ac2b656d18..f09b38870ed 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ package javax.print.attribute; * of a Print Service or some other characteristic of a Print Service. A Print * Service instance adds a number of PrintServiceAttributes to a Print * service's attribute set to report the Print Service's status. - *

    * * @see PrintServiceAttributeSet * diff --git a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java index badde734218..3d3296ed405 100644 --- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java +++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ package javax.print.attribute; * The {@link #add(Attribute) add(Attribute)}, and * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations * are respecified below to guarantee this additional invariant. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java index 1089381d1c6..7e9c40835b5 100644 --- a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,7 +78,6 @@ import java.io.Serializable; * mind, there is no guarantee that the conversion factor for the client's units * will be an exact integer. If the conversion factor isn't an exact integer, * resolution values in the client's units won't be stored precisely. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java index 0aed773fe6e..8ba9303135a 100644 --- a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,6 @@ import java.util.Vector; * Class SetOfIntegerSyntax has operations to return the set's members in * canonical array form, to test whether a given integer is a member of the * set, and to iterate through the members of the set. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java index 0f6a5dfe6c4..76832508c94 100644 --- a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,7 +77,6 @@ import java.io.Serializable; * client's units will be an exact integer. If the conversion factor isn't an * exact integer, resolution values in the client's units won't be stored * precisely. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java b/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java index 61e4bd57e62..ca8736b1315 100644 --- a/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java +++ b/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ package javax.print.attribute; * which is a SupportedValuesAttribute giving the legal values a client may * specify for the {@link javax.print.attribute.standard.Copies Copies} * attribute. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/TextSyntax.java b/jdk/src/share/classes/javax/print/attribute/TextSyntax.java index 20e27fa314f..7b91de24d0f 100644 --- a/jdk/src/share/classes/javax/print/attribute/TextSyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/TextSyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,6 @@ import java.util.Locale; * includes a locale to indicate the natural language. Thus, a text attribute * always represents a localized string. Once constructed, a text attribute's * value is immutable. - *

    * * @author David Mendenhall * @author Alan Kaminsky diff --git a/jdk/src/share/classes/javax/print/attribute/URISyntax.java b/jdk/src/share/classes/javax/print/attribute/URISyntax.java index 118b1c0cd8d..770ba8a9592 100644 --- a/jdk/src/share/classes/javax/print/attribute/URISyntax.java +++ b/jdk/src/share/classes/javax/print/attribute/URISyntax.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import java.net.URI; * Class URISyntax is an abstract base class providing the common * implementation of all attributes whose value is a Uniform Resource * Identifier (URI). Once constructed, a URI attribute's value is immutable. - *

    * * @author Alan Kaminsky */ diff --git a/jdk/src/share/classes/javax/print/attribute/package.html b/jdk/src/share/classes/javax/print/attribute/package.html index fa9851655a8..aeedb0df2c2 100644 --- a/jdk/src/share/classes/javax/print/attribute/package.html +++ b/jdk/src/share/classes/javax/print/attribute/package.html @@ -3,7 +3,7 @@ javax.print.attribute package - + diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties index 77f8ed73bf7..642793a8e66 100644 --- a/nashorn/make/project.properties +++ b/nashorn/make/project.properties @@ -309,7 +309,7 @@ run.test.jvmargs.main=${run.test.jvmargs.common} -ea run.test.jvmargs.octane.main=${run.test.jvmargs.common} -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode -XX:TypeProfileLevel=222 # Security manager args - make sure that we run with the nashorn.policy that the build creates -run.test.jvmsecurityargs=-Xverify:all -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy +run.test.jvmsecurityargs=-Xverify:all -Djava.security.manager -Djava.security.policy=${build.dir}/nashorn.policy # VM options for script tests with @fork option test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -cp ${run.test.classpath} diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java index b48ed8b5c19..bb16cf48caa 100644 --- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java +++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestHelper.java @@ -39,7 +39,8 @@ import java.io.Reader; public abstract class TestHelper { public static final String TEST_ROOT = "test"; - public static final String BUILD_ROOT = "build/test"; + public static final String BUILD_ROOT = + System.getProperty("build.dir", "build") + File.separator + "test"; public static final String TEST_PREFIX = TEST_ROOT + File.separator; private TestHelper() { From d62403b09ada16674d982acaab5b37c2d54828a1 Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Fri, 18 Jul 2014 13:43:28 +0100 Subject: [PATCH 048/166] 8051350: Update javadoc for com.sun.jndi.toolkit.corba.CorbaUtils Reviewed-by: alanb --- jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java b/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java index d1ea853a9b4..8009b67aa2c 100644 --- a/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java +++ b/jdk/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java @@ -55,7 +55,6 @@ public class CorbaUtils { * Returns the CORBA object reference associated with a Remote * object by using the javax.rmi.CORBA package. *

    - * Use reflection to avoid hard dependencies on javax.rmi.CORBA package. * This method effective does the following: *

           * java.lang.Object stub;
    
    From 80448466d47c750c86a284c111064ca791be987a Mon Sep 17 00:00:00 2001
    From: Ivan Gerasimov 
    Date: Fri, 18 Jul 2014 17:04:10 +0400
    Subject: [PATCH 049/166] 8050893: (smartcardio) Invert reset argument in tests
     in sun/security/smartcardio
    
    Reviewed-by: valeriep
    ---
     jdk/test/sun/security/smartcardio/TestAll.java   |  4 ++--
     .../sun/security/smartcardio/TestChannel.java    | 10 +++++-----
     .../sun/security/smartcardio/TestConnect.java    | 14 +++++++-------
     .../security/smartcardio/TestConnectAgain.java   | 10 +++++-----
     .../sun/security/smartcardio/TestControl.java    |  9 ++++-----
     .../sun/security/smartcardio/TestDefault.java    |  7 +++----
     .../sun/security/smartcardio/TestExclusive.java  | 13 +++++++------
     .../smartcardio/TestMultiplePresent.java         |  8 ++++----
     .../sun/security/smartcardio/TestPresent.java    |  7 +++----
     .../sun/security/smartcardio/TestTransmit.java   | 16 +++++++++++-----
     jdk/test/sun/security/smartcardio/Utils.java     | 14 ++++++++++----
     11 files changed, 61 insertions(+), 51 deletions(-)
    
    diff --git a/jdk/test/sun/security/smartcardio/TestAll.java b/jdk/test/sun/security/smartcardio/TestAll.java
    index e83706f664c..1bd1d76ffd0 100644
    --- a/jdk/test/sun/security/smartcardio/TestAll.java
    +++ b/jdk/test/sun/security/smartcardio/TestAll.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -26,7 +26,7 @@
     // Because all the tests are marked @ignore as they require special hardware,
     // we cannot use jtreg to do this.
     
    -import java.lang.reflect.*;
    +import java.lang.reflect.Method;
     
     public class TestAll {
     
    diff --git a/jdk/test/sun/security/smartcardio/TestChannel.java b/jdk/test/sun/security/smartcardio/TestChannel.java
    index 75eb211ad84..e14cf833da2 100644
    --- a/jdk/test/sun/security/smartcardio/TestChannel.java
    +++ b/jdk/test/sun/security/smartcardio/TestChannel.java
    @@ -31,10 +31,10 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import javax.smartcardio.Card;
    +import javax.smartcardio.CardChannel;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.CommandAPDU;
     
     public class TestChannel extends Utils {
     
    @@ -95,7 +95,7 @@ public class TestChannel extends Utils {
             }
     
             // disconnect
    -        card.disconnect(false);
    +        card.disconnect(true);
     
             System.out.println("OK.");
         }
    diff --git a/jdk/test/sun/security/smartcardio/TestConnect.java b/jdk/test/sun/security/smartcardio/TestConnect.java
    index b2dcc920c55..e0789343761 100644
    --- a/jdk/test/sun/security/smartcardio/TestConnect.java
    +++ b/jdk/test/sun/security/smartcardio/TestConnect.java
    @@ -31,10 +31,11 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import java.util.List;
    +import javax.smartcardio.TerminalFactory;
    +import javax.smartcardio.Card;
    +import javax.smartcardio.CardChannel;
    +import javax.smartcardio.CardTerminal;
     
     public class TestConnect extends Utils {
     
    @@ -63,7 +64,7 @@ public class TestConnect extends Utils {
                 throw new Exception("Not T=0 protocol");
             }
             transmit(card);
    -        card.disconnect(false);
    +        card.disconnect(true);
     
             try {
                 transmit(card);
    @@ -96,7 +97,7 @@ public class TestConnect extends Utils {
                 throw new Exception("Not T=0 protocol");
             }
             transmit(card);
    -        card.disconnect(true);
    +        card.disconnect(false);
     
             card = terminal.connect("*");
             System.out.println("card: " + card);
    @@ -105,7 +106,6 @@ public class TestConnect extends Utils {
             }
             transmit(card);
             card.disconnect(true);
    -        card.disconnect(true);
     
             System.out.println("OK.");
         }
    diff --git a/jdk/test/sun/security/smartcardio/TestConnectAgain.java b/jdk/test/sun/security/smartcardio/TestConnectAgain.java
    index 8f44a9783ae..e938a561dac 100644
    --- a/jdk/test/sun/security/smartcardio/TestConnectAgain.java
    +++ b/jdk/test/sun/security/smartcardio/TestConnectAgain.java
    @@ -31,10 +31,10 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import javax.smartcardio.Card;
    +import javax.smartcardio.CardException;
    +import javax.smartcardio.CardChannel;
    +import javax.smartcardio.CardTerminal;
     
     public class TestConnectAgain extends Utils {
     
    @@ -95,7 +95,7 @@ public class TestConnectAgain extends Utils {
             }
     
             // disconnect
    -        card.disconnect(false);
    +        card.disconnect(true);
     
             System.out.println("OK.");
         }
    diff --git a/jdk/test/sun/security/smartcardio/TestControl.java b/jdk/test/sun/security/smartcardio/TestControl.java
    index 05521bd6172..5a690640311 100644
    --- a/jdk/test/sun/security/smartcardio/TestControl.java
    +++ b/jdk/test/sun/security/smartcardio/TestControl.java
    @@ -31,10 +31,9 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import javax.smartcardio.Card;
    +import javax.smartcardio.CardException;
    +import javax.smartcardio.CardTerminal;
     
     public class TestControl extends Utils {
     
    @@ -68,7 +67,7 @@ public class TestControl extends Utils {
             }
     
             // disconnect
    -        card.disconnect(false);
    +        card.disconnect(true);
     
             System.out.println("OK.");
         }
    diff --git a/jdk/test/sun/security/smartcardio/TestDefault.java b/jdk/test/sun/security/smartcardio/TestDefault.java
    index 74994765696..247537265e3 100644
    --- a/jdk/test/sun/security/smartcardio/TestDefault.java
    +++ b/jdk/test/sun/security/smartcardio/TestDefault.java
    @@ -31,10 +31,9 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import java.util.List;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.TerminalFactory;
     
     public class TestDefault {
     
    diff --git a/jdk/test/sun/security/smartcardio/TestExclusive.java b/jdk/test/sun/security/smartcardio/TestExclusive.java
    index a43e03ecf5b..f41e2cf3e66 100644
    --- a/jdk/test/sun/security/smartcardio/TestExclusive.java
    +++ b/jdk/test/sun/security/smartcardio/TestExclusive.java
    @@ -31,10 +31,11 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import javax.smartcardio.Card;
    +import javax.smartcardio.CardChannel;
    +import javax.smartcardio.CardException;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.CommandAPDU;
     
     public class TestExclusive extends Utils {
     
    @@ -84,9 +85,9 @@ public class TestExclusive extends Utils {
             Thread.sleep(1000);
     
             // disconnect
    -        card.disconnect(false);
    +        card.disconnect(true);
     
    -        if (otherOK == false) {
    +        if (! otherOK) {
                 throw new Exception("Secondary thread failed");
             }
     
    diff --git a/jdk/test/sun/security/smartcardio/TestMultiplePresent.java b/jdk/test/sun/security/smartcardio/TestMultiplePresent.java
    index fe779710762..6be66c926dd 100644
    --- a/jdk/test/sun/security/smartcardio/TestMultiplePresent.java
    +++ b/jdk/test/sun/security/smartcardio/TestMultiplePresent.java
    @@ -31,10 +31,10 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import java.util.List;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.CardTerminals;
    +import javax.smartcardio.TerminalFactory;
     import static javax.smartcardio.CardTerminals.State.*;
     
     public class TestMultiplePresent {
    diff --git a/jdk/test/sun/security/smartcardio/TestPresent.java b/jdk/test/sun/security/smartcardio/TestPresent.java
    index 6aa3c49ee1c..2728f903ca4 100644
    --- a/jdk/test/sun/security/smartcardio/TestPresent.java
    +++ b/jdk/test/sun/security/smartcardio/TestPresent.java
    @@ -31,10 +31,9 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import java.util.List;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.TerminalFactory;
     
     public class TestPresent {
     
    diff --git a/jdk/test/sun/security/smartcardio/TestTransmit.java b/jdk/test/sun/security/smartcardio/TestTransmit.java
    index 5d69931095f..2c484417317 100644
    --- a/jdk/test/sun/security/smartcardio/TestTransmit.java
    +++ b/jdk/test/sun/security/smartcardio/TestTransmit.java
    @@ -31,10 +31,16 @@
     
     // This test requires special hardware.
     
    -import java.io.*;
    -import java.util.*;
    -
    -import javax.smartcardio.*;
    +import java.io.BufferedReader;
    +import java.io.ByteArrayOutputStream;
    +import java.io.FileReader;
    +import java.io.IOException;
    +import java.io.StringReader;
    +import javax.smartcardio.Card;
    +import javax.smartcardio.CardChannel;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.CommandAPDU;
    +import javax.smartcardio.ResponseAPDU;
     
     public class TestTransmit extends Utils {
     
    @@ -79,7 +85,7 @@ public class TestTransmit extends Utils {
             }
     
             // disconnect
    -        card.disconnect(false);
    +        card.disconnect(true);
     
             System.out.println("OK.");
         }
    diff --git a/jdk/test/sun/security/smartcardio/Utils.java b/jdk/test/sun/security/smartcardio/Utils.java
    index e67bdcf0648..b4edbcc292b 100644
    --- a/jdk/test/sun/security/smartcardio/Utils.java
    +++ b/jdk/test/sun/security/smartcardio/Utils.java
    @@ -24,10 +24,16 @@
     
     // common utility functions for the PC/SC tests
     
    -import javax.smartcardio.*;
    -
    -import java.io.*;
    -import java.util.*;
    +import java.io.StringReader;
    +import java.io.ByteArrayOutputStream;
    +import java.io.IOException;
    +import java.util.Arrays;
    +import java.util.List;
    +import javax.smartcardio.CardTerminal;
    +import javax.smartcardio.CardChannel;
    +import javax.smartcardio.ResponseAPDU;
    +import javax.smartcardio.CommandAPDU;
    +import javax.smartcardio.TerminalFactory;
     
     public class Utils {
     
    
    From 712d8ff48ecb2363ee72ac712e89fcdaf701c9d9 Mon Sep 17 00:00:00 2001
    From: Jaroslav Bachorik 
    Date: Fri, 18 Jul 2014 17:23:28 +0200
    Subject: [PATCH 050/166] 8035829: [parfait] JNI exception pending in
     jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
    
    Reviewed-by: sundar, kevinw
    ---
     .../windows/native/sun/tools/attach/WindowsVirtualMachine.c  | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
    index 94fb2f72ceb..411d1777a54 100644
    --- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
    +++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
    @@ -388,6 +388,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue
         if (argsLen > 0) {
             if (argsLen > MAX_ARGS) {
                 JNU_ThrowInternalError(env, "Too many arguments");
    +            return;
             }
             for (i=0; iGetObjectArrayElement(env, args, i);
    @@ -423,6 +424,8 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue
         stubLen = (DWORD)(*env)->GetArrayLength(env, stub);
         stubCode = (*env)->GetByteArrayElements(env, stub, &isCopy);
     
    +    if ((*env)->ExceptionOccurred(env)) return;
    +
         pCode = (PDWORD) VirtualAllocEx( hProcess, 0, stubLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
         if (pCode == NULL) {
             JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
    @@ -592,6 +595,8 @@ static void jstring_to_cstring(JNIEnv* env, jstring jstr, char* cstr, int len) {
             cstr[0] = '\0';
         } else {
             str = JNU_GetStringPlatformChars(env, jstr, &isCopy);
    +        if ((*env)->ExceptionOccurred(env)) return;
    +
             strncpy(cstr, str, len);
             cstr[len-1] = '\0';
             if (isCopy) {
    
    From 1980bab985f5a0807a877d100181c9b192988953 Mon Sep 17 00:00:00 2001
    From: Mike Duigou 
    Date: Fri, 18 Jul 2014 08:54:28 -0700
    Subject: [PATCH 051/166] 8051057: Optimize StringCharBuffer.toString(int, int)
    
    Reviewed-by: smarks, alanb
    ---
     jdk/src/share/classes/java/nio/StringCharBuffer.java | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/jdk/src/share/classes/java/nio/StringCharBuffer.java b/jdk/src/share/classes/java/nio/StringCharBuffer.java
    index 0c20fa669c5..4a5f0517691 100644
    --- a/jdk/src/share/classes/java/nio/StringCharBuffer.java
    +++ b/jdk/src/share/classes/java/nio/StringCharBuffer.java
    @@ -100,7 +100,7 @@ class StringCharBuffer                                  // package-private
         }
     
         final String toString(int start, int end) {
    -        return str.toString().substring(start + offset, end + offset);
    +        return str.subSequence(start + offset, end + offset).toString();
         }
     
         public final CharBuffer subSequence(int start, int end) {
    
    From 50446a33dd88b7533ae263d445e9e666bd8ac59b Mon Sep 17 00:00:00 2001
    From: Miroslav Kos 
    Date: Fri, 18 Jul 2014 19:14:38 +0200
    Subject: [PATCH 052/166] 8038970: Deprivilege JAX-WS/JAF code
    
    Changes to prepare for granting minimal set of permissions to JAX-WS code.
    
    Reviewed-by: mchung
    ---
     .../javax/activation/CommandMap.java          |  9 ++-
     .../javax/activation/FileTypeMap.java         |  8 +-
     .../v2/model/nav/ReflectionNavigator.java     | 78 +++++++++++++------
     .../internal/bind/v2/runtime/JaxBeanInfo.java | 17 +++-
     .../bind/v2/runtime/reflect/Accessor.java     |  3 +-
     .../bind/v2/runtime/reflect/opt/Injector.java | 39 ++++++----
     .../api/streaming/XMLStreamWriterFactory.java | 28 +++++--
     .../ws/assembler/MetroConfigLoader.java       | 20 +----
     .../internal/ws/assembler/TubeCreator.java    |  4 +-
     .../assembler/TubelineAssemblyController.java |  7 +-
     .../internal/ws/client/WSServiceDelegate.java | 18 ++---
     .../internal/ws/fault/SOAPFaultBuilder.java   | 13 +---
     .../sun/xml/internal/ws/model/Injector.java   | 44 ++++++-----
     13 files changed, 163 insertions(+), 125 deletions(-)
    
    diff --git a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java
    index 93393377a06..d07ae3ec38b 100644
    --- a/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java
    +++ b/jaxws/src/share/jaf_classes/javax/activation/CommandMap.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -93,10 +93,11 @@ public abstract class CommandMap {
                     // otherwise, we also allow it if this code and the
                     // factory come from the same (non-system) class loader (e.g.,
                     // the JAF classes were loaded with the applet classes).
    -                if (CommandMap.class.getClassLoader() == null ||
    -                    CommandMap.class.getClassLoader() !=
    -                            commandMap.getClass().getClassLoader())
    +                ClassLoader cl = CommandMap.class.getClassLoader();
    +                if (cl == null || cl.getParent() == null ||
    +                    cl != commandMap.getClass().getClassLoader()) {
                         throw ex;
    +                }
                 }
             }
             // remove any per-thread-context-class-loader CommandMap
    diff --git a/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java b/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java
    index a7c41185273..313998a6aec 100644
    --- a/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java
    +++ b/jaxws/src/share/jaf_classes/javax/activation/FileTypeMap.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -96,9 +96,9 @@ public abstract class FileTypeMap {
                     // otherwise, we also allow it if this code and the
                     // factory come from the same (non-system) class loader (e.g.,
                     // the JAF classes were loaded with the applet classes).
    -                if (FileTypeMap.class.getClassLoader() == null ||
    -                    FileTypeMap.class.getClassLoader() !=
    -                        fileTypeMap.getClass().getClassLoader())
    +                ClassLoader cl = FileTypeMap.class.getClassLoader();
    +                if (cl == null || cl.getParent() == null ||
    +                    cl != fileTypeMap.getClass().getClassLoader())
                         throw ex;
                 }
             }
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java
    index 7f25c89d688..7d86d087ffc 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java
    @@ -35,6 +35,8 @@ import java.lang.reflect.ParameterizedType;
     import java.lang.reflect.Type;
     import java.lang.reflect.TypeVariable;
     import java.lang.reflect.WildcardType;
    +import java.security.AccessController;
    +import java.security.PrivilegedAction;
     import java.util.Arrays;
     import java.util.Collection;
     
    @@ -264,20 +266,38 @@ import com.sun.xml.internal.bind.v2.runtime.Location;
             return clazz.getSimpleName();
         }
     
    -    public Collection getDeclaredFields(Class clazz) {
    -        return Arrays.asList(clazz.getDeclaredFields());
    +    public Collection getDeclaredFields(final Class clazz) {
    +        Field[] fields = AccessController.doPrivileged(new PrivilegedAction() {
    +            @Override
    +            public Field[] run() {
    +                return clazz.getDeclaredFields();
    +            }
    +        });
    +        return Arrays.asList(fields);
         }
     
    -    public Field getDeclaredField(Class clazz, String fieldName) {
    -        try {
    -            return clazz.getDeclaredField(fieldName);
    -        } catch (NoSuchFieldException e) {
    -            return null;
    -        }
    +    public Field getDeclaredField(final Class clazz, final String fieldName) {
    +        return AccessController.doPrivileged(new PrivilegedAction() {
    +            @Override
    +            public Field run() {
    +                try {
    +                    return clazz.getDeclaredField(fieldName);
    +                } catch (NoSuchFieldException e) {
    +                    return null;
    +                }
    +            }
    +        });
         }
     
    -    public Collection getDeclaredMethods(Class clazz) {
    -        return Arrays.asList(clazz.getDeclaredMethods());
    +    public Collection getDeclaredMethods(final Class clazz) {
    +        Method[] methods =
    +            AccessController.doPrivileged(new PrivilegedAction() {
    +                @Override
    +                public Method[] run() {
    +                    return clazz.getDeclaredMethods();
    +                }
    +            });
    +        return Arrays.asList(methods);
         }
     
         public Class getDeclaringClassForField(Field field) {
    @@ -565,7 +585,7 @@ import com.sun.xml.internal.bind.v2.runtime.Location;
             return method.isBridge();
         }
     
    -    public boolean isOverriding(Method method, Class base) {
    +    public boolean isOverriding(Method method, final Class base) {
             // this isn't actually correct,
             // as the JLS considers
             // class Derived extends Base {
    @@ -576,22 +596,30 @@ import com.sun.xml.internal.bind.v2.runtime.Location;
             // }
             // to be overrided. Handling this correctly needs a careful implementation
     
    -        String name = method.getName();
    -        Class[] params = method.getParameterTypes();
    +        final String name = method.getName();
    +        final Class[] params = method.getParameterTypes();
     
    -        while (base != null) {
    -            try {
    -                if (base.getDeclaredMethod(name, params) != null) {
    -                    return true;
    +        return AccessController.doPrivileged(
    +                new PrivilegedAction() {
    +
    +                    @Override
    +                    public Boolean run() {
    +                        Class clazz = base;
    +                        while (clazz != null) {
    +                            try {
    +                                Method m = clazz.getDeclaredMethod(name, params);
    +                                if (m != null) {
    +                                    return Boolean.TRUE;
    +                                }
    +                            } catch (NoSuchMethodException ignored) {
    +                                // recursively go into the base class
    +                            }
    +                            clazz = clazz.getSuperclass();
    +                        }
    +                        return Boolean.FALSE;
    +                    }
                     }
    -            } catch (NoSuchMethodException e) {
    -                // recursively go into the base class
    -            }
    -
    -            base = base.getSuperclass();
    -        }
    -
    -        return false;
    +        );
         }
     
         public boolean isInterface(Class clazz) {
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java
    index 059d9e32018..eaf696c4f29 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -28,6 +28,8 @@ package com.sun.xml.internal.bind.v2.runtime;
     import java.io.IOException;
     import java.lang.reflect.InvocationTargetException;
     import java.lang.reflect.Method;
    +import java.security.AccessController;
    +import java.security.PrivilegedAction;
     import java.util.Arrays;
     import java.util.Collection;
     import java.util.Collections;
    @@ -415,6 +417,15 @@ public abstract class JaxBeanInfo {
         private static final Class[] unmarshalEventParams = { Unmarshaller.class, Object.class };
         private static Class[] marshalEventParams = { Marshaller.class };
     
    +    private Method[] getDeclaredMethods(final Class c) {
    +        return AccessController.doPrivileged(new PrivilegedAction() {
    +            @Override
    +            public Method[] run() {
    +                return c.getDeclaredMethods();
    +            }
    +        });
    +    }
    +
         /**
          * use reflection to determine which of the 4 object lifecycle methods exist on
          * the JAXB bound type.
    @@ -428,7 +439,7 @@ public abstract class JaxBeanInfo {
                 }
     
                 while (jt != null) {
    -                for (Method m : jt.getDeclaredMethods()) {
    +                for (Method m : getDeclaredMethods(jt)) {
                         String name = m.getName();
     
                         if (lcm.beforeUnmarshal == null) {
    @@ -468,7 +479,7 @@ public abstract class JaxBeanInfo {
             } catch (SecurityException e) {
                 // this happens when we don't have enough permission.
                 logger.log(Level.WARNING, Messages.UNABLE_TO_DISCOVER_EVENTHANDLER.format(
    -                    jaxbType.getName(), e));
    +                    jaxbType.getName(), e), e);
             }
         }
     
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java
    index 7923cab28d7..e005de2e538 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java
    @@ -229,8 +229,7 @@ public abstract class Accessor implements Receiver {
                 if (!Modifier.isPublic(mod) || Modifier.isFinal(mod) || !Modifier.isPublic(f.getDeclaringClass().getModifiers())) {
                     try {
                         // attempt to make it accessible, but do so in the security context of the calling application.
    -                    // don't do this in the doPrivilege block, as that would create a security hole for anyone
    -                    // to make any field accessible.
    +                    // don't do this in the doPrivilege block
                         f.setAccessible(true);
                     } catch (SecurityException e) {
                         if ((!accessWarned) && (!supressAccessorWarnings)) {
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java
    index 78f4746abea..17c99557d9f 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -146,26 +146,31 @@ final class Injector {
         private static final Method findLoadedClass;
     
         static {
    +        Method[] m = AccessController.doPrivileged(
    +                new PrivilegedAction() {
    +                    @Override
    +                    public Method[] run() {
    +                        return new Method[]{
    +                                getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
    +                                getMethod(ClassLoader.class, "resolveClass", Class.class),
    +                                getMethod(ClassLoader.class, "findLoadedClass", String.class)
    +                        };
    +                    }
    +                }
    +        );
    +        defineClass = m[0];
    +        resolveClass = m[1];
    +        findLoadedClass = m[2];
    +    }
    +
    +    private static Method getMethod(final Class c, final String methodname, final Class... params) {
             try {
    -            defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE);
    -            resolveClass = ClassLoader.class.getDeclaredMethod("resolveClass", Class.class);
    -            findLoadedClass = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class);
    +            Method m = c.getDeclaredMethod(methodname, params);
    +            m.setAccessible(true);
    +            return m;
             } catch (NoSuchMethodException e) {
    -            // impossible
                 throw new NoSuchMethodError(e.getMessage());
             }
    -        AccessController.doPrivileged(new PrivilegedAction() {
    -
    -            @Override
    -            public Void run() {
    -                // TODO: check security implication
    -                // do these setAccessible allow anyone to call these methods freely?s
    -                defineClass.setAccessible(true);
    -                resolveClass.setAccessible(true);
    -                findLoadedClass.setAccessible(true);
    -                return null;
    -            }
    -        });
         }
     
         private Injector(ClassLoader parent) {
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java
    index 6cff489ba7b..fa52778a9f1 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/streaming/XMLStreamWriterFactory.java
    @@ -42,6 +42,8 @@ import java.io.OutputStream;
     import java.io.StringWriter;
     import java.lang.reflect.InvocationTargetException;
     import java.lang.reflect.Method;
    +import java.security.AccessController;
    +import java.security.PrivilegedAction;
     import java.util.logging.Level;
     import java.util.logging.Logger;
     
    @@ -91,8 +93,6 @@ public abstract class XMLStreamWriterFactory {
                         }
                     } catch (XMLStreamException ex) {
                         Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex);
    -                } catch (NoSuchMethodException ex) {
    -                    Logger.getLogger(XMLStreamWriterFactory.class.getName()).log(Level.INFO, null, ex);
                     }
                 }
     
    @@ -282,17 +282,31 @@ public abstract class XMLStreamWriterFactory {
                     return new Zephyr(xof,clazz);
                 } catch (XMLStreamException e) {
                     return null;    // impossible
    -            } catch (NoSuchMethodException e) {
    -                return null;    // this xof wasn't Zephyr
                 }
             }
     
    -        private Zephyr(XMLOutputFactory xof, Class clazz) throws NoSuchMethodException {
    +        private Zephyr(XMLOutputFactory xof, Class clazz) {
                 this.xof = xof;
     
                 zephyrClass = clazz;
    -            setOutputMethod = clazz.getMethod("setOutput", StreamResult.class, String.class);
    -            resetMethod = clazz.getMethod("reset");
    +            setOutputMethod = getMethod(clazz, "setOutput", StreamResult.class, String.class);
    +            resetMethod = getMethod(clazz, "reset");
    +        }
    +
    +        private static Method getMethod(final Class c, final String methodname, final Class... params) {
    +            return AccessController.doPrivileged(
    +                    new PrivilegedAction() {
    +                        @Override
    +                        public Method run() {
    +                            try {
    +                                return c.getMethod(methodname, params);
    +                            } catch (NoSuchMethodException e) {
    +                                // impossible
    +                                throw new NoSuchMethodError(e.getMessage());
    +                            }
    +                        }
    +                    }
    +            );
             }
     
             /**
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/MetroConfigLoader.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/MetroConfigLoader.java
    index 1e33628b0c1..966e1736aac 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/MetroConfigLoader.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/MetroConfigLoader.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -42,13 +42,12 @@ import javax.xml.bind.Unmarshaller;
     import javax.xml.stream.XMLInputFactory;
     import javax.xml.ws.WebServiceException;
     import java.lang.reflect.Method;
    -import java.lang.reflect.ReflectPermission;
     import java.net.MalformedURLException;
     import java.net.URI;
     import java.net.URISyntaxException;
     import java.net.URL;
    -import java.security.*;
    -import java.util.PropertyPermission;
    +import java.security.AccessController;
    +import java.security.PrivilegedExceptionAction;
     import java.util.logging.Level;
     
     /**
    @@ -258,24 +257,13 @@ class MetroConfigLoader {
                             public JAXBContext run() throws Exception {
                                 return JAXBContext.newInstance(MetroConfig.class.getPackage().getName());
                             }
    -                    }, createSecurityContext()
    -            );
    +                    });
             } else {
                 // usage from JAX-WS/Metro/Glassfish
                 return JAXBContext.newInstance(MetroConfig.class.getPackage().getName());
             }
         }
     
    -    private static AccessControlContext createSecurityContext() {
    -        PermissionCollection perms = new Permissions();
    -        perms.add(new RuntimePermission("accessClassInPackage.com" + ".sun.xml.internal.ws.runtime.config")); // avoid repackaging
    -        perms.add(new ReflectPermission("suppressAccessChecks"));
    -        return new AccessControlContext(
    -                new ProtectionDomain[]{
    -                        new ProtectionDomain(null, perms),
    -                });
    -    }
    -
         private static boolean isJDKInternal() {
             // avoid "string repackaging"
             return MetroConfigLoader.class.getName().startsWith("com." + "sun.xml.internal.ws");
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubeCreator.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubeCreator.java
    index d0e980ce937..d68f854c38f 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubeCreator.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubeCreator.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -49,7 +49,7 @@ final class TubeCreator {
             try {
                 Class factoryClass;
                 if (isJDKInternal(className)) {
    -                factoryClass = Class.forName(className, true, null);
    +                factoryClass = Class.forName(className, true, TubeCreator.class.getClassLoader());
                 } else {
                     factoryClass = Class.forName(className, true, tubeFactoryClassLoader);
                 }
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubelineAssemblyController.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubelineAssemblyController.java
    index 3f925581a85..a82c491e7fc 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubelineAssemblyController.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/TubelineAssemblyController.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -109,11 +109,12 @@ final class TubelineAssemblyController {
         }
     
         private Collection initializeTubeCreators(TubeFactoryList tfl) {
    -        final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    +        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
    +        ClassLoader classLoader = tccl != null ? tccl : TubelineAssemblyController.class.getClassLoader();
     
             LinkedList tubeCreators = new LinkedList();
             for (TubeFactoryConfig tubeFactoryConfig : tfl.getTubeFactoryConfigs()) {
    -            tubeCreators.addFirst(new TubeCreator(tubeFactoryConfig, contextClassLoader));
    +            tubeCreators.addFirst(new TubeCreator(tubeFactoryConfig, classLoader));
             }
             return tubeCreators;
         }
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java
    index 7805320d90a..1c054547a4e 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -91,7 +91,8 @@ import java.lang.reflect.InvocationHandler;
     import java.lang.reflect.Proxy;
     import java.net.MalformedURLException;
     import java.net.URL;
    -import java.security.*;
    +import java.security.AccessController;
    +import java.security.PrivilegedAction;
     import java.util.Collection;
     import java.util.HashMap;
     import java.util.HashSet;
    @@ -715,11 +716,6 @@ public class WSServiceDelegate extends WSService {
             final ClassLoader loader = getDelegatingLoader(portInterface.getClassLoader(),
                     WSServiceDelegate.class.getClassLoader());
     
    -        // accessClassInPackage privilege needs to be granted ...
    -        RuntimePermission perm = new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.*");
    -        PermissionCollection perms = perm.newPermissionCollection();
    -        perms.add(perm);
    -
             return AccessController.doPrivileged(
                     new PrivilegedAction() {
                         @Override
    @@ -728,12 +724,8 @@ public class WSServiceDelegate extends WSService {
                                     new Class[]{portInterface, WSBindingProvider.class, Closeable.class}, pis);
                             return portInterface.cast(proxy);
                         }
    -                },
    -                new AccessControlContext(
    -                        new ProtectionDomain[]{
    -                                new ProtectionDomain(null, perms)
    -                        })
    -        );
    +                });
    +
         }
     
         private WSDLService getWSDLModelfromSEI(final Class sei) {
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
    index 92bd3b26167..bf258021c33 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -58,12 +58,8 @@ import javax.xml.ws.soap.SOAPFaultException;
     import java.lang.reflect.Constructor;
     import java.lang.reflect.Field;
     import java.lang.reflect.Method;
    -import java.lang.reflect.ReflectPermission;
    -import java.security.AccessControlContext;
     import java.security.AccessController;
    -import java.security.Permissions;
     import java.security.PrivilegedAction;
    -import java.security.ProtectionDomain;
     import java.util.Iterator;
     import java.util.Map;
     import java.util.logging.Level;
    @@ -569,9 +565,6 @@ public abstract class SOAPFaultBuilder {
     
             // in jdk runtime doPrivileged is necessary since JAX-WS internal classes are in restricted packages
             if (isJDKRuntime()) {
    -            Permissions permissions = new Permissions();
    -            permissions.add(new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.ws.fault"));
    -            permissions.add(new ReflectPermission("suppressAccessChecks"));
                 return AccessController.doPrivileged(
                         new PrivilegedAction() {
                             @Override
    @@ -582,9 +575,7 @@ public abstract class SOAPFaultBuilder {
                                     throw new Error(e);
                                 }
                             }
    -                    },
    -                    new AccessControlContext(new ProtectionDomain[]{new ProtectionDomain(null, permissions)})
    -            );
    +                    });
     
             } else {
                 try {
    diff --git a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Injector.java b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Injector.java
    index 9d07e99b7c7..158e0a9f8ef 100644
    --- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Injector.java
    +++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Injector.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -50,28 +50,36 @@ final class Injector {
         private static final Method definePackage;
     
         static {
    +        Method[] m = AccessController.doPrivileged(
    +                new PrivilegedAction() {
    +                    @Override
    +                    public Method[] run() {
    +                        return new Method[]{
    +                                getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
    +                                getMethod(ClassLoader.class, "resolveClass", Class.class),
    +                                getMethod(ClassLoader.class, "getPackage", String.class),
    +                                getMethod(ClassLoader.class, "definePackage",
    +                                        String.class, String.class, String.class, String.class,
    +                                        String.class, String.class, String.class, URL.class)
    +                        };
    +                    }
    +                }
    +        );
    +        defineClass = m[0];
    +        resolveClass = m[1];
    +        getPackage = m[2];
    +        definePackage = m[3];
    +    }
    +
    +    private static Method getMethod(final Class c, final String methodname, final Class... params) {
             try {
    -            defineClass = ClassLoader.class.getDeclaredMethod("defineClass",String.class,byte[].class,Integer.TYPE,Integer.TYPE);
    -            resolveClass = ClassLoader.class.getDeclaredMethod("resolveClass",Class.class);
    -            getPackage = ClassLoader.class.getDeclaredMethod("getPackage", String.class);
    -            definePackage = ClassLoader.class.getDeclaredMethod("definePackage",
    -                    String.class, String.class, String.class, String.class,
    -                    String.class, String.class, String.class, URL.class);
    +            Method m = c.getDeclaredMethod(methodname, params);
    +            m.setAccessible(true);
    +            return m;
             } catch (NoSuchMethodException e) {
                 // impossible
                 throw new NoSuchMethodError(e.getMessage());
             }
    -        AccessController.doPrivileged(new PrivilegedAction() {
    -            public Void run() {
    -                // TODO: check security implication
    -                // do these setAccessible allow anyone to call these methods freely?s
    -                defineClass.setAccessible(true);
    -                resolveClass.setAccessible(true);
    -                getPackage.setAccessible(true);
    -                definePackage.setAccessible(true);
    -                return null;
    -            }
    -        });
         }
     
         static synchronized Class inject(ClassLoader cl, String className, byte[] image) {
    
    From 1fa3b2ce7fb1970dd67e5e986a034031561c0afb Mon Sep 17 00:00:00 2001
    From: Mandy Chung 
    Date: Fri, 18 Jul 2014 10:40:55 -0700
    Subject: [PATCH 053/166] 8050968: Extension class loader initialization fails
     on Win7 x64 zh_TW
    
    Reviewed-by: alanb, dholmes, sherman
    ---
     .../sun/nio/cs/ext/ExtendedCharsets.java       | 18 ++++++++++++++----
     1 file changed, 14 insertions(+), 4 deletions(-)
    
    diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
    index 91b676c2c0c..7b1db203305 100644
    --- a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
    +++ b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
    @@ -1173,8 +1173,7 @@ public class ExtendedCharsets
             if (!sun.misc.VM.isBooted())
                 return;
     
    -        String map = AccessController.doPrivileged(
    -            (PrivilegedAction) () -> System.getProperty("sun.nio.cs.map"));
    +        String map = getProperty("sun.nio.cs.map");
             boolean sjisIsMS932 = false;
             boolean iso2022jpIsMS50221 = false;
             boolean iso2022jpIsMS50220 = false;
    @@ -1294,8 +1293,7 @@ public class ExtendedCharsets
     
                 }
             }
    -        String osName = AccessController.doPrivileged(
    -            (PrivilegedAction) () -> System.getProperty("os.name"));
    +        String osName = getProperty("os.name");
             if ("SunOS".equals(osName) || "Linux".equals(osName) || "AIX".equals(osName)
                    || osName.contains("OS X")) {
                 charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
    @@ -1308,6 +1306,18 @@ public class ExtendedCharsets
             initialized = true;
         }
     
    +    private static String getProperty(String key) {
    +        // this method may be called during initialization of
    +        // system class loader and thus not using lambda
    +        return AccessController.doPrivileged(
    +            new PrivilegedAction() {
    +                @Override
    +                public String run() {
    +                    return System.getProperty(key);
    +                }
    +            });
    +    }
    +
         public static String[] aliasesFor(String charsetName) {
             if (instance == null)
                 return null;
    
    From f697e160a17bd4e0166dd82f7a48ca9601173c87 Mon Sep 17 00:00:00 2001
    From: Claes Redestad 
    Date: Fri, 18 Jul 2014 22:32:24 +0200
    Subject: [PATCH 054/166] 8050114: Expose Integer/Long formatUnsigned methods
     internally
    
    Reviewed-by: mduigou
    ---
     jdk/src/share/classes/java/lang/Integer.java  | 19 +++--
     jdk/src/share/classes/java/lang/Long.java     | 19 +++--
     jdk/src/share/classes/java/lang/System.java   |  6 ++
     .../classes/sun/misc/JavaLangAccess.java      | 10 +++
     .../misc/JavaLangAccess/FormatUnsigned.java   | 78 +++++++++++++++++++
     5 files changed, 116 insertions(+), 16 deletions(-)
     create mode 100644 jdk/test/sun/misc/JavaLangAccess/FormatUnsigned.java
    
    diff --git a/jdk/src/share/classes/java/lang/Integer.java b/jdk/src/share/classes/java/lang/Integer.java
    index 626fa337528..94b0aff7970 100644
    --- a/jdk/src/share/classes/java/lang/Integer.java
    +++ b/jdk/src/share/classes/java/lang/Integer.java
    @@ -320,24 +320,27 @@ public final class Integer extends Number implements Comparable {
         }
     
         /**
    -     * Format a long (treated as unsigned) into a character buffer.
    +     * Format an {@code int} (treated as unsigned) into a character buffer. If
    +     * {@code len} exceeds the formatted ASCII representation of {@code val},
    +     * {@code buf} will be padded with leading zeroes.
    +     *
          * @param val the unsigned int to format
          * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)
          * @param buf the character buffer to write to
          * @param offset the offset in the destination buffer to start at
          * @param len the number of characters to write
    -     * @return the lowest character  location used
          */
    -     static int formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) {
    -        int charPos = len;
    +     static void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) {
    +        // assert shift > 0 && shift <=5 : "Illegal shift value";
    +        // assert offset >= 0 && offset < buf.length : "illegal offset";
    +        // assert len > 0 && (offset + len) <= buf.length : "illegal length";
    +        int charPos = offset + len;
             int radix = 1 << shift;
             int mask = radix - 1;
             do {
    -            buf[offset + --charPos] = Integer.digits[val & mask];
    +            buf[--charPos] = Integer.digits[val & mask];
                 val >>>= shift;
    -        } while (val != 0 && charPos > 0);
    -
    -        return charPos;
    +        } while (charPos > offset);
         }
     
         final static char [] DigitTens = {
    diff --git a/jdk/src/share/classes/java/lang/Long.java b/jdk/src/share/classes/java/lang/Long.java
    index 71548bb7fd8..76caa77fac7 100644
    --- a/jdk/src/share/classes/java/lang/Long.java
    +++ b/jdk/src/share/classes/java/lang/Long.java
    @@ -361,24 +361,27 @@ public final class Long extends Number implements Comparable {
         }
     
         /**
    -     * Format a long (treated as unsigned) into a character buffer.
    +     * Format a long (treated as unsigned) into a character buffer. If
    +     * {@code len} exceeds the formatted ASCII representation of {@code val},
    +     * {@code buf} will be padded with leading zeroes.
    +     *
          * @param val the unsigned long to format
          * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)
          * @param buf the character buffer to write to
          * @param offset the offset in the destination buffer to start at
          * @param len the number of characters to write
    -     * @return the lowest character location used
          */
    -     static int formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
    -        int charPos = len;
    +     static void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
    +        // assert shift > 0 && shift <=5 : "Illegal shift value";
    +        // assert offset >= 0 && offset < buf.length : "illegal offset";
    +        // assert len > 0 && (offset + len) <= buf.length : "illegal length";
    +        int charPos = offset + len;
             int radix = 1 << shift;
             int mask = radix - 1;
             do {
    -            buf[offset + --charPos] = Integer.digits[((int) val) & mask];
    +            buf[--charPos] = Integer.digits[((int) val) & mask];
                 val >>>= shift;
    -        } while (val != 0 && charPos > 0);
    -
    -        return charPos;
    +        } while (charPos > offset);
         }
     
         /**
    diff --git a/jdk/src/share/classes/java/lang/System.java b/jdk/src/share/classes/java/lang/System.java
    index e96bd3b6f14..fbac697c245 100644
    --- a/jdk/src/share/classes/java/lang/System.java
    +++ b/jdk/src/share/classes/java/lang/System.java
    @@ -1263,6 +1263,12 @@ public final class System {
                 public void invokeFinalize(Object o) throws Throwable {
                     o.finalize();
                 }
    +            public void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len) {
    +                Long.formatUnsignedLong(val, shift, buf, offset, len);
    +            }
    +            public void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) {
    +                Integer.formatUnsignedInt(val, shift, buf, offset, len);
    +            }
             });
         }
     }
    diff --git a/jdk/src/share/classes/sun/misc/JavaLangAccess.java b/jdk/src/share/classes/sun/misc/JavaLangAccess.java
    index 812f88e2098..a86453df430 100644
    --- a/jdk/src/share/classes/sun/misc/JavaLangAccess.java
    +++ b/jdk/src/share/classes/sun/misc/JavaLangAccess.java
    @@ -132,4 +132,14 @@ public interface JavaLangAccess {
          * Invokes the finalize method of the given object.
          */
         void invokeFinalize(Object o) throws Throwable;
    +
    +    /**
    +     * Invokes Long.formatUnsignedLong(long val, int shift, char[] buf, int offset, int len)
    +     */
    +    void formatUnsignedLong(long val, int shift, char[] buf, int offset, int len);
    +
    +    /**
    +     * Invokes Integer.formatUnsignedInt(long val, int shift, char[] buf, int offset, int len)
    +     */
    +    void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len);
     }
    diff --git a/jdk/test/sun/misc/JavaLangAccess/FormatUnsigned.java b/jdk/test/sun/misc/JavaLangAccess/FormatUnsigned.java
    new file mode 100644
    index 00000000000..ff3411af244
    --- /dev/null
    +++ b/jdk/test/sun/misc/JavaLangAccess/FormatUnsigned.java
    @@ -0,0 +1,78 @@
    +/*
    + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
    + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    + *
    + * This code is free software; you can redistribute it and/or modify it
    + * under the terms of the GNU General Public License version 2 only, as
    + * published by the Free Software Foundation.
    + *
    + * This code is distributed in the hope that it will be useful, but WITHOUT
    + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + * version 2 for more details (a copy is included in the LICENSE file that
    + * accompanied this code).
    + *
    + * You should have received a copy of the GNU General Public License version
    + * 2 along with this work; if not, write to the Free Software Foundation,
    + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + * or visit www.oracle.com if you need additional information or have any
    + * questions.
    + */
    +
    +import sun.misc.JavaLangAccess;
    +import sun.misc.SharedSecrets;
    +
    +/*
    + * @test
    + * @summary Test JavaLangAccess.formatUnsignedInt/-Long
    + * @bug 8050114
    + */
    +public class FormatUnsigned {
    +
    +    static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
    +
    +    public static void testFormatUnsignedInt() {
    +        testFormatUnsignedInt("7fffffff", Integer.MAX_VALUE, 8, 4, 0, 8);
    +        testFormatUnsignedInt("80000000", Integer.MIN_VALUE, 8, 4, 0, 8);
    +        testFormatUnsignedInt("4711", 04711, 4, 3, 0, 4);
    +        testFormatUnsignedInt("4711", 0x4711, 4, 4, 0, 4);
    +        testFormatUnsignedInt("1010", 0b1010, 4, 1, 0, 4);
    +        testFormatUnsignedInt("00001010", 0b1010, 8, 1, 0, 8);
    +        testFormatUnsignedInt("\u0000\u000000001010", 0b1010, 10, 1, 2, 8);
    +    }
    +
    +    public static void testFormatUnsignedLong() {
    +        testFormatUnsignedLong("7fffffffffffffff", Long.MAX_VALUE, 16, 4, 0, 16);
    +        testFormatUnsignedLong("8000000000000000", Long.MIN_VALUE, 16, 4, 0, 16);
    +        testFormatUnsignedLong("4711", 04711L, 4, 3, 0, 4);
    +        testFormatUnsignedLong("4711", 0x4711L, 4, 4, 0, 4);
    +        testFormatUnsignedLong("1010", 0b1010L, 4, 1, 0, 4);
    +        testFormatUnsignedLong("00001010", 0b1010L, 8, 1, 0, 8);
    +        testFormatUnsignedLong("\u0000\u000000001010", 0b1010L, 10, 1, 2, 8);
    +    }
    +
    +    public static void testFormatUnsignedInt(String expected, int value, int arraySize, int shift, int offset, int length) {
    +        char[] chars = new char[arraySize];
    +        jla.formatUnsignedInt(value, shift, chars, offset, length);
    +        String s = new String(chars);
    +        if (!expected.equals(s)) {
    +            throw new Error(s + " should be equal to expected " + expected);
    +        }
    +    }
    +
    +    public static void testFormatUnsignedLong(String expected, long value, int arraySize, int shift, int offset, int length) {
    +        char[] chars = new char[arraySize];
    +        jla.formatUnsignedLong(value, shift, chars, offset, length);
    +        String s = new String(chars);
    +        if (!expected.equals(s)) {
    +            throw new Error(s + " should be equal to expected " + expected);
    +        }
    +    }
    +
    +    public static void main(String[] args) {
    +        testFormatUnsignedInt();
    +        testFormatUnsignedLong();
    +    }
    +}
    
    From bfa19ebfbc1e7bb68dd1b164b60227f8115dd6b5 Mon Sep 17 00:00:00 2001
    From: Weijun Wang 
    Date: Sat, 19 Jul 2014 10:20:42 +0800
    Subject: [PATCH 055/166] 8043071: Expose session key and KRB_CRED through
     extended GSS-API
    
    Reviewed-by: mullan
    ---
     .../sun/security/jgss/ExtendedGSSContext.java |  29 +--
     .../com/sun/security/jgss/InquireType.java    |  45 +++-
     .../security/auth/kerberos/EncryptionKey.java | 208 ++++++++++++++++++
     .../auth/kerberos/KerberosCredMessage.java    | 171 ++++++++++++++
     .../security/auth/kerberos/KerberosKey.java   |  63 +++---
     .../auth/kerberos/KerberosTicket.java         | 123 ++++++-----
     .../sun/security/jgss/krb5/Krb5Context.java   |  38 +++-
     .../auth/kerberos/KerberosHashEqualsTest.java |  79 ++++++-
     .../kerberos/KerberosNullsAndDestroyTest.java |  92 ++++++++
     jdk/test/sun/security/krb5/auto/Context.java  |  23 +-
     .../krb5/auto/KerberosHashEqualsTest.java     | 174 ---------------
     .../security/krb5/auto/NewInquireTypes.java   |  65 ++++++
     12 files changed, 814 insertions(+), 296 deletions(-)
     create mode 100644 jdk/src/share/classes/javax/security/auth/kerberos/EncryptionKey.java
     create mode 100644 jdk/src/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
     create mode 100644 jdk/test/javax/security/auth/kerberos/KerberosNullsAndDestroyTest.java
     delete mode 100644 jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java
     create mode 100644 jdk/test/sun/security/krb5/auto/NewInquireTypes.java
    
    diff --git a/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java b/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java
    index 2733c7b08f8..0f3a27dfac9 100644
    --- a/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java
    +++ b/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java
    @@ -36,33 +36,7 @@ import org.ietf.jgss.*;
     public interface ExtendedGSSContext extends GSSContext {
         /**
          * Return the mechanism-specific attribute associated with {@code type}.
    -     * 

    - * For each supported attribute type, the type for the output are - * defined below. - *
      - *
    1. {@code KRB5_GET_TKT_FLAGS}: - * the returned object is a boolean array for the service ticket flags, - * which is long enough to contain all true bits. This means if - * the user wants to get the n'th bit but the length of the - * returned array is less than n, it is regarded as false. - *
    2. {@code KRB5_GET_SESSION_KEY}: - * the returned object is an instance of {@link java.security.Key}, - * which has the following properties: - *
        - *
      • Algorithm: enctype as a string, where - * enctype is defined in RFC 3961, section 8. - *
      • Format: "RAW" - *
      • Encoded form: the raw key bytes, not in any ASN.1 encoding - *
      - *
    3. {@code KRB5_GET_AUTHZ_DATA}: - * the returned object is an array of - * {@link com.sun.security.jgss.AuthorizationDataEntry}, or null if the - * optional field is missing in the service ticket. - *
    4. {@code KRB5_GET_AUTHTIME}: - * the returned object is a String object in the standard KerberosTime - * format defined in RFC 4120 5.2.3 - *
    - * + *

    * If there is a security manager, an {@link InquireSecContextPermission} * with the name {@code type.mech} must be granted. Otherwise, this could * result in a {@link SecurityException}.

    @@ -97,6 +71,7 @@ public interface ExtendedGSSContext extends GSSContext { * @throws SecurityException if a security manager exists and a proper * {@link InquireSecContextPermission} is not granted. * @see InquireSecContextPermission + * @see InquireType */ public Object inquireSecContext(InquireType type) throws GSSException; diff --git a/jdk/src/share/classes/com/sun/security/jgss/InquireType.java b/jdk/src/share/classes/com/sun/security/jgss/InquireType.java index 9dfc83abf7c..440a85c178f 100644 --- a/jdk/src/share/classes/com/sun/security/jgss/InquireType.java +++ b/jdk/src/share/classes/com/sun/security/jgss/InquireType.java @@ -32,13 +32,38 @@ package com.sun.security.jgss; @jdk.Exported public enum InquireType { /** - * Attribute type for retrieving the session key of an - * established Kerberos 5 security context. + * Attribute type for retrieving the session key of an established + * Kerberos 5 security context. The returned object is an instance of + * {@link java.security.Key}, which has the following properties: + *

      + *
    • Algorithm: enctype as a string, where + * enctype is defined in RFC 3961, section 8. + *
    • Format: "RAW" + *
    • Encoded form: the raw key bytes, not in any ASN.1 encoding + *
    + * @deprecated as of 1.9, replaced by {@link #KRB5_GET_SESSION_KEY_EX} + * which returns an instance of + * {@link sun.security.jgss.krb5.Krb5Context.EncryptionKey} + * that implements the {@link javax.crypto.SecretKey} interface and + * has similar methods with {@link javax.security.auth.kerberos.KerberosKey}. */ + @Deprecated KRB5_GET_SESSION_KEY, + /** + * Attribute type for retrieving the session key of an + * established Kerberos 5 security context. The return value is an + * instance of {@link javax.security.auth.kerberos.EncryptionKey}. + * + * @since 1.9 + */ + KRB5_GET_SESSION_KEY_EX, /** * Attribute type for retrieving the service ticket flags of an - * established Kerberos 5 security context. + * established Kerberos 5 security context. The returned object is + * a boolean array for the service ticket flags, which is long enough + * to contain all true bits. This means if the user wants to get the + * n'th bit but the length of the returned array is less than + * n, it is regarded as false. */ KRB5_GET_TKT_FLAGS, /** @@ -49,7 +74,17 @@ public enum InquireType { KRB5_GET_AUTHZ_DATA, /** * Attribute type for retrieving the authtime in the service ticket - * of an established Kerberos 5 security context. + * of an established Kerberos 5 security context. The returned object + * is a String object in the standard KerberosTime format defined in + * RFC 4120 Section 5.2.3. */ - KRB5_GET_AUTHTIME + KRB5_GET_AUTHTIME, + /** + * Attribute type for retrieving the KRB_CRED message that an initiator + * is about to send to an acceptor. The return type is an instance of + * {@link javax.security.auth.kerberos.KerberosCredMessage}. + * + * @since 1.9 + */ + KRB5_GET_KRB_CRED, } diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/EncryptionKey.java b/jdk/src/share/classes/javax/security/auth/kerberos/EncryptionKey.java new file mode 100644 index 00000000000..22730b60844 --- /dev/null +++ b/jdk/src/share/classes/javax/security/auth/kerberos/EncryptionKey.java @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.security.auth.kerberos; + +import java.util.Arrays; +import java.util.Objects; +import javax.crypto.SecretKey; +import javax.security.auth.DestroyFailedException; + +/** + * This class encapsulates an EncryptionKey used in Kerberos.

    + * + * An EncryptionKey is defined in Section 4.2.9 of the Kerberos Protocol + * Specification (RFC 4120) as: + *

    + *     EncryptionKey   ::= SEQUENCE {
    + *             keytype         [0] Int32 -- actually encryption type --,
    + *             keyvalue        [1] OCTET STRING
    + *     }
    + * 
    + * The key material of an {@code EncryptionKey} is defined as the value + * of the {@code keyValue} above.

    + * + * @since 1.9 + */ +public final class EncryptionKey implements SecretKey { + + private static final long serialVersionUID = 9L; + + /** + * {@code KeyImpl} is serialized by writing out the ASN.1 encoded bytes + * of the encryption key. + * + * @serial + */ + final private KeyImpl key; + + private transient boolean destroyed = false; + + /** + * Constructs a {@code EncryptionKey} from the given bytes and + * the key type. + *

    + * The contents of the byte array are copied; subsequent modification of + * the byte array does not affect the newly created key. + * + * @param keyBytes the key material for the key + * @param keyType the key type for the key as defined by the + * Kerberos protocol specification. + * @throws NullPointerException if keyBytes is null + */ + public EncryptionKey(byte[] keyBytes, int keyType) { + key = new KeyImpl(Objects.requireNonNull(keyBytes), keyType); + } + + /** + * Returns the key type for this key. + * + * @return the key type. + * @throws IllegalStateException if the key is destroyed + */ + public int getKeyType() { + // KeyImpl already checked if destroyed + return key.getKeyType(); + } + + /* + * Methods from java.security.Key + */ + + /** + * Returns the standard algorithm name for this key. The algorithm names + * are the encryption type string defined on the IANA + * Kerberos Encryption Type Numbers + * page. + *

    + * This method can return the following value not defined on the IANA page: + *

      + *
    1. none: for etype equal to 0
    2. + *
    3. unknown: for etype greater than 0 but unsupported by + * the implementation
    4. + *
    5. private: for etype smaller than 0
    6. + *
    + * + * @return the name of the algorithm associated with this key. + * @throws IllegalStateException if the key is destroyed + */ + @Override + public String getAlgorithm() { + // KeyImpl already checked if destroyed + return key.getAlgorithm(); + } + + /** + * Returns the name of the encoding format for this key. + * + * @return the String "RAW" + * @throws IllegalStateException if the key is destroyed + */ + @Override + public String getFormat() { + // KeyImpl already checked if destroyed + return key.getFormat(); + } + + /** + * Returns the key material of this key. + * + * @return a newly allocated byte array that contains the key material + * @throws IllegalStateException if the key is destroyed + */ + @Override + public byte[] getEncoded() { + // KeyImpl already checked if destroyed + return key.getEncoded(); + } + + /** + * Destroys this key by clearing out the key material of this key. + * + * @throws DestroyFailedException if some error occurs while destorying + * this key. + */ + @Override + public void destroy() throws DestroyFailedException { + if (!destroyed) { + key.destroy(); + destroyed = true; + } + } + + + @Override + public boolean isDestroyed() { + return destroyed; + } + + @Override + public String toString() { + if (destroyed) { + return "Destroyed EncryptionKey"; + } + return "key " + key.toString(); + } + + @Override + public int hashCode() { + int result = 17; + if (isDestroyed()) { + return result; + } + result = 37 * result + Arrays.hashCode(getEncoded()); + return 37 * result + getKeyType(); + } + + /** + * Compares the specified Object with this key for equality. + * Returns true if the given object is also a + * {@code EncryptionKey} and the two + * {@code EncryptionKey} instances are equivalent. + * + * @param other the Object to compare to + * @return true if the specified object is equal to this EncryptionKey, + * false otherwise. NOTE: Returns false if either of the EncryptionKey + * objects has been destroyed. + */ + @Override + public boolean equals(Object other) { + + if (other == this) + return true; + + if (! (other instanceof EncryptionKey)) { + return false; + } + + EncryptionKey otherKey = ((EncryptionKey) other); + if (isDestroyed() || otherKey.isDestroyed()) { + return false; + } + + return getKeyType() == otherKey.getKeyType() + && Arrays.equals(getEncoded(), otherKey.getEncoded()); + } +} diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java new file mode 100644 index 00000000000..ee2010b1531 --- /dev/null +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.security.auth.kerberos; + +import javax.security.auth.Destroyable; +import java.util.Arrays; +import java.util.Base64; +import java.util.Objects; + +/** + * This class encapsulates a Kerberos 5 KRB_CRED message which can be used to + * send Kerberos credentials from one principal to another.

    + * + * A KRB_CRED message is defined in Section 5.8.1 of the Kerberos Protocol + * Specification (RFC 4120) as: + *

    + *    KRB-CRED        ::= [APPLICATION 22] SEQUENCE {
    + *            pvno            [0] INTEGER (5),
    + *            msg-type        [1] INTEGER (22),
    + *            tickets         [2] SEQUENCE OF Ticket,
    + *            enc-part        [3] EncryptedData -- EncKrbCredPart
    + *    }
    + * 

    + * + * @since 1.9 + */ +public final class KerberosCredMessage implements Destroyable { + + final private KerberosPrincipal sender; + final private KerberosPrincipal recipient; + final private byte[] message; + + private boolean destroyed = false; + + /** + * Constructs a {@code KerberosCredMessage} object. + *

    + * The contents of the {@code message} argument are copied; subsequent + * modification of the byte array does not affect the newly created object. + * + * @param sender the sender of the message + * @param recipient the recipient of the message + * @param message the DER encoded KRB_CRED message + * @throws NullPointerException if any of sender, recipient + * or message is null + */ + public KerberosCredMessage(KerberosPrincipal sender, + KerberosPrincipal recipient, + byte[] message) { + this.sender = Objects.requireNonNull(sender); + this.recipient = Objects.requireNonNull(recipient); + this.message = Objects.requireNonNull(message).clone(); + } + + /** + * Returns the DER encoded form of the KRB_CRED message. + * + * @return a newly allocated byte array that contains the encoded form + * @throws IllegalStateException if the object is destroyed + */ + public byte[] getEncoded() { + if (destroyed) { + throw new IllegalStateException("This object is no longer valid"); + } + return message.clone(); + } + + /** + * Returns the sender of this message. + * + * @return the sender + * @throws IllegalStateException if the object is destroyed + */ + public KerberosPrincipal getSender() { + if (destroyed) { + throw new IllegalStateException("This object is no longer valid"); + } + return sender; + } + + /** + * Returns the recipient of this message. + * + * @return the recipient + * @throws IllegalStateException if the object is destroyed + */ + public KerberosPrincipal getRecipient() { + if (destroyed) { + throw new IllegalStateException("This object is no longer valid"); + } + return recipient; + } + + /** + * Destroys this object by clearing out the message. + */ + @Override + public void destroy() { + if (!destroyed) { + Arrays.fill(message, (byte)0); + destroyed = true; + } + } + + @Override + public boolean isDestroyed() { + return destroyed; + } + + @Override + public String toString() { + if (destroyed) { + return "Destroyed KerberosCredMessage"; + } else { + return "KRB_CRED from " + sender + " to " + recipient + ":\n" + + Base64.getUrlEncoder().encodeToString(message); + } + } + + @Override + public int hashCode() { + if (isDestroyed()) { + return -1; + } else { + return Objects.hash(sender, recipient, Arrays.hashCode(message)); + } + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + + if (! (other instanceof KerberosCredMessage)) { + return false; + } + + KerberosCredMessage otherMessage = ((KerberosCredMessage) other); + if (isDestroyed() || otherMessage.isDestroyed()) { + return false; + } + + return Objects.equals(sender, otherMessage.sender) + && Objects.equals(recipient, otherMessage.recipient) + && Arrays.equals(message, otherMessage.message); + } +} diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java index a8d12131aaf..b233052f44f 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosKey.java @@ -27,13 +27,27 @@ package javax.security.auth.kerberos; import java.util.Arrays; import javax.crypto.SecretKey; -import javax.security.auth.Destroyable; import javax.security.auth.DestroyFailedException; /** * This class encapsulates a long term secret key for a Kerberos * principal.

    * + * A {@code KerberosKey} object includes an EncryptionKey, a + * {@link KerberosPrincipal} as its owner, and the version number + * of the key.

    + * + * An EncryptionKey is defined in Section 4.2.9 of the Kerberos Protocol + * Specification (RFC 4120) as: + *

    + *     EncryptionKey   ::= SEQUENCE {
    + *             keytype         [0] Int32 -- actually encryption type --,
    + *             keyvalue        [1] OCTET STRING
    + *     }
    + * 
    + * The key material of a {@code KerberosKey} is defined as the value + * of the {@code keyValue} above.

    + * * All Kerberos JAAS login modules that obtain a principal's password and * generate the secret key from it should use this class. * Sometimes, such as when authenticating a server in @@ -70,7 +84,7 @@ import javax.security.auth.DestroyFailedException; * @author Mayank Upadhyay * @since 1.4 */ -public class KerberosKey implements SecretKey, Destroyable { +public class KerberosKey implements SecretKey { private static final long serialVersionUID = -4625402278148246993L; @@ -89,15 +103,8 @@ public class KerberosKey implements SecretKey, Destroyable { private final int versionNum; /** - * {@code KeyImpl} is serialized by writing out the ASN1 Encoded bytes + * {@code KeyImpl} is serialized by writing out the ASN.1 encoded bytes * of the encryption key. - * The ASN1 encoding is defined in RFC4120 and as follows: - *

    -    * EncryptionKey   ::= SEQUENCE {
    -    *           keytype   [0] Int32 -- actually encryption type --,
    -    *           keyvalue  [1] OCTET STRING
    -    * }
    -    * 
    * * @serial */ @@ -111,7 +118,7 @@ public class KerberosKey implements SecretKey, Destroyable { * key information from a Kerberos "keytab". * * @param principal the principal that this secret key belongs to - * @param keyBytes the raw bytes for the secret key + * @param keyBytes the key material for the secret key * @param keyType the key type for the secret key as defined by the * Kerberos protocol specification. * @param versionNum the version number of this secret key @@ -153,10 +160,12 @@ public class KerberosKey implements SecretKey, Destroyable { * Returns the principal that this key belongs to. * * @return the principal this key belongs to. + * @throws IllegalStateException if the key is destroyed */ public final KerberosPrincipal getPrincipal() { - if (destroyed) + if (destroyed) { throw new IllegalStateException("This key is no longer valid"); + } return principal; } @@ -164,10 +173,12 @@ public class KerberosKey implements SecretKey, Destroyable { * Returns the key version number. * * @return the key version number. + * @throws IllegalStateException if the key is destroyed */ public final int getVersionNumber() { - if (destroyed) + if (destroyed) { throw new IllegalStateException("This key is no longer valid"); + } return versionNum; } @@ -175,10 +186,10 @@ public class KerberosKey implements SecretKey, Destroyable { * Returns the key type for this long-term key. * * @return the key type. + * @throws IllegalStateException if the key is destroyed */ public final int getKeyType() { - if (destroyed) - throw new IllegalStateException("This key is no longer valid"); + // KeyImpl already checked if destroyed return key.getKeyType(); } @@ -201,10 +212,10 @@ public class KerberosKey implements SecretKey, Destroyable { * * * @return the name of the algorithm associated with this key. + * @throws IllegalStateException if the key is destroyed */ public final String getAlgorithm() { - if (destroyed) - throw new IllegalStateException("This key is no longer valid"); + // KeyImpl already checked if destroyed return key.getAlgorithm(); } @@ -212,10 +223,10 @@ public class KerberosKey implements SecretKey, Destroyable { * Returns the name of the encoding format for this secret key. * * @return the String "RAW" + * @throws IllegalStateException if the key is destroyed */ public final String getFormat() { - if (destroyed) - throw new IllegalStateException("This key is no longer valid"); + // KeyImpl already checked if destroyed return key.getFormat(); } @@ -223,16 +234,15 @@ public class KerberosKey implements SecretKey, Destroyable { * Returns the key material of this secret key. * * @return the key material + * @throws IllegalStateException if the key is destroyed */ public final byte[] getEncoded() { - if (destroyed) - throw new IllegalStateException("This key is no longer valid"); + // KeyImpl already checked if destroyed return key.getEncoded(); } /** - * Destroys this key. A call to any of its other methods after this - * will cause an IllegalStateException to be thrown. + * Destroys this key by clearing out the key material of this secret key. * * @throws DestroyFailedException if some error occurs while destorying * this key. @@ -253,9 +263,9 @@ public class KerberosKey implements SecretKey, Destroyable { public String toString() { if (destroyed) { - return "Destroyed Principal"; + return "Destroyed KerberosKey"; } - return "Kerberos Principal " + principal.toString() + + return "Kerberos Principal " + principal + "Key Version " + versionNum + "key " + key.toString(); } @@ -293,8 +303,9 @@ public class KerberosKey implements SecretKey, Destroyable { */ public boolean equals(Object other) { - if (other == this) + if (other == this) { return true; + } if (! (other instanceof KerberosKey)) { return false; diff --git a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java index da38df976e7..513b49c1fc0 100644 --- a/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java +++ b/jdk/src/share/classes/javax/security/auth/kerberos/KerberosTicket.java @@ -35,9 +35,6 @@ import javax.security.auth.Destroyable; import javax.security.auth.RefreshFailedException; import javax.security.auth.DestroyFailedException; import sun.misc.HexDumpEncoder; -import sun.security.krb5.EncryptionKey; -import sun.security.krb5.Asn1Exception; -import sun.security.util.*; /** * This class encapsulates a Kerberos ticket and associated @@ -253,9 +250,10 @@ public class KerberosTicket implements Destroyable, Refreshable, Date endTime, Date renewTill, InetAddress[] clientAddresses) { - if (sessionKey == null) - throw new IllegalArgumentException("Session key for ticket" - + " cannot be null"); + if (sessionKey == null) { + throw new IllegalArgumentException("Session key for ticket" + + " cannot be null"); + } init(asn1Encoding, client, server, new KeyImpl(sessionKey, keyType), flags, authTime, startTime, endTime, renewTill, clientAddresses); @@ -271,41 +269,46 @@ public class KerberosTicket implements Destroyable, Refreshable, Date endTime, Date renewTill, InetAddress[] clientAddresses) { - if (asn1Encoding == null) - throw new IllegalArgumentException("ASN.1 encoding of ticket" - + " cannot be null"); + if (asn1Encoding == null) { + throw new IllegalArgumentException("ASN.1 encoding of ticket" + + " cannot be null"); + } this.asn1Encoding = asn1Encoding.clone(); - if (client == null) - throw new IllegalArgumentException("Client name in ticket" - + " cannot be null"); + if (client == null) { + throw new IllegalArgumentException("Client name in ticket" + + " cannot be null"); + } this.client = client; - if (server == null) - throw new IllegalArgumentException("Server name in ticket" - + " cannot be null"); + if (server == null) { + throw new IllegalArgumentException("Server name in ticket" + + " cannot be null"); + } this.server = server; // Caller needs to make sure `sessionKey` will not be null this.sessionKey = sessionKey; if (flags != null) { - if (flags.length >= NUM_FLAGS) - this.flags = flags.clone(); - else { + if (flags.length >= NUM_FLAGS) { + this.flags = flags.clone(); + } else { this.flags = new boolean[NUM_FLAGS]; // Fill in whatever we have - for (int i = 0; i < flags.length; i++) + for (int i = 0; i < flags.length; i++) { this.flags[i] = flags[i]; + } } - } else - this.flags = new boolean[NUM_FLAGS]; + } else { + this.flags = new boolean[NUM_FLAGS]; + } if (this.flags[RENEWABLE_TICKET_FLAG]) { - if (renewTill == null) - throw new IllegalArgumentException("The renewable period " + if (renewTill == null) { + throw new IllegalArgumentException("The renewable period " + "end time cannot be null for renewable tickets."); - + } this.renewTill = new Date(renewTill.getTime()); } @@ -318,13 +321,15 @@ public class KerberosTicket implements Destroyable, Refreshable, this.startTime = this.authTime; } - if (endTime == null) - throw new IllegalArgumentException("End time for ticket validity" - + " cannot be null"); + if (endTime == null) { + throw new IllegalArgumentException("End time for ticket validity" + + " cannot be null"); + } this.endTime = new Date(endTime.getTime()); - if (clientAddresses != null) - this.clientAddresses = clientAddresses.clone(); + if (clientAddresses != null) { + this.clientAddresses = clientAddresses.clone(); + } } /** @@ -346,14 +351,17 @@ public class KerberosTicket implements Destroyable, Refreshable, } /** - * Returns the session key associated with this ticket. + * Returns the session key associated with this ticket. The return value + * is always a {@link EncryptionKey} object. * * @return the session key. */ public final SecretKey getSessionKey() { - if (destroyed) + if (destroyed) { throw new IllegalStateException("This ticket is no longer valid"); - return sessionKey; + } + return new EncryptionKey( + sessionKey.getEncoded(), sessionKey.getKeyType()); } /** @@ -366,8 +374,9 @@ public class KerberosTicket implements Destroyable, Refreshable, * @see #getSessionKey() */ public final int getSessionKeyType() { - if (destroyed) + if (destroyed) { throw new IllegalStateException("This ticket is no longer valid"); + } return sessionKey.getKeyType(); } @@ -508,8 +517,9 @@ public class KerberosTicket implements Destroyable, Refreshable, * @return an ASN.1 encoding of the entire ticket. */ public final byte[] getEncoded() { - if (destroyed) + if (destroyed) { throw new IllegalStateException("This ticket is no longer valid"); + } return asn1Encoding.clone(); } @@ -539,16 +549,17 @@ public class KerberosTicket implements Destroyable, Refreshable, */ public void refresh() throws RefreshFailedException { - if (destroyed) + if (destroyed) { throw new RefreshFailedException("A destroyed ticket " - + "cannot be renewd."); - - if (!isRenewable()) + + "cannot be renewd."); + } + if (!isRenewable()) { throw new RefreshFailedException("This ticket is not renewable"); - - if (System.currentTimeMillis() > getRenewTill().getTime()) + } + if (System.currentTimeMillis() > getRenewTill().getTime()) { throw new RefreshFailedException("This ticket is past " - + "its last renewal time."); + + "its last renewal time."); + } Throwable e = null; sun.security.krb5.Credentials krb5Creds = null; @@ -634,8 +645,9 @@ public class KerberosTicket implements Destroyable, Refreshable, } public String toString() { - if (destroyed) - throw new IllegalStateException("This ticket is no longer valid"); + if (destroyed) { + return "Destroyed KerberosTicket"; + } StringBuilder caddrString = new StringBuilder(); if (clientAddresses != null) { for (int i = 0; i < clientAddresses.length; i++) { @@ -715,8 +727,9 @@ public class KerberosTicket implements Destroyable, Refreshable, */ public boolean equals(Object other) { - if (other == this) + if (other == this) { return true; + } if (! (other instanceof KerberosTicket)) { return false; @@ -731,7 +744,7 @@ public class KerberosTicket implements Destroyable, Refreshable, !endTime.equals(otherTicket.getEndTime()) || !server.equals(otherTicket.getServer()) || !client.equals(otherTicket.getClient()) || - !sessionKey.equals(otherTicket.getSessionKey()) || + !sessionKey.equals(otherTicket.sessionKey) || !Arrays.equals(clientAddresses, otherTicket.getClientAddresses()) || !Arrays.equals(flags, otherTicket.getFlags())) { return false; @@ -739,35 +752,41 @@ public class KerberosTicket implements Destroyable, Refreshable, // authTime may be null if (authTime == null) { - if (otherTicket.getAuthTime() != null) + if (otherTicket.getAuthTime() != null) { return false; + } } else { - if (!authTime.equals(otherTicket.getAuthTime())) + if (!authTime.equals(otherTicket.getAuthTime())) { return false; + } } // startTime may be null if (startTime == null) { - if (otherTicket.getStartTime() != null) + if (otherTicket.getStartTime() != null) { return false; + } } else { - if (!startTime.equals(otherTicket.getStartTime())) + if (!startTime.equals(otherTicket.getStartTime())) { return false; + } } if (renewTill == null) { - if (otherTicket.getRenewTill() != null) + if (otherTicket.getRenewTill() != null) { return false; + } } else { - if (!renewTill.equals(otherTicket.getRenewTill())) + if (!renewTill.equals(otherTicket.getRenewTill())) { return false; + } } return true; } private void readObject(ObjectInputStream s) - throws IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { s.defaultReadObject(); if (sessionKey == null) { throw new InvalidObjectException("Session key cannot be null"); diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java index 53c13f0894f..abce4c05987 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java @@ -40,11 +40,13 @@ import java.security.Provider; import java.security.AccessController; import java.security.AccessControlContext; import java.security.Key; -import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; -import javax.crypto.Cipher; +import java.security.PrivilegedExceptionAction; import javax.security.auth.Subject; -import javax.security.auth.kerberos.*; +import javax.security.auth.kerberos.ServicePermission; +import javax.security.auth.kerberos.KerberosCredMessage; +import javax.security.auth.kerberos.KerberosPrincipal; +import javax.security.auth.kerberos.KerberosTicket; import sun.security.krb5.internal.Ticket; /** @@ -118,6 +120,7 @@ class Krb5Context implements GSSContextSpi { // XXX See if the required info from these can be extracted and // stored elsewhere + private Credentials tgt; private Credentials serviceCreds; private KrbApReq apReq; Ticket serviceTicket; @@ -616,7 +619,6 @@ class Krb5Context implements GSSContextSpi { "No TGT available"); } myName = (Krb5NameElement) myCred.getName(); - Credentials tgt; final Krb5ProxyCredential second; if (myCred instanceof Krb5InitCredential) { second = null; @@ -750,7 +752,6 @@ class Krb5Context implements GSSContextSpi { // No need to write anything; // just validate the incoming token new AcceptSecContextToken(this, serviceCreds, apReq, is); - serviceCreds = null; apReq = null; state = STATE_DONE; } else { @@ -1304,6 +1305,9 @@ class Krb5Context implements GSSContextSpi { public final void dispose() throws GSSException { state = STATE_DELETED; delegatedCred = null; + tgt = null; + serviceCreds = null; + key = null; } public final Provider getProvider() { @@ -1424,6 +1428,9 @@ class Krb5Context implements GSSContextSpi { switch (type) { case KRB5_GET_SESSION_KEY: return new KerberosSessionKey(key); + case KRB5_GET_SESSION_KEY_EX: + return new javax.security.auth.kerberos.EncryptionKey( + key.getBytes(), key.getEType()); case KRB5_GET_TKT_FLAGS: return tktFlags.clone(); case KRB5_GET_AUTHZ_DATA: @@ -1435,6 +1442,26 @@ class Krb5Context implements GSSContextSpi { } case KRB5_GET_AUTHTIME: return authTime; + case KRB5_GET_KRB_CRED: + if (!isInitiator()) { + throw new GSSException(GSSException.UNAVAILABLE, -1, + "KRB_CRED not available on acceptor side."); + } + KerberosPrincipal sender = new KerberosPrincipal( + myName.getKrb5PrincipalName().getName()); + KerberosPrincipal recipient = new KerberosPrincipal( + peerName.getKrb5PrincipalName().getName()); + try { + byte[] krbCred = new KrbCred(tgt, serviceCreds, key) + .getMessage(); + return new KerberosCredMessage( + sender, recipient, krbCred); + } catch (KrbException | IOException e) { + GSSException gsse = new GSSException(GSSException.UNAVAILABLE, -1, + "KRB_CRED not generated correctly."); + gsse.initCause(e); + throw gsse; + } } throw new GSSException(GSSException.UNAVAILABLE, -1, "Inquire type not supported."); @@ -1456,4 +1483,5 @@ class Krb5Context implements GSSContextSpi { public void setAuthzData(com.sun.security.jgss.AuthorizationDataEntry[] authzData) { this.authzData = authzData; } + } diff --git a/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java b/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java index 9578a59547a..7eed2ccf425 100644 --- a/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java +++ b/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java @@ -33,9 +33,7 @@ import java.net.InetAddress; import java.util.Date; -import javax.security.auth.kerberos.KerberosKey; -import javax.security.auth.kerberos.KerberosPrincipal; -import javax.security.auth.kerberos.KerberosTicket; +import javax.security.auth.kerberos.*; public class KerberosHashEqualsTest { public static void main(String[] args) throws Exception { @@ -66,28 +64,67 @@ public class KerberosHashEqualsTest { k2.destroy(); checkNotSame(k1, k2); - - // destroyed keys doesn't equal to each other checkNotSame(k2, k1); checkSame(k2, k2); + k1.destroy(); + checkNotSame(k1, k2); + + // Destroyed key has string and hashCode + k1.toString(); k1.hashCode(); + // a little different + k1 = new KerberosKey(newKP("A"), "pass".getBytes(), 1, 1); k2 = new KerberosKey(newKP("B"), "pass".getBytes(), 1, 1); checkNotSame(k1, k2); + k2 = new KerberosKey(newKP("A"), "ssap".getBytes(), 1, 1); checkNotSame(k1, k2); + k2 = new KerberosKey(newKP("A"), "pass".getBytes(), 2, 1); checkNotSame(k1, k2); + k2 = new KerberosKey(newKP("A"), "pass".getBytes(), 1, 2); checkNotSame(k1, k2); + // Null k1 = new KerberosKey(null, "pass".getBytes(), 1, 2); checkNotSame(k1, k2); // null to non-null k2 = new KerberosKey(null, "pass".getBytes(), 1, 2); checkSame(k1, k2); // null to null + // Even key with null principal has a string and hashCode + k1.toString(); k1.hashCode(); + checkNotSame(k1, "Another Object"); + EncryptionKey e1, e2; + e1 = new EncryptionKey("pass".getBytes(), 1); + e2 = new EncryptionKey("pass".getBytes(), 1); + checkSame(e1, e1); // me to me + checkSame(e1, e2); // same + + e2.destroy(); + checkNotSame(e1, e2); + checkNotSame(e2, e1); + checkSame(e2, e2); + + e1.destroy(); + checkNotSame(e1, e2); + + // Destroyed key has string and hashCode + e1.toString(); e1.hashCode(); + + // a little different + e1 = new EncryptionKey("pass".getBytes(), 1); + e2 = new EncryptionKey("ssap".getBytes(), 1); + checkNotSame(e1, e2); + + e2 = new EncryptionKey("pass".getBytes(), 2); + checkNotSame(e1, e2); + + checkNotSame(e1, "Another Object"); + KerberosTicket t1, t2; t1 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); @@ -120,6 +157,7 @@ public class KerberosHashEqualsTest { t2.destroy(); checkNotSame(t1, t2); + t2.hashCode(); t2.toString(); // destroyed tickets doesn't equal to each other checkNotSame(t2, t1); @@ -130,6 +168,37 @@ public class KerberosHashEqualsTest { checkNotSame(t1, t2); // renewtill is useful checkNotSame(t1, "Another Object"); + + KerberosCredMessage m1, m2; + m1 = new KerberosCredMessage(newKP("C"), newKP("S"), "message".getBytes()); + m2 = new KerberosCredMessage(newKP("C"), newKP("S"), "message".getBytes()); + checkSame(m1, m1); // me to me + checkSame(m1, m2); // same + + m2.destroy(); + checkNotSame(m1, m2); + checkNotSame(m2, m1); + checkSame(m2, m2); + + m1.destroy(); + checkNotSame(m1, m2); + + // Destroyed message has string and hashCode + m1.toString(); m1.hashCode(); + + // a little different + m1 = new KerberosCredMessage(newKP("C"), newKP("S"), "message".getBytes()); + m2 = new KerberosCredMessage(newKP("A"), newKP("S"), "message".getBytes()); + checkNotSame(m1, m2); + + m2 = new KerberosCredMessage(newKP("C"), newKP("B"), "message".getBytes()); + checkNotSame(m1, m2); + + m1 = new KerberosCredMessage(newKP("C"), newKP("S"), "hello".getBytes()); + checkNotSame(m1, m2); + + checkNotSame(m1, "Another Object"); + System.out.println("Good!"); } diff --git a/jdk/test/javax/security/auth/kerberos/KerberosNullsAndDestroyTest.java b/jdk/test/javax/security/auth/kerberos/KerberosNullsAndDestroyTest.java new file mode 100644 index 00000000000..06bb71cd90b --- /dev/null +++ b/jdk/test/javax/security/auth/kerberos/KerberosNullsAndDestroyTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8043071 + * @summary Expose session key and KRB_CRED through extended GSS-API + */ + +import javax.security.auth.kerberos.*; +import java.util.function.Supplier; + +public class KerberosNullsAndDestroyTest { + + public static void main(String[] args) throws Exception { + + KerberosPrincipal c = new KerberosPrincipal("me@HERE"); + KerberosPrincipal s = new KerberosPrincipal("you@THERE"); + + // These object constructions should throw NullPointerException + checkNPE(() -> new KerberosKey(c, null, 17, 1)); + checkNPE(() -> new EncryptionKey(null, 17)); + checkNPE(() -> new KerberosCredMessage(null, s, new byte[1])); + checkNPE(() -> new KerberosCredMessage(c, null, new byte[1])); + checkNPE(() -> new KerberosCredMessage(c, s, null)); + + KerberosKey k1 = new KerberosKey(c, new byte[16], 17, 1); + EncryptionKey k2 = new EncryptionKey(new byte[16], 17); + KerberosCredMessage m = new KerberosCredMessage(c, s, new byte[1]); + + // These get calls should throw IllegalStateException + k1.destroy(); + checkISE(() -> k1.getAlgorithm()); + checkISE(() -> k1.getEncoded()); + checkISE(() -> k1.getFormat()); + checkISE(() -> k1.getKeyType()); + checkISE(() -> k1.getPrincipal()); + checkISE(() -> k1.getVersionNumber()); + + k2.destroy(); + checkISE(() -> k2.getAlgorithm()); + checkISE(() -> k2.getEncoded()); + checkISE(() -> k2.getFormat()); + checkISE(() -> k2.getKeyType()); + + m.destroy(); + checkISE(() -> m.getSender()); + checkISE(() -> m.getRecipient()); + checkISE(() -> m.getEncoded()); + } + + static void checkNPE(Supplier f) throws Exception { + check(f, NullPointerException.class); + } + + static void checkISE(Supplier f) throws Exception { + check(f, IllegalStateException.class); + } + + static void check(Supplier f, Class type) throws Exception { + try { + f.get(); + } catch (Exception e) { + if (e.getClass() != type) { + throw e; + } else { + return; + } + } + throw new Exception("Should fail"); + } +} diff --git a/jdk/test/sun/security/krb5/auto/Context.java b/jdk/test/sun/security/krb5/auto/Context.java index 715a1ad5978..28395d61295 100644 --- a/jdk/test/sun/security/krb5/auto/Context.java +++ b/jdk/test/sun/security/krb5/auto/Context.java @@ -26,9 +26,11 @@ import java.security.Key; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Arrays; +import java.util.Base64; import java.util.HashMap; import java.util.Map; import javax.security.auth.Subject; +import javax.security.auth.kerberos.KerberosCredMessage; import javax.security.auth.kerberos.KerberosKey; import javax.security.auth.kerberos.KerberosTicket; import javax.security.auth.login.LoginContext; @@ -86,7 +88,6 @@ public class Context { /** * Using the delegated credentials from a previous acceptor - * @param c */ public Context delegated() throws Exception { Context out = new Context(); @@ -177,7 +178,6 @@ public class Context { /** * Logins with username/keytab as an existing Subject. The * same subject can be used multiple times to simulate multiple logins. - * @param s existing subject */ public static Context fromUserKtab( String user, String ktab, boolean storeKey) throws Exception { @@ -411,6 +411,12 @@ public class Context { Key k = (Key)ex.inquireSecContext( InquireType.KRB5_GET_SESSION_KEY); if (k == null) { + throw new Exception("(Old) Session key cannot be null"); + } + System.out.println("(Old) Session key is: " + k); + Key k2 = (Key)ex.inquireSecContext( + InquireType.KRB5_GET_SESSION_KEY_EX); + if (k2 == null) { throw new Exception("Session key cannot be null"); } System.out.println("Session key is: " + k); @@ -431,6 +437,19 @@ public class Context { InquireType.KRB5_GET_AUTHZ_DATA); System.out.println("AuthzData is: " + Arrays.toString(ad)); } + try { + KerberosCredMessage tok = (KerberosCredMessage)ex.inquireSecContext( + InquireType.KRB5_GET_KRB_CRED); + System.out.println("KRB_CRED is " + + (tok == null?"not ":"") + "available"); + if (tok != null) { + System.out.println("From " + tok.getSender() + " to " + + tok.getRecipient()); + System.out.println(Base64.getEncoder().encodeToString(tok.getEncoded())); + } + } catch (Exception e) { + System.out.println("KRB_CRED is not available: " + e); + } } } } diff --git a/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java b/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java deleted file mode 100644 index e7c026dab03..00000000000 --- a/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @bug 4641821 - * @run main/othervm KerberosHashEqualsTest - * @summary hashCode() and equals() for KerberosKey and KerberosTicket - */ - -import java.net.InetAddress; -import java.util.Date; -import javax.security.auth.kerberos.KerberosKey; -import javax.security.auth.kerberos.KerberosPrincipal; -import javax.security.auth.kerberos.KerberosTicket; - -public class KerberosHashEqualsTest { - public static void main(String[] args) throws Exception { - new OneKDC(null); - new KerberosHashEqualsTest().check(); - } - - void checkSame(Object o1, Object o2) { - if(!o1.equals(o2)) { - throw new RuntimeException("equals() fails"); - } - if(o1.hashCode() != o2.hashCode()) { - throw new RuntimeException("hashCode() not same"); - } - } - - void checkNotSame(Object o1, Object o2) { - if(o1.equals(o2)) { - throw new RuntimeException("equals() succeeds"); - } - } - - void check() throws Exception { - - // The key part: - // new KerberosKey(principal, bytes, keyType, version) - - KerberosKey k1, k2; - KerberosPrincipal CLIENT = new KerberosPrincipal("client"); - KerberosPrincipal SERVER = new KerberosPrincipal("server"); - byte[] PASS = "pass".getBytes(); - - k1 = new KerberosKey(CLIENT, PASS, 1, 1); - k2 = new KerberosKey(CLIENT, PASS, 1, 1); - checkSame(k1, k1); // me is me - checkSame(k1, k2); // same - - // A destroyed key doesn't equal to any key - k2.destroy(); - checkNotSame(k1, k2); - checkNotSame(k2, k1); - k1.destroy(); - checkNotSame(k1, k2); // even if they are both destroyed - checkNotSame(k2, k1); - checkSame(k2, k2); - - // a little difference means not equal - k1 = new KerberosKey(CLIENT, PASS, 1, 1); - k2 = new KerberosKey(SERVER, PASS, 1, 1); - checkNotSame(k1, k2); // Different principal name - - k2 = new KerberosKey(CLIENT, "ssap".getBytes(), 1, 1); - checkNotSame(k1, k2); // Different password - - k2 = new KerberosKey(CLIENT, PASS, 2, 1); - checkNotSame(k1, k2); // Different keytype - - k2 = new KerberosKey(CLIENT, PASS, 1, 2); - checkNotSame(k1, k2); // Different version - - k2 = new KerberosKey(null, PASS, 1, 2); - checkNotSame(k1, k2); // null is not non-null - - k1 = new KerberosKey(null, PASS, 1, 2); - checkSame(k1, k2); // null is null - - checkNotSame(k1, "Another Object"); - - // The ticket part: - // new KerberosTicket(asn1 bytes, client, server, session key, type, flags, - // auth, start, end, renewUntil times, address) - - KerberosTicket t1, t2; - - byte[] ASN1 = "asn1".getBytes(); - boolean[] FORWARDABLE = new boolean[] {true, true}; - boolean[] ALLTRUE = new boolean[] {true, true, true, true, true, true, true, true, true, true}; - Date D0 = new Date(0); - - t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); - checkSame(t1, t1); - checkSame(t1, t2); - - // destroyed tickets doesn't equal to each other - t1.destroy(); - checkNotSame(t1, t2); - checkNotSame(t2, t1); - - t2.destroy(); - checkNotSame(t1, t2); // even if they are both destroyed - checkNotSame(t2, t1); - - checkSame(t2, t2); // unless they are the same object - - // a little difference means not equal - t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); - t2 = new KerberosTicket("asn11".getBytes(), CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); - checkNotSame(t1, t2); // Different ASN1 encoding - - t2 = new KerberosTicket(ASN1, new KerberosPrincipal("client1"), SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); - checkNotSame(t1, t2); // Different client - - t2 = new KerberosTicket(ASN1, CLIENT, new KerberosPrincipal("server1"), PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); - checkNotSame(t1, t2); // Different server - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, "pass1".getBytes(), 1, FORWARDABLE, D0, D0, D0, D0, null); - checkNotSame(t1, t2); // Different session key - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 2, FORWARDABLE, D0, D0, D0, D0, null); - checkNotSame(t1, t2); // Different key type - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, new boolean[] {true, false}, D0, D0, D0, D0, null); - checkNotSame(t1, t2); // Different flags, not FORWARDABLE - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, new Date(1), D0, D0, D0, null); - checkNotSame(t1, t2); // Different authtime - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, new Date(1), D0, D0, null); - checkNotSame(t1, t2); // Different starttime - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, new Date(1), D0, null); - checkNotSame(t1, t2); // Different endtime - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, new InetAddress[2]); - checkNotSame(t1, t2); // Different client addresses - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, new Date(1), null); - t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, new Date(2), null); - checkSame(t1, t2); // renewtill is ignored when RENEWABLE ticket flag is not set. - - t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, ALLTRUE, D0, D0, D0, new Date(1), null); - t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, ALLTRUE, D0, D0, D0, new Date(2), null); - checkNotSame(t1, t2); // renewtill is used when RENEWABLE is set. - - checkNotSame(t1, "Another Object"); - System.out.println("Good!"); - } -} diff --git a/jdk/test/sun/security/krb5/auto/NewInquireTypes.java b/jdk/test/sun/security/krb5/auto/NewInquireTypes.java new file mode 100644 index 00000000000..0a922468b62 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/NewInquireTypes.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8043071 + * @summary Expose session key and KRB_CRED through extended GSS-API + * @compile -XDignore.symbol.file NewInquireTypes.java + * @run main/othervm NewInquireTypes + */ + +import com.sun.security.jgss.InquireType; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.internal.KRBCred; +import sun.security.krb5.internal.crypto.KeyUsage; + +import javax.security.auth.kerberos.KerberosCredMessage; +import javax.security.auth.kerberos.EncryptionKey; + +public class NewInquireTypes { + + public static void main(String[] args) throws Exception { + + new OneKDC(null).writeJAASConf(); + + Context c, s; + c = Context.fromJAAS("client"); + s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + Context.handshake(c, s); + + EncryptionKey key = (EncryptionKey) + c.x().inquireSecContext(InquireType.KRB5_GET_SESSION_KEY_EX); + KerberosCredMessage cred = (KerberosCredMessage) + c.x().inquireSecContext(InquireType.KRB5_GET_KRB_CRED); + + // Confirm the KRB_CRED message is encrypted with the session key. + new KRBCred(cred.getEncoded()).encPart.decrypt( + new sun.security.krb5.EncryptionKey(key.getKeyType(), key.getEncoded()), + KeyUsage.KU_ENC_KRB_CRED_PART); + } +} From fa3886e6d008f9c81445871903da2043d9805f24 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Sat, 19 Jul 2014 11:22:08 +0800 Subject: [PATCH 056/166] 8051399: Fix for JDK-8043071 breaks dev build Reviewed-by: xuelei --- .../com/sun/security/auth/module/Krb5LoginModule.java | 5 ++++- .../classes/sun/security/jgss/krb5/Krb5InitCredential.java | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index 8539a266ee5..12ee20b126b 100644 --- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -33,7 +33,10 @@ import java.text.MessageFormat; import java.util.*; import javax.security.auth.*; -import javax.security.auth.kerberos.*; +import javax.security.auth.kerberos.KerberosTicket; +import javax.security.auth.kerberos.KerberosPrincipal; +import javax.security.auth.kerberos.KerberosKey; +import javax.security.auth.kerberos.KeyTab; import javax.security.auth.callback.*; import javax.security.auth.login.*; import javax.security.auth.spi.*; diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java index 536f927aa30..aabe0a103de 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java @@ -29,8 +29,8 @@ import org.ietf.jgss.*; import sun.security.jgss.GSSCaller; import sun.security.jgss.spi.*; import sun.security.krb5.*; -import sun.security.krb5.Config; -import javax.security.auth.kerberos.*; +import javax.security.auth.kerberos.KerberosTicket; +import javax.security.auth.kerberos.KerberosPrincipal; import java.net.InetAddress; import java.io.IOException; import java.util.Date; From 29f1de041171a3c4ab1fd4a9161431a0d72158c5 Mon Sep 17 00:00:00 2001 From: Dmitriy Ermashov Date: Mon, 21 Jul 2014 12:29:45 +0400 Subject: [PATCH 057/166] 8049694: Migrate functional AWT_DesktopProperties/Automated tests to OpenJDK Reviewed-by: azvegint, serb --- .../Toolkit/DesktopProperties/rfe4758438.java | 238 ++++++++++++++++++ .../Toolkit/DesktopProperties/rfe4758438.sh | 83 ++++++ 2 files changed, 321 insertions(+) create mode 100644 jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.java create mode 100644 jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.sh diff --git a/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.java b/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.java new file mode 100644 index 00000000000..e5b2e4dd1e1 --- /dev/null +++ b/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.java @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.io.InputStream; + +/* + * @test + * @bug 4758438 + * @summary Testcase to check the implementation of RFE 4758438 + * The RFE suggests that the GNOME desktop properties + * should be made accessible through the + * Toolkit.getDesktopProperty() API. + * @author Girish R (girish.ramachandran@sun.com) + * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com) + * @run shell rfe4758438.sh + */ + +public class rfe4758438 implements PropertyChangeListener { + + enum PROPS { + drag_threshold( + "org.gnome.settings-daemon.peripherals.mouse drag-threshold", + "/desktop/gnome/peripherals/mouse/drag_threshold", + "gnome.Net/DndDragThreshold", + "int", + new String[]{"5", "6"}), + double_click( + "org.gnome.settings-daemon.peripherals.mouse double-click", + "/desktop/gnome/peripherals/mouse/double_click", + "gnome.Net/DoubleClickTime", + "int", + new String[]{"200","300"}), + cursor_blink( + "org.gnome.desktop.interface cursor-blink", + "/desktop/gnome/interface/cursor_blink", + "gnome.Net/CursorBlink", + "bool", + new String[]{"true","false"}), + cursor_blink_time( + "org.gnome.desktop.interface cursor-blink-time", + "/desktop/gnome/interface/cursor_blink_time", + "gnome.Net/CursorBlinkTime", + "int", + new String[]{"1000","1500"}), + gtk_theme( + "org.gnome.desktop.interface gtk-theme", + "/desktop/gnome/interface/gtk_theme", + "gnome.Net/ThemeName", + "string", + new String[]{"Crux","Simple"}); + + public final String gsettings; + public final String gconftool; + public final String java; + public final String type; + public final String[] values; + + PROPS(String gsettings, String gconftool, String java, String type, String[] values){ + this.gsettings = gsettings; + this.gconftool = gconftool; + this.java = java; + this.type = type; + this.values = values; + } + } + + static boolean useGsettings; + static String tool; + Toolkit toolkit = Toolkit.getDefaultToolkit(); + String changedProperty; + Object changedValue; + Object lock = new Object(); + + /** + * Implementation of PropertyChangeListener method + */ + public void propertyChange(PropertyChangeEvent event) { + changedProperty = event.getPropertyName(); + changedValue = toolkit.getDesktopProperty(changedProperty); + System.out.println("Property "+changedProperty+" changed. Changed value: "+changedValue); + synchronized(lock) { + try { + lock.notifyAll(); + } catch (Exception e) { + } + } + } + + public static void main(String[] args) throws Exception { + useGsettings = System.getProperty("useGsettings").equals("true"); + tool = System.getProperty("tool"); + + String osName = System.getProperty("os.name"); + if (!"Linux".equals(osName) && !"SunOS".equals(osName)) + System.out.println("This test need not be run on this platform"); + else + new rfe4758438().doTest(); + } + + void doTest() throws Exception { + for (PROPS p : PROPS.values()) + toolkit.addPropertyChangeListener(p.java, this); + + for (PROPS p : PROPS.values()) { + Thread.sleep(1000); + doTest(p); + } + System.out.println("Test passed"); + } + + /** + * Do the test for each property. Find the current value + * of the property, set the property to a value not equal + * to the current value, check if the propertyChange event + * is triggered. Reset the property to the actual value. + */ + void doTest(PROPS property) throws Exception { + //Choose the test value which is not same as the current value + Object obj = toolkit.getDesktopProperty(property.java); + if (obj == null) + throw new RuntimeException("No such property available: " + property.java); + + //For boolean type values, getDesktopProperty method returns Integer objects + if (property.type.equals("bool")) { + if (obj.equals(new Integer(1))) { + obj = new String("true"); + } else { + obj = new String("false"); + } + } + Object value = property.values[0]; + if (obj.toString().equals(value)) { + value = property.values[1]; + } + + //Create the command to execute + StringBuffer sb = new StringBuffer(tool); + if (useGsettings) { + sb.append(" set "); + sb.append(property.gsettings); + sb.append(" "); + } else { + sb.append(" --set --type="); + sb.append(property.type); + sb.append(" "); + sb.append(property.gconftool); + sb.append(" "); + } + String tempCommand = sb.toString(); + sb.append(value.toString()); + + //Initialize the variables and execute the command + changedProperty = ""; + changedValue = null; + if (executeCommand(sb.toString()) != 0) + throw new RuntimeException("Could not execute the command"); + + synchronized(lock) { + try { + lock.wait(5000); + } catch (Exception e) { + } + } + if (property.type.equals("bool")) { + if (changedValue.equals(new Integer(1))) { + changedValue = new String("true"); + } else { + changedValue = new String("false"); + } + } + + //Check if the event got triggered + if (!changedProperty.equals(property.java)) { + //Reset the property + executeCommand(tempCommand + obj.toString()); + throw new RuntimeException("PropertyChangedEvent did not occur for " + property.java); + } else if (!changedValue.toString().equals(value.toString())) { + //Reset the property + executeCommand(tempCommand + obj.toString()); + throw new RuntimeException("New value of the property is different from " + + "the value supplied"); + } + + //Reset the property + executeCommand(tempCommand + obj.toString()); + } + + /** + * Uses the gconftool-2 command to change the value of the property. + * Gets the output of the command and prints the output + */ + int executeCommand(String command) throws Exception { + System.out.println("Executing " + command); + Process process = Runtime.getRuntime().exec(command); + + InputStream is = process.getInputStream(); + InputStream es = process.getErrorStream(); + StringBuilder stdout = new StringBuilder(); + StringBuilder stderr = new StringBuilder(); + + process.waitFor(); + + while (is.available() > 0) + stdout.append((char) is.read()); + + while (es.available() > 0) + stderr.append((char) es.read()); + + if (stdout.length() > 0) + System.out.println(stdout.toString()); + if (stderr.length() > 0) + System.err.println(stderr.toString()); + return process.exitValue(); + } +} diff --git a/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.sh b/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.sh new file mode 100644 index 00000000000..6a55d727c7b --- /dev/null +++ b/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.sh @@ -0,0 +1,83 @@ +# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. + +if [ -z "${TESTJAVA}" ]; then + echo "TESTJAVA undefined: can't continue." + exit 1 +fi + +OS=`uname` + +case "$OS" in + Linux* ) + GNOMESID=`pgrep gnome-session` + DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS /proc/$GNOMESID/environ | cut -d= -f2-` + export DBUS_SESSION_BUS_ADDRESS + DISPLAY=`grep -z DISPLAY /proc/$GNOMESID/environ | cut -d= -f2-` + export DISPLAY + ;; + Sun* ) + GNOMESID=`pgrep gnome-session` + DBUS_SESSION_BUS_ADDRESS=`pargs -e $GNOMESID | grep DBUS_SESSION_BUS_ADDRESS | cut -d= -f2-` + export DBUS_SESSION_BUS_ADDRESS + DISPLAY=`pargs -e $GNOMESID | grep DISPLAY | cut -d= -f2-` + export DISPLAY + ;; + * ) + echo "This Feature is not to be tested on $OS" + exit 0 + ;; +esac + +if [ ${GNOME_DESKTOP_SESSION_ID:-nonset} = "nonset" ]; +then + if [ ${GNOME_SESSION_NAME:-nonset} = "nonset" ]; + then + echo "This test should run under Gnome" + exit 0 + fi +fi + +SCHEMAS=`gsettings list-schemas | wc -l` + +if [ $SCHEMAS -eq 0 ]; +then + TOOL=`which gconftool-2` + USE_GSETTINGS="false" +else + TOOL=`which gsettings` + USE_GSETTINGS="true" +fi + +cd ${TESTSRC} +echo $PWD +echo "${TESTJAVA}/bin/javac -d ${TESTCLASSES} rfe4758438.java" +${TESTJAVA}/bin/javac -d ${TESTCLASSES} rfe4758438.java + +cd ${TESTCLASSES} +${TESTJAVA}/bin/java -DuseGsettings=${USE_GSETTINGS} -Dtool=${TOOL} ${TESTVMOPTS} rfe4758438 + +if [ $? -ne 0 ] +then + echo "Test failed. See the error stream output" + exit 1 +fi +exit 0 From 4f0106f2443244f7b38b16b6f80c42926a33a876 Mon Sep 17 00:00:00 2001 From: Alexander Stepanov Date: Mon, 21 Jul 2014 13:17:43 +0400 Subject: [PATCH 058/166] 8049617: move awt automated tests from AWT_Modality to OpenJDK repository - part 3 Reviewed-by: pchelko --- .../BlockingDDAppModalTest.java | 46 +++ .../BlockingDDDocModalTest.java | 46 +++ .../BlockingDDModelessTest.java | 46 +++ .../BlockingDDNonModalTest.java | 44 +++ .../BlockingDDSetModalTest.java | 45 +++ .../ModalBlockingTests/BlockingDDTest.java | 124 ++++++++ .../BlockingDDToolkitModalTest.java | 46 +++ .../BlockingDFAppModalTest.java | 46 +++ .../BlockingDFSetModalTest.java | 46 +++ .../ModalBlockingTests/BlockingDFTest.java | 97 ++++++ .../BlockingDFToolkitModalTest.java | 46 +++ .../BlockingDFWModeless1Test.java | 50 +++ .../BlockingDFWModeless2Test.java | 50 +++ .../BlockingDFWNonModal1Test.java | 48 +++ .../BlockingDFWNonModal2Test.java | 48 +++ .../ModalBlockingTests/BlockingDFWTest.java | 162 ++++++++++ .../BlockingDocModalTest.java | 153 +++++++++ .../BlockingFDAppModalTest.java | 47 +++ .../BlockingFDDocModalTest.java | 47 +++ .../BlockingFDModelessTest.java | 47 +++ .../BlockingFDNonModalTest.java | 46 +++ .../BlockingFDSetModalTest.java | 46 +++ .../ModalBlockingTests/BlockingFDTest.java | 124 ++++++++ .../BlockingFDToolkitModalTest.java | 47 +++ .../BlockingFDWDocModal1Test.java | 49 +++ .../BlockingFDWDocModal2Test.java | 49 +++ .../BlockingFDWDocModal3Test.java | 49 +++ .../BlockingFDWDocModal4Test.java | 49 +++ .../BlockingFDWModeless1Test.java | 49 +++ .../BlockingFDWModeless2Test.java | 49 +++ .../BlockingFDWModeless3Test.java | 49 +++ .../BlockingFDWModeless4Test.java | 49 +++ .../BlockingFDWNonModal1Test.java | 47 +++ .../BlockingFDWNonModal2Test.java | 48 +++ .../BlockingFDWNonModal3Test.java | 48 +++ .../BlockingFDWNonModal4Test.java | 48 +++ .../ModalBlockingTests/BlockingFDWTest.java | 162 ++++++++++ .../BlockingWindowsAppModal1Test.java | 49 +++ .../BlockingWindowsAppModal2Test.java | 49 +++ .../BlockingWindowsAppModal3Test.java | 49 +++ .../BlockingWindowsAppModal4Test.java | 49 +++ .../BlockingWindowsAppModal5Test.java | 49 +++ .../BlockingWindowsAppModal6Test.java | 49 +++ .../BlockingWindowsDocModal1Test.java | 49 +++ .../BlockingWindowsDocModal2Test.java | 49 +++ .../BlockingWindowsDocModalTest.java | 211 ++++++++++++ .../BlockingWindowsSetModal1Test.java | 48 +++ .../BlockingWindowsSetModal2Test.java | 48 +++ .../BlockingWindowsSetModal3Test.java | 48 +++ .../BlockingWindowsSetModal4Test.java | 48 +++ .../BlockingWindowsSetModal5Test.java | 48 +++ .../BlockingWindowsSetModal6Test.java | 48 +++ .../BlockingWindowsTest.java | 299 ++++++++++++++++++ .../BlockingWindowsToolkitModal1Test.java | 49 +++ .../BlockingWindowsToolkitModal2Test.java | 49 +++ .../BlockingWindowsToolkitModal3Test.java | 49 +++ .../BlockingWindowsToolkitModal4Test.java | 49 +++ .../BlockingWindowsToolkitModal5Test.java | 49 +++ .../BlockingWindowsToolkitModal6Test.java | 49 +++ .../UnblockedDialogAppModalTest.java | 44 +++ .../UnblockedDialogDocModalTest.java | 44 +++ .../UnblockedDialogModelessTest.java | 44 +++ .../UnblockedDialogNonModalTest.java | 43 +++ .../UnblockedDialogSetModalTest.java | 43 +++ .../UnblockedDialogTest.java | 123 +++++++ .../UnblockedDialogToolkitModalTest.java | 44 +++ .../java/awt/Modal/helpers/TestFrame.java | 6 +- 67 files changed, 4164 insertions(+), 3 deletions(-) create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogTest.java create mode 100644 jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java new file mode 100644 index 00000000000..b04cd70db7e --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Dialog. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDDAppModalTest + */ + +public class BlockingDDAppModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java new file mode 100644 index 00000000000..e73867ed495 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Dialog. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDDDocModalTest + */ + +public class BlockingDDDocModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java new file mode 100644 index 00000000000..f38c3d68898 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Dialog. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDDModelessTest + */ + +public class BlockingDDModelessTest { + + public static void main(String[] args) throws Exception { + (new BlockingDDTest(Dialog.ModalityType.MODELESS)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java new file mode 100644 index 00000000000..f3f558e7170 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Dialog. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDDNonModalTest + */ + +public class BlockingDDNonModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDDTest(null)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java new file mode 100644 index 00000000000..3b89dadb667 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Dialog. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDDSetModalTest + */ + +public class BlockingDDSetModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDDTest()).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java new file mode 100644 index 00000000000..ecddb82d42d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + +// DD: Dialog -> Dialog + +public class BlockingDDTest { + + private TestDialog parent, dialog; + + private static final int delay = 1000; + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + private final boolean setModal; + + private BlockingDDTest(Dialog.ModalityType modType, boolean modal) throws Exception { + + modalityType = modType; + setModal = modal; + robot = new ExtendedRobot(); + createGUI(); + } + + public BlockingDDTest(Dialog.ModalityType modType) throws Exception { + this(modType, false); + } + + public BlockingDDTest() throws Exception { + this(null, true); + } + + + private void showParent() { + + parent = new TestDialog((Frame) null); + parent.setTitle("Parent"); + parent.setLocation(50, 50); + parent.setVisible(true); + } + + private void showChild() { + + dialog = new TestDialog(parent); + if (setModal) { + dialog.setModal(true); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + dialog.setLocation(250, 50); + dialog.setVisible(true); + } + + + private void createGUI() throws Exception { + + EventQueue.invokeAndWait(this::showParent); + robot.waitForIdle(delay); + EventQueue.invokeLater(this::showChild); + robot.waitForIdle(delay); + } + + public void doTest() throws Exception { + + try { + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "the 1st Dialog button " + + "did not gain focus when it became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " + + "gained the focus but lost it afterwards"); + + dialog.checkUnblockedDialog(robot, "Modal Dialog shouldn't be blocked."); + + if ((modalityType == Dialog.ModalityType.APPLICATION_MODAL) || + (modalityType == Dialog.ModalityType.DOCUMENT_MODAL) || + (modalityType == Dialog.ModalityType.TOOLKIT_MODAL) || + dialog.isModal()) + { + parent.checkBlockedDialog(robot, + "Dialog is the parent of a visible " + modalityType + " Dialog."); + } else { + parent.checkUnblockedDialog(robot, + "Dialog is the parent of a visible " + modalityType + " Dialog."); + } + + robot.waitForIdle(delay); + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (parent != null) { parent.dispose(); } + if (dialog != null) { dialog.dispose(); } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java new file mode 100644 index 00000000000..e386dc1b123 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Dialog. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDDToolkitModalTest + */ + +public class BlockingDDToolkitModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java new file mode 100644 index 00000000000..7ebc7657cec --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDFAppModalTest + */ + +public class BlockingDFAppModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDFTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java new file mode 100644 index 00000000000..790d5e03b7c --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDFSetModalTest + */ + +public class BlockingDFSetModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDFTest()).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFTest.java new file mode 100644 index 00000000000..b07b8105c61 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFTest.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + + +// DF: Dialog -> Frame + +public class BlockingDFTest { + + private TestDialog dialog; + private TestFrame frame; + + private static final int delay = 500; + private final ExtendedRobot robot; + + private BlockingDFTest(Dialog.ModalityType modalityType, + boolean setModal) throws Exception { + + robot = new ExtendedRobot(); + EventQueue.invokeLater(() -> { createGUI(modalityType, setModal); }); + } + + public BlockingDFTest(Dialog.ModalityType modalityType) throws Exception { + this(modalityType, false); + } + + public BlockingDFTest() throws Exception { this(null, true); } + + + private void createGUI(Dialog.ModalityType modalityType, + boolean setModal) { + + frame = new TestFrame(); + frame.setLocation(50, 50); + frame.setVisible(true); + + dialog = new TestDialog((Dialog) null); + dialog.setLocation(250, 50); + if (setModal) { + dialog.setModal(true); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + dialog.setVisible(true); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "The 1st button did not " + + "gain focus when the dialog became visible"); + + dialog.checkUnblockedDialog(robot, ""); + frame.checkBlockedFrame(robot, ""); + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (frame != null) { frame.dispose(); } + if (dialog != null) { dialog.dispose(); } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java new file mode 100644 index 00000000000..de09b5d05d2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a Frame + * constructor receives focus, whether its components receives focus + * and respond to key events. Check also the correctness + * of blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main BlockingDFToolkitModalTest + */ + +public class BlockingDFToolkitModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingDFTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java new file mode 100644 index 00000000000..5c9c3f3fc77 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also if the other windows + * receive mouse and key events. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingDFWModeless1Test + */ + +public class BlockingDFWModeless1Test { + + public static void main(String[] args) throws Exception { + (new BlockingDFWTest( + BlockingDFWTest.Parent.FRAME, + Dialog.ModalityType.MODELESS)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java new file mode 100644 index 00000000000..430dff23d0e --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also if the other windows + * receive mouse and key events. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingDFWModeless2Test + */ + +public class BlockingDFWModeless2Test { + + public static void main(String[] args) throws Exception { + (new BlockingDFWTest( + BlockingDFWTest.Parent.DIALOG, + Dialog.ModalityType.MODELESS)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java new file mode 100644 index 00000000000..58242e425cf --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also if the other windows + * receive mouse and key events. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingDFWNonModal1Test + */ + +public class BlockingDFWNonModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingDFWTest( + BlockingDFWTest.Parent.FRAME, null)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java new file mode 100644 index 00000000000..acd9fb8b0ae --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a Dialog + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also if the other windows + * receive mouse and key events. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingDFWNonModal2Test + */ + +public class BlockingDFWNonModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingDFWTest( + BlockingDFWTest.Parent.DIALOG, null)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java new file mode 100644 index 00000000000..7659ddd5450 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import java.awt.event.KeyEvent; +import static jdk.testlibrary.Asserts.*; + +// DFW: Dialog -> Frame -> Window + +public class BlockingDFWTest { + + private static final int delay = 500; + private final ExtendedRobot robot; + + public enum Parent {DIALOG, FRAME}; + + private ParentDialog parentDialog; + private ParentFrame parentFrame; + private TestDialog dialog; + private TestFrame frame; + private TestWindow window; + + + public BlockingDFWTest(Parent parentWin, Dialog.ModalityType modalityType) throws Exception { + + robot = new ExtendedRobot(); + EventQueue.invokeLater(() -> { createGUI(parentWin, modalityType); }); + } + + private void createGUI(Parent parentWin, Dialog.ModalityType modalityType) { + + Window p = null; + switch (parentWin) { + case DIALOG: + parentDialog = new ParentDialog((Dialog) null); + dialog = new CustomDialog(parentDialog); + p = parentDialog; + break; + case FRAME: + parentFrame = new ParentFrame(); + dialog = new CustomDialog(parentFrame); + p = parentFrame; + break; + } + + assertFalse(p == null, "invalid parent"); + p.setLocation(50, 50); + dialog.setLocation(250, 50); + if (modalityType != null) { dialog.setModalityType(modalityType); } + + frame = new TestFrame(); + frame.setLocation(50, 250); + window = new TestWindow(frame); + window.setLocation(250, 250); + + p.setVisible(true); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + if (parentDialog != null) { parentDialog.clickOpenButton(robot); } + else if (parentFrame != null) { parentFrame.clickOpenButton(robot); } + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "the 1st button did not gain " + + "focus when the dialog became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st dialog button " + + "gained focus, but lost it afterwards"); + + dialog.openGained.reset(); + robot.type(KeyEvent.VK_TAB); + + dialog.openGained.waitForFlagTriggered(); + assertTrue(dialog.openGained.flag(), "Tab navigation did not happen " + + "properly; open button did not gain focus on tab press " + + "when parent frame is visible"); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + frame.activated.waitForFlagTriggered(); + assertTrue(frame.activated.flag(), "Frame did not trigger " + + "Window Activated event when made visible."); + + frame.checkUnblockedFrame(robot, "Frame should not be blocked."); + window.checkUnblockedWindow(robot, "Window should not be blocked."); + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + if (parentDialog != null) { parentDialog.dispose(); } + if (parentFrame != null) { parentFrame.dispose(); } + } + + + class ParentDialog extends TestDialog { + + public ParentDialog(Dialog d) { super(d); } + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } + + class ParentFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog d) { super(d); } + public CustomDialog(Frame f) { super(f); } + + @Override + public void doOpenAction() { + if (frame != null) { frame.setVisible(true); } + if (window != null) { window.setVisible(true); } + } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java new file mode 100644 index 00000000000..638c67a5507 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + + +/* + * @test + * @bug 8049617 + * @summary Test if a document modality works as expected: + * whether all the windows lying down the document root + * (Frame) get blocked. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingDocModalTest + */ + + +public class BlockingDocModalTest { + + private static final int delay = 500; + private final ExtendedRobot robot; + + private TestDialog dialog, childDialog; + private TestFrame frame; + private TestWindow window; + + + public BlockingDocModalTest() throws Exception { + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + frame.setVisible(true); + + dialog = new TestDialog(frame); + dialog.setLocation(250, 250); + dialog.setVisible(true); + + childDialog = new CustomDialog(dialog); + childDialog.setLocation(250, 50); + childDialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); + + window = new TestWindow(frame); + window.setLocation(50, 250); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + childDialog.activated.waitForFlagTriggered(); + assertTrue(childDialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + childDialog.closeGained.waitForFlagTriggered(); + assertTrue(childDialog.closeGained.flag(), "the 1st button did not " + + "gain focus when the Dialog became visible"); + + assertTrue(childDialog.closeButton.hasFocus(), "the 1st dialog button " + + "gained focus but lost it afterwards"); + + frame.checkBlockedFrame(robot, "A document modal Dialog from " + + "this Frame's child hierarchy should block this frame"); + + childDialog.checkUnblockedDialog(robot, + "This is a document modal childDialog."); + + childDialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkBlockedWindow(robot, + "A document modal dialog having a parent belonging " + + "to this Window's document hierarchy is displayed."); + + dialog.checkBlockedDialog(robot, + "A document modal child dialog should block this Dialog."); + + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if ( frame != null) { frame.dispose(); } + if (window != null) { window.dispose(); } + if (childDialog != null) { childDialog.dispose(); } + } + + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (childDialog != null) { childDialog.setVisible(true); } + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog d) { super(d); } + + @Override + public void doOpenAction() { + if (window != null) { window.setVisible(true); } + } + } + + + public static void main(String[] args) throws Exception { + (new BlockingDocModalTest()).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java new file mode 100644 index 00000000000..e446498c0fc --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of the blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @run main BlockingFDAppModalTest + */ + +public class BlockingFDAppModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingFDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java new file mode 100644 index 00000000000..1f9168fbcf2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of the blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @run main BlockingFDDocModalTest + */ + +public class BlockingFDDocModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingFDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java new file mode 100644 index 00000000000..d63d1f3d11c --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of the blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @run main BlockingFDModelessTest + */ + +public class BlockingFDModelessTest { + + public static void main(String[] args) throws Exception { + (new BlockingFDTest(Dialog.ModalityType.MODELESS)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java new file mode 100644 index 00000000000..f91bcfb23f9 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of the blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @run main BlockingFDNonModalTest + */ + +public class BlockingFDNonModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingFDTest(null)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java new file mode 100644 index 00000000000..21f1720861e --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of the blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @run main BlockingFDSetModalTest + */ + +public class BlockingFDSetModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingFDTest()).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java new file mode 100644 index 00000000000..38a936f805c --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + + +// FD: Frame -> Dialog + +public class BlockingFDTest { + + private TestFrame frame; + private TestDialog dialog; + + private static final int delay = 500; + private final ExtendedRobot robot; + + private final Dialog.ModalityType modalityType; + private final boolean setModal; + + private BlockingFDTest(Dialog.ModalityType modType, boolean modal) throws Exception { + + modalityType = modType; + setModal = modal; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + public BlockingFDTest(Dialog.ModalityType modType) throws Exception { + this(modType, false); + } + + public BlockingFDTest() throws Exception { + this(null, true); + } + + private void createGUI() { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + dialog = new TestDialog(frame); + if (setModal) { + dialog.setModal(true); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + dialog.setLocation(250, 50); + + frame.setVisible(true); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "the 1st Dialog button " + + "did not gain focus when it became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " + + "gained the focus but lost it afterwards"); + + if ((modalityType == Dialog.ModalityType.APPLICATION_MODAL) || + (modalityType == Dialog.ModalityType.DOCUMENT_MODAL) || + (modalityType == Dialog.ModalityType.TOOLKIT_MODAL) || + setModal) + { + frame.checkBlockedFrame(robot, + "Frame is the parent of a visible " + modalityType + " Dialog."); + } else { + frame.checkUnblockedFrame(robot, + "Frame is the parent of a visible " + modalityType + " Dialog."); + } + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (frame != null) { frame.dispose(); } + if (dialog != null) { dialog.dispose(); } + } + + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java new file mode 100644 index 00000000000..f907276fc44 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a Frame + * constructor receives focus, whether its components receive focus + * and respond to key events. Check also the correctness + * of the blocking behavior for the parent Frame. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @run main BlockingFDToolkitModalTest + */ + +public class BlockingFDToolkitModalTest { + + public static void main(String[] args) throws Exception { + (new BlockingFDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java new file mode 100644 index 00000000000..8f24edc2444 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a null Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWDocModal1Test + */ + +public class BlockingFDWDocModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL, + BlockingFDWTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java new file mode 100644 index 00000000000..41b3f07119d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a null Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWDocModal2Test + */ + +public class BlockingFDWDocModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL, + BlockingFDWTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java new file mode 100644 index 00000000000..4cc992e5e1a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a hidden Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWDocModal3Test + */ + +public class BlockingFDWDocModal3Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL, + BlockingFDWTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java new file mode 100644 index 00000000000..a84af093f24 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a hidden Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWDocModal4Test + */ + +public class BlockingFDWDocModal4Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.DOCUMENT_MODAL, + BlockingFDWTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java new file mode 100644 index 00000000000..2872d59c4ed --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a null Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWModeless1Test + */ + +public class BlockingFDWModeless1Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.MODELESS, + BlockingFDWTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java new file mode 100644 index 00000000000..d8a9417d78b --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a null Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWModeless2Test + */ + +public class BlockingFDWModeless2Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.MODELESS, + BlockingFDWTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java new file mode 100644 index 00000000000..b85b23df383 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a hidden Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWModeless3Test + */ + +public class BlockingFDWModeless3Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.MODELESS, + BlockingFDWTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java new file mode 100644 index 00000000000..37a04b434e0 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog created with a hidden Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWModeless4Test + */ + +public class BlockingFDWModeless4Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(Dialog.ModalityType.MODELESS, + BlockingFDWTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java new file mode 100644 index 00000000000..440d42882c7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a null Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWNonModal1Test + */ + +public class BlockingFDWNonModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(null, + BlockingFDWTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java new file mode 100644 index 00000000000..ece48092250 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a null Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWNonModal2Test + */ + +public class BlockingFDWNonModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(null, + BlockingFDWTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java new file mode 100644 index 00000000000..759967a2de8 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a hidden Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWNonModal3Test + */ + +public class BlockingFDWNonModal3Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(null, + BlockingFDWTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java new file mode 100644 index 00000000000..e24f818a238 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog created with a hidden Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Check also the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingFDWNonModal4Test + */ + +public class BlockingFDWNonModal4Test { + + public static void main(String[] args) throws Exception { + (new BlockingFDWTest(null, + BlockingFDWTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java new file mode 100644 index 00000000000..cbcab392d51 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + + +// FDW: Frame -> Dialog -> Window + +public class BlockingFDWTest { + + private TestFrame frame; + private TestDialog dialog; + private TestWindow window; + + private Dialog hiddenDialog; + private Frame hiddenFrame; + + private static final int delay = 500; + private final ExtendedRobot robot; + + public enum DialogOwner {HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME}; + + public BlockingFDWTest(Dialog.ModalityType modalityType, + DialogOwner owner) throws Exception { + + robot = new ExtendedRobot(); + EventQueue.invokeLater(() -> { createGUI(modalityType, owner); }); + } + + private void createGUI(Dialog.ModalityType modalityType, + DialogOwner owner) { + + frame = new CustomFrame(); + frame.setLocation(50, 50); + + switch (owner) { + case HIDDEN_DIALOG: + hiddenDialog = new Dialog((Frame) null); + dialog = new CustomDialog(hiddenDialog); + break; + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + case HIDDEN_FRAME: + hiddenFrame = new Frame(); + dialog = new CustomDialog(hiddenFrame); + break; + case NULL_FRAME: + dialog = new CustomDialog((Frame) null); + break; + } + + assertFalse(dialog == null, "error: null dialog"); + + dialog.setLocation(250, 50); + if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + window = new TestWindow(frame); + window.setLocation(450, 50); + + frame.setVisible(true); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + frame.clickOpenButton(robot); + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "the 1st Dialog button " + + "did not gain focus when it became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " + + "gained the focus but lost it afterwards"); + + frame.checkUnblockedFrame(robot, "A " + dialog.getModalityType() + " dialog is visible."); + + dialog.checkUnblockedDialog(robot, "A Frame is visible."); + + dialog.openClicked.reset(); + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + window.checkUnblockedWindow(robot, + "A Frame and a " + dialog.getModalityType() + " Dialog are visible."); + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (frame != null) { frame.dispose(); } + if (dialog != null) { dialog.dispose(); } + if (window != null) { window.dispose(); } + if (hiddenDialog != null) { hiddenDialog.dispose(); } + if (hiddenFrame != null) { hiddenFrame.dispose(); } + } + + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog dialog) { + super(dialog); + } + + public CustomDialog(Frame frame) { + super(frame); + } + + @Override + public void doOpenAction() { + if (window != null) { window.setVisible(true); } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java new file mode 100644 index 00000000000..4a840f8ca63 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a null Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsAppModal1Test + */ + +public class BlockingWindowsAppModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL, + BlockingWindowsTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java new file mode 100644 index 00000000000..46a37f86a62 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a null Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsAppModal2Test + */ + +public class BlockingWindowsAppModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL, + BlockingWindowsTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java new file mode 100644 index 00000000000..c58fe745773 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a hidden Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsAppModal3Test + */ + +public class BlockingWindowsAppModal3Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL, + BlockingWindowsTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java new file mode 100644 index 00000000000..651ef125fbd --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a hidden Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsAppModal4Test + */ + +public class BlockingWindowsAppModal4Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL, + BlockingWindowsTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java new file mode 100644 index 00000000000..0fd12ae0f1d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsAppModal5Test + */ + +public class BlockingWindowsAppModal5Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL, + BlockingWindowsTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java new file mode 100644 index 00000000000..39ae804586e --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog created with a Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsAppModal6Test + */ + +public class BlockingWindowsAppModal6Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.APPLICATION_MODAL, + BlockingWindowsTest.DialogOwner.DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java new file mode 100644 index 00000000000..dbb13829c40 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsDocModal1Test + */ + +public class BlockingWindowsDocModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsDocModalTest( + BlockingWindowsDocModalTest.Parent.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java new file mode 100644 index 00000000000..da39e5db2af --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog created with a Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsDocModal2Test + */ + +public class BlockingWindowsDocModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsDocModalTest( + BlockingWindowsDocModalTest.Parent.DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModalTest.java new file mode 100644 index 00000000000..7ffc5e1ce49 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModalTest.java @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.*; +import java.awt.event.KeyEvent; +import static jdk.testlibrary.Asserts.*; + +import java.util.List; +import java.util.ArrayList; + +public class BlockingWindowsDocModalTest { + + private ParentDialog parentDialog; + private ParentFrame parentFrame; + private CustomDialog dialog; + private TestDialog secondDialog, childDialog; + private TestFrame secondFrame; + private TestWindow window, childWindow, secondWindow; + + + private static final int delay = 500; + private final ExtendedRobot robot; + + private List allWindows; + + public enum Parent {DIALOG, FRAME}; + private Parent root; + + public BlockingWindowsDocModalTest(Parent p) throws Exception { + + root = p; + + robot = new ExtendedRobot(); + EventQueue.invokeLater(this::createGUI); + } + + private void createGUI() { + + allWindows = new ArrayList<>(); + + switch (root) { + case DIALOG: + parentDialog = new ParentDialog((Dialog) null); + parentDialog.setLocation(50, 50); + parentDialog.setVisible(true); + allWindows.add(parentDialog); + + dialog = new CustomDialog(parentDialog); + secondDialog = new TestDialog(parentDialog); + window = new TestWindow(parentDialog); + break; + case FRAME: + parentFrame = new ParentFrame(); + parentFrame.setLocation(50, 50); + parentFrame.setVisible(true); + allWindows.add(parentFrame); + + dialog = new CustomDialog(parentFrame); + secondDialog = new TestDialog(parentFrame); + window = new TestWindow(parentFrame); + break; + } + + allWindows.add(dialog); + allWindows.add(secondDialog); + allWindows.add(window); + + dialog.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); + dialog.setLocation(250, 50); + window.setLocation(450, 50); + secondDialog.setLocation(450, 250); + + secondFrame = new TestFrame(); + allWindows.add(secondFrame); + secondFrame.setLocation(50, 250); + + secondWindow = new TestWindow(secondFrame); + allWindows.add(secondWindow); + secondWindow.setLocation(250, 250); + + childDialog = new TestDialog(dialog); + allWindows.add(childDialog); + childDialog.setLocation(250, 450); + + childWindow = new TestWindow(dialog); + allWindows.add(childWindow); + childWindow.setLocation(50, 450); + } + + public void doTest() throws Exception { + + try { + robot.waitForIdle(delay); + + if (root == Parent.DIALOG) { + parentDialog.clickOpenButton(robot); + } else { //Parent.FRAME + parentFrame.clickOpenButton(robot); + } + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Acivated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), + "the 1st Dialog button didn't gain focus"); + + assertTrue(dialog.closeButton.hasFocus(), "the 1st Dialog button " + + "gained focus but lost it afterwards"); + + dialog.openGained.reset(); + robot.type(KeyEvent.VK_TAB); + + dialog.openGained.waitForFlagTriggered(); + assertTrue(dialog.openGained.flag(), "Tab navigation did not happen properly on Dialog; " + + "Open button did not gain focus on tab press when parent frame is visible"); + + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + secondFrame.checkUnblockedFrame(robot, + "A document modal dialog and its parent are visible."); + secondWindow.checkUnblockedWindow(robot, + "A Frame and a document modal Dialog are visible."); + + if (root == Parent.DIALOG) { + parentDialog.checkBlockedDialog(robot, "Dialog is a parent of a document modal dialog."); + } else { //Parent.FRAME + parentFrame.checkBlockedFrame(robot, "Frame is a parent of a document modal dialog."); + } + + secondDialog.checkBlockedDialog(robot, + "The parent of the Dialog is also the parent of a document modal dialog"); + window.checkBlockedWindow(robot, + "The parent of the Window is also the parent of a document modal dialog"); + + childWindow.checkUnblockedWindow(robot, + "The parent of the Window is a document modal dialog"); + childDialog.checkUnblockedDialog(robot, + "The parent of the Dialog is a document modal dialog"); + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + for (Window w: allWindows) { + if (w != null) { w.dispose(); } + } + } + + class ParentDialog extends TestDialog { + + public ParentDialog(Dialog d) { super(d); } + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } + + class ParentFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog d) { super(d); } + public CustomDialog(Frame f) { super(f); } + + @Override + public void doOpenAction() { + if (secondFrame != null) { secondFrame.setVisible(true); } + if (secondWindow != null) { secondWindow.setVisible(true); } + if (secondDialog != null) { secondDialog.setVisible(true); } + if (window != null) { window.setVisible(true); } + if (childWindow != null) { childWindow.setVisible(true); } + if (childDialog != null) { childDialog.setVisible(true); } + } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java new file mode 100644 index 00000000000..c4b7e366e42 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a null Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsSetModal1Test + */ + +public class BlockingWindowsSetModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest( + BlockingWindowsTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java new file mode 100644 index 00000000000..5eccd050d8b --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a null Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsSetModal2Test + */ + +public class BlockingWindowsSetModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest( + BlockingWindowsTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java new file mode 100644 index 00000000000..7bfdc05ee95 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a hidden Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsSetModal3Test + */ + +public class BlockingWindowsSetModal3Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest( + BlockingWindowsTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java new file mode 100644 index 00000000000..1019335ec6d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a hidden Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsSetModal4Test + */ + +public class BlockingWindowsSetModal4Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest( + BlockingWindowsTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java new file mode 100644 index 00000000000..067cd4e0f4a --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsSetModal5Test + */ + +public class BlockingWindowsSetModal5Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest( + BlockingWindowsTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java new file mode 100644 index 00000000000..57d43ca3043 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog created with a Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsSetModal6Test + */ + +public class BlockingWindowsSetModal6Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest( + BlockingWindowsTest.DialogOwner.DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsTest.java new file mode 100644 index 00000000000..74e71a745dc --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsTest.java @@ -0,0 +1,299 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import static jdk.testlibrary.Asserts.*; + +import java.awt.*; +import java.util.List; +import java.util.ArrayList; + +public class BlockingWindowsTest { + + private TestDialog dialog, childDialog, secondDialog, dummyDialog, parentDialog; + private TestFrame frame, secondFrame; + private TestWindow window, childWindow; + + private static final int delay = 500; + private final ExtendedRobot robot; + + private List allWindows; + + private Dialog hiddenDialog; + private Frame hiddenFrame; + + private Dialog.ModalityType modalityType; + + public enum DialogOwner {HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, DIALOG, FRAME}; + + private BlockingWindowsTest(Dialog.ModalityType modType, + boolean setModal, + DialogOwner owner) throws Exception { + + modalityType = modType; + robot = new ExtendedRobot(); + EventQueue.invokeLater(() -> { + createGUI(setModal, owner); + }); + } + + public BlockingWindowsTest( + Dialog.ModalityType modalityType, DialogOwner owner) throws Exception { + this(modalityType, false, owner); + } + + public BlockingWindowsTest(DialogOwner owner) throws Exception { + this(null, true, owner); + } + + private void createGUI(boolean setModal, + DialogOwner owner) { + + allWindows = new ArrayList<>(); + + if (owner != DialogOwner.DIALOG) { + frame = new CustomFrame(); + frame.setLocation(50, 50); + frame.setVisible(true); + allWindows.add(frame); + } + + switch (owner) { + case DIALOG: + parentDialog = new ParentDialog((Dialog) null); + parentDialog.setLocation(50, 50); + parentDialog.setVisible(true); + allWindows.add(parentDialog); + dialog = new CustomDialog(parentDialog); + break; + case FRAME: + dialog = new CustomDialog(frame); + break; + case HIDDEN_DIALOG: + hiddenDialog = new Dialog((Frame) null); + dialog = new CustomDialog(hiddenDialog); + allWindows.add(hiddenDialog); + break; + case NULL_DIALOG: + dialog = new CustomDialog((Dialog) null); + break; + case HIDDEN_FRAME: + hiddenFrame = new Frame(); + dialog = new CustomDialog(hiddenFrame); + allWindows.add(hiddenFrame); + break; + case NULL_FRAME: + dialog = new CustomDialog((Frame) null); + break; + } + + assertFalse(dialog == null, "error: null dialog"); + + if (setModal) { + dialog.setModal(true); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + dialog.setLocation(250, 50); + allWindows.add(dialog); + + if (owner == DialogOwner.DIALOG) { + window = new TestWindow(parentDialog); + } else { + window = new TestWindow(frame); + } + + window.setLocation(50, 250); + allWindows.add(window); + + if (owner == DialogOwner.DIALOG) { + dummyDialog = new TestDialog(parentDialog); + } else { + dummyDialog = new TestDialog(frame); + } + dummyDialog.setLocation(450, 450); + allWindows.add(dummyDialog); + + childWindow = new CustomWindow(dialog); + childWindow.setLocation(450, 50); + allWindows.add(childWindow); + + childDialog = new TestDialog(dialog); + childDialog.setLocation(450, 250); + allWindows.add(childDialog); + + if (owner == DialogOwner.DIALOG) { + secondDialog = new CustomDialog(parentDialog); + } else { + secondDialog = new CustomDialog(frame); + } + if (setModal) { + secondDialog.setModal(true); + } else if (modalityType != null) { + secondDialog.setModalityType(modalityType); + } + + secondDialog.setLocation(50, 450); + allWindows.add(secondDialog); + + secondFrame = new TestFrame(); + secondFrame.setLocation(250, 450); + allWindows.add(secondFrame); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + if (parentDialog == null) { frame.clickOpenButton(robot); } + else { parentDialog.clickOpenButton(robot); } + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "The first button did not gain focus " + + "when the dialog became visible"); + + assertTrue(dialog.closeButton.hasFocus(), "The first dialog button " + + "gained focus, but lost it afterwards"); + + if (parentDialog == null) { + frame.checkBlockedFrame(robot, modalityType + " Dialog is visible."); + } else { + parentDialog.checkBlockedDialog(robot, modalityType + " Dialog is visible."); + } + + dialog.checkUnblockedDialog(robot, "A Frame is visible."); + + dialog.openClicked.reset(); + dialog.clickOpenButton(robot); + robot.waitForIdle(delay); + + assertFalse(window.focusGained.flag(), "Window gained focus on becoming " + + "visible when Frame and Dialog are visible"); + + window.checkBlockedWindow(robot, + "The parent of the Window is blocked by " + modalityType + " Dialog."); + + dummyDialog.checkBlockedDialog(robot, + "The parent of the Dialog is blocked by " + modalityType + " Dialog."); + + childDialog.checkUnblockedDialog(robot, + "The parent of the Dialog is " + modalityType + " Dialog"); + + childWindow.checkUnblockedWindow(robot, + "The parent of the Window is " + modalityType + " Dialog"); + + childWindow.openClicked.reset(); + childWindow.clickOpenButton(robot); + robot.waitForIdle(delay); + + secondDialog.checkUnblockedDialog(robot, + "The dialog is " + modalityType + ", the parent of the dialog " + + "is blocked by another " + modalityType + " dialog."); + + secondFrame.checkBlockedFrame(robot, + modalityType + " dialog is displayed immediately after showing " + + "this frame. Another modal dialog is alreay visible"); + + secondDialog.clickCloseButton(robot); + robot.waitForIdle(delay); + + childWindow.checkUnblockedWindow(robot, "A blocking dialog was closed."); + robot.waitForIdle(delay); + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + for (Window w: allWindows) { + if (w != null) { w.dispose(); } + } + } + + + class CustomFrame extends TestFrame { + + @Override + public void doOpenAction() { + if (dialog != null) { dialog.setVisible(true); } + } + } + + class CustomDialog extends TestDialog { + + public CustomDialog(Dialog dialog) { + super(dialog); + } + + public CustomDialog(Frame frame) { + super(frame); + } + + @Override + public void doOpenAction() { + if (window != null) { window.setVisible(true); } + if (dummyDialog != null) { dummyDialog.setVisible(true); } + if (childWindow != null) { childWindow.setVisible(true); } + if (childDialog != null) { childDialog.setVisible(true); } + } + + @Override + public void doCloseAction() { + this.dispose(); + } + } + + class CustomWindow extends TestWindow { + + public CustomWindow(Window parent) { + super(parent); + } + + @Override + public void doOpenAction() { + if (secondFrame != null) { secondFrame.setVisible(true); } + if (secondDialog != null) { secondDialog.setVisible(true); } + } + } + + class ParentDialog extends TestDialog { + + public ParentDialog(Dialog d) { super(d); } + + @Override + public void doOpenAction() { + if (dialog != null) { + dialog.setVisible(true); + } + } + } +} + diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java new file mode 100644 index 00000000000..0a9d6a18ba0 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a null Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsToolkitModal1Test + */ + +public class BlockingWindowsToolkitModal1Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL, + BlockingWindowsTest.DialogOwner.NULL_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java new file mode 100644 index 00000000000..32080274b9d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a null Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsToolkitModal2Test + */ + +public class BlockingWindowsToolkitModal2Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL, + BlockingWindowsTest.DialogOwner.NULL_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java new file mode 100644 index 00000000000..6b4aaf7e5c7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a hidden Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsToolkitModal3Test + */ + +public class BlockingWindowsToolkitModal3Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL, + BlockingWindowsTest.DialogOwner.HIDDEN_FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java new file mode 100644 index 00000000000..f8ddae7c0d7 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a hidden Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsToolkitModal4Test + */ + +public class BlockingWindowsToolkitModal4Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL, + BlockingWindowsTest.DialogOwner.HIDDEN_DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java new file mode 100644 index 00000000000..cb55619792e --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a Frame + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsToolkitModal5Test + */ + +public class BlockingWindowsToolkitModal5Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL, + BlockingWindowsTest.DialogOwner.FRAME)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java new file mode 100644 index 00000000000..6407def149e --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog created with a Dialog + * constructor receives focus; whether its components receive focus + * and respond to key events, when there are other windows shown. + * Also check the correctness of blocking behavior for other windows shown. + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @build TestFrame + * @build TestWindow + * @run main BlockingWindowsToolkitModal6Test + */ + +public class BlockingWindowsToolkitModal6Test { + + public static void main(String[] args) throws Exception { + (new BlockingWindowsTest(Dialog.ModalityType.TOOLKIT_MODAL, + BlockingWindowsTest.DialogOwner.DIALOG)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java new file mode 100644 index 00000000000..81965d281b2 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether an application modal Dialog receives focus; check + * if its components receive focus and respond to key events + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main UnblockedDialogAppModalTest + */ + +public class UnblockedDialogAppModalTest { + + public static void main(String[] args) throws Exception { + (new UnblockedDialogTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java new file mode 100644 index 00000000000..ce4fb9d302f --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a document modal Dialog receives focus; check + * if its components receive focus and respond to key events + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main UnblockedDialogDocModalTest + */ + +public class UnblockedDialogDocModalTest { + + public static void main(String[] args) throws Exception { + (new UnblockedDialogTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java new file mode 100644 index 00000000000..e566b718e3b --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a modeless Dialog receives focus; check + * if its components receive focus and respond to key events + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main UnblockedDialogModelessTest + */ + +public class UnblockedDialogModelessTest { + + public static void main(String[] args) throws Exception { + (new UnblockedDialogTest(Dialog.ModalityType.MODELESS)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java new file mode 100644 index 00000000000..664ddc709f8 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a non-modal Dialog receives focus; check + * if its components receive focus and respond to key events + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main UnblockedDialogNonModalTest + */ + +public class UnblockedDialogNonModalTest { + + public static void main(String[] args) throws Exception { + (new UnblockedDialogTest(null)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java new file mode 100644 index 00000000000..4c7996b496d --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * @test + * @bug 8049617 + * @summary Check whether a modal Dialog receives focus; check + * if its components receive focus and respond to key events + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main UnblockedDialogSetModalTest + */ + +public class UnblockedDialogSetModalTest { + + public static void main(String[] args) throws Exception { + (new UnblockedDialogTest()).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogTest.java new file mode 100644 index 00000000000..1406a145dee --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogTest.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.*; +import static jdk.testlibrary.Asserts.*; + + +public class UnblockedDialogTest { + + private TestDialog dialog; + + private static final int delay = 500; + private final ExtendedRobot robot; + + private Dialog parentDialog; + private Frame parentFrame; + + private enum DialogOwner {HIDDEN_DIALOG, HIDDEN_FRAME, NULL_DIALOG, NULL_FRAME}; + + Dialog.ModalityType modalityType; + boolean setModal; + + private UnblockedDialogTest(Dialog.ModalityType modType, + boolean set) throws Exception { + + robot = new ExtendedRobot(); + modalityType = modType; + setModal = set; + } + + public UnblockedDialogTest(Dialog.ModalityType modType) throws Exception { + this(modType, false); + } + + public UnblockedDialogTest() throws Exception { this(null, true); } + + + private void createGUI(DialogOwner owner) { + + switch (owner) { + case HIDDEN_DIALOG: + parentDialog = new Dialog((Frame) null); + dialog = new TestDialog(parentDialog); + break; + case NULL_DIALOG: + dialog = new TestDialog((Dialog) null); + break; + case HIDDEN_FRAME: + parentFrame = new Frame(); + dialog = new TestDialog(parentFrame); + break; + case NULL_FRAME: + dialog = new TestDialog((Frame) null); + break; + } + + assertFalse(dialog == null, "error: null dialog"); + + dialog.setLocation(50, 50); + if (setModal) { + dialog.setModal(true); + } else if (modalityType != null) { + dialog.setModalityType(modalityType); + } + + dialog.setVisible(true); + } + + public void doTest() throws Exception { + + try { + + robot.waitForIdle(delay); + + for (DialogOwner owner: DialogOwner.values()) { + + EventQueue.invokeLater(() -> { createGUI(owner); }); + + robot.waitForIdle(delay); + + dialog.activated.waitForFlagTriggered(); + assertTrue(dialog.activated.flag(), "Dialog did not trigger " + + "Window Activated event when it became visible"); + + dialog.closeGained.waitForFlagTriggered(); + assertTrue(dialog.closeGained.flag(), "The 1st button did not " + + "gain focus when the dialog became visible"); + + dialog.checkUnblockedDialog(robot, ""); + robot.waitForIdle(delay); + } + + } finally { + EventQueue.invokeAndWait(this::closeAll); + } + } + + private void closeAll() { + if (dialog != null) { dialog.dispose(); } + if (parentDialog != null) { parentDialog.dispose(); } + if (parentFrame != null) { parentFrame.dispose(); } + } +} diff --git a/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java new file mode 100644 index 00000000000..213d0297385 --- /dev/null +++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; + +/* + * @test + * @bug 8049617 + * @summary Check whether a toolkit modal Dialog receives focus; check + * if its components receive focus and respond to key events + * + * @library ../helpers ../../../../lib/testlibrary/ + * @build ExtendedRobot + * @build Flag + * @build TestDialog + * @run main UnblockedDialogToolkitModalTest + */ + +public class UnblockedDialogToolkitModalTest { + + public static void main(String[] args) throws Exception { + (new UnblockedDialogTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); + } +} diff --git a/jdk/test/java/awt/Modal/helpers/TestFrame.java b/jdk/test/java/awt/Modal/helpers/TestFrame.java index 7af2a3bf686..cbe0feac0c6 100644 --- a/jdk/test/java/awt/Modal/helpers/TestFrame.java +++ b/jdk/test/java/awt/Modal/helpers/TestFrame.java @@ -292,13 +292,13 @@ public class TestFrame extends Frame implements ActionListener, robot.waitForIdle(delay); assertFalse(dummyClicked.flag(), - "DummyButton on blocked Window triggered action when clicked. " + message); + "DummyButton on blocked Frame triggered action when clicked. " + message); assertFalse(dummyGained.flag(), - "DummyButton on blocked Window gained focus when clicked. " + message); + "DummyButton on blocked Frame gained focus when clicked. " + message); assertFalse(focusGained.flag(), - "A blocked Dialog gained focus when component clicked. " + message); + "A blocked Frame gained focus when component clicked. " + message); } public void checkUnblockedFrame(ExtendedRobot robot, From 0f6c52abb1e859e11209f060726954d433fe4544 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 21 Jul 2014 22:09:38 +0800 Subject: [PATCH 059/166] 8049834: Two security tools tests do not run with only JRE Reviewed-by: mullan --- .../tools/jarsigner/default_options.sh | 64 +++++++++++++++++++ .../tools/{keytool => jarsigner}/weaksize.sh | 0 .../security/tools/keytool/default_options.sh | 21 ------ 3 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 jdk/test/sun/security/tools/jarsigner/default_options.sh rename jdk/test/sun/security/tools/{keytool => jarsigner}/weaksize.sh (100%) diff --git a/jdk/test/sun/security/tools/jarsigner/default_options.sh b/jdk/test/sun/security/tools/jarsigner/default_options.sh new file mode 100644 index 00000000000..ca946bb9cb3 --- /dev/null +++ b/jdk/test/sun/security/tools/jarsigner/default_options.sh @@ -0,0 +1,64 @@ +# +# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8049834 +# @summary Two security tools tests do not run with only JRE +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +KS=ks +KEYTOOL="$TESTJAVA/bin/keytool ${TESTTOOLVMOPTS}" +JAR="$TESTJAVA/bin/jar ${TESTTOOLVMOPTS}" +JARSIGNER="$TESTJAVA/bin/jarsigner ${TESTTOOLVMOPTS}" + +rm $KS 2> /dev/null + +PASS=changeit +export PASS + +$KEYTOOL -genkeypair -dname CN=A -alias a \ + -storepass:env PASS -keypass:env PASS -keystore $KS \ + -keyalg rsa || exit 1 + +cat < js.conf +jarsigner.all = -keystore \${user.dir}/$KS -storepass:env PASS -debug -strict +jarsigner.sign = -digestalg SHA1 +jarsigner.verify = -verbose:summary + +EOF + +$JAR cvf a.jar ks js.conf + +$JARSIGNER -conf js.conf a.jar a || exit 21 +$JARSIGNER -conf js.conf -verify a.jar > jarsigner.out || exit 22 +grep "and 1 more" jarsigner.out || exit 23 +$JAR xvf a.jar META-INF/MANIFEST.MF +grep "SHA1-Digest" META-INF/MANIFEST.MF || exit 24 + +echo Done +exit 0 diff --git a/jdk/test/sun/security/tools/keytool/weaksize.sh b/jdk/test/sun/security/tools/jarsigner/weaksize.sh similarity index 100% rename from jdk/test/sun/security/tools/keytool/weaksize.sh rename to jdk/test/sun/security/tools/jarsigner/weaksize.sh diff --git a/jdk/test/sun/security/tools/keytool/default_options.sh b/jdk/test/sun/security/tools/keytool/default_options.sh index 5dc9894efee..182b3a202c4 100644 --- a/jdk/test/sun/security/tools/keytool/default_options.sh +++ b/jdk/test/sun/security/tools/keytool/default_options.sh @@ -33,16 +33,12 @@ fi KS=ks KEYTOOL="$TESTJAVA/bin/keytool ${TESTTOOLVMOPTS}" -JAR="$TESTJAVA/bin/jar ${TESTTOOLVMOPTS}" -JARSIGNER="$TESTJAVA/bin/jarsigner ${TESTTOOLVMOPTS}" rm $KS 2> /dev/null PASS=changeit export PASS -# keytool - cat < kt.conf # A Pre-configured options file keytool.all = -storepass:env PASS -keypass:env PASS -keystore \${user.dir}/$KS -debug @@ -69,23 +65,6 @@ $KEYTOOL -conf kt.conf -delete -alias a && exit 16 # Single-valued option on command line overrides again $KEYTOOL -conf kt.conf -delete -alias b -keystore $KS || exit 17 -# jarsigner - -cat < js.conf -jarsigner.all = -keystore \${user.dir}/$KS -storepass:env PASS -debug -strict -jarsigner.sign = -digestalg SHA1 -jarsigner.verify = -verbose:summary - -EOF - -$JAR cvf a.jar ks js.conf kt.conf - -$JARSIGNER -conf js.conf a.jar a || exit 21 -$JARSIGNER -conf js.conf -verify a.jar > jarsigner.out || exit 22 -grep "and 2 more" jarsigner.out || exit 23 -$JAR xvf a.jar META-INF/MANIFEST.MF -grep "SHA1-Digest" META-INF/MANIFEST.MF || exit 24 - # Error cases # File does not exist From 72ae973a310df8390cf8f4c6cf34efa16f7bee15 Mon Sep 17 00:00:00 2001 From: Yuri Nesterenko Date: Mon, 21 Jul 2014 18:10:13 +0400 Subject: [PATCH 060/166] 8051440: move tests about maximizing undecorated to OpenJDK Reviewed-by: serb --- .../MaximizedUndecorated.java | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 jdk/test/java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java diff --git a/jdk/test/java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java b/jdk/test/java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java new file mode 100644 index 00000000000..62e80101c26 --- /dev/null +++ b/jdk/test/java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import javax.swing.JFrame; +import java.awt.GraphicsEnvironment; +import java.awt.Toolkit; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Rectangle; +import java.lang.reflect.InvocationTargetException; +/* + * @test + * @bug 8022302 + * @summary Set extendedState Frame.MAXIMIZED_BOTH for undecorated Frame and JFrame. + * Check if resulted size is equal to GraphicsEnvironment.getMaximumWindowBounds(). + * + * @library ../../../../lib/testlibrary + * @build ExtendedRobot + * @run main MaximizedUndecorated + */ + + +public class MaximizedUndecorated { + private Frame frame; + private ExtendedRobot robot; + public static void main(String args[]) { + if (!Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { + return; + } + MaximizedUndecorated test = new MaximizedUndecorated(); + boolean doPass = true; + try{ + if( !test.doTest(true) ) { + System.out.println("Actual bounds differ from Maximum Window Bounds for JFrame"); + doPass = false; + } + if( !test.doTest(false) ) { + System.out.println("Actual bounds differ from Maximum Window Bounds for Frame"); + doPass = false; + } + }catch(Exception ie) { + ie.printStackTrace(); + throw new RuntimeException("Interrupted or InvocationTargetException occured"); + } + if(!doPass) { + throw new RuntimeException("Actual bounds of undecorated frame differ from Maximum Windows Bounds for this platform"); + } + } + MaximizedUndecorated() { + try { + robot = new ExtendedRobot(); + }catch(Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Cannot create robot"); + } + } + boolean doTest(boolean swingFrame) throws InterruptedException, InvocationTargetException { + EventQueue.invokeAndWait( () -> { + frame = swingFrame? new JFrame("Test Frame") : new Frame("Test Frame"); + frame.setLayout(new FlowLayout()); + frame.setBounds(50,50,300,300); + frame.setUndecorated(true); + frame.setVisible(true); + }); + robot.waitForIdle(2000); + EventQueue.invokeAndWait( () -> { + frame.setExtendedState(Frame.MAXIMIZED_BOTH); + }); + robot.waitForIdle(2000); + Rectangle actualBounds = frame.getBounds(); + Rectangle expectedBounds = GraphicsEnvironment. + getLocalGraphicsEnvironment().getMaximumWindowBounds(); + EventQueue.invokeAndWait( () -> { + frame.dispose(); + }); + + return actualBounds.equals(expectedBounds); + } +} From d99124eadba4163c3354c9c95248360b7bae264f Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 21 Jul 2014 22:10:37 +0800 Subject: [PATCH 061/166] 8048194: GSSContext.acceptSecContext fails when a supported mech is not initiator preferred Reviewed-by: mullan --- .../security/jgss/spnego/SpNegoContext.java | 45 ++++++-- .../jgss/spnego/NotPreferredMech.java | 100 ++++++++++++++++++ 2 files changed, 134 insertions(+), 11 deletions(-) create mode 100644 jdk/test/sun/security/jgss/spnego/NotPreferredMech.java diff --git a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java index 1c66bf53897..2390639537b 100644 --- a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java +++ b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java @@ -523,13 +523,6 @@ public class SpNegoContext implements GSSContextSpi { valid = false; } - // get the mechanism token - byte[] mechToken = initToken.getMechToken(); - if (mechToken == null) { - throw new GSSException(GSSException.FAILURE, -1, - "mechToken is missing"); - } - /* * Select the best match between the list of mechs * that the initiator requested and the list that @@ -545,7 +538,19 @@ public class SpNegoContext implements GSSContextSpi { internal_mech = mech_wanted; // get the token for mechanism - byte[] accept_token = GSS_acceptSecContext(mechToken); + byte[] accept_token; + + if (mechList[0].equals(mech_wanted)) { + // get the mechanism token + byte[] mechToken = initToken.getMechToken(); + if (mechToken == null) { + throw new GSSException(GSSException.FAILURE, -1, + "mechToken is missing"); + } + accept_token = GSS_acceptSecContext(mechToken); + } else { + accept_token = null; + } // verify MIC if (!GSSUtil.useMSInterop() && valid) { @@ -594,9 +599,27 @@ public class SpNegoContext implements GSSContextSpi { retVal = targToken.getEncoded(); } else if (state == STATE_IN_PROCESS) { + // read data + byte[] token = new byte[is.available()]; + SpNegoToken.readFully(is, token); + if (DEBUG) { + System.out.println("SpNegoContext.acceptSecContext: " + + "receiving token = " + + SpNegoToken.getHexBytes(token)); + } + + // read the SPNEGO token + // token will be validated when parsing + NegTokenTarg inputToken = new NegTokenTarg(token); + + if (DEBUG) { + System.out.println("SpNegoContext.acceptSecContext: " + + "received token of type = " + + SpNegoToken.getTokenName(inputToken.getType())); + } + // read the token - byte[] client_token = new byte[is.available()]; - SpNegoToken.readFully(is, client_token); + byte[] client_token = inputToken.getResponseToken(); byte[] accept_token = GSS_acceptSecContext(client_token); if (accept_token == null) { valid = false; @@ -1055,7 +1078,7 @@ public class SpNegoContext implements GSSContextSpi { * This is only valid on the acceptor side of the context. * @return GSSCredentialSpi object for the delegated credential * @exception GSSException - * @see GSSContext#getDelegCredState + * @see GSSContext#getCredDelegState */ public final GSSCredentialSpi getDelegCred() throws GSSException { if (state != STATE_IN_PROCESS && state != STATE_DONE) diff --git a/jdk/test/sun/security/jgss/spnego/NotPreferredMech.java b/jdk/test/sun/security/jgss/spnego/NotPreferredMech.java new file mode 100644 index 00000000000..5eb8150d265 --- /dev/null +++ b/jdk/test/sun/security/jgss/spnego/NotPreferredMech.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8048194 + * @run main/othervm NotPreferredMech + * @summary GSSContext.acceptSecContext fails when a supported mech is not initiator preferred + */ + +import org.ietf.jgss.*; +import sun.security.jgss.*; +import sun.security.jgss.spnego.NegTokenInit; +import sun.security.jgss.spnego.NegTokenTarg; +import sun.security.util.BitArray; +import sun.security.util.DerOutputStream; +import sun.security.util.DerValue; +import sun.security.util.ObjectIdentifier; + +import java.io.ByteArrayOutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; + +public class NotPreferredMech { + + public static void main(String[] argv) throws Exception { + + // Generates a NegTokenInit mechTypes field, with an + // unsupported mech as the preferred. + DerOutputStream mech = new DerOutputStream(); + mech.write(new Oid("1.2.3.4").getDER()); + mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); + DerOutputStream mechTypeList = new DerOutputStream(); + mechTypeList.write(DerValue.tag_Sequence, mech); + + // Generates a NegTokenInit mechToken field for 1.2.3.4 mech + GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + h1.encode(bout); + bout.write(new byte[1]); + + // Generates the NegTokenInit token + Constructor ctor = NegTokenInit.class.getDeclaredConstructor( + byte[].class, BitArray.class, byte[].class, byte[].class); + ctor.setAccessible(true); + NegTokenInit initToken = ctor.newInstance( + mechTypeList.toByteArray(), + new BitArray(0), + bout.toByteArray(), + null); + Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") + .getDeclaredMethod("getEncoded"); + m.setAccessible(true); + byte[] spnegoToken = (byte[])m.invoke(initToken); + + // and wraps it into a GSSToken + GSSHeader h = new GSSHeader( + new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), + spnegoToken.length); + bout = new ByteArrayOutputStream(); + h.encode(bout); + bout.write(spnegoToken); + byte[] token = bout.toByteArray(); + + // and feeds it to a GSS acceptor + GSSManager man = GSSManager.getInstance(); + GSSContext ctxt = man.createContext((GSSCredential) null); + token = ctxt.acceptSecContext(token, 0, token.length); + NegTokenTarg targ = new NegTokenTarg(token); + + // Make sure it's a GO-ON message + Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); + m2.setAccessible(true); + int negResult = (int)m2.invoke(targ); + + if (negResult != 1 /* ACCEPT_INCOMPLETE */) { + throw new Exception("Not a continue"); + } + } +} From df01b0f397e10715da829c78a7c8d44f37712738 Mon Sep 17 00:00:00 2001 From: Petr Pchelko Date: Mon, 21 Jul 2014 21:41:11 +0400 Subject: [PATCH 062/166] 8046884: JNI exception pending in jdk/src/solaris/native/sun/java2d/x11: X11PMPLitLoops.c, X11SurfaceData.c Reviewed-by: prr, serb --- .../native/sun/java2d/x11/X11PMBlitLoops.c | 19 ++++++++++++++----- .../native/sun/java2d/x11/X11SurfaceData.c | 18 +++++++++++++++--- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c b/jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c index 6b35df41414..c94d58b8a62 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c +++ b/jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c @@ -241,9 +241,12 @@ Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask width, height, 1); if (xsdo->bitmask == 0) { AWT_UNLOCK(); - JNU_ThrowOutOfMemoryError(env, - "Cannot create bitmask for " - "offscreen surface"); + if (!(*env)->ExceptionCheck(env)) + { + JNU_ThrowOutOfMemoryError(env, + "Cannot create bitmask for " + "offscreen surface"); + } return; } } @@ -253,7 +256,10 @@ Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask 1, XYBitmap, 0, NULL, width, height, 32, 0); if (image == NULL) { AWT_UNLOCK(); - JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask"); + if (!(*env)->ExceptionCheck(env)) + { + JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask"); + } return; } dstScan = image->bytes_per_line; @@ -261,7 +267,10 @@ Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask if (image->data == NULL) { XFree(image); AWT_UNLOCK(); - JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask"); + if (!(*env)->ExceptionCheck(env)) + { + JNU_ThrowOutOfMemoryError(env, "Cannot allocate bitmask for mask"); + } return; } pDst = (unsigned char *)image->data; diff --git a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c index eb82d64a921..d9af8ddf6e1 100644 --- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c +++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c @@ -454,6 +454,7 @@ jboolean XShared_initSurface(JNIEnv *env, X11SDOps *xsdo, jint depth, jint width AWT_LOCK(); xsdo->drawable = X11SD_CreateSharedPixmap(xsdo); AWT_UNLOCK(); + JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE); if (xsdo->drawable) { xsdo->shmPMData.usingShmPixmap = JNI_TRUE; xsdo->shmPMData.shmPixmap = xsdo->drawable; @@ -469,6 +470,7 @@ jboolean XShared_initSurface(JNIEnv *env, X11SDOps *xsdo, jint depth, jint width xsdo->configData->awt_visInfo.screen), width, height, depth); AWT_UNLOCK(); + JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE); #ifdef MITSHM xsdo->shmPMData.usingShmPixmap = JNI_FALSE; xsdo->shmPMData.pixmap = xsdo->drawable; @@ -504,6 +506,7 @@ Java_sun_java2d_x11_X11SurfaceData_initSurface(JNIEnv *env, jclass xsd, if (xsdo->configData->awt_cmap == (Colormap)NULL) { awtJNI_CreateColorData(env, xsdo->configData, 1); + JNU_CHECK_EXCEPTION(env); } /* color_data will be initialized in awtJNI_CreateColorData for 8-bit visuals */ @@ -805,7 +808,10 @@ static jint X11SD_Lock(JNIEnv *env, xsdo->cData->awt_icmLUT == NULL)) { AWT_UNLOCK(); - JNU_ThrowNullPointerException(env, "colormap lookup table"); + if (!(*env)->ExceptionCheck(env)) + { + JNU_ThrowNullPointerException(env, "colormap lookup table"); + } return SD_FAILURE; } if ((lockflags & SD_LOCK_INVCOLOR) != 0 && @@ -816,7 +822,10 @@ static jint X11SD_Lock(JNIEnv *env, xsdo->cData->img_oda_blue == NULL)) { AWT_UNLOCK(); - JNU_ThrowNullPointerException(env, "inverse colormap lookup table"); + if (!(*env)->ExceptionCheck(env)) + { + JNU_ThrowNullPointerException(env, "inverse colormap lookup table"); + } return SD_FAILURE; } if ((lockflags & SD_LOCK_INVGRAY) != 0 && @@ -824,7 +833,10 @@ static jint X11SD_Lock(JNIEnv *env, xsdo->cData->pGrayInverseLutData == NULL)) { AWT_UNLOCK(); - JNU_ThrowNullPointerException(env, "inverse gray lookup table"); + if (!(*env)->ExceptionCheck(env)) + { + JNU_ThrowNullPointerException(env, "inverse gray lookup table"); + } return SD_FAILURE; } if (xsdo->dgaAvailable && (lockflags & (SD_LOCK_RD_WR))) { From d20e70b9cc1e6a19a89ba89b2f86aa48cba36a6a Mon Sep 17 00:00:00 2001 From: Aleksei Efimov Date: Tue, 22 Jul 2014 22:06:52 +0400 Subject: [PATCH 063/166] 8029837: NPE seen in XMLDocumentFragmentScannerImpl.setProperty since 7u40b33 Reviewed-by: joehw --- .../bind/xjc/8029837/PreParseGrammarTest.java | 58 +++++++++++++++++++ jdk/test/javax/xml/bind/xjc/8029837/test.xsd | 4 ++ 2 files changed, 62 insertions(+) create mode 100644 jdk/test/javax/xml/bind/xjc/8029837/PreParseGrammarTest.java create mode 100644 jdk/test/javax/xml/bind/xjc/8029837/test.xsd diff --git a/jdk/test/javax/xml/bind/xjc/8029837/PreParseGrammarTest.java b/jdk/test/javax/xml/bind/xjc/8029837/PreParseGrammarTest.java new file mode 100644 index 00000000000..ae626504651 --- /dev/null +++ b/jdk/test/javax/xml/bind/xjc/8029837/PreParseGrammarTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8029837 + * @summary Test simulates the partial call to xjc ant task that fails with + * NullPointer exception + * @run main/othervm PreParseGrammarTest + */ + +import com.sun.org.apache.xerces.internal.parsers.XMLGrammarPreparser; +import com.sun.org.apache.xerces.internal.xni.XNIException; +import com.sun.org.apache.xerces.internal.xni.grammars.Grammar; +import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription; +import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +public class PreParseGrammarTest { + + public static void main(String[] args) throws FileNotFoundException, XNIException, IOException { + File xsdf = new File(System.getProperty("test.src", ".") + "/test.xsd"); + InputStream is = new BufferedInputStream(new FileInputStream(xsdf)); + XMLInputSource xis = new XMLInputSource(null, null, null, is, null); + XMLGrammarPreparser gp = new XMLGrammarPreparser(); + gp.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); + //The NullPointerException is observed on next call during ant task + // execution + Grammar res = gp.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, xis); + System.out.println("Grammar preparsed successfully:" + res); + return; + } +} diff --git a/jdk/test/javax/xml/bind/xjc/8029837/test.xsd b/jdk/test/javax/xml/bind/xjc/8029837/test.xsd new file mode 100644 index 00000000000..f7ee730e98a --- /dev/null +++ b/jdk/test/javax/xml/bind/xjc/8029837/test.xsd @@ -0,0 +1,4 @@ + + + + From 744f8147aec8b515be9de8149b7147b55c22a169 Mon Sep 17 00:00:00 2001 From: Mike Duigou Date: Tue, 22 Jul 2014 13:13:27 -0700 Subject: [PATCH 064/166] 6721085: Fix broken link to Collections Framework Tutorial Reviewed-by: lancea --- jdk/src/share/classes/java/util/package.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/util/package.html b/jdk/src/share/classes/java/util/package.html index abcf84bef43..eb77a146b0f 100644 --- a/jdk/src/share/classes/java/util/package.html +++ b/jdk/src/share/classes/java/util/package.html @@ -43,7 +43,7 @@ classes (a string tokenizer, a random-number generator, and a bit array).

    Related Documentation

    For overviews, tutorials, examples, guides, and tool documentation, please see: