com.jalios.jtaglib
Class ChartTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.jalios.jtaglib.ChartTag
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class ChartTag
extends javax.servlet.jsp.tagext.TagSupport

This tag prints a date.

Version:
$Revision: 27752 $
Author:
Jean-Philippe Encausse
See Also:
Serialized Form

Field Summary
protected  ChartTagBeautifier beautifier
           
protected  int color
           
protected  int colorFirst
           
protected  int colorRotate
           
protected  String[] colors
           
static String[] COLORS
           
protected  int countValue
           
protected  ObjectIntTreeMap dataMap
           
protected  String display
           
static String DISPLAY_HCHART
           
static String DISPLAY_TABLECHART
           
static String DISPLAY_VCHART
           
protected  int fixHLegWidth
           
protected  int height
           
protected  boolean isPercent
           
protected  Comparator lgdCmpt
           
protected  Locale locale
           
protected  int max
           
protected  int maxValue
           
protected  boolean maxValueSet
           
protected  boolean mixedChart
           
protected  boolean printChart
           
protected  boolean printCSS
           
static String REVISION
           
protected  String sort
           
static String SORT_GREATER
           
static String SORT_LOWER
           
static String SORT_NONE
           
protected  String title
           
protected  String unit
           
protected  int width
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
ChartTag()
           
 
Method Summary
protected  void clean()
           
protected  int countItems()
          Count the number of elements to display depending of the element map
protected  void countMaxValue()
          Get the max value of the map
 int doEndTag()
           
 int doStartTag()
           
protected  void printChartElement(StringBuffer sb, String legend, int value, int color, int spanLegend, boolean separator)
          Print one element of the Chart
protected  void printCSS(StringBuffer sb, int items)
          Print the CSS Style to display correctly chart.
protected  void printHLegendRatio(StringBuffer sb)
          Print Legend 0% - 100% of the Chart
protected  void printLegentChart(StringBuffer sb, List legendList)
          Print Legend Square of the chart
protected  List printMixedChart(StringBuffer sb, ObjectIntTreeMap items)
          Print all items of mixed charts chart
protected  List printNotMixedChart(StringBuffer sb, ObjectIntTreeMap items)
          Print all items of not mixed charts chart
protected  List printSingleChart(StringBuffer sb, ObjectIntTreeMap items, int color)
          Print all items in a chart
protected  void printTitle(StringBuffer sb)
           
protected  void printVChartLegendList(StringBuffer sb, List legendList)
           
protected  void printVLegendRatio(StringBuffer sb)
          Print Legend 0% - 100% of the Chart
 void setBeautifier(ChartTagBeautifier beautifier)
           
 void setColor(int color)
           
 void setColorFirst(int colorFirst)
           
 void setColorRotate(int colorRotate)
           
 void setColors(String[] colors)
           
 void setDataMap(ObjectIntTreeMap dataMap)
           
 void setDisplay(String display)
           
 void setFixHLengthWidth(int fixHLegWidth)
           
 void setHeight(int height)
           
 void setIsPercent(boolean isPercent)
           
 void setLegendComparator(Comparator legendComparator)
           
 void setLocale(Locale locale)
           
 void setMax(int max)
           
 void setMaxValue(int maxValue)
           
 void setMixedChart(boolean mixedChart)
           
 void setPrintChart(boolean printChart)
           
 void setPrintCSS(boolean printCSS)
           
 void setSort(String sort)
           
 void setTitle(String title)
           
 void setUnit(String unit)
           
 void setWidth(int width)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

COLORS

public static String[] COLORS

DISPLAY_VCHART

public static final String DISPLAY_VCHART
See Also:
Constant Field Values

DISPLAY_HCHART

public static final String DISPLAY_HCHART
See Also:
Constant Field Values

DISPLAY_TABLECHART

public static final String DISPLAY_TABLECHART
See Also:
Constant Field Values

SORT_NONE

public static final String SORT_NONE
See Also:
Constant Field Values

SORT_GREATER

public static final String SORT_GREATER
See Also:
Constant Field Values

SORT_LOWER

public static final String SORT_LOWER
See Also:
Constant Field Values

printCSS

protected boolean printCSS

printChart

protected boolean printChart

mixedChart

protected boolean mixedChart

