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.plugin;
031:
032: import java.util.HashSet;
033: import java.util.Set;
034:
035: import org.jvnet.substance.theme.*;
036: import org.jvnet.substance.theme.SubstanceTheme.ThemeKind;
037:
038: /**
039: * Core plugin for themes. See
040: * {@link org.jvnet.substance.plugin.SubstanceThemePlugin} interface. This class
041: * is <b>for internal use only</b>.
042: *
043: * @author Kirill Grouchnikov.
044: */
045: public class BaseThemePlugin implements SubstanceThemePlugin {
046: /**
047: * Creates info object on a single theme.
048: *
049: * @param themeDisplayName
050: * Theme display name.
051: * @param themeClass
052: * Theme class.
053: * @param themeKind
054: * Theme kind.
055: * @param isDefault
056: * Indication whether the specified theme is default.
057: * @return Info object on the specified theme.
058: */
059: private static ThemeInfo create(String themeDisplayName,
060: Class<?> themeClass, ThemeKind themeKind, boolean isDefault) {
061: ThemeInfo result = new ThemeInfo(themeDisplayName, themeClass
062: .getName(), themeKind);
063: result.setDefault(isDefault);
064: return result;
065: }
066:
067: /*
068: * (non-Javadoc)
069: *
070: * @see org.jvnet.substance.plugin.SubstanceThemePlugin#getThemes()
071: */
072: public Set<ThemeInfo> getThemes() {
073: Set<ThemeInfo> result = new HashSet<ThemeInfo>();
074: result.add(create(SubstanceAquaTheme.DISPLAY_NAME,
075: SubstanceAquaTheme.class,
076: SubstanceAquaTheme.THEME_KIND, false));
077: result.add(create(SubstanceLightAquaTheme.DISPLAY_NAME,
078: SubstanceLightAquaTheme.class,
079: SubstanceLightAquaTheme.THEME_KIND, false));
080: result.add(create(SubstanceLimeGreenTheme.DISPLAY_NAME,
081: SubstanceLimeGreenTheme.class,
082: SubstanceLimeGreenTheme.THEME_KIND, false));
083: result.add(create(SubstanceBrownTheme.DISPLAY_NAME,
084: SubstanceBrownTheme.class,
085: SubstanceBrownTheme.THEME_KIND, false));
086: result.add(create(SubstanceOrangeTheme.DISPLAY_NAME,
087: SubstanceOrangeTheme.class,
088: SubstanceOrangeTheme.THEME_KIND, false));
089: result.add(create(SubstancePurpleTheme.DISPLAY_NAME,
090: SubstancePurpleTheme.class,
091: SubstancePurpleTheme.THEME_KIND, false));
092: result.add(create(SubstanceSunGlareTheme.DISPLAY_NAME,
093: SubstanceSunGlareTheme.class,
094: SubstanceSunGlareTheme.THEME_KIND, false));
095: result.add(create(SubstanceSunsetTheme.DISPLAY_NAME,
096: SubstanceSunsetTheme.class,
097: SubstanceSunsetTheme.THEME_KIND, false));
098: result.add(create(SubstanceOliveTheme.DISPLAY_NAME,
099: SubstanceOliveTheme.class,
100: SubstanceOliveTheme.THEME_KIND, false));
101: result.add(create(SubstanceTerracottaTheme.DISPLAY_NAME,
102: SubstanceTerracottaTheme.class,
103: SubstanceTerracottaTheme.THEME_KIND, false));
104: result.add(create(SubstanceSepiaTheme.DISPLAY_NAME,
105: SubstanceSepiaTheme.class,
106: SubstanceSepiaTheme.THEME_KIND, false));
107: result.add(create(SubstanceSteelBlueTheme.DISPLAY_NAME,
108: SubstanceSteelBlueTheme.class,
109: SubstanceSteelBlueTheme.THEME_KIND, false));
110: result.add(create(SubstanceEbonyTheme.DISPLAY_NAME,
111: SubstanceEbonyTheme.class,
112: SubstanceEbonyTheme.THEME_KIND, false));
113: result.add(create(SubstanceCharcoalTheme.DISPLAY_NAME,
114: SubstanceCharcoalTheme.class,
115: SubstanceCharcoalTheme.THEME_KIND, false));
116: result.add(create(SubstanceDarkVioletTheme.DISPLAY_NAME,
117: SubstanceDarkVioletTheme.class,
118: SubstanceDarkVioletTheme.THEME_KIND, false));
119: result.add(create(SubstanceUltramarineTheme.DISPLAY_NAME,
120: SubstanceUltramarineTheme.class,
121: SubstanceUltramarineTheme.THEME_KIND, false));
122: result.add(create(SubstanceJadeForestTheme.DISPLAY_NAME,
123: SubstanceJadeForestTheme.class,
124: SubstanceJadeForestTheme.THEME_KIND, false));
125: result.add(create(SubstanceBottleGreenTheme.DISPLAY_NAME,
126: SubstanceBottleGreenTheme.class,
127: SubstanceBottleGreenTheme.THEME_KIND, false));
128: result.add(create(SubstanceRaspberryTheme.DISPLAY_NAME,
129: SubstanceRaspberryTheme.class,
130: SubstanceRaspberryTheme.THEME_KIND, false));
131: result.add(create(SubstanceBarbyPinkTheme.DISPLAY_NAME,
132: SubstanceBarbyPinkTheme.class,
133: SubstanceBarbyPinkTheme.THEME_KIND, false));
134: result.add(create(SubstanceDesertSandTheme.DISPLAY_NAME,
135: SubstanceDesertSandTheme.class,
136: SubstanceDesertSandTheme.THEME_KIND, false));
137: result.add(create(SubstanceCremeTheme.DISPLAY_NAME,
138: SubstanceCremeTheme.class,
139: SubstanceCremeTheme.THEME_KIND, false));
140: return result;
141: }
142:
143: public String getDefaultThemeClassName() {
144: return null;
145: }
146: }
|