Revision 37740
tags/v2_0_0_Build_2043/libraries/libUIComponent/.cvsignore | ||
---|---|---|
1 |
bin |
|
2 |
bin-test |
|
0 | 3 |
tags/v2_0_0_Build_2043/libraries/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_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/incrementabletask/TestThread.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.incrementabletask; |
|
2 |
|
|
3 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
4 |
* |
|
5 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
6 |
* of the Valencian Government (CIT) |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
* MA 02110-1301, USA. |
|
22 |
* |
|
23 |
*/ |
|
24 |
|
|
25 |
public class TestThread { |
|
26 |
public class miThread1 extends Thread { |
|
27 |
public void run() { |
|
28 |
System.out.println("miThread1 begin"); |
|
29 |
for (int i=0; i<=10; i++) { |
|
30 |
System.out.println(i); |
|
31 |
try { |
|
32 |
Thread.sleep(500); |
|
33 |
} catch (InterruptedException e) { |
|
34 |
e.printStackTrace(); |
|
35 |
} |
|
36 |
} |
|
37 |
System.out.println("miThread1 end"); |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
public TestThread() { |
|
42 |
System.out.println("testThread begin"); |
|
43 |
miThread1 a = new miThread1(); |
|
44 |
a.start(); |
|
45 |
while (true) { |
|
46 |
try { |
|
47 |
Thread.sleep(250); |
|
48 |
} catch (InterruptedException e) { |
|
49 |
e.printStackTrace(); |
|
50 |
} |
|
51 |
System.out.println("isAlive(): " + a.isAlive()); |
|
52 |
if (!a.isAlive()) break; |
|
53 |
} |
|
54 |
System.out.println("testThread end"); |
|
55 |
} |
|
56 |
|
|
57 |
public static void main(String[] args) { |
|
58 |
System.out.println("main begin"); |
|
59 |
new TestThread(); |
|
60 |
System.out.println("main end"); |
|
61 |
} |
|
62 |
|
|
63 |
} |
tags/v2_0_0_Build_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/incrementabletask/TestIncrementableTask.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.incrementabletask; |
|
2 |
|
|
3 |
import org.gvsig.gui.beans.progresspanel.LogControl; |
|
4 |
|
|
5 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
6 |
* |
|
7 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
8 |
* of the Valencian Government (CIT) |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or |
|
11 |
* modify it under the terms of the GNU General Public License |
|
12 |
* as published by the Free Software Foundation; either version 2 |
|
13 |
* of the License, or (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
23 |
* MA 02110-1301, USA. |
|
24 |
* |
|
25 |
*/ |
|
26 |
|
|
27 |
/** |
|
28 |
* Test del IncrementableTask |
|
29 |
* |
|
30 |
* @version 27/05/2007 |
|
31 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
32 |
*/ |
|
33 |
public class TestIncrementableTask { |
|
34 |
class ClassProcess implements Runnable, IIncrementable, IncrementableListener { |
|
35 |
int i = 0; |
|
36 |
long j = 0; |
|
37 |
LogControl log = new LogControl(); |
|
38 |
IncrementableTask incrementableTask = null; |
|
39 |
|
|
40 |
private volatile Thread blinker; |
|
41 |
// private boolean ended = false; |
|
42 |
// private boolean threadSuspended = false; |
|
43 |
|
|
44 |
public ClassProcess() { |
|
45 |
} |
|
46 |
|
|
47 |
public void start() { |
|
48 |
blinker = new Thread(this); |
|
49 |
blinker.start(); |
|
50 |
} |
|
51 |
|
|
52 |
public synchronized void stop() { |
|
53 |
// ended = true; |
|
54 |
blinker = null; |
|
55 |
notify(); |
|
56 |
} |
|
57 |
|
|
58 |
public boolean isAlive() { |
|
59 |
return blinker.isAlive(); |
|
60 |
} |
|
61 |
|
|
62 |
public void procesoDuro() throws InterruptedException { |
|
63 |
try { |
|
64 |
for (long k = 0; k <= 8000; k++) |
|
65 |
for (long n = 0; n <= 5000; n++) { |
|
66 |
for (long l = 0; l <= 100; l++); |
|
67 |
if (Thread.currentThread().isInterrupted()) |
|
68 |
throw new InterruptedException(); |
|
69 |
} |
|
70 |
System.out.println("b"); |
|
71 |
} finally { |
|
72 |
System.out.println("c"); |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
public synchronized void run() { |
|
77 |
try { |
|
78 |
procesoDuro(); |
|
79 |
} catch (InterruptedException e1) { |
|
80 |
System.out.println("Se ha salido"); |
|
81 |
} |
|
82 |
/* |
|
83 |
for (long k=0; k<=65535; k++) |
|
84 |
for (long n=0; n<=5000; n++); |
|
85 |
for (j=0; j<=65535; j++) { |
|
86 |
if (Thread.currentThread().isInterrupted()) |
|
87 |
break; |
|
88 |
for (long i=0; i<=65535; i++); |
|
89 |
log.replaceLastLine(j + ""); |
|
90 |
System.out.println(Thread.currentThread().isInterrupted()); |
|
91 |
if ((j%1000)==0) { |
|
92 |
log.addLine(j + ""); |
|
93 |
} |
|
94 |
synchronized(this) { |
|
95 |
while (threadSuspended && !Thread.currentThread().isInterrupted()) |
|
96 |
try { |
|
97 |
wait(500); |
|
98 |
} catch (InterruptedException e) { |
|
99 |
e.printStackTrace(); |
|
100 |
} |
|
101 |
} |
|
102 |
}*/ |
|
103 |
incrementableTask.processFinalize(); |
|
104 |
} |
|
105 |
|
|
106 |
public String getLabel() { |
|
107 |
return "Generando estad?sticas, por favor, espere..."; |
|
108 |
} |
|
109 |
|
|
110 |
public String getLog() { |
|
111 |
return log.getText(); |
|
112 |
} |
|
113 |
|
|
114 |
public int getPercent() { |
|
115 |
return (int) ((j*100)/65535); |
|
116 |
} |
|
117 |
|
|
118 |
public String getTitle() { |
|
119 |
return "Barra de progreso"; |
|
120 |
} |
|
121 |
|
|
122 |
public void setIncrementableTask(IncrementableTask value) { |
|
123 |
incrementableTask = value; |
|
124 |
} |
|
125 |
|
|
126 |
public void actionCanceled(IncrementableEvent e) { |
|
127 |
// ended = true; |
|
128 |
blinker.interrupt(); |
|
129 |
} |
|
130 |
|
|
131 |
public void actionResumed(IncrementableEvent e) { |
|
132 |
// threadSuspended = false; |
|
133 |
} |
|
134 |
|
|
135 |
public void actionSuspended(IncrementableEvent e) { |
|
136 |
// threadSuspended = true; |
|
137 |
} |
|
138 |
|
|
139 |
|
|
140 |
public void setLabel(String label) { |
|
141 |
// TODO Auto-generated method stub |
|
142 |
|
|
143 |
} |
|
144 |
|
|
145 |
public boolean isSuspended() { |
|
146 |
// TODO Auto-generated method stub |
|
147 |
return false; |
|
148 |
} |
|
149 |
|
|
150 |
public void resume() { |
|
151 |
// TODO Auto-generated method stub |
|
152 |
|
|
153 |
} |
|
154 |
|
|
155 |
public void suspend() { |
|
156 |
// TODO Auto-generated method stub |
|
157 |
|
|
158 |
} |
|
159 |
|
|
160 |
public boolean isCancelable() { |
|
161 |
// TODO Auto-generated method stub |
|
162 |
return false; |
|
163 |
} |
|
164 |
|
|
165 |
public void process() throws InterruptedException, Exception { |
|
166 |
// TODO Auto-generated method stub |
|
167 |
|
|
168 |
} |
|
169 |
|
|
170 |
public void setCancelable(boolean b) { |
|
171 |
// TODO Auto-generated method stub |
|
172 |
|
|
173 |
} |
|
174 |
|
|
175 |
public boolean isPausable() { |
|
176 |
// TODO Auto-generated method stub |
|
177 |
return false; |
|
178 |
} |
|
179 |
|
|
180 |
public void setPausable(boolean b) { |
|
181 |
// TODO Auto-generated method stub |
|
182 |
|
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
ClassProcess classProcess = null; |
|
187 |
|
|
188 |
public TestIncrementableTask() { |
|
189 |
super(); |
|
190 |
initialize(); |
|
191 |
} |
|
192 |
|
|
193 |
private void initialize() { |
|
194 |
classProcess = new ClassProcess(); |
|
195 |
IncrementableTask incrementableTask = new IncrementableTask(classProcess); |
|
196 |
classProcess.setIncrementableTask(incrementableTask); |
|
197 |
incrementableTask.showWindow(); |
|
198 |
incrementableTask.addIncrementableListener(classProcess); |
|
199 |
|
|
200 |
incrementableTask.start(); |
|
201 |
classProcess.start(); |
|
202 |
while (classProcess.isAlive()) { |
|
203 |
try { |
|
204 |
Thread.sleep(500); |
|
205 |
} catch (InterruptedException e) { |
|
206 |
e.printStackTrace(); |
|
207 |
} |
|
208 |
} |
|
209 |
classProcess.stop(); |
|
210 |
classProcess = null; |
|
211 |
incrementableTask = null; |
|
212 |
} |
|
213 |
|
|
214 |
public static void main(String[] args) { |
|
215 |
new TestIncrementableTask(); |
|
216 |
} |
|
217 |
} |
|
0 | 218 |
tags/v2_0_0_Build_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/combobutton/TestComboButton.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.combobutton; |
|
20 |
|
|
21 |
import java.awt.event.ActionEvent; |
|
22 |
import java.awt.event.ActionListener; |
|
23 |
|
|
24 |
import javax.swing.ImageIcon; |
|
25 |
import javax.swing.JButton; |
|
26 |
|
|
27 |
import org.gvsig.gui.beans.TestUI; |
|
28 |
import org.gvsig.gui.beans.controls.combobutton.ComboButton; |
|
29 |
|
|
30 |
public class TestComboButton implements ActionListener { |
|
31 |
|
|
32 |
public TestComboButton() { |
|
33 |
TestUI frame = new TestUI("TestComboButton"); |
|
34 |
ComboButton cb = new ComboButton(); |
|
35 |
ImageIcon icon1 = new ImageIcon(getClass().getResource("images/backward.png")); |
|
36 |
ImageIcon icon2 = new ImageIcon(getClass().getResource("images/forward.png")); |
|
37 |
JButton b1 = new JButton("Action 1", icon1); |
|
38 |
b1.addActionListener(new ActionListener() { |
|
39 |
public void actionPerformed(ActionEvent arg0) { |
|
40 |
System.out.println("Pulsando el bot?n 1"); |
|
41 |
System.out.println("Action command: " + arg0.getActionCommand()); |
|
42 |
} |
|
43 |
}); |
|
44 |
b1.setActionCommand("action1"); |
|
45 |
JButton b2 = new JButton("Action 2", icon2); |
|
46 |
b2.addActionListener(new ActionListener() { |
|
47 |
public void actionPerformed(ActionEvent arg0) { |
|
48 |
System.out.println("Pulsando el bot?n 2"); |
|
49 |
System.out.println("Action command: " + arg0.getActionCommand()); |
|
50 |
} |
|
51 |
}); |
|
52 |
b2.setActionCommand("action2"); |
|
53 |
cb.setName("Prueba"); |
|
54 |
cb.addButton(b1); |
|
55 |
cb.addSeparator(); |
|
56 |
cb.addButton(b2); |
|
57 |
cb.addActionListener(this); |
|
58 |
frame.getContentPane().add(cb); |
|
59 |
frame.setSize(80, 80); |
|
60 |
frame.setVisible(true); |
|
61 |
} |
|
62 |
|
|
63 |
|
|
64 |
public static void main(String[] args) { |
|
65 |
new TestComboButton(); |
|
66 |
} |
|
67 |
|
|
68 |
|
|
69 |
public void actionPerformed(ActionEvent e) { |
|
70 |
System.out.println("actionPerformed() : " + e.getActionCommand()); |
|
71 |
} |
|
72 |
} |
|
0 | 73 |
tags/v2_0_0_Build_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/colorslideredition/TestColorSliderEdition.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.colorslideredition; |
|
20 |
|
|
21 |
import java.awt.Color; |
|
22 |
import java.awt.Dimension; |
|
23 |
import java.awt.GridBagConstraints; |
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import javax.swing.JCheckBox; |
|
28 |
import javax.swing.JPanel; |
|
29 |
import javax.swing.border.EmptyBorder; |
|
30 |
|
|
31 |
import org.gvsig.gui.beans.TestUI; |
|
32 |
/** |
|
33 |
* |
|
34 |
* @version 02/11/2007 |
|
35 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
36 |
*/ |
|
37 |
public class TestColorSliderEdition implements ActionListener { |
|
38 |
private TestUI jFrame = new TestUI("TestColorSliderEdition"); |
|
39 |
private ColorSliderEdition colorSliderEdition = null; |
|
40 |
JCheckBox jCBInterpolated = null; |
|
41 |
JCheckBox jCBEnabled = null; |
|
42 |
|
|
43 |
public TestColorSliderEdition() { |
|
44 |
jCBInterpolated = new JCheckBox("Interpolated"); |
|
45 |
jCBInterpolated.setSelected(true); |
|
46 |
jCBInterpolated.addActionListener(this); |
|
47 |
jCBEnabled = new JCheckBox("Enabled"); |
|
48 |
jCBEnabled.addActionListener(this); |
|
49 |
jCBEnabled.setSelected(true); |
|
50 |
|
|
51 |
jFrame.setSize(new Dimension(498, 127)); |
|
52 |
colorSliderEdition = new ColorSliderEdition(); |
|
53 |
colorSliderEdition.setPreferredSize(new Dimension(0, 44)); |
|
54 |
colorSliderEdition.setMinimumSize(new Dimension(0, 44)); |
|
55 |
|
|
56 |
colorSliderEdition.addItem(new ItemColorSlider(0, Color.black), false); |
|
57 |
colorSliderEdition.addItem(new ItemColorSlider(25, Color.red), false); |
|
58 |
colorSliderEdition.addItem(new ItemColorSlider(50, Color.yellow), false); |
|
59 |
colorSliderEdition.addItem(new ItemColorSlider(75, Color.blue), true); |
|
60 |
colorSliderEdition.addItem(new ItemColorSlider(100, new Color(255, 255, 255, 0)), true); |
|
61 |
|
|
62 |
JPanel jPanel = new JPanel(); |
|
63 |
jFrame.setContentPane(jPanel); |
|
64 |
|
|
65 |
jPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
66 |
jPanel.setLayout(new java.awt.GridBagLayout()); |
|
67 |
|
|
68 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
|
69 |
gridBagConstraints.gridx = 0; |
|
70 |
gridBagConstraints.gridy = 0; |
|
71 |
gridBagConstraints.weightx = 1; |
|
72 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; |
|
73 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 5); |
|
74 |
jPanel.add(colorSliderEdition, gridBagConstraints); |
|
75 |
|
|
76 |
gridBagConstraints = new GridBagConstraints(); |
|
77 |
gridBagConstraints.gridx = 0; |
|
78 |
gridBagConstraints.gridy = 1; |
|
79 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5); |
|
80 |
jPanel.add(jCBInterpolated, gridBagConstraints); |
|
81 |
|
|
82 |
gridBagConstraints = new GridBagConstraints(); |
|
83 |
gridBagConstraints.gridx = 0; |
|
84 |
gridBagConstraints.gridy = 2; |
|
85 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 5, 5); |
|
86 |
jPanel.add(jCBEnabled, gridBagConstraints); |
|
87 |
|
|
88 |
jFrame.setVisible(true); |
|
89 |
} |
|
90 |
|
|
91 |
public static void main(String[] args) { |
|
92 |
new TestColorSliderEdition(); |
|
93 |
} |
|
94 |
|
|
95 |
public void actionPerformed(ActionEvent e) { |
|
96 |
if (e.getSource() == jCBInterpolated) { |
|
97 |
colorSliderEdition.setInterpolated(jCBInterpolated.isSelected()); |
|
98 |
return; |
|
99 |
} |
|
100 |
if (e.getSource() == jCBEnabled) { |
|
101 |
colorSliderEdition.setEnabled(jCBEnabled.isSelected()); |
|
102 |
return; |
|
103 |
} |
|
104 |
} |
|
105 |
} |
|
0 | 106 |
tags/v2_0_0_Build_2043/libraries/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_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/editabletextcomponent/TestJEditableTextField.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.editabletextcomponent; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
|
|
5 |
import javax.swing.JFrame; |
|
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 for JEditableTextField |
|
51 |
* |
|
52 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
53 |
*/ |
|
54 |
public class TestJEditableTextField { |
|
55 |
private static JEditableTextField jTCE; |
|
56 |
|
|
57 |
/** |
|
58 |
* Test method for the TestJEditableTextField class |
|
59 |
* |
|
60 |
* @param args |
|
61 |
*/ |
|
62 |
public static void main(String[] args) |
|
63 |
{ |
|
64 |
final int height = 40; |
|
65 |
final int width = 300; |
|
66 |
|
|
67 |
// Objects creation |
|
68 |
JFrame jF = new JFrame(); |
|
69 |
|
|
70 |
jTCE = new JEditableTextField(); |
|
71 |
jTCE.setPreferredSize(new Dimension(width, height)); |
|
72 |
|
|
73 |
// Set properties |
|
74 |
jF.setTitle("Test JEditableTextField"); |
|
75 |
jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
76 |
jF.setSize(jTCE.getPreferredSize()); |
|
77 |
jF.getContentPane().add(jTCE); |
|
78 |
|
|
79 |
jF.setVisible(true); |
|
80 |
} |
|
81 |
} |
tags/v2_0_0_Build_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/editabletextcomponent/TestJEditableTextArea.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.editabletextcomponent; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
|
|
5 |
import javax.swing.JFrame; |
|
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 for JEditableTextArea |
|
51 |
* |
|
52 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
53 |
*/ |
|
54 |
public class TestJEditableTextArea { |
|
55 |
private static JEditableTextArea jTCA; |
|
56 |
|
|
57 |
/** |
|
58 |
* Test method for the TestJEditableTextArea class |
|
59 |
* |
|
60 |
* @param args |
|
61 |
*/ |
|
62 |
public static void main(String[] args) |
|
63 |
{ |
|
64 |
final int height = 40; |
|
65 |
final int width = 300; |
|
66 |
|
|
67 |
// Objects creation |
|
68 |
JFrame jF = new JFrame(); |
|
69 |
|
|
70 |
jTCA = new JEditableTextArea(); |
|
71 |
jTCA.setPreferredSize(new Dimension(width, height)); |
|
72 |
|
|
73 |
// Set properties |
|
74 |
jF.setTitle("Test JEditableTextArea"); |
|
75 |
jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
76 |
jF.setSize(jTCA.getPreferredSize()); |
|
77 |
jF.getContentPane().add(jTCA); |
|
78 |
|
|
79 |
jF.setVisible(true); |
|
80 |
} |
|
81 |
} |
tags/v2_0_0_Build_2043/libraries/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_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/AllTests.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestSuite; |
|
5 |
|
|
6 |
import org.gvsig.gui.beans.panelGroup.Test1ExceptionsUsingTabbedPanel; |
|
7 |
import org.gvsig.gui.beans.panelGroup.Test1ExceptionsUsingTreePanel; |
|
8 |
import org.gvsig.gui.beans.panelGroup.TestPanelGroupLoaderFromList; |
|
9 |
import org.gvsig.gui.beans.panelGroup.TestPanelGroupManager; |
|
10 |
|
|
11 |
public class AllTests { |
|
12 |
|
|
13 |
public static Test suite() { |
|
14 |
TestSuite suite = new TestSuite("Test for org.gvsig.gui.beans"); |
|
15 |
//$JUnit-BEGIN$ |
|
16 |
suite.addTestSuite(TestPanelGroupLoaderFromList.class); |
|
17 |
suite.addTestSuite(TestPanelGroupManager.class); |
|
18 |
suite.addTestSuite(Test1ExceptionsUsingTabbedPanel.class); |
|
19 |
suite.addTestSuite(Test1ExceptionsUsingTreePanel.class); |
|
20 |
//$JUnit-END$ |
|
21 |
return suite; |
|
22 |
} |
|
23 |
|
|
24 |
} |
|
0 | 25 |
tags/v2_0_0_Build_2043/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/graphic/TestGraphic.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.graphic; |
|
20 |
|
|
21 |
import java.awt.BorderLayout; |
|
22 |
|
|
23 |
import org.gvsig.gui.beans.TestUI; |
|
24 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
25 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
|
26 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
|
27 |
/** |
|
28 |
* Test para comprobar el funcionamiento de la grafica |
|
29 |
* |
|
30 |
* @version 06/06/2008 |
|
31 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
32 |
*/ |
|
33 |
public class TestGraphic implements GraphicListener { |
|
34 |
private TestUI frame = new TestUI("TestGraphic"); |
|
35 |
private DefaultButtonsPanel defaultButtonsPanel = null; |
|
36 |
private GraphicContainer graphic = null; |
|
37 |
|
|
38 |
public TestGraphic() throws NotInitializeException{ |
|
39 |
graphic = new GraphicContainer(true); |
|
40 |
|
|
41 |
int nSeries = 3; |
|
42 |
|
|
43 |
String[] names = new String[nSeries]; |
|
44 |
int[][] series = new int[nSeries][256]; |
|
45 |
|
|
46 |
for(int iSerie = 0; iSerie < nSeries; iSerie++){ |
|
47 |
names[iSerie] = "Band " + iSerie; |
|
48 |
for (int i = 0; i < 256; i++) |
|
49 |
series[iSerie][i] = i * (iSerie + 1); |
|
50 |
} |
|
51 |
|
|
52 |
graphic.getPGraphic().setViewType(0); |
|
53 |
|
|
54 |
graphic.getPGraphic().setNewChart(series, names); |
|
55 |
|
|
56 |
graphic.addValueChangedListener(this); |
|
57 |
defaultButtonsPanel = new DefaultButtonsPanel(ButtonsPanel.BUTTONS_CLOSE); |
|
58 |
defaultButtonsPanel.setLayout(new BorderLayout(5, 5)); |
|
59 |
defaultButtonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
60 |
defaultButtonsPanel.add(graphic, BorderLayout.CENTER); |
|
61 |
frame.getContentPane().add(defaultButtonsPanel); |
|
62 |
frame.setSize(640, 480); |
|
63 |
frame.setVisible(true); |
|
64 |
} |
|
65 |
|
|
66 |
public static void main(String[] args) { |
|
67 |
try { |
|
68 |
new TestGraphic(); |
|
69 |
} catch (NotInitializeException ex){ |
|
70 |
System.out.println("Tabla no inicializada"); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
public void actionValueChanged(GraphicEvent e) { |
|
75 |
System.out.println(graphic.getX1() + ":" + graphic.getX2()); |
|
76 |
} |
|
77 |
} |
|
0 | 78 |
tags/v2_0_0_Build_2043/libraries/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_2043/libraries/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"); |
|
161 |
// jCBSD.removeAllItems(); |
|
162 |
jCBSD.addItem("RemoteServices"); |
|
163 |
jCBSD.addItem("?and?"); |
|
164 |
jCBSD.addItem("?"); |
|
165 |
// jCBSD.setSelectedItem("appgvSig"); |
|
166 |
// jCBSD.setSelectedItem(jCBSD.getItemAt(3)); //Test setSelectedItem |
|
167 |
jCBSD.addItem("extNomenclatorIGN"); |
|
168 |
|
|
169 |
// jCBSD.setSelectedItem(jCBSD.getItemAt(1)); //Test setSelectedItem |
|
170 |
// jCBSD.setSelectedIndex(1); //Test setSelectedIndex |
|
171 |
jCBSD.addItem("extWMS"); |
|
172 |
jCBSD.addItem("?AND?"); |
|
173 |
jCBSD.addItem("window"); |
|
174 |
jCBSD.addItem("?"); |
|
175 |
jCBSD.addItem("LIBUI"); |
|
176 |
jCBSD.setSelectedItem("window"); |
|
177 |
jCBSD.addItem("libCorePlugin"); |
|
178 |
jCBSD.addItem("libCq CMS for java"); |
|
179 |
jCBSD.addItem("libDriverManager"); |
|
180 |
|
|
181 |
// jCBSD.setSelectedItem("libDriverManager"); |
|
182 |
//// jCBSD.addItem("libFMap"); |
|
183 |
//// jCBSD.addItem("libG_fwAndamiDBMS"); |
|
184 |
//// jCBSD.addItem("libIverUtiles"); |
|
185 |
//// jCBSD.addItem("libNomenclatorIGN"); |
|
186 |
//// jCBSD.addItem("libNomenclatorIGN_GUI"); |
|
187 |
//// jCBSD.addItem("libRemoteServices"); |
|
188 |
////// jCBSD.addItem("extNomenclatorIGN"); // Duplication test |
|
189 |
//// jCBSD.addItem("libUI"); |
|
190 |
//// jCBSD.addItem("a"); |
|
191 |
//// jCBSD.addItem("aa"); |
|
192 |
//// jCBSD.addItem("aaa"); |
|
193 |
//// jCBSD.addItem("aaaa"); |
|
194 |
//// jCBSD.addItem("aaaaa"); |
|
195 |
//// jCBSD.addItem("b"); |
|
196 |
//// jCBSD.addItem("bbb"); |
|
197 |
//// jCBSD.addItem("bb"); |
|
198 |
//// jCBSD.addItem("c"); |
|
199 |
//// jCBSD.addItem("."); |
|
200 |
//// jCBSD.addItem("ccc"); |
|
201 |
//// jCBSD.addItem("cc"); |
|
202 |
//// jCBSD.addItem("cccc"); |
|
203 |
//// jCBSD.addItem("ddd"); |
|
204 |
//// jCBSD.addItem("d"); |
|
205 |
//// jCBSD.addItem("dd"); |
|
206 |
//// jCBSD.addItem("dddd"); |
|
207 |
//// jCBSD.addItem("e"); |
|
208 |
//// jCBSD.addItem("eee"); |
|
209 |
//// jCBSD.addItem("ee"); |
|
210 |
//// jCBSD.addItem("eeee"); |
|
211 |
// jCBSD.addItem("ff"); |
|
212 |
// jCBSD.addItem("f"); |
|
213 |
//// jCBSD.addItem("LIBZZMAYUSCULA1"); |
|
214 |
//// jCBSD.addItem("ff"); // Duplication test |
|
215 |
//// jCBSD.addItem("asldf"); |
|
216 |
//// jCBSD.addItem("wej"); |
|
217 |
//// jCBSD.addItem("asdf"); |
|
218 |
//// jCBSD.addItem("LIBMAYUSCULA2"); |
|
219 |
//// jCBSD.addItem("qera"); |
|
220 |
//// jCBSD.addItem("zxvcas"); |
|
221 |
//// jCBSD.addItem("wea"); |
|
222 |
//// jCBSD.addItem("asr"); |
|
223 |
//// jCBSD.addItem("asra"); |
|
224 |
//// jCBSD.addItem("LIBMAYUSCULA1"); |
|
225 |
//// jCBSD.addItem("rar"); |
|
226 |
//// jCBSD.addItem("afda"); |
|
227 |
//// jCBSD.addItem("ljvkgk"); |
|
228 |
//// jCBSD.addItem("zcv"); |
|
229 |
//// jCBSD.addItem("gfhdt"); |
|
230 |
//// jCBSD.addItem("dfhgd"); |
|
231 |
//// jCBSD.addItem("dfh"); |
|
232 |
//// jCBSD.addItem("dfhs"); |
|
233 |
//// jCBSD.addItem("sfszv"); |
|
234 |
//// jCBSD.addItem("qer"); |
|
235 |
//// jCBSD.addItem("adfazva"); |
|
236 |
//// jCBSD.addItem("xnd"); |
|
237 |
//// jCBSD.addItem("vdkjgd"); |
|
238 |
//// jCBSD.addItem("ddhd"); |
|
239 |
//// jCBSD.addItem("dxgx"); |
|
240 |
|
|
241 |
//// jCBSD.addItem("cnsf"); |
|
242 |
//// jCBSD.addItem("ssfgs"); |
|
243 |
//// jCBSD.addItem("sgfsbx"); |
|
244 |
//// jCBSD.addItem("sfxb"); |
|
245 |
//// jCBSD.addItem("chdgk"); |
|
246 |
//// jCBSD.addItem("jgu"); |
|
247 |
//// jCBSD.addItem("gkgj"); |
|
248 |
//// jCBSD.addItem("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeee"); |
|
249 |
//// jCBSD.addItem("ljko?j.n"); |
|
250 |
//// jCBSD.addItem("hfjf"); |
|
251 |
//// jCBSD.addItem("xbxb"); |
|
252 |
//// jCBSD.addItem(".,lhhi"); |
|
253 |
//// jCBSD.addItem("hklx_fwAndami"); |
|
254 |
//// jCBSD.addItem("cvn"); |
|
255 |
//// jCBSD.addItem("dgh"); |
|
256 |
//// jCBSD.addItem("cncv"); |
|
257 |
//// jCBSD.addItem("sg"); |
|
258 |
//// jCBSD.addItem("b,mjk"); |
|
259 |
//// jCBSD.addItem("xv"); |
|
260 |
//// jCBSD.addItem("sgghu"); |
|
261 |
//// jCBSD.addItem("saxc"); |
|
262 |
//// jCBSD.addItem("srts"); |
|
263 |
//// jCBSD.addItem("sduyg"); |
|
264 |
//// jCBSD.addItem("sxfsrs"); |
|
265 |
//// jCBSD.addItem("rsdtf"); |
|
266 |
//// jCBSD.addItem("po`llh"); |
|
267 |
//// jCBSD.addItem("fghtf54j"); |
|
268 |
//// jCBSD.addItem("s25ewsd"); |
|
269 |
//// jCBSD.addItem("uo8khkj"); |
|
270 |
//// jCBSD.addItem("sfg45"); |
|
271 |
//// jCBSD.addItem("3gd"); |
|
272 |
//// jCBSD.addItem("5dhd"); |
|
273 |
//// jCBSD.addItem("sg4dh6"); |
|
274 |
//// jCBSD.addItem("dfh5"); |
|
275 |
//// jCBSD.addItem("s4hfj74"); |
|
276 |
//// jCBSD.addItem("sdg534"); |
|
277 |
//// jCBSD.addItem("2452etdfg"); |
|
278 |
//// jCBSD.addItem("2ui068"); |
|
279 |
//// jCBSD.addItem("3dsd sgr"); |
|
280 |
//// jCBSD.addItem("sr sgsr"); |
|
281 |
//// jCBSD.addItem("sssssssss"); |
|
282 |
//// jCBSD.addItem("aaaaass"); |
|
283 |
//// jCBSD.addItem("ss"); |
|
284 |
//// jCBSD.addItem("sry"); |
|
285 |
//// jCBSD.addItem("h?hj"); |
|
286 |
//// jCBSD.addItem("gkgb"); |
|
287 |
//// jCBSD.addItem("gkgu"); |
|
288 |
//// jCBSD.addItem("gjugvfc"); |
|
289 |
//// jCBSD.addItem("dghdd"); |
|
290 |
//// jCBSD.addItem("dhdt"); |
|
291 |
//// jCBSD.addItem("dhgd"); |
|
292 |
//// jCBSD.addItem("ddtughd"); |
|
293 |
//// jCBSD.addItem("ffuklj?d"); |
|
294 |
//// jCBSD.addItem("j?olk.j"); |
|
295 |
//// jCBSD.addItem("las alupoai a?ieurpay"); |
|
296 |
//// jCBSD.addItem("tytresd"); |
|
297 |
//// jCBSD.addItem("fgkg"); |
|
298 |
//// jCBSD.addItem("lhh"); |
|
299 |
//// jCBSD.addItem("hkhlhip"); |
|
300 |
//// jCBSD.addItem("k?popi0??=(J"); |
|
301 |
//// jCBSD.addItem("af??=)(/?/"); |
Also available in: Unified diff