org.zkoss.pivot.impl
Class SimplePivotRenderer

java.lang.Object
  extended by org.zkoss.pivot.impl.SimplePivotRenderer
All Implemented Interfaces:
PivotRenderer, PivotRendererExt

public class SimplePivotRenderer
extends java.lang.Object
implements PivotRendererExt

A basic implementation of PivotRenderer.

Author:
simonpai

Constructor Summary
SimplePivotRenderer()
           
 
Method Summary
 int getColumnSize(Pivottable table, PivotHeaderContext colc, PivotField field)
          Returns the column size in pixel.
 int getRowSize(Pivottable table, PivotHeaderContext rowc, PivotField field)
          Returns the row size in pixel.
 java.lang.String renderCell(java.lang.Number data, Pivottable table, PivotHeaderContext rowContext, PivotHeaderContext columnContext, PivotField dataField)
          Renders the content of each cell.
 java.lang.String renderCellSClass(java.lang.Number data, Pivottable table, PivotHeaderContext rowContext, PivotHeaderContext columnContext, PivotField dataField)
          Specify a CSS class on the cell.
 java.lang.String renderCellStyle(java.lang.Number data, Pivottable table, PivotHeaderContext rowContext, PivotHeaderContext columnContext, PivotField dataField)
          Specify the CSS style on the cell.
 java.lang.String renderDataField(PivotField field)
          Renders the label of a data field, shown when there are multiple data fields.
 java.lang.String renderField(java.lang.Object data, Pivottable table, PivotField field)
          Renders the label of a header field in columns and rows.
 java.lang.String renderGrandTotalField(Pivottable table, PivotField field)
          Renders the title of a grand total field.
 java.lang.String renderSubtotalField(java.lang.Object data, Pivottable table, PivotField field, Calculator calculator)
          Renders the label of a subtotal field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePivotRenderer

public SimplePivotRenderer()
Method Detail

renderCell

public java.lang.String renderCell(java.lang.Number data,
                                   Pivottable table,
                                   PivotHeaderContext rowContext,
                                   PivotHeaderContext columnContext,
                                   PivotField dataField)
Description copied from interface: PivotRenderer
Renders the content of each cell. (excluding row fields, column fields)

Specified by:
renderCell in interface PivotRenderer
Parameters:
data - data object
rowContext - row header context object
columnContext - column header context object
See Also:
PivotHeaderContext

getColumnSize

public int getColumnSize(Pivottable table,
                         PivotHeaderContext colc,
                         PivotField field)
Description copied from interface: PivotRenderer
Returns the column size in pixel.

Note that the cell field always from 0 to m, and the returned value is never negative.

Specified by:
getColumnSize in interface PivotRenderer
Parameters:
table - the Pivottable
colc - information of the corresponding column
field - the field corresponds to the leaf column cell. Can be row, column, data field, or null (only in the case of grand total)

getRowSize

public int getRowSize(Pivottable table,
                      PivotHeaderContext rowc,
                      PivotField field)
Description copied from interface: PivotRenderer
Returns the row size in pixel.

Note that the cell field always from 0 to m, and the returned value is never negative.

Specified by:
getRowSize in interface PivotRenderer
Parameters:
table - the Pivottable
rowc - information of the corresponding row
field - the field corresponds to the leaf row cell. Can be row, column, data field, or null (only in the case of grand total)

renderField

public java.lang.String renderField(java.lang.Object data,
                                    Pivottable table,
                                    PivotField field)
Description copied from interface: PivotRenderer
Renders the label of a header field in columns and rows.

Specified by:
renderField in interface PivotRenderer
Parameters:
data - data object
field - PivotField
See Also:
PivotField

renderGrandTotalField

public java.lang.String renderGrandTotalField(Pivottable table,
                                              PivotField field)
Description copied from interface: PivotRenderer
Renders the title of a grand total field.

Specified by:
renderGrandTotalField in interface PivotRenderer
field - a data PivotField

renderSubtotalField

public java.lang.String renderSubtotalField(java.lang.Object data,
                                            Pivottable table,
                                            PivotField field,
                                            Calculator calculator)
Description copied from interface: PivotRenderer
Renders the label of a subtotal field.

Specified by:
renderSubtotalField in interface PivotRenderer
Parameters:
data - data object
field - PivotField
calculator - the subtotal calculator
See Also:
PivotField, Calculator

renderDataField

public java.lang.String renderDataField(PivotField field)
Description copied from interface: PivotRenderer
Renders the label of a data field, shown when there are multiple data fields.

Specified by:
renderDataField in interface PivotRenderer

renderCellSClass

public java.lang.String renderCellSClass(java.lang.Number data,
                                         Pivottable table,
                                         PivotHeaderContext rowContext,
                                         PivotHeaderContext columnContext,
                                         PivotField dataField)
Description copied from interface: PivotRendererExt
Specify a CSS class on the cell.

Specified by:
renderCellSClass in interface PivotRendererExt
Parameters:
data - data object
rowContext - row header context object
columnContext - column header context object
Returns:
a CSS class name, or null to ignore
See Also:
PivotHeaderContext

renderCellStyle

public java.lang.String renderCellStyle(java.lang.Number data,
                                        Pivottable table,
                                        PivotHeaderContext rowContext,
                                        PivotHeaderContext columnContext,
                                        PivotField dataField)
Description copied from interface: PivotRendererExt
Specify the CSS style on the cell.

Specified by:
renderCellStyle in interface PivotRendererExt
Parameters:
data - data object
rowContext - row header context object
columnContext - column header context object
Returns:
a CSS style string, or null to ignore
See Also:
PivotHeaderContext


Copyright © 2012. All Rights Reserved.