Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / thememanager / legendmanager / panels / edition / PanelEditInterval.java @ 5503

History | View | Annotate | Download (5.92 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 com.iver.cit.gvsig.fmap.rendering.IInterval;
60

    
61
import javax.swing.JButton;
62

    
63

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

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

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

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

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

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

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

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

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

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