GuideField.java
4.24 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.wcm.foundation.forms.FormsHelper
* org.apache.commons.lang3.StringUtils
* org.apache.sling.api.SlingHttpServletRequest
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.aemds.guide.common;
import com.adobe.aemds.guide.common.GuideNode;
import com.adobe.aemds.guide.taglibs.GuideELUtils;
import com.adobe.aemds.guide.utils.GuideUtils;
import com.day.cq.wcm.foundation.forms.FormsHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
public class GuideField
extends GuideNode {
protected String helpQuestionMarkContent = "";
private String displayNoneStyle = ";display:none";
public Boolean getIsRequired() {
return FormsHelper.isRequired((Resource)super.getResource());
}
public Boolean getIsReadOnly() {
return FormsHelper.isReadOnly((SlingHttpServletRequest)this.slingRequest, (Resource)super.getResource());
}
public boolean getIsOldFieldLayout() {
String fieldLayout = (String)this.resourceProps.get("fieldLayout", (Object)"");
if (fieldLayout != null && fieldLayout.length() > 0 && !fieldLayout.equals("/libs/fd/af/layouts/field/defaultFieldLayout/defaultFieldLayout.jsp")) {
return this.checkIfPathIsAbsolute(fieldLayout);
}
return false;
}
public String getFieldLayout() {
String fieldLayout = (String)this.resourceProps.get("fieldLayout", (Object)"");
if (fieldLayout != null && fieldLayout.length() > 0 && fieldLayout.indexOf("defaultFieldLayout") < 0) {
return fieldLayout;
}
Resource guideContainerResource = this.resource.getResourceResolver().getResource(GuideELUtils.getGuideContainerPath(this.slingRequest, this.resource));
return GuideUtils.getFieldLayout(guideContainerResource, "fieldLayout", "fd/af/layouts/field/defaultFieldLayout");
}
public String getFieldLayoutName() {
String fieldLayout = this.getFieldLayout();
String fieldLayoutName = "defaultFieldLayout";
if (fieldLayout != null && fieldLayout.length() > 0) {
fieldLayoutName = StringUtils.substringAfterLast((String)fieldLayout, (String)"/");
fieldLayoutName = StringUtils.substringBeforeLast((String)fieldLayoutName, (String)".jsp");
}
return fieldLayoutName;
}
public boolean getHideTitle() {
return (Boolean)this.resourceProps.get("hideTitle", (Object)false);
}
public String getShortDescription() {
return this.externalize((String)this.resourceProps.get("shortDescription", (Object)""));
}
public String getLongDescription() {
return this.externalize((String)this.resourceProps.get("longDescription", (Object)""));
}
public Boolean getDescriptionVisibility() {
return (Boolean)this.resourceProps.get("shortVisible", (Object)false);
}
public String getValue() {
return (String)this.resourceProps.get("_value", String.class);
}
public String getCaptionInlineStyles() {
if (this.getHideTitle()) {
return this.getInlineStyles("Caption") + this.displayNoneStyle;
}
return this.getInlineStyles("Caption");
}
public String getWidgetInlineStyles() {
return this.getInlineStyles("Widget");
}
public void setHelpIndicatorContent(String helpQuestionMarkContent) {
this.helpQuestionMarkContent = helpQuestionMarkContent != null ? helpQuestionMarkContent : "";
}
public String getHelpIndicatorContent() {
return this.helpQuestionMarkContent;
}
public String getShortDescriptionInlineStyles() {
if (this.getDescriptionVisibility().booleanValue()) {
return this.getInlineStyles("ShortDescription");
}
return this.getInlineStyles("ShortDescription") + this.displayNoneStyle;
}
public String getPlaceholderText() {
return (String)this.resourceProps.get("placeholderText", (Object)"");
}
}