Revision 38348

View differences:

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

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.2  2007-08-21 09:58:04  bsanchez
47
* - Quitados imports innecesarios
48
* - Quitado codigo no usado
49
* - Cambio de deprecated show por setVisible(true)
50
*
51
* Revision 1.1  2007/08/20 08:34:46  evercher
52
* He fusionado LibUI con LibUIComponents
53
*
54
* Revision 1.1  2006/09/27 13:34:57  jaume
55
* *** empty log message ***
56
*
57
*
58
*/
59
package controls.dnd;
60

  
61
import java.awt.Dimension;
62

  
63
import javax.swing.JFrame;
64
import javax.swing.JPanel;
65

  
66
import org.gvsig.gui.beans.TestUI;
67
import org.gvsig.gui.beans.controls.dnd.JDnDList;
68
import org.gvsig.gui.beans.controls.dnd.JDnDListModel;
69
import org.gvsig.gui.beans.controls.dnd.JDnDTable;
70
import org.gvsig.gui.beans.controls.dnd.JDnDTableModel;
71
/**
72
 * El model que ha de suportar les funcions d'una JDnDTable. Encara est? en
73
 * proves.
74
 *
75
 * @author jaume
76
 */
77
public class JDnDTableTest {
78
	static String[] colNames = new String[] {"1234", "abcd", "qwerty"};
79
	static String[][] values = new String[][] {new String[] {"a1", "a2", "a3"},
80
										new String[] {"b1", "b2", "b3"},
81
										new String[] {"c1", "c2", "c3"}};
82

  
83
	public static void main(String args[]) {
84
		JFrame f = new TestUI("JDnDTableTest");
85
		JPanel content = new JPanel();
86
		content.setPreferredSize(new Dimension(500,400));
87

  
88
		JDnDTableModel model = new JDnDTableModel(values, colNames);
89
		JDnDListModel listModel = new JDnDListModel();
90
		listModel.addElement("a");
91
		listModel.addElement("b");
92
		listModel.addElement("c");
93

  
94
		JDnDTable tbl = new JDnDTable();
95

  
96
		tbl.setModel(model);
97
		tbl.setSize(new Dimension(450, 350));
98
		JDnDList list = new JDnDList();
99
		list.setModel(listModel);
100
		content.add(tbl);
101
		content.add(list);
102
		f.setContentPane(content);
103
		f.pack();
104
		f.setVisible(true);
105
	}
106
}
0 107

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/buttonbar/TestButtonBar.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.buttonbar;
20

  
21
import org.gvsig.gui.beans.TestUI;
22

  
23
public class TestButtonBar {
24
	private TestUI frame = new TestUI("TestButtonBar");
25

  
26
	public TestButtonBar() {
27
		ButtonBarContainer cont = new ButtonBarContainer();
28
		frame.setSize(410, 45);
29
		cont.setButtonAlignment("right");
30
		cont.addButton("down.png", "hola",0);
31
		cont.addButton(null, "que",1);
32
		cont.addButton(null, "tal",2);
33
		cont.addButton(null, "estas?",3);
34
		cont.addButton(null, "adios", 4);
35
		cont.getButton(2).setEnabled(false);
36
		cont.disableAllControls();
37
		cont.restoreControlsValue();
38
		cont.setComponentBorder(true);
39
		cont.delButton(3);
40
		frame.getContentPane().add(cont);
41
		frame.setVisible(true);
42
	}
43

  
44
	public static void main(String[] args){
45
		new TestButtonBar();
46
	}
47
}
0 48

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/openfile/TestOpenFile.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.openfile;
20

  
21
import javax.swing.JFrame;
22

  
23
public class TestOpenFile {
24
	private int               w     = 510;
25
	private int               h     = 90;
26
	private JFrame            frame = new JFrame();
27
	private OpenFileContainer open  = null;
28

  
29
	public TestOpenFile() {
30
		open = new OpenFileContainer();
31
		open.setComponentSize(w, h);
32
		frame.getContentPane().add(open);
33
		frame.setSize(w, h);
34
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
35
		frame.setVisible(true);
36
	}
37

  
38
	public static void main(String[] args) {
39
		new TestOpenFile();
40
	}
41
}
0 42

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/filterPanel/filterQueryPanel/TestFilterQueryJPanel.java
1
package org.gvsig.gui.beans.filterPanel.filterQueryPanel;
2

  
3
import javax.swing.JFrame;
4

  
5
import org.gvsig.gui.beans.Messages;
6

  
7

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

  
49
/**
50
 * Tests FilterQueryJPanel
51
 * 
52
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
53
 */
