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 javax.annotation.Nonnull; |
22 |
|
|
23 |
|
import java.util.List; |
24 |
|
import java.util.Objects; |
25 |
|
|
26 |
|
import com.google.common.collect.Lists; |
27 |
|
|
28 |
|
import org.apache.maven.doxia.site.Image; |
29 |
|
import org.devacfr.maven.skins.reflow.ISkinConfig; |
30 |
|
|
31 |
|
|
32 |
|
@author |
33 |
|
@since |
34 |
|
|
|
|
| 33,3% |
Uncovered Elements: 28 (42) |
Complexity: 12 |
Complexity Density: 0,44 |
|
35 |
|
public class MenuItem { |
36 |
|
|
37 |
|
|
38 |
|
private final String name; |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
private final String href; |
44 |
|
|
45 |
|
|
46 |
|
private final Image image; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
private final String target; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
private final String inherit; |
55 |
|
|
56 |
|
|
57 |
|
private final boolean active; |
58 |
|
|
59 |
|
|
60 |
|
private final List<MenuItem> menuItems = Lists.newArrayList(); |
61 |
|
|
62 |
|
|
63 |
|
@link |
64 |
|
|
65 |
|
@param |
66 |
|
|
67 |
|
@param |
68 |
|
|
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0,11 |
|
70 |
90 |
public MenuItem(@Nonnull final ISkinConfig config, final org.apache.maven.doxia.site.MenuItem item) {... |
71 |
90 |
Objects.requireNonNull(item);; |
72 |
90 |
this.href = config.relativeLink(item.getHref()); |
73 |
90 |
this.image = item.getImage(); |
74 |
90 |
this.name = item.getName(); |
75 |
90 |
this.target = item.getTarget(); |
76 |
90 |
this.active = config.isActiveLink(this.href); |
77 |
90 |
this.inherit = null; |
78 |
90 |
recurciveAddItem(config, this.menuItems, item.getItems()); |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
84 |
90 |
private void recurciveAddItem(final ISkinConfig config,... |
85 |
|
final List<MenuItem> menuItems, |
86 |
|
final List<org.apache.maven.doxia.site.MenuItem> origMenuItems) { |
87 |
90 |
if (origMenuItems == null) { |
88 |
0 |
return; |
89 |
|
} |
90 |
90 |
for (final org.apache.maven.doxia.site.MenuItem menuItem : origMenuItems) { |
91 |
0 |
menuItems.add(new MenuItem(config, menuItem)); |
92 |
|
} |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
@return |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
0 |
public String getName() {... |
99 |
0 |
return name; |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
@return |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
0 |
public List<MenuItem> getMenuItems() {... |
106 |
0 |
return menuItems; |
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
@return |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
0 |
public String getInherit() {... |
115 |
0 |
return inherit; |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
@return |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0,38 |
|
121 |
0 |
public boolean isActive() {... |
122 |
0 |
boolean active = this.active; |
123 |
0 |
if (active) { |
124 |
0 |
return active; |
125 |
|
} |
126 |
0 |
for (final MenuItem menuItem : menuItems) { |
127 |
0 |
active = menuItem.isActive(); |
128 |
0 |
if (active) { |
129 |
0 |
break; |
130 |
|
} |
131 |
|
} |
132 |
0 |
return active; |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
@return |
141 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
142 |
0 |
public String getHref() {... |
143 |
0 |
return href; |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
@return |
148 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
149 |
0 |
public Image getImage() {... |
150 |
0 |
return image; |
151 |
|
} |
152 |
|
|
153 |
|
|
154 |
|
@return |
155 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
0 |
public String getTarget() {... |
157 |
0 |
return target; |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
} |