List of usage examples for com.jgoodies.binding PresentationModel observeChanged
public void observeChanged(ValueModel valueModel)
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; }