1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.objects.meta

File TextAreaMetaClass.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
27
2
1
91
52
2
0.07
13.5
2
1

Classes

Class Line # Actions
TextAreaMetaClass 42 27 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 18 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package com.xpn.xwiki.objects.meta;
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.objects.classes.NumberClass;
28    import com.xpn.xwiki.objects.classes.PropertyClassInterface;
29    import com.xpn.xwiki.objects.classes.StaticListClass;
30    import com.xpn.xwiki.objects.classes.TextAreaClass;
31    import com.xpn.xwiki.objects.classes.TextAreaClass.ContentType;
32    import com.xpn.xwiki.objects.classes.TextAreaClass.EditorType;
33   
34    /**
35    * Defines the meta properties of a text area XClass property.
36    *
37    * @version $Id: 2cfab89b65680d5b3c4399dc6f846593c8bd9897 $
38    */
39    @Component
40    @Named("TextArea")
41    @Singleton
 
42    public class TextAreaMetaClass extends StringMetaClass
43    {
44    /**
45    * Unknown value.
46    */
47    private static final String UNKNWON = "---";
48   
49    /**
50    * Default constructor. Initializes the default meta properties of a Text Area XClass property.
51    */
 
52  78 toggle public TextAreaMetaClass()
53    {
54  78 setPrettyName("TextArea");
55  78 setName(getClass().getAnnotation(Named.class).value());
56   
57  78 NumberClass rowsClass = new NumberClass(this);
58  78 rowsClass.setName("rows");
59  78 rowsClass.setPrettyName("Rows");
60  78 rowsClass.setSize(5);
61  78 rowsClass.setNumberType("integer");
62  78 safeput(rowsClass.getName(), rowsClass);
63   
64  78 StaticListClass editorClass = new StaticListClass(this);
65  78 editorClass.setName("editor");
66  78 editorClass.setPrettyName("Editor");
67  78 editorClass.setValues(UNKNWON + '|' + EditorType.TEXT + '|' + EditorType.PURE_TEXT + '|' + EditorType.WYSIWYG);
68  78 editorClass.setRelationalStorage(false);
69  78 editorClass.setDisplayType("select");
70  78 editorClass.setMultiSelect(false);
71  78 editorClass.setSize(1);
72  78 safeput(editorClass.getName(), editorClass);
73   
74  78 StaticListClass contentTypeClass = new StaticListClass(this);
75  78 contentTypeClass.setName("contenttype");
76  78 contentTypeClass.setPrettyName("Content");
77  78 contentTypeClass.setValues(
78    UNKNWON + '|' + ContentType.WIKI_TEXT + '|' + ContentType.VELOCITY_CODE + '|' + ContentType.PURE_TEXT);
79  78 contentTypeClass.setRelationalStorage(false);
80  78 contentTypeClass.setDisplayType(editorClass.getDisplayType());
81  78 contentTypeClass.setMultiSelect(false);
82  78 contentTypeClass.setSize(1);
83  78 safeput(contentTypeClass.getName(), contentTypeClass);
84    }
85   
 
86  5386 toggle @Override
87    public PropertyClassInterface getInstance()
88    {
89  5386 return new TextAreaClass();
90    }
91    }