All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jidefx.scene.control.editor.ChoiceBoxEditor Maven / Gradle / Ivy

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));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy