Statistics
| Revision:

root / branches / gvSIG_03_SLD / applications / appgvSIG / src / com / iver / cit / gvsig / gui / thememanager / legendmanager / panels / edition / PanelEditInterval.java @ 2076

History | View | Annotate | Download (5.73 KB)

1
/*
2
 * Created on 24-may-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package com.iver.cit.gvsig.gui.thememanager.legendmanager.panels.edition;
48

    
49

    
50
import javax.swing.JLabel;
51
import javax.swing.JOptionPane;
52
import javax.swing.JPanel;
53
import javax.swing.JTextField;
54

    
55
import com.iver.andami.PluginServices;
56
import com.iver.andami.ui.mdiManager.View;
57
import com.iver.andami.ui.mdiManager.ViewInfo;
58
import com.iver.cit.gvsig.fmap.rendering.FInterval;
59
import javax.swing.JButton;
60

    
61

    
62
/**
63
 * DOCUMENT ME!
64
 *
65
 * @author fjp To change the template for this generated type comment go to
66
 *         Window>Preferences>Java>Code Generation>Code and
67
 *         Comments
68
*/
69
public class PanelEditInterval extends JPanel implements View  {
70
        private JButton jButton = null;
71
        private FIntervalCellEditor intervaleditor;
72
        private JPanel jPanel = null;
73
        private JPanel jPanel1 = null;
74
        private JLabel jLabel = null;
75
        private JTextField m_txtMin1 = null;
76
        private JPanel jPanel2 = null;
77
        private JLabel jLabel1 = null;
78
        private JTextField m_txtMax1 = null;
79
        /**
80
     * This is the default constructor
81
     */
82
    public PanelEditInterval(FIntervalCellEditor ice) {
83
        super();
84
        initialize();
85
                intervaleditor=ice;
86
    }
87

    
88
    /**
89
     * DOCUMENT ME!
90
     *
91
     * @param i DOCUMENT ME!
92
     */
93
    public void setFInterval(FInterval i) {
94
                m_txtMin1.setText(String.valueOf(i.getMin()));
95
                m_txtMax1.setText(String.valueOf(i.getMax()));
96
    }
97

    
98
    /**
99
     * DOCUMENT ME!
100
     *
101
     * @return DOCUMENT ME!
102
     */
103
    private FInterval getFInterval() {
104
                double from=0;
105
                double to=0;
106
                try{
107
        from = Double.parseDouble(m_txtMin1.getText());
108
        to =Double.parseDouble(m_txtMax1.getText());
109
       
110
                }catch (NumberFormatException e) {
111
                        JOptionPane.showMessageDialog(null, PluginServices.getText(this,"Formato de n?mero erroneo")+".");
112
                }
113
                FInterval i = new FInterval(from, to);
114
        return i;
115
    }
116

    
117
    /**
118
     * This method initializes this
119
     */
120
    private void initialize() {
121
        this.setSize(316, 124);
122
                this.add(getJPanel1(), null);
123
                this.add(getJPanel2(), null);
124
                this.add(getJPanel(), null);
125
                
126
        
127
    }
128

    
129
        public ViewInfo getViewInfo() {
130
                ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
131
                m_viewinfo.setTitle(PluginServices.getText(this, "Intervalo"));
132
                m_viewinfo.setWidth(this.getWidth());
133
                m_viewinfo.setHeight(this.getHeight());
134
                return m_viewinfo;
135
        }
136

    
137
        /**
138
         * This method initializes jButton        
139
         *         
140
         * @return javax.swing.JButton        
141
         */    
142
        private JButton getJButton() {
143
                if (jButton == null) {
144
                        jButton = new JButton();
145
                        jButton.setText("aceptar");
146
                        jButton.setPreferredSize(new java.awt.Dimension(90,26));
147
                        jButton.addActionListener(new java.awt.event.ActionListener() { 
148
                                public void actionPerformed(java.awt.event.ActionEvent e) {    
149
                                        intervaleditor.setCurrentInterval(getFInterval());
150
                                        PluginServices.getMDIManager().closeView(PanelEditInterval.this);
151
                                }
152
                        });
153
                }
154
                return jButton;
155
        }
156

    
157
        /**
158
         * This method initializes jPanel        
159
         *         
160
         * @return javax.swing.JPanel        
161
         */    
162
        private JPanel getJPanel() {
163
                if (jPanel == null) {
164
                        jPanel = new JPanel();
165
                        jPanel.setPreferredSize(new java.awt.Dimension(140,36));
166
                        jPanel.add(getJButton(), null);
167
                }
168
                return jPanel;
169
        }
170

    
171
        /**
172
         * This method initializes jPanel1        
173
         *         
174
         * @return javax.swing.JPanel        
175
         */    
176
        private JPanel getJPanel1() {
177
                if (jPanel1 == null) {
178
                        jLabel = new JLabel();
179
                        jLabel.setText("Valor minimo");
180
                        jPanel1 = new JPanel();
181
                        jPanel1.add(jLabel, null);
182
                        jPanel1.add(getM_txtMin1(), null);
183
                        
184
                }
185
                return jPanel1;
186
        }
187

    
188
        /**
189
         * This method initializes jTextField        
190
         *         
191
         * @return javax.swing.JTextField        
192
         */    
193
        private JTextField getM_txtMin1() {
194
                if (m_txtMin1 == null) {
195
                        m_txtMin1 = new JTextField();
196
                        m_txtMin1.setPreferredSize(new java.awt.Dimension(100,20));
197
                }
198
                return m_txtMin1;
199
        }
200

    
201
        /**
202
         * This method initializes jPanel2        
203
         *         
204
         * @return javax.swing.JPanel        
205
         */    
206
        private JPanel getJPanel2() {
207
                if (jPanel2 == null) {
208
                        jLabel1 = new JLabel();
209
                        jLabel1.setText("Valor maximo");
210
                        jPanel2 = new JPanel();
211
                        jPanel2.add(jLabel1, null);
212
                        jPanel2.add(getM_txtMax1(), null);
213
                        
214
                }
215
                return jPanel2;
216
        }
217

    
218
        /**
219
         * This method initializes jTextField        
220
         *         
221
         * @return javax.swing.JTextField        
222
         */    
223
        private JTextField getM_txtMax1() {
224
                if (m_txtMax1 == null) {
225
                        m_txtMax1 = new JTextField();
226
                        m_txtMax1.setPreferredSize(new java.awt.Dimension(100,20));
227
                }
228
                return m_txtMax1;
229
        }
230
}  //  @jve:decl-index=0:visual-constraint="10,10"