Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / legend / edition / gui / PanelEditInterval.java @ 8767

History | View | Annotate | Download (5.93 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.project.documents.view.legend.edition.gui;
48

    
49

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

    
56
import com.iver.andami.PluginServices;
57
import com.iver.andami.ui.mdiManager.IWindow;
58
import com.iver.andami.ui.mdiManager.WindowInfo;
59
import com.iver.cit.gvsig.fmap.rendering.FInterval;
60
import com.iver.cit.gvsig.fmap.rendering.IInterval;
61

    
62

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

    
90
    /**
91
     * DOCUMENT ME!
92
     *
93
     * @param i DOCUMENT ME!
94
     */
95
    public void setFInterval(IInterval i) {
96
            ok=false;
97
                if (i instanceof FInterval){
98
                        
99
                        m_txtMin1.setText(String.valueOf(((FInterval)i).getMin()));
100
                        m_txtMax1.setText(String.valueOf(((FInterval)i).getMax()));
101
                }
102
        }
103

    
104
    /**
105
     * DOCUMENT ME!
106
     *
107
     * @return DOCUMENT ME!
108
     */
109
    public FInterval getFInterval() {
110
                double from=0;
111
                double to=0;
112
                try{
113
        from = Double.parseDouble(m_txtMin1.getText());
114
        to =Double.parseDouble(m_txtMax1.getText());
115
       
116
                }catch (NumberFormatException e) {
117
                        JOptionPane.showMessageDialog(null, PluginServices.getText(this,"Formato_de_numero_erroneo")+".");
118
                }
119
                FInterval i = new FInterval(from, to);
120
        return i;
121
    }
122

    
123
    /**
124
     * This method initializes this
125
     */
126
    private void initialize() {
127
        this.setSize(316, 124);
128
                this.add(getJPanel1(), null);
129
                this.add(getJPanel2(), null);
130
                this.add(getJPanel(), null);
131
                
132
        
133
    }
134

    
135
        public WindowInfo getWindowInfo() {
136
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
137
                m_viewinfo.setTitle(PluginServices.getText(this, "Intervalo"));
138
                m_viewinfo.setWidth(this.getWidth());
139
                m_viewinfo.setHeight(this.getHeight());
140
                return m_viewinfo;
141
        }
142

    
143
        /**
144
         * This method initializes jButton        
145
         *         
146
         * @return javax.swing.JButton        
147
         */    
148
        private JButton getJButton() {
149
                if (jButton == null) {
150
                        jButton = new JButton();
151
                        jButton.setText("aceptar");
152
                        jButton.setPreferredSize(new java.awt.Dimension(90,26));
153
                        jButton.addActionListener(new java.awt.event.ActionListener() { 
154
                                public void actionPerformed(java.awt.event.ActionEvent e) {    
155
                                        //intervaleditor.setCurrentInterval(getFInterval());
156
                                        ok=true;
157
                                        PluginServices.getMDIManager().closeWindow(PanelEditInterval.this);
158
                                }
159
                        });
160
                }
161
                return jButton;
162
        }
163
        public boolean isOK(){
164
                return ok;
165
        }
166
        /**
167
         * This method initializes jPanel        
168
         *         
169
         * @return javax.swing.JPanel        
170
         */    
171
        private JPanel getJPanel() {
172
                if (jPanel == null) {
173
                        jPanel = new JPanel();
174
                        jPanel.setPreferredSize(new java.awt.Dimension(140,36));
175
                        jPanel.add(getJButton(), null);
176
                }
177
                return jPanel;
178
        }
179

    
180
        /**
181
         * This method initializes jPanel1        
182
         *         
183
         * @return javax.swing.JPanel        
184
         */    
185
        private JPanel getJPanel1() {
186
                if (jPanel1 == null) {
187
                        jLabel = new JLabel();
188
                        jLabel.setText("Valor minimo");
189
                        jPanel1 = new JPanel();
190
                        jPanel1.add(jLabel, null);
191
                        jPanel1.add(getM_txtMin1(), null);
192
                        
193
                }
194
                return jPanel1;
195
        }
196

    
197
        /**
198
         * This method initializes jTextField        
199
         *         
200
         * @return javax.swing.JTextField        
201
         */    
202
        private JTextField getM_txtMin1() {
203
                if (m_txtMin1 == null) {
204
                        m_txtMin1 = new JTextField();
205
                        m_txtMin1.setPreferredSize(new java.awt.Dimension(100,20));
206
                }
207
                return m_txtMin1;
208
        }
209

    
210
        /**
211
         * This method initializes jPanel2        
212
         *         
213
         * @return javax.swing.JPanel        
214
         */    
215
        private JPanel getJPanel2() {
216
                if (jPanel2 == null) {
217
                        jLabel1 = new JLabel();
218
                        jLabel1.setText("Valor maximo");
219
                        jPanel2 = new JPanel();
220
                        jPanel2.add(jLabel1, null);
221
                        jPanel2.add(getM_txtMax1(), null);
222
                        
223
                }
224
                return jPanel2;
225
        }
226

    
227
        /**
228
         * This method initializes jTextField        
229
         *         
230
         * @return javax.swing.JTextField        
231
         */    
232
        private JTextField getM_txtMax1() {
233
                if (m_txtMax1 == null) {
234
                        m_txtMax1 = new JTextField();
235
                        m_txtMax1.setPreferredSize(new java.awt.Dimension(100,20));
236
                }
237
                return m_txtMax1;
238
        }
239
}  //  @jve:decl-index=0:visual-constraint="10,10"