svn-gvsig-desktop / trunk / extensions / extPublish / src / com / iver / cit / gvsig / publish / gui / listeners / OptionsServerWindowListener.java @ 8877
History | View | Annotate | Download (6.02 KB)
1 |
package com.iver.cit.gvsig.publish.gui.listeners; |
---|---|
2 |
|
3 |
import java.awt.event.ActionEvent; |
4 |
import java.awt.event.ActionListener; |
5 |
import java.util.Properties; |
6 |
|
7 |
import com.iver.andami.PluginServices; |
8 |
import com.iver.andami.persistence.serverData.ServerDataPersistence; |
9 |
import com.iver.andami.ui.mdiManager.IWindow; |
10 |
import com.iver.cit.gvsig.publish.gui.OptionsServerWindow; |
11 |
import com.iver.cit.gvsig.publish.gui.SelectServerWindow; |
12 |
import com.iver.cit.gvsig.publish.servers.GenericServer; |
13 |
import com.iver.cit.gvsig.publish.servers.PublishControler; |
14 |
import com.iver.utiles.swing.jcomboServer.ServerData; |
15 |
|
16 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
17 |
*
|
18 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
19 |
*
|
20 |
* This program is free software; you can redistribute it and/or
|
21 |
* modify it under the terms of the GNU General Public License
|
22 |
* as published by the Free Software Foundation; either version 2
|
23 |
* of the License, or (at your option) any later version.
|
24 |
*
|
25 |
* This program is distributed in the hope that it will be useful,
|
26 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28 |
* GNU General Public License for more details.
|
29 |
*
|
30 |
* You should have received a copy of the GNU General Public License
|
31 |
* along with this program; if not, write to the Free Software
|
32 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
33 |
*
|
34 |
* For more information, contact:
|
35 |
*
|
36 |
* Generalitat Valenciana
|
37 |
* Conselleria d'Infraestructures i Transport
|
38 |
* Av. Blasco Ib??ez, 50
|
39 |
* 46010 VALENCIA
|
40 |
* SPAIN
|
41 |
*
|
42 |
* +34 963862235
|
43 |
* gvsig@gva.es
|
44 |
* www.gvsig.gva.es
|
45 |
*
|
46 |
* or
|
47 |
*
|
48 |
* IVER T.I. S.A
|
49 |
* Salamanca 50
|
50 |
* 46005 Valencia
|
51 |
* Spain
|
52 |
*
|
53 |
* +34 963163400
|
54 |
* dac@iver.es
|
55 |
*/
|
56 |
/* CVS MESSAGES:
|
57 |
*
|
58 |
* $Id: OptionsServerWindowListener.java 8877 2006-11-20 14:17:47Z dagilgon $
|
59 |
* $Log$
|
60 |
* Revision 1.13 2006-11-20 14:17:19 dagilgon
|
61 |
* *** empty log message ***
|
62 |
*
|
63 |
* Revision 1.12 2006/11/20 12:59:05 dagilgon
|
64 |
* *** empty log message ***
|
65 |
*
|
66 |
* Revision 1.11 2006/11/17 13:43:45 jorpiell
|
67 |
* A?adido el nuevo panel donde se muestran las capas
|
68 |
*
|
69 |
* Revision 1.10 2006/10/05 13:20:05 jvhigon
|
70 |
* Debido a los cambios de nombre MapserverConfigFile y GeoserverConfig
|
71 |
*
|
72 |
* Revision 1.9 2006/10/05 12:13:43 jorpiell
|
73 |
* A?adida una factor?a en la clase publishControler
|
74 |
*
|
75 |
* Revision 1.8 2006/09/11 12:09:13 jorpiell
|
76 |
* Ya se puede almacenar la ruta donde se encuentra el ejecutable de GDAL
|
77 |
*
|
78 |
* Revision 1.7 2006/09/08 15:39:49 jorpiell
|
79 |
* A?adida la capacidad de publicar con WFS
|
80 |
*
|
81 |
* Revision 1.6 2006/09/08 08:58:53 jorpiell
|
82 |
* Se han renombrado y modificado algunas clases
|
83 |
*
|
84 |
* Revision 1.5 2006/09/07 19:13:39 jorpiell
|
85 |
* Ya se pueden cargar im?genes
|
86 |
*
|
87 |
* Revision 1.4 2006/09/07 12:51:54 jorpiell
|
88 |
* Enganchada la interfaz gr?fica con el generador de ficheros
|
89 |
*
|
90 |
* Revision 1.3 2006/09/03 14:34:03 jorpiell
|
91 |
* Se ha cambiado el nombre del servidor a SERVER_BRAND
|
92 |
*
|
93 |
* Revision 1.2 2006/09/03 14:31:00 jorpiell
|
94 |
* Ahora se cargan todos los datos desde el fichero de configuraci?n. Se han a?adido algunos comentarios
|
95 |
*
|
96 |
* Revision 1.1 2006/09/01 13:40:59 jorpiell
|
97 |
* Primer gran commit de la extension
|
98 |
*
|
99 |
* Revision 1.1 2006/08/31 19:19:04 jorpiell
|
100 |
* *** empty log message ***
|
101 |
*
|
102 |
*
|
103 |
*/
|
104 |
/**
|
105 |
* Listener for the options service window. It implements the
|
106 |
* actions for the last and for the accept buttons.
|
107 |
*
|
108 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
109 |
*/
|
110 |
public class OptionsServerWindowListener implements ActionListener{ |
111 |
private IWindow lastWindow = null; |
112 |
private IWindow nextWindow = null; |
113 |
private IWindow currentWindow = null; |
114 |
|
115 |
public OptionsServerWindowListener(IWindow lastWindow, IWindow nextWindow, IWindow currentWindow) {
|
116 |
super();
|
117 |
this.lastWindow = lastWindow;
|
118 |
this.nextWindow = nextWindow;
|
119 |
this.currentWindow = currentWindow;
|
120 |
} |
121 |
|
122 |
/*
|
123 |
* (non-Javadoc)
|
124 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
125 |
*/
|
126 |
public void actionPerformed(ActionEvent e) { |
127 |
if (e.getActionCommand().equals("last")){ |
128 |
PluginServices.getMDIManager().addCentredWindow(lastWindow); |
129 |
PluginServices.getMDIManager().closeWindow(currentWindow); |
130 |
}else if(e.getActionCommand().equals("accept")){ |
131 |
//PluginServices.getMDIManager().closeWindow(optionsServerWindow);
|
132 |
ServerData serverData = saveServerOptions(); |
133 |
String brand = serverData.getProperty(GenericServer.GENERIC_SERVER_BRAND);
|
134 |
String type = serverData.getServiceType();
|
135 |
writeConfigurationFile(serverData,brand,type); |
136 |
//if (nextWindow == null){
|
137 |
// //nextWindow = new AttributesLayerWindow(currentWindow);
|
138 |
//}
|
139 |
//PluginServices.getMDIManager().addCentredWindow(nextWindow);
|
140 |
PluginServices.getMDIManager().closeWindow(currentWindow); |
141 |
} |
142 |
} |
143 |
|
144 |
/**
|
145 |
* Saves the current server and its potions in the
|
146 |
* plugins-persistence file
|
147 |
*/
|
148 |
private ServerData saveServerOptions(){
|
149 |
SelectServerWindow selectServerWindow = (SelectServerWindow)lastWindow; |
150 |
OptionsServerWindow optionsServerWindow = (OptionsServerWindow)currentWindow; |
151 |
String url = selectServerWindow.getServerURL();
|
152 |
String brand = selectServerWindow.getSelectedBrand();
|
153 |
String type = selectServerWindow.getSelectedType();
|
154 |
String serverPath = selectServerWindow.getServerPath();
|
155 |
Properties props = optionsServerWindow.getServerProperties();
|
156 |
props.put(GenericServer.GENERIC_SERVER_BRAND,brand); |
157 |
props.put(GenericServer.GENERIC_SERVER_PATH,serverPath); |
158 |
|
159 |
ServerData serverData = new ServerData(url,type);
|
160 |
serverData.setProperies(props); |
161 |
ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_MULTIPLE); |
162 |
persistence.addServerData(serverData); |
163 |
persistence.setPersistent(); |
164 |
return serverData;
|
165 |
//return null;
|
166 |
} |
167 |
|
168 |
/**
|
169 |
* This method writes the configuration file
|
170 |
* @param serverData
|
171 |
* ServerData that contains all the server options
|
172 |
* @param brand
|
173 |
* Server brand
|
174 |
* @param type
|
175 |
* Server brand
|
176 |
*/
|
177 |
private void writeConfigurationFile(ServerData serverData,String brand,String type){ |
178 |
PublishControler publishC = PublishControler.getPublishControler(brand,type); |
179 |
publishC.publish(serverData); |
180 |
} |
181 |
|
182 |
} |