~ubuntu-branches/debian/stretch/insubstantial/stretch

« back to all changes in this revision

Viewing changes to substance-flamingo/src/main/java/org/pushingpixels/substance/flamingo/FlamingoPlugin.java

  • Committer: Package Import Robot
  • Author(s): Felix Natter
  • Date: 2016-01-18 20:58:45 UTC
  • Revision ID: package-import@ubuntu.com-20160118205845-crbmrkda61qsi5qa
Tags: upstream-7.3+dfsg2
ImportĀ upstreamĀ versionĀ 7.3+dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2005-2010 Flamingo / Substance Kirill Grouchnikov. All Rights Reserved.
 
3
 *
 
4
 * Redistribution and use in source and binary forms, with or without 
 
5
 * modification, are permitted provided that the following conditions are met:
 
6
 * 
 
7
 *  o Redistributions of source code must retain the above copyright notice, 
 
8
 *    this list of conditions and the following disclaimer. 
 
9
 *     
 
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. 
 
13
 *     
 
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. 
 
17
 *     
 
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. 
 
29
 */
 
30
package org.pushingpixels.substance.flamingo;
 
31
 
 
32
import java.awt.*;
 
33
 
 
34
import javax.swing.SwingConstants;
 
35
import javax.swing.border.Border;
 
36
import javax.swing.plaf.*;
 
37
 
 
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;
 
54
 
 
55
/**
 
56
 * Plugin for Flamingo components.
 
57
 * 
 
58
 * @author Kirill Grouchnikov
 
59
 */
 
