|
|
|
[
Permlink
| « Hide
]
Chris Blackburn - 19/Nov/07 06:16 PM
I have attached the patch I used to put in the instanceof JToggleButton. Pretty straight forward.
Chris,
The reason why there's no instanceof check is because both JCheckbox and JRadiobutton extend from JToggleButton. With the instanceof check, two events would get recorded for clicks on checkboxes and radio buttons: one from the ButtonClickRecorder, and the other from either the CheckBox or RadioButton recorders. Another way of solving this problem would be create a custom recorder and register it with FrankensteinIntegration: public class YourButtonClickRecorder extends AbstractComponentRecorder implements ActionListener { public YourButtonClickRecorder(EventRecorder recorder, NamingStrategy namingStrategy) { super(recorder, namingStrategy, YourCustomButton.class); } void componentShown(Component component) { button(component).addActionListener(this); } private YourCustomButton button(Component event) { return (YourCustomButton) event; } void componentHidden(Component component) { button(component).removeActionListener(this); } public void actionPerformed(ActionEvent e) { YourCustomButton button = button(e); recorder.record(new YourButtonEvent(componentName(button), new ClickAction())); } } |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||