1 package fr.ifremer.dali.ui.swing.content.manage.context.contextslist;
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
27 import fr.ifremer.dali.dto.configuration.context.ContextDTO;
28 import fr.ifremer.dali.ui.swing.action.AbstractDaliAction;
29
30
31
32
33
34 public class DuplicateContextAction extends AbstractDaliAction<ManageContextsListTableUIModel, ManageContextsListTableUI, ManageContextsListTableUIHandler> {
35
36 private ContextDTO duplicatedContext;
37
38
39
40
41
42
43 public DuplicateContextAction(ManageContextsListTableUIHandler handler) {
44 super(handler, false);
45 }
46
47
48 @Override
49 public void doAction() throws Exception {
50
51 ContextDTO contextToDuplicate = getModel().getSingleSelectedRow();
52 duplicatedContext = getContext().getContextService().duplicateContext(contextToDuplicate);
53 }
54
55
56 @Override
57 public void postSuccessAction() {
58 getModel().addBean(duplicatedContext);
59 ManageContextsListTableUIRowModel lastRow = getModel().getRows().get(getModel().getRows().size()-1);
60 getHandler().setFocusOnCell(lastRow);
61 }
62
63 }