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 |
|
|
25 |
|
import com.google.common.base.Strings; |
26 |
|
import com.google.common.collect.Lists; |
27 |
|
import org.codehaus.plexus.util.xml.Xpp3Dom; |
28 |
|
import org.devacfr.maven.skins.reflow.ISkinConfig; |
29 |
|
|
30 |
|
import static java.util.Objects.requireNonNull; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@author |
36 |
|
@since |
37 |
|
|
|
|
| 48,1% |
Uncovered Elements: 14 (27) |
Complexity: 7 |
Complexity Density: 0,41 |
|
38 |
|
public class Header extends BsComponent { |
39 |
|
|
40 |
|
|
41 |
|
private static final String COMPONENT = "header"; |
42 |
|
|
43 |
|
private static final List<String> HEADER_TYPES = Lists.newArrayList("jumbotron", "banner", "custom"); |
44 |
|
|
45 |
|
|
46 |
|
private boolean enabled = true; |
47 |
|
|
48 |
|
|
49 |
|
private String type; |
50 |
|
|
51 |
|
|
52 |
|
private String content; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@param |
58 |
|
|
59 |
|
|
|
|
| 60% |
Uncovered Elements: 8 (20) |
Complexity: 4 |
Complexity Density: 0,29 |
|
60 |
13 |
public Header(@Nonnull final ISkinConfig config) {... |
61 |
13 |
super(COMPONENT); |
62 |
13 |
requireNonNull(config); |
63 |
13 |
this.setTheme(config.getAttributeValue(COMPONENT, "theme", String.class, null)); |
64 |
13 |
this.setBackground(config.getAttributeValue(COMPONENT, "background", String.class, null)); |
65 |
13 |
this.setCssClass(config.getAttributeValue(COMPONENT, "cssClass", String.class, null)); |
66 |
|
|
67 |
13 |
this.type = config.getAttributeValue(COMPONENT, "type", String.class, HEADER_TYPES.get(0)).toLowerCase(); |
68 |
13 |
if (!HEADER_TYPES.contains(this.type)) { |
69 |
0 |
this.type = HEADER_TYPES.get(0); |
70 |
|
} |
71 |
13 |
this.enabled = config.getAttributeValue(COMPONENT, "enabled", Boolean.class, true); |
72 |
|
|
73 |
13 |
Xpp3Dom component = config.get(COMPONENT); |
74 |
13 |
if (component != null) { |
75 |
0 |
this.content = component.getValue(); |
76 |
0 |
if (!Strings.isNullOrEmpty(this.content)) { |
77 |
0 |
this.type = HEADER_TYPES.get(2); |
78 |
|
} |
79 |
|
} |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@return |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
0 |
public boolean isEnabled() {... |
88 |
0 |
return enabled; |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
@return |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0 |
public String getType() {... |
97 |
0 |
return type; |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
@return |
102 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
0 |
public String getContent() {... |
104 |
0 |
return content; |
105 |
|
} |
106 |
|
} |