org.openi.chart
Class EnhancedChartComponent

java.lang.Object
  extended bycom.tonbeller.wcf.component.ComponentSupport
      extended bycom.tonbeller.jpivot.chart.ChartComponent
          extended byorg.openi.chart.EnhancedChartComponent
All Implemented Interfaces:
com.tonbeller.wcf.bookmarks.Bookmarkable, com.tonbeller.wcf.component.Component, java.util.EventListener, com.tonbeller.wcf.component.Form, com.tonbeller.wcf.component.FormListener, javax.servlet.http.HttpSessionBindingListener, com.tonbeller.wcf.component.LifeCycle, com.tonbeller.jpivot.core.ModelChangeListener, com.tonbeller.wcf.component.Renderable, com.tonbeller.wcf.controller.RequestListener, com.tonbeller.wcf.component.RoleExprHolder, com.tonbeller.wcf.component.Visible

public class EnhancedChartComponent
extends com.tonbeller.jpivot.chart.ChartComponent
implements com.tonbeller.jpivot.core.ModelChangeListener

Started as an exact copy of com.tonbeller.jpivot.chart.ChartComponent. Needed to enhance the render functionality to handle different series colors and palettes. There was no way to overload, override that functionality without copying a significant amount of the class, so here is a complete copy. Will likely evolve into something quite different.


Nested Class Summary
 class EnhancedChartComponent.jpivotCategoryURLGenerator
          A URLGenerator class to generate chart urls that work with jpivot
 class EnhancedChartComponent.jpivotPieURLGenerator
          A URLGenerator class to generate pie urls that work with jpivot
 
Field Summary
protected  java.lang.String axisFontName
           
protected  int axisFontSize
           
protected  int axisFontStyle
           
protected  java.lang.String axisTickFontName
           
protected  int axisTickFontSize
           
protected  int axisTickFontStyle
           
protected  int bgColorB
           
protected  int bgColorG
           
protected  int bgColorR
           
protected  java.lang.String CHART_SERVLET
           
protected  int chartHeight
           
protected  java.lang.String chartTitle
           
protected  int chartType
           
protected  int chartWidth
           
protected  int colCount
           
protected  java.util.List colorPalette
           
protected  boolean dirty
           
protected  com.tonbeller.wcf.controller.Dispatcher dispatcher
           
protected  org.w3c.dom.Document document
           
protected  boolean drillThroughEnabled
           
protected  java.lang.String filename
           
protected  java.lang.String fontName
           
protected  int fontSize
           
protected  int fontStyle
           
protected  double foregroundAlpha
           
protected  java.lang.String horizAxisLabel
           
protected  org.jfree.chart.ChartRenderingInfo info
           
protected  java.lang.String legendFontName
           
protected  int legendFontSize
           
protected  int legendFontStyle
           
protected  int legendPosition
           
protected  java.util.Locale locale
           
protected  com.tonbeller.jpivot.olap.model.OlapModel olapModel
           
protected  java.lang.String ref
           
protected  org.w3c.dom.Element rootElement
           
protected  boolean showLegend
           
protected  boolean showPareto
           
protected  boolean showSlicer
           
protected  boolean showTooltips
           
protected  int slicerAlignment
           
protected  java.lang.String slicerFontName
           
protected  int slicerFontSize
           
protected  int slicerFontStyle
           
protected  int slicerPosition
           
protected  int tickLabelRotate
           
protected  java.awt.Font titleFont
           
protected  boolean useChartSize
           
protected  java.lang.String vertAxisLabel
           
 
Fields inherited from interface com.tonbeller.wcf.bookmarks.Bookmarkable
EXTENSIONAL, INTENSIONAL
 
Constructor Summary
EnhancedChartComponent(java.lang.String id, com.tonbeller.wcf.component.Component parent, java.lang.String ref, com.tonbeller.wcf.controller.RequestContext context)
          Constructor
 
