1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.edit.internal; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.model.reference.LocalDocumentReference; |
27 |
|
|
28 |
|
import com.xpn.xwiki.XWiki; |
29 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
30 |
|
import com.xpn.xwiki.internal.mandatory.AbstractMandatoryDocumentInitializer; |
31 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
32 |
|
import com.xpn.xwiki.objects.classes.TextAreaClass.EditorType; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@Component |
41 |
|
@Named("XWiki.EditorClass") |
42 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
43 |
|
public class EditorClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
44 |
|
{ |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
public static final LocalDocumentReference REFERENCE = |
49 |
|
new LocalDocumentReference(XWiki.SYSTEM_SPACE, "EditorClass"); |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
60 |
public EditorClassDocumentInitializer()... |
55 |
|
{ |
56 |
60 |
super(REFERENCE); |
57 |
|
} |
58 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
59 |
92 |
@Override... |
60 |
|
public boolean updateDocument(XWikiDocument document) |
61 |
|
{ |
62 |
92 |
boolean needsUpdate = false; |
63 |
|
|
64 |
92 |
BaseClass bclass = document.getXClass(); |
65 |
|
|
66 |
92 |
needsUpdate |= bclass.addTextField("dataType", "Data Type", 30); |
67 |
92 |
needsUpdate |= bclass.addTextField("roleHint", "Role Hint", 30); |
68 |
92 |
needsUpdate |= bclass.addTextAreaField("code", "Code", 40, 20, EditorType.TEXT); |
69 |
92 |
needsUpdate |= bclass.addTextField("icon", "Icon", 30); |
70 |
92 |
needsUpdate |= bclass.addTextField("category", "Category", 30); |
71 |
92 |
needsUpdate |= bclass.addStaticListField("scope", "Scope", "wiki=Current Wiki|user=Current User|global=Global"); |
72 |
|
|
73 |
92 |
needsUpdate |= setClassDocumentFields(document, "Editor Class"); |
74 |
|
|
75 |
92 |
return needsUpdate; |
76 |
|
} |
77 |
|
} |