gvsig-catalog / trunk / extCatalog / src / org / gvsig / catalog / gui / ConnectDialog.java @ 10
History | View | Annotate | Download (5.11 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 org.gvsig.catalog.gui; |
42 |
|
43 |
import java.awt.Frame; |
44 |
|
45 |
import javax.swing.Icon; |
46 |
import javax.swing.JDialog; |
47 |
|
48 |
import org.gvsig.andami.IconThemeHelper; |
49 |
import org.gvsig.andami.PluginServices; |
50 |
import org.gvsig.andami.persistence.serverData.ServerDataPersistence; |
51 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
52 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
53 |
import org.gvsig.catalog.drivers.ICatalogServiceDriver; |
54 |
import org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel; |
55 |
import org.gvsig.catalog.utils.Frames; |
56 |
import org.gvsig.i18n.Messages; |
57 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
58 |
|
59 |
|
60 |
/**
|
61 |
* Inicia la consulta de cat?logo de metadatos
|
62 |
*
|
63 |
* @author luisw
|
64 |
*/
|
65 |
public class ConnectDialog extends ServerConnectDialogPanel implements IWindow { |
66 |
public WindowInfo m_windowInfo = null; |
67 |
|
68 |
/**
|
69 |
* Constructor de la ventana de dialogo.
|
70 |
*/
|
71 |
public ConnectDialog() {
|
72 |
super(null); |
73 |
init(); |
74 |
} |
75 |
|
76 |
/**
|
77 |
* Inicializa el Dialog
|
78 |
*/
|
79 |
private void init() { |
80 |
this.setBounds(0, 0, 597, 238); |
81 |
setName("connectDialog");
|
82 |
} |
83 |
|
84 |
/**
|
85 |
* Add a server
|
86 |
*
|
87 |
* @param server
|
88 |
*/
|
89 |
public static void addServer(ServerData server) { |
90 |
ServerConnectDialogPanel.addTreeMapServer(server); |
91 |
} |
92 |
|
93 |
/**
|
94 |
* Search Button action
|
95 |
*/
|
96 |
protected void searchButtonActionPerformed() { |
97 |
addCurrentHost(); |
98 |
closeJDialog(); |
99 |
|
100 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
101 |
Frames.centerFrame(panel,525,165); |
102 |
panel.setTitle(Messages.getText( "catalog_search"));
|
103 |
SearchDialog dialog = new SearchDialog(getClient(),this); |
104 |
dialog.setCurrentServer(getCurrentServer()); |
105 |
dialog.setFrame(panel); |
106 |
panel.getContentPane().add(dialog); |
107 |
panel.setVisible(true);
|
108 |
} |
109 |
|
110 |
/**
|
111 |
* Save the current host (if is neccessary) in a file using the andami
|
112 |
* persistence
|
113 |
*/
|
114 |
private void addCurrentHost() { |
115 |
String host = getClient().getSUri();
|
116 |
ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_CATALOG); |
117 |
ServerData newServerData = new ServerData(host, ServerData.SERVER_TYPE_CATALOG, getClient().getProtocol(),getControlsPanel().getDatabase());
|
118 |
if (client.getServerData() != null){ |
119 |
if ((client.getServerData() .getServerAddress().compareTo(newServerData.getServerAddress()) == 0) && |
120 |
(client.getServerData() .getServiceSubType().compareTo(newServerData.getServiceSubType()) == 0)){
|
121 |
newServerData.setProperies(client.getServerData().getProperies()); |
122 |
} |
123 |
} |
124 |
persistence.addServerData(newServerData); |
125 |
persistence.setPersistent(); |
126 |
} |
127 |
|
128 |
/*
|
129 |
* (non-Javadoc)
|
130 |
* @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed()
|
131 |
*/
|
132 |
protected void closeButtonActionPerformed() { |
133 |
closeJDialog(); |
134 |
} |
135 |
|
136 |
/*
|
137 |
* (non-Javadoc)
|
138 |
* @see es.gva.cit.catalog.ui.serverconnect.ServerConnectDialogPanel#serverPropertiesButtonActionPerformed()
|
139 |
*/
|
140 |
protected void serverPropertiesButtonActionPerformed(){ |
141 |
createClient(); |
142 |
PluginServices.getMDIManager().addWindow(new ServerPropertiesDialog(
|
143 |
getControlsPanel().getServer(), |
144 |
client, |
145 |
((ICatalogServiceDriver)getControlsPanel().getDriver()).getProfile(), |
146 |
null));
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* Close the dialog
|
151 |
*/
|
152 |
public void closeJDialog() { |
153 |
PluginServices.getMDIManager().closeWindow(ConnectDialog.this); |
154 |
} |
155 |
|
156 |
/* (non-Javadoc)
|
157 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
158 |
*/
|
159 |
public WindowInfo getWindowInfo() {
|
160 |
if (m_windowInfo == null){ |
161 |
m_windowInfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
162 |
m_windowInfo.setTitle(Messages.getText("metadata_catalog"));
|
163 |
m_windowInfo.setHeight(200);
|
164 |
m_windowInfo.setWidth(600);
|
165 |
} |
166 |
return m_windowInfo;
|
167 |
} |
168 |
public Object getWindowProfile(){ |
169 |
return WindowInfo.DIALOG_PROFILE;
|
170 |
} |
171 |
|
172 |
/* (non-Javadoc)
|
173 |
* @see org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel#getPropertiesIcon()
|
174 |
*/
|
175 |
protected Icon getPropertiesIcon() { |
176 |
// catalog-move-down
|
177 |
// catalog-move-up
|
178 |
// catalog-server-properties
|
179 |
return IconThemeHelper.getImageIcon("catalog-server-properties"); |
180 |
} |
181 |
} |