Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Refresh. Show all posts
Showing posts with label Refresh. Show all posts

Monday 17 July 2017

Reinitialise taskFlow in dynamic region and set focus to default activity


Hello All

We all use bounded task flows in ADF application development and to switch between multiple task flows we use concept of dynamic region

Recently I came across a problem about dynamic region and bounded task flows, Scenario is like this

I have dropped a BTF in dynamic region and there is a link on page to open that task flow and those who have used dynamic region would be familiar with this piece of code


Monday 15 February 2016

Show live progress of a long running task using af:progressIndicator in Oracle ADF

This post is about using af:progressIndicator to show live status of a particular task
af:progressIndicator state is tracked and maintained by it's value property that supports org.apache.myfaces.trinidad.model.BoundedRangeModel
This class has two methods

public abstract long getMaximum() { }
returns Maximum value for Model

public abstract long getValue() { }
returns value for Model (current state)

Now to see live progress on page we have to refresh progressIndicator component periodically and this can be achieved using af:poll component , poll component delivers poll events to server periodically and we can ppr (refresh) progress indicator after a particular interval

Friday 6 December 2013

Show current Date and Time on Page in Oracle ADF (refresh Date/time Programmatically)

Hello All,
in this tutorial i am going to explain that how to show current date and time on your ADF application page
Follow Steps-
  • Create a fusion web application and a page in it (i have used .jspx page)
  • Now drag an output text from component palette and drop it on page

  • Now select the output text and go to its property inspector then select value from Expression Builder as shown in image
  • Now in Expression Builder ,create a Managed Bean of type java.util.Date and assign its value to output text




  •  Now run your page and see current date is there
  • Now to format Date and Time , drag and drop af:convertDateTime  under output text from component palette



  •  Select convertDateTime and go to property inspector and change its pattern and run your page


  •  Now you have done basic configuration for Date/Time, if you want to refresh time (second and minute part) on page periodically then drop a poll component in page and create a poll listener in managed bean
  • Now write this simple code in your managed bean to invoke poll listener

  •     /**Binding of Output text*/
        private RichOutputText dateBind;
    
        public void setDateBind(RichOutputText dateBind) {
            this.dateBind = dateBind;
        }
    
        public RichOutputText getDateBind() {
            return dateBind;
        }
    
    
        /**Poll Listener Method ,handles Poll Event
         * @param pollEvent
         */
        public void refreshTime(PollEvent pollEvent) {
            AdfFacesContext.getCurrentInstance().addPartialTarget(dateBind);
    
        }
    

    And don't forget to set clientComponent property of outputText to true
  • Now Run your application , see in this video clip how your page get refreshed... Cheers ..!

Cheers :) Happy Learning

Friday 27 September 2013

Refreshing Child Nodes of an af:treeTable / af:tree in Oracle ADF

Hello All,
A very common problem in ADF treeTable and tree is to refresh child nodes after any DML operation on tree.
to avoid this refresh problem developer can pragmatically refresh treeTable's child node.


  • First get the master ViewObject on that treeTable is based
  • if viewObject has any key attribute then filter it against a key for that you want to refresh child nodes
  • if viewObject doesn't have any key attribute, then filter it using any unique key to get header(master) row
  • get the rowset of child rows for that key, using viewlink accessor
  • and execute query for Child Rows rowset
  • see the refreshed child node :-)

Code- Using Key Attribute


// Get Master ViewObject
    ViewObjectImpl viewObj = masterViewObject;  
    // Filter It Using Key Attribute
  Row[] grpRow = vo.findByKey(new Key(new Object[] { keyAttribute Value }), 1);  
       // Get Child Rows using ViewLink Accessor
        if(grpRow.length>0){
        RowSet childRows = (RowSet)grpRow[0].getAttribute("viewLink AccessorName");  
  //Execute Child Rowset
        childRows.executeQuery();  
        }

Using Unique Key






      // Get Master ViewObject
    ViewObjectImpl viewObj = masterViewObject;  
    // Filter It Using Key Attribute
   Row[] grpRow=viewObj.getFilteredRows("uniqueKey", uniqueKey Value); 
       // Get Child Rows using ViewLink Accessor
        if(grpRow.length>0){
        RowSet childRows = (RowSet)grpRow[0].getAttribute("viewLink AccessorName");  
  //Execute Child Rowset
        childRows.executeQuery();  
        }
  

Somo more blogs on tree table
Programmatically refreshing the child nodes of an <af:tree>
Tree Table Component in Oracle ADF(Hierarchical Representation)
Implementing master/detail tree relation using af:Iterator and af:forEach for better UI designs - Oracle ADF 
Tree Table Component with declarative presentation in ADF, Access childs without custom selection listener
CRUD operations on a tree table
Tree Table Component in Oracle ADF

Cheers :-)

Thursday 25 October 2012

Set on Current row after Rollback Execute or page refresh

Some times we edit a table in form and Save(Commit & Execute) or Cancel(Rollback & Execute)  and table refreshed to its first record means focus is now on first row of table.
And we need the same row again, then we search it and perform another operation, this is really disgusting behavior of table for Developer.

To set on previously selected row after execute we can use this code,
in this scenario we have to get current row key from its IteratorBinding and after Execute we can set it again to show that row as selected.





    /**
     * Generic Method to call operation binding
     **/
     public BindingContainer getBindings() {
      return BindingContext.getCurrent().getCurrentBindingsEntry();
     }


     BindingContainer bindings = getBindings();
     //Get Iterator of table
     DCIteratorBinding parentIter = (DCIteratorBinding)bindings.get("IteratorName");
     //Get current row key
     Key parentKey = parentIter.getCurrentRow().getKey();

     //You can add your operation code here, i have used simple Cancel operation 
     //with Rollback and Execute
     
     
     OperationBinding ob= bindings.getOperationBinding("Rollback");
     ob.execute();
     OperationBinding ob1= bindings.getOperationBinding("Execute");
     ob1.execute();
    
     //Set again row key as current row
     parentIter.setCurrentRowWithKey(parentKey.toStringFormat(true));


Monday 22 October 2012

Refresh Page in Oracle ADF by Java Code, Set partial trigger programmatically

Some times we need to refresh whole page , then we can use this managed bean code to refresh whole page in ADF.


    
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

//Method to reload page
    protected void refreshPage() {

        FacesContext fctx = FacesContext.getCurrentInstance();
        String page = fctx.getViewRoot().getViewId();
        ViewHandler ViewH = fctx.getApplication().getViewHandler();
        UIViewRoot UIV = ViewH.createView(fctx, page);
        UIV.setViewId(page);
        fctx.setViewRoot(UIV);

    }

Partially refresh any UIComponent, Set partial trigger programmatically-




import oracle.adf.view.rich.context.AdfFacesContext;

AdfFacesContext.getCurrentInstance().addPartialTarget(UIComponentBinding);