EmulatorImpl.java
2.26 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.wcm.api.components.Component
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.api.resource.ResourceUtil
* org.apache.sling.api.resource.ValueMap
*/
package com.day.cq.wcm.emulator.impl;
import com.day.cq.wcm.api.components.Component;
import com.day.cq.wcm.emulator.Emulator;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.api.resource.ValueMap;
public class EmulatorImpl
implements Emulator {
private final Resource resource;
private final Component component;
private final ValueMap properties;
private final ValueMap config;
private String contentCssPath;
public EmulatorImpl(Resource resource) {
this.resource = resource;
this.properties = ResourceUtil.getValueMap((Resource)resource);
this.component = (Component)resource.adaptTo(Component.class);
this.config = ResourceUtil.getValueMap((Resource)resource.getResourceResolver().getResource(resource, "cq:emulatorConfig"));
}
public String getContentCssPath() {
return this.contentCssPath;
}
public String getDescription() {
return (String)this.properties.get("jcr:description", String.class);
}
public String getName() {
return this.component.getName();
}
public String getPath() {
return this.resource.getPath();
}
public String getTitle() {
return this.component.getTitle();
}
public boolean canRotate() {
return (Boolean)this.config.get("canRotate", (Object)false);
}
public boolean hasTouchScrolling() {
return (Boolean)this.config.get("touchScrolling", (Object)false);
}
public int getWidth() {
return (Integer)this.config.get("width", (Object)-1);
}
public int getHeight() {
return (Integer)this.config.get("height", (Object)-1);
}
public double getPixelRatio() {
return (Double)this.config.get("device-pixel-ratio", (Object)1.0);
}
public void setContentCssPath(String cssPath) {
this.contentCssPath = cssPath;
}
}