Package com.jalios.jtaglib
Class ChartTag
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- com.jalios.jtaglib.ChartTag
-
- All Implemented Interfaces:
java.io.Serializable,javax.servlet.jsp.tagext.IterationTag,javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.tagext.Tag
public class ChartTag extends javax.servlet.jsp.tagext.TagSupportThis tag prints a date.- Author:
- Jean-Philippe Encausse
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ChartTagBeautifierbeautifierprotected intcolorprotected intcolorFirstprotected intcolorRotateprotected java.lang.String[]colorsstatic java.lang.String[]COLORSprotected intcountValueprotected ObjectIntTreeMapdataMapprotected java.lang.Stringdisplaystatic java.lang.StringDISPLAY_HCHARTstatic java.lang.StringDISPLAY_TABLECHARTstatic java.lang.StringDISPLAY_VCHARTprotected intfixHLegWidthprotected intheightprotected booleanisPercentprotected java.util.ComparatorlgdCmptprotected java.util.Localelocaleprotected intmaxprotected intmaxValueprotected booleanmaxValueSetprotected booleanmixedChartprotected booleanprintChartprotected booleanprintCSSprotected java.lang.Stringsortstatic java.lang.StringSORT_GREATERstatic java.lang.StringSORT_LOWERstatic java.lang.StringSORT_NONEprotected java.lang.Stringtitleprotected java.lang.Stringunitprotected intwidth
-
Constructor Summary
Constructors Constructor Description ChartTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclean()protected intcountItems()Count the number of elements to display depending of the element mapprotected voidcountMaxValue()Get the max value of the mapintdoEndTag()intdoStartTag()protected voidprintChartElement(java.lang.StringBuffer sb, java.lang.String legend, int value, int color, int spanLegend, boolean separator)Print one element of the Chartprotected voidprintCSS(java.lang.StringBuffer sb, int items)Print the CSS Style to display correctly chart.protected voidprintHLegendRatio(java.lang.StringBuffer sb)Print Legend 0% - 100% of the Chartprotected voidprintLegentChart(java.lang.StringBuffer sb, java.util.List legendList)Print Legend Square of the chartprotected java.util.ListprintMixedChart(java.lang.StringBuffer sb, ObjectIntTreeMap items)Print all items of mixed charts chartprotected java.util.ListprintNotMixedChart(java.lang.StringBuffer sb, ObjectIntTreeMap items)Print all items of not mixed charts chartprotected java.util.ListprintSingleChart(java.lang.StringBuffer sb, ObjectIntTreeMap items, int color)Print all items in a chartprotected voidprintTitle(java.lang.StringBuffer sb)protected voidprintVChartLegendList(java.lang.StringBuffer sb, java.util.List legendList)protected voidprintVLegendRatio(java.lang.StringBuffer sb)Print Legend 0% - 100% of the ChartvoidsetBeautifier(ChartTagBeautifier beautifier)voidsetColor(int color)voidsetColorFirst(int colorFirst)voidsetColorRotate(int colorRotate)voidsetColors(java.lang.String[] colors)voidsetDataMap(ObjectIntTreeMap dataMap)voidsetDisplay(java.lang.String display)voidsetFixHLengthWidth(int fixHLegWidth)voidsetHeight(int height)voidsetIsPercent(boolean isPercent)voidsetLegendComparator(java.util.Comparator legendComparator)voidsetLocale(java.util.Locale locale)voidsetMax(int max)voidsetMaxValue(int maxValue)voidsetMixedChart(boolean mixedChart)voidsetPrintChart(boolean printChart)voidsetPrintCSS(boolean printCSS)voidsetSort(java.lang.String sort)voidsetTitle(java.lang.String title)voidsetUnit(java.lang.String unit)voidsetWidth(int width)
-
-
-
Field Detail
-
COLORS
public static java.lang.String[] COLORS
-
DISPLAY_VCHART
public static final java.lang.String DISPLAY_VCHART
- See Also:
- Constant Field Values
-
DISPLAY_HCHART
public static final java.lang.String DISPLAY_HCHART
- See Also:
- Constant Field Values
-
DISPLAY_TABLECHART
public static final java.lang.String DISPLAY_TABLECHART
- See Also:
- Constant Field Values
-
SORT_NONE
public static final java.lang.String SORT_NONE
- See Also:
- Constant Field Values
-
SORT_GREATER
public static final java.lang.String SORT_GREATER
- See Also:
- Constant Field Values
-
SORT_LOWER
public static final java.lang.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 java.lang.String display
-
color
protected int color
-
colorFirst
protected int colorFirst
-
colorRotate
protected int colorRotate
-
colors
protected java.lang.String[] colors
-
title
protected java.lang.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 java.lang.String sort
-
max
protected int max
-
fixHLegWidth
protected int fixHLegWidth
-
beautifier
protected ChartTagBeautifier beautifier
-
lgdCmpt
protected java.util.Comparator lgdCmpt
-
locale
protected java.util.Locale locale
-
unit
protected java.lang.String unit
-
-
Method Detail
-
setSort
public void setSort(java.lang.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(java.lang.String[] colors)
-
setColorFirst
public void setColorFirst(int colorFirst)
-
setColorRotate
public void setColorRotate(int colorRotate)
-
setTitle
public void setTitle(java.lang.String title)
-
setDisplay
public void setDisplay(java.lang.String display)
-
setUnit
public void setUnit(java.lang.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(java.util.Comparator legendComparator)
-
setLocale
public void setLocale(java.util.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(java.lang.StringBuffer sb, int items)Print the CSS Style to display correctly chart.- Parameters:
sb- the buffer to print intoitems- the number of chart color to display
-
printSingleChart
protected java.util.List printSingleChart(java.lang.StringBuffer sb, ObjectIntTreeMap items, int color)Print all items in a chart- Parameters:
sb- the buffer to print intoitems- a Map of Items String/int[0]- Returns:
- a List of legend
-
printNotMixedChart
protected java.util.List printNotMixedChart(java.lang.StringBuffer sb, ObjectIntTreeMap items)Print all items of not mixed charts chart- Parameters:
sb- the buffer to print intoitems- 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 java.util.List printMixedChart(java.lang.StringBuffer sb, ObjectIntTreeMap items)Print all items of mixed charts chart- Parameters:
sb- the buffer to print intoitems- 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(java.lang.StringBuffer sb, java.lang.String legend, int value, int color, int spanLegend, boolean separator)Print one element of the Chart- Parameters:
sb- the buffer to printlegend- the legend to displayvalue- the value to display in %color- the color setspanLegend-separator-
-
printHLegendRatio
protected void printHLegendRatio(java.lang.StringBuffer sb)
Print Legend 0% - 100% of the Chart- Parameters:
sb- the buffer to print
-
printVLegendRatio
protected void printVLegendRatio(java.lang.StringBuffer sb)
Print Legend 0% - 100% of the Chart- Parameters:
sb- the buffer to print
-
printLegentChart
protected void printLegentChart(java.lang.StringBuffer sb, java.util.List legendList)Print Legend Square of the chart- Parameters:
sb- the buffer to print
-
printTitle
protected void printTitle(java.lang.StringBuffer sb)
-
printVChartLegendList
protected void printVChartLegendList(java.lang.StringBuffer sb, java.util.List legendList)
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException- Specified by:
doStartTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doStartTagin classjavax.servlet.jsp.tagext.TagSupport- Throws:
javax.servlet.jsp.JspException
-
doEndTag
public int doEndTag()
- Specified by:
doEndTagin interfacejavax.servlet.jsp.tagext.Tag- Overrides:
doEndTagin classjavax.servlet.jsp.tagext.TagSupport
-
-