Revision 44308
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 | ||
---|---|---|
52 | 52 |
import org.gvsig.fmap.dal.feature.FeatureType; |
53 | 53 |
import org.gvsig.fmap.dal.feature.FeatureTypeDefinitionsManager; |
54 | 54 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
55 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
55 | 56 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
56 | 57 |
import org.gvsig.fmap.dal.swing.FeatureTableModel; |
57 | 58 |
import org.gvsig.fmap.dal.swing.JFeatureTable; |
... | ... | |
68 | 69 |
import org.gvsig.fmap.dal.swing.impl.featuretype.DefaultFeatureTypePanel; |
69 | 70 |
import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionPanel; |
70 | 71 |
import org.gvsig.fmap.dal.swing.impl.searchpanel.DefaultSearchPanel; |
71 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionAddAction; |
|
72 | 72 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionAddAction.SelectionAddActionFactory; |
73 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionFilterAction; |
|
74 | 73 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionFilterAction.SelectionFilterActionFactory; |
75 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionSetAction; |
|
76 | 74 |
import org.gvsig.fmap.dal.swing.impl.actions.SelectionSetAction.SelectionSetActionFactory; |
77 |
import org.gvsig.fmap.dal.swing.impl.actions.ShowFormAction; |
|
78 | 75 |
import org.gvsig.fmap.dal.swing.impl.actions.ShowFormAction.ShowFormActionFactory; |
79 | 76 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionPanel; |
80 | 77 |
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
... | ... | |
83 | 80 |
import org.gvsig.tools.dynobject.DynStruct; |
84 | 81 |
import org.gvsig.tools.exception.BaseException; |
85 | 82 |
import org.gvsig.fmap.dal.swing.DALActionFactory; |
83 |
import org.gvsig.fmap.dal.swing.impl.jdbc.DefaultJDBCConnectionDialog; |
|
84 |
import org.gvsig.fmap.dal.swing.impl.jdbc.JDBCConnectionPickerController; |
|
85 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
|
86 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
86 | 87 |
|
87 | 88 |
|
88 | 89 |
/** |
... | ... | |
135 | 136 |
} |
136 | 137 |
|
137 | 138 |
@Override |
139 |
public JDBCConnectionDialog createJDBCConectionDialog() { |
|
140 |
JDBCConnectionDialog x = new DefaultJDBCConnectionDialog(); |
|
141 |
return x; |
|
142 |
} |
|
143 |
|
|
144 |
@Override |
|
138 | 145 |
public JExpressionBuilder createQueryFilterExpresion(FeatureStore store) { |
139 | 146 |
DataManager dataManager = DALLocator.getDataManager(); |
140 | 147 |
ExpressionEvaluatorSwingManager swingManager = ExpressionEvaluatorSwingLocator.getManager(); |
... | ... | |
283 | 290 |
public Collection<DALActionFactory> getStoreActions() { |
284 | 291 |
return Collections.unmodifiableCollection(this.featureStoreSearchActions.values()); |
285 | 292 |
} |
293 |
|
|
294 |
@Override |
|
295 |
public PickerController<JDBCServerExplorerParameters> createJDBCConnectionPickerController( |
|
296 |
JComboBox cboConnection, JButton btnConnection |
|
297 |
) { |
|
298 |
JDBCConnectionPickerController x = new JDBCConnectionPickerController(cboConnection, btnConnection); |
|
299 |
return x; |
|
300 |
} |
|
301 |
|
|
302 |
|
|
286 | 303 |
} |
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/jdbc/DefaultJDBCConnectionDialogView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/vectorialdb/wizard/VectorialDBConnectionParamsDialogView.xml</at> |
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">5</at> |
|
39 |
<at name="row">4</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">javax.swing.JButton</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">javax.swing.JButton</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="text">Delete</at> |
|
57 |
<at name="height">22</at> |
|
58 |
<at name="width">68</at> |
|
59 |
<at name="name">btnDelete</at> |
|
60 |
<at name="actionCommand">Delete</at> |
|
61 |
<at name="border"> |
|
62 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
63 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
64 |
<at name="name">border</at> |
|
65 |
</super> |
|
66 |
<at name="borders"> |
|
67 |
<object classname="java.util.LinkedList"> |
|
68 |
<item > |
|
69 |
<at name="value"> |
|
70 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
71 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
72 |
<at name="name">border</at> |
|
73 |
</super> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
</item> |
|
77 |
</object> |
|
78 |
</at> |
|
79 |
</object> |
|
80 |
</at> |
|
81 |
</object> |
|
82 |
</at> |
|
83 |
</object> |
|
84 |
</at> |
|
85 |
</object> |
|
86 |
</at> |
|
87 |
</item> |
|
88 |
<item > |
|
89 |
<at name="value"> |
|
90 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
91 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
92 |
<at name="cellconstraints"> |
|
93 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
94 |
<at name="column">7</at> |
|
95 |
<at name="row">4</at> |
|
96 |
<at name="colspan">1</at> |
|
97 |
<at name="rowspan">1</at> |
|
98 |
<at name="halign">default</at> |
|
99 |
<at name="valign">default</at> |
|
100 |
<at name="insets" object="insets">0,0,0,0</at> |
|
101 |
</object> |
|
102 |
</at> |
|
103 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
104 |
</super> |
|
105 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
106 |
<at name="beanclass">javax.swing.JButton</at> |
|
107 |
<at name="beanproperties"> |
|
108 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
109 |
<at name="classname">javax.swing.JButton</at> |
|
110 |
<at name="properties"> |
|
111 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
112 |
<at name="text">Acept</at> |
|
113 |
<at name="height">22</at> |
|
114 |
<at name="width">63</at> |
|
115 |
<at name="name">btnAcept</at> |
|
116 |
<at name="actionCommand">Acept</at> |
|
117 |
<at name="border"> |
|
118 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
119 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
120 |
<at name="name">border</at> |
|
121 |
</super> |
|
122 |
<at name="borders"> |
|
123 |
<object classname="java.util.LinkedList"> |
|
124 |
<item > |
|
125 |
<at name="value"> |
|
126 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
127 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
128 |
<at name="name">border</at> |
|
129 |
</super> |
|
130 |
</object> |
|
131 |
</at> |
|
132 |
</item> |
|
133 |
</object> |
|
134 |
</at> |
|
135 |
</object> |
|
136 |
</at> |
|
137 |
</object> |
|
138 |
</at> |
|
139 |
</object> |
|
140 |
</at> |
|
141 |
</object> |
|
142 |
</at> |
|
143 |
</item> |
|
144 |
<item > |
|
145 |
<at name="value"> |
|
146 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
147 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
148 |
<at name="cellconstraints"> |
|
149 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
150 |
<at name="column">9</at> |
|
151 |
<at name="row">4</at> |
|
152 |
<at name="colspan">1</at> |
|
153 |
<at name="rowspan">1</at> |
|
154 |
<at name="halign">default</at> |
|
155 |
<at name="valign">default</at> |
|
156 |
<at name="insets" object="insets">0,0,0,0</at> |
|
157 |
</object> |
|
158 |
</at> |
|
159 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
160 |
</super> |
|
161 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
162 |
<at name="beanclass">javax.swing.JButton</at> |
|
163 |
<at name="beanproperties"> |
|
164 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
165 |
<at name="classname">javax.swing.JButton</at> |
|
166 |
<at name="properties"> |
|
167 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
168 |
<at name="text">Cancel</at> |
|
169 |
<at name="height">22</at> |
|
170 |
<at name="width">70</at> |
|
171 |
<at name="name">btnCancel</at> |
|
172 |
<at name="actionCommand">Cancel</at> |
|
173 |
<at name="border"> |
|
174 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
175 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
176 |
<at name="name">border</at> |
|
177 |
</super> |
|
178 |
<at name="borders"> |
|
179 |
<object classname="java.util.LinkedList"> |
|
180 |
<item > |
|
181 |
<at name="value"> |
|
182 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
183 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
184 |
<at name="name">border</at> |
|
185 |
</super> |
|
186 |
</object> |
|
187 |
</at> |
|
188 |
</item> |
|
189 |
</object> |
|
190 |
</at> |
|
191 |
</object> |
|
192 |
</at> |
|
193 |
</object> |
|
194 |
</at> |
|
195 |
</object> |
|
196 |
</at> |
|
197 |
</object> |
|
198 |
</at> |
|
199 |
</item> |
|
200 |
<item > |
|
201 |
<at name="value"> |
|
202 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
203 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
204 |
<at name="cellconstraints"> |
|
205 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
206 |
<at name="column">2</at> |
|
207 |
<at name="row">2</at> |
|
208 |
<at name="colspan">8</at> |
|
209 |
<at name="rowspan">1</at> |
|
210 |
<at name="halign">default</at> |
|
211 |
<at name="valign">default</at> |
|
212 |
<at name="insets" object="insets">0,0,0,0</at> |
|
213 |
</object> |
|
214 |
</at> |
|
215 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
216 |
</super> |
|
217 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
218 |
<at name="beanclass">javax.swing.JPanel</at> |
|
219 |
<at name="beanproperties"> |
|
220 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
221 |
<at name="classname">javax.swing.JPanel</at> |
|
222 |
<at name="properties"> |
|
223 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
224 |
<at name="height">160</at> |
|
225 |
<at name="width">395</at> |
|
226 |
<at name="name">containerJDBCConnectionPanel</at> |
|
227 |
</object> |
|
228 |
</at> |
|
229 |
</object> |
|
230 |
</at> |
|
231 |
</object> |
|
232 |
</at> |
|
233 |
</item> |
|
234 |
<item > |
|
235 |
<at name="value"> |
|
236 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
237 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
238 |
<at name="cellconstraints"> |
|
239 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
240 |
<at name="column">3</at> |
|
241 |
<at name="row">4</at> |
|
242 |
<at name="colspan">1</at> |
|
243 |
<at name="rowspan">1</at> |
|
244 |
<at name="halign">default</at> |
|
245 |
<at name="valign">default</at> |
|
246 |
<at name="insets" object="insets">0,0,0,0</at> |
|
247 |
</object> |
|
248 |
</at> |
|
249 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
250 |
</super> |
|
251 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
252 |
<at name="beanclass">javax.swing.JButton</at> |
|
253 |
<at name="beanproperties"> |
|
254 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
255 |
<at name="classname">javax.swing.JButton</at> |
|
256 |
<at name="properties"> |
|
257 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
258 |
<at name="text">Advanced...</at> |
|
259 |
<at name="height">22</at> |
|
260 |
<at name="width">98</at> |
|
261 |
<at name="name">btnAdvanced</at> |
|
262 |
<at name="actionCommand">Advanced...</at> |
|
263 |
<at name="border"> |
|
264 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
265 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
266 |
<at name="name">border</at> |
|
267 |
</super> |
|
268 |
<at name="borders"> |
|
269 |
<object classname="java.util.LinkedList"> |
|
270 |
<item > |
|
271 |
<at name="value"> |
|
272 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
273 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
274 |
<at name="name">border</at> |
|
275 |
</super> |
|
276 |
</object> |
|
277 |
</at> |
|
278 |
</item> |
|
279 |
</object> |
|
280 |
</at> |
|
281 |
</object> |
|
282 |
</at> |
|
283 |
</object> |
|
284 |
</at> |
|
285 |
</object> |
|
286 |
</at> |
|
287 |
</object> |
|
288 |
</at> |
|
289 |
</item> |
|
290 |
</object> |
|
291 |
</at> |
|
292 |
<at name="properties"> |
|
293 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
294 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
295 |
<at name="properties"> |
|
296 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
297 |
<at name="name"></at> |
|
298 |
<at name="fill"> |
|
299 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
300 |
<at name="name">fill</at> |
|
301 |
</object> |
|
302 |
</at> |
|
303 |
<at name="scollBars"> |
|
304 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
305 |
<at name="name">scollBars</at> |
|
306 |
<at name="verticalpolicy">21</at> |
|
307 |
<at name="horizontalpolicy">31</at> |
|
308 |
<at name="border"> |
|
309 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
310 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
311 |
<at name="name">border</at> |
|
312 |
</super> |
|
313 |
<at name="borders"> |
|
314 |
<object classname="java.util.LinkedList"> |
|
315 |
<item > |
|
316 |
<at name="value"> |
|
317 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
318 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
319 |
<at name="name">border</at> |
|
320 |
</super> |
|
321 |
</object> |
|
322 |
</at> |
|
323 |
</item> |
|
324 |
</object> |
|
325 |
</at> |
|
326 |
</object> |
|
327 |
</at> |
|
328 |
</object> |
|
329 |
</at> |
|
330 |
<at name="border"> |
|
331 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
332 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
333 |
<at name="name">border</at> |
|
334 |
</super> |
|
335 |
<at name="borders"> |
|
336 |
<object classname="java.util.LinkedList"/> |
|
337 |
</at> |
|
338 |
</object> |
|
339 |
</at> |
|
340 |
</object> |
|
341 |
</at> |
|
342 |
</object> |
|
343 |
</at> |
|
344 |
<at name="cellpainters"> |
|
345 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
346 |
<at name="rows"> |
|
347 |
<object classname="[Ljava.lang.Object;" size="5"> |
|
348 |
<at name="item" index="0"> |
|
349 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
350 |
</at> |
|
351 |
<at name="item" index="1"> |
|
352 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
353 |
</at> |
|
354 |
<at name="item" index="2"> |
|
355 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
356 |
</at> |
|
357 |
<at name="item" index="3"> |
|
358 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
359 |
</at> |
|
360 |
<at name="item" index="4"> |
|
361 |
<object classname="[Ljava.lang.Object;" size="10"/> |
|
362 |
</at> |
|
363 |
</object> |
|
364 |
</at> |
|
365 |
</object> |
|
366 |
</at> |
|
367 |
<at name="rowgroups"> |
|
368 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
369 |
<at name="groups"> |
|
370 |
<object classname="java.util.HashMap"/> |
|
371 |
</at> |
|
372 |
</object> |
|
373 |
</at> |
|
374 |
<at name="colgroups"> |
|
375 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
376 |
<at name="groups"> |
|
377 |
<object classname="java.util.HashMap"/> |
|
378 |
</at> |
|
379 |
</object> |
|
380 |
</at> |
|
381 |
</object> |
|
382 |
</at> |
|
383 |
</object> |
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/jdbc/DefaultJDBCConnectionDialogView.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.impl.jdbc; |
|
2 |
|
|
3 |
import com.jeta.open.i18n.I18NUtils; |
|
4 |
import com.jgoodies.forms.layout.CellConstraints; |
|
5 |
import com.jgoodies.forms.layout.FormLayout; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.ComponentOrientation; |
|
8 |
import java.awt.Container; |
|
9 |
import java.awt.Dimension; |
|
10 |
import javax.swing.Box; |
|
11 |
import javax.swing.ImageIcon; |
|
12 |
import javax.swing.JButton; |
|
13 |
import javax.swing.JFrame; |
|
14 |
import javax.swing.JPanel; |
|
15 |
|
|
16 |
|
|
17 |
public class DefaultJDBCConnectionDialogView extends JPanel |
|
18 |
{ |
|
19 |
JButton btnDelete = new JButton(); |
|
20 |
JButton btnAcept = new JButton(); |
|
21 |
JButton btnCancel = new JButton(); |
|
22 |
JPanel containerJDBCConnectionPanel = new JPanel(); |
|
23 |
JButton btnAdvanced = new JButton(); |
|
24 |
|
|
25 |
/** |
|
26 |
* Default constructor |
|
27 |
*/ |
|
28 |
public DefaultJDBCConnectionDialogView() |
|
29 |
{ |
|
30 |
initializePanel(); |
|
31 |
} |
|
32 |
|
|
33 |
/** |
|
34 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
35 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
36 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
37 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
38 |
*/ |
|
39 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
40 |
{ |
|
41 |
Dimension filler = new Dimension(10,10); |
|
42 |
|
|
43 |
boolean filled_cell_11 = false; |
|
44 |
CellConstraints cc = new CellConstraints(); |
|
45 |
if ( cols.length > 0 && rows.length > 0 ) |
|
46 |
{ |
|
47 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
48 |
{ |
|
49 |
/** add a rigid area */ |
|
50 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
51 |
filled_cell_11 = true; |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
for( int index = 0; index < cols.length; index++ ) |
|
56 |
{ |
|
57 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
58 |
{ |
|
59 |
continue; |
|
60 |
} |
|
61 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
62 |
} |
|
63 |
|
|
64 |
for( int index = 0; index < rows.length; index++ ) |
|
65 |
{ |
|
66 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
67 |
{ |
|
68 |
continue; |
|
69 |
} |
|
70 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
71 |
} |
|
72 |
|
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Helper method to load an image file from the CLASSPATH |
|
77 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
78 |
* @return an ImageIcon instance with the specified image file |
|
79 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
80 |
*/ |
|
81 |
public ImageIcon loadImage( String imageName ) |
|
82 |
{ |
|
83 |
try |
|
84 |
{ |
|
85 |
ClassLoader classloader = getClass().getClassLoader(); |
|
86 |
java.net.URL url = classloader.getResource( imageName ); |
|
87 |
if ( url != null ) |
|
88 |
{ |
|
89 |
ImageIcon icon = new ImageIcon( url ); |
|
90 |
return icon; |
|
91 |
} |
|
92 |
} |
|
93 |
catch( Exception e ) |
|
94 |
{ |
|
95 |
e.printStackTrace(); |
|
96 |
} |
|
97 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Method for recalculating the component orientation for |
|
102 |
* right-to-left Locales. |
|
103 |
* @param orientation the component orientation to be applied |
|
104 |
*/ |
|
105 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
106 |
{ |
|
107 |
// Not yet implemented... |
|
108 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
109 |
super.applyComponentOrientation(orientation); |
|
110 |
} |
|
111 |
|
|
112 |
public JPanel createPanel() |
|
113 |
{ |
|
114 |
JPanel jpanel1 = new JPanel(); |
|
115 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); |
|
116 |
CellConstraints cc = new CellConstraints(); |
|
117 |
jpanel1.setLayout(formlayout1); |
|
118 |
|
|
119 |
btnDelete.setActionCommand("Delete"); |
|
120 |
btnDelete.setName("btnDelete"); |
|
121 |
btnDelete.setText("Delete"); |
|
122 |
jpanel1.add(btnDelete,cc.xy(5,4)); |
|
123 |
|
|
124 |
btnAcept.setActionCommand("Acept"); |
|
125 |
btnAcept.setName("btnAcept"); |
|
126 |
btnAcept.setText("Acept"); |
|
127 |
jpanel1.add(btnAcept,cc.xy(7,4)); |
|
128 |
|
|
129 |
btnCancel.setActionCommand("Cancel"); |
|
130 |
btnCancel.setName("btnCancel"); |
|
131 |
btnCancel.setText("Cancel"); |
|
132 |
jpanel1.add(btnCancel,cc.xy(9,4)); |
|
133 |
|
|
134 |
containerJDBCConnectionPanel.setName("containerJDBCConnectionPanel"); |
|
135 |
jpanel1.add(containerJDBCConnectionPanel,cc.xywh(2,2,8,1)); |
|
136 |
|
|
137 |
btnAdvanced.setActionCommand("Advanced..."); |
|
138 |
btnAdvanced.setName("btnAdvanced"); |
|
139 |
btnAdvanced.setText("Advanced..."); |
|
140 |
jpanel1.add(btnAdvanced,cc.xy(3,4)); |
|
141 |
|
|
142 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10 },new int[]{ 1,2,3,4,5 }); |
|
143 |
return jpanel1; |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* Initializer |
|
148 |
*/ |
|
149 |
protected void initializePanel() |
|
150 |
{ |
|
151 |
setLayout(new BorderLayout()); |
|
152 |
add(createPanel(), BorderLayout.CENTER); |
|
153 |
} |
|
154 |
|
|
155 |
|
|
156 |
} |
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/jdbc/JDBCConnectionPickerController.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.impl.jdbc; |
|
2 |
|
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.awt.event.ItemEvent; |
|
6 |
import java.awt.event.ItemListener; |
|
7 |
import javax.swing.ComboBoxModel; |
|
8 |
import javax.swing.JButton; |
|
9 |
import javax.swing.JComboBox; |
|
10 |
import org.gvsig.fmap.dal.DALLocator; |
|
11 |
import org.gvsig.fmap.dal.DataManager; |
|
12 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
13 |
import org.gvsig.fmap.dal.DataServerExplorerPool; |
|
14 |
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry; |
|
15 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
16 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
17 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
|
18 |
import org.gvsig.tools.swing.api.pickercontroller.AbstractPickerController; |
|
19 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
20 |
import org.gvsig.tools.util.LabeledValue; |
|
21 |
import org.gvsig.tools.util.LabeledValueImpl; |
|
22 |
|
|
23 |
/** |
|
24 |
* |
|
25 |
* @author jjdelcerro |
|
26 |
*/ |
|
27 |
public class JDBCConnectionPickerController |
|
28 |
extends AbstractPickerController<JDBCServerExplorerParameters> |
|
29 |
implements PickerController<JDBCServerExplorerParameters> |
|
30 |
{ |
|
31 |
|
|
32 |
private final JComboBox cboConnection; |
|
33 |
private final JButton btnConnection; |
|
34 |
|
|
35 |
public JDBCConnectionPickerController(JComboBox cboConnection, JButton btnConnection) { |
|
36 |
this.btnConnection = btnConnection; |
|
37 |
this.cboConnection = cboConnection; |
|
38 |
|
|
39 |
this.fillConnections(this.cboConnection); |
|
40 |
this.btnConnection.addActionListener(new ActionListener() { |
|
41 |
@Override |
|
42 |
public void actionPerformed(ActionEvent e) { |
|
43 |
doAddConnection(); |
|
44 |
} |
|
45 |
}); |
|
46 |
this.cboConnection.addItemListener(new ItemListener() { |
|
47 |
@Override |
|
48 |
public void itemStateChanged(ItemEvent e) { |
|
49 |
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
50 |
fireChangeEvent(); |
|
51 |
} |
|
52 |
} |
|
53 |
}); |
|
54 |
} |
|
55 |
|
|
56 |
private void fillConnections(JComboBox combo) { |
|
57 |
DataManager dataManager = DALLocator.getDataManager(); |
|
58 |
DataServerExplorerPool pool = dataManager.getDataServerExplorerPool(); |
|
59 |
|
|
60 |
DataServerExplorerParameters params; |
|
61 |
combo.removeAllItems(); |
|
62 |
for (DataServerExplorerPoolEntry entry : pool) { |
|
63 |
if (entry.getExplorerParameters() instanceof JDBCServerExplorerParameters) { |
|
64 |
JDBCServerExplorerParameters dbParams = (JDBCServerExplorerParameters) entry.getExplorerParameters(); |
|
65 |
combo.addItem( |
|
66 |
new LabeledValueImpl<>(entry.getName(), dbParams) |
|
67 |
); |
|
68 |
} |
|
69 |
} |
|
70 |
combo.setSelectedIndex(-1); |
|
71 |
} |
|
72 |
|
|
73 |
private void doAddConnection() { |
|
74 |
JDBCConnectionDialog newco = DALSwingLocator.getSwingManager().createJDBCConectionDialog(); |
|
75 |
newco.showDialog(); |
|
76 |
if (newco.isCanceled()) { |
|
77 |
return; |
|
78 |
} |
|
79 |
DataManager dataManager = DALLocator.getDataManager(); |
|
80 |
DataServerExplorerPool pool = dataManager.getDataServerExplorerPool(); |
|
81 |
|
|
82 |
pool.add(newco.getConnectionName(), newco.getServerExplorerParameters()); |
|
83 |
this.fillConnections(this.cboConnection); |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public JDBCServerExplorerParameters get() { |
|
88 |
LabeledValueImpl<JDBCServerExplorerParameters> item = (LabeledValueImpl<JDBCServerExplorerParameters>) this.cboConnection.getSelectedItem(); |
|
89 |
if (item == null) { |
|
90 |
return null; |
|
91 |
} |
|
92 |
JDBCServerExplorerParameters conn = item.getValue(); |
|
93 |
return conn; |
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
public void set(JDBCServerExplorerParameters value) { |
|
98 |
ComboBoxModel<LabeledValue<JDBCServerExplorerParameters>> model = this.cboConnection.getModel(); |
|
99 |
for (int i = 0; i < model.getSize(); i++) { |
|
100 |
JDBCServerExplorerParameters params = model.getElementAt(i).getValue(); |
|
101 |
if( params == value ) { |
|
102 |
this.cboConnection.setSelectedIndex(i); |
|
103 |
return; |
|
104 |
} |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
@Override |
|
109 |
public void coerceAndSet(Object value) { |
|
110 |
JDBCServerExplorerParameters params; |
|
111 |
try { |
|
112 |
params = (JDBCServerExplorerParameters) value; |
|
113 |
} catch(Exception ex) { |
|
114 |
throw new IllegalArgumentException("Can't coerce value to JDBCServerExplorerParameters", ex); |
|
115 |
} |
|
116 |
this.set(params); |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public void setEnabled(boolean enabled) { |
|
121 |
this.cboConnection.setEnabled(enabled); |
|
122 |
this.btnConnection.setEnabled(enabled); |
|
123 |
} |
|
124 |
|
|
125 |
@Override |
|
126 |
public boolean isEnabled() { |
|
127 |
return this.cboConnection.isEnabled(); |
|
128 |
} |
|
129 |
|
|
130 |
} |
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/jdbc/DefaultJDBCConnectionDialog.java | ||
---|---|---|
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.fmap.dal.swing.impl.jdbc; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
import java.awt.event.ActionEvent; |
|
28 |
import java.awt.event.ActionListener; |
|
29 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
30 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
|
31 |
import org.gvsig.fmap.dal.swing.dataStoreParameters.DataStoreParametersPanel; |
|
32 |
import org.gvsig.fmap.dal.swing.dataStoreParameters.DataStoreParametersPanelManager; |
|
33 |
import org.gvsig.fmap.dal.swing.impl.dataStoreParameters.DataStoreDynObjectParametersPanel; |
|
34 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionPanel; |
|
35 |
import org.gvsig.tools.ToolsLocator; |
|
36 |
import org.gvsig.tools.i18n.I18nManager; |
|
37 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
38 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
39 |
|
|
40 |
import org.slf4j.Logger; |
|
41 |
import org.slf4j.LoggerFactory; |
|
42 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
public class DefaultJDBCConnectionDialog extends DefaultJDBCConnectionDialogView implements JDBCConnectionDialog { |
|
48 |
|
|
49 |
private static final long serialVersionUID = -5493563028200403559L; |
|
50 |
|
|
51 |
private static final Logger LOG = LoggerFactory |
|
52 |
.getLogger(DefaultJDBCConnectionDialog.class); |
|
53 |
|
|
54 |
private boolean isCanceled = false; |
|
55 |
private JDBCConnectionPanel jdbcServerExplorer; |
|
56 |
|
|
57 |
public DefaultJDBCConnectionDialog() { |
|
58 |
initComponents(); |
|
59 |
} |
|
60 |
|
|
61 |
private void initComponents() { |
|
62 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
63 |
this.btnAdvanced.setText(i18nManager.getTranslation("advanced")); |
|
64 |
this.btnAdvanced.addActionListener(new ActionListener() { |
|
65 |
@Override |
|
66 |
public void actionPerformed(ActionEvent ae) { |
|
67 |
doAdvanced(); |
|
68 |
} |
|
69 |
}); |
|
70 |
this.btnAcept.setText(i18nManager.getTranslation("ok")); |
|
71 |
this.btnAcept.addActionListener(new ActionListener() { |
|
72 |
@Override |
|
73 |
public void actionPerformed(ActionEvent ae) { |
|
74 |
doAcept(); |
|
75 |
} |
|
76 |
}); |
|
77 |
this.btnCancel.setText(i18nManager.getTranslation("cancel")); |
|
78 |
this.btnCancel.addActionListener(new ActionListener() { |
|
79 |
@Override |
|
80 |
public void actionPerformed(ActionEvent ae) { |
|
81 |
doCancel(); |
|
82 |
} |
|
83 |
}); |
|
84 |
|
|
85 |
this.btnDelete.setText(i18nManager.getTranslation("del")); |
|
86 |
this.btnDelete.addActionListener(new ActionListener() { |
|
87 |
@Override |
|
88 |
public void actionPerformed(ActionEvent ae) { |
|
89 |
doDelete(); |
|
90 |
} |
|
91 |
}); |
|
92 |
this.jdbcServerExplorer = DALSwingLocator.getSwingManager().createJDBCConnectionPanel(); |
|
93 |
this.containerJDBCConnectionPanel.setLayout(new BorderLayout()); |
|
94 |
this.containerJDBCConnectionPanel.add( |
|
95 |
this.jdbcServerExplorer.asJComponent(), |
|
96 |
BorderLayout.CENTER |
|
97 |
); |
|
98 |
} |
|
99 |
|
|
100 |
protected void doAdvanced() { |
|
101 |
JDBCServerExplorerParameters myParams = this.getServerExplorerParameters(); |
|
102 |
try { |
|
103 |
myParams.validate(); |
|
104 |
} catch (Exception e) { |
|
105 |
// ignore... only for fill default values |
|
106 |
} |
|
107 |
DataStoreParametersPanelManager paramsManager = DALSwingLocator.getDataStoreParametersPanelManager(); |
|
108 |
DataStoreParametersPanel panel = new DataStoreDynObjectParametersPanel(myParams); |
|
109 |
paramsManager.showPropertiesDialog(myParams, panel); |
|
110 |
} |
|
111 |
|
|
112 |
protected void doAcept() { |
|
113 |
this.isCanceled = false; |
|
114 |
this.setVisible(false); |
|
115 |
} |
|
116 |
|
|
117 |
protected void doCancel() { |
|
118 |
this.isCanceled = true; |
|
119 |
this.setVisible(false); |
|
120 |
} |
|
121 |
|
|
122 |
protected void doDelete() { |
|
123 |
this.jdbcServerExplorer.delete(); |
|
124 |
this.jdbcServerExplorer.clear(); |
|
125 |
} |
|
126 |
|
|
127 |
@Override |
|
128 |
public void showDialog() { |
|
129 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
130 |
WindowManager winmgr = ToolsSwingLocator.getWindowManager(); |
|
131 |
winmgr.showWindow( |
|
132 |
this, |
|
133 |
i18nManager.getTranslation("_Connection_parameters"), |
|
134 |
WindowManager.MODE.DIALOG |
|
135 |
); |
|
136 |
} |
|
137 |
|
|
138 |
@Override |
|
139 |
public boolean isCanceled() { |
|
140 |
return this.isCanceled; |
|
141 |
} |
|
142 |
|
|
143 |
@Override |
|
144 |
public JDBCServerExplorerParameters getServerExplorerParameters() { |
|
145 |
return this.jdbcServerExplorer.getServerExplorerParameters(); |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public String getConnectionName() { |
|
150 |
return this.jdbcServerExplorer.getConnectionName(); |
|
151 |
} |
|
152 |
|
|
153 |
} |
|
154 |
|
|
0 | 155 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/fmap/dal/swing/DataSwingManager.java | ||
---|---|---|
39 | 39 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
40 | 40 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
41 | 41 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
42 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
42 | 43 |
import org.gvsig.fmap.dal.swing.expressionevaluator.FeatureStoreElement; |
43 | 44 |
import org.gvsig.fmap.dal.swing.featuretype.AttributeDescriptorPickerController; |
44 | 45 |
import org.gvsig.fmap.dal.swing.featuretype.FeatureTypeAttributePanel; |
... | ... | |
47 | 48 |
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
48 | 49 |
import org.gvsig.tools.dynobject.DynStruct; |
49 | 50 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
51 |
import org.gvsig.fmap.dal.swing.jdbc.JDBCConnectionDialog; |
|
50 | 52 |
|
51 | 53 |
/** |
52 | 54 |
* @author fdiaz |
... | ... | |
62 | 64 |
public JFeatureForm createJFeatureForm(Feature feature) throws CreateJFeatureFormException; |
63 | 65 |
|
64 | 66 |
public JDBCConnectionPanel createJDBCConnectionPanel(); |
67 |
|
|
68 |
public JDBCConnectionDialog createJDBCConectionDialog(); |
|
65 | 69 |
|
66 | 70 |
public JExpressionBuilder createQueryFilterExpresion(FeatureStore store); |
67 | 71 |
|
... | ... | |
101 | 105 |
public void registerStoreAction(DALActionFactory action); |
102 | 106 |
|
103 | 107 |
public Collection<DALActionFactory> getStoreActions(); |
108 |
|
|
109 |
public PickerController<JDBCServerExplorerParameters> createJDBCConnectionPickerController( |
|
110 |
JComboBox cboConnection, JButton btnConnection |
|
111 |
); |
|
104 | 112 |
|
105 | 113 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.api/src/main/java/org/gvsig/fmap/dal/swing/jdbc/JDBCConnectionDialog.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.swing.jdbc; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
4 |
|
|
5 |
/** |
|
6 |
* |
|
7 |
* @author jjdelcerro |
|
8 |
*/ |
|
9 |
public interface JDBCConnectionDialog { |
|
10 |
|
|
11 |
public String getConnectionName(); |
|
12 |
|
|
13 |
public JDBCServerExplorerParameters getServerExplorerParameters(); |
|
14 |
|
|
15 |
public boolean isCanceled(); |
|
16 |
|
|
17 |
public void showDialog(); |
|
18 |
|
|
19 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/databaseworkspace/ConnectToDatabaseWorkspacePanel.java | ||
---|---|---|
1 | 1 |
package org.gvsig.geodb.databaseworkspace; |
2 | 2 |
|
3 |
import java.awt.event.ActionEvent; |
|
4 |
import java.awt.event.ActionListener; |
|
5 |
import java.awt.event.ItemEvent; |
|
6 |
import java.awt.event.ItemListener; |
|
7 |
import javax.swing.JComboBox; |
|
8 | 3 |
import javax.swing.JComponent; |
4 |
import javax.swing.event.ChangeEvent; |
|
5 |
import javax.swing.event.ChangeListener; |
|
9 | 6 |
import org.apache.commons.lang.StringUtils; |
10 | 7 |
import org.gvsig.fmap.dal.DALLocator; |
11 | 8 |
import org.gvsig.fmap.dal.DataManager; |
12 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
13 |
import org.gvsig.fmap.dal.DataServerExplorerPool; |
|
14 |
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry; |
|
15 | 9 |
import org.gvsig.fmap.dal.DatabaseWorkspaceManager; |
16 | 10 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.CONFIG_NAME_STORESREPOSITORYID; |
17 | 11 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.CONFIG_NAME_STORESREPOSITORYLABEL; |
18 | 12 |
import org.gvsig.fmap.dal.StoresRepository; |
19 | 13 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
20 |
import org.gvsig.geodb.vectorialdb.wizard.VectorialDBConnectionParamsDialog;
|
|
14 |
import org.gvsig.fmap.dal.swing.DALSwingLocator;
|
|
21 | 15 |
import org.gvsig.tools.swing.api.Component; |
16 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
22 | 17 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
23 | 18 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
24 |
import org.gvsig.tools.util.LabeledValueImpl; |
|
25 | 19 |
|
26 | 20 |
/** |
27 | 21 |
* |
... | ... | |
33 | 27 |
{ |
34 | 28 |
|
35 | 29 |
private Dialog dialog; |
30 |
private PickerController<JDBCServerExplorerParameters> connectionPicker; |
|
36 | 31 |
|
37 | 32 |
public ConnectToDatabaseWorkspacePanel() { |
38 | 33 |
this.initComponents(); |
... | ... | |
51 | 46 |
} |
52 | 47 |
|
53 | 48 |
private void initComponents() { |
54 |
this.fillConnections(this.cboConnection); |
|
55 |
this.cboConnection.addItemListener(new ItemListener() { |
|
49 |
this.connectionPicker = DALSwingLocator.getSwingManager().createJDBCConnectionPickerController( |
|
50 |
this.cboConnection, |
|
51 |
this.btnConnection |
|
52 |
); |
|
53 |
this.connectionPicker.addChangeListener(new ChangeListener() { |
|
56 | 54 |
@Override |
57 |
public void itemStateChanged(ItemEvent e) { |
|
58 |
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
59 |
doUpdateStoresRepositoryInfo(); |
|
60 |
} |
|
55 |
public void stateChanged(ChangeEvent e) { |
|
56 |
doUpdateStoresRepositoryInfo(); |
|
61 | 57 |
} |
62 | 58 |
}); |
63 |
this.btnConnection.addActionListener(new ActionListener() { |
|
64 |
@Override |
|
65 |
public void actionPerformed(ActionEvent e) { |
|
66 |
doAddConnection(); |
|
67 |
} |
|
68 |
}); |
|
69 | 59 |
doUpdateStoresRepositoryInfo(); |
70 | 60 |
} |
71 | 61 |
|
... | ... | |
75 | 65 |
} |
76 | 66 |
|
77 | 67 |
public JDBCServerExplorerParameters getConnection() { |
78 |
LabeledValueImpl<JDBCServerExplorerParameters> item = (LabeledValueImpl<JDBCServerExplorerParameters>) this.cboConnection.getSelectedItem();
|
|
79 |
if (item == null) {
|
|
68 |
JDBCServerExplorerParameters conn = this.connectionPicker.get();
|
|
69 |
if (conn == null) {
|
|
80 | 70 |
return null; |
81 | 71 |
} |
82 |
JDBCServerExplorerParameters conn = item.getValue(); |
|
83 | 72 |
DataManager dataManager = DALLocator.getDataManager(); |
84 | 73 |
DatabaseWorkspaceManager workspace = dataManager.createDatabaseWorkspaceManager(conn); |
85 | 74 |
if( !workspace.isValidStoresRepository() ) { |
... | ... | |
88 | 77 |
return conn; |
89 | 78 |
} |
90 | 79 |
|
91 |
private void fillConnections(JComboBox combo) { |
|
92 |
DataManager dataManager = DALLocator.getDataManager(); |
|
93 |
DataServerExplorerPool pool = dataManager.getDataServerExplorerPool(); |
|
94 |
|
|
95 |
DataServerExplorerParameters params; |
|
96 |
combo.removeAllItems(); |
|
97 |
for (DataServerExplorerPoolEntry entry : pool) { |
|
98 |
if (entry.getExplorerParameters() instanceof JDBCServerExplorerParameters) { |
|
99 |
JDBCServerExplorerParameters dbParams = (JDBCServerExplorerParameters) entry.getExplorerParameters(); |
|
100 |
combo.addItem( |
|
101 |
new LabeledValueImpl<>(entry.getName(), dbParams) |
|
102 |
); |
|
103 |
} |
|
104 |
} |
|
105 |
combo.setSelectedIndex(-1); |
|
106 |
} |
|
107 |
|
|
108 |
private void doAddConnection() { |
|
109 |
VectorialDBConnectionParamsDialog newco = new VectorialDBConnectionParamsDialog(); |
|
110 |
newco.showDialog(); |
|
111 |
if (newco.isCanceled()) { |
|
112 |
return; |
|
113 |
} |
|
114 |
DataManager dataManager = DALLocator.getDataManager(); |
|
115 |
DataServerExplorerPool pool = dataManager.getDataServerExplorerPool(); |
|
116 |
|
|
117 |
pool.add(newco.getConnectionName(), newco.getServerExplorerParameters()); |
|
118 |
this.fillConnections(this.cboConnection); |
|
119 |
} |
|
120 |
|
|
121 | 80 |
private void doUpdateEnableComponents() { |
122 | 81 |
boolean theEnabled = this.getConnection() != null; |
123 | 82 |
if( dialog!=null ) { |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/databaseworkspace/WorkspaceConfigurationPanel.java | ||
---|---|---|
3 | 3 |
import org.gvsig.fmap.dal.DatabaseWorkspaceManager; |
4 | 4 |
import java.awt.event.ActionEvent; |
5 | 5 |
import java.awt.event.ActionListener; |
6 |
import java.awt.event.ItemEvent; |
|
7 |
import java.awt.event.ItemListener; |
|
8 | 6 |
import javax.swing.JButton; |
9 |
import javax.swing.JComboBox; |
|
10 | 7 |
import javax.swing.JComponent; |
8 |
import javax.swing.event.ChangeEvent; |
|
9 |
import javax.swing.event.ChangeListener; |
|
11 | 10 |
import org.apache.commons.lang.StringUtils; |
12 | 11 |
import org.gvsig.featureform.swing.JFeaturesForm; |
13 | 12 |
import org.gvsig.fmap.dal.DALLocator; |
14 | 13 |
import org.gvsig.fmap.dal.DataManager; |
15 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
16 |
import org.gvsig.fmap.dal.DataServerExplorerPool; |
|
17 |
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry; |
|
18 | 14 |
import org.gvsig.fmap.dal.DataStoreParameters; |
19 | 15 |
import org.gvsig.fmap.dal.StoresRepository; |
20 | 16 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
... | ... | |
22 | 18 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
23 | 19 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
24 | 20 |
import org.gvsig.fmap.dal.swing.searchpanel.FeatureStoreSearchPanel; |
25 |
import org.gvsig.geodb.vectorialdb.wizard.VectorialDBConnectionParamsDialog; |
|
26 | 21 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.CONFIG_NAME_STORESREPOSITORYID; |
27 | 22 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.CONFIG_NAME_STORESREPOSITORYLABEL; |
28 | 23 |
import org.gvsig.tools.swing.api.Component; |
29 | 24 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
25 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
|
30 | 26 |
import org.gvsig.tools.swing.api.windowmanager.Dialog; |
31 | 27 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
32 | 28 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2; |
33 |
import org.gvsig.tools.util.LabeledValueImpl; |
|
34 | 29 |
import org.slf4j.Logger; |
35 | 30 |
import org.slf4j.LoggerFactory; |
36 | 31 |
|
... | ... | |
163 | 158 |
private TableController resourcesTableController; |
164 | 159 |
private TableController repositoryTableController; |
165 | 160 |
private TableController configurationTableController; |
161 |
private PickerController<JDBCServerExplorerParameters> connectionPicker; |
|
166 | 162 |
|
167 | 163 |
public WorkspaceConfigurationPanel() { |
168 | 164 |
this.initComponents(); |
169 | 165 |
} |
170 | 166 |
|
171 | 167 |
private void initComponents() { |
172 |
this.fillConnections(this.cboConnections); |
|
173 |
this.cboConnections.addItemListener(new ItemListener() { |
|
168 |
this.connectionPicker = DALSwingLocator.getSwingManager().createJDBCConnectionPickerController( |
|
169 |
this.cboConnections, |
|
170 |
this.btnAddConnection |
|
171 |
); |
|
172 |
this.connectionPicker.addChangeListener(new ChangeListener() { |
|
174 | 173 |
@Override |
175 |
public void itemStateChanged(ItemEvent e) { |
|
176 |
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
177 |
doUpdateEnableComponents(); |
|
178 |
doUpdateStoresRepositoryInfo(); |
|
179 |
} |
|
174 |
public void stateChanged(ChangeEvent e) { |
|
175 |
doUpdateEnableComponents(); |
|
176 |
doUpdateStoresRepositoryInfo(); |
|
180 | 177 |
} |
181 | 178 |
}); |
182 |
this.btnAddConnection.addActionListener(new ActionListener() { |
|
183 |
@Override |
|
184 |
public void actionPerformed(ActionEvent e) { |
|
185 |
doAddConnection(); |
|
186 |
} |
|
187 |
}); |
|
188 | 179 |
this.resourcesTableController = new TableController( |
189 | 180 |
DatabaseWorkspaceManager.TABLE_RESOURCES, |
190 | 181 |
btnCreateResourceTable, |
... | ... | |
230 | 221 |
} |
231 | 222 |
|
232 | 223 |
public JDBCServerExplorerParameters getConnection() { |
233 |
LabeledValueImpl<JDBCServerExplorerParameters> item = (LabeledValueImpl<JDBCServerExplorerParameters>) this.cboConnections.getSelectedItem(); |
|
234 |
if (item == null) { |
|
235 |
return null; |
|
236 |
} |
|
237 |
return item.getValue(); |
|
224 |
JDBCServerExplorerParameters conn = this.connectionPicker.get(); |
|
225 |
return conn; |
|
238 | 226 |
} |
239 | 227 |
|
240 |
private void fillConnections(JComboBox combo) { |
|
241 |
DataManager dataManager = DALLocator.getDataManager(); |
|
242 |
DataServerExplorerPool pool = dataManager.getDataServerExplorerPool(); |
|
243 |
|
|
244 |
DataServerExplorerParameters params; |
|
245 |
combo.removeAllItems(); |
|
246 |
for (DataServerExplorerPoolEntry entry : pool) { |
|
247 |
if (entry.getExplorerParameters() instanceof JDBCServerExplorerParameters) { |
|
248 |
JDBCServerExplorerParameters dbParams = (JDBCServerExplorerParameters) entry.getExplorerParameters(); |
|
249 |
combo.addItem( |
|
250 |
new LabeledValueImpl<>(entry.getName(), dbParams) |
|
251 |
); |
|
252 |
} |
|
253 |
} |
|
254 |
combo.setSelectedIndex(-1); |
|
255 |
} |
|
256 |
|
|
257 |
private void doAddConnection() { |
|
258 |
VectorialDBConnectionParamsDialog newco = new VectorialDBConnectionParamsDialog(); |
|
259 |
newco.showDialog(); |
|
260 |
if (newco.isCanceled()) { |
|
261 |
return; |
|
262 |
} |
|
263 |
DataManager dataManager = DALLocator.getDataManager(); |
|
264 |
DataServerExplorerPool pool = dataManager.getDataServerExplorerPool(); |
|
265 |
|
|
266 |
pool.add(newco.getConnectionName(), newco.getServerExplorerParameters()); |
|
267 |
this.fillConnections(this.cboConnections); |
|
268 |
} |
|
269 |
|
|
270 | 228 |
private void doUpdateEnableComponents() { |
271 | 229 |
boolean theEnabled = this.getConnection() != null; |
272 | 230 |
this.repositoryTableController.setEnabled(theEnabled); |
Also available in: Unified diff