tell me more icon Creating an ADF Swing Empty Panel

The Create ADF Swing Empty Panel/InternalFrame dialog lets you create either an empty panel or internal frame. Select P anel to create an empty panel. In the dialog, the name you enter becomes the Java class that defines the panel for containing databound UI components.

Create ADF Swing Empty Panel Wizard

When you select the Generate a runnable panel/frame option, JDeveloper adds a main statement to the Java class and generates a standard JPanel Swing container that is made runnable by the creation of a test frame in which to execute the panel. This allows you to test your ADF Swing panel individually (without the use of a frame that contains the ADF Swing bootstrap code).

When you click OK, JDeveloper does the following:

  • Creates the panel source file,
  • Creates the page definition file for the panel, OrderItemsPanelPageDef.xml
  • Adds an entry for the panel source file in DataBindings.cpx
  • Displays the empty panel in the Java visual editor

Java visual editor, OrderItemsPanel

The initial panel in the visual editor is empty because it does not yet contain databound UI components. The Structure window also shows no component hierarchy under the UI node.

Structure window, no hierarchy

The source file contains several calls from the Oracle ADF Swing API that will enable data binding and interoperation with the Oracle ADF model layer. To see the code, click Source at the bottom of the editor window.

Specifically, the generated source code contains:

  • A constructor to create a JUPanelBinding object and to load the metadata for the bindings on that object. The creation of the panel binding is an important part of the ADF Swing functionality, which enables data binding for Swing components.

    Note: Initially, when an empty panel appears in the project no bindings have been defined. The metadata gets defined when the application developer lays out the empty panel using JDeveloper data binding tools.

  • A main() method that calls setBindingContext() on the panel. This method itself calls the method to start the test frame, which takes as an argument the DataBindings.cpx file. This .cpx file specifies a connection to the business service implementation instance (for example, an ADF Business Components application module instance) using the ADF data control for the instance, plus the ADF binding context. Ultimately, setBindingContext() makes the ADF binding context available to the runnable panel.

Later you will use the Data Controls panel to lay out the detail panel with databound UI with ADF Swing components. But first, the detail panel requires its own layout manager setting. While JDeveloper does not prevent you from setting different layout managers across the various containers of your form, in actual practice you will probably want to work with the same type of layout manager used for the master form. Resizing behavior can differ between different types of layout managers, and this can create undesired effects in the UI as the user resizes the window.

In the next step you will use the Property Inspector to select BorderLayout as the layout manager for the empty panel you created.

Property Inspector

Structure window

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

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