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.echo.extras;
020
021 import echopoint.style.AbstractStyle;
022 import static echopoint.style.echo.extras.ResourceImages.CalendarSelectBackground;
023 import static echopoint.style.echo.extras.ResourceImages.CalendarSelectHeader;
024 import static echopoint.style.echo.extras.ResourceImages.CalendarSelectSelectedDate;
025 import static echopoint.util.ColorKit.makeColor;
026 import nextapp.echo.app.FillImage;
027 import nextapp.echo.app.Extent;
028 import nextapp.echo.app.Border;
029 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_BACKGROUND;
030 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_DATE_BACKGROUND;
031 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_DATE_BACKGROUND_IMAGE;
032 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_HEADER_BACKGROUND_IMAGE;
033 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_HEADER_FOREGROUND;
034 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_ROLLOVER_DATE_BACKGROUND;
035 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_SELECTED_DATE_BACKGROUND;
036 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_SELECTED_DATE_BACKGROUND_IMAGE;
037 import static nextapp.echo.extras.app.CalendarSelect.PROPERTY_SELECTED_DATE_BORDER;
038
039 /**
040 * The default style class for use with {@link
041 * nextapp.echo.extras.app.CalendarSelect} components.
042 *
043 * @author Rakesh Vidyadharan 2009-05-26
044 * @version $Id: CalendarSelectStyle.java 210 2009-05-28 02:06:26Z sptrakesh $
045 */
046 public class CalendarSelectStyle extends AbstractStyle
047 {
048 private static final long serialVersionUID = 1l;
049
050 @Override
051 protected void init()
052 {
053 setGeneralStyles();
054 setDateStyles();
055 setSelectedDateStyles();
056 }
057
058 /** Set general styles for the component. */
059 protected void setGeneralStyles()
060 {
061 set( PROPERTY_BACKGROUND, makeColor( "#6f87af" ) );
062 set( PROPERTY_HEADER_BACKGROUND_IMAGE, new FillImage(
063 CalendarSelectHeader, new Extent( 100, Extent.PERCENT ),
064 new Extent( 50, Extent.PERCENT ), FillImage.REPEAT ) );
065 set( PROPERTY_HEADER_FOREGROUND, makeColor( "#ffffff" ) );
066 }
067
068 /** Set the styles for the date cells. */
069 protected void setDateStyles()
070 {
071 set( PROPERTY_DATE_BACKGROUND, makeColor( "#bcbcbc" ) );
072 set( PROPERTY_DATE_BACKGROUND_IMAGE, new FillImage(
073 CalendarSelectBackground, new Extent( 0 ),
074 new Extent( 0 ), FillImage.REPEAT_HORIZONTAL ) );
075 set( PROPERTY_ROLLOVER_DATE_BACKGROUND, makeColor( "#ffffff" ) );
076 }
077
078 /** Set the styles for the selected date cell. */
079 protected void setSelectedDateStyles()
080 {
081 set( PROPERTY_SELECTED_DATE_BACKGROUND, makeColor( "#1579c7" ) );
082 set( PROPERTY_SELECTED_DATE_BACKGROUND_IMAGE,
083 new FillImage( CalendarSelectSelectedDate ) );
084
085 final Border.Side[] sides = new Border.Side[4];
086 sides[Border.SIDE_TOP] =
087 new Border.Side( 1, makeColor( "#0e4f82" ), Border.STYLE_SOLID );
088 sides[Border.SIDE_RIGHT] = sides[Border.SIDE_TOP];
089 sides[Border.SIDE_BOTTOM] =
090 new Border.Side( 1, makeColor( "#1472bc" ), Border.STYLE_SOLID );
091 sides[Border.SIDE_LEFT] = sides[Border.SIDE_BOTTOM];
092 set( PROPERTY_SELECTED_DATE_BORDER, new Border( sides ) );
093 }
094 }