Example usage for com.jgoodies.binding PresentationModel getBufferedModel

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

Introduction

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

Prototype

public BufferedValueModel getBufferedModel(String propertyName) 

Source Link

Document

Looks up or creates a buffered adapter to the read-write property with the given name on this PresentationModel's bean channel.

Usage

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

License:Open Source License

public static JFormattedTextField createIntegerField(PresentationModel detailsModel, String fieldName,
        boolean useGrouping, boolean buffered) {
    NumberFormat nf = NumberFormat.getIntegerInstance();
    nf.setGroupingUsed(useGrouping);//ww  w .j  a va 2 s. com
    JFormattedTextField returnField;
    if (buffered) {
        returnField = BasicComponentFactory.createIntegerField(detailsModel.getBufferedModel(fieldName), nf);
    } else {
        returnField = BasicComponentFactory.createIntegerField(detailsModel.getModel(fieldName), nf);
    }
    returnField.addFocusListener(
            new ATFormattedTextFocusListener(returnField, "Invalid entry. This field requires an integer."));
    return returnField;
}

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

License:Open Source License

public static JCheckBox createCheckBox(PresentationModel detailsModel, String fieldName, Class clazz,
        boolean buffered) {
    ATFieldInfo fieldInfo = ATFieldInfo.getFieldInfo(clazz.getName() + "." + fieldName);
    JCheckBox checkBox;/*  w  w w  .  j  a va2  s. c  o m*/
    if (fieldInfo == null) {
        if (buffered) {
            checkBox = BasicComponentFactory.createCheckBox(detailsModel.getBufferedModel(fieldName),
                    fieldName);
        } else {
            checkBox = BasicComponentFactory.createCheckBox(detailsModel.getModel(fieldName), fieldName);
        }
    } else {
        if (buffered) {
            checkBox = BasicComponentFactory.createCheckBox(detailsModel.getBufferedModel(fieldName),
                    fieldInfo.getFieldLabel());
        } else {
            checkBox = BasicComponentFactory.createCheckBox(detailsModel.getModel(fieldName),
                    fieldInfo.getFieldLabel());
        }
        checkBox.setToolTipText(fieldInfo.getPopupHelpText());
    }
    checkBox.addFocusListener(new ATCheckBoxListener(checkBox));
    return checkBox;
}

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 .  ja  va 2s. c  o  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;
}

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

License:Open Source License

public static JComboBox createComboBox(PresentationModel detailsModel, String fieldName, Object[] values,
        Integer maxLength, boolean buffered) {
    JComboBox returnCombobox;/*w w w.  j av a2 s. c  o m*/
    if (buffered) {
        returnCombobox = addListCellRenderer(BasicComponentFactory
                .createComboBox(new SelectionInList(values, detailsModel.getModel(fieldName))), maxLength);
    } else {
        returnCombobox = addListCellRenderer(BasicComponentFactory.createComboBox(
                new SelectionInList(values, detailsModel.getBufferedModel(fieldName))), maxLength);
    }
    returnCombobox.addFocusListener(new ATComboBoxListener(returnCombobox));
    return returnCombobox;
}