Field.java
2.29 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* aQute.bnd.annotation.ProviderType
* javax.servlet.http.HttpServletRequest
*/
package com.adobe.granite.ui.components;
import aQute.bnd.annotation.ProviderType;
import com.adobe.granite.ui.components.Config;
import com.adobe.granite.ui.components.Value;
import javax.servlet.http.HttpServletRequest;
@ProviderType
public class Field {
private Config cfg;
public static String HIDE_IN_DEFAULT_CLASS = "foundation-field-hide-in-default";
public static String IS_MIXED_SUFFIX = ".granite.mixed";
private static final String BULK_EDIT_MODE_ATTRIBUTE = "granite.ui.field.bulkedit";
public Field() {
}
public Field(Config cfg) {
this.cfg = cfg;
}
public String getRootClass(boolean isEmpty) {
return Field.getRootClass(this.cfg, isEmpty);
}
public String getRootClass(String value) {
return Field.getRootClass(this.cfg, value);
}
public boolean isMixed(Value value) {
return Field.isMixed(this.cfg, value);
}
public boolean isBulkEditAllowed() {
return this.cfg.get("allowBulkEdit", false);
}
public static boolean isBulkEditMode(HttpServletRequest request) {
Boolean isBulkEditMode = (Boolean)request.getAttribute("granite.ui.field.bulkedit");
return isBulkEditMode == null ? false : isBulkEditMode;
}
public static void setBulkEditMode(HttpServletRequest request) {
request.setAttribute("granite.ui.field.bulkedit", (Object)true);
}
public static void clearBulkEditMode(HttpServletRequest request) {
request.removeAttribute("granite.ui.field.bulkedit");
}
public static String getRootClass(Config cfg, boolean isEmpty) {
String cls = "";
if (isEmpty && cfg.get("renderReadOnly", false).booleanValue() && !cfg.get("showEmptyInReadOnly", false).booleanValue()) {
cls = cls + HIDE_IN_DEFAULT_CLASS;
}
return cls;
}
public static String getRootClass(Config cfg, String value) {
return Field.getRootClass(cfg, value == null || "".equals(value));
}
public static boolean isMixed(Config cfg, Value value) {
String name = cfg.get("name") + IS_MIXED_SUFFIX;
return value.getContentValue(name, false);
}
}