1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.objects.meta; |
21 |
|
|
22 |
|
import com.xpn.xwiki.XWikiContext; |
23 |
|
import com.xpn.xwiki.XWikiException; |
24 |
|
import com.xpn.xwiki.internal.objects.classes.PropertyClassProvider; |
25 |
|
import com.xpn.xwiki.internal.objects.meta.PropertyMetaClassInterface; |
26 |
|
import com.xpn.xwiki.objects.BaseCollection; |
27 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
28 |
|
import com.xpn.xwiki.objects.classes.BooleanClass; |
29 |
|
import com.xpn.xwiki.objects.classes.NumberClass; |
30 |
|
import com.xpn.xwiki.objects.classes.PropertyClassInterface; |
31 |
|
import com.xpn.xwiki.objects.classes.StringClass; |
32 |
|
import com.xpn.xwiki.objects.classes.TextAreaClass; |
33 |
|
import com.xpn.xwiki.web.Utils; |
34 |
|
|
35 |
|
|
36 |
|
@link |
37 |
|
|
38 |
|
@link |
39 |
|
|
40 |
|
@link |
41 |
|
|
42 |
|
@link |
43 |
|
@link |
44 |
|
|
45 |
|
@version |
46 |
|
|
|
|
| 86.5% |
Uncovered Elements: 10 (74) |
Complexity: 13 |
Complexity Density: 0.21 |
|
47 |
|
public class PropertyMetaClass extends BaseClass implements PropertyMetaClassInterface, PropertyClassProvider |
48 |
|
{ |
49 |
|
|
50 |
|
|
51 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 1 |
Complexity Density: 0.04 |
|
52 |
885 |
public PropertyMetaClass()... |
53 |
|
{ |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
885 |
StringClass nameClass = new StringClass(this); |
58 |
885 |
nameClass.setName("name"); |
59 |
885 |
nameClass.setPrettyName("Name"); |
60 |
885 |
nameClass.setUnmodifiable(true); |
61 |
885 |
nameClass.setSize(40); |
62 |
885 |
safeput(nameClass.getName(), nameClass); |
63 |
|
|
64 |
885 |
BooleanClass disabledClass = new BooleanClass(this); |
65 |
885 |
disabledClass.setName("disabled"); |
66 |
885 |
disabledClass.setPrettyName("Disabled"); |
67 |
885 |
disabledClass.setDisplayType("yesno"); |
68 |
885 |
disabledClass.setDisplayFormType("checkbox"); |
69 |
885 |
safeput(disabledClass.getName(), disabledClass); |
70 |
|
|
71 |
885 |
addPresentationMetaProperties(); |
72 |
|
|
73 |
885 |
BooleanClass unmodifiableClass = new BooleanClass(this); |
74 |
885 |
unmodifiableClass.setName("unmodifiable"); |
75 |
885 |
unmodifiableClass.setPrettyName("Unmodifiable"); |
76 |
885 |
unmodifiableClass.setDisplayType(disabledClass.getDisplayType()); |
77 |
885 |
safeput(unmodifiableClass.getName(), unmodifiableClass); |
78 |
|
|
79 |
885 |
NumberClass numberClass = new NumberClass(this); |
80 |
885 |
numberClass.setName("number"); |
81 |
885 |
numberClass.setPrettyName("Number"); |
82 |
885 |
numberClass.setNumberType("integer"); |
83 |
885 |
safeput(numberClass.getName(), numberClass); |
84 |
|
|
85 |
885 |
addValidationMetaProperties(); |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
|
91 |
885 |
private void addPresentationMetaProperties()... |
92 |
|
{ |
93 |
885 |
StringClass prettyNameClass = new StringClass(this); |
94 |
885 |
prettyNameClass.setName("prettyName"); |
95 |
885 |
prettyNameClass.setPrettyName("Pretty Name"); |
96 |
885 |
prettyNameClass.setSize(40); |
97 |
885 |
safeput(prettyNameClass.getName(), prettyNameClass); |
98 |
|
|
99 |
885 |
TextAreaClass toolTipClass = new TextAreaClass(this); |
100 |
885 |
toolTipClass.setName("tooltip"); |
101 |
885 |
toolTipClass.setPrettyName("Tooltip"); |
102 |
885 |
toolTipClass.setSize(60); |
103 |
885 |
toolTipClass.setRows(5); |
104 |
885 |
safeput(toolTipClass.getName(), toolTipClass); |
105 |
|
|
106 |
885 |
TextAreaClass customDisplayClass = new TextAreaClass(this); |
107 |
885 |
customDisplayClass.setName("customDisplay"); |
108 |
885 |
customDisplayClass.setPrettyName("Custom Display"); |
109 |
885 |
customDisplayClass.setEditor("Text"); |
110 |
885 |
customDisplayClass.setRows(5); |
111 |
885 |
customDisplayClass.setSize(80); |
112 |
885 |
safeput(customDisplayClass.getName(), customDisplayClass); |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
118 |
885 |
private void addValidationMetaProperties()... |
119 |
|
{ |
120 |
885 |
StringClass validationRegExpClass = new StringClass(this); |
121 |
885 |
validationRegExpClass.setName("validationRegExp"); |
122 |
885 |
validationRegExpClass.setPrettyName("Validation Regular Expression"); |
123 |
885 |
validationRegExpClass.setSize(40); |
124 |
885 |
safeput(validationRegExpClass.getName(), validationRegExpClass); |
125 |
|
|
126 |
885 |
StringClass validationMessageClass = new StringClass(this); |
127 |
885 |
validationMessageClass.setName("validationMessage"); |
128 |
885 |
validationMessageClass.setPrettyName("Validation Message"); |
129 |
885 |
validationMessageClass.setSize(80); |
130 |
885 |
safeput(validationMessageClass.getName(), validationMessageClass); |
131 |
|
} |
132 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
133 |
0 |
@Override... |
134 |
|
public BaseCollection getObject() |
135 |
|
{ |
136 |
0 |
return null; |
137 |
|
} |
138 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
139 |
0 |
@Override... |
140 |
|
public void setObject(BaseCollection object) |
141 |
|
{ |
142 |
|
} |
143 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
144 |
0 |
@Override... |
145 |
|
public String toFormString() |
146 |
|
{ |
147 |
0 |
return null; |
148 |
|
} |
149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0 |
@Override... |
151 |
|
public PropertyMetaClass clone() |
152 |
|
{ |
153 |
0 |
return (PropertyMetaClass) super.clone(); |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
@inheritDoc |
158 |
|
|
159 |
|
@link |
160 |
|
|
161 |
|
|
162 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 4 |
Complexity Density: 0.8 |
|
163 |
4 |
@Override... |
164 |
|
public BaseCollection newObject(XWikiContext context) throws XWikiException |
165 |
|
{ |
166 |
4 |
PropertyClassInterface instance = null; |
167 |
4 |
try { |
168 |
|
|
169 |
4 |
PropertyClassProvider provider = Utils.getComponent(PropertyClassProvider.class, getName()); |
170 |
4 |
instance = provider.getInstance(); |
171 |
|
} catch (Exception e) { |
172 |
|
|
173 |
|
} |
174 |
4 |
return instance != null && instance instanceof BaseCollection ? (BaseCollection) instance : super |
175 |
|
.newObject(context); |
176 |
|
} |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
178 |
0 |
@Override... |
179 |
|
public PropertyClassInterface getInstance() |
180 |
|
{ |
181 |
|
|
182 |
|
|
183 |
0 |
return null; |
184 |
|
} |
185 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
186 |
37580 |
@Override... |
187 |
|
public PropertyMetaClassInterface getDefinition() |
188 |
|
{ |
189 |
37580 |
return this; |
190 |
|
} |
191 |
|
} |