1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.plugin.charts.params; |
21 |
|
|
22 |
|
import java.awt.Font; |
23 |
|
import java.util.HashMap; |
24 |
|
import java.util.Map; |
25 |
|
|
26 |
|
import com.xpn.xwiki.plugin.charts.exceptions.ParamException; |
27 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 6 |
Complexity Density: 0.5 |
|
28 |
|
public class FontChartParam extends AbstractChartParam |
29 |
|
{ |
30 |
|
private Map styleChoices = new HashMap(); |
31 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
32 |
0 |
public FontChartParam(String name)... |
33 |
|
{ |
34 |
0 |
super(name); |
35 |
0 |
init(); |
36 |
|
} |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
38 |
0 |
public FontChartParam(String name, boolean optional)... |
39 |
|
{ |
40 |
0 |
super(name, optional); |
41 |
0 |
init(); |
42 |
|
} |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
44 |
0 |
@Override... |
45 |
|
public Class getType() |
46 |
|
{ |
47 |
0 |
return Font.class; |
48 |
|
} |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
50 |
0 |
public void init()... |
51 |
|
{ |
52 |
0 |
styleChoices.put("plain", Font.PLAIN); |
53 |
0 |
styleChoices.put("bold", Font.BOLD); |
54 |
0 |
styleChoices.put("italic", Font.ITALIC); |
55 |
0 |
styleChoices.put("bold+italic", Font.BOLD + Font.ITALIC); |
56 |
|
} |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
58 |
0 |
@Override... |
59 |
|
public Object convert(String value) throws ParamException |
60 |
|
{ |
61 |
0 |
Map map = parseMap(value, 3); |
62 |
0 |
return new Font(getStringArg(map, "name"), getStyleParam(map, "style"), getIntArg(map, "size")); |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0 |
private int getStyleParam(Map map, String name) throws ParamException... |
66 |
|
{ |
67 |
0 |
return ((Integer) getChoiceArg(map, name, styleChoices)).intValue(); |
68 |
|
} |
69 |
|
} |