001: /*
002: * Gruntspud
003: *
004: * Copyright (C) 2002 Brett Smith.
005: *
006: * Written by: Brett Smith <t_magicthize@users.sourceforge.net>
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public License
010: * as published by the Free Software Foundation; either version 2 of
011: * the License, or (at your option) any later version.
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU Library General Public License for more details.
016: *
017: * You should have received a copy of the GNU Library General Public
018: * License along with this program; if not, write to the Free Software
019: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020: */
021:
022: package gruntspud.ui.preferences;
023:
024: import gruntspud.Constants;
025: import gruntspud.GruntspudContext;
026: import gruntspud.ui.UIUtil;
027:
028: import java.awt.GridBagConstraints;
029: import java.awt.GridBagLayout;
030: import java.awt.Insets;
031: import java.awt.event.ActionEvent;
032: import java.awt.event.ActionListener;
033:
034: import javax.swing.JCheckBox;
035:
036: /**
037: * Description of the Class
038: *
039: *@author magicthize
040: *@created 26 May 2002
041: */
042: public class GlobalOptionsTab extends AbstractOptionsTab implements
043: ActionListener {
044: private JCheckBox checkoutReadOnly;
045: private JCheckBox doNoChanges;
046: private JCheckBox useGzip;
047: private JCheckBox noHistoryLogging;
048: private JCheckBox traceExecution;
049: private JCheckBox veryQuiet;
050: private JCheckBox moderatelyQuiet;
051:
052: /**
053: * Constructor for the GlobalOptionsTab object
054: */
055: public GlobalOptionsTab() {
056: super ("Global", UIUtil
057: .getCachedIcon(Constants.ICON_TOOL_GLOBAL));
058: }
059:
060: /**
061: * DOCUMENT ME!
062: *
063: * @param context DOCUMENT ME!
064: */
065: public void init(GruntspudContext context) {
066: super .init(context);
067: setTabToolTipText("Options that are common to most or all "
068: + "CVS commands.");
069: setTabLargeIcon(UIUtil
070: .getCachedIcon(Constants.ICON_TOOL_LARGE_GLOBAL));
071: setLayout(new GridBagLayout());
072: setTabMnemonic('a');
073: setTabContext("General");
074:
075: checkoutReadOnly = new JCheckBox("Checkout read only", context
076: .getHost().getBooleanProperty(
077: Constants.OPTIONS_GLOBAL_CHECKOUT_READ_ONLY));
078: doNoChanges = new JCheckBox("Do no changes", context.getHost()
079: .getBooleanProperty(
080: Constants.OPTIONS_GLOBAL_DO_NO_CHANGES));
081: useGzip = new JCheckBox("Compression", context.getHost()
082: .getBooleanProperty(Constants.OPTIONS_GLOBAL_USE_GZIP));
083: noHistoryLogging = new JCheckBox("No history logging", context
084: .getHost().getBooleanProperty(
085: Constants.OPTIONS_GLOBAL_NO_HISTORY_LOGGING));
086: traceExecution = new JCheckBox("Trace execution", context
087: .getHost().getBooleanProperty(
088: Constants.OPTIONS_GLOBAL_TRACE_EXECUTION));
089: moderatelyQuiet = new JCheckBox("Moderately quiet", context
090: .getHost().getBooleanProperty(
091: Constants.OPTIONS_GLOBAL_MODERATELY_QUIET));
092: veryQuiet = new JCheckBox("Very quiet",
093: context.getHost().getBooleanProperty(
094: Constants.OPTIONS_GLOBAL_VERY_QUIET));
095:
096: GridBagConstraints gbc = new GridBagConstraints();
097: gbc.insets = new Insets(3, 3, 3, 3);
098: gbc.anchor = GridBagConstraints.NORTHWEST;
099: gbc.fill = GridBagConstraints.HORIZONTAL;
100: gbc.weightx = 3.0;
101: UIUtil.jGridBagAdd(this , checkoutReadOnly, gbc,
102: GridBagConstraints.REMAINDER);
103: UIUtil.jGridBagAdd(this , doNoChanges, gbc,
104: GridBagConstraints.REMAINDER);
105: UIUtil.jGridBagAdd(this , useGzip, gbc,
106: GridBagConstraints.REMAINDER);
107: UIUtil.jGridBagAdd(this , noHistoryLogging, gbc,
108: GridBagConstraints.REMAINDER);
109: UIUtil.jGridBagAdd(this , traceExecution, gbc,
110: GridBagConstraints.REMAINDER);
111: UIUtil.jGridBagAdd(this , moderatelyQuiet, gbc,
112: GridBagConstraints.REMAINDER);
113: gbc.weighty = 1.0;
114: UIUtil.jGridBagAdd(this , veryQuiet, gbc,
115: GridBagConstraints.REMAINDER);
116: }
117:
118: /**
119: * DOCUMENT ME!
120: *
121: * @param evt DOCUMENT ME!
122: */
123: public void actionPerformed(ActionEvent evt) {
124: }
125:
126: /**
127: * Description of the Method
128: *
129: *@return Description of the Return Value
130: */
131: public boolean validateTab() {
132: return true;
133: }
134:
135: /**
136: * Description of the Method
137: */
138: public void tabSelected() {
139: }
140:
141: /**
142: * Description of the Method
143: */
144: public void applyTab() {
145: getContext().getHost().setBooleanProperty(
146: Constants.OPTIONS_GLOBAL_CHECKOUT_READ_ONLY,
147: checkoutReadOnly.isSelected());
148: getContext().getHost().setBooleanProperty(
149: Constants.OPTIONS_GLOBAL_DO_NO_CHANGES,
150: doNoChanges.isSelected());
151: getContext().getHost()
152: .setBooleanProperty(Constants.OPTIONS_GLOBAL_USE_GZIP,
153: useGzip.isSelected());
154: getContext().getHost().setBooleanProperty(
155: Constants.OPTIONS_GLOBAL_NO_HISTORY_LOGGING,
156: noHistoryLogging.isSelected());
157: getContext().getHost().setBooleanProperty(
158: Constants.OPTIONS_GLOBAL_TRACE_EXECUTION,
159: traceExecution.isSelected());
160: getContext().getHost().setBooleanProperty(
161: Constants.OPTIONS_GLOBAL_MODERATELY_QUIET,
162: moderatelyQuiet.isSelected());
163: getContext().getHost().setBooleanProperty(
164: Constants.OPTIONS_GLOBAL_VERY_QUIET,
165: veryQuiet.isSelected());
166: }
167: }
|