Sunday, January 8, 2012

jdevloper not taking the latest changes – what to do?

Sometime when you do the changes and run the application the latest changes are not updated while running the application.
The culprit is the system folder.
{user_home}\system11.1.1.4.37.57.75\o.j2ee\drs\
has the exploded war file which will have the classes that is old. deleting the classes from the exploded directory would definitely fix the issue.

Enable FastSwap in Weblogic deployment to load java classes at runtime without relaoding the classloader

 Fast Swap
Specifies whether FastSwap deployment is used to minimize redeployment since Java classes are redefined in place without reloading the ClassLoader. For more information, see "Using FastSwap Deployment to Minimize Redeployment" in Deploying Applications to Oracle WebLogic Server.

Enable Class Redefinition
Select to enable FastSwap.

Refresh Interval
FastSwap checks for changes in application classes when an incoming HTTP request is received. Subsequent HTTP requests arriving within the number of seconds specified here will not trigger a check for changes. The first HTTP request arriving after the number of seconds specified here have passed, will cause FastSwap to perform a class-change check again.

Redefinition Task Limit
Specifies the number of redefinition tasks that will be retained by the FastSwap system. If the number of tasks exceeds this limit, older tasks are automatically removed.


The following types of changes are supported with FastSwap:
  • Addition of static methods
  • Removal of static methods
  • Addition of instance methods
  • Removal of instance methods
  • Changes to static method bodies
  • Changes to instance method bodies
  • Addition of static fields
  • Removal of static fields
  • Addition of instance fields
  • Removal of instance fields

Wednesday, December 8, 2010

JavaScipt Code to close a popup

var popup = AdfPage.PAGE.findComponent("popupId"); 
          if (popup.isPopupVisible() == true){
              popup.hide();
          }

How to invoke a JavaScript method from the managed bean

Jspx part
---------------
<f:view>
    <af:document id="d1">
     <![CDATA[
   <script>
      function greeter() {
         alert("Hello..");
         }
   }             
</script> ]]>
      <af:form id="f1">
        <af:commandButton text="commandButton 1" id="cb2"
                              partialSubmit="true"
                              action="#{ScriptCallerBean.cb2_action}"/>
      </af:form>
    </af:document>
</f:view>


managed bean coding
------------------------
import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;

public void caller(){
ExtendedRenderKitService extRenderKitSrvc = Service.getRenderKitService(FacesContext.getCurrentInstance(),ExtendedRenderKitService.class);
extRenderKitSrvc.addScript(FacesContext.getCurrentInstance(),"window.greeter()");
}

Friday, November 26, 2010

How to export commandLink in the table into excel

Hi Friends,
        Some of you may have this problem,The problem is While you are exporting collumn in the commandLink,in the excel sheet the commandLink collumn field will be empty.The reason is the export is only for components of type ValueHolder, which a command ink is not.
      So I solve this problem by using an output text inside the commandLink,and in the outputText field property I use the value property,but in the text property of the commandLink is empty.

sample coding,
   <af:commandLink actionListener="#{bindings.setCurrentRowWithKey.execute}"
          text=""  id="cl4" action="edit">
           <af:outputText value="#{row.DocumentName}" id="ot2"/>
    </af:commandLink>

Hi this will work in all versions of the JDeveloper,This is one of solution,I dont know whether  this is a correct solution or not.If any alternative solution,please post your comments             

Clearing Filter criteria in ADF Rich Table

Hi Friends,this is one of my use-case for removing the filter text in the table when clicking a command button.
I think you all like this scenario.

Logic is,
           ADF table filter uses SearchRegion binding, which genearly uses a All Queriable Attributes Criteria. It will apply the criteria on the View object. So we need to clear the criteria on the view object.

The Solution is,
        1.Bind a table in the Jspx to a managed bean,say summaryTable.
        2.In the Jspx page,use a commandButton and in its Action property call a method in the managed bean for eg: clearFilters()

        3.Type the following code in the method,
  public String clearFilters(){
      if (summaryTable != null){
      FilterableQueryDescriptor queryDescriptor =
                                        (FilterableQueryDescriptor)summaryTable.getFilterModel();
      if (queryDescriptor != null && queryDescriptor.getFilterCriteria() != null){
      queryDescriptor.getFilterCriteria().clear();
      summaryTable.queueEvent(new QueryEvent(summaryTable,queryDescriptor));
      }
      else{
          String message = "Have some problem in Clearing Filters. please try later";
          FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(message));
      }
      }
      return null;
  }


Now you run your application,type some filter text and click in the Button which will clear the filter text.
This example I tried in JDeveloper 11.1.1.2.0 . I hope it will work in all the versions of JDeveloper.If any problem post your comments or mail to felixandrew3@gmail.com

Thursday, November 25, 2010

How to invoke popup component programmatically in ADF

Hi All,
     Here is a sample solution for invoking the popup component from a method in the managed bean.

Solution.
     1.Create a button in the Jspx page.
     2.Create a popup componet inside the af|form (for eg:popup id=p1)   and bind the popup to a managed bean with name popup
     3.In the Action property of button,invoke a method in the managed bean( for eg.the method caller() )

In the backing bean code,

  public String caller(){
      showPopup(popup, null);
      return null;
 }
 public static void showPopup(RichPopup popup, UIComponent component) {
      FacesContext context = FacesContext.getCurrentInstance();
      String alignId = (component==null) ? null : component.getClientId(context);
      StringBuilder script = new StringBuilder();
      script.append("var popup = AdfPage.PAGE.findComponent('").append("p1").append("'); ")
              .append("if (!popup.isPopupVisible()) { ")
              .append("var hints = {}; ");
       if (alignId!=null) {
         script.append("hints[AdfRichPopup.HINT_ALIGN_ID] = '").append(alignId).append("'; ")
           .append("hints[AdfRichPopup.HINT_ALIGN] = AdfRichPopup.ALIGN_AFTER_START; ");
       }
        script.append("popup.show(hints);}");
        ExtendedRenderKitService erks =
          Service.getService(context.getRenderKit(), ExtendedRenderKitService.class);
        erks.addScript(context, script.toString());
       }
    
Hi, Onething note this works in JDeveloper 11.1.1.2.0  But I dont know how about in other version.I hope it will work in all versions,

         If it dosn't works post your comment or mail to : felixandrew3@gmail.com . I will send you the sample code.