Statistics
| Revision:

svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.library / org.gvsig.raster / org.gvsig.raster.swing / org.gvsig.raster.swing.buffer / org.gvsig.raster.swing.buffer.impl / src / main / java / org / gvsig / raster / swing / buffer / impl / operations / dynformfield / JDynFormFieldKernelFactory.java @ 43806

History | View | Annotate | Download (2.97 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.raster.swing.buffer.impl.operations.dynformfield;
25

    
26
import org.gvsig.raster.lib.buffer.api.Kernel;
27
import org.gvsig.tools.ToolsLocator;
28
import org.gvsig.tools.dataTypes.DataTypes;
29
import org.gvsig.tools.dynform.spi.DynFormSPILocator;
30
import org.gvsig.tools.dynform.spi.DynFormSPIManager;
31
import org.gvsig.tools.dynform.spi.JDynFormFieldFactory;
32
import org.gvsig.tools.dynobject.DynField;
33
import org.gvsig.tools.dynobject.DynObject;
34
import org.gvsig.tools.dynobject.DynObjectManager;
35
import org.gvsig.tools.dynobject.DynStruct;
36
import org.gvsig.tools.service.Service;
37
import org.gvsig.tools.service.ServiceException;
38
import org.gvsig.tools.service.spi.ServiceManager;
39

    
40
/**
41
 * @author fdiaz
42
 *
43
 */
44
public class JDynFormFieldKernelFactory implements JDynFormFieldFactory {
45

    
46
        private String name = null;
47
        private DynStruct parametersDefinition = null;
48

    
49
        @Override
50
        public String getName() {
51
                if( name == null ) {
52
                        DynFormSPIManager manager = DynFormSPILocator.getDynFormSPIManager();
53
                        this.name = manager.makeServiceName(DataTypes.DYNOBJECT, "kernel");
54
                }
55
                return this.name;
56
        }
57

    
58

    
59
        @Override
60
        public Service create(DynObject parameters, ServiceManager serviceManager)
61
                        throws ServiceException {
62
                return new JDynFormFieldKernel(parameters, serviceManager);
63
        }
64

    
65
        @Override
66
        public DynObject createParameters() {
67
                return ToolsLocator.getDynObjectManager().createDynObject(parametersDefinition);
68
        }
69

    
70
        @Override
71
        public void initialize() {
72
                if( this.parametersDefinition == null ) {
73
                        String serviceName = this.getName();
74
                    DynObjectManager manager = ToolsLocator.getDynObjectManager();
75
                    this.parametersDefinition = manager.createDynClass(
76
                                    serviceName, "Parameters definition for Feature links fields in dynamic forms");
77
                    this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_FIELDDEFINITION)
78
                                .setClassOfValue(Kernel.class).setMandatory(true);
79
                    this.parametersDefinition.addDynFieldObject(DynFormSPIManager.FIELD_VALUE)
80
                                .setClassOfValue(Kernel.class).setMandatory(true);
81
                }
82
        }
83

    
84

    
85
}