svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extCatalog / src / org / gvsig / catalog / gui / ConnectDialog.java @ 29625
History | View | Annotate | Download (4.98 KB)
1 | 15557 | jpiera | /* 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 | 28383 | jpiera | package org.gvsig.catalog.gui; |
42 | 15557 | jpiera | |
43 | import java.awt.Frame; |
||
44 | |||
45 | 28434 | jpiera | import javax.swing.Icon; |
46 | 15557 | jpiera | import javax.swing.JDialog; |
47 | |||
48 | 29625 | jpiera | import org.gvsig.andami.PluginServices; |
49 | import org.gvsig.andami.persistence.serverData.ServerDataPersistence; |
||
50 | import org.gvsig.andami.ui.mdiManager.IWindow; |
||
51 | import org.gvsig.andami.ui.mdiManager.WindowInfo; |
||
52 | 28355 | jpiera | import org.gvsig.catalog.drivers.ICatalogServiceDriver; |
53 | import org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel; |
||
54 | import org.gvsig.catalog.utils.Frames; |
||
55 | 15557 | jpiera | import org.gvsig.i18n.Messages; |
56 | 29625 | jpiera | import org.gvsig.utils.swing.jcomboServer.ServerData; |
57 | 15557 | jpiera | |
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 | 24989 | jcampos | public Object getWindowProfile(){ |
168 | return WindowInfo.DIALOG_PROFILE;
|
||
169 | } |
||
170 | 28434 | jpiera | |
171 | /* (non-Javadoc)
|
||
172 | * @see org.gvsig.catalog.ui.serverconnect.ServerConnectDialogPanel#getPropertiesIcon()
|
||
173 | */
|
||
174 | protected Icon getPropertiesIcon() { |
||
175 | return PluginServices.getIconTheme().get("catalog-properties"); |
||
176 | } |
||
177 | 15557 | jpiera | } |