54
public class TestFilterQueryJPanel {
55
	public static void main(String[] args) {
56
		JFrame frame = new JFrame();
57
		
58
		FilterQueryJPanel fQ = new FilterQueryJPanel();
59
	    frame.setSize(fQ.getPreferredSize());
60
		frame.getContentPane().add(fQ);
61
		frame.setTitle(Messages.getText("test_TableFilterQueryJPanel_title"));
62
		frame.pack();
63
		frame.setVisible(true);
64
	}
65
}
0 66

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/filterPanel/filterQueryPanel/Test2FilterQueryJPanel.java
1
package org.gvsig.gui.beans.filterPanel.filterQueryPanel;
2

  
3
import javax.swing.JFrame;
4

  
5
import org.gvsig.gui.beans.Messages;
6

  
7

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

  
49
/**
50
 * Tests FilterQueryJPanel
51
 * 
52
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
53
 */
54
public class Test2FilterQueryJPanel {
55
	public static void main(String[] args) {
56
		FilterQueryJPanel filterQueryJPanel = new FilterQueryJPanel();
57
		filterQueryJPanel.resizeHeight(427);
58
		
59
		JFrame frame = new JFrame();
60

  
61
		FilterQueryJPanel fQ = new FilterQueryJPanel();
62
	    frame.setSize(fQ.getPreferredSize());
63
		frame.getContentPane().add(fQ);
64
		frame.setTitle(Messages.getText("test_TableFilterQueryJPanel_title"));
65
		frame.pack();
66
		frame.setVisible(true);
67
	}
68
}
0 69

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/filterPanel/filterQueryPanel/Test3FilterQueryJPanel.java
1
package org.gvsig.gui.beans.filterPanel.filterQueryPanel;
2

  
3
import javax.swing.JFrame;
4

  
5
import org.gvsig.gui.beans.Messages;
6

  
7

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

  
49
/**
50
 * Tests FilterQueryJPanel
51
 * 
52
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
53
 */
54
public class Test3FilterQueryJPanel {
55
	public static void main(String[] args) {
56
		FilterQueryJPanel filterQueryJPanel = new FilterQueryJPanel();
57
		filterQueryJPanel.resize(460, 450);
58
		
59
		JFrame frame = new JFrame();
60

  
61
		FilterQueryJPanel fQ = new FilterQueryJPanel();
62
	    frame.setSize(fQ.getPreferredSize());
63
		frame.getContentPane().add(fQ);
64
		frame.setTitle(Messages.getText("test_TableFilterQueryJPanel_title"));
65
		frame.pack();
66
		frame.setVisible(true);
67
	}
68
}
0 69

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/filterPanel/tableFilterQueryPanel/TestTableFilterQueryJPanel.java
1
package org.gvsig.gui.beans.filterPanel.tableFilterQueryPanel;
2

  
3
import javax.swing.JFrame;
4

  
5
import org.gvsig.gui.beans.Messages;
6

  
7

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

  
49
/**
50
 * Tests TableFilterQueryJPanel
51
 * 
52
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
53
 */
54
public class TestTableFilterQueryJPanel {
55
	public static void main(String[] args) {
56
		JFrame frame = new JFrame();
57
		TableFilterQueryJPanel tFQ = new TableFilterQueryJPanel();
58
	    frame.setSize(tFQ.getPreferredSize());
59
		frame.getContentPane().add(tFQ);
60

  
61
		frame.setTitle(Messages.getText("test_TableFilterQueryJPanel_title"));
62
		frame.pack();
63
		frame.setVisible(true);
64
	}
65
}
0 66

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/filterPanel/tableFilterQueryPanel/Test2TableFilterQueryJPanel.java
1
package org.gvsig.gui.beans.filterPanel.tableFilterQueryPanel;
2

  
3
import javax.swing.JFrame;
4

  
5
import org.gvsig.gui.beans.Messages;
6

  
7

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

  
49
/**
50
 * Tests TableFilterQueryJPanel
51
 * 
52
 * @author Pablo Piqueras Bartolom? (p_queras@hotmail.com)
53
 */
