Monday, April 29, 2013

Open and Close Popup on pageload using javascript ADF

  <f:view>


<af:document id="d1" title="Report">
     <af:resource type="javascript">

            function openPopup() {
            var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1');
            popup.show();
            var timeOutPeriod = 50 * 1000; // 50 sec
             setTimeout(function closePopup(){popup.hide();}, timeOutPeriod);
                     }
              </af:resource>

  <af:clientListener type="load" method="openPopup"/>
   
<af:form id="f1">
      
  <af:popup id="p1" contentDelivery="immediate">

<af:dialog id="d2" type="none" title="Report is currently being generated..."
closeIconVisible="false" clientComponent="true">
<af:panelGroupLayout id="pgl1" layout="vertical" halign="center">
<af:image source="/images/reportgen.JPG" id="i1"/>
<af:image source="/images/animbar.gif" id="i2"
inlineStyle="width:120px;"/>
<af:outputText value="... please wait" id="ot11"/>
</af:panelGroupLayout>
</af:dialog>

</af:popup>


</af:form>
   
    </af:document>

 </f:view>


  alert("This is a test");
 alert(popup); //this shows the id of the popup
if the below code doesn't work, you can find the right popId by displaying the popup id using alert command
var popup = AdfPage.PAGE.findComponentByAbsoluteId('p1'); 

Thursday, April 25, 2013

Using ADFUtils,JSFUtils class in ADF


http://www.adftips.com/2010/10/adf-ui-adfutil-class-to-evaluate-set.html

BindingContainer bindings =
                    BindingContext.getCurrent().getCurrentBindingsEntry();
               OperationBinding method =
                    (OperationBinding)bindings.getOperationBinding("ExecuteWithParams");
                Map paramsMap = method.getParamsMap();
                paramsMap.put("Key", "Value");
               method.execute();     


   OperationBinding operationBinding =
            ADFUtils.findOperation("Operation1");
 operationBinding.getParamsMap().put("Key", "Value");
operationBinding.execute();



   

   DCBindingContainer bindings =
            (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding dcIteratorBindings =
            bindings.findIteratorBinding("ExampleVOIterator");

        ExampleVORowImpl row =
            (ExampleVORowImpl) dcIteratorBindings.getCurrentRow();



        DCIteratorBinding exVOIter =
            ADFUtils.findIterator("ExampleVOIterator");
      ExampleVORowImpl row =
            (ExampleVORowImpl) dcIteratorBindings.getCurrentRow();







        ExampleVOImpl exVO =
            (ExampleVOImpl) ADFUtils.getViewObjectByIterator("ExampleVOIterator");


        if (exVO.getRowCount() > 0) {
//
}
else{
//
}



JSFUtils:

 String refId = JSFUtils.resolveRemoteUser();


        RichInputText itcomponent =
            (RichInputText)JSFUtils.findComponentInRoot("it10");



JBO-27022: Failed to load value at index

Try Removing the Attribute from View Object as well as from the query; then add back the attribute to VO attributes and query.

Groovy Expression to render a button based on role ADF


#{securityContext.userInRole['User_Role']}

Implement PagePhaseListener for Single page or page fragment ADF


Register the bean for a page at ControllerClass of the page Definition









Tuesday, April 16, 2013

Close Browser Window without Promt using javascript ADF (IE)

import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;



    public void closeWindow() {
        // Add event code here...
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ExtendedRenderKitService service =
            Service.getRenderKitService(facesContext,
                                        ExtendedRenderKitService.class);
        service.addScript(facesContext, "window.open('', '_self', ''); window.close();");

    }

Thursday, April 11, 2013

Friday, April 5, 2013

Access Managed bean from another Managed bean

Set Iterator to row with Key in backing bean adf

import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCIteratorBinding;

// Get the Iterator
        DCBindingContainer bindings =
            (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding unitVOIterator =
            bindings.findIteratorBinding("unitViewROVOIterator");
        RowSetIterator unitVORowSetIterator =
            unitVOIterator.getRowSetIterator();

     
// Set the row
        Key key = new Key(new Object[] { unit });
        Row[] row = unitVORowSetIterator.findByKey(key, 1);// second parameter - No of Parameters to return

        unitVORowSetIterator.setCurrentRow(row[0]);
        unitViewROVORowImpl ccRow =
            (unitViewROVORowImpl)unitVORowSetIterator.getCurrentRow();