1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.internal.mandatory; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.inject.Singleton; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
|
27 |
|
import com.xpn.xwiki.XWiki; |
28 |
|
import com.xpn.xwiki.XWikiConstant; |
29 |
|
import com.xpn.xwiki.doc.XWikiDocument; |
30 |
|
import com.xpn.xwiki.objects.classes.BaseClass; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@version |
36 |
|
@since |
37 |
|
|
38 |
|
@Component |
39 |
|
@Named("XWiki.EditModeClass") |
40 |
|
@Singleton |
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
41 |
|
public class EditModeClassDocumentInitializer extends AbstractMandatoryDocumentInitializer |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
60 |
public EditModeClassDocumentInitializer()... |
47 |
|
{ |
48 |
60 |
super(XWiki.SYSTEM_SPACE, XWikiConstant.EDIT_MODE_CLASS.getName()); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
51 |
92 |
@Override... |
52 |
|
public boolean updateDocument(XWikiDocument document) |
53 |
|
{ |
54 |
92 |
boolean needsUpdate = false; |
55 |
|
|
56 |
92 |
BaseClass bclass = document.getXClass(); |
57 |
|
|
58 |
92 |
needsUpdate |= bclass.addTextField("defaultEditMode", "Default Edit Mode", 15); |
59 |
|
|
60 |
92 |
if (document.isNew()) { |
61 |
38 |
needsUpdate |= setClassDocumentFields(document, "XWiki Edit Mode Class"); |
62 |
38 |
document.setContent("Class that should be used to specify the edit mode of a page."); |
63 |
|
} |
64 |
|
|
65 |
92 |
return needsUpdate; |
66 |
|
} |
67 |
|
} |