jidefx.scene.control.editor.ChoiceBoxEditor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jidefx-fields Show documentation
Show all versions of jidefx-fields Show documentation
JideFX Common Layer is a collection of several extend feature for JavaFX
The newest version!
/*
* @(#)TextFieldCellEditor.java 5/19/2013
*
* Copyright 2002 - 2013 JIDE Software Inc. All rights reserved.
*/
package jidefx.scene.control.editor;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.scene.control.ChoiceBox;
/**
* An editor based on {@code ChoiceBox} for any data that can be enumerated.
*/
public class ChoiceBoxEditor extends ChoiceBox implements Editor, LazyInitializeEditor {
@Override
public ObservableValue observableValue() {
return valueProperty();
}
@Override
public void initialize(Class clazz, EditorContext context) {
Object list = context != null ? context.getProperties().get(EditorContext.PROPERTY_OBSERVABLE_LIST) : null;
if (list instanceof ObservableList) {
setItems(((ObservableList) list));
}
}
}