54
public class Test2TableFilterQueryJPanel {
55
	public static void main(String[] args) {
56
		JFrame frame = new JFrame();
57
		TableFilterQueryJPanel tableFilterQueryJPanel = new TableFilterQueryJPanel();
58
		tableFilterQueryJPanel.resize(460, 300);
59

  
60
	    frame.setSize(tableFilterQueryJPanel.getPreferredSize());	    
61
		frame.getContentPane().add(tableFilterQueryJPanel);		
62

  
63
		frame.setTitle(Messages.getText("test_TableFilterQueryJPanel_title"));
64
		frame.pack();
65
		frame.setVisible(true);
66
	}
67
}
0 68

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboscale/TestComboScale.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.comboscale;
20

  
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
import java.awt.event.ActionListener;
24

  
25
import javax.swing.JButton;
26
import javax.swing.JPanel;
27

  
28
import org.gvsig.gui.beans.TestUI;
29
import org.gvsig.gui.beans.controls.comboscale.ComboScale;
30

  
31
public class TestComboScale {
32
	private ComboScale cs;
33

  
34
	public TestComboScale() {
35
		TestUI frame = new TestUI("TestComboScale");
36
		cs = new ComboScale();
37
		long[] scale = new long[5];
38
		scale[0] = 100;
39
		scale[1] = 500;
40
		scale[2] = 1000;
41
		scale[3] = 5000;
42
		scale[4] = 10000;
43
		cs.setItems(scale);
44
		cs.setScale(400);
45
		JButton btn = new JButton("Reset");
46
		btn.setPreferredSize(new Dimension(100, 50));
47
		btn.addActionListener(new ActionListener() {
48
			public void actionPerformed(java.awt.event.ActionEvent e) {
49
				cs.setScale(500);
50
			}
51
		});
52

  
53
		JPanel panel = new JPanel();
54
		frame.setContentPane(panel);
55
		panel.setLayout(new BorderLayout());
56
		panel.add(cs, BorderLayout.CENTER);
57
		panel.add(btn, BorderLayout.EAST);
58

  
59
		frame.setSize(280, 80);
60
		frame.setVisible(true);
61

  
62
		cs.addActionListener(new java.awt.event.ActionListener() {
63
			public void actionPerformed(java.awt.event.ActionEvent e) {
64
				System.out.println("ActionListener: " + e.getActionCommand());
65
			}
66
		});
67
	}
68

  
69
	public static void main(String[] args) {
70
		new TestComboScale();
71
	}
72
}
0 73

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/colorbutton/TestColorButton.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19
package org.gvsig.gui.beans.colorbutton;
20

  
21
import java.awt.Dimension;
22

  
23
import javax.swing.JPanel;
24

  
25
import org.gvsig.gui.beans.TestUI;
26
/**
27
* Test del ColorButton
28
*
29
* @version 08/05/2007
30
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
31
*/
32
public class TestColorButton implements ColorButtonListener {
33
	private TestUI       jFrame       = null;
34
	private ColorButton colorButton = null;
35

  
36
	public TestColorButton() {
37
		initialize();
38
	}
39

  
40
	private void initialize() {
41
		colorButton = new ColorButton();
42
		colorButton.setEnabled(true);
43
		colorButton.addValueChangedListener(this);
44
		jFrame = new TestUI("TestColorButton");
45
		JPanel jpanel = new JPanel();
46
		jpanel.add(colorButton);
47
		jFrame.setSize(new Dimension(598, 167));
48
		jFrame.setContentPane(jpanel);
49
		jFrame.pack();
50
		jFrame.setVisible(true);
51
	}
52

  
53
	/**
54
	 * @param args
55
	 */
56
	public static void main(String[] args) {
57
		new TestColorButton();
58
	}
59

  
60
	public void actionValueChanged(ColorButtonEvent e) {
61
		System.out.println("actionValueChanged");
62
	}
63

  
64
	public void actionValueDragged(ColorButtonEvent e) {
65
		System.out.println("actionValueDragged");
66
	}
67
}
0 68

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/propertiespanel/TestPropertiesPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19
package org.gvsig.gui.beans.propertiespanel;
20

  
21
import java.awt.Toolkit;
22
import java.util.ArrayList;
23
import java.util.EventObject;
24

  
25
import org.gvsig.gui.beans.TestUI;
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
28
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
29

  
30
public class TestPropertiesPanel implements ButtonsPanelListener, PropertiesComponentListener {
31
	TestUI frame = null;
32
	PropertiesPanel pd = null;
33

  
34
	public TestPropertiesPanel() {
35
		initialize();
36
	}
37

  
38
	public void initialize() {
39
		Toolkit.getDefaultToolkit().setDynamicLayout(true);
40
		frame = new TestUI("TestPropertiesPanel");
41
		pd = new PropertiesPanel();
42

  
43
		pd.addButtonPressedListener(this);
44
		pd.addValue("Protocolo", "protocolo", "", null);
45
		pd.addValue("Integer", "var1", new Integer(50), null);
46
		{
47
			Object[] types = {new Integer(PropertiesComponent.TYPE_SLIDER), new Integer(-255), new Integer(255)};
48
			pd.addValue("Slider", "slider1", new Integer(25), types); // Slider
49
			Object[] types2 = {new Integer(PropertiesComponent.TYPE_SLIDER), new Integer(0), new Integer(50)};
50
			pd.addValue("Slider", "slider2", new Integer(25), types2); // Slider
51
			Object[] types3 = {new Integer(PropertiesComponent.TYPE_SLIDER), new Integer(0), new Integer(100)};
52
			pd.addValue("Slider", "slider3", new Double(25), types3); // Slider
53
		}
54
		pd.addValue("Activo", "check1", new Boolean(true), null); // Slider
55
		{
56
			ArrayList lista = new ArrayList();
57
			lista.add("Primer elemento");
58
			lista.add("Segundo elemento");
59
			lista.add("Tercer elemento");
60
			PropertyStruct property = new PropertyStruct();
61
			property.setTextLabel("Combo");
62
			property.setKey("combo1");
63
			property.setOldValue(new Integer(1));
64
			Object[] types = {new Integer(PropertiesComponent.TYPE_COMBO), lista};
65
			property.setExtras(types);
66
			pd.addPropertyStruct(property);
67
		}
68
		frame.getContentPane().add(pd);
69
		frame.pack();
70
		pd.addStateChangedListener(this);
71
		frame.setVisible(true);
72
	}
73

  
74
	public static void main(String[] args) {
75
		new TestPropertiesPanel();
76
	}
77

  
78
	public void actionButtonPressed(ButtonsPanelEvent e) {
79
		if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
80
			ArrayList values = pd.getValues();
81
			System.out.println("-----");
82
			for (int i=0; i<values.size(); i++) {
83
				System.out.println(((PropertyStruct)values.get(i)).getKey()
84
						+ ": '" + ((PropertyStruct)values.get(i)).getOldValue().toString()
85
						+ "', '" + ((PropertyStruct)values.get(i)).getNewValue().toString() + "'");
86
				System.out.println(pd.getComponentUI(((PropertyStruct)values.get(i)).getKey()).toString());
87
			}
88
		}
89
	}
