public class AutoCompleteDocument
extends java.lang.Object
implements javax.swing.text.Document
Modifier and Type | Field and Description |
---|---|
protected javax.swing.text.Document |
delegate |
protected boolean |
strictMatching
true, if only items from the adaptors's list can be entered
false, otherwise (selected item might not be in the adaptors's list)
|
Constructor and Description |
---|
AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor,
boolean strictMatching)
Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor.
|
AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor,
boolean strictMatching,
ObjectToStringConverter stringConverter)
Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor.
|
AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor,
boolean strictMatching,
ObjectToStringConverter stringConverter,
javax.swing.text.Document delegate)
Creates a new AutoCompleteDocument for the given AbstractAutoCompleteAdaptor.
|
Modifier and Type | Method and Description |
---|---|
void |
addDocumentListener(javax.swing.event.DocumentListener listener) |
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener listener) |
protected javax.swing.text.Document |
createDefaultDocument()
Creates the default backing document when no delegate is passed to this
document.
|
javax.swing.text.Position |
createPosition(int offs) |
javax.swing.text.Element |
getDefaultRootElement() |
javax.swing.text.Position |
getEndPosition() |
int |
getLength() |
java.lang.Object |
getProperty(java.lang.Object key) |
javax.swing.text.Element[] |
getRootElements() |
javax.swing.text.Position |
getStartPosition() |
java.lang.String |
getText(int offset,
int length) |
void |
getText(int offset,
int length,
javax.swing.text.Segment txt) |
void |
insertString(int offs,
java.lang.String str,
javax.swing.text.AttributeSet a) |
boolean |
isStrictMatching()
Returns if only items from the adaptor's list should be allowed to be entered.
|
void |
putProperty(java.lang.Object key,
java.lang.Object value) |
void |
remove(int offs,
int len) |
void |
removeDocumentListener(javax.swing.event.DocumentListener listener) |
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener listener) |
void |
render(java.lang.Runnable r) |
protected boolean strictMatching
protected final javax.swing.text.Document delegate
public AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter, javax.swing.text.Document delegate)
adaptor
- The adaptor that will be used to find and select matching
items.strictMatching
- true, if only items from the adaptor's list should
be allowed to be enteredstringConverter
- the converter used to transform items to stringsdelegate
- the Document
delegate backing this documentpublic AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter)
adaptor
- The adaptor that will be used to find and select matching
items.strictMatching
- true, if only items from the adaptor's list should
be allowed to be enteredstringConverter
- the converter used to transform items to stringspublic AutoCompleteDocument(AbstractAutoCompleteAdaptor adaptor, boolean strictMatching)
strictMatching
- true, if only items from the adaptor's list should
be allowed to be enteredadaptor
- The adaptor that will be used to find and select matching
items.protected javax.swing.text.Document createDefaultDocument()
public void remove(int offs, int len) throws javax.swing.text.BadLocationException
remove
in interface javax.swing.text.Document
javax.swing.text.BadLocationException
public void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet a) throws javax.swing.text.BadLocationException
insertString
in interface javax.swing.text.Document
javax.swing.text.BadLocationException
public void addDocumentListener(javax.swing.event.DocumentListener listener)
addDocumentListener
in interface javax.swing.text.Document
public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
addUndoableEditListener
in interface javax.swing.text.Document
public javax.swing.text.Position createPosition(int offs) throws javax.swing.text.BadLocationException
createPosition
in interface javax.swing.text.Document
javax.swing.text.BadLocationException
public javax.swing.text.Element getDefaultRootElement()
getDefaultRootElement
in interface javax.swing.text.Document
public javax.swing.text.Position getEndPosition()
getEndPosition
in interface javax.swing.text.Document
public int getLength()
getLength
in interface javax.swing.text.Document
public java.lang.Object getProperty(java.lang.Object key)
getProperty
in interface javax.swing.text.Document
public javax.swing.text.Element[] getRootElements()
getRootElements
in interface javax.swing.text.Document
public javax.swing.text.Position getStartPosition()
getStartPosition
in interface javax.swing.text.Document
public java.lang.String getText(int offset, int length) throws javax.swing.text.BadLocationException
getText
in interface javax.swing.text.Document
javax.swing.text.BadLocationException
public void getText(int offset, int length, javax.swing.text.Segment txt) throws javax.swing.text.BadLocationException
getText
in interface javax.swing.text.Document
javax.swing.text.BadLocationException
public void putProperty(java.lang.Object key, java.lang.Object value)
putProperty
in interface javax.swing.text.Document
public void removeDocumentListener(javax.swing.event.DocumentListener listener)
removeDocumentListener
in interface javax.swing.text.Document
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
removeUndoableEditListener
in interface javax.swing.text.Document
public void render(java.lang.Runnable r)
render
in interface javax.swing.text.Document
public boolean isStrictMatching()