Domain Portal

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 13 September 2008

JDeveloper 11g - CRUD in ADF Form Component

Posted on 00:24 by Unknown
I'm again back to one of most popular topics on my blog - CRUD implementation in ADF. I was blogging previously about CRUD in 10g and also about CRUD in 11g af:table component - JDeveloper 11g - Create, Edit and Delete operations in ADF Faces af:table component. Today I want to describe CRUD in ADF Form implementation, it is different comparing to ADF Table implementation. Actually, its easy to implement CRUD operations in ADF Form, however it can be complex to implement user friendly CRUD behavior. Main focus of my blog post will be to describe how to achieve user friendly CRUD behavior with ADF Form component.


This post is based on sample application I have developed - UndoCreate.zip. Sample is based on standard HR schema, before running application make sure you have correct DB connection defined.

1) Find Functionality

By default, when you are using ADF Search Form functionality, entered query parameters are stored and are shown again when user will re-open form in Find mode. However, based on my experience, usually it is not a desired behavior. Users prefer not to see old query parameters when they re-open form in Find mode. For example, when some query parameter is entered:


Search is executed and result returned:


And now, when user will press Find button again, previous query criteria should be cleared. It is not cleared by default in ADF, however it is cleared in my sample application:


I'm clearing previous query parameters by executing combination of Rollback, Find, Delete and Create actions in backing bean findButton_action() method associated with Find button.

2) Find Functionality - No Results

When user enters query parameter, that will not give any result, and press Search button - empty form will be returned by default. Example of non-existing query criteria:


Empty form returned by default:


In my sample application, I have changed this default behavior in executeButton_action() method in backing bean. I'm doing a check - if iterator is empty, I'm returning to Find mode and displaying information message - 'No Results found!':


In this case I'm not clearing entered query criteria.

3) Undo Functionality in Create Mode

When form is in Create mode, user usually prefer to have 3 choices - to store entered data and to go to Edit mode, to clear entered data and to remain in Create mode, and to close Create mode by opening form in Find mode:


If with 2 cases - to store entered data or to open form in Find mode everything is less or more okej, there is a problem with a case when user wants to clear entered data and to remain in Create mode. With default Undo functionality, when using only Rollback action, user will be navigated back to Edit mode. In order to change this, I'm re-invoking Create mode initialization from backing bean in undoButton_action() method, it is invoked after default Rollback action. This allows to clear entered data and to stay in Create mode after Undo button is pressed:


4) Undo Functionality in Edit Mode

By default, when Undo button is pressed while in Edit mode and Rollback action is executed, changes will be discarded and at the same time form will be refreshed and will show first row from iterator. This means, user will be navigate from a row he is currently editing to a first row in iterator.

To make this behavior more user friendly, I have implemented custom Rollback functionality in undoButton_action() method in backing bean:


In this code, I'm acquiring form related iterator, getting current row user is editing and refreshing it. At the end, I'm applying Partial refresh to a form in order to display correct data. More information about Rollback functionality you can find in Chris Muir blog post - JDeveloper and the art of the rollback. The same functionality can be applied not only in 11g, but in 10g as well.

With implemented functionality, if user is editing data:


And decides to remove all changes by pressing Undo button, form will remain on the same row:


5) Delete Functionality

When user executes Delete functionality, I can recommend to commit transaction at the same time. In developed sample application, when Delete button is pressed - deleteButton_action() method is invoked, where confirmation popup is opened:


When user confirms Delete action, Commit action is executed at the same time, and row is removed from database.

6) Delete Functionality - Last Row

By default, after user will delete last row from iterator, empty form will be rendered:


Such behavior is not user friendly, much better to navigate to Find mode automatically:


This logic is implemented in deleteDialogListener(DialogEvent dialogEvent) method in backing bean:


7) Confirm or Undo Pending Changes

When user is editing data and there are pending changes (before commit or rollback), based on my experience its better not allow to navigate from current row. For example, when data is changed and there are pending changes:


