Pages

Thursday, December 18, 2014

Recover Missing Firefox icon..

Multiple times ...firefox seems to loose it's icon... and it looks real bad. I did some google and found this link : http://www.heerengandhi.com/2009/07/29/firefox-icon-went-missing-in-windows-7-heres-a-fix/comment-page-1/

Just copy paste of the instructions for my reference..and anyone else reading.

Follow these directions:
  1. Close all folder windows that are currently open.
  2. Launch Task Manager using the CTRL+SHIFT+ESC key sequence, or by running taskmgr.exe
  3. In the Process tab, right-click on the Explorer.exe process and select End Process
  4. Click the End process button when asked for confirmation.
  5. From the File menu of Task Manager, select New Task (Run…)
  6. Type CMD.EXE, and click OK
  7. In the Command Prompt window, type the commands one by one and press ENTER after each command:
    CD /d %userprofile%\AppData\Local
    DEL IconCache.db /a
    EXIT
  8. In Task Manager, click File, select New Task (Run…)
  9. Type EXPLORER.EXE, and click OK.

Your icons should be as good as new!

Handling Ok Cancel action on Uncommited warning popup

Handling Ok Cancel action on Uncommited warning popup

There are couple of post which covers how to show uncommitted data warning popup. So I will not go in details for that, rather we will cover how to handle ok cancel action on uncommited data warning popup.

Few references for, how to show  uncommitted data warning popup : 
http://www.oracle.com/technetwork/testcontent/unsaveddatawarning-096556.html
http://www.awasthiashish.com/2012/10/uncommitedunsaved-data-warnig-on-page.html

Select af:document from page structure and go to property inspector, now set UncommitedDataWarning to on.

Before starting with implementation, I would like to refer the information found on OTN forum : 
https://community.oracle.com/message/10982006#10982006

From looking at the design specs, uncommitted data warning is a combination of ADF view and ADFc functionality. Good news is that - at least by the specs - a dirty transaction in a region should be automatically detected. The class that handles the uncommitted data warning is AdfcDirtyPageHandler. This class is registered in a text file "oracle.adf.view.rich.context.DirtyPageHandler". So if this works as with how you change the ADFc exception handler, then its by a file with this name in the application META-INF/service folder (the latter doesn't exist by default). Note that "AdfcDirtyPageHandler" is in an internal package, which means its not supported to extend it. However, the default abstract class is DirtyPageHandler and this is in a public package. 
From the Java docs:
META_INF/services-based application-scoped object for tracking whether navigation will result in data loss.  Only a single implementation may be registered per application. Registering multiple implementations will result in an IllegalStateException at applciation initialization. If no implementation is registered, a default implementation will be used. That implementation will always return false from isDataDirty and will do nothing in response to a trackNavigation call.
Maybe worth filing an ER to get a public listener / hook into this instead of dealing with your own implementation. Will file one

To handle ok cancel action on uncommitted data warning popup : 

1. Create a text file with name "oracle.adf.view.rich.context.DirtyPageHandler" under folder structure :
    TestApp/.adf/META-INF/services/



2. Create a java class CustomDirtyPageHandler which extends "AdfcDirtyPageHandler".

public class CustomDirtyPageHandler extends AdfcDirtyPageHandler 

3. Update the file "oracle.adf.view.rich.context.DirtyPageHandler" created in step1 with the name of custom handler ( full package path ).




4. Now you are good to write your logic in CustomDirtyPageHandler java class.  In sample code below, Rollback is executed on OK action. Make sure that Rollback binding is available in pageDef of jspx.


Ignore the below warning/error : 





Enjoy!!!


Wednesday, December 17, 2014

Scroll to top on Commit or Rollback

Scroll to top on Commit or Rollback

This post is about scrolling to some component on user action. Mostly when user click save or cancel, a message is displayed on top of the page. At the same time, it is required to scroll the page to top and show message to the user... rather user scrolling up to see what happened. 

Implementation is simple : 

1. Need a javascript method to scroll.

2. Next step is just to invoke this javascript method at the end of your commit call.


Enjoy!!

Calling JavaScript from ManagedBean

Calling JavaScript from ManagedBean

Often there are requirements to call the invoke javascript from actionListener to set focus or scroll etc. Here goes the code to invoke javascript : 


Enjoy !!!