1 56 package org.objectstyle.cayenne.swing; 57 58 import java.awt.Component ; 59 import java.awt.event.ActionEvent ; 60 import java.awt.event.ActionListener ; 61 62 import javax.swing.AbstractButton ; 63 64 67 public class ActionBinding extends BindingBase { 68 69 protected Component view; 70 71 public ActionBinding(AbstractButton button, String propertyExpression) { 72 super(propertyExpression); 73 74 button.addActionListener(new ActionListener () { 75 76 public void actionPerformed(ActionEvent e) { 77 fireAction(); 78 } 79 }); 80 81 this.view = button; 82 } 83 84 public Component getView() { 85 if (view == null) { 86 throw new BindingException("headless action"); 87 } 88 89 return view; 90 } 91 92 public void updateView() { 93 } 95 96 protected void fireAction() { 97 getValue(); 99 } 100 } | Popular Tags |