Data binding in JClient is the ability to create Swing containers and components that are bound to data in back-end business services. To enable data binding, JClient provides a small API that works with the Oracle ADF model layer. The API is exposed in the application source code through a combination of JClient bootstrap code:
loadCpx() to load the application metadata
(specified in the DataBindings.cpx file), which specifies
a connection to the business service implementation instance (for
example, a Business Components application module instance) using the
ADF data control for the instance, as well as the ADF binding context.
setBindingContext() to make the ADF binding context
available to the frame or panel.
createPanelBinding() to create an object that will
access the business service's contained data collections through Swing
component models.
bindUIControl() on the panel binding to set the ADF
model for the individual components of the JClient form or panel.
To work with a data binding in your Swing application, each container (a frame or panel) must either create a panel binding object or get one from the source from which it originated. The frame that creates the first panel binding also contains the JClient bootstrap code, where the connection to the business services is created. Subsequent containers that your application creates either chain from the original panel binding or they create their panel binding in order to display unrelated data. How you want to partition the data views of your application determines whether a container sets a new panel binding or whether it gets an existing one:
When migrating a project from JDeveloper 9.0.4 or earlier to JDeveloper 10g, you will be able to work with control bindings by selecting the control's Model or Document property in the Property Inspector. However, you must not use the new ADF-style bindings (that you create using the Data Control Palette) in the panels and forms that you previously created. Mixing the new bindings with old bindings on the same panels and forms will not work. You can, however, create new panels and forms using the Data Control Palette and add them to your existing application. These new panels and forms can use the new ADF-style bindings.
When you use the Property Inspector to display the model binding editor for a control that you want to customize, JDeveloper will display the binding editor appropriate to the style of the binding (either for JDeveloper9i, and earlier, style bindings or for the new ADF-style bindings in JDeveloper 10g). The displayed binding editor will generate the binding code appropriate to the binding style used by the form or panel.
Note that the usage of the Structure window's UI Model tab to edit control bindings is reserved for ADF-style bindings only. JDeveloper 10 g does not support creating new panels and forms with the old-style bindings. You must import a project created in JDeveloper9i, or earlier, into JDeveloper 10g in order to continue to work with the old-style bindings.
For complete JClient migration information, see Migrating Oracle9i JDeveloper Release 9.0.X JClient Projects in the JDeveloper Help.
The easiest way to create databound containers is to use the JClient wizards (see the Swing/JClient for ADF folder in the New Gallery). Specifically, if you use these two JClient wizards, then the source code will contain the bootstrap code and constructors needed to create the panel binding:
An additional benefit to using these two wizards is their support for easy drag-and-drop UI design within JDeveloper. Because they are generated with the bootstrap code for a specific data control object (which contains the business service's collections, structured objects, attributes, and methods), all of the Swing components that you insert from the Data Control Palette in JDeveloper will have access to any business service that that the data control object contains.
If you were to start with a standard frame or panel (one generated without using the JClient wizards) that you want to enable a JClient data binding for, you can can add the appropriate JClient bootstrap code to the main frame and then handle the panel binding in your secondary windows this way:
BusinessCompViewName(getPanelBinding());
frame.setVisible(true);
BusinessCompViewName(new
JUPanelBinding(getPanelBinding().getApplicationName(),null));
frame.setVisible(true);
The first call will create the frame object and set the panel binding. The second call makes the frame visible.
For a complete discussion of the wizard-generated code, see About the JClient Application Code Code.
Dropping Data Panels onto an Empty JClient Form
Copyright © 1997, 2004, Oracle. All rights reserved.