001: /*
002: * ViewOptionsCommand.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.actions.viewcommands;
023:
024: import java.awt.event.ActionEvent;
025: import javax.swing.JCheckBoxMenuItem;
026: import javax.swing.SwingUtilities;
027:
028: import org.executequery.GUIUtilities;
029: import org.underworldlabs.util.SystemProperties;
030: import org.underworldlabs.swing.actions.ReflectiveAction;
031: import org.executequery.gui.BaseDialog;
032: import org.executequery.gui.prefs.PropertiesPanel;
033: import org.executequery.gui.SystemOutputPanel;
034: import org.executequery.gui.SystemPropertiesDockedTab;
035: import org.executequery.gui.browser.ConnectionsTreePanel;
036: import org.executequery.gui.drivers.DriversTreePanel;
037: import org.executequery.gui.keywords.KeywordsDockedPanel;
038: import org.executequery.gui.prefs.PropertyTypes;
039: import org.executequery.gui.sqlstates.SQLStateCodesDockedPanel;
040: import org.executequery.toolbars.ToolBarManager;
041:
042: /* ----------------------------------------------------------
043: * CVS NOTE: Changes to the CVS repository prior to the
044: * release of version 3.0.0beta1 has meant a
045: * resetting of CVS revision numbers.
046: * ----------------------------------------------------------
047: */
048:
049: /**
050: *
051: * @author Takis Diakoumis
052: * @version $Revision: 1.4 $
053: * @date $Date: 2006/06/14 15:04:55 $
054: */
055: public class ViewOptionsCommand extends ReflectiveAction {
056:
057: public ViewOptionsCommand() {
058: }
059:
060: public void viewStatusBar(ActionEvent e) {
061: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
062: GUIUtilities.displayStatusBar(item.isSelected());
063: }
064:
065: public void viewConsole(ActionEvent e) {
066: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
067: boolean selected = item.isSelected();
068: GUIUtilities.displayDockedComponent(
069: SystemOutputPanel.PROPERTY_KEY, selected);
070: }
071:
072: public void viewConnections(ActionEvent e) {
073: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
074: boolean selected = item.isSelected();
075: GUIUtilities.displayDockedComponent(
076: ConnectionsTreePanel.PROPERTY_KEY, selected);
077: }
078:
079: public void viewKeywords(ActionEvent e) {
080: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
081: boolean selected = item.isSelected();
082: GUIUtilities.displayDockedComponent(
083: KeywordsDockedPanel.PROPERTY_KEY, selected);
084: }
085:
086: public void viewSqlStateCodes(ActionEvent e) {
087: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
088: boolean selected = item.isSelected();
089: GUIUtilities.displayDockedComponent(
090: SQLStateCodesDockedPanel.PROPERTY_KEY, selected);
091: }
092:
093: public void viewDrivers(ActionEvent e) {
094: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
095: boolean selected = item.isSelected();
096: GUIUtilities.displayDockedComponent(
097: DriversTreePanel.PROPERTY_KEY, selected);
098: }
099:
100: public void viewSystemProperties(ActionEvent e) {
101: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
102: boolean selected = item.isSelected();
103: GUIUtilities.displayDockedComponent(
104: SystemPropertiesDockedTab.PROPERTY_KEY, selected);
105: /*
106: GUIUtilities.displayPalette(GUIUtilities.SYSTEM_PROPERTIES_PALETTE,
107: item.isSelected());
108: */
109: }
110:
111: public void viewBrowserTools(ActionEvent e) {
112: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
113: GUIUtilities.displayToolBar(ToolBarManager.BROWSER_TOOLS, item
114: .isSelected());
115: }
116:
117: public void viewFileTools(ActionEvent e) {
118: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
119: GUIUtilities.displayToolBar(ToolBarManager.FILE_TOOLS, item
120: .isSelected());
121: }
122:
123: public void viewEditTools(ActionEvent e) {
124: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
125: GUIUtilities.displayToolBar(ToolBarManager.EDIT_TOOLS, item
126: .isSelected());
127: }
128:
129: public void viewSearchTools(ActionEvent e) {
130: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
131: GUIUtilities.displayToolBar(ToolBarManager.SEARCH_TOOLS, item
132: .isSelected());
133: }
134:
135: public void viewDatabaseTools(ActionEvent e) {
136: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
137: GUIUtilities.displayToolBar(ToolBarManager.DATABASE_TOOLS, item
138: .isSelected());
139: }
140:
141: public void viewImportExportTools(ActionEvent e) {
142: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
143: GUIUtilities.displayToolBar(ToolBarManager.IMPORT_EXPORT_TOOLS,
144: item.isSelected());
145: }
146:
147: /*
148: public void viewComponentTools(ActionEvent e) {
149: JCheckBoxMenuItem item = (JCheckBoxMenuItem)e.getSource();
150: GUIUtilities.displayToolBar(ToolBarManager.COMPONENT_TOOLS, item.isSelected());
151: }
152:
153: public void viewWindowTools(ActionEvent e) {
154: JCheckBoxMenuItem item = (JCheckBoxMenuItem)e.getSource();
155: GUIUtilities.displayToolBar(ToolBarManager.WINDOW_TOOLS, item.isSelected());
156: }
157: */
158:
159: public void viewSystemTools(ActionEvent e) {
160: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
161: GUIUtilities.displayToolBar(ToolBarManager.SYSTEM_TOOLS, item
162: .isSelected());
163: }
164:
165: public void customizeTools(ActionEvent e) {
166: SwingUtilities.invokeLater(new Runnable() {
167: public void run() {
168: GUIUtilities.showWaitCursor();
169: BaseDialog dialog = new BaseDialog(
170: PropertiesPanel.TITLE, true);
171: PropertiesPanel panel = new PropertiesPanel(dialog,
172: PropertyTypes.TOOLBAR_GENERAL);
173: dialog.addDisplayComponentWithEmptyBorder(panel);
174: dialog.display();
175: GUIUtilities.showNormalCursor();
176: }
177: });
178: }
179:
180: /*
181: public void showFrameIcon(ActionEvent e) {
182: SystemProperties.setProperty("desktop.frame.icon", "1");
183: GUIUtilities.setViewColourProperties(true);
184: }
185:
186: public void hideFrameIcon(ActionEvent e) {
187: SystemProperties.setProperty("desktop.frame.icon", "0");
188: GUIUtilities.setViewColourProperties(true);
189: }
190: */
191: public void viewEditorStatusBar(ActionEvent e) {
192: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
193: SystemProperties.setBooleanProperty("user",
194: "editor.display.statusbar", item.isSelected());
195: GUIUtilities.updateOpenEditors(true);
196:
197: }
198:
199: public void viewEditorLineNumbers(ActionEvent e) {
200: JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
201: SystemProperties.setBooleanProperty("user",
202: "editor.display.linenums", item.isSelected());
203: GUIUtilities.updateOpenEditors(true);
204: }
205:
206: }
|