Thursday, August 23, 2012

ADF - Refresh page programmatically

Some times when you develop your ADF application, you need to refresh programmatically a page. You can achieve this using the internal page ID in backing bean class usgin the following code:


ViewHandler vh = fctx.getApplication().getViewHandler();
String pageId = fctx.getViewRoot().getViewId();
UIViewRoot vr = vh.createView(fctx, pageId);
vr.setViewId(pageId);fctx.setViewRoot(vr)

Tuesday, August 07, 2012

ADF - Refresh child Iterator via View Link Accessor

I'm back... after few months I found five minutes to write a short post on my blog, from Sydney, my new home.

There are a lot of use cases where you need to refresh child iterators of a master ViewObject via View Link Accessor, for example in tree component. In this post I'm writing a simple implementation to achieve that.
DCIteratorBinding masterIterato = .....
ViewObject vo = masterIterato.getViewObject();
Row[] deptRow = vo.findByKey(new Key(new Object[] { objectId }), 1);
RowSet childRows = (RowSet)deptRow[0].getAttribute("ViewLinkAccessorName");
childRows.executeQuery();
In the code you can show the way to obtain the RowSet representing the child rows of a specific master Row, then re-execute the query of RowSet. Master Row is found via findByKey method on ViewObject.