Announcement Announcement Module
No announcement yet.
Create binding for existing combobox Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create binding for existing combobox

    I'm just trying abeille and would like to bind a combobox, which I retrieve from FormPanel as proposed by Peter in :

            FormPanel formPanel = new FormPanel("foo/bar/Client.jfrm");
            FormAccessor accessor = formPanel.getFormAccessor();
            // bind the form components to the form model
            getBindingFactory().bind(accessor.getComboBox("title"), "title");
    But, I don't want to have the combobox statically filled, but it should take a collection of beans and render a specific property of those beans. I can use createBoundCombobox with the appropriate signature and replace the combobox in my abeille form with the new combobox:

            SwingBindingFactory sbf = new SwingBindingFactory(model);
            // put the collection of wards into a value holder
            ValueModel wardVM = new ValueHolder(wards);
            // and bind the combobox this way:
            // - the property val of the objects in wardVM is displayed
            // - if an item is selected, the property selectedWard is set
            // to that item
            Binding comboBinding = sbf.createBoundComboBox("selectedWard", wardVM, "val");
            panel.getFormAccessor(ID_SELECTION_PANEL).replaceBean(ID_COMBO_WARD, comboBinding.getControl());
    But this is not, what I would like to do. I would need something like

    SwingBindingFactory.bindControl(JComponent control, String formProperty, ValueModel selectableItemHolder, String rederedProperty)
    which would create the correct context map for the binder.

    Is there another way that I don't see, at the moment.

    Many thanks

    Last edited by robyn; May 14th, 2006, 07:16 PM.

  • #2
    Fixed by a patch: