tell me more icon Creating a Master Form in ADF Swing Form

In an Oracle ADF Business Components data model, a master-detail relationship is a foreign-key association between two or more view objects. When you create master-detail forms and tables using those view objects, end users will be able to drill down from a master collection to view (and optionally edit) the related data objects in the detail collection.

In the example, you will use Oracle ADF Swing and ADF Business Components to create a master form, detail table. ADF Swing, which is fully compatible with Java Swing, adds a thin layer to the client application so that standard Java components can work with ADF data binding libraries. Applications using ADF Swing and ADF Business Components do not need to implement data access and update logic. Instead, ADF Swing and ADF Business Components cleanly separate data access code from UI code resulting in thin clients without the burden on the view layer.

To design a simple master form, detail table for a Java application, you will use a single window comprising one ADF Swing form that will contain the panels for both the master portion and detail portion. The ADF Swing form will also contain the ADF-specific code for enabling ADF data binding in your Java client application.

To begin creating the ADF Swing form, you will use the Create ADF Swing Empty Form dialog. To open the dialog, in the Application Navigator, right-click the View project and choose New . In the New Gallery, select ADF Swing under Client Tier in the Categories tree, and Empty Form in the Items list, then click OK.

New Gallery, Client Tier, ADF Swing

In the Create ADF Swing Empty Form dialog, you will accept the default form and package names, and choose to include a menu bar in the form.

Create ADF Swing Empty Form

When you click OK, JDeveloper will create the empty form with a default data panel and then display the form in the Java visual editor. The form, initialized with ADF data binding code, is the databound Business Components master-detail client form that you will later run.

To start laying out the master portion of the client form, you will use the Data Controls panel to insert a master collection as an edit form panel. In the Create ADF Swing Edit Form dialog, you will delete the attributes that you do not want to be displayed in the master edit form.

Create ADF Swing Edit Form

When you click OK JDeveloper will create the edit form panel inside the data panel of the client form.

Java visual editor, Orders edit form created

To initialize the data panel in the client form to use a layout manager, you will use the Property Inspector to select BorderLayout as the layout property value.

Property Inspector, dataPanel, layout

To constrain the master edit form panel in the topmost portion of the BorderLayout, you will use the Constraints visual property editor to select the area in the layout manager.

Java visual editor, Form.java

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

false ,,,,,,,,,,,,,,,