--- a/jdk/make/CopyFiles.gmk Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/CopyFiles.gmk Tue Jul 29 09:09:55 2014 -0700
@@ -122,7 +122,7 @@
##########################################################################################
#
-# Copy flavormap.properties, cursor.properties and cursors gif files to LIBDIR
+# Copy cursor.properties and cursors gif files to LIBDIR
#
ifneq ($(OPENJDK_TARGET_OS), macosx)
OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
@@ -130,11 +130,6 @@
OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/macosx/lib
endif
-$(LIBDIR)/flavormap.properties: $(OPENJDK_TARGET_OS_LIB_SRC)/flavormap.properties
- $(call install-file)
-
-COPY_FILES += $(LIBDIR)/flavormap.properties
-
CURSORS_DEST_DIR = $(LIBDIR)/images/cursors
CURSORS_OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib/images/cursors
--- a/jdk/make/CopyIntoClasses.gmk Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/CopyIntoClasses.gmk Tue Jul 29 09:09:55 2014 -0700
@@ -163,6 +163,19 @@
################################################################################
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ OPENJDK_TARGET_OS_FLAVORMAP_PROPERTIES = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/datatransfer/flavormap.properties
+else
+ OPENJDK_TARGET_OS_FLAVORMAP_PROPERTIES = $(JDK_TOPDIR)/src/macosx/classes/sun/awt/datatransfer/flavormap.properties
+endif
+
+$(JDK_OUTPUTDIR)/classes/sun/awt/datatransfer/flavormap.properties: $(OPENJDK_TARGET_OS_FLAVORMAP_PROPERTIES)
+ $(install-file)
+
+COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/sun/awt/datatransfer/flavormap.properties
+
+################################################################################
+
CLEAN_FILES := $(wildcard \
$(JDK_TOPDIR)/src/share/classes/com/sun/imageio/plugins/common/*.properties \
$(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/*.properties \
--- a/jdk/make/data/swingbeaninfo/SwingBeanInfo.template Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/data/swingbeaninfo/SwingBeanInfo.template Tue Jul 29 09:09:55 2014 -0700
@@ -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,7 +42,7 @@
*/
public class @(BeanClassName)BeanInfo extends javax.swing.SwingBeanInfoBase {
- private static final Class class@(BeanClassName) = @(BeanClassObject);
+ private static final Class<?> class@(BeanClassName) = @(BeanClassObject);
/**
* @return a @(BeanClassName) BeanDescriptor
--- a/jdk/make/data/swingbeaninfo/javax/swing/SwingBeanInfoBase.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/data/swingbeaninfo/javax/swing/SwingBeanInfoBase.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -67,7 +67,7 @@
* its PropertyDescriptors will be included.
*/
public BeanInfo[] getAdditionalBeanInfo() {
- Class superClass = getBeanDescriptor().getBeanClass().getSuperclass();
+ Class<?> superClass = getBeanDescriptor().getBeanClass().getSuperclass();
BeanInfo superBeanInfo = null;
try {
superBeanInfo = Introspector.getBeanInfo(superClass);
--- a/jdk/make/data/swingbeaninfo/sun/swing/BeanInfoUtils.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/data/swingbeaninfo/sun/swing/BeanInfoUtils.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -122,7 +122,7 @@
* @see java.beans#PropertyDescriptor
* @see java.beans#FeatureDescriptor
*/
- public static PropertyDescriptor createPropertyDescriptor(Class cls, String name, Object[] args)
+ public static PropertyDescriptor createPropertyDescriptor(Class<?> cls, String name, Object[] args)
{
PropertyDescriptor pd = null;
try {
@@ -156,7 +156,7 @@
String methodName = (String)value;
Method method;
try {
- method = cls.getMethod(methodName, new Class[0]);
+ method = cls.getMethod(methodName, new Class<?>[0]);
pd.setReadMethod(method);
}
catch(Exception e) {
@@ -168,8 +168,8 @@
String methodName = (String)value;
Method method;
try {
- Class type = pd.getPropertyType();
- method = cls.getMethod(methodName, new Class[]{type});
+ Class<?> type = pd.getPropertyType();
+ method = cls.getMethod(methodName, new Class<?>[]{type});
pd.setWriteMethod(method);
}
catch(Exception e) {
@@ -215,9 +215,9 @@
* @see java.beans#BeanInfo
* @see java.beans#PropertyDescriptor
*/
- public static BeanDescriptor createBeanDescriptor(Class cls, Object[] args)
+ public static BeanDescriptor createBeanDescriptor(Class<?> cls, Object[] args)
{
- Class customizerClass = null;
+ Class<?> customizerClass = null;
/* For reasons I don't understand, customizerClass is a
* readOnly property. So we have to find it and pass it
@@ -242,11 +242,11 @@
}
static private PropertyDescriptor createReadOnlyPropertyDescriptor(
- String name, Class cls) throws IntrospectionException {
+ String name, Class<?> cls) throws IntrospectionException {
Method readMethod = null;
String base = capitalize(name);
- Class[] parameters = new Class[0];
+ Class<?>[] parameters = new Class<?>[0];
// Is it a boolean?
try {
@@ -264,7 +264,7 @@
try {
// Try indexed accessor pattern.
- parameters = new Class[1];
+ parameters = new Class<?>[1];
parameters[0] = int.class;
readMethod = cls.getMethod("get" + base, parameters);
} catch (NoSuchMethodException nsme) {
--- a/jdk/make/lib/PlatformLibraries.gmk Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/lib/PlatformLibraries.gmk Tue Jul 29 09:09:55 2014 -0700
@@ -90,8 +90,7 @@
LIBOSX_DIRS := \
$(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
$(JDK_TOPDIR)/src/macosx/native/com/apple/eio \
- $(JDK_TOPDIR)/src/macosx/native/apple/security \
- $(JDK_TOPDIR)/src/macosx/native/apple/launcher
+ $(JDK_TOPDIR)/src/macosx/native/apple/security
$(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
LIBRARY := osx, \
--- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers Tue Jul 29 09:09:55 2014 -0700
@@ -204,6 +204,7 @@
Java_sun_print_CUPSPrinter_canConnect;
Java_sun_print_CUPSPrinter_getMedia;
Java_sun_print_CUPSPrinter_getPageSizes;
+ Java_sun_print_CUPSPrinter_getResolutions;
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow;
Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box;
--- a/jdk/make/mapfiles/libawt_headless/mapfile-vers Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/mapfiles/libawt_headless/mapfile-vers Tue Jul 29 09:09:55 2014 -0700
@@ -76,6 +76,7 @@
Java_sun_print_CUPSPrinter_canConnect;
Java_sun_print_CUPSPrinter_getMedia;
Java_sun_print_CUPSPrinter_getPageSizes;
+ Java_sun_print_CUPSPrinter_getResolutions;
# libfontmanager entry points
AWTIsHeadless;
--- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers Tue Jul 29 09:09:55 2014 -0700
@@ -442,6 +442,7 @@
Java_sun_print_CUPSPrinter_canConnect;
Java_sun_print_CUPSPrinter_getMedia;
Java_sun_print_CUPSPrinter_getPageSizes;
+ Java_sun_print_CUPSPrinter_getResolutions;
awt_GetDrawingSurface;
awt_FreeDrawingSurface;
--- a/jdk/make/profile-includes.txt Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/make/profile-includes.txt Tue Jul 29 09:09:55 2014 -0700
@@ -177,7 +177,6 @@
ext/dnsns.jar \
ext/nashorn.jar \
ext/zipfs.jar \
- flavormap.properties \
fontconfig.RedHat.5.bfc \
fontconfig.RedHat.5.properties.src \
fontconfig.RedHat.6.bfc \
--- a/jdk/src/macosx/bundle/JavaAppLauncher/JavaAppLauncher.xcodeproj/project.pbxproj Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 45;
- objects = {
-
-/* Begin PBXBuildFile section */
- 2C483E05143512EB00F2AEFD /* 1.7.0.jre in Copy PlugIns */ = {isa = PBXBuildFile; fileRef = 2C483E04143512EB00F2AEFD /* 1.7.0.jre */; };
- 89D3CD32142EEB2200A08AED /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 89D3CD29142EEB2200A08AED /* InfoPlist.strings */; };
- 89D3CD33142EEB2200A08AED /* GenericApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 89D3CD2B142EEB2200A08AED /* GenericApp.icns */; };
- 89D3CD35142EEB2200A08AED /* JVMArgs.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D3CD30142EEB2200A08AED /* JVMArgs.m */; };
- 89D3CD36142EEB2200A08AED /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D3CD31142EEB2200A08AED /* main.m */; };
- 89D3D365143041F000A08AED /* JavaAppLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D3D364143041F000A08AED /* JavaAppLauncher.m */; };
- 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXCopyFilesBuildPhase section */
- 2C48F06614350F0F00F2AEFD /* Copy PlugIns */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 2147483647;
- dstPath = "";
- dstSubfolderSpec = 13;
- files = (
- 2C483E05143512EB00F2AEFD /* 1.7.0.jre in Copy PlugIns */,
- );
- name = "Copy PlugIns";
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
- 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
- 2C483E04143512EB00F2AEFD /* 1.7.0.jre */ = {isa = PBXFileReference; lastKnownFileType = folder; name = 1.7.0.jre; path = "../../../../../build/macosx-universal/j2sdk-bundle/1.7.0.jdk/Contents/Home/1.7.0.jre"; sourceTree = SOURCE_ROOT; };
- 2C48F06714350F8300F2AEFD /* 1.7.0.jdk */ = {isa = PBXFileReference; lastKnownFileType = folder; name = 1.7.0.jdk; path = "../../../../../build/macosx-universal/j2sdk-bundle/1.7.0.jdk"; sourceTree = SOURCE_ROOT; };
- 2CB5DA5E14355FCA00D3A656 /* classfile_constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = classfile_constants.h; sourceTree = "<group>"; };
- 2CB5DA6014355FCA00D3A656 /* jawt_md.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jawt_md.h; sourceTree = "<group>"; };
- 2CB5DA6114355FCA00D3A656 /* jni_md.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_md.h; sourceTree = "<group>"; };
- 2CB5DA6214355FCA00D3A656 /* jawt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jawt.h; sourceTree = "<group>"; };
- 2CB5DA6314355FCA00D3A656 /* jdwpTransport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jdwpTransport.h; sourceTree = "<group>"; };
- 2CB5DA6414355FCA00D3A656 /* jni.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni.h; sourceTree = "<group>"; };
- 2CB5DA6514355FCA00D3A656 /* jvmti.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jvmti.h; sourceTree = "<group>"; };
- 2CB5DA6614355FCA00D3A656 /* jvmticmlr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jvmticmlr.h; sourceTree = "<group>"; };
- 89D3CD2A142EEB2200A08AED /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
- 89D3CD2B142EEB2200A08AED /* GenericApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = GenericApp.icns; path = /System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/GenericApp.icns; sourceTree = "<absolute>"; };
- 89D3CD2C142EEB2200A08AED /* JavaAppLauncher-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "JavaAppLauncher-Info.plist"; sourceTree = "<group>"; };
- 89D3CD2E142EEB2200A08AED /* JavaAppLauncher_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaAppLauncher_Prefix.pch; sourceTree = "<group>"; };
- 89D3CD2F142EEB2200A08AED /* JVMArgs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JVMArgs.h; sourceTree = "<group>"; };
- 89D3CD30142EEB2200A08AED /* JVMArgs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JVMArgs.m; sourceTree = "<group>"; };
- 89D3CD31142EEB2200A08AED /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
- 89D3D363143041F000A08AED /* JavaAppLauncher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaAppLauncher.h; sourceTree = "<group>"; };
- 89D3D364143041F000A08AED /* JavaAppLauncher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavaAppLauncher.m; sourceTree = "<group>"; };
- 8D1107320486CEB800E47090 /* JavaAppLauncher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JavaAppLauncher.app; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 8D11072E0486CEB800E47090 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 1058C7A0FEA54F0111CA2CBB /* frameworks */ = {
- isa = PBXGroup;
- children = (
- 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
- );
- name = frameworks;
- sourceTree = "<group>";
- };
- 19C28FACFE9D520D11CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- 8D1107320486CEB800E47090 /* JavaAppLauncher.app */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- 29B97314FDCFA39411CA2CEA /* JavaAppLauncher */ = {
- isa = PBXGroup;
- children = (
- 89D3CD2D142EEB2200A08AED /* src */,
- 89D3CD28142EEB2200A08AED /* resources */,
- 29B97323FDCFA39411CA2CEA /* linking */,
- 19C28FACFE9D520D11CA2CBB /* Products */,
- );
- name = JavaAppLauncher;
- sourceTree = "<group>";
- };
- 29B97323FDCFA39411CA2CEA /* linking */ = {
- isa = PBXGroup;
- children = (
- 2C48F06714350F8300F2AEFD /* 1.7.0.jdk */,
- 2C483E04143512EB00F2AEFD /* 1.7.0.jre */,
- 2CB5DA5D14355FCA00D3A656 /* include */,
- 1058C7A0FEA54F0111CA2CBB /* frameworks */,
- );
- name = linking;
- sourceTree = "<group>";
- };
- 2CB5DA5D14355FCA00D3A656 /* include */ = {
- isa = PBXGroup;
- children = (
- 2CB5DA5E14355FCA00D3A656 /* classfile_constants.h */,
- 2CB5DA5F14355FCA00D3A656 /* darwin */,
- 2CB5DA6214355FCA00D3A656 /* jawt.h */,
- 2CB5DA6314355FCA00D3A656 /* jdwpTransport.h */,
- 2CB5DA6414355FCA00D3A656 /* jni.h */,
- 2CB5DA6514355FCA00D3A656 /* jvmti.h */,
- 2CB5DA6614355FCA00D3A656 /* jvmticmlr.h */,
- );
- name = include;
- path = "../../../../../build/macosx-universal/j2sdk-bundle/1.7.0.jdk/Contents/Home/include";
- sourceTree = "<group>";
- };
- 2CB5DA5F14355FCA00D3A656 /* darwin */ = {
- isa = PBXGroup;
- children = (
- 2CB5DA6014355FCA00D3A656 /* jawt_md.h */,
- 2CB5DA6114355FCA00D3A656 /* jni_md.h */,
- );
- path = darwin;
- sourceTree = "<group>";
- };
- 89D3CD28142EEB2200A08AED /* resources */ = {
- isa = PBXGroup;
- children = (
- 89D3CD29142EEB2200A08AED /* InfoPlist.strings */,
- 89D3CD2B142EEB2200A08AED /* GenericApp.icns */,
- 89D3CD2C142EEB2200A08AED /* JavaAppLauncher-Info.plist */,
- );
- path = resources;
- sourceTree = "<group>";
- };
- 89D3CD2D142EEB2200A08AED /* src */ = {
- isa = PBXGroup;
- children = (
- 89D3CD31142EEB2200A08AED /* main.m */,
- 89D3D363143041F000A08AED /* JavaAppLauncher.h */,
- 89D3D364143041F000A08AED /* JavaAppLauncher.m */,
- 89D3CD2F142EEB2200A08AED /* JVMArgs.h */,
- 89D3CD30142EEB2200A08AED /* JVMArgs.m */,
- 89D3CD2E142EEB2200A08AED /* JavaAppLauncher_Prefix.pch */,
- );
- path = src;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 8D1107260486CEB800E47090 /* JavaAppLauncher */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JavaAppLauncher" */;
- buildPhases = (
- 8D1107290486CEB800E47090 /* Resources */,
- 2C48F06614350F0F00F2AEFD /* Copy PlugIns */,
- 8D11072C0486CEB800E47090 /* Sources */,
- 8D11072E0486CEB800E47090 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = JavaAppLauncher;
- productInstallPath = "$(HOME)/Applications";
- productName = JavaAppLauncher;
- productReference = 8D1107320486CEB800E47090 /* JavaAppLauncher.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 29B97313FDCFA39411CA2CEA /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JavaAppLauncher" */;
- compatibilityVersion = "Xcode 3.1";
- developmentRegion = English;
- hasScannedForEncodings = 1;
- knownRegions = (
- en,
- English,
- );
- mainGroup = 29B97314FDCFA39411CA2CEA /* JavaAppLauncher */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 8D1107260486CEB800E47090 /* JavaAppLauncher */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 8D1107290486CEB800E47090 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 89D3CD32142EEB2200A08AED /* InfoPlist.strings in Resources */,
- 89D3CD33142EEB2200A08AED /* GenericApp.icns in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 8D11072C0486CEB800E47090 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 89D3CD35142EEB2200A08AED /* JVMArgs.m in Sources */,
- 89D3CD36142EEB2200A08AED /* main.m in Sources */,
- 89D3D365143041F000A08AED /* JavaAppLauncher.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin PBXVariantGroup section */
- 89D3CD29142EEB2200A08AED /* InfoPlist.strings */ = {
- isa = PBXVariantGroup;
- children = (
- 89D3CD2A142EEB2200A08AED /* English */,
- );
- name = InfoPlist.strings;
- sourceTree = "<group>";
- };
-/* End PBXVariantGroup section */
-
-/* Begin XCBuildConfiguration section */
- C01FCF4B08A954540054247B /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_MODEL_TUNING = G5;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = src/JavaAppLauncher_Prefix.pch;
- INFOPLIST_FILE = "resources/JavaAppLauncher-Info.plist";
- INSTALL_PATH = "$(HOME)/Applications";
- LIBRARY_SEARCH_PATHS = "$(inherited)";
- PRODUCT_NAME = JavaAppLauncher;
- };
- name = Debug;
- };
- C01FCF4C08A954540054247B /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- GCC_MODEL_TUNING = G5;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = src/JavaAppLauncher_Prefix.pch;
- INFOPLIST_FILE = "resources/JavaAppLauncher-Info.plist";
- INSTALL_PATH = "$(HOME)/Applications";
- LIBRARY_SEARCH_PATHS = "$(inherited)";
- PRODUCT_NAME = JavaAppLauncher;
- };
- name = Release;
- };
- C01FCF4F08A954540054247B /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
- SDKROOT = "";
- };
- name = Debug;
- };
- C01FCF5008A954540054247B /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- PREBINDING = NO;
- SDKROOT = "";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "JavaAppLauncher" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- C01FCF4B08A954540054247B /* Debug */,
- C01FCF4C08A954540054247B /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- C01FCF4E08A954540054247B /* Build configuration list for PBXProject "JavaAppLauncher" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- C01FCF4F08A954540054247B /* Debug */,
- C01FCF5008A954540054247B /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
-}
--- a/jdk/src/macosx/bundle/JavaAppLauncher/resources/English.lproj/InfoPlist.strings Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-/* Localized versions of Info.plist keys */
-
--- a/jdk/src/macosx/bundle/JavaAppLauncher/resources/JavaAppLauncher-Info.plist Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string>GenericApp.icns</string>
- <key>CFBundleIdentifier</key>
- <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
- <key>CFBundleDisplayName</key>
- <string>Your Cool App</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1</string>
- <key>LSMinimumSystemVersion</key>
- <string>${MACOSX_DEPLOYMENT_TARGET}</string>
- <key>NSHumanReadableCopyright</key>
- <string>Copyright © 2011 Your Company Inc. All Rights Reserved.</string>
- <key>JVMInfo</key>
- <dict>
- <key>JRE</key>
- <string>1.7.0.jre</string>
- <key>ClassPath</key>
- <array/>
- <key>Properties</key>
- <dict>
- <key>apple.laf.useScreenMenuBar</key>
- <string>true</string>
- </dict>
- <key>MainClass</key>
- <string>com.yourcompany.yourapp.mainclass</string>
- <key>Arguments</key>
- <array/>
- </dict>
-</dict>
-</plist>
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.h Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "jni.h"
-
-
-@interface JVMArgs : NSObject {
-@public
- NSBundle *jreBundle;
- char *preferredJVMLib;
- JavaVMInitArgs vm_args;
- BOOL startOnFirstThread;
- BOOL debug;
-
- NSDictionary *appInfo;
- NSMutableDictionary *jvmInfo;
-
- NSString *userHome;
- NSString *appPackage;
- NSString *javaRoot;
-}
-
-@property (retain, nonatomic) NSBundle *jreBundle;
-@property (nonatomic) char *preferredJVMLib;
-@property (nonatomic) JavaVMInitArgs vm_args;
-@property (nonatomic) BOOL startOnFirstThread;
-@property (nonatomic) BOOL debug;
-
-@property (retain, nonatomic) NSDictionary *appInfo;
-@property (retain, nonatomic) NSMutableDictionary *jvmInfo;
-
-@property (retain, nonatomic) NSString *userHome;
-@property (retain, nonatomic) NSString *appPackage;
-@property (retain, nonatomic) NSString *javaRoot;
-
-+ (JVMArgs *)jvmArgsForBundle:(NSBundle *)appBundle argc:(int)argc argv:(char *[])argv;
-
-@end
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JVMArgs.m Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, 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.
- */
-
-#import "JVMArgs.h"
-
-
-#define kArgsFailure "JVMArgsFailure"
-
-NSString *kArgumentsKey = @"Arguments";
-
-NSString *kClassPathKey = @"ClassPath";
-#ifdef __i386__
-NSString *kArchClassPathKey = @"ClassPath.i386";
-#elif __x86_64__
-NSString *kArchClassPathKey = @"ClassPath.x86_64";
-#endif
-
-NSString *kVMOptionsKey = @"VMOptions";
-#ifdef __i386__
-NSString *kArchVMOptionsKey = @"VMOptions.i386";
-#elif __x86_64__
-NSString *kArchVMOptionsKey = @"VMOptions.x86_64";
-#endif
-
-
-@implementation JVMArgs
-
-@synthesize jreBundle;
-@synthesize preferredJVMLib;
-@synthesize vm_args;
-@synthesize startOnFirstThread;
-@synthesize debug;
-
-@synthesize appInfo;
-@synthesize jvmInfo;
-
-@synthesize userHome;
-@synthesize appPackage;
-@synthesize javaRoot;
-
-- (void) dealloc {
- self.jreBundle = nil;
- if (self.preferredJVMLib) free(self.preferredJVMLib);
-
- self.appInfo = nil;
- self.jvmInfo = nil;
-
- self.userHome = nil;
- self.appPackage = nil;
- self.javaRoot = nil;
-
- [super dealloc];
-}
-
-
-NSString *GetJavaRoot(NSDictionary *jvmInfoDict) {
- NSObject *javaRoot = [jvmInfoDict objectForKey:@"$JAVAROOT"];
- if (![javaRoot isKindOfClass:[NSString class]]) return @"$APP_PACKAGE/Contents/Java";
- return (NSString *)javaRoot;
-}
-
-// Replaces occurances of $JAVAROOT, $APP_PACKAGE, and $USER_HOME
-- (NSString *) expandMacros:(NSString *)str {
- if ([str rangeOfString:@"$JAVAROOT"].length == 0 && [str rangeOfString:@"$APP_PACKAGE"].length == 0 && [str rangeOfString:@"$USER_HOME"].length == 0) return str;
-
- // expand $JAVAROOT first, because it can contain $APP_PACKAGE
- NSMutableString *mutable = [str mutableCopy];
- [mutable replaceOccurrencesOfString:@"$JAVAROOT" withString:javaRoot options:0 range:NSMakeRange(0, [str length])];
- [mutable replaceOccurrencesOfString:@"$APP_PACKAGE" withString:appPackage options:0 range:NSMakeRange(0, [str length])];
- [mutable replaceOccurrencesOfString:@"$USER_HOME" withString:userHome options:0 range:NSMakeRange(0, [str length])];
- return mutable;
-}
-
-- (NSArray *) arrayFrom:(id) obj delimitedBy:(NSString *)delimiter withErrKey:(NSString *)key {
- if (obj == nil) return nil;
- if ([obj isKindOfClass:[NSArray class]]) return obj;
- if (![obj isKindOfClass:[NSString class]]) {
- [NSException raise:@kArgsFailure format:@"%@", [NSString stringWithFormat:@"Failed to find '%@' array in JVMInfo Info.plist"]];
- }
-
- // split
- return [(NSString *)obj componentsSeparatedByString:delimiter];
-}
-
-- (void) buildArgsForBundle:(NSBundle *)appBundle argc:(int)argc argv:(char *[])argv {
- // for verbose logging
- self.debug = NULL != getenv("JAVA_LAUNCHER_VERBOSE");
-
- self.appInfo = [appBundle infoDictionary];
-
- // all apps must have a JVMInfo dictionary inside their Info.plist
- self.jvmInfo = [[self.appInfo objectForKey:@"JVMInfo"] mutableCopy];
- if (![jvmInfo isKindOfClass:[NSDictionary class]]) {
- [NSException raise:@kArgsFailure format:@"Failed to find 'JVMInfo' dictionary in Info.plist"];
- }
-
- // initialize macro expansion values
- self.userHome = NSHomeDirectory();
- self.appPackage = [appBundle bundlePath];
- self.javaRoot = GetJavaRoot(jvmInfo);
- self.javaRoot = [self expandMacros:self.javaRoot]; // dereference $APP_PACKAGE
-
- // if the 'Arguments' key is defined, those override the ones that came into main()
- NSArray *jvmInfoArgs = [jvmInfo valueForKey:kArgumentsKey];
- if (jvmInfoArgs != nil) {
- // substitute all the variables in the 'Arguments' array/string
- jvmInfoArgs = [self arrayFrom:jvmInfoArgs delimitedBy:@" " withErrKey:kArgumentsKey];
- NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:[jvmInfoArgs count]];
- [jvmInfoArgs enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- [arguments replaceObjectAtIndex:idx withObject:[self expandMacros:[obj description]]];
- }];
- [jvmInfo setObject:arguments forKey:kArgumentsKey];
- } else if (argc != 0) {
- // put the (macro expanded) args to main() in an NSArray
- NSMutableArray *arguments = [NSMutableArray arrayWithCapacity:argc];
- for (int i = 0; i < argc; i++) {
- [arguments addObject:[self expandMacros:[NSString stringWithUTF8String:(argv[i])]]];
- }
- [jvmInfo setObject:arguments forKey:kArgumentsKey];
- }
-
- // all JVMInfo's must have a JRE or JDK key
- NSString *jreBundleName = [jvmInfo objectForKey:@"JRE"];
- if (!jreBundleName) jreBundleName = [jvmInfo objectForKey:@"JDK"];
- if (![jreBundleName isKindOfClass:[NSString class]]) {
- [NSException raise:@kArgsFailure format:@"Failed to find 'JRE' or 'JDK' string in Info.plist JVMInfo"];
- }
-
- // the JRE/JDK must be loadable from the ($APP_PACKAGE)/Contents/PlugIns/ directory
- NSURL *jreBundleURL = [[appBundle builtInPlugInsURL] URLByAppendingPathComponent:jreBundleName];
- self.jreBundle = [NSBundle bundleWithURL:jreBundleURL];
- if (!self.jreBundle) {
- [NSException raise:@kArgsFailure format:@"Failed to find JRE/JDK at: %@", jreBundleURL];
- }
-
- // if the app prefers 'client' or 'server', use the JVM key
- NSString *JVMLib = [jvmInfo objectForKey:@"JVM"];
- if (JVMLib != nil) self.preferredJVMLib = strdup([JVMLib UTF8String]);
-
- // sniff for StartOnFirstThread
- if ([[jvmInfo objectForKey:@"StartOnFirstThread"] boolValue]) {
- self.startOnFirstThread = YES;
- } else if ([[jvmInfo objectForKey:@"StartOnMainThread"] boolValue]) {
- // for key compatibility with the Apple JavaApplicationStub's 'Java' dictionary
- self.startOnFirstThread = YES;
- }
-
- // add $JAVAROOT directory to the JNI library search path
- setenv("JAVA_LIBRARY_PATH", [javaRoot UTF8String], 1);
-
- // 'WorkingDirectory' key changes current working directory
- NSString *javaWorkingDir = [jvmInfo objectForKey:@"WorkingDirectory"];
- if (javaWorkingDir == nil) javaWorkingDir = @"$APP_PACKAGE/..";
- javaWorkingDir = [self expandMacros:javaWorkingDir];
- if (chdir([javaWorkingDir UTF8String]) == -1) {
- NSLog(@kArgsFailure " chdir() failed, could not change the current working directory to %s\n", [javaWorkingDir UTF8String]);
- }
-
- NSMutableArray *classpath = [NSMutableArray array];
-
- // 'Jar' key sets exactly one classpath entry
- NSString *jarFile = [jvmInfo objectForKey:@"Jar"];
- if (jarFile != nil) {
- [jvmInfo setObject:[self expandMacros:jarFile] forKey:@"Jar"];
- [classpath addObject:jarFile];
- }
-
- // 'ClassPath' key allows arbitrary classpath
- [classpath addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kClassPathKey] delimitedBy:@":" withErrKey:kClassPathKey]];
- [classpath addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kArchClassPathKey] delimitedBy:@":" withErrKey:kArchClassPathKey]];
-
- // Sum up all the classpath entries into one big JVM arg
- NSMutableString *classpathOption = [NSMutableString stringWithString:@"-Djava.class.path="];
- [classpath enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- if (idx > 1) [classpathOption appendString:@":"];
- [classpathOption appendString:obj];
- }];
-
- NSMutableArray *jvmOptions = [NSMutableArray arrayWithObject:classpathOption];
-
- // 'VMOptions' key allows arbitary VM start up options
- [jvmOptions addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kVMOptionsKey] delimitedBy:@" " withErrKey:kVMOptionsKey]];
- [jvmOptions addObjectsFromArray:[self arrayFrom:[jvmInfo objectForKey:kArchVMOptionsKey] delimitedBy:@" " withErrKey:kArchVMOptionsKey]];
-
- // 'Properties' key is a sub-dictionary transfered to initial System.properties
- NSDictionary *properties = [jvmInfo objectForKey:@"Properties"];
- if (properties != nil) {
- if (![properties isKindOfClass:[NSDictionary class]]) {
- [NSException raise:@kArgsFailure format:@"Failed to find 'Properties' dictionary in Info.plist JVMInfo"];
- }
-
- [properties enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
- [jvmOptions addObject:[NSString stringWithFormat:@"-D%@=%@", key, obj]];
- }];
- }
-
- // build the real JVM init args struct
- vm_args.version = JNI_VERSION_1_6;
- vm_args.ignoreUnrecognized = JNI_TRUE;
- vm_args.nOptions = [jvmOptions count];
- vm_args.options = calloc(vm_args.nOptions, sizeof(JavaVMOption));
- [jvmOptions enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
- NSString *expanded = [self expandMacros:[obj description]]; // turn everything into a string, and expand macros
- vm_args.options[idx].optionString = strdup([expanded UTF8String]);
- }];
-}
-
-+ (JVMArgs *)jvmArgsForBundle:(NSBundle *)appBundle argc:(int)argc argv:(char *[])argv {
- JVMArgs *args = [JVMArgs new];
- [args buildArgsForBundle:appBundle argc:argc argv:argv];
- return [args autorelease];
-}
-
-@end
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JavaAppLauncher.h Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "jni.h"
-
-#import "JVMArgs.h"
-
-
-@interface JavaAppLauncher : NSObject {
- JVMArgs *args;
- JavaVM *jvm;
-}
-
-@property (retain) JVMArgs *args;
-
-- (void) findAndLoadJVM;
-- (void) invokeBundledAppJavaLauncherWithEnv:(JNIEnv *)env;
-
-@end
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JavaAppLauncher.m Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import "JavaAppLauncher.h"
-
-#import <dlfcn.h>
-
-#import "jni.h"
-
-#define kLaunchFailure "JavaAppLauncherFailure"
-
-
-typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
-typedef void (JNICALL *SetPreferredJVM_t)(const char *prefJVM);
-
-
-@implementation JavaAppLauncher
-
-@synthesize args;
-
-- (void) findAndLoadJVM {
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
- @try {
- // load the libjli.dylib of the embedded JRE (or JDK) bundle
- NSURL *jreBundleURL = [args.jreBundle bundleURL];
- CFBundleRef jreBundle = CFBundleCreate(NULL, (CFURLRef)jreBundleURL);
-
- NSError *err = nil;
- Boolean jreBundleLoaded = CFBundleLoadExecutableAndReturnError(jreBundle, (CFErrorRef *)&err);
- if (err != nil || !jreBundleLoaded) {
- [NSException raise:@kLaunchFailure format:@"could not load the JRE/JDK: %@", err];
- }
-
- // if there is a preferred libjvm to load, set it here
- if (args.preferredJVMLib != NULL) {
- SetPreferredJVM_t setPrefJVMFxnPtr = CFBundleGetFunctionPointerForName(jreBundle, CFSTR("JLI_SetPreferredJVM"));
- if (setPrefJVMFxnPtr != NULL) {
- setPrefJVMFxnPtr(args.preferredJVMLib);
- } else {
- NSLog(@"No JLI_SetPreferredJVM in JRE/JDK primary executable, failed to set preferred JVM library to: %s", args->preferredJVMLib);
- }
- }
-
- // pull the JNI_CreateJavaVM function pointer out of the primary executable of the JRE/JDK bundle
- CreateJavaVM_t createJVMFxnPtr = CFBundleGetFunctionPointerForName(jreBundle, CFSTR("JNI_CreateJavaVM"));
- if (createJVMFxnPtr == NULL) {
- [NSException raise:@kLaunchFailure format:@"null JNI_CreateJavaVM fxn ptr from: %@", jreBundle];
- }
-
- // instantiate the JVM
- JNIEnv *env;
- jint createJVMStatus = createJVMFxnPtr(&jvm, (void **)&env, &(args->vm_args));
- if (createJVMStatus != JNI_OK) {
- [NSException raise:@kLaunchFailure format:@"failed to JNI_CreateJavaVM (%d): %@", createJVMStatus, jreBundle];
- }
-
- // check the app needs to run the Java main() on the main thread
- if (args.startOnFirstThread) {
- dispatch_sync(dispatch_get_main_queue(), ^(void) {
- JNIEnv *mainThreadEnv;
- (*jvm)->AttachCurrentThread(jvm, (void **)&mainThreadEnv, NULL);
- [self invokeBundledAppJavaLauncherWithEnv:mainThreadEnv];
- (*jvm)->DetachCurrentThread(jvm);
- });
- } else {
- [self invokeBundledAppJavaLauncherWithEnv:env];
- }
-
- } @catch (NSException *e) {
- NSLog(@"%@: %@", e, [e callStackSymbols]);
- }
-
- if (jvm) {
- (*jvm)->DetachCurrentThread(jvm);
- (*jvm)->DestroyJavaVM(jvm);
- }
-
- [pool drain];
-}
-
-static const char kLauncherClassName[] = "apple/launcher/JavaAppLauncher";
-
-- (void) invokeBundledAppJavaLauncherWithEnv:(JNIEnv *)env {
- // hand off control to the apple.launcher.JavaAppLauncher class
-
- jclass mainClass = (*env)->FindClass(env, kLauncherClassName);
- if (mainClass == NULL) {
- fprintf(stderr, kLaunchFailure " FindClass() failed for class %s:\n", kLauncherClassName);
- (*env)->ExceptionDescribe(env);
- return;
- }
-
- jmethodID mainMethod = (*env)->GetStaticMethodID(env, mainClass, "launch", "(JZ)V");
- if ((mainMethod == NULL) || (*env)->ExceptionOccurred(env)) {
- fprintf(stderr, kLaunchFailure " GetStaticMethodID() failed for launch() method");
- (*env)->ExceptionDescribe(env);
- return;
- }
-
- CFDictionaryRef jvmInfo = CFRetain(args.jvmInfo);
-
- (*env)->CallStaticVoidMethod(env, mainClass, mainMethod, (jlong)jvmInfo, (jboolean)args.debug);
- if ((*env)->ExceptionOccurred(env)) {
- fprintf(stderr, kLaunchFailure " CallStaticVoidMethod() threw an exception\n");
- (*env)->ExceptionDescribe(env);
- return;
- }
-}
-
-@end
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/JavaAppLauncher_Prefix.pch Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-//
-// Prefix header for all source files of the 'JavaAppLauncher' target in the 'JavaAppLauncher' project
-//
-
-#ifdef __OBJC__
- #import <Cocoa/Cocoa.h>
-#endif
--- a/jdk/src/macosx/bundle/JavaAppLauncher/src/main.m Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import <Cocoa/Cocoa.h>
-
-#import "JVMArgs.h"
-#import "JavaAppLauncher.h"
-
-
-static void dummyTimer(CFRunLoopTimerRef timer, void *info) {}
-static void ParkEventLoop() {
- // RunLoop needs at least one source, and 1e20 is pretty far into the future
- CFRunLoopTimerRef t = CFRunLoopTimerCreate(kCFAllocatorDefault, 1.0e20, 0.0, 0, 0, dummyTimer, NULL);
- CFRunLoopAddTimer(CFRunLoopGetCurrent(), t, kCFRunLoopDefaultMode);
- CFRelease(t);
-
- // Park this thread in the main run loop.
- int32_t result;
- do {
- result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, false);
- } while (result != kCFRunLoopRunFinished);
-}
-
-int main(int argc, char *argv[]) {
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
- @try {
- NSBundle *mainBundle = [NSBundle mainBundle];
-
- // pick apart the Info.plist, and release all the temporary objects
- NSAutoreleasePool *argParsingPool = [NSAutoreleasePool new];
- JVMArgs *args = [JVMArgs jvmArgsForBundle:mainBundle argc:argc argv:argv];
- JavaAppLauncher *launcher = [JavaAppLauncher new];
- launcher.args = args;
- [argParsingPool drain];
-
- // kick off a new thread to instantiate the JVM on
- NSThread *thread = [[NSThread alloc] initWithTarget:launcher selector:@selector(findAndLoadJVM) object:nil];
- struct rlimit limit;
- int err = getrlimit(RLIMIT_STACK, &limit);
- if (err == 0 && limit.rlim_cur != 0LL) {
- [thread setStackSize:limit.rlim_cur];
- }
- [thread start];
- [thread release];
-
- [launcher release];
-
- ParkEventLoop();
-
- } @catch (NSException *e) {
- NSLog(@"%@: %@", e, [e callStackSymbols]);
- }
-
- [pool drain];
-
- return 0;
-}
--- a/jdk/src/macosx/classes/apple/launcher/JavaAppLauncher.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 apple.launcher;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.text.MessageFormat;
-import java.util.*;
-import java.util.jar.*;
-
-import javax.swing.*;
-
-class JavaAppLauncher implements Runnable {
- static {
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<Void>() {
- public Void run() {
- System.loadLibrary("osx");
- return null;
- }
- });
- }
-
- private static native <T> T nativeConvertAndRelease(final long ptr);
- private static native void nativeInvokeNonPublic(Class<? extends Method> cls, Method m, String[] args);
-
- // entry point from native
- static void launch(final long javaDictionaryPtr, final boolean verbose) {
- final Map<String, ?> javaDictionary = nativeConvertAndRelease(javaDictionaryPtr);
- (new JavaAppLauncher(javaDictionary, verbose)).run();
- }
-
- // these are the values for the enumeration JavaFailureMode
- static final String kJavaFailureMainClassNotSpecified = "MainClassNotSpecified";
- static final String kJavaFailureMainClassNotFound = "CannotLoadMainClass";
- static final String kJavaFailureMainClassHasNoMain = "NoMainMethod";
- static final String kJavaFailureMainClassMainNotStatic = "MainNotStatic";
- static final String kJavaFailureMainThrewException = "MainThrewException";
- static final String kJavaFailureMainInitializerException = "MainInitializerException";
-
- final boolean verbose; // Normally set by environment variable JAVA_LAUNCHER_VERBOSE.
- final Map<String, ?> javaDictionary;
-
- JavaAppLauncher(final Map<String, ?> javaDictionary, final boolean verbose) {
- this.verbose = verbose;
- this.javaDictionary = javaDictionary;
- }
-
- @Override
- public void run() {
- final Method m = loadMainMethod(getMainMethod());
- final String methodName = m.getDeclaringClass().getName() + ".main(String[])";
- try {
- log("Calling " + methodName + " method");
- m.invoke(null, new Object[] { getArguments() });
- log(methodName + " has returned");
- } catch (final IllegalAccessException x) {
- try {
- nativeInvokeNonPublic(m.getClass(), m, getArguments());
- } catch (final Throwable excpt) {
- logError(methodName + " threw an exception:");
- if ((excpt instanceof UnsatisfiedLinkError) && excpt.getMessage().equals("nativeInvokeNonPublic")) {
- showFailureAlertAndKill(kJavaFailureMainThrewException, "nativeInvokeNonPublic not registered");
- } else {
- excpt.printStackTrace();
- showFailureAlertAndKill(kJavaFailureMainThrewException, excpt.toString());
- }
- }
- } catch (final InvocationTargetException invokeExcpt) {
- logError(methodName + " threw an exception:");
- invokeExcpt.getTargetException().printStackTrace();
- showFailureAlertAndKill(kJavaFailureMainThrewException, invokeExcpt.getTargetException().toString());
- }
- }
-
- Method loadMainMethod(final String mainClassName) {
- try {
- final Class<?> mainClass = Class.forName(mainClassName, true, sun.misc.Launcher.getLauncher().getClassLoader());
- final Method mainMethod = mainClass.getDeclaredMethod("main", new Class[] { String[].class });
- if ((mainMethod.getModifiers() & Modifier.STATIC) == 0) {
- logError("The main(String[]) method of class " + mainClassName + " is not static!");
- showFailureAlertAndKill(kJavaFailureMainClassMainNotStatic, mainClassName);
- }
- return mainMethod;
- } catch (final ExceptionInInitializerError x) {
- logError("The main class \"" + mainClassName + "\" had a static initializer throw an exception.");
- x.getException().printStackTrace();
- showFailureAlertAndKill(kJavaFailureMainInitializerException, x.getException().toString());
- } catch (final ClassNotFoundException x) {
- logError("The main class \"" + mainClassName + "\" could not be found.");
- showFailureAlertAndKill(kJavaFailureMainClassNotFound, mainClassName);
- } catch (final NoSuchMethodException x) {
- logError("The main class \"" + mainClassName + "\" has no static main(String[]) method.");
- showFailureAlertAndKill(kJavaFailureMainClassHasNoMain, mainClassName);
- } catch (final NullPointerException x) {
- logError("No main class specified");
- showFailureAlertAndKill(kJavaFailureMainClassNotSpecified, null);
- }
-
- return null;
- }
-
- // get main class name from 'Jar' key, or 'MainClass' key
- String getMainMethod() {
- final Object javaJar = javaDictionary.get("Jar");
- if (javaJar != null) {
- if (!(javaJar instanceof String)) {
- logError("'Jar' key in 'Java' sub-dictionary of Info.plist requires a string value");
- return null;
- }
-
- final String jarPath = (String)javaJar;
- if (jarPath.length() == 0) {
- log("'Jar' key of sub-dictionary 'Java' of Info.plist key is empty");
- } else {
- // extract main class from manifest of this jar
- final String main = getMainFromManifest(jarPath);
- if (main == null) {
- logError("jar file '" + jarPath + "' does not have Main-Class: attribute in its manifest");
- return null;
- }
-
- log("Main class " + main + " found in jar manifest");
- return main;
- }
- }
-
- final Object javaMain = javaDictionary.get("MainClass");
- if (!(javaMain instanceof String)) {
- logError("'MainClass' key in 'Java' sub-dictionary of Info.plist requires a string value");
- return null;
- }
-
- final String main = (String)javaMain;
- if (main.length() == 0) {
- log("'MainClass' key of sub-dictionary 'Java' of Info.plist key is empty");
- return null;
- }
-
- log("Main class " + (String)javaMain + " found via 'MainClass' key of sub-dictionary 'Java' of Info.plist key");
- return (String)javaMain;
- }
-
- // get arguments for main(String[]) out of Info.plist and command line
- String[] getArguments() {
- // check for 'Arguments' key, which contains the main() args if not defined in Info.plist
- final Object javaArguments = javaDictionary.get("Arguments");
- if (javaArguments == null) {
- // no arguments
- log("No arguments for main(String[]) specified");
- return new String[0];
- }
-
- if (javaArguments instanceof List) {
- final List<?> args = (List<?>)javaArguments;
- final int count = args.size();
- log("Arguments to main(String[" + count + "]):");
-
- final String[] result = new String[count];
- for (int i = 0; i < count; ++i) {
- final Object element = args.get(i);
- if (element instanceof String) {
- result[i] = (String)element;
- } else {
- logError("Found non-string in array");
- }
- log(" arg[" + i + "]=" + result[i]);
- }
- return result;
- }
-
- logError("'Arguments' key in 'Java' sub-dictionary of Info.plist requires a string value or an array of strings");
- return new String[0];
- }
-
- // returns name of main class, or null
- String getMainFromManifest(final String jarpath) {
- JarFile jar = null;
- try {
- jar = new JarFile(jarpath);
- final Manifest man = jar.getManifest();
- final Attributes attr = man.getMainAttributes();
- return attr.getValue("Main-Class");
- } catch (final IOException x) {
- // shrug
- } finally {
- if (jar != null) {
- try {
- jar.close();
- } catch (final IOException x) { }
- }
- }
- return null;
- }
-
- void log(final String s) {
- if (!verbose) return;
- System.out.println("[LaunchRunner] " + s);
- }
-
- static void logError(final String s) {
- System.err.println("[LaunchRunner Error] " + s);
- }
-
- // This kills the app and does not return!
- static void showFailureAlertAndKill(final String msg, String arg) {
- if (arg == null) arg = "<<null>>";
- JOptionPane.showMessageDialog(null, getMessage(msg, arg), "", JOptionPane.ERROR_MESSAGE);
- System.exit(-1);
- }
-
- static String getMessage(final String msgKey, final Object ... args) {
- final String msg = ResourceBundle.getBundle("appLauncherErrors").getString(msgKey);
- return MessageFormat.format(msg, args);
- }
-}
--- a/jdk/src/macosx/classes/apple/launcher/appLauncherErrors.properties Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-MainClassNotSpecified=No main class specified.
-CannotLoadMainClass=The main class \u201C{0}\u201D could not be loaded.
-NoMainMethod=The main class \u201C{0}\u201D has no \u201Cvoid main(String[])\u201D method.
-MainNotStatic=The \u201Cmain(String[])\u201D method of class \u201C{0}\u201D is not static.
-MainThrewException=Uncaught exception in main method: {0}
-MainInitializerException=A static initializer of the main class threw an exception: {0}
--- a/jdk/src/macosx/classes/apple/security/KeychainStore.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/apple/security/KeychainStore.java Tue Jul 29 09:09:55 2014 -0700
@@ -74,19 +74,19 @@
* Entries that have been deleted. When something calls engineStore we'll
* remove them from the keychain.
*/
- private Hashtable deletedEntries = new Hashtable();
+ private Hashtable<String, Object> 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<String, Object> 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<String, Object> entries = new Hashtable<>();
/**
* Algorithm identifiers and corresponding OIDs for the contents of the PKCS12 bag we get from the Keychain.
@@ -471,7 +471,7 @@
// 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<Object> allValues = entries.values();
for (Object value : allValues) {
if (value instanceof TrustedCertEntry) {
@@ -517,7 +517,7 @@
*
* @return enumeration of the alias names
*/
- public Enumeration engineAliases() {
+ public Enumeration<String> engineAliases() {
permissionCheck();
return entries.keys();
}
@@ -598,8 +598,8 @@
permissionCheck();
Certificate certElem;
- for (Enumeration e = entries.keys(); e.hasMoreElements(); ) {
- String alias = (String)e.nextElement();
+ for (Enumeration<String> 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 @@
permissionCheck();
// Delete items that do have a keychain item ref.
- for (Enumeration e = deletedEntries.keys(); e.hasMoreElements(); ) {
- String alias = (String)e.nextElement();
+ for (Enumeration<String> 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 @@
// 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<String> 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 @@
// 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<String> 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 @@
// 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<CertKeychainItemPair> createdCerts = new ArrayList<>();
try {
CertificateFactory cf = CertificateFactory.getInstance("X.509");
@@ -842,12 +842,12 @@
// 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;
}
--- a/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/eawt/_AppDockIconHandler.java Tue Jul 29 09:09:55 2014 -0700
@@ -95,7 +95,7 @@
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) {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaBorder.java Tue Jul 29 09:09:55 2014 -0700
@@ -75,7 +75,7 @@
protected AquaBorder deriveBorderForSize(final Size size) {
try {
final Class<? extends AquaBorder> 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) {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxButton.java Tue Jul 29 09:09:55 2014 -0700
@@ -35,8 +35,8 @@
@SuppressWarnings("serial") // Superclass is not serializable across versions
class AquaComboBoxButton extends JButton {
- final protected JComboBox comboBox;
- final protected JList list;
+ final protected JComboBox<Object> comboBox;
+ final protected JList<?> list;
final protected CellRendererPane rendererPane;
final protected AquaComboBoxUI ui;
@@ -45,7 +45,10 @@
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<Object> comboBox,
+ final CellRendererPane rendererPane,
+ final JList<?> list) {
super("");
putClientProperty("JButton.buttonType", "comboboxInternal");
@@ -163,7 +166,7 @@
}
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<Object> renderer = comboBox.getRenderer();
// fake it out! not renderPressed
final Component c = renderer.getListCellRendererComponent(list, comboBox.getSelectedItem(), -1, false, false);
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Tue Jul 29 09:09:55 2014 -0700
@@ -43,7 +43,7 @@
protected Component bottomStrut;
protected boolean isPopDown = false;
- public AquaComboBoxPopup(final JComboBox cBox) {
+ public AquaComboBoxPopup(final JComboBox<Object> cBox) {
super(cBox);
}
@@ -93,7 +93,7 @@
final int rowCount = Math.min(maxRowCount, currentElementCount);
final Dimension popupSize = new Dimension();
- final ListCellRenderer renderer = list.getCellRenderer();
+ final ListCellRenderer<Object> renderer = list.getCellRenderer();
for (int i = 0; i < rowCount; i++) {
final Object value = list.getModel().getElementAt(i);
@@ -149,8 +149,8 @@
@Override
@SuppressWarnings("serial") // anonymous class
- protected JList createList() {
- return new JList(comboBox.getModel()) {
+ protected JList<Object> createList() {
+ return new JList<Object>(comboBox.getModel()) {
@Override
public void processMouseEvent(MouseEvent e) {
if (e.isMetaDown()) {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRenderer.java Tue Jul 29 09:09:55 2014 -0700
@@ -29,8 +29,8 @@
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<Object> implements UIResource {
+ public AquaComboBoxRenderer(final JComboBox<?> comboBox) {
super(comboBox);
}
}
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxRendererInternal.java Tue Jul 29 09:09:55 2014 -0700
@@ -31,8 +31,8 @@
import java.awt.*;
@SuppressWarnings("serial") // Superclass is not serializable across versions
-class AquaComboBoxRendererInternal extends JLabel implements ListCellRenderer {
- final JComboBox fComboBox;
+class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer<E> {
+ final JComboBox<?> fComboBox;
boolean fSelected;
boolean fChecked;
boolean fInList;
@@ -40,7 +40,7 @@
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 @@
}
// 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<? extends E> 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) {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -102,13 +102,13 @@
if (now - 1000 < lastBlink) return;
lastBlink = now;
- final JList itemList = popup.getList();
+ final JList<Object> 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<Object> dataModel = itemList.getModel();
if (dataModel == null) return;
final Object value = dataModel.getElementAt(selectedIndex);
@@ -125,7 +125,7 @@
// this space intentionally left blank
}
- protected ListCellRenderer createRenderer() {
+ protected ListCellRenderer<Object> createRenderer() {
return new AquaComboBoxRenderer(comboBox);
}
@@ -185,7 +185,7 @@
final Object text = editor.getText();
- final ListModel model = listBox.getModel();
+ final ListModel<Object> 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 @@
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 @@
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 @@
@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 @@
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 @@
}
@SuppressWarnings("unchecked")
- static final RecyclableSingleton<ClientPropertyApplicator<JComboBox, AquaComboBoxUI>> APPLICATOR = new RecyclableSingleton<ClientPropertyApplicator<JComboBox, AquaComboBoxUI>>() {
+ static final RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>> APPLICATOR = new
+ RecyclableSingleton<ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>>() {
@Override
- protected ClientPropertyApplicator<JComboBox, AquaComboBoxUI> getInstance() {
- return new ClientPropertyApplicator<JComboBox, AquaComboBoxUI>(
+ protected ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI> getInstance() {
+ return new ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI>(
new Property<AquaComboBoxUI>(AquaFocusHandler.FRAME_ACTIVE_PROPERTY) {
public void applyProperty(final AquaComboBoxUI target, final Object value) {
if (Boolean.FALSE.equals(value)) {
@@ -633,7 +634,7 @@
}
}
) {
- 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 @@
};
}
};
- static ClientPropertyApplicator<JComboBox, AquaComboBoxUI> getApplicator() {
+ static ClientPropertyApplicator<JComboBox<?>, AquaComboBoxUI> getApplicator() {
return APPLICATOR.get();
}
}
--- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -724,6 +724,7 @@
final Transferable transferable = dtde.getTransferable();
try {
+ @SuppressWarnings("unchecked")
final java.util.List<File> fileList = (java.util.List<File>)transferable.getTransferData(DataFlavor.javaFileListFlavor);
dropFiles(fileList.toArray(new File[fileList.size()]));
dtde.dropComplete(true);
@@ -1144,11 +1145,14 @@
}
@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<File> createDirectoryComboBoxRenderer(final JFileChooser fc) {
+ return new AquaComboBoxRendererInternal<File>(directoryComboBox) {
+ public Component getListCellRendererComponent(final JList<? extends File> 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 @@
* 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<File> implements ComboBoxModel<File> {
Vector<File> fDirectories = new Vector<File>();
int topIndex = -1;
int fPathCount = 0;
@@ -1248,7 +1252,7 @@
return fDirectories.size();
}
- public Object getElementAt(final int index) {
+ public File getElementAt(final int index) {
return fDirectories.elementAt(index);
}
}
@@ -1257,11 +1261,14 @@
// 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<FileFilter> createFilterComboBoxRenderer() {
+ return new AquaComboBoxRendererInternal<FileFilter>(filterComboBox) {
+ public Component getListCellRendererComponent(final JList<? extends FileFilter> 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 void actionPerformed(final ActionEvent e) {
- getFileChooser().setFileFilter((FileFilter)filterComboBox.getSelectedItem());
+ getFileChooser().setFileFilter((FileFilter) filterComboBox.getSelectedItem());
}
}
@@ -1503,7 +1510,7 @@
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 @@
// 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 @@
}
}
- JComboBox directoryComboBox;
+ JComboBox<File> directoryComboBox;
DirectoryComboBoxModel fDirectoryComboBoxModel;
private final Action directoryComboBoxAction = new DirectoryComboBoxAction();
@@ -1797,7 +1804,7 @@
JTableExtension fFileList;
private FilterComboBoxModel filterComboBoxModel;
- JComboBox filterComboBox;
+ JComboBox<FileFilter> filterComboBox;
private final Action filterComboBoxAction = new FilterComboBoxAction();
private static final Dimension hstrut10 = new Dimension(10, 1);
--- a/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaFocusHandler.java Tue Jul 29 09:09:55 2014 -0700
@@ -131,7 +131,7 @@
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 @@
}
}
- 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));
}
--- a/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaListUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -79,7 +79,7 @@
* 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 @@
}*/
}
- JList getComponent() {
+ JList<Object> getComponent() {
return list;
}
@@ -144,7 +144,7 @@
final Rectangle rowBounds = getCellBounds(list, selectedIndex, selectedIndex);
if (rowBounds == null) return;
- final ListCellRenderer renderer = list.getCellRenderer();
+ final ListCellRenderer<Object> renderer = list.getCellRenderer();
if (renderer == null) return;
final Component rendererComponent = renderer.getListCellRendererComponent(list, value, selectedIndex, selected, true);
--- a/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -3820,7 +3820,7 @@
_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;
--- a/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaTableHeaderUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -69,6 +69,7 @@
final static RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>> TABLE_HEADER_APPLICATORS = new RecyclableSingleton<ClientPropertyApplicator<JTableHeader, JTableHeader>>() {
@Override
+ @SuppressWarnings("unchecked")
protected ClientPropertyApplicator<JTableHeader, JTableHeader> getInstance() {
return new ClientPropertyApplicator<JTableHeader, JTableHeader>(
new Property<JTableHeader>("JTableHeader.selectedColumn") {
--- a/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtilControlSize.java Tue Jul 29 09:09:55 2014 -0700
@@ -121,7 +121,7 @@
try {
// see if this component has a "getUI" method
final Class<? extends JComponent> 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]);
--- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java Tue Jul 29 09:09:55 2014 -0700
@@ -82,7 +82,8 @@
@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 @@
@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) {
--- a/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/ClientPropertyApplicator.java Tue Jul 29 09:09:55 2014 -0700
@@ -33,6 +33,7 @@
public class ClientPropertyApplicator<T extends JComponent, N> implements PropertyChangeListener {
private final Map<String, Property<N>> properties = new HashMap<String, Property<N>>();
+ @SuppressWarnings("unchecked")
public ClientPropertyApplicator(final Property<N>... propertyList) {
for (final Property<N> p : propertyList) {
properties.put(p.name, p);
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuBar.java Tue Jul 29 09:09:55 2014 -0700
@@ -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,54 +246,25 @@
fSubmenus.remove(menu);
}
- private static Field[] stolenFields = null;
-
- static {
- stolenFields = AccessController.doPrivileged(new PrivilegedAction<Field[]>() {
- 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<Menu> menus = (Vector<Menu>)stolenFields[0].get(this);
- menus.insertElementAt(m, index);
-
- stolenFields[1].set(m, this);
+ final Vector<Menu> menus = AWTAccessor.getMenuBarAccessor().getMenus(this);
+ menus.insertElementAt(m, index);
+ AWTAccessor.getMenuComponentAccessor().setParent(m, this);
- final sun.lwawt.macosx.CMenuBar peer = (sun.lwawt.macosx.CMenuBar)getPeer();
- if (peer == null) return m;
+ final CMenuBar peer = (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;
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/awt/datatransfer/flavormap.properties Tue Jul 29 09:09:55 2014 -0700
@@ -0,0 +1,76 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the Mac OS X platform-specific,
+# default mappings between common Mac OS X selection atoms and platform-independent
+# MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# The standard format is:
+#
+# <native>=<MIME type>,<MIME type>, ...
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate DataFlavor values and set multiple values for a single native by
+# separating them with ",". If a mapping contains a duplicate key or value,
+# earlier mappings which included this key or value will be preferred.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+
+# The COMPOUND_TEXT support for inter-client text transfer is disabled by
+# default. The reason is that many native applications prefer this format over
+# other native text formats, but are unable to decode the textual data in this
+# format properly. This results in java-to-native text transfer failures.
+# To enable the COMPOUND_TEXT support for this JRE installation uncomment
+# the line below.
+
+# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
+
+TEXT=text/plain;eoln="\n";terminators=0
+STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
+TIFF=image/x-java-image;class=java.awt.Image
+RICH_TEXT=text/rtf
+HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
+URL=application/x-java-url;class=java.net.URL,\
+ text/uri-list;eoln="\r\n";terminators=1
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java Tue Jul 29 09:09:55 2014 -0700
@@ -88,7 +88,7 @@
super.startDrag(dsc, cursor, dragImage, dragImageOffset);
}
- protected void startDrag(Transferable transferable, long[] formats, Map formatMap) {
+ protected void startDrag(Transferable transferable, long[] formats, Map<Long, DataFlavor> formatMap) {
DragGestureEvent trigger = getTrigger();
InputEvent triggerEvent = trigger.getTriggerEvent();
@@ -311,7 +311,7 @@
}
}
- 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 @@
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<Long, DataFlavor> formatMap);
private native void doDragging(long nativeDragSource);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethod.java Tue Jul 29 09:09:55 2014 -0700
@@ -44,13 +44,14 @@
public class CInputMethod extends InputMethodAdapter {
private InputMethodContext fIMContext;
private Component fAwtFocussedComponent;
- private LWComponentPeer fAwtFocussedComponentPeer;
+ private LWComponentPeer<?, ?> fAwtFocussedComponentPeer;
private boolean isActive;
private static Map<TextAttribute, Integer>[] sHighlightStyles;
// Intitalize highlight mapping table and its mapper.
static {
+ @SuppressWarnings({"rawtypes", "unchecked"})
Map<TextAttribute, Integer> styles[] = new Map[4];
HashMap<TextAttribute, Integer> map;
@@ -242,7 +243,7 @@
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 @@
* 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 @@
/**
* @see java.awt.Toolkit#mapInputMethodHighlight
*/
- public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+ public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
int index;
int state = highlight.getState();
if (state == InputMethodHighlight.RAW_TEXT) {
@@ -384,7 +385,7 @@
// 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 @@
// 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();
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CInputMethodDescriptor.java Tue Jul 29 09:09:55 2014 -0700
@@ -57,7 +57,7 @@
}
static Object[] getAvailableLocalesInternal() {
- List workList = nativeGetAvailableLocales();
+ List<?> workList = nativeGetAvailableLocales();
if (workList != null) {
return workList.toArray();
@@ -119,5 +119,5 @@
}
private static native void nativeInit();
- private static native List nativeGetAvailableLocales();
+ private static native List<?> nativeGetAvailableLocales();
}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Jul 29 09:09:55 2014 -0700
@@ -151,7 +151,7 @@
return (bits & mask) != 0;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "rawtypes"})
static ClientPropertyApplicator<JRootPane, CPlatformWindow> CLIENT_PROPERTY_APPLICATOR = new ClientPropertyApplicator<JRootPane, CPlatformWindow>(new Property[] {
new Property<CPlatformWindow>(WINDOW_DOCUMENT_MODIFIED) { public void applyProperty(final CPlatformWindow c, final Object value) {
c.setStyleBits(DOCUMENT_MODIFIED, value == null ? false : Boolean.parseBoolean(value.toString()));
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Tue Jul 29 09:09:55 2014 -0700
@@ -32,6 +32,7 @@
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.*;
@@ -543,9 +544,9 @@
return super.getImage(filename);
}
- String fileneame2x = getScaledImageName(filename);
- return (imageExists(fileneame2x))
- ? getImageWithResolutionVariant(filename, fileneame2x)
+ String filename2x = getScaledImageName(filename);
+ return (imageExists(filename2x))
+ ? getImageWithResolutionVariant(filename, filename2x)
: super.getImage(filename);
}
@@ -691,6 +692,7 @@
}
@Override
+ @SuppressWarnings("unchecked")
public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
Class<T> abstractRecognizerClass, DragSource ds, Component c,
int srcActions, DragGestureListener dgl) {
@@ -743,7 +745,7 @@
* @since 1.3
*/
@Override
- public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+ public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
return CInputMethod.mapInputMethodHighlight(highlight);
}
@@ -906,6 +908,9 @@
}
private static boolean isValidPath(String path) {
- return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".");
+ return path != null &&
+ !path.isEmpty() &&
+ !path.endsWith("/") &&
+ !path.endsWith(".");
}
}
--- a/jdk/src/macosx/lib/flavormap.properties Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#
-# This properties file is used to initialize the default
-# java.awt.datatransfer.SystemFlavorMap. It contains the Mac OS X platform-specific,
-# default mappings between common Mac OS X selection atoms and platform-independent
-# MIME type strings, which will be converted into
-# java.awt.datatransfer.DataFlavors.
-#
-# These default mappings may be augmented by specifying the
-#
-# AWT.DnD.flavorMapFileURL
-#
-# property in the appropriate awt.properties file. The specified properties URL
-# will be loaded into the SystemFlavorMap.
-#
-# The standard format is:
-#
-# <native>=<MIME type>
-#
-# <native> should be a string identifier that the native platform will
-# recognize as a valid data format. <MIME type> should specify both a MIME
-# primary type and a MIME subtype separated by a '/'. The MIME type may include
-# parameters, where each parameter is a key/value pair separated by '=', and
-# where each parameter to the MIME type is separated by a ';'.
-#
-# Because SystemFlavorMap implements FlavorTable, developers are free to
-# duplicate both native keys and DataFlavor values. If a mapping contains a
-# duplicate key or value, earlier mappings which included this key or value
-# will be preferred.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", and which support the charset parameter, should specify the exact
-# format in which the native platform expects the data. The "charset"
-# parameter specifies the char to byte encoding, the "eoln" parameter
-# specifies the end-of-line marker, and the "terminators" parameter specifies
-# the number of terminating NUL bytes. Note that "eoln" and "terminators"
-# are not standardized MIME type parameters. They are specific to this file
-# format ONLY. They will not appear in any of the DataFlavors returned by the
-# SystemFlavorMap at the Java level.
-#
-# If the "charset" parameter is omitted, or has zero length, the platform
-# default encoding is assumed. If the "eoln" parameter is omitted, or has
-# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
-# or has a value less than zero, zero is assumed.
-#
-# Upon initialization, the data transfer subsystem will record the specified
-# details of the native text format, but the default SystemFlavorMap will
-# present a large set of synthesized DataFlavors which map, in both
-# directions, to the native. After receiving data from the application in one
-# of the synthetic DataFlavors, the data transfer subsystem will transform
-# the data stream into the format specified in this file before passing the
-# transformed stream to the native system.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", but which do not support the charset parameter, will be treated as
-# opaque, 8-bit data. They will not undergo any transformation process, and
-# any "charset", "eoln", or "terminators" parameters specified in this file
-# will be ignored.
-#
-# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
-# text flavors which support the charset parameter.
-
-UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
-
-# The COMPOUND_TEXT support for inter-client text transfer is disabled by
-# default. The reason is that many native applications prefer this format over
-# other native text formats, but are unable to decode the textual data in this
-# format properly. This results in java-to-native text transfer failures.
-# To enable the COMPOUND_TEXT support for this JRE installation uncomment
-# the line below.
-
-# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
-
-TEXT=text/plain;eoln="\n";terminators=0
-STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
-FILE_NAME=application/x-java-file-list;class=java.util.List
-text/uri-list=application/x-java-file-list;class=java.util.List
-PNG=image/x-java-image;class=java.awt.Image
-JFIF=image/x-java-image;class=java.awt.Image
-TIFF=image/x-java-image;class=java.awt.Image
-RICH_TEXT=text/rtf
-HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
-URL=application/x-java-url;class=java.net.URL
-URL=text/uri-list;eoln="\r\n";terminators=1
--- a/jdk/src/macosx/native/apple/launcher/JavaAppLauncher.m Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import "apple_launcher_JavaAppLauncher.h"
-
-#import <Cocoa/Cocoa.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-
-/*
- * Class: apple_launcher_JavaAppLauncher
- * Method: nativeConvertAndRelease
- * Signature: (J)Ljava/lang/Object;
- */
-JNIEXPORT jobject JNICALL Java_apple_launcher_JavaAppLauncher_nativeConvertAndRelease
-(JNIEnv *env, jclass clazz, jlong nsObjectPtr) {
-
- jobject value = NULL;
-
-JNF_COCOA_ENTER(env);
-
- id obj = jlong_to_ptr(nsObjectPtr);
- value = [[JNFDefaultCoercions defaultCoercer] coerceNSObject:obj withEnv:env];
- CFRelease(obj);
-
-JNF_COCOA_EXIT(env);
-
- return value;
-}
-
-/*
- * Class: apple_launcher_JavaAppLauncher
- * Method: nativeInvokeNonPublic
- * Signature: (Ljava/lang/Class;Ljava/lang/reflect/Method;[Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_apple_launcher_JavaAppLauncher_nativeInvokeNonPublic
-(JNIEnv *env, jclass clazz, jclass targetClass, jobject targetMethod, jobjectArray args) {
- jmethodID mainMethodID = (*env)->FromReflectedMethod(env, targetMethod);
- if ((*env)->ExceptionOccurred(env)) return;
- (*env)->CallStaticVoidMethod(env, targetClass, mainMethodID, args);
-}
--- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m Tue Jul 29 09:09:55 2014 -0700
@@ -45,6 +45,7 @@
#include <dlfcn.h>
#include <sizecalc.h>
+#import "ThreadUtilities.h"
static NSScreen* SplashNSScreen()
{
@@ -130,8 +131,12 @@
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];
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java Tue Jul 29 09:09:55 2014 -0700
@@ -126,18 +126,18 @@
new IIOMetadataNode(nativeMetadataFormatName);
addChildNode(root, "BMPVersion", bmpVersion);
- addChildNode(root, "Width", new Integer(width));
- addChildNode(root, "Height", new Integer(height));
+ addChildNode(root, "Width", width);
+ addChildNode(root, "Height", height);
addChildNode(root, "BitsPerPixel", new Short(bitsPerPixel));
- addChildNode(root, "Compression", new Integer(compression));
- addChildNode(root, "ImageSize", new Integer(imageSize));
+ addChildNode(root, "Compression", compression);
+ addChildNode(root, "ImageSize", imageSize);
IIOMetadataNode node = addChildNode(root, "PixelsPerMeter", null);
- addChildNode(node, "X", new Integer(xPixelsPerMeter));
- addChildNode(node, "Y", new Integer(yPixelsPerMeter));
+ addChildNode(node, "X", xPixelsPerMeter);
+ addChildNode(node, "Y", yPixelsPerMeter);
- addChildNode(root, "ColorsUsed", new Integer(colorsUsed));
- addChildNode(root, "ColorsImportant", new Integer(colorsImportant));
+ addChildNode(root, "ColorsUsed", colorsUsed);
+ addChildNode(root, "ColorsImportant", colorsImportant);
int version = 0;
for (int i = 0; i < bmpVersion.length(); i++)
@@ -146,19 +146,19 @@
if (version >= 4) {
node = addChildNode(root, "Mask", null);
- addChildNode(node, "Red", new Integer(redMask));
- addChildNode(node, "Green", new Integer(greenMask));
- addChildNode(node, "Blue", new Integer(blueMask));
- addChildNode(node, "Alpha", new Integer(alphaMask));
+ addChildNode(node, "Red", redMask);
+ addChildNode(node, "Green", greenMask);
+ addChildNode(node, "Blue", blueMask);
+ addChildNode(node, "Alpha", alphaMask);
- addChildNode(root, "ColorSpaceType", new Integer(colorSpace));
+ addChildNode(root, "ColorSpaceType", colorSpace);
node = addChildNode(root, "CIEXYZEndPoints", null);
addXYZPoints(node, "Red", redX, redY, redZ);
addXYZPoints(node, "Green", greenX, greenY, greenZ);
addXYZPoints(node, "Blue", blueX, blueY, blueZ);
- node = addChildNode(root, "Intent", new Integer(intent));
+ node = addChildNode(root, "Intent", intent);
}
// Palette
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java Tue Jul 29 09:09:55 2014 -0700
@@ -2323,7 +2323,7 @@
SOSMarkerSegment sos = (SOSMarkerSegment) seg;
SOSMarkerSegment.ScanComponentSpec [] specs = sos.componentSpecs;
for (int i = 0; i < specs.length; i++) {
- Integer id = new Integer(specs[i].componentSelector);
+ Integer id = specs[i].componentSelector;
if (!ids.contains(id)) {
ids.add(id);
}
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java Tue Jul 29 09:09:55 2014 -0700
@@ -639,7 +639,7 @@
metadata.zTXt_keyword.add(keyword);
int method = stream.readUnsignedByte();
- metadata.zTXt_compressionMethod.add(new Integer(method));
+ metadata.zTXt_compressionMethod.add(method);
byte[] b = new byte[chunkLength - keyword.length() - 2];
stream.readFully(b);
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java Tue Jul 29 09:09:55 2014 -0700
@@ -1254,8 +1254,11 @@
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 =
@@ -1644,7 +1647,7 @@
int compressionMethod =
getEnumeratedAttribute(zTXt_node, "compressionMethod",
zTXt_compressionMethodNames);
- zTXt_compressionMethod.add(new Integer(compressionMethod));
+ zTXt_compressionMethod.add(compressionMethod);
String text = getAttribute(zTXt_node, "text");
zTXt_text.add(text);
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPMetadata.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPMetadata.java Tue Jul 29 09:09:55 2014 -0700
@@ -75,9 +75,9 @@
IIOMetadataNode root =
new IIOMetadataNode(nativeMetadataFormatName);
- addChildNode(root, "WBMPType", new Integer(wbmpType));
- addChildNode(root, "Width", new Integer(width));
- addChildNode(root, "Height", new Integer(height));
+ addChildNode(root, "WBMPType", wbmpType);
+ addChildNode(root, "Width", width);
+ addChildNode(root, "Height", height);
return root;
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Tue Jul 29 09:09:55 2014 -0700
@@ -812,12 +812,12 @@
"OptionPane.setButtonMargin", Boolean.FALSE,
"OptionPane.sameSizeButtons", Boolean.TRUE,
- "OptionPane.buttonOrientation", new Integer(SwingConstants.RIGHT),
+ "OptionPane.buttonOrientation", SwingConstants.RIGHT,
"OptionPane.minimumSize", new DimensionUIResource(262, 90),
- "OptionPane.buttonPadding", new Integer(10),
+ "OptionPane.buttonPadding", 10,
"OptionPane.windowBindings", new Object[] {
"ESCAPE", "close" },
- "OptionPane.buttonClickThreshhold", new Integer(500),
+ "OptionPane.buttonClickThreshhold", 500,
"OptionPane.isYesLast", Boolean.TRUE,
"OptionPane.font", new FontLazyValue(Region.OPTION_PANE),
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Tue Jul 29 09:09:55 2014 -0700
@@ -567,7 +567,7 @@
"ProgressBar.selectionForeground", table.get("control"),
"ProgressBar.selectionBackground", table.get("controlText"),
"ProgressBar.border", loweredBevelBorder,
- "ProgressBar.cellLength", new Integer(6),
+ "ProgressBar.cellLength", 6,
"ProgressBar.cellSpacing", Integer.valueOf(0),
// Buttons
@@ -582,7 +582,7 @@
"released SPACE", "released"
}),
- "CheckBox.textIconGap", new Integer(8),
+ "CheckBox.textIconGap", 8,
"CheckBox.margin", new InsetsUIResource(4, 2, 4, 2),
"CheckBox.icon", checkBoxIcon,
"CheckBox.focus", table.get("activeCaptionBorder"),
@@ -593,7 +593,7 @@
}),
"RadioButton.margin", new InsetsUIResource(4, 2, 4, 2),
- "RadioButton.textIconGap", new Integer(8),
+ "RadioButton.textIconGap", 8,
"RadioButton.background", table.get("control"),
"RadioButton.foreground", table.get("controlText"),
"RadioButton.icon", radioButtonIcon,
@@ -627,10 +627,10 @@
"Menu.selectionBackground", menuItemPressedBackground,
"Menu.checkIcon", menuItemCheckIcon,
"Menu.arrowIcon", menuArrowIcon,
- "Menu.menuPopupOffsetX", new Integer(0),
- "Menu.menuPopupOffsetY", new Integer(0),
- "Menu.submenuPopupOffsetX", new Integer(-2),
- "Menu.submenuPopupOffsetY", new Integer(3),
+ "Menu.menuPopupOffsetX", 0,
+ "Menu.menuPopupOffsetY", 0,
+ "Menu.submenuPopupOffsetX", -2,
+ "Menu.submenuPopupOffsetY", 3,
"Menu.shortcutKeys", new int[]{
SwingUtilities2.getSystemMnemonicKeyMask(),
KeyEvent.META_MASK
@@ -938,7 +938,7 @@
"Tree.collapsedIcon", treeCollapsedIcon,
"Tree.editorBorder", focusBorder,
"Tree.editorBorderSelectionColor", table.get("activeCaptionBorder"),
- "Tree.rowHeight", new Integer(18),
+ "Tree.rowHeight", 18,
"Tree.drawsFocusBorderAroundIcon", Boolean.TRUE,
"Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
"COPY", "copy",
--- a/jdk/src/share/classes/java/awt/Color.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Color.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* see <A href="http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html">
* http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html
* </A>.
- * <p>
+ *
* @version 10 Feb 1997
* @author Sami Shaio
* @author Arthur van Hoff
--- a/jdk/src/share/classes/java/awt/Font.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Font.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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".
- * <p>
*
* @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
--- a/jdk/src/share/classes/java/awt/Graphics.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Graphics.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* is specified by the <code>width</code> and <code>height</code>
* arguments.
* </ul>
- * <p>
+ *
* @param x the <i>x</i> coordinate.
* @param y the <i>y</i> coordinate.
* @param width the width of the clipping rectangle.
--- a/jdk/src/share/classes/java/awt/MenuComponent.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/MenuComponent.java Tue Jul 29 09:09:55 2014 -0700
@@ -132,16 +132,24 @@
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();
}
--- a/jdk/src/share/classes/java/awt/Polygon.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Polygon.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
/**
* Determines whether the specified coordinates are inside this
* <code>Polygon</code>.
- * <p>
+ *
* @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
--- a/jdk/src/share/classes/java/awt/Rectangle.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Rectangle.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* <p>
* <a name="Empty">
* 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.</a>
* 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>
* <p>
* <a name="NonExistant">
* A {@code Rectangle} whose width or height is negative has neither
@@ -422,7 +421,7 @@
* <code>Rectangle</code> to the specified
* <code>x</code>, <code>y</code>, <code>width</code>,
* and <code>height</code>.
- * <p>
+ *
* @param x the new X coordinate for the upper-left
* corner of this <code>Rectangle</code>
* @param y the new Y coordinate for the upper-left
@@ -488,7 +487,7 @@
/**
* Moves this <code>Rectangle</code> to the specified location.
- * <p>
+ *
* @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 @@
/**
* Sets the size of this <code>Rectangle</code> to the specified
* width and height.
- * <p>
+ *
* @param width the new width for this <code>Rectangle</code>
* @param height the new height for this <code>Rectangle</code>
* @deprecated As of JDK version 1.1,
--- a/jdk/src/share/classes/java/awt/Toolkit.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Toolkit.java Tue Jul 29 09:09:55 2014 -0700
@@ -1241,10 +1241,9 @@
* clipboard enables data transfer between Java programs and native
* applications which use native clipboard facilities.
* <p>
- * In addition to any and all formats specified in the flavormap.properties
- * file, or other file specified by the <code>AWT.DnD.flavorMapFileURL
- * </code> Toolkit property, text returned by the system Clipboard's <code>
- * getTransferData()</code> method is available in the following flavors:
+ * In addition to any and all default formats text returned by the system
+ * Clipboard's <code>getTransferData()</code> method is available in the
+ * following flavors:
* <ul>
* <li>DataFlavor.stringFlavor</li>
* <li>DataFlavor.plainTextFlavor (<b>deprecated</b>)</li>
--- a/jdk/src/share/classes/java/awt/color/ColorSpace.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/color/ColorSpace.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* convert from CS_CIEXYZ to the output color space.
* See {@link #toCIEXYZ(float[]) toCIEXYZ} and
* {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
- * <p>
+ *
* @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 @@
* convert from CS_CIEXYZ to the output color space.
* See {@link #toCIEXYZ(float[]) toCIEXYZ} and
* {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
- * <p>
+ *
* @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 @@
* that would be measured using current CIE recommended practices.
* See the {@link ICC_ColorSpace#toCIEXYZ(float[]) toCIEXYZ} method of
* <code>ICC_ColorSpace</code> for further information.
- * <p>
+ *
* @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 @@
* relative values before being passed to this method.
* See the {@link ICC_ColorSpace#fromCIEXYZ(float[]) fromCIEXYZ} method of
* <code>ICC_ColorSpace</code> for further information.
- * <p>
+ *
* @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
--- a/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/color/ICC_ColorSpace.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* convert from CS_CIEXYZ to the output color space.
* See {@link #toCIEXYZ(float[]) toCIEXYZ} and
* {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
- * <p>
+ *
* @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 @@
* convert from CS_CIEXYZ to the output color space.
* See {@link #toCIEXYZ(float[]) toCIEXYZ} and
* {@link #fromCIEXYZ(float[]) fromCIEXYZ} for further information.
- * <p>
+ *
* @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 @@
* 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.
- * <p>
+ *
* @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 @@
* 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.
- * <p>
+ *
* @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.
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java Tue Jul 29 09:09:55 2014 -0700
@@ -27,6 +27,8 @@
import java.awt.Toolkit;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
import java.lang.ref.SoftReference;
import java.io.BufferedReader;
@@ -38,6 +40,7 @@
import java.net.MalformedURLException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -45,6 +48,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Properties;
import java.util.Set;
import sun.awt.AppContext;
@@ -210,193 +214,48 @@
}
/**
- * Initializes a SystemFlavorMap by reading flavormap.properties and
- * AWT.DnD.flavorMapFileURL.
+ * Initializes a SystemFlavorMap by reading flavormap.properties
* For thread-safety must be called under lock on this.
*/
private void initSystemFlavorMap() {
if (isMapInitialized) {
return;
}
-
isMapInitialized = true;
- BufferedReader flavormapDotProperties =
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<BufferedReader>() {
- public BufferedReader run() {
- String fileName =
- System.getProperty("java.home") +
- File.separator +
- "lib" +
- File.separator +
- "flavormap.properties";
- try {
- return new BufferedReader
- (new InputStreamReader
- (new File(fileName).toURI().toURL().openStream(), "ISO-8859-1"));
- } catch (MalformedURLException e) {
- System.err.println("MalformedURLException:" + e + " while loading default flavormap.properties file:" + fileName);
- } catch (IOException e) {
- System.err.println("IOException:" + e + " while loading default flavormap.properties file:" + fileName);
- }
- return null;
- }
- });
- String url =
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<String>() {
- public String run() {
- return Toolkit.getProperty("AWT.DnD.flavorMapFileURL", null);
- }
- });
-
- if (flavormapDotProperties != null) {
- try {
- parseAndStoreReader(flavormapDotProperties);
- } catch (IOException e) {
- System.err.println("IOException:" + e + " while parsing default flavormap.properties file");
- }
- }
-
- BufferedReader flavormapURL = null;
- if (url != null) {
- try {
- flavormapURL = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "ISO-8859-1"));
- } catch (MalformedURLException e) {
- System.err.println("MalformedURLException:" + e + " while reading AWT.DnD.flavorMapFileURL:" + url);
- } catch (IOException e) {
- System.err.println("IOException:" + e + " while reading AWT.DnD.flavorMapFileURL:" + url);
- } catch (SecurityException e) {
- // ignored
- }
+ InputStream is = SystemFlavorMap.class.getResourceAsStream("/sun/awt/datatransfer/flavormap.properties");
+ if (is == null) {
+ throw new InternalError("Default flavor mapping not found");
}
- if (flavormapURL != null) {
- try {
- parseAndStoreReader(flavormapURL);
- } catch (IOException e) {
- System.err.println("IOException:" + e + " while parsing AWT.DnD.flavorMapFileURL");
- }
- }
- }
- /**
- * Copied code from java.util.Properties. Parsing the data ourselves is the
- * only way to handle duplicate keys and values.
- */
- private void parseAndStoreReader(BufferedReader in) throws IOException {
- while (true) {
- // Get next line
- String line = in.readLine();
- if (line == null) {
- return;
- }
-
- if (line.length() > 0) {
- // Continue lines that end in slashes if they are not comments
- char firstChar = line.charAt(0);
- if (firstChar != '#' && firstChar != '!') {
- while (continueLine(line)) {
- String nextLine = in.readLine();
- if (nextLine == null) {
- nextLine = "";
- }
- String loppedLine =
- line.substring(0, line.length() - 1);
- // Advance beyond whitespace on new line
- int startIndex = 0;
- for(; startIndex < nextLine.length(); startIndex++) {
- if (whiteSpaceChars.
- indexOf(nextLine.charAt(startIndex)) == -1)
- {
- break;
- }
- }
- nextLine = nextLine.substring(startIndex,
- nextLine.length());
- line = loppedLine+nextLine;
- }
-
- // Find start of key
- int len = line.length();
- int keyStart = 0;
- for(; keyStart < len; keyStart++) {
- if(whiteSpaceChars.
- indexOf(line.charAt(keyStart)) == -1) {
- break;
- }
- }
-
- // Blank lines are ignored
- if (keyStart == len) {
- continue;
- }
-
- // Find separation between key and value
- int separatorIndex = keyStart;
- for(; separatorIndex < len; separatorIndex++) {
- char currentChar = line.charAt(separatorIndex);
- if (currentChar == '\\') {
- separatorIndex++;
- } else if (keyValueSeparators.
- indexOf(currentChar) != -1) {
- break;
- }
- }
-
- // Skip over whitespace after key if any
- int valueIndex = separatorIndex;
- for (; valueIndex < len; valueIndex++) {
- if (whiteSpaceChars.
- indexOf(line.charAt(valueIndex)) == -1) {
- break;
- }
- }
-
- // Skip over one non whitespace key value separators if any
- if (valueIndex < len) {
- if (strictKeyValueSeparators.
- indexOf(line.charAt(valueIndex)) != -1) {
- valueIndex++;
- }
- }
-
- // Skip over white space after other separators if any
- while (valueIndex < len) {
- if (whiteSpaceChars.
- indexOf(line.charAt(valueIndex)) == -1) {
- break;
- }
- valueIndex++;
- }
-
- String key = line.substring(keyStart, separatorIndex);
- String value = (separatorIndex < len)
- ? line.substring(valueIndex, len)
- : "";
-
- // Convert then store key and value
- key = loadConvert(key);
- value = loadConvert(value);
-
+ try (InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader reader = new BufferedReader(isr)) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ line = line.trim();
+ if (line.startsWith("#") || line.isEmpty()) continue;
+ while (line.endsWith("\\")) {
+ line = line.substring(0, line.length() - 1) + reader.readLine().trim();
+ }
+ int delimiterPosition = line.indexOf('=');
+ String key = line.substring(0, delimiterPosition).replace("\\ ", " ");
+ String[] values = line.substring(delimiterPosition + 1, line.length()).split(",");
+ for (String value : values) {
try {
MimeType mime = new MimeType(value);
if ("text".equals(mime.getPrimaryType())) {
String charset = mime.getParameter("charset");
- if (DataTransferer.doesSubtypeSupportCharset
- (mime.getSubType(), charset))
+ if (DataTransferer.doesSubtypeSupportCharset(mime.getSubType(), charset))
{
// We need to store the charset and eoln
// parameters, if any, so that the
// DataTransferer will have this information
// for conversion into the native format.
- DataTransferer transferer =
- DataTransferer.getInstance();
+ DataTransferer transferer = DataTransferer.getInstance();
if (transferer != null) {
- transferer.registerTextFlavorProperties
- (key, charset,
- mime.getParameter("eoln"),
- mime.getParameter("terminators"));
+ transferer.registerTextFlavorProperties(key, charset,
+ mime.getParameter("eoln"),
+ mime.getParameter("terminators"));
}
}
@@ -441,78 +300,9 @@
}
}
}
- }
- }
-
- /**
- * Copied from java.util.Properties.
- */
- private boolean continueLine (String line) {
- int slashCount = 0;
- int index = line.length() - 1;
- while((index >= 0) && (line.charAt(index--) == '\\')) {
- slashCount++;
+ } catch (IOException e) {
+ throw new InternalError("Error reading default flavor mapping", e);
}
- return (slashCount % 2 == 1);
- }
-
- /**
- * Copied from java.util.Properties.
- */
- private String loadConvert(String theString) {
- char aChar;
- int len = theString.length();
- StringBuilder outBuffer = new StringBuilder(len);
-
- for (int x = 0; x < len; ) {
- aChar = theString.charAt(x++);
- if (aChar == '\\') {
- aChar = theString.charAt(x++);
- if (aChar == 'u') {
- // Read the xxxx
- int value = 0;
- for (int i = 0; i < 4; i++) {
- aChar = theString.charAt(x++);
- switch (aChar) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9': {
- value = (value << 4) + aChar - '0';
- break;
- }
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f': {
- value = (value << 4) + 10 + aChar - 'a';
- break;
- }
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F': {
- value = (value << 4) + 10 + aChar - 'A';
- break;
- }
- default: {
- throw new IllegalArgumentException(
- "Malformed \\uxxxx encoding.");
- }
- }
- }
- outBuffer.append((char)value);
- } else {
- if (aChar == 't') {
- aChar = '\t';
- } else if (aChar == 'r') {
- aChar = '\r';
- } else if (aChar == 'n') {
- aChar = '\n';
- } else if (aChar == 'f') {
- aChar = '\f';
- }
- outBuffer.append(aChar);
- }
- } else {
- outBuffer.append(aChar);
- }
- }
- return outBuffer.toString();
}
/**
--- a/jdk/src/share/classes/java/awt/font/TextAttribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/font/TextAttribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -96,7 +96,7 @@
* </UL>
*
* <h4>Summary of attributes</h4>
- * <table style="float:center" border="0" cellspacing="0" cellpadding="2" width="%95"
+ * <table style="float:center" border="0" cellspacing="0" cellpadding="2" width="95%"
* summary="Key, value type, principal constants, and default value
* behavior of all TextAttributes">
* <tr style="background-color:#ccccff">
--- a/jdk/src/share/classes/java/awt/geom/Arc2D.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/geom/Arc2D.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* <p>
* <a name="inscribes">
* The arc is a partial section of a full ellipse which
- * inscribes the framing rectangle of its parent {@link RectangularShape}.
- * </a>
+ * inscribes the framing rectangle of its parent</a> {@link RectangularShape}.
+ *
* <a name="angles">
* The angles are specified relative to the non-square
* framing rectangle such that 45 degrees always falls on the line from
--- a/jdk/src/share/classes/java/awt/image/AffineTransformOp.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/AffineTransformOp.java Tue Jul 29 09:09:55 2014 -0700
@@ -324,7 +324,7 @@
* 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 <code>Raster</code>.
- * <p>
+ *
* @param src The <CODE>Raster</CODE> to transform.
* @param dst The <CODE>Raster</CODE> in which to store the results of the
* transformation.
--- a/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/BufferedImageFilter.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* an image should avoid calling this method directly since that
* operation could result in problems with retrieving the requested
* pixels.
- * <p>
+ *
* @param width the width to which to set the width of this
* <code>BufferedImageFilter</code>
* @param height the height to which to set the height of this
--- a/jdk/src/share/classes/java/awt/image/ImageFilter.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java Tue Jul 29 09:09:55 2014 -0700
@@ -225,7 +225,7 @@
*
* <li>
* 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.
*
--- a/jdk/src/share/classes/java/awt/image/WritableRaster.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/WritableRaster.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <p>
+ *
* @param srcRaster The Raster from which to copy pixels.
*
* @throws NullPointerException if srcRaster is null.
--- a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java Tue Jul 29 09:09:55 2014 -0700
@@ -370,7 +370,7 @@
* the specified parameter.
*/
public ParameterBlock add(int i) {
- return add(new Integer(i));
+ return add(i);
}
/**
@@ -489,7 +489,7 @@
* the specified parameter.
*/
public ParameterBlock set(int i, int index) {
- return set(new Integer(i), index);
+ return set(i, index);
}
/**
--- a/jdk/src/share/classes/java/awt/print/PrinterJob.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/awt/print/PrinterJob.java Tue Jul 29 09:09:55 2014 -0700
@@ -546,7 +546,6 @@
* user settings returned from
* <code>printDialog(PrintRequestAttributeSet attributes</code> to
* this print() method.
- * <p>
*
* @param attributes a set of attributes for the job
* @exception PrinterException an error in the print system
--- a/jdk/src/share/classes/java/beans/EventHandler.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/beans/EventHandler.java Tue Jul 29 09:09:55 2014 -0700
@@ -437,7 +437,7 @@
if (method.getDeclaringClass() == Object.class) {
// Handle the Object public methods.
if (methodName.equals("hashCode")) {
- return new Integer(System.identityHashCode(proxy));
+ return System.identityHashCode(proxy);
} else if (methodName.equals("equals")) {
return (proxy == arguments[0] ? Boolean.TRUE : Boolean.FALSE);
} else if (methodName.equals("toString")) {
--- a/jdk/src/share/classes/java/beans/MetaData.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/beans/MetaData.java Tue Jul 29 09:09:55 2014 -0700
@@ -123,13 +123,13 @@
Class<?> oldClass = oldInstance.getClass();
return new Expression(oldInstance, Array.class, "newInstance",
new Object[]{oldClass.getComponentType(),
- new Integer(Array.getLength(oldInstance))});
+ Array.getLength(oldInstance)});
}
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
int n = Array.getLength(oldInstance);
for (int i = 0; i < n; i++) {
- Object index = new Integer(i);
+ Object index = i;
// Expression oldGetExp = new Expression(Array.class, "get", new Object[]{oldInstance, index});
// Expression newGetExp = new Expression(Array.class, "get", new Object[]{newInstance, index});
Expression oldGetExp = new Expression(oldInstance, "get", new Object[]{index});
@@ -635,7 +635,7 @@
newSize = 0;
}
for (int i = 0; i < newSize; i++) {
- Object index = new Integer(i);
+ Object index = i;
Expression oldGetExp = new Expression(oldInstance, "get", new Object[]{index});
Expression newGetExp = new Expression(newInstance, "get", new Object[]{index});
@@ -892,7 +892,7 @@
protected Expression instantiate(Object oldInstance, Encoder out) {
java.awt.MenuShortcut m = (java.awt.MenuShortcut)oldInstance;
return new Expression(oldInstance, m.getClass(), "new",
- new Object[]{new Integer(m.getKey()), Boolean.valueOf(m.usesShiftModifier())});
+ new Object[]{m.getKey(), Boolean.valueOf(m.usesShiftModifier())});
}
}
--- a/jdk/src/share/classes/java/beans/NameGenerator.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/java/beans/NameGenerator.java Tue Jul 29 09:09:55 2014 -0700
@@ -107,7 +107,7 @@
Integer size = nameToCount.get(className);
int instanceNumber = (size == null) ? 0 : (size).intValue() + 1;
- nameToCount.put(className, new Integer(instanceNumber));
+ nameToCount.put(className, instanceNumber);
result = className + instanceNumber;
valueToName.put(instance, result);
--- a/jdk/src/share/classes/javax/imageio/package.html Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/imageio/package.html Tue Jul 29 09:09:55 2014 -0700
@@ -131,8 +131,8 @@
<li>the number of bands is 1;
<li>the number of bits per sample is not greater than 8;
<li>the size of a color component is not greater than 8;
-</ul> </p>
-
+</ul>
+
<p>
By default the GIF writer plug-in creates version "89a" images. This can be
changed to "87a" by explicitly setting the version in the
--- a/jdk/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -170,7 +170,7 @@
while (iter.hasNext()) {
DigraphNode<E> node = iter.next();
int inDegree = node.getInDegree();
- inDegrees.put(node, new Integer(inDegree));
+ inDegrees.put(node, inDegree);
// Add nodes with zero in-degree to the zero list
if (inDegree == 0) {
@@ -191,7 +191,7 @@
while (outNodes.hasNext()) {
DigraphNode<E> node = outNodes.next();
int inDegree = inDegrees.get(node).intValue() - 1;
- inDegrees.put(node, new Integer(inDegree));
+ inDegrees.put(node, inDegree);
// If the in-degree has fallen to 0, place the node on the list
if (inDegree == 0) {
--- a/jdk/src/share/classes/javax/print/Doc.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/Doc.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
+ *
* @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 @@
* 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.
- * <P>
+ *
* @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.
--- a/jdk/src/share/classes/javax/print/DocFlavor.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/DocFlavor.java Tue Jul 29 09:09:55 2014 -0700
@@ -381,7 +381,6 @@
* <LI>
* A line feed (LF) character standing by itself means
* "go to column 1 of the next line."
- * <LI>
* </UL>
* <P>
* The client must itself perform all plain text print data formatting not
@@ -436,7 +435,6 @@
* Java Print Service instance supports without having
* to load the representation classes, which may be problematic for
* limited-resource clients.
- * <P>
*
* @author Alan Kaminsky
*/
@@ -536,7 +534,7 @@
* 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.
- * <p>
+ *
* @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 @@
* Class DocFlavor.BYTE_ARRAY provides predefined static constant
* DocFlavor objects for example doc flavors using a byte array
* (<CODE>byte[]</CODE>) as the print data representation class.
- * <P>
*
* @author Alan Kaminsky
*/
@@ -836,7 +833,6 @@
* DocFlavor objects for example doc flavors using a byte stream ({@link
* java.io.InputStream java.io.InputStream}) as the print
* data representation class.
- * <P>
*
* @author Alan Kaminsky
*/
@@ -1038,8 +1034,7 @@
* objects.
* For example doc flavors using a Uniform Resource Locator ({@link
* java.net.URL java.net.URL}) as the print data
- * representation class.
- * <P>
+ * representation class.
*
* @author Alan Kaminsky
*/
@@ -1229,7 +1224,6 @@
* DocFlavor objects for example doc flavors using a character array
* (<CODE>char[]</CODE>) as the print data representation class. As such,
* the character set is Unicode.
- * <P>
*
* @author Alan Kaminsky
*/
@@ -1279,7 +1273,6 @@
* 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.
- * <P>
*
* @author Alan Kaminsky
*/
@@ -1327,7 +1320,6 @@
* 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.
- * <P>
*
* @author Alan Kaminsky
*/
@@ -1376,7 +1368,6 @@
* Class DocFlavor.SERVICE_FORMATTED provides predefined static constant
* DocFlavor objects for example doc flavors for service formatted print
* data.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/PrintService.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/PrintService.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* that indicates bounds on the legal values -- used, for example, by an
* integer-valued attribute that must lie within a certain range.
* </UL>
- * <P>
*
* @param category Printing attribute category to test. It must be a
* {@link java.lang.Class Class} that implements
--- a/jdk/src/share/classes/javax/print/PrintServiceLookup.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/PrintServiceLookup.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* available that is not part of the installation.
* If the lookup service is already registered, or cannot be registered,
* the method returns false.
- * <p>
*
* @param sp an implementation of a lookup service.
* @return <code>true</code> if the new lookup service is newly
@@ -305,7 +304,6 @@
* <p>
* Locates MultiDoc print services which can be positively confirmed
* to support the combination of attributes and DocFlavors specified.
- * <p>
*
* @param flavors of documents required. If null or empty it is ignored.
* @param attributes required to be supported. If null this
--- a/jdk/src/share/classes/javax/print/ServiceUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/ServiceUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* }
* }
* }</pre>
- * <p>
-
+ *
* @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
--- a/jdk/src/share/classes/javax/print/ServiceUIFactory.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/ServiceUIFactory.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
/**
* Get a UI object which may be cast to the requested UI type
* by the application and used in its user interface.
- * <P>
+ *
* @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.
--- a/jdk/src/share/classes/javax/print/SimpleDoc.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/SimpleDoc.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* However, if the print data representation object is itself a
* <code>Reader</code> then the print data representation object is
* simply returned.
- * <P>
+ *
* @return a <code>Reader</code> 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 @@
* However, if the print data representation object is itself an
* input stream then the print data representation object is simply
* returned.
- * <P>
+ *
* @return an <code>InputStream</code> for reading the print data
* bytes from this doc. If an input stream cannot be
* provided because this doc does not meet
--- a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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).
- * <p>
+ *
* @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 @@
* Implementations which allocate resources on construction should examine
* the stream and may wish to only allocate resources if the stream is
* non-null.
- * <p>
+ *
* @param out destination stream for generated output.
* @return a PrintService which will generate the format specified by the
* DocFlavor supported by this Factory.
--- a/jdk/src/share/classes/javax/print/attribute/Attribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/Attribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/DateTimeSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* rather than a <code>java.util.Calendar</code> because it typically takes
* less memory to store and less time to compare a <code>java.util.Date</code>
* than a <code>java.util.Calendar</code>.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/DocAttribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/DocAttribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @see DocAttributeSet
* @see PrintRequestAttributeSet
--- a/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* The {@link #add(Attribute) add(Attribute)}, and
* {@link #addAll(AttributeSet) addAll(AttributeSet)} operations
* are respecified below to guarantee this additional invariant.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/EnumSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -34,7 +34,6 @@
/**
* Class HashAttributeSet provides an <code>AttributeSet</code>
* implementation with characteristics of a hash map.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/HashDocAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* inherits its implementation from class {@link HashAttributeSet
* HashAttributeSet} and enforces the semantic restrictions of interface {@link
* DocAttributeSet DocAttributeSet}.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* which inherits its implementation from class {@link HashAttributeSet
* HashAttributeSet} and enforces the semantic restrictions of interface
* {@link PrintJobAttributeSet PrintJobAttributeSet}.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* class {@link HashAttributeSet HashAttributeSet} and enforces the
* semantic restrictions of interface
* {@link PrintRequestAttributeSet PrintRequestAttributeSet}.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* which inherits its implementation from class {@link HashAttributeSet
* HashAttributeSet} and enforces the semantic restrictions of interface
* {@link PrintServiceAttributeSet PrintServiceAttributeSet}.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/IntegerSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* established when it is constructed (see {@link #IntegerSyntax(int)
* IntegerSyntax(int)}). Once constructed, an integer attribute's
* value is immutable.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @see PrintRequestAttributeSet
* @see PrintJobAttributeSet
--- a/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/PrintJobAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* The {@link #add(Attribute) add(Attribute)}, and
* {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations
* are respecified below to guarantee this additional invariant.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* as well as PrintRequestAttribute, the client may include the
* attribute in a <code>Doc</code>}'s attribute set to specify
* a job setting which pertains just to that doc.
- * <P>
*
* @see DocAttributeSet
* @see PrintRequestAttributeSet
--- a/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/PrintRequestAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* The {@link #add(Attribute) add(Attribute)}, and
* {@link #addAll(AttributeSet) addAll(AttributeSet)} operations
* are respecified below to guarantee this additional invariant.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @see PrintServiceAttributeSet
*
--- a/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/PrintServiceAttributeSet.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* The {@link #add(Attribute) add(Attribute)}, and
* {@link #addAll(AttributeSet) addAll(AttributeSet)} operations
* are respecified below to guarantee this additional invariant.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/ResolutionSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/Size2DSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/SupportedValuesAttribute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* which is a SupportedValuesAttribute giving the legal values a client may
* specify for the {@link javax.print.attribute.standard.Copies Copies}
* attribute.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/TextSyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/TextSyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/URISyntax.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/URISyntax.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/package.html Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/package.html Tue Jul 29 09:09:55 2014 -0700
@@ -3,7 +3,7 @@
<head>
<title>javax.print.attribute package</title>
<!--
-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
@@ -398,7 +398,7 @@
in a run time exception either immediately or at some later time.
IllegalArgumentException and NullPointerException are examples of
typical and acceptable run time exceptions for such cases.
-<P>
+
@since 1.4
</body>
</html>
--- a/jdk/src/share/classes/javax/print/attribute/standard/ColorSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/ColorSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -52,7 +52,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/Compression.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/Compression.java Tue Jul 29 09:09:55 2014 -0700
@@ -40,7 +40,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/CopiesSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/CopiesSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -40,7 +40,6 @@
* javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
* explanation of canonical array form. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* "date-time-at-completed" attribute can be obtained as described above. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* "date-time-at-creation" attribute can be obtained as described above. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* "date-time-at-processing" attribute can be obtained as described above. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/Destination.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/Destination.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -50,7 +50,6 @@
* cause.
* <P>
* <B>IPP Compatibility:</B> Destination is not an IPP attribute.
- * <P>
*
* @author Phil Race.
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java Tue Jul 29 09:09:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -46,9 +46,8 @@
* or even printer specific options.
* <P>
* <B>IPP Compatibility:</B> This is not an IPP attribute.
- * <P>
+ *
* @since 1.7
- *
*/
public final class DialogTypeSelection extends EnumSyntax
implements PrintRequestAttribute {
--- a/jdk/src/share/classes/javax/print/attribute/standard/DocumentName.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DocumentName.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -43,7 +43,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobHoldUntil.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobHoldUntil.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -78,7 +78,6 @@
* for example, a JobHoldUntil value with today's date and 9:00pm local time
* might be converted to the standard IPP keyword "night". The category name
* returned by <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobImpressions.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobImpressions.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -65,7 +65,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @see JobImpressionsSupported
* @see JobImpressionsCompleted
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @see JobImpressions
* @see JobImpressionsSupported
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -42,7 +42,6 @@
* javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
* explanation of canonical array form. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobKOctets.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobKOctets.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -117,7 +117,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @see JobKOctetsSupported
* @see JobKOctetsProcessed
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -59,7 +59,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @see JobKOctets
* @see JobKOctetsSupported
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -42,7 +42,6 @@
* javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
* explanation of canonical array form. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheets.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheets.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -57,7 +57,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @see JobMediaSheetsSupported
* @see JobMediaSheetsCompleted
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @see JobMediaSheets
* @see JobMediaSheetsSupported
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -42,7 +42,6 @@
* javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
* explanation of canonical array form. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobName.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobName.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -48,7 +48,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -47,7 +47,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobPriority.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobPriority.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -54,7 +54,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobPrioritySupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobPrioritySupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -44,7 +44,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
* The category name returned by <CODE>getName()</CODE> gives the IPP
* attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobSheets.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobSheets.java Tue Jul 29 09:09:55 2014 -0700
@@ -49,7 +49,6 @@
* <code>toString()</code> method returns the IPP string representation of
* the attribute value. For a subclass, the attribute value must be
* localized to give the IPP name and natural language values.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobState.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobState.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobStateReason.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobStateReason.java Tue Jul 29 09:09:55 2014 -0700
@@ -51,7 +51,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/JobStateReasons.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/JobStateReasons.java Tue Jul 29 09:09:55 2014 -0700
@@ -62,7 +62,6 @@
* JobStateReason JobStateReason} object's <CODE>toString()</CODE> method gives
* the IPP keyword value. The category name returned by <CODE>getName()</CODE>
* gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/Media.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/Media.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -52,7 +52,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Phil Race
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -46,7 +46,6 @@
* to find the physical dimensions of the MediaSizeName instances
* enumerated in this API. This is useful for clients which need this
* information to format {@literal &} paginate printing.
- * <P>
*
* @author Phil Race, Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/NumberOfDocuments.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/NumberOfDocuments.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -37,7 +37,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -37,7 +37,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
* The category name returned by <CODE>getName()</CODE> gives the IPP
* attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/NumberUpSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/NumberUpSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -38,7 +38,6 @@
* javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
* explanation of canonical array form. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/OrientationRequested.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/OrientationRequested.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -58,7 +58,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -43,7 +43,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -38,7 +38,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PagesPerMinute.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PagesPerMinute.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -39,7 +39,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -50,7 +50,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
* category name returned by <CODE>getName()</CODE> gives the IPP attribute
* name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PresentationDirection.java Tue Jul 29 09:09:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, 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
@@ -45,7 +45,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Phil Race.
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrintQuality.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrintQuality.java Tue Jul 29 09:09:55 2014 -0700
@@ -38,7 +38,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterInfo.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterInfo.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -42,7 +42,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -43,7 +43,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterLocation.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterLocation.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -38,7 +38,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -36,7 +36,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -51,7 +51,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -49,7 +49,6 @@
* <CODE>toString()</CODE> gives the IPP uri value.
* The category name returned by <CODE>getName()</CODE>
* gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -49,7 +49,6 @@
* <CODE>toString()</CODE> gives the IPP uri value.
* The category name returned by <CODE>getName()</CODE>
* gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterName.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterName.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -41,7 +41,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterResolution.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterResolution.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -64,7 +64,6 @@
* <CODE>"printer-resolution"</CODE> attribute can be obtained by calling
* methods on the PrinterResolution object. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author David Mendenhall
* @author Alan Kaminsky
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterState.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterState.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -42,7 +42,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReason.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReason.java Tue Jul 29 09:09:55 2014 -0700
@@ -61,7 +61,6 @@
* between, gives the IPP keyword value for a {@link PrinterStateReasons}.
* The category name returned by <CODE>getName()</CODE> gives the IPP
* attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* together with a hyphen (<CODE>"-"</CODE>) in between, gives the IPP keyword
* value. The category name returned by <CODE>getName()</CODE> gives the IPP
* attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterURI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterURI.java Tue Jul 29 09:09:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2004, 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
@@ -41,7 +41,6 @@
* <CODE>toString()</CODE> gives the IPP printer-uri value.
* The category name returned by <CODE>getName()</CODE>
* gives the IPP attribute name.
- * <P>
*
* @author Robert Herriot
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/QueuedJobCount.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/QueuedJobCount.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -36,7 +36,6 @@
* <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
* The category name returned by <CODE>getName()</CODE> gives the IPP
* attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java Tue Jul 29 09:09:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, 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
@@ -55,7 +55,6 @@
* <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
* integer value is the IPP enum value. The <code>toString()</code> method
* returns the IPP string representation of the attribute value.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/RequestingUserName.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/RequestingUserName.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -48,7 +48,6 @@
* <B>IPP Compatibility:</B> The string value gives the IPP name value. The
* locale gives the IPP natural language. The category name returned by
* <CODE>getName()</CODE> gives the IPP attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/Severity.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/Severity.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -58,7 +58,6 @@
* between, gives the IPP keyword value for a {@link PrinterStateReasons}.
* The category name returned by <CODE>getName()</CODE> gives the IPP
* attribute name.
- * <P>
*
* @author Alan Kaminsky
*/
--- a/jdk/src/share/classes/javax/print/attribute/standard/SheetCollate.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/SheetCollate.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
@@ -149,7 +149,6 @@
* </UL>
* <P>
* <B>IPP Compatibility:</B> SheetCollate is not an IPP attribute at present.
- * <P>
*
* @see MultipleDocumentHandling
*
--- a/jdk/src/share/classes/javax/print/attribute/standard/package.html Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/package.html Tue Jul 29 09:09:55 2014 -0700
@@ -3,7 +3,7 @@
<head>
<title>javax.print.attribute.standard package</title>
<!--
-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
@@ -286,7 +286,7 @@
in a run time exception either immediately or at some later time.
IllegalArgumentException and NullPointerException are examples of
typical and acceptable run time exceptions for such cases.
-<P>
+
@since 1.4
</body>
</html>
--- a/jdk/src/share/classes/javax/print/event/package.html Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/event/package.html Tue Jul 29 09:09:55 2014 -0700
@@ -3,7 +3,7 @@
<head>
<title>javax.print.event package</title>
<!--
-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,7 @@
in a run time exception either immediately or at some later time.
IllegalArgumentException and NullPointerException are examples of
typical and acceptable run time exceptions for such cases.
-<P>
+
@since 1.4
</body>
</html>
--- a/jdk/src/share/classes/javax/print/package.html Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/print/package.html Tue Jul 29 09:09:55 2014 -0700
@@ -3,7 +3,7 @@
<head>
<title>javax.print package</title>
<!--
-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
@@ -141,7 +141,7 @@
in a run time exception either immediately or at some later time.
IllegalArgumentException and NullPointerException are examples of
typical and acceptable run time exceptions for such cases.
-<P>
+
@since 1.4
</body>
</html>
--- a/jdk/src/share/classes/javax/sound/midi/MidiSystem.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/sound/midi/MidiSystem.java Tue Jul 29 09:09:55 2014 -0700
@@ -914,7 +914,7 @@
MidiFileWriter writer = providers.get(i);
int[] types = writer.getMidiFileTypes();
for (int j = 0; j < types.length; j++ ) {
- allTypes.add(new Integer(types[j]));
+ allTypes.add(types[j]);
}
}
int resultTypes[] = new int[allTypes.size()];
@@ -968,7 +968,7 @@
MidiFileWriter writer = providers.get(i);
int[] types = writer.getMidiFileTypes(sequence);
for (int j = 0; j < types.length; j++ ) {
- allTypes.add(new Integer(types[j]));
+ allTypes.add(types[j]);
}
}
int resultTypes[] = new int[allTypes.size()];
--- a/jdk/src/share/classes/javax/swing/AbstractAction.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/AbstractAction.java Tue Jul 29 09:09:55 2014 -0700
@@ -269,6 +269,10 @@
* when a bound property has changed and it will send the appropriate
* <code>PropertyChangeEvent</code> to any registered
* <code>PropertyChangeListeners</code>.
+ *
+ * @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 ||
--- a/jdk/src/share/classes/javax/swing/CellRendererPane.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/CellRendererPane.java Tue Jul 29 09:09:55 2014 -0700
@@ -120,6 +120,18 @@
* 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 @@
/**
* 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 @@
/**
* 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);
--- a/jdk/src/share/classes/javax/swing/DebugGraphics.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/DebugGraphics.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
* creates a new Frame that shows each operation on an
* offscreen buffer. The value of <b>options</b> 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 @@
}
}
- /** 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;
}
--- a/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java Tue Jul 29 09:09:55 2014 -0700
@@ -88,6 +88,11 @@
* <pre>
* min <= value <= value+extent <= max
* </pre>
+ *
+ * @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 @@
* If no such listeners exist,
* this method returns an empty array.
*
+ * @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
* that descends from <code>java.util.EventListener</code>
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java Tue Jul 29 09:09:55 2014 -0700
@@ -71,7 +71,7 @@
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) {
--- a/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultSingleSelectionModel.java Tue Jul 29 09:09:55 2014 -0700
@@ -155,6 +155,7 @@
* If no such listeners exist,
* this method returns an empty array.
*
+ * @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
* that descends from <code>java.util.EventListener</code>
--- a/jdk/src/share/classes/javax/swing/DesktopManager.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/DesktopManager.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
*/
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 <b>f</b> 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 <b>f</b> 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 <b>f</b> will be a JInternalFrame.
- */
+ /**
+ * The user has moved the frame. Calls to this method will be preceded by calls
+ * to beginDraggingFrame().
+ * Normally <b>f</b> 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 <b>f</b> will be a JInternalFrame.
- */
+
+ /**
+ * This method signals the end of the dragging session. Any state maintained by
+ * the DesktopManager can be removed here. Normally <b>f</b> 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 <b>f</b> 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 <b>f</b> 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 <b>f</b> will be a JInternalFrame.
- */
+
+ /**
+ * The user has resized the component. Calls to this method will be preceded by calls
+ * to beginResizingFrame().
+ * Normally <b>f</b> 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 <b>f</b> will be a JInternalFrame.
- */
+
+ /**
+ * This method signals the end of the resize session. Any state maintained by
+ * the DesktopManager can be removed here. Normally <b>f</b> 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);
}
--- a/jdk/src/share/classes/javax/swing/GrayFilter.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/GrayFilter.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
/**
* 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);
--- a/jdk/src/share/classes/javax/swing/Icon.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/Icon.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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);
--- a/jdk/src/share/classes/javax/swing/JApplet.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JApplet.java Tue Jul 29 09:09:55 2014 -0700
@@ -157,8 +157,11 @@
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 @@
/**
* Returns the menubar set on this applet.
*
+ * @return the menubar set on this applet
* @see #setJMenuBar
*/
public JMenuBar getJMenuBar() {
@@ -542,6 +546,9 @@
// Accessibility support
////////////////
+ /**
+ * {@code AccessibleContext} associated with this {@code JApplet}
+ */
protected AccessibleContext accessibleContext = null;
/**
--- a/jdk/src/share/classes/javax/swing/JComponent.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Tue Jul 29 09:09:55 2014 -0700
@@ -496,6 +496,7 @@
/**
* 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 @@
* <code>SortingFocusTraversalPolicy</code> 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 @@
* This method is now obsolete, please use a combination of
* <code>getActionMap()</code> and <code>getInputMap()</code> 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 @@
* Unregisters a keyboard action.
* This will remove the binding from the <code>ActionMap</code>
* (if it exists) as well as the <code>InputMap</code>s.
+ *
+ * @param aKeyStroke the keystroke for which to unregister its
+ * keyboard action
*/
public void unregisterKeyboardAction(KeyStroke aKeyStroke) {
ActionMap am = getActionMap(false);
@@ -2286,6 +2298,8 @@
* conditions <code>WHEN_FOCUSED</code> and
* <code>WHEN_IN_FOCUSED_WINDOW</code> 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 @@
* 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 <code>ActionListener</code>
* object invoked when the keystroke occurs
*/
@@ -2610,6 +2625,8 @@
* <code>FocusTraversalPolicy</code> of this <code>JComponent</code>'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
* <code>FocusTraversalPolicy.getDefaultComponent(Container).requestFocus()</code>
@@ -2821,6 +2838,8 @@
* 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 @@
* <code>setToolTipText</code>. 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 @@
* 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 @@
* 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")
--- a/jdk/src/share/classes/javax/swing/JDesktopPane.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java Tue Jul 29 09:09:55 2014 -0700
@@ -208,8 +208,11 @@
}
/**
- * Returns the <code>DesktopManger</code> 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;
--- a/jdk/src/share/classes/javax/swing/JDialog.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JDialog.java Tue Jul 29 09:09:55 2014 -0700
@@ -664,6 +664,8 @@
/**
* 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 @@
/**
* Returns the menubar set on this dialog.
*
+ * @return the menubar set on this dialog
* @see #setJMenuBar
*/
public JMenuBar getJMenuBar() {
@@ -1225,6 +1228,9 @@
// Accessibility support
////////////////
+ /**
+ * {@code AccessibleContext} associated with this {@code JDialog}
+ */
protected AccessibleContext accessibleContext = null;
/**
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java Tue Jul 29 09:09:55 2014 -0700
@@ -39,6 +39,7 @@
import javax.swing.event.*;
import javax.swing.text.html.*;
import javax.accessibility.*;
+import sun.reflect.misc.ReflectUtil;
/**
* A text component to edit various kinds of content.
@@ -1193,12 +1194,12 @@
try {
Class<?> c;
if (loader != null) {
+ ReflectUtil.checkPackageAccess(classname);
c = loader.loadClass(classname);
} else {
// Will only happen if developer has invoked
// registerEditorKitForContentType(type, class, null).
- c = Class.forName(classname, true, Thread.currentThread().
- getContextClassLoader());
+ c = SwingUtilities.loadSystemClass(classname);
}
k = (EditorKit) c.newInstance();
kitRegistry.put(type, k);
--- a/jdk/src/share/classes/javax/swing/JInternalFrame.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java Tue Jul 29 09:09:55 2014 -0700
@@ -2107,7 +2107,7 @@
if (n == null) {
return false;
}
- setLayer(new Integer(n.intValue()));
+ setLayer(Integer.valueOf(n.intValue()));
return true;
}
--- a/jdk/src/share/classes/javax/swing/JLabel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JLabel.java Tue Jul 29 09:09:55 2014 -0700
@@ -128,6 +128,10 @@
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 @@
* <p>
* 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 @@
* <p>
* 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 @@
* 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 @@
*
* @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 @@
*
* @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 @@
* <p>
* This is a JavaBeans bound property.
*
+ * @param iconTextGap the space between the icon and text properties
* @see #getIconTextGap
* @beaninfo
* bound: true
--- a/jdk/src/share/classes/javax/swing/JLayeredPane.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JLayeredPane.java Tue Jul 29 09:09:55 2014 -0700
@@ -159,15 +159,15 @@
public class JLayeredPane extends JComponent implements Accessible {
/// Watch the values in getObjectForLayer()
/** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
- public final static Integer DEFAULT_LAYER = new Integer(0);
+ public final static Integer DEFAULT_LAYER = 0;
/** Convenience object defining the Palette layer. Equivalent to new Integer(100).*/
- public final static Integer PALETTE_LAYER = new Integer(100);
+ public final static Integer PALETTE_LAYER = 100;
/** Convenience object defining the Modal layer. Equivalent to new Integer(200).*/
- public final static Integer MODAL_LAYER = new Integer(200);
+ public final static Integer MODAL_LAYER = 200;
/** Convenience object defining the Popup layer. Equivalent to new Integer(300).*/
- public final static Integer POPUP_LAYER = new Integer(300);
+ public final static Integer POPUP_LAYER = 300;
/** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
- public final static Integer DRAG_LAYER = new Integer(400);
+ public final static Integer DRAG_LAYER = 400;
/** Convenience object defining the Frame Content layer.
* This layer is normally only use to position the contentPane and menuBar
* components of JFrame.
@@ -294,10 +294,7 @@
*/
public static void putLayer(JComponent c, int layer) {
/// MAKE SURE THIS AND setLayer(Component c, int layer, int position) are SYNCED
- Integer layerObj;
-
- layerObj = new Integer(layer);
- c.putClientProperty(LAYER_PROPERTY, layerObj);
+ c.putClientProperty(LAYER_PROPERTY, layer);
}
/** Gets the layer property for a JComponent, it
@@ -609,27 +606,20 @@
* @return an Integer object for that layer
*/
protected Integer getObjectForLayer(int layer) {
- Integer layerObj;
switch(layer) {
case 0:
- layerObj = DEFAULT_LAYER;
- break;
+ return DEFAULT_LAYER;
case 100:
- layerObj = PALETTE_LAYER;
- break;
+ return PALETTE_LAYER;
case 200:
- layerObj = MODAL_LAYER;
- break;
+ return MODAL_LAYER;
case 300:
- layerObj = POPUP_LAYER;
- break;
+ return POPUP_LAYER;
case 400:
- layerObj = DRAG_LAYER;
- break;
+ return DRAG_LAYER;
default:
- layerObj = new Integer(layer);
+ return layer;
}
- return layerObj;
}
/**
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java Tue Jul 29 09:09:55 2014 -0700
@@ -298,6 +298,7 @@
* 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 @@
/**
* Returns a properly configured <code>PropertyChangeListener</code>
* which updates the control as changes to the <code>Action</code> 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 @@
@SuppressWarnings("serial")
static public class Separator extends JSeparator
{
+ /**
+ * Constructs a popup menu-specific Separator.
+ */
public Separator( )
{
super( JSeparator.HORIZONTAL );
@@ -1553,6 +1560,7 @@
* Returns true if the <code>MouseEvent</code> is considered a popup trigger
* by the <code>JPopupMenu</code>'s currently installed UI.
*
+ * @param e a {@code MouseEvent}
* @return true if the mouse event is a popup trigger
* @since 1.3
*/
--- a/jdk/src/share/classes/javax/swing/JScrollBar.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JScrollBar.java Tue Jul 29 09:09:55 2014 -0700
@@ -341,7 +341,7 @@
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- oldValue, new Integer(model.getValue()));
+ oldValue, model.getValue());
}
}
@@ -952,7 +952,7 @@
*/
public Number getMaximumAccessibleValue() {
// TIGER - 4422362
- return new Integer(model.getMaximum() - model.getExtent());
+ return model.getMaximum() - model.getExtent();
}
} // AccessibleJScrollBar
--- a/jdk/src/share/classes/javax/swing/JScrollPane.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JScrollPane.java Tue Jul 29 09:09:55 2014 -0700
@@ -1102,6 +1102,7 @@
* <code>setColumnHeaderView</code>
* 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 @@
* 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 @@
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() {
--- a/jdk/src/share/classes/javax/swing/JSpinner.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JSpinner.java Tue Jul 29 09:09:55 2014 -0700
@@ -149,6 +149,7 @@
* 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 @@
* getModel().getValue()
* </pre>
*
+ * @return the current value of the model
* @see #setValue
* @see SpinnerModel#getValue
*/
@@ -349,6 +351,7 @@
* getModel().setValue(value)
* </pre>
*
+ * @param value new value for the spinner
* @throws IllegalArgumentException if <code>value</code> isn't allowed
* @see #getValue
* @see SpinnerModel#setValue
--- a/jdk/src/share/classes/javax/swing/JTextField.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JTextField.java Tue Jul 29 09:09:55 2014 -0700
@@ -675,6 +675,9 @@
* that of the <code>Action</code>.
*
* @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
--- a/jdk/src/share/classes/javax/swing/JWindow.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JWindow.java Tue Jul 29 09:09:55 2014 -0700
@@ -272,6 +272,8 @@
/**
* Called by the constructor methods to create the default
* <code>rootPane</code>.
+ *
+ * @return a new {@code JRootPane}
*/
protected JRootPane createRootPane() {
JRootPane rp = new JRootPane();
--- a/jdk/src/share/classes/javax/swing/LookAndFeel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/LookAndFeel.java Tue Jul 29 09:09:55 2014 -0700
@@ -465,7 +465,7 @@
* @see Class#getResourceAsStream(String)
*/
public static Object makeIcon(final Class<?> baseClass, final String gifFile) {
- return SwingUtilities2.makeIcon(baseClass, baseClass, gifFile);
+ return SwingUtilities2.makeIcon_Unprivileged(baseClass, baseClass, gifFile);
}
/**
--- a/jdk/src/share/classes/javax/swing/ProgressMonitor.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/ProgressMonitor.java Tue Jul 29 09:09:55 2014 -0700
@@ -369,6 +369,8 @@
/**
* 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 @@
* 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 @@
/**
* 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() {
--- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java Tue Jul 29 09:09:55 2014 -0700
@@ -109,11 +109,12 @@
AccessController.doPrivileged(new PrivilegedAction<Method>() {
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;
}
--- a/jdk/src/share/classes/javax/swing/SpinnerModel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/SpinnerModel.java Tue Jul 29 09:09:55 2014 -0700
@@ -88,6 +88,7 @@
* that case, <code>model.setValue(new Number(11))</code>
* would throw an exception.
*
+ * @param value new value for the spinner
* @throws IllegalArgumentException if <code>value</code> isn't allowed
* @see #getValue
*/
--- a/jdk/src/share/classes/javax/swing/Timer.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/Timer.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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 @@
* If no such listeners exist,
* this method returns an empty array.
*
+ * @param <T> the type of {@code EventListener} class being requested
* @param listenerType the type of listeners requested;
* this parameter should specify an interface
* that descends from <code>java.util.EventListener</code>
@@ -410,6 +414,7 @@
* 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 @@
/**
- * Returns the <code>Timer</code>'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 @@
* 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 @@
/**
- * Returns <code>true</code> if the <code>Timer</code> 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 @@
/**
- * Returns <code>true</code> if the <code>Timer</code> 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() {
--- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java Tue Jul 29 09:09:55 2014 -0700
@@ -645,7 +645,7 @@
int i = 1;
while (newFolder.exists() && i < 100) {
newFolder = createFileObject(containingDir, MessageFormat.format(
- newFolderNextString, new Integer(i)));
+ newFolderNextString, i));
i++;
}
@@ -755,7 +755,7 @@
int i = 2;
while (newFolder.exists() && i < 100) {
newFolder = createFileObject(containingDir, MessageFormat.format(
- newFolderNextString, new Integer(i)));
+ newFolderNextString, i));
i++;
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicArrowButton.java Tue Jul 29 09:09:55 2014 -0700
@@ -99,6 +99,8 @@
/**
* Returns the direction of the arrow.
+ *
+ * @return the direction of the arrow
*/
public int getDirection() {
return direction;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicBorders.java Tue Jul 29 09:09:55 2014 -0700
@@ -45,6 +45,11 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
/**
- * 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 @@
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 @@
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 @@
@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 @@
}
}
+ /**
+ * 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 @@
}
+ /**
+ * 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 @@
}
}
+ /**
+ * 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 @@
}
}
+ /**
+ * 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 @@
}
}
+ /**
+ * 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 @@
}
}
+ /**
+ * 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 @@
* 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;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonListener.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
}
+ /**
+ * Constructs a new instance of {@code BasicButtonListener}.
+ *
+ * @param b an abstract button
+ */
public BasicButtonListener(AbstractButton b) {
}
@@ -76,13 +81,20 @@
}
}
+ /**
+ * 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 @@
}
/**
- * Unregister's default key actions
+ * Unregister default key actions.
+ *
+ * @param c a component
*/
public void uninstallKeyboardActions(JComponent c) {
SwingUtilities.replaceUIInputMap(c, JComponent.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
// 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 @@
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 @@
// ********************************
// 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 @@
return buttonUI;
}
+ /**
+ * Returns the property prefix.
+ *
+ * @return the property prefix
+ */
protected String getPropertyPrefix() {
return propertyPrefix;
}
@@ -91,6 +108,11 @@
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 @@
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 @@
}
}
+ /**
+ * Registers keyboard actions.
+ *
+ * @param b an abstract button
+ */
protected void installKeyboardActions(AbstractButton b){
BasicButtonListener listener = getButtonListener(b);
@@ -150,6 +182,11 @@
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 @@
}
}
+ /**
+ * Unregisters listeners.
+ *
+ * @param b an abstract button
+ */
protected void uninstallListeners(AbstractButton b) {
BasicButtonListener listener = getButtonListener(b);
if(listener != null) {
@@ -168,6 +210,11 @@
}
}
+ /**
+ * Uninstalls default properties.
+ *
+ * @param b an abstract button
+ */
protected void uninstallDefaults(AbstractButton b) {
LookAndFeel.uninstallBorder(b);
}
@@ -175,10 +222,22 @@
// ********************************
// 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 @@
}
}
+ /**
+ * 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 @@
}
/**
+ * 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 @@
*
* @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 @@
// 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;
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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.event.*;
import javax.swing.*;
import javax.swing.plaf.*;
-import javax.swing.border.*;
-import java.io.Serializable;
-
/**
* BasicCheckboxMenuItem implementation
@@ -42,6 +39,12 @@
*/
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 @@
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() &&
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -59,6 +59,13 @@
// ********************************
// 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 =
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -61,21 +61,45 @@
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 @@
handler = null;
}
+ /**
+ * Installs preview panel.
+ */
protected void installPreviewPanel() {
JComponent previewPanel = this.chooser.getPreviewPanel();
if (previewPanel == null) {
@@ -169,6 +196,9 @@
this.chooser.remove(this.previewPanelHolder);
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background",
"ColorChooser.foreground",
@@ -180,16 +210,21 @@
}
}
+ /**
+ * 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 @@
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);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java Tue Jul 29 09:09:55 2014 -0700
@@ -41,9 +41,15 @@
* @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();
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java Tue Jul 29 09:09:55 2014 -0700
@@ -59,6 +59,9 @@
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);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -61,6 +61,10 @@
* @author Mark Davidson
*/
public class BasicComboBoxUI extends ComboBoxUI {
+
+ /**
+ * The instance of {@code JComboBox}.
+ */
protected JComboBox<Object> comboBox;
/**
* This protected field is implementation specific. Do not access directly
@@ -73,20 +77,30 @@
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<Object> 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 @@
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 @@
*/
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 @@
// 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 @@
* 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 @@
/**
* 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 @@
/**
* Gets the insets from the JComboBox.
+ *
+ * @return the insets
*/
protected Insets getInsets() {
return comboBox.getInsets();
@@ -1206,6 +1248,10 @@
/**
* 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<Object> renderer = comboBox.getRenderer();
@@ -1263,6 +1309,10 @@
/**
* 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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Tue Jul 29 09:09:55 2014 -0700
@@ -75,6 +75,9 @@
private static Border LIST_BORDER = new LineBorder(Color.BLACK, 1);
+ /**
+ * The instance of {@code JComboBox}.
+ */
protected JComboBox<Object> comboBox;
/**
* This protected field is implementation specific. Do not access directly
@@ -186,11 +189,30 @@
* 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 @@
}
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions() {
// XXX - shouldn't call this method
// comboBox.unregisterKeyboardAction( KeyStroke.getKeyStroke( KeyEvent.VK_ENTER, 0 ) );
@@ -319,6 +344,12 @@
//===================================================================
// begin Initialization routines
//
+
+ /**
+ * Constructs a new instance of {@code BasicComboPopup}.
+ *
+ * @param combo an instance of {@code JComboBox}
+ */
public BasicComboPopup( JComboBox<Object> combo ) {
super();
setName("ComboPopup.popup");
@@ -555,6 +586,8 @@
/**
* 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 @@
}
}
+ /**
+ * Registers keyboard actions.
+ */
protected void installKeyboardActions() {
/* XXX - shouldn't call this method. take it out for testing.
@@ -1007,6 +1043,8 @@
/**
* 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 @@
* 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 @@
}
}
+ /**
+ * 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 @@
/**
* 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 @@
/**
* 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
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
*/
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 @@
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 @@
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 @@
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 @@
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 @@
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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -55,7 +55,14 @@
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 @@
@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 @@
handler = null;
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
if (desktop.getBackground() == null ||
desktop.getBackground() instanceof UIResource) {
@@ -141,6 +160,9 @@
LookAndFeel.installProperty(desktop, "opaque", Boolean.TRUE);
}
+ /**
+ * Uninstalls default properties.
+ */
protected void uninstallDefaults() { }
/**
@@ -169,6 +191,9 @@
pcl = null;
}
+ /**
+ * Installs desktop manager.
+ */
protected void installDesktopManager() {
desktopManager = desktop.getDesktopManager();
if(desktopManager == null) {
@@ -177,6 +202,9 @@
}
}
+ /**
+ * Uninstalls desktop manager.
+ */
protected void uninstallDesktopManager() {
if(desktop.getDesktopManager() instanceof UIResource) {
desktop.setDesktopManager(null);
@@ -184,6 +212,9 @@
desktopManager = null;
}
+ /**
+ * Installs keyboard actions.
+ */
protected void installKeyboardActions(){
InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
if (inputMap != null) {
@@ -202,9 +233,15 @@
registerKeyboardActions();
}
+ /**
+ * Registers keyboard actions.
+ */
protected void registerKeyboardActions(){
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void unregisterKeyboardActions(){
}
@@ -253,6 +290,9 @@
map.put(new Actions(Actions.NAVIGATE_PREVIOUS));
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions(){
unregisterKeyboardActions();
SwingUtilities.replaceUIInputMap(desktop, JComponent.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java Tue Jul 29 09:09:55 2014 -0700
@@ -55,6 +55,11 @@
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 @@
}
}
+ /**
+ * Returns a list of directories.
+ *
+ * @return a list of directories
+ */
public Vector<File> getDirectories() {
synchronized(fileCache) {
if (directories != null) {
@@ -103,6 +113,11 @@
}
}
+ /**
+ * Returns a list of files.
+ *
+ * @return a list of files
+ */
public Vector<File> getFiles() {
synchronized(fileCache) {
if (files != null) {
@@ -126,6 +141,9 @@
}
}
+ /**
+ * Validates content of file cache.
+ */
public void validateFileCache() {
File currentDirectory = filechooser.getCurrentDirectory();
if (currentDirectory == null) {
@@ -163,20 +181,34 @@
}
}
-
+ /**
+ * 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 void intervalRemoved(ListDataEvent e) {
}
+ /**
+ * Sorts a list of files.
+ *
+ * @param v a list of files
+ */
protected void sort(Vector<? extends File> v){
ShellFolder.sort(v);
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 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 @@
}
+ /**
+ * 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 @@
}
+ /**
+ * 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 @@
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 @@
}
- /** Draw a string with the graphics <code>g</code> at location (x,y)
- * just like <code>g.drawString</code> would.
- * The first occurrence of <code>underlineChar</code>
- * 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 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 @@
}
}
+ /**
+ * 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) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicHTML.java Tue Jul 29 09:09:55 2014 -0700
@@ -48,6 +48,10 @@
/**
* 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 @@
* 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 @@
* 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;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicIconFactory.java Tue Jul 29 09:09:55 2014 -0700
@@ -61,6 +61,11 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
return radioButtonMenuItemIcon;
}
+ /**
+ * Returns an empty frame icon.
+ *
+ * @return an empty frame icon
+ */
public static Icon createEmptyFrameIcon() {
if(frame_icon == null)
frame_icon = new EmptyFrameIcon();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Tue Jul 29 09:09:55 2014 -0700
@@ -60,44 +60,125 @@
@SuppressWarnings("serial") // Same-version serialization only
public class BasicInternalFrameTitlePane extends JComponent
{
+ /**
+ * The instance of {@code JMenuBar}.
+ */
protected JMenuBar menuBar;
+ /**
+ * The iconify button.
+ */
protected JButton iconButton;
+ /**
+ * The maximize button.
+ */
protected JButton maxButton;
+ /**
+ * The close button.
+ */
protected JButton closeButton;
+ /**
+ * The instance of {@code JMenu}.
+ */
protected JMenu windowMenu;
+ /**
+ * The instance of {@code JInternalFrame}.
+ */
protected JInternalFrame frame;
+ /**
+ * The color of a selected title.
+ */
protected Color selectedTitleColor;
+ /**
+ * The color of a selected text.
+ */
protected Color selectedTextColor;
+ /**
+ * The color of a not selected title.
+ */
protected Color notSelectedTitleColor;
+ /**
+ * The color of a not selected text.
+ */
protected Color notSelectedTextColor;
+ /**
+ * The maximize icon.
+ */
protected Icon maxIcon;
+ /**
+ * The minimize icon.
+ */
protected Icon minIcon;
+ /**
+ * The iconify icon.
+ */
protected Icon iconIcon;
+ /**
+ * The close icon.
+ */
protected Icon closeIcon;
+ /**
+ * The instance of a {@code PropertyChangeListener}.
+ */
protected PropertyChangeListener propertyChangeListener;
+ /**
+ * The instance of a {@code CloseAction}.
+ */
protected Action closeAction;
+ /**
+ * The instance of a {@code MaximizeAction}.
+ */
protected Action maximizeAction;
+ /**
+ * The instance of an {@code IconifyAction}.
+ */
protected Action iconifyAction;
+ /**
+ * The instance of a {@code RestoreAction}.
+ */
protected Action restoreAction;
+ /**
+ * The instance of a {@code MoveAction}.
+ */
protected Action moveAction;
+ /**
+ * The instance of a {@code SizeAction}.
+ */
protected Action sizeAction;
// These constants are not used in JDK code
+ /**
+ * The close button text property.
+ */
protected static final String CLOSE_CMD =
UIManager.getString("InternalFrameTitlePane.closeButtonText");
+ /**
+ * The minimize button text property.
+ */
protected static final String ICONIFY_CMD =
UIManager.getString("InternalFrameTitlePane.minimizeButtonText");
+ /**
+ * The restore button text property.
+ */
protected static final String RESTORE_CMD =
UIManager.getString("InternalFrameTitlePane.restoreButtonText");
+ /**
+ * The maximize button text property.
+ */
protected static final String MAXIMIZE_CMD =
UIManager.getString("InternalFrameTitlePane.maximizeButtonText");
+ /**
+ * The move button text property.
+ */
protected static final String MOVE_CMD =
UIManager.getString("InternalFrameTitlePane.moveButtonText");
+ /**
+ * The size button text property.
+ */
protected static final String SIZE_CMD =
UIManager.getString("InternalFrameTitlePane.sizeButtonText");
@@ -107,11 +188,19 @@
private String maxButtonToolTip;
private Handler handler;
+ /**
+ * Constructs a new instance of {@code BasicInternalFrameTitlePane}.
+ *
+ * @param f an instance of {@code JInternalFrame}
+ */
public BasicInternalFrameTitlePane(JInternalFrame f) {
frame = f;
installTitlePane();
}
+ /**
+ * Installs the title pane.
+ */
protected void installTitlePane() {
installDefaults();
installListeners();
@@ -128,6 +217,9 @@
}
+ /**
+ * Adds subcomponents.
+ */
protected void addSubComponents() {
add(menuBar);
add(iconButton);
@@ -135,6 +227,9 @@
add(closeButton);
}
+ /**
+ * Creates actions.
+ */
protected void createActions() {
maximizeAction = new MaximizeAction();
iconifyAction = new IconifyAction();
@@ -151,6 +246,9 @@
return map;
}
+ /**
+ * Registers listeners.
+ */
protected void installListeners() {
if( propertyChangeListener == null ) {
propertyChangeListener = createPropertyChangeListener();
@@ -158,11 +256,17 @@
frame.addPropertyChangeListener(propertyChangeListener);
}
+ /**
+ * Unregisters listeners.
+ */
protected void uninstallListeners() {
frame.removePropertyChangeListener(propertyChangeListener);
handler = null;
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
maxIcon = UIManager.getIcon("InternalFrame.maximizeIcon");
minIcon = UIManager.getIcon("InternalFrame.minimizeIcon");
@@ -184,10 +288,15 @@
UIManager.getString("InternalFrame.maxButtonToolTip");
}
-
+ /**
+ * Uninstalls default properties.
+ */
protected void uninstallDefaults() {
}
+ /**
+ * Creates buttons.
+ */
protected void createButtons() {
iconButton = new NoFocusButton(
"InternalFrameTitlePane.iconifyButtonAccessibleName",
@@ -213,6 +322,9 @@
setButtonIcons();
}
+ /**
+ * Sets the button icons.
+ */
protected void setButtonIcons() {
if(frame.isIcon()) {
if (minIcon != null) {
@@ -261,6 +373,9 @@
}
}
+ /**
+ * Assembles system menu.
+ */
protected void assembleSystemMenu() {
menuBar = createSystemMenuBar();
windowMenu = createSystemMenu();
@@ -269,6 +384,11 @@
enableActions();
}
+ /**
+ * Adds system menu items to {@code systemMenu}.
+ *
+ * @param systemMenu an instance of {@code JMenu}
+ */
protected void addSystemMenuItems(JMenu systemMenu) {
JMenuItem mi = systemMenu.add(restoreAction);
mi.setMnemonic(getButtonMnemonic("restore"));
@@ -294,16 +414,29 @@
}
}
+ /**
+ * Returns a new instance of {@code JMenu}.
+ *
+ * @return a new instance of {@code JMenu}
+ */
protected JMenu createSystemMenu() {
return new JMenu(" ");
}
+ /**
+ * Returns a new instance of {@code JMenuBar}.
+ *
+ * @return a new instance of {@code JMenuBar}
+ */
protected JMenuBar createSystemMenuBar() {
menuBar = new SystemMenuBar();
menuBar.setBorderPainted(false);
return menuBar;
}
+ /**
+ * Shows system menu.
+ */
protected void showSystemMenu(){
// windowMenu.setPopupMenuVisible(true);
// windowMenu.setVisible(true);
@@ -367,14 +500,24 @@
g.fillRect(0, 0, getWidth(), getHeight());
}
+ /**
+ * Returns the title.
+ *
+ * @param text a text
+ * @param fm an instance of {@code FontMetrics}
+ * @param availTextWidth an available text width
+ * @return the title.
+ */
protected String getTitle(String text, FontMetrics fm, int availTextWidth) {
return SwingUtilities2.clipStringIfNecessary(
frame, fm, text, availTextWidth);
- }
+ }
/**
* Post a WINDOW_CLOSING-like event to the frame, so that it can
- * be treated like a regular Frame.
+ * be treated like a regular {@code Frame}.
+ *
+ * @param frame an instance of {@code JInternalFrame}
*/
protected void postClosingEvent(JInternalFrame frame) {
InternalFrameEvent e = new InternalFrameEvent(
@@ -387,7 +530,9 @@
}
}
-
+ /**
+ * Enables actions.
+ */
protected void enableActions() {
restoreAction.setEnabled(frame.isMaximum() || frame.isIcon());
maximizeAction.setEnabled(
@@ -406,10 +551,20 @@
return handler;
}
+ /**
+ * Returns an instance of {@code PropertyChangeListener}.
+ *
+ * @return an instance of {@code PropertyChangeListener}
+ */
protected PropertyChangeListener createPropertyChangeListener() {
return getHandler();
}
+ /**
+ * Returns a layout manager.
+ *
+ * @return a layout manager
+ */
protected LayoutManager createLayout() {
return getHandler();
}
@@ -606,6 +761,9 @@
* Instantiate it only within subclasses of <code>Foo</code>.
*/
public class CloseAction extends AbstractAction {
+ /**
+ * Constructs a new instance of a {@code CloseAction}.
+ */
public CloseAction() {
super(UIManager.getString(
"InternalFrameTitlePane.closeButtonText"));
@@ -623,6 +781,9 @@
* Instantiate it only within subclasses of <code>Foo</code>.
*/
public class MaximizeAction extends AbstractAction {
+ /**
+ * Constructs a new instance of a {@code MaximizeAction}.
+ */
public MaximizeAction() {
super(UIManager.getString(
"InternalFrameTitlePane.maximizeButtonText"));
@@ -652,6 +813,9 @@
* Instantiate it only within subclasses of <code>Foo</code>.
*/
public class IconifyAction extends AbstractAction {
+ /**
+ * Constructs a new instance of an {@code IconifyAction}.
+ */
public IconifyAction() {
super(UIManager.getString(
"InternalFrameTitlePane.minimizeButtonText"));
@@ -673,6 +837,9 @@
* Instantiate it only within subclasses of <code>Foo</code>.
*/
public class RestoreAction extends AbstractAction {
+ /**
+ * Constructs a new instance of a {@code RestoreAction}.
+ */
public RestoreAction() {
super(UIManager.getString(
"InternalFrameTitlePane.restoreButtonText"));
@@ -700,6 +867,9 @@
* Instantiate it only within subclasses of <code>Foo</code>.
*/
public class MoveAction extends AbstractAction {
+ /**
+ * Constructs a new instance of a {@code MoveAction}.
+ */
public MoveAction() {
super(UIManager.getString(
"InternalFrameTitlePane.moveButtonText"));
@@ -734,6 +904,9 @@
* Instantiate it only within subclasses of <code>Foo</code>.
*/
public class SizeAction extends AbstractAction {
+ /**
+ * Constructs a new instance of a {@code SizeAction}.
+ */
public SizeAction() {
super(UIManager.getString(
"InternalFrameTitlePane.sizeButtonText"));
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* 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 @@
/**
* 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 @@
* 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 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 @@
}
}
+ /**
+ * 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 @@
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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -59,20 +59,53 @@
private static final StringBuilder BASELINE_COMPONENT_KEY =
new StringBuilder("List.baselineComponent");
+ /**
+ * The instance of {@code JList}.
+ */
protected JList<Object> 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 @@
* 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 @@
/**
* 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 @@
/**
- * 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 @@
/**
* 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 @@
/**
- * 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 @@
/**
- * 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 @@
/**
- * 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.
* <pre>
* class MyListUI extends BasicListUI {
* protected MouseInputListener <b>createMouseInputListener</b>() {
@@ -1553,6 +1618,7 @@
* }
* </pre>
*
+ * @return an instance of {@code MouseInputListener}
* @see MouseInputHandler
* @see #installUI
*/
@@ -1566,6 +1632,9 @@
*/
public class FocusHandler implements FocusListener
{
+ /**
+ * Repaints focused cells.
+ */
protected void repaintCellFocus()
{
getHandler().repaintCellFocus();
@@ -1584,6 +1653,11 @@
}
}
+ /**
+ * Returns an instance of {@code FocusListener}.
+ *
+ * @return an instance of {@code FocusListener}
+ */
protected FocusListener createFocusListener() {
return getHandler();
}
@@ -1617,9 +1691,9 @@
/**
- * 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.
* <pre>
* class MyListUI extends BasicListUI {
* protected ListSelectionListener <b>createListSelectionListener</b>() {
@@ -1634,6 +1708,7 @@
* }
* </pre>
*
+ * @return an instance of {@code ListSelectionHandler}
* @see ListSelectionHandler
* @see #installUI
*/
@@ -1649,8 +1724,8 @@
/**
- * 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.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
@@ -1687,9 +1762,9 @@
/**
- * 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.
* <pre>
* class MyListUI extends BasicListUI {
* protected ListDataListener <b>createListDataListener</b>() {
@@ -1704,6 +1779,7 @@
* }
* </pre>
*
+ * @return an instance of {@code ListDataListener}
* @see ListDataListener
* @see JList#getModel
* @see #installUI
@@ -1744,9 +1820,9 @@
/**
- * 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.
* <pre>
* class MyListUI extends BasicListUI {
* protected PropertyChangeListener <b>createPropertyChangeListener</b>() {
@@ -1763,6 +1839,7 @@
* }
* </pre>
*
+ * @return an instance of {@code PropertyChangeHandler}
* @see PropertyChangeListener
* @see #installUI
*/
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Tue Jul 29 09:09:55 2014 -0700
@@ -455,7 +455,7 @@
initResourceBundle(table);
// *** Shared Integers
- Integer fiveHundred = new Integer(500);
+ Integer fiveHundred = 500;
// *** Shared Longs
Long oneThousand = 1000L;
@@ -673,7 +673,6 @@
Object editorMargin = threeInsets;
Object caretBlinkRate = fiveHundred;
- Integer four = new Integer(4);
Object[] allAuditoryCues = new Object[] {
"CheckBoxMenuItem.commandSound",
@@ -714,7 +713,7 @@
"Button.highlight", controlLtHighlight,
"Button.border", buttonBorder,
"Button.margin", new InsetsUIResource(2, 14, 2, 14),
- "Button.textIconGap", four,
+ "Button.textIconGap", 4,
"Button.textShiftOffset", zero,
"Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
"SPACE", "pressed",
@@ -732,7 +731,7 @@
"ToggleButton.highlight", controlLtHighlight,
"ToggleButton.border", buttonToggleBorder,
"ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
- "ToggleButton.textIconGap", four,
+ "ToggleButton.textIconGap", 4,
"ToggleButton.textShiftOffset", zero,
"ToggleButton.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] {
@@ -749,7 +748,7 @@
"RadioButton.highlight", controlLtHighlight,
"RadioButton.border", radioButtonBorder,
"RadioButton.margin", twoInsets,
- "RadioButton.textIconGap", four,
+ "RadioButton.textIconGap", 4,
"RadioButton.textShiftOffset", zero,
"RadioButton.icon", radioButtonIcon,
"RadioButton.focusInputMap",
@@ -764,7 +763,7 @@
"CheckBox.foreground", controlText,
"CheckBox.border", radioButtonBorder,
"CheckBox.margin", twoInsets,
- "CheckBox.textIconGap", four,
+ "CheckBox.textIconGap", 4,
"CheckBox.textShiftOffset", zero,
"CheckBox.icon", checkBoxIcon,
"CheckBox.focusInputMap",
@@ -1087,10 +1086,10 @@
"Menu.margin", twoInsets,
"Menu.checkIcon", menuItemCheckIcon,
"Menu.arrowIcon", menuArrowIcon,
- "Menu.menuPopupOffsetX", new Integer(0),
- "Menu.menuPopupOffsetY", new Integer(0),
- "Menu.submenuPopupOffsetX", new Integer(0),
- "Menu.submenuPopupOffsetY", new Integer(0),
+ "Menu.menuPopupOffsetX", 0,
+ "Menu.menuPopupOffsetY", 0,
+ "Menu.submenuPopupOffsetX", 0,
+ "Menu.submenuPopupOffsetY", 0,
"Menu.shortcutKeys", new int[]{
SwingUtilities2.getSystemMnemonicKeyMask()
},
@@ -1188,10 +1187,10 @@
"ProgressBar.selectionForeground", control,
"ProgressBar.selectionBackground", textHighlight,
"ProgressBar.border", progressBarBorder,
- "ProgressBar.cellLength", new Integer(1),
+ "ProgressBar.cellLength", 1,
"ProgressBar.cellSpacing", zero,
- "ProgressBar.repaintInterval", new Integer(50),
- "ProgressBar.cycleTime", new Integer(3000),
+ "ProgressBar.repaintInterval", 50,
+ "ProgressBar.cycleTime", 3000,
"ProgressBar.horizontalSize", new DimensionUIResource(146, 12),
"ProgressBar.verticalSize", new DimensionUIResource(12, 146),
@@ -1236,7 +1235,7 @@
"LEFT", "positiveUnitIncrement",
"KP_LEFT", "positiveUnitIncrement",
}),
- "ScrollBar.width", new Integer(16),
+ "ScrollBar.width", 16,
"ScrollPane.font", dialogPlain12,
"ScrollPane.background", control,
@@ -1332,7 +1331,7 @@
"SplitPane.shadow", controlShadow,
"SplitPane.darkShadow", controlDkShadow,
"SplitPane.border", splitPaneBorder,
- "SplitPane.dividerSize", new Integer(7),
+ "SplitPane.dividerSize", 7,
"SplitPaneDivider.border", splitPaneDividerBorder,
"SplitPaneDivider.draggingColor", darkGray,
"SplitPane.ancestorInputMap",
@@ -1363,7 +1362,7 @@
"TabbedPane.darkShadow", controlDkShadow,
"TabbedPane.selected", null,
"TabbedPane.focus", controlText,
- "TabbedPane.textIconGap", four,
+ "TabbedPane.textIconGap", 4,
// Causes tabs to be painted on top of the content area border.
// The amount of overlap is then controlled by tabAreaInsets.bottom,
@@ -1377,7 +1376,7 @@
"TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
"TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
"TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
- "TabbedPane.tabRunOverlay", new Integer(2),
+ "TabbedPane.tabRunOverlay", 2,
"TabbedPane.tabsOpaque", Boolean.TRUE,
"TabbedPane.contentOpaque", Boolean.TRUE,
"TabbedPane.focusInputMap",
@@ -1737,9 +1736,9 @@
"Tree.selectionBorderColor", black,
"Tree.dropLineColor", controlShadow,
"Tree.editorBorder", blackLineBorder,
- "Tree.leftChildIndent", new Integer(7),
- "Tree.rightChildIndent", new Integer(13),
- "Tree.rowHeight", new Integer(16),
+ "Tree.leftChildIndent", 7,
+ "Tree.rightChildIndent", 13,
+ "Tree.rowHeight", 16,
"Tree.scrollsOnExpand", Boolean.TRUE,
"Tree.openIcon", SwingUtilities2.makeIcon(getClass(),
BasicLookAndFeel.class,
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuBarUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
* @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 @@
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
if (menuBar.getLayout() == null ||
menuBar.getLayout() instanceof UIResource) {
@@ -90,6 +111,9 @@
"MenuBar.font");
}
+ /**
+ * Registers listeners.
+ */
protected void installListeners() {
containerListener = createContainerListener();
changeListener = createChangeListener();
@@ -102,6 +126,9 @@
menuBar.addContainerListener(containerListener);
}
+ /**
+ * Registers keyboard actions.
+ */
protected void installKeyboardActions() {
InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
@@ -131,12 +158,18 @@
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 @@
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();
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
*/
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 @@
*/
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;
/**
- * <code>PropertyChangeListener</code> returned from
- * <code>createPropertyChangeListener</code>. You should not
+ * {@code PropertyChangeListener} returned from
+ * {@code createPropertyChangeListener}. You should not
* need to access this field, rather if you want to customize the
- * <code>PropertyChangeListener</code> override
- * <code>createPropertyChangeListener</code>.
+ * {@code PropertyChangeListener} override
+ * {@code createPropertyChangeListener}.
*
* @since 1.6
* @see #createPropertyChangeListener
@@ -79,10 +112,17 @@
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 @@
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 @@
installKeyboardActions();
}
-
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
String prefix = getPropertyPrefix();
@@ -202,16 +250,26 @@
}
/**
+ *
+ * @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 @@
}
}
+ /**
+ * Registers keyboard action.
+ */
protected void installKeyboardActions() {
installLazyActionMap();
updateAcceleratorBinding();
@@ -248,7 +309,9 @@
menuItem = null;
}
-
+ /**
+ * Uninstalls default properties.
+ */
protected void uninstallDefaults() {
LookAndFeel.uninstallBorder(menuItem);
LookAndFeel.installProperty(menuItem, "borderPainted", oldBorderPainted);
@@ -261,12 +324,18 @@
}
/**
+ * 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 @@
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 <code>PropertyChangeListener</code> 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 <code>PropertyChangeListener</code> or null
+ * @param c a component
+ * @return an instance of a {@code PropertyChangeListener} or null
* @since 1.6
*/
protected PropertyChangeListener
@@ -380,6 +471,15 @@
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 @@
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 @@
}
}
+ /**
+ * Returns a menu element path.
+ *
+ * @return a menu element path
+ */
public MenuElement[] getPath() {
MenuSelectionManager m = MenuSelectionManager.defaultManager();
MenuElement oldPath[] = m.getSelectedPath();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -48,7 +48,14 @@
*/
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 @@
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 @@
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 @@
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 @@
* 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;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -79,17 +79,26 @@
*/
public class BasicOptionPaneUI extends OptionPaneUI {
+ /**
+ * The mininum width of {@code JOptionPane}.
+ */
public static final int MinimumWidth = 262;
+ /**
+ * The mininum height of {@code JOptionPane}.
+ */
public static final int MinimumHeight = 90;
private static String newline;
/**
- * <code>JOptionPane</code> that the receiver is providing the
+ * {@code JOptionPane} that the receiver is providing the
* look and feel for.
*/
protected JOptionPane optionPane;
+ /**
+ * The size of {@code JOptionPane}.
+ */
protected Dimension minimumSize;
/** JComponent provide for input if optionPane.getWantsInput() returns
@@ -103,6 +112,9 @@
* in either the message or the buttons. */
protected boolean hasCustomComponents;
+ /**
+ * The instance of {@code PropertyChangeListener}.
+ */
protected PropertyChangeListener propertyChangeListener;
private Handler handler;
@@ -123,8 +135,10 @@
/**
- * Creates a new BasicOptionPaneUI instance.
- */
+ * Creates a new {@code BasicOptionPaneUI} instance.
+ *
+ * @return a new {@code BasicOptionPaneUI} instance
+ */
public static ComponentUI createUI(JComponent x) {
return new BasicOptionPaneUI();
}
@@ -155,6 +169,9 @@
optionPane = null;
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
LookAndFeel.installColorsAndFont(optionPane, "OptionPane.background",
"OptionPane.foreground", "OptionPane.font");
@@ -163,10 +180,16 @@
LookAndFeel.installProperty(optionPane, "opaque", Boolean.TRUE);
}
+ /**
+ * Uninstalls default properties.
+ */
protected void uninstallDefaults() {
LookAndFeel.uninstallBorder(optionPane);
}
+ /**
+ * Registers components.
+ */
protected void installComponents() {
optionPane.add(createMessageArea());
@@ -178,6 +201,9 @@
optionPane.applyComponentOrientation(optionPane.getComponentOrientation());
}
+ /**
+ * Unregisters components.
+ */
protected void uninstallComponents() {
hasCustomComponents = false;
inputComponent = null;
@@ -185,16 +211,27 @@
optionPane.removeAll();
}
+ /**
+ * Returns a layout manager.
+ *
+ * @return a layout manager
+ */
protected LayoutManager createLayoutManager() {
return new BoxLayout(optionPane, BoxLayout.Y_AXIS);
}
+ /**
+ * Registers listeners.
+ */
protected void installListeners() {
if ((propertyChangeListener = createPropertyChangeListener()) != null) {
optionPane.addPropertyChangeListener(propertyChangeListener);
}
}
+ /**
+ * Unregisters listeners.
+ */
protected void uninstallListeners() {
if (propertyChangeListener != null) {
optionPane.removePropertyChangeListener(propertyChangeListener);
@@ -203,6 +240,11 @@
handler = null;
}
+ /**
+ * Returns an instance of {@code PropertyChangeListener}.
+ *
+ * @return an instance of {@code PropertyChangeListener}
+ */
protected PropertyChangeListener createPropertyChangeListener() {
return getHandler();
}
@@ -214,6 +256,9 @@
return handler;
}
+ /**
+ * Registers keyboard actions.
+ */
protected void installKeyboardActions() {
InputMap map = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
@@ -224,6 +269,9 @@
"OptionPane.actionMap");
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions() {
SwingUtilities.replaceUIInputMap(optionPane, JComponent.
WHEN_IN_FOCUSED_WINDOW, null);
@@ -244,6 +292,8 @@
/**
* Returns the minimum size the option pane should be. Primarily
* provided for subclassers wishing to offer a different minimum size.
+ *
+ * @return the minimum size of the option pane
*/
public Dimension getMinimumOptionPaneSize() {
if (minimumSize == null) {
@@ -280,9 +330,11 @@
}
/**
- * Messaged from installComponents to create a Container containing the
- * body of the message. The icon is the created by calling
- * <code>addIcon</code>.
+ * Messaged from {@code installComponents} to create a {@code Container}
+ * containing the body of the message. The icon is the created
+ * by calling {@code addIcon}.
+ *
+ * @return a instance of {@code Container}
*/
protected Container createMessageArea() {
JPanel top = new JPanel();
@@ -325,15 +377,21 @@
}
/**
- * Creates the appropriate object to represent <code>msg</code> and
- * places it into <code>container</code>. If <code>msg</code> is an
- * instance of Component, it is added directly, if it is an Icon,
- * a JLabel is created to represent it, otherwise a JLabel is
- * created for the string, if <code>d</code> is an Object[], this
- * method will be recursively invoked for the children.
- * <code>internallyCreated</code> is true if Objc is an instance
- * of Component and was created internally by this method (this is
- * used to correctly set hasCustomComponents only if !internallyCreated).
+ * Creates the appropriate object to represent {@code msg} and
+ * places it into {@code container}. If {@code msg} is an instance of
+ * {@code Component}, it is added directly, if it is an {@code Icon},
+ * a {@code JLabel} is created to represent it, otherwise a {@code JLabel} is
+ * created for the string, if {@code d} is an Object[], this method
+ * will be recursively invoked for the children. {@code internallyCreated} is
+ * {@code true} if Objc is an instance of {@code Component} and was created
+ * internally by this method (this is used to correctly set
+ * {@code hasCustomComponents} only if {@code internallyCreated} is {@code false}).
+ *
+ * @param container a container
+ * @param cons an instance of {@code GridBagConstraints}
+ * @param msg a message
+ * @param maxll a maximum length
+ * @param internallyCreated {@code true} if the component was internally created
*/
protected void addMessageComponents(Container container,
GridBagConstraints cons,
@@ -431,8 +489,10 @@
}
/**
- * Returns the message to display from the JOptionPane the receiver is
+ * Returns the message to display from the {@code JOptionPane} the receiver is
* providing the look and feel for.
+ *
+ * @return the message to display
*/
protected Object getMessage() {
inputComponent = null;
@@ -514,8 +574,10 @@
/**
* Creates and adds a JLabel representing the icon returned from
- * <code>getIcon</code> to <code>top</code>. This is messaged from
- * <code>createMessageArea</code>
+ * {@code getIcon} to {@code top}. This is messaged from
+ * {@code createMessageArea}.
+ *
+ * @param top a container
*/
protected void addIcon(Container top) {
/* Create the icon. */
@@ -531,9 +593,11 @@
}
/**
- * Returns the icon from the JOptionPane the receiver is providing
+ * Returns the icon from the {@code JOptionPane} the receiver is providing
* the look and feel for, or the default icon as returned from
- * <code>getDefaultIcon</code>.
+ * {@code getDefaultIcon}.
+ *
+ * @return the icon
*/
protected Icon getIcon() {
Icon mIcon = (optionPane == null ? null : optionPane.getIcon());
@@ -545,6 +609,9 @@
/**
* Returns the icon to use for the passed in type.
+ *
+ * @param messageType a type of message
+ * @return the icon to use for the passed in type
*/
protected Icon getIconForType(int messageType) {
if(messageType < 0 || messageType > 3)
@@ -572,14 +639,20 @@
/**
* Returns the maximum number of characters to place on a line.
+ *
+ * @return the maximum number of characters to place on a line
*/
protected int getMaxCharactersPerLineCount() {
return optionPane.getMaxCharactersPerLineCount();
}
- /**
- * Recursively creates new JLabel instances to represent <code>d</code>.
- * Each JLabel instance is added to <code>c</code>.
+ /**
+ * Recursively creates new {@code JLabel} instances to represent {@code d}.
+ * Each {@code JLabel} instance is added to {@code c}.
+ *
+ * @param c a container
+ * @param d a text
+ * @param maxll a maximum length of a text
*/
protected void burstStringInto(Container c, String d, int maxll) {
// Primitive line wrapping
@@ -602,13 +675,20 @@
c.add(label);
}
+ /**
+ * Returns a separator.
+ *
+ * @return a separator
+ */
protected Container createSeparator() {
return null;
}
/**
- * Creates and returns a Container containing the buttons. The buttons
- * are created by calling <code>getButtons</code>.
+ * Creates and returns a {@code Container} containing the buttons.
+ * The buttons are created by calling {@code getButtons}.
+ *
+ * @return a {@code Container} containing the buttons
*/
protected Container createButtonArea() {
JPanel bottom = new JPanel();
@@ -633,10 +713,14 @@
/**
* Creates the appropriate object to represent each of the objects in
- * <code>buttons</code> and adds it to <code>container</code>. This
+ * {@code buttons} and adds it to {@code container}. This
* differs from addMessageComponents in that it will recurse on
- * <code>buttons</code> and that if button is not a Component
+ * {@code buttons} and that if button is not a Component
* it will create an instance of JButton.
+ *
+ * @param container a container
+ * @param buttons an array of buttons
+ * @param initialIndex an initial index
*/
protected void addButtonComponents(Container container, Object[] buttons,
int initialIndex) {
@@ -733,17 +817,25 @@
}
}
+ /**
+ * Constructs a new instance of a {@code ButtonActionListener}.
+ *
+ * @param buttonIndex an index of the button
+ * @return a new instance of a {@code ButtonActionListener}
+ */
protected ActionListener createButtonActionListener(int buttonIndex) {
return new ButtonActionListener(buttonIndex);
}
/**
- * Returns the buttons to display from the JOptionPane the receiver is
- * providing the look and feel for. If the JOptionPane has options
+ * Returns the buttons to display from the {@code JOptionPane} the receiver is
+ * providing the look and feel for. If the {@code JOptionPane} has options
* set, they will be provided, otherwise if the optionType is
- * YES_NO_OPTION, yesNoOptions is returned, if the type is
- * YES_NO_CANCEL_OPTION yesNoCancelOptions is returned, otherwise
- * defaultButtons are returned.
+ * {@code YES_NO_OPTION}, {@code yesNoOptions} is returned, if the type is
+ * {@code YES_NO_CANCEL_OPTION} {@code yesNoCancelOptions} is returned, otherwise
+ * {@code defaultButtons} are returned.
+ *
+ * @return the buttons to display from the JOptionPane
*/
protected Object[] getButtons() {
if (optionPane != null) {
@@ -827,8 +919,10 @@
}
/**
- * Returns true, basic L&F wants all the buttons to have the same
+ * Returns {@code true}, basic L&F wants all the buttons to have the same
* width.
+ *
+ * @return {@code true} if all the buttons should have the same width
*/
protected boolean getSizeButtonsToSameWidth() {
return true;
@@ -838,6 +932,8 @@
* Returns the initial index into the buttons to select. The index
* is calculated from the initial value from the JOptionPane and
* options of the JOptionPane or 0.
+ *
+ * @return the initial index into the buttons to select
*/
protected int getInitialValueIndex() {
if (optionPane != null) {
@@ -915,7 +1011,13 @@
* Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
*/
public static class ButtonAreaLayout implements LayoutManager {
+ /**
+ * The value represents if the width of children should be synchronized.
+ */
protected boolean syncAllWidths;
+ /**
+ * The padding value.
+ */
protected int padding;
/** If true, children are lumped together in parent. */
protected boolean centersChildren;
@@ -928,6 +1030,12 @@
*/
private boolean useOrientation;
+ /**
+ * Constructs a new instance of {@code ButtonAreaLayout}.
+ *
+ * @param syncAllWidths if the width of children should be synchronized
+ * @param padding the padding value
+ */
public ButtonAreaLayout(boolean syncAllWidths, int padding) {
this.syncAllWidths = syncAllWidths;
this.padding = padding;
@@ -943,27 +1051,57 @@
this.reverseButtons = reverseButtons;
}
+ /**
+ * Sets if the width of children should be synchronized.
+ *
+ * @param newValue if the width of children should be synchronized
+ */
public void setSyncAllWidths(boolean newValue) {
syncAllWidths = newValue;
}
+ /**
+ * Returns if the width of children should be synchronized.
+ *
+ * @return if the width of children should be synchronized
+ */
public boolean getSyncAllWidths() {
return syncAllWidths;
}
+ /**
+ * Sets the padding value.
+ *
+ * @param newPadding the new padding
+ */
public void setPadding(int newPadding) {
this.padding = newPadding;
}
+ /**
+ * Returns the padding.
+ *
+ * @return the padding
+ */
public int getPadding() {
return padding;
}
+ /**
+ * Sets whether or not center children should be used.
+ *
+ * @param newValue a new value
+ */
public void setCentersChildren(boolean newValue) {
centersChildren = newValue;
useOrientation = false;
}
+ /**
+ * Returns whether or not center children should be used.
+ *
+ * @return whether or not center children should be used
+ */
public boolean getCentersChildren() {
return centersChildren;
}
@@ -1163,8 +1301,16 @@
* Instantiate it only within subclasses of {@code BasicOptionPaneUI}.
*/
public class ButtonActionListener implements ActionListener {
+ /**
+ * The index of the button.
+ */
protected int buttonIndex;
+ /**
+ * Constructs a new instance of {@code ButtonActionListener}.
+ *
+ * @param buttonIndex an index of the button
+ */
public ButtonActionListener(int buttonIndex) {
this.buttonIndex = buttonIndex;
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPanelUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
// 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 @@
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 @@
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);
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuSeparatorUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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 @@
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 @@
installKeyboardActions();
}
+ /**
+ * Installs default properties.
+ */
public void installDefaults() {
if (popupMenu.getLayout() == null ||
popupMenu.getLayout() instanceof UIResource)
@@ -101,11 +116,14 @@
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 @@
}
}
+ /**
+ * Registers keyboard actions.
+ */
protected void installKeyboardActions() {
}
@@ -181,10 +202,16 @@
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 @@
}
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions() {
SwingUtilities.replaceUIActionMap(popupMenu, null);
SwingUtilities.replaceUIInputMap(popupMenu,
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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 @@
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 @@
progressBar = null;
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
LookAndFeel.installProperty(progressBar, "opaque", Boolean.TRUE);
LookAndFeel.installBorder(progressBar,"ProgressBar.border");
@@ -164,10 +178,16 @@
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 @@
// 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 @@
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 @@
/**
* 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 @@
/**
* 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 @@
}
}
+ /**
+ * Sets the cell length.
+ *
+ * @param cellLen a new cell length
+ */
protected void setCellLength(int cellLen) {
this.cellLength = cellLen;
}
@@ -374,6 +413,11 @@
}
}
+ /**
+ * Sets the cell spacing.
+ *
+ * @param cellSpace a new cell spacing
+ */
protected void setCellSpacing(int cellSpace) {
this.cellSpacing = cellSpace;
}
@@ -384,6 +428,11 @@
* 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 @@
* 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 @@
* 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 @@
}
}
-
+ /**
+ * 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 @@
* 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 @@
/**
* Gets the index of the current animation frame.
*
+ * @return the index of the current animation frame
* @since 1.4
*/
protected int getAnimationIndex() {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
*/
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 @@
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() &&
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRadioButtonUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
{
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 @@
// ********************************
// 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 @@
defaults_initialized = false;
}
+ /**
+ * Returns the default icon.
+ *
+ * @return the default icon
+ */
public Icon getDefaultIcon() {
return icon;
}
@@ -195,6 +210,13 @@
}
}
+ /**
+ * 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){
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicRootPaneUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -48,6 +48,12 @@
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 @@
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 @@
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);
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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 @@
*/
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 @@
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 @@
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 @@
}
+ /**
+ * 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 @@
installKeyboardActions(scrollpane);
}
-
+ /**
+ * Uninstalls default properties.
+ *
+ * @param c an instance of {@code JScrollPane}
+ */
protected void uninstallDefaults(JScrollPane c) {
LookAndFeel.uninstallBorder(scrollpane);
@@ -210,7 +251,11 @@
}
}
-
+ /**
+ * Unregisters listeners.
+ *
+ * @param c a component
+ */
protected void uninstallListeners(JComponent c) {
JViewport viewport = scrollpane.getViewport();
JScrollBar vsb = scrollpane.getVerticalScrollBar();
@@ -242,7 +287,11 @@
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 @@
return handler;
}
+ /**
+ * Synchronizes the {@code JScrollPane} with {@code Viewport}.
+ */
protected void syncScrollPaneWithViewport()
{
JViewport viewport = scrollpane.getViewport();
@@ -453,6 +505,11 @@
}
}
+ /**
+ * Returns an instance of viewport {@code ChangeListener}.
+ *
+ * @return an instance of viewport {@code ChangeListener}
+ */
protected ChangeListener createViewportChangeListener() {
return getHandler();
}
@@ -483,6 +540,11 @@
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 @@
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 @@
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 @@
}
}
-
+ /**
+ * Updates row header.
+ *
+ * @param e the property change event
+ */
protected void updateRowHeader(PropertyChangeEvent e)
{
JViewport newRowHead = (JViewport)(e.getNewValue());
@@ -611,7 +691,11 @@
}
}
-
+ /**
+ * Updates column header.
+ *
+ * @param e the property change event
+ */
protected void updateColumnHeader(PropertyChangeEvent e)
{
JViewport newColHead = (JViewport)(e.getNewValue());
@@ -679,9 +763,9 @@
/**
- * 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.
* <pre>
* class MyScrollPaneUI extends BasicScrollPaneUI {
* protected PropertyChangeListener <b>createPropertyChangeListener</b>() {
@@ -698,6 +782,8 @@
* }
* </pre>
*
+ * @return an instance of {@code PropertyChangeListener}
+ *
* @see java.beans.PropertyChangeListener
* @see #installUI
*/
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSeparatorUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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 @@
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 )
{
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -400,6 +400,8 @@
* The implementation of <code>replaceEditor</code> should be coordinated
* with the <code>createEditor</code> method.
*
+ * @param oldEditor an old instance of editor
+ * @param newEditor a new instance of editor
* @see #createEditor
* @see #createPropertyChangeListener
*/
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java Tue Jul 29 09:09:55 2014 -0700
@@ -65,9 +65,13 @@
{
/**
* 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 @@
/**
- * 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 @@
}
/**
- * 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 @@
/**
- * Returns the <code>SplitPaneUI</code> 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 @@
/**
- * Sets the size of the divider to <code>newSize</code>. That is
- * the width if the splitpane is <code>HORIZONTAL_SPLIT</code>, or
- * the height of <code>VERTICAL_SPLIT</code>.
+ * 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 @@
/**
* 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 @@
/**
* Sets the border of this component.
+ *
+ * @param border a new border
* @since 1.3
*/
public void setBorder(Border border) {
@@ -382,8 +397,10 @@
/**
- * 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 @@
/**
- * 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 @@
/**
* 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 @@
/**
* 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 @@
*/
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 @@
/**
- * 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 @@
/**
* 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 @@
/**
* 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 @@
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 @@
/**
* 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 @@
/**
* 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 @@
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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -286,7 +286,10 @@
/**
- * 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 @@
/**
- * 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 @@
/**
- * 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 @@
/**
- * 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 <code>installKeyboardActions</code> 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.
* <p>
- * 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 @@
/**
- * 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 <code>installKeyboardActions</code> 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.
* <p>
- * 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 @@
/**
- * 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 <code>installKeyboardActions</code> 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.
* <p>
- * 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 @@
/**
- * 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 <code>installKeyboardActions</code> 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.
* <p>
- * 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 @@
/**
- * 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 <code>installKeyboardActions</code> 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.
* <p>
- * 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 @@
/**
- * 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 @@
/**
- * 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 @@
/**
- * 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 @@
/**
* 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 @@
/**
- * 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 @@
/**
- * 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 @@
/**
* Returns the divider between the top Components.
+ *
+ * @return the divider between the top Components
*/
public BasicSplitPaneDivider getDivider() {
return divider;
@@ -828,6 +854,8 @@
/**
* 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 @@
/**
- * 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 @@
/**
* 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 @@
/**
- * 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 @@
/**
- * 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 @@
/**
* Creates the default divider.
+ *
+ * @return the default divider
*/
public BasicSplitPaneDivider createDefaultDivider() {
return new BasicSplitPaneDivider(this);
@@ -1108,6 +1147,9 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
* <p>
* 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 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 @@
/**
* 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 @@
/**
- * Sets the sizes to <code>newSizes</code>.
+ * 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 @@
/**
* Returns the sizes of the components.
+ *
+ * @return the sizes of the components
*/
protected int[] getSizes() {
int[] retSizes = new int[3];
@@ -1624,6 +1683,9 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
/**
* 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 @@
/**
- * 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 @@
/**
- * 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 BasicVerticalLayoutManager extends
BasicHorizontalLayoutManager
{
+ /**
+ * Constructs a new instance of {@code BasicVerticalLayoutManager}.
+ */
public BasicVerticalLayoutManager() {
super(1);
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -49,11 +49,19 @@
// 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 @@
//
/**
- * 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 @@
// 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 @@
header = null;
}
+ /**
+ * Uninstalls default properties
+ */
protected void uninstallDefaults() {}
+ /**
+ * Unregisters listeners.
+ */
protected void uninstallListeners() {
header.removeMouseListener(mouseInputListener);
header.removeMouseMotionListener(mouseInputListener);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -64,12 +64,29 @@
//
// 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 @@
}
/**
- * 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 @@
// 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 @@
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 @@
handler = null;
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions() {
SwingUtilities.replaceUIInputMap(table, JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, null);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -443,6 +443,9 @@
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 @@
return map;
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions() {
editor.setKeymap(null);
SwingUtilities.replaceUIInputMap(editor, JComponent.
@@ -1280,8 +1286,14 @@
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 {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
// ********************************
// 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 @@
}
}
+ /**
+ * 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;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -50,29 +50,65 @@
*/
public class BasicToolBarUI extends ToolBarUI implements SwingConstants
{
+ /**
+ * The instance of {@code JToolBar}.
+ */
protected JToolBar toolBar;
private boolean floating;
private int floatingX;
private int floatingY;
private JFrame floatingFrame;
private RootPaneContainer floatingToolBar;
+ /**
+ * The instance of {@code DragWindow}.
+ */
protected DragWindow dragWindow;
private Container dockingSource;
private int dockingSensitivity = 0;
+ /**
+ * The index of the focused component.
+ */
protected int focusedCompIndex = -1;
+ /**
+ * The background color of the docking border.
+ */
protected Color dockingColor = null;
+ /**
+ * The background color of the not docking border.
+ */
protected Color floatingColor = null;
+ /**
+ * The color of the docking border.
+ */
protected Color dockingBorderColor = null;
+ /**
+ * The color of the not docking border.
+ */
protected Color floatingBorderColor = null;
+ /**
+ * The instance of a {@code MouseInputListener}.
+ */
protected MouseInputListener dockingListener;
+ /**
+ * The instance of a {@code PropertyChangeListener}.
+ */
protected PropertyChangeListener propertyListener;
+ /**
+ * The instance of a {@code ContainerListener}.
+ */
protected ContainerListener toolBarContListener;
+ /**
+ * The instance of a {@code FocusListener}.
+ */
protected FocusListener toolBarFocusListener;
private Handler handler;
+ /**
+ * The layout before floating.
+ */
protected String constraintBeforeFloating = BorderLayout.NORTH;
// Rollover button implementation.
@@ -130,6 +166,12 @@
private static String FOCUSED_COMP_INDEX = "JToolBar.focusedCompIndex";
+ /**
+ * Constructs a new instance of {@code BasicToolBarUI}.
+ *
+ * @param c a component
+ * @return a new instance of {@code BasicToolBarUI}
+ */
public static ComponentUI createUI( JComponent c )
{
return new BasicToolBarUI();
@@ -180,6 +222,9 @@
c.putClientProperty( FOCUSED_COMP_INDEX, Integer.valueOf( focusedCompIndex ) );
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults( )
{
LookAndFeel.installBorder(toolBar,"ToolBar.border");
@@ -222,6 +267,9 @@
setRolloverBorders( isRolloverBorders() );
}
+ /**
+ * Uninstalls default properties.
+ */
protected void uninstallDefaults( )
{
LookAndFeel.uninstallBorder(toolBar);
@@ -237,14 +285,23 @@
nonRolloverToggleBorder = null;
}
+ /**
+ * Registers components.
+ */
protected void installComponents( )
{
}
+ /**
+ * Unregisters components.
+ */
protected void uninstallComponents( )
{
}
+ /**
+ * Registers listeners.
+ */
protected void installListeners( )
{
dockingListener = createDockingListener( );
@@ -278,6 +335,9 @@
}
}
+ /**
+ * Unregisters listeners.
+ */
protected void uninstallListeners( )
{
if ( dockingListener != null )
@@ -314,6 +374,9 @@
handler = null;
}
+ /**
+ * Registers keyboard actions.
+ */
protected void installKeyboardActions( )
{
InputMap km = getInputMap(JComponent.
@@ -342,6 +405,9 @@
map.put(new Actions(Actions.NAVIGATE_DOWN));
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions( )
{
SwingUtilities.replaceUIActionMap(toolBar, null);
@@ -350,7 +416,12 @@
null);
}
- protected void navigateFocusedComp( int direction )
+ /**
+ * Navigates the focused component.
+ *
+ * @param direction a direction
+ */
+ protected void navigateFocusedComp(int direction)
{
int nComp = toolBar.getComponentCount();
int j;
@@ -411,6 +482,7 @@
* <p>
* Override this method to provide an alternate rollover border.
*
+ * @return a rollover border for toolbar components
* @since 1.4
*/
protected Border createRolloverBorder() {
@@ -434,6 +506,7 @@
* <p>
* Override this method to provide an alternate rollover border.
*
+ * @return the non rollover border for toolbar components
* @since 1.4
*/
protected Border createNonRolloverBorder() {
@@ -465,6 +538,9 @@
/**
* No longer used, use BasicToolBarUI.createFloatingWindow(JToolBar)
+ *
+ * @param toolbar an instance of {@code JToolBar}
+ * @return an instance of {@code JFrame}
* @see #createFloatingWindow
*/
protected JFrame createFloatingFrame(JToolBar toolbar) {
@@ -502,7 +578,9 @@
/**
* Creates a window which contains the toolbar after it has been
* dragged out from its container
- * @return a <code>RootPaneContainer</code> object, containing the toolbar.
+ *
+ * @param toolbar an instance of {@code JToolBar}
+ * @return a {@code RootPaneContainer} object, containing the toolbar
* @since 1.4
*/
protected RootPaneContainer createFloatingWindow(JToolBar toolbar) {
@@ -555,6 +633,12 @@
return dialog;
}
+ /**
+ * Returns an instance of {@code DragWindow}.
+ *
+ * @param toolbar an instance of {@code JToolBar}
+ * @return an instance of {@code DragWindow}
+ */
protected DragWindow createDragWindow(JToolBar toolbar) {
Window frame = null;
if(toolBar != null) {
@@ -776,15 +860,32 @@
}
}
+ /**
+ * Sets the floating location.
+ *
+ * @param x an X coordinate
+ * @param y an Y coordinate
+ */
public void setFloatingLocation(int x, int y) {
floatingX = x;
floatingY = y;
}
+ /**
+ * Returns {@code true} if the {@code JToolBar} is floating
+ *
+ * @return {@code true} if the {@code JToolBar} is floating
+ */
public boolean isFloating() {
return floating;
}
+ /**
+ * Sets the floating property.
+ *
+ * @param b {@code true} if the {@code JToolBar} is floating
+ * @param p the position
+ */
public void setFloating(boolean b, Point p) {
if (toolBar.isFloatable()) {
boolean visible = false;
@@ -863,6 +964,11 @@
return orientation;
}
+ /**
+ * Sets the tool bar's orientation.
+ *
+ * @param orientation the new orientation
+ */
public void setOrientation(int orientation)
{
toolBar.setOrientation( orientation );
@@ -873,6 +979,8 @@
/**
* Gets the color displayed when over a docking area
+ *
+ * @return the color displayed when over a docking area
*/
public Color getDockingColor() {
return dockingColor;
@@ -880,6 +988,8 @@
/**
* Sets the color displayed when over a docking area
+ *
+ * @param c the new color
*/
public void setDockingColor(Color c) {
this.dockingColor = c;
@@ -887,6 +997,8 @@
/**
* Gets the color displayed when over a floating area
+ *
+ * @return the color displayed when over a floating area
*/
public Color getFloatingColor() {
return floatingColor;
@@ -894,6 +1006,8 @@
/**
* Sets the color displayed when over a floating area
+ *
+ * @param c the new color
*/
public void setFloatingColor(Color c) {
this.floatingColor = c;
@@ -912,6 +1026,13 @@
return false;
}
+ /**
+ * Returns {@code true} if the {@code JToolBar} can dock at the given position.
+ *
+ * @param c a component
+ * @param p a position
+ * @return {@code true} if the {@code JToolBar} can dock at the given position
+ */
public boolean canDock(Component c, Point p) {
return (p != null && getDockingConstraint(c, p) != null);
}
@@ -952,6 +1073,13 @@
return null;
}
+ /**
+ * The method is used to drag {@code DragWindow} during the {@code JToolBar}
+ * is being dragged.
+ *
+ * @param position the relative to the {@code JTollBar} position
+ * @param origin the screen position of {@code JToolBar} before dragging
+ */
protected void dragTo(Point position, Point origin)
{
if (toolBar.isFloatable())
@@ -1002,6 +1130,13 @@
}
}
+ /**
+ * The method is called at end of dragging to place the frame in either
+ * its original place or in its floating frame.
+ *
+ * @param position the relative to the {@code JTollBar} position
+ * @param origin the screen position of {@code JToolBar} before dragging
+ */
protected void floatAt(Point position, Point origin)
{
if(toolBar.isFloatable())
@@ -1044,26 +1179,51 @@
return handler;
}
+ /**
+ * Returns an instance of {@code ContainerListener}.
+ *
+ * @return an instance of {@code ContainerListener}
+ */
protected ContainerListener createToolBarContListener( )
{
return getHandler();
}
+ /**
+ * Returns an instance of {@code FocusListener}.
+ *
+ * @return an instance of {@code FocusListener}
+ */
protected FocusListener createToolBarFocusListener( )
{
return getHandler();
}
+ /**
+ * Returns an instance of {@code PropertyChangeListener}.
+ *
+ * @return an instance of {@code PropertyChangeListener}
+ */
protected PropertyChangeListener createPropertyListener()
{
return getHandler();
}
+ /**
+ * Returns an instance of {@code MouseInputListener}.
+ *
+ * @return an instance of {@code MouseInputListener}
+ */
protected MouseInputListener createDockingListener( ) {
getHandler().tb = toolBar;
return getHandler();
}
+ /**
+ * Constructs a new instance of {@code WindowListener}.
+ *
+ * @return a new instance of {@code WindowListener}
+ */
protected WindowListener createFrameListener() {
return new FrameListener();
}
@@ -1241,6 +1401,9 @@
}
}
+ /**
+ * The class listens for window events.
+ */
protected class FrameListener extends WindowAdapter {
public void windowClosing(WindowEvent w) {
if (toolBar.isFloatable()) {
@@ -1276,6 +1439,9 @@
}
+ /**
+ * The class listens for component events.
+ */
protected class ToolBarContListener implements ContainerListener {
// NOTE: This class exists only for backward compatibility. All
// its functionality has been moved into Handler. If you need to add
@@ -1291,6 +1457,9 @@
}
+ /**
+ * The class listens for focus events.
+ */
protected class ToolBarFocusListener implements FocusListener {
// NOTE: This class exists only for backward compatibility. All
// its functionality has been moved into Handler. If you need to add
@@ -1305,6 +1474,9 @@
}
}
+ /**
+ * The class listens for property changed events.
+ */
protected class PropertyListener implements PropertyChangeListener {
// NOTE: This class exists only for backward compatibility. All
// its functionality has been moved into Handler. If you need to add
@@ -1324,10 +1496,24 @@
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
+ /**
+ * The instance of {@code JToolBar}.
+ */
protected JToolBar toolBar;
+ /**
+ * {@code true} if the {@code JToolBar} is being dragged.
+ */
protected boolean isDragging = false;
+ /**
+ * The origin point.
+ */
protected Point origin = null;
+ /**
+ * Constructs a new instance of {@code DockingListener}.
+ *
+ * @param t an instance of {@code JToolBar}
+ */
public DockingListener(JToolBar t) {
this.toolBar = t;
getHandler().tb = t;
@@ -1373,6 +1559,9 @@
}
}
+ /**
+ * The window which appears during dragging the {@code JToolBar}.
+ */
@SuppressWarnings("serial") // Same-version serialization only
protected class DragWindow extends Window
{
@@ -1396,6 +1585,11 @@
return orientation;
}
+ /**
+ * Sets the orientation.
+ *
+ * @param o the new orientation
+ */
public void setOrientation(int o) {
if(isShowing()) {
if (o == this.orientation)
@@ -1416,14 +1610,29 @@
}
}
+ /**
+ * Returns the offset.
+ *
+ * @return the offset
+ */
public Point getOffset() {
return offset;
}
+ /**
+ * Sets the offset.
+ *
+ * @param p the new offset
+ */
public void setOffset(Point p) {
this.offset = p;
}
+ /**
+ * Sets the border color.
+ *
+ * @param c the new border color
+ */
public void setBorderColor(Color c) {
if (this.borderColor == c)
return;
@@ -1431,6 +1640,11 @@
repaint();
}
+ /**
+ * Returns the border color.
+ *
+ * @return the border color
+ */
public Color getBorderColor() {
return this.borderColor;
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
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 @@
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 @@
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);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -63,7 +63,13 @@
// Old actions forward to an instance of this.
static private final Actions SHARED_ACTION = new Actions();
+ /**
+ * The collapsed icon.
+ */
transient protected Icon collapsedIcon;
+ /**
+ * The expanded icon.
+ */
transient protected Icon expandedIcon;
/**
@@ -210,6 +216,12 @@
*/
private MouseEvent releaseEvent;
+ /**
+ * Constructs a new instance of {@code BasicTreeUI}.
+ *
+ * @param x a component
+ * @return a new instance of {@code BasicTreeUI}
+ */
public static ComponentUI createUI(JComponent x) {
return new BasicTreeUI();
}
@@ -279,19 +291,36 @@
map.put(TransferHandler.getPasteAction());
}
-
+ /**
+ * Constructs a new instance of {@code BasicTreeUI}.
+ */
public BasicTreeUI() {
super();
}
+ /**
+ * Returns the hash color.
+ *
+ * @return the hash color
+ */
protected Color getHashColor() {
return hashColor;
}
+ /**
+ * Sets the hash color.
+ *
+ * @param color the hash color
+ */
protected void setHashColor(Color color) {
hashColor = color;
}
+ /**
+ * Sets the left child indent.
+ *
+ * @param newAmount the left child indent
+ */
public void setLeftChildIndent(int newAmount) {
leftChildIndent = newAmount;
totalChildIndent = leftChildIndent + rightChildIndent;
@@ -300,10 +329,20 @@
updateSize();
}
+ /**
+ * Returns the left child indent.
+ *
+ * @return the left child indent
+ */
public int getLeftChildIndent() {
return leftChildIndent;
}
+ /**
+ * Sets the right child indent.
+ *
+ * @param newAmount the right child indent
+ */
public void setRightChildIndent(int newAmount) {
rightChildIndent = newAmount;
totalChildIndent = leftChildIndent + rightChildIndent;
@@ -312,22 +351,47 @@
updateSize();
}
+ /**
+ * Returns the right child indent.
+ *
+ * @return the right child indent
+ */
public int getRightChildIndent() {
return rightChildIndent;
}
+ /**
+ * Sets the expanded icon.
+ *
+ * @param newG the expanded icon
+ */
public void setExpandedIcon(Icon newG) {
expandedIcon = newG;
}
+ /**
+ * Returns the expanded icon.
+ *
+ * @return the expanded icon
+ */
public Icon getExpandedIcon() {
return expandedIcon;
}
+ /**
+ * Sets the collapsed icon.
+ *
+ * @param newG the collapsed icon
+ */
public void setCollapsedIcon(Icon newG) {
collapsedIcon = newG;
}
+ /**
+ * Returns the collapsed icon.
+ *
+ * @return the collapsed icon
+ */
public Icon getCollapsedIcon() {
return collapsedIcon;
}
@@ -340,6 +404,8 @@
/**
* Updates the componentListener, if necessary.
+ *
+ * @param largeModel the new value
*/
protected void setLargeModel(boolean largeModel) {
if(getRowHeight() < 1)
@@ -354,12 +420,19 @@
}
}
+ /**
+ * Returns {@code true} if large model is set.
+ *
+ * @return {@code true} if large model is set
+ */
protected boolean isLargeModel() {
return largeModel;
}
/**
* Sets the row height, this is forwarded to the treeState.
+ *
+ * @param rowHeight the row height
*/
protected void setRowHeight(int rowHeight) {
completeEditing();
@@ -370,13 +443,20 @@
}
}
+ /**
+ * Returns the row height.
+ *
+ * @return the row height
+ */
protected int getRowHeight() {
return (tree == null) ? -1 : tree.getRowHeight();
}
/**
- * Sets the TreeCellRenderer to <code>tcr</code>. This invokes
- * <code>updateRenderer</code>.
+ * Sets the {@code TreeCellRenderer} to {@code tcr}. This invokes
+ * {@code updateRenderer}.
+ *
+ * @param tcr the new value
*/
protected void setCellRenderer(TreeCellRenderer tcr) {
completeEditing();
@@ -388,15 +468,19 @@
}
/**
- * Return currentCellRenderer, which will either be the trees
- * renderer, or defaultCellRenderer, which ever wasn't null.
+ * Return {@code currentCellRenderer}, which will either be the trees
+ * renderer, or {@code defaultCellRenderer}, which ever wasn't null.
+ *
+ * @return an instance of {@code TreeCellRenderer}
*/
protected TreeCellRenderer getCellRenderer() {
return currentCellRenderer;
}
/**
- * Sets the TreeModel.
+ * Sets the {@code TreeModel}.
+ *
+ * @param model the new value
*/
protected void setModel(TreeModel model) {
completeEditing();
@@ -414,12 +498,19 @@
}
}
+ /**
+ * Returns the tree model.
+ *
+ * @return the tree model
+ */
protected TreeModel getModel() {
return treeModel;
}
/**
* Sets the root to being visible.
+ *
+ * @param newValue the new value
*/
protected void setRootVisible(boolean newValue) {
completeEditing();
@@ -431,12 +522,19 @@
}
}
+ /**
+ * Returns {@code true} if the tree root is visible.
+ *
+ * @return {@code true} if the tree root is visible
+ */
protected boolean isRootVisible() {
return (tree != null) ? tree.isRootVisible() : false;
}
/**
* Determines whether the node handles are to be displayed.
+ *
+ * @param newValue the new value
*/
protected void setShowsRootHandles(boolean newValue) {
completeEditing();
@@ -447,28 +545,47 @@
}
}
+ /**
+ * Returns {@code true} if the root handles are to be displayed.
+ *
+ * @return {@code true} if the root handles are to be displayed
+ */
protected boolean getShowsRootHandles() {
return (tree != null) ? tree.getShowsRootHandles() : false;
}
/**
* Sets the cell editor.
+ *
+ * @param editor the new cell editor
*/
protected void setCellEditor(TreeCellEditor editor) {
updateCellEditor();
}
+ /**
+ * Returns an instance of {@code TreeCellEditor}.
+ *
+ * @return an instance of {@code TreeCellEditor}
+ */
protected TreeCellEditor getCellEditor() {
return (tree != null) ? tree.getCellEditor() : null;
}
/**
* Configures the receiver to allow, or not allow, editing.
+ *
+ * @param newValue the new value
*/
protected void setEditable(boolean newValue) {
updateCellEditor();
}
+ /**
+ * Returns {@code true} if the tree is editable.
+ *
+ * @return {@code true} if the tree is editable
+ */
protected boolean isEditable() {
return (tree != null) ? tree.isEditable() : false;
}
@@ -476,6 +593,8 @@
/**
* Resets the selection model. The appropriate listener are installed
* on the model.
+ *
+ * @param newLSM new selection model
*/
protected void setSelectionModel(TreeSelectionModel newLSM) {
completeEditing();
@@ -503,6 +622,11 @@
tree.repaint();
}
+ /**
+ * Returns the tree selection model.
+ *
+ * @return the tree selection model
+ */
protected TreeSelectionModel getSelectionModel() {
return treeSelectionModel;
}
@@ -649,7 +773,7 @@
}
/**
- * Invoked after the <code>tree</code> instance variable has been
+ * Invoked after the {@code tree} instance variable has been
* set, but before any defaults/listeners have been installed.
*/
protected void prepareForUIInstall() {
@@ -690,6 +814,9 @@
updateSize();
}
+ /**
+ * Installs default properties.
+ */
protected void installDefaults() {
if(tree.getBackground() == null ||
tree.getBackground() instanceof UIResource) {
@@ -739,6 +866,9 @@
}
}
+ /**
+ * Registers listeners.
+ */
protected void installListeners() {
if ( (propertyChangeListener = createPropertyChangeListener())
!= null ) {
@@ -787,6 +917,9 @@
LookAndFeel.installProperty(tree, "opaque", Boolean.TRUE);
}
+ /**
+ * Registers keyboard actions.
+ */
protected void installKeyboardActions() {
InputMap km = getInputMap(JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
@@ -837,8 +970,10 @@
//
/**
- * Creates an instance of NodeDimensions that is able to determine
+ * Creates an instance of {@code NodeDimensions} that is able to determine
* the size of a given node in the tree.
+ *
+ * @return an instance of {@code NodeDimensions}
*/
protected AbstractLayoutCache.NodeDimensions createNodeDimensions() {
return new NodeDimensionsHandler();
@@ -847,6 +982,8 @@
/**
* Creates a listener that is responsible that updates the UI based on
* how the tree changes.
+ *
+ * @return an instance of the {@code PropertyChangeListener}
*/
protected PropertyChangeListener createPropertyChangeListener() {
return getHandler();
@@ -862,6 +999,8 @@
/**
* Creates the listener responsible for updating the selection based on
* mouse events.
+ *
+ * @return an instance of the {@code MouseListener}
*/
protected MouseListener createMouseListener() {
return getHandler();
@@ -870,14 +1009,18 @@
/**
* Creates a listener that is responsible for updating the display
* when focus is lost/gained.
+ *
+ * @return an instance of the {@code FocusListener}
*/
protected FocusListener createFocusListener() {
return getHandler();
}
/**
- * Creates the listener reponsible for getting key events from
+ * Creates the listener responsible for getting key events from
* the tree.
+ *
+ * @return an instance of the {@code KeyListener}
*/
protected KeyListener createKeyListener() {
return getHandler();
@@ -886,6 +1029,8 @@
/**
* Creates the listener responsible for getting property change
* events from the selection model.
+ *
+ * @return an instance of the {@code PropertyChangeListener}
*/
protected PropertyChangeListener createSelectionModelPropertyChangeListener() {
return getHandler();
@@ -894,6 +1039,8 @@
/**
* Creates the listener that updates the display based on selection change
* methods.
+ *
+ * @return an instance of the {@code TreeSelectionListener}
*/
protected TreeSelectionListener createTreeSelectionListener() {
return getHandler();
@@ -901,6 +1048,8 @@
/**
* Creates a listener to handle events from the current editor.
+ *
+ * @return an instance of the {@code CellEditorListener}
*/
protected CellEditorListener createCellEditorListener() {
return getHandler();
@@ -910,6 +1059,8 @@
* Creates and returns a new ComponentHandler. This is used for
* the large model to mark the validCachedPreferredSize as invalid
* when the component moves.
+ *
+ * @return an instance of the {@code ComponentListener}
*/
protected ComponentListener createComponentListener() {
return new ComponentHandler();
@@ -918,6 +1069,8 @@
/**
* Creates and returns the object responsible for updating the treestate
* when nodes expanded state changes.
+ *
+ * @return an instance of the {@code TreeExpansionListener}
*/
protected TreeExpansionListener createTreeExpansionListener() {
return getHandler();
@@ -926,6 +1079,8 @@
/**
* Creates the object responsible for managing what is expanded, as
* well as the size of nodes.
+ *
+ * @return the object responsible for managing what is expanded
*/
protected AbstractLayoutCache createLayoutCache() {
if(isLargeModel() && getRowHeight() > 0) {
@@ -936,14 +1091,18 @@
/**
* Returns the renderer pane that renderer components are placed in.
+ *
+ * @return an instance of the {@code CellRendererPane}
*/
protected CellRendererPane createCellRendererPane() {
return new CellRendererPane();
}
/**
- * Creates a default cell editor.
- */
+ * Creates a default cell editor.
+ *
+ * @return a default cell editor
+ */
protected TreeCellEditor createDefaultCellEditor() {
if(currentCellRenderer != null &&
(currentCellRenderer instanceof DefaultTreeCellRenderer)) {
@@ -956,15 +1115,19 @@
}
/**
- * Returns the default cell renderer that is used to do the
- * stamping of each node.
- */
+ * Returns the default cell renderer that is used to do the
+ * stamping of each node.
+ *
+ * @return an instance of {@code TreeCellRenderer}
+ */
protected TreeCellRenderer createDefaultCellRenderer() {
return new DefaultTreeCellRenderer();
}
/**
* Returns a listener that can update the tree when the model changes.
+ *
+ * @return an instance of the {@code TreeModelListener}.
*/
protected TreeModelListener createTreeModelListener() {
return getHandler();
@@ -987,9 +1150,15 @@
completeUIUninstall();
}
+ /**
+ * Invoked before unstallation of UI.
+ */
protected void prepareForUIUninstall() {
}
+ /**
+ * Uninstalls UI.
+ */
protected void completeUIUninstall() {
if(createdRenderer) {
tree.setCellRenderer(null);
@@ -1016,12 +1185,18 @@
treeExpansionListener = null;
}
+ /**
+ * Uninstalls default properties.
+ */
protected void uninstallDefaults() {
if (tree.getTransferHandler() instanceof UIResource) {
tree.setTransferHandler(null);
}
}
+ /**
+ * Unregisters listeners.
+ */
protected void uninstallListeners() {
if(componentListener != null) {
tree.removeComponentListener(componentListener);
@@ -1059,6 +1234,9 @@
handler = null;
}
+ /**
+ * Unregisters keyboard actions.
+ */
protected void uninstallKeyboardActions() {
SwingUtilities.replaceUIActionMap(tree, null);
SwingUtilities.replaceUIInputMap(tree, JComponent.
@@ -1340,8 +1518,18 @@
/**
* Paints the horizontal part of the leg. The receiver should
- * NOT modify <code>clipBounds</code>, or <code>insets</code>.<p>
- * NOTE: <code>parentRow</code> can be -1 if the root is not visible.
+ * NOT modify {@code clipBounds}, or {@code insets}.<p>
+ * NOTE: {@code parentRow} can be -1 if the root is not visible.
+ *
+ * @param g a graphics context
+ * @param clipBounds a clipped rectangle
+ * @param insets insets
+ * @param bounds a bounding rectangle
+ * @param path a tree path
+ * @param row a row
+ * @param isExpanded {@code true} if the path is expanded
+ * @param hasBeenExpanded {@code true} if the path has been expanded
+ * @param isLeaf {@code true} if the path is leaf
*/
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds,
@@ -1397,7 +1585,12 @@
/**
* Paints the vertical part of the leg. The receiver should
- * NOT modify <code>clipBounds</code>, <code>insets</code>.
+ * NOT modify {@code clipBounds}, {@code insets}.
+ *
+ * @param g a graphics context
+ * @param clipBounds a clipped rectangle
+ * @param insets insets
+ * @param path a tree path
*/
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
Insets insets, TreePath path) {
@@ -1472,7 +1665,17 @@
/**
* Paints the expand (toggle) part of a row. The receiver should
- * NOT modify <code>clipBounds</code>, or <code>insets</code>.
+ * NOT modify {@code clipBounds}, or {@code insets}.
+ *
+ * @param g a graphics context
+ * @param clipBounds a clipped rectangle
+ * @param insets insets
+ * @param bounds a bounding rectangle
+ * @param path a tree path
+ * @param row a row
+ * @param isExpanded {@code true} if the path is expanded
+ * @param hasBeenExpanded {@code true} if the path has been expanded
+ * @param isLeaf {@code true} if the row is leaf
*/
protected void paintExpandControl(Graphics g,
Rectangle clipBounds, Insets insets,
@@ -1511,7 +1714,17 @@
/**
* Paints the renderer part of a row. The receiver should
- * NOT modify <code>clipBounds</code>, or <code>insets</code>.
+ * NOT modify {@code clipBounds}, or {@code insets}.
+ *
+ * @param g a graphics context
+ * @param clipBounds a clipped rectangle
+ * @param insets insets
+ * @param bounds a bounding rectangle
+ * @param path a tree path
+ * @param row a row
+ * @param isExpanded {@code true} if the path is expanded
+ * @param hasBeenExpanded {@code true} if the path has been expanded
+ * @param isLeaf {@code true} if the path is leaf
*/
protected void paintRow(Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds, TreePath path,
@@ -1541,8 +1754,16 @@
}
/**
- * Returns true if the expand (toggle) control should be drawn for
+ * Returns {@code true} if the expand (toggle) control should be drawn for
* the specified row.
+ *
+ * @param path a tree path
+ * @param row a row
+ * @param isExpanded {@code true} if the path is expanded
+ * @param hasBeenExpanded {@code true} if the path has been expanded
+ * @param isLeaf {@code true} if the row is leaf
+ * @return {@code true} if the expand (toggle) control should be drawn
+ * for the specified row
*/
protected boolean shouldPaintExpandControl(TreePath path, int row,
boolean isExpanded,
@@ -1561,6 +1782,12 @@
/**
* Paints a vertical line.
+ *
+ * @param g a graphics context
+ * @param c a component
+ * @param x an X coordinate
+ * @param top an Y1 coordinate
+ * @param bottom an Y2 coordinate
*/
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top,
int bottom) {
@@ -1573,6 +1800,12 @@
/**
* Paints a horizontal line.
+ *
+ * @param g a graphics context
+ * @param c a component
+ * @param y an Y coordinate
+ * @param left an X1 coordinate
+ * @param right an X2 coordinate
*/
protected void paintHorizontalLine(Graphics g, JComponent c, int y,
int left, int right) {
@@ -1586,6 +1819,8 @@
/**
* The vertical element of legs between nodes starts at the bottom of the
* parent node by default. This method makes the leg start below that.
+ *
+ * @return the vertical leg buffer
*/
protected int getVerticalLegBuffer() {
return 0;
@@ -1595,6 +1830,8 @@
* The horizontal element of legs between nodes starts at the
* right of the left-hand side of the child node by default. This
* method makes the leg end before that.
+ *
+ * @return the horizontal leg buffer
*/
protected int getHorizontalLegBuffer() {
return 0;
@@ -1610,7 +1847,15 @@
// Generic painting methods
//
- // Draws the icon centered at (x,y)
+ /**
+ * Draws the {@code icon} centered at (x,y).
+ *
+ * @param c a component
+ * @param graphics a graphics context
+ * @param icon an icon
+ * @param x an X coordinate
+ * @param y an Y coordinate
+ */
protected void drawCentered(Component c, Graphics graphics, Icon icon,
int x, int y) {
icon.paintIcon(c, graphics,
@@ -1618,32 +1863,57 @@
y - icon.getIconHeight() / 2);
}
- // This method is slow -- revisit when Java2D is ready.
- // assumes x1 <= x2
- protected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2){
+ /**
+ * Draws a horizontal dashed line. It is assumed {@code x1} <= {@code x2}.
+ * If {@code x1} is greater than {@code x2}, the method draws nothing.
+ *
+ * @param g an instance of {@code Graphics}
+ * @param y an Y coordinate
+ * @param x1 an X1 coordinate
+ * @param x2 an X2 coordinate
+ */
+ protected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2) {
// Drawing only even coordinates helps join line segments so they
// appear as one line. This can be defeated by translating the
// Graphics by an odd amount.
- x1 += (x1 % 2);
-
- for (int x = x1; x <= x2; x+=2) {
- g.drawLine(x, y, x, y);
- }
+ drawDashedLine(g, y, x1, x2, false);
}
- // This method is slow -- revisit when Java2D is ready.
- // assumes y1 <= y2
+ /**
+ * Draws a vertical dashed line. It is assumed {@code y1} <= {@code y2}.
+ * If {@code y1} is greater than {@code y2}, the method draws nothing.
+ *
+ * @param g an instance of {@code Graphics}
+ * @param x an X coordinate
+ * @param y1 an Y1 coordinate
+ * @param y2 an Y2 coordinate
+ */
protected void drawDashedVerticalLine(Graphics g, int x, int y1, int y2) {
// Drawing only even coordinates helps join line segments so they
// appear as one line. This can be defeated by translating the
// Graphics by an odd amount.
- y1 += (y1 % 2);
-
- for (int y = y1; y <= y2; y+=2) {
- g.drawLine(x, y, x, y);
- }
+ drawDashedLine(g, x, y1, y2, true);
}
+ private void drawDashedLine(Graphics g, int v, int v1, int v2, boolean isVertical) {
+ if (v1 >= v2) {
+ return;
+ }
+ v1 += (v1 % 2);
+ Graphics2D g2d = (Graphics2D) g;
+ Stroke oldStroke = g2d.getStroke();
+
+ BasicStroke dashedStroke = new BasicStroke(1, BasicStroke.CAP_BUTT,
+ BasicStroke.JOIN_ROUND, 0, new float[]{1}, 0);
+ g2d.setStroke(dashedStroke);
+ if (isVertical) {
+ g2d.drawLine(v, v1, v, v2);
+ } else {
+ g2d.drawLine(v1, v, v2, v);
+ }
+
+ g2d.setStroke(oldStroke);
+ }
//
// Various local methods
//
@@ -1685,9 +1955,11 @@
}
/**
- * Updates the expanded state of all the descendants of <code>path</code>
+ * Updates the expanded state of all the descendants of {@code path}
* by getting the expanded descendants from the tree and forwarding
* to the tree state.
+ *
+ * @param path a tree path
*/
protected void updateExpandedDescendants(TreePath path) {
completeEditing();
@@ -1708,7 +1980,10 @@
}
/**
- * Returns a path to the last child of <code>parent</code>.
+ * Returns a path to the last child of {@code parent}.
+ *
+ * @param parent a tree path
+ * @return a path to the last child of {@code parent}
*/
protected TreePath getLastChildPath(TreePath parent) {
if(treeModel != null) {
@@ -1906,8 +2181,10 @@
}
/**
- * Messaged from the VisibleTreeNode after it has been expanded.
- */
+ * Messaged from the {@code VisibleTreeNode} after it has been expanded.
+ *
+ * @param path a tree path
+ */
protected void pathWasExpanded(TreePath path) {
if(tree != null) {
tree.fireTreeExpanded(path);
@@ -1915,8 +2192,10 @@
}
/**
- * Messaged from the VisibleTreeNode after it has collapsed.
- */
+ * Messaged from the {@code VisibleTreeNode} after it has collapsed.
+ *
+ * @param path a tree path
+ */
protected void pathWasCollapsed(TreePath path) {
if(tree != null) {
tree.fireTreeCollapsed(path);
@@ -1924,9 +2203,12 @@
}
/**
- * Ensures that the rows identified by beginRow through endRow are
- * visible.
- */
+ * Ensures that the rows identified by {@code beginRow} through
+ * {@code endRow} are visible.
+ *
+ * @param beginRow the begin row
+ * @param endRow the end row
+ */
protected void ensureRowsAreVisible(int beginRow, int endRow) {
if(tree != null && beginRow >= 0 && endRow < getRowCount(tree)) {
boolean scrollVert = DefaultLookup.getBoolean(tree, this,
@@ -1969,31 +2251,46 @@
}
}
- /** Sets the preferred minimum size.
- */
+ /**
+ * Sets the preferred minimum size.
+ *
+ * @param newSize the new preferred size
+ */
public void setPreferredMinSize(Dimension newSize) {
preferredMinSize = newSize;
}
- /** Returns the minimum preferred size.
- */
+ /**
+ * Returns the minimum preferred size.
+ *
+ * @return the minimum preferred size
+ */
public Dimension getPreferredMinSize() {
if(preferredMinSize == null)
return null;
return new Dimension(preferredMinSize);
}
- /** Returns the preferred size to properly display the tree,
- * this is a cover method for getPreferredSize(c, true).
- */
+ /**
+ * Returns the preferred size to properly display the tree,
+ * this is a cover method for {@code getPreferredSize(c, true)}.
+ *
+ * @param c a component
+ * @return the preferred size to represent the tree in the component
+ */
public Dimension getPreferredSize(JComponent c) {
return getPreferredSize(c, true);
}
- /** Returns the preferred size to represent the tree in
- * <I>c</I>. If <I>checkConsistency</I> is true
- * <b>checkConsistency</b> is messaged first.
- */
+ /**
+ * Returns the preferred size to represent the tree in
+ * <I>c</I>. If <I>checkConsistency</I> is {@code true}
+ * <b>checkConsistency</b> is messaged first.
+ *
+ * @param c a component
+ * @param checkConsistency if {@code true} consistency is checked
+ * @return the preferred size to represent the tree in the component
+ */
public Dimension getPreferredSize(JComponent c,
boolean checkConsistency) {
Dimension pSize = this.getPreferredMinSize();
@@ -2056,11 +2353,16 @@
}
/**
- * Stops the editing session. If messageStop is true the editor
- * is messaged with stopEditing, if messageCancel is true the
- * editor is messaged with cancelEditing. If messageTree is true
- * the treeModel is messaged with valueForPathChanged.
- */
+ * Stops the editing session. If {@code messageStop} is {@code true} the editor
+ * is messaged with {@code stopEditing}, if {@code messageCancel}
+ * is {@code true} the editor is messaged with {@code cancelEditing}.
+ * If {@code messageTree} is {@code true} the {@code treeModel} is messaged
+ * with {@code valueForPathChanged}.
+ *
+ * @param messageStop message to stop editing
+ * @param messageCancel message to cancel editing
+ * @param messageTree message to tree
+ */
protected void completeEditing(boolean messageStop,
boolean messageCancel,
boolean messageTree) {
@@ -2112,10 +2414,14 @@
}
/**
- * Will start editing for node if there is a cellEditor and
- * shouldSelectCell returns true.<p>
- * This assumes that path is valid and visible.
- */
+ * Will start editing for node if there is a {@code cellEditor} and
+ * {@code shouldSelectCell} returns {@code true}.<p>
+ * This assumes that path is valid and visible.
+ *
+ * @param path a tree path
+ * @param event a mouse event
+ * @return {@code true} if the editing is successful
+ */
protected boolean startEditing(TreePath path, MouseEvent event) {
if (isEditing(tree) && tree.getInvokesStopCellEditing() &&
!stopEditing(tree)) {
@@ -2220,9 +2526,13 @@
//
/**
- * If the <code>mouseX</code> and <code>mouseY</code> are in the
- * expand/collapse region of the <code>row</code>, this will toggle
+ * If the {@code mouseX} and {@code mouseY} are in the
+ * expand/collapse region of the {@code row}, this will toggle
* the row.
+ *
+ * @param path a tree path
+ * @param mouseX an X coordinate
+ * @param mouseY an Y coordinate
*/
protected void checkForClickInExpandControl(TreePath path,
int mouseX, int mouseY) {
@@ -2232,9 +2542,15 @@
}
/**
- * Returns true if <code>mouseX</code> and <code>mouseY</code> fall
+ * Returns {@code true} if {@code mouseX} and {@code mouseY} fall
* in the area of row that is used to expand/collapse the node and
- * the node at <code>row</code> does not represent a leaf.
+ * the node at {@code row} does not represent a leaf.
+ *
+ * @param path a tree path
+ * @param mouseX an X coordinate
+ * @param mouseY an Y coordinate
+ * @return {@code true} if the mouse cursor fall in the area of row that
+ * is used to expand/collapse the node and the node is not a leaf.
*/
protected boolean isLocationInExpandControl(TreePath path,
int mouseX, int mouseY) {
@@ -2265,7 +2581,11 @@
/**
* Messaged when the user clicks the particular row, this invokes
- * toggleExpandState.
+ * {@code toggleExpandState}.
+ *
+ * @param path a tree path
+ * @param mouseX an X coordinate
+ * @param mouseY an Y coordinate
*/
protected void handleExpandControlClick(TreePath path, int mouseX,
int mouseY) {
@@ -2274,9 +2594,11 @@
/**
* Expands path if it is not expanded, or collapses row if it is expanded.
- * If expanding a path and JTree scrolls on expand, ensureRowsAreVisible
- * is invoked to scroll as many of the children to visible as possible
- * (tries to scroll to last visible descendant of path).
+ * If expanding a path and {@code JTree} scrolls on expand,
+ * {@code ensureRowsAreVisible} is invoked to scroll as many of the children
+ * to visible as possible (tries to scroll to last visible descendant of path).
+ *
+ * @param path a tree path
*/
protected void toggleExpandState(TreePath path) {
if(!tree.isExpanded(path)) {
@@ -2299,8 +2621,11 @@
}
/**
- * Returning true signifies a mouse event on the node should toggle
+ * Returning {@code true} signifies a mouse event on the node should toggle
* the selection of only the row under mouse.
+ *
+ * @param event a mouse event
+ * @return {@code true} if a mouse event on the node should toggle the selection
*/
protected boolean isToggleSelectionEvent(MouseEvent event) {
return (SwingUtilities.isLeftMouseButton(event) &&
@@ -2308,8 +2633,12 @@
}
/**
- * Returning true signifies a mouse event on the node should select
+ * Returning {@code true} signifies a mouse event on the node should select
* from the anchor point.
+ *
+ * @param event a mouse event
+ * @return {@code true} if a mouse event on the node should select
+ * from the anchor point
*/
protected boolean isMultiSelectEvent(MouseEvent event) {
return (SwingUtilities.isLeftMouseButton(event) &&
@@ -2317,9 +2646,12 @@
}
/**
- * Returning true indicates the row under the mouse should be toggled
- * based on the event. This is invoked after checkForClickInExpandControl,
- * implying the location is not in the expand (toggle) control
+ * Returning {@code true} indicates the row under the mouse should be toggled
+ * based on the event. This is invoked after {@code checkForClickInExpandControl},
+ * implying the location is not in the expand (toggle) control.
+ *
+ * @param event a mouse event
+ * @return {@code true} if the row under the mouse should be toggled
*/
protected boolean isToggleEvent(MouseEvent event) {
if(!SwingUtilities.isLeftMouseButton(event)) {
@@ -2334,12 +2666,15 @@
}
/**
- * Messaged to update the selection based on a MouseEvent over a
+ * Messaged to update the selection based on a {@code MouseEvent} over a
* particular row. If the event is a toggle selection event, the
* row is either selected, or deselected. If the event identifies
* a multi selection event, the selection is updated from the
* anchor point. Otherwise the row is selected, and if the event
* specified a toggle event the row is expanded/collapsed.
+ *
+ * @param path the selected path
+ * @param event the mouse event
*/
protected void selectPathForEvent(TreePath path, MouseEvent event) {
/* Adjust from the anchor point. */
@@ -2397,7 +2732,10 @@
}
/**
- * @return true if the node at <code>row</code> is a leaf.
+ * Returns {@code true} if the node at {@code row} is a leaf.
+ *
+ * @param row a row
+ * @return {@code true} if the node at {@code row} is a leaf
*/
protected boolean isLeaf(int row) {
TreePath path = getPathForRow(tree, row);
@@ -2592,8 +2930,10 @@
}
/**
- * Returns the JScrollPane housing the JTree, or null if one isn't
- * found.
+ * Returns the {@code JScrollPane} housing the {@code JTree},
+ * or null if one isn't found.
+ *
+ * @return the {@code JScrollPane} housing the {@code JTree}
*/
protected JScrollPane getScrollPane() {
Component c = tree.getParent();
@@ -2828,7 +3168,11 @@
}
/**
- * @return amount to indent the given row.
+ * Returns amount to indent the given row.
+ *
+ * @param row a row
+ * @param depth a depth
+ * @return amount to indent the given row
*/
protected int getRowX(int row, int depth) {
return BasicTreeUI.this.getRowX(row, depth);
@@ -2924,6 +3268,12 @@
* changes. */
private boolean changeSelection;
+ /**
+ * Constructs a new instance of {@code TreeTraverseAction}.
+ *
+ * @param direction the direction
+ * @param name the name of action
+ */
public TreeTraverseAction(int direction, String name) {
this(direction, name, true);
}
@@ -2956,6 +3306,12 @@
private boolean addToSelection;
private boolean changeSelection;
+ /**
+ * Constructs a new instance of {@code TreePageAction}.
+ *
+ * @param direction the direction
+ * @param name the name of action
+ */
public TreePageAction(int direction, String name) {
this(direction, name, false, true);
}
@@ -2993,6 +3349,12 @@
private boolean addToSelection;
private boolean changeSelection;
+ /**
+ * Constructs a new instance of {@code TreeIncrementAction}.
+ *
+ * @param direction the direction
+ * @param name the name of action
+ */
public TreeIncrementAction(int direction, String name) {
this(direction, name, false, true);
}
@@ -3024,11 +3386,20 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class TreeHomeAction extends AbstractAction {
+ /**
+ * The direction.
+ */
protected int direction;
/** Set to true if append to selection. */
private boolean addToSelection;
private boolean changeSelection;
+ /**
+ * Constructs a new instance of {@code TreeHomeAction}.
+ *
+ * @param direction the direction
+ * @param name the name of action
+ */
public TreeHomeAction(int direction, String name) {
this(direction, name, false, true);
}
@@ -3059,6 +3430,11 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class TreeToggleAction extends AbstractAction {
+ /**
+ * Constructs a new instance of {@code TreeToggleAction}.
+ *
+ * @param name the name of action
+ */
public TreeToggleAction(String name) {
}
@@ -3079,6 +3455,11 @@
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class TreeCancelEditingAction extends AbstractAction {
+ /**
+ * Constructs a new instance of {@code TreeCancelEditingAction}.
+ *
+ * @param name the name of action
+ */
public TreeCancelEditingAction(String name) {
}
@@ -3110,6 +3491,13 @@
private Component focusComponent;
private boolean dispatchedEvent;
+ /**
+ * Constructs a new instance of {@code MouseInputHandler}.
+ *
+ * @param source a source component
+ * @param destination a destination component
+ * @param event a mouse event
+ */
public MouseInputHandler(Component source, Component destination,
MouseEvent event){
this(source, destination, event, null);
@@ -3173,6 +3561,9 @@
removeFromSource();
}
+ /**
+ * Removes an event from the source.
+ */
protected void removeFromSource() {
if(source != null) {
source.removeMouseListener(this);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicViewportUI.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 @@
// 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 @@
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 @@
LookAndFeel.installProperty(c, "opaque", Boolean.TRUE);
}
+ /**
+ * Uninstall view port properties.
+ *
+ * @param c a component
+ */
protected void uninstallDefaults(JComponent c) {
}
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/ComboPopup.java Tue Jul 29 09:09:55 2014 -0700
@@ -69,6 +69,8 @@
* 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<Object> getList();
@@ -91,6 +93,8 @@
/**
* 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();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java Tue Jul 29 09:09:55 2014 -0700
@@ -41,6 +41,17 @@
*/
@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);
}
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Tue Jul 29 09:09:55 2014 -0700
@@ -633,7 +633,7 @@
LazyValue toolBarBorder = t -> new MetalBorders.ToolBarBorder();
LazyValue progressBarBorder = t ->
- new BorderUIResource.LineBorderUIResource(controlDarkShadow, new Integer(1));
+ new BorderUIResource.LineBorderUIResource(controlDarkShadow, 1);
LazyValue toolTipBorder = t ->
new BorderUIResource.LineBorderUIResource(primaryControlDarkShadow);
@@ -851,8 +851,8 @@
"Slider.foreground", primaryControlShadow,
"Slider.focus", focusColor,
"Slider.focusInsets", zeroInsets,
- "Slider.trackWidth", new Integer( 7 ),
- "Slider.majorTickLength", new Integer( 6 ),
+ "Slider.trackWidth", 7 ,
+ "Slider.majorTickLength", 6 ,
"Slider.horizontalThumbIcon",(LazyValue) t -> MetalIconFactory.getHorizontalSliderThumbIcon(),
"Slider.verticalThumbIcon",(LazyValue) t -> MetalIconFactory.getVerticalSliderThumbIcon(),
"Slider.focusInputMap",
@@ -914,7 +914,7 @@
new MetalBorders.OptionDialogBorder(),
"InternalFrame.paletteBorder",(LazyValue) t ->
new MetalBorders.PaletteBorder(),
- "InternalFrame.paletteTitleHeight", new Integer(11),
+ "InternalFrame.paletteTitleHeight", 11,
"InternalFrame.paletteCloseIcon",(LazyValue) t ->
new MetalIconFactory.PaletteCloseIcon(),
"InternalFrame.closeIcon",
@@ -1067,7 +1067,7 @@
"ScrollBar.thumb", primaryControlShadow,
"ScrollBar.thumbShadow", primaryControlDarkShadow,
"ScrollBar.thumbHighlight", primaryControl,
- "ScrollBar.width", new Integer( 17 ),
+ "ScrollBar.width", 17 ,
"ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
"ScrollBar.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
@@ -1238,8 +1238,8 @@
"Menu.borderPainted", Boolean.TRUE,
"Menu.menuPopupOffsetX", zero,
"Menu.menuPopupOffsetY", zero,
- "Menu.submenuPopupOffsetX", new Integer(-4),
- "Menu.submenuPopupOffsetY", new Integer(-3),
+ "Menu.submenuPopupOffsetX", -4,
+ "Menu.submenuPopupOffsetY", -3,
"Menu.font", menuTextValue,
"Menu.selectionForeground", menuSelectedForeground,
"Menu.selectionBackground", menuSelectedBackground,
@@ -1354,7 +1354,7 @@
// SplitPane
- "SplitPane.dividerSize", new Integer(10),
+ "SplitPane.dividerSize", 10,
"SplitPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"UP", "negativeIncrement",
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template Tue Jul 29 09:09:55 2014 -0700
@@ -398,7 +398,7 @@
@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 @@
}
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 @@
//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 @@
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 @@
private static final class PainterBorder implements Border, UIResource {
private Insets insets;
- private Painter painter;
+ private Painter<Component> painter;
private String painterKey;
PainterBorder(String painterKey, Insets insets) {
@@ -827,7 +827,9 @@
@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<Component> temp = (Painter<Component>)UIManager.get(painterKey);
+ painter = temp;
if (painter == null) return;
}
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template Tue Jul 29 09:09:55 2014 -0700
@@ -28,7 +28,7 @@
import javax.swing.*;
-class ${STATE_NAME} extends State {
+class ${STATE_NAME} extends State<JComponent> {
${STATE_NAME}() {
super("${STATE_KEY}");
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java Tue Jul 29 09:09:55 2014 -0700
@@ -764,7 +764,7 @@
break;
case 4: // integer
try {
- value = new Integer(Integer.parseInt(aValue));
+ value = Integer.valueOf(aValue);
} catch (NumberFormatException nfe) {
throw new SAXException(property + " invalid value");
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java Tue Jul 29 09:09:55 2014 -0700
@@ -33,6 +33,7 @@
import java.util.HashMap;
import java.util.Map;
import javax.swing.text.JTextComponent;
+import sun.swing.SwingUtilities2;
/**
* <code>SynthStyle</code> is a set of style properties.
@@ -303,7 +304,8 @@
}));
DEFAULT_VALUES.put("InternalFrame.icon",
- LookAndFeel.makeIcon(BasicLookAndFeel.class,
+ SwingUtilities2.makeIcon(BasicLookAndFeel.class,
+ BasicLookAndFeel.class,
"icons/JavaCup16.png"));
DEFAULT_VALUES.put("InternalFrame.windowBindings",
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java Tue Jul 29 09:09:55 2014 -0700
@@ -2556,7 +2556,7 @@
if (caretPos != dot) {
// the caret moved
firePropertyChange(ACCESSIBLE_CARET_PROPERTY,
- new Integer(caretPos), new Integer(dot));
+ caretPos, dot);
caretPos = dot;
try {
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java Tue Jul 29 09:09:55 2014 -0700
@@ -1934,13 +1934,13 @@
return Boolean.FALSE;
} else if (key == StyleConstants.Alignment) {
if (svalue.equals("right")) {
- return new Integer(StyleConstants.ALIGN_RIGHT);
+ return StyleConstants.ALIGN_RIGHT;
} else if (svalue.equals("center")) {
- return new Integer(StyleConstants.ALIGN_CENTER);
+ return StyleConstants.ALIGN_CENTER;
} else if (svalue.equals("justify")) {
- return new Integer(StyleConstants.ALIGN_JUSTIFIED);
+ return StyleConstants.ALIGN_JUSTIFIED;
}
- return new Integer(StyleConstants.ALIGN_LEFT);
+ return StyleConstants.ALIGN_LEFT;
} else if (key == StyleConstants.StrikeThrough) {
if (svalue.indexOf("line-through") >= 0) {
return Boolean.TRUE;
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Tue Jul 29 09:09:55 2014 -0700
@@ -623,7 +623,7 @@
* @param n the number of tokens to buffer
*/
public void setTokenThreshold(int n) {
- putProperty(TokenThreshold, new Integer(n));
+ putProperty(TokenThreshold, n);
}
/**
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java Tue Jul 29 09:09:55 2014 -0700
@@ -165,14 +165,14 @@
foregroundColor = StyleConstants.getForeground(a);
if (foregroundColor != null &&
colorTable.get(foregroundColor) == null) {
- colorTable.put(foregroundColor, new Integer(colorCount));
+ colorTable.put(foregroundColor, colorCount);
colorCount ++;
}
backgroundColor = a.getAttribute(StyleConstants.Background);
if (backgroundColor != null &&
colorTable.get(backgroundColor) == null) {
- colorTable.put(backgroundColor, new Integer(colorCount));
+ colorTable.put(backgroundColor, colorCount);
colorCount ++;
}
@@ -183,7 +183,7 @@
if (fontName != null &&
fontTable.get(fontName) == null) {
- fontTable.put(fontName, new Integer(fontCount));
+ fontTable.put(fontName, fontCount);
fontCount ++;
}
}
@@ -200,7 +200,7 @@
Integer aNum = styleTable.get(a);
if (aNum == null) {
styleCount = styleCount + 1;
- aNum = new Integer(styleCount);
+ aNum = styleCount;
styleTable.put(a, aNum);
}
}
--- a/jdk/src/share/classes/sun/applet/AppletClassLoader.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletClassLoader.java Tue Jul 29 09:09:55 2014 -0700
@@ -137,7 +137,7 @@
* 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 @@
* 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 @@
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<byte[]>() {
+ public byte[] run() throws IOException {
try {
URL finalURL = new URL(base, path);
@@ -556,9 +556,10 @@
* 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<URL> findResources(String name) throws IOException {
- final Enumeration e = super.findResources(name);
+ final Enumeration<URL> e = super.findResources(name);
// 6215746: Disable META-INF/* lookup from codebase in
// applet/plugin classloader. [stanley.ho]
@@ -576,9 +577,9 @@
}
final URL url = u;
- return new Enumeration() {
+ return new Enumeration<URL>() {
private boolean done;
- public Object nextElement() {
+ public URL nextElement() {
if (!done) {
if (e.hasMoreElements()) {
return e.nextElement();
@@ -601,7 +602,7 @@
* 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 ThreadGroup getThreadGroup() {
synchronized (threadGroupSynchronizer) {
if (threadGroup == null || threadGroup.isDestroyed()) {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
threadGroup = new AppletThreadGroup(base + "-threadGroup");
// threadGroup.setDaemon(true);
@@ -770,8 +771,8 @@
// Hash map to store applet compatibility info
- private HashMap jdk11AppletInfo = new HashMap();
- private HashMap jdk12AppletInfo = new HashMap();
+ private HashMap<String, Boolean> jdk11AppletInfo = new HashMap<>();
+ private HashMap<String, Boolean> jdk12AppletInfo = new HashMap<>();
/**
* Set applet target level as JDK 1.1.
@@ -780,7 +781,7 @@
* @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 @@
* @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 @@
* 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 @@
* 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 =
--- a/jdk/src/share/classes/sun/applet/AppletImageRef.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletImageRef.java Tue Jul 29 09:09:55 2014 -0700
@@ -65,7 +65,7 @@
* invoke reconstitute().
*/
public synchronized void flush() {
- SoftReference s = soft;
+ SoftReference<Image> s = soft;
if (s != null) s.clear();
soft = null;
}
@@ -74,9 +74,9 @@
* 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);
}
/**
--- a/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletObjectInputStream.java Tue Jul 29 09:09:55 2014 -0700
@@ -59,7 +59,7 @@
* 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 @@
/**
* 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') {
--- a/jdk/src/share/classes/sun/applet/AppletPanel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletPanel.java Tue Jul 29 09:09:55 2014 -0700
@@ -179,7 +179,7 @@
handler = new Thread(appletGroup, this, "thread " + nm);
// set the context class loader for this thread
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
handler.setContextClassLoader(loader);
@@ -253,7 +253,7 @@
/**
* AppletEvent Queue
*/
- private Queue queue = null;
+ private Queue<Integer> queue = null;
synchronized public void addAppletListener(AppletListener l) {
@@ -282,7 +282,7 @@
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 @@
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 @@
* calls KeyboardFocusManager directly.
*/
private Component getMostRecentFocusOwnerForWindow(Window w) {
- Method meth = (Method)AccessController.doPrivileged(new PrivilegedAction() {
+ Method meth = AccessController.doPrivileged(
+ new PrivilegedAction<Method>() {
@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 @@
/**
* The class loaders
*/
- private static HashMap classloaders = new HashMap();
+ private static HashMap<String, AppletClassLoader> classloaders = new HashMap<>();
/**
* Flush a class loader.
@@ -1001,7 +1002,7 @@
* Flush all class loaders.
*/
public static synchronized void flushClassLoaders() {
- classloaders = new HashMap();
+ classloaders = new HashMap<>();
}
/**
@@ -1018,14 +1019,14 @@
* 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<AppletClassLoader>() {
@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 @@
* (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 @@
*/
private AccessControlContext getAccessControlContext(final URL codebase) {
- PermissionCollection perms = (PermissionCollection)
- AccessController.doPrivileged(new PrivilegedAction() {
+ PermissionCollection perms = AccessController.doPrivileged(
+ new PrivilegedAction<PermissionCollection>() {
@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 @@
// critical section of the window list in AppContext.
synchronized (Window.class)
{
- WeakReference weakRef = null;
+ WeakReference<Window> weakRef = null;
// Remove frame from the Window list in wrong AppContext
{
// Lookup current frame's AppContext
- Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>)oldAppContext.get(Window.class);
+ @SuppressWarnings("unchecked")
+ Vector<WeakReference<Window>> windowList =
+ (Vector<WeakReference<Window>>)oldAppContext.get(Window.class);
if (windowList != null) {
- for (WeakReference ref : windowList) {
+ for (WeakReference<Window> ref : windowList) {
if (ref.get() == frame) {
weakRef = ref;
break;
@@ -1195,7 +1197,9 @@
// Insert frame into the Window list in the applet's AppContext map
{
- Vector<WeakReference<Window>> windowList = (Vector)newAppContext.get(Window.class);
+ @SuppressWarnings("unchecked")
+ Vector<WeakReference<Window>> windowList =
+ (Vector<WeakReference<Window>>)newAppContext.get(Window.class);
if (windowList == null) {
windowList = new Vector<WeakReference<Window>>();
newAppContext.put(Window.class, windowList);
@@ -1224,7 +1228,7 @@
// 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
--- a/jdk/src/share/classes/sun/applet/AppletProps.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletProps.java Tue Jul 29 09:09:55 2014 -0700
@@ -105,9 +105,9 @@
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<Properties>() {
+ public Properties run() {
return System.getProperties();
}
});
@@ -148,7 +148,7 @@
// Save properties
try {
reset();
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws IOException {
File dotAV = Main.theUserPropertiesFile;
FileOutputStream out = new FileOutputStream(dotAV);
--- a/jdk/src/share/classes/sun/applet/AppletSecurity.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletSecurity.java Tue Jul 29 09:09:55 2014 -0700
@@ -80,7 +80,7 @@
}
// Cache to store known restricted packages
- private HashSet restrictedPackages = new HashSet();
+ private HashSet<String> restrictedPackages = new HashSet<>();
/**
* Reset from Properties
@@ -90,11 +90,11 @@
// Clear cache
restrictedPackages.clear();
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run()
{
// Enumerate system properties
- Enumeration e = System.getProperties().propertyNames();
+ Enumeration<?> e = System.getProperties().propertyNames();
while (e.hasMoreElements())
{
@@ -130,7 +130,7 @@
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 @@
final ClassLoader currentLoader = context[i].getClassLoader();
if (currentLoader instanceof URLClassLoader) {
- loader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ loader = AccessController.doPrivileged(
+ new PrivilegedAction<ClassLoader>() {
+ 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;
- }
- } catch (Exception e) {
- throw new UnsupportedOperationException(e);
- }
+ for (int i=0; i<pds.length; i++) {
+ ClassLoader cl = pds[i].getClassLoader();
- for (int i=0; i<pds.length; i++) {
- ClassLoader cl = pds[i].getClassLoader();
-
- if (cl instanceof AppletClassLoader) {
- return cl;
+ if (cl instanceof AppletClassLoader) {
+ return cl;
+ }
}
+
+ return null;
}
-
- return null;
- }
- });
+ });
if (loader != null) {
return (AppletClassLoader) loader;
@@ -282,9 +283,9 @@
super.checkPackageAccess(pkgname);
// now check the list of restricted packages
- for (Iterator iter = restrictedPackages.iterator(); iter.hasNext();)
+ for (Iterator<String> 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
--- a/jdk/src/share/classes/sun/applet/AppletViewer.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletViewer.java Tue Jul 29 09:09:55 2014 -0700
@@ -94,7 +94,7 @@
@Override
public AppletViewer createAppletViewer(int x, int y,
- URL doc, Hashtable atts) {
+ URL doc, Hashtable<String, String> atts) {
return new AppletViewer(x, y, doc, atts, System.out, this);
}
@@ -156,7 +156,7 @@
/**
* Create the applet viewer.
*/
- public AppletViewer(int x, int y, URL doc, Hashtable atts,
+ public AppletViewer(int x, int y, URL doc, Hashtable<String, String> atts,
PrintStream statusMsgStream, AppletViewerFactory factory) {
this.factory = factory;
this.statusMsgStream = statusMsgStream;
@@ -350,7 +350,7 @@
* s. Whitespace not stripped.
*/
private String [] splitSeparator(String sep, String s) {
- Vector v = new Vector();
+ Vector<String> v = new Vector<>();
int tokenStart = 0;
int tokenEnd = 0;
@@ -370,7 +370,7 @@
* Methods for java.applet.AppletContext
*/
- private static Map audioClips = new HashMap();
+ private static Map<URL, AudioClip> audioClips = new HashMap<>();
/**
* Get an audio clip.
@@ -379,7 +379,7 @@
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 @@
}
}
- private static Map imageRefs = new HashMap();
+ private static Map<URL, AppletImageRef> imageRefs = new HashMap<>();
/**
* Get an image.
@@ -403,7 +403,7 @@
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 @@
imageRefs.clear();
}
- static Vector appletPanels = new Vector();
+ static Vector<AppletPanel> appletPanels = new Vector<>();
/**
* Get an applet by name.
@@ -430,8 +430,8 @@
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<AppletPanel> e = appletPanels.elements() ; e.hasMoreElements() ;) {
+ AppletPanel p = e.nextElement();
String param = p.getParameter("name");
if (param != null) {
param = param.toLowerCase();
@@ -455,14 +455,14 @@
* applets on this page.
*/
@Override
- public Enumeration getApplets() {
+ public Enumeration<Applet> getApplets() {
AppletSecurity security = (AppletSecurity)System.getSecurityManager();
- Vector v = new Vector();
+ Vector<Applet> 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<AppletPanel> e = appletPanels.elements() ; e.hasMoreElements() ;) {
+ AppletPanel p = e.nextElement();
if (p.getDocumentBase().equals(panel.getDocumentBase())) {
SocketPermission sp =
@@ -509,7 +509,7 @@
}
@Override
- public Iterator getStreamKeys(){
+ public Iterator<String> getStreamKeys(){
// We do nothing.
return null;
}
@@ -517,7 +517,7 @@
/**
* System parameters.
*/
- static Hashtable systemParam = new Hashtable();
+ static Hashtable<String, String> systemParam = new Hashtable<>();
static {
systemParam.put("codebase", "codebase");
@@ -533,32 +533,32 @@
/**
* Print the HTML tag.
*/
- public static void printTag(PrintStream out, Hashtable atts) {
+ public static void printTag(PrintStream out, Hashtable<String, String> atts) {
out.print("<applet");
- String v = (String)atts.get("codebase");
+ String v = atts.get("codebase");
if (v != null) {
out.print(" codebase=\"" + v + "\"");
}
- v = (String)atts.get("code");
+ v = atts.get("code");
if (v == null) {
v = "applet.class";
}
out.print(" code=\"" + v + "\"");
- v = (String)atts.get("width");
+ v = atts.get("width");
if (v == null) {
v = "150";
}
out.print(" width=" + v);
- v = (String)atts.get("height");
+ v = atts.get("height");
if (v == null) {
v = "100";
}
out.print(" height=" + v);
- v = (String)atts.get("name");
+ v = atts.get("name");
if (v != null) {
out.print(" name=\"" + v + "\"");
}
@@ -568,8 +568,8 @@
int len = atts.size();
String params[] = new String[len];
len = 0;
- for (Enumeration e = atts.keys() ; e.hasMoreElements() ;) {
- String param = (String)e.nextElement();
+ for (Enumeration<String> 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 @@
* Save the applet to a well known file (for now) as a serialized object
*/
void appletSave() {
- AccessController.doPrivileged(new PrivilegedAction() {
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
@@ -702,8 +702,10 @@
void appletClone() {
Point p = location();
updateAtts();
+ @SuppressWarnings("unchecked")
+ Hashtable<String, String> tmp = (Hashtable<String, String>) panel.atts.clone();
factory.createAppletViewer(p.x + XDELTA, p.y + YDELTA,
- panel.documentURL, (Hashtable)panel.atts.clone());
+ panel.documentURL, tmp);
}
/**
@@ -884,8 +886,8 @@
@Override
public void run()
{
- for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
- AppletPanel p = (AppletPanel)e.nextElement();
+ for (Enumeration<AppletPanel> e = appletPanels.elements() ; e.hasMoreElements() ;) {
+ AppletPanel p = e.nextElement();
appletShutdown(p);
}
appletSystemExit();
@@ -1016,8 +1018,8 @@
/**
* Scan tag
*/
- public static Hashtable scanTag(Reader in) throws IOException {
- Hashtable atts = new Hashtable();
+ public static Hashtable<String, String> scanTag(Reader in) throws IOException {
+ Hashtable<String, String> atts = new Hashtable<>();
skipSpace(in);
while (c >= 0 && c != '>') {
String att = scanIdentifier(in);
@@ -1122,7 +1124,7 @@
url = conn.getURL();
int ydisp = 1;
- Hashtable atts = null;
+ Hashtable<String, String> atts = null;
while(true) {
c = in.read();
@@ -1172,12 +1174,12 @@
else {
String nm = scanIdentifier(in);
if (nm.equalsIgnoreCase("param")) {
- Hashtable t = scanTag(in);
- String att = (String)t.get("name");
+ Hashtable<String, String> 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 @@
}
else if (nm.equalsIgnoreCase("app")) {
statusMsgStream.println(appNotLongerSupportedWarning);
- Hashtable atts2 = scanTag(in);
- nm = (String)atts2.get("class");
+ Hashtable<String, String> 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);
--- a/jdk/src/share/classes/sun/applet/AppletViewerFactory.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletViewerFactory.java Tue Jul 29 09:09:55 2014 -0700
@@ -35,7 +35,8 @@
public
interface AppletViewerFactory {
- public AppletViewer createAppletViewer(int x, int y, URL doc, Hashtable atts);
+ public AppletViewer createAppletViewer(int x, int y, URL doc,
+ Hashtable<String, String> atts);
public MenuBar getBaseMenuBar();
public boolean isStandalone();
}
--- a/jdk/src/share/classes/sun/applet/AppletViewerPanel.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/AppletViewerPanel.java Tue Jul 29 09:09:55 2014 -0700
@@ -59,7 +59,7 @@
/**
* The attributes of the applet.
*/
- Hashtable atts;
+ Hashtable<String, String> atts;
/*
* JDK 1.1 serialVersionUID
@@ -69,7 +69,7 @@
/**
* Construct an applet viewer and start the applet.
*/
- AppletViewerPanel(URL documentURL, Hashtable atts) {
+ AppletViewerPanel(URL documentURL, Hashtable<String, String> atts) {
this.documentURL = documentURL;
this.atts = atts;
@@ -105,7 +105,7 @@
* Get an applet parameter.
*/
public String getParameter(String name) {
- return (String)atts.get(name.toLowerCase());
+ return atts.get(name.toLowerCase());
}
/**
--- a/jdk/src/share/classes/sun/applet/Main.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/applet/Main.java Tue Jul 29 09:09:55 2014 -0700
@@ -84,7 +84,7 @@
/**
* The list of valid URLs passed in to AppletViewer.
*/
- private static Vector urlList = new Vector(1);
+ private static Vector<URL> 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 @@
// 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 @@
// 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 @@
// 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;
--- a/jdk/src/share/classes/sun/audio/AudioData.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, 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 sun.audio;
-
-import java.io.*;
-import java.util.Arrays;
-
-import javax.sound.sampled.*;
-
-
-/**
- * A clip of audio data. This data can be used to construct an
- * AudioDataStream, which can be played. <p>
- *
- * @author Arthur van Hoff
- * @author Kara Kytle
- * @see AudioDataStream
- * @see AudioPlayer
- */
-
- /*
- * the idea here is that the AudioData object encapsulates the
- * data you need to play an audio clip based on a defined set
- * of data. to do this, you require the audio data (a byte
- * array rather than an arbitrary input stream) and a format
- * object.
- */
-
-
-public final class AudioData {
-
- private static final AudioFormat DEFAULT_FORMAT =
- new AudioFormat(AudioFormat.Encoding.ULAW,
- 8000, // sample rate
- 8, // sample size in bits
- 1, // channels
- 1, // frame size in bytes
- 8000, // frame rate
- true ); // bigendian (irrelevant for 8-bit data)
-
- AudioFormat format; // carry forth the format array amusement
- byte buffer[];
-
- /**
- * Constructor
- */
- public AudioData(final byte[] buffer) {
- // if we cannot extract valid format information, we resort to assuming
- // the data will be 8k mono u-law in order to provide maximal backwards
- // compatibility....
- this(DEFAULT_FORMAT, buffer);
-
- // okay, we need to extract the format and the byte buffer of data
- try {
- AudioInputStream ais = AudioSystem.getAudioInputStream(new ByteArrayInputStream(buffer));
- this.format = ais.getFormat();
- ais.close();
- // $$fb 2002-10-27: buffer contains the file header now!
- } catch (IOException e) {
- // use default format
- } catch (UnsupportedAudioFileException e1 ) {
- // use default format
- }
- }
-
-
- /**
- * Non-public constructor; this is the one we use in ADS and CADS
- * constructors.
- */
- AudioData(final AudioFormat format, final byte[] buffer) {
- this.format = format;
- if (buffer != null) {
- this.buffer = Arrays.copyOf(buffer, buffer.length);
- }
- }
-}
--- a/jdk/src/share/classes/sun/audio/AudioDataStream.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, 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 sun.audio;
-
-import java.io.*;
-
-/**
- * An input stream to play AudioData.
- *
- * @see AudioPlayer
- * @see AudioData
- * @author Arthur van Hoff
- * @author Kara Kytle
- */
-public class AudioDataStream extends ByteArrayInputStream {
-
- private final AudioData ad;
-
- /**
- * Constructor
- */
- public AudioDataStream(final AudioData data) {
-
- super(data.buffer);
- this.ad = data;
- }
-
- final AudioData getAudioData() {
- return ad;
- }
-}
--- a/jdk/src/share/classes/sun/audio/AudioDevice.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,419 +0,0 @@
-/*
- * 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. 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 sun.audio;
-
-import java.util.Hashtable;
-import java.util.Vector;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.BufferedInputStream;
-
-import javax.sound.sampled.*;
-import javax.sound.midi.*;
-import com.sun.media.sound.DataPusher;
-import com.sun.media.sound.Toolkit;
-
-/**
- * This class provides an interface to the Headspace Audio engine through
- * the Java Sound API.
- *
- * This class emulates systems with multiple audio channels, mixing
- * multiple streams for the workstation's single-channel device.
- *
- * @see AudioData
- * @see AudioDataStream
- * @see AudioStream
- * @see AudioStreamSequence
- * @see ContinuousAudioDataStream
- * @author David Rivas
- * @author Kara Kytle
- * @author Jan Borgersen
- * @author Florian Bomers
- */
-
-public final class AudioDevice {
-
- private boolean DEBUG = false /*true*/ ;
-
- private Vector<Info> infos;
-
- /** Are we currently playing audio? */
- private boolean playing = false;
-
- /** Handle to the JS audio mixer. */
- private Mixer mixer = null;
-
-
-
- /**
- * The default audio player. This audio player is initialized
- * automatically.
- */
- public static final AudioDevice device = new AudioDevice();
-
- /**
- * Create an AudioDevice instance.
- */
- private AudioDevice() {
- infos = new Vector<>();
- }
-
-
- private synchronized void startSampled( AudioInputStream as,
- InputStream in ) throws UnsupportedAudioFileException,
- LineUnavailableException {
-
- Info info = null;
- DataPusher datapusher = null;
- DataLine.Info lineinfo = null;
- SourceDataLine sourcedataline = null;
-
- // if ALAW or ULAW, we must convert....
- as = Toolkit.getPCMConvertedAudioInputStream(as);
-
- if( as==null ) {
- // could not convert
- return;
- }
-
- lineinfo = new DataLine.Info(SourceDataLine.class,
- as.getFormat());
- if( !(AudioSystem.isLineSupported(lineinfo))) {
- return;
- }
- sourcedataline = (SourceDataLine)AudioSystem.getLine(lineinfo);
- datapusher = new DataPusher(sourcedataline, as);
-
- info = new Info( null, in, datapusher );
- infos.addElement( info );
-
- datapusher.start();
- }
-
- private synchronized void startMidi( InputStream bis,
- InputStream in ) throws InvalidMidiDataException,
- MidiUnavailableException {
-
- Sequencer sequencer = null;
- Info info = null;
-
- sequencer = MidiSystem.getSequencer( );
- sequencer.open();
- try {
- sequencer.setSequence( bis );
- } catch( IOException e ) {
- throw new InvalidMidiDataException( e.getMessage() );
- }
-
- info = new Info( sequencer, in, null );
-
- infos.addElement( info );
-
- // fix for bug 4302884: Audio device is not released when AudioClip stops
- sequencer.addMetaEventListener(info);
-
- sequencer.start();
-
- }
-
-
-
- /**
- * Open an audio channel.
- */
- public synchronized void openChannel(InputStream in) {
-
-
- if(DEBUG) {
- System.out.println("AudioDevice: openChannel");
- System.out.println("input stream =" + in);
- }
-
- Info info = null;
-
- // is this already playing? if so, then just return
- for(int i=0; i<infos.size(); i++) {
- info = infos.elementAt(i);
- if( info.in == in ) {
-
- return;
- }
- }
-
-
- AudioInputStream as = null;
-
- if( in instanceof AudioStream ) {
-
- if ( ((AudioStream)in).midiformat != null ) {
-
- // it's a midi file
- try {
- startMidi( ((AudioStream)in).stream, in );
- } catch (Exception e) {
- return;
- }
-
-
- } else if( ((AudioStream)in).ais != null ) {
-
- // it's sampled audio
- try {
- startSampled( ((AudioStream)in).ais, in );
- } catch (Exception e) {
- return;
- }
-
- }
- } else if (in instanceof AudioDataStream ) {
- if (in instanceof ContinuousAudioDataStream) {
- try {
- AudioInputStream ais = new AudioInputStream(in,
- ((AudioDataStream)in).getAudioData().format,
- AudioSystem.NOT_SPECIFIED);
- startSampled(ais, in );
- } catch (Exception e) {
- return;
- }
- }
- else {
- try {
- AudioInputStream ais = new AudioInputStream(in,
- ((AudioDataStream)in).getAudioData().format,
- ((AudioDataStream)in).getAudioData().buffer.length);
- startSampled(ais, in );
- } catch (Exception e) {
- return;
- }
- }
- } else {
- BufferedInputStream bis = new BufferedInputStream( in, 1024 );
-
- try {
-
- try {
- as = AudioSystem.getAudioInputStream(bis);
- } catch(IOException ioe) {
- return;
- }
-
- startSampled( as, in );
-
- } catch( UnsupportedAudioFileException e ) {
-
- try {
- try {
- MidiFileFormat mff =
- MidiSystem.getMidiFileFormat( bis );
- } catch(IOException ioe1) {
- return;
- }
-
- startMidi( bis, in );
-
-
- } catch( InvalidMidiDataException e1 ) {
-
- // $$jb:08.01.99: adding this section to make some of our other
- // legacy classes work.....
- // not MIDI either, special case handling for all others
-
- AudioFormat defformat = new AudioFormat( AudioFormat.Encoding.ULAW,
- 8000, 8, 1, 1, 8000, true );
- try {
- AudioInputStream defaif = new AudioInputStream( bis,
- defformat, AudioSystem.NOT_SPECIFIED);
- startSampled( defaif, in );
- } catch (UnsupportedAudioFileException es) {
- return;
- } catch (LineUnavailableException es2) {
- return;
- }
-
- } catch( MidiUnavailableException e2 ) {
-
- // could not open sequence
- return;
- }
-
- } catch( LineUnavailableException e ) {
-
- return;
- }
- }
-
- // don't forget adjust for a new stream.
- notify();
- }
-
-
- /**
- * Close an audio channel.
- */
- public synchronized void closeChannel(InputStream in) {
-
- if(DEBUG) {
- System.out.println("AudioDevice.closeChannel");
- }
-
- if (in == null) return; // can't go anywhere here!
-
- Info info;
-
- for(int i=0; i<infos.size(); i++) {
-
- info = infos.elementAt(i);
-
- if( info.in == in ) {
-
- if( info.sequencer != null ) {
-
- info.sequencer.stop();
- //info.sequencer.close();
- infos.removeElement( info );
-
- } else if( info.datapusher != null ) {
-
- info.datapusher.stop();
- infos.removeElement( info );
- }
- }
- }
- notify();
- }
-
-
- /**
- * Open the device (done automatically)
- */
- public synchronized void open() {
-
- // $$jb: 06.24.99: This is done on a per-stream
- // basis using the new JS API now.
- }
-
-
- /**
- * Close the device (done automatically)
- */
- public synchronized void close() {
-
- // $$jb: 06.24.99: This is done on a per-stream
- // basis using the new JS API now.
-
- }
-
-
- /**
- * Play open audio stream(s)
- */
- public void play() {
-
- // $$jb: 06.24.99: Holdover from old architechture ...
- // we now open/close the devices as needed on a per-stream
- // basis using the JavaSound API.
-
- if (DEBUG) {
- System.out.println("exiting play()");
- }
- }
-
- /**
- * Close streams
- */
- public synchronized void closeStreams() {
-
- Info info;
-
- for(int i=0; i<infos.size(); i++) {
-
- info = infos.elementAt(i);
-
- if( info.sequencer != null ) {
-
- info.sequencer.stop();
- info.sequencer.close();
- infos.removeElement( info );
-
- } else if( info.datapusher != null ) {
-
- info.datapusher.stop();
- infos.removeElement( info );
- }
- }
-
-
- if (DEBUG) {
- System.err.println("Audio Device: Streams all closed.");
- }
- // Empty the hash table.
- infos = new Vector<>();
- }
-
- /**
- * Number of channels currently open.
- */
- public int openChannels() {
- return infos.size();
- }
-
- /**
- * Make the debug info print out.
- */
- void setVerbose(boolean v) {
- DEBUG = v;
- }
-
-
-
-
-
-
- // INFO CLASS
-
- final class Info implements MetaEventListener {
-
- final Sequencer sequencer;
- final InputStream in;
- final DataPusher datapusher;
-
- Info( Sequencer sequencer, InputStream in, DataPusher datapusher ) {
-
- this.sequencer = sequencer;
- this.in = in;
- this.datapusher = datapusher;
- }
-
- public void meta(MetaMessage event) {
- if (event.getType() == 47 && sequencer != null) {
- sequencer.close();
- }
- }
- }
-
-
-
-}
--- a/jdk/src/share/classes/sun/audio/AudioPlayer.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
- * 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. 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 sun.audio;
-
-import java.io.InputStream;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-
-/**
- * This class provides an interface to play audio streams.
- *
- * To play an audio stream use:
- * <pre>
- * AudioPlayer.player.start(audiostream);
- * </pre>
- * To stop playing an audio stream use:
- * <pre>
- * AudioPlayer.player.stop(audiostream);
- * </pre>
- * To play an audio stream from a URL use:
- * <pre>
- * AudioStream audiostream = new AudioStream(url.openStream());
- * AudioPlayer.player.start(audiostream);
- * </pre>
- * To play a continuous sound you first have to
- * create an AudioData instance and use it to construct a
- * ContinuousAudioDataStream.
- * For example:
- * <pre>
- * AudioData data = new AudioStream(url.openStream()).getData();
- * ContinuousAudioDataStream audiostream = new ContinuousAudioDataStream(data);
- * AudioPlayer.player.start(audiostream);
- * </pre>
- *
- * @see AudioData
- * @see AudioDataStream
- * @see AudioDevice
- * @see AudioStream
- * @author Arthur van Hoff, Thomas Ball
- */
-
-public final class AudioPlayer extends Thread {
-
- private final AudioDevice devAudio;
- private final static boolean DEBUG = false /*true*/;
-
- /**
- * The default audio player. This audio player is initialized
- * automatically.
- */
- public static final AudioPlayer player = getAudioPlayer();
-
- private static ThreadGroup getAudioThreadGroup() {
-
- if(DEBUG) { System.out.println("AudioPlayer.getAudioThreadGroup()"); }
- ThreadGroup g = currentThread().getThreadGroup();
- while ((g.getParent() != null) &&
- (g.getParent().getParent() != null)) {
- g = g.getParent();
- }
- return g;
- }
-
- /**
- * Create an AudioPlayer thread in a privileged block.
- */
-
- private static AudioPlayer getAudioPlayer() {
-
- if(DEBUG) { System.out.println("> AudioPlayer.getAudioPlayer()"); }
- PrivilegedAction<AudioPlayer> action = new PrivilegedAction<AudioPlayer>() {
- public AudioPlayer run() {
- AudioPlayer t = new AudioPlayer();
- t.setPriority(MAX_PRIORITY);
- t.setDaemon(true);
- t.start();
- return t;
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Construct an AudioPlayer.
- */
- private AudioPlayer() {
-
- super(getAudioThreadGroup(), "Audio Player");
- if(DEBUG) { System.out.println("> AudioPlayer private constructor"); }
- devAudio = AudioDevice.device;
- devAudio.open();
- if(DEBUG) { System.out.println("< AudioPlayer private constructor completed"); }
- }
-
-
- /**
- * Start playing a stream. The stream will continue to play
- * until the stream runs out of data, or it is stopped.
- * @see AudioPlayer#stop
- */
- public synchronized void start(InputStream in) {
-
- if(DEBUG) {
- System.out.println("> AudioPlayer.start");
- System.out.println(" InputStream = " + in);
- }
- devAudio.openChannel(in);
- notify();
- if(DEBUG) {
- System.out.println("< AudioPlayer.start completed");
- }
- }
-
- /**
- * Stop playing a stream. The stream will stop playing,
- * nothing happens if the stream wasn't playing in the
- * first place.
- * @see AudioPlayer#start
- */
- public synchronized void stop(InputStream in) {
-
- if(DEBUG) {
- System.out.println("> AudioPlayer.stop");
- }
-
- devAudio.closeChannel(in);
- if(DEBUG) {
- System.out.println("< AudioPlayer.stop completed");
- }
- }
-
- /**
- * Main mixing loop. This is called automatically when the AudioPlayer
- * is created.
- */
- public void run() {
-
- // $$jb: 06.24.99: With the JS API, mixing is no longer done by AudioPlayer
- // or AudioDevice ... it's done by the API itself, so this bit of legacy
- // code does nothing.
- // $$jb: 10.21.99: But it appears that some legacy applications
- // check to see if this thread is alive or not, so we need to spin here.
-
- devAudio.play();
- if(DEBUG) {
- System.out.println("AudioPlayer mixing loop.");
- }
- while(true) {
- try{
- Thread.sleep(5000);
- //wait();
- } catch(Exception e) {
- break;
- // interrupted
- }
- }
- if(DEBUG) {
- System.out.println("AudioPlayer exited.");
- }
-
- }
- }
--- a/jdk/src/share/classes/sun/audio/AudioSecurityAction.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, 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 sun.audio;
-
-public interface AudioSecurityAction {
- Object run();
-}
--- a/jdk/src/share/classes/sun/audio/AudioSecurityExceptionAction.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, 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 sun.audio;
-
-public interface AudioSecurityExceptionAction {
- Object run() throws Exception;
-}
--- a/jdk/src/share/classes/sun/audio/AudioStream.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * 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. 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 sun.audio;
-
-import java.io.InputStream;
-import java.io.FilterInputStream;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-
-import javax.sound.sampled.*;
-import javax.sound.midi.*;
-
-/**
- * Convert an InputStream to an AudioStream.
- *
- */
-
-
-public final class AudioStream extends FilterInputStream {
-
- // AudioContainerInputStream acis;
- AudioInputStream ais = null;
- AudioFormat format = null;
- MidiFileFormat midiformat = null;
- InputStream stream = null;
-
-
- /*
- * create the AudioStream; if we survive without throwing
- * an exception, we should now have some subclass of
- * ACIS with all the header info already read
- */
-
- public AudioStream(InputStream in) throws IOException {
-
- super(in);
-
- stream = in;
-
- if( in.markSupported() == false ) {
-
- stream = new BufferedInputStream( in, 1024 );
- }
-
- try {
- ais = AudioSystem.getAudioInputStream( stream );
- format = ais.getFormat();
- this.in = ais;
-
- } catch (UnsupportedAudioFileException e ) {
-
- // not an audio file, see if it's midi...
- try {
- midiformat = MidiSystem.getMidiFileFormat( stream );
-
- } catch (InvalidMidiDataException e1) {
- throw new IOException("could not create audio stream from input stream");
- }
- }
- }
-
-
-
-
- /**
- * A blocking read.
- */
- /* public int read(byte buf[], int pos, int len) throws IOException {
-
- return(acis.readFully(buf, pos, len));
- }
- */
-
- /**
- * Get the data.
- */
- public AudioData getData() throws IOException {
- int length = getLength();
-
- //limit the memory to 1M, so too large au file won't load
- if (length < 1024*1024) {
- byte [] buffer = new byte[length];
- try {
- ais.read(buffer, 0, length);
- } catch (IOException ex) {
- throw new IOException("Could not create AudioData Object");
- }
- return new AudioData(format, buffer);
- }
-
- /* acis.setData();
-
- if (acis.stream instanceof ByteArrayInputStream) {
- Format[] format = acis.getFormat();
- byte[] bytes = acis.getBytes();
- if (bytes == null)
- throw new IOException("could not create AudioData object: no data received");
- return new AudioData((AudioFormat)format[0], bytes);
- }
- */
-
- throw new IOException("could not create AudioData object");
- }
-
-
- public int getLength() {
-
- if( ais != null && format != null ) {
- return (int) (ais.getFrameLength() *
- ais.getFormat().getFrameSize() );
-
- } else if ( midiformat != null ) {
- return midiformat.getByteLength();
-
- } else {
- return -1;
- }
- }
-}
--- a/jdk/src/share/classes/sun/audio/AudioStreamSequence.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * 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. 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 sun.audio;
-
-import java.io.InputStream;
-import java.io.SequenceInputStream;
-import java.util.Enumeration;
-
-/**
- * Convert a sequence of input streams into a single InputStream.
- * This class can be used to play two audio clips in sequence.<p>
- * For example:
- * <pre>
- * Vector v = new Vector();
- * v.addElement(audiostream1);
- * v.addElement(audiostream2);
- * AudioStreamSequence audiostream = new AudioStreamSequence(v.elements());
- * AudioPlayer.player.start(audiostream);
- * </pre>
- * @see AudioPlayer
- * @author Arthur van Hoff
- */
-public final class AudioStreamSequence extends SequenceInputStream {
- /**
- * Create an AudioStreamSequence given an
- * enumeration of streams.
- */
- public AudioStreamSequence(Enumeration<? extends InputStream> e) {
- super(e);
- }
-}
--- a/jdk/src/share/classes/sun/audio/AudioTranslatorStream.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, 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 sun.audio;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * Translator for native audio formats (not implemented in this release).
- *
- */
-public final class AudioTranslatorStream extends NativeAudioStream {
-
- private final int length = 0;
-
- public AudioTranslatorStream(InputStream in) throws IOException {
- super(in);
- // No translators supported yet.
- throw new InvalidAudioFormatException();
- }
-
- public int getLength() {
- return length;
- }
- }
--- a/jdk/src/share/classes/sun/audio/ContinuousAudioDataStream.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, 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 sun.audio;
-
-/**
- * Create a continuous audio stream. This wraps a stream
- * around an AudioData object, the stream is restarted
- * at the beginning everytime the end is reached, thus
- * creating continuous sound.<p>
- * For example:
- * <pre>
- * AudioData data = AudioData.getAudioData(url);
- * ContinuousAudioDataStream audiostream = new ContinuousAudioDataStream(data);
- * AudioPlayer.player.start(audiostream);
- * </pre>
- *
- * @see AudioPlayer
- * @see AudioData
- * @author Arthur van Hoff
- */
-
-public final class ContinuousAudioDataStream extends AudioDataStream {
-
-
- /**
- * Create a continuous stream of audio.
- */
- public ContinuousAudioDataStream(AudioData data) {
-
- super(data);
- }
-
-
- public int read() {
-
- int i = super.read();
-
- if (i == -1) {
- reset();
- i = super.read();
- }
-
- return i;
- }
-
-
- public int read(byte ab[], int i1, int j) {
-
- int k;
-
- for (k = 0; k < j; ) {
- int i2 = super.read(ab, i1 + k, j - k);
- if (i2 >= 0) k += i2;
- else reset();
- }
-
- return k;
- }
- }
--- a/jdk/src/share/classes/sun/audio/InvalidAudioFormatException.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * 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. 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 sun.audio;
-import java.io.IOException;
-
-/**
- * Signals an invalid audio stream for the stream handler.
- */
-@SuppressWarnings("serial") // JDK-implementation class
-final class InvalidAudioFormatException extends IOException {
-
-
- /**
- * Constructor.
- */
- InvalidAudioFormatException() {
- super();
- }
-
- /**
- * Constructor with a detail message.
- */
- InvalidAudioFormatException(String s) {
- super(s);
- }
-}
--- a/jdk/src/share/classes/sun/audio/NativeAudioStream.java Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, 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 sun.audio;
-
-import java.io.InputStream;
-import java.io.DataInputStream;
-import java.io.FilterInputStream;
-import java.io.IOException;
-
-/**
- * A Sun-specific AudioStream that supports native audio formats.
- *
- */
-
- /*
- * note: this file used to do the real header reading and
- * format verification for .au files (the only kind supported).
- * now we are way more cool than that and don't need this
- * functionality here; i'm just gutting this class and letting
- * it contain an ACIS instead (so now it should work for
- * all the data types we support....).
- */
-
-public
- class NativeAudioStream extends FilterInputStream {
-
-
- public NativeAudioStream(InputStream in) throws IOException {
-
- super(in);
- }
-
- public int getLength() {
- return 0;
- }
- }
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java Tue Jul 29 09:09:55 2014 -0700
@@ -481,11 +481,16 @@
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.
*/
Font getFont_NoClientCode(MenuComponent menuComp);
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java Tue Jul 29 09:09:55 2014 -0700
@@ -1322,7 +1322,7 @@
return SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
fractionalMetricsHint);
case SunHints.INTKEY_AATEXT_LCD_CONTRAST:
- return new Integer(lcdTextContrast);
+ return lcdTextContrast;
case SunHints.INTKEY_INTERPOLATION:
switch (interpolationHint) {
case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
--- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java Tue Jul 29 09:09:55 2014 -0700
@@ -384,7 +384,8 @@
}
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();
--- a/jdk/src/share/classes/sun/print/CustomMediaSizeName.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/print/CustomMediaSizeName.java Tue Jul 29 09:09:55 2014 -0700
@@ -67,6 +67,22 @@
MediaSize.INCH);
} catch (IllegalArgumentException iae) {
}
+ // The public API method finds a closest match even if it not
+ // all that close. Here we want to be sure its *really* close.
+ if (mediaName != null) {
+ MediaSize sz = MediaSize.getMediaSizeForName(mediaName);
+ if (sz == null) {
+ mediaName = null;
+ } else {
+ float w = sz.getX(MediaSize.INCH);
+ float h = sz.getY(MediaSize.INCH);
+ float dw = Math.abs(w - width);
+ float dh = Math.abs(h - length);
+ if (dw > 0.1 || dh > 0.1) {
+ mediaName = null;
+ }
+ }
+ }
}
/**
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java Tue Jul 29 09:09:55 2014 -0700
@@ -168,13 +168,6 @@
private static final String IMAGE_STR = " string /imStr exch def";
private static final String IMAGE_RESTORE = "imSave restore";
- private static final String COORD_PREP = " 0 exch translate "
- + "1 -1 scale"
- + "[72 " + PS_XRES + " div "
- + "0 0 "
- + "72 " + PS_YRES + " div "
- + "0 0]concat";
-
private static final String SetFontName = "F";
private static final String DrawStringName = "S";
@@ -275,6 +268,9 @@
private AffineTransform mLastTransform;
+ private double xres = PS_XRES;
+ private double yres = PS_XRES;
+
/* non-null if printing EPS for Java Plugin */
private EPSPrinter epsPrinter = null;
@@ -796,6 +792,15 @@
}
}
+ private String getCoordPrep() {
+ return " 0 exch translate "
+ + "1 -1 scale"
+ + "[72 " + getXRes() + " div "
+ + "0 0 "
+ + "72 " + getYRes() + " div "
+ + "0 0]concat";
+ }
+
/**
* The RasterPrintJob super class calls this method
* at the start of each page.
@@ -852,7 +857,7 @@
mPSStream.println(" >> setpagedevice");
}
mPSStream.println(PAGE_SAVE);
- mPSStream.println(paperHeight + COORD_PREP);
+ mPSStream.println(paperHeight + getCoordPrep());
}
/**
@@ -1493,14 +1498,22 @@
* to be rendered.
*/
protected double getXRes() {
- return PS_XRES;
+ return xres;
}
/**
* Return the y resolution of the coordinates
* to be rendered.
*/
protected double getYRes() {
- return PS_YRES;
+ return yres;
+ }
+
+ /**
+ * Set the resolution at which to print.
+ */
+ protected void setXYRes(double x, double y) {
+ xres = x;
+ yres = y;
}
/**
--- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java Tue Jul 29 09:09:55 2014 -0700
@@ -72,6 +72,7 @@
import javax.print.attribute.AttributeSet;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.ResolutionSyntax;
import javax.print.attribute.Size2DSyntax;
import javax.print.attribute.standard.Chromaticity;
import javax.print.attribute.standard.Copies;
@@ -86,6 +87,7 @@
import javax.print.attribute.standard.MediaSizeName;
import javax.print.attribute.standard.OrientationRequested;
import javax.print.attribute.standard.PageRanges;
+import javax.print.attribute.standard.PrinterResolution;
import javax.print.attribute.standard.PrinterState;
import javax.print.attribute.standard.PrinterStateReason;
import javax.print.attribute.standard.PrinterStateReasons;
@@ -283,6 +285,7 @@
private String jobNameAttr;
private String userNameAttr;
private PageRanges pageRangesAttr;
+ protected PrinterResolution printerResAttr;
protected Sides sidesAttr;
protected String destinationAttr;
protected boolean noJobSheet = false;
@@ -1064,6 +1067,14 @@
attrset));
}
+ /**
+ * Set the device resolution.
+ * Overridden and used only by the postscript code.
+ * Windows code pulls the information from the attribute set itself.
+ */
+ protected void setXYRes(double x, double y) {
+ }
+
/* subclasses may need to pull extra information out of the attribute set
* They can override this method & call super.setAttributes()
*/
@@ -1072,6 +1083,7 @@
/* reset all values to defaults */
setCollated(false);
sidesAttr = null;
+ printerResAttr = null;
pageRangesAttr = null;
copiesAttr = 0;
jobNameAttr = null;
@@ -1117,6 +1129,18 @@
sidesAttr = Sides.ONE_SIDED;
}
+ printerResAttr = (PrinterResolution)attributes.get(PrinterResolution.class);
+ if (service.isAttributeCategorySupported(PrinterResolution.class)) {
+ if (!isSupportedValue(printerResAttr, attributes)) {
+ printerResAttr = (PrinterResolution)
+ service.getDefaultAttributeValue(PrinterResolution.class);
+ }
+ double xr =
+ printerResAttr.getCrossFeedResolution(ResolutionSyntax.DPI);
+ double yr = printerResAttr.getFeedResolution(ResolutionSyntax.DPI);
+ setXYRes(xr, yr);
+ }
+
pageRangesAttr = (PageRanges)attributes.get(PageRanges.class);
if (!isSupportedValue(pageRangesAttr, attributes)) {
pageRangesAttr = null;
--- a/jdk/src/share/classes/sun/print/ServiceDialog.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/print/ServiceDialog.java Tue Jul 29 09:09:55 2014 -0700
@@ -1017,8 +1017,8 @@
format.setParseIntegerOnly(true);
format.setDecimalSeparatorAlwaysShown(false);
NumberFormatter nf = new NumberFormatter(format);
- nf.setMinimum(new Integer(1));
- nf.setMaximum(new Integer(Integer.MAX_VALUE));
+ nf.setMinimum(1);
+ nf.setMaximum(Integer.MAX_VALUE);
nf.setAllowsInvalid(true);
nf.setCommitsOnValidEdit(true);
tfRangeFrom = new JFormattedTextField(nf);
@@ -1110,12 +1110,12 @@
if (min < 1) {
min = 1;
- tfRangeFrom.setValue(new Integer(1));
+ tfRangeFrom.setValue(1);
}
if (max < min) {
max = min;
- tfRangeTo.setValue(new Integer(min));
+ tfRangeTo.setValue(min);
}
PageRanges pr = new PageRanges(min, max);
@@ -1165,8 +1165,8 @@
} else { // RANGE
rbPages.setSelected(true);
}
- tfRangeFrom.setValue(new Integer(min));
- tfRangeTo.setValue(new Integer(max));
+ tfRangeFrom.setValue(min);
+ tfRangeTo.setValue(max);
rbAll.setEnabled(prSupported);
rbPages.setEnabled(prSupported);
setupRangeWidgets();
@@ -1274,14 +1274,14 @@
min = 1;
max = Integer.MAX_VALUE;
}
- snModel.setMinimum(new Integer(min));
- snModel.setMaximum(new Integer(max));
+ snModel.setMinimum(min);
+ snModel.setMaximum(max);
int value = cp.getValue();
if ((value < min) || (value > max)) {
value = min;
}
- snModel.setValue(new Integer(value));
+ snModel.setValue(value);
// setup Collate checkbox
if (psCurrent.isAttributeCategorySupported(scCategory)) {
@@ -2762,7 +2762,7 @@
if ((value < 1) || (value > 100)) {
value = 1;
}
- snModel.setValue(new Integer(value));
+ snModel.setValue(value);
lblPriority.setEnabled(jpSupported);
spinPriority.setEnabled(jpSupported);
--- a/jdk/src/share/classes/sun/swing/PrintingStatus.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/swing/PrintingStatus.java Tue Jul 29 09:09:55 2014 -0700
@@ -295,7 +295,7 @@
private void updateStatusOnEDT(int pageIndex) {
assert SwingUtilities.isEventDispatchThread();
Object[] pageNumber = new Object[]{
- new Integer(pageIndex + 1)};
+ pageIndex + 1};
statusLabel.setText(statusFormat.format(pageNumber));
}
}
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java Tue Jul 29 09:09:55 2014 -0700
@@ -49,6 +49,8 @@
import sun.print.ProxyPrintGraphics;
import sun.awt.*;
import java.io.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.*;
import sun.font.FontDesignMetrics;
import sun.font.FontUtilities;
@@ -1486,9 +1488,60 @@
public static Object makeIcon(final Class<?> baseClass,
final Class<?> rootClass,
final String imageFile) {
+ return makeIcon(baseClass, rootClass, imageFile, true);
+ }
- return new UIDefaults.LazyValue() {
- public Object createValue(UIDefaults table) {
+ /**
+ * Utility method that creates a <code>UIDefaults.LazyValue</code> that
+ * creates an <code>ImageIcon</code> <code>UIResource</code> for the
+ * specified image file name. The image is loaded using
+ * <code>getResourceAsStream</code>, starting with a call to that method
+ * on the base class parameter. If it cannot be found, searching will
+ * continue through the base class' inheritance hierarchy, up to and
+ * including <code>rootClass</code>.
+ *
+ * Finds an image with a given name without privileges enabled.
+ *
+ * @param baseClass the first class to use in searching for the resource
+ * @param rootClass an ancestor of <code>baseClass</code> to finish the
+ * search at
+ * @param imageFile the name of the file to be found
+ * @return a lazy value that creates the <code>ImageIcon</code>
+ * <code>UIResource</code> for the image,
+ * or null if it cannot be found
+ */
+ public static Object makeIcon_Unprivileged(final Class<?> baseClass,
+ final Class<?> rootClass,
+ final String imageFile) {
+ return makeIcon(baseClass, rootClass, imageFile, false);
+ }
+
+ private static Object makeIcon(final Class<?> baseClass,
+ final Class<?> rootClass,
+ final String imageFile,
+ final boolean enablePrivileges) {
+ return (UIDefaults.LazyValue) (table) -> {
+ byte[] buffer = enablePrivileges ? AccessController.doPrivileged(
+ (PrivilegedAction<byte[]>) ()
+ -> getIconBytes(baseClass, rootClass, imageFile))
+ : getIconBytes(baseClass, rootClass, imageFile);
+
+ if (buffer == null) {
+ return null;
+ }
+ if (buffer.length == 0) {
+ System.err.println("warning: " + imageFile
+ + " is zero-length");
+ return null;
+ }
+
+ return new ImageIconUIResource(buffer);
+ };
+ }
+
+ private static byte[] getIconBytes(final Class<?> baseClass,
+ final Class<?> rootClass,
+ final String imageFile) {
/* Copy resource into a byte array. This is
* necessary because several browsers consider
* Class.getResource a security risk because it
@@ -1496,60 +1549,38 @@
* Class.getResourceAsStream just returns raw
* bytes, which we can convert to an image.
*/
- byte[] buffer =
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<byte[]>() {
- public byte[] run() {
- try {
- InputStream resource = null;
Class<?> srchClass = baseClass;
while (srchClass != null) {
- resource = srchClass.getResourceAsStream(imageFile);
- if (resource != null || srchClass == rootClass) {
+ try (InputStream resource =
+ srchClass.getResourceAsStream(imageFile)) {
+ if (resource == null) {
+ if (srchClass == rootClass) {
break;
}
-
srchClass = srchClass.getSuperclass();
+ continue;
}
- if (resource == null) {
- return null;
- }
-
- BufferedInputStream in =
- new BufferedInputStream(resource);
- ByteArrayOutputStream out =
- new ByteArrayOutputStream(1024);
+ try (BufferedInputStream in
+ = new BufferedInputStream(resource);
+ ByteArrayOutputStream out
+ = new ByteArrayOutputStream(1024)) {
byte[] buffer = new byte[1024];
int n;
while ((n = in.read(buffer)) > 0) {
out.write(buffer, 0, n);
}
- in.close();
out.flush();
return out.toByteArray();
+ }
} catch (IOException ioe) {
System.err.println(ioe.toString());
}
+ }
return null;
}
- });
-
- if (buffer == null) {
- return null;
- }
- if (buffer.length == 0) {
- System.err.println("warning: " + imageFile +
- " is zero-length");
- return null;
- }
-
- return new ImageIconUIResource(buffer);
- }
- };
- }
/* Used to help decide if AA text rendering should be used, so
* this local display test should be additionally qualified
--- a/jdk/src/share/native/sun/awt/image/awt_parseImage.c Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/native/sun/awt/image/awt_parseImage.c Tue Jul 29 09:09:55 2014 -0700
@@ -508,6 +508,7 @@
cmP->csType = (*env)->GetIntField(env, cmP->jcmodel, g_CMcsTypeID);
cmP->cmType = getColorModelType(env, jcmodel);
+ JNU_CHECK_EXCEPTION_RETURN(env, -1);
cmP->isDefaultCM = FALSE;
cmP->isDefaultCompatCM = FALSE;
--- a/jdk/src/share/native/sun/java2d/opengl/OGLBufImgOps.c Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLBufImgOps.c Tue Jul 29 09:09:55 2014 -0700
@@ -636,6 +636,9 @@
"OGLBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d",
shortData, numBands, bandLength, offset);
+ for (i = 0; i < 4; i++) {
+ bands[i] = NULL;
+ }
RETURN_IF_NULL(oglc);
RETURN_IF_NULL(srcOps);
RESET_PREVIOUS_OP();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/awt/datatransfer/flavormap.properties Tue Jul 29 09:09:55 2014 -0700
@@ -0,0 +1,71 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the X11 platform-specific,
+# default mappings between common X11 selection atoms and platform-independent
+# MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# The standard format is:
+#
+# <native>=<MIME type>,<MIME type>, ...
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate DataFlavor values and set multiple values for a single native by
+# separating them with ",". If a mapping contains a duplicate key or value,
+# earlier mappings which included this key or value will be preferred.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+
+# The COMPOUND_TEXT support for inter-client text transfer is disabled by
+# default. The reason is that many native applications prefer this format over
+# other native text formats, but are unable to decode the textual data in this
+# format properly. This results in java-to-native text transfer failures.
+# To enable the COMPOUND_TEXT support for this JRE installation uncomment
+# the line below.
+
+# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
+
+TEXT=text/plain;eoln="\n";terminators=0
+STRING=text/plain;charset=iso8859-1;eoln="\n";terminators=0
+FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java Tue Jul 29 09:09:55 2014 -0700
@@ -39,6 +39,7 @@
import javax.print.attribute.standard.MediaSize;
import javax.print.attribute.standard.MediaTray;
import javax.print.attribute.standard.MediaPrintableArea;
+import javax.print.attribute.standard.PrinterResolution;
import javax.print.attribute.Size2DSyntax;
import javax.print.attribute.Attribute;
import javax.print.attribute.EnumSyntax;
@@ -57,6 +58,8 @@
// CUPS does not support multi-threading.
private static synchronized native String[] getMedia(String printer);
private static synchronized native float[] getPageSizes(String printer);
+ private static synchronized native void
+ getResolutions(String printer, ArrayList<Integer> resolutionList);
//public static boolean useIPPMedia = false; will be used later
private MediaPrintableArea[] cupsMediaPrintables;
@@ -68,6 +71,7 @@
public int nTrays = 0;
private String[] media;
private float[] pageSizes;
+ int[] resolutionsArray;
private String printer;
private static boolean libFound;
@@ -119,6 +123,12 @@
nTrays = media.length/2-nPageSizes;
assert (nTrays >= 0);
}
+ ArrayList<Integer> resolutionList = new ArrayList<>();
+ getResolutions(printer, resolutionList);
+ resolutionsArray = new int[resolutionList.size()];
+ for (int i=0; i < resolutionList.size(); i++) {
+ resolutionsArray[i] = resolutionList.get(i);
+ }
}
}
@@ -160,6 +170,12 @@
return cupsMediaTrays;
}
+ /**
+ * return the raw packed array of supported printer resolutions.
+ */
+ int[] getRawResolutions() {
+ return resolutionsArray;
+ }
/**
* Initialize media by translating PPD info to PrintService attributes.
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java Tue Jul 29 09:09:55 2014 -0700
@@ -96,6 +96,8 @@
private MediaSizeName[] mediaSizeNames;
private CustomMediaSizeName[] customMediaSizeNames;
private int defaultMediaIndex;
+ private int[] rawResolutions = null;
+ private PrinterResolution[] printerResolutions = null;
private boolean isCupsPrinter;
private boolean init;
private Boolean isPS;
@@ -414,6 +416,7 @@
mediaTrays = cps.getMediaTrays();
customMediaSizeNames = cps.getCustomMediaSizeNames();
defaultMediaIndex = cps.getDefaultMediaIndex();
+ rawResolutions = cps.getRawResolutions();
urlConnection.disconnect();
init = true;
return;
@@ -765,6 +768,15 @@
return sidesSup;
}
}
+ } else if (category == PrinterResolution.class) {
+ PrinterResolution[] supportedRes = getPrintResolutions();
+ if (supportedRes == null) {
+ return null;
+ }
+ PrinterResolution []arr =
+ new PrinterResolution[supportedRes.length];
+ System.arraycopy(supportedRes, 0, arr, 0, supportedRes.length);
+ return arr;
}
return null;
@@ -1043,6 +1055,14 @@
if (getAttMap != null && getAttMap.containsKey("color-supported")) {
catList.add(Chromaticity.class);
}
+
+ // CUPS does not report printer resolution via IPP but it
+ // may be gleaned from the PPD.
+ PrinterResolution[] supportedRes = getPrintResolutions();
+ if (supportedRes != null && (supportedRes.length > 0)) {
+ catList.add(PrinterResolution.class);
+ }
+
supportedCats = new Class<?>[catList.size()];
catList.toArray(supportedCats);
return supportedCats;
@@ -1362,6 +1382,10 @@
}
}
return false;
+ } if (attr.getCategory() == PrinterResolution.class) {
+ if (attr instanceof PrinterResolution) {
+ return isSupportedResolution((PrinterResolution)attr);
+ }
}
return true;
}
@@ -1523,11 +1547,48 @@
}
}
return Sides.ONE_SIDED;
+ } else if (category == PrinterResolution.class) {
+ PrinterResolution[] supportedRes = getPrintResolutions();
+ if ((supportedRes != null) && (supportedRes.length > 0)) {
+ return supportedRes[0];
+ } else {
+ return new PrinterResolution(300, 300, PrinterResolution.DPI);
+ }
}
return null;
}
+ private PrinterResolution[] getPrintResolutions() {
+ if (printerResolutions == null) {
+ if (rawResolutions == null) {
+ printerResolutions = new PrinterResolution[0];
+ } else {
+ int numRes = rawResolutions.length / 2;
+ PrinterResolution[] pres = new PrinterResolution[numRes];
+ for (int i=0; i < numRes; i++) {
+ pres[i] = new PrinterResolution(rawResolutions[i*2],
+ rawResolutions[i*2+1],
+ PrinterResolution.DPI);
+ }
+ printerResolutions = pres;
+ }
+ }
+ return printerResolutions;
+ }
+
+ private boolean isSupportedResolution(PrinterResolution res) {
+ PrinterResolution[] supportedRes = getPrintResolutions();
+ if (supportedRes != null) {
+ for (int i=0; i<supportedRes.length; i++) {
+ if (res.equals(supportedRes[i])) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public ServiceUIFactory getServiceUIFactory() {
return null;
}
--- a/jdk/src/solaris/lib/flavormap.properties Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-# This properties file is used to initialize the default
-# java.awt.datatransfer.SystemFlavorMap. It contains the X11 platform-specific,
-# default mappings between common X11 selection atoms and platform-independent
-# MIME type strings, which will be converted into
-# java.awt.datatransfer.DataFlavors.
-#
-# These default mappings may be augmented by specifying the
-#
-# AWT.DnD.flavorMapFileURL
-#
-# property in the appropriate awt.properties file. The specified properties URL
-# will be loaded into the SystemFlavorMap.
-#
-# The standard format is:
-#
-# <native>=<MIME type>
-#
-# <native> should be a string identifier that the native platform will
-# recognize as a valid data format. <MIME type> should specify both a MIME
-# primary type and a MIME subtype separated by a '/'. The MIME type may include
-# parameters, where each parameter is a key/value pair separated by '=', and
-# where each parameter to the MIME type is separated by a ';'.
-#
-# Because SystemFlavorMap implements FlavorTable, developers are free to
-# duplicate both native keys and DataFlavor values. If a mapping contains a
-# duplicate key or value, earlier mappings which included this key or value
-# will be preferred.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", and which support the charset parameter, should specify the exact
-# format in which the native platform expects the data. The "charset"
-# parameter specifies the char to byte encoding, the "eoln" parameter
-# specifies the end-of-line marker, and the "terminators" parameter specifies
-# the number of terminating NUL bytes. Note that "eoln" and "terminators"
-# are not standardized MIME type parameters. They are specific to this file
-# format ONLY. They will not appear in any of the DataFlavors returned by the
-# SystemFlavorMap at the Java level.
-#
-# If the "charset" parameter is omitted, or has zero length, the platform
-# default encoding is assumed. If the "eoln" parameter is omitted, or has
-# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
-# or has a value less than zero, zero is assumed.
-#
-# Upon initialization, the data transfer subsystem will record the specified
-# details of the native text format, but the default SystemFlavorMap will
-# present a large set of synthesized DataFlavors which map, in both
-# directions, to the native. After receiving data from the application in one
-# of the synthetic DataFlavors, the data transfer subsystem will transform
-# the data stream into the format specified in this file before passing the
-# transformed stream to the native system.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", but which do not support the charset parameter, will be treated as
-# opaque, 8-bit data. They will not undergo any transformation process, and
-# any "charset", "eoln", or "terminators" parameters specified in this file
-# will be ignored.
-#
-# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
-# text flavors which support the charset parameter.
-
-UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
-
-# The COMPOUND_TEXT support for inter-client text transfer is disabled by
-# default. The reason is that many native applications prefer this format over
-# other native text formats, but are unable to decode the textual data in this
-# format properly. This results in java-to-native text transfer failures.
-# To enable the COMPOUND_TEXT support for this JRE installation uncomment
-# the line below.
-
-# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
-
-TEXT=text/plain;eoln="\n";terminators=0
-STRING=text/plain;charset=iso8859-1;eoln="\n";terminators=0
-FILE_NAME=application/x-java-file-list;class=java.util.List
-text/uri-list=application/x-java-file-list;class=java.util.List
-PNG=image/x-java-image;class=java.awt.Image
-JFIF=image/x-java-image;class=java.awt.Image
--- a/jdk/src/solaris/native/sun/awt/CUPSfuncs.c Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/solaris/native/sun/awt/CUPSfuncs.c Tue Jul 29 09:09:55 2014 -0700
@@ -394,3 +394,112 @@
unlink(filename);
return sizeArray;
}
+
+/*
+ * Populates the supplied ArrayList<Integer> with resolutions.
+ * The first pair of elements will be the default resolution.
+ * If resolution isn't supported the list will be empty.
+ * If needed we can add a 2nd ArrayList<String> which would
+ * be populated with the corresponding UI name.
+ * PPD specifies the syntax for resolution as either "Ndpi" or "MxNdpi",
+ * eg 300dpi or 600x600dpi. The former is a shorthand where xres==yres.
+ * We will always expand to the latter as we use a single array list.
+ * Note: getMedia() and getPageSizes() both open the ppd file
+ * This is not going to scale forever so if we add anymore we
+ * should look to consolidate this.
+ */
+JNIEXPORT void JNICALL
+Java_sun_print_CUPSPrinter_getResolutions(JNIEnv *env,
+ jobject printObj,
+ jstring printer,
+ jobject arrayList)
+{
+ ppd_file_t *ppd = NULL;
+ ppd_option_t *resolution;
+ int defx = 0, defy = 0;
+ int resx = 0, resy = 0;
+ jclass intCls, cls;
+ jmethodID intCtr, arrListAddMID;
+ int i;
+
+ intCls = (*env)->FindClass(env, "java/lang/Integer");
+ CHECK_NULL(intCls);
+ intCtr = (*env)->GetMethodID(env, intCls, "<init>", "(I)V");
+ CHECK_NULL(intCtr);
+ cls = (*env)->FindClass(env, "java/util/ArrayList");
+ CHECK_NULL(cls);
+ arrListAddMID =
+ (*env)->GetMethodID(env, cls, "add", "(Ljava/lang/Object;)Z");
+ CHECK_NULL(arrListAddMID);
+
+ const char *name = (*env)->GetStringUTFChars(env, printer, NULL);
+ if (name == NULL) {
+ (*env)->ExceptionClear(env);
+ JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
+ }
+ const char *filename;
+
+ // NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
+ // unlink() must be called to remove the file after using it.
+ filename = j2d_cupsGetPPD(name);
+ (*env)->ReleaseStringUTFChars(env, printer, name);
+ CHECK_NULL(filename);
+ if ((ppd = j2d_ppdOpenFile(filename)) == NULL) {
+ unlink(filename);
+ DPRINTF("unable to open PPD %s\n", filename)
+ }
+ resolution = j2d_ppdFindOption(ppd, "Resolution");
+ if (resolution != NULL) {
+ int matches = sscanf(resolution->defchoice, "%dx%ddpi", &defx, &defy);
+ if (matches == 2) {
+ if (defx <= 0 || defy <= 0) {
+ defx = 0;
+ defy = 0;
+ }
+ } else {
+ matches = sscanf(resolution->defchoice, "%ddpi", &defx);
+ if (matches == 1) {
+ if (defx <= 0) {
+ defx = 0;
+ } else {
+ defy = defx;
+ }
+ }
+ }
+ if (defx > 0) {
+ jobject rxObj = (*env)->NewObject(env, intCls, intCtr, defx);
+ jobject ryObj = (*env)->NewObject(env, intCls, intCtr, defy);
+ (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
+ (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
+ }
+
+ for (i = 0; i < resolution->num_choices; i++) {
+ char *resStr = resolution->choices[i].choice;
+ int matches = sscanf(resStr, "%dx%ddpi", &resx, &resy);
+ if (matches == 2) {
+ if (resx <= 0 || resy <= 0) {
+ resx = 0;
+ resy = 0;
+ }
+ } else {
+ matches = sscanf(resStr, "%ddpi", &resx);
+ if (matches == 1) {
+ if (resx <= 0) {
+ resx = 0;
+ } else {
+ resy = resx;
+ }
+ }
+ }
+ if (resx > 0 && (resx != defx || resy != defy )) {
+ jobject rxObj = (*env)->NewObject(env, intCls, intCtr, resx);
+ jobject ryObj = (*env)->NewObject(env, intCls, intCtr, resy);
+ (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj);
+ (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj);
+ }
+ }
+ }
+
+ j2d_ppdClose(ppd);
+ unlink(filename);
+}
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c Tue Jul 29 09:09:55 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, 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
@@ -433,7 +433,8 @@
result = TRUE;
}
- dlclose(lib);
+ // 8048289: workaround for https://bugzilla.gnome.org/show_bug.cgi?id=733065
+ // dlclose(lib);
return result;
}
--- a/jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11PMBlitLoops.c Tue Jul 29 09:09:55 2014 -0700
@@ -241,9 +241,12 @@
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 @@
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 @@
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;
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c Tue Jul 29 09:09:55 2014 -0700
@@ -454,6 +454,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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))) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/windows/classes/sun/awt/datatransfer/flavormap.properties Tue Jul 29 09:09:55 2014 -0700
@@ -0,0 +1,69 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the Win32 platform-
+# specific, default mappings between common Win32 Clipboard atoms and platform-
+# independent MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# The standard format is:
+#
+# <native>=<MIME type>,<MIME type>, ...
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate DataFlavor values and set multiple values for a single native by
+# separating them with ",". If a mapping contains a duplicate key or value,
+# earlier mappings which included this key or value will be preferred.#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UNICODE\ TEXT=text/plain;charset=utf-16le;eoln="\r\n";terminators=2
+TEXT=text/plain;eoln="\r\n";terminators=1
+HTML\ Format=text/html;charset=utf-8;eoln="\r\n";terminators=1
+Rich\ Text\ Format=text/rtf
+HDROP=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
+DIB=image/x-java-image;class=java.awt.Image
+ENHMETAFILE=image/x-java-image;class=java.awt.Image
+METAFILEPICT=image/x-java-image;class=java.awt.Image
+LOCALE=application/x-java-text-encoding;class="[B"
+UniformResourceLocator=application/x-java-url;class=java.net.URL,\
+ text/uri-list;eoln="\r\n";terminators=1,\
+ text/plain;eoln="\r\n";terminators=1
+FileGroupDescriptorW=application/x-java-file-list;class=java.util.List
+FileGroupDescriptor=application/x-java-file-list;class=java.util.List
--- a/jdk/src/windows/lib/flavormap.properties Tue Jul 29 13:08:27 2014 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#
-# This properties file is used to initialize the default
-# java.awt.datatransfer.SystemFlavorMap. It contains the Win32 platform-
-# specific, default mappings between common Win32 Clipboard atoms and platform-
-# independent MIME type strings, which will be converted into
-# java.awt.datatransfer.DataFlavors.
-#
-# These default mappings may be augmented by specifying the
-#
-# AWT.DnD.flavorMapFileURL
-#
-# property in the appropriate awt.properties file. The specified properties URL
-# will be loaded into the SystemFlavorMap.
-#
-# The standard format is:
-#
-# <native>=<MIME type>
-#
-# <native> should be a string identifier that the native platform will
-# recognize as a valid data format. <MIME type> should specify both a MIME
-# primary type and a MIME subtype separated by a '/'. The MIME type may include
-# parameters, where each parameter is a key/value pair separated by '=', and
-# where each parameter to the MIME type is separated by a ';'.
-#
-# Because SystemFlavorMap implements FlavorTable, developers are free to
-# duplicate both native keys and DataFlavor values. If a mapping contains a
-# duplicate key or value, earlier mappings which included this key or value
-# will be preferred.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", and which support the charset parameter, should specify the exact
-# format in which the native platform expects the data. The "charset"
-# parameter specifies the char to byte encoding, the "eoln" parameter
-# specifies the end-of-line marker, and the "terminators" parameter specifies
-# the number of terminating NUL bytes. Note that "eoln" and "terminators"
-# are not standardized MIME type parameters. They are specific to this file
-# format ONLY. They will not appear in any of the DataFlavors returned by the
-# SystemFlavorMap at the Java level.
-#
-# If the "charset" parameter is omitted, or has zero length, the platform
-# default encoding is assumed. If the "eoln" parameter is omitted, or has
-# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
-# or has a value less than zero, zero is assumed.
-#
-# Upon initialization, the data transfer subsystem will record the specified
-# details of the native text format, but the default SystemFlavorMap will
-# present a large set of synthesized DataFlavors which map, in both
-# directions, to the native. After receiving data from the application in one
-# of the synthetic DataFlavors, the data transfer subsystem will transform
-# the data stream into the format specified in this file before passing the
-# transformed stream to the native system.
-#
-# Mappings whose values specify DataFlavors with primary MIME types of
-# "text", but which do not support the charset parameter, will be treated as
-# opaque, 8-bit data. They will not undergo any transformation process, and
-# any "charset", "eoln", or "terminators" parameters specified in this file
-# will be ignored.
-#
-# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
-# text flavors which support the charset parameter.
-
-UNICODE\ TEXT=text/plain;charset=utf-16le;eoln="\r\n";terminators=2
-TEXT=text/plain;eoln="\r\n";terminators=1
-HTML\ Format=text/html;charset=utf-8;eoln="\r\n";terminators=1
-Rich\ Text\ Format=text/rtf
-HDROP=application/x-java-file-list;class=java.util.List
-PNG=image/x-java-image;class=java.awt.Image
-JFIF=image/x-java-image;class=java.awt.Image
-DIB=image/x-java-image;class=java.awt.Image
-ENHMETAFILE=image/x-java-image;class=java.awt.Image
-METAFILEPICT=image/x-java-image;class=java.awt.Image
-LOCALE=application/x-java-text-encoding;class="[B"
-UniformResourceLocator=application/x-java-url;class=java.net.URL
-UniformResourceLocator=text/uri-list;eoln="\r\n";terminators=1
-UniformResourceLocator=text/plain;eoln="\r\n";terminators=1
-FileGroupDescriptorW=application/x-java-file-list;class=java.util.List
-FileGroupDescriptor=application/x-java-file-list;class=java.util.List
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DBufImgOps.cpp Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBufImgOps.cpp Tue Jul 29 09:09:55 2014 -0700
@@ -201,6 +201,9 @@
int i;
jint flags = 0;
+ for (i = 0; i < 4; i++) {
+ bands[i] = NULL;
+ }
J2dTraceLn4(J2D_TRACE_INFO,
"D3DBufImgOps_EnableLookupOp: short=%d num=%d len=%d off=%d",
shortData, numBands, bandLength, offset);
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp Tue Jul 29 09:09:55 2014 -0700
@@ -6935,9 +6935,9 @@
{
TRY;
- return JNI_IS_TRUE(AwtToolkit::GetInstance().SyncCall(
+ return (jboolean)AwtToolkit::GetInstance().SyncCall(
(void *(*)(void *))AwtComponent::_NativeHandlesWheelScrolling,
- env->NewGlobalRef(self)));
+ env->NewGlobalRef(self));
// global ref is deleted in _NativeHandlesWheelScrolling
CATCH_BAD_ALLOC_RET(NULL);
@@ -6956,9 +6956,9 @@
jobject selfGlobalRef = env->NewGlobalRef(self);
- return JNI_IS_TRUE(AwtToolkit::GetInstance().SyncCall(
+ return (jboolean)AwtToolkit::GetInstance().SyncCall(
(void*(*)(void*))AwtComponent::_IsObscured,
- (void *)selfGlobalRef));
+ (void *)selfGlobalRef);
// selfGlobalRef is deleted in _IsObscured
CATCH_BAD_ALLOC_RET(NULL);
--- a/jdk/src/windows/native/sun/windows/awt_List.cpp Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_List.cpp Tue Jul 29 09:09:55 2014 -0700
@@ -1018,8 +1018,8 @@
ses->list = env->NewGlobalRef(self);
ses->index = index;
- return JNI_IS_TRUE(AwtToolkit::GetInstance().SyncCall(
- (void *(*)(void *))AwtList::_IsSelected, ses));
+ return (jboolean)AwtToolkit::GetInstance().SyncCall(
+ (void *(*)(void *))AwtList::_IsSelected, ses);
// global ref and ses are deleted in _IsSelected
CATCH_BAD_ALLOC_RET(FALSE);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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(); }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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(); }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDFWTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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); }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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); }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingFDWTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Window> 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); }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Window> 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);
+ }
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogSetModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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(); }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogToolkitModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFModelessTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFNonModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDWFTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsModelessTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsNonModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWAppModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWDocModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWModelessTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWNonModalTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFDWTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDAppModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDDocModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDModeless4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDNonModal4Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferFWDTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFAppModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFDocModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFModeless3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal1Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal2Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFNonModal3Test.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalFocusTransferTests/FocusTransferWDFTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalitySettingsTest/ModalitySettingsTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/NullModalityDialogTest/NullModalityDialogTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- a/jdk/test/java/awt/Modal/helpers/TestDialog.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/test/java/awt/Modal/helpers/TestDialog.java Tue Jul 29 09:09:55 2014 -0700
@@ -332,35 +332,47 @@
"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);
}
}
--- a/jdk/test/java/awt/Modal/helpers/TestFrame.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/test/java/awt/Modal/helpers/TestFrame.java Tue Jul 29 09:09:55 2014 -0700
@@ -292,13 +292,13 @@
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,
@@ -324,46 +324,50 @@
"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() {
+ public void checkOpenButtonFocusGained(boolean refState) {
+ checkOpenButtonFocusGained(refState, Flag.ATTEMPTS);
+ }
+
+ public void checkOpenButtonFocusGained(boolean refState, int attempts) {
try {
- openGained.waitForFlagTriggered();
+ openGained.waitForFlagTriggered(attempts);
} 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");
- }
+ 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() {
+ public void checkOpenButtonFocusLost(boolean refState, int attempts) {
try {
- openLost.waitForFlagTriggered();
+ openLost.waitForFlagTriggered(attempts);
} catch (InterruptedException e) {}
- assertTrue(openLost.flag(), "frame Open button did not lose focus");
+ String msg = "frame Open button ";
+ msg += (refState ? "did not lose focus" :
+ "lost focus when it should not");
+ assertTrue(openLost.flag()== refState, msg);
}
}
--- a/jdk/test/java/awt/Modal/helpers/TestWindow.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/test/java/awt/Modal/helpers/TestWindow.java Tue Jul 29 09:09:55 2014 -0700
@@ -295,39 +295,51 @@
"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);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.java Tue Jul 29 09:09:55 2014 -0700
@@ -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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/DesktopProperties/rfe4758438.sh Tue Jul 29 09:09:55 2014 -0700
@@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedModifiersTest/ExtendedModifiersTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Component> 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();
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/KeyMaskTest/KeyMaskTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Component> 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Component> 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/MouseEvent/MouseButtonsTest/MouseButtonsTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Component> 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/MouseEvent/MultipleMouseButtonsTest/MultipleMouseButtonsTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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<Component> 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();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWButton.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 <i>Button</i> 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.<p>
+ *
+ * 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)<p>
+ * <ol>
+ * <li><b>Focus</b>: Indicates that the LWButton has the focus.
+ * <li><b>Mouse Over</b>: Indicates that the mouse is over the component.
+ * <li><b>Mouse Pressed</b>: Indicates that the mouse has been pressed.
+ * </ol>
+ *
+ * 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 <i>processEvent</i>
+ // 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 <code>null</code> 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;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWComponent.java Tue Jul 29 09:09:55 2014 -0700
@@ -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.<p>
+ *
+ * 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.<p>
+ *
+ * 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.<p>
+ *
+ * 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.<p>
+ *
+ * <b>KVETCHING</b>: <i>Kvetch</i> 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 <i>kvetch</i> is where this code lives
+ * and is intended to check a broad range of conditions.<p>
+ *
+ * To turn off specific kvetch's, one simply specifies a System property
+ * as in this table:<p>
+ *
+ * <table border="1">
+ * <tr><th>Property name</th><th>Value</th><th>Discussion</th></tr>
+ * <tr>
+ * <th>javasoft.awtsqe.lw.IGNORE_FOCUS_KVETCH</th>
+ * <th>true or false</th>
+ * <td>Specify whether the <i>hasFocus</i> kvetch is checked.</td>
+ * </tr>
+ * </table><p>
+ *
+ * <b>XXX To implement</b> - 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.<p>
+ *
+ * <b>XXX To implement</b> - 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.<p>
+ */
+
+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 <i>shoulds</i> 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 <i>shoulds</i> 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. <p>
+ *
+ * Child classes of LWComponent are to call {@code restrictGraphicsToClientArea}
+ * at the beginning of their {@code paint} method, and then call
+ * {@code unrestrictGraphicsFromClientArea} afterwards.<p>
+ *
+ * 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).<p>
+ *
+ * @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);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/helpers/lwcomponents/LWList.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/png/PngDitDepthTest.java Tue Jul 29 09:09:55 2014 -0700
@@ -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);
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/attribute/PrintResAttr.java Tue Jul 29 09:09:55 2014 -0700
@@ -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 8048328
+ * @summary CUPS Printing does not report supported printer resolutions.
+ * @run main PrintResAttr
+ */
+
+/*
+ * Since there is no guarantee you have any printers that support
+ * resolution this test can't verify that resolution is being
+ * reported when supported. But when they are it should test that
+ * the code behaves reasonably.
+ */
+import javax.print.*;
+import javax.print.attribute.*;
+import javax.print.attribute.standard.*;
+
+public class PrintResAttr {
+
+ public static void main(String args[]) throws Exception {
+
+ PrintService[] services =
+ PrintServiceLookup.lookupPrintServices(null,null);
+ for (int i=0; i<services.length; i++) {
+ if (services[i].isAttributeCategorySupported(PrinterResolution.class)) {
+ System.out.println("Testing " + services[i]);
+ PrinterResolution[] res = (PrinterResolution[])
+ services[i].getSupportedAttributeValues(PrinterResolution.class,
+ null,null);
+ System.out.println("# supp res= " + res.length);
+ for (int r=0;r<res.length;r++) System.out.println(res[r]);
+ }
+ }
+ }
+}
--- a/jdk/test/sun/awt/image/bug8038000.java Tue Jul 29 13:08:27 2014 -0700
+++ b/jdk/test/sun/awt/image/bug8038000.java Tue Jul 29 09:09:55 2014 -0700
@@ -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
*/