7 Replies Latest reply: Mar 8, 2013 12:57 AM by Abhijit Dutta RSS

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

    994181
      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-Oracle
          Hi,

          do you PPR the graph?

          Frank
          • 2. Re: ADF Graph doesn't get refresh on changing data in get method
            994181
            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
            • 5. Re: ADF Graph doesn't get refresh on changing data in get method
              prateekazam
              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
                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
                  Hi,

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