Statistics
| Revision:

gvsig-raster / org.gvsig.raster.reproject / branches / org.gvsig.raster.reproject_dataaccess_refactoring / org.gvsig.raster.reproject.app.reprojectclient / src / main / java / org / gvsig / raster / reproject / app / preparelayer / RasterProjectionActionsDialog.java @ 2440

History | View | Annotate | Download (4.72 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
* 
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
* 
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
* 
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
* MA  02110-1301, USA.
20
* 
21
*/
22
package org.gvsig.raster.reproject.app.preparelayer;
23

    
24
import java.awt.BorderLayout;
25
import java.awt.Point;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
28

    
29
import javax.swing.JPanel;
30

    
31
import org.gvsig.andami.PluginServices;
32
import org.gvsig.andami.ui.mdiManager.IWindow;
33
import org.gvsig.andami.ui.mdiManager.IWindowListener;
34
import org.gvsig.andami.ui.mdiManager.WindowInfo;
35
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters;
36
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
37
import org.gvsig.raster.mainplugin.RasterMainPluginUtils;
38

    
39
/**
40
 * Dialogo de opciones de sobre la proyecci?n de la capa raster y la vista.
41
 *
42
 * @author Nacho Brodin nachobrodin@gmail.com
43
 */
44
public class RasterProjectionActionsDialog extends JPanel implements IWindow, IWindowListener, ActionListener {
45
        private static final long            serialVersionUID       = 6954391896451933337L;
46
        private RasterProjectionActionsPanel panel                  = null;
47
        private Point                        posWindow              = null;
48
        private int                          widthWindow            = 390;
49
        private int                          heightWindow           = 260;
50
        private boolean                      layerIsReprojectable   = true;
51
        private String                       layerName              = null;
52
        private int                          defaultAction          = RasterDataParameters.NEW_PROJETION_TO_THE_LAYER;
53

    
54
        /**
55
         * Constructor.
56
         */
57
        public RasterProjectionActionsDialog(boolean layerIsReprojectable, String layerName, int defaultAction) {
58
                this.layerIsReprojectable = layerIsReprojectable;
59
                this.layerName = layerName;
60
                this.defaultAction = defaultAction;
61
                BorderLayout bl = new BorderLayout();
62
                bl.setHgap(2);
63
                bl.setVgap(2);
64
                setLayout(bl);
65
                add(getRasterProjectionActionsPanel(), BorderLayout.CENTER);
66
                getRasterProjectionActionsPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).addActionListener(this);
67
                getRasterProjectionActionsPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_CANCEL).addActionListener(this);
68
                getRasterProjectionActionsPanel().getCheckOption().addActionListener(this);
69
                posWindow = RasterMainPluginUtils.iwindowPosition(widthWindow, heightWindow);
70
                PluginServices.getMDIManager().addWindow(this);
71
        }
72
        
73
        public WindowInfo getWindowInfo() {
74
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
75
                m_viewinfo.setTitle(PluginServices.getText(this, "options"));
76
                m_viewinfo.setHeight(heightWindow);
77
                m_viewinfo.setWidth(widthWindow);
78
                if (posWindow != null) {
79
                        m_viewinfo.setX((int) posWindow.getX());
80
                        m_viewinfo.setY((int) posWindow.getY());
81
                }
82
                return m_viewinfo;
83
        }
84

    
85
        /**
86
         * Obtiene el panel con las opciones de proyecci?n
87
         * @return RasterProjectionActionsPanel
88
         */
89
        public RasterProjectionActionsPanel getRasterProjectionActionsPanel() {
90
                if (panel == null) {
91
                        panel = new RasterProjectionActionsPanel(layerIsReprojectable, layerName, defaultAction);
92
                }
93
                return panel;
94
        }
95

    
96
        /**
97
         * Obtiene la selecci?n del panel
98
         * @return entero con la selecci?n. Esta representada por las constantes de la
99
         *         clase RasterReprojectionPanel.
100
         */
101
        public int getSelection() {
102
                return getRasterProjectionActionsPanel().getSelection();
103
        }
104
        
105
        /**
106
         * Obtiene la selecci?n del panel
107
         * @return entero con la selecci?n. Esta representada por las constantes de la
108
         *         clase RasterReprojectionPanel.
109
         */
110
        public boolean getChangeProjectionOption() {
111
                return getRasterProjectionActionsPanel().getCheckOption().isSelected();
112
        }
113

    
114
        public void actionPerformed(ActionEvent e) {
115
                if (e.getSource() == getRasterProjectionActionsPanel().getCheckOption()) {
116
                        return;
117
                }
118
                PluginServices.getMDIManager().closeWindow(this);
119
        }
120

    
121
        public void windowClosed() {}
122

    
123
        public void windowActivated() {}
124

    
125
        public Object getWindowProfile() {
126
                return WindowInfo.DIALOG_PROFILE;
127
        }
128
}