Package org.compiere.grid.ed
Class AutoCompletion
- java.lang.Object
-
- javax.swing.text.AbstractDocument
-
- javax.swing.text.PlainDocument
-
- org.compiere.grid.ed.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
-
-
Field Summary
-
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
-
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
-
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
-
-
Constructor Summary
Constructors Constructor Description AutoCompletion(CComboBox<Object> comboBox)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
enable(CComboBox<Object> comboBox)
Enable auto completion for a combo box (strict mode)static void
enable(CComboBox<Object> comboBox, boolean strictMode)
Enable auto completion for a combo boxvoid
insertString(int offs, String str, AttributeSet a)
void
remove(int offs, int len)
void
setStrictMode(boolean mode)
Set strict mode.void
setText(String text)
Set textprotected boolean
startsWithIgnoreCase(String str1, String str2)
Checks if str1 starts with str2 (ignores case, trim leading whitespaces, strip diacritics)-
Methods inherited from class javax.swing.text.PlainDocument
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
-
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
-
-
-
-
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
-
remove
public void remove(int offs, int len) throws BadLocationException
- Specified by:
remove
in interfaceDocument
- Overrides:
remove
in classAbstractDocument
- Throws:
BadLocationException
-
insertString
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
- Specified by:
insertString
in interfaceDocument
- Overrides:
insertString
in classPlainDocument
- Throws:
BadLocationException
-
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
-
-