001: /*
002: * Copyright (c) 2001-2007 JGoodies Karsten Lentzsch. 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 JGoodies Karsten Lentzsch 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:
031: package com.jgoodies.looks.demo;
032:
033: import javax.swing.LookAndFeel;
034:
035: import com.jgoodies.looks.BorderStyle;
036: import com.jgoodies.looks.HeaderStyle;
037: import com.jgoodies.looks.plastic.PlasticLookAndFeel;
038: import com.jgoodies.looks.plastic.PlasticTheme;
039: import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
040:
041: /**
042: * Describes most of the optional settings of the JGoodies Looks.
043: * Used by the <code>DemoFrame</code> to configure the UI.
044: *
045: * @author Karsten Lentzsch
046: * @version $Revision: 1.7 $
047: *
048: * @see com.jgoodies.looks.BorderStyle
049: * @see com.jgoodies.looks.HeaderStyle
050: * @see com.jgoodies.looks.Options
051: */
052: public final class Settings {
053:
054: private LookAndFeel selectedLookAndFeel;
055:
056: private PlasticTheme selectedTheme;
057:
058: private boolean useNarrowButtons;
059:
060: private boolean tabIconsEnabled;
061:
062: private String plasticTabStyle;
063:
064: private boolean plasticHighContrastFocusEnabled;
065:
066: private Boolean popupDropShadowEnabled;
067:
068: private HeaderStyle menuBarHeaderStyle;
069:
070: private BorderStyle menuBarPlasticBorderStyle;
071:
072: private BorderStyle menuBarWindowsBorderStyle;
073:
074: private Boolean menuBar3DHint;
075:
076: private HeaderStyle toolBarHeaderStyle;
077:
078: private BorderStyle toolBarPlasticBorderStyle;
079:
080: private BorderStyle toolBarWindowsBorderStyle;
081:
082: private Boolean toolBar3DHint;
083:
084: // Instance Creation ******************************************************
085:
086: private Settings() {
087: // Override default constructor; prevents instantiability.
088: }
089:
090: public static Settings createDefault() {
091: Settings settings = new Settings();
092: settings.setSelectedLookAndFeel(new PlasticXPLookAndFeel());
093: settings.setSelectedTheme(PlasticLookAndFeel
094: .createMyDefaultTheme());
095: settings.setUseNarrowButtons(true);
096: settings.setTabIconsEnabled(true);
097: settings
098: .setPlasticTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
099: settings.setPlasticHighContrastFocusEnabled(false);
100: settings.setPopupDropShadowEnabled(null);
101: settings.setMenuBarHeaderStyle(null);
102: settings.setMenuBarPlasticBorderStyle(null);
103: settings.setMenuBarWindowsBorderStyle(null);
104: settings.setMenuBar3DHint(null);
105: settings.setToolBarHeaderStyle(null);
106: settings.setToolBarPlasticBorderStyle(null);
107: settings.setToolBarWindowsBorderStyle(null);
108: settings.setToolBar3DHint(null);
109: return settings;
110: }
111:
112: // Accessors **************************************************************
113:
114: public Boolean getMenuBar3DHint() {
115: return menuBar3DHint;
116: }
117:
118: public void setMenuBar3DHint(Boolean menuBar3DHint) {
119: this .menuBar3DHint = menuBar3DHint;
120: }
121:
122: public HeaderStyle getMenuBarHeaderStyle() {
123: return menuBarHeaderStyle;
124: }
125:
126: public void setMenuBarHeaderStyle(HeaderStyle menuBarHeaderStyle) {
127: this .menuBarHeaderStyle = menuBarHeaderStyle;
128: }
129:
130: public BorderStyle getMenuBarPlasticBorderStyle() {
131: return menuBarPlasticBorderStyle;
132: }
133:
134: public void setMenuBarPlasticBorderStyle(
135: BorderStyle menuBarPlasticBorderStyle) {
136: this .menuBarPlasticBorderStyle = menuBarPlasticBorderStyle;
137: }
138:
139: public BorderStyle getMenuBarWindowsBorderStyle() {
140: return menuBarWindowsBorderStyle;
141: }
142:
143: public void setMenuBarWindowsBorderStyle(
144: BorderStyle menuBarWindowsBorderStyle) {
145: this .menuBarWindowsBorderStyle = menuBarWindowsBorderStyle;
146: }
147:
148: public Boolean isPopupDropShadowEnabled() {
149: return popupDropShadowEnabled;
150: }
151:
152: public void setPopupDropShadowEnabled(Boolean popupDropShadowEnabled) {
153: this .popupDropShadowEnabled = popupDropShadowEnabled;
154: }
155:
156: public boolean isPlasticHighContrastFocusEnabled() {
157: return plasticHighContrastFocusEnabled;
158: }
159:
160: public void setPlasticHighContrastFocusEnabled(
161: boolean plasticHighContrastFocusEnabled) {
162: this .plasticHighContrastFocusEnabled = plasticHighContrastFocusEnabled;
163: }
164:
165: public String getPlasticTabStyle() {
166: return plasticTabStyle;
167: }
168:
169: public void setPlasticTabStyle(String plasticTabStyle) {
170: this .plasticTabStyle = plasticTabStyle;
171: }
172:
173: public LookAndFeel getSelectedLookAndFeel() {
174: return selectedLookAndFeel;
175: }
176:
177: public void setSelectedLookAndFeel(LookAndFeel selectedLookAndFeel) {
178: this .selectedLookAndFeel = selectedLookAndFeel;
179: }
180:
181: public void setSelectedLookAndFeel(
182: String selectedLookAndFeelClassName) {
183: try {
184: Class theClass = Class
185: .forName(selectedLookAndFeelClassName);
186: setSelectedLookAndFeel((LookAndFeel) theClass.newInstance());
187: } catch (Exception e) {
188: System.out.println("Can't instantiate "
189: + selectedLookAndFeelClassName);
190: e.printStackTrace();
191: }
192: }
193:
194: public PlasticTheme getSelectedTheme() {
195: return selectedTheme;
196: }
197:
198: public void setSelectedTheme(PlasticTheme selectedTheme) {
199: this .selectedTheme = selectedTheme;
200: }
201:
202: public boolean isTabIconsEnabled() {
203: return tabIconsEnabled;
204: }
205:
206: public void setTabIconsEnabled(boolean tabIconsEnabled) {
207: this .tabIconsEnabled = tabIconsEnabled;
208: }
209:
210: public Boolean getToolBar3DHint() {
211: return toolBar3DHint;
212: }
213:
214: public void setToolBar3DHint(Boolean toolBar3DHint) {
215: this .toolBar3DHint = toolBar3DHint;
216: }
217:
218: public HeaderStyle getToolBarHeaderStyle() {
219: return toolBarHeaderStyle;
220: }
221:
222: public void setToolBarHeaderStyle(HeaderStyle toolBarHeaderStyle) {
223: this .toolBarHeaderStyle = toolBarHeaderStyle;
224: }
225:
226: public BorderStyle getToolBarPlasticBorderStyle() {
227: return toolBarPlasticBorderStyle;
228: }
229:
230: public void setToolBarPlasticBorderStyle(
231: BorderStyle toolBarPlasticBorderStyle) {
232: this .toolBarPlasticBorderStyle = toolBarPlasticBorderStyle;
233: }
234:
235: public BorderStyle getToolBarWindowsBorderStyle() {
236: return toolBarWindowsBorderStyle;
237: }
238:
239: public void setToolBarWindowsBorderStyle(
240: BorderStyle toolBarWindowsBorderStyle) {
241: this .toolBarWindowsBorderStyle = toolBarWindowsBorderStyle;
242: }
243:
244: public boolean isUseNarrowButtons() {
245: return useNarrowButtons;
246: }
247:
248: public void setUseNarrowButtons(boolean useNarrowButtons) {
249: this.useNarrowButtons = useNarrowButtons;
250: }
251:
252: }
|