[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: JComponent.putClientProperty
From: |
David Gilbert |
Subject: |
[cp-patches] FYI: JComponent.putClientProperty |
Date: |
Mon, 12 Sep 2005 23:22:43 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050728) |
The putClientProperty() method in JComponent should fire a property change event
describing the new (or cleared) property. I added a test in Mauve for this, and
committed this patch to make it work:
2005-09-12 David Gilbert <address@hidden>
* javax/swing/JComponent.java
(putClientProperty): fire property change event.
Regards,
Dave Gilbert
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.56
diff -u -r1.56 JComponent.java
--- javax/swing/JComponent.java 15 Aug 2005 19:50:37 -0000 1.56
+++ javax/swing/JComponent.java 12 Sep 2005 22:18:34 -0000
@@ -452,7 +452,9 @@
/**
* Add a client property <code>value</code> to this component, associated
* with <code>key</code>. If there is an existing client property
- * associated with <code>key</code>, it will be replaced.
+ * associated with <code>key</code>, it will be replaced. A
+ * address@hidden PropertyChangeEvent} is sent to registered listeners (with
the
+ * name of the property being <code>key.toString()</code>).
*
* @param key The key of the client property association to add
* @param value The value of the client property association to add
@@ -463,10 +465,13 @@
*/
public final void putClientProperty(Object key, Object value)
{
+ Hashtable t = getClientProperties();
+ Object old = t.get(key);
if (value != null)
- getClientProperties().put(key, value);
+ t.put(key, value);
else
- getClientProperties().remove(key);
+ t.remove(key);
+ firePropertyChange(key.toString(), old, value);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: JComponent.putClientProperty,
David Gilbert <=