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.contentviews.pages; |
35 |
|
|
36 |
|
import info.magnolia.event.EventBus; |
37 |
|
import info.magnolia.module.googlesitemap.app.subapp.sitemapdetail.contentviews.SitemapTableColumnDefinition; |
38 |
|
import info.magnolia.module.googlesitemap.app.subapp.sitemapdetail.contentconnector.SitemapContentConnector; |
39 |
|
import info.magnolia.module.googlesitemap.bean.SiteMapEntry; |
40 |
|
import info.magnolia.objectfactory.ComponentProvider; |
41 |
|
import info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector; |
42 |
|
import info.magnolia.ui.workbench.column.definition.ColumnDefinition; |
43 |
|
import info.magnolia.ui.workbench.definition.WorkbenchDefinition; |
44 |
|
import info.magnolia.ui.workbench.tree.TreePresenter; |
45 |
|
import info.magnolia.ui.workbench.tree.TreeView; |
46 |
|
|
47 |
|
import java.util.Iterator; |
48 |
|
|
49 |
|
import javax.inject.Inject; |
50 |
|
|
51 |
|
import com.vaadin.data.Container; |
52 |
|
import com.vaadin.ui.Table; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@see |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 7 |
Complexity Density: 0.5 |
|
58 |
|
public class SitemapPagesPresenter extends TreePresenter { |
59 |
|
|
60 |
|
private SitemapContentConnector contentConnector; |
61 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
62 |
0 |
@Inject... |
63 |
|
public SitemapPagesPresenter(SitemapTreeView view, ComponentProvider componentProvider, ContentConnector contentConnector) { |
64 |
0 |
super(view, componentProvider); |
65 |
0 |
this.contentConnector = (SitemapContentConnector) contentConnector; |
66 |
|
} |
67 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
68 |
0 |
@Override... |
69 |
|
public TreeView start(WorkbenchDefinition workbenchDefinition, EventBus eventBus, String viewTypeName, ContentConnector contentConnector) { |
70 |
0 |
SitemapTreeView view = (SitemapTreeView) super.start(workbenchDefinition, eventBus, viewTypeName, contentConnector); |
71 |
0 |
Iterator<ColumnDefinition> it = getColumnsIterator(); |
72 |
0 |
while (it.hasNext()) { |
73 |
0 |
ColumnDefinition columnDefinition = it.next(); |
74 |
0 |
if (columnDefinition instanceof SitemapTableColumnDefinition) { |
75 |
0 |
view.setColumnAlignment(columnDefinition.getName(), ((SitemapTableColumnDefinition)columnDefinition).getAlignment()); |
76 |
|
} |
77 |
|
} |
78 |
|
|
79 |
0 |
((Table)view.asVaadinComponent()).setCellStyleGenerator(new Table.CellStyleGenerator() { |
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
80 |
0 |
@Override... |
81 |
|
public String getStyle(Table source, Object itemId, Object propertyId) { |
82 |
0 |
if ((Boolean) source.getItem(itemId).getItemProperty(SiteMapEntry.SITE_ALERT_NAME).getValue()) { |
83 |
0 |
return "excluded"; |
84 |
|
} |
85 |
0 |
return null; |
86 |
|
} |
87 |
|
}); |
88 |
|
|
89 |
0 |
return view; |
90 |
|
} |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
0 |
@Override... |
93 |
|
protected Container initializeContainer() { |
94 |
0 |
return contentConnector.getContainer(); |
95 |
|
} |
96 |
|
} |