1 56 package org.objectstyle.cayenne.swing; 57 58 import java.awt.Component ; 59 import java.beans.PropertyChangeEvent ; 60 import java.beans.PropertyChangeListener ; 61 62 68 public class PropertyBinding extends BindingBase { 69 70 protected BoundComponent boundComponent; 71 protected String boundExpression; 72 73 public PropertyBinding(BoundComponent boundComponent, String propertyExpression, 74 String boundExpression) { 75 super(propertyExpression); 76 77 this.boundExpression = boundExpression; 78 this.boundComponent = boundComponent; 79 this.boundComponent.addPropertyChangeListener(boundExpression, 80 new PropertyChangeListener () { 81 82 public void propertyChange(PropertyChangeEvent event) { 83 setValue(event.getNewValue()); 84 } 85 86 }); 87 } 88 89 public Component getView() { 90 return boundComponent.getView(); 91 } 92 93 public void updateView() { 94 boundComponent.bindingUpdated(boundExpression, getValue()); 95 } 96 } | Popular Tags |