001: /*
002: * Copyright (c) 2005-2008 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 Substance 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.skin;
031:
032: import java.awt.Color;
033:
034: import org.jvnet.substance.border.ClassicInnerBorderPainter;
035: import org.jvnet.substance.button.ClassicButtonShaper;
036: import org.jvnet.substance.color.ColorScheme;
037: import org.jvnet.substance.painter.*;
038: import org.jvnet.substance.painter.decoration.DecorationAreaType;
039: import org.jvnet.substance.painter.decoration.MarbleNoiseDecorationPainter;
040: import org.jvnet.substance.painter.highlight.ClassicHighlightPainter;
041: import org.jvnet.substance.theme.SubstanceComplexTheme;
042: import org.jvnet.substance.theme.SubstanceTheme;
043: import org.jvnet.substance.theme.SubstanceTheme.ThemeKind;
044: import org.jvnet.substance.utils.ComponentState;
045: import org.jvnet.substance.utils.SubstanceColorUtilities;
046: import org.jvnet.substance.utils.SubstanceConstants.ColorShiftKind;
047: import org.jvnet.substance.watermark.SubstanceNullWatermark;
048:
049: /**
050: * <code>Autumn</code> skin. This class is part of officially supported API.
051: *
052: * @author Kirill Grouchnikov
053: * @since version 4.0
054: */
055: public class AutumnSkin extends SubstanceAbstractSkin {
056: /**
057: * Display name for <code>this</code> skin.
058: */
059: public static String NAME = "Autumn";
060:
061: /**
062: * Color scheme for active visual state.
063: *
064: * @author Kirill Grouchnikov
065: */
066: protected static class ActiveScheme implements ColorScheme {
067: /**
068: * The main ultra-light color.
069: */
070: private static final Color mainUltraLightColor = Color
071: .decode("#FDDDAC");
072:
073: /**
074: * The main extra-light color.
075: */
076: private static final Color mainExtraLightColor = Color
077: .decode("#FCEF9F");
078:
079: /**
080: * The main light color.
081: */
082: private static final Color mainLightColor = Color
083: .decode("#FCD592");
084:
085: /**
086: * The main medium color.
087: */
088: private static final Color mainMidColor = Color
089: .decode("#F9BE84");
090:
091: /**
092: * The main dark color.
093: */
094: private static final Color mainDarkColor = Color
095: .decode("#F8B87A");
096:
097: /**
098: * The main ultra-dark color.
099: */
100: // private static final Color mainUltraDarkColor =
101: // Color.decode("#5B0E00");
102: private static final Color mainUltraDarkColor = Color
103: .decode("#AC623B");
104:
105: /**
106: * The foreground color.
107: */
108: private static final Color foregroundColor = Color
109: .decode("#AC623B");
110:
111: /*
112: * (non-Javadoc)
113: *
114: * @see org.jvnet.substance.color.ColorScheme#getForegroundColor()
115: */
116: public Color getForegroundColor() {
117: return ActiveScheme.foregroundColor;
118: }
119:
120: /*
121: * (non-Javadoc)
122: *
123: * @see org.jvnet.substance.color.ColorScheme#getUltraLightColor()
124: */
125: public Color getUltraLightColor() {
126: return ActiveScheme.mainUltraLightColor;
127: }
128:
129: /*
130: * (non-Javadoc)
131: *
132: * @see org.jvnet.substance.color.ColorScheme#getExtraLightColor()
133: */
134: public Color getExtraLightColor() {
135: return ActiveScheme.mainExtraLightColor;
136: }
137:
138: /*
139: * (non-Javadoc)
140: *
141: * @see org.jvnet.substance.color.ColorScheme#getLightColor()
142: */
143: public Color getLightColor() {
144: return ActiveScheme.mainLightColor;
145: }
146:
147: /*
148: * (non-Javadoc)
149: *
150: * @see org.jvnet.substance.color.ColorScheme#getMidColor()
151: */
152: public Color getMidColor() {
153: return ActiveScheme.mainMidColor;
154: }
155:
156: /*
157: * (non-Javadoc)
158: *
159: * @see org.jvnet.substance.color.ColorScheme#getDarkColor()
160: */
161: public Color getDarkColor() {
162: return ActiveScheme.mainDarkColor;
163: }
164:
165: /*
166: * (non-Javadoc)
167: *
168: * @see org.jvnet.substance.color.ColorScheme#getUltraDarkColor()
169: */
170: public Color getUltraDarkColor() {
171: return ActiveScheme.mainUltraDarkColor;
172: }
173: }
174:
175: /**
176: * Color scheme for default visual state.
177: *
178: * @author Kirill Grouchnikov
179: */
180: protected static class DefaultScheme implements ColorScheme {
181: /**
182: * The main ultra-light color.
183: */
184: private static final Color mainUltraLightColor = Color
185: .decode("#FFF2DF");
186:
187: /**
188: * The main extra-light color.
189: */
190: private static final Color mainExtraLightColor = Color
191: .decode("#FFE3C5");
192:
193: /**
194: * The main light color.
195: */
196: private static final Color mainLightColor = Color
197: .decode("#FDD1A4");
198:
199: /**
200: * The main medium color.
201: */
202: private static final Color mainMidColor = Color
203: .decode("#FBCD9C");
204:
205: /**
206: * The main dark color.
207: */
208: private static final Color mainDarkColor = Color
209: .decode("#FCC896");
210:
211: /**
212: * The main ultra-dark color.
213: */
214: // private static final Color mainUltraDarkColor =
215: // Color.decode("#872A00");
216: private static final Color mainUltraDarkColor = Color
217: .decode("#AC623B");
218:
219: /**
220: * The foreground color.
221: */
222: private static final Color foregroundColor = Color
223: .decode("#AC623B");
224:
225: /*
226: * (non-Javadoc)
227: *
228: * @see org.jvnet.substance.color.ColorScheme#getForegroundColor()
229: */
230: public Color getForegroundColor() {
231: return DefaultScheme.foregroundColor;
232: }
233:
234: /*
235: * (non-Javadoc)
236: *
237: * @see org.jvnet.substance.color.ColorScheme#getUltraLightColor()
238: */
239: public Color getUltraLightColor() {
240: return DefaultScheme.mainUltraLightColor;
241: }
242:
243: /*
244: * (non-Javadoc)
245: *
246: * @see org.jvnet.substance.color.ColorScheme#getExtraLightColor()
247: */
248: public Color getExtraLightColor() {
249: return DefaultScheme.mainExtraLightColor;
250: }
251:
252: /*
253: * (non-Javadoc)
254: *
255: * @see org.jvnet.substance.color.ColorScheme#getLightColor()
256: */
257: public Color getLightColor() {
258: return DefaultScheme.mainLightColor;
259: }
260:
261: /*
262: * (non-Javadoc)
263: *
264: * @see org.jvnet.substance.color.ColorScheme#getMidColor()
265: */
266: public Color getMidColor() {
267: return DefaultScheme.mainMidColor;
268: }
269:
270: /*
271: * (non-Javadoc)
272: *
273: * @see org.jvnet.substance.color.ColorScheme#getDarkColor()
274: */
275: public Color getDarkColor() {
276: return DefaultScheme.mainDarkColor;
277: }
278:
279: /*
280: * (non-Javadoc)
281: *
282: * @see org.jvnet.substance.color.ColorScheme#getUltraDarkColor()
283: */
284: public Color getUltraDarkColor() {
285: return DefaultScheme.mainUltraDarkColor;
286: }
287: }
288:
289: /**
290: * Creates a new <code>Autumn</code> skin.
291: */
292: public AutumnSkin() {
293: SubstanceTheme activeTheme = new SubstanceTheme(
294: new ActiveScheme(), "Autumn Active", ThemeKind.COLD);
295: SubstanceTheme defaultTheme = new SubstanceTheme(
296: new DefaultScheme(), "Autumn Default", ThemeKind.COLD);
297:
298: // final ColorScheme disabledScheme = new
299: // BlendBiColorScheme(defaultTheme
300: // .getColorScheme(), defaultTheme.getDisabledTheme()
301: // .getColorScheme(), 0.6) {
302: // Color foreColor = new Color(128, 131, 136);
303: //
304: // @Override
305: // public Color getForegroundColor() {
306: // return foreColor;
307: // }
308: // };
309: SubstanceTheme disabledTheme = defaultTheme;
310: // new SubstanceTheme(disabledScheme,
311: // "Disabled Autumn", ThemeKind.COLD);
312:
313: SubstanceTheme activeTitleTheme = defaultTheme;
314:
315: SubstanceComplexTheme theme = new SubstanceComplexTheme(NAME,
316: ThemeKind.COLD, activeTheme, defaultTheme,
317: disabledTheme, activeTitleTheme) {
318: /*
319: * (non-Javadoc)
320: *
321: * @see org.jvnet.substance.theme.SubstanceComplexTheme#getLightBackgroundColor()
322: */
323: @Override
324: public Color getLightBackgroundColor() {
325: return SubstanceColorUtilities.getInterpolatedColor(
326: defaultTheme.getColorScheme()
327: .getUltraLightColor(), defaultTheme
328: .getColorScheme().getExtraLightColor(),
329: 0.5);
330:
331: }
332:
333: /*
334: * (non-Javadoc)
335: *
336: * @see org.jvnet.substance.theme.SubstanceTheme#getDisabledForegroundColor()
337: */
338: @Override
339: public Color getDisabledForegroundColor() {
340: return SubstanceColorUtilities
341: .getInterpolatedColor(defaultTheme
342: .getColorScheme().getForegroundColor(),
343: defaultTheme.getColorScheme()
344: .getLightColor(), 0.6f);
345: }
346: };
347: theme
348: .setNonActivePainter(new SimplisticSoftBorderReverseGradientPainter());
349: theme.setSelectedTabFadeStart(0.1);
350: theme.setSelectedTabFadeEnd(0.3);
351: theme.registerComponentStateTheme(disabledTheme, 0.6f, false,
352: ComponentState.DISABLED_UNSELECTED);
353: theme.registerComponentStateTheme(activeTheme, 0.6f, false,
354: ComponentState.DISABLED_SELECTED);
355:
356: theme.registerDecorationAreaTheme(theme, false,
357: DecorationAreaType.PRIMARY_TITLE_PANE,
358: DecorationAreaType.SECONDARY_TITLE_PANE,
359: DecorationAreaType.HEADER);
360:
361: theme.setPaintingToolbarDropShadows();
362:
363: this .theme = theme;
364: this .buttonShaper = new ClassicButtonShaper();
365: this .watermark = new SubstanceNullWatermark();
366: this .gradientPainter = new MatteGradientPainter();
367: this .borderPainter = new ClassicInnerBorderPainter(0.8f,
368: ColorShiftKind.TINT);
369:
370: this .highlightPainter = new ClassicHighlightPainter();
371:
372: MarbleNoiseDecorationPainter decorationPainter = new MarbleNoiseDecorationPainter();
373: decorationPainter.setPaintingSeparators(true);
374: decorationPainter.setTextureAlpha(0.7f);
375: this .decorationPainter = decorationPainter;
376:
377: tabBackgroundComposite = new AlphaControlBackgroundComposite(
378: 0.75f);
379: }
380:
381: /*
382: * (non-Javadoc)
383: *
384: * @see org.jvnet.substance.skin.SubstanceSkin#getDisplayName()
385: */
386: public String getDisplayName() {
387: return NAME;
388: }
389: }
|