gvsig-educa / org.gvsig.educa.thematicmap / trunk / org.gvsig.educa.thematicmap / org.gvsig.educa.thematicmap.lib / org.gvsig.educa.thematicmap.lib.prov.qresp / src / main / java / org / gvsig / educa / thematicmap / lib / prov / qresp / QRespThematicMapProviderFactory.java @ 226
History | View | Annotate | Download (3.44 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright � 2007-2012 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program 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
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.educa.thematicmap.lib.prov.qresp; |
24 |
|
25 |
import org.gvsig.tools.ToolsLocator; |
26 |
import org.gvsig.tools.dynobject.DynClass; |
27 |
import org.gvsig.tools.dynobject.DynObject; |
28 |
import org.gvsig.tools.dynobject.DynObjectManager; |
29 |
import org.gvsig.tools.service.spi.AbstractProviderFactory; |
30 |
import org.gvsig.tools.service.spi.Provider; |
31 |
import org.gvsig.tools.service.spi.ProviderServices; |
32 |
|
33 |
/**
|
34 |
* Thematic map factory of providers of question-response type games.
|
35 |
*
|
36 |
* @author gvSIG Team
|
37 |
* @version $Id$
|
38 |
*/
|
39 |
public class QRespThematicMapProviderFactory extends AbstractProviderFactory { |
40 |
|
41 |
public static final String PROVIDER_NAME = "ThematicMapQuestionAnswer"; |
42 |
public static final String PROVIDER_DESCRIPTION = |
43 |
"Thematic Map provider of question-response type games";
|
44 |
|
45 |
private DynClass dynclass;
|
46 |
|
47 |
public void initialize() { |
48 |
if (dynclass == null) { |
49 |
DynObjectManager dynObjectManager = |
50 |
ToolsLocator.getDynObjectManager(); |
51 |
dynclass = |
52 |
dynObjectManager.createDynClass(PROVIDER_NAME, |
53 |
PROVIDER_DESCRIPTION); |
54 |
|
55 |
dynclass.addDynFieldString("questionLayerName").setMandatory(true); |
56 |
dynclass.addDynFieldString("questionAttributeName").setMandatory(true); |
57 |
dynclass.addDynFieldString("questionAttributeID").setMandatory(true); |
58 |
dynclass.addDynFieldString("questionAttributeIDAnswerOk").setMandatory(true); |
59 |
|
60 |
dynclass.addDynFieldString("answerLayerName").setMandatory(true); |
61 |
dynclass.addDynFieldString("answerAttributeName").setMandatory(true); |
62 |
dynclass.addDynFieldString("answerQuestionID").setMandatory(true); |
63 |
|
64 |
dynclass.addDynFieldInt("howManyQuestions")
|
65 |
.setDefaultFieldValue(Integer.valueOf(10)).setMandatory(true); |
66 |
dynclass.addDynFieldBoolean("random")
|
67 |
.setDefaultFieldValue(Boolean.TRUE).setMandatory(true); |
68 |
|
69 |
dynObjectManager.add(dynclass); |
70 |
|
71 |
|
72 |
/*
|
73 |
* NombreCapa
|
74 |
* CampoIdentificadorDeItemGeografico
|
75 |
* TextoDeLaPregunta
|
76 |
* NumeroDePreguntas
|
77 |
*
|
78 |
*/
|
79 |
} |
80 |
} |
81 |
|
82 |
@Override
|
83 |
protected DynClass createParametersDynClass() {
|
84 |
if (dynclass == null) { |
85 |
initialize(); |
86 |
} |
87 |
return dynclass;
|
88 |
} |
89 |
|
90 |
@Override
|
91 |
protected Provider doCreate(DynObject parameters, ProviderServices services) { |
92 |
return new QRespThematicMapProvider(parameters, services); |
93 |
} |
94 |
|
95 |
} |