Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/xpn/xwiki/objects/meta/NumberMetaClass.java


1   /**
2    * ===================================================================
3    *
4    * Copyright (c) 2003 Ludovic Dubost, All rights reserved.
5    *
6    * This program is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU General Public License
8    * as published by the Free Software Foundation; either version 2
9    * of the License, or (at your option) any later version.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details, published at
15   * http://www.gnu.org/copyleft/gpl.html or in gpl.txt in the
16   * root folder of this distribution.
17  
18   * Created by
19   * User: Ludovic Dubost
20   * Date: 22 déc. 2003
21   * Time: 09:19:06
22   */
23  package com.xpn.xwiki.objects.meta;
24  
25  import com.xpn.xwiki.objects.BaseCollection;
26  import com.xpn.xwiki.objects.classes.NumberClass;
27  import com.xpn.xwiki.objects.classes.StaticListClass;
28  
29  public class NumberMetaClass extends PropertyMetaClass {
30  
31    public NumberMetaClass() {
32      super();
33      // setType("numbermetaclass");
34      setPrettyName("Number Class");
35      setName(NumberClass.class.getName());
36  
37      StaticListClass type_class = new StaticListClass(this);
38      type_class.setName("numberType");
39      type_class.setPrettyName("Number Type");
40      type_class.setValues("integer|long|float|double");
41      type_class.setRelationalStorage(false);
42      type_class.setDisplayType("select");
43      type_class.setMultiSelect(false);
44      type_class.setSize(1);
45      safeput("numberType", type_class);
46  
47      NumberClass size_class = new NumberClass(this);
48      size_class.setName("size");
49      size_class.setPrettyName("Size");
50      size_class.setSize(5);
51      size_class.setNumberType("integer");
52  
53      safeput("numberType", type_class);
54      safeput("size", size_class);
55    }
56  
57    public BaseCollection newObject() {
58          return new NumberClass();
59    }
60  }