svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / saveraster / ui / SaveRasterDialog.java @ 11267
History | View | Annotate | Download (4.58 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 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 |
package org.gvsig.rastertools.saveraster.ui; |
20 |
|
21 |
import java.awt.BorderLayout; |
22 |
import java.awt.Container; |
23 |
|
24 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
25 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
26 |
import org.gvsig.rastertools.saveraster.SaveRasterDialogListener; |
27 |
import org.gvsig.rastertools.saveraster.ui.listener.DataInputListener; |
28 |
import org.gvsig.rastertools.saveraster.util.DriverProperties; |
29 |
|
30 |
import com.iver.andami.PluginServices; |
31 |
import com.iver.andami.ui.mdiManager.IWindow; |
32 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
33 |
import com.iver.cit.gvsig.fmap.MapControl; |
34 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
35 |
|
36 |
|
37 |
/**
|
38 |
* Panel que contiene los botones de Aceptar, Cancelar y Aplicar heredando de
|
39 |
* DefaultDialogPanel. Dentro de este estar? el panel con los controles de
|
40 |
* salvar a raster.
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
42 |
*/
|
43 |
public class SaveRasterDialog extends DefaultButtonsPanel implements IWindow { |
44 |
final private static long serialVersionUID = -3370601314380922368L; |
45 |
private DataInputListener listener = null; |
46 |
public DriverProperties driverProps = null; |
47 |
private SaveRasterPanel controlsPanel = null; |
48 |
private FLayers layers = null; |
49 |
private SaveRasterDialogListener dialogListener = null; |
50 |
|
51 |
/**
|
52 |
* Constructor de la ventana de dialogo para gvSIG.
|
53 |
*/
|
54 |
public SaveRasterDialog(FLayers layers, MapControl mapCtrl) {
|
55 |
super(ButtonsPanel.BUTTONS_NONE);
|
56 |
driverProps = new DriverProperties();
|
57 |
this.layers = layers;
|
58 |
init(mapCtrl); |
59 |
} |
60 |
|
61 |
/**
|
62 |
* Constructor generico para poder visualizar la ventana desde
|
63 |
* una funci?n main.
|
64 |
*/
|
65 |
public SaveRasterDialog() {
|
66 |
super(ButtonsPanel.BUTTONS_NONE);
|
67 |
init(null);
|
68 |
} |
69 |
|
70 |
|
71 |
/**
|
72 |
* Inicializaci?n del panel.
|
73 |
* @return void
|
74 |
*/
|
75 |
public void init(MapControl mapCtrl) { |
76 |
getButtonsPanel().addAccept(); |
77 |
getButtonsPanel().addCancel(); |
78 |
|
79 |
setLayout(new BorderLayout()); |
80 |
add(getControlsPanel(), BorderLayout.CENTER);
|
81 |
|
82 |
if(layers != null && mapCtrl != null) |
83 |
dialogListener = new SaveRasterDialogListener(this, layers, mapCtrl); |
84 |
|
85 |
setSize(new java.awt.Dimension(385, 345)); |
86 |
getDataInputListener(); |
87 |
|
88 |
//Ocultamos el bot?n de aplicar
|
89 |
//this.setLocation(new java.awt.Point(0,0));
|
90 |
getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false);
|
91 |
|
92 |
setName("saveRaster");
|
93 |
} |
94 |
|
95 |
/**
|
96 |
* Cierra esta ventana a trav?s de andami
|
97 |
*/
|
98 |
public void closeJDialog() { |
99 |
this.hide();
|
100 |
for(int i=0;i<layers.getLayersCount();i++){ |
101 |
layers.getLayer(i).getMapContext().invalidate(); |
102 |
} |
103 |
PluginServices.getMDIManager().closeWindow(SaveRasterDialog.this); |
104 |
} |
105 |
|
106 |
/**
|
107 |
* Obtiene el panel con los controles de Salvar a Raster.
|
108 |
* @return
|
109 |
*/
|
110 |
public SaveRasterPanel getControlsPanel() {
|
111 |
if (controlsPanel == null) { |
112 |
controlsPanel = new SaveRasterPanel();
|
113 |
controlsPanel.setPreferredSize(new java.awt.Dimension(379, 317)); |
114 |
} |
115 |
return controlsPanel;
|
116 |
} |
117 |
|
118 |
public DataInputListener getDataInputListener() {
|
119 |
if(listener == null){ |
120 |
listener = new DataInputListener(getControlsPanel());
|
121 |
listener.setDialogPanel(this);
|
122 |
} |
123 |
return listener;
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* This method initializes jContentPane
|
128 |
*
|
129 |
* @return javax.swing.JPanel
|
130 |
*/
|
131 |
public Container getContentPane() { |
132 |
return this; |
133 |
} |
134 |
|
135 |
/**
|
136 |
* Asigna la lista de capas
|
137 |
* @param layers
|
138 |
*/
|
139 |
public void setLayerList(FLayers layers){ |
140 |
this.layers = layers;
|
141 |
} |
142 |
|
143 |
/**
|
144 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
145 |
*/
|
146 |
public WindowInfo getWindowInfo() {
|
147 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
148 |
m_viewinfo.setTitle(PluginServices.getText(this, "salvar_raster")); |
149 |
return m_viewinfo;
|
150 |
} |
151 |
|
152 |
} |