svn-gvsig-desktop / branches / v2_0_0_prep / extensions / extGazetteer / src / org / gvsig / gazetteer / gui / ConnectDialog.java @ 37871
History | View | Annotate | Download (4.02 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.gazetteer.gui; |
42 |
|
43 |
|
44 |
import java.awt.Frame; |
45 |
|
46 |
import javax.swing.JDialog; |
47 |
|
48 |
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 |
import org.gvsig.catalog.utils.Frames; |
53 |
import org.gvsig.gazetteer.ui.serverconnect.ServerConnectDialogPanel; |
54 |
import org.gvsig.i18n.Messages; |
55 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
56 |
|
57 |
|
58 |
/**
|
59 |
* @author Jorge Piera Llodra (piera_jor@gva.es)
|
60 |
*/
|
61 |
public class ConnectDialog extends ServerConnectDialogPanel |
62 |
implements IWindow {
|
63 |
public WindowInfo m_windowInfo = null; |
64 |
|
65 |
/**
|
66 |
* Building the dialog Window
|
67 |
*/
|
68 |
public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) { |
69 |
super(null); |
70 |
init(); |
71 |
} |
72 |
|
73 |
/**
|
74 |
* Establishing window properties
|
75 |
*
|
76 |
*/
|
77 |
private void init() { |
78 |
this.setBounds(0, 0, 610, 263); |
79 |
setName("connectDialog");
|
80 |
} |
81 |
|
82 |
public static void addServer(ServerData server) { |
83 |
addTreeMapServer(server); |
84 |
} |
85 |
|
86 |
/*
|
87 |
* (non-Javadoc)
|
88 |
* @see es.gva.cit.gazetteer.ui.serverconnect.ServerConnectDialogPanel#searchButtonActionPerformed()
|
89 |
*/
|
90 |
protected void searchButtonActionPerformed() { |
91 |
addCurrentHost(); |
92 |
closeJDialog(); |
93 |
|
94 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
95 |
Frames.centerFrame(panel,525,125); |
96 |
panel.setTitle(Messages.getText( "gazetteer_search"));
|
97 |
SearchDialog dialog = new SearchDialog(client,this); |
98 |
dialog.setFrame(panel); |
99 |
dialog.setCurrentServer(getCurrentServer()); |
100 |
dialog.setFrame(panel); |
101 |
panel.getContentPane().add(dialog); |
102 |
panel.setVisible(true);
|
103 |
} |
104 |
|
105 |
/**
|
106 |
* Save the current host (if is neccessary) in a file using the andami
|
107 |
* persistence
|
108 |
* @param host
|
109 |
* Host to save
|
110 |
*/
|
111 |
private void addCurrentHost(){ |
112 |
String host = client.getSUri();
|
113 |
ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_GAZETTEER); |
114 |
persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_GAZETTEER, client.getProtocol()));
|
115 |
persistence.setPersistent(); |
116 |
} |
117 |
|
118 |
/*
|
119 |
* (non-Javadoc)
|
120 |
* @see es.gva.cit.gazetteer.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed()
|
121 |
*/
|
122 |
protected void closeButtonActionPerformed() { |
123 |
closeJDialog(); |
124 |
} |
125 |
|
126 |
/**
|
127 |
* Cierra el Dialog
|
128 |
*/
|
129 |
public void closeJDialog() { |
130 |
PluginServices.getMDIManager().closeWindow(ConnectDialog.this); |
131 |
} |
132 |
|
133 |
/* (non-Javadoc)
|
134 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo()
|
135 |
*/
|
136 |
public WindowInfo getWindowInfo() {
|
137 |
if (m_windowInfo == null){ |
138 |
m_windowInfo=new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MODALDIALOG);
|
139 |
m_windowInfo.setTitle(Messages.getText( "gazetteer_connect"));
|
140 |
m_windowInfo.setHeight(225);
|
141 |
m_windowInfo.setWidth(610);
|
142 |
} |
143 |
return m_windowInfo;
|
144 |
} |
145 |
public Object getWindowProfile(){ |
146 |
return WindowInfo.DIALOG_PROFILE;
|
147 |
} |
148 |
|
149 |
} |