This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 158968

Summary: binding issues with design time on custom beans
Product: guibuilder Reporter: paulc86 <paulc86>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Attachments: fix in bind() method for complex custom beans using binding

Description paulc86 2009-02-23 10:19:19 UTC
when trying to use custom beans (in my case panels). with the GUI builder netbeans has problems instantiating complex
beans. most problems can be overcome by using the java.beans.Beans.isDesignTime() method. 

however I personally found that I could not overcome a call to "bindingGroup.bind();" within the initComponents() method
created by the GUI builder to get around this I had to patch the org.jdesktop.beansbinding.BindingGroup.bind() method as
I obviously could not edit the code within the initComponents() method.

Once patched the jar needs to be rebuilt and then placed in the ext folder of netbeans replacing the current library,
for good measure a restart of netbeans. This then allowed me to use my custom panels as components, dragging and
dropping them onto my forms.

My new version of the bind() method looks like..
    public void bind() {

        if (!java.beans.Beans.isDesignTime()) {

            List<Binding> toBind = new ArrayList<Binding>(unbound);

            for (Binding binding : toBind) {

                binding.bind();

            }

        }

    }

what I suggest is that netbeans should surrond the call to bindingGroup.bind(); with..
if( !java.beans.Beans.isDesignTime() ){
   bindingGroup.bind();
}

or the fix in the bind() method of beans binding should be packaged with netbeans default beansbinding jar.

This has additionally been reported to the beans binding project.

Thanks

P
Comment 1 paulc86 2009-02-23 10:20:13 UTC
Created attachment 77239 [details]
fix in bind() method for complex custom beans using binding
Comment 2 Jiri Prox 2009-02-23 10:29:13 UTC
*** Issue 158967 has been marked as a duplicate of this issue. ***