Saturday, June 23, 2012

How to reload whole jsf/jspx page from bean in JDeveloper 11g ?

Oracle JDeveloper 11.1.1.3
ADF Faces Rich Components


Sometimes requirement is to refresh whole jspx page from root . By simple java bean code this can achieve.
 public String refreshPage_action() {  
    FacesContext fctx = FacesContext.getCurrentInstance();  
    String pageToRefresh = fctx.getViewRoot().getViewId();   //getting View Id of current page  
    ViewHandler viewHandler = fctx.getApplication().getViewHandler();      
    UIViewRoot viewRoot = viewHandler.createView(fctx, pageToRefresh);   //ViewRoot for current page  
    viewRoot.setViewId(pageToRefresh);  
    fctx.setViewRoot(viewRoot);     //set the viewroot in facesContext to reload  
    return null;  
 }   

How to remove installed extensions in JDeveloper 11g ?

Windows 7 Enterprise
Oracle JDeveloper 11.1.1.3

From Help > Check For Updates menu, you can install new extensions either from 'Search Update Centers' or 'Install From Local File'.

When you want to remove those extensions from IDE manually, you can goto filesystem & should remove
the related .jar files. This would completely remove the extension.

The location in my machine is - C:\Oracle\Middleware11g\jdeveloper\jdev\extensions.

Alternatively, the extension can be disabled or enabled from JDeveloper.
From Tools > Preferences > Extensions the list of installed extensions can be found.
Deselect desired extension to stop loading in IDE.

In future, if same extension want to use again, this can be enabled from here.

Thursday, June 21, 2012

Edit Dynamic Tab Shell Layout (DynamicTabShell.jspx) page in JDeveloper 11g


Windows 7 Enterprise
Oracle JDeveloper 11.1.1.3
WebLogic Server 10.3.3.0

This post is about to show the steps involved to edit the Dynamic Tab Shell Layout (DynamicTabShell.jspx) page in Jdev11g-ADF.

1.  Goto this location C:\Oracle\Middleware11g\jdeveloper\adfv\jlib, according to your installation folder.
2.  Create a folder CUSTOMIZATION.
3.  Open CMD command promt.
4.  Navigate to 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib\CUSTOMIZATION' by CD command.
5.  Execute in CMD 'C:\>jar xf oracle-page-templates-ext.jar'. Your JDK should be
     registered in PATH variable under Environment Variables in your machine.
     Command Prompt should return with no errors. IF necessary you can put exact path of
     'oracle-page-templates-ext.jar' .
6.  Now, navigate by windows explorer
     'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib\CUSTOMIZATION\ORACLE\UI\PATTERN\
     DYNAMICSHELL\
7.  While opening Jdev already, double click to open 'dynamicTabShell.jspx' in IDE.
8.  Now, you are ready to Edit the template page as per your need. Main requirement is to decrease the
     bottom space in page. You can also edit other things.
9.  After editing Save the file & Close from IDE.
10.Now, its time to re-package all the extracted files. Navigate to 'CUSTOMIZATION' folder in CMD.
11.Type 'jar cfM0 oracle-page-template.jar *'. [0~Zero]
12.This will create a 'oracle-page-template.jar' packaged file containing edited jspx file & others, in same
     location.
13.Copy 'oracle-page-template.jar' file & paste in 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib' or under
     middleware installation directory.

14.Now, you can use this jar file in your project to use edited dynamicTabShell.jspx.
15.By default your project will be using 'Oracle Extended Page Templates' reference with
     'oracle-page-templates-ext.jar' file from path 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib'.

16.Open your Application.jws, right click 'ViewController > Properties > Libraries & Classpath'.
17.Remove the 'Oracle Extended Page Templates' in the Classpath Entries.
18.Add 'oracle-page-template.jar' from 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib', by
     clicking 'Add/Jar directory'.
19.Click OK & run application to see new changes in template page & you done !

Be careful, when you take these source project files in other machine. You should also ship
'oracle-page-template.jar' & save in that machine & re-register in Classpath Entries with exact path.