Example usage for com.jgoodies.binding PresentationModel observeChanged

List of usage examples for com.jgoodies.binding PresentationModel observeChanged

Introduction

In this page you can find the example usage for com.jgoodies.binding PresentationModel observeChanged.

Prototype

public void observeChanged(ValueModel valueModel) 

Source Link

Document

Observes value changes in the given ValueModel.

Usage

From source file:org.archiviststoolkit.swing.ATBasicComponentFactory.java

License:Open Source License

public static JComboBox createComboBox(PresentationModel detailsModel, String fieldName, Class clazz,
        Integer maxLength, boolean buffered) {
    ATFieldInfo fieldInfo = ATFieldInfo.getFieldInfo(clazz.getName() + "." + fieldName);
    Vector<LookupListItems> values = null;
    JComboBox returnCombobox;//w w  w .  j  ava 2 s  .co m
    if (fieldInfo != null) {
        values = LookupListUtils.getLookupListValues2(fieldInfo.getLookupList());
    }
    if (values == null) {
        values = new Vector<LookupListItems>();
    } else {

    }
    if (fieldInfo == null) {
        returnCombobox = addListCellRenderer(BasicComponentFactory.createComboBox(new SelectionInList(values)),
                maxLength);
    } else {
        if (buffered) {
            ValueModel valueModel = detailsModel.getBufferedModel(fieldName);
            detailsModel.observeChanged(valueModel);
            returnCombobox = addListCellRenderer(
                    BasicComponentFactory
                            .createComboBox(new SelectionInList(values, ATJgoodiesBindingConverterFactory
                                    .createLookupListConverter(valueModel, fieldInfo.getLookupList()))),
                    maxLength);
        } else {
            ValueModel valueModel = detailsModel.getModel(fieldName);
            detailsModel.observeChanged(valueModel);
            returnCombobox = addListCellRenderer(
                    BasicComponentFactory
                            .createComboBox(new SelectionInList(values, ATJgoodiesBindingConverterFactory
                                    .createLookupListConverter(valueModel, fieldInfo.getLookupList()))),
                    maxLength);
        }
    }
    returnCombobox.addFocusListener(new ATComboBoxListener(returnCombobox));
    return returnCombobox;
}