0 Replies Latest reply: Sep 17, 2012 8:50 AM by 962564 RSS

    Stamped Pivot table does not show the changed content from DataFormat code

    962564
      Hi !

      We are creating a JSF page to provide an user interface for booking a vehicle online. The screen will display
      dates as columns and available vehicles as rows. User will book a vehicle by starting a mouse drag (holding the left mouse button pressed )
      till the target date. Once the mouse released, we would like to populate the cells with a letter which indicates that the vehicle has
      been booked for the specified dates.
      To achieve this, I have used a pivot table as it supports the required display. The pivot table is stamped with "output text" item as a
      data cell. A set of clientlistener and serverlistener are declared on the output text item. I am using the getDataFormat() procedure
      to change the cell colour and set a new value.

      Problem 1 : On the mouse release, the cell colour is changed but the new value is not displayed on screen (it still shows the old value).
      I am using the setNewRawValue() procedure to change the cell contents I have checked this with getNewRawValue() procedure immediately
      after the setNewRawValue().
      I noticed that if I remove the stamping i.e. if only pivot table is present, the setNewRawValue() works perfect and immediately displays
      the new cell value. But with "output text" as a stamped component, the cell value is not displayed but the colour change is visible.
      The reason I have to use "output text" item, because the JDeveloper does not allow me to define the serverlistener at the pivot table level.
      It allows me to declare the clientlistener at pivot table level. When I try to insert a server listener, it shows the error message
      "Cannot insert <serverlistener> at the current insertion location because the element is not valid at that location".

      I have also tested a simple stamped pivot table with no listeners i.e. it just displays the page with no mouse interaction, the same problem occurs.

      Problem 2 : Another problem is where should I define the javascript functions if I have to use the same functionality using the JSF page fragments
      instead of a JSF page. This problem is entirely different and nothing to do with Problem 1.

      Softwares :
      JDeveloper Studio Edition Version 11.1.1.3.0 on Windows XP.


      I would appreciate a guidance in this matter.

      Regards

      Abhay


      **************VBChartPage.jspx

      <?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: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" binding="#{backingBeanScope.VBChartPageMB.d1}">
      <af:messages binding="#{backingBeanScope.VBChartPageMB.m1}" id="m1"/>
      <af:resource type="javascript">
      function handlePivotMouse(evt2) {
      var co = evt2.getSource() ;
      var tt = evt2.getType() ;
      var ci = co.getProperty("shortDesc") ;
      var cu = new AdfCustomEvent(co, "customEvent", {eventtype:tt,cellindex:ci}, true) ;
      cu.queue();
      }
      </af:resource>
      <af:form id="f1" binding="#{backingBeanScope.VBChartPageMB.f1}">
      <af:panelStretchLayout binding="#{backingBeanScope.VBChartPageMB.psl1}"
      id="psl1">
      <f:facet name="bottom"/>
      <f:facet name="center">
      <dvt:pivotTable id="pivotTable1"
      value="#{bindings.VBChartView1.pivotTableModel}"
      binding="#{backingBeanScope.VBChartPageMB.pivotTable1}"
      var="cellData"
      dataFormat="#{backingBeanScope.VBChartPageMB.getDataFormat}">
      <dvt:dataCell>
      <af:outputText value="#{cellData.dataValue}"
      binding="#{backingBeanScope.VBChartPageMB.ot1}"
      id="ot1">
      <af:clientListener method="handlePivotMouse" type="mouseUp"/>
      <af:clientListener method="handlePivotMouse"
      type="mouseDown"/>
      <af:clientListener method="handlePivotMouse"
      type="mouseMove"/>
      <af:clientAttribute name="shortDesc"
      value="#{backingBeanScope.VBChartPageMB.pivotTable1.cellIndex}"/>
      <af:serverListener type="customEvent"
      method="#{backingBeanScope.VBChartPageMB.handleEvent}"/>
      </af:outputText>
      </dvt:dataCell>
      </dvt:pivotTable>
      </f:facet>
      <f:facet name="start"/>
      <f:facet name="end">
      <af:region value="#{bindings.vbchartflow1.regionModel}" id="r1"
      binding="#{backingBeanScope.VBChartPageMB.r1}"
      rendered="false"/>
      </f:facet>
      <f:facet name="top"/>
      </af:panelStretchLayout>
      </af:form>
      </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:VBChartPageMB-->
      </jsp:root>
      ********************** code from VBChartPage.java

      package test.misc.mousetest.ui.mbeans;

      import oracle.adf.view.faces.bi.component.pivotTable.CellFormat;
      import oracle.adf.view.faces.bi.component.pivotTable.DataCellContext;
      import oracle.adf.view.faces.bi.component.pivotTable.UIPivotTable;
      import oracle.adf.view.rich.component.rich.RichDocument;
      import oracle.adf.view.rich.component.rich.RichForm;
      import oracle.adf.view.rich.component.rich.fragment.RichRegion;
      import oracle.adf.view.rich.component.rich.layout.RichPanelStretchLayout;
      import oracle.adf.view.rich.component.rich.output.RichMessages;
      import oracle.adf.view.rich.component.rich.output.RichOutputText;
      import oracle.adf.view.rich.render.ClientEvent;

      public class VBChartPage {
      private RichForm f1;
      private RichDocument d1;
      private RichPanelStretchLayout psl1;
      private RichMessages m1;
      private UIPivotTable pivotTable1;
      private RichOutputText ot1;
      private static boolean mousePressed = false ;
      private RichRegion r1;

      public void setF1(RichForm f1) {
      this.f1 = f1;
      }

      public RichForm getF1() {
      return f1;
      }

      public void setD1(RichDocument d1) {
      this.d1 = d1;
      }

      public RichDocument getD1() {
      return d1;
      }

      public void setPsl1(RichPanelStretchLayout psl1) {
      this.psl1 = psl1;
      }

      public RichPanelStretchLayout getPsl1() {
      return psl1;
      }


      public void setM1(RichMessages m1) {
      this.m1 = m1;
      }

      public RichMessages getM1() {
      return m1;
      }

      public void setPivotTable1(UIPivotTable pivotTable1) {
      this.pivotTable1 = pivotTable1;
      }

      public UIPivotTable getPivotTable1() {
      return pivotTable1;
      }

      public void setOt1(RichOutputText ot1) {
      this.ot1 = ot1;
      }

      public RichOutputText getOt1() {
      return ot1;
      }

      public void handleEvent( ClientEvent ce) {
      mousePressed = PivotChartHandler.processMouseEvent(ce, pivotTable1, mousePressed) ;

      }

      public CellFormat getDataFormat(DataCellContext dataCellContext) {
      // Add event code here...
      CellFormat cf = new CellFormat(null,"","") ;
      if ( !mousePressed )
      cf.setStyle("background-color:white");
      else
      cf.setStyle("background-color:Yellow");

      cf.setNewRawValue("0");
      }
      return cf;
      }

      public void setR1(RichRegion r1) {
      this.r1 = r1;
      }

      public RichRegion getR1() {
      return r1;
      }
      }

      ****************************************************