2
* $Id: TaskPaneContainerAddon.java,v 1.2 2007/11/21 17:32:04 kschaefe Exp $
4
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5
* Santa Clara, California 95054, U.S.A. All rights reserved.
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
package org.jdesktop.swingx.plaf;
23
import java.awt.Color;
24
import java.awt.GradientPaint;
25
import java.awt.Toolkit;
27
import javax.swing.BorderFactory;
28
import javax.swing.plaf.BorderUIResource;
29
import javax.swing.plaf.ColorUIResource;
30
import javax.swing.plaf.metal.MetalLookAndFeel;
32
import org.jdesktop.swingx.JXTaskPaneContainer;
33
import org.jdesktop.swingx.painter.MattePainter;
34
import org.jdesktop.swingx.plaf.windows.WindowsClassicLookAndFeelAddons;
35
import org.jdesktop.swingx.plaf.windows.WindowsLookAndFeelAddons;
36
import org.jdesktop.swingx.util.OS;
39
* Addon for <code>JXTaskPaneContainer</code>. This addon defines the following properties:
41
* <tr><td>TaskPaneContainer.background</td><td>background color</td></tr>
42
* <tr><td>TaskPaneContainer.backgroundPainter</td><td>background painter</td></tr>
43
* <tr><td>TaskPaneContainer.border</td><td>container border</td></tr>
44
* <tr><td>TaskPaneContainer.font</td><td>font (currently unused)</td></tr>
45
* <tr><td>TaskPaneContainer.foreground</td><td>foreground color (currently unused)</td></tr>
48
* @author <a href="mailto:fred@L2FProd.com">Frederic Lavigne</a>
49
* @author Karl Schaefer
51
public class TaskPaneContainerAddon extends AbstractComponentAddon {
53
public TaskPaneContainerAddon() {
54
super("JXTaskPaneContainer");
58
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
59
super.addBasicDefaults(addon, defaults);
61
defaults.add(JXTaskPaneContainer.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicTaskPaneContainerUI");
62
defaults.add("TaskPaneContainer.background", UIManagerExt.getSafeColor("Desktop.background",
63
new ColorUIResource(Color.decode("#005C5C"))));
64
defaults.add("TaskPaneContainer.border", new BorderUIResource(BorderFactory.createEmptyBorder(10, 10, 0, 10)));
71
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
72
super.addMetalDefaults(addon, defaults);
74
defaults.add("TaskPaneContainer.background", MetalLookAndFeel.getDesktopColor());
81
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
82
super.addWindowsDefaults(addon, defaults);
83
if (addon instanceof WindowsClassicLookAndFeelAddons) {
84
defaults.add("TaskPaneContainer.background", UIManagerExt.getSafeColor("List.background",
85
new ColorUIResource(Color.decode("#005C5C"))));
86
} else if (addon instanceof WindowsLookAndFeelAddons) {
87
String xpStyle = OS.getWindowsVisualStyle();
88
ColorUIResource background;
89
Color backgroundGradientStart;
90
Color backgroundGradientEnd;
92
if (WindowsLookAndFeelAddons.HOMESTEAD_VISUAL_STYLE
93
.equalsIgnoreCase(xpStyle)) {
94
background = new ColorUIResource(201, 215, 170);
95
backgroundGradientStart = new Color(204, 217, 173);
96
backgroundGradientEnd = new Color(165, 189, 132);
97
} else if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE
98
.equalsIgnoreCase(xpStyle)) {
99
background = new ColorUIResource(192, 195, 209);
100
backgroundGradientStart = new Color(196, 200, 212);
101
backgroundGradientEnd = new Color(177, 179, 200);
103
if (OS.isWindowsVista()) {
104
final Toolkit toolkit = Toolkit.getDefaultToolkit();
105
background = new ColorUIResource((Color)toolkit.getDesktopProperty("win.3d.backgroundColor"));
106
backgroundGradientStart = (Color)toolkit.getDesktopProperty("win.frame.activeCaptionColor");
107
backgroundGradientEnd = (Color)toolkit.getDesktopProperty("win.frame.inactiveCaptionColor");
109
background = new ColorUIResource(117, 150, 227);
110
backgroundGradientStart = new ColorUIResource(123, 162, 231);
111
backgroundGradientEnd = new ColorUIResource(99, 117, 214);
115
defaults.add("TaskPaneContainer.backgroundPainter", new PainterUIResource(
116
new MattePainter<JXTaskPaneContainer>(new GradientPaint(0f, 0f,
117
backgroundGradientStart, 0f, 1f, backgroundGradientEnd), true)));
118
defaults.add("TaskPaneContainer.background", background);
126
protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
127
super.addMacDefaults(addon, defaults);
129
defaults.add("TaskPaneContainer.background", new ColorUIResource(238, 238, 238));