Thursday, August 19, 2010

UI Shell Dynamic Tab: Suppressing required / mandatory field error when navigating between Tabs or creating new Tabs.

Recently I have seen few posts in forum on how to suppress the mandatory / required validation error on attributes so that user can navigate between the tabs, can create new tabs when existing tabs has required or mandatory errors. I tried a test case and it could be downloaded here. In this blog I will try to detail the test case performed.

I created a test application that looks like the image below. Idea is to have two navigation links on the left which would launch their separate taskflow. Everytime I click on it should launch the taskflow in new tab no matter if their are incomplete tabs with missing required values. I should be able to navigate between the open tabs, work on them in any order I want, commit them or rollback them or even reset the inputs I have entered.

I created a new Jspx page with Oracle Dynamic Tab Shell template. On the Navigation facet I dropped two af:commandLink, set their immediate property to true and associated their action property with bean methods. Code that goes in backing bean is shown later. Here is how code in navigation facet looks like:


I created two jsff pages Page1 and Page2 and dropped view object from data control on to this page as editable form (for model, I used Employees tables provided by HR schema in Oracle database. I created an EO, VO and AM for this table). I also dragged Commit and Rollback from the data control and dropped on each page. Additionally I added a command button and inserted an af:resetActionListener to it.




I created 2 Taskflows, TF1 and TF2 and in their Overview tab set their behavior for their transaction as 'Always Begin New Transaction' and unchecked 'Share data control with calling task flow. Dragged and dropped CreateInsert method as default activity in both the task flows which leads to Page1 and Page2 in Taskflow1 and Taskflow2 respectively.  Here are how they look like:




Now in the backing bean of my Jspx page, I have below code:



Just doing so, we can close the tab using the close icon located in the end of the tab even when there are required attribute validation error's on the existing tab, we can reset the errors and values entered on the form using reset button, we can navigate between all the open tabs even with the existing error for required attribute or can open new tab. Have Fun !!

3 comments:

  1. Hi Amit,
    I have a question relating to UI shell but unrelated to the current blog post

    How can I customize the UI shell close tab behaviour? By default, the TabContext does provide the service of checking whether a tab is dirty or not. But I want a layer of abstraction above the tabContext where I could do custom actions while closing a tab. However UI shell doesn't seem to provide a handle on the TAB CLOSE icon. Could you suggest me a direction to head into?

    Vinit

    ReplyDelete
  2. 1. New Dynamic Tab Shell is supposed to handling Dirty Tab you can get the details from:
    http://www.oracle.com/technology/products/adf/patterns/11/uishell.html

    For some reason OTN is down so you may not be able to get this page..try cache version from google..
    http://webcache.googleusercontent.com/search?q=cache:Czqa3dnHF8EJ:www.oracle.com/technology/products/adf/patterns/11/uishell.html+http://www.oracle.com/technology/products/adf/patterns/11/uishell.html&cd=1&hl=en&ct=clnk&gl=us

    2. New Template provides API for to check if current Tab is dirty, make it dirty, close activity etc.

    3. Well, for close Icon.. Yes.. currently we do have only one close icon and no close icon on individual tabs .. this was a tradeoff to keep the functionality of handling dirty Tabs.. as both were mutually exclusive.. latter was obviously a better choice.

    Thanks.

    ReplyDelete
  3. You can unzip oracle-page-templates-ext.jar to customize the UI shell template, zip and add to your project.

    Have fun !!

    ReplyDelete