FR [ 2552854 ] Combobox AutoCompletion should ignore diacritics

https://sourceforge.net/tracker/?func=detail&aid=2552854&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-04-29 06:42:18 +00:00
parent ce9c30c56e
commit e3ff98f1ff
1 changed files with 6 additions and 3 deletions

View File

@ -33,6 +33,7 @@ import org.compiere.swing.CComboBox;
* <li>BF [ 1735043 ] AutoCompletion: drop down box is showed even if i press Caps * <li>BF [ 1735043 ] AutoCompletion: drop down box is showed even if i press Caps
* <li>FR [ 1820783 ] AutoCompletion: posibility to toggle strict mode * <li>FR [ 1820783 ] AutoCompletion: posibility to toggle strict mode
* <li>BF [ 1820778 ] ESC(cancel editing) key not working if you are on VComboBox * <li>BF [ 1820778 ] ESC(cancel editing) key not working if you are on VComboBox
* <li>FR [ 2552854 ] Combobox AutoCompletion should ignore diacritics
*/ */
public class AutoCompletion extends PlainDocument { public class AutoCompletion extends PlainDocument {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -262,13 +263,15 @@ public class AutoCompletion extends PlainDocument {
} }
/** /**
* Checks if str1 starts with str2 (ignores case) * Checks if str1 starts with str2 (ignores case, trim whitespaces, strip diacritics)
* @param str1 * @param str1
* @param str2 * @param str2
* @return true if str1 starts with str2 * @return true if str1 starts with str2
*/ */
private boolean startsWithIgnoreCase(String str1, String str2) { protected boolean startsWithIgnoreCase(String str1, String str2) {
return str1.toUpperCase().startsWith(str2.toUpperCase()); String s1 = org.compiere.util.Util.stripDiacritics(str1.toUpperCase()).trim();
String s2 = org.compiere.util.Util.stripDiacritics(str2.toUpperCase()).trim();
return s1.startsWith(s2);
} }
} }