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 / DefaultDataSwingManager.java @ 46421
History | View | Annotate | Download (23.7 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 java.util.Collection; |
26 |
import java.util.Collections; |
27 |
import java.util.HashMap; |
28 |
import java.util.LinkedHashMap; |
29 |
import java.util.List; |
30 |
import java.util.Map; |
31 |
import java.util.function.Predicate; |
32 |
import javax.swing.AbstractButton; |
33 |
import javax.swing.Action; |
34 |
import javax.swing.JButton; |
35 |
import javax.swing.JComboBox; |
36 |
import javax.swing.JList; |
37 |
import javax.swing.JTextField; |
38 |
import javax.swing.text.JTextComponent; |
39 |
import javax.swing.tree.TreeModel; |
40 |
import org.apache.commons.lang3.StringUtils; |
41 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
42 |
import org.gvsig.expressionevaluator.swing.Element; |
43 |
import org.gvsig.expressionevaluator.swing.ExpressionBuilderConfig; |
44 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
45 |
import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
46 |
import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
47 |
import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
48 |
import org.gvsig.featureform.swing.CreateJFeatureFormException; |
49 |
import org.gvsig.featureform.swing.FeaturesFormContext; |
50 |
import org.gvsig.featureform.swing.JFeatureForm; |
51 |
import org.gvsig.featureform.swing.JFeatureReferencesForm; |
52 |
|
53 |
import org.gvsig.featureform.swing.JFeaturesForm; |
54 |
import org.gvsig.featureform.swing.impl.DefaultFeaturesFormContext; |
55 |
import org.gvsig.featureform.swing.impl.DefaultJFeatureForm; |
56 |
import org.gvsig.featureform.swing.impl.DefaultJFeatureReferencesForm; |
57 |
import org.gvsig.featureform.swing.impl.DefaultJFeaturesForm; |
58 |
import org.gvsig.fmap.dal.DALLocator; |
59 |
import org.gvsig.fmap.dal.DataManager; |
60 |
import org.gvsig.fmap.dal.DataStoreProviderFactory; |
61 |
import org.gvsig.fmap.dal.StoresRepository; |
62 |
import org.gvsig.fmap.dal.exception.DataException; |
63 |
import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable; |
64 |
import org.gvsig.fmap.dal.feature.Feature; |
65 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
66 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
67 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
68 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
69 |
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
70 |
import org.gvsig.fmap.dal.feature.FeatureType; |
71 |
import org.gvsig.fmap.dal.feature.FeatureTypeDefinitionsManager; |
72 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
73 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
74 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
75 |
import org.gvsig.fmap.dal.swing.FeatureTableModel; |
76 |
import org.gvsig.fmap.dal.swing.JFeatureTable; |
77 |
import org.gvsig.fmap.dal.swing.expressionevaluator.FeatureStoreElement; |
78 |
import org.gvsig.fmap.dal.swing.featuretype.AttributeDescriptorPickerController; |
79 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypeAttributePanel; |
80 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypePanel; |
81 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.DefaultFeatureStoreElement2; |
82 |
import org.gvsig.fmap.dal.swing.impl.featuretable.FeatureTablePanel; |
83 |
import org.gvsig.fmap.dal.swing.impl.featuretable.table.DefaultFeatureTableModel; |
84 |
import org.gvsig.fmap.dal.swing.impl.featuretable.table.EmptyFeatureTableModel; |
85 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultAttributeDescriptorPickerController; |
86 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributePanel; |
87 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureTypePanel; |
88 |
import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionPanel; |
89 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel; |
90 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionAddAction.SelectionAddActionFactory; |
91 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionFilterAction.SelectionFilterActionFactory; |
92 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionSetAction.SelectionSetActionFactory; |
93 |
import org.gvsig.fmap.dal.swing.impl.actions.ShowFormAction.ShowFormActionFactory; |
94 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionPanel; |
95 |
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
96 |
import org.gvsig.tools.dynform.DynFormLocator; |
97 |
import org.gvsig.tools.dynobject.DynClass; |
98 |
import org.gvsig.tools.dynobject.DynStruct; |
99 |
import org.gvsig.tools.exception.BaseException; |
100 |
import org.gvsig.fmap.dal.swing.DALActionFactory; |
101 |
import org.gvsig.fmap.dal.swing.DALActionFactory.DALActionContext; |
102 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
103 |
import org.gvsig.fmap.dal.swing.ProjectionPickerController; |
104 |
import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModelImpl; |
105 |
import org.gvsig.fmap.dal.swing.impl.featuretype.FeatureAttributeListCellRendererImpl; |
106 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributesSelectionPanel; |
107 |
import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionDialog; |
108 |
import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerController; |
109 |
import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryOrderPanel; |
110 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
111 |
import org.gvsig.fmap.dal.swing.searchpanel.SearchConditionPanel.SearchConditionPanelFactory; |
112 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
113 |
import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryOrderPanel; |
114 |
import org.gvsig.fmap.dal.swing.featuretable.SimpleFeaturesTableModel; |
115 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureAttributeListCellRenderer; |
116 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureAttributesSelectionPanel; |
117 |
import org.gvsig.fmap.dal.swing.impl.actions.GraphAction.GraphActionFactory; |
118 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.CheckTableFieldsSuggestionProviderFactory; |
119 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.QuotesForFieldNameSuggestionProviderFactory; |
120 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.StorePointFieldSuggestionProviderFactory; |
121 |
import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.WrongNameFieldSuggestionProviderFactory; |
122 |
import org.gvsig.fmap.dal.swing.impl.storerepository.StoresRepositoryTreeModel; |
123 |
import org.gvsig.fmap.dal.swing.searchPostProcess.SearchPostProcessFactory; |
124 |
import org.gvsig.tools.dynform.DynFormDefinition; |
125 |
|
126 |
|
127 |
/**
|
128 |
* @author fdiaz
|
129 |
*
|
130 |
*/
|
131 |
@SuppressWarnings("UseSpecificCatch") |
132 |
public class DefaultDataSwingManager implements DataSwingManager { |
133 |
|
134 |
private final Map<String,DALActionFactory> featureStoreSearchActions; |
135 |
private final Map<String,SearchPostProcessFactory> searchPostProcess; |
136 |
private Map<String,SearchConditionPanelFactory> searchConditionPanelFactories; |
137 |
|
138 |
public DefaultDataSwingManager() {
|
139 |
this.featureStoreSearchActions = new LinkedHashMap<>(); |
140 |
this.registerStoreAction(new SelectionAddActionFactory()); |
141 |
this.registerStoreAction(new SelectionFilterActionFactory()); |
142 |
this.registerStoreAction(new SelectionSetActionFactory()); |
143 |
this.registerStoreAction(new ShowFormActionFactory()); |
144 |
this.registerStoreAction(new GraphActionFactory()); |
145 |
|
146 |
this.searchPostProcess = new HashMap<>(); |
147 |
} |
148 |
|
149 |
@Override
|
150 |
public JFeaturesForm createJFeaturesForm(FeatureStore store) throws CreateJFeatureFormException { |
151 |
try {
|
152 |
FeatureType featureType = store.getDefaultFeatureType(); |
153 |
|
154 |
DefaultJFeaturesForm form = new DefaultJFeaturesForm();
|
155 |
form.bind(store, featureType2DynClass(store, featureType), null);
|
156 |
return form;
|
157 |
|
158 |
} catch (Exception ex) { |
159 |
throw new CreateJFeatureFormException(ex); |
160 |
} |
161 |
} |
162 |
|
163 |
@Override
|
164 |
public JFeaturesForm createJFeaturesForm(FeatureStore store, FeatureQuery query) throws CreateJFeatureFormException { |
165 |
try {
|
166 |
FeatureType featureType = store.getDefaultFeatureType(); |
167 |
|
168 |
DefaultJFeaturesForm form = new DefaultJFeaturesForm();
|
169 |
form.bind(store, featureType2DynClass(store, featureType), query); |
170 |
return form;
|
171 |
|
172 |
} catch (Exception ex) { |
173 |
throw new CreateJFeatureFormException(ex); |
174 |
} |
175 |
} |
176 |
|
177 |
public DynClass featureType2DynClass(FeatureStore store, FeatureType type) {
|
178 |
FeatureTypeDefinitionsManager featureTypeDefinitionsManager = DALLocator.getFeatureTypeDefinitionsManager(); |
179 |
if( featureTypeDefinitionsManager.contains(store,type) ) {
|
180 |
// Force reload next call to get.
|
181 |
featureTypeDefinitionsManager.remove(store,type); |
182 |
} |
183 |
DynClass dynClass = featureTypeDefinitionsManager.get(store,type); |
184 |
// Force reload next call to get.
|
185 |
DynFormLocator.getDynFormManager().removeDefinition(dynClass.getName()); |
186 |
return dynClass;
|
187 |
} |
188 |
|
189 |
@Override
|
190 |
public JDBCConnectionPanel createJDBCConnectionPanel() {
|
191 |
JDBCConnectionPanel x = new DefaultJDBCConnectionPanel();
|
192 |
return x;
|
193 |
} |
194 |
|
195 |
@Override
|
196 |
public JDBCConnectionDialog createJDBCConectionDialog() {
|
197 |
JDBCConnectionDialog x = new DefaultJDBCConnectionDialog();
|
198 |
return x;
|
199 |
} |
200 |
|
201 |
@Override
|
202 |
public void configureExpressionBuilder(ExpressionBuilderConfig builder, FeatureStore store) { |
203 |
DataManager dataManager = DALLocator.getDataManager(); |
204 |
FeatureSymbolTable featureSymbolTable = dataManager.createFeatureSymbolTable(); |
205 |
|
206 |
builder.removeAllElements(); |
207 |
FeatureStoreProviderFactory storeFactory = (FeatureStoreProviderFactory) store.getProviderFactory(); |
208 |
Feature sampleFeature = store.getSampleFeature(); |
209 |
builder.setAllowedFunctions(storeFactory.allowFunction()); |
210 |
if( sampleFeature!=null ) { |
211 |
featureSymbolTable.setFeature(sampleFeature); |
212 |
builder.setPreviewSymbolTable(featureSymbolTable.createParent()); |
213 |
} |
214 |
builder.addSymbolTable(featureSymbolTable); |
215 |
FeatureStoreElement storeElement = new DefaultFeatureStoreElement2(store);
|
216 |
builder.addElement(storeElement); |
217 |
if( store.getProviderFactory().hasSQLSupport()==DataStoreProviderFactory.YES ) {
|
218 |
builder.getPreferences().setSQLCompatible(true);
|
219 |
} |
220 |
builder.addSuggestionFactory(new StorePointFieldSuggestionProviderFactory(store));
|
221 |
builder.addSuggestionFactory(new QuotesForFieldNameSuggestionProviderFactory(store));
|
222 |
builder.addSuggestionFactory(new WrongNameFieldSuggestionProviderFactory(store));
|
223 |
builder.addSuggestionFactory(new CheckTableFieldsSuggestionProviderFactory(store));
|
224 |
} |
225 |
|
226 |
@Override
|
227 |
public void resetExpressionBuilder(ExpressionBuilderConfig builder) { |
228 |
builder.removeAllElements(); |
229 |
builder.setPreviewSymbolTable(ExpressionUtils.createSymbolTable()); |
230 |
} |
231 |
|
232 |
@Override
|
233 |
public void addToExpressionBuilder(ExpressionBuilderConfig builder, FeatureStore store, String name) { |
234 |
// Este metodo permite a?adir mas de un store al builder llamandolo
|
235 |
// con un name distinto para cada store. En el arbol se presentaran todos
|
236 |
// los stores que se configuren en el builder.
|
237 |
// Ojo, que las expresiones creadas por estos builder no son compatible
|
238 |
// con SQL.
|
239 |
DataManager dataManager = DALLocator.getDataManager(); |
240 |
|
241 |
// Creamos el store-element y lo a?adimos al builder
|
242 |
FeatureStoreElement n = new DefaultFeatureStoreElement2(store, name);
|
243 |
builder.addElement(n); |
244 |
|
245 |
// Creamos una tabla de simbolos de ejemplo basada en el store, y la
|
246 |
// a?adimos a la tabla de simbolos de previsualizacion del builder.
|
247 |
FeatureSymbolTable featureSymbolTable = dataManager.createFeatureSymbolTable(); |
248 |
Feature sampleFeature = store.getSampleFeature(); |
249 |
if( sampleFeature!=null ) { |
250 |
featureSymbolTable.setFeature(sampleFeature); |
251 |
builder.getPreviewSymbolTable().addSymbolTable(featureSymbolTable); |
252 |
} |
253 |
|
254 |
// forzamos a que al insertar campos de un store se indique siempre
|
255 |
// en nombre del store. Necesario si hay mas de un store en el builder.
|
256 |
List<Element> elements = builder.getElements(); |
257 |
for (Element item : elements) { |
258 |
if( item instanceof FeatureStoreElement ) { |
259 |
((FeatureStoreElement)item).setUseFullyQualifiedNames(true);
|
260 |
} |
261 |
} |
262 |
// Marcamos como no compatible sql las expresiones que vamos a generar.
|
263 |
builder.getPreferences().setSQLCompatible(false);
|
264 |
|
265 |
// A?adimos los generadores de sugerencias.
|
266 |
builder.addSuggestionFactory(new StorePointFieldSuggestionProviderFactory(store));
|
267 |
builder.addSuggestionFactory(new QuotesForFieldNameSuggestionProviderFactory(store));
|
268 |
builder.addSuggestionFactory(new WrongNameFieldSuggestionProviderFactory(store));
|
269 |
builder.addSuggestionFactory(new CheckTableFieldsSuggestionProviderFactory(store));
|
270 |
} |
271 |
|
272 |
@Override
|
273 |
public JExpressionBuilder createQueryFilterExpresion(FeatureStore store) {
|
274 |
return this.createJExpressionBuilder(store); |
275 |
} |
276 |
|
277 |
@Override
|
278 |
public JExpressionBuilder createJExpressionBuilder(final FeatureStore store) { |
279 |
ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
280 |
final JExpressionBuilder builder = expressionSwingManager.createJExpressionBuilder();
|
281 |
this.configureExpressionBuilder(builder, store);
|
282 |
builder.expandElement( |
283 |
(Element t) -> t!=null && StringUtils.equals(t.getName(),store.getName()) |
284 |
); |
285 |
return builder;
|
286 |
} |
287 |
|
288 |
@Override
|
289 |
public ExpressionPickerController createExpressionPickerController(FeatureStore store, JTextComponent text, JButton button, JButton bookmarks, JButton history) { |
290 |
ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
291 |
ExpressionPickerController builder = expressionSwingManager.createExpressionPickerController(text, button, bookmarks, history); |
292 |
this.configureExpressionBuilder(builder, store);
|
293 |
return builder;
|
294 |
} |
295 |
|
296 |
@Override
|
297 |
public JFeatureForm createJFeatureForm(FeatureStore store) throws CreateJFeatureFormException { |
298 |
JFeatureForm form = new DefaultJFeatureForm();
|
299 |
form.setStore(store); |
300 |
return form;
|
301 |
} |
302 |
|
303 |
@Override
|
304 |
public JFeatureReferencesForm createJFeatureReferencesForm(FeatureStore store, List<FeatureReference> references) throws CreateJFeatureFormException { |
305 |
JFeatureReferencesForm form = new DefaultJFeatureReferencesForm();
|
306 |
form.bind(store, references); |
307 |
return form;
|
308 |
} |
309 |
|
310 |
@Override
|
311 |
public JFeatureForm createJFeatureForm(Feature feature) throws CreateJFeatureFormException { |
312 |
JFeatureForm form = new DefaultJFeatureForm();
|
313 |
form.setFeature(feature); |
314 |
return form;
|
315 |
} |
316 |
|
317 |
@Override
|
318 |
public JFeatureForm createJFeatureForm(DynFormDefinition definicion) throws CreateJFeatureFormException { |
319 |
JFeatureForm form = new DefaultJFeatureForm();
|
320 |
form.setDefinition(definicion); |
321 |
return form;
|
322 |
} |
323 |
|
324 |
@Override
|
325 |
public JFeatureTable createJFeatureTable(FeatureTableModel model) {
|
326 |
return this.createJFeatureTable(model, true); |
327 |
} |
328 |
|
329 |
@Override
|
330 |
public JFeatureTable createJFeatureTable(FeatureTableModel model, boolean isDoubleBuffered) { |
331 |
return new FeatureTablePanel(model, isDoubleBuffered); |
332 |
} |
333 |
|
334 |
@Override
|
335 |
public FeatureTableModel createEmptyFeatureTableModel(DynStruct struct) {
|
336 |
return new EmptyFeatureTableModel(struct); |
337 |
} |
338 |
|
339 |
@Override
|
340 |
public FeatureTableModel createFeatureTableModel(FeatureStore featureStore,
|
341 |
FeatureQuery featureQuery) { |
342 |
try {
|
343 |
FeaturePagingHelper pager = DALLocator.getDataManager().createFeaturePagingHelper( |
344 |
featureStore, featureQuery, |
345 |
FeaturePagingHelper.DEFAULT_PAGE_SIZE |
346 |
); |
347 |
return this.createFeatureTableModel(pager); |
348 |
} catch (BaseException ex) {
|
349 |
throw new RuntimeException("Can't create a FeatureTableModel.", ex); |
350 |
} |
351 |
} |
352 |
|
353 |
@Override
|
354 |
public FeatureTableModel createFeatureTableModel(FeaturePagingHelper featurePager) {
|
355 |
return new DefaultFeatureTableModel(featurePager); |
356 |
} |
357 |
|
358 |
@Override
|
359 |
public ProjectionPickerController createProjectionPickerController(
|
360 |
JTextField txtProjection,
|
361 |
JButton btnSelectProjection
|
362 |
) { |
363 |
ProjectionPickerControllerImpl picker = new ProjectionPickerControllerImpl(txtProjection, btnSelectProjection);
|
364 |
return picker;
|
365 |
} |
366 |
|
367 |
@Override
|
368 |
public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JComboBox combo) { |
369 |
AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(combo, null); |
370 |
return controller;
|
371 |
} |
372 |
|
373 |
@Override
|
374 |
public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JList list) { |
375 |
AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(list, null); |
376 |
return controller;
|
377 |
} |
378 |
|
379 |
@Override
|
380 |
public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JComboBox combo, Predicate<FeatureAttributeDescriptor> filter) { |
381 |
AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(combo, filter);
|
382 |
return controller;
|
383 |
} |
384 |
|
385 |
@Override
|
386 |
public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JList list, Predicate<FeatureAttributeDescriptor> filter) { |
387 |
AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(list, filter);
|
388 |
return controller;
|
389 |
} |
390 |
|
391 |
@Override
|
392 |
public FeatureTypePanel createFeatureTypePanel() {
|
393 |
FeatureTypePanel panel = new DefaultFeatureTypePanel();
|
394 |
return panel;
|
395 |
} |
396 |
|
397 |
@Override
|
398 |
public FeatureTypeAttributePanel createFeatureTypeAttributePanel() {
|
399 |
FeatureTypeAttributePanel panel = new DefaultFeatureAttributePanel();
|
400 |
return panel;
|
401 |
} |
402 |
|
403 |
@Override
|
404 |
public FeatureStoreElement createFeatureStoreElement() {
|
405 |
FeatureStoreElement e = new DefaultFeatureStoreElement2(null); |
406 |
return e;
|
407 |
} |
408 |
|
409 |
@Override
|
410 |
public FeatureStoreElement createFeatureStoreElement(FeatureStore store) {
|
411 |
FeatureStoreElement e = new DefaultFeatureStoreElement2(store);
|
412 |
return e;
|
413 |
} |
414 |
|
415 |
@Override
|
416 |
public ExpressionPickerController createExpressionPickerController(FeatureStore store, JTextComponent text, JButton button) { |
417 |
FeatureSymbolTable previewSymbolTable = DALLocator.getManager().createFeatureSymbolTable(); |
418 |
previewSymbolTable.setFeature(store.getSampleFeature()); |
419 |
|
420 |
ExpressionPickerController controller = ExpressionEvaluatorSwingLocator.getManager().createExpressionPickerController(text, button); |
421 |
controller.addElement(this.createFeatureStoreElement(store));
|
422 |
controller.setPreviewSymbolTable(previewSymbolTable); |
423 |
|
424 |
return controller;
|
425 |
} |
426 |
|
427 |
|
428 |
@Override
|
429 |
public FeatureStoreSearchPanel createFeatureStoreSearchPanel(FeatureStore store) {
|
430 |
DefaultSearchPanel e = new DefaultSearchPanel(store);
|
431 |
return e;
|
432 |
} |
433 |
|
434 |
@Override
|
435 |
public final void registerStoreAction(DALActionFactory action) { |
436 |
this.featureStoreSearchActions.put(action.getName().toLowerCase(), action);
|
437 |
} |
438 |
|
439 |
@Override
|
440 |
public Collection<DALActionFactory> getStoreActions() { |
441 |
return Collections.unmodifiableCollection(this.featureStoreSearchActions.values()); |
442 |
} |
443 |
|
444 |
@Override
|
445 |
public DALActionFactory getStoreAction(String name) { |
446 |
DALActionFactory action = this.featureStoreSearchActions.get(name.toLowerCase());
|
447 |
return action;
|
448 |
} |
449 |
|
450 |
@Override
|
451 |
public void setStoreAction(AbstractButton component, String name, boolean preserveLabel, DALActionContext context) { |
452 |
DALActionFactory factory = this.getStoreAction(name);
|
453 |
Action action = factory.createAction(context);
|
454 |
if( preserveLabel ) {
|
455 |
String s = component.getText();
|
456 |
component.setAction(action); |
457 |
component.setText(s); |
458 |
} else {
|
459 |
component.setAction(action); |
460 |
} |
461 |
} |
462 |
|
463 |
|
464 |
@Override
|
465 |
public PickerController<JDBCServerExplorerParameters> createJDBCConnectionPickerController(
|
466 |
JComboBox cboConnection, JButton btnConnection |
467 |
) { |
468 |
JDBCConnectionPickerController x = new JDBCConnectionPickerController(cboConnection, btnConnection);
|
469 |
return x;
|
470 |
} |
471 |
|
472 |
@Override
|
473 |
public SimpleFeaturesTableModel createSimpleFeaturesTableModel(FeatureStore store) {
|
474 |
try {
|
475 |
SimpleFeaturesTableModelImpl m = new SimpleFeaturesTableModelImpl(store);
|
476 |
return m;
|
477 |
} catch (DataException ex) {
|
478 |
throw new RuntimeException("Can't creatre SimpleFeaturesTableModel.", ex); |
479 |
} |
480 |
} |
481 |
|
482 |
@Override
|
483 |
public SimpleFeaturesTableModel createSimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) { |
484 |
SimpleFeaturesTableModelImpl m = new SimpleFeaturesTableModelImpl(featureType, columnNames, features);
|
485 |
return m;
|
486 |
} |
487 |
|
488 |
@Override
|
489 |
public FeatureAttributeListCellRenderer createDefaultFeatureAttributeListCellRenderer() {
|
490 |
FeatureAttributeListCellRenderer r = new FeatureAttributeListCellRendererImpl();
|
491 |
return r;
|
492 |
} |
493 |
|
494 |
@Override
|
495 |
public FeatureQueryOrderPanel createFeatureStoreOrderPanel() {
|
496 |
DefaultFeatureQueryOrderPanel p = new DefaultFeatureQueryOrderPanel();
|
497 |
return p;
|
498 |
} |
499 |
|
500 |
@Override
|
501 |
public Iterable<SearchConditionPanelFactory> getSearchConditionPanels() { |
502 |
if( this.searchConditionPanelFactories==null ) { |
503 |
return Collections.EMPTY_LIST; |
504 |
} |
505 |
return this.searchConditionPanelFactories.values(); |
506 |
} |
507 |
|
508 |
@Override
|
509 |
public void registerSearchConditionPanel(SearchConditionPanelFactory factory) { |
510 |
if( this.searchConditionPanelFactories==null ) { |
511 |
this.searchConditionPanelFactories = new HashMap<>(); |
512 |
} |
513 |
this.searchConditionPanelFactories.put(factory.getName(), factory);
|
514 |
} |
515 |
|
516 |
@Override
|
517 |
public FeatureAttributesSelectionPanel createFeatureAttributeSelectionPanel() {
|
518 |
FeatureAttributesSelectionPanel p = new DefaultFeatureAttributesSelectionPanel();
|
519 |
return p;
|
520 |
} |
521 |
|
522 |
@Override
|
523 |
public void registerSearchPostProcess(SearchPostProcessFactory process) { |
524 |
this.searchPostProcess.put(process.getName(), process);
|
525 |
} |
526 |
|
527 |
@Override
|
528 |
public Map<String,SearchPostProcessFactory> getSearchPostProcess() { |
529 |
return this.searchPostProcess; |
530 |
} |
531 |
|
532 |
@Override
|
533 |
public SearchPostProcessFactory getSearchPostProcess(String name) { |
534 |
SearchPostProcessFactory process = this.searchPostProcess.get(name);
|
535 |
return process;
|
536 |
} |
537 |
|
538 |
@Override
|
539 |
public FeaturesFormContext createFeaturesFormContext(FeatureStore store) {
|
540 |
DefaultFeaturesFormContext context = new DefaultFeaturesFormContext(store);
|
541 |
return context;
|
542 |
} |
543 |
|
544 |
@Override
|
545 |
public TreeModel createTreeModel(StoresRepository repository) { |
546 |
StoresRepositoryTreeModel model = new StoresRepositoryTreeModel(repository);
|
547 |
return model;
|
548 |
} |
549 |
} |
550 |
|
551 |
|