root / tags / v1_0_2_Build_901 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / core / gui / GeoprocessPaneContainer.java @ 10571
History | View | Annotate | Download (6.19 KB)
1 |
/*
|
---|---|
2 |
* Created on 28-mar-2006
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id: GeoprocessPaneContainer.java 10571 2007-03-01 11:52:43Z $
|
47 |
* $Log$
|
48 |
* Revision 1.6.2.4 2006-11-15 08:29:55 caballero
|
49 |
* cerrar la IWindow de andami, para poder guardar el proyecto
|
50 |
*
|
51 |
* Revision 1.6.2.3 2006/11/15 00:08:17 jjdelcerro
|
52 |
* *** empty log message ***
|
53 |
*
|
54 |
* Revision 1.8 2006/10/23 10:27:23 caballero
|
55 |
* ancho y alto del panel
|
56 |
*
|
57 |
* Revision 1.7 2006/09/18 11:02:20 caballero
|
58 |
* cambio tama?o container
|
59 |
*
|
60 |
* Revision 1.6 2006/08/29 07:56:30 cesar
|
61 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
62 |
*
|
63 |
* Revision 1.5 2006/08/29 07:13:56 cesar
|
64 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow
|
65 |
*
|
66 |
* Revision 1.4 2006/08/11 16:12:27 azabala
|
67 |
* *** empty log message ***
|
68 |
*
|
69 |
* Revision 1.3 2006/07/04 16:42:37 azabala
|
70 |
* *** empty log message ***
|
71 |
*
|
72 |
* Revision 1.2 2006/05/25 08:20:43 jmvivo
|
73 |
* Modificado para que, si el proceso no ha podido ejecutarse, no cierre la ventana
|
74 |
*
|
75 |
* Revision 1.1 2006/05/24 21:13:09 azabala
|
76 |
* primera version en cvs despues de refactoring orientado a crear un framework extensible de geoprocessing
|
77 |
*
|
78 |
* Revision 1.1 2006/04/11 17:55:51 azabala
|
79 |
* primera version en cvs
|
80 |
*
|
81 |
* Revision 1.2 2006/04/07 19:00:58 azabala
|
82 |
* *** empty log message ***
|
83 |
*
|
84 |
* Revision 1.1 2006/03/28 16:26:45 azabala
|
85 |
* *** empty log message ***
|
86 |
*
|
87 |
*
|
88 |
*/
|
89 |
package com.iver.cit.gvsig.geoprocess.core.gui; |
90 |
|
91 |
import java.awt.BorderLayout; |
92 |
import java.awt.Component; |
93 |
import java.awt.Container; |
94 |
import java.awt.Window; |
95 |
import java.awt.event.ActionEvent; |
96 |
import java.awt.event.ActionListener; |
97 |
|
98 |
import javax.swing.JPanel; |
99 |
|
100 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
101 |
|
102 |
import com.iver.andami.PluginServices; |
103 |
import com.iver.andami.ui.mdiManager.IWindow; |
104 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
105 |
import com.iver.cit.gvsig.geoprocess.core.IGeoprocessController; |
106 |
/**
|
107 |
* This GUI class is a container to show gui components associated to
|
108 |
* a geoprocess.
|
109 |
* To correctly execute the geoprocess associated, this PaneContainer must
|
110 |
* receive an AndamiCommand instance, which is controller class that
|
111 |
* knows how to invoque geoprocess
|
112 |
* @author azabala
|
113 |
*
|
114 |
*/
|
115 |
public class GeoprocessPaneContainer extends JPanel implements IWindow { |
116 |
private static final long serialVersionUID = 1L; |
117 |
private AcceptCancelPanel buttonPanel = null; |
118 |
private JPanel mainPanel = new JPanel(); // @jve:decl-index=0:visual-constraint="10,10" |
119 |
private WindowInfo viewInfo = null; |
120 |
private IGeoprocessController controller;
|
121 |
|
122 |
private ActionListener okActionListener = new ActionListener(){ |
123 |
public void actionPerformed(ActionEvent arg0) { |
124 |
if (controller.launchGeoprocess()) {
|
125 |
//So controller will launch geoprocess in background,
|
126 |
//we can call cancel to close dialog
|
127 |
cancel(); |
128 |
} |
129 |
} |
130 |
}; |
131 |
|
132 |
private ActionListener cancelActionListener = new ActionListener(){ |
133 |
public void actionPerformed(ActionEvent arg0) { |
134 |
cancel(); |
135 |
} |
136 |
}; |
137 |
|
138 |
/**
|
139 |
* Constructor from GUI component associated to a geoprocess
|
140 |
* @param mainPanel
|
141 |
*/
|
142 |
public GeoprocessPaneContainer(JPanel mainPanel) { |
143 |
super();
|
144 |
this.mainPanel = mainPanel;
|
145 |
initialize(); |
146 |
} |
147 |
/**
|
148 |
* Implementation of ViewInfo andami interface.
|
149 |
*/
|
150 |
public WindowInfo getWindowInfo() {
|
151 |
if (viewInfo == null) { |
152 |
viewInfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
153 |
viewInfo.setTitle(PluginServices.getText(this,
|
154 |
"Herramientas_de_analisis"));
|
155 |
viewInfo.setWidth(controller.getWidth()); |
156 |
viewInfo.setHeight(controller.getHeight()); |
157 |
} |
158 |
return viewInfo;
|
159 |
} |
160 |
|
161 |
/**
|
162 |
* Sets AndamiCmd instance, which knows how to run geoprocess
|
163 |
* from user inputs in main panel.
|
164 |
* @param command
|
165 |
*/
|
166 |
public void setCommand(IGeoprocessController controller){ |
167 |
this.controller = controller;
|
168 |
} |
169 |
|
170 |
/**
|
171 |
* This method initializes this
|
172 |
*
|
173 |
* @return void
|
174 |
*/
|
175 |
private void initialize() { |
176 |
// this.setLayout(new BorderLayout(10, 10));
|
177 |
this.setLayout(new BorderLayout()); |
178 |
// mainPanel.setSize(new java.awt.Dimension(430,390));
|
179 |
this.setSize(new java.awt.Dimension(570,460)); |
180 |
this.add(getMainPanel(), java.awt.BorderLayout.NORTH);
|
181 |
this.add(getButtonPanel(), java.awt.BorderLayout.SOUTH);
|
182 |
|
183 |
this.validate();
|
184 |
} |
185 |
|
186 |
private JPanel getMainPanel() { |
187 |
return mainPanel;
|
188 |
} |
189 |
/**
|
190 |
* This method initializes buttonPanel
|
191 |
*
|
192 |
* @return javax.swing.JPanel
|
193 |
*/
|
194 |
private AcceptCancelPanel getButtonPanel() {
|
195 |
if (buttonPanel == null) { |
196 |
buttonPanel = new AcceptCancelPanel();
|
197 |
buttonPanel.setOkButtonActionListener(okActionListener); |
198 |
buttonPanel.setCancelButtonActionListener(cancelActionListener); |
199 |
} |
200 |
return buttonPanel;
|
201 |
} |
202 |
|
203 |
/**
|
204 |
* Closes parent dialog
|
205 |
*
|
206 |
*/
|
207 |
public void cancel(){ |
208 |
if (PluginServices.getMainFrame() == null) { |
209 |
Container container = getParent();
|
210 |
Container parentOfContainer = null; |
211 |
while(! (container instanceof Window)){ |
212 |
parentOfContainer = container.getParent(); |
213 |
container = parentOfContainer; |
214 |
} |
215 |
((Window)container).dispose();
|
216 |
}else {
|
217 |
PluginServices.getMDIManager().closeWindow(GeoprocessPaneContainer.this); |
218 |
} |
219 |
} |
220 |
|
221 |
} // @jve:decl-index=0:visual-constraint="31,13"
|