public class FComboBoxEditor
extends javax.swing.plaf.basic.BasicComboBoxEditor.UIResource
BasicComboBoxEditor descendant that handles bidirectional string-to-value
conversion based on a given AttributeI.
This editor is designed to work with FComboBox to ensure that the user's
text input is correctly converted into the appropriate object type for the
underlying data model and that the data model's object values are correctly
converted into displayable strings.
It manages two primary conversion flows:
| Constructor and Description |
|---|
FComboBoxEditor(AttributeI _attr,
AbstractModel _model)
Constructs an
FComboBoxEditor. |
FComboBoxEditor(AttributeI _attr,
AbstractModel _model,
java.lang.String _nullChoiceTitle) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
comboBoxValueToEditorValue(java.lang.Object _entry)
Converts a combo box entry (an
Object) to a displayable string for the editor. |
java.lang.Object |
editorValueToComboBoxValue(java.lang.Object _editorValue)
Converts an editor's value (a
String) to a corresponding combo box entry (an Object). |
AttributeI |
getAttr() |
java.lang.Object |
getItem()
Retrieves the converted value from the editor component.
|
AbstractModel |
getModel() |
java.lang.String |
getNullChoiceTitle() |
void |
setAttr(AttributeI $5) |
void |
setItem(java.lang.Object _entry)
Sets the value in the editor's text component based on a combo box entry.
|
void |
setModel(AbstractModel $6) |
void |
setNullChoiceTitle(java.lang.String $7) |
public FComboBoxEditor(AttributeI _attr, AbstractModel _model)
FComboBoxEditor._attr - The attribute that defines the type of value to be handled._model - The data model of the combo box._nullChoiceTitle - The label to use for a null entry. If null, an empty string is used.public FComboBoxEditor(AttributeI _attr, AbstractModel _model, java.lang.String _nullChoiceTitle)
public java.lang.Object getItem()
editorValueToComboBoxValue(Object).getItem in interface javax.swing.ComboBoxEditorgetItem in class javax.swing.plaf.basic.BasicComboBoxEditorpublic java.lang.Object editorValueToComboBoxValue(java.lang.Object _editorValue)
String) to a corresponding combo box entry (an Object).
This is the core conversion method. It performs a linear search through the
model's entries to find a match for the string value from the editor.
This is a simple but effective approach, given that combo box models typically
do not contain a vast number of entries.editorValue - The string value from the editor's text field.EntryValueWrapper,
a converted value, or null if no match is found.public void setItem(java.lang.Object _entry)
comboBoxValueToEditorValue(Object).setItem in interface javax.swing.ComboBoxEditorsetItem in class javax.swing.plaf.basic.BasicComboBoxEditorentry - The combo box model entry to display.public java.lang.String comboBoxValueToEditorValue(java.lang.Object _entry)
Object) to a displayable string for the editor.
This method handles various types of entries to ensure the correct string
representation is shown to the user.entry - The combo box model entry to convert.String representing the entry, or the nullChoiceTitle
if the entry is null.public AttributeI getAttr()
public void setAttr(AttributeI $5)
public AbstractModel getModel()
public void setModel(AbstractModel $6)
public java.lang.String getNullChoiceTitle()
public void setNullChoiceTitle(java.lang.String $7)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.