Binding Java visual components to data with the visual editor
The Java visual editor provides a set of generic binder classes and visual feedback to help you bind visual components to data objects provided by Web services, enterprise beans, and Java beans.
To see the Javadoc for the generic binder classes provided, see API reference for binders.
To learn about using the Java visual editor binders to connect to a data source, do the following tutorial:
Tutorial: Build a rich Java client that uses a Web service.
In the Java visual editor, Swing visual components including text fields, tables, and buttons can be bound using the generic classes and interfaces provided. You can also write your own binders for other components by implementing the provided interfaces. The visual editor provides dialog boxes that help you create data source data objects and data sources that you can use to bind a visual component. Or, you can manually add basic data objects, data source data objects, and data sources from the palette and configure them using the Properties view.
Tip: To debug the generated binders during run time, you should add the -Djve.debug virtual machine argument to the launch configuration for your Java application or Java Bean that includes the binders.
- When you select a JTextField, JTable, JTextArea, or JButton in the design view, the visual editor displays a Bind tab on the selected item. The Bind tab indicates that the visual component can be bound to a data object or some action on a data source. The following image shows the Bind tab on a text field selected on the design area of the Java visual editor:
- If you click the Bind tab, a dialog box opens and prompts you to make selections, specific to the type of visual component, in order to bind the visual component to a data object or service on the data source.
- If no appropriate data objects or data sources exist in your application for the visual component to be bound to, you can use the dialogs to define new instances of data sources and data source data objects. The following screen shot shows an example dialog for binding a text field to a property of a data source data object. In this example, the data objects are already created:
- As new instances of objects and data sources are created, the required interfaces and classes for the data objects, data sources, and their related binders are generated into a new package. By default, the package is named jve.generated, but you can change this preference. The following screen shot shows an example project with the jve.generated package included:
Data binders overview
The Java visual editor provides a generic framework of interfaces and classes that help you to bind visual components to data sources such as enterprise bean, Java Bean factories, or Web services.Binding text fields
You can use the Java visual editor to bind a Swing text field to a data object.Binding tables
You can use the visual editor to bind a Swing JTable to a row data object.Defining filter binders for tables
You can use a Text Filter Binder to filter the contents of a table that is bound to a data object.Binding buttons
You can use the visual editor to bind the action of a Swing JButton to perform a service made available by a data source.Creating new data objects in the Java visual editor
In order to bind Java visual components, you need to first create a data object that can provide appropriate data for the visual component.Specifying a default name for generated binders packages
The Java visual editor generates the binder helper classes into a new package in your Java project. The default package name is jve.generated. You can specify a different package name to use for new projects that use the helper classes.