Class ChartTagBeautifier


  • public class ChartTagBeautifier
    extends Beautifier
    Since:
    jcms-5.0.0
    Author:
    Olivier Jaquemet
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String beautify​(java.lang.String str)
      String beautifier.
      java.lang.String beautifyLegend​(java.lang.String legend)
      Called for each legend of the the chart with no value.
      java.lang.String beautifyLegend​(java.lang.String legend, java.lang.Integer[] values)
      Called for each legend of the chart which has a value associated to it.
      java.lang.String beautifyTitle​(java.lang.String title)
      String beautifier for the chart title.
      void printChartElementClass​(java.lang.StringBuffer sb, java.lang.String legend, int value, java.lang.String display)
      Called for each value in chart, allow you to add any class to this value.
      void printChartElementStyle​(java.lang.StringBuffer sb, java.lang.String legend, int value, java.lang.String display)
      Called for each value in chart, allow you to add any style to this value.
      void setLocale​(java.util.Locale locale)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChartTagBeautifier

        public ChartTagBeautifier()
      • ChartTagBeautifier

        public ChartTagBeautifier​(Beautifier beautifier)
      • ChartTagBeautifier

        public ChartTagBeautifier​(Beautifier beautifier,
                                  Beautifier legendBeautifier)
    • Method Detail

      • beautify

        public java.lang.String beautify​(java.lang.String str)
        String beautifier.
        Overrides:
        beautify in class Beautifier
      • printChartElementStyle

        public void printChartElementStyle​(java.lang.StringBuffer sb,
                                           java.lang.String legend,
                                           int value,
                                           java.lang.String display)
        Called for each value in chart, allow you to add any style to this value. For example: if (value > 90) { sb.append("background-color: red;"); } else { sb.append("background-color: blue;"); }
        Parameters:
        sb - the string buffer to append to
        legend - the legend associated with this value
        value - the value printed
        display - the format of the chart (see CharTag.DISPLAY_VCHART ChartTag.DISPLAY_HCHART)
      • printChartElementClass

        public void printChartElementClass​(java.lang.StringBuffer sb,
                                           java.lang.String legend,
                                           int value,
                                           java.lang.String display)
        Called for each value in chart, allow you to add any class to this value. For example: if (value > 90) { sb.append("importantValue"); } else { sb.append("basicValue"); }
        Parameters:
        sb - the string buffer to append to
        legend - the legend associated with this value
        value - the value printed
        display - the format of the chart (see CharTag.DISPLAY_VCHART ChartTag.DISPLAY_HCHART)
      • beautifyTitle

        public java.lang.String beautifyTitle​(java.lang.String title)
        String beautifier for the chart title.
        Parameters:
        title - string to beautify
        Returns:
        the beautified string
      • beautifyLegend

        public java.lang.String beautifyLegend​(java.lang.String legend,
                                               java.lang.Integer[] values)
        Called for each legend of the chart which has a value associated to it.
        Parameters:
        legend - the legend to beautify
        values - the value associated with this legend
        Returns:
        the beautified legend
      • beautifyLegend

        public java.lang.String beautifyLegend​(java.lang.String legend)
        Called for each legend of the the chart with no value.
        Parameters:
        legend - the legend to beautify
        Returns:
        the beautified legend
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Overrides:
        setLocale in class Beautifier