Warning of Uncommitted/Unsaved Changes in ADF Faces Pages (Shay Shmeltzer's Weblog) Ever wondered how to notify users of your ADF Faces application that they have uncommitted changes on their ADF page before they go off and check their facebook page (or just close the browser's tab)?
Well there is a little nifty feature in ADF Faces that makes this trivial - the uncommittedDataWarning property of your af:document tag. I don't remember at which specific version of JDeveloper this feature was added, but a quick google for "unsaved changes in ADF" brought up some older solutions and I figured I'll raise the awareness of this relatively newer feature with a little video. By the way there is a longer explanation of this un-saved changes feature in relation to bounded taskflows here. Another thing I show in the video is something that often causes newbies to stumble - and that's the reason why commit/rollback are not enabled on your page. This is somewhat related and it depends on the EL used for their disabled property.
JDev 11g, Task Flows & ADF BC – the Always use Existing Transaction option – it's not what it seems. JDev 11.1.1.5.0 Oracle's JDeveloper 11g introduces the powerful concept of task flows to the Application Development Framework (ADF).
Task flows enable "Service Oriented Development" (akin to "Service Oriented Architecture") allowing developers to align web application development closely to the concept of business processes, rather than a disparate set of web pages strung loosely together by URLs. Yet as the old saying goes, "with power comes great responsibility", or alternatively, "the devil is in the detail". Developers need to have a good grasp of the task flow capabilities and options in order to not paint themselves into a corner. ADF Code Corner. ADF Best Practices. Warning on Saved Changes. This topic contains the following sections: Overview One advantage of a rich client web application is the user can easily navigate about anywhere based on current needs.
How-to delete a tree node using the context menu (ADF Code Corner Oracle JDeveloper OTN Harvest) How to render different node icons for different tree levels (ADF Code Corner Oracle JDeveloper OTN Harvest) Nodes of the af:tree component are stamped, which means that upon rendering, the UI component defined in the nodeStamp facet is printed repeatedly with different data values.
If the requirement is to icons differently on each node level, then EL and the af:switcher component help as explained in the following. The sample uses the Oracle HR sample schema Locations, Departments and Employees hierarchy. The tree nodes are printed as af:commandImageLinks because this gives me the option to print an icon and text within the same component, avoiding the need for a surrounding container (the nodeStamp facet can only have a single child component) that messes with the tree layout. Reading train stop display names from a resource bundle (ADF Code Corner Oracle JDeveloper OTN Harvest) In Oracle JDeveloper 11g R1, you set the display name of a train stop of an ADF bounded task flow train model by using the Oracle JDeveloper Structure Window.
To do so Double-click onto the bounded task flow configuration file (XML) located in the Application Navigator so the task flow diagram open In the task flow diagram, select the view activity node for which you want to define the display name. How-to read data from selected tree node (ADF Code Corner Oracle JDeveloper OTN Harvest) By default, the SelectionListener property of an ADF bound tree points to the makeCurrent method of the FacesCtrlHierBinding class in ADF to synchronize the current row in the ADF binding layer with the selected tree node.
To customize the selection behavior, or just to read the selected node value in Java, you override the default configuration with an EL string pointing to a managed bean method property. In the following I show how you change the selection listener while preserving the default ADF selection behavior. To change the SelectionListener, select the tree component in the Structure Window and open the Oracle JDeveloper Property Inspector.
How-to determine the ADF tree node type using EL (ADF Code Corner Oracle JDeveloper OTN Harvest) Creating an ADF tree in ADF produces an entry similar to this in the PageDef file of the view.
Notice the DefName attribute on each node containing a reference to the actual View Object instance used to render a specific node. With this information you can now use EL to render the tree nodes differently. For example, the page source below renders the node as a command link if the node presents a customer. For Countries, the node is simply rendered as an output text. The EL expression #{node.hierTypeBinding.viewDefName} returns the name of the node type, which in ADF is the absolute name of the collection instance rendering the node. The UIManager Pattern (The GroundBlog by Duncan Mills)
One of the most common mistakes that I see when reviewing ADF application code, is the sin of storing UI component references, most commonly things like table or tree components in Session or PageFlow scope. The reasons why this is bad are simple; firstly, these UI object references are not serializable so would not survive a session migration between servers and secondly there is no guarantee that the framework will re-use the same component tree from request to request, although in practice it generally does do so. So there danger here is, that at best you end up with an NPE after you session has migrated, and at worse, you end up pinning old generations of the component tree happily eating up your precious memory.
So that's clear, we should never. ever, be storing references to components anywhere other than request scope (or maybe backing bean scope). So double check the scope of those binding attributes that map component references into a managed bean in your applications. Retrieving the previous value of an ADF BC attribute.