Tips for Getting Started with ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:24:57 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Tips for Getting Started with ADF

I'll use this document as a running list of small tips that crop up for developers working with ADF in JDeveloper 10g:

Use findDataControl() and not getDefaultDataControl() on BindingContext

There is no real notion of the ADF binding context having a default data dontrol. The binding context might contain many data controls and many binding containers, so the definition of what the "default" one would be is ill-defined. The getDefaultDataControl() method exists in the oracle.adf.model.BindingContext class to support upward compatibility of existing 9.0.X JClient applications and should not be used in new code that you write. To find a data control, you should use the findDataControl() method on BindingContext instead.

I admit that we should have picked a less-enticing name than getDefaultDataControl() for this method we did not want developers to use, and we should have better JavaDoc that warns against using it and explains why it's there. When developers use code-insight to pick a method name on BindingContext, it appears that this name guides many users to incorrectly pick it. Pretend its name is getDefaultDataControlForJClientUpwardCompatibilityOnly(), and you'll be fine. I've filed a bug to get the JavaDoc to be clearer on this point in a future maintenance release.

Where Can I See If My Data Control is In "Batch" or "Immediate" Mode?

By clicking on the DataBindings.cpx file in your view/controller project, the structure pane will show a list of all the data controls and binding containers (a.k.a. "UI Models") defined. Clicking in the structure pane on your data control, its properties appear in the Property Inspector. You can tell what mode your data control will be used in by looking at the "Sync Mode" property. In this release, the "Sync Mode" only applies to data controls based on ADF Business Components application modules.

Where Did The Implementation Files for My Business Components Go?

In JDeveloper 9.0.X, the implementation files for BC4J components appeared in-line in the System Navigator by expanding the navigator node. Now, in the JDeveloper 10g "Application Navigator" components like ADF Business Components, EJB's, and web services that comprise multiple implementation files all are handled in a consistent way. A single node appears under the package in the application navigator representing the component, and in the Structure Pane under "Source Files" folder you can see all of the implementation files that make it up. For quick navigation to the files that developers change most frequently, if you click on your component node in the navigator, you'll see a menu pick in the right-mouse menu like "Go to Entity Object Class..." etc.  If after trying this new approach, you still prefer the System Navigator's organization, you can see the system navigator by using the "View | System Navigator" menu item in the main menu.

How Do I Rename a Data Control Based on an ADF Application Module?

For other kinds of data controls, you can rename them using the property inspector by clicking the DataControls.dcx file in your model project, selecting the data control in question in the structure pane, and setting its Id property in the property inspector. The value is stored in the DataControls.dcx file. By design, all ADF application modules are accessible as Data Controls, so we don't add (what would be a redundant) entry in the DataControls.dcx file for your application modules. In fact, if you only have application modules serving as your data controls, then you won't even have a DataControls.dcx file in your project. So, changing the name of the data control based on an application module requires a slightly different set of steps. Do the following:

  • Select the application module in the navigator
  • In the Property Inspector, click into the "Custom Properties" field and click the (...) button
  • In the "Custom Properties" dialog, pull down the "Name" combo box and select the DATA_CONTROL_NAME property
  • Enter a value into the "Value" field that will be used to override the default data control name, and click (Add)
  • Click (OK) to dismiss the dialog

The Data Control Palette should update to show your data controls new name. If this custom property is not set, then the default name will be YourModuleDataControl. Be careful if you rename your data control after having already done some data binding that you will need to revisit your iterator bindings and action bindings and update there binding expressions to reflect the new data control name.



© Copyright 2008 Steve Muench. Click here to send an email to the editor of this weblog.
Last update: 2/3/2008; 9:24:57 PM.