Source Code Cross Referenced for GradientTheme.java in  » Swing-Library » InfoNode-Docking-Windows » net » infonode » tabbedpanel » theme » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » InfoNode Docking Windows » net.infonode.tabbedpanel.theme 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2004 NNL Technology AB
003:         * Visit www.infonode.net for information about InfoNode(R) 
004:         * products and how to contact NNL Technology AB.
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 
019:         * MA 02111-1307, USA.
020:         */
021:
022:        // $Id: GradientTheme.java,v 1.22 2005/02/16 11:28:15 jesper Exp $
023:        package net.infonode.tabbedpanel.theme;
024:
025:        import net.infonode.gui.Colors;
026:        import net.infonode.gui.colorprovider.ColorMultiplier;
027:        import net.infonode.gui.colorprovider.ColorProvider;
028:        import net.infonode.gui.colorprovider.ColorProviderUtil;
029:        import net.infonode.gui.colorprovider.UIManagerColorProvider;
030:        import net.infonode.tabbedpanel.TabbedPanelProperties;
031:        import net.infonode.tabbedpanel.border.GradientTabAreaBorder;
032:        import net.infonode.tabbedpanel.border.OpenContentBorder;
033:        import net.infonode.tabbedpanel.border.TabAreaLineBorder;
034:        import net.infonode.tabbedpanel.titledtab.TitledTabProperties;
035:
036:        import javax.swing.border.Border;
037:        import javax.swing.border.CompoundBorder;
038:        import java.awt.*;
039:
040:        /**
041:         * A theme that draws gradient tab backgrounds.
042:         *
043:         * @author $Author: jesper $
044:         * @version $Revision: 1.22 $
045:         * @since ITP 1.1.0
046:         */
047:        public class GradientTheme extends TabbedPanelTitledTabTheme {
048:            private static final float HUE = Colors.ROYAL_BLUE_HUE;
049:            private static final float SATURATION = 0.06f;
050:            private static final float BRIGHTNESS = 0.72f;
051:
052:            /**
053:             * The tab area background color used if no color is specified in the constructor.
054:             */
055:            public static final Color DEFAULT_TAB_AREA_BACKGROUND_COLOR = Color
056:                    .getHSBColor(HUE, SATURATION, BRIGHTNESS);
057:
058:            private static final Border HIGHLIGHTED_TAB_GRADIENT_BORDER = new GradientTabAreaBorder(
059:                    Color.WHITE);
060:
061:            private static final Border TAB_AREA_COMPONENTS_GRADIENT_BORDER = new GradientTabAreaBorder(
062:                    new ColorMultiplier(UIManagerColorProvider.CONTROL_COLOR,
063:                            0.88), UIManagerColorProvider.CONTROL_COLOR);
064:
065:            private boolean opaqueTabArea;
066:            private boolean shadowEnabled;
067:            private Color borderColor;
068:            private Color tabAreaBackgroundColor;
069:            private Border normalTabGradientBorder;
070:            private TitledTabProperties titledTabProperties = new TitledTabProperties();
071:            private TabbedPanelProperties tabbedPanelProperties = new TabbedPanelProperties();
072:
073:            /**
074:             * Creates a default theme with transparent tab area and shadows.
075:             */
076:            public GradientTheme() {
077:                this (false, true);
078:            }
079:
080:            /**
081:             * Constructor.
082:             *
083:             * @param opaqueTabArea if true a gradient background is drawn for the tab area, otherwise it's transparent
084:             * @param shadowEnabled if true the shadow is enabled
085:             */
086:            public GradientTheme(boolean opaqueTabArea, boolean shadowEnabled) {
087:                this (opaqueTabArea, shadowEnabled, null);
088:            }
089:
090:            /**
091:             * Constructor.
092:             *
093:             * @param opaqueTabArea if true a gradient background is drawn for the tab area, otherwise it's transparent
094:             * @param shadowEnabled if true the shadow is enabled
095:             * @param borderColor   the border color, null means default border color
096:             */
097:            public GradientTheme(boolean opaqueTabArea, boolean shadowEnabled,
098:                    Color borderColor) {
099:                this (opaqueTabArea, shadowEnabled, borderColor,
100:                        DEFAULT_TAB_AREA_BACKGROUND_COLOR);
101:            }
102:
103:            /**
104:             * Constructor.
105:             *
106:             * @param opaqueTabArea          if true a gradient background is drawn for the tab area, otherwise it's transparent
107:             * @param shadowEnabled          if true the shadow is enabled
108:             * @param borderColor            the border color, null means default border color
109:             * @param tabAreaBackgroundColor the background color for the tab area and normal tabs, null means use the default tab
110:             *                               background
111:             */
112:            public GradientTheme(boolean opaqueTabArea, boolean shadowEnabled,
113:                    Color borderColor, Color tabAreaBackgroundColor) {
114:                this .opaqueTabArea = opaqueTabArea;
115:                this .shadowEnabled = shadowEnabled;
116:                this .borderColor = borderColor;
117:                this .tabAreaBackgroundColor = tabAreaBackgroundColor;
118:
119:                ColorProvider cp = ColorProviderUtil.getColorProvider(
120:                        tabAreaBackgroundColor,
121:                        UIManagerColorProvider.TABBED_PANE_BACKGROUND);
122:
123:                normalTabGradientBorder = new GradientTabAreaBorder(cp,
124:                        new ColorMultiplier(cp, 1.1));
125:                initTabbedPanelProperties();
126:                initTitledTabProperties();
127:            }
128:
129:            /**
130:             * Gets the name for this theme
131:             *
132:             * @return the name
133:             */
134:            public String getName() {
135:                return "Gradient Theme"
136:                        + (opaqueTabArea ? " - Opaque Tab Area" : "");
137:            }
138:
139:            private void initTabbedPanelProperties() {
140:
141:                tabbedPanelProperties.getContentPanelProperties()
142:                        .getComponentProperties().setInsets(
143:                                new Insets(3, 3, 3, 3)).setBorder(
144:                                new OpenContentBorder(borderColor,
145:                                        opaqueTabArea ? 0 : 1));
146:
147:                tabbedPanelProperties.setShadowEnabled(shadowEnabled)
148:                        .setPaintTabAreaShadow(opaqueTabArea).setTabSpacing(
149:                                opaqueTabArea ? 0 : -1);
150:
151:                if (opaqueTabArea) {
152:                    if (tabAreaBackgroundColor != null)
153:                        tabbedPanelProperties.getTabAreaProperties()
154:                                .getComponentProperties().setBackgroundColor(
155:                                        tabAreaBackgroundColor);
156:
157:                    tabbedPanelProperties.getTabAreaProperties()
158:                            .getComponentProperties().setBorder(
159:                                    new CompoundBorder(new TabAreaLineBorder(
160:                                            borderColor),
161:                                            normalTabGradientBorder));
162:                }
163:
164:                tabbedPanelProperties.getTabAreaComponentsProperties()
165:                        .setStretchEnabled(opaqueTabArea)
166:
167:                        .getComponentProperties().setBorder(
168:                                new CompoundBorder(new TabAreaLineBorder(
169:                                        opaqueTabArea ? null : borderColor,
170:                                        !opaqueTabArea, true, !opaqueTabArea,
171:                                        true),
172:                                        TAB_AREA_COMPONENTS_GRADIENT_BORDER))
173:                        .setInsets(
174:                                opaqueTabArea ? new Insets(0, 3, 0, 3)
175:                                        : new Insets(1, 3, 1, 3));
176:            }
177:
178:            private void initTitledTabProperties() {
179:                if (opaqueTabArea)
180:                    titledTabProperties.setHighlightedRaised(0);
181:
182:                titledTabProperties.getNormalProperties()
183:                        .getComponentProperties().setBorder(
184:                                opaqueTabArea ? (Border) new TabAreaLineBorder(
185:                                        false, false, true, true)
186:                                        : new CompoundBorder(
187:                                                new TabAreaLineBorder(),
188:                                                normalTabGradientBorder));
189:
190:                if (opaqueTabArea)
191:                    titledTabProperties.getNormalProperties()
192:                            .getComponentProperties().setBackgroundColor(null);
193:
194:                if (!opaqueTabArea && tabAreaBackgroundColor != null)
195:                    titledTabProperties.getNormalProperties()
196:                            .getComponentProperties().setBackgroundColor(
197:                                    tabAreaBackgroundColor);
198:
199:                titledTabProperties.getHighlightedProperties().setIconVisible(
200:                        true)
201:
202:                .getComponentProperties().setBorder(
203:                        new CompoundBorder(
204:                                opaqueTabArea ? (Border) new TabAreaLineBorder(
205:                                        false, false, true, true)
206:                                        : new TabAreaLineBorder(borderColor),
207:                                HIGHLIGHTED_TAB_GRADIENT_BORDER));
208:            }
209:
210:            public TitledTabProperties getTitledTabProperties() {
211:                return titledTabProperties;
212:            }
213:
214:            public TabbedPanelProperties getTabbedPanelProperties() {
215:                return tabbedPanelProperties;
216:            }
217:
218:            /**
219:             * Returns the gradient border for the highlighted tab.
220:             *
221:             * @return the gradient border for the highlighted tab
222:             */
223:            public Border getHighlightedTabGradientBorder() {
224:                return HIGHLIGHTED_TAB_GRADIENT_BORDER;
225:            }
226:
227:            /**
228:             * Returns the gradient border for the tab area components.
229:             *
230:             * @return the gradient border for the tab area components
231:             */
232:            public Border getTabAreaComponentsGradientBorder() {
233:                return TAB_AREA_COMPONENTS_GRADIENT_BORDER;
234:            }
235:
236:            /**
237:             * Returns the gradient border for the normal tab or the tab area if it's opaque.
238:             *
239:             * @return the gradient border for the normal tab or the tab area if it's opaque
240:             */
241:            public Border getNormalTabGradientBorder() {
242:                return normalTabGradientBorder;
243:            }
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.