Forum Stats

  • 3,838,105 Users
  • 2,262,332 Discussions
  • 7,900,506 Comments

Discussions

Is partial submit possible for trinidad components

771063
771063 Member Posts: 33
edited May 21, 2010 1:47PM in JDeveloper and ADF
Hi,

I am designing a mobile browser application. I have to use partial page refresh. Requirement is that Clicking on an image link on the page should display data in the table corresponding to the selected image. I am able to achieve that using ADF components. But not able to achieve the same using trinidad components. As far as i know mobile browser doesnt support ADF components and supports only trinidad components. Is there any trinidad component similar to Image Link in ADF which can be submitted partially?

Thanks
Neha
Tagged:

Answers

  • Frank Nimphius-Oracle
    Frank Nimphius-Oracle Member Posts: 29,689 Bronze Badge
    Hi,

    you can make an image a child component of a link component. This should have a similar effect

    Frank
  • 771063
    771063 Member Posts: 33
    Hi,

    Thanks for your reply.

    I could not find any link component in trinidad which can be submitted partially. Can u please explain in detail how to do that?

    Thanks
    Neha
  • 771063
    771063 Member Posts: 33
    edited May 21, 2010 8:01AM
    Hi,

    As i posted in my last reply that i am able to set an image inside a link component. I have set the partial submit to true for command link and have also set actionlistner to a managed bean method. But clicking the image is not executing this action listner as it is not calling the managed bean method. So my guess is that, as link is not a trinidad component, its not working properly. Can u please help me on this?

    Thanks

    Edited by: user772674 on May 21, 2010 5:01 AM
  • 771063
    771063 Member Posts: 33
    Hi,

    As i posted in my last reply that i am able to set an image inside a link component. I have ste the partial submit to true for command link and have also set actionlistner to a managed bean method. But clicking the image is not executing this action listner. So my guess is that as link is not a trinidad component, its not working properly. Can u please help me on this?

    Thanks
  • jflack
    jflack Member Posts: 1,518 Bronze Trophy
    Lets step back from this a bit and take a look.

    First of all, I can tell you that a tr:commandLink should do the job from the view side, and that you can embed a tr:image inside the link, no problem.

    Really, your components are not the problem. The question is, what should the action or actionListener associated with the commandLink do? How do you know that the actionListener isn't executing? Did you trace it, or add some logging?

    My bet is that the actionListener IS executing, but it isn't doing what you expect it to do. I suspect that if you want it to change the contents of a tr:table, you need it to run the Execute or ExecuteWithParams operation on the iterator behind that table. If the image is from a parent table, you probably need to set that row of the parent as the current row, then Execute the iterator for the detail. If the image is fixed, you probably need to set a parameter based on which image was clicked (you can get its ID) then do ExecuteWithParams.
  • 771063
    771063 Member Posts: 33
    Hi,

    I was actually using <af:commandLink>. After changing it to <tr:commandLink>, actionListener (managed bean method) is getting called now. Following is the code i have written in managed bean method

    public void setEmployeeId(ActionEvent actionEvent) {
    System.out.println("Inside seemp");
    // Add event code here...
    employeeId = actionEvent.getComponent().getId();
    System.out.println(actionEvent.getComponent().getValueExpression(employeeId));
    DCBindingContainer m_bindingContainerObj = (DCBindingContainer)ADFContext.getCurrent().getExpressionEvaluator().evaluate("#{bindings}");
    DCDataControl dataControlObj = m_bindingContainerObj.findDataControl("TweetAppModuleDataControl");
    TweetAppModuleImpl am = (TweetAppModuleImpl) dataControlObj.getDataProvider();
    Collection<HashMap> employee = am.setEmployee(employeeId);
    empModel = new SortableModel(employee);
    //AdfFacesContext.getCurrentInstance().addPartialTarget(getSetEmployeeTable());
    AdfFacesContext.getCurrentInstance().addPartialTarget(getMobileEmpTable());
    //call the app module impl funtion which will set the where clause value

    }

    This method is avaialble inAppModule
    public Collection<HashMap> setEmployee(String employeeId) {
    ViewObjectImpl tweetVO;
    tweetVO = getTweetsView1();
    System.out.println("TweetViewImpl = " + tweetVO);
    tweetVO.setWhereClause("employee = :emp");
    tweetVO.defineNamedWhereClauseParam("emp", null, null);
    tweetVO.setNamedWhereClauseParam("emp", "Duncan Angove");
    System.out.println(tweetVO.getQuery());
    tweetVO.executeQuery();
    Collection<HashMap> employee = new ArrayList<HashMap>();

    while (tweetVO.hasNext()) {
    HashMap emp = new HashMap();
    Row searchRow = tweetVO.getRowSetIterator().next();
    emp.put("Eventtype", searchRow.getAttribute(2).toString());
    System.out.println(searchRow.getAttribute(2).toString());
    employee.add(emp);
    }
    return employee;
    }


    JSF Code

    <tr:commandLink id="cl1" partialSubmit="true"
    actionListener="#{Tweets.setEmployeeId}">
    <tr:image source="/john.gif" id="i1"/>
    </tr:commandLink>
    <tr:table value="#{Tweets.empModel}" var="row"
    rows="#{Tweets.empModel.rowCount}"
    emptyText="#{bindings.TweetsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
    id="t1" binding="#{Tweets.mobileEmpTable}">
    <tr:column sortProperty="Eventtype" sortable="false"
    headerText="#{bindings.TweetsView1.hints.Eventtype.label}"
    id="c1">
    <tr:inputText value="#{row.bindings.Eventtype.inputValue}"
    simple="true"
    required="#{bindings.TweetsView1.hints.Eventtype.mandatory}"
    columns="#{bindings.TweetsView1.hints.Eventtype.displayWidth}"
    maximumLength="#{bindings.TweetsView1.hints.Eventtype.precision}"
    id="it1">
    <f:validator binding="#{row.bindings.Eventtype.validator}"/>
    </tr:inputText>
    </tr:column>
    </tr:table>

    But i am getting below mentioned error . Also on the browser it is showing Error 403
    <PanelPartialRootRenderer><encodeAll> Error during partial-page rendering
    javax.el.PropertyNotFoundException: Target Unreachable, 'bindings' returned null
    at com.sun.el.parser.AstValue.getTarget(AstValue.java:88)
    at com.sun.el.parser.AstValue.isReadOnly(AstValue.java:126)
    at com.sun.el.ValueExpressionImpl.isReadOnly(ValueExpressionImpl.java:230)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.EditableValueRenderer.getReadOnly(EditableValueRenderer.java:244)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.renderAsElement(FormElementRenderer.java:217)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:103)
    at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:446)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:119)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer.renderKids(ColumnRenderer.java:151)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer._renderKids(ColumnRenderer.java:168)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer._renderTD(ColumnRenderer.java:350)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer._renderDataMode(ColumnRenderer.java:241)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ColumnRenderer.encodeAll(ColumnRenderer.java:96)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at org.apache.myfaces.trinidadinternal.renderkit.core.desktop.DesktopTableRenderer._renderRegularColumns(DesktopTableRenderer.java:998)
    at org.apache.myfaces.trinidadinternal.renderkit.core.desktop.DesktopTableRenderer.renderSingleRow(DesktopTableRenderer.java:111)
    at org.apache.myfaces.trinidadinternal.renderkit.core.desktop.DesktopTableRenderer$1.processRowImpl(DesktopTableRenderer.java:861)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.table.TableUtils$RowLoop.processRow(TableUtils.java:117)


    Cant we use AppModule for mobile supported app? Or there are some extra setting required? FYI, following code for bean and app module is working fiine with normal adf compoennts. So i have tested that code for with simple jsf page. What i dont know if the same code will be supported by trinidad components or not

    Thanks
    Neha
  • jflack
    jflack Member Posts: 1,518 Bronze Trophy
    I haven't completely traced through your code, but one thing jumped out at me. In Trinidad, ADFContext doesn't exist.
    Instead of:
    DCBindingContainer m_bindingContainerObj = (DCBindingContainer)ADFContext.getCurrent().getExpressionEvaluator().evaluate("#{bindings}");
    Try adding this helper method:
        public static Object getFromEL(String expr) {
            FacesContext fc = FacesContext.getCurrentInstance();
            return fc.getApplication().evaluateExpressionGet(fc, expr,
                                                             Object.class);
        }
    And evaluate EL like this:
    DCBindingContainer m_bindingContainerObj = (DCBindingContainer)getFromEL("#{bindings}");
    And AdfFacesContext is gone and replaced by RequestContext, so make your call to addPartialTarget:
    RequestContext.getCurrentInstance().addPartialTarget(getMobileEmpTable());
  • 771063
    771063 Member Posts: 33
    Hi,

    Thanks for your response.
    But even after changing what you suggested, i am still getting the same error "Error 403 - forbidden" on browser and "
    javax.el.PropertyNotFoundException: Target Unreachable, 'bindings' returned null
    " on server console. I added some debug statements towards the end of managed bean method that sets the partial target using RequestContext/. That log statement is getting printed. I am just not sure from where this error is thrown.

    public void setEmployeeId(ActionEvent actionEvent) {
    System.out.println("Inside seemp");
    // Add event code here...
    employeeId = actionEvent.getComponent().getId();
    System.out.println(actionEvent.getComponent().getValueExpression(employeeId));
    DCBindingContainer m_bindingContainerObj = (DCBindingContainer)getFromEL("#{bindings}");

    DCDataControl dataControlObj = m_bindingContainerObj.findDataControl("TweetAppModuleDataControl");
    TweetAppModuleImpl am = (TweetAppModuleImpl) dataControlObj.getDataProvider();

    Collection<HashMap> employee = am.setEmployee(employeeId);
    empModel = new SortableModel(employee);
    System.out.println("Before Request context");
    RequestContext.getCurrentInstance().addPartialTarget(getMobileEmpTable());
    System.out.println("After Request context");

    //call the app module impl funtion which will set the where clause value

    }
This discussion has been closed.