90

  
91
	public void actionChangeProperties(EventObject e) {
92
		System.out.println("Ha cambiado");
93
		System.out.println(pd.getProperties().get("slider3"));
94
	}
95
}
0 96

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/propertiespanel/ui/TestSlider.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19
package org.gvsig.gui.beans.propertiespanel.ui;
20

  
21
import java.awt.BorderLayout;
22
import java.awt.event.ActionEvent;
23
import java.awt.event.ActionListener;
24

  
25
import javax.swing.JButton;
26
import javax.swing.JColorChooser;
27
import javax.swing.event.ChangeEvent;
28
import javax.swing.event.ChangeListener;
29

  
30
import org.gvsig.gui.beans.propertiespanel.JPanelProperty;
31
/**
32
 * Panel que ira dentro del panel de propiedades
33
 *
34
 * @version 06/06/2007
35
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
36
 */
37
public class TestSlider extends JPanelProperty implements ChangeListener, ActionListener {
38
	private static final long serialVersionUID = -4936433530376831937L;
39

  
40
	public TestSlider() {
41
		initialize();
42
	}
43

  
44
	private void initialize() {
45
		setLayout(new BorderLayout());
46
		JColorChooser color = new JColorChooser();
47
		add(color, BorderLayout.CENTER);
48
		JButton boton = new JButton("OK");
49
		add(boton, BorderLayout.SOUTH);
50
		boton.addActionListener(this);
51
		color.getSelectionModel().addChangeListener(this);
52
	}
53

  
54
	public void stateChanged(ChangeEvent e) {
55
		this.callStateChanged();
56
	}
57

  
58
	public void actionPerformed(ActionEvent e) {
59
		this.callStateChanged();
60
	}
61
}
0 62

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/propertiespanel/TestPropertiesPanel2.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19
package org.gvsig.gui.beans.propertiespanel;
20

  
21
import java.util.ArrayList;
22
import java.util.EventObject;
23

  
24
import org.gvsig.gui.beans.TestUI;
25
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
28

  
29
public class TestPropertiesPanel2 implements ButtonsPanelListener, PropertiesComponentListener {
30
	TestUI frame = null;
31
	PropertiesPanel pd = null;
32

  
33
	public TestPropertiesPanel2() {
34
		initialize();
35
	}
36

  
37
	public void initialize() {
38
		frame = new TestUI("TestPropertiesPanel2");
39
		pd = new PropertiesPanel();
40

  
41
		pd.addButtonPressedListener(this);
42
		pd.addValue("Protocolo", "protocolo", "", null);
43
		pd.addValue("Integer", "var1", new Integer(50), null);
44
		{
45
			Object[] types = {new Integer(PropertiesComponent.TYPE_SLIDER), new Integer(-255), new Integer(255)};
46
			pd.addValue("Slider", "slider1", new Integer(25), types); // Slider
47
			Object[] types2 = {new Integer(PropertiesComponent.TYPE_SLIDER), new Integer(0), new Integer(50)};
48
			pd.addValue("Slider", "slider2", new Integer(25), types2); // Slider
49
			Object[] types3 = {new Integer(PropertiesComponent.TYPE_SLIDER), new Integer(0), new Integer(100)};
50
			pd.addValue("Slider", "slider3", new Integer(25), types3); // Slider
51
		}
52
		pd.addValue("Activo", "check1", new Boolean(true), null); // Slider
53
		{
54
			ArrayList lista = new ArrayList();
55
			lista.add("Primer elemento");
56
			lista.add("Segundo elemento");
57
			lista.add("Tercer elemento");
58
			PropertyStruct property = new PropertyStruct();
59
			property.setTextLabel("Combo");
60
			property.setKey("combo1");
61
			property.setOldValue(new Integer(1));
62
			Object[] types = {new Integer(PropertiesComponent.TYPE_COMBO), lista};
63
			property.setExtras(types);
64
			pd.addPropertyStruct(property);
65

  
66
			pd = new PropertiesPanel(pd.getProperties());
67
		}
68
		frame.getContentPane().add(pd);
69
		frame.pack();
70
		pd.addStateChangedListener(this);
71
		frame.setVisible(true);
72
	}
73

  
74
	public static void main(String[] args) {
75
		new TestPropertiesPanel2();
76
	}
77

  
78
	public void actionButtonPressed(ButtonsPanelEvent e) {
79
		if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
80
			ArrayList values = pd.getValues();
81
			System.out.println("-----");
82
			for (int i=0; i<values.size(); i++) {
83
				System.out.println(((PropertyStruct)values.get(i)).getKey()
84
						+ ": '" + ((PropertyStruct)values.get(i)).getOldValue().toString()
85
						+ "', '" + ((PropertyStruct)values.get(i)).getNewValue().toString() + "'");
86
			}
87
		}
88
	}
