Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / view / legend / edition / gui / PanelEditInterval.java @ 40558

History | View | Annotate | Download (6.9 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
/*
25
 * Created on 24-may-2004
26
 *
27
 * To change the template for this generated file go to
28
 * Window>Preferences>Java>Code Generation>Code and Comments
29
 */
30
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
31
 *
32
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
33
 *
34
 * This program is free software; you can redistribute it and/or
35
 * modify it under the terms of the GNU General Public License
36
 * as published by the Free Software Foundation; either version 2
37
 * of the License, or (at your option) any later version.
38
 *
39
 * This program is distributed in the hope that it will be useful,
40
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
42
 * GNU General Public License for more details.
43
 *
44
 * You should have received a copy of the GNU General Public License
45
 * along with this program; if not, write to the Free Software
46
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
47
 *
48
 * For more information, contact:
49
 *
50
 *  Generalitat Valenciana
51
 *   Conselleria d'Infraestructures i Transport
52
 *   Av. Blasco Ib??ez, 50
53
 *   46010 VALENCIA
54
 *   SPAIN
55
 *
56
 *      +34 963862235
57
 *   gvsig@gva.es
58
 *      www.gvsig.gva.es
59
 *
60
 *    or
61
 *
62
 *   IVER T.I. S.A
63
 *   Salamanca 50
64
 *   46005 Valencia
65
 *   Spain
66
 *
67
 *   +34 963163400
68
 *   dac@iver.es
69
 */
70
package org.gvsig.app.project.documents.view.legend.edition.gui;
71

    
72

    
73
import javax.swing.JButton;
74
import javax.swing.JLabel;
75
import javax.swing.JOptionPane;
76
import javax.swing.JPanel;
77
import javax.swing.JTextField;
78

    
79
import org.gvsig.andami.PluginServices;
80
import org.gvsig.andami.ui.mdiManager.IWindow;
81
import org.gvsig.andami.ui.mdiManager.WindowInfo;
82
import org.gvsig.fmap.mapcontext.rendering.legend.IInterval;
83
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval;
84

    
85

    
86

    
87
/**
88
 * DOCUMENT ME!
89
 *
90
 * @author fjp To change the template for this generated type comment go to
91
 *         Window>Preferences>Java>Code Generation>Code and
92
 *         Comments
93
*/
94
public class PanelEditInterval extends JPanel implements IWindow  {
95
        private JButton jButton = null;
96
        //private FIntervalCellEditor intervaleditor;
97
        private JPanel jPanel = null;
98
        private JPanel jPanel1 = null;
99
        private JLabel jLabel = null;
100
        private JTextField m_txtMin1 = null;
101
        private JPanel jPanel2 = null;
102
        private JLabel jLabel1 = null;
103
        private JTextField m_txtMax1 = null;
104
        private boolean ok=false;
105
        /**
106
     * This is the default constructor
107
     */
108
    public PanelEditInterval() {
109
        super();
110
        initialize();
111
                //intervaleditor=ice;
112
    }
113

    
114
    /**
115
     * DOCUMENT ME!
116
     *
117
     * @param i DOCUMENT ME!
118
     */
119
    public void setFInterval(IInterval i) {
120
            ok=false;
121
                if (i instanceof FInterval){
122

    
123
                        m_txtMin1.setText(String.valueOf(((FInterval)i).getMin()));
124
                        m_txtMax1.setText(String.valueOf(((FInterval)i).getMax()));
125
                }
126
        }
127

    
128
    /**
129
     * DOCUMENT ME!
130
     *
131
     * @return DOCUMENT ME!
132
     */
133
    public FInterval getFInterval() {
134
                double from=0;
135
                double to=0;
136
                try{
137
        from = Double.parseDouble(m_txtMin1.getText());
138
        to =Double.parseDouble(m_txtMax1.getText());
139

    
140
                }catch (NumberFormatException e) {
141
                        JOptionPane.showMessageDialog(null, PluginServices.getText(this,"Formato_de_numero_erroneo")+".");
142
                }
143
                FInterval i = new FInterval(from, to);
144
        return i;
145
    }
146

    
147
    /**
148
     * This method initializes this
149
     */
150
    private void initialize() {
151
        this.setSize(316, 124);
152
                this.add(getJPanel1(), null);
153
                this.add(getJPanel2(), null);
154
                this.add(getJPanel(), null);
155

    
156

    
157
    }
158

    
159
        public WindowInfo getWindowInfo() {
160
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
161
                m_viewinfo.setTitle(PluginServices.getText(this, "Intervalo"));
162
                m_viewinfo.setWidth(this.getWidth());
163
                m_viewinfo.setHeight(this.getHeight());
164
                return m_viewinfo;
165
        }
166

    
167
        /**
168
         * This method initializes jButton
169
         *
170
         * @return javax.swing.JButton
171
         */
172
        private JButton getJButton() {
173
                if (jButton == null) {
174
                        jButton = new JButton();
175
                        jButton.setText("aceptar");
176
                        jButton.setPreferredSize(new java.awt.Dimension(90,26));
177
                        jButton.addActionListener(new java.awt.event.ActionListener() {
178
                                public void actionPerformed(java.awt.event.ActionEvent e) {
179
                                        //intervaleditor.setCurrentInterval(getFInterval());
180
                                        ok=true;
181
                                        PluginServices.getMDIManager().closeWindow(PanelEditInterval.this);
182
                                }
183
                        });
184
                }
185
                return jButton;
186
        }
187
        public boolean isOK(){
188
                return ok;
189
        }
190
        /**
191
         * This method initializes jPanel
192
         *
193
         * @return javax.swing.JPanel
194
         */
195
        private JPanel getJPanel() {
196
                if (jPanel == null) {
197
                        jPanel = new JPanel();
198
                        jPanel.setPreferredSize(new java.awt.Dimension(140,36));
199
                        jPanel.add(getJButton(), null);
200
                }
201
                return jPanel;
202
        }
203

    
204
        /**
205
         * This method initializes jPanel1
206
         *
207
         * @return javax.swing.JPanel
208
         */
209
        private JPanel getJPanel1() {
210
                if (jPanel1 == null) {
211
                        jLabel = new JLabel();
212
                        jLabel.setText("Valor minimo");
213
                        jPanel1 = new JPanel();
214
                        jPanel1.add(jLabel, null);
215
                        jPanel1.add(getM_txtMin1(), null);
216

    
217
                }
218
                return jPanel1;
219
        }
220

    
221
        /**
222
         * This method initializes jTextField
223
         *
224
         * @return javax.swing.JTextField
225
         */
226
        private JTextField getM_txtMin1() {
227
                if (m_txtMin1 == null) {
228
                        m_txtMin1 = new JTextField();
229
                        m_txtMin1.setPreferredSize(new java.awt.Dimension(100,20));
230
                }
231
                return m_txtMin1;
232
        }
233

    
234
        /**
235
         * This method initializes jPanel2
236
         *
237
         * @return javax.swing.JPanel
238
         */
239
        private JPanel getJPanel2() {
240
                if (jPanel2 == null) {
241
                        jLabel1 = new JLabel();
242
                        jLabel1.setText("Valor maximo");
243
                        jPanel2 = new JPanel();
244
                        jPanel2.add(jLabel1, null);
245
                        jPanel2.add(getM_txtMax1(), null);
246

    
247
                }
248
                return jPanel2;
249
        }
250

    
251
        /**
252
         * This method initializes jTextField
253
         *
254
         * @return javax.swing.JTextField
255
         */
256
        private JTextField getM_txtMax1() {
257
                if (m_txtMax1 == null) {
258
                        m_txtMax1 = new JTextField();
259
                        m_txtMax1.setPreferredSize(new java.awt.Dimension(100,20));
260
                }
261
                return m_txtMax1;
262
        }
263
        public Object getWindowProfile() {
264
                return WindowInfo.DIALOG_PROFILE;
265
        }
266

    
267
}  //  @jve:decl-index=0:visual-constraint="10,10"