Java Doc for ExtendedPropertyChangeSupport.java in  » Swing-Library » jgoodies-data-binding » com » jgoodies » binding » beans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jgoodies data binding » com.jgoodies.binding.beans 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.beans.PropertyChangeSupport
      com.jgoodies.binding.beans.ExtendedPropertyChangeSupport

ExtendedPropertyChangeSupport
final public class ExtendedPropertyChangeSupport extends PropertyChangeSupport (Code)
Differs from its superclass PropertyChangeSupport in that it can check for changed values using #equals or ==. Useful if you want to ensure that a PropertyChangeEvent is fired if the old and new value are not the same but if they are equal.

The Java Bean Specification recommends to not throw a PropertyChangeEvent if the old and new value of a bound Bean property are equal (see chapter 7.4.4). This can reduce the number of events fired and helps avoid loops. Nevertheless a bound property may fire an event if the old and new value are equal.

An example for a condition where the identity check == is required and the #equals test fails is class com.jgoodies.binding.list.SelectionInList . If the contained ListModel changes its value, an internal listener is removed from the old value and added to the new value. The listener must be moved from the old instance to the new instance even if these are equal. The PropertyChangeSupport doesn't fire a property change event if such a ListModel is implemented as a java.util.List . This is because instances of List are equal if and only if all list members are equal and if they are in the same sequence.

This class provides two means to fire an event if the old and new value are equal but not the same. First, you enable the identity check in constructor ExtendedPropertyChangeSupport.ExtendedPropertyChangeSupport(Object,boolean) . By default all calls to #firePropertyChange will then check the identity, not the equality. Second, you can invoke ExtendedPropertyChangeSupport.firePropertyChange(PropertyChangeEvent,boolean) or ExtendedPropertyChangeSupport.firePropertyChange(String,Object,Object,boolean) and enable or disable the identity check for this call only.

TODO: (Issue #5) Use WeakReferences to refer to registered listeners.

TODO: (Issue #6) Add an optional check for valid property name when adding a listener for a specific property.

TODO: (Issue #7) Add an optional strict check for existing property names when firing a named property change.

TODO: (Issue #8) Add an option to ensure that update notifications are performed in the event dispatch thread. In case a bean is changed in a thread other than the event dispatch thread, such a feature would help complying with Swing's single thread rule.

TODO: (Issue #11) Consider adding an option that saves update notifications if 'checkIdentity' is true but the value types can be compared safely via #equals, for example Strings, Booleans and Numbers.
author:
   Mattias Neuling
author:
   Karsten Lentzsch
version:
   $Revision: 1.8 $
See Also:   PropertyChangeSupport
See Also:   PropertyChangeEvent
See Also:   PropertyChangeListener
See Also:   Object.equals(Object)
See Also:   java.util.List.equals(Object)




Constructor Summary
public  ExtendedPropertyChangeSupport(Object sourceBean)
     Constructs an ExtendedPropertyChangeSupport object.
public  ExtendedPropertyChangeSupport(Object sourceBean, boolean checkIdentityDefault)
     Constructs an ExtendedPropertyChangeSupport object with the specified default test method for differences between the old and new property values.

Method Summary
public  voidfirePropertyChange(PropertyChangeEvent evt)
     Fires the specified PropertyChangeEvent to any registered listeners. Uses the default test (#equals vs.
public  voidfirePropertyChange(String propertyName, Object oldValue, Object newValue)
     Reports a bound property update to any registered listeners. Uses the default test (#equals vs.
public  voidfirePropertyChange(PropertyChangeEvent evt, boolean checkIdentity)
     Fires an existing PropertyChangeEvent to any registered listeners.
public  voidfirePropertyChange(String propertyName, Object oldValue, Object newValue, boolean checkIdentity)
     Reports a bound property update to any registered listeners. No event is fired if the old and new value are the same. If checkIdentity is true an event is fired in all other cases.


Constructor Detail
ExtendedPropertyChangeSupport
public ExtendedPropertyChangeSupport(Object sourceBean)(Code)
Constructs an ExtendedPropertyChangeSupport object.
Parameters:
  sourceBean - The bean to be given as the source for any events.



ExtendedPropertyChangeSupport
public ExtendedPropertyChangeSupport(Object sourceBean, boolean checkIdentityDefault)(Code)
Constructs an ExtendedPropertyChangeSupport object with the specified default test method for differences between the old and new property values.
Parameters:
  sourceBean - The object provided as the source for any generated events.
Parameters:
  checkIdentityDefault - true enables the identity check by default




Method Detail
firePropertyChange
public void firePropertyChange(PropertyChangeEvent evt)(Code)
Fires the specified PropertyChangeEvent to any registered listeners. Uses the default test (#equals vs. ==) to determine whether the event's old and new values are different. No event is fired if old and new value are the same.
Parameters:
  evt - The PropertyChangeEvent object.
See Also:   PropertyChangeSupport.firePropertyChange(PropertyChangeEvent)



firePropertyChange
public void firePropertyChange(String propertyName, Object oldValue, Object newValue)(Code)
Reports a bound property update to any registered listeners. Uses the default test (#equals vs. ==) to determine whether the event's old and new values are different. No event is fired if old and new value are the same.
Parameters:
  propertyName - The programmatic name of the propertythat was changed.
Parameters:
  oldValue - The old value of the property.
Parameters:
  newValue - The new value of the property.
See Also:   PropertyChangeSupport.firePropertyChange(StringObjectObject)



firePropertyChange
public void firePropertyChange(PropertyChangeEvent evt, boolean checkIdentity)(Code)
Fires an existing PropertyChangeEvent to any registered listeners. The boolean parameter specifies whether differences between the old and new value are tested using == or #equals. No event is fired if old and new value are the same.
Parameters:
  evt - The PropertyChangeEvent object.
Parameters:
  checkIdentity - true to check differences using ==false to use #equals.



firePropertyChange
public void firePropertyChange(String propertyName, Object oldValue, Object newValue, boolean checkIdentity)(Code)
Reports a bound property update to any registered listeners. No event is fired if the old and new value are the same. If checkIdentity is true an event is fired in all other cases. If this parameter is false, an event is fired if old and new values are not equal.
Parameters:
  propertyName - The programmatic name of the propertythat was changed.
Parameters:
  oldValue - The old value of the property.
Parameters:
  newValue - The new value of the property.
Parameters:
  checkIdentity - true to check differences using ==false to use #equals.



Methods inherited from java.beans.PropertyChangeSupport
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc)
public void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue)(Code)(Java Doc)
public void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue)(Code)(Java Doc)
public void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, Object oldValue, Object newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc)
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc)
public void firePropertyChange(PropertyChangeEvent evt)(Code)(Java Doc)
public synchronized PropertyChangeListener[] getPropertyChangeListeners()(Code)(Java Doc)
public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)(Code)(Java Doc)
public synchronized boolean hasListeners(String propertyName)(Code)(Java Doc)
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.