How to Create a CellFormat Object for a Data Cell

Using ADF Pivot Table Components 26-13 } cellFormat.setStylecolor; } return cellFormat; }

26.10 Pivot Table Data Cell Stamping and Editing

The content in a pivot table data cell can be stamped using the dvt:dataCell child component to place a read-only or input component in each data cell. When you use stamping, child components are not created for every data cell in a pivot table. Rather, the content of the dvt:dataCell component is repeatedly rendered, or stamped, once per data attribute, such as the rows in a pivot table. Only certain types of components are supported, including all components with no activity and most components that implement the EditableValueHolder or ActionSource interfaces. You can also use stamping to specify custom CSS styles for the data cell. Each time a child component is stamped, the data for the current cell is copied into a var property used by the data cell component in an EL Expression. Once the pivot table has completed rendering, the var property is removed, or reverted back to its previous value. Data cell editing is enabled by using an input component as the child component of dvt:dataCell. At runtime you can open the cell for editing by double-clicking the cell in the pivot table, or by selecting the cell and pressing F2. Example 26–7 shows sample code for data cell stamping. Example 26–7 Data Cell Stamping Sample Code dvt:pivotTable var=cellData varStatus=cellStatus dvt:dataCell af:switcher defaultFacet=default facetName={cellStatus.members.MeasDim.value} f:facet name=Sales af:inputText value={cellData.dataValue} f:facet f:facet name=Weight af:outputText value={cellData.dataValue} inlineStyle={cellStatus.cellFormat.textStyle} f:facet f:facet name=Available af:selectBooleanCheckbox id=idselectbooleancheckbox label=Availability text=Item Available autoSubmit=true value={cellData.dataValue} f:facet f:facet name=default af:outputText value={cellData.dataValue} f:facet af:switcher dvt:dataCell dvt:pivotTable Figure 26–14 shows the resulting pivot table. 26-14 Web User Interface Developers Guide for Oracle Application Development Framework Figure 26–14 Pivot Table Using Data Cell Stamping

26.10.1 How to Specify Custom Images for Data Cells

With data cell stamping you can use the dvt:dataCell tag to specify a custom image for a data cell using af:image, af:icon, or af:commandImageLink as a child tag. Example 26–8 shows sample code for using an af:commandImageLink as a custom image in a pivot table data cell. Example 26–8 Using a Custom Image for a Data Cell dvt:pivotTable var=cellData varStatus=cellStatus -- This is the default data cell that will be used for all data attributes-- dvt:dataCell af:commandImageLink text=Go icon=imagesgo.gif actionListener={pivotTableBean.imageLinkClick} af:outputText value={cellData.dataValue} dvt:dataCell dvt:pivotTable Actions associated with the image are handled through a registered listener, actionListener. In a bean class you specify the method to be called when the image link is clicked, for example: public void imageLinkClick javax.faces.event.ActionEvent.action

26.10.2 How to Specify Images, Icons, Links, and Read-Only Content in Header Cells

In the same way that you use stamping in data cells, you can customize the content in header cells using the dvt:headerCell child component to place a read-only component in each header cell. Only read-only components or noneditable components are supported, including af:outputText, af:image, af:icon, af:commandImageLink, and af:commandLink. Example 26–9 shows sample code for using an af:commandImageLink as a custom image and af:icon as a custom icon in pivot table header cells. Example 26–9 Using Custom Components in Header Cells dvt:pivotTable id=goodPT binding={pivotTableHeaderCellDemo.pivotTable} contentDelivery=immediate value={pivotTableHeaderCellDemo.dataModel} var=cellData varStatus=cellStatus -- header cell components -- Note: In order to temporarily or permanently write values back to a set of cells within a cube, called a writeback, the pivot table must be bound to a data control or data model that supports writeback operations. A row set based data control is transformed into a cube and therefore cannot support writeback operations.