3-24 Java EE Developers Guide for Oracle Application Development Framework
To use dynamic components: 1.
If not already included, import the dynamic component library.
1.
In the Application Navigator, right-click the view project in which the dynamic components will be used, and from the context menu, choose Project
Properties
.
2. In the Project Properties dialog, select the JSP Tag Libraries node.
3. On the JSP Tag Libraries page, click Add.
4. In the Choose Tag Libraries dialog, select ADF Dynamic Components and
click OK. 5.
On the JSP Tag Libraries page, click OK. 2.
From the Data Controls panel, drag the collection onto the page, and from the context menu, choose Forms ADF Dynamic Form.
3. In the Property Inspector, enter the following: for the Category field:
■
Category : Enter the string used as the value for the Category UI hint for the
first group you’d like to display in your form. For example, in Figure 3–10
, the Category value would be id.
■
Editable : Enter true if you want the data to be editable the default. Enter
false if the data should be read-only.
4.
Repeat Steps 2 and 3 for each group that you want to display on the form. For example, the form in
Figure 3–10 is actually made up of three different forms: one
for the category id, one for the category contact, and one for the category status
.
3.8.2 What Happens When You Use Dynamic Components
When you drop a dynamic form, only a binding to the iterator is created. Example 3–13
shows the page definition for a page that contains one dynamic form component created by dropping the supplier collection. Note that no attribute
bindings are created.
Example 3–13 Page Definition Code for a Dynamic Form
pageDefinition xmlns=http:xmlns.oracle.comadfmuimodel version=11.1.1.53.2 id=DynamicFormPageDef
Package=package.pageDefs parameters
executables iterator Binds=root RangeSize=25
DataControl=SupplierFacadeLocal id=SupplierFacadeLocalIterator
accessorIterator MasterBinding=SupplierFacadeLocalIterator Binds=supplier RangeSize=25
DataControl=SupplierFacadeLocal BeanClass=oracle.fodemo.supplier.model.Supplier
id=supplierIterator executables
bindings pageDefinition
Tip: If dynamic components are not listed, then the library was not
imported into the project. Repeat Step 1.
Creating a Basic Databound Page 3-25
JDeveloper inserts a form tag which contains a dynamic form tag for each of the forms dropped. The form tag’s value is bound to the iterator binding, as shown in
Example 3–14 . This binding means the entire form is bound to the data returned by the
iterator. You cannot set display properties for each attribute individuality, nor can you rearrange attributes directly on the JSF page.
Example 3–14 JSF Page Code for a Dynamic Form
af:document af:messages
af:form dynamic:form value={bindings.supplierIterator} id=f1
category=id dynamic:form value={bindings.supplierIterator} id=f2
category=contact dynamic:form value={bindings.supplierIterator} id=f3
category=status af:form
af:document
3.8.3 What Happens at Runtime: How Attribute Values Are Dynamically Determined
When a page with dynamic components is rendered, the bindings are created just as they are when items are dropped from the Data Controls panel at design time, except
that they are created at runtime. For more information, see Section 3.3.2, What
Happens When You Create a Form.
3.9 Modifying the UI Components and Bindings on a Form
Once you use the Data Controls panel to create any type of form except a dynamic form, you can then delete attributes, change the order in which they are displayed,
change the component used to display data, and change the attribute to which the components are bound.
For more information about modifying existing UI components and bindings, see the Modifying the UI Components and Bindings on a Form section of the Oracle Fusion
Middleware Fusion Developers Guide for Oracle Application Development Framework.
Tip: You can set certain properties that affect the functionality of the
form. For example, you can make a form available for upload, set the rendered property, or set a partial trigger. To do this, select the
af:form tag in the Structure window, and set the needed properties
using the Property Inspector.
Tip:
While there is a slight performance hit because the bindings need to be created at runtime, there is also a performance gain because
the JSF pages do not need to be regenerated and recompiled when the structure of the view object changes.