Bind Dialog Box: Binding Tab

Use to bind properties of JavaBeans components (beans) with each other so that the values of those properties are synchronized. For example, you can bind the value property of a JSlider component to the value of an object in a table so that the value in the table cell is updated as the user adjusts the slider.

The property for which you open the Bind dialog box serves as the target of the binding. In the Bind dialog box, you specify the binding source and configure the binding.

The Bind Dialog box Advanced tab contains the following fields:

Element Description

Name

Enables you to create a name for the binding, which gives you more flexibility for managing your bindings.

The name is added to the constructor of the binding and can be referenced with the binding's getName() method.

Update Mode

Specifies the way that the properties are kept synchronized.

Always sync (read/write)

Whenever a change is made to either the source or the target, the other is updated.

Only read from source (read only)

The target is only updated the first time the source value is set.

Changes that are made to the source are updated in the target. Changes made to the target are not updated in the source.

Read from source once (read once)

The target is only updated when the target and source are initially bound.

Update Source When

This option is available only to the text property of JTextField and JTextArea components.

Enables you to select the frequency with which the properties are synchronized.

Ignore Adjusting

This option is available to the value property of JSlider; to the selectedElement property of JTable and JList; and to the selectedElements property of JTable and JList.

When this checkbox is selected, any changes made to one property are not propagated to the other property until the user is finished making the change. For example, when the application's user drags a slider, the value of the property bound to the slider is updated when the user releases the mouse button.

Converter

If your binding involves properties with different data types, you can specify code that converts values between the types. The beans binding library handles many commonly needed conversions, but you might need to provide your own converters for other combinations of property types. Such converters need to extend the org.jdesktop.beansbinding.Converter class.

The Converter drop-down list is populated with any converters that have been added as beans to your form.

You can also add the conversion code directly by clicking the ellipsis (...) button, and selecting Custom Code from the Select Converter Property Using drop-down list.

Validator

Enables you to specify code to validate a change in the target property value before propagating that change back to the source property. Such a validator needs to extend the org.jdesktop.beansbinding.Validator class.

The Validator drop-down list is populated with any validators that have been added as beans to your form. You can also add the validation code directly by clicking the ellipsis (...) button, and selecting Custom Code from the Select Validator Property Using drop-down list.

Null Source Value

Enables you to specify a different value to use if the source property has a null value when the binding is attempted.

This field corresponds with the setSourceNullValue() method of the org.jdesktop.beansbinding.Binding class.

Unreadable Source Value

Enables you to specify a different value to use if the binding expression can not be resolved when the binding is attempted.

This field corresponds with the setSourceUnreadableValue() method of the org.jdesktop.beansbinding.Binding class.


Note: To better understand the classes and methods mentioned above, you can access the beans binding Javadoc documentation directly from the IDE. Choose Help > Javadoc References > Beans Binding. In the browser window that opens, click the org.jdesktop.beansbinding link to access documentation for those classes.


Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.