1 |
|
|
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 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.googlesitemap.app.subapp.sitemapdetail.actions; |
35 |
|
|
36 |
|
import info.magnolia.event.EventBus; |
37 |
|
import info.magnolia.module.googlesitemap.bean.SiteMapEntry; |
38 |
|
import info.magnolia.ui.api.action.AbstractAction; |
39 |
|
import info.magnolia.ui.api.action.ActionExecutionException; |
40 |
|
import info.magnolia.ui.api.context.UiContext; |
41 |
|
import info.magnolia.ui.api.event.AdmincentralEventBus; |
42 |
|
import info.magnolia.ui.api.event.ContentChangedEvent; |
43 |
|
import info.magnolia.ui.dialog.formdialog.FormDialogPresenter; |
44 |
|
import info.magnolia.ui.dialog.formdialog.FormDialogPresenterFactory; |
45 |
|
import info.magnolia.ui.form.EditorCallback; |
46 |
|
|
47 |
|
import javax.inject.Inject; |
48 |
|
import javax.inject.Named; |
49 |
|
|
50 |
|
import com.vaadin.data.Item; |
51 |
|
import com.vaadin.data.util.BeanItem; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
@link@link |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
57 |
|
public class EditSiteMapEntryAction extends AbstractAction<EditSiteMapEntryActionDefinition> { |
58 |
|
|
59 |
|
private final FormDialogPresenterFactory formDialogPresenterFactory; |
60 |
|
private final UiContext uiContext; |
61 |
|
private final EventBus eventBus; |
62 |
|
private final SiteMapEntry entry; |
63 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
64 |
0
|
@Inject... |
65 |
|
protected EditSiteMapEntryAction(EditSiteMapEntryActionDefinition definition, BeanItem<SiteMapEntry> entry, FormDialogPresenterFactory formDialogPresenterFactory, UiContext uiContext, @Named(AdmincentralEventBus.NAME) EventBus eventBus) { |
66 |
0
|
super(definition); |
67 |
0
|
this.entry = entry.getBean(); |
68 |
0
|
this.formDialogPresenterFactory = formDialogPresenterFactory; |
69 |
0
|
this.uiContext = uiContext; |
70 |
0
|
this.eventBus = eventBus; |
71 |
|
} |
72 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
73 |
0
|
@Override... |
74 |
|
public void execute() throws ActionExecutionException { |
75 |
0
|
final FormDialogPresenter formDialogPresenter = formDialogPresenterFactory.createFormDialogPresenter(getDefinition().getDialogName()); |
76 |
|
|
77 |
0
|
Item item = new BeanItem<SiteMapEntry>(entry); |
78 |
|
|
79 |
0
|
formDialogPresenter.start(item, getDefinition().getDialogName(), uiContext, new EditorCallback() { |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
81 |
0
|
@Override... |
82 |
|
public void onSuccess(String actionName) { |
83 |
0
|
eventBus.fireEvent(new ContentChangedEvent(entry)); |
84 |
0
|
formDialogPresenter.closeDialog(); |
85 |
|
} |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
0
|
@Override... |
88 |
|
public void onCancel() { |
89 |
0
|
formDialogPresenter.closeDialog(); |
90 |
|
} |
91 |
|
}); |
92 |
|
} |
93 |
|
|
94 |
|
} |