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.base; |
35 |
|
|
36 |
|
import info.magnolia.event.EventBus; |
37 |
|
import info.magnolia.i18nsystem.SimpleTranslator; |
38 |
|
import info.magnolia.module.googlesitemap.app.subapp.sitemapdetail.event.EntrySelectedEvent; |
39 |
|
import info.magnolia.module.googlesitemap.app.subapp.sitemapdetail.util.SiteMapEntryContainer; |
40 |
|
import info.magnolia.module.googlesitemap.bean.SiteMapEntry; |
41 |
|
import info.magnolia.module.googlesitemap.service.SiteMapService; |
42 |
|
import info.magnolia.ui.api.app.SubAppEventBus; |
43 |
|
|
44 |
|
import java.util.List; |
45 |
|
|
46 |
|
import javax.inject.Named; |
47 |
|
import javax.jcr.Node; |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@param |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 8 |
Complexity Density: 0.62 |
|
53 |
|
public abstract class SiteMapDetailPresenter<L extends SiteMapContentView.Listener> implements SiteMapContentView.Listener { |
54 |
|
|
55 |
|
private final SiteMapContentView view; |
56 |
|
|
57 |
|
private final EventBus eventBus; |
58 |
|
|
59 |
|
private SimpleTranslator translator; |
60 |
|
|
61 |
|
protected final SiteMapService service; |
62 |
|
|
63 |
|
protected SiteMapEntryContainer siteContainer; |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
65 |
0
|
public SiteMapDetailPresenter(... |
66 |
|
SiteMapContentView<L> view, |
67 |
|
SiteMapService service, |
68 |
|
@Named(SubAppEventBus.NAME)EventBus eventBus, |
69 |
|
SimpleTranslator translator) { |
70 |
0
|
this.view = view; |
71 |
0
|
this.service = service; |
72 |
0
|
this.eventBus = eventBus; |
73 |
0
|
this.translator = translator; |
74 |
|
} |
75 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
76 |
0
|
public SiteMapContentView start() {... |
77 |
0
|
this.view.setListener(getListener()); |
78 |
0
|
return view; |
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0
|
public SimpleTranslator getTranslator() {... |
82 |
0
|
return translator; |
83 |
|
} |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
0
|
public void edit(Node siteMapNode) {... |
86 |
0
|
constructDataSource(fetchSiteMapEntries(siteMapNode)); |
87 |
|
} |
88 |
|
|
89 |
|
public abstract String getLabel(); |
90 |
|
|
91 |
|
protected abstract List<SiteMapEntry> fetchSiteMapEntries(Node node); |
92 |
|
|
93 |
|
protected abstract SiteMapContentView.Listener getListener(); |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0
|
protected SiteMapContentView getView() {... |
96 |
0
|
return view; |
97 |
|
} |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
99 |
0
|
private void constructDataSource(List<SiteMapEntry> siteMapBeanForSite) {... |
100 |
0
|
this.siteContainer = new SiteMapEntryContainer(siteMapBeanForSite); |
101 |
0
|
view.setDatasource(siteContainer); |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0
|
@Override... |
105 |
|
public void onEntrySelected(SiteMapEntry value) { |
106 |
0
|
eventBus.fireEvent(new EntrySelectedEvent(value)); |
107 |
|
} |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
0
|
public SiteMapEntry getCurrentSelection() {... |
110 |
0
|
return view.getValue(); |
111 |
|
} |
112 |
|
} |