01: package examples;
02:
03: import javax.swing.*;
04:
05: import net.ar.webonswing.managers.persistence.*;
06: import net.ar.webonswing.ui.*;
07:
08: public class RadioButtonPersistenceContributor extends
09: RadioButtonUIContributor {
10: public void doPersistenceContribution(
11: PersistenceContributionContainer aPersistenceManager) {
12: JRadioButton radioButton = (JRadioButton) getJComponent();
13: aPersistenceManager.persistValue(theComponent, new Boolean(
14: radioButton.isSelected()));
15: }
16:
17: public boolean isPersistedValueEqualToModel(
18: PersistenceContributionContainer aPersistenceManager) {
19: JRadioButton radioButton = (JRadioButton) getJComponent();
20: return radioButton.isSelected() == ((Boolean) aPersistenceManager
21: .restoreValue(theComponent)).booleanValue();
22: }
23:
24: public void restorePersistedValue(
25: PersistenceContributionContainer aPersistenceManager) {
26: JRadioButton radioButton = (JRadioButton) getJComponent();
27: radioButton.setSelected(((Boolean) aPersistenceManager
28: .restoreValue(theComponent)).booleanValue());
29: }
30: }
|