Java Doc for ChangeTracker.java in  » Swing-Library » jgoodies-data-binding » com » jgoodies » binding » util » 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.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jgoodies.binding.beans.Model
      com.jgoodies.binding.util.ChangeTracker

ChangeTracker
final public class ChangeTracker extends Model (Code)
Tracks changes in a set of bound bean properties. The tracker itself provides a read-only bound bean property changed that indicates whether one of the observed properties has changed. The changed state can be reset to false using #reset.

The tracker can observe readable bound bean properties if and only if the bean provides the optional support for listening on named properties as described in section 7.4.5 of the Java Bean Specification. The bean class must provide the following pair of methods:

 public void addPropertyChangeListener(String name, PropertyChangeListener l);
 public void removePropertyChangeListener(String name, PropertyChangeListener l);
 

Example:

 ChangeTracker tracker = new ChangeTracker();
 tracker.observe(address, "street");
 tracker.observe(address, "city");
 tracker.addPropertyChangeListener(new PropertyChangeListener() {
 public void propertyChange(PropertyChangeEvent evt) {
 System.out.println("Change state: " + evt.getNewValue());
 }
 });
 // Change the first ValueModel
 System.out.println(tracker.isChanged()); // Prints "false"
 address.setStreet("Belsenplatz");        // Prints "Change state: true"
 System.out.println(tracker.isChanged()); // Prints "true"
 tracker.reset();                         // Prints "Change state: false"
 System.out.println(tracker.isChanged()); // Prints "false"
 

Note: The classes BeanAdapter and PresentationModel already provide support for tracking changes. Typical binding code can use these classes and there seems to be no need to use the ChangeTracker.
author:
   Karsten Lentzsch
version:
   $Revision: 1.3 $
See Also:   ValueModel



Field Summary
final public static  StringPROPERTYNAME_CHANGED
     The name of the read-only bound bean property that indicates whether one of the observed properties has changed.

Constructor Summary
public  ChangeTracker()
     Constructs a change tracker with change state set to false.

Method Summary
public  booleanisChanged()
     Answers whether one of the registered ValueModels has changed since this tracker has been reset last time.
public  voidobserve(Object bean, String propertyName)
     Observes the specified readable bound bean property in the given bean.
public  voidobserve(ValueModel valueModel)
     Observes value changes in the given ValueModel.
public  voidreset()
     Resets this tracker's changed state to false.
public  voidretractInterestFor(Object bean, String propertyName)
     Retracts interest for the specified readable bound bean property in the given bean.
public  voidretractInterestFor(ValueModel valueModel)
     Retracts interest for value changes in the given ValueModel.

Field Detail
PROPERTYNAME_CHANGED
final public static String PROPERTYNAME_CHANGED(Code)
The name of the read-only bound bean property that indicates whether one of the observed properties has changed.
See Also:   ChangeTracker.isChanged()




Constructor Detail
ChangeTracker
public ChangeTracker()(Code)
Constructs a change tracker with change state set to false.




Method Detail
isChanged
public boolean isChanged()(Code)
Answers whether one of the registered ValueModels has changed since this tracker has been reset last time. true if an observed property has changed since the last reset



observe
public void observe(Object bean, String propertyName)(Code)
Observes the specified readable bound bean property in the given bean.
Parameters:
  bean - the bean to be observed
Parameters:
  propertyName - the name of the readable bound bean property
throws:
  NullPointerException - if the bean or propertyName is null
throws:
  PropertyNotBindableException - if this tracker can't addthe PropertyChangeListener from the bean
See Also:   ChangeTracker.retractInterestFor(Object,String)



observe
public void observe(ValueModel valueModel)(Code)
Observes value changes in the given ValueModel.
Parameters:
  valueModel - the ValueModel to observe
throws:
  NullPointerException - if the valueModel is null
See Also:   ChangeTracker.retractInterestFor(ValueModel)



reset
public void reset()(Code)
Resets this tracker's changed state to false.



retractInterestFor
public void retractInterestFor(Object bean, String propertyName)(Code)
Retracts interest for the specified readable bound bean property in the given bean.
Parameters:
  bean - the bean to be observed
Parameters:
  propertyName - the name of the readable bound bean property
throws:
  NullPointerException - if the bean or propertyName is null
throws:
  PropertyNotBindableException - if this tracker can't removethe PropertyChangeListener from the bean
See Also:   ChangeTracker.observe(Object,String)



retractInterestFor
public void retractInterestFor(ValueModel valueModel)(Code)
Retracts interest for value changes in the given ValueModel.
Parameters:
  valueModel - the ValueModel to observe
throws:
  NullPointerException - if the valueModel is null
See Also:   ChangeTracker.retractInterestFor(ValueModel)



Methods inherited from com.jgoodies.binding.beans.Model
final public synchronized void addPropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
final public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc)
final public synchronized void addVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc)
final public synchronized void addVetoableChangeListener(String propertyName, VetoableChangeListener listener)(Code)(Java Doc)
final protected boolean equals(Object o1, Object o2)(Code)(Java Doc)
final protected void fireIndexedPropertyChange(String propertyName, int index, Object oldValue, Object newValue)(Code)(Java Doc)
final protected void fireIndexedPropertyChange(String propertyName, int index, int oldValue, int newValue)(Code)(Java Doc)
final protected void fireIndexedPropertyChange(String propertyName, int index, boolean oldValue, boolean newValue)(Code)(Java Doc)
final protected void fireMultiplePropertiesChanged()(Code)(Java Doc)
final protected void firePropertyChange(PropertyChangeEvent event)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, Object oldValue, Object newValue, boolean checkIdentity)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, double oldValue, double newValue)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, float oldValue, float newValue)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, int oldValue, int newValue)(Code)(Java Doc)
final protected void firePropertyChange(String propertyName, long oldValue, long newValue)(Code)(Java Doc)
final protected void fireVetoableChange(PropertyChangeEvent event) throws PropertyVetoException(Code)(Java Doc)
final protected void fireVetoableChange(String propertyName, Object oldValue, Object newValue) throws PropertyVetoException(Code)(Java Doc)
final protected void fireVetoableChange(String propertyName, boolean oldValue, boolean newValue) throws PropertyVetoException(Code)(Java Doc)
final protected void fireVetoableChange(String propertyName, double oldValue, double newValue) throws PropertyVetoException(Code)(Java Doc)
final protected void fireVetoableChange(String propertyName, int oldValue, int newValue) throws PropertyVetoException(Code)(Java Doc)
final protected void fireVetoableChange(String propertyName, float oldValue, float newValue) throws PropertyVetoException(Code)(Java Doc)
final protected void fireVetoableChange(String propertyName, long oldValue, long newValue) throws PropertyVetoException(Code)(Java Doc)
final public synchronized PropertyChangeListener[] getPropertyChangeListeners()(Code)(Java Doc)
final public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)(Code)(Java Doc)
final public synchronized VetoableChangeListener[] getVetoableChangeListeners()(Code)(Java Doc)
final public synchronized VetoableChangeListener[] getVetoableChangeListeners(String propertyName)(Code)(Java Doc)
final public synchronized void removePropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
final public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)(Code)(Java Doc)
final public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)(Code)(Java Doc)
final public synchronized void removeVetoableChangeListener(String propertyName, VetoableChangeListener 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.