Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.olap
Class OlapCellRenderer

java.lang.Object
  extended by com.citra.pivot.olap.OlapCellRenderer
All Implemented Interfaces:
TableCellRenderer

public class OlapCellRenderer
extends Object
implements TableCellRenderer

OlapCellRenderer is the default renderer for the data cells of an olap pivot table.


Field Summary
protected  Map defaultRenderersByMeasure
          a map that contains table cell renderers vs olap measures
protected  Map formattedValuesByMeasure
          a map that contains boolean flags vs olap measures
protected  boolean globalUseFormattedValue
          determines whether the olap cell's formatted value should be used in rendering
 
Constructor Summary
OlapCellRenderer()
          Constructs an OlapCellRenderer.
 
Method Summary
 TableCellRenderer getDefaultRenderer(OlapMeasure measure)
          Determines the renderer for the given measure, if any.
 boolean getGlobalUseFormattedValue()
          Determines whether the renderer will use the formatted values of an olap cell when rendering.
protected  TableCellRenderer getTableCellRenderer(JTable table, OlapCell cell)
          Determines the renderer to use for the given olap cell.
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns the component used for drawing the cell.
 boolean getUseFormattedValue(OlapMeasure measure)
          Determines whether the renderer will use the formatted values of an olap cell when rendering, for the given measure.
protected  Object getValue(OlapCell cell)
          Retrieves the value to use for rendering for the given olap cell.
 void setDefaultRenderer(OlapMeasure measure, TableCellRenderer renderer)
          Assigns the renderer to use for the given measure.
 void setGlobalUseFormattedValue(boolean globalUseFormattedValue)
          Determines whether the renderer will use the formatted values of an olap cell when rendering.
 void setUseFormattedValue(OlapMeasure measure, boolean useFormattedValue)
          Determines whether the renderer will use the formatted values of an olap cell when rendering, for the given measure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

globalUseFormattedValue

protected boolean globalUseFormattedValue
determines whether the olap cell's formatted value should be used in rendering


defaultRenderersByMeasure

protected Map defaultRenderersByMeasure
a map that contains table cell renderers vs olap measures


formattedValuesByMeasure

protected Map formattedValuesByMeasure
a map that contains boolean flags vs olap measures

Constructor Detail

OlapCellRenderer

public OlapCellRenderer()
Constructs an OlapCellRenderer.

Method Detail

getDefaultRenderer

public TableCellRenderer getDefaultRenderer(OlapMeasure measure)
Determines the renderer for the given measure, if any.

Parameters:
measure - the measure whose renderer is returned
Returns:
the renderer, if any, for the given measure

getGlobalUseFormattedValue

public boolean getGlobalUseFormattedValue()
Determines whether the renderer will use the formatted values of an olap cell when rendering.

Returns:
true if the formatted value is used, false otherwise

getTableCellRenderer

protected TableCellRenderer getTableCellRenderer(JTable table,
                                                 OlapCell cell)
Determines the renderer to use for the given olap cell.

Parameters:
table - the pivot table
cell - the cell whose renderer is retrieved
Returns:
the cell's renderer

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Returns the component used for drawing the cell. This method is used to configure the renderer appropriately before drawing.

Specified by:
getTableCellRendererComponent in interface TableCellRenderer
Parameters:
table - the JTable that is asking the renderer to draw; can be null
value - the value of the cell to be rendered. It is up to the specific renderer to interpret and draw the value. For example, if value is the string "true", it could be rendered as a string or it could be rendered as a check box that is checked. null is a valid value
isSelected - true if the cell is to be rendered with the selection highlighted; otherwise false
hasFocus - if true, render cell appropriately. For example, put a special border on the cell, if the cell can be edited, render in the color used to indicate editing
row - the row index of the cell being drawn. When drawing the header, the value of row is -1
column - the column index of the cell being drawn

getUseFormattedValue

public boolean getUseFormattedValue(OlapMeasure measure)
Determines whether the renderer will use the formatted values of an olap cell when rendering, for the given measure.

Parameters:
measure - the given measure
Returns:
true if the formatted value is used, false otherwise

getValue

protected Object getValue(OlapCell cell)
Retrieves the value to use for rendering for the given olap cell.

Parameters:
cell - the olap cell whose value is rerieved
Returns:
the value to render

setDefaultRenderer

public void setDefaultRenderer(OlapMeasure measure,
                               TableCellRenderer renderer)
Assigns the renderer to use for the given measure.

Parameters:
measure - the measure whose renderer is assigned
renderer - the renderer to assign

setGlobalUseFormattedValue

public void setGlobalUseFormattedValue(boolean globalUseFormattedValue)
Determines whether the renderer will use the formatted values of an olap cell when rendering.

Parameters:
globalUseFormattedValue - true if the formatted value is used, false otherwise

setUseFormattedValue

public void setUseFormattedValue(OlapMeasure measure,
                                 boolean useFormattedValue)
Determines whether the renderer will use the formatted values of an olap cell when rendering, for the given measure.

Parameters:
measure - the given measure
useFormattedValue - true if the formatted value is used, false otherwise

Copyright © 2011 Citra Technologies. All Rights Reserved.