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 115069 - binding adaptors broken for abstract button and slider
Summary: binding adaptors broken for abstract button and slider
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Binding (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@guibuilder
Depends on:
Reported: 2007-09-07 21:57 UTC by Patrick Keegan
Modified: 2007-09-10 13:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Keegan 2007-09-07 21:57:04 UTC
The which worked in previous milestones now will not run

I get

org.jdesktop.beansbinding.PropertyResolutionException: Exception invoking method public void
org.jdesktop.swingbinding.adapters.JSliderAdapterProvider$Adapter.setValue(int) on
        at org.jdesktop.beansbinding.BeanProperty.invokeMethod(
        at org.jdesktop.beansbinding.BeanProperty.write(
        at org.jdesktop.beansbinding.BeanProperty.setValue(
        at org.jdesktop.beansbinding.Binding.refreshUnmanaged(
        at org.jdesktop.beansbinding.Binding.refresh(
        at org.jdesktop.beansbinding.AutoBinding.tryRefreshThenSave(
        at org.jdesktop.beansbinding.AutoBinding.bindImpl(
        at org.jdesktop.beansbinding.Binding.bindUnmanaged(
        at org.jdesktop.beansbinding.Binding.bind(
        at org.jdesktop.beansbinding.BindingGroup.bind(
        at carsapp.CarsView.initComponents(
        at carsapp.CarsView.<init>(
        at carsapp.CarsApp.startup(
        at org.jdesktop.application.Application$
        at java.awt.event.InvocationEvent.dispatch(
        at java.awt.EventQueue.dispatchEvent(
        at java.awt.EventDispatchThread.pumpOneEventForFilters(
        at java.awt.EventDispatchThread.pumpEventsForFilter(
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(
        at java.awt.EventDispatchThread.pumpEvents(
        at java.awt.EventDispatchThread.pumpEvents(
Caused by: java.lang.IllegalArgumentException

When I remove the sliders from the form, I get something similar for the JCheckBoxs

org.jdesktop.beansbinding.PropertyResolutionException: Exception invoking method public void
org.jdesktop.swingbinding.adapters.AbstractButtonAdapterProvider$Adapter.setSelected(boolean) on
Comment 1 Peter Pis 2007-09-07 22:25:02 UTC
Seems to be related to the update of beans binding library and its integration.
Comment 2 Peter Pis 2007-09-08 00:12:18 UTC
Tried with latest beta 1 build (Build 200709070000). I removed the jslider connected to jlabel and no exception has been
Comment 3 Patrick Keegan 2007-09-08 11:46:56 UTC
Peter, thanks for looking at this so quickly.

I have two questions:
*what do you mean "jslider connected to jlabel". How are they connected? There is no binding between jLabels and
jSliders in the tutorial
*Are you able to keep the checkboxes? Even if I remove the jSliders, I get the application still fails to launch because
of the AbstractButtonAdapterProvider problem.
Comment 4 Peter Pis 2007-09-08 12:37:20 UTC
I just made a short test whether it's possible to bind JSlider and JTextField (JLabel) and that works fine. That was
what I meant in my previous comment.

Following and applying the section #To bind the sliders and checkboxes to their corresponding table elements:# in the
tutorial makes that application can't be executed.

honza, could you please evaluate this ASAP?
Comment 5 Peter Pis 2007-09-08 15:28:27 UTC
No workaround is known for now. P1.
Comment 6 Jan Stola 2007-09-08 17:12:24 UTC
Both of these problems seem to be consequence of Shannon's (IMHO unfortunatel approach) in the new beans binding 
library - the bindings doesn't work and throw cryptic exceptions when they are not fully configured.

The root of the exception being thrown is the fact that no row of the table is selected when the application is 
started. Hence, the value of the expression ${selectedElement.moderness} is not known (e.g. unreadable). The library 
attempts to set 'null' as a value of JSlider, but the binding support for JSlider doesn't accept this value. The 
previous version of the library simply left the JSlider's value untouched.

The "workaround" (in fact, the correct configuration) is to set 'Unreadable Source Value:' property on Advanced tab of 
the binding:

1. Go to the binding customizer of the 'value' property.
2. Switch to Advanced tab.
3. Check Unreadable Source Value check box.
4. Press ... button next to Unreadable Source Value field.
5. Select Custom code form the combo box at the top.
6. Enter 0 (zero) into Property Code field.
7. Press OK.
8. Press OK.

The situation with JCheckBox is similar. In theory, it can be fixed using the same steps, just entering 'false' instead 
of '0' in the step 6. Unfortunately, the PropertyPanel used for Unreadable Source Value sometimes doesn't work as 
expected. For example, for boolean property (like JCheckBox.selected) it doesn't have '...' button and therefore cannot 
be used to set the correct value. I will investigate this problem next week and will fire a bug against 

By now, another workaround can be used:

1. Select the check box.
2. Invoke Customize Code from the contextual menu.
3. Enter binding.setSourceUnreadableValue(false); below the binding code.
4. Press OK.

You can, of course, you similar approach for JSlider.

Lowering to P2 since some workarounds exist.
Comment 7 Peter Pis 2007-09-08 18:19:07 UTC
Ok, your suggestion works. It can be confusing to many users. It should be mentioned in release notes definitely.
Comment 8 Patrick Keegan 2007-09-08 19:09:28 UTC
Yes, these workarounds work for me too. I'll add the workarounds to the tutorial and note them in the release notes.
Comment 9 Jan Stola 2007-09-10 11:04:09 UTC
I agree that the current situation where you have to specify the unreadable source value is not nice. Unfortunately, it 
is how the beans binding library version 1.0 is designed. So, we cannot do anything with it, by now. Hence, the only 
problem mentioned in this issue is the problem with PropertyPanel (reported as a separate issue 115133).

Closing this issue as invalid because it is mainly a misunderstanding than a real defect.
Comment 10 Patrick Keegan 2007-09-10 11:22:14 UTC
Is there any way that we can (eventually) enhance the visual support to detect situations when there might be an
unreadable source value and suggest a reasonable default?
Comment 11 Jan Stola 2007-09-10 13:22:02 UTC
> Is there any way that we can (eventually) enhance the visual support to detect situations when there might
> be an unreadable source value and suggest a reasonable default?

Not in general. I hope that Shannon will make such binding working even if the unreadable source value is not set. By 
now, the library attempts to set 'null' to the target. It would be much better if the library left the target untouched.