summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2005-11-14 12:50:01 +0000
committerRoman Kennke <roman@kennke.org>2005-11-14 12:50:01 +0000
commit5a252d6a953d6943afed5cbe6541b2b24a1f7778 (patch)
treec92aebc135d6b3de857b43269088c9467bc1f619
parenta06ead23f3c128fa508c0cad8f952eeadfc65f0e (diff)
downloadclasspath-5a252d6a953d6943afed5cbe6541b2b24a1f7778.tar.gz
2005-11-14 Roman Kennke <kennke@aicas.com>
* javax/swing/RepaintManager.java (globalManager): Removed obsolete field. (currentRepaintManagers): New field. (RepaintWorker.run): Fetch current RepaintManager for the current thread group. (currentManager): Return the current manager for the current thread group. (setCurrentManager): Set the repaint manager for the current thread group.
-rw-r--r--ChangeLog12
-rw-r--r--javax/swing/RepaintManager.java74
2 files changed, 57 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index cad753f49..6b111ae7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2005-11-14 Roman Kennke <kennke@aicas.com>
+ * javax/swing/RepaintManager.java
+ (globalManager): Removed obsolete field.
+ (currentRepaintManagers): New field.
+ (RepaintWorker.run): Fetch current RepaintManager for the current
+ thread group.
+ (currentManager): Return the current manager for the current thread
+ group.
+ (setCurrentManager): Set the repaint manager for the current thread
+ group.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
* javax/swing/plaf/basic/BasicComboPopup.java
(show): Instead of fiddling with the list size, set the preferredSize
of the scroller.
diff --git a/javax/swing/RepaintManager.java b/javax/swing/RepaintManager.java
index 37281e03d..b857b1261 100644
--- a/javax/swing/RepaintManager.java
+++ b/javax/swing/RepaintManager.java
@@ -65,7 +65,11 @@ import java.util.Iterator;
*/
public class RepaintManager
{
-
+ /**
+ * The current repaint managers, indexed by their ThreadGroups.
+ */
+ static HashMap currentRepaintManagers;
+
/**
* <p>A helper class which is placed into the system event queue at
* various times in order to facilitate repainting and layout. There is
@@ -102,7 +106,9 @@ public class RepaintManager
public void run()
{
- RepaintManager rm = RepaintManager.globalManager;
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ RepaintManager rm =
+ (RepaintManager) currentRepaintManagers.get(threadGroup);
setLive(false);
rm.validateInvalidComponents();
rm.paintDirtyRegions();
@@ -249,16 +255,6 @@ public class RepaintManager
/**
- * The global, shared RepaintManager instance. This is reused for all
- * components in all windows. This is package-private to avoid an accessor
- * method.
- *
- * @see #currentManager(JComponent)
- * @see #setCurrentManager
- */
- static RepaintManager globalManager;
-
- /**
* Create a new RepaintManager object.
*/
public RepaintManager()
@@ -275,31 +271,46 @@ public class RepaintManager
}
/**
- * Get the value of the shared {@link #globalManager} instance, possibly
- * returning a special manager associated with the specified
- * component. The default implementaiton ignores the component parameter.
+ * Returns the <code>RepaintManager</code> for the current thread's
+ * thread group. The default implementation ignores the
+ * <code>component</code> parameter and returns the same repaint manager
+ * for all components.
*
- * @param component A component to look up the manager of
+ * @param component a component to look up the manager of
*
- * @return The current repaint manager
+ * @return the current repaint manager for the calling thread's thread group
+ * and the specified component
*
* @see #setCurrentManager
*/
public static RepaintManager currentManager(Component component)
{
- if (globalManager == null)
- globalManager = new RepaintManager();
- return globalManager;
+ if (currentRepaintManagers == null)
+ currentRepaintManagers = new HashMap();
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ RepaintManager currentManager =
+ (RepaintManager) currentRepaintManagers.get(threadGroup);
+ if (currentManager == null)
+ {
+ currentManager = new RepaintManager();
+ currentRepaintManagers.put(threadGroup, currentManager);
+ }
+ return currentManager;
}
/**
- * Get the value of the shared {@link #globalManager} instance, possibly
- * returning a special manager associated with the specified
- * component. The default implementaiton ignores the component parameter.
+ * Returns the <code>RepaintManager</code> for the current thread's
+ * thread group. The default implementation ignores the
+ * <code>component</code> parameter and returns the same repaint manager
+ * for all components.
+ *
+ * This method is only here for backwards compatibility with older versions
+ * of Swing and simply forwards to {@link #currentManager(Component)}.
*
- * @param component A component to look up the manager of
+ * @param component a component to look up the manager of
*
- * @return The current repaint manager
+ * @return the current repaint manager for the calling thread's thread group
+ * and the specified component
*
* @see #setCurrentManager
*/
@@ -309,15 +320,20 @@ public class RepaintManager
}
/**
- * Set the value of the shared {@link #globalManager} instance.
+ * Sets the repaint manager for the calling thread's thread group.
*
- * @param manager The new value of the shared instance
+ * @param manager the repaint manager to set for the current thread's thread
+ * group
*
- * @see #currentManager(JComponent)
+ * @see #currentManager(Component)
*/
public static void setCurrentManager(RepaintManager manager)
{
- globalManager = manager;
+ if (currentRepaintManagers == null)
+ currentRepaintManagers = new HashMap();
+
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ currentRepaintManagers.put(threadGroup, manager);
}
/**