1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.module.googlesitemap.app.field; |
35 |
|
|
36 |
|
import info.magnolia.module.googlesitemap.GoogleSiteMapConfiguration; |
37 |
|
import info.magnolia.module.googlesitemap.SiteMapNodeTypes; |
38 |
|
import info.magnolia.ui.form.field.factory.SelectFieldFactory; |
39 |
|
import info.magnolia.ui.vaadin.integration.jcr.DefaultPropertyUtil; |
40 |
|
|
41 |
|
import com.google.inject.Inject; |
42 |
|
import com.vaadin.data.Item; |
43 |
|
import com.vaadin.data.Property; |
44 |
|
|
45 |
|
|
46 |
|
@link@link |
47 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
48 |
|
public class GoogleSiteMapSelectFieldFactory extends SelectFieldFactory<GoogleSiteMapSelectFieldFactoryDefinition> { |
49 |
|
|
50 |
|
private final GoogleSiteMapConfiguration configuration; |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
52 |
0 |
@Inject... |
53 |
|
public GoogleSiteMapSelectFieldFactory(GoogleSiteMapSelectFieldFactoryDefinition definition, Item relatedFieldItem, GoogleSiteMapConfiguration configuration) { |
54 |
0 |
super(definition, relatedFieldItem); |
55 |
0 |
this.configuration = configuration; |
56 |
|
} |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
58 |
0 |
@Override... |
59 |
|
protected Object createDefaultValue(Property<?> dataSource) { |
60 |
0 |
if (SiteMapNodeTypes.SiteMap.DEFAULT_CHANGEFREQ.equals(definition.getName())) { |
61 |
0 |
return DefaultPropertyUtil.createTypedValue(String.class, configuration.getChangeFrequency()); |
62 |
|
} |
63 |
|
|
64 |
0 |
if (SiteMapNodeTypes.SiteMap.DEFAULT_PRIORITY.equals(definition.getName())) { |
65 |
0 |
return DefaultPropertyUtil.createTypedValue(Double.class, Double.toString(configuration.getPriority())); |
66 |
|
} |
67 |
|
|
68 |
0 |
return super.createDefaultValue(dataSource); |
69 |
|
} |
70 |
|
} |