About the Frame Class in JClient

Application Bootstrap

When you select the frame class in the navigator and choose Run , the main() method &ldquobootstraps&rdquo the application. It starts a binding context and loads data controls, based on entries in the DataBindings.cpx file. Then it passes the binding context with initialized data controls to the panel binding to create the Oracle ADF data bindings.

The following code shows the bootstrap code created by the Create Form wizard, using selected columns from the Employees and Departments tables from the HR schema:

// bootstrap application
JUMetaObjectManager.setBaseErrorHandler(new JUErrorHandlerDlg());

// Lookup the *.cpx file and create all data controls listed in this file.
JUMetaObjectManager mgr = JUMetaObjectManager.getJUMom();

// Use the definition classes provided by JClient. Change only if you do not want to use custom DefClasses.
mgr.setJClientDefFactory(null);

// Create a new binding context that extends java.util.Hashtable.
BindingContext ctx = new BindingContext();

// Get user connection information if available. If not, display logon dialog.
ctx.put(DataControlFactory.APP_PARAM_ENV_INFO, new JUEnvInfoProvider());

// Set locale to the default locale of the JVM.
ctx.setLocaleContext(new DefLocaleContext(null));

// Load data binding container data binding file.
HashMap map = new HashMap(4); map.put(DataControlFactory.APP_PARAMS_BINDING_CONTEXT, ctx);
mgr.loadCpx("DataBindings.cpx", map);

// Get handle to the Business Components application module.
DCDataControl app = (DCDataControl)ctx.get("model_AppModuleDataControl");
app.setClientApp(DCDataControl.JCLIENT);

// Despite the following line of code, attribute sets and fetches are normally
// performed in one batch operation. This requires only one network round
// trip. Attributes that aren't needed are not loaded to the client. The code
// line below is added only when using the JClient Form wizard. Declaratively creating
// the frame, starting with an empty form wizard does not add the following lines.
app.getApplicationModule().fetchAttributeProperties(new String[] {"DepartmentsView1", "EmployeesView3"}, new String[][] {{"DepartmentId", "DepartmentName" }, {"EmployeeId", "FirstName", "LastName" "DepartmentId" }}, null);

// Initialize application root class.
FormDepartmentsView1EmployeesView3 frame = new FormDepartmentsView1EmployeesView3();

// Set binding context to the frame.
frame.setBindingContext(ctx);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();

Frame Initialization

The frame is intialized by its constructor, which does not expect any arguments by default. The binding context of the application is passed to the setBindingContext() method of the frame.

Initialization of the frame results in a panel binding object ( JUPanelBinding) based on an Oracle ADF model definition that may have components that are bound to data from more than one data control. The creation of the panel binding is an important part of the JClient functionality, which enables data binding for Swing components and chaining of data panels.

After you lay out the data panel or form, you may improve the performance of your JClient application by defining the fetchAttributeProperties() method in your form. This will ensure that your form performs in batch mode to fetch attribute values.

 

 

Copyright © 1997, 2004, Oracle. All rights reserved.