Method Summary
protected  boolean canDrillThrough(com.tonbeller.jpivot.olap.model.Cell cell)
           
protected  com.tonbeller.wcf.table.TableModel drillThrough(com.tonbeller.jpivot.olap.model.Cell cell)
          returns a DrillThroughTableModel for the drill through
 java.lang.String getAxisFontName()
           
 int getAxisFontSize()
           
 int getAxisFontStyle()
           
 java.lang.String getAxisTickFontName()
           
 int getAxisTickFontSize()
           
 int getAxisTickFontStyle()
           
 int getBgColorB()
           
 int getBgColorG()
           
 int getBgColorR()
           
 int getChartHeight()
           
 java.lang.String getChartTitle()
           
 int getChartType()
           
 int getChartWidth()
           
 int getColCount()
           
 java.util.List getColorPalette()
           
 java.lang.String getFilename()
           
 java.lang.String getFontName()
           
 int getFontSize()
           
 int getFontStyle()
           
 double getForegroundAlpha()
           
 java.lang.String getHorizAxisLabel()
           
 java.lang.String getLegendFontName()
           
 int getLegendFontSize()
           
 int getLegendFontStyle()
           
 int getLegendPosition()
           
 boolean getShowLegend()
           
 boolean getShowPareto()
           
 int getSlicerAlignment()
           
 java.lang.String getSlicerFontName()
           
 int getSlicerFontSize()
           
 int getSlicerFontStyle()
           
 int getSlicerPosition()
           
 int getTickLabelRotate()
           
 java.lang.String getVertAxisLabel()
           
 void initialize(com.tonbeller.wcf.controller.RequestContext context)
          called once by the creating tag
 boolean isDirty()
          true means that render() will create a new chart
 boolean isDrillThroughEnabled()
           
 boolean isShowSlicer()
           
 boolean isUseChartSize()
           
 void modelChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
           
 org.w3c.dom.Document render(com.tonbeller.wcf.controller.RequestContext context)
          Entry point for producing charts, called by wcf render tag.
 void setAxisFontName(java.lang.String axisFontName)
           
 void setAxisFontSize(int axisFontSize)
           
 void setAxisFontStyle(int axisFontStyle)
           
 void setAxisTickFontName(java.lang.String axisTickFontName)
           
 void setAxisTickFontSize(int axisTickFontSize)
           
 void setAxisTickFontStyle(int axisTickFontStyle)
           
 void setBgColorB(int bgColorB)
           
 void setBgColorG(int bgColorG)
           
 void setBgColorR(int bgColorR)
           
 void setChartHeight(int chartHeight)
           
 void setChartTitle(java.lang.String chartTitle)
           
 void setChartType(int chartType)
           
 void setChartWidth(int chartWidth)
           
 void setColorPalette(java.util.List seriesPalette)
           
 void setDirty(boolean dirty)
           
 void setDrillThroughEnabled(boolean drillThroughEnabled)
           
 void setFontName(java.lang.String fontname)
           
 void setFontSize(int fontSize)
           
 void setFontStyle(int fontStyle)
           
 void setForegroundAlpha(double foregroundAlpha)
           
 void setHorizAxisLabel(java.lang.String axisLabel)
           
 void setLegendFontName(java.lang.String legendFontName)
           
 void setLegendFontSize(int legendFontSize)
           
 void setLegendFontStyle(int legendFontStyle)
           
 void setLegendPosition(int legendPosition)
           
 void setShowLegend(boolean showLegend)
           
 void setShowPareto(boolean showPareto)
           
 void setShowSlicer(boolean showSlicer)
           
 void setSlicerAlignment(int slicerAlignment)
           
 void setSlicerFontName(java.lang.String slicerFontName)
           
 void setSlicerFontSize(int slicerFontSize)
           
 void setSlicerFontStyle(int slicerFontStyle)
           
 void setSlicerPosition(int slicerPosition)
           
 void setTickLabelRotate(int tickLabelRotate)
           
 void setUseChartSize(boolean useChartSize)
           
 void setVertAxisLabel(java.lang.String axisLabel)
           
 void structureChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
           
 java.lang.String writeImageMap(java.lang.String name, org.jfree.chart.ChartRenderingInfo info, boolean useOverLibForToolTips)
          Writes an image map as a String This function has been requested to be added to jfreechart Also requires slight change to ChartEntity.getImageMapAreaTag() to produce valid xml tag and use & entity in urls.
 
