001    package com.sptci.echo2.style;
002    
003    import nextapp.echo2.app.Grid;
004    import nextapp.echo2.app.MutableStyleSheet;
005    import nextapp.echo2.app.button.AbstractButton;
006    
007    import echopointng.ButtonEx;
008    
009    import com.sptci.echo2.Confirmation;
010    
011    /**
012     * The base class for the application wide style sheet.
013     *
014     * <p>Copyright 2007 Sans Pareil Technologies, Inc.</p>
015     * @author Rakesh Vidyadharan 2007-04-21
016     * @version $Id: StyleSheet.java 3224 2007-05-07 11:10:27Z rakesh $
017     */
018    public class StyleSheet extends MutableStyleSheet
019    {
020      /**
021       * Default constructor.
022       *
023       * @see #init
024       */
025      public StyleSheet()
026      {
027        init();
028      }
029    
030      /**
031       * Initialise the style sheet with the default styles.
032       *
033       * @see #addButtonStyles
034       * @see #addColumnStyles
035       * @see #addGridStyles
036       * @see #addLabelStyles
037       * @see #addRowStyles
038       * @see #addTextStyles
039       * @see #addWindowPaneStyles
040       */
041      protected void init()
042      {
043        addButtonStyles();
044        addColumnStyles();
045        addLabelStyles();
046        addRowStyles();
047        addTextStyles();
048        addWindowPaneStyles();
049      }
050    
051      /**
052       * Add the styles for button components to the style sheet.
053       */
054      protected void addButtonStyles()
055      {
056        Button general = new Button();
057        addStyle( AbstractButton.class, null, general );
058        addStyle( AbstractButton.class, "General.Button", general );
059        addStyle( AbstractButton.class, 
060            Confirmation.class.getName() + ".Button", general );
061    
062        addStyle( AbstractButton.class, "Link.Button", new Button() );
063        addStyle( AbstractButton.class, "Link.Button.Selected", new SelectedLink() );
064        addStyle( AbstractButton.class, "Default.Button", new DefaultButton() );
065        addStyle( AbstractButton.class,
066            com.sptci.echo2.Logout.class.getName(), new Logout() );
067    
068        addStyle( ButtonEx.class, null, general );
069      }
070    
071      /**
072       * Add the styles for column components to the style sheet.
073       */
074      protected void addColumnStyles()
075      {
076        addStyle( nextapp.echo2.app.Column.class, null, new Column() );
077      }
078    
079      /**
080       * Add the styles for grid components to the style sheet.
081       */
082      protected void addGridStyles()
083      {
084        addStyle( Grid.class,
085            "com.sptci.echo2.LoginPane.grid", new LoginPaneGrid() );
086      }
087    
088      /**
089       * Add the styles for label components to the style sheet.
090       */
091      protected void addLabelStyles()
092      {
093        Label general = new Label();
094        addStyle( nextapp.echo2.app.Label.class, null, general );
095        addStyle( nextapp.echo2.app.Label.class, "General.Label", general );
096    
097        addStyle( nextapp.echo2.app.Label.class,
098            "Default.Label", new DefaultLabel() );
099        addStyle( nextapp.echo2.app.Label.class,
100            "Bold.Label", new BoldLabel() );
101      }
102    
103      /**
104       * Add the styles for row components to the style sheet.
105       */
106      protected void addRowStyles()
107      {
108        addStyle( Row.class, null, new Row() );
109      }
110    
111      /**
112       * Add the styles for text components to the style sheet.
113       */
114      protected void addTextStyles()
115      {
116        TextComponent general = new TextComponent();
117        addStyle( nextapp.echo2.app.text.TextComponent.class, null, general );
118        addStyle( nextapp.echo2.app.text.TextComponent.class,
119            "General.TextComponent", general );
120    
121        addStyle( nextapp.echo2.app.text.TextComponent.class,
122            "Default.TextComponent", new DefaultTextComponent() );
123      }
124    
125      /**
126       * Add the styles for WindowPane components to the style sheet
127       */
128      protected void addWindowPaneStyles()
129      {
130        WindowPane wp = new WindowPane();
131        addStyle( nextapp.echo2.app.WindowPane.class, null, wp );
132        addStyle( nextapp.echo2.app.WindowPane.class, "Default.WindowPane", new WindowPane() );
133        addStyle( nextapp.echo2.app.WindowPane.class,
134            com.sptci.echo2.LoginPane.class.getName(), new LoginPane() );
135      }
136    }