Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.swing / org.gvsig.fmap.dal.swing.impl / src / main / java / org / gvsig / fmap / dal / swing / impl / DefaultDALSwingLibrary.java @ 47049

History | View | Annotate | Download (9.56 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright � 2007-2014 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.fmap.dal.swing.impl;
24

    
25
import org.gvsig.featureform.swing.impl.DefaultJFeaturesForm;
26
import org.gvsig.featureform.swing.impl.dynformfield.ImageByteArray.JDynFormFieldImageByteArrayFactory;
27
import org.gvsig.featureform.swing.impl.dynformfield.ImageFile.JDynFormFieldImageFileFactory;
28
import org.gvsig.featureform.swing.impl.dynformfield.ImageURL.JDynFormFieldImageURLFactory;
29
import org.gvsig.featureform.swing.impl.dynformfield.deprecated.linkedentities.JDynFormFieldFeaturesTableLinkFactory;
30
import org.gvsig.featureform.swing.impl.dynformfield.deprecated.linkedentity.JDynFormFieldFeatureLinkFactory;
31
import org.gvsig.featureform.swing.impl.dynformfield.features.JDynFormFieldRelatedFeaturesFactory;
32
import org.gvsig.featureform.swing.impl.dynformfield.linkforeingkey.JDynFormFieldForeingKeyFactory;
33
import org.gvsig.featureform.swing.impl.dynformfield.dropdownforeingkey.JDynFormFieldDropdownForeingKeyFactory;
34
import org.gvsig.fmap.dal.impl.DefaultEditingNotificationManager;
35
import org.gvsig.fmap.dal.swing.DALSwingLibrary;
36
import org.gvsig.fmap.dal.swing.DALSwingLocator;
37
import org.gvsig.fmap.dal.swing.dataStoreParameters.DataStoreParametersPanelManager;
38
import org.gvsig.fmap.dal.swing.impl.actions.CopyFormAction.CopyFormActionFactory;
39
import org.gvsig.fmap.dal.swing.impl.actions.GraphAction.GraphActionFactory;
40
import org.gvsig.fmap.dal.swing.impl.actions.ReportStoreAction.ReportStoreActionFactory;
41
import org.gvsig.fmap.dal.swing.impl.actions.SelectionAddAction.SelectionAddActionFactory;
42
import org.gvsig.fmap.dal.swing.impl.actions.SelectionFilterAction.SelectionFilterActionFactory;
43
import org.gvsig.fmap.dal.swing.impl.actions.SelectionSetAction.SelectionSetActionFactory;
44
import org.gvsig.fmap.dal.swing.impl.actions.ShowFormAction.ShowFormActionFactory;
45
import org.gvsig.fmap.dal.swing.impl.actions.ShowFormForOpenStoreParametersAction;
46
import org.gvsig.fmap.dal.swing.impl.dataStoreParameters.DataStoreDynObjectParametersPanelFactory;
47
import org.gvsig.fmap.dal.swing.impl.dataStoreParameters.DefaultDataStoreParametersPanelManager;
48
import org.gvsig.fmap.dal.swing.impl.dynobjectutils.CreateComboModelFromTable;
49
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.FeatureStoreElementFactory;
50
import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryCalculatedColumnsPanel;
51
import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryGroupByPanel;
52
import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryOrderPanel;
53
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributePanel;
54
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributeSelectionPanel;
55
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributesSelectionPanel;
56
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureTypePanel;
57
import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerController;
58
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.CountAggregateOperation.CountAggregateOperationFactory;
59
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.DistinctOn;
60
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.DistinctOnFactory;
61
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.FirstAggregateOperation.FirstAggregateOperationFactory;
62
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.LastAggregateOperation.LastAggregateOperationFactory;
63
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.MaxAggregateOperation.MaxAggregateOperationFactory;
64
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.MinAggregateOperation.MinAggregateOperationFactory;
65
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.NullAggregateOperation.NullAggregateOperationFactory;
66
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.SumAggregateOperation.SumAggregateOperationFactory;
67
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel;
68
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchParameters;
69
import org.gvsig.tools.ToolsLocator;
70
import org.gvsig.tools.dynform.spi.DynFormSPILibrary;
71
import org.gvsig.tools.dynobject.DynObjectManager;
72
import org.gvsig.tools.library.AbstractLibrary;
73
import org.gvsig.tools.library.LibraryException;
74
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
75
import org.slf4j.Logger;
76
import org.slf4j.LoggerFactory;
77

    
78

    
79
/**
80
 * @author fdiaz
81
 *
82
 */
83
@SuppressWarnings("UseSpecificCatch")
84
public class DefaultDALSwingLibrary  extends AbstractLibrary{
85

    
86
    public static final String LIBRARY_NAME = "DataAccessSwingLibrary";
87
    
88
    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultDALSwingLibrary.class);
89

    
90
    @Override
91
    public void doRegistration() {
92
        registerAsImplementationOf(DALSwingLibrary.class);
93
        require(DynFormSPILibrary.class);
94
    }
95

    
96

    
97
    @Override
98
    protected void doInitialize() throws LibraryException {
99
        DALSwingLocator.registerSwingManager(DefaultDataSwingManager.class);
100
        DALSwingLocator.registerEditingNotificationManager(DefaultEditingNotificationManager.class);
101

    
102
        DALSwingLocator.registerDataStoreParametersPanelManager(DefaultDataStoreParametersPanelManager.class);
103
    }
104

    
105

    
106
    @Override
107
    protected void doPostInitialize() throws LibraryException {
108
        try {
109
            JDynFormFieldFeatureLinkFactory.selfRegister();
110
            JDynFormFieldFeaturesTableLinkFactory.selfRegister();
111
            
112
            JDynFormFieldImageByteArrayFactory.selfRegister();
113
            JDynFormFieldImageFileFactory.selfRegister();
114
            JDynFormFieldImageURLFactory.selfRegister();
115
            JDynFormFieldForeingKeyFactory.selfRegister();
116
            JDynFormFieldDropdownForeingKeyFactory.selfRegister();
117
            JDynFormFieldRelatedFeaturesFactory.selfRegister();
118
            
119
            DefaultFeatureAttributePanel.selfRegister();
120
            DefaultFeatureAttributeSelectionPanel.selfRegister();
121
            DefaultFeatureAttributesSelectionPanel.selfRegister();
122
            DefaultFeatureTypePanel.selfRegister();
123
            
124
            DefaultFeatureQueryCalculatedColumnsPanel.selfRegister();
125
            DefaultFeatureQueryGroupByPanel.selfRegister();
126
            DefaultFeatureQueryOrderPanel.selfRegister();
127
            
128
            DefaultSearchPanel.selfRegister();
129
            
130
            JDBCConnectionPickerController.selfRegister();
131
            DefaultJFeaturesForm.selfRegister();
132
            DefaultSearchParameters.registerPersistence();
133

    
134
            DynObjectManager dynObjectmanager = ToolsLocator.getDynObjectManager();
135
            dynObjectmanager.registerDynMethod(new CreateComboModelFromTable("DAL.createComboModelFromTable", "XXXXXXXXXXXXXXXXXXXX."));
136
            
137
            
138
            DataStoreParametersPanelManager dataStoreParametersPanelManager;
139
            try {
140
                dataStoreParametersPanelManager = DALSwingLocator.getDataStoreParametersPanelManager();
141
                dataStoreParametersPanelManager.registerFactory(new DataStoreDynObjectParametersPanelFactory());
142
            } catch(ReferenceNotRegisteredException ex) {
143
                LOGGER.debug("Can't locate DataStoreParametersPanelManager");
144
            }
145
            
146

    
147
            DefaultEditingNotificationManager.selfRegister();
148
            ProjectionPickerControllerImpl.selfRegister();
149
            
150
            DistinctOnFactory.selfRegister();
151
            DistinctOn.registerAggregateOperation(new MinAggregateOperationFactory());
152
            DistinctOn.registerAggregateOperation(new MaxAggregateOperationFactory());
153
            DistinctOn.registerAggregateOperation(new SumAggregateOperationFactory());
154
            DistinctOn.registerAggregateOperation(new CountAggregateOperationFactory());
155
            DistinctOn.registerAggregateOperation(new FirstAggregateOperationFactory());
156
            DistinctOn.registerAggregateOperation(new LastAggregateOperationFactory());
157
            DistinctOn.registerAggregateOperation(new NullAggregateOperationFactory());
158
            
159
            ShowFormForOpenStoreParametersAction.selfRegister();
160
            
161
            SelectionAddActionFactory.selfRegister();
162
            SelectionFilterActionFactory.selfRegister();
163
            SelectionSetActionFactory.selfRegister();
164
            ShowFormActionFactory.selfRegister();
165
            CopyFormActionFactory.selfRegister();
166
            ReportStoreActionFactory.selfRegister();
167
            GraphActionFactory.selfRegister();
168
        
169
        } catch(Exception ex) {
170
            LOGGER.warn("Can't register DAL components in DynForms",ex);
171
        }
172
        try {
173
            FeatureStoreElementFactory.selfRegister();
174
        } catch(Exception ex) {
175
            LOGGER.warn("Can't register DAL components in ExpressionEvaluator",ex);
176
        }
177
    }
178

    
179
}