Statistics
| Revision:

root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / mosaic / gui / MosaicDialog.java @ 20365

History | View | Annotate | Download (4.62 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
         *
3
         * Copyright (C) 2006 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 Iba?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.remotesensing.mosaic.gui;
42

    
43
import java.awt.BorderLayout;
44
import java.beans.PropertyChangeEvent;
45
import java.beans.PropertyChangeListener;
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
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
51

    
52
import com.iver.andami.PluginServices;
53
import com.iver.andami.ui.mdiManager.IWindow;
54
import com.iver.andami.ui.mdiManager.IWindowListener;
55
import com.iver.andami.ui.mdiManager.WindowInfo;
56
import com.iver.cit.gvsig.fmap.MapControl;
57
import com.iver.cit.gvsig.project.documents.view.gui.View;
58

    
59
public class MosaicDialog extends DefaultButtonsPanel implements IWindow, IWindowListener,ButtonsPanelListener, PropertyChangeListener{
60

    
61
        private static final long serialVersionUID = 2847035927527203595L;
62
        private SelectLayersFromViewPanel northPanel = null;
63
        private MethodMosaicPanel southPanel = null;
64
        private MapControl mapControl = null;
65
        private View view=null;
66
        /**
67
         * Constructor
68
         * @param width Ancho del panel
69
         * @param height Alto del panel
70
         */
71
        public MosaicDialog(int width, int height, View view) {
72
                super();
73
                this.view= view;
74
                this.setSize(width, height);
75
                this.setLayout(new BorderLayout());
76
                mapControl = view.getMapControl();
77
                this.add(getPanelNorth(), BorderLayout.NORTH);
78
                this.add(getPanelSouth(), BorderLayout.CENTER);
79
        }
80
        
81
        
82
        public WindowInfo getWindowInfo() {
83
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.PALETTE| WindowInfo.RESIZABLE);
84
                m_viewinfo.setTitle(PluginServices.getText(this, "mosaicos"));
85
                m_viewinfo.setHeight(this.getHeight());
86
                m_viewinfo.setWidth(this.getWidth());
87
                return m_viewinfo;
88
        }
89

    
90
        public void actionButtonPressed(ButtonsPanelEvent e) {
91
                // Al pulsar Cancelar la ventana se cierra y se refresca la vista
92
                if (e.getButton() == ButtonsPanel.BUTTON_CANCEL) {
93
                        close();
94
                }
95

    
96
                // Al pulsar Aceptar simplemente la ventana se cierra
97
                if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
98
                        close();
99
                }
100
        }
101
        
102
        /**
103
         * Acciones a ejecutar cuando se cancela
104
         */
105
        public void close() {
106
                try {
107
                        PluginServices.getMDIManager().closeWindow(this);
108
                } catch (ArrayIndexOutOfBoundsException e) {
109
                        //Si la ventana no se puede eliminar no hacemos nada
110
                }
111
        }
112
        
113

    
114
        public void windowActivated() {
115
                
116
        }
117

    
118
        /**
119
         * M?todo que realiza acciones al cerrar el dialogo como eliminar los graphis 
120
         * de la vista
121
         * */
122
        public void windowClosed() {
123
                
124
        }
125

    
126
        
127
        /**
128
         *  @return northPanel. Panel principal
129
         * */
130
        public SelectLayersFromViewPanel getPanelNorth() {
131
                if (northPanel == null){
132
                        northPanel = new SelectLayersFromViewPanel(view);
133
                        //northPanel.getTableImages().getSelectionModel().addListSelectionListener(this);
134
                        northPanel.getTableImages().addPropertyChangeListener(this);
135
                }
136
                return northPanel;
137
        }
138

    
139
        /**
140
         *  @return northPanel. Panel principal
141
         * */
142
        public MethodMosaicPanel getPanelSouth() {
143
                if (southPanel == null){
144
                        southPanel = new MethodMosaicPanel(northPanel.getSelectedLayers(),view);
145
                        southPanel.setView(view);
146
                }
147
                return southPanel;
148
        }
149

    
150
        
151

    
152
        public MapControl getMapControl() {
153
                return mapControl;
154
        }
155

    
156

    
157

    
158
        public void propertyChange(PropertyChangeEvent evt) {
159
                getPanelSouth().setNameLayers(getPanelNorth().getSelectedLayers());
160
                getPanelSouth().updateCombo();
161
                getPanelSouth().updateRoisTable();
162
        }
163

    
164

    
165
}