svn-gvsig-desktop / trunk / extensions / extCatalogAndGazetteer / src / es / gva / cit / gvsig / catalog / gui / ConnectDialog.java @ 15557
History | View | Annotate | Download (4.67 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package es.gva.cit.gvsig.catalog.gui; |
42 |
|
43 |
import java.awt.Frame; |
44 |
|
45 |
import javax.swing.JDialog; |
46 |
|
47 |
import org.gvsig.i18n.Messages; |
48 |
|
49 |
import com.iver.andami.PluginServices; |
50 |
import com.iver.andami.persistence.serverData.ServerDataPersistence; |
51 |
import com.iver.andami.ui.mdiManager.IWindow; |
52 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
53 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
54 |
|
55 |
import es.gva.cit.catalog.drivers.ICatalogServiceDriver; |
56 |
import es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel; |
57 |
import es.gva.cit.catalog.utils.Frames; |
58 |
|
59 |
/**
|
60 |
* Inicia la consulta de cat?logo de metadatos
|
61 |
*
|
62 |
* @author luisw
|
63 |
*/
|
64 |
public class ConnectDialog extends ServerConnectDialogPanel implements IWindow { |
65 |
public WindowInfo m_windowInfo = null; |
66 |
|
67 |
/**
|
68 |
* Constructor de la ventana de dialogo.
|
69 |
*/
|
70 |
public ConnectDialog() {
|
71 |
super(null); |
72 |
init(); |
73 |
} |
74 |
|
75 |
/**
|
76 |
* Inicializa el Dialog
|
77 |
*/
|
78 |
private void init() { |
79 |
this.setBounds(0, 0, 597, 238); |
80 |
setName("connectDialog");
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* Add a server
|
85 |
*
|
86 |
* @param server
|
87 |
*/
|
88 |
public static void addServer(ServerData server) { |
89 |
ServerConnectDialogPanel.addTreeMapServer(server); |
90 |
} |
91 |
|
92 |
/**
|
93 |
* Search Button action
|
94 |
*/
|
95 |
protected void searchButtonActionPerformed() { |
96 |
addCurrentHost(); |
97 |
closeJDialog(); |
98 |
|
99 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
100 |
Frames.centerFrame(panel,525,165); |
101 |
panel.setTitle(Messages.getText( "catalog_search"));
|
102 |
SearchDialog dialog = new SearchDialog(getClient(),this); |
103 |
dialog.setCurrentServer(getCurrentServer()); |
104 |
dialog.setFrame(panel); |
105 |
panel.getContentPane().add(dialog); |
106 |
panel.setVisible(true);
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* Save the current host (if is neccessary) in a file using the andami
|
111 |
* persistence
|
112 |
*/
|
113 |
private void addCurrentHost() { |
114 |
String host = getClient().getSUri();
|
115 |
ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_CATALOG); |
116 |
ServerData newServerData = new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol(),getControlsPanel().getDatabase());
|
117 |
if (client.getServerData() != null){ |
118 |
if ((client.getServerData() .getServerAddress().compareTo(newServerData.getServerAddress()) == 0) && |
119 |
(client.getServerData() .getServiceSubType().compareTo(newServerData.getServiceSubType()) == 0)){
|
120 |
newServerData.setProperies(client.getServerData().getProperies()); |
121 |
} |
122 |
} |
123 |
persistence.addServerData(newServerData); |
124 |
persistence.setPersistent(); |
125 |
} |
126 |
|
127 |
/*
|
128 |
* (non-Javadoc)
|
129 |
* @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed()
|
130 |
*/
|
131 |
protected void closeButtonActionPerformed() { |
132 |
closeJDialog(); |
133 |
} |
134 |
|
135 |
/*
|
136 |
* (non-Javadoc)
|
137 |
* @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#serverPropertiesButtonActionPerformed()
|
138 |
*/
|
139 |
protected void serverPropertiesButtonActionPerformed(){ |
140 |
createClient(); |
141 |
PluginServices.getMDIManager().addWindow(new ServerPropertiesDialog(
|
142 |
getControlsPanel().getServer(), |
143 |
client, |
144 |
((ICatalogServiceDriver)getControlsPanel().getDriver()).getProfile(), |
145 |
null));
|
146 |
} |
147 |
|
148 |
/**
|
149 |
* Close the dialog
|
150 |
*/
|
151 |
public void closeJDialog() { |
152 |
PluginServices.getMDIManager().closeWindow(ConnectDialog.this); |
153 |
} |
154 |
|
155 |
/* (non-Javadoc)
|
156 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
157 |
*/
|
158 |
public WindowInfo getWindowInfo() {
|
159 |
if (m_windowInfo == null){ |
160 |
m_windowInfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
161 |
m_windowInfo.setTitle(Messages.getText("metadata_catalog"));
|
162 |
m_windowInfo.setHeight(200);
|
163 |
m_windowInfo.setWidth(600);
|
164 |
} |
165 |
return m_windowInfo;
|
166 |
} |
167 |
} |