001: /**
002: * L2FProd.com Common Components 7.3 License.
003: *
004: * Copyright 2005-2007 L2FProd.com
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package com.l2fprod.common.swing.plaf;
018:
019: import com.l2fprod.common.swing.JTaskPane;
020: import com.l2fprod.common.swing.plaf.windows.WindowsClassicLookAndFeelAddons;
021: import com.l2fprod.common.swing.plaf.windows.WindowsLookAndFeelAddons;
022: import com.l2fprod.common.util.OS;
023:
024: import java.awt.Color;
025: import java.awt.Toolkit;
026: import java.util.Arrays;
027: import java.util.List;
028:
029: import javax.swing.UIManager;
030: import javax.swing.plaf.ColorUIResource;
031: import javax.swing.plaf.metal.MetalLookAndFeel;
032:
033: /**
034: * Addon for <code>JTaskPane</code>. <br>
035: *
036: */
037: public class JTaskPaneAddon extends AbstractComponentAddon {
038:
039: public JTaskPaneAddon() {
040: super ("JTaskPane");
041: }
042:
043: protected void addBasicDefaults(LookAndFeelAddons addon,
044: List defaults) {
045: super .addBasicDefaults(addon, defaults);
046: defaults.addAll(Arrays.asList(new Object[] {
047: JTaskPane.UI_CLASS_ID,
048: "com.l2fprod.common.swing.plaf.basic.BasicTaskPaneUI",
049: "TaskPane.useGradient", Boolean.FALSE,
050: "TaskPane.background",
051: UIManager.getColor("Desktop.background") }));
052: }
053:
054: protected void addMetalDefaults(LookAndFeelAddons addon,
055: List defaults) {
056: super .addMetalDefaults(addon, defaults);
057: defaults.addAll(Arrays.asList(new Object[] {
058: "TaskPane.background",
059: MetalLookAndFeel.getDesktopColor() }));
060: }
061:
062: protected void addWindowsDefaults(LookAndFeelAddons addon,
063: List defaults) {
064: super .addWindowsDefaults(addon, defaults);
065: if (addon instanceof WindowsClassicLookAndFeelAddons) {
066: defaults.addAll(Arrays.asList(new Object[] {
067: "TaskPane.background",
068: UIManager.getColor("List.background") }));
069: } else if (addon instanceof WindowsLookAndFeelAddons) {
070: String xpStyle = OS.getWindowsVisualStyle();
071: ColorUIResource background;
072: ColorUIResource backgroundGradientStart;
073: ColorUIResource backgroundGradientEnd;
074:
075: if (WindowsLookAndFeelAddons.HOMESTEAD_VISUAL_STYLE
076: .equalsIgnoreCase(xpStyle)) {
077: background = new ColorUIResource(201, 215, 170);
078: backgroundGradientStart = new ColorUIResource(204, 217,
079: 173);
080: backgroundGradientEnd = new ColorUIResource(165, 189,
081: 132);
082: } else if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE
083: .equalsIgnoreCase(xpStyle)) {
084: background = new ColorUIResource(192, 195, 209);
085: backgroundGradientStart = new ColorUIResource(196, 200,
086: 212);
087: backgroundGradientEnd = new ColorUIResource(177, 179,
088: 200);
089: } else {
090: if (OS.isWindowsVista()) {
091: final Toolkit toolkit = Toolkit.getDefaultToolkit();
092: background = new ColorUIResource(
093: (Color) toolkit
094: .getDesktopProperty("win.3d.backgroundColor"));
095: backgroundGradientStart = new ColorUIResource(
096: (Color) toolkit
097: .getDesktopProperty("win.frame.activeCaptionColor"));
098: backgroundGradientEnd = new ColorUIResource(
099: (Color) toolkit
100: .getDesktopProperty("win.frame.inactiveCaptionColor"));
101: } else {
102: background = new ColorUIResource(117, 150, 227);
103: backgroundGradientStart = new ColorUIResource(123,
104: 162, 231);
105: backgroundGradientEnd = new ColorUIResource(99,
106: 117, 214);
107: }
108: }
109: defaults.addAll(Arrays.asList(new Object[] {
110: "TaskPane.useGradient", Boolean.TRUE,
111: "TaskPane.background", background,
112: "TaskPane.backgroundGradientStart",
113: backgroundGradientStart,
114: "TaskPane.backgroundGradientEnd",
115: backgroundGradientEnd, }));
116: }
117: }
118:
119: protected void addMacDefaults(LookAndFeelAddons addon, List defaults) {
120: super .addMacDefaults(addon, defaults);
121: defaults.addAll(Arrays.asList(new Object[] {
122: "TaskPane.background",
123: new ColorUIResource(238, 238, 238), }));
124: }
125:
126: }
|