1 package fr.ifremer.reefdb.ui.swing.content.manage.referential.pmfm.parameter.local.replace;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 import fr.ifremer.reefdb.ui.swing.util.AbstractReefDbUIHandler;
27 import jaxx.runtime.validator.swing.SwingValidator;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30 import org.nuiton.jaxx.application.swing.util.Cancelable;
31
32 import javax.swing.*;
33
34
35
36
37
38
39 public class ReplaceParameterUIHandler extends AbstractReefDbUIHandler<ReplaceParameterUIModel, ReplaceParameterUI> implements Cancelable {
40
41
42
43
44 private static final Log log =
45 LogFactory.getLog(ReplaceParameterUIHandler.class);
46
47
48 @Override
49 public void afterInit(ReplaceParameterUI ui) {
50
51 initUI(ui);
52
53 ReplaceParameterUIModel model = getModel();
54 initBeanFilterableComboBox(ui.getSourceListComboBox(), model.getSourceList(), model.getSelectedSource(), model.getDecoratorContext());
55 initBeanFilterableComboBox(ui.getTargetListComboBox(), model.getTargetList(), model.getSelectedTarget(), model.getDecoratorContext());
56
57 SwingValidator validator = ui.getValidator();
58 listenValidatorValid(validator, model);
59
60 registerValidators(validator);
61 }
62
63
64 @Override
65 protected JComponent getComponentToFocus() {
66 return getUI().getSourceListComboBox();
67 }
68
69
70 @Override
71 @SuppressWarnings("unchecked")
72 public SwingValidator getValidator() {
73 return ui.getValidator();
74 }
75
76
77 @Override
78 public void cancel() {
79 getModel().setValid(false);
80 onCloseUI();
81 }
82
83 }