| 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 org.devacfr.maven.skins.reflow.ISkinConfig; |
| 24 |
|
|
| 25 |
|
|
| 26 |
|
@author |
| 27 |
|
@since |
| 28 |
|
|
| |
|
| 84,4% |
Uncovered Elements: 7 (45) |
Complexity: 14 |
Complexity Density: 0,54 |
|
| 29 |
|
public class TocSidebar extends Toc<TocSidebar> { |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
private boolean fixed = true; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
private boolean expanded = true; |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
private boolean autoExpandable = true; |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
private int level = 0; |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
@param |
| 47 |
|
|
| 48 |
|
|
| |
|
| 75% |
Uncovered Elements: 5 (20) |
Complexity: 5 |
Complexity Density: 0,42 |
|
| 49 |
1 |
public TocSidebar(final @Nonnull ISkinConfig config) {... |
| 50 |
1 |
super("sidebar", "sidebar"); |
| 51 |
1 |
final String position = config.getAttributeValue("toc", "position", String.class, "fixed").toLowerCase(); |
| 52 |
1 |
this.withEnabled(true) |
| 53 |
|
.withExpanded(config.getAttributeValue("toc", "expanded", Boolean.class, true)) |
| 54 |
|
.withAutoExpandable(config.getAttributeValue("toc", "autoExpandable", Boolean.class, true)) |
| 55 |
|
.withFixed("fixed".equals(position)) |
| 56 |
|
.withLevel(config.getAttributeValue("toc", "level", Integer.class, 0)); |
| 57 |
1 |
if (this.isEnabled()) { |
| 58 |
1 |
this.addCssOptions("m-toc-sidebar-enabled"); |
| 59 |
|
} |
| 60 |
1 |
if (isExpanded()) { |
| 61 |
1 |
this.addCssOptions("m-toc-sidebar-expanded"); |
| 62 |
|
} |
| 63 |
1 |
if (isAutoExpandable()) { |
| 64 |
1 |
this.addCssOptions("m-toc-sidebar-autoexpandable"); |
| 65 |
|
} |
| 66 |
1 |
if (isFixed()) { |
| 67 |
1 |
this.addCssOptions("toc-sidebar-fixed"); |
| 68 |
|
} else { |
| 69 |
0 |
this.addCssOptions("toc-sidebar-relative"); |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
@return |
| 77 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
1 |
public boolean isFixed() {... |
| 79 |
1 |
return fixed; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
@param |
| 86 |
|
|
| 87 |
|
@return |
| 88 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 89 |
1 |
protected TocSidebar withFixed(final boolean fixed) {... |
| 90 |
1 |
this.fixed = fixed; |
| 91 |
1 |
return self(); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
|
@return |
| 98 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
1 |
public boolean isExpanded() {... |
| 100 |
1 |
return expanded; |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
|
| 104 |
|
|
| 105 |
|
|
| 106 |
|
@param |
| 107 |
|
|
| 108 |
|
@return |
| 109 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 110 |
1 |
protected TocSidebar withExpanded(final boolean expanded) {... |
| 111 |
1 |
this.expanded = expanded; |
| 112 |
1 |
return self(); |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
@return |
| 119 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 120 |
1 |
public boolean isAutoExpandable() {... |
| 121 |
1 |
return autoExpandable; |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
@param |
| 128 |
|
|
| 129 |
|
@return |
| 130 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 131 |
1 |
protected TocSidebar withAutoExpandable(final boolean autoExpandable) {... |
| 132 |
1 |
this.autoExpandable = autoExpandable; |
| 133 |
1 |
return self(); |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
|
| 137 |
|
@return |
| 138 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
1 |
public int getLevel() {... |
| 140 |
1 |
return level; |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
|
| 144 |
|
|
| 145 |
|
|
| 146 |
|
@param |
| 147 |
|
|
| 148 |
|
@return |
| 149 |
|
|
| |
|
| 66,7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
| 150 |
1 |
protected TocSidebar withLevel(final int level) {... |
| 151 |
1 |
if (level < 1) { |
| 152 |
1 |
this.level = Integer.MAX_VALUE; |
| 153 |
|
} else { |
| 154 |
0 |
this.level = level; |
| 155 |
|
} |
| 156 |
1 |
return self(); |
| 157 |
|
} |
| 158 |
|
} |