Methods inherited from class com.tonbeller.wcf.component.ComponentSupport
addFormListener, destroy, getBookmarkState, getDispatcher, getForm, getId, getLocale, getNextView, getParent, getRoleExpr, isAutoValidate, isVisible, removeFormListener, request, revert, setAutoValidate, setBookmarkState, setId, setNextView, setParent, setRoleExpr, setVisible, validate, valueBound, valueUnbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected java.lang.String ref

document

protected org.w3c.dom.Document document

olapModel

protected com.tonbeller.jpivot.olap.model.OlapModel olapModel

dirty

protected boolean dirty

locale

protected java.util.Locale locale

rootElement

protected org.w3c.dom.Element rootElement

colCount

protected int colCount

CHART_SERVLET

protected java.lang.String CHART_SERVLET

filename

protected java.lang.String filename

chartTitle

protected java.lang.String chartTitle

titleFont

protected java.awt.Font titleFont

fontName

protected java.lang.String fontName

fontStyle

protected int fontStyle

fontSize

protected int fontSize

slicerFontName

protected java.lang.String slicerFontName

slicerFontStyle

protected int slicerFontStyle

slicerFontSize

protected int slicerFontSize

axisFontName

protected java.lang.String axisFontName

axisFontStyle

protected int axisFontStyle

axisFontSize

protected int axisFontSize

axisTickFontName

protected java.lang.String axisTickFontName

axisTickFontStyle

protected int axisTickFontStyle

axisTickFontSize

protected int axisTickFontSize

legendFontName

protected java.lang.String legendFontName

legendFontStyle

protected int legendFontStyle

legendFontSize

protected int legendFontSize

legendPosition

protected int legendPosition

slicerPosition

protected int slicerPosition

slicerAlignment

protected int slicerAlignment

bgColorR

protected int bgColorR

bgColorG

protected int bgColorG

bgColorB

protected int bgColorB

chartType

protected int chartType

chartHeight

protected int chartHeight

chartWidth

protected int chartWidth

horizAxisLabel

protected java.lang.String horizAxisLabel

vertAxisLabel

protected java.lang.String vertAxisLabel

showLegend

protected boolean showLegend

showSlicer

protected boolean showSlicer

showTooltips

protected boolean showTooltips

drillThroughEnabled

protected boolean drillThroughEnabled

tickLabelRotate

protected int tickLabelRotate

info

protected org.jfree.chart.ChartRenderingInfo info

dispatcher

protected com.tonbeller.wcf.controller.Dispatcher dispatcher

colorPalette

protected java.util.List colorPalette

foregroundAlpha

protected double foregroundAlpha

showPareto

protected boolean showPareto

useChartSize

protected boolean useChartSize
Constructor Detail

EnhancedChartComponent

public EnhancedChartComponent(java.lang.String id,
                              com.tonbeller.wcf.component.Component parent,
                              java.lang.String ref,
                              com.tonbeller.wcf.controller.RequestContext context)
Constructor

Parameters:
id - the id of this component
ref - a reference to an olap model
Method Detail

initialize

public void initialize(com.tonbeller.wcf.controller.RequestContext context)
                throws java.lang.Exception
called once by the creating tag

Specified by:
initialize in interface com.tonbeller.wcf.component.LifeCycle
Throws:
java.lang.Exception

render

public org.w3c.dom.Document render(com.tonbeller.wcf.controller.RequestContext context)
                            throws java.lang.Exception
