public class ComboBoxEditor extends CustomEditor implements SetPropertyEditorOpts
Примеры использования:
Пример с использование спика значений
@UiBean(
// Указываем редактор
propertyEditor = ComboBoxEditor.class,
// Указываем опции редактору
// Формат опций
// variants: перечисление вариантов через косую черту
editorOpts = "variants: ab | cd | ed | \"d e1\" | 'e2 a' "
)
public String getComboVar() { ... }
public void setComboVar(String svar) { ... }
Пример с использованием сосденего метода, для получения списка значений:
@UiBean(
// Указываем редактор
propertyEditor = ComboBoxEditor.class,
// Указываем опции редактору
// Формат
// variants call method имя_меода
editorOpts = "variants call method getSvarVariants"
)
public String getSvar() { ... }
public void setSvar(String svar) { ... }
public List<String> getSvarVariants(){ ... }
Пример с использование внешнего класса, для получения списка значений:
// Бин с редактируемым свойством
public class BBean {
...
@UiBean(
// Указываем редактор
propertyEditor = ComboBoxEditor.class,
// Указываем опции редактору
// Формат опций
// variants call class Имя_вспомогательного_класса method имя_метода
// Имя класса может быть без имени пакета,
// если находятся в одном пакете
editorOpts = "variants call
class BBeanHelper
method getComboVariants"
)
public String getComboVar() { ... }
public void setComboVar( String val ) { ... }
...
}
// Вспомогательный класс
public class BBeanHelper {
...
// Вспомогательный метод, возвращающий массив или Iterable
public Object[] getComboVariants(){
return new Object[]{ "bvar1", "bvar2", "bvar3", };
}
...
}
| Modifier and Type | Field and Description |
|---|---|
protected JComboBox |
comboBox |
protected ListCellRenderer |
listCellRenderer |
protected String |
optionsString |
propertyEditorSupportcellEditable, component, listeners, shouldSelectCell| Constructor and Description |
|---|
ComboBoxEditor() |
ComboBoxEditor(ComboBoxEditor sample) |
| Modifier and Type | Method and Description |
|---|---|
ComboBoxEditor |
clone() |
protected JComponent |
createComponent()
Создание графического компонента - редактора
|
String |
getAsText() |
JComboBox |
getComboBox() |
String |
getJavaInitializationString() |
Object |
getValue() |
Object[] |
getVaraints() |
void |
setAsText(String text) |
void |
setPropertyEditorOpts(String opts)
Передача параметров редактору
|
void |
setValue(Object value) |
void |
setVartiants(Object[] variants) |
void |
startEditing(Object value,
Object context) |
addPropertyChangeListener, firePropertyChanged, getCellEditorValue, getComponent, getCustomEditor, getTags, isPaintable, paintValue, parseEditOptions, removePropertyChangeListener, setTags, supportsCustomEditoraddCellEditorListener, cancelCellEditing, clearAllListeners, fireEditingCanceled, fireEditingStopped, getEditIcon, getNullIcon, getNullSelectedIcon, getNullUnSelectedIcon, isCellEditable, isShouldSelectCell, removeCellEditorListener, setCellEditable, setComponent, setShouldSelectCell, stopCellEditingprotected ListCellRenderer listCellRenderer
protected String optionsString
protected JComboBox comboBox
public ComboBoxEditor()
public ComboBoxEditor(ComboBoxEditor sample)
public ComboBoxEditor clone()
clone in class CustomEditorpublic void startEditing(Object value, Object context)
startEditing in interface TreeTableNodeValueEditor.EditorstartEditing in class CustomEditorpublic void setPropertyEditorOpts(String opts)
SetPropertyEditorOptssetPropertyEditorOpts in interface SetPropertyEditorOptsopts - параметры/опцииpublic Object[] getVaraints()
public void setVartiants(Object[] variants)
public JComboBox getComboBox()
protected JComponent createComponent()
CustomEditorcreateComponent in class CustomEditorpublic void setValue(Object value)
setValue in interface PropertyEditorpublic Object getValue()
getValue in interface PropertyEditorpublic String getJavaInitializationString()
getJavaInitializationString in interface PropertyEditorpublic String getAsText()
getAsText in interface PropertyEditorpublic void setAsText(String text) throws IllegalArgumentException
setAsText in interface PropertyEditorIllegalArgumentExceptionCopyright © 2019. All rights reserved.