60
public class FlamingoPlugin implements LafComponentPlugin {
 
61
 
 
62
        /*
 
63
         * (non-Javadoc)
 
64
         * 
 
65
         * @see
 
66
         * org.pushingpixels.lafplugin.LafComponentPlugin#getDefaults(java.lang.
 
67
         * Object)
 
68
         */
 
69
        @Override
 
70
    public Object[] getDefaults(Object mSkin) {
 
71
                String UI_COMMON_CLASSNAME_PREFIX = "org.pushingpixels.substance.flamingo.common.ui.Substance";
 
72
 
 
73
                String UI_RIBBON_CLASSNAME_PREFIX = "org.pushingpixels.substance.flamingo.ribbon.ui.Substance";
 
74
 
 
75
                String UI_BCB_CLASSNAME_PREFIX = "org.pushingpixels.substance.flamingo.bcb.ui.Substance";
 
76
 
 
77
                FontSet fontSet = SubstanceLookAndFeel.getFontPolicy().getFontSet(
 
78
                                "Substance", null);
 
79
                Font controlFont = fontSet.getControlFont();
 
80
 
 
81
                SubstanceSkin skin = (SubstanceSkin) mSkin;
 
82
                Border textBorder = new BorderUIResource(new SubstanceBorder());
 
83
 
 
84
                SubstanceColorScheme mainActiveScheme = skin
 
85
                                .getActiveColorScheme(DecorationAreaType.NONE);
 
86
                Color backgroundColor = new ColorUIResource(mainActiveScheme
 
87
                                .getBackgroundFillColor());
 
88
                Color disabledForegroundColor = SubstanceColorUtilities
 
89
                                .getForegroundColor(mainActiveScheme);
 
90
 
 
91
                Object[] defaults = new Object[] {
 
92
                                JCommandButtonPanel.uiClassID,
 
93
                                UI_COMMON_CLASSNAME_PREFIX + "CommandButtonPanelUI",
 
94
 
 
95
                                JCommandButton.uiClassID,
 
96
                                UI_COMMON_CLASSNAME_PREFIX + "CommandButtonUI",
 
97
 
 
98
                                JCommandMenuButton.uiClassID,
 
99
                                UI_COMMON_CLASSNAME_PREFIX + "CommandMenuButtonUI",
 
100
 
 
101
                                JCommandToggleButton.uiClassID,
 
102
                                UI_COMMON_CLASSNAME_PREFIX + "CommandToggleButtonUI",
 
103
 
 
104
                                JCommandToggleMenuButton.uiClassID,
 
105
                                UI_COMMON_CLASSNAME_PREFIX + "CommandToggleMenuButtonUI",
 
106
 
 
107
                                JPopupPanel.uiClassID,
 
108
                                UI_COMMON_CLASSNAME_PREFIX + "PopupPanelUI",
 
109
 
 
110
                                JScrollablePanel.uiClassID,
 
111
                                UI_COMMON_CLASSNAME_PREFIX + "ScrollablePanelUI",
 
112
 
 
113
                                JCommandPopupMenu.uiClassID,
 
114
                                UI_COMMON_CLASSNAME_PREFIX + "CommandPopupMenuUI",
 
115
 
 
116
                                JColorSelectorPanel.uiClassID,
 
117
                                UI_COMMON_CLASSNAME_PREFIX + "ColorSelectorPanelUI",
 
118
 
 
119
                                JBandControlPanel.uiClassID,
 
120
                                UI_RIBBON_CLASSNAME_PREFIX + "BandControlPanelUI",
 
121
 
 
122
                                JFlowBandControlPanel.uiClassID,
 
123
                                UI_RIBBON_CLASSNAME_PREFIX + "FlowBandControlPanelUI",
 
124
 
 
125
                                JRibbon.uiClassID,
 
126
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonUI",
 
127
 
 
128
                                JRibbonRootPane.uiClassID,
 
129
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonRootPaneUI",
 
130
 
 
131
                                JRibbonBand.uiClassID,
 
132
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonBandUI",
 
133
 
 
134
                                JRibbonGallery.uiClassID,
 
135
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonGalleryUI",
 
136
 
 
137
                                JRibbonApplicationMenuButton.uiClassID,
 
138
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonApplicationMenuButtonUI",
 
139
 
 
140
                                JRibbonApplicationMenuPopupPanel.uiClassID,
 
141
                                UI_RIBBON_CLASSNAME_PREFIX
 
142
                                                + "RibbonApplicationMenuPopupPanelUI",
 
143
 
 
144
                                JRibbonTaskToggleButton.uiClassID,
 
145
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonTaskToggleButtonUI",
 
146
 
 
147
                                JRichTooltipPanel.uiClassID,
 
148
                                UI_RIBBON_CLASSNAME_PREFIX + "RichTooltipPanelUI",
 
149
 
 
150
                                JRibbonComponent.uiClassID,
 
151
                                UI_RIBBON_CLASSNAME_PREFIX + "RibbonComponentUI",
 
152
 
 
153
                                JBreadcrumbBar.uiClassID,
 
154
                                UI_BCB_CLASSNAME_PREFIX + "BreadcrumbBarUI",
 
155
 
 
156
                                "BreadcrumbBar.font",
 
157
                                controlFont,
 
158
 
 
159
                                "IconPanel.font",
 
160
                                fontSet.getTitleFont(),
 
161
 
 
162
                                "CommandButtonPanel.font",
 
163
                                controlFont.deriveFont(Font.BOLD, controlFont.getSize() + 1),
 
164
 
 
165
                                "Ribbon.font",
 
166
                                controlFont,
 
167
 
 
168
                                "ControlPanel.border",
 
169
                                null,
 
170
 
 
171
                                "ControlPanel.background",
 
172
                                backgroundColor,
 
173
 
 
174
                                "CommandButton.popupActionIcon",
 
175
                                new IconUIResource(SubstanceImageCreator
 
176
                                                .getDoubleArrowIconDelta(SubstanceSizeUtils
 
177
                                                                .getControlFontSize(), -2, -1, -0.5f,
 
178
                                                                SwingConstants.SOUTH, mainActiveScheme)),
 
179
 
 
180
                                "PopupPanel.border", textBorder,
 
181
 
 
182
                                "PopupGallery.background", backgroundColor,
 
183
 
 
184
                                "Ribbon.border",
 
185
                                new BorderUIResource.EmptyBorderUIResource(1, 1, 1, 1),
 
186
 
 
187
                                "RibbonBand.border", new SubstanceRibbonBandBorder(),
 
188
 
 
189
                                "RibbonBand.background", backgroundColor,
 
190
 
 
191
                                "RibbonGallery.border",
 
192
                                new BorderUIResource.EmptyBorderUIResource(2, 2, 2, 2),
 
193
 
 
194
                                "RibbonGallery.margin", new Insets(3, 3, 3, 3),
 
195
 
 
196
                                "ToggleButton.background", backgroundColor,
 
197
 
 
198
                                "ToggleButton.disabledText", disabledForegroundColor };
 
199
                return defaults;
 
200
        }
 
201
 
 
202
        /*
 
203
         * (non-Javadoc)
 
204
         * 
 
205
         * @see org.pushingpixels.lafplugin.LafComponentPlugin#uninitialize()
 
206
         */
 
207
        @Override
 
208
    public void uninitialize() {
 
209
        }
 
210
 
 
211
        /*
 
212
         * (non-Javadoc)
 
213
         * 
 
214
         * @see org.pushingpixels.lafplugin.LafComponentPlugin#initialize()
 
215
         */
 
216
        @Override
 
217
    public void initialize() {
 
218
        }
 
219
}