001: /*
002: * PropertiesAppearance.java
003: *
004: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021:
022: package org.executequery.gui.prefs;
023:
024: import java.util.ArrayList;
025: import org.executequery.Constants;
026: import org.underworldlabs.util.SystemProperties;
027:
028: /* ----------------------------------------------------------
029: * CVS NOTE: Changes to the CVS repository prior to the
030: * release of version 3.0.0beta1 has meant a
031: * resetting of CVS revision numbers.
032: * ----------------------------------------------------------
033: */
034:
035: /**
036: * System preferences appearance panel.
037: *
038: * @author Takis Diakoumis
039: * @version $Revision: 1.5 $
040: * @date $Date: 2006/06/14 15:06:31 $
041: */
042: public class PropertiesAppearance extends PropertiesBase {
043:
044: private SimplePreferencesPanel preferencesPanel;
045:
046: /** <p>Constructs a new instance. */
047: public PropertiesAppearance() {
048: try {
049: jbInit();
050: } catch (Exception e) {
051: e.printStackTrace();
052: }
053: }
054:
055: /** Initializes the state of this instance. */
056: private void jbInit() throws Exception {
057:
058: ArrayList list = new ArrayList();
059: list.add(new UserPreference(UserPreference.CATEGORY_TYPE, null,
060: "General", null));
061:
062: String key = "system.display.statusbar";
063: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
064: "Status bar", new Boolean(SystemProperties.getProperty(
065: "user", key))));
066:
067: key = "system.display.console";
068: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
069: "System console", new Boolean(SystemProperties
070: .getProperty("user", key))));
071:
072: key = "system.display.connections";
073: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
074: "Connections", new Boolean(SystemProperties
075: .getProperty("user", key))));
076:
077: key = "system.display.drivers";
078: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
079: "Drivers", new Boolean(SystemProperties.getProperty(
080: "user", key))));
081:
082: key = "system.display.keywords";
083: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
084: "SQL Keywords", new Boolean(SystemProperties
085: .getProperty("user", key))));
086:
087: key = "system.display.state-codes";
088: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
089: "SQL State Codes", new Boolean(SystemProperties
090: .getProperty("user", key))));
091:
092: key = "system.display.systemprops";
093: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
094: "System properties palette", new Boolean(
095: SystemProperties.getProperty("user", key))));
096:
097: list.add(new UserPreference(UserPreference.CATEGORY_TYPE, null,
098: "Appearance", null));
099:
100: key = "startup.display.lookandfeel";
101: list.add(new UserPreference(UserPreference.STRING_TYPE, key,
102: "Look and feel (requires restart)", SystemProperties
103: .getProperty("user", key),
104: Constants.LOOK_AND_FEELS));
105:
106: key = "desktop.background.custom.colour";
107: list.add(new UserPreference(UserPreference.COLOUR_TYPE, key,
108: "Desktop background", SystemProperties
109: .getColourProperty("user", key)));
110:
111: key = "decorate.dialog.look";
112: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
113: "Decorate dialogs", new Boolean(SystemProperties
114: .getProperty("user", key))));
115:
116: key = "decorate.frame.look";
117: list.add(new UserPreference(UserPreference.BOOLEAN_TYPE, key,
118: "Decorate frame", new Boolean(SystemProperties
119: .getProperty("user", key))));
120:
121: UserPreference[] preferences = (UserPreference[]) list
122: .toArray(new UserPreference[list.size()]);
123: preferencesPanel = new SimplePreferencesPanel(preferences);
124: addContent(preferencesPanel);
125:
126: }
127:
128: public void restoreDefaults() {
129: preferencesPanel.savePreferences();
130: }
131:
132: public void save() {
133: preferencesPanel.savePreferences();
134: }
135:
136: }
|