valueChangeListener is not working on checkbox or SelectOneChoice in Oracle ADF

Requirment-valueChangeListener is not working on checkbox or SelectOneChoice in Oracle ADF

Solution-While working in ADF project, normally we have checkbox or SelectOneChoice , radio buttons (af:selectOneRadio) and list of values ie., LOVs etc.

when we wrote value change listener on it. everything seems to be perfect. but sometimes ,weird things happened in this world. our valueChangeListener is not getting called.It happend , if you using iterator or some varible in it. developer spent lot of times spending on it, why it is not called when everything seems to be correct.

You just need to do one change,.in your valueChangeListener add below code as first line.

valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());

Thats it. It should work now.

Now let check out, what we have done here as by oracle doc.
processUpdates

public abstract void processUpdates(javax.faces.context.FacesContext context)- Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

If the rendered property of this UIComponent is false, skip further processing.
Call the processUpdates() method of all facets and children of this UIComponent, in the order determined by a call to getFacetsAndChildren().

Parameters:
context – FacesContext for the request we are processing
Throws:
java.lang.NullPointerException – if context is null


It process the component value in update model value phase of lifecycle.

Happy coding with Vinay in Techartifact ….. 🙂

find ADF Faces Components in Page by javascript-findComponent

When we using JavaScript with ADF, the AdfPage.PAGE.findComponentByAbsoluteId() and AdfPage.PAGE.findComponent() are useful.

-> Search by the component ID – use findComponentByAbsoluteId function
-> Search in component that stamps its children – use findComponentByAbsoluteLocator function Relative Search
-> Use findComponent function. This function searches the component clientId which can be renderer implementation specific.

you can write a java script function like

    <af:resource type="javascript">
          function contactsPopupOpenListener(evnt) { var contactBtn =
          AdfPage.PAGE.findComponent("T:topMenuLink_contact");
          contactBtn.setStyleClass("OCCTopMenuContactLinkActive"); } function
          contactsPopupCloseListener(evnt) { var contactBtn =
          AdfPage.PAGE.findComponent("T:topMenuLink_contact");
          contactBtn.setStyleClass("OCCTopMenuContactLink"); }
        </af:resource>

happy finding of component with Vinay in Techartifact…. 🙂

How to connect with UCM in ADF using RIDC API

In order to get things started you need to install the WebCenter extensions for JDeveloper, create a WebCenter Portal project and configure a Content Server connection to point to a running instance of UCM 11g..

Once you have these in place, you can start programming RIDC. I will describe below the most useful operations that can be performed using the API.

            IdcContext idcContext = new IdcContext("weblogic", "welcome1");
            IdcClientManager clientManager = new IdcClientManager();
            try {
                // Create idc client
                IdcClient client = clientManager.createClient("idc://dummy.com:4444");
                // Create a new binder
                DataBinder dataBinder = client.createBinder();
                // set parameter for service call
               // dataBinder.putLocal(WCCConstants.KEY_IDC_SERVICE, "DELETE_REV");
                //
                dataBinder.putLocal(CWCCConstants.KEY_TIMESTAMP, ts.toString());            logger.fine("get response");
            result = response.getResponseAsBinder();
        } catch (IdcClientException e) {
            throw new ContentServiceException("Error in request IdcClient: " + e.getMessage(), e);
        }
        return result;
    

Using this way we can call the UCM service and get the result set.

Happy coding with Vinay in Techartifact.