root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / saveraster / ui / SaveRasterDialog.java @ 24986
History | View | Annotate | Download (4.34 KB)
1 | 11267 | nacho | /* 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 | 11283 | nacho | import org.gvsig.rastertools.saveraster.ui.listener.SaveRasterDialogListener; |
27 | 14495 | nbrodin | import org.gvsig.rastertools.saveraster.ui.panels.listener.DataInputListener; |
28 | 11267 | nacho | 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 | * Panel que contiene los botones de Aceptar, Cancelar y Aplicar heredando de
|
||
37 | * DefaultDialogPanel. Dentro de este estar? el panel con los controles de
|
||
38 | * salvar a raster.
|
||
39 | 12050 | bsanchez | *
|
40 | 11267 | nacho | * @author Nacho Brodin (nachobrodin@gmail.com)
|
41 | */
|
||
42 | public class SaveRasterDialog extends DefaultButtonsPanel implements IWindow { |
||
43 | 12050 | bsanchez | final private static long serialVersionUID = -3370601314380922368L; |
44 | private DataInputListener listener = null; |
||
45 | public DriverProperties driverProps = null; |
||
46 | 11267 | nacho | private SaveRasterPanel controlsPanel = null; |
47 | private FLayers layers = null; |
||
48 | |||
49 | /**
|
||
50 | * Constructor de la ventana de dialogo para gvSIG.
|
||
51 | */
|
||
52 | public SaveRasterDialog(FLayers layers, MapControl mapCtrl) {
|
||
53 | 13699 | nacho | super(ButtonsPanel.BUTTONS_APPLYCLOSE);
|
54 | 11267 | nacho | driverProps = new DriverProperties();
|
55 | this.layers = layers;
|
||
56 | init(mapCtrl); |
||
57 | } |
||
58 | 12050 | bsanchez | |
59 | 11267 | nacho | /**
|
60 | * Constructor generico para poder visualizar la ventana desde
|
||
61 | * una funci?n main.
|
||
62 | */
|
||
63 | 12050 | bsanchez | public SaveRasterDialog() {
|
64 | super(ButtonsPanel.BUTTONS_NONE);
|
||
65 | init(null);
|
||
66 | } |
||
67 | 11267 | nacho | |
68 | 12050 | bsanchez | |
69 | 11267 | nacho | /**
|
70 | 12050 | bsanchez | * Inicializaci?n del panel.
|
71 | * @return void
|
||
72 | */
|
||
73 | public void init(MapControl mapCtrl) { |
||
74 | setLayout(new BorderLayout()); |
||
75 | add(getControlsPanel(), BorderLayout.CENTER);
|
||
76 | |||
77 | if (layers != null && mapCtrl != null) |
||
78 | new SaveRasterDialogListener(this, layers, mapCtrl); |
||
79 | |||
80 | 20417 | bsanchez | setSize(new java.awt.Dimension(405, 410)); |
81 | 12050 | bsanchez | getDataInputListener(); |
82 | |||
83 | // Ocultamos el bot?n de aplicar
|
||
84 | getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false);
|
||
85 | |||
86 | setName("saveRaster");
|
||
87 | } |
||
88 | |||
89 | 14495 | nbrodin | /**
|
90 | * Cierra esta ventana a trav?s de andami
|
||
91 | */
|
||
92 | public void closeJDialog() { |
||
93 | 12050 | bsanchez | this.setVisible(false); |
94 | 14495 | nbrodin | for(int i = 0; i < layers.getLayersCount(); i++){ |
95 | 11267 | nacho | layers.getLayer(i).getMapContext().invalidate(); |
96 | } |
||
97 | PluginServices.getMDIManager().closeWindow(SaveRasterDialog.this); |
||
98 | 12050 | bsanchez | } |
99 | 11267 | nacho | |
100 | 12050 | bsanchez | /**
|
101 | * Obtiene el panel con los controles de Salvar a Raster.
|
||
102 | * @return
|
||
103 | */
|
||
104 | public SaveRasterPanel getControlsPanel() {
|
||
105 | if (controlsPanel == null) { |
||
106 | controlsPanel = new SaveRasterPanel();
|
||
107 | controlsPanel.setPreferredSize(new java.awt.Dimension(379, 317)); |
||
108 | } |
||
109 | return controlsPanel;
|
||
110 | } |
||
111 | |||
112 | 11267 | nacho | public DataInputListener getDataInputListener() {
|
113 | 12050 | bsanchez | if (listener == null) { |
114 | 11267 | nacho | listener = new DataInputListener(getControlsPanel());
|
115 | listener.setDialogPanel(this);
|
||
116 | } |
||
117 | return listener;
|
||
118 | } |
||
119 | 12050 | bsanchez | |
120 | 11267 | nacho | /**
|
121 | * This method initializes jContentPane
|
||
122 | *
|
||
123 | * @return javax.swing.JPanel
|
||
124 | */
|
||
125 | public Container getContentPane() { |
||
126 | return this; |
||
127 | } |
||
128 | 12050 | bsanchez | |
129 | 11267 | nacho | /**
|
130 | * Asigna la lista de capas
|
||
131 | * @param layers
|
||
132 | */
|
||
133 | public void setLayerList(FLayers layers){ |
||
134 | this.layers = layers;
|
||
135 | } |
||
136 | 12050 | bsanchez | |
137 | 11267 | nacho | /**
|
138 | * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
||
139 | */
|
||
140 | public WindowInfo getWindowInfo() {
|
||
141 | 14495 | nbrodin | WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE);
|
142 | 18846 | bsanchez | m_viewinfo.setTitle(PluginServices.getText(this, "salvar_raster_geo")); |
143 | 11267 | nacho | return m_viewinfo;
|
144 | } |
||
145 | 24986 | jcampos | |
146 | public Object getWindowProfile() { |
||
147 | return WindowInfo.PROPERTIES_PROFILE;
|
||
148 | } |
||
149 | 12050 | bsanchez | } |