89

  
90
	public void actionChangeProperties(EventObject e) {
91
		System.out.println("Ha cambiado");
92
	}
93
}
0 94

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/propertiespanel/TestPropertiesPanel_JPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*/
19
package org.gvsig.gui.beans.propertiespanel;
20

  
21
import java.util.ArrayList;
22
import java.util.EventObject;
23

  
24
import org.gvsig.gui.beans.TestUI;
25
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
28
import org.gvsig.gui.beans.propertiespanel.ui.TestSlider;
29
/**
30
 * Test para comprobar que se puede integrar un JPanelProperty dentro del
31
 * PropertiesComponent
32
 *
33
 * @version 06/06/2007
34
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
35
 */
36
public class TestPropertiesPanel_JPanel implements ButtonsPanelListener, PropertiesComponentListener {
37
	private TestUI          jFrame = null;
38
	private PropertiesPanel pd     = null;
39

  
40
	public TestPropertiesPanel_JPanel() {
41
		initialize();
42
	}
43

  
44
	public void initialize() {
45
		jFrame = new TestUI("TestPropertiesPanel_JPanel");
46
		pd = new PropertiesPanel();
47

  
48
		pd.addButtonPressedListener(this);
49
		TestSlider ts = new TestSlider();
50
		pd.addValue("Protocolo", "protocolo", "", null);
51
		pd.addValue("Integer", "var1", new Integer(50), null);
52
		pd.addValue("Mi panel", "mipanel", ts, null);
53

  
54
		jFrame.getContentPane().add(pd);
55
		pd.addStateChangedListener(this);
56
		jFrame.pack();
57
		jFrame.setVisible(true);
58
	}
59

  
60
	public static void main(String[] args) {
61
		new TestPropertiesPanel_JPanel();
62
	}
63

  
64
	public void actionButtonPressed(ButtonsPanelEvent e) {
65
		if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
66
			ArrayList values = pd.getValues();
67
			System.out.println("-----");
68
			for (int i = 0; i < values.size(); i++) {
69
				System.out.println(((PropertyStruct)values.get(i)).getKey()
70
					+ ": '" + ((PropertyStruct)values.get(i)).getOldValue().toString()
71
					+ "', '" + ((PropertyStruct)values.get(i)).getNewValue() + "'");
72
			}
73
		}
74
	}