Entry point for producing charts, called by wcf render tag. Produces a jfreechart dataset from olap model, then creates a chart and writes it to the servlet container temp directory. Returns a DOM document for Renderer to transform into html. Requires that jfreechart servlet is installed in this application context.

Specified by:
render in interface com.tonbeller.wcf.component.Renderable
Throws:
java.lang.Exception

writeImageMap

public java.lang.String writeImageMap(java.lang.String name,
                                      org.jfree.chart.ChartRenderingInfo info,
                                      boolean useOverLibForToolTips)
Writes an image map as a String This function has been requested to be added to jfreechart Also requires slight change to ChartEntity.getImageMapAreaTag() to produce valid xml tag and use & entity in urls. Diffs sent to jfreechart project - so hopefully this will be in there soon

Parameters:
name - the map name.
info - the chart rendering info.
useOverLibForToolTips - whether to use OverLIB for tooltips (http://www.bosrup.com/web/overlib/).

getColCount

public int getColCount()
Returns:

isDirty

public boolean isDirty()
true means that render() will create a new chart


setDirty

public void setDirty(boolean dirty)

modelChanged

public void modelChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
Specified by:
modelChanged in interface com.tonbeller.jpivot.core.ModelChangeListener

structureChanged

public void structureChanged(com.tonbeller.jpivot.core.ModelChangeEvent e)
Specified by:
structureChanged in interface com.tonbeller.jpivot.core.ModelChangeListener

getChartHeight

public int getChartHeight()
Returns:

setChartHeight

public void setChartHeight(int chartHeight)
Parameters:
chartHeight -

getChartTitle

public java.lang.String getChartTitle()
Returns:

setChartTitle

public void setChartTitle(java.lang.String chartTitle)
Parameters:
chartTitle -

getChartType

public int getChartType()
Returns:

setChartType

public void setChartType(int chartType)
Parameters:
chartType -

getChartWidth

public int getChartWidth()
Returns:

setChartWidth

public void setChartWidth(int chartWidth)
Parameters:
chartWidth -

getHorizAxisLabel

public java.lang.String getHorizAxisLabel()
Returns:

setHorizAxisLabel

public void setHorizAxisLabel(java.lang.String axisLabel)
Parameters:
axisLabel -

getShowLegend

public boolean getShowLegend()
Returns:

setShowLegend

public void setShowLegend(boolean showLegend)
Parameters:
showLegend -

getFontName

public java.lang.String getFontName()
Returns:

setFontName

public void setFontName(java.lang.String fontname)

getVertAxisLabel

public java.lang.String getVertAxisLabel()
Returns:

setVertAxisLabel

public void setVertAxisLabel(java.lang.String axisLabel)
Parameters:
axisLabel -

getFontSize

public int getFontSize()
Returns:

setFontSize

public void setFontSize(int fontSize)
Parameters:
fontSize -

getFontStyle

public int getFontStyle()
Returns:

setFontStyle

public void setFontStyle(int fontStyle)
Parameters:
fontStyle -

getBgColorB

public int getBgColorB()
Returns:

setBgColorB

public void setBgColorB(int bgColorB)
Parameters:
bgColorB -

getBgColorG

public int getBgColorG()
Returns:

setBgColorG

public void setBgColorG(int bgColorG)
Parameters:
bgColorG -

getBgColorR

public int getBgColorR()
Returns:

setBgColorR

public void setBgColorR(int bgColorR)
Parameters:
bgColorR -

canDrillThrough

protected boolean canDrillThrough(com.tonbeller.jpivot.olap.model.Cell cell)

drillThrough

protected com.tonbeller.wcf.table.TableModel drillThrough(com.tonbeller.jpivot.olap.model.Cell cell)
returns a DrillThroughTableModel for the drill through

Parameters:
cell -
Returns:

isDrillThroughEnabled

public boolean isDrillThroughEnabled()

setDrillThroughEnabled

public void setDrillThroughEnabled(boolean drillThroughEnabled)

getAxisFontName

public java.lang.String getAxisFontName()
Returns:

setAxisFontName

public void setAxisFontName(java.lang.String axisFontName)
Parameters:
axisFontName -

getAxisFontSize

public int getAxisFontSize()
Returns:

setAxisFontSize

public void setAxisFontSize(int axisFontSize)
Parameters:
axisFontSize -

getAxisFontStyle

public int getAxisFontStyle()
Returns:

setAxisFontStyle

public void setAxisFontStyle(int axisFontStyle)
Parameters:
axisFontStyle -

getLegendFontName

public java.lang.String getLegendFontName()
Returns:

setLegendFontName

public void setLegendFontName(java.lang.String legendFontName)
Parameters:
legendFontName -

getLegendFontSize

public int getLegendFontSize()
Returns:

setLegendFontSize

public void setLegendFontSize(int legendFontSize)
Parameters:
legendFontSize -

getLegendFontStyle

public int getLegendFontStyle()
Returns:

setLegendFontStyle

public void setLegendFontStyle(int legendFontStyle)
Parameters:
legendFontStyle -

getSlicerAlignment

public int getSlicerAlignment()
Returns:

setSlicerAlignment

public void setSlicerAlignment(int slicerAlignment)
Parameters:
slicerAlignment -

getSlicerFontName

public java.lang.String getSlicerFontName()
Returns:

setSlicerFontName

public void setSlicerFontName(java.lang.String slicerFontName)
Parameters:
slicerFontName -

getSlicerFontSize

public int getSlicerFontSize()
Returns:

setSlicerFontSize

public void setSlicerFontSize(int slicerFontSize)
Parameters:
slicerFontSize -

getSlicerFontStyle

public int getSlicerFontStyle()
Returns:

setSlicerFontStyle

public void setSlicerFontStyle(int slicerFontStyle)
Parameters:
slicerFontStyle -

getSlicerPosition

public int getSlicerPosition()
Returns:

setSlicerPosition

public void setSlicerPosition(int slicerPosition)
Parameters:
slicerPosition -

getLegendPosition

public int getLegendPosition()
Returns:

setLegendPosition

public void setLegendPosition(int legendPosition)
Parameters:
legendPosition -

getAxisTickFontName

public java.lang.String getAxisTickFontName()
Returns:

setAxisTickFontName

public void setAxisTickFontName(java.lang.String axisTickFontName)
Parameters:
axisTickFontName -

getAxisTickFontSize

public int getAxisTickFontSize()
Returns:

setAxisTickFontSize

public void setAxisTickFontSize(int axisTickFontSize)
Parameters:
axisTickFontSize -

getAxisTickFontStyle

public int getAxisTickFontStyle()
Returns:

setAxisTickFontStyle

public void setAxisTickFontStyle(int axisTickFontStyle)
Parameters:
axisTickFontStyle -

getTickLabelRotate

public int getTickLabelRotate()
Returns:
Returns the tickLabelRotate.

setTickLabelRotate

public void setTickLabelRotate(int tickLabelRotate)
Parameters:
tickLabelRotate - The tickLabelRotate to set.

isShowSlicer

public boolean isShowSlicer()
Returns:

setShowSlicer

public void setShowSlicer(boolean showSlicer)
Parameters:
showSlicer -

getFilename

public java.lang.String getFilename()
Returns:

getColorPalette

public java.util.List getColorPalette()
Returns:
Returns the colorPalette.

setColorPalette

public void setColorPalette(java.util.List seriesPalette)

getShowPareto

public boolean getShowPareto()
Returns:
Returns the generatePareto.

getForegroundAlpha

public double getForegroundAlpha()

isUseChartSize

public boolean isUseChartSize()

setShowPareto

public void setShowPareto(boolean showPareto)

setForegroundAlpha

public void setForegroundAlpha(double foregroundAlpha)

setUseChartSize

public void setUseChartSize(boolean useChartSize)