Class AutoCompletion

  • All Implemented Interfaces:
    Serializable, Document

    public class AutoCompletion
    extends PlainDocument
    Auto completion behaviour for a combo box
    Author:
    phib: this is from http://www.orbital-computer.de/JComboBox with some minor revisions for Adempiere, Teo Sarca, SC ARHIPAC SERVICE SRL
  • BF [ 1735043 ] AutoCompletion: drop down box is showed even if i press Caps
  • FR [ 1820783 ] AutoCompletion: posibility to toggle strict mode
  • BF [ 1820778 ] ESC(cancel editing) key not working if you are on VComboBox
  • BF [ 1898001 ] AutoComplete: Exception when selecting a text
  • FR [ 2552854 ] Combobox AutoCompletion should ignore diacritics, tobi42, www.metas.de
  • BF [ 2861223 ] AutoComplete: Ignoring Whitespace in Search String
  • See Also:
    Serialized Form
    • Constructor Detail

    • Method Detail

      • enable

        public static void enable​(CComboBox<Object> comboBox)
        Enable auto completion for a combo box (strict mode)
        Parameters:
        comboBox -
      • enable

        public static void enable​(CComboBox<Object> comboBox,
                                  boolean strictMode)
        Enable auto completion for a combo box
        Parameters:
        comboBox -
        strictMode - true if you want to set strict mode
      • setText

        public void setText​(String text)
        Set text
        Parameters:
        text -
      • setStrictMode

        public void setStrictMode​(boolean mode)
        Set strict mode. If the strict mode is enabled, you can't enter any other values than the ones from combo box list.
        Parameters:
        mode - true if strict mode
      • startsWithIgnoreCase

        protected boolean startsWithIgnoreCase​(String str1,
                                               String str2)
        Checks if str1 starts with str2 (ignores case, trim leading whitespaces, strip diacritics)
        Parameters:
        str1 -
        str2 -
        Returns:
        true if str1 starts with str2