root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / roi / ui / ROIManagerDialog.java @ 13221
History | View | Annotate | Download (3.86 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 Instituto de Desarrollo Regional 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 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
package org.gvsig.rastertools.roi.ui; |
42 |
|
43 |
import java.awt.BorderLayout; |
44 |
|
45 |
import javax.swing.JPanel; |
46 |
|
47 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
48 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
49 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.ui.mdiManager.IWindow; |
53 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
54 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
55 |
|
56 |
/**
|
57 |
* Di?logo para el gestor de ROIs.
|
58 |
*
|
59 |
* @author Diego Guerrero Sevilla (diego.guerrero@uclm.es)
|
60 |
*
|
61 |
*/
|
62 |
public class ROIManagerDialog extends JPanel implements IWindow, ButtonsPanelListener { |
63 |
private static final long serialVersionUID = 2847035927527203595L; |
64 |
|
65 |
|
66 |
private ROIManagerPanel roiManagerPanel = null; |
67 |
|
68 |
/**
|
69 |
* Constructor
|
70 |
* @param width Ancho del panel
|
71 |
* @param height Alto del panel
|
72 |
*/
|
73 |
public ROIManagerDialog(int width, int height) { |
74 |
this.setSize(width, height);
|
75 |
this.setLayout(new BorderLayout()); |
76 |
this.add(getROIManagerPanel(), BorderLayout.CENTER); |
77 |
} |
78 |
|
79 |
public ROIManagerPanel getROIManagerPanel() {
|
80 |
if (roiManagerPanel == null){ |
81 |
roiManagerPanel = new ROIManagerPanel(this); |
82 |
roiManagerPanel.addButtonPressedListener(this);
|
83 |
} |
84 |
return roiManagerPanel;
|
85 |
} |
86 |
|
87 |
public WindowInfo getWindowInfo() {
|
88 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
|
89 |
if(roiManagerPanel.getFLayer() != null) |
90 |
m_viewinfo.setAdditionalInfo(roiManagerPanel.getFLayer().getName()); |
91 |
m_viewinfo.setTitle(PluginServices.getText(this, "regiones_interes - "+m_viewinfo.getAdditionalInfo())); |
92 |
m_viewinfo.setHeight(this.getHeight());
|
93 |
m_viewinfo.setWidth(this.getWidth());
|
94 |
return m_viewinfo;
|
95 |
} |
96 |
|
97 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
98 |
// Al pulsar Aceptar o Aplicar se ejecuta el aceptar del panel
|
99 |
if (e.getButton() == ButtonsPanel.BUTTON_APPLY || e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
|
100 |
|
101 |
} |
102 |
|
103 |
// Al pulsar Cancelar la ventana se cierra y se refresca la vista
|
104 |
if (e.getButton() == ButtonsPanel.BUTTON_CANCEL) {
|
105 |
close(); |
106 |
} |
107 |
|
108 |
// Al pulsar Aceptar simplemente la ventana se cierra
|
109 |
if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
|
110 |
close(); |
111 |
} |
112 |
} |
113 |
|
114 |
/**
|
115 |
* Acciones a ejecutar cuando se cancela
|
116 |
*/
|
117 |
public void close() { |
118 |
try {
|
119 |
PluginServices.getMDIManager().closeWindow(this);
|
120 |
} catch (ArrayIndexOutOfBoundsException e) { |
121 |
//Si la ventana no se puede eliminar no hacemos nada
|
122 |
} |
123 |
} |
124 |
|
125 |
/**
|
126 |
* Se asigna el layer sobre el que trabaja el gestor de ROIs
|
127 |
* @param layer
|
128 |
*/
|
129 |
public void setLayer(FLayer layer) { |
130 |
getROIManagerPanel().setFLayer(layer); |
131 |
} |
132 |
} |