Updating old code: what happened with ListBinder.MODEL_KEY in v0.2 ?
Hi,
I'm migrating from a very old, previous version of 0.1 to the head of the project and I'm experiencing some problems. One thing I can't get to work is the ListBinder.
Previously, to create a JList I did the follow:
Code:
final SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();
this.selectedPCsObservableList = factory
.createBoundListModel(LineForm.SELECTED_PCS);
Map<String, Object> context = new HashMap<String, Object>();
context.put(AbstractListBinder.SELECTABLE_ITEMS_KEY, null);
context.put(ListBinder.RENDERER_KEY, new BeanPropertyValueListRenderer(
"code"));
context.put(ListBinder.MODEL_KEY, this.selectedPCsObservableList);
final Binding nodes = factory.createBinding(JList.class,
LineForm.SELECTED_PCS, context);
this.jlSelectedPCs = (JList) nodes.getControl();
But ListBinder.MODEL_KEY doesn't exist anymore, and everytime I select one item in the list, instead of been selected, it disappears.
The new code I'm trying is the follow:
Code:
final SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();
this.selectedPCsObservableList = factory
.createBoundListModel(LineForm.SELECTED_PCS);
final Binding nodes = factory.createBoundList(LineForm.SELECTED_PCS,
this.selectedPCsObservableList, "code",
ListSelectionModel.SINGLE_SELECTION);
I've tried some other signatures of SwingBindingFactory.createBoundList but them doesn't work as well.
What should I do to keep the previous behaviour of JList?
Thanks,
Mauro.