--- a/jdk/src/share/classes/java/beans/EventSetDescriptor.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/beans/EventSetDescriptor.java Mon Oct 04 14:38:14 2010 -0700
@@ -176,8 +176,9 @@
setRemoveListenerMethod(getMethod(sourceClass, removeListenerMethodName, 1));
// Be more forgiving of not finding the getListener method.
- if (getListenerMethodName != null) {
- setGetListenerMethod(Introspector.findInstanceMethod(sourceClass, getListenerMethodName));
+ Method method = Introspector.findMethod(sourceClass, getListenerMethodName, 0);
+ if (method != null) {
+ setGetListenerMethod(method);
}
}
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Mon Oct 04 14:38:14 2010 -0700
@@ -189,11 +189,13 @@
indexedReadMethodName = Introspector.GET_PREFIX + getBaseName();
}
}
- indexedReadMethod = Introspector.findInstanceMethod(cls, indexedReadMethodName, int.class);
+
+ Class[] args = { int.class };
+ indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
if (indexedReadMethod == null) {
// no "is" method, so look for a "get" method.
indexedReadMethodName = Introspector.GET_PREFIX + getBaseName();
- indexedReadMethod = Introspector.findInstanceMethod(cls, indexedReadMethodName, int.class);
+ indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
}
setIndexedReadMethod0(indexedReadMethod);
}
@@ -265,7 +267,9 @@
if (indexedWriteMethodName == null) {
indexedWriteMethodName = Introspector.SET_PREFIX + getBaseName();
}
- indexedWriteMethod = Introspector.findInstanceMethod(cls, indexedWriteMethodName, int.class, type);
+
+ Class[] args = (type == null) ? null : new Class[] { int.class, type };
+ indexedWriteMethod = Introspector.findMethod(cls, indexedWriteMethodName, 2, args);
if (indexedWriteMethod != null) {
if (!indexedWriteMethod.getReturnType().equals(void.class)) {
indexedWriteMethod = null;
--- a/jdk/src/share/classes/java/beans/Introspector.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/beans/Introspector.java Mon Oct 04 14:38:14 2010 -0700
@@ -28,7 +28,6 @@
import com.sun.beans.WeakCache;
import com.sun.beans.finder.BeanInfoFinder;
import com.sun.beans.finder.ClassFinder;
-import com.sun.beans.finder.MethodFinder;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
@@ -843,8 +842,8 @@
Method read = result.getReadMethod();
if (read == null && write != null) {
- read = findInstanceMethod(result.getClass0(),
- GET_PREFIX + NameGenerator.capitalize(result.getName()));
+ read = findMethod(result.getClass0(),
+ GET_PREFIX + NameGenerator.capitalize(result.getName()), 0);
if (read != null) {
try {
result.setReadMethod(read);
@@ -854,9 +853,9 @@
}
}
if (write == null && read != null) {
- write = findInstanceMethod(result.getClass0(),
- SET_PREFIX + NameGenerator.capitalize(result.getName()),
- FeatureDescriptor.getReturnType(result.getClass0(), read));
+ write = findMethod(result.getClass0(),
+ SET_PREFIX + NameGenerator.capitalize(result.getName()), 1,
+ new Class[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
if (write != null) {
try {
result.setWriteMethod(write);
@@ -1280,27 +1279,90 @@
// Package private support methods.
//======================================================================
- static Method findMethod(Class<?> type, String name, int args) {
- for (Method method : type.getMethods()) {
- if (method.getName().equals(name) && (args == method.getParameterTypes().length)) {
- try {
- return MethodFinder.findAccessibleMethod(method);
+ /**
+ * Internal support for finding a target methodName with a given
+ * parameter list on a given class.
+ */
+ private static Method internalFindMethod(Class start, String methodName,
+ int argCount, Class args[]) {
+ // For overriden methods we need to find the most derived version.
+ // So we start with the given class and walk up the superclass chain.
+
+ Method method = null;
+
+ for (Class cl = start; cl != null; cl = cl.getSuperclass()) {
+ Method methods[] = getPublicDeclaredMethods(cl);
+ for (int i = 0; i < methods.length; i++) {
+ method = methods[i];
+ if (method == null) {
+ continue;
}
- catch (NoSuchMethodException exception) {
- // continue search for a method with the specified count of parameters
+
+ // make sure method signature matches.
+ Class params[] = FeatureDescriptor.getParameterTypes(start, method);
+ if (method.getName().equals(methodName) &&
+ params.length == argCount) {
+ if (args != null) {
+ boolean different = false;
+ if (argCount > 0) {
+ for (int j = 0; j < argCount; j++) {
+ if (params[j] != args[j]) {
+ different = true;
+ continue;
+ }
+ }
+ if (different) {
+ continue;
+ }
+ }
+ }
+ return method;
}
}
}
- return null;
+ method = null;
+
+ // Now check any inherited interfaces. This is necessary both when
+ // the argument class is itself an interface, and when the argument
+ // class is an abstract class.
+ Class ifcs[] = start.getInterfaces();
+ for (int i = 0 ; i < ifcs.length; i++) {
+ // Note: The original implementation had both methods calling
+ // the 3 arg method. This is preserved but perhaps it should
+ // pass the args array instead of null.
+ method = internalFindMethod(ifcs[i], methodName, argCount, null);
+ if (method != null) {
+ break;
+ }
+ }
+ return method;
}
- static Method findInstanceMethod(Class<?> type, String name, Class<?>... args) {
- try {
- return MethodFinder.findInstanceMethod(type, name, args);
- }
- catch (NoSuchMethodException exception) {
+ /**
+ * Find a target methodName on a given class.
+ */
+ static Method findMethod(Class cls, String methodName, int argCount) {
+ return findMethod(cls, methodName, argCount, null);
+ }
+
+ /**
+ * Find a target methodName with specific parameter list on a given class.
+ * <p>
+ * Used in the contructors of the EventSetDescriptor,
+ * PropertyDescriptor and the IndexedPropertyDescriptor.
+ * <p>
+ * @param cls The Class object on which to retrieve the method.
+ * @param methodName Name of the method.
+ * @param argCount Number of arguments for the desired method.
+ * @param args Array of argument types for the method.
+ * @return the method or null if not found
+ */
+ static Method findMethod(Class cls, String methodName, int argCount,
+ Class args[]) {
+ if (methodName == null) {
return null;
}
+ return internalFindMethod(cls, methodName, argCount, args);
}
/**
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java Mon Oct 04 14:38:14 2010 -0700
@@ -90,13 +90,13 @@
// Find methods for up to 2 params. We are guessing here.
// This block should never execute unless the classloader
// that loaded the argument classes disappears.
- method = Introspector.findMethod(cls, name, i);
+ method = Introspector.findMethod(cls, name, i, null);
if (method != null) {
break;
}
}
} else {
- method = Statement.getMethod(cls, name, params);
+ method = Introspector.findMethod(cls, name, params.length, params);
}
setMethod(method);
}
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java Mon Oct 04 14:38:14 2010 -0700
@@ -112,7 +112,8 @@
// If this class or one of its base classes allow PropertyChangeListener,
// then we assume that any properties we discover are "bound".
// See Introspector.getTargetPropertyInfo() method.
- this.bound = null != Introspector.findInstanceMethod(beanClass, "addPropertyChangeListener", PropertyChangeListener.class);
+ Class[] args = { PropertyChangeListener.class };
+ this.bound = null != Introspector.findMethod(beanClass, "addPropertyChangeListener", args.length, args);
}
/**
@@ -223,10 +224,10 @@
// property type is. For booleans, there can be "is" and "get"
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
- readMethod = Introspector.findInstanceMethod(cls, readMethodName);
+ readMethod = Introspector.findMethod(cls, readMethodName, 0);
if (readMethod == null) {
readMethodName = Introspector.GET_PREFIX + getBaseName();
- readMethod = Introspector.findInstanceMethod(cls, readMethodName);
+ readMethod = Introspector.findMethod(cls, readMethodName, 0);
}
try {
setReadMethod(readMethod);
@@ -291,7 +292,8 @@
writeMethodName = Introspector.SET_PREFIX + getBaseName();
}
- writeMethod = Introspector.findInstanceMethod(cls, writeMethodName, type);
+ Class[] args = (type == null) ? null : new Class[] { type };
+ writeMethod = Introspector.findMethod(cls, writeMethodName, 1, args);
if (writeMethod != null) {
if (!writeMethod.getReturnType().equals(void.class)) {
writeMethod = null;
--- a/jdk/src/share/classes/java/util/Locale.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/util/Locale.java Mon Oct 04 14:38:14 2010 -0700
@@ -569,6 +569,9 @@
* @exception NullPointerException thrown if any argument is null.
*/
public Locale(String language, String country, String variant) {
+ if (language== null || country == null || variant == null) {
+ throw new NullPointerException();
+ }
_baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
_extensions = getCompatibilityExtensions(language, "", country, variant);
}
--- a/jdk/src/share/classes/java/util/ResourceBundle.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/java/util/ResourceBundle.java Mon Oct 04 14:38:14 2010 -0700
@@ -293,16 +293,6 @@
= new ConcurrentHashMap<CacheKey, BundleReference>(INITIAL_CACHE_SIZE);
/**
- * This ConcurrentMap is used to keep multiple threads from loading the
- * same bundle concurrently. The table entries are <CacheKey, Thread>
- * where CacheKey is the key for the bundle that is under construction
- * and Thread is the thread that is constructing the bundle.
- * This list is manipulated in findBundleInCache and putBundleInCache.
- */
- private static final ConcurrentMap<CacheKey, Thread> underConstruction
- = new ConcurrentHashMap<CacheKey, Thread>();
-
- /**
* Queue for reference objects referring to class loaders or bundles.
*/
private static final ReferenceQueue referenceQueue = new ReferenceQueue();
@@ -1381,7 +1371,7 @@
boolean expiredBundle = false;
// First, look up the cache to see if it's in the cache, without
- // declaring beginLoading.
+ // attempting to load bundle.
cacheKey.setLocale(targetLocale);
ResourceBundle bundle = findBundleInCache(cacheKey, control);
if (isValidBundle(bundle)) {
@@ -1408,56 +1398,25 @@
CacheKey constKey = (CacheKey) cacheKey.clone();
try {
- // Try declaring loading. If beginLoading() returns true,
- // then we can proceed. Otherwise, we need to take a look
- // at the cache again to see if someone else has loaded
- // the bundle and put it in the cache while we've been
- // waiting for other loading work to complete.
- while (!beginLoading(constKey)) {
- bundle = findBundleInCache(cacheKey, control);
- if (bundle == null) {
- continue;
+ bundle = loadBundle(cacheKey, formats, control, expiredBundle);
+ if (bundle != null) {
+ if (bundle.parent == null) {
+ bundle.setParent(parent);
}
- if (bundle == NONEXISTENT_BUNDLE) {
- // If the bundle is NONEXISTENT_BUNDLE, the bundle doesn't exist.
- return parent;
- }
- expiredBundle = bundle.expired;
- if (!expiredBundle) {
- if (bundle.parent == parent) {
- return bundle;
- }
- BundleReference bundleRef = cacheList.get(cacheKey);
- if (bundleRef != null && bundleRef.get() == bundle) {
- cacheList.remove(cacheKey, bundleRef);
- }
- }
+ bundle.locale = targetLocale;
+ bundle = putBundleInCache(cacheKey, bundle, control);
+ return bundle;
}
- try {
- bundle = loadBundle(cacheKey, formats, control, expiredBundle);
- if (bundle != null) {
- if (bundle.parent == null) {
- bundle.setParent(parent);
- }
- bundle.locale = targetLocale;
- bundle = putBundleInCache(cacheKey, bundle, control);
- return bundle;
- }
-
- // Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle
- // instance for the locale.
- putBundleInCache(cacheKey, NONEXISTENT_BUNDLE, control);
- } finally {
- endLoading(constKey);
- }
+ // Put NONEXISTENT_BUNDLE in the cache as a mark that there's no bundle
+ // instance for the locale.
+ putBundleInCache(cacheKey, NONEXISTENT_BUNDLE, control);
} finally {
if (constKey.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
}
}
}
- assert underConstruction.get(cacheKey) != Thread.currentThread();
return parent;
}
@@ -1465,7 +1424,6 @@
List<String> formats,
Control control,
boolean reload) {
- assert underConstruction.get(cacheKey) == Thread.currentThread();
// Here we actually load the bundle in the order of formats
// specified by the getFormats() value.
@@ -1498,7 +1456,6 @@
break;
}
}
- assert underConstruction.get(cacheKey) == Thread.currentThread();
return bundle;
}
@@ -1530,57 +1487,6 @@
}
/**
- * Declares the beginning of actual resource bundle loading. This method
- * returns true if the declaration is successful and the current thread has
- * been put in underConstruction. If someone else has already begun
- * loading, this method waits until that loading work is complete and
- * returns false.
- */
- private static final boolean beginLoading(CacheKey constKey) {
- Thread me = Thread.currentThread();
- Thread worker;
- // We need to declare by putting the current Thread (me) to
- // underConstruction that we are working on loading the specified
- // resource bundle. If we are already working the loading, it means
- // that the resource loading requires a recursive call. In that case,
- // we have to proceed. (4300693)
- if (((worker = underConstruction.putIfAbsent(constKey, me)) == null)
- || worker == me) {
- return true;
- }
-
- // If someone else is working on the loading, wait until
- // the Thread finishes the bundle loading.
- synchronized (worker) {
- while (underConstruction.get(constKey) == worker) {
- try {
- worker.wait();
- } catch (InterruptedException e) {
- // record the interruption
- constKey.setCause(e);
- }
- }
- }
- return false;
- }
-
- /**
- * Declares the end of the bundle loading. This method calls notifyAll
- * for those who are waiting for this completion.
- */
- private static final void endLoading(CacheKey constKey) {
- // Remove this Thread from the underConstruction map and wake up
- // those who have been waiting for me to complete this bundle
- // loading.
- Thread me = Thread.currentThread();
- assert (underConstruction.get(constKey) == me);
- underConstruction.remove(constKey);
- synchronized (me) {
- me.notifyAll();
- }
- }
-
- /**
* Throw a MissingResourceException with proper message
*/
private static final void throwMissingResourceException(String baseName,
--- a/jdk/src/share/classes/javax/swing/GroupLayout.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/GroupLayout.java Mon Oct 04 14:38:14 2010 -0700
@@ -1464,8 +1464,8 @@
* <= {@code pref} <= {@code max}.
* <p>
* Similarly any methods that take a {@code Component} throw a
- * {@code NullPointerException} if passed {@code null} and any methods
- * that take a {@code Group} throw an {@code IllegalArgumentException} if
+ * {@code IllegalArgumentException} if passed {@code null} and any methods
+ * that take a {@code Group} throw an {@code NullPointerException} if
* passed {@code null}.
*
* @see #createSequentialGroup
--- a/jdk/src/share/classes/javax/swing/JComponent.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Mon Oct 04 14:38:14 2010 -0700
@@ -4787,6 +4787,17 @@
* @see RepaintManager#addDirtyRegion
*/
public void repaint(long tm, int x, int y, int width, int height) {
+ Container p = this;
+ while ((p = p.getParent()) instanceof JComponent) {
+ JComponent jp = (JComponent) p;
+ if (jp.isPaintingOrigin()) {
+ Rectangle rectangle = SwingUtilities.convertRectangle(
+ this, new Rectangle(x, y, width, height), jp);
+ jp.repaint(tm,
+ rectangle.x, rectangle.y, rectangle.width, rectangle.height);
+ return;
+ }
+ }
RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width, height);
}
--- a/jdk/src/share/classes/javax/swing/JDesktopPane.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java Mon Oct 04 14:38:14 2010 -0700
@@ -215,7 +215,8 @@
/**
* Sets the <code>DesktopManger</code> that will handle
- * desktop-specific UI actions.
+ * desktop-specific UI actions. This may be overridden by
+ * {@code LookAndFeel}.
*
* @param d the <code>DesktopManager</code> to use
*
--- a/jdk/src/share/classes/javax/swing/JLayer.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/JLayer.java Mon Oct 04 14:38:14 2010 -0700
@@ -25,17 +25,17 @@
package javax.swing;
+import sun.awt.AWTAccessor;
+
import javax.swing.plaf.LayerUI;
+import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectInputStream;
-import java.io.Serializable;
-import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.Iterator;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -156,8 +156,6 @@
private LayerUI<? super V> layerUI;
private JPanel glassPane;
private boolean isPainting;
- private static final DefaultLayerLayout sharedLayoutInstance =
- new DefaultLayerLayout();
private long eventMask;
private static final LayerEventController eventController =
@@ -165,7 +163,7 @@
/**
* Creates a new {@code JLayer} object with a {@code null} view component
- * and {@code null} {@link javax.swing.plaf.LayerUI}.
+ * and default {@link javax.swing.plaf.LayerUI}.
*
* @see #setView
* @see #setUI
@@ -176,14 +174,14 @@
/**
* Creates a new {@code JLayer} object
- * with {@code null} {@link javax.swing.plaf.LayerUI}.
+ * with default {@link javax.swing.plaf.LayerUI}.
*
* @param view the component to be decorated by this {@code JLayer}
*
* @see #setUI
*/
public JLayer(V view) {
- this(view, null);
+ this(view, new LayerUI<V>());
}
/**
@@ -195,7 +193,6 @@
* to be used by this {@code JLayer}
*/
public JLayer(V view, LayerUI<V> ui) {
- setLayout(sharedLayoutInstance);
setGlassPane(createGlassPane());
setView(view);
setUI(ui);
@@ -279,10 +276,15 @@
*/
public void setGlassPane(JPanel glassPane) {
Component oldGlassPane = getGlassPane();
+ boolean isGlassPaneVisible = false;
if (oldGlassPane != null) {
+ isGlassPaneVisible = oldGlassPane.isVisible();
super.remove(oldGlassPane);
}
if (glassPane != null) {
+ AWTAccessor.getComponentAccessor().setMixingCutoutShape(glassPane,
+ new Rectangle());
+ glassPane.setVisible(isGlassPaneVisible);
super.addImpl(glassPane, null, 0);
}
this.glassPane = glassPane;
@@ -303,6 +305,40 @@
}
/**
+ * Sets the layout manager for this container. This method is
+ * overridden to prevent the layout manager from being set.
+ * <p/>Note: If {@code mgr} is non-{@code null}, this
+ * method will throw an exception as layout managers are not supported on
+ * a {@code JLayer}.
+ *
+ * @param mgr the specified layout manager
+ * @exception IllegalArgumentException this method is not supported
+ */
+ public void setLayout(LayoutManager mgr) {
+ if (mgr != null) {
+ throw new IllegalArgumentException("JLayer.setLayout() not supported");
+ }
+ }
+
+ /**
+ * A non-{@code null] border, or non-zero insets, isn't supported, to prevent the geometry
+ * of this component from becoming complex enough to inhibit
+ * subclassing of {@code LayerUI} class. To create a {@code JLayer} with a border,
+ * add it to a {@code JPanel} that has a border.
+ * <p/>Note: If {@code border} is non-{@code null}, this
+ * method will throw an exception as borders are not supported on
+ * a {@code JLayer}.
+ *
+ * @param border the {@code Border} to set
+ * @exception IllegalArgumentException this method is not supported
+ */
+ public void setBorder(Border border) {
+ if (border != null) {
+ throw new IllegalArgumentException("JLayer.setBorder() not supported");
+ }
+ }
+
+ /**
* This method is not supported by {@code JLayer}
* and always throws {@code UnsupportedOperationException}
*
@@ -341,6 +377,32 @@
}
/**
+ * Always returns {@code true} to cause painting to originate from {@code JLayer},
+ * or one of its ancestors.
+ *
+ * @return true
+ * @see JComponent#isPaintingOrigin()
+ */
+ boolean isPaintingOrigin() {
+ return true;
+ }
+
+ /**
+ * Delegates repainting to {@link javax.swing.plaf.LayerUI#repaint} method.
+ *
+ * @param tm this parameter is not used
+ * @param x the x value of the dirty region
+ * @param y the y value of the dirty region
+ * @param width the width of the dirty region
+ * @param height the height of the dirty region
+ */
+ public void repaint(long tm, int x, int y, int width, int height) {
+ if (getUI() != null) {
+ getUI().repaint(tm, x, y, width, height, this);
+ }
+ }
+
+ /**
* Delegates all painting to the {@link javax.swing.plaf.LayerUI} object.
*
* @param g the {@code Graphics} to render to
@@ -364,14 +426,18 @@
}
/**
- * To enable the correct painting of the {@code glassPane} and view component,
- * the {@code JLayer} overrides the default implementation of
- * this method to return {@code false} when the {@code glassPane} is visible.
+ * The {@code JLayer} overrides the default implementation of
+ * this method (in {@code JComponent}) to return {@code false}.
+ * This ensures
+ * that the drawing machinery will call the {@code JLayer}'s
+ * {@code paint}
+ * implementation rather than messaging the {@code JLayer}'s
+ * children directly.
*
- * @return false if {@code JLayer}'s {@code glassPane} is visible
+ * @return false
*/
public boolean isOptimizedDrawingEnabled() {
- return glassPane == null || !glassPane.isVisible();
+ return false;
}
/**
@@ -461,17 +527,16 @@
/**
* Returns the preferred size of the viewport for a view component.
* <p/>
- * If the ui delegate of this layer is not {@code null}, this method delegates its
- * implementation to the {@code LayerUI.getPreferredScrollableViewportSize(JLayer)}
+ * If the view component of this layer implements {@link Scrollable}, this method delegates its
+ * implementation to the view component.
*
* @return the preferred size of the viewport for a view component
*
* @see Scrollable
- * @see LayerUI#getPreferredScrollableViewportSize(JLayer)
*/
public Dimension getPreferredScrollableViewportSize() {
- if (getUI() != null) {
- return getUI().getPreferredScrollableViewportSize(this);
+ if (getView() instanceof Scrollable) {
+ return ((Scrollable)getView()).getPreferredScrollableViewportSize();
}
return getPreferredSize();
}
@@ -481,18 +546,17 @@
* that display logical rows or columns in order to completely expose
* one block of rows or columns, depending on the value of orientation.
* <p/>
- * If the ui delegate of this layer is not {@code null}, this method delegates its
- * implementation to the {@code LayerUI.getScrollableBlockIncrement(JLayer,Rectangle,int,int)}
+ * If the view component of this layer implements {@link Scrollable}, this method delegates its
+ * implementation to the view component.
*
* @return the "block" increment for scrolling in the specified direction
*
* @see Scrollable
- * @see LayerUI#getScrollableBlockIncrement(JLayer, Rectangle, int, int)
*/
public int getScrollableBlockIncrement(Rectangle visibleRect,
int orientation, int direction) {
- if (getUI() != null) {
- return getUI().getScrollableBlockIncrement(this, visibleRect,
+ if (getView() instanceof Scrollable) {
+ return ((Scrollable)getView()).getScrollableBlockIncrement(visibleRect,
orientation, direction);
}
return (orientation == SwingConstants.VERTICAL) ? visibleRect.height :
@@ -504,17 +568,16 @@
* determine the height of the layer, unless the preferred height
* of the layer is smaller than the height of the viewport.
* <p/>
- * If the ui delegate of this layer is not null, this method delegates its
- * implementation to the {@code LayerUI.getScrollableTracksViewportHeight(JLayer)}
+ * If the view component of this layer implements {@link Scrollable}, this method delegates its
+ * implementation to the view component.
*
* @return whether the layer should track the height of the viewport
*
* @see Scrollable
- * @see LayerUI#getScrollableTracksViewportHeight(JLayer)
*/
public boolean getScrollableTracksViewportHeight() {
- if (getUI() != null) {
- return getUI().getScrollableTracksViewportHeight(this);
+ if (getView() instanceof Scrollable) {
+ return ((Scrollable)getView()).getScrollableTracksViewportHeight();
}
return false;
}
@@ -524,17 +587,16 @@
* determine the width of the layer, unless the preferred width
* of the layer is smaller than the width of the viewport.
* <p/>
- * If the ui delegate of this layer is not null, this method delegates its
- * implementation to the {@code LayerUI.getScrollableTracksViewportWidth(JLayer)}
+ * If the view component of this layer implements {@link Scrollable}, this method delegates its
+ * implementation to the view component.
*
* @return whether the layer should track the width of the viewport
*
* @see Scrollable
- * @see LayerUI#getScrollableTracksViewportWidth(JLayer)
*/
public boolean getScrollableTracksViewportWidth() {
- if (getUI() != null) {
- return getUI().getScrollableTracksViewportWidth(this);
+ if (getView() instanceof Scrollable) {
+ return ((Scrollable)getView()).getScrollableTracksViewportWidth();
}
return false;
}
@@ -549,20 +611,19 @@
* Scrolling containers, like {@code JScrollPane}, will use this method
* each time the user requests a unit scroll.
* <p/>
- * If the ui delegate of this layer is not {@code null}, this method delegates its
- * implementation to the {@code LayerUI.getScrollableUnitIncrement(JLayer,Rectangle,int,int)}
+ * If the view component of this layer implements {@link Scrollable}, this method delegates its
+ * implementation to the view component.
*
* @return The "unit" increment for scrolling in the specified direction.
* This value should always be positive.
*
* @see Scrollable
- * @see LayerUI#getScrollableUnitIncrement(JLayer, Rectangle, int, int)
*/
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation,
int direction) {
- if (getUI() != null) {
- return getUI().getScrollableUnitIncrement(
- this, visibleRect, orientation, direction);
+ if (getView() instanceof Scrollable) {
+ return ((Scrollable) getView()).getScrollableUnitIncrement(
+ visibleRect, orientation, direction);
}
return 1;
}
@@ -595,6 +656,16 @@
}
/**
+ * Delegates its functionality to the {@link javax.swing.plaf.LayerUI#doLayout(JLayer)} method,
+ * if {@code LayerUI} is set.
+ */
+ public void doLayout() {
+ if (getUI() != null) {
+ getUI().doLayout(this);
+ }
+ }
+
+ /**
* static AWTEventListener to be shared with all AbstractLayerUIs
*/
private static class LayerEventController implements AWTEventListener {
@@ -625,8 +696,8 @@
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
- isEventEnabled(l.getLayerEventMask(),
- event.getID())) {
+ isEventEnabled(l.getLayerEventMask(), event.getID()) &&
+ (!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
@@ -758,82 +829,4 @@
return super.contains(x, y);
}
}
-
- /**
- * The default layout manager for the {@link javax.swing.JLayer}.<br/>
- * It places the glassPane on top of the view component
- * and makes it the same size as {@code JLayer},
- * it also makes the view component the same size but minus layer's insets<br/>
- */
- private static class DefaultLayerLayout implements LayoutManager, Serializable {
- /**
- * {@inheritDoc}
- */
- public void layoutContainer(Container parent) {
- JLayer layer = (JLayer) parent;
- Component view = layer.getView();
- Component glassPane = layer.getGlassPane();
- if (view != null) {
- Insets insets = layer.getInsets();
- view.setLocation(insets.left, insets.top);
- view.setSize(layer.getWidth() - insets.left - insets.right,
- layer.getHeight() - insets.top - insets.bottom);
- }
- if (glassPane != null) {
- glassPane.setLocation(0, 0);
- glassPane.setSize(layer.getWidth(), layer.getHeight());
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public Dimension minimumLayoutSize(Container parent) {
- JLayer layer = (JLayer) parent;
- Insets insets = layer.getInsets();
- Dimension ret = new Dimension(insets.left + insets.right,
- insets.top + insets.bottom);
- Component view = layer.getView();
- if (view != null) {
- Dimension size = view.getMinimumSize();
- ret.width += size.width;
- ret.height += size.height;
- }
- if (ret.width == 0 || ret.height == 0) {
- ret.width = ret.height = 4;
- }
- return ret;
- }
-
- /**
- * {@inheritDoc}
- */
- public Dimension preferredLayoutSize(Container parent) {
- JLayer layer = (JLayer) parent;
- Insets insets = layer.getInsets();
- Dimension ret = new Dimension(insets.left + insets.right,
- insets.top + insets.bottom);
- Component view = layer.getView();
- if (view != null) {
- Dimension size = view.getPreferredSize();
- if (size.width > 0 && size.height > 0) {
- ret.width += size.width;
- ret.height += size.height;
- }
- }
- return ret;
- }
-
- /**
- * {@inheritDoc}
- */
- public void addLayoutComponent(String name, Component comp) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeLayoutComponent(Component comp) {
- }
- }
}
--- a/jdk/src/share/classes/javax/swing/JTable.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/JTable.java Mon Oct 04 14:38:14 2010 -0700
@@ -4574,9 +4574,8 @@
* @see TableColumnModelListener
*/
public void columnMoved(TableColumnModelEvent e) {
- // If I'm currently editing, then I should stop editing
- if (isEditing()) {
- removeEditor();
+ if (isEditing() && !getCellEditor().stopCellEditing()) {
+ getCellEditor().cancelCellEditing();
}
repaint();
}
@@ -4593,8 +4592,8 @@
* @see TableColumnModelListener
*/
public void columnMarginChanged(ChangeEvent e) {
- if (isEditing()) {
- removeEditor();
+ if (isEditing() && !getCellEditor().stopCellEditing()) {
+ getCellEditor().cancelCellEditing();
}
TableColumn resizingColumn = getResizingColumn();
// Need to do this here, before the parent's
--- a/jdk/src/share/classes/javax/swing/ToolTipManager.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/ToolTipManager.java Mon Oct 04 14:38:14 2010 -0700
@@ -459,7 +459,7 @@
if (insideComponent == null) {
// Drag exit
}
- if (window != null && event.getSource() == window) {
+ if (window != null && event.getSource() == window && insideComponent != null) {
// if we get an exit and have a heavy window
// we need to check if it if overlapping the inside component
Container insideComponentWindow = insideComponent.getTopLevelAncestor();
--- a/jdk/src/share/classes/javax/swing/plaf/LayerUI.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/LayerUI.java Mon Oct 04 14:38:14 2010 -0700
@@ -600,104 +600,6 @@
}
/**
- * Returns the preferred size of the viewport for a view component.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @return the preferred size of the viewport for a view component
- * @see Scrollable#getPreferredScrollableViewportSize()
- */
- public Dimension getPreferredScrollableViewportSize(JLayer<? extends V> l) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getPreferredScrollableViewportSize();
- }
- return l.getPreferredSize();
- }
-
- /**
- * Returns a scroll increment, which is required for components
- * that display logical rows or columns in order to completely expose
- * one block of rows or columns, depending on the value of orientation.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @param visibleRect The view area visible within the viewport
- * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
- * @param direction Less than zero to scroll up/left, greater than zero for down/right.
- * @return the "block" increment for scrolling in the specified direction
- * @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int)
- */
- public int getScrollableBlockIncrement(JLayer<? extends V> l,
- Rectangle visibleRect,
- int orientation, int direction) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableBlockIncrement(
- visibleRect,orientation, direction);
- }
- return (orientation == SwingConstants.VERTICAL) ? visibleRect.height :
- visibleRect.width;
- }
-
- /**
- * Returns {@code false} to indicate that the height of the viewport does not
- * determine the height of the layer, unless the preferred height
- * of the layer is smaller than the height of the viewport.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @return whether the layer should track the height of the viewport
- * @see Scrollable#getScrollableTracksViewportHeight()
- */
- public boolean getScrollableTracksViewportHeight(JLayer<? extends V> l) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableTracksViewportHeight();
- }
- return false;
- }
-
- /**
- * Returns {@code false} to indicate that the width of the viewport does not
- * determine the width of the layer, unless the preferred width
- * of the layer is smaller than the width of the viewport.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @return whether the layer should track the width of the viewport
- * @see Scrollable
- * @see LayerUI#getScrollableTracksViewportWidth(JLayer)
- */
- public boolean getScrollableTracksViewportWidth(JLayer<? extends V> l) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableTracksViewportWidth();
- }
- return false;
- }
-
- /**
- * Returns a scroll increment, which is required for components
- * that display logical rows or columns in order to completely expose
- * one new row or column, depending on the value of orientation.
- * Ideally, components should handle a partially exposed row or column
- * by returning the distance required to completely expose the item.
- * <p>
- * Scrolling containers, like JScrollPane, will use this method
- * each time the user requests a unit scroll.
- *
- * @param l the {@code JLayer} component where this UI delegate is being installed
- * @param visibleRect The view area visible within the viewport
- * @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
- * @param direction Less than zero to scroll up/left, greater than zero for down/right.
- * @return The "unit" increment for scrolling in the specified direction.
- * This value should always be positive.
- * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
- */
- public int getScrollableUnitIncrement(JLayer<? extends V> l,
- Rectangle visibleRect,
- int orientation, int direction) {
- if (l.getView() instanceof Scrollable) {
- return ((Scrollable)l.getView()).getScrollableUnitIncrement(
- visibleRect, orientation, direction);
- }
- return 1;
- }
-
- /**
* If the {@code JLayer}'s view component is not {@code null},
* this calls the view's {@code getBaseline()} method.
* Otherwise, the default implementation is called.
@@ -718,7 +620,7 @@
/**
* If the {@code JLayer}'s view component is not {@code null},
- * this calls the view's {@code getBaselineResizeBehavior()} method.
+ * this returns the result of the view's {@code getBaselineResizeBehavior()} method.
* Otherwise, the default implementation is called.
*
* @param c {@code JLayer} to return baseline resize behavior for
@@ -732,4 +634,90 @@
}
return super.getBaselineResizeBehavior(c);
}
+
+ /**
+ * Causes the passed instance of {@code JLayer} to lay out its components.
+ *
+ * @param l the {@code JLayer} component where this UI delegate is being installed
+ */
+ public void doLayout(JLayer<? extends V> l) {
+ Component view = l.getView();
+ if (view != null) {
+ view.setBounds(0, 0, l.getWidth(), l.getHeight());
+ }
+ Component glassPane = l.getGlassPane();
+ if (glassPane != null) {
+ glassPane.setBounds(0, 0, l.getWidth(), l.getHeight());
+ }
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this returns the result of the view's {@code getPreferredSize()} method.
+ * Otherwise, the default implementation is used.
+ *
+ * @param c {@code JLayer} to return preferred size for
+ * @return preferred size for the passed {@code JLayer}
+ */
+ public Dimension getPreferredSize(JComponent c) {
+ JLayer l = (JLayer) c;
+ Component view = l.getView();
+ if (view != null) {
+ return view.getPreferredSize();
+ }
+ return super.getPreferredSize(c);
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this returns the result of the view's {@code getMinimalSize()} method.
+ * Otherwise, the default implementation is used.
+ *
+ * @param c {@code JLayer} to return preferred size for
+ * @return minimal size for the passed {@code JLayer}
+ */
+ public Dimension getMinimumSize(JComponent c) {
+ JLayer l = (JLayer) c;
+ Component view = l.getView();
+ if (view != null) {
+ return view.getMinimumSize();
+ }
+ return super.getMinimumSize(c);
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this returns the result of the view's {@code getMaximumSize()} method.
+ * Otherwise, the default implementation is used.
+ *
+ * @param c {@code JLayer} to return preferred size for
+ * @return maximun size for the passed {@code JLayer}
+ */
+ public Dimension getMaximumSize(JComponent c) {
+ JLayer l = (JLayer) c;
+ Component view = l.getView();
+ if (view != null) {
+ return view.getMaximumSize();
+ }
+ return super.getMaximumSize(c);
+ }
+
+ /**
+ * Adds the specified region to the dirty region list if the component
+ * is showing. The component will be repainted after all of the
+ * currently pending events have been dispatched.
+ * <p/>
+ * This method is to be overridden when the dirty region needs to be changed.
+ *
+ * @param tm this parameter is not used
+ * @param x the x value of the dirty region
+ * @param y the y value of the dirty region
+ * @param width the width of the dirty region
+ * @param height the height of the dirty region
+ * @see java.awt.Component#isShowing
+ * @see RepaintManager#addDirtyRegion
+ */
+ public void repaint(long tm, int x, int y, int width, int height, JLayer<? extends V> l) {
+ RepaintManager.currentManager(l).addDirtyRegion(l, x, y, width, height);
+ }
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java Mon Oct 04 14:38:14 2010 -0700
@@ -1603,6 +1603,7 @@
BoundedRangeModel newModel = (BoundedRangeModel)e.getNewValue();
oldModel.removeChangeListener(modelListener);
newModel.addChangeListener(modelListener);
+ scrollBarValue = scrollbar.getValue();
scrollbar.repaint();
scrollbar.revalidate();
} else if ("orientation" == propertyName) {
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Mon Oct 04 14:38:14 2010 -0700
@@ -144,7 +144,7 @@
*/
public int getBaseline(JComponent c, int width, int height) {
int baseline;
- if (MetalLookAndFeel.usingOcean()) {
+ if (MetalLookAndFeel.usingOcean() && height >= 4) {
height -= 4;
baseline = super.getBaseline(c, width, height);
if (baseline >= 0) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java Mon Oct 04 14:38:14 2010 -0700
@@ -115,6 +115,9 @@
return new SynthTabbedPaneUI();
}
+ private SynthTabbedPaneUI() {
+ }
+
private boolean scrollableTabLayoutEnabled() {
return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
}
--- a/jdk/src/share/classes/sun/util/locale/BaseLocale.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/share/classes/sun/util/locale/BaseLocale.java Mon Oct 04 14:38:14 2010 -0700
@@ -64,12 +64,14 @@
public static BaseLocale getInstance(String language, String script, String region, String variant) {
// JDK uses deprecated ISO639.1 language codes for he, yi and id
- if (AsciiUtil.caseIgnoreMatch(language, "he")) {
- language = "iw";
- } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
- language = "ji";
- } else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
- language = "in";
+ if (language != null) {
+ if (AsciiUtil.caseIgnoreMatch(language, "he")) {
+ language = "iw";
+ } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
+ language = "ji";
+ } else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
+ language = "in";
+ }
}
Key key = new Key(language, script, region, variant);
--- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c Mon Oct 04 14:38:14 2010 -0700
@@ -1473,6 +1473,10 @@
static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) {
/* mark that XIM server was destroyed */
X11im = NULL;
+ JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ /* free the old pX11IMData and set it to null. this also avoids crashing
+ * the jvm if the XIM server reappears */
+ X11InputMethodData *pX11IMData = getX11InputMethodData(env, currentX11InputMethodInstance);
}
/*
--- a/jdk/src/windows/lib/tzmappings Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/src/windows/lib/tzmappings Mon Oct 04 14:38:14 2010 -0700
@@ -1,5 +1,4 @@
#
-#
# This file describes mapping information between Windows and Java
# time zones.
# Format: Each line should include a colon separated fields of Windows
@@ -11,7 +10,7 @@
# NOTE
# This table format is not a public interface of any Java
# platforms. No applications should depend on this file in any form.
-#
+#
# This table has been generated by a program and should not be edited
# manually.
#
@@ -84,8 +83,8 @@
Ekaterinburg Standard Time:10,11::Asia/Yekaterinburg:
West Asia:10,11:UZ:Asia/Tashkent:
West Asia Standard Time:10,11:UZ:Asia/Tashkent:
-Central Asia:12,13::Asia/Dhaka:
-Central Asia Standard Time:12,13::Asia/Dhaka:
+Central Asia:12,13::Asia/Almaty:
+Central Asia Standard Time:12,13::Asia/Almaty:
N. Central Asia Standard Time:12,13::Asia/Novosibirsk:
Bangkok:14,15::Asia/Bangkok:
Bangkok Standard Time:14,15::Asia/Bangkok:
@@ -167,22 +166,27 @@
Greenwich Standard Time:88,89::GMT:
Argentina Standard Time:900,900::America/Buenos_Aires:
Azerbaijan Standard Time:901,901:AZ:Asia/Baku:
-Central Brazilian Standard Time:902,902:BR:America/Manaus:
-Central Standard Time (Mexico):903,903::America/Mexico_City:
-Georgian Standard Time:904,904:GE:Asia/Tbilisi:
-Jordan Standard Time:905,905:JO:Asia/Amman:
-Mauritius Standard Time:906,906:MU:Indian/Mauritius:
-Middle East Standard Time:907,907:LB:Asia/Beirut:
-Montevideo Standard Time:908,908:UY:America/Montevideo:
-Morocco Standard Time:909,909:MA:Africa/Casablanca:
-Mountain Standard Time (Mexico):910,910:MX:America/Chihuahua:
-Namibia Standard Time:911,911:NA:Africa/Windhoek:
-Pacific Standard Time (Mexico):912,912:MX:America/Tijuana:
-Pakistan Standard Time:913,913::Asia/Karachi:
-UTC:914,914::UTC:
-Venezuela Standard Time:915,915::America/Caracas:
-Kamchatka Standard Time:916,916:RU:Asia/Kamchatka:
-Paraguay Standard Time:917,917:PY:America/Asuncion:
-Western Brazilian Standard Time:918,918:BR:America/Rio_Branco:
-Ulaanbaatar Standard Time:919,919::Asia/Ulaanbaatar:
-Armenian Standard Time:920,920:AM:Asia/Yerevan:
+Bangladesh Standard Time:902,902::Asia/Dhaka:
+Central Brazilian Standard Time:903,903:BR:America/Manaus:
+Central Standard Time (Mexico):904,904::America/Mexico_City:
+Georgian Standard Time:905,905:GE:Asia/Tbilisi:
+Jordan Standard Time:906,906:JO:Asia/Amman:
+Kamchatka Standard Time:907,907:RU:Asia/Kamchatka:
+Mauritius Standard Time:908,908:MU:Indian/Mauritius:
+Middle East Standard Time:909,909:LB:Asia/Beirut:
+Montevideo Standard Time:910,910:UY:America/Montevideo:
+Morocco Standard Time:911,911:MA:Africa/Casablanca:
+Mountain Standard Time (Mexico):912,912:MX:America/Chihuahua:
+Namibia Standard Time:913,913:NA:Africa/Windhoek:
+Pacific Standard Time (Mexico):914,914:MX:America/Tijuana:
+Pakistan Standard Time:915,915::Asia/Karachi:
+Paraguay Standard Time:916,916:PY:America/Asuncion:
+Syria Standard Time:917,917:SY:Asia/Damascus:
+UTC:918,918::UTC:
+UTC+12:919,919::GMT+1200:
+UTC-02:920,920::GMT-0200:
+UTC-11:921,921::GMT-1100:
+Ulaanbaatar Standard Time:922,922::Asia/Ulaanbaatar:
+Venezuela Standard Time:923,923::America/Caracas:
+Western Brazilian Standard Time:924,924:BR:America/Rio_Branco:
+Armenian Standard Time:925,925:AM:Asia/Yerevan:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/6976577/Test6976577.java Mon Oct 04 14:38:14 2010 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6976577
+ * @summary Tests public methods in non-public beans
+ * @author Sergey Malenkov
+ */
+
+import test.Accessor;
+
+import java.beans.EventSetDescriptor;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+
+public class Test6976577 {
+
+ public static void main(String[] args) throws Exception {
+ Class<?> bt = Accessor.getBeanType();
+ Class<?> lt = Accessor.getListenerType();
+
+ // test PropertyDescriptor
+ PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
+ test(pd.getReadMethod());
+ test(pd.getWriteMethod());
+
+ // test IndexedPropertyDescriptor
+ IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
+ test(ipd.getReadMethod());
+ test(ipd.getWriteMethod());
+ test(ipd.getIndexedReadMethod());
+ test(ipd.getIndexedWriteMethod());
+
+ // test EventSetDescriptor
+ EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
+ test(esd.getAddListenerMethod());
+ test(esd.getRemoveListenerMethod());
+ test(esd.getGetListenerMethod());
+ test(esd.getListenerMethods());
+ }
+
+ private static void test(Method... methods) {
+ for (Method method : methods) {
+ if (method == null) {
+ throw new Error("public method is not found");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/6976577/test/Accessor.java Mon Oct 04 14:38:14 2010 -0700
@@ -0,0 +1,81 @@
+package test;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.EventListener;
+import java.util.TooManyListenersException;
+
+public class Accessor {
+
+ public static Class<?> getBeanType() {
+ return Bean.class;
+ }
+
+ public static Class<?> getListenerType() {
+ return TestListener.class;
+ }
+}
+
+interface TestEvent {
+}
+
+interface TestListener extends EventListener {
+ void process(TestEvent event);
+}
+
+class Bean {
+
+ private boolean b;
+ private int[] indexed;
+ private TestListener listener;
+ private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ this.pcs.addPropertyChangeListener(listener);
+ }
+
+ public void addTestListener(TestListener listener) throws TooManyListenersException {
+ if (listener != null) {
+ if (this.listener != null) {
+ throw new TooManyListenersException();
+ }
+ this.listener = listener;
+ }
+ }
+
+ public void removeTestListener(TestListener listener) {
+ if (this.listener == listener) {
+ this.listener = null;
+ }
+ }
+
+ public TestListener[] getTestListeners() {
+ return (this.listener != null)
+ ? new TestListener[] { this.listener }
+ : new TestListener[0];
+ }
+
+ public boolean isBoolean() {
+ return this.b;
+ }
+
+ public void setBoolean(boolean b) {
+ this.b = b;
+ }
+
+ public int[] getIndexed() {
+ return this.indexed;
+ }
+
+ public void setIndexed(int[] values) {
+ this.indexed = values;
+ }
+
+ public int getIndexed(int index) {
+ return this.indexed[index];
+ }
+
+ public void setIndexed(int index, int value) {
+ this.indexed[index] = value;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/6632953/bug6632953.java Mon Oct 04 14:38:14 2010 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6632953
+ * @summary MetalComboBoxUI.getBaseline(JComponent, int, int) throws IAE for valid width/height
+ * @author Alexander Potochkin
+ */
+
+import javax.swing.JComboBox;
+import javax.swing.plaf.metal.MetalComboBoxUI;
+
+public class bug6632953 {
+
+ public static void main(String... args) throws Exception {
+ MetalComboBoxUI ui = new MetalComboBoxUI();
+ ui.installUI(new JComboBox());
+ ui.getBaseline(new JComboBox(), 0, 0);
+ ui.getBaseline(new JComboBox(), 1, 1);
+ ui.getBaseline(new JComboBox(), 2, 2);
+ ui.getBaseline(new JComboBox(), 3, 3);
+ ui.getBaseline(new JComboBox(), 4, 4);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollBar/6542335/bug6542335.java Mon Oct 04 14:38:14 2010 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 6542335
+ @summary different behavior on knob of scroll bar between 1.4.2 and 5.0
+ @author Alexander Potochkin
+ @run main bug6542335
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicScrollBarUI;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug6542335 {
+ private static JScrollBar sb;
+ private static MyScrollBarUI ui;
+
+ public static void main(String[] args) throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(10);
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final JFrame frame = new JFrame("bug6542335");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ sb = new JScrollBar(0, 0, 1, 0, 1);
+
+ ui = new MyScrollBarUI();
+ sb.setUI(ui);
+
+ sb.setPreferredSize(new Dimension(200, 17));
+ DefaultBoundedRangeModel rangeModel = new DefaultBoundedRangeModel();
+ rangeModel.setMaximum(100);
+ rangeModel.setMinimum(0);
+ rangeModel.setExtent(50);
+ rangeModel.setValue(50);
+
+ sb.setModel(rangeModel);
+ frame.add(sb);
+
+ frame.setSize(200, 100);
+ frame.setVisible(true);
+ }
+ });
+
+ Rectangle thumbBounds = new Rectangle(ui.getThumbBounds());
+
+ toolkit.realSync();
+ Point l = sb.getLocationOnScreen();
+ robot.mouseMove(l.x + (int) (0.75 * sb.getWidth()), l.y + sb.getHeight()/2);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (!thumbBounds.equals(ui.getThumbBounds())) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static class MyScrollBarUI extends BasicScrollBarUI {
+ public Rectangle getThumbBounds() {
+ return super.getThumbBounds();
+ }
+ }
+}
--- a/jdk/test/javax/swing/JTable/Test6888156.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/test/javax/swing/JTable/Test6888156.java Mon Oct 04 14:38:14 2010 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,14 +71,14 @@
table = new JTable(model);
}
- public void test(final LookAndFeel laf) throws Exception {
+ public void test(final String laf) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
try {
+ System.out.println(laf);
UIManager.setLookAndFeel(laf);
- } catch (UnsupportedLookAndFeelException e) {
- System.err.println(laf.getDescription() +
- " is unsupported; continuing");
+ } catch (Exception e) {
+ System.err.println(laf + " is unsupported; continuing");
return;
}
SwingUtilities.updateComponentTreeUI(table);
@@ -92,8 +92,10 @@
public static void main(String[] args) throws Exception {
Test6888156 t = new Test6888156();
- t.test(new javax.swing.plaf.nimbus.NimbusLookAndFeel());
- t.test(new com.sun.java.swing.plaf.gtk.GTKLookAndFeel());
+ t.test("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+ t.test("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+ for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
+ t.test(laf.getClassName());
+ }
}
}
-
--- a/jdk/test/javax/swing/JTextArea/6940863/bug6940863.java Mon Oct 04 14:36:45 2010 -0700
+++ b/jdk/test/javax/swing/JTextArea/6940863/bug6940863.java Mon Oct 04 14:38:14 2010 -0700
@@ -56,6 +56,7 @@
public static void main(String[] args) throws Exception {
if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
System.out.println("The test is suitable only for Windows OS. Skipped");
+ return;
}
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");