isPercent

protected boolean isPercent

display

protected String display

color

protected int color

colorFirst

protected int colorFirst

colorRotate

protected int colorRotate

colors

protected String[] colors

title

protected String title

dataMap

protected ObjectIntTreeMap dataMap

height

protected int height

width

protected int width

maxValue

protected int maxValue

maxValueSet

protected boolean maxValueSet

countValue

protected int countValue

sort

protected String sort

max

protected int max

fixHLegWidth

protected int fixHLegWidth

beautifier

protected ChartTagBeautifier beautifier

lgdCmpt

protected Comparator lgdCmpt

locale

protected Locale locale

unit

protected String unit
Constructor Detail

ChartTag

public ChartTag()
Method Detail

setSort

public void setSort(String sort)

setMax

public void setMax(int max)

setMixedChart

public void setMixedChart(boolean mixedChart)

setDataMap

public void setDataMap(ObjectIntTreeMap dataMap)

setPrintChart

public void setPrintChart(boolean printChart)

setPrintCSS

public void setPrintCSS(boolean printCSS)

setIsPercent

public void setIsPercent(boolean isPercent)

setColor

public void setColor(int color)

setColors

public void setColors(String[] colors)

setColorFirst

public void setColorFirst(int colorFirst)

setColorRotate

public void setColorRotate(int colorRotate)

setTitle

public void setTitle(String title)

setDisplay

public void setDisplay(String display)

setUnit

public void setUnit(String unit)

setHeight

public void setHeight(int height)

setWidth

public void setWidth(int width)

setMaxValue

public void setMaxValue(int maxValue)

setFixHLengthWidth

public void setFixHLengthWidth(int fixHLegWidth)

setBeautifier

public void setBeautifier(ChartTagBeautifier beautifier)

setLegendComparator

public void setLegendComparator(Comparator legendComparator)

setLocale

public void setLocale(Locale locale)

clean

protected void clean()

countItems

protected int countItems()
Count the number of elements to display depending of the element map

Returns:
an int representing the number of elements

countMaxValue

protected void countMaxValue()
Get the max value of the map


printCSS

protected void printCSS(StringBuffer sb,
                        int items)
Print the CSS Style to display correctly chart.

Parameters:
sb - the buffer to print into
items - the number of chart color to display

printSingleChart

protected List printSingleChart(StringBuffer sb,
                                ObjectIntTreeMap items,
                                int color)
Print all items in a chart

Parameters:
sb - the buffer to print into
items - a Map of Items String/int[0]
Returns:
a List of legend

printNotMixedChart

protected List printNotMixedChart(StringBuffer sb,
                                  ObjectIntTreeMap items)
Print all items of not mixed charts chart

Parameters:
sb - the buffer to print into
items - a Map of Items String/int[0]
Returns:
A List that contains all legends the first item should be an Integer representing the span value.

printMixedChart

protected List printMixedChart(StringBuffer sb,
                               ObjectIntTreeMap items)
Print all items of mixed charts chart

Parameters:
sb - the buffer to print into
items - a Map of Items String/int[0]
Returns:
A List that contains all legends the first item should be an Integer representing the span value.

printChartElement

protected void printChartElement(StringBuffer sb,
                                 String legend,
                                 int value,
                                 int color,
                                 int spanLegend,
                                 boolean separator)
Print one element of the Chart

Parameters:
sb - the buffer to print
legend - the legend to display
value - the value to display in %
color - the color set
spanLegend -
separator -

printHLegendRatio

protected void printHLegendRatio(StringBuffer sb)
Print Legend 0% - 100% of the Chart

Parameters:
sb - the buffer to print

printVLegendRatio

protected void printVLegendRatio(StringBuffer sb)
Print Legend 0% - 100% of the Chart

Parameters:
sb - the buffer to print

printLegentChart

protected void printLegentChart(StringBuffer sb,
                                List legendList)
Print Legend Square of the chart

Parameters:
sb - the buffer to print

printTitle

protected void printTitle(StringBuffer sb)

printVChartLegendList

protected void printVChartLegendList(StringBuffer sb,
                                     List legendList)

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspException

doEndTag

public int doEndTag()
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.TagSupport


Copyright © 2001-2010 Jalios SA. All Rights Reserved.