Revision: 1311
Author: mathiasbr
Date: 2006-08-18 15:02:47 -0700 (Fri, 18 Aug 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1311&view=rev
Log Message:
-----------
selecting the value if autocompletion is already selecting it causes stack
overflow
Modified Paths:
--------------
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/list/ComboBoxAutoCompletion.java
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/list/ComboBoxAutoCompletion.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/list/ComboBoxAutoCompletion.java
2006-08-18 15:38:19 UTC (rev 1310)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/list/ComboBoxAutoCompletion.java
2006-08-18 22:02:47 UTC (rev 1311)
@@ -59,6 +59,8 @@
private ComboBoxModel model;
+ private boolean selectingValue;
+
/**
* Adds autocompletion support to the given <code>JComboBox</code>.
*
@@ -126,6 +128,8 @@
// ignore empty insert
if (str == null || str.length() == 0)
return;
+ if(selectingValue)
+ return;
// check offset position
if (offs < 0 || offs > getLength())
throw new BadLocationException("Invalid offset - must be >= 0 and
<= " + getLength(), offs);
@@ -139,7 +143,12 @@
// lookup and select a matching item
Object item = lookupItem(futureText);
if (item != null) {
- comboBox.setSelectedItem(item);
+ selectingValue = true;
+ try {
+ comboBox.setSelectedItem(item);
+ } finally {
+ selectingValue = false;
+ }
}
else {
// keep old item selected if there is no match
@@ -282,7 +291,8 @@
}
public void contentsChanged(ListDataEvent e) {
- fillItem2StringMap();
+ if(!selectingValue)
+ fillItem2StringMap();
}
public void intervalAdded(ListDataEvent e) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs