1   /*
2    * Copyright 2002-2004 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package org.springframework.binding.support;
17  
18  import java.beans.PropertyChangeListener;
19  
20  import org.springframework.binding.value.PropertyChangePublisher;
21  import org.springframework.binding.value.support.PropertyChangeSupport;
22  
23  /**
24   * @author Oliver Hutchison
25   */
26  public class TestBeanWithPCP implements PropertyChangePublisher {
27      private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
28      
29      private Object boundProperty;
30      
31      public Object getBoundProperty() {
32          return boundProperty;
33      }
34      
35      public void setBoundProperty(Object boundProperty) {
36          Object oldBoundProperty = this.boundProperty;
37          this.boundProperty = boundProperty;
38          pcs.firePropertyChange("boundProperty", oldBoundProperty, boundProperty);
39      }
40      
41      public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) {
42          return pcs.getPropertyChangeListeners(propertyName);
43      }
44  
45      public void addPropertyChangeListener(PropertyChangeListener listener) {
46          pcs.addPropertyChangeListener(listener);        
47      }
48  
49      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
50          pcs.addPropertyChangeListener(propertyName, listener);        
51      }
52  
53      public void removePropertyChangeListener(PropertyChangeListener listener) {
54          pcs.removePropertyChangeListener(listener);        
55      }
56  
57      public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
58          pcs.removePropertyChangeListener(propertyName, listener);        
59      }
60  }