Revision 43020 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/DefaultJDBCConnectionPanel.java
DefaultJDBCConnectionPanel.java | ||
---|---|---|
18 | 18 |
import javax.swing.text.View; |
19 | 19 |
import org.apache.commons.lang3.StringUtils; |
20 | 20 |
import org.gvsig.fmap.dal.DALLocator; |
21 |
import org.gvsig.fmap.dal.DataFactory; |
|
21 | 22 |
import org.gvsig.fmap.dal.DataManager; |
22 | 23 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
23 | 24 |
import org.gvsig.fmap.dal.DataServerExplorerPool; |
... | ... | |
94 | 95 |
fillConnectors(); |
95 | 96 |
} catch(Throwable th) { |
96 | 97 |
// Ignore it to allow use in GUI builders |
98 |
logger.warn("Can't fill combos",th); |
|
97 | 99 |
} |
98 | 100 |
this.translate(); |
99 | 101 |
adjustPreferedHeight(this.lblFoother,300); |
... | ... | |
282 | 284 |
|
283 | 285 |
private void fillConnectors() { |
284 | 286 |
DataManager dataManager = DALLocator.getDataManager(); |
285 |
List explorers = dataManager.getExplorerProviders(); |
|
286 | 287 |
|
287 |
DataServerExplorerParameters params; |
|
288 |
|
|
289 |
JDBCServerExplorerParameters last = null; |
|
290 |
Iterator it = explorers.iterator(); |
|
291 |
while ( it.hasNext() ) { |
|
292 |
String explorerName = (String) it.next(); |
|
293 |
try { |
|
294 |
params = dataManager.createServerExplorerParameters(explorerName); |
|
295 |
} catch (DataException e) { |
|
296 |
continue; |
|
297 |
} |
|
288 |
ServerExplorerParametersComboItem last = null; |
|
289 |
|
|
290 |
for (DataFactory factory : dataManager.getServerExplorerRegister() ) { |
|
291 |
DataServerExplorerParameters params = (DataServerExplorerParameters) factory.createParameters(); |
|
298 | 292 |
if ( params instanceof JDBCServerExplorerParameters ) { |
299 |
JDBCServerExplorerParameters dbParams = (JDBCServerExplorerParameters) params; |
|
300 |
if( dbParams.getClass().getName().equals(JDBCServerExplorerParameters.class.getName()) ) { |
|
301 |
last = dbParams; |
|
293 |
if( params.getClass() == JDBCServerExplorerParameters.class && |
|
294 |
last == null ) { |
|
295 |
// Si es el proveedor generico de JDBC, lo guarda para |
|
296 |
// a?adirlo al final del combo. |
|
297 |
last = new ServerExplorerParametersComboItem( |
|
298 |
factory.getDescription(), |
|
299 |
(JDBCServerExplorerParameters) params |
|
300 |
); |
|
302 | 301 |
} else { |
303 | 302 |
this.cboConnectors.addItem( |
304 |
new ServerExplorerParametersComboItem(dbParams) |
|
303 |
new ServerExplorerParametersComboItem( |
|
304 |
factory.getDescription(), |
|
305 |
(JDBCServerExplorerParameters) params |
|
306 |
) |
|
305 | 307 |
); |
306 | 308 |
} |
307 | 309 |
} |
308 | 310 |
} |
309 | 311 |
if( last!=null ) { |
310 |
this.cboConnectors.addItem( |
|
311 |
new ServerExplorerParametersComboItem(last) |
|
312 |
); |
|
312 |
this.cboConnectors.addItem(last); |
|
313 | 313 |
} |
314 | 314 |
} |
315 | 315 |
|
Also available in: Unified diff