Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 1.6.3
    • Component/s: Autocomplete
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      464

      Description

      I use AutoCompleteDecorator on a combobox that contains items with different
      cases like
      "Foo" and "foo". when typing 'f', the proposed choice is always 'Foo', no way to
      change the case, the upper case is forced. Note this happens as well on
      characters at every position.

        Activity

        Hide
        bierhance added a comment -

        This behaviour can certainly be annoying in some circumstances. Nevertheless,
        I'm filing this as an enhancement. There are two possible solutions:

        1. We could introduce a switch to turn case-sensitivity on and off. This would
        be really easy to implement, but is very restrictive at the same time.

        2. Matching case could be preferred over different case when comparing the
        user's input and the item string.

        I'll look into the second option first.

        Show
        bierhance added a comment - This behaviour can certainly be annoying in some circumstances. Nevertheless, I'm filing this as an enhancement. There are two possible solutions: 1. We could introduce a switch to turn case-sensitivity on and off. This would be really easy to implement, but is very restrictive at the same time. 2. Matching case could be preferred over different case when comparing the user's input and the item string. I'll look into the second option first.
        Hide
        bflorat added a comment -

        Yes, it is sometimes very anoying (see this jajuk ticket for more details:
        http://sourceforge.net/tracker/index.php?func=detail&aid=1639780&group_id=91412&atid=597086)

        I forget to add a detail: if the combo contains "foo" and "Foo", the combobox
        popup is blocked on "Foo" when using the down key.

        I agree on the second option. I think a better behavior could be to respect case
        at any position (first letter or not) if the same item exist in lower and upper
        case format. Keep the current behavior for others situations.

        Show
        bflorat added a comment - Yes, it is sometimes very anoying (see this jajuk ticket for more details: http://sourceforge.net/tracker/index.php?func=detail&aid=1639780&group_id=91412&atid=597086 ) I forget to add a detail: if the combo contains "foo" and "Foo", the combobox popup is blocked on "Foo" when using the down key. I agree on the second option. I think a better behavior could be to respect case at any position (first letter or not) if the same item exist in lower and upper case format. Keep the current behavior for others situations.
        Hide
        bflorat added a comment -

        Please considere this patch that fixes two very anoying problems (for me at least):
        o The exact-matching issue descibed on this ticket
        o Allow user to change case when typing

        The fix is very simple: a new "ignoreCase" flag on AutoCompleteDocument allows
        user to take case into account (by default, previous behavior is used)

            1. Eclipse Workspace Patch 1.0
              #P Swingx
              Index: src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java
              ===================================================================
              RCS file:
              /cvs/swingx/src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java,v
              retrieving revision 1.4
              diff -u -r1.4 AutoCompleteDocument.java
            • src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java 29 Jul
              2006 14:57:47 -0000 1.4
              +++ src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java 2 Mar
              2007 14:57:54 -0000
              @@ -44,6 +44,11 @@
              boolean strictMatching;

        /**
        + * true if the Autocompleting should ignore case (default)
        + */
        + boolean ignoreCase = true;
        +
        + /**

        • The adaptor that is used to find and select items.
          */
          AbstractAutoCompleteAdaptor adaptor;
          @@ -56,12 +61,14 @@
        • items.
        • @param strictMatching true, if only items from the adaptor's list should
        • be allowed to be entered
          + * @param ignoreCase true, if only items case should be ignored during searches
        • @param stringConverter the converter used to transform items to strings
          */
        • public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean
          strictMatching, ObjectToStringConverter stringConverter) {
          + public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean
          strictMatching, boolean ignoreCase, ObjectToStringConverter stringConverter) { this.adaptor = adaptor; this.strictMatching = strictMatching; this.stringConverter = stringConverter; + this.ignoreCase = ignoreCase; // Handle initially selected object Object selected = adaptor.getSelectedItem(); @@ -70,6 +77,19 @@ }

        /**
        + * Creates a new AutoCompleteDocument for the given
        AbstractAutoCompleteAdaptor (ignoring case).
        + * @param adaptor The adaptor that will be used to find and select matching
        + * items.
        + * @param strictMatching true, if only items from the adaptor's list should
        + * be allowed to be entered
        + * @param stringConverter the converter used to transform items to strings
        + */
        + public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean
        strictMatching, ObjectToStringConverter stringConverter)

        { + this(adaptor,strictMatching,true,stringConverter); + }

        +
        +
        + /**

        • Creates a new AutoCompleteDocument for the given
          AbstractAutoCompleteAdaptor.
        • @param strictMatching true, if only items from the adaptor's list should
        • be allowed to be entered
          @@ -158,7 +178,7 @@

        /**

        • Searches for an item that matches the given pattern. The
          AbstractAutoCompleteAdaptor
        • * is used to access the candidate items. The match is not case-sensitive
          + * is used to access the candidate items. The match is case-sensitive
        • and will only match at the beginning of each item's string representation.
        • @param pattern the pattern that should be matched
          @@ -176,8 +196,9 @@
          if (possibleStrings!=null) {
          // current item exactly matches the pattern?
          for (int j=0; j<possibleStrings.length; j++) {
        • if (possibleStrings[j].equalsIgnoreCase(pattern)) {
        • return new LookupResult(currentItem, possibleStrings[j]);
          + if ( ignoreCase ? possibleStrings[j].equalsIgnoreCase(pattern)
          + : possibleStrings[j].equals(pattern) ) { + return new LookupResult(currentItem, possibleStrings[j]); }

          }
          }
          @@ -185,8 +206,9 @@
          // check if the currently selected item matches
          possibleStrings = stringConverter.getPossibleStringsForItem(selectedItem);
          if (possibleStrings!=null) {

        • for (int i=0; i<possibleStrings.length; i++) {
        • if (startsWithIgnoreCase(possibleStrings[i], pattern)) {
          + for (int i=0; i<possibleStrings.length; i++)
          Unknown macro: {+ if (ignoreCase ? startsWithIgnoreCase(possibleStrings[i], pattern)+ }

          @@ -197,7 +219,8 @@
          possibleStrings =
          stringConverter.getPossibleStringsForItem(currentItem);
          if (possibleStrings!=null) {
          for (int j=0; j<possibleStrings.length; j++) {

        • if (startsWithIgnoreCase(possibleStrings[j], pattern))
          Unknown macro: {+ if (ignoreCase ? startsWithIgnoreCase(possibleStrings[j], pattern)+ }

          @@ -226,4 +249,16 @@
          if (base.length() < prefix.length()) return false;
          return base.regionMatches(true, 0, prefix, 0, prefix.length());
          }
          +
          + /**
          + * Returns true if <code>base</code> starts with <code>prefix</code>
          (taking case into account).
          + * @param base the string to be checked
          + * @param prefix the prefix to check for
          + * @return true if <code>base</code> starts with <code>prefix</code>; false
          otherwise
          + */
          + private boolean startsWith(String base, String prefix)

          { + if (base.length() < prefix.length()) return false; + return base.regionMatches(false, 0, prefix, 0, prefix.length()); + }

          +
          }
          Index: src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java
          ===================================================================
          RCS file:
          /cvs/swingx/src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java,v
          retrieving revision 1.9
          diff -u -r1.9 AutoCompleteDecorator.java

            • src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java 29 Jan
              2007 08:52:45 -0000 1.9
              +++ src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java 2 Mar
              2007 14:57:54 -0000
              @@ -77,6 +77,7 @@
              decorate(textComponent, items, strictMatching,
              ObjectToStringConverter.DEFAULT_IMPLEMENTATION);
              }

        +
        /**

        • Enables automatic completion for the given JTextComponent based on the
        • items contained in the given <tt>List</tt>.
          @@ -84,16 +85,30 @@
        • @param textComponent the text component that will be used for automatic
        • completion.
        • @param strictMatching <tt>true</tt>, if only given items should be
          allowed to be entered
          + * @param ignoreCase true, if only items case should be ignored during searches
        • @param stringConverter the converter used to transform items to strings
          */
        • public static void decorate(JTextComponent textComponent, List items,
          boolean strictMatching, ObjectToStringConverter stringConverter) {
          + public static void decorate(JTextComponent textComponent, List items,
          boolean strictMatching, boolean ignoreCase, ObjectToStringConverter
          stringConverter) { AbstractAutoCompleteAdaptor adaptor = new TextComponentAdaptor(textComponent, items); - AutoCompleteDocument document = new AutoCompleteDocument(adaptor, strictMatching, stringConverter); + AutoCompleteDocument document = new AutoCompleteDocument(adaptor, strictMatching, ignoreCase, stringConverter); decorate(textComponent, document, adaptor); }

        /**

        • Enables automatic completion for the given JTextComponent based on the
          + * items contained in the given <tt>List</tt> and ignoring case.
          + * @param items contains the items that are used for autocompletion
          + * @param textComponent the text component that will be used for automatic
          + * completion.
          + * @param strictMatching <tt>true</tt>, if only given items should be
          allowed to be entered
          + * @param stringConverter the converter used to transform items to strings
          + */
          + public static void decorate(JTextComponent textComponent, List items,
          boolean strictMatching, ObjectToStringConverter stringConverter) { + decorate(textComponent,items,strictMatching,true,stringConverter); + }

          +
          + /**
          + * Enables automatic completion for the given JTextComponent based on the

        • items contained in the given JList. The two components will be
        • synchronized. The automatic completion will always be strict.
        • @param list a <tt>JList</tt> containing the items for automatic completion
          @@ -120,13 +135,23 @@
          }

        /**

        • * Enables automatic completion for the given JComboBox. The automatic
          + * Enables automatic completion for the given JComboBox ignoring case.
          + * The automatic completion will be strict (only items from the combo box
          can be selected)
          + * if the combo box is not editable.
          + * @param comboBox a combo box
          + */
          + public static void decorate(final JComboBox comboBox, boolean ignoreCase) { + decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION, ignoreCase); + }

          +
          + /**
          + * Enables automatic completion for the given JComboBox (ignoring case)).
          The automatic

        • completion will be strict (only items from the combo box can be selected)
        • if the combo box is not editable.
        • @param comboBox a combo box
          */
          public static void decorate(final JComboBox comboBox) { - decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); + decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION, true); }

        /**
        @@ -135,8 +160,9 @@

        • if the combo box is not editable.
        • @param comboBox a combo box
        • @param stringConverter the converter used to transform items to strings
          + * @param ignoreCase true, if only items case should be ignored during searches
          */
        • public static void decorate(final JComboBox comboBox, final
          ObjectToStringConverter stringConverter) {
          + public static void decorate(final JComboBox comboBox, final
          ObjectToStringConverter stringConverter, boolean ignoreCase) {
          boolean strictMatching = !comboBox.isEditable();
          // has to be editable
          comboBox.setEditable(true);
          @@ -146,7 +172,7 @@
          // configure the text component=editor component
          JTextComponent editorComponent = (JTextComponent)
          comboBox.getEditor().getEditorComponent();
          final AbstractAutoCompleteAdaptor adaptor = new ComboBoxAdaptor(comboBox);
        • final AutoCompleteDocument document = new AutoCompleteDocument(adaptor,
          strictMatching, stringConverter);
          + final AutoCompleteDocument document = new AutoCompleteDocument(adaptor,
          strictMatching, ignoreCase, stringConverter);
          decorate(editorComponent, document, adaptor);

        // show the popup list when the user presses a key

        Show
        bflorat added a comment - Please considere this patch that fixes two very anoying problems (for me at least): o The exact-matching issue descibed on this ticket o Allow user to change case when typing The fix is very simple: a new "ignoreCase" flag on AutoCompleteDocument allows user to take case into account (by default, previous behavior is used) Eclipse Workspace Patch 1.0 #P Swingx Index: src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java =================================================================== RCS file: /cvs/swingx/src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java,v retrieving revision 1.4 diff -u -r1.4 AutoCompleteDocument.java src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java 29 Jul 2006 14:57:47 -0000 1.4 +++ src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDocument.java 2 Mar 2007 14:57:54 -0000 @@ -44,6 +44,11 @@ boolean strictMatching; /** + * true if the Autocompleting should ignore case (default) + */ + boolean ignoreCase = true; + + /** The adaptor that is used to find and select items. */ AbstractAutoCompleteAdaptor adaptor; @@ -56,12 +61,14 @@ items. @param strictMatching true, if only items from the adaptor's list should be allowed to be entered + * @param ignoreCase true, if only items case should be ignored during searches @param stringConverter the converter used to transform items to strings */ public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter) { + public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, boolean ignoreCase, ObjectToStringConverter stringConverter) { this.adaptor = adaptor; this.strictMatching = strictMatching; this.stringConverter = stringConverter; + this.ignoreCase = ignoreCase; // Handle initially selected object Object selected = adaptor.getSelectedItem(); @@ -70,6 +77,19 @@ } /** + * Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor (ignoring case). + * @param adaptor The adaptor that will be used to find and select matching + * items. + * @param strictMatching true, if only items from the adaptor's list should + * be allowed to be entered + * @param stringConverter the converter used to transform items to strings + */ + public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter) { + this(adaptor,strictMatching,true,stringConverter); + } + + + /** Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor. @param strictMatching true, if only items from the adaptor's list should be allowed to be entered @@ -158,7 +178,7 @@ /** Searches for an item that matches the given pattern. The AbstractAutoCompleteAdaptor * is used to access the candidate items. The match is not case-sensitive + * is used to access the candidate items. The match is case-sensitive and will only match at the beginning of each item's string representation. @param pattern the pattern that should be matched @@ -176,8 +196,9 @@ if (possibleStrings!=null) { // current item exactly matches the pattern? for (int j=0; j<possibleStrings.length; j++) { if (possibleStrings [j] .equalsIgnoreCase(pattern)) { return new LookupResult(currentItem, possibleStrings [j] ); + if ( ignoreCase ? possibleStrings [j] .equalsIgnoreCase(pattern) + : possibleStrings [j] .equals(pattern) ) { + return new LookupResult(currentItem, possibleStrings[j]); } } } @@ -185,8 +206,9 @@ // check if the currently selected item matches possibleStrings = stringConverter.getPossibleStringsForItem(selectedItem); if (possibleStrings!=null) { for (int i=0; i<possibleStrings.length; i++) { if (startsWithIgnoreCase(possibleStrings [i] , pattern)) { + for (int i=0; i<possibleStrings.length; i++) Unknown macro: {+ if (ignoreCase ? startsWithIgnoreCase(possibleStrings[i], pattern)+ } @@ -197,7 +219,8 @@ possibleStrings = stringConverter.getPossibleStringsForItem(currentItem); if (possibleStrings!=null) { for (int j=0; j<possibleStrings.length; j++) { if (startsWithIgnoreCase(possibleStrings [j] , pattern)) Unknown macro: {+ if (ignoreCase ? startsWithIgnoreCase(possibleStrings[j], pattern)+ } @@ -226,4 +249,16 @@ if (base.length() < prefix.length()) return false; return base.regionMatches(true, 0, prefix, 0, prefix.length()); } + + /** + * Returns true if <code>base</code> starts with <code>prefix</code> (taking case into account). + * @param base the string to be checked + * @param prefix the prefix to check for + * @return true if <code>base</code> starts with <code>prefix</code>; false otherwise + */ + private boolean startsWith(String base, String prefix) { + if (base.length() < prefix.length()) return false; + return base.regionMatches(false, 0, prefix, 0, prefix.length()); + } + } Index: src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java =================================================================== RCS file: /cvs/swingx/src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java,v retrieving revision 1.9 diff -u -r1.9 AutoCompleteDecorator.java src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java 29 Jan 2007 08:52:45 -0000 1.9 +++ src/java/org/jdesktop/swingx/autocomplete/AutoCompleteDecorator.java 2 Mar 2007 14:57:54 -0000 @@ -77,6 +77,7 @@ decorate(textComponent, items, strictMatching, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); } + /** Enables automatic completion for the given JTextComponent based on the items contained in the given <tt>List</tt>. @@ -84,16 +85,30 @@ @param textComponent the text component that will be used for automatic completion. @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered + * @param ignoreCase true, if only items case should be ignored during searches @param stringConverter the converter used to transform items to strings */ public static void decorate(JTextComponent textComponent, List items, boolean strictMatching, ObjectToStringConverter stringConverter) { + public static void decorate(JTextComponent textComponent, List items, boolean strictMatching, boolean ignoreCase, ObjectToStringConverter stringConverter) { AbstractAutoCompleteAdaptor adaptor = new TextComponentAdaptor(textComponent, items); - AutoCompleteDocument document = new AutoCompleteDocument(adaptor, strictMatching, stringConverter); + AutoCompleteDocument document = new AutoCompleteDocument(adaptor, strictMatching, ignoreCase, stringConverter); decorate(textComponent, document, adaptor); } /** Enables automatic completion for the given JTextComponent based on the + * items contained in the given <tt>List</tt> and ignoring case. + * @param items contains the items that are used for autocompletion + * @param textComponent the text component that will be used for automatic + * completion. + * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered + * @param stringConverter the converter used to transform items to strings + */ + public static void decorate(JTextComponent textComponent, List items, boolean strictMatching, ObjectToStringConverter stringConverter) { + decorate(textComponent,items,strictMatching,true,stringConverter); + } + + /** + * Enables automatic completion for the given JTextComponent based on the items contained in the given JList. The two components will be synchronized. The automatic completion will always be strict. @param list a <tt>JList</tt> containing the items for automatic completion @@ -120,13 +135,23 @@ } /** * Enables automatic completion for the given JComboBox. The automatic + * Enables automatic completion for the given JComboBox ignoring case. + * The automatic completion will be strict (only items from the combo box can be selected) + * if the combo box is not editable. + * @param comboBox a combo box + */ + public static void decorate(final JComboBox comboBox, boolean ignoreCase) { + decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION, ignoreCase); + } + + /** + * Enables automatic completion for the given JComboBox (ignoring case)). The automatic completion will be strict (only items from the combo box can be selected) if the combo box is not editable. @param comboBox a combo box */ public static void decorate(final JComboBox comboBox) { - decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); + decorate(comboBox, ObjectToStringConverter.DEFAULT_IMPLEMENTATION, true); } /** @@ -135,8 +160,9 @@ if the combo box is not editable. @param comboBox a combo box @param stringConverter the converter used to transform items to strings + * @param ignoreCase true, if only items case should be ignored during searches */ public static void decorate(final JComboBox comboBox, final ObjectToStringConverter stringConverter) { + public static void decorate(final JComboBox comboBox, final ObjectToStringConverter stringConverter, boolean ignoreCase) { boolean strictMatching = !comboBox.isEditable(); // has to be editable comboBox.setEditable(true); @@ -146,7 +172,7 @@ // configure the text component=editor component JTextComponent editorComponent = (JTextComponent) comboBox.getEditor().getEditorComponent(); final AbstractAutoCompleteAdaptor adaptor = new ComboBoxAdaptor(comboBox); final AutoCompleteDocument document = new AutoCompleteDocument(adaptor, strictMatching, stringConverter); + final AutoCompleteDocument document = new AutoCompleteDocument(adaptor, strictMatching, ignoreCase, stringConverter); decorate(editorComponent, document, adaptor); // show the popup list when the user presses a key
        Hide
        bflorat added a comment -

        Hi, any progress with this patch ?

        Show
        bflorat added a comment - Hi, any progress with this patch ?
        Hide
        Karl Schaefer added a comment -

        Postponing all AutoComplete items.

        As for the patch, because it's over 20 lines, we need to have a signed JCA/SCA
        before we can use it.

        Show
        Karl Schaefer added a comment - Postponing all AutoComplete items. As for the patch, because it's over 20 lines, we need to have a signed JCA/SCA before we can use it.
        Hide
        bflorat added a comment -

        No problem for JCA/SCA agreement, just tell me what to do.

        Show
        bflorat added a comment - No problem for JCA/SCA agreement, just tell me what to do.
        Hide
        Karl Schaefer added a comment -

        Please follow the directions at the bottom of this page:
        http://swinglabs.org/docs/project/contribute.jsp

        If you have any questions, please post to the forum, so that anyone may answer.

        Show
        Karl Schaefer added a comment - Please follow the directions at the bottom of this page: http://swinglabs.org/docs/project/contribute.jsp If you have any questions, please post to the forum, so that anyone may answer.
        Hide
        apique added a comment -

        I have the same problem. I have a combobox with "INDEX" and "index" values and
        even if I click on "index", "INDEX" is selected.
        It should not be fully case sensitive, when there is several valid choices case
        should be use.
        The AutoCompleteDocument.lookupItem method could try case sensitive first, then
        not case sensitive.

        P.S.: Sorry, english is not my first language...

        Show
        apique added a comment - I have the same problem. I have a combobox with "INDEX" and "index" values and even if I click on "index", "INDEX" is selected. It should not be fully case sensitive, when there is several valid choices case should be use. The AutoCompleteDocument.lookupItem method could try case sensitive first, then not case sensitive. P.S.: Sorry, english is not my first language...
        Hide
        bierhance added a comment - - edited

        Proposed Fix that prefers matching case. Hence, no additional switch for case sensitivity is needed.

        Show
        bierhance added a comment - - edited Proposed Fix that prefers matching case. Hence, no additional switch for case sensitivity is needed.
        Hide
        bierhance added a comment -

        Hi Karl! I attached a fix for this issue. Would you mind to review the patch? Assign back to me when you either have no time for the review or once done reviewing. Thanks a bunch. Thomas

        Show
        bierhance added a comment - Hi Karl! I attached a fix for this issue. Would you mind to review the patch? Assign back to me when you either have no time for the review or once done reviewing. Thanks a bunch. Thomas
        Hide
        bierhance added a comment -

        Manual test case

        Show
        bierhance added a comment - Manual test case
        Hide
        Karl Schaefer added a comment -

        Thomas, everything seems to be working fine, but do not make the Comparator's public because the implemetations are broken. If EQUALS_IGNORE_CASE.compare(s1, s2) !=0, then EQUALS_IGNORE_CASE.compare(s1, s2) == -EQUALS_IGNORE_CASE.compare(s2, s1), but it doesn't. I would document the brokenness (or fix them, but that really adds a bunch of weight that we don't need), but keep them in the default scope. It might even be better to place them in the AutoComplete class, which I have been using as a place to collect some package-private code.

        Furthermore, keeping that internal for now will benefit us, because we will have the chance to change our minds/improve upon this groundwork for SWINGX-739, giving the users the option of a startsWith or a contains.

        Show
        Karl Schaefer added a comment - Thomas, everything seems to be working fine, but do not make the Comparator's public because the implemetations are broken. If EQUALS_IGNORE_CASE.compare(s1, s2) !=0, then EQUALS_IGNORE_CASE.compare(s1, s2) == -EQUALS_IGNORE_CASE.compare(s2, s1), but it doesn't. I would document the brokenness (or fix them, but that really adds a bunch of weight that we don't need), but keep them in the default scope. It might even be better to place them in the AutoComplete class, which I have been using as a place to collect some package-private code. Furthermore, keeping that internal for now will benefit us, because we will have the chance to change our minds/improve upon this groundwork for SWINGX-739 , giving the users the option of a startsWith or a contains.
        Hide
        bierhance added a comment -

        Revision: 3944
        Author: bierhance
        Date: 2011-03-04 16:33
        Message: Auto completion now prefers matching case. Comments from the review by Karl Schaefer were incorporated.
        Issue #SWINGX-464 - AutoCompleteDecorator forces case

        Show
        bierhance added a comment - Revision: 3944 Author: bierhance Date: 2011-03-04 16:33 Message: Auto completion now prefers matching case. Comments from the review by Karl Schaefer were incorporated. Issue # SWINGX-464 - AutoCompleteDecorator forces case
        Hide
        bflorat added a comment -

        Hi there, congratulations for 1.6.3.

        I just tried the 1.6.3 build (BTW, I spent more half an hour crawling on around ten or more swingx websites /maven repository website/ tickets systems and finally found in some obscure forum thread that the artifact download is available from the Swingx Nexus at [1] , I guess the download link is not that obvious or is it me ?)

        Unfortunately, the bug is still there (or is it a similar one?) . For instance, I have in my list : "Unknown",
        I type : "U n K" , swingx forces : "U n k" instead so I cannot type "UnKown", "Unknown" is forced.

        I am thus stuck for now with my fix (see my code previously posted on this ticket).

        Thanks for consideration.

        [1] https://maven.java.net/index.html#nexus-search;quick~swingx

        Show
        bflorat added a comment - Hi there, congratulations for 1.6.3. I just tried the 1.6.3 build (BTW, I spent more half an hour crawling on around ten or more swingx websites /maven repository website/ tickets systems and finally found in some obscure forum thread that the artifact download is available from the Swingx Nexus at [1] , I guess the download link is not that obvious or is it me ?) Unfortunately, the bug is still there (or is it a similar one?) . For instance, I have in my list : "Unknown", I type : "U n K" , swingx forces : "U n k" instead so I cannot type "UnKown", "Unknown" is forced. I am thus stuck for now with my fix (see my code previously posted on this ticket). Thanks for consideration. [1] https://maven.java.net/index.html#nexus-search;quick~swingx
        Hide
        Karl Schaefer added a comment -

        Hmm, well SwingX is available via Maven Central, so I'm not sure what all that hullabaloo is about. You should be able to get it from there always.

        To the point at hand of this bug: I think the solution if for differentating between two different, but similar provided options. I think that's the correct solution.

        What you're describing is non-strict matching should allow for case variant of potential matches to be manually added, yes? If so, then we'd need a completely different mechanism, such that we match exact for case, so you would no longer be able to type 'f' to get 'Foo' even if 'Foo' were the only item beginning with 'f'. I think that could get really confusing.

        Show
        Karl Schaefer added a comment - Hmm, well SwingX is available via Maven Central, so I'm not sure what all that hullabaloo is about. You should be able to get it from there always. To the point at hand of this bug: I think the solution if for differentating between two different, but similar provided options. I think that's the correct solution. What you're describing is non-strict matching should allow for case variant of potential matches to be manually added, yes? If so, then we'd need a completely different mechanism, such that we match exact for case, so you would no longer be able to type 'f' to get 'Foo' even if 'Foo' were the only item beginning with 'f'. I think that could get really confusing.

          People

          • Assignee:
            bierhance
            Reporter:
            bflorat
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: