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 @ 45234
History | View | Annotate | Download (18.6 KB)
1 | 42112 | jjdelcerro | /* 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 | 44263 | jjdelcerro | import java.util.Collection; |
26 | import java.util.Collections; |
||
27 | 44707 | jjdelcerro | import java.util.HashMap; |
28 | 44263 | jjdelcerro | import java.util.LinkedHashMap; |
29 | 44340 | jjdelcerro | import java.util.List; |
30 | 44263 | jjdelcerro | import java.util.Map; |
31 | 44128 | jjdelcerro | import java.util.function.Predicate; |
32 | 44410 | jjdelcerro | import javax.swing.AbstractButton; |
33 | import javax.swing.Action; |
||
34 | 44077 | jjdelcerro | import javax.swing.JButton; |
35 | 44096 | jjdelcerro | import javax.swing.JComboBox; |
36 | 44215 | jjdelcerro | import javax.swing.JList; |
37 | 44077 | jjdelcerro | import javax.swing.JTextField; |
38 | 44644 | jjdelcerro | import javax.swing.ListCellRenderer; |
39 | 44340 | jjdelcerro | import javax.swing.table.TableModel; |
40 | 44662 | jjdelcerro | import javax.swing.text.JTextComponent; |
41 | 44855 | jjdelcerro | import org.apache.commons.lang3.StringUtils; |
42 | import org.gvsig.expressionevaluator.swing.Element; |
||
43 | import org.gvsig.expressionevaluator.swing.ExpressionBuilderConfig; |
||
44 | 44128 | jjdelcerro | import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
45 | import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
||
46 | 44662 | jjdelcerro | import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
47 | 44128 | jjdelcerro | import org.gvsig.expressionevaluator.swing.JExpressionBuilder; |
48 | 42112 | jjdelcerro | import org.gvsig.featureform.swing.CreateJFeatureFormException; |
49 | 42775 | jjdelcerro | import org.gvsig.featureform.swing.JFeatureForm; |
50 | 42112 | jjdelcerro | |
51 | 42775 | jjdelcerro | import org.gvsig.featureform.swing.JFeaturesForm; |
52 | 42112 | jjdelcerro | import org.gvsig.featureform.swing.impl.DefaultJFeatureForm; |
53 | 42775 | jjdelcerro | import org.gvsig.featureform.swing.impl.DefaultJFeaturesForm; |
54 | import org.gvsig.fmap.dal.DALLocator; |
||
55 | 44128 | jjdelcerro | import org.gvsig.fmap.dal.DataManager; |
56 | 44191 | jjdelcerro | import org.gvsig.fmap.dal.DataStoreProviderFactory; |
57 | 44128 | jjdelcerro | import org.gvsig.fmap.dal.exception.DataException; |
58 | import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable; |
||
59 | 42775 | jjdelcerro | import org.gvsig.fmap.dal.feature.Feature; |
60 | 44128 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
61 | 42775 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureQuery; |
62 | 42112 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureStore; |
63 | 44712 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
64 | 42775 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureType; |
65 | import org.gvsig.fmap.dal.feature.FeatureTypeDefinitionsManager; |
||
66 | import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
||
67 | 44308 | jjdelcerro | import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
68 | 42112 | jjdelcerro | import org.gvsig.fmap.dal.swing.DataSwingManager; |
69 | 42775 | jjdelcerro | import org.gvsig.fmap.dal.swing.FeatureTableModel; |
70 | import org.gvsig.fmap.dal.swing.JFeatureTable; |
||
71 | 44128 | jjdelcerro | import org.gvsig.fmap.dal.swing.expressionevaluator.FeatureStoreElement; |
72 | 44096 | jjdelcerro | import org.gvsig.fmap.dal.swing.featuretype.AttributeDescriptorPickerController; |
73 | 44128 | jjdelcerro | import org.gvsig.fmap.dal.swing.featuretype.FeatureTypeAttributePanel; |
74 | import org.gvsig.fmap.dal.swing.featuretype.FeatureTypePanel; |
||
75 | 44263 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.expressionevaluator.DefaultFeatureStoreElement2; |
76 | 42775 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretable.FeatureTablePanel; |
77 | import org.gvsig.fmap.dal.swing.impl.featuretable.table.DefaultFeatureTableModel; |
||
78 | import org.gvsig.fmap.dal.swing.impl.featuretable.table.EmptyFeatureTableModel; |
||
79 | 44096 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultAttributeDescriptorPickerController; |
80 | 44713 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributePanel; |
81 | 44128 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureTypePanel; |
82 | 42112 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionPanel; |
83 | 44259 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel; |
84 | 44281 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.actions.SelectionAddAction.SelectionAddActionFactory; |
85 | import org.gvsig.fmap.dal.swing.impl.actions.SelectionFilterAction.SelectionFilterActionFactory; |
||
86 | import org.gvsig.fmap.dal.swing.impl.actions.SelectionSetAction.SelectionSetActionFactory; |
||
87 | import org.gvsig.fmap.dal.swing.impl.actions.ShowFormAction.ShowFormActionFactory; |
||
88 | 42112 | jjdelcerro | import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionPanel; |
89 | 44259 | jjdelcerro | import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
90 | 42620 | jjdelcerro | import org.gvsig.tools.dynform.DynFormLocator; |
91 | import org.gvsig.tools.dynobject.DynClass; |
||
92 | 42775 | jjdelcerro | import org.gvsig.tools.dynobject.DynStruct; |
93 | import org.gvsig.tools.exception.BaseException; |
||
94 | 44281 | jjdelcerro | import org.gvsig.fmap.dal.swing.DALActionFactory; |
95 | 44410 | jjdelcerro | import org.gvsig.fmap.dal.swing.DALActionFactory.DALActionContext; |
96 | 44340 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretable.SimpleFeaturesTableModel; |
97 | 44713 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretype.FeatureAttributeListCellRenderer; |
98 | 44712 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureAttributesSelectionPanel; |
99 | 44308 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionDialog; |
100 | import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerController; |
||
101 | 44712 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.featurequery.DefaultFeatureQueryOrderPanel; |
102 | 44308 | jjdelcerro | import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
103 | 44707 | jjdelcerro | import org.gvsig.fmap.dal.swing.searchpanel.SearchConditionPanel.SearchConditionPanelFactory; |
104 | 44308 | jjdelcerro | import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
105 | 44712 | jjdelcerro | import org.gvsig.fmap.dal.swing.featurequery.FeatureQueryOrderPanel; |
106 | 44713 | jjdelcerro | import org.gvsig.fmap.dal.swing.featuretype.FeatureAttributesSelectionPanel; |
107 | 44855 | jjdelcerro | import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.CheckTableFieldsSuggestionProviderFactory; |
108 | import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.QuotesForFieldNameSuggestionProviderFactory; |
||
109 | import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.StorePointFieldSuggestionProviderFactory; |
||
110 | import org.gvsig.fmap.dal.swing.impl.expressionevaluator.suggestions.WrongNameFieldSuggestionProviderFactory; |
||
111 | 42112 | jjdelcerro | |
112 | |||
113 | /**
|
||
114 | * @author fdiaz
|
||
115 | *
|
||
116 | */
|
||
117 | 44128 | jjdelcerro | @SuppressWarnings("UseSpecificCatch") |
118 | 42775 | jjdelcerro | public class DefaultDataSwingManager implements DataSwingManager { |
119 | 42112 | jjdelcerro | |
120 | 44281 | jjdelcerro | private final Map<String,DALActionFactory> featureStoreSearchActions; |
121 | 44707 | jjdelcerro | private Map<String,SearchConditionPanelFactory> searchConditionPanelFactories; |
122 | 44263 | jjdelcerro | |
123 | public DefaultDataSwingManager() {
|
||
124 | this.featureStoreSearchActions = new LinkedHashMap<>(); |
||
125 | 44281 | jjdelcerro | this.registerStoreAction(new SelectionAddActionFactory()); |
126 | this.registerStoreAction(new SelectionFilterActionFactory()); |
||
127 | this.registerStoreAction(new SelectionSetActionFactory()); |
||
128 | this.registerStoreAction(new ShowFormActionFactory()); |
||
129 | 44263 | jjdelcerro | } |
130 | |||
131 | 42512 | jjdelcerro | @Override
|
132 | 42775 | jjdelcerro | public JFeaturesForm createJFeaturesForm(FeatureStore store) throws CreateJFeatureFormException { |
133 | 42112 | jjdelcerro | try {
|
134 | 42775 | jjdelcerro | FeatureType featureType = store.getDefaultFeatureType(); |
135 | |||
136 | DefaultJFeaturesForm form = new DefaultJFeaturesForm();
|
||
137 | 44202 | jjdelcerro | form.bind(store, featureType2DynClass(store, featureType)); |
138 | 42775 | jjdelcerro | return form;
|
139 | |||
140 | } catch (Exception ex) { |
||
141 | throw new CreateJFeatureFormException(ex); |
||
142 | 42112 | jjdelcerro | } |
143 | } |
||
144 | |||
145 | 44202 | jjdelcerro | public DynClass featureType2DynClass(FeatureStore store, FeatureType type) {
|
146 | FeatureTypeDefinitionsManager featureTypeDefinitionsManager = DALLocator.getFeatureTypeDefinitionsManager(); |
||
147 | if( featureTypeDefinitionsManager.contains(store,type) ) {
|
||
148 | // Force reload next call to get.
|
||
149 | featureTypeDefinitionsManager.remove(store,type); |
||
150 | } |
||
151 | DynClass dynClass = featureTypeDefinitionsManager.get(store,type); |
||
152 | // Force reload next call to get.
|
||
153 | DynFormLocator.getDynFormManager().removeDefinition(dynClass.getName()); |
||
154 | return dynClass;
|
||
155 | } |
||
156 | |||
157 | 42512 | jjdelcerro | @Override
|
158 | 42112 | jjdelcerro | public JDBCConnectionPanel createJDBCConnectionPanel() {
|
159 | JDBCConnectionPanel x = new DefaultJDBCConnectionPanel();
|
||
160 | return x;
|
||
161 | } |
||
162 | |||
163 | 42512 | jjdelcerro | @Override
|
164 | 44308 | jjdelcerro | public JDBCConnectionDialog createJDBCConectionDialog() {
|
165 | JDBCConnectionDialog x = new DefaultJDBCConnectionDialog();
|
||
166 | return x;
|
||
167 | } |
||
168 | |||
169 | @Override
|
||
170 | 44855 | jjdelcerro | public void configureExpressionBuilder(ExpressionBuilderConfig builder, FeatureStore store) { |
171 | 44128 | jjdelcerro | DataManager dataManager = DALLocator.getDataManager(); |
172 | ExpressionEvaluatorSwingManager swingManager = ExpressionEvaluatorSwingLocator.getManager(); |
||
173 | 44202 | jjdelcerro | FeatureSymbolTable featureSymbolTable = dataManager.createFeatureSymbolTable(); |
174 | 44128 | jjdelcerro | |
175 | 44712 | jjdelcerro | FeatureStoreProviderFactory storeFactory = (FeatureStoreProviderFactory) store.getProviderFactory(); |
176 | 44128 | jjdelcerro | Feature sampleFeature = null;
|
177 | try {
|
||
178 | sampleFeature = store.getFeatureSelection().first(); |
||
179 | if( sampleFeature == null ) { |
||
180 | sampleFeature = store.first(); |
||
181 | } |
||
182 | } catch (DataException ex) {
|
||
183 | } |
||
184 | 44712 | jjdelcerro | builder.setAllowedFunctions(storeFactory.allowFunction()); |
185 | 44128 | jjdelcerro | if( sampleFeature!=null ) { |
186 | featureSymbolTable.setFeature(sampleFeature); |
||
187 | builder.setPreviewSymbolTable(featureSymbolTable.createParent()); |
||
188 | } |
||
189 | 44202 | jjdelcerro | builder.addSymbolTable(featureSymbolTable); |
190 | 44263 | jjdelcerro | FeatureStoreElement storeElement = new DefaultFeatureStoreElement2(store);
|
191 | 44209 | jjdelcerro | builder.addElement(storeElement); |
192 | 44191 | jjdelcerro | if( store.getProviderFactory().hasSQLSupport()==DataStoreProviderFactory.YES ) {
|
193 | 44259 | jjdelcerro | builder.getPreferences().setSQLCompatible(true);
|
194 | 44855 | jjdelcerro | } |
195 | builder.addSuggestionFactory(new StorePointFieldSuggestionProviderFactory(store));
|
||
196 | builder.addSuggestionFactory(new QuotesForFieldNameSuggestionProviderFactory(store));
|
||
197 | builder.addSuggestionFactory(new WrongNameFieldSuggestionProviderFactory(store));
|
||
198 | builder.addSuggestionFactory(new CheckTableFieldsSuggestionProviderFactory(store));
|
||
199 | } |
||
200 | |||
201 | @Override
|
||
202 | public JExpressionBuilder createQueryFilterExpresion(FeatureStore store) {
|
||
203 | return this.createJExpressionBuilder(store); |
||
204 | } |
||
205 | |||
206 | @Override
|
||
207 | public JExpressionBuilder createJExpressionBuilder(final FeatureStore store) { |
||
208 | ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
||
209 | final JExpressionBuilder builder = expressionSwingManager.createJExpressionBuilder();
|
||
210 | this.configureExpressionBuilder(builder, store);
|
||
211 | builder.expandElement( |
||
212 | (Element t) -> t!=null && StringUtils.equals(t.getName(),store.getName()) |
||
213 | ); |
||
214 | 44128 | jjdelcerro | return builder;
|
215 | 42489 | jjdelcerro | } |
216 | 42112 | jjdelcerro | |
217 | 42775 | jjdelcerro | @Override
|
218 | 44855 | jjdelcerro | public ExpressionPickerController createExpressionPickerController(FeatureStore store, JTextComponent text, JButton button, JButton bookmarks, JButton history) { |
219 | ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
||
220 | ExpressionPickerController builder = expressionSwingManager.createExpressionPickerController(text, button, bookmarks, history); |
||
221 | this.configureExpressionBuilder(builder, store);
|
||
222 | return builder;
|
||
223 | } |
||
224 | |||
225 | @Override
|
||
226 | 42775 | jjdelcerro | public JFeatureForm createJFeatureForm(FeatureStore store) throws CreateJFeatureFormException { |
227 | JFeatureForm form = new DefaultJFeatureForm();
|
||
228 | form.setStore(store); |
||
229 | return form;
|
||
230 | } |
||
231 | |||
232 | @Override
|
||
233 | public JFeatureForm createJFeatureForm(Feature feature) throws CreateJFeatureFormException { |
||
234 | JFeatureForm form = new DefaultJFeatureForm();
|
||
235 | form.setFeature(feature); |
||
236 | return form;
|
||
237 | } |
||
238 | |||
239 | 44202 | jjdelcerro | @Override
|
240 | 42775 | jjdelcerro | public JFeatureTable createJFeatureTable(FeatureTableModel model) {
|
241 | return this.createJFeatureTable(model, true); |
||
242 | } |
||
243 | |||
244 | 44202 | jjdelcerro | @Override
|
245 | 42775 | jjdelcerro | public JFeatureTable createJFeatureTable(FeatureTableModel model, boolean isDoubleBuffered) { |
246 | return new FeatureTablePanel(model, isDoubleBuffered); |
||
247 | } |
||
248 | |||
249 | 44202 | jjdelcerro | @Override
|
250 | 42775 | jjdelcerro | public FeatureTableModel createEmptyFeatureTableModel(DynStruct struct) {
|
251 | return new EmptyFeatureTableModel(struct); |
||
252 | } |
||
253 | |||
254 | 44202 | jjdelcerro | @Override
|
255 | 42775 | jjdelcerro | public FeatureTableModel createFeatureTableModel(FeatureStore featureStore,
|
256 | FeatureQuery featureQuery) { |
||
257 | try {
|
||
258 | FeaturePagingHelper pager = DALLocator.getDataManager().createFeaturePagingHelper( |
||
259 | featureStore, featureQuery, |
||
260 | FeaturePagingHelper.DEFAULT_PAGE_SIZE |
||
261 | ); |
||
262 | return this.createFeatureTableModel(pager); |
||
263 | } catch (BaseException ex) {
|
||
264 | throw new RuntimeException("Can't create a FeatureTableModel.", ex); |
||
265 | } |
||
266 | } |
||
267 | |||
268 | 44202 | jjdelcerro | @Override
|
269 | 42775 | jjdelcerro | public FeatureTableModel createFeatureTableModel(FeaturePagingHelper featurePager) {
|
270 | return new DefaultFeatureTableModel(featurePager); |
||
271 | } |
||
272 | 44077 | jjdelcerro | |
273 | 44202 | jjdelcerro | @Override
|
274 | 44077 | jjdelcerro | public ProjectionPickerController createProjectionPickerController(
|
275 | JTextField txtProjection,
|
||
276 | JButton btnSelectProjection
|
||
277 | ) { |
||
278 | ProjectionPickerController picker = new ProjectionPickerController(txtProjection, btnSelectProjection);
|
||
279 | return picker;
|
||
280 | } |
||
281 | 44096 | jjdelcerro | |
282 | 44202 | jjdelcerro | @Override
|
283 | 44096 | jjdelcerro | public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JComboBox combo) { |
284 | 44128 | jjdelcerro | AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(combo, null); |
285 | 44096 | jjdelcerro | return controller;
|
286 | } |
||
287 | 44128 | jjdelcerro | |
288 | 44202 | jjdelcerro | @Override
|
289 | 44215 | jjdelcerro | public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JList list) { |
290 | AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(list, null); |
||
291 | return controller;
|
||
292 | } |
||
293 | |||
294 | @Override
|
||
295 | 44128 | jjdelcerro | public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JComboBox combo, Predicate<FeatureAttributeDescriptor> filter) { |
296 | AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(combo, filter);
|
||
297 | return controller;
|
||
298 | } |
||
299 | |||
300 | 44202 | jjdelcerro | @Override
|
301 | 44215 | jjdelcerro | public AttributeDescriptorPickerController createAttributeDescriptorPickerController(JList list, Predicate<FeatureAttributeDescriptor> filter) { |
302 | AttributeDescriptorPickerController controller = new DefaultAttributeDescriptorPickerController(list, filter);
|
||
303 | return controller;
|
||
304 | } |
||
305 | |||
306 | @Override
|
||
307 | 44128 | jjdelcerro | public FeatureTypePanel createFeatureTypePanel() {
|
308 | FeatureTypePanel panel = new DefaultFeatureTypePanel();
|
||
309 | return panel;
|
||
310 | } |
||
311 | |||
312 | 44202 | jjdelcerro | @Override
|
313 | 44128 | jjdelcerro | public FeatureTypeAttributePanel createFeatureTypeAttributePanel() {
|
314 | 44713 | jjdelcerro | FeatureTypeAttributePanel panel = new DefaultFeatureAttributePanel();
|
315 | 44128 | jjdelcerro | return panel;
|
316 | } |
||
317 | |||
318 | 44202 | jjdelcerro | @Override
|
319 | 44259 | jjdelcerro | public FeatureStoreElement createFeatureStoreElement() {
|
320 | 44263 | jjdelcerro | FeatureStoreElement e = new DefaultFeatureStoreElement2(null); |
321 | 44128 | jjdelcerro | return e;
|
322 | } |
||
323 | 44259 | jjdelcerro | |
324 | @Override
|
||
325 | 44285 | jjdelcerro | public FeatureStoreElement createFeatureStoreElement(FeatureStore store) {
|
326 | FeatureStoreElement e = new DefaultFeatureStoreElement2(store);
|
||
327 | return e;
|
||
328 | } |
||
329 | |||
330 | @Override
|
||
331 | 44662 | jjdelcerro | public ExpressionPickerController createExpressionPickerController(FeatureStore store, JTextComponent text, JButton button) { |
332 | FeatureSymbolTable previewSymbolTable = DALLocator.getManager().createFeatureSymbolTable(); |
||
333 | previewSymbolTable.setFeature(store.getSampleFeature()); |
||
334 | |||
335 | ExpressionPickerController controller = ExpressionEvaluatorSwingLocator.getManager().createExpressionPickerController(text, button); |
||
336 | controller.addElement(this.createFeatureStoreElement(store));
|
||
337 | controller.setPreviewSymbolTable(previewSymbolTable); |
||
338 | |||
339 | return controller;
|
||
340 | } |
||
341 | |||
342 | |||
343 | @Override
|
||
344 | 44259 | jjdelcerro | public FeatureStoreSearchPanel createFeatureStoreSearchPanel(FeatureStore store) {
|
345 | DefaultSearchPanel e = new DefaultSearchPanel(store);
|
||
346 | return e;
|
||
347 | } |
||
348 | |||
349 | 44263 | jjdelcerro | @Override
|
350 | 44281 | jjdelcerro | public final void registerStoreAction(DALActionFactory action) { |
351 | 44263 | jjdelcerro | this.featureStoreSearchActions.put(action.getName().toLowerCase(), action);
|
352 | } |
||
353 | 44259 | jjdelcerro | |
354 | 44263 | jjdelcerro | @Override
|
355 | 44281 | jjdelcerro | public Collection<DALActionFactory> getStoreActions() { |
356 | 44263 | jjdelcerro | return Collections.unmodifiableCollection(this.featureStoreSearchActions.values()); |
357 | } |
||
358 | 44308 | jjdelcerro | |
359 | @Override
|
||
360 | 44340 | jjdelcerro | public DALActionFactory getStoreAction(String name) { |
361 | DALActionFactory action = this.featureStoreSearchActions.get(name.toLowerCase());
|
||
362 | return action;
|
||
363 | } |
||
364 | 44410 | jjdelcerro | |
365 | @Override
|
||
366 | public void setStoreAction(AbstractButton component, String name, boolean preserveLabel, DALActionContext context) { |
||
367 | DALActionFactory factory = this.getStoreAction(name);
|
||
368 | Action action = factory.createAction(context);
|
||
369 | if( preserveLabel ) {
|
||
370 | String s = component.getText();
|
||
371 | component.setAction(action); |
||
372 | component.setText(s); |
||
373 | } else {
|
||
374 | component.setAction(action); |
||
375 | } |
||
376 | } |
||
377 | 44340 | jjdelcerro | |
378 | 44410 | jjdelcerro | |
379 | 44340 | jjdelcerro | @Override
|
380 | 44308 | jjdelcerro | public PickerController<JDBCServerExplorerParameters> createJDBCConnectionPickerController(
|
381 | JComboBox cboConnection, JButton btnConnection |
||
382 | ) { |
||
383 | JDBCConnectionPickerController x = new JDBCConnectionPickerController(cboConnection, btnConnection);
|
||
384 | return x;
|
||
385 | } |
||
386 | 44340 | jjdelcerro | |
387 | @Override
|
||
388 | public TableModel createSimpleFeaturesTableModel(FeatureStore store) { |
||
389 | try {
|
||
390 | SimpleFeaturesTableModel m = new SimpleFeaturesTableModel(store);
|
||
391 | return m;
|
||
392 | } catch (DataException ex) {
|
||
393 | throw new RuntimeException("Can't creatre SimpleFeaturesTableModel.", ex); |
||
394 | } |
||
395 | } |
||
396 | 44308 | jjdelcerro | |
397 | 44340 | jjdelcerro | @Override
|
398 | public TableModel createSimpleFeaturesTableModel(FeatureType featureType, List<String> columnNames, List<Feature> features) { |
||
399 | SimpleFeaturesTableModel m = new SimpleFeaturesTableModel(featureType, columnNames, features);
|
||
400 | return m;
|
||
401 | } |
||
402 | 44644 | jjdelcerro | |
403 | @Override
|
||
404 | public ListCellRenderer createDefaultFeatureAttributeListCellRenderer() { |
||
405 | 44713 | jjdelcerro | ListCellRenderer r = new FeatureAttributeListCellRenderer(); |
406 | 44644 | jjdelcerro | return r;
|
407 | } |
||
408 | |||
409 | @Override
|
||
410 | 44712 | jjdelcerro | public FeatureQueryOrderPanel createFeatureStoreOrderPanel() {
|
411 | DefaultFeatureQueryOrderPanel p = new DefaultFeatureQueryOrderPanel();
|
||
412 | 44644 | jjdelcerro | return p;
|
413 | } |
||
414 | 44308 | jjdelcerro | |
415 | 44707 | jjdelcerro | @Override
|
416 | public Iterable<SearchConditionPanelFactory> getSearchConditionPanels() { |
||
417 | if( this.searchConditionPanelFactories==null ) { |
||
418 | return Collections.EMPTY_LIST; |
||
419 | } |
||
420 | return this.searchConditionPanelFactories.values(); |
||
421 | } |
||
422 | |||
423 | @Override
|
||
424 | public void registerSearchConditionPanel(SearchConditionPanelFactory factory) { |
||
425 | if( this.searchConditionPanelFactories==null ) { |
||
426 | this.searchConditionPanelFactories = new HashMap<>(); |
||
427 | } |
||
428 | this.searchConditionPanelFactories.put(factory.getName(), factory);
|
||
429 | } |
||
430 | |||
431 | @Override
|
||
432 | 44713 | jjdelcerro | public FeatureAttributesSelectionPanel createFeatureAttributeSelectionPanel() {
|
433 | FeatureAttributesSelectionPanel p = new DefaultFeatureAttributesSelectionPanel();
|
||
434 | 44707 | jjdelcerro | return p;
|
435 | } |
||
436 | |||
437 | 42112 | jjdelcerro | } |