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;
020
021 import nextapp.echo.app.Extent;
022 import nextapp.echo.app.FillImage;
023 import nextapp.echo.app.FillImageBorder;
024 import nextapp.echo.app.Insets;
025 import static nextapp.echo.app.WindowPane.PROPERTY_BACKGROUND;
026 import static nextapp.echo.app.WindowPane.PROPERTY_BORDER;
027 import static nextapp.echo.app.WindowPane.PROPERTY_CONTROLS_INSETS;
028 import static nextapp.echo.app.WindowPane.PROPERTY_MAXIMIZE_ENABLED;
029 import static nextapp.echo.app.WindowPane.PROPERTY_TITLE_BACKGROUND;
030 import static nextapp.echo.app.WindowPane.PROPERTY_TITLE_BACKGROUND_IMAGE;
031 import static nextapp.echo.app.WindowPane.PROPERTY_TITLE_FONT;
032 import static nextapp.echo.app.WindowPane.PROPERTY_TITLE_FOREGROUND;
033 import static nextapp.echo.app.WindowPane.PROPERTY_TITLE_INSETS;
034
035 import echopoint.style.AbstractStyle;
036 import static echopoint.style.DefaultFont.fontWithStyle;
037 import static echopoint.style.echo.ResourceImages.BorderBottom;
038 import static echopoint.style.echo.ResourceImages.BorderBottomLeft;
039 import static echopoint.style.echo.ResourceImages.BorderBottomRight;
040 import static echopoint.style.echo.ResourceImages.BorderLeft;
041 import static echopoint.style.echo.ResourceImages.BorderRight;
042 import static echopoint.style.echo.ResourceImages.BorderTop;
043 import static echopoint.style.echo.ResourceImages.BorderTopLeft;
044 import static echopoint.style.echo.ResourceImages.BorderTopRight;
045 import static echopoint.style.echo.ResourceImages.Header;
046 import static echopoint.util.ColorKit.makeColor;
047
048 /**
049 * The default style to apply to {@link nextapp.echo.app.WindowPane}
050 * components.
051 *
052 * @author Rakesh Vidyadharan 2009-05-24
053 * @version $Id: WindowPaneStyle.java 255 2009-11-29 12:16:16Z sptrakesh $
054 */
055 public class WindowPaneStyle extends AbstractStyle
056 {
057 private static final long serialVersionUID = 1L;
058
059 /** {@inheritDoc} */
060 @Override
061 protected void init()
062 {
063 super.init();
064
065 set( PROPERTY_BACKGROUND, makeColor( "#cfdfff" ) );
066 setBorderStyle();
067 setControlsStyles();
068 setTitleStyles();
069 }
070
071 /** Set the fill images used as border for the window pane. */
072 protected void setBorderStyle()
073 {
074 final FillImageBorder border = new FillImageBorder();
075 border.setBorderInsets( new Insets( 20, 34, 20, 20 ) );
076 border.setContentInsets( new Insets( 4, 4, 6, 4 ) );
077
078 border.setFillImage( FillImageBorder.TOP_LEFT,
079 new FillImage( BorderTopLeft ) );
080 border.setFillImage( FillImageBorder.TOP,
081 new FillImage( BorderTop ) );
082 border.setFillImage( FillImageBorder.TOP_RIGHT,
083 new FillImage( BorderTopRight ) );
084
085 border.setFillImage( FillImageBorder.LEFT,
086 new FillImage( BorderLeft ) );
087 border.setFillImage( FillImageBorder.RIGHT,
088 new FillImage( BorderRight ) );
089
090 border.setFillImage( FillImageBorder.BOTTOM_LEFT,
091 new FillImage( BorderBottomLeft ) );
092 border.setFillImage( FillImageBorder.BOTTOM,
093 new FillImage( BorderBottom ) );
094 border.setFillImage( FillImageBorder.BOTTOM_RIGHT,
095 new FillImage( BorderBottomRight ) );
096
097 set( PROPERTY_BORDER, border );
098 }
099
100 /** Set the styles for the control buttons on title bar. */
101 protected void setControlsStyles()
102 {
103 set( PROPERTY_MAXIMIZE_ENABLED, true );
104 set( PROPERTY_CONTROLS_INSETS, new Insets( 2, 10 ) );
105 }
106
107 /** Set styles for the title bar of the window pane. */
108 protected void setTitleStyles()
109 {
110 set( PROPERTY_TITLE_BACKGROUND, makeColor( "#2f2f4f" ) );
111 set( PROPERTY_TITLE_BACKGROUND_IMAGE, new FillImage( Header,
112 new Extent( 0 ), new Extent( 50, Extent.PERCENT ),
113 FillImage.REPEAT_HORIZONTAL ) );
114
115 set( PROPERTY_TITLE_BACKGROUND_IMAGE, makeColor( "#2f2f4f" ) );
116 set( PROPERTY_TITLE_FONT, fontWithStyle( "BOLD" ) );
117 set( PROPERTY_TITLE_FOREGROUND, makeColor( "#ffffff" ) );
118 set( PROPERTY_TITLE_INSETS, new Insets( 5, 10 ) );
119 }
120 }