1 13 14 package more_for_test; 15 16 import java.beans.*; 17 18 22 public class TestBean extends Object implements java.io.Serializable { 23 24 private static final String PROP_SAMPLE_PROPERTY = "SampleProperty"; 25 26 private String sampleProperty; 27 28 private PropertyChangeSupport propertySupport; 29 30 31 public TestBean() { 32 propertySupport = new PropertyChangeSupport( this ); 33 } 34 35 public String getSampleProperty() { 36 return sampleProperty; 37 } 38 39 public void setSampleProperty(String value) { 40 String oldValue = sampleProperty; 41 sampleProperty = value; 42 propertySupport.firePropertyChange(PROP_SAMPLE_PROPERTY, oldValue, sampleProperty); 43 } 44 45 46 public void addPropertyChangeListener(PropertyChangeListener listener) { 47 propertySupport.addPropertyChangeListener(listener); 48 } 49 50 public void removePropertyChangeListener(PropertyChangeListener listener) { 51 propertySupport.removePropertyChangeListener(listener); 52 } 53 54 } 55 | Popular Tags |