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 @ 47426
History | View | Annotate | Download (13.5 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.featuretable.SimpleFeatureReferencesTableModelImpl; |
54 |
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModelImpl; |
55 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributePanel; |
56 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributeSelectionPanel; |
57 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributesSelectionPanel; |
58 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureTypePanel; |
59 |
import org.gvsig.fmap.dal.swing.impl.featuretype.FeatureTypeEditorFactory; |
60 |
import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerControllerImpl; |
61 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.CountAggregateOperation.CountAggregateOperationFactory; |
62 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.DistinctOn; |
63 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.DistinctOnFactory; |
64 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.FirstAggregateOperation.FirstAggregateOperationFactory; |
65 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.LastAggregateOperation.LastAggregateOperationFactory; |
66 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.MaxAggregateOperation.MaxAggregateOperationFactory; |
67 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.MinAggregateOperation.MinAggregateOperationFactory; |
68 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.NullAggregateOperation.NullAggregateOperationFactory; |
69 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.STConvexHullAggregateOperation; |
70 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.STConvexHullAggregateOperation.STConvexHullAggregateOperationFactory; |
71 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.STExtentAggregateOperation.STExtentAggregateOperationFactory; |
72 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.STIntersectionAggregateOperation.STIntersectionAggregateOperationFactory; |
73 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.STUnionAggregateOperation.STUnionAggregateOperationFactory; |
74 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.SumAggregateOperation.SumAggregateOperationFactory; |
75 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel; |
76 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchParameters; |
77 |
import org.gvsig.tools.ToolsLocator; |
78 |
import org.gvsig.tools.dynform.spi.DynFormSPILibrary; |
79 |
import org.gvsig.tools.dynobject.DynObjectManager; |
80 |
import org.gvsig.tools.library.AbstractLibrary; |
81 |
import org.gvsig.tools.library.LibraryException; |
82 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
83 |
import org.gvsig.tools.swing.api.ToolsSwingUtils; |
84 |
import org.slf4j.Logger; |
85 |
import org.slf4j.LoggerFactory; |
86 |
|
87 |
|
88 |
/**
|
89 |
* @author fdiaz
|
90 |
*
|
91 |
*/
|
92 |
@SuppressWarnings("UseSpecificCatch") |
93 |
public class DefaultDALSwingLibrary extends AbstractLibrary{ |
94 |
|
95 |
public static final String LIBRARY_NAME = "DataAccessSwingLibrary"; |
96 |
|
97 |
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultDALSwingLibrary.class); |
98 |
|
99 |
@Override
|
100 |
public void doRegistration() { |
101 |
registerAsImplementationOf(DALSwingLibrary.class); |
102 |
require(DynFormSPILibrary.class); |
103 |
} |
104 |
|
105 |
|
106 |
@Override
|
107 |
protected void doInitialize() throws LibraryException { |
108 |
DALSwingLocator.registerSwingManager(DefaultDataSwingManager.class); |
109 |
DALSwingLocator.registerEditingNotificationManager(DefaultEditingNotificationManager.class); |
110 |
|
111 |
DALSwingLocator.registerDataStoreParametersPanelManager(DefaultDataStoreParametersPanelManager.class); |
112 |
} |
113 |
|
114 |
|
115 |
@Override
|
116 |
protected void doPostInitialize() throws LibraryException { |
117 |
try {
|
118 |
JDynFormFieldFeatureLinkFactory.selfRegister(); |
119 |
JDynFormFieldFeaturesTableLinkFactory.selfRegister(); |
120 |
|
121 |
JDynFormFieldImageByteArrayFactory.selfRegister(); |
122 |
JDynFormFieldImageFileFactory.selfRegister(); |
123 |
JDynFormFieldImageURLFactory.selfRegister(); |
124 |
JDynFormFieldForeingKeyFactory.selfRegister(); |
125 |
JDynFormFieldDropdownForeingKeyFactory.selfRegister(); |
126 |
JDynFormFieldRelatedFeaturesFactory.selfRegister(); |
127 |
|
128 |
DefaultFeatureAttributePanel.selfRegister(); |
129 |
DefaultFeatureAttributeSelectionPanel.selfRegister(); |
130 |
DefaultFeatureAttributesSelectionPanel.selfRegister(); |
131 |
DefaultFeatureTypePanel.selfRegister(); |
132 |
|
133 |
DefaultFeatureQueryCalculatedColumnsPanel.selfRegister(); |
134 |
DefaultFeatureQueryGroupByPanel.selfRegister(); |
135 |
DefaultFeatureQueryOrderPanel.selfRegister(); |
136 |
|
137 |
DefaultSearchPanel.selfRegister(); |
138 |
|
139 |
JDBCConnectionPickerControllerImpl.selfRegister(); |
140 |
DefaultJFeaturesForm.selfRegister(); |
141 |
DefaultSearchParameters.registerPersistence(); |
142 |
|
143 |
DynObjectManager dynObjectmanager = ToolsLocator.getDynObjectManager(); |
144 |
dynObjectmanager.registerDynMethod(new CreateComboModelFromTable("DAL.createComboModelFromTable", "XXXXXXXXXXXXXXXXXXXX.")); |
145 |
|
146 |
|
147 |
DataStoreParametersPanelManager dataStoreParametersPanelManager; |
148 |
try {
|
149 |
dataStoreParametersPanelManager = DALSwingLocator.getDataStoreParametersPanelManager(); |
150 |
dataStoreParametersPanelManager.registerFactory(new DataStoreDynObjectParametersPanelFactory());
|
151 |
} catch(ReferenceNotRegisteredException ex) {
|
152 |
LOGGER.debug("Can't locate DataStoreParametersPanelManager");
|
153 |
} |
154 |
|
155 |
registerIcons(); |
156 |
|
157 |
DefaultEditingNotificationManager.selfRegister(); |
158 |
ProjectionPickerControllerImpl.selfRegister(); |
159 |
|
160 |
DistinctOnFactory.selfRegister(); |
161 |
DistinctOn.registerAggregateOperation(new MinAggregateOperationFactory());
|
162 |
DistinctOn.registerAggregateOperation(new MaxAggregateOperationFactory());
|
163 |
DistinctOn.registerAggregateOperation(new SumAggregateOperationFactory());
|
164 |
DistinctOn.registerAggregateOperation(new CountAggregateOperationFactory());
|
165 |
DistinctOn.registerAggregateOperation(new FirstAggregateOperationFactory());
|
166 |
DistinctOn.registerAggregateOperation(new LastAggregateOperationFactory());
|
167 |
DistinctOn.registerAggregateOperation(new NullAggregateOperationFactory());
|
168 |
|
169 |
DistinctOn.registerAggregateOperation(new STConvexHullAggregateOperationFactory());
|
170 |
DistinctOn.registerAggregateOperation(new STExtentAggregateOperationFactory());
|
171 |
// DistinctOn.registerAggregateOperation(new STIntersectionAggregateOperationFactory());
|
172 |
DistinctOn.registerAggregateOperation(new STUnionAggregateOperationFactory());
|
173 |
|
174 |
ShowFormForOpenStoreParametersAction.selfRegister(); |
175 |
|
176 |
SelectionAddActionFactory.selfRegister(); |
177 |
SelectionFilterActionFactory.selfRegister(); |
178 |
SelectionSetActionFactory.selfRegister(); |
179 |
ShowFormActionFactory.selfRegister(); |
180 |
CopyFormActionFactory.selfRegister(); |
181 |
ReportStoreActionFactory.selfRegister(); |
182 |
GraphActionFactory.selfRegister(); |
183 |
|
184 |
SimpleFeaturesTableModelImpl.selfRegister(); |
185 |
|
186 |
FeatureTypeEditorFactory.selfRegister(); |
187 |
} catch(Exception ex) { |
188 |
LOGGER.warn("Can't register DAL components in DynForms",ex);
|
189 |
} |
190 |
try {
|
191 |
FeatureStoreElementFactory.selfRegister(); |
192 |
} catch(Exception ex) { |
193 |
LOGGER.warn("Can't register DAL components in ExpressionEvaluator",ex);
|
194 |
} |
195 |
} |
196 |
|
197 |
private void registerIcons() { |
198 |
ToolsSwingUtils.registerIcons( |
199 |
DefaultDALSwingLibrary.class, |
200 |
"/org/gvsig/fmap/dal/images",
|
201 |
LIBRARY_NAME, |
202 |
new String[]{"dal", "featurestore-column", "featurestore-members"}, |
203 |
new String[]{"dal", "featurestore-foreing-key", "featurestore-members"}, |
204 |
new String[]{"dal", "featurestore-table", "featurestore-members"}, |
205 |
new String[]{"dal", "featurestore-calculated-column", "featurestore-members"}, |
206 |
new String[]{"dal", "featurestore-query-calculated-column", "featurestore-members"} |
207 |
); |
208 |
ToolsSwingUtils.registerSubgroupIconScreenshot( |
209 |
DefaultDALSwingLibrary.class, |
210 |
"dal",
|
211 |
"featurestore-members",
|
212 |
"/org/gvsig/fmap/dal/screenshots/featurestore-members.png"
|
213 |
); |
214 |
|
215 |
ToolsSwingUtils.registerIcons( |
216 |
DefaultDALSwingLibrary.class, |
217 |
"/org/gvsig/fmap/dal/storegeomtypes",
|
218 |
LIBRARY_NAME, |
219 |
new String[]{"storegeomtypes", "store-geomtype-line-sel"}, |
220 |
new String[]{"storegeomtypes", "store-geomtype-line"}, |
221 |
new String[]{"storegeomtypes", "store-geomtype-mix-sel"}, |
222 |
new String[]{"storegeomtypes", "store-geomtype-mix"}, |
223 |
new String[]{"storegeomtypes", "store-geomtype-multiline-sel"}, |
224 |
new String[]{"storegeomtypes", "store-geomtype-multiline"}, |
225 |
new String[]{"storegeomtypes", "store-geomtype-multipoint-sel"}, |
226 |
new String[]{"storegeomtypes", "store-geomtype-multipoint"}, |
227 |
new String[]{"storegeomtypes", "store-geomtype-multipolygon-sel"}, |
228 |
new String[]{"storegeomtypes", "store-geomtype-multipolygon"}, |
229 |
new String[]{"storegeomtypes", "store-geomtype-point-sel"}, |
230 |
new String[]{"storegeomtypes", "store-geomtype-point"}, |
231 |
new String[]{"storegeomtypes", "store-geomtype-polygon-sel"}, |
232 |
new String[]{"storegeomtypes", "store-geomtype-polygon"}, |
233 |
new String[]{"storegeomtypes", "store-geomtype-raster"}, |
234 |
|
235 |
new String[]{"storegeomtypes", "store-geomtype-wrong"} |
236 |
); |
237 |
ToolsSwingUtils.registerGroupIconDescription( |
238 |
"storegeomtypes",
|
239 |
"Images used in lists, dropdowns, and trees displaying layer names to indicate the type of geometry of the layer."
|
240 |
); |
241 |
|
242 |
} |
243 |
|
244 |
} |