001 /*
002 * This file is part of the Echo Point Project. This project is a
003 * collection of Components that have extended the Echo Web Application
004 * Framework Version 3.
005 *
006 * Version: MPL 1.1
007 *
008 * The contents of this file are subject to the Mozilla Public License Version
009 * 1.1 (the "License"); you may not use this file except in compliance with
010 * the License. You may obtain a copy of the License at
011 * http://www.mozilla.org/MPL/
012 *
013 * Software distributed under the License is distributed on an "AS IS" basis,
014 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015 * for the specific language governing rights and limitations under the
016 * License.
017 */
018
019 package echopoint.style;
020
021 import echopoint.Anchor;
022 import echopoint.InfoWindow;
023 import echopoint.ProgressBar;
024 import echopoint.TagCloud;
025 import echopoint.style.google.chart.ChartStyleSheet;
026
027 /**
028 * An extensible stylesheet that enforces a default look-and-feel for all
029 * EchoPoint components. Can be used as the starting point for applications
030 * built using the framework. We hope this promotes an object-oriented
031 * management of styles for applications.
032 *
033 * <p>It is recommended that you extend from {@link echopoint.Servlet} (in
034 * the webcontainer area) since the base servlet takes care of initialising
035 * default style properties from init parameters.</p>
036 *
037 * <p>This class is based upon the
038 * <a href='http://sptci.com/docs/public/com/sptci/echo/style/StyleSheet.html'>StyleSheet</a>
039 * implementation that <a href='http://sptci.com/'>SPT</a> has used as the
040 * basis for building a number of Echo2/3 applications.</p>
041 *
042 * @author Rakesh Vidyadharan 2009-05-12
043 * @version $Id: StyleSheet.java 208 2009-05-25 02:40:35Z sptrakesh $
044 */
045 public class StyleSheet extends ChartStyleSheet
046 {
047 private static final long serialVersionUID = 1L;
048
049 /**
050 * Initialises the default styles for the various components. Sub-classes
051 * should over-ride this method (while still invoking {@code super.init()})
052 * to add additional styles. Alternatively, sub-classes may over-ride the
053 * various component style setting methods as appropriate.
054 */
055 @Override
056 protected void init()
057 {
058 super.init();
059
060 addAnchorStyles();
061 addInfoWindowStyles();
062 addProgressBarStyles();
063 addTagCloudStyles();
064 }
065
066 /** Add styles for {@link echopoint.Anchor} components. */
067 protected void addAnchorStyles()
068 {
069 final AnchorStyle style = new AnchorStyle();
070 addStyle( Anchor.class, "", style );
071 addStyle( Anchor.class, "Default", style );
072 }
073
074 /** Set the styles for {@link echopoint.InfoWindow} components. */
075 protected void addInfoWindowStyles()
076 {
077 final InfoWindowStyle style = new InfoWindowStyle();
078 addStyle( InfoWindow.class, "", style );
079 addStyle( InfoWindow.class, "Default", style );
080 }
081
082 /** Set the styles for {@link echopoint.ProgressBar} components. */
083 protected void addProgressBarStyles()
084 {
085 final ProgressBarStyle style = new ProgressBarStyle();
086 addStyle( ProgressBar.class, "", style );
087 addStyle( ProgressBar.class, "Default", style );
088 }
089
090 /** Add styles for {@link echopoint.TagCloud} components. */
091 protected void addTagCloudStyles()
092 {
093 final TagCloudStyle style = new TagCloudStyle();
094 addStyle( TagCloud.class, "", style );
095 addStyle( TagCloud.class, "Default", style );
096 }
097 }