Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / raster / gui / wizards / projection / RasterProjectionActionsDialog.java @ 24986

History | View | Annotate | Download (4.27 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.raster.gui.wizards.projection;
20

    
21
import java.awt.BorderLayout;
22
import java.awt.Point;
23
import java.awt.event.ActionEvent;
24
import java.awt.event.ActionListener;
25

    
26
import javax.swing.JPanel;
27

    
28
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
29
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
30
import org.gvsig.raster.util.RasterToolsUtil;
31

    
32
import com.iver.andami.PluginServices;
33
import com.iver.andami.ui.mdiManager.IWindow;
34
import com.iver.andami.ui.mdiManager.IWindowListener;
35
import com.iver.andami.ui.mdiManager.WindowInfo;
36
/**
37
 * Dialogo de opciones de sobre la proyecci?n de la capa raster y la vista.
38
 *
39
 * @version 07/04/2008
40
 * @author Nacho Brodin nachobrodin@gmail.com
41
 */
42
public class RasterProjectionActionsDialog extends JPanel implements IWindow, IWindowListener, ActionListener {
43
        private static final long            serialVersionUID = 6954391896451933337L;
44
        private RasterProjectionActionsPanel panel            = null;
45
        private Point                        posWindow        = null;
46
        private int                          widthWindow      = 390;
47
        private int                          heightWindow     = 250;
48
        private FLyrRasterSE                 lyr              = null;
49

    
50
        /**
51
         * Constructor.
52
         */
53
        public RasterProjectionActionsDialog(FLyrRasterSE lyr) {
54
                this.lyr = lyr;
55
                BorderLayout bl = new BorderLayout();
56
                bl.setHgap(2);
57
                bl.setVgap(2);
58
                setLayout(bl);
59
                add(getRasterProjectionActionsPanel(), BorderLayout.CENTER);
60
                getRasterProjectionActionsPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
61
                getRasterProjectionActionsPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).addActionListener(this);
62
                getRasterProjectionActionsPanel().getCheckOption().addActionListener(this);
63
                posWindow = RasterToolsUtil.iwindowPosition(widthWindow, heightWindow);
64
                PluginServices.getMDIManager().addWindow(this);
65
        }
66

    
67
        /*
68
         * (non-Javadoc)
69
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
70
         */
71
        public WindowInfo getWindowInfo() {
72
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
73
                m_viewinfo.setTitle(PluginServices.getText(this, "options"));
74
                m_viewinfo.setHeight(heightWindow);
75
                m_viewinfo.setWidth(widthWindow);
76
                if (posWindow != null) {
77
                        m_viewinfo.setX((int) posWindow.getX());
78
                        m_viewinfo.setY((int) posWindow.getY());
79
                }
80
                return m_viewinfo;
81
        }
82

    
83
        /**
84
         * Obtiene el panel con las opciones de proyecci?n
85
         * @return RasterProjectionActionsPanel
86
         */
87
        public RasterProjectionActionsPanel getRasterProjectionActionsPanel() {
88
                if (panel == null) {
89
                        panel = new RasterProjectionActionsPanel(lyr);
90
                }
91
                return panel;
92
        }
93

    
94
        /**
95
         * Obtiene la selecci?n del panel
96
         * @return entero con la selecci?n. Esta representada por las constantes de la
97
         *         clase RasterReprojectionPanel.
98
         */
99
        public int getSelection() {
100
                return getRasterProjectionActionsPanel().getSelection();
101
        }
102

    
103
        /*
104
         * (non-Javadoc)
105
         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
106
         */
107
        public void actionPerformed(ActionEvent e) {
108
                if (e.getSource() == getRasterProjectionActionsPanel().getCheckOption()) {
109
                        RasterProjectionActionsPanel.selectAllFiles = getRasterProjectionActionsPanel().getCheckOption().isSelected();
110
                        return;
111
                }
112
                PluginServices.getMDIManager().closeWindow(this);
113
        }
114

    
115
        public void windowClosed() {}
116

    
117
        public void windowActivated() {}
118

    
119
        public Object getWindowProfile() {
120
                return WindowInfo.DIALOG_PROFILE;
121
        }
122
}