001    package echopoint.style.google.chart;
002    
003    import echopoint.google.chart.BarChart;
004    import echopoint.google.chart.LineChart;
005    import echopoint.google.chart.Map;
006    import echopoint.google.chart.RadarChart;
007    import echopoint.google.chart.ScatterPlot;
008    import echopoint.google.chart.Sparkline;
009    import echopoint.style.echo.extras.ExtrasStyleSheet;
010    
011    /**
012     * An extensible stylesheet that enforces a default look-and-feel for all
013     * EchoPoint Google Chart API components.  Can be used as the starting point
014     * for applications built using the framework.  We hope this promotes an
015     * object-oriented management of styles for applications.
016     *
017     * <p>It is recommended that you extend from {@link echopoint.Servlet} (in
018     * the webcontainer area) since the base servlet takes care of initialising
019     * default style properties from init parameters.</p>
020     *
021     * <p>This class is based upon the
022     * <a href='http://sptci.com/docs/public/com/sptci/echo/style/StyleSheet.html'>StyleSheet</a>
023     * implementation that <a href='http://sptci.com/'>SPT</a> has used as the
024     * basis for building a number of Echo2/3 applications.</p>
025     *
026     * @author Rakesh Vidyadharan 2009-05-24
027     * @version $Id: ChartStyleSheet.java 210 2009-05-28 02:06:26Z sptrakesh $
028     */
029    public class ChartStyleSheet extends ExtrasStyleSheet
030    {
031      private static final long serialVersionUID = 1L;
032    
033      /** {@inheritDoc} */
034      @Override
035      protected void init()
036      {
037        super.init();
038    
039        addBarChartStyles();
040        addLineChartStyles();
041        addMapStyles();
042        addScatterPlotStyles();
043        addSparklineStyles();
044        addRadarChartStyles();
045      }
046    
047      /** Add styles for {@link echopoint.google.chart.BarChart} components. */
048      protected void addBarChartStyles()
049      {
050        final BarChartStyle style = new BarChartStyle();
051        addStyle( BarChart.class, "", style );
052        addStyle( BarChart.class, "Default", style );
053      }
054    
055      /** Add styles for {@link echopoint.google.chart.LineChart} components. */
056      protected void addLineChartStyles()
057      {
058        final LineChartStyle style = new LineChartStyle();
059        addStyle( LineChart.class, "", style );
060        addStyle( LineChart.class, "Default", style );
061      }
062    
063      /** Add styles for {@link echopoint.google.chart.Map} components. */
064      protected void addMapStyles()
065      {
066        final MapStyle style = new MapStyle();
067        addStyle( Map.class, "", style );
068        addStyle( Map.class, "Default", style );
069      }
070    
071      /** Add styles for {@link echopoint.google.chart.ScatterPlot} components. */
072      protected void addScatterPlotStyles()
073      {
074        final ScatterPlotStyle style = new ScatterPlotStyle();
075        addStyle( ScatterPlot.class, "", style );
076        addStyle( ScatterPlot.class, "Default", style );
077      }
078    
079      /** Add styles for {@link echopoint.google.chart.Sparkline} components. */
080      protected void addSparklineStyles()
081      {
082        final SparklineStyle style = new SparklineStyle();
083        addStyle( Sparkline.class, "", style );
084        addStyle( Sparkline.class, "Default", style );
085      }
086    
087      /** Add styles for {@link echopoint.google.chart.RadarChart} components. */
088      protected void addRadarChartStyles()
089      {
090        final RadarChartStyle style = new RadarChartStyle();
091        addStyle( RadarChart.class, "", style );
092        addStyle( RadarChart.class, "Default", style );
093      }
094    }