Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / propertiespanel / TestPropertiesPanel_JPanel.java @ 40561

History | View | Annotate | Download (3.61 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
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
25
*
26
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
27
*
28
* This program is free software; you can redistribute it and/or
29
* modify it under the terms of the GNU General Public License
30
* as published by the Free Software Foundation; either version 2
31
* of the License, or (at your option) any later version.
32
*
33
* This program is distributed in the hope that it will be useful,
34
* but WITHOUT ANY WARRANTY; without even the implied warranty of
35
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
36
* GNU General Public License for more details.
37
*
38
* You should have received a copy of the GNU General Public License
39
* along with this program; if not, write to the Free Software
40
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
41
*/
42
package org.gvsig.gui.beans.propertiespanel;
43

    
44
import java.util.ArrayList;
45
import java.util.EventObject;
46

    
47
import org.gvsig.gui.beans.TestUI;
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
import org.gvsig.gui.beans.propertiespanel.ui.TestSlider;
52
/**
53
 * Test para comprobar que se puede integrar un JPanelProperty dentro del
54
 * PropertiesComponent
55
 *
56
 * @version 06/06/2007
57
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
58
 */
59
public class TestPropertiesPanel_JPanel implements ButtonsPanelListener, PropertiesComponentListener {
60
        private TestUI          jFrame = null;
61
        private PropertiesPanel pd     = null;
62

    
63
        public TestPropertiesPanel_JPanel() {
64
                initialize();
65
        }
66

    
67
        public void initialize() {
68
                jFrame = new TestUI("TestPropertiesPanel_JPanel");
69
                pd = new PropertiesPanel();
70

    
71
                pd.addButtonPressedListener(this);
72
                TestSlider ts = new TestSlider();
73
                pd.addValue("Protocolo", "protocolo", "", null);
74
                pd.addValue("Integer", "var1", new Integer(50), null);
75
                pd.addValue("Mi panel", "mipanel", ts, null);
76

    
77
                jFrame.getContentPane().add(pd);
78
                pd.addStateChangedListener(this);
79
                jFrame.pack();
80
                jFrame.setVisible(true);
81
        }
82

    
83
        public static void main(String[] args) {
84
                new TestPropertiesPanel_JPanel();
85
        }
86

    
87
        public void actionButtonPressed(ButtonsPanelEvent e) {
88
                if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
89
                        ArrayList values = pd.getValues();
90
                        System.out.println("-----");
91
                        for (int i = 0; i < values.size(); i++) {
92
                                System.out.println(((PropertyStruct)values.get(i)).getKey()
93
                                        + ": '" + ((PropertyStruct)values.get(i)).getOldValue().toString()
94
                                        + "', '" + ((PropertyStruct)values.get(i)).getNewValue() + "'");
95
                        }
96
                }
97
        }
98

    
99
        public void actionChangeProperties(EventObject e) {
100
                System.out.println("Ha cambiado");
101
        }
102
}