AutoComplete Combobox usage and requirements

asked 2013-03-15 16:59:30 +0800

kbsimm gravatar image kbsimm

This forum entry is long. It discuses AutoComplete Combobox, what behavior exists and what behavior should exist. It is a precursor to me submitting a change request and/or bug report. Your opinions are appreciated.

As is well known a Combobox can be made to AutoComplete by setting the model to a SimpleListModel as follows:

Combobox someCombobox = new Combobox();
someComboBox.setModel(new SimpleListModel(...List data...);

This results in a Combobox which provides the following "features":

  1. No values are displayed or are available for selection until the user types one or more characters.
  2. When a user types a character the list is restricted to only those values beginning with the typed characters.
  3. The list is hardcoded to the limit of 15 List entries via the Combobox.syncModel method which calls getSubModel(index, -1)
  4. someComboBox.setAutocomplete(false) does not work. (ie Autocompete still functions when this is set to false) A previous version has a bug report on this ... see this tracker entry

It is my opinion that the implementation is flawed as follows:

  1. If a user calls combobox.setButtonVisable(true) then selecting the button should dropdown the list showing all values. If the user calls setButtonVisable(false) force setAutodrop(true) and only show subList when characters are typed.
  2. Create an optional model/method to not narrow the list but rather scroll the list to value beginning with typed characters. ie given the list apple, apricot, banana, pear; typing "b" would scroll to banana but not eliminate the other selections.
  3. Eliminate the hardcoded limit of 15 List entries. Show all List entries regardless of List size with the option of adding a an optional limit. Reason: The concept of limiting a list without expressly telling the user you have limited it is bad UI design. If the list is "abacus", "abase", "abate", "abbess", "abbey", "abbot", "abdicate", "abdomen", "abdominal" and the limit is 3 and the user types a and sees only the first three the user has no reason to believe that anymore then 3 values exist.
  4. Fix setAutocomplete(false)
  5. Implement performance improvements in the implementation of getSubModel

Showing all values on selection of the dropdown in Autocomplete was previously discussed here. I will post a partial solution there.

Interestingly enough the tags UI element here in the forum appears to be using autocomplete combobox. The list limits to 15 but it shows the values if a space is typed so was it customized? Also interesting, there is a check on the tags UI component that limits chars to 20 but there are tag in the list that are longer then 20 chars

Finally is this forum the correct place to have discussions such as this?

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2013-03-15 16:59:30 +0800

Seen: 32 times

Last updated: Mar 15 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More