1 package fr.ifremer.dali.ui.swing.content.extraction;
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 com.google.common.collect.ImmutableList;
27 import fr.ifremer.dali.ui.swing.action.AbstractCheckModelAction;
28 import fr.ifremer.quadrige3.ui.swing.model.AbstractBeanUIModel;
29 import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
30
31 import java.util.List;
32
33 import static org.nuiton.i18n.I18n.t;
34
35
36
37
38 public class SearchAction extends AbstractCheckModelAction<ExtractionUIModel, ExtractionUI, ExtractionUIHandler> {
39
40
41
42
43
44
45 public SearchAction(final ExtractionUIHandler handler) {
46 super(handler, false);
47 setActionDescription(t("dali.action.search.tip"));
48 }
49
50
51 @Override
52 protected Class<SaveAction> getSaveActionClass() {
53 return SaveAction.class;
54 }
55
56
57 @Override
58 protected AbstractApplicationUIHandler<?, ?> getSaveHandler() {
59 return getHandler();
60 }
61
62
63 @Override
64 protected boolean isModelModify() {
65 return getModel().isModify();
66 }
67
68
69 @Override
70 protected void setModelModify(boolean modelModify) {
71 getModel().setModify(modelModify);
72 }
73
74
75 @Override
76 protected boolean isModelValid() {
77 return getModel().isValid();
78 }
79
80
81 @Override
82 public void doAction() throws Exception {
83
84 getUI().getExtractionsTable().getExtractionsTable().clearSelection();
85
86
87 getHandler().loadExtractions(getContext().getExtractionService().getExtractions(getModel().getExtractionId(), getModel().getProgramCode()));
88 }
89
90 @Override
91 protected List<AbstractBeanUIModel> getOtherModelsToModify() {
92 return ImmutableList.of(
93 getModel().getExtractionsTableUIModel(),
94 getModel().getExtractionFiltersUIModel(),
95 getModel().getExtractionConfigUIModel()
96 );
97 }
98
99 }