public class JComboBoxConfigurableLookUp.PlainDocumentTextFormatter extends PlainDocument
Inner class that inherits of the class PlainDocument, and is used for manipulate the textWritten that has the document of the editor of this component.
This class is also optimized for items look up process.
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
lineLimitAttribute, tabSizeAttribute
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
StreamDescriptionProperty, TitleProperty
Constructor and Description |
---|
JComboBoxConfigurableLookUp.PlainDocumentTextFormatter()
Default Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
initialize()
This method makes some initialize operations.
|
void |
insertString(int offs,
String str,
AttributeSet a) |
void |
remove(int offs,
int len) |
void |
replace(int offset,
int length,
String text,
AttributeSet attrs) |
protected void |
setJComboBoxReference(JComboBoxConfigurableLookUp comboBox)
Sets a reference of this component.
|
void |
updateCaretPosition(int position)
Updates the position of the caret in the
ComboBoxEditor of this component. |
void |
updateOnlyTextColor()
Updates the color of the text in this document.
|
void |
updateTextColorAndRingBeep()
Updates the color of the text in the
ComboBoxEditor of this component, and
rings a beep if there is no item. |
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
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, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
public JComboBoxConfigurableLookUp.PlainDocumentTextFormatter()
Default Constructor.
protected void initialize()
This method makes some initialize operations.
protected void setJComboBoxReference(JComboBoxConfigurableLookUp comboBox)
Sets a reference of this component.
comboBox
- A reference to the class that contains this.public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
insertString
in interface Document
insertString
in class PlainDocument
BadLocationException
public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException
replace
in class AbstractDocument
BadLocationException
public void remove(int offs, int len) throws BadLocationException
remove
in interface Document
remove
in class AbstractDocument
BadLocationException
public void updateTextColorAndRingBeep()
Updates the color of the text in the ComboBoxEditor
of this component, and
rings a beep if there is no item.
ILookUp
agent.ILookUp
agent.public void updateCaretPosition(int position)
Updates the position of the caret in the ComboBoxEditor
of this component.
position
- the new position of the caret.public void updateOnlyTextColor()
Updates the color of the text in this document.
Sets text to red color if there is no item in the visible list that the look up agent
returned with that text and the items of the dataModel, and, being enabled the second color in
the configuration the the JcomboBoxConfigurableLookUp
agent. Otherwise, the foreground color
of the text will be black.
This method disables the beep during the process of updating the color of the text, and restores it after.