2
* Copyright (c) 2005-2010 Flamingo / Substance Kirill Grouchnikov. All Rights Reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions are met:
7
* o Redistributions of source code must retain the above copyright notice,
8
* this list of conditions and the following disclaimer.
10
* o Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
14
* o Neither the name of Flamingo Kirill Grouchnikov nor the names of
15
* its contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
package org.pushingpixels.substance.flamingo;
34
import javax.swing.SwingConstants;
35
import javax.swing.border.Border;
36
import javax.swing.plaf.*;
38
import org.pushingpixels.flamingo.api.bcb.JBreadcrumbBar;
39
import org.pushingpixels.flamingo.api.common.*;
40
import org.pushingpixels.flamingo.api.common.popup.JCommandPopupMenu;
41
import org.pushingpixels.flamingo.api.common.popup.JPopupPanel;
42
import org.pushingpixels.flamingo.api.ribbon.*;
43
import org.pushingpixels.flamingo.internal.ui.common.JRichTooltipPanel;
44
import org.pushingpixels.flamingo.internal.ui.common.popup.JColorSelectorPanel;
45
import org.pushingpixels.flamingo.internal.ui.ribbon.*;
46
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
47
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuPopupPanel;
48
import org.pushingpixels.lafplugin.LafComponentPlugin;
49
import org.pushingpixels.substance.api.*;
50
import org.pushingpixels.substance.api.fonts.FontSet;
51
import org.pushingpixels.substance.flamingo.ribbon.ui.SubstanceRibbonBandBorder;
52
import org.pushingpixels.substance.internal.utils.*;
53
import org.pushingpixels.substance.internal.utils.border.SubstanceBorder;
56
* Plugin for Flamingo components.
58
* @author Kirill Grouchnikov
60
public class FlamingoPlugin implements LafComponentPlugin {
66
* org.pushingpixels.lafplugin.LafComponentPlugin#getDefaults(java.lang.
70
public Object[] getDefaults(Object mSkin) {
71
String UI_COMMON_CLASSNAME_PREFIX = "org.pushingpixels.substance.flamingo.common.ui.Substance";
73
String UI_RIBBON_CLASSNAME_PREFIX = "org.pushingpixels.substance.flamingo.ribbon.ui.Substance";
75
String UI_BCB_CLASSNAME_PREFIX = "org.pushingpixels.substance.flamingo.bcb.ui.Substance";
77
FontSet fontSet = SubstanceLookAndFeel.getFontPolicy().getFontSet(
79
Font controlFont = fontSet.getControlFont();
81
SubstanceSkin skin = (SubstanceSkin) mSkin;
82
Border textBorder = new BorderUIResource(new SubstanceBorder());
84
SubstanceColorScheme mainActiveScheme = skin
85
.getActiveColorScheme(DecorationAreaType.NONE);
86
Color backgroundColor = new ColorUIResource(mainActiveScheme
87
.getBackgroundFillColor());
88
Color disabledForegroundColor = SubstanceColorUtilities
89
.getForegroundColor(mainActiveScheme);
91
Object[] defaults = new Object[] {
92
JCommandButtonPanel.uiClassID,
93
UI_COMMON_CLASSNAME_PREFIX + "CommandButtonPanelUI",
95
JCommandButton.uiClassID,
96
UI_COMMON_CLASSNAME_PREFIX + "CommandButtonUI",
98
JCommandMenuButton.uiClassID,
99
UI_COMMON_CLASSNAME_PREFIX + "CommandMenuButtonUI",
101
JCommandToggleButton.uiClassID,
102
UI_COMMON_CLASSNAME_PREFIX + "CommandToggleButtonUI",
104
JCommandToggleMenuButton.uiClassID,
105
UI_COMMON_CLASSNAME_PREFIX + "CommandToggleMenuButtonUI",
107
JPopupPanel.uiClassID,
108
UI_COMMON_CLASSNAME_PREFIX + "PopupPanelUI",
110
JScrollablePanel.uiClassID,
111
UI_COMMON_CLASSNAME_PREFIX + "ScrollablePanelUI",
113
JCommandPopupMenu.uiClassID,
114
UI_COMMON_CLASSNAME_PREFIX + "CommandPopupMenuUI",
116
JColorSelectorPanel.uiClassID,
117
UI_COMMON_CLASSNAME_PREFIX + "ColorSelectorPanelUI",
119
JBandControlPanel.uiClassID,
120
UI_RIBBON_CLASSNAME_PREFIX + "BandControlPanelUI",
122
JFlowBandControlPanel.uiClassID,
123
UI_RIBBON_CLASSNAME_PREFIX + "FlowBandControlPanelUI",
126
UI_RIBBON_CLASSNAME_PREFIX + "RibbonUI",
128
JRibbonRootPane.uiClassID,
129
UI_RIBBON_CLASSNAME_PREFIX + "RibbonRootPaneUI",
131
JRibbonBand.uiClassID,
132
UI_RIBBON_CLASSNAME_PREFIX + "RibbonBandUI",
134
JRibbonGallery.uiClassID,
135
UI_RIBBON_CLASSNAME_PREFIX + "RibbonGalleryUI",
137
JRibbonApplicationMenuButton.uiClassID,
138
UI_RIBBON_CLASSNAME_PREFIX + "RibbonApplicationMenuButtonUI",
140
JRibbonApplicationMenuPopupPanel.uiClassID,
141
UI_RIBBON_CLASSNAME_PREFIX
142
+ "RibbonApplicationMenuPopupPanelUI",
144
JRibbonTaskToggleButton.uiClassID,
145
UI_RIBBON_CLASSNAME_PREFIX + "RibbonTaskToggleButtonUI",
147
JRichTooltipPanel.uiClassID,
148
UI_RIBBON_CLASSNAME_PREFIX + "RichTooltipPanelUI",
150
JRibbonComponent.uiClassID,
151
UI_RIBBON_CLASSNAME_PREFIX + "RibbonComponentUI",
153
JBreadcrumbBar.uiClassID,
154
UI_BCB_CLASSNAME_PREFIX + "BreadcrumbBarUI",
156
"BreadcrumbBar.font",
160
fontSet.getTitleFont(),
162
"CommandButtonPanel.font",
163
controlFont.deriveFont(Font.BOLD, controlFont.getSize() + 1),
168
"ControlPanel.border",
171
"ControlPanel.background",
174
"CommandButton.popupActionIcon",
175
new IconUIResource(SubstanceImageCreator
176
.getDoubleArrowIconDelta(SubstanceSizeUtils
177
.getControlFontSize(), -2, -1, -0.5f,
178
SwingConstants.SOUTH, mainActiveScheme)),
180
"PopupPanel.border", textBorder,
182
"PopupGallery.background", backgroundColor,
185
new BorderUIResource.EmptyBorderUIResource(1, 1, 1, 1),
187
"RibbonBand.border", new SubstanceRibbonBandBorder(),
189
"RibbonBand.background", backgroundColor,
191
"RibbonGallery.border",
192
new BorderUIResource.EmptyBorderUIResource(2, 2, 2, 2),
194
"RibbonGallery.margin", new Insets(3, 3, 3, 3),
196
"ToggleButton.background", backgroundColor,
198
"ToggleButton.disabledText", disabledForegroundColor };
205
* @see org.pushingpixels.lafplugin.LafComponentPlugin#uninitialize()
208
public void uninitialize() {
214
* @see org.pushingpixels.lafplugin.LafComponentPlugin#initialize()
217
public void initialize() {