1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.renderer; |
21 |
|
|
22 |
|
import java.util.ArrayDeque; |
23 |
|
import java.util.Deque; |
24 |
|
|
25 |
|
import org.xwiki.rendering.listener.chaining.AbstractChainingListener; |
26 |
|
import org.xwiki.rendering.listener.chaining.ChainingListener; |
27 |
|
import org.xwiki.rendering.renderer.printer.WikiPrinter; |
28 |
|
|
29 |
|
|
30 |
|
@version |
31 |
|
@since |
32 |
|
|
|
|
| 81% |
Uncovered Elements: 4 (21) |
Complexity: 8 |
Complexity Density: 0.8 |
|
33 |
|
public abstract class AbstractChainingPrintRenderer extends AbstractChainingListener implements PrintRenderer |
34 |
|
{ |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
private Deque<WikiPrinter> printers = new ArrayDeque<WikiPrinter>(); |
39 |
|
|
40 |
|
|
41 |
|
@return |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
0 |
public WikiPrinter getMainPrinter()... |
44 |
|
{ |
45 |
0 |
return this.printers.getLast(); |
46 |
|
} |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
1273493 |
@Override... |
49 |
|
public WikiPrinter getPrinter() |
50 |
|
{ |
51 |
1273495 |
return this.printers.peek(); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
@inheritDoc |
56 |
|
|
57 |
|
@since |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
215195 |
@Override... |
60 |
|
public void setPrinter(WikiPrinter printer) |
61 |
|
{ |
62 |
215195 |
pushPrinter(printer); |
63 |
|
} |
64 |
|
|
65 |
|
|
66 |
|
@link |
67 |
|
|
68 |
|
@param@link |
69 |
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
70 |
215295 |
protected void pushPrinter(WikiPrinter wikiPrinter)... |
71 |
|
{ |
72 |
215298 |
this.printers.push(wikiPrinter); |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
215307 |
if (getListenerChain().indexOf(getClass()) == 0) { |
77 |
107575 |
ChainingListener nextListener = this; |
78 |
? |
while ((nextListener = getListenerChain().getNextListener(nextListener.getClass())) != null) { |
79 |
342406 |
if (PrintRenderer.class.isAssignableFrom(nextListener.getClass())) { |
80 |
107582 |
((PrintRenderer) nextListener).setPrinter(wikiPrinter); |
81 |
|
} |
82 |
|
} |
83 |
|
} |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
@link |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
115 |
protected void popPrinter()... |
90 |
|
{ |
91 |
115 |
this.printers.pop(); |
92 |
|
} |
93 |
|
} |