Revision 38010
tags/v2_0_0_Build_2045/libraries/libUIComponent/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.ui</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<version>2.0.1-SNAPSHOT</version> |
|
9 |
<name>libUIComponent</name> |
|
10 |
<description>Swing components collection</description> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.maven.base.pom</artifactId> |
|
14 |
<version>1.0.8-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
<scm> |
|
17 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/libUIComponent</connection> |
|
18 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/branches/v2_0_0_prep/libraries/libUIComponent</developerConnection> |
|
19 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/branches/v2_0_0_prep/libraries/libUIComponent</url> |
|
20 |
</scm> |
|
21 |
<repositories> |
|
22 |
<repository> |
|
23 |
<id>gvsig-public-http-repository</id> |
|
24 |
<name>gvSIG maven public HTTP repository</name> |
|
25 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
26 |
<releases> |
|
27 |
<enabled>true</enabled> |
|
28 |
<updatePolicy>daily</updatePolicy> |
|
29 |
<checksumPolicy>warn</checksumPolicy> |
|
30 |
</releases> |
|
31 |
<snapshots> |
|
32 |
<enabled>true</enabled> |
|
33 |
<updatePolicy>daily</updatePolicy> |
|
34 |
<checksumPolicy>warn</checksumPolicy> |
|
35 |
</snapshots> |
|
36 |
</repository> |
|
37 |
</repositories> |
|
38 |
<dependencyManagement> |
|
39 |
<dependencies> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
43 |
<version>2.0.1-SNAPSHOT</version> |
|
44 |
<type>pom</type> |
|
45 |
<scope>import</scope> |
|
46 |
</dependency> |
|
47 |
</dependencies> |
|
48 |
</dependencyManagement> |
|
49 |
<dependencies> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.i18n</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>jfree</groupId> |
|
62 |
<artifactId>jcommon</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>jfree</groupId> |
|
67 |
<artifactId>jfreechart</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>net.sf</groupId> |
|
72 |
<artifactId>flib-jcalendar</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>jwizardcomponent</groupId> |
|
77 |
<artifactId>jwizardcomponent</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.slf4j</groupId> |
|
82 |
<artifactId>slf4j-api</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
</dependencies> |
|
86 |
<build> |
|
87 |
<sourceDirectory>src</sourceDirectory> |
|
88 |
<testSourceDirectory>src-test-ui</testSourceDirectory> |
|
89 |
<resources> |
|
90 |
<resource> |
|
91 |
<directory>src</directory> |
|
92 |
<includes> |
|
93 |
<include>**/*.gif</include> |
|
94 |
<include>**/*.png</include> |
|
95 |
<include>**/*.PNG</include> |
|
96 |
<include> **/*.bmp</include> |
|
97 |
<include> **/*.jpg</include> |
|
98 |
<include> **/*.jpeg</include> |
|
99 |
<include> **/*.properties</include> |
|
100 |
</includes> |
|
101 |
</resource> |
|
102 |
<resource> |
|
103 |
<targetPath>org/gvsig/gui/beans/resources/translations</targetPath> |
|
104 |
<filtering>false</filtering> |
|
105 |
<directory>${basedir}/config</directory> |
|
106 |
<includes> |
|
107 |
<include>*.properties</include> |
|
108 |
</includes> |
|
109 |
</resource> |
|
110 |
</resources> |
|
111 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
112 |
<plugins> |
|
113 |
<plugin> |
|
114 |
<groupId>org.apache.maven.plugins</groupId> |
|
115 |
<artifactId>maven-surefire-plugin</artifactId> |
|
116 |
<configuration> |
|
117 |
<skipTests>true</skipTests> |
|
118 |
</configuration> |
|
119 |
</plugin> |
|
120 |
<plugin> |
|
121 |
<groupId>org.apache.maven.plugins</groupId> |
|
122 |
<artifactId>maven-compiler-plugin</artifactId> |
|
123 |
<configuration> |
|
124 |
<testExcludes> |
|
125 |
<exclude>**</exclude> |
|
126 |
</testExcludes> |
|
127 |
</configuration> |
|
128 |
</plugin> |
|
129 |
</plugins> |
|
130 |
</build> |
|
131 |
|
|
132 |
<profiles> |
|
133 |
<profile> |
|
134 |
<id>eclipse-project</id> |
|
135 |
<build> |
|
136 |
<plugins> |
|
137 |
<plugin> |
|
138 |
<artifactId>maven-antrun-plugin</artifactId> |
|
139 |
<configuration> |
|
140 |
<tasks> |
|
141 |
<ant antfile="${basedir}/../build/ant-tasks/eclipse-tasks.xml" target="eclipse.eclipse" /> |
|
142 |
</tasks> |
|
143 |
</configuration> |
|
144 |
<dependencies> |
|
145 |
<dependency> |
|
146 |
<groupId>org.apache.ant</groupId> |
|
147 |
<artifactId>ant-trax</artifactId> |
|
148 |
<version>1.7.1</version> |
|
149 |
</dependency> |
|
150 |
<dependency> |
|
151 |
<groupId>xalan</groupId> |
|
152 |
<artifactId>xalan</artifactId> |
|
153 |
<version>2.6.0</version> |
|
154 |
</dependency> |
|
155 |
</dependencies> |
|
156 |
</plugin> |
|
157 |
</plugins> |
|
158 |
</build> |
|
159 |
</profile> |
|
160 |
<profile> |
|
161 |
<id>gvsig-install</id> |
|
162 |
<activation> |
|
163 |
<activeByDefault>true</activeByDefault> |
|
164 |
</activation> |
|
165 |
<properties> |
|
166 |
<!-- gvSIG installation folder --> |
|
167 |
<gvsig.install.dir>${basedir}/../build/product |
|
168 |
</gvsig.install.dir> |
|
169 |
</properties> |
|
170 |
</profile> |
|
171 |
</profiles> |
|
172 |
<properties> |
|
173 |
<eclipse.project.name>libUIComponent</eclipse.project.name> |
|
174 |
</properties> |
|
175 |
</project> |
tags/v2_0_0_Build_2045/libraries/libUIComponent/.cvsignore | ||
---|---|---|
1 |
bin |
|
2 |
bin-test |
|
0 | 3 |
tags/v2_0_0_Build_2045/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_2045/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??=)(/?/"); |
|
302 |
//// jCBSD.addItem("-a,malj'=)/"); |
|
303 |
//// jCBSD.addItem("2gw"); |
|
304 |
//// jCBSD.addItem("5teu"); |
|
305 |
//// jCBSD.addItem("4576jfff"); |
|
306 |
//// jCBSD.addItem("urtyu"); |
|
307 |
//// jCBSD.addItem("fi7"); |
|
308 |
//// jCBSD.addItem("git7t4h"); |
|
309 |
//// jCBSD.addItem("hr6frr"); |
|
310 |
//// jCBSD.addItem("ehe5et"); |
|
311 |
//// jCBSD.addItem("eue5klhj"); |
|
312 |
//// jCBSD.addItem("yoiyoy"); |
|
313 |
//// jCBSD.addItem("yoyi"); |
|
314 |
//// jCBSD.addItem("sgcsc"); |
|
315 |
//// jCBSD.addItem("sgmff74"); |
|
316 |
//// jCBSD.addItem("dd43d d6dhlhju"); |
|
317 |
//// jCBSD.addItem("gkjngr"); |
|
318 |
//// jCBSD.addItem("dbddht"); |
|
319 |
//// jCBSD.addItem("sbd"); |
|
320 |
//// jCBSD.addItem("dcbd5opihjj"); |
|
321 |
//// jCBSD.addItem("pujtth"); |
|
322 |
//// jCBSD.addItem("ZZZZZ"); |
|
323 |
//// jCBSD.addItem("ytht"); |
|
324 |
//// jCBSD.addItem("tjgt"); |
|
325 |
//// jCBSD.addItem("rrf"); |
|
326 |
//// jCBSD.addItem("BLIUE? "); |
|
327 |
//// jCBSD.addItem("?AND?"); |
|
328 |
//// jCBSD.addItem("axaaa4iktiu"); |
|
329 |
//// jCBSD.addItem("tttyir"); |
|
330 |
//// jCBSD.addItem("ruyrrruu4"); |
|
331 |
//// jCBSD.addItem("rryewrsw"); |
|
332 |
//// jCBSD.addItem("wertw"); |
|
333 |
//// jCBSD.addItem("wer26e"); |
|
334 |
//// jCBSD.addItem("eceye"); |
|
335 |
//// jCBSD.addItem("etye7yyy-er"); |
|
336 |
//// jCBSD.addItem("eyert7e7e7"); |
|
337 |
//// jCBSD.addItem("_abcdefghijklmn?opqrstuvwxyz"); |
|
338 |
//// jCBSD.addItem("_0123456789"); |
|
339 |
//// jCBSD.addItem("sstsnmmsutt"); |
|
340 |
//// jCBSD.addItem("dcytdtyd"); |
|
341 |
//// jCBSD.addItem("dcdtdty"); |
|
342 |
//// jCBSD.addItem("dctycd"); |
|
343 |
//// jCBSD.addItem("cstyd"); |
|
344 |
//// jCBSD.addItem("dbddcytdsssc"); |
|
345 |
//// jCBSD.addItem("cdydt"); |
|
346 |
//// jCBSD.addItem("scscydu"); |
|
347 |
//// jCBSD.addItem("axct"); |
|
348 |
//// jCBSD.addItem("joobfvd"); |
|
349 |
//// jCBSD.addItem("jomj"); |
|
350 |
//// jCBSD.addItem("omjo"); |
|
351 |
//// jCBSD.addItem("mol"); |
|
352 |
//// jCBSD.addItem("agdhfj"); |
|
353 |
//// jCBSD.addItem("fjfhjuh,ooom"); |
|
354 |
//// jCBSD.addItem("affjfa"); |
|
355 |
//// jCBSD.addItem("afjfjyfga"); |
|
356 |
//// jCBSD.addItem("NOMENCLATOR"); |
|
357 |
//// jCBSD.addItem("asg"); |
|
358 |
//// jCBSD.addItem("afaea"); |
|
359 |
//// jCBSD.addItem("gvSIG"); |
|
360 |
//// jCBSD.addItem("yoiey"); |
|
361 |
//// jCBSD.addItem("35"); |
|
362 |
//// jCBSD.addItem("ewgw2dh"); |
|
363 |
//// jCBSD.addItem("titgr"); |
|
364 |
//// jCBSD.addItem("o9yky"); |
|
365 |
//// jCBSD.addItem("kyio8gbr"); |
|
366 |
//// jCBSD.addItem("eve5yed574rir"); |
|
367 |
//// jCBSD.addItem("578tygmtio"); |
|
368 |
//// jCBSD.addItem("t43262ryteye"); |
|
369 |
//// jCBSD.addItem("wvwx"); |
|
370 |
//// jCBSD.addItem("zssscwwwwww"); |
|
371 |
//// jCBSD.addItem("sgvr"); |
|
372 |
//// jCBSD.addItem("..."); |
|
373 |
// jCBSD.addItem("?LTIMO ITEM EN A?ADIRSE"); |
|
374 |
|
|
375 |
// --- END ADD ITEMS TO THE COMPONENT AND OTHER TESTS --- |
|
376 |
|
|
377 |
// Test of no item default selection |
|
378 |
// jCBSD.setSelectedIndex(-1); |
|
379 |
|
|
380 |
// Other tests |
|
381 |
// jCBSD.setSelectedIndex(0); |
|
382 |
// System.out.println("Selected: " + jCBSD.getSelectedItem()); |
|
383 |
// jCBSD.setSelectedIndex(3); |
|
384 |
// System.out.println("Item at 3: " + jCBSD.getItemAt(3)); |
|
385 |
// jCBSD.setSelectedItem("?AND?"); |
|
386 |
|
|
387 |
// System.out.println("Index of LIBUI: " + ((DefaultComboBoxConfigurableLookUpModel)jCBSD.getModel()).getIndexOf("LIBUI")); |
|
388 |
// jCBSD.addItem("A?ADIDO"); |
|
389 |
// jCBSD.removeItemAt(0); |
|
390 |
// jCBSD.removeAllItems(); |
|
391 |
// ((DefaultComboBoxConfigurableLookUpModel)jCBSD.getModel()).removeAllElements(); |
|
392 |
// System.out.println("Number of elements (list box): " + jCBSD.getItemCount()); |
|
393 |
|
|
394 |
// Tests the method ''setPrototypeDisplayValue'' |
|
395 |
// jCBSD.addItem("ABCDEFGHIJKLMN?OPQRSTUVWXYZ-ABCDEFGHIJKLMN?OPQRSTUVWXYZ-ABCDEFGHIJKLMN?OPQRSTUVWXYZ"); |
|
396 |
// jCBSD.setSelectedItem("ABCDEFGHIJKLMN?OPQRSTUVWXYZ-ABCDEFGHIJKLMN?OPQRSTUVWXYZ-ABCDEFGHIJKLMN?OPQRSTUVWXYZ"); |
|
397 |
// jCBSD.setPrototypeDisplayValue("ABCDEFGHIJKLMN?OPQRSTUVWXYZ"); |
|
398 |
|
|
399 |
// Configure the JFrame |
|
400 |
jF.setTitle("Test JComboBoxConfigurableLookUp"); |
|
401 |
jF.setSize(new Dimension(width, height)); |
|
402 |
jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
403 |
jF.getContentPane().add(jCBSD); |
|
404 |
jF.setVisible(true); |
|
405 |
|
|
406 |
// More tests |
|
407 |
// jCBSD.setSelectedIndex(0); // Failures before the component could be showed |
|
408 |
// System.out.println("Selected: " + jCBSD.getSelectedItem()); |
|
409 |
// jCBSD.setSelectedIndex(3); // Failures before the component could be showed |
|
410 |
// System.out.println("Item at 3: " + jCBSD.getItemAt(3)); |
|
411 |
// jCBSD.setSelectedItem("?AND?"); // Failures before the component could be showed |
|
412 |
|
|
413 |
// Test a Look up Agent |
|
414 |
// model.setLookUpAgent(new SampleAgent()); |
|
415 |
|
|
416 |
// Test changing the renderer |
|
417 |
// jCBSD.setRenderer(new SampleBasicComboBoxRenderer()); |
|
418 |
|
|
419 |
// More tests |
|
420 |
// jCBSD.removeAllItems(); |
|
421 |
// jCBSD.addItem("extCAD"); |
|
422 |
// jCBSD.addItem("libuiDownCase"); |
|
423 |
// jCBSD.addItem("appgvSig"); |
|
424 |
// jCBSD.removeAllItems(); |
|
425 |
// jCBSD.addItem("extCAD"); |
|
426 |
// jCBSD.addItem("libuiDownCase"); |
|
427 |
// jCBSD.addItem("appgvSig"); |
|
428 |
// jCBSD.setSelectedItem("libuiDownCase"); |
|
429 |
|
|
430 |
// Test change the editor |
|
431 |
// jCBSD.setEditor(new SampleComboBoxEditor()); |
|
432 |
} |
|
433 |
catch(Exception e) |
|
434 |
{ |
|
435 |
e.printStackTrace(); |
|
436 |
JOptionPane.showMessageDialog(null, Messages.getText("testJComboBoxConfigurableLookUpErrorMessage"), Messages.getText("error"), JOptionPane.ERROR_MESSAGE); |
|
437 |
} |
|
438 |
} |
|
439 |
} |
tags/v2_0_0_Build_2045/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboboxconfigurablelookup/programmertests/SampleAgent.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 |
|
|
20 |
package org.gvsig.gui.beans.comboboxconfigurablelookup.programmertests; |
|
21 |
|
|
22 |
import java.util.ArrayList; |
|
23 |
import java.util.List; |
|
24 |
import java.util.Vector; |
|
25 |
|
|
26 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.ILookUp; |
|
27 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.StringComparator; |
|
28 |
|
|
29 |
/** |
|
30 |
* <p>Sample of personalized look up algorithm for the model of a <code>JComboBoxConfigurableLookUp</code> object.</p> |
|
31 |
* |
|
32 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
33 |
* @version 08/02/2008 |
|
34 |
*/ |
|
35 |
public class SampleAgent implements ILookUp { |
|
36 |
/** |
|
37 |
* <p>Creates a new instance of the class <code>StartsWithLookUpAgent</code>.</p> |
|
38 |
*/ |
|
39 |
public SampleAgent() { |
|
40 |
} |
|
41 |
|
|
42 |
/* |
|
43 |
* (non-Javadoc) |
|
44 |
* @see org.gvsig.gui.beans.comboboxconfigurablelookup.ILookUp#doLookUpConsideringCaseSensitive(java.lang.String, java.util.Vector, org.gvsig.gui.beans.comboboxconfigurablelookup.StringComparator) |
|
45 |
*/ |
|
46 |
public List<Object> doLookUpConsideringCaseSensitive(String text, Vector<Object> sortOrderedItems, StringComparator comp) { |
|
47 |
if (sortOrderedItems == null) |
|
48 |
return null; |
|
49 |
|
|
50 |
List<Object> list = new ArrayList<Object>(); |
|
51 |
|
|
52 |
for (int i = 0; i < (sortOrderedItems.size()); i++) { |
|
53 |
if (i % 2 == 0) |
|
54 |
list.add(sortOrderedItems.get(i)); |
|
55 |
} |
|
56 |
|
|
57 |
return list; |
|
58 |
} |
|
59 |
|
|
60 |
/* |
|
61 |
* (non-Javadoc) |
|
62 |
* @see org.gvsig.gui.beans.comboboxconfigurablelookup.ILookUp#doLookUpIgnoringCaseSensitive(java.lang.String, java.util.Vector, org.gvsig.gui.beans.comboboxconfigurablelookup.StringComparator) |
|
63 |
*/ |
|
64 |
public List<Object> doLookUpIgnoringCaseSensitive(String text, Vector<Object> sortOrderedItems, StringComparator comp) { |
|
65 |
if (sortOrderedItems == null) |
|
66 |
return null; |
|
67 |
|
|
68 |
List<Object> list = new ArrayList<Object>(); |
|
69 |
|
|
70 |
for (int i = 0; i < (sortOrderedItems.size()); i++) { |
|
71 |
if (i % 2 == 0) |
|
72 |
list.add(sortOrderedItems.get(i)); |
|
73 |
} |
|
74 |
|
|
75 |
return list; |
|
76 |
} |
|
77 |
} |
tags/v2_0_0_Build_2045/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboboxconfigurablelookup/programmertests/SampleComboBoxEditor.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 |
|
|
20 |
package org.gvsig.gui.beans.comboboxconfigurablelookup.programmertests; |
|
21 |
|
|
22 |
import java.awt.Component; |
|
23 |
import java.awt.event.ActionListener; |
|
24 |
import java.awt.event.FocusEvent; |
|
25 |
import java.awt.event.FocusListener; |
|
26 |
import java.lang.reflect.Method; |
|
27 |
|
|
28 |
import javax.swing.ComboBoxEditor; |
|
29 |
import javax.swing.JTextField; |
|
30 |
import javax.swing.border.Border; |
|
31 |
import javax.swing.plaf.basic.BasicComboBoxEditor; |
|
32 |
|
|
33 |
import org.gvsig.gui.beans.editabletextcomponent.JEditableTextField; |
|
34 |
|
|
35 |
/** |
|
36 |
* <p>The default editor for editable combo boxes. The editor is implemented as a JTextField.</p> |
|
37 |
* |
|
38 |
* @version 12/02/08 |
|
39 |
* @author Arnaud Weber |
|
40 |
* @author Mark Davidson |
|
41 |
* @author Pablo Piqueras Bartolom? |
|
42 |
*/ |
|
43 |
public class SampleComboBoxEditor implements ComboBoxEditor, FocusListener { |
|
44 |
protected JTextField editor; |
|
45 |
private Object oldValue; |
|
46 |
|
|
47 |
public SampleComboBoxEditor() { |
|
48 |
editor = new BorderlessTextField("",9); |
|
49 |
editor.setBorder(null); |
|
50 |
} |
|
51 |
|
|
52 |
public Component getEditorComponent() { |
|
53 |
return editor; |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Sets the item that should be edited. |
|
58 |
* |
|
59 |
* @param anObject the displayed value of the editor |
|
60 |
*/ |
|
61 |
public void setItem(Object anObject) { |
|
62 |
if ( anObject != null ) { |
|
63 |
editor.setText(anObject.toString()); |
|
64 |
|
|
65 |
oldValue = anObject; |
|
66 |
} else { |
|
67 |
editor.setText(""); |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
public Object getItem() { |
|
72 |
Object newValue = editor.getText(); |
|
73 |
|
|
74 |
if (oldValue != null && !(oldValue instanceof String)) { |
|
75 |
// The original value is not a string. Should return the value in it's |
|
76 |
// original type. |
|
77 |
if (newValue.equals(oldValue.toString())) { |
|
78 |
return oldValue; |
|
79 |
} else { |
|
80 |
// Must take the value from the editor and get the value and cast it to the new type. |
|
81 |
Class cls = oldValue.getClass(); |
|
82 |
try { |
|
83 |
Method method = cls.getMethod("valueOf", new Class[]{String.class}); |
|
84 |
newValue = method.invoke(oldValue, new Object[] { editor.getText()}); |
|
85 |
} catch (Exception ex) { |
|
86 |
// Fail silently and return the newValue (a String object) |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
return newValue; |
|
91 |
} |
|
92 |
|
|
93 |
public void selectAll() { |
|
94 |
editor.selectAll(); |
|
95 |
editor.requestFocus(); |
|
96 |
} |
|
97 |
|
|
98 |
// This used to do something but now it doesn't. It couldn't be |
|
99 |
// removed because it would be an API change to do so. |
|
100 |
public void focusGained(FocusEvent e) {} |
|
101 |
|
|
102 |
// This used to do something but now it doesn't. It couldn't be |
|
103 |
// removed because it would be an API change to do so. |
|
104 |
public void focusLost(FocusEvent e) {} |
|
105 |
|
|
106 |
public void addActionListener(ActionListener l) { |
|
107 |
editor.addActionListener(l); |
|
108 |
} |
|
109 |
|
|
110 |
public void removeActionListener(ActionListener l) { |
|
111 |
editor.removeActionListener(l); |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Inner text field editable as a component of a ComboBox editor. |
|
116 |
* |
|
117 |
* @see JEditableTextField |
|
118 |
* |
|
119 |
* @version 12/02/08 |
|
120 |
* @author Arnaud Weber |
|
121 |
* @author Mark Davidson |
|
122 |
* @author Pablo Piqueras Bartolom? |
|
123 |
*/ |
|
124 |
private class BorderlessTextField extends JEditableTextField { |
|
125 |
private static final long serialVersionUID = -3333236529430569318L; |
|
126 |
|
|
127 |
public BorderlessTextField(String value,int n) { |
|
128 |
super(value,n); |
|
129 |
} |
|
130 |
|
|
131 |
// workaround for 4530952 |
|
132 |
public void setText(String s) { |
|
133 |
if (getText().equals(s)) { |
|
134 |
return; |
|
135 |
} |
|
136 |
super.setText(s); |
|
137 |
} |
|
138 |
|
|
139 |
public void setBorder(Border b) {} |
|
140 |
} |
|
141 |
|
|
142 |
/** |
|
143 |
* A subclass of BasicComboBoxEditor that implements UIResource. |
|
144 |
* BasicComboBoxEditor doesn't implement UIResource |
|
145 |
* directly so that applications can safely override the |
|
146 |
* cellRenderer property with BasicListCellRenderer subclasses. |
|
147 |
* <p> |
|
148 |
* <strong>Warning:</strong> |
|
149 |
* Serialized objects of this class will not be compatible with |
|
150 |
* future Swing releases. The current serialization support is |
|
151 |
* appropriate for short term storage or RMI between applications running |
|
152 |
* the same version of Swing. As of 1.4, support for long term storage |
|
153 |
* of all JavaBeans<sup><font size="-2">TM</font></sup> |
|
154 |
* has been added to the <code>java.beans</code> package. |
|
155 |
* Please see {@link java.beans.XMLEncoder}. |
|
156 |
*/ |
|
157 |
public static class UIResource extends BasicComboBoxEditor |
|
158 |
implements javax.swing.plaf.UIResource { |
|
159 |
} |
|
160 |
} |
tags/v2_0_0_Build_2045/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboboxconfigurablelookup/programmertests/SampleBasicComboBoxRenderer.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 |
|
|
20 |
package org.gvsig.gui.beans.comboboxconfigurablelookup.programmertests; |
|
21 |
|
|
22 |
import java.awt.Color; |
|
23 |
import java.awt.Component; |
|
24 |
|
|
25 |
import javax.swing.JList; |
|
26 |
import javax.swing.plaf.basic.BasicComboBoxRenderer; |
|
27 |
|
|
28 |
/** |
|
29 |
* <p>Sample of personalized combo box cell renderer.</p> |
|
30 |
* |
|
31 |
* @version 08/02/2008 |
|
32 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
33 |
*/ |
|
34 |
public class SampleBasicComboBoxRenderer extends BasicComboBoxRenderer { |
|
35 |
private static final long serialVersionUID = -9044759678425798655L; |
|
36 |
|
|
37 |
/** |
|
38 |
* <p>Creates a new instance of the <code>SampleBasicComboBoxRenderer</code> class.</p> |
|
39 |
*/ |
|
40 |
public SampleBasicComboBoxRenderer() { |
|
41 |
super(); |
|
42 |
} |
|
43 |
|
|
44 |
/* |
|
45 |
* (non-Javadoc) |
|
46 |
* @see javax.swing.plaf.basic.BasicComboBoxRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) |
|
47 |
*/ |
|
48 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
|
49 |
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
|
50 |
|
|
51 |
if (isSelected) |
|
52 |
component.setBackground(Color.GRAY); |
|
53 |
else |
|
54 |
component.setBackground(new Color(((17 * index) % 256), ((31 * index) % 256), ((7 * index) % 256))); |
|
55 |
|
|
56 |
return component; |
|
57 |
} |
|
58 |
} |
tags/v2_0_0_Build_2045/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboboxconfigurablelookup/usertests/JFrameUserTestOfJComboBoxConfigurableLookUp.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.comboboxconfigurablelookup.usertests; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
|
|
5 |
import javax.swing.JFrame; |
|
6 |
|
|
7 |
import org.gvsig.gui.beans.Messages; |
|
8 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.JComboBoxConfigurableLookUp; |
|
9 |
|
|
10 |
|
|
11 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
12 |
* |
|
13 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
14 |
* |
|
15 |
* This program is free software; you can redistribute it and/or |
|
16 |
* modify it under the terms of the GNU General Public License |
|
17 |
* as published by the Free Software Foundation; either version 2 |
|
18 |
* of the License, or (at your option) any later version. |
|
19 |
* |
|
20 |
* This program is distributed in the hope that it will be useful, |
|
21 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23 |
* GNU General Public License for more details. |
|
24 |
* |
|
25 |
* You should have received a copy of the GNU General Public License |
|
26 |
* along with this program; if not, write to the Free Software |
|
27 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
28 |
* |
|
29 |
* For more information, contact: |
|
30 |
* |
|
31 |
* Generalitat Valenciana |
|
32 |
* Conselleria d'Infraestructures i Transport |
|
33 |
* Av. Blasco Ib??ez, 50 |
|
34 |
* 46010 VALENCIA |
|
35 |
* SPAIN |
|
36 |
* |
|
37 |
* +34 963862235 |
|
38 |
* gvsig@gva.es |
|
39 |
* www.gvsig.gva.es |
|
40 |
* |
|
41 |
* or |
|
42 |
* |
|
43 |
* IVER T.I. S.A |
|
44 |
* Salamanca 50 |
|
45 |
* 46005 Valencia |
|
46 |
* Spain |
|
47 |
* |
|
48 |
* +34 963163400 |
|
49 |
* dac@iver.es |
|
50 |
*/ |
|
51 |
|
|
52 |
/** |
|
53 |
* <p>Creates and launches an application for testing {@link JComboBoxConfigurableLookUp JComboBoxConfigurableLookUp}.</p> |
|
54 |
* |
|
55 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
56 |
* @version 07/02/2008 |
|
57 |
*/ |
|
58 |
public class JFrameUserTestOfJComboBoxConfigurableLookUp implements Serializable{ |
|
59 |
private static final long serialVersionUID = 5760643373469048220L; |
|
60 |
|
|
61 |
private JPanelUserTestOfJComboBoxConfigurableLookUp mainPanel = null; |
|
62 |
private JFrame frame; |
|
63 |
|
|
64 |
/** |
|
65 |
* <p>Default constructor.</p> |
|
66 |
*/ |
|
67 |
public JFrameUserTestOfJComboBoxConfigurableLookUp() { |
|
68 |
createFrame(); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* <p>Creates the main <code>JFrame</code> for execute the application, and adds to it the <code>JPanel</code> test application.</p> |
|
73 |
*/ |
|
74 |
private void createFrame() { |
|
75 |
// Create: Configuration Frame |
|
76 |
frame = new JFrame(); |
|
77 |
frame.setResizable(false); |
|
78 |
frame.setTitle(Messages.getText("jComboBoxConfigurableLookUpByTheUser_frameTitle")); |
|
79 |
frame.getContentPane().add(getJPanelUserTestOfJComboBoxConfigurableLookUp()); |
|
80 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
81 |
frame.pack(); |
|
82 |
|
|
83 |
// Centers the frame in the middle of the screen |
|
84 |
frame.setLocationRelativeTo(null); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* <p>Initializes <code>mainPanel</code>.</p> |
|
89 |
* |
|
90 |
* @return JPanelUserTestOfJComboBoxConfigurableLookUp |
|
91 |
*/ |
|
92 |
private JPanelUserTestOfJComboBoxConfigurableLookUp getJPanelUserTestOfJComboBoxConfigurableLookUp() { |
|
93 |
if (mainPanel == null) { |
|
94 |
mainPanel = new JPanelUserTestOfJComboBoxConfigurableLookUp(); |
|
95 |
} |
|
96 |
|
|
97 |
return mainPanel; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* <p>Method for launch the application.</p> |
|
102 |
* |
|
103 |
* @param args |
|
104 |
*/ |
|
105 |
public static void main(String[] args) { |
|
106 |
JFrameUserTestOfJComboBoxConfigurableLookUp app = new JFrameUserTestOfJComboBoxConfigurableLookUp(); |
|
107 |
app.setVisible(true); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* <p>Sets visible the frame.</p> |
|
112 |
* |
|
113 |
* @param visible True or false |
|
114 |
*/ |
|
115 |
public void setVisible(boolean visible) { |
|
116 |
frame.setVisible(visible); |
|
117 |
} |
|
118 |
} |
tags/v2_0_0_Build_2045/libraries/libUIComponent/src-test-ui/org/gvsig/gui/beans/comboboxconfigurablelookup/usertests/JPanelUserTestOfJComboBoxConfigurableLookUp.java | ||
---|---|---|
1 |
package org.gvsig.gui.beans.comboboxconfigurablelookup.usertests; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.FlowLayout; |
|
6 |
import java.awt.Font; |
|
7 |
import java.awt.GridLayout; |
|
8 |
import java.awt.event.MouseAdapter; |
|
9 |
import java.awt.event.MouseEvent; |
|
10 |
import java.awt.event.WindowAdapter; |
|
11 |
import java.awt.event.WindowEvent; |
|
12 |
import java.io.BufferedReader; |
|
13 |
import java.io.File; |
|
14 |
import java.io.FileReader; |
|
15 |
import java.io.IOException; |
|
16 |
import java.io.OutputStream; |
|
17 |
import java.io.PrintStream; |
|
18 |
import java.io.Serializable; |
|
19 |
import java.lang.reflect.InvocationTargetException; |
|
20 |
import java.lang.reflect.Method; |
|
21 |
import java.util.HashMap; |
|
22 |
import java.util.Map; |
|
23 |
import java.util.StringTokenizer; |
|
24 |
import java.util.Vector; |
|
25 |
|
|
26 |
import javax.swing.BorderFactory; |
|
27 |
import javax.swing.JButton; |
|
28 |
import javax.swing.JCheckBox; |
|
29 |
import javax.swing.JComboBox; |
|
30 |
import javax.swing.JFrame; |
|
31 |
import javax.swing.JLabel; |
|
32 |
import javax.swing.JOptionPane; |
|
33 |
import javax.swing.JPanel; |
|
34 |
import javax.swing.JScrollPane; |
|
35 |
import javax.swing.JTabbedPane; |
|
36 |
import javax.swing.JTextArea; |
|
37 |
import javax.swing.JTextField; |
|
38 |
import javax.swing.border.TitledBorder; |
|
39 |
import javax.swing.event.ListDataEvent; |
|
40 |
import javax.swing.event.ListDataListener; |
|
41 |
import javax.swing.event.PopupMenuEvent; |
|
42 |
import javax.swing.event.PopupMenuListener; |
|
43 |
|
|
44 |
import org.gvsig.gui.beans.Messages; |
|
45 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.DefaultComboBoxConfigurableLookUpModel; |
|
46 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.JComboBoxConfigurableLookUp; |
|
47 |
import org.gvsig.gui.beans.comboboxconfigurablelookup.programmertests.SampleBasicComboBoxRenderer; |
|
48 |
|
|
49 |
|
|
50 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
51 |
* |
|
52 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
53 |
* |
|
54 |
* This program is free software; you can redistribute it and/or |
|
55 |
* modify it under the terms of the GNU General Public License |
|
56 |
* as published by the Free Software Foundation; either version 2 |
|
57 |
* of the License, or (at your option) any later version. |
|
58 |
* |
|
59 |
* This program is distributed in the hope that it will be useful, |
|
60 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
61 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
62 |
* GNU General Public License for more details. |
|
63 |
* |
|
64 |
* You should have received a copy of the GNU General Public License |
|
65 |
* along with this program; if not, write to the Free Software |
|
66 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
67 |
* |
|
68 |
* For more information, contact: |
|
69 |
* |
|
70 |
* Generalitat Valenciana |
|
71 |
* Conselleria d'Infraestructures i Transport |
|
72 |
* Av. Blasco Ib??ez, 50 |
|
73 |
* 46010 VALENCIA |
|
74 |
* SPAIN |
|
75 |
* |
|
76 |
* +34 963862235 |
|
77 |
* gvsig@gva.es |
|
78 |
* www.gvsig.gva.es |
|
79 |
* |
|
80 |
* or |
|
81 |
* |
|
82 |
* IVER T.I. S.A |
|
83 |
* Salamanca 50 |
|
84 |
* 46005 Valencia |
|
85 |
* Spain |
|
86 |
* |
|
87 |
* +34 963163400 |
|
88 |
* dac@iver.es |
|
89 |
*/ |
|
90 |
|
|
91 |
/** |
|
92 |
* <p>Application for testing <code>JComboBoxLookUpConfigurable</code> objects.</p> |
|
93 |
* |
|
94 |
* <p>This class is a JPanel and has other classes nested.</p> |
|
95 |
* |
|
96 |
* @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) |
|
97 |
* @version 07/02/2008 |
|
98 |
*/ |
|
99 |
public class JPanelUserTestOfJComboBoxConfigurableLookUp extends JPanel implements Serializable { |
|
100 |
private static final long serialVersionUID = -8900802197326194647L; |
|
101 |
|
|
102 |
private final int panelWidth = 735; |
|
103 |
private final int panelHeight = 580; |
|
104 |
private final int testWidth = 260; |
|
105 |
private ConfigurationJPanel configurationPanel = null; |
|
106 |
private OtherTestsJPanel otherTestsPanel = null; |
|
107 |
private JavaFileMethodsLoader javaFileMethodsLoader; |
|
108 |
private int testNumber; |
|
109 |
private String path; |
|
110 |
private boolean isConfiguring; |
|
111 |
|
|
112 |
private static final short DEFAULT_CELL_RENDERER = 0; |
|
113 |
private static final short SAMPLE_BG_COLOR_CELL_RENDERER = 1; |
|
114 |
|
|
115 |
/** |
|
116 |
* <p>Default constructor.</p> |
|
117 |
*/ |
|
118 |
public JPanelUserTestOfJComboBoxConfigurableLookUp() { |
|
119 |
super(); |
|
120 |
this.initialize(); |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* <p>Initializes the application pane.</p> |
|
125 |
*/ |
|
126 |
private void initialize() { |
|
127 |
path = "src/org/gvsig/gui/beans/comboboxconfigurablelookup/JComboBoxConfigurableLookUp.java"; |
|
128 |
isConfiguring = false; |
|
129 |
this.setPreferredSize(new Dimension(panelWidth, panelHeight)); |
|
130 |
this.setSize(new Dimension(panelWidth, panelHeight)); |
|
131 |
FlowLayout flowLayout = new FlowLayout(); |
|
132 |
flowLayout.setAlignment(FlowLayout.LEFT); |
|
133 |
this.setLayout(flowLayout); |
|
134 |
this.add(this.getConfigurationPanel()); |
|
135 |
this.add(this.getOtherTestsPanel()); |
|
136 |
this.loadPublicMethods(); |
|
137 |
this.redirectDebugAndErrorMessages(); |
|
138 |
testNumber = 1; |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* <p>Loads public methods of the <code>JComboBoxConfigurableLookUp</code> from its file class and adds the constructors to the |
|
143 |
* inner <code>ConfigurationPanel</code> and the other methods to the <code>OtherTestsPanel</code>.</p> |
|
144 |
*/ |
|
145 |
private void loadPublicMethods() { |
|
146 |
String methodHead; |
|
147 |
String reservedWord = new String("public "); |
|
148 |
int reservedWordLength = reservedWord.length(); |
|
149 |
|
|
150 |
for (int i = 0; i < javaFileMethodsLoader.size(); i++) |
|
151 |
{ |
|
152 |
methodHead = javaFileMethodsLoader.getMethodHead(i); |
|
153 |
if (methodHead.startsWith(reservedWord)) |
|
154 |
{ |
|
155 |
if (methodHead.startsWith(reservedWord + javaFileMethodsLoader.getClassName())) |
|
156 |
getConfigurationPanel().addConstructorItem(methodHead.substring(reservedWordLength, methodHead.length())); |
|
157 |
else |
|
158 |
getOtherTestsPanel().addMethodItem(methodHead.substring(reservedWordLength, methodHead.length())); |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* <p>Redirects the default output and error stream to the inner log <code>JTextArea</code>.</p> |
|
165 |
*/ |
|
166 |
private void redirectDebugAndErrorMessages() { |
|
167 |
// Now create a new TextAreaOutputStream to write to our JTextArea control and wrap a |
|
168 |
// PrintStream around it to support the println/printf methods. |
|
169 |
PrintStream out = new PrintStream( new TextAreaOutputStream( getOtherTestsPanel().getJTextAreaLog() ) ); |
|
170 |
|
|
171 |
// Redirect standard output stream to the TextAreaOutputStream |
|
172 |
System.setOut( out ); |
|
173 |
|
|
174 |
// Redirect standard error stream to the TextAreaOutputStream |
|
175 |
System.setErr( out ); |
|
176 |
} |
|
177 |
|
|
178 |
/** |
|
179 |
* <p>This method initializes <code>configurationPanel</code>.</p> |
|
180 |
* |
|
181 |
* @return javax.swing.JComboBoxItemsSeekerConfigurableTestingByTheUserConfigurationPanel |
|
182 |
*/ |
|
183 |
private ConfigurationJPanel getConfigurationPanel() { |
|
184 |
if (configurationPanel == null) { |
|
185 |
configurationPanel = new ConfigurationJPanel(); |
|
186 |
configurationPanel.getJButtonNew().addMouseListener(new MouseAdapter() { |
|
187 |
/* |
|
188 |
* (non-Javadoc) |
|
189 |
* @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) |
|
190 |
*/ |
|
191 |
public void mouseClicked(MouseEvent arg0) { |
|
192 |
addNewTestObject(); |
|
193 |
} |
|
194 |
}); |
|
195 |
} |
|
196 |
|
|
197 |
return configurationPanel; |
|
198 |
} |
|
199 |
|
|
200 |
/** |
|
201 |
* <p>This method initializes <code>otherTestsPanel</code>.<p> |
|
202 |
* |
|
203 |
* @return javax.swing.JComboBoxItemsSeekerConfigurableTestingByTheUserOtherTestsPanel |
|
204 |
*/ |
|
205 |
private OtherTestsJPanel getOtherTestsPanel() { |
|
206 |
if (this.otherTestsPanel == null) |
|
207 |
this.otherTestsPanel = new OtherTestsJPanel(path); |
|
208 |
|
|
209 |
return this.otherTestsPanel; |
|
210 |
} |
|
211 |
|
|
212 |
/** |
|
213 |
* <p>This method creates a JFrame with a new object for testing.</p> |
|
214 |
* <p>This method also defines the closing methods and the name of the <code>JFrame</code>, and add the <code>JFrame</code> to the <code>OtherTestPanel</code>; that panel. |
|
215 |
* will use it for do methods.</p> |
|
216 |
*/ |
|
217 |
private void addNewTestObject() { |
|
218 |
JComboBoxConfigurableLookUp object = this.createComponent(); |
|
219 |
object.setPreferredSize(new Dimension(testWidth, object.getPreferredSize().height)); |
|
220 |
String keyAndTitle = Messages.getText("test") + " " + String.valueOf(testNumber++); |
|
221 |
|
|
222 |
JFrame jFrame = new JFrame(keyAndTitle); |
|
223 |
jFrame.getContentPane().add(object); |
|
224 |
jFrame.pack(); |
|
225 |
jFrame.setVisible(true); |
|
226 |
|
|
227 |
// Centers the JFrame in the middle of the screen |
|
228 |
jFrame.setLocationRelativeTo(null); |
|
229 |
|
|
230 |
// Defines the methods that will have to do the JFrame when it would have to be closed |
|
231 |
jFrame.addWindowListener(new WindowAdapter(){ |
|
232 |
|
|
233 |
/* |
|
234 |
* (non-Javadoc) |
|
235 |
* @see java.awt.event.WindowAdapter#windowClosed(java.awt.event.WindowEvent) |
|
236 |
*/ |
|
237 |
public void windowClosed(WindowEvent e) { |
|
238 |
// It's executen when the application closes the JFrame |
|
239 |
getOtherTestsPanel().removeTestObject(((JFrame)e.getSource()).getTitle()); |
|
240 |
getOtherTestsPanel().getJTextAreaLog().append('(' + ((JFrame)e.getSource()).getTitle() + ", " + Messages.getText("elimination") + ")\n"); |
|
241 |
} |
|
242 |
|
|
243 |
/* |
|
244 |
* (non-Javadoc) |
|
245 |
* @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent) |
|
246 |
*/ |
|
247 |
public void windowClosing(WindowEvent e) { |
|
248 |
// It's executen when the user closes the JFrame |
|
249 |
getOtherTestsPanel().removeTestObject(((JFrame)e.getSource()).getTitle()); |
|
250 |
getOtherTestsPanel().getJTextAreaLog().append('(' + ((JFrame)e.getSource()).getTitle() + ", " + Messages.getText("elimination") + ")\n"); |
|
251 |
} |
|
252 |
}); |
|
253 |
|
|
254 |
this.getOtherTestsPanel().addTestObject(keyAndTitle, jFrame); |
|
255 |
} |
|
256 |
|
|
257 |
|
|
258 |
/** |
|
259 |
* <p>Obtains the configuration value for create the new object and creates it.</p> |
|
260 |
* |
|
261 |
* @return JComboBoxConfigurableLookUp The new object created |
|
262 |
*/ |
|
263 |
private JComboBoxConfigurableLookUp createComponent() { |
|
264 |
JComboBoxConfigurableLookUp comboBox = null; |
|
265 |
String argument = ""; |
|
266 |
|
|
267 |
// ESTA PARTE CREA EL OBJETO, AVISA DE QUE EN CASO NECESARIO PONDR? UN PAR?METRO PREESTABLECIDO, Y ALMACENA EL TEXTO ACERCA |
|
268 |
// DEL PAR?METRO QUE PONDR? LUEGO EN EL LOG |
|
269 |
switch(getConfigurationPanel().getSelectedComboBoxConstructor()) { |
|
270 |
case 0: |
|
271 |
comboBox = new JComboBoxConfigurableLookUp(); |
|
272 |
break; |
|
273 |
case 1: |
|
274 |
JOptionPane.showMessageDialog(null, Messages.getText("will_use_a_default_model"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE); |
|
275 |
DefaultComboBoxConfigurableLookUpModel model = new DefaultComboBoxConfigurableLookUpModel(new Object[] {"Item1", "Item2", "Item3", "Item4", "Item5"}); |
|
276 |
comboBox = new JComboBoxConfigurableLookUp(model); |
|
277 |
argument = "model; "; |
|
278 |
break; |
|
279 |
case 2: |
|
280 |
JOptionPane.showMessageDialog(null, Messages.getText("will_use_a_default_array_of_items"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE); |
|
281 |
comboBox = new JComboBoxConfigurableLookUp(new Object[] {"Item1", "Item2", "Item3", "Item4", "Item5"}); |
|
282 |
argument = "array; "; |
|
283 |
break; |
|
284 |
case 3: |
|
285 |
JOptionPane.showMessageDialog(null, Messages.getText("will_use_a_default_vector_of_items"), Messages.getText("warning"), JOptionPane.WARNING_MESSAGE); |
|
286 |
Vector<Object> vector = new Vector<Object>(); |
|
287 |
vector.add("Item1"); |
|
288 |
vector.add("Item2"); |
|
289 |
vector.add("Item3"); |
|
290 |
vector.add("Item4"); |
|
291 |
vector.add("Item5"); |
|
292 |
comboBox = new JComboBoxConfigurableLookUp(vector); |
|
293 |
argument = "vector; "; |
|
294 |
break; |
|
295 |
default: |
|
296 |
comboBox = new JComboBoxConfigurableLookUp(); |
|
297 |
} |
|
298 |
|
|
299 |
DefaultComboBoxConfigurableLookUpModel model = (DefaultComboBoxConfigurableLookUpModel)comboBox.getModel(); |
|
300 |
String itemsOrderText = null; |
|
301 |
String languageRule = null; |
|
302 |
String cellRenderer = getConfigurationPanel().getSelectedComboBoxCellRenderer(); |
|
303 |
|
Also available in: Unified diff