root / trunk / org.gvsig.postgresql / org.gvsig.postgresql.app / org.gvsig.postgresql.app.export / src / main / java / org / gvsig / postgresql / exportto / panel / DefaultConnectionPanel.java @ 61
History | View | Annotate | Download (2.14 KB)
1 | 61 | jjdelcerro | /*
|
---|---|---|---|
2 | * To change this license header, choose License Headers in Project Properties.
|
||
3 | * To change this template file, choose Tools | Templates
|
||
4 | * and open the template in the editor.
|
||
5 | */
|
||
6 | |||
7 | package org.gvsig.postgresql.exportto.panel; |
||
8 | |||
9 | import java.util.HashMap; |
||
10 | import java.util.Iterator; |
||
11 | import java.util.Map; |
||
12 | import javax.swing.JComponent; |
||
13 | import javax.swing.JPanel; |
||
14 | import org.gvsig.andami.PluginsLocator; |
||
15 | import org.gvsig.andami.PluginsManager; |
||
16 | import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
||
17 | import org.gvsig.tools.swing.api.Component; |
||
18 | import org.gvsig.geodb.ExtDB_Spatial; |
||
19 | |||
20 | /**
|
||
21 | *
|
||
22 | * @author jjdelcerro
|
||
23 | */
|
||
24 | public class DefaultConnectionPanel extends JPanel implements Component { |
||
25 | |||
26 | private String name = null; |
||
27 | private DBServerExplorerParameters explorerParameters = null; |
||
28 | private String explorerNameFilter = null; |
||
29 | |||
30 | |||
31 | public DefaultConnectionPanel() {
|
||
32 | |||
33 | } |
||
34 | |||
35 | public void setFilterByExplorerName(String explorerNameFilter) { |
||
36 | this.explorerNameFilter = explorerNameFilter;
|
||
37 | } |
||
38 | |||
39 | public JComponent asJComponent() { |
||
40 | return this; |
||
41 | } |
||
42 | |||
43 | protected Map<String,DBServerExplorerParameters> getUserConections() { |
||
44 | PluginsManager pluginsManager = PluginsLocator.getManager(); |
||
45 | ExtDB_Spatial geodbExtension = pluginsManager.getExtension(ExtDB_Spatial.class); |
||
46 | Map<String, DBServerExplorerParameters> connections = geodbExtension.getUserConnections(); |
||
47 | if( this.explorerNameFilter == null ) { |
||
48 | return connections;
|
||
49 | } |
||
50 | Map<String,DBServerExplorerParameters> filteredConnections = new HashMap<String,DBServerExplorerParameters>(); |
||
51 | |||
52 | Iterator<Map.Entry<String,DBServerExplorerParameters>> it = connections.entrySet().iterator(); |
||
53 | while( it.hasNext() ) {
|
||
54 | Map.Entry<String,DBServerExplorerParameters> entry = it.next(); |
||
55 | if( this.explorerNameFilter.equalsIgnoreCase(entry.getValue().getExplorerName()) ) { |
||
56 | filteredConnections.put(entry.getKey(), entry.getValue()); |
||
57 | } |
||
58 | } |
||
59 | return filteredConnections;
|
||
60 | } |
||
61 | |||
62 | protected void initComponents() { |
||
63 | |||
64 | } |
||
65 | |||
66 | |||
67 | } |