Statistics
| Revision:

root / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / gridmath / gui / CalculatorDialog.java @ 16088

History | View | Annotate | Download (3.75 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 Ib??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.gridmath.gui;
42

    
43
import java.awt.BorderLayout;
44
import java.awt.Dimension;
45

    
46
import javax.swing.JPanel;
47

    
48
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
49
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
50
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
51

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

    
57
/**
58
 * Clase que implementa la interfaz de la calculadora de mapas. Desde esta interfaz se
59
 * puede configurar la expresi?n a evaluar y la lista de variables que intervienen.
60
 * 
61
 * @author Alejandro Mu?oz Sanchez        (alejandro.munoz@uclm.es)
62
 * @author Diego Guerrero Sevilla (diego.guerrero@uclm.es)
63
 * @version 19/10/2007 
64
 */
65
 
66
public class CalculatorDialog extends JPanel implements IWindow, ButtonsPanelListener{
67

    
68
        private static final long serialVersionUID = -8676017674682458513L;
69
        
70
        private View view = null;
71
        private CalculatorPanel calculatorPanel = null;
72
        private int width=630;
73
        private int height=300;
74

    
75
        /**
76
         * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
77
         */
78
        public WindowInfo getWindowInfo() {
79
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.MAXIMIZABLE | WindowInfo.RESIZABLE);
80
                m_viewinfo.setWidth(width);
81
                m_viewinfo.setHeight(height);
82
                m_viewinfo.setTitle(PluginServices.getText(this,"band_math"));
83
                m_viewinfo.setX(300);
84
                return m_viewinfo;
85
        }
86

    
87
        /*
88
         * (non-Javadoc)
89
         * @see org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener#actionButtonPressed(org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent)
90
         */
91
        public void actionButtonPressed(ButtonsPanelEvent e) {
92
                if (e.getButton() == ButtonsPanel.BUTTON_CLOSE) {
93
                        try {
94
                                PluginServices.getMDIManager().closeWindow(this);
95
                        } catch (ArrayIndexOutOfBoundsException ex) {
96
                                // Si la ventana no se puede eliminar no hacemos nada
97
                        }
98
                }
99
        }
100

    
101
        /**
102
         * Constructor
103
         * @param view vista actual
104
         */
105
        public CalculatorDialog(View view) {
106
                this.view = view;
107
                this.setPreferredSize(new Dimension(width, height));
108
                this.setSize(width, height);
109
                this.setLayout(new BorderLayout(3, 3));
110
                this.add(getCalculatorPanel(), java.awt.BorderLayout.CENTER);
111
        }
112

    
113
        /**
114
         * @return CalculatorPanel del dialogo
115
         */
116
        public CalculatorPanel getCalculatorPanel() {
117
                if (calculatorPanel==null){
118
                        calculatorPanel = new CalculatorPanel(this,view);
119
                        calculatorPanel.addButtonPressedListener(this);
120
                }
121
                return calculatorPanel;
122
        }
123
}