CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2010
    Posts
    1

    Question Bean Binding Problems

    I'm having trouble binding data between variables and GUI components. I'm using Netbeans, although I b/c of the restrictions of the program itself I can't use the Netbeans way of binding through the GUI building.
    The problem is the binding seems to be very inconsistent between the different things I've binded. Some of them will update on the run, others will update originally and not change after that, and others still will simply never update from the start. I've posted some my code below and also included a screenshot of the interface I'm trying to bind to (note: I painted out some work sensitive information, but the instrument type variables are binded properly). If the bindings were working properly, you would see '0's in front of every field below instrument status, but currently two of them are missing and nothing is updating, but instrument type and status. I'm new to Binding and figure I must have made a amateur mistake somewhere.
    Many thanks to anyone who can help me solve this problem!
    -qzcx

    PS. I forgot to mention, the only working binding are bindings between two GUI components. Not sure how related that is. Like I said, I'm very new to Binding.

    Code:
    statusBindingGroup = new org.jdesktop.beansbinding.BindingGroup();
    
            //Instrument type binding
            org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    InstrumentIconType, org.jdesktop.beansbinding.ELProperty.create("${text}"),
                    instrumentTypeAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Instrument status binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    InstrumentIconStatus, org.jdesktop.beansbinding.ELProperty.create("${text}"),
                    instrumentStatusAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Packets Sent Binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    this, org.jdesktop.beansbinding.ELProperty.create("${selectedInstrument.packetsSent}"),
                    packetsSentAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Packets Recived Binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    this, org.jdesktop.beansbinding.ELProperty.create("${selectedInstrument.packetsRecieved}"),
                    packetsRecievedAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Timeout Counter Binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    this, org.jdesktop.beansbinding.ELProperty.create("${selectedInstrument.timeoutCounter}"),
                    timeoutAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Requests Recieved Counter Binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    this, org.jdesktop.beansbinding.ELProperty.create("${selectedInstrument.resultRequestsRecieved}"),
                    resultRequestsAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Drop and Runs Sent Counter Binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    this, org.jdesktop.beansbinding.ELProperty.create("${selectedInstrument.dropAndRunsSent}"),
                    dropAndRunAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            //Results Sent Counter Binding
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
                    org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
                    this, org.jdesktop.beansbinding.ELProperty.create("${selectedInstrument.resultsSent}"),
                    resultsSentAnswerLabel, org.jdesktop.beansbinding.BeanProperty.create("text"));
            statusBindingGroup.addBinding(binding);
    
            statusBindingGroup.bind();// </editor-fold>
    Attached Images Attached Images  

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured