This discussion is archived
7 Replies Latest reply: Mar 7, 2013 10:57 PM by Abhijit Dutta RSS

ADF Graph doesn't get refresh on changing data in get method

994181 Newbie
Currently Being Moderated
HI,

I have made a graph by populating a graphList in a getGraphList method of Graph Class and i got it when this class instantiate but when i recall the same method and change the data of this list it doesn't get reflect in the graph while the data of the list changes.
kindly let me know the way of refreshing the graph in ADF.

Thanks
  • 1. Re: ADF Graph doesn't get refresh on changing data in get method
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    do you PPR the graph?

    Frank
  • 2. Re: ADF Graph doesn't get refresh on changing data in get method
    994181 Newbie
    Currently Being Moderated
    Hi Frank,

    i dint get what you asked.As i have asked you i have made a graph by defining a list in a class and than making this class as a data control Just share me the way of refreshing this graph.

    Thanks,
    Lalit
  • 3. Re: ADF Graph doesn't get refresh on changing data in get method
    994181 Newbie
    Currently Being Moderated
    waiting for reply
  • 4. Re: ADF Graph doesn't get refresh on changing data in get method
    994181 Newbie
    Currently Being Moderated
    waiting for reply
  • 5. Re: ADF Graph doesn't get refresh on changing data in get method
    prateekazam Journeyer
    Currently Being Moderated
    Hi ,

    First things are you refreshing the UI component through partial trigger.

    Please paste your code here to debug

    Thanks
    Prateek
  • 6. Re: ADF Graph doesn't get refresh on changing data in get method
    994181 Newbie
    Currently Being Moderated
    Hi,
    The code is as follow..

    public class Data {
    private String title;
    private Integer age,sal;
    public Data() {
    super();
    }

    public void setTitle(String title) {
    this.title = title;
    }

    public String getTitle() {
    return title;
    }

    public void setAge(Integer age) {
    this.age = age;
    }

    public Integer getAge() {
    return age;
    }

    public void setSal(Integer sal) {
    this.sal = sal;
    }

    public Integer getSal() {
    return sal;
    }
    }
    ----------------------------------------------------

    package model;

    import java.util.ArrayList;
    import java.util.List;

    public class Graph {

    List<Data> list=new ArrayList<Data>();
    public Graph() {
    super();
    list=new ArrayList<Data>();
    Data d=new Data(); Data d2=new Data();
    d.setTitle("rahul");
    d.setAge(24);
    d.setSal(50000);
    list.add(d);
    d2.setTitle("raja");
    d2.setAge(24);
    d2.setSal(60000);
    list.add(d2);
    getGraphList();
    }
    public Graph(String updatedGraph) {
    super();
    list=new ArrayList<Data>();
    Data d=new Data(); Data d2=new Data(); Data d3=new Data();
    d.setTitle("rahul");
    d.setAge(24);
    d.setSal(50000);
    list.add(d);
    d2.setTitle("raja");
    d2.setAge(24);
    d2.setSal(60000);
    list.add(d2);
    d3.setTitle("sachin");
    d3.setAge(21);
    d3.setSal(70000);
    list.add(d3);
    getGraphList();
    }
    public Data[] getGraphList(){
    Data[] data=null;
    data=(Data[])list.toArray(new Data[list.size()]);
    return data;
    }

    public void setList(List<Data> list) {
    this.list = list;
    }

    public List<Data> getList() {
    return list;
    }
    }
    ------------------------------------------
    package model;

    public class ManageBean {
    Graph g=null;
    public ManageBean() {
    super();
    }
    public void getGraph(){
    g=new Graph();
    }
    public void getRefreshGraph(){
    System.out.println("hi");
    g=new Graph("refresh Graph");
    }
    }
    ------------------------------------------------------
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:tr="http://myfaces.apache.org/trinidad"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    xmlns:dvt="http://xmlns.oracle.com/dss/adf/faces">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <h:panelGrid columns="2" id="pg1">
    <af:commandButton text="getGraph" action="#{pageFlowScope.manageBean.getGraph}"/>
    <af:commandButton text="getRefreshGraph" action="#{pageFlowScope.manageBean.getRefreshGraph}"/>
    </h:panelGrid>

    <center>
    <dvt:barGraph id="barGraph1" value="#{bindings.graphList.graphModel}"
    subType="BAR_VERT_CLUST">
    <dvt:background>
    <dvt:specialEffects/>
    </dvt:background>
    <dvt:graphPlotArea/>
    <dvt:seriesSet>
    <dvt:series/>
    </dvt:seriesSet>
    <dvt:o1Axis/>
    <dvt:y1Axis/>
    <dvt:legendArea automaticPlacement="AP_NEVER"/>
    </dvt:barGraph>
    </center>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    ------------------------------------------------------

    i have exposed graph class as datacontrol, on clicking getRefreshBruuon i have again reCreated object of Graph class and called paramatrise contructor in which i have added 1 more row in graphList and data is saving but not getting refresh on graph .
    Kindly check it.

    Thanks
  • 7. Re: ADF Graph doesn't get refresh on changing data in get method
    Abhijit Dutta Pro
    Currently Being Moderated
    Hi,

    in your "getRefreshGraph" method can you refresh the graph partially as below.
    AdfFacesContext.getCurrentInstance().addPartialTarget(bar graph binding in managed bean);
    ~Abhijit

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points