Wednesday, December 31, 2014

ADF: Show/Hide af:outputText based on Interval

Recently I came across a requirement to show/hide text on page based on certain time interval. I achieved it by using af:poll component. Even though we can do it through setInterval function available in javascript, I faced some problem with clearInterval in different browsers.

af: poll: if you set timeout as -1 it will poll infinitely.

Java Script:
        <af:resource type="javascript">
          var _ivtxt;
          function updateText(evt) {
              var potll = evt.getSource();
              _ivtxt = potll.findComponent("otiv4");
              var vis = _ivtxt.getProperty("visible");
              if (vis) {
              else {

           <af:poll interval="#{pageFlowScope.showText? 1000 : -1}"
                       id="p5" timeout="-1">
                 <af:clientListener method="updateText" type="poll"/>

           <af:outputText value="Sample Text" id="otiv4" clientComponent="true"/>


Recently I created a ADF application having multiple models and single view controller project. I exported same application as ADF Library and added to another application. When I tried to run the application, I faced following error.

javax.el.ELException: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.ConfigException, msg=JBO-33001: Configuration file /com/bc4j.xcfg is not found in the classpath.
        at com.sun.el.parser.AstValue.invoke(
        at com.sun.el.MethodExpressionImpl.invoke(
        at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(

 To fix this problem, I made following changes to View Controller project's Deployment profile.

1. Open ViewController project properties dialog, select Deployment option and edit the required deployment profile.
2. In Deployment Profile Edit window, select Library Dependencies node and click the Edit Dependencies icon
3. In Edit Dependencies window, add a dependency on the build output path or on one or more deployment archives.