1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.internal.parser.xhtml.wikimodel; |
21 |
|
|
22 |
|
import org.xwiki.rendering.wikimodel.WikiParameter; |
23 |
|
import org.xwiki.rendering.wikimodel.WikiParameters; |
24 |
|
import org.xwiki.rendering.wikimodel.xhtml.handler.TableDataTagHandler; |
25 |
|
import org.xwiki.rendering.wikimodel.xhtml.impl.TagContext; |
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@version |
32 |
|
@since |
33 |
|
|
|
|
| 76% |
Uncovered Elements: 6 (25) |
Complexity: 7 |
Complexity Density: 0.58 |
|
34 |
|
public class XWikiTableDataTagHandler extends TableDataTagHandler implements XWikiWikiModelHandler |
35 |
|
{ |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
private static final String TH_SCOPE = "scope"; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
private static final String TH_SCOPE_COL = "col"; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
private static final String TH_SCOPE_ROW = "row"; |
50 |
|
|
|
|
| 75% |
Uncovered Elements: 6 (24) |
Complexity: 7 |
Complexity Density: 0.58 |
|
51 |
26 |
@Override... |
52 |
|
protected void begin(TagContext context) |
53 |
|
{ |
54 |
26 |
WikiParameters parameters = context.getParams(); |
55 |
|
|
56 |
|
|
57 |
26 |
WikiParameter scopeParameter = parameters.getParameter(TH_SCOPE); |
58 |
|
|
59 |
26 |
if (scopeParameter != null) { |
60 |
21 |
if (context.getScannerContext().getTableRowCounter() == 0) { |
61 |
17 |
if (scopeParameter.getValue().equals(TH_SCOPE_COL)) { |
62 |
16 |
parameters = parameters.remove(TH_SCOPE); |
63 |
|
} |
64 |
4 |
} else if (context.getScannerContext().getTableCellCounter() == 0) { |
65 |
4 |
if (scopeParameter.getValue().equals(TH_SCOPE_ROW)) { |
66 |
4 |
parameters = parameters.remove(TH_SCOPE); |
67 |
|
} |
68 |
|
} else { |
69 |
0 |
if (scopeParameter.getValue().equals(TH_SCOPE_COL)) { |
70 |
0 |
parameters = parameters.remove(TH_SCOPE); |
71 |
|
} |
72 |
|
} |
73 |
|
} |
74 |
|
|
75 |
26 |
context.getScannerContext().beginTableCell(true, parameters); |
76 |
|
} |
77 |
|
} |