001: /*
002: * Copyright (c) 2005-2008 Flamingo / Substance Kirill Grouchnikov. All Rights Reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * o Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * o Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * o Neither the name of Flamingo Kirill Grouchnikov nor the names of
015: * its contributors may be used to endorse or promote products derived
016: * from this software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
022: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
027: * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
028: * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030: package org.jvnet.substance.flamingo;
031:
032: import java.awt.*;
033:
034: import javax.swing.SwingConstants;
035: import javax.swing.border.Border;
036: import javax.swing.plaf.*;
037:
038: import org.jvnet.flamingo.bcb.BreadcrumbBar;
039: import org.jvnet.flamingo.bcb.ScrollablePopup;
040: import org.jvnet.flamingo.bcb.ui.BreadcrumbParticle;
041: import org.jvnet.flamingo.bcb.ui.ChoicesSelector;
042: import org.jvnet.flamingo.common.*;
043: import org.jvnet.flamingo.ribbon.*;
044: import org.jvnet.flamingo.ribbon.ui.JRibbonGallery;
045: import org.jvnet.lafplugin.LafComponentPlugin;
046: import org.jvnet.substance.*;
047: import org.jvnet.substance.flamingo.ribbon.RibbonBackgroundDelegate;
048: import org.jvnet.substance.fonts.FontSet;
049: import org.jvnet.substance.theme.SubstanceTheme;
050: import org.jvnet.substance.utils.SubstanceSizeUtils;
051:
052: /**
053: * Plugin for Flamingo components.
054: *
055: * @author Kirill Grouchnikov
056: */
057: public class FlamingoPlugin implements LafComponentPlugin {
058:
059: /*
060: * (non-Javadoc)
061: *
062: * @see org.jvnet.lafplugin.LafComponentPlugin#getDefaults(java.lang.Object)
063: */
064: public Object[] getDefaults(Object mTheme) {
065: String UI_COMMON_CLASSNAME_PREFIX = "org.jvnet.substance.flamingo.common.ui.Substance";
066:
067: String UI_RIBBON_CLASSNAME_PREFIX = "org.jvnet.substance.flamingo.ribbon.ui.Substance";
068:
069: String UI_BCB_CLASSNAME_PREFIX = "org.jvnet.substance.flamingo.bcb.ui.Substance";
070:
071: FontSet fontSet = SubstanceLookAndFeel.getFontPolicy()
072: .getFontSet("Substance", null);
073: Font controlFont = fontSet.getControlFont();
074:
075: SubstanceTheme theme = (SubstanceTheme) mTheme;
076: Border textBorder = new BorderUIResource(new SubstanceBorder());
077: Color backgroundColor = new ColorUIResource(theme
078: .getBackgroundColor());
079: Color disabledForegroundColor = new ColorUIResource(theme
080: .getDisabledTheme().getForegroundColor());
081: Object[] defaults = new Object[] {
082: JButtonStrip.uiClassID,
083: UI_COMMON_CLASSNAME_PREFIX + "ButtonStripUI",
084:
085: JCommandButtonPanel.uiClassID,
086: UI_COMMON_CLASSNAME_PREFIX + "CommandButtonPanelUI",
087:
088: JCommandButton.uiClassID,
089: UI_COMMON_CLASSNAME_PREFIX + "CommandButtonUI",
090:
091: JCommandToggleButton.uiClassID,
092: UI_COMMON_CLASSNAME_PREFIX + "CommandToggleButtonUI",
093:
094: JPopupPanel.uiClassID,
095: UI_COMMON_CLASSNAME_PREFIX + "PopupPanelUI",
096:
097: JBandControlPanel.uiClassID,
098: UI_RIBBON_CLASSNAME_PREFIX + "BandControlPanelUI",
099:
100: JRibbon.uiClassID,
101: UI_RIBBON_CLASSNAME_PREFIX + "RibbonUI",
102:
103: JRibbonBand.uiClassID,
104: UI_RIBBON_CLASSNAME_PREFIX + "RibbonBandUI",
105:
106: JRibbonGallery.uiClassID,
107: UI_RIBBON_CLASSNAME_PREFIX + "RibbonGalleryUI",
108:
109: JToggleTabButton.uiClassID,
110: UI_RIBBON_CLASSNAME_PREFIX + "ToggleTabButtonUI",
111:
112: BreadcrumbBar.uiClassID,
113: UI_BCB_CLASSNAME_PREFIX + "BreadcrumbBarUI",
114:
115: BreadcrumbParticle.uiClassID,
116: UI_BCB_CLASSNAME_PREFIX + "BreadcrumbParticleUI",
117:
118: ChoicesSelector.uiClassID,
119: UI_BCB_CLASSNAME_PREFIX + "ChoicesSelectorUI",
120:
121: ScrollablePopup.uiClassID,
122: UI_BCB_CLASSNAME_PREFIX + "ScrollablePopupUI",
123:
124: "BreadcrumbBar.font",
125: controlFont,
126:
127: "IconPanel.font",
128: fontSet.getTitleFont(),
129:
130: "CommandButtonPanel.font",
131: controlFont.deriveFont(Font.BOLD,
132: controlFont.getSize() + 1),
133:
134: "Ribbon.font",
135: controlFont,
136:
137: "ControlPanel.border",
138: null,
139:
140: "ControlPanel.background",
141: backgroundColor,
142:
143: "GalleryButton.expandIcon",
144: new IconUIResource(SubstanceImageCreator
145: .getDoubleArrowIcon(SubstanceSizeUtils
146: .getControlFontSize(), -2, 1, -0.3f,
147: SwingConstants.SOUTH, theme)),
148:
149: "PopupGallery.border", textBorder,
150:
151: "PopupGallery.background", backgroundColor,
152:
153: "Ribbon.border",
154: new BorderUIResource.EmptyBorderUIResource(1, 1, 0, 1),
155:
156: "RibbonBand.border", new SubstanceBorder(1.0f),
157:
158: "RibbonBand.background", backgroundColor,
159:
160: "RibbonGallery.border",
161: new BorderUIResource.EmptyBorderUIResource(2, 2, 2, 2),
162:
163: "RibbonGallery.margin", new Insets(3, 3, 3, 3),
164:
165: "ToggleButton.background", backgroundColor,
166:
167: "ToggleButton.disabledText", disabledForegroundColor };
168: return defaults;
169: }
170:
171: /*
172: * (non-Javadoc)
173: *
174: * @see org.jvnet.lafplugin.LafComponentPlugin#uninitialize()
175: */
176: public void uninitialize() {
177: RibbonBackgroundDelegate.reset();
178: }
179:
180: /*
181: * (non-Javadoc)
182: *
183: * @see org.jvnet.lafplugin.LafComponentPlugin#initialize()
184: */
185: public void initialize() {
186: }
187: }
|