75

  
76
	public void actionChangeProperties(EventObject e) {
77
		System.out.println("Ha cambiado");
78
	}
79
}
0 80

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/buttonspanel/TestButtonsPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.buttonspanel;
20

  
21
import java.awt.FlowLayout;
22

  
23
import org.gvsig.gui.beans.TestUI;
24
/**
25
 * <code>TestButtonsPanel</code> es un test para comprobar el funcionamiento de
26
 * la clase <code>ButtonsPanel</code>.
27
 *
28
 * @version 15/03/2007
29
 * @author BorSanZa - Borja Sanchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class TestButtonsPanel implements ButtonsPanelListener {
32
	private TestUI frame = new TestUI("TestButtonsPanel");
33

  
34
	public TestButtonsPanel(){
35
		frame.getContentPane().setLayout(new java.awt.GridLayout(0, 1));
36

  
37
		frame.setSize(320, 320);
38
		ButtonsPanel bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPT);
39
		bp.addButtonPressedListener(this);
40
		frame.getContentPane().add(bp);
41
		bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCEL);
42
		bp.addButtonPressedListener(this);
43
		bp.setLayout(new java.awt.FlowLayout(FlowLayout.CENTER));
44
		frame.getContentPane().add(bp);
45
		bp = new ButtonsPanel(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
46
		bp.setLayout(new java.awt.FlowLayout(FlowLayout.LEFT));
47
		bp.addButtonPressedListener(this);
48
		frame.getContentPane().add(bp);
49
		bp = new ButtonsPanel(ButtonsPanel.BUTTONS_YESNO);
50
		bp.addButtonPressedListener(this);
51

  
52
		bp.getButton(ButtonsPanel.BUTTONS_YESNO).setEnabled(false);
53

  
54
		frame.getContentPane().add(bp);
55
		bp = new ButtonsPanel(ButtonsPanel.BUTTONS_CLOSE);
56
		bp.addButtonPressedListener(this);
57
		frame.getContentPane().add(bp);
58
		bp = new ButtonsPanel(ButtonsPanel.BUTTONS_EXIT);
59
		bp.addButtonPressedListener(this);
60
		bp.addButton("1", 55);
61
		bp.addButton("bp.addButtonPressedListener(this);", 56);
62

  
63
//		bp.getButton(ButtonsPanel.BUTTON_ACCEPT).isEnabled();
64

  
65
		frame.getContentPane().add(bp);
66
		frame.setVisible(true);
67
	}
68

  
69
	public static void main(String[] args){
70
		new TestButtonsPanel();
71
	}
72

  
73
	public void actionButtonPressed(ButtonsPanelEvent e) {
74
		System.out.println(e.getButton());
75
		if (ButtonsPanel.BUTTON_EXIT == e.getButton()) {
76
			frame.dispose();
77
		}
78
	}
79
}
0 80

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/textincreaser/TestTextIncreaser.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.textincreaser;
20

  
21
import javax.swing.JFrame;
22

  
23
public class TestTextIncreaser {
24
	private int                    w     = 200;
25
	private int                    h     = 200;
26
	private JFrame                 frame = new JFrame();
27
	private TextIncreaserContainer tic1;
28

  
29
	public TestTextIncreaser() {
30
		tic1 = new TextIncreaserContainer(70, 0, 10, 0, true);
31

  
32
		frame.getContentPane().add(tic1);
33
		frame.setSize(w, h);
34
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
35
		frame.setVisible(true);
36
	}
37

  
38
	public static void main(String[] args) {
39
		new TestTextIncreaser();
40
	}
41
}
0 42

  
tags/v2_0_0_Build_2047/libraries/libUIComponent/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboboxconfigurablelookup/programmertests/TestJComboBoxConfigurableLookUp.java
1
package org.gvsig.gui.beans.comboboxconfigurablelookup.programmertests;
2

  
3
import java.awt.Dimension;
4

  
5
import javax.swing.JFrame;
6
import javax.swing.JOptionPane;
7

  
8
import org.gvsig.gui.beans.Messages;
9
import org.gvsig.gui.beans.comboboxconfigurablelookup.DefaultComboBoxConfigurableLookUpModel;
10
import org.gvsig.gui.beans.comboboxconfigurablelookup.JComboBoxConfigurableLookUp;
11

  
12

  
13

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

  
55
/**
56
 * <p>Tests the class {@link JComboBoxConfigurableLookUp JComboBoxConfigurableLookUp} .</p>
57
 * 
58
 * <p>Notes:
59
 *  <ul>
60
 *   <li>MORE TESTS COULD BE ADDED!!!</li>
61
 *   <li>DON'T REMOVE TEST COMMENTED!!!</li>
62
 *  </ul>
63
 * </p>
64
 *
65
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
66
 * @version 07/02/2008
67
 */
