Statistics
| Revision:

gvsig-educa / org.gvsig.educa.thematicmap / trunk / org.gvsig.educa.thematicmap / org.gvsig.educa.thematicmap.lib / org.gvsig.educa.thematicmap.lib.prov.locateonthemap / src / main / java / org / gvsig / educa / thematicmap / lib / prov / locateonthemap / LocateOnTheMapProviderFactory.java @ 228

History | View | Annotate | Download (1.75 KB)

1 228 nfrancisco
package org.gvsig.educa.thematicmap.lib.prov.locateonthemap;
2
3
import org.gvsig.tools.ToolsLocator;
4
import org.gvsig.tools.dynobject.DynClass;
5
import org.gvsig.tools.dynobject.DynObject;
6
import org.gvsig.tools.dynobject.DynObjectManager;
7
import org.gvsig.tools.service.spi.AbstractProviderFactory;
8
import org.gvsig.tools.service.spi.Provider;
9
import org.gvsig.tools.service.spi.ProviderServices;
10
11
public class LocateOnTheMapProviderFactory extends AbstractProviderFactory {
12
13
        public static final String PROVIDER_NAME = "LocateOnTheMap";
14
        public static final String PROVIDER_DESCRIPTION = "Thematic Map provider of Locate on the map type games";
15
16
        private DynClass dynclass;
17
18
        public void initialize() {
19
                if (dynclass == null) {
20
                        DynObjectManager dynObjectManager = ToolsLocator
21
                                        .getDynObjectManager();
22
                        dynclass = dynObjectManager.createDynClass(PROVIDER_NAME,
23
                                        PROVIDER_DESCRIPTION);
24
25
                        // question text
26
                        dynclass.addDynFieldString("questionString").setMandatory(true);
27
                        // name of the column with the answers
28
                        dynclass.addDynFieldString("columnNameIDString").setMandatory(true);
29
                        // text with a description of the game (optional?)
30
                        dynclass.addDynFieldString("gameDescriptionText")
31
                                        .setMandatory(true);
32
                        //
33
34
                        dynclass.addDynFieldInt("howManyQuestions")
35
                                        .setDefaultFieldValue(Integer.valueOf(10))
36
                                        .setMandatory(true);
37
                        dynclass.addDynFieldBoolean("random")
38
                                        .setDefaultFieldValue(Boolean.TRUE).setMandatory(true);
39
40
                        dynObjectManager.add(dynclass);
41
42
                }
43
        }
44
45
        @Override
46
        protected DynClass createParametersDynClass() {
47
                if (dynclass == null) {
48
                        initialize();
49
                }
50
                return dynclass;
51
        }
52
53
        @Override
54
        protected Provider doCreate(DynObject parameters, ProviderServices services) {
55
                return new LocateOnTheMapProvider(parameters, services);
56
        }
57
58
}