Buttons related to form logic - Find, Create, Delete and buttons related to form navigation - First, Previous, Next and Delete are blocked. Information message is shown - 'Save or Undo Changes First!' asking user to confirm or dismiss current pending changes:



Information about pending changes is retrieved from bindings.Commit.enabled using Expression Language. Its enough to edit data available in the form and bindings.Commit.enabled will return true.
Email ThisBlogThis!Share to XShare to Facebook
Posted in ADF, JDeveloper 11g | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Groovy - Multiple LOV's per Attribute in JDeveloper 11g
    I was blogging previously about multiple LOV's per attribute functionality. I was using RowImpl class for View object in order to calcu...
  • Multiple LOV's per Attribute in JDeveloper 11g
    During OOW 2008 I have attended Steve Muench talk about new features in ADF Business Components available in 11g release - Oracle ADF: New D...
  • JBO-25058 and JBO-26001 exceptions
    In a case if you will get JBO-25058 and JBO-26001 exceptions after running application developed with Oracle ADF in JDeveloper 11g, most pro...
  • Oracle Always Rocks !
    This song was performed at Oracle OpenWorld 2007, after Larry Ellison and Safra Catz keynote - Sunday Night Live—30 Years Behind The Scenes ...
  • JDeveloper/ADF News from Oracle OpenWorld 2008
    This week I'm in San Francisco, attending Oracle OpenWorld 2008 conference. One of the main news for me, announced on Ted Farrell keyno...
  • JDev/ADF samples list
    This week, Steve Muench on his examples page have added a link to my JDev/ADF samples list . Thanks, I'm very proud of this - it is co...
  • Using #{row.rowKeyStr} property with Composite View Object
    Synchronizing view and edit pages in ADF is pretty easy. Let's say, in view page we have a read-only table and in edit page - editable f...
  • Oracle Fusion Middleware 11g Technology Preview 3 - whats included?
    Probably almost everyone have noticed Christmas gift from Oracle - JDeveloper 11g Technology Preview 3 . What new things are inside this gif...
  • Three Dependent List Boxes in af:table Component
    You may already have read Frank Nimphius blog post - ADF Faces: How-to create dependent list boxes in a table . Frank describes in his blog ...
  • Oracle Open World 2008 - Abstract Accepted
    I have very exciting news - my abstract for Oracle Open World 2008 session is accepted by Oracle and I will represent Vgo Software on this...

Categories

  • ADF
  • Apex
  • Apple
  • BPEL
  • Events
  • Forms
  • Groovy
  • JDeveloper 11g
  • Nomination
  • ODTUG Kaleidoscope
  • OFUG
  • Oracle Magazine
  • Oracle OpenWorld
  • Security
  • SOA
  • Spatial
  • TopLink
  • Traveling
  • Uncategorized
  • Vgo Software
  • Web Services
  • WebCenter
  • WebLogic
  • Workarounds

Blog Archive

  • ▼  2008 (72)
    • ►  December (2)
    • ►  November (3)
    • ►  October (9)
    • ▼  September (4)
      • Second Session on UKOUG 2008 Conference
      • JDeveloper/ADF News from Oracle OpenWorld 2008
      • JDeveloper 11g - CRUD in ADF Form Component
      • Oracle JDeveloper/ADF Developers Wanted
    • ►  August (9)
    • ►  July (6)
    • ►  June (10)
    • ►  May (4)
    • ►  April (5)
    • ►  March (7)
    • ►  February (5)
    • ►  January (8)
  • ►  2007 (65)
    • ►  December (6)
    • ►  November (7)
    • ►  October (6)
    • ►  September (4)
    • ►  August (3)
    • ►  July (4)
    • ►  June (6)
    • ►  May (5)
    • ►  April (6)
    • ►  March (4)
    • ►  February (5)
    • ►  January (9)
  • ►  2006 (9)
    • ►  December (9)
Powered by Blogger.

About Me

Unknown
View my complete profile