Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers 10g (10.1.3.1.0) Part Number B25947-01 |
|
|
View PDF |
You can create a form that allows a user to edit the current data, and then commit those changes to the data source. You then use a operations associated with a collection or the data control itself to create command buttons that can be used to modify data records. For example, you use the Delete
operation to create a button that allows a user to delete a record from the current range. Or you can use the built-in Submit button to submit changes.
Tip: You can also use the Create operation on a form to create a new object, however using the ADF Creation Form provides additional built-in functionality. See Section 13.6, "Creating an Input Form" for more information. |
It is important to note that these operations are executed only against objects in the ADF cache. You need to use the Commit
operation on the root data control to actually commit any changes to the data source. You use the data control's Rollback
operation to rollback any changes made to the cached object.
To use the operations on a form, you follow the same procedures as the navigation operations (see Section 13.4.1, "How to Insert Navigation Controls into a Form" for procedures), however you must also create the buttons for the commit and rollback operations in order for changes to be committed to the data store or to restore the cache.
To create an edit form:
From the Data Control Palette, drag the collection for which you wish to create the form, and select ADF Form from the context menu.
In the Edit Form Fields dialog, if you want the user to be able to change data, select Include Submit Button.
From the Data Control Palette, select the operation associated with the collection of objects on which you wish the operation to execute, and drag it onto the JSF page.
For example, if you want to be able delete service requests, you would drag the Delete
operation associated with the ServiceRequests
collection. Figure 13-8 shows the operations associated with a collection.
Choose either Command Button or Command Link from the context menu.
From the Data Control Palette, drag the Commit
and Rollback
operations associated with the root level data control, and drop them as either a command button or command link. This will allow the changes to be committed to or rolled back. Figure 13-9 shows the commit and rollback operations for the SRService
data control.
Dropping any data control operation as a command button causes the same events as dropping navigation operations. See Section 13.4.2, "What Happens When Command Buttons Are Created Using the Data Control Palette" for more information.
The only difference is that the action bindings for the Commit
and Rollback
operations do not require a reference to the iterator, as they execute a method on the application module. Example 13-12 shows the action bindings generated in the page definition file for these operations.
Example 13-12 Action Bindings for Commit and Rollback Operations
<action id="Commit" InstanceName="SRService" DataControl="SRService" RequiresUpdateModel="true" Action="100"/> <action id="Rollback" InstanceName="SRService" DataControl="SRService" RequiresUpdateModel="false" Action="101"/>
The following table shows the built-in non-navigation operations provided on data controls, along with the result of invoking the operation or executing an event bound to the operation (see Section 13.4.3, "What Happens at Runtime: About Action Events and Action Listeners" for more information about action events).
Table 13-2 More Built-in Operations
Operation | Action Attribute Value | When invoked, the associated iterator binding will... |
---|---|---|
Create |
41 |
Creates a row directly before the current row, then moves the current row pointer to the new row. Note that the range does not move, meaning that the last row in the range may now be excluded from the range. Also note that this performs a |
Delete |
30 |
Deletes the current row from the cache and moves the current row pointer to the next row in the result set. Note that the range does not move, meaning that a row may be added to the end of the range. If the last row is deleted, the current row pointer moves to the preceding row. If there are no more rows in the collection, the enabled attribute is set to "disabled." |
SetCurrentRowWithKey |
96 |
Set the row key as a |
SetCurrentRowWithKeyValue |
98 |
Set the current object on the iterator, given a key's value. |
RemoveRowWithKey |
99 |
Uses the row key as a |
Commit |
100 |
Causes all items currently in the cache to be committed to the database. |
Rollback |
101 |
Clears the cache and returns the transaction and iterator to the initial state. |
Execute and Find |
|
These operations are used only in search forms. See Chapter 18, "Creating a Search Form" for more information. |