1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
package org.devacfr.maven.skins.reflow.model; |
20 |
|
|
21 |
|
import static java.util.Objects.requireNonNull; |
22 |
|
|
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.annotation.Nonnull; |
26 |
|
|
27 |
|
import org.apache.maven.doxia.site.SiteModel; |
28 |
|
import org.codehaus.plexus.util.xml.Xpp3Dom; |
29 |
|
import org.devacfr.maven.skins.reflow.ISkinConfig; |
30 |
|
|
31 |
|
import com.google.common.base.Strings; |
32 |
|
import com.google.common.collect.Lists; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@author |
38 |
|
@since |
39 |
|
|
|
|
| 73,5% |
Uncovered Elements: 9 (34) |
Complexity: 8 |
Complexity Density: 0,33 |
|
40 |
|
public class Footer extends BsComponent { |
41 |
|
|
42 |
|
|
43 |
|
private static final String COMPONENT = "footer"; |
44 |
|
|
45 |
|
|
46 |
|
private final List<Column> columns = Lists.newArrayList(); |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@param |
52 |
|
|
53 |
|
|
|
|
| 77,4% |
Uncovered Elements: 7 (31) |
Complexity: 7 |
Complexity Density: 0,3 |
|
54 |
17 |
public Footer(@Nonnull final ISkinConfig config) {... |
55 |
17 |
super(COMPONENT); |
56 |
17 |
requireNonNull(config); |
57 |
17 |
this.setTheme(config.getAttributeValue(COMPONENT, "theme", String.class, "light")); |
58 |
17 |
this.setBackground(config.getAttributeValue(COMPONENT, "background", String.class, "light")); |
59 |
17 |
this.setCssClass(config.getAttributeValue(COMPONENT, "cssClass", String.class, null)); |
60 |
|
|
61 |
17 |
final Xpp3Dom bottomNav = config.get("bottomNav"); |
62 |
17 |
final SiteModel model = config.getSiteModel(); |
63 |
|
|
64 |
17 |
if (model.getBody() != null && model.getBody().getMenus() != null) { |
65 |
6 |
final List<org.apache.maven.doxia.site.Menu> menus = model.getBody().getMenus(); |
66 |
6 |
if (bottomNav != null && bottomNav.getChildren().length > 0) { |
67 |
|
|
68 |
6 |
for (final Xpp3Dom col : bottomNav.getChildren()) { |
69 |
18 |
final String regex = col.getValue(); |
70 |
18 |
if (Strings.isNullOrEmpty(regex)) { |
71 |
0 |
continue; |
72 |
|
} |
73 |
18 |
final List<Menu> amenus = Lists.newArrayList(); |
74 |
18 |
for (final org.apache.maven.doxia.site.Menu menu : menus) { |
75 |
|
|
76 |
90 |
if (Menu.matches(regex, menu)) { |
77 |
30 |
amenus.add(new Menu(config, menu)); |
78 |
|
} |
79 |
|
} |
80 |
18 |
this.columns.add(new Column(config, amenus)); |
81 |
|
} |
82 |
|
} else { |
83 |
0 |
final List<Menu> amenus = Lists.newArrayList(); |
84 |
0 |
for (final org.apache.maven.doxia.site.Menu menu : menus) { |
85 |
0 |
amenus.add(new Menu(config, menu)); |
86 |
|
} |
87 |
0 |
this.columns.add(new Column(config, amenus)); |
88 |
|
} |
89 |
|
} |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
@return@link |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0 |
public List<Column> getColumns() {... |
96 |
0 |
return columns; |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
@author |
101 |
|
@since |
102 |
|
|
|
|
| 66,7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
103 |
|
public static class Column { |
104 |
|
|
105 |
|
|
106 |
|
private final List<Menu> menus; |
107 |
|
|
108 |
|
|
109 |
|
@param |
110 |
|
|
111 |
|
@param |
112 |
|
|
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
114 |
18 |
public Column(@Nonnull final ISkinConfig config, @Nonnull final List<Menu> menus) {... |
115 |
18 |
requireNonNull(config); |
116 |
18 |
requireNonNull(menus); |
117 |
18 |
this.menus = menus; |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
@return@link |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
0 |
public List<Menu> getMenus() {... |
124 |
0 |
return menus; |
125 |
|
} |
126 |
|
} |
127 |
|
} |