68
public class TestJComboBoxConfigurableLookUp extends JFrame {
69
	private static final long serialVersionUID = -422198204525608333L;
70

  
71
	/**
72
	 * Test method for the <code>TestJComboBoxConfigurableLookUp</code>
73
	 * 
74
	 * @param args
75
	 */
76
	public static void main(String[] args)
77
	{
78
		int width = 300;
79
		int height = 60;
80
		
81
		try
82
		{
83
			// Objects creation
84
			JFrame jF = new JFrame();
85
	
86
			// Create a TestJComboBoxConfigurableLookUp, sets the behavior configuration and add Items
87
			
88
			// ---- TESTS ----
89
			// Test the default behavior
90
			JComboBoxConfigurableLookUp jCBSD = new JComboBoxConfigurableLookUp();
91

  
92
			// -- TESTS FLAGS FOR CONTROL --
93
			// Test the change of the flag 'onlyOneColor'
94
			// jCBSD.setOnlyOneColorOnText(true);
95
			// jCBSD.setOnlyOneColorOnText(false);
96
			
97
			// Test the change of the flag 'beepEnabled'
98
			// jCBSD.setBeepEnabled(false);
99
			// jCBSD.setBeepEnabled(true);
100

  
101
			// Test the change of the flag 'hidePopupIfThereAreNoItems'
102
			// jCBSD.setHidePopupIfThereAreNoItems(false);
103
			// jCBSD.setHidePopupIfThereAreNoItems(true);
104
			
105
			// Test the change of the flag 'toForceSelectAnItem'
106
			// jCBSD.setToForceSelectAnItem(false);
107
			// jCBSD.setToForceSelectAnItem(true);
108
			
109

  
110
			// --- TESTS ADDING A MODEL ---
111
			// -- TESTS FLAGS FOR THE MODEL --
112
			// DefaultComboBoxConfigurableLookUpModel model = new DefaultComboBoxConfigurableLookUpModel();
113
			DefaultComboBoxConfigurableLookUpModel model = new DefaultComboBoxConfigurableLookUpModel(new Object[] {"Item1", "Item2", "Item3", "Item4", "Item5"});
114
			// DefaultComboBoxConfigurableLookUpModel model = (DefaultComboBoxConfigurableLookUpModel) jCBSD.getModel();
115
				
116
			// Test the change of the flag 'itemsShownInListBox'
117
			// model.setLanguageRules("en_US");
118
			// model.setLanguageRules("fr_FR");
119
			// model.setLanguageRules("es_ES");
120
			// model.setLanguageRules(DefaultComboBoxConfigurableLookUpModel.DEFAULT_LANGUAGE_RULES_CONFIGURATION);
121
				
122
			// Test the change of the flag 'caseSensitive'
123
			// model.setCaseSensitive(false);
124
			// model.setCaseSensitive(DefaultComboBoxConfigurableLookUpModel.CASE_INSENSITIVE);
125
			// model.setCaseSensitive(true);
126
			// model.setCaseSensitive(DefaultComboBoxConfigurableLookUpModel.CASE_SENSITIVE);
127
			 
128
			// Test the change of the flag 'itemsOrder'
129
			// model.setItemsOrder(DefaultComboBoxConfigurableLookUpModel.MAINTAIN_POSITION);
130
			// model.setItemsOrder(DefaultComboBoxConfigurableLookUpModel.ALPHABETICAL_ORDERED);
131
			// model.setItemsOrder(DefaultComboBoxConfigurableLookUpModel.MAINTAIN_AGENT_POSITIONS);
132
			
133
			// Test the change of the flag 'itemsShownInListBox'
134
			// model.setShowAllItemsInListBox(DefaultComboBoxConfigurableLookUpModel.SHOW_ALL_ITEMS);
135
			// model.setShowAllItemsInListBox(true);
136
			// model.setShowAllItemsInListBox(DefaultComboBoxConfigurableLookUpModel.SHOW_ONLY_MATCHES);
137
			// model.setShowAllItemsInListBox(false);
138

  
139
			// Test the change of the flag 'completeArrowKeySelection'
140
			// jCBSD.setCompleteArrowKeySelection(true);
141
			// jCBSD.setCompleteArrowKeySelection(false);
142

  
143
			// Test the change of the flag 'displayAllItemsWithArrowButton'
144
			// jCBSD.setDisplayAllItemsWithArrowButton(false);
145
			 jCBSD.setDisplayAllItemsWithArrowButton(true);
146

  
147
			// Adds the new model
148
			jCBSD.setModel(model);
149

  
150
			// --- ADD ITEMS TO THE COMPONENT AND OTHER TESTS ---
151
			// Add some items to test if has too much delay with an average number of items
152
			jCBSD.addItem("extAddEventTheme");
153
			jCBSD.addItem("?and?");
154
			jCBSD.addItem("_fwAndami");
155
			jCBSD.addItem("extJDBC");
156

  
157
			jCBSD.addItem("extCAD");
158
			jCBSD.addItem("libuiDownCase");
159
			jCBSD.addItem("appgvSig");
160
			// jCBSD.setSelectedItem("appgvSig");
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff