PageRenderTime 218ms CodeModel.GetById 208ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/jedit/options/FirewallOptionPane.java

#
Java | 102 lines | 59 code | 9 blank | 34 comment | 0 complexity | e76822f79d69e5fb738966ff443b1ff5 MD5 | raw file
  1/*
  2 * FirewallOptionPane.java - Firewall plugin options panel
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 1999 Dirk Moebius
  7 *
  8 * This program is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License
 10 * as published by the Free Software Foundation; either version 2
 11 * of the License, or any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 21 */
 22
 23package org.gjt.sp.jedit.options;
 24
 25 //{{{ Imports
 26import java.awt.*;
 27import java.awt.event.*;
 28import javax.swing.*;
 29import javax.swing.border.*;
 30import org.gjt.sp.jedit.*;
 31//}}}
 32
 33public class FirewallOptionPane extends AbstractOptionPane {
 34
 35	//{{{ FirewallOptionPane constructor
 36	public FirewallOptionPane()
 37	{
 38		super("firewall");
 39	} //}}}
 40
 41	//{{{ _init() method
 42	public void _init()
 43	{
 44		// checkbox "Enable firewall authentication"
 45		addComponent(cEnabled = new JCheckBox(jEdit.getProperty(
 46			"options.firewall.enabled")));
 47		// proxy host
 48		addComponent(jEdit.getProperty("options.firewall.host"), 
 49			tHost = new JTextField(jEdit.getProperty("firewall.host"), 15));
 50		// proxy port
 51		addComponent(jEdit.getProperty("options.firewall.port"), 
 52			tPort = new JTextField(jEdit.getProperty("firewall.port"), 15));
 53		// proxy username
 54		addComponent(jEdit.getProperty("options.firewall.user"),
 55			tUser = new JTextField(jEdit.getProperty("firewall.user"), 15));
 56		// proxy password
 57		addComponent(jEdit.getProperty("options.firewall.password"),
 58			tPass = new JPasswordField(jEdit.getProperty("firewall.password"), 15));
 59		// no proxy for
 60		addComponent(jEdit.getProperty("options.firewall.nonProxy"),
 61			tNonProxy = new JTextField(jEdit.getProperty("firewall.nonProxyHosts"), 15));
 62
 63		boolean enabled = jEdit.getBooleanProperty("firewall.enabled");
 64		cEnabled.setSelected(enabled);
 65		tHost.setEnabled(enabled);
 66		tPort.setEnabled(enabled);
 67		tUser.setEnabled(enabled);
 68		tPass.setEnabled(enabled);
 69		tNonProxy.setEnabled(enabled);
 70
 71		cEnabled.addActionListener(new ActionListener() {
 72			public void actionPerformed(ActionEvent e) {
 73				boolean enbld = cEnabled.isSelected();
 74				cEnabled.setSelected(enbld);
 75				tHost.setEnabled(enbld);
 76				tPort.setEnabled(enbld);
 77				tUser.setEnabled(enbld);
 78				tPass.setEnabled(enbld);
 79				tNonProxy.setEnabled(enbld);
 80			}
 81		});
 82	} //}}}
 83
 84	//{{{ _save() method
 85	public void _save() {
 86		jEdit.setBooleanProperty("firewall.enabled", cEnabled.isSelected());
 87		jEdit.setProperty("firewall.host", tHost.getText());			
 88		jEdit.setProperty("firewall.port", tPort.getText());
 89		jEdit.setProperty("firewall.user", tUser.getText());
 90		jEdit.setProperty("firewall.password", new String(tPass.getPassword()));
 91		jEdit.setProperty("firewall.nonProxyHosts", tNonProxy.getText());
 92	} //}}}
 93
 94	//{{{ Private members
 95	private JCheckBox cEnabled;
 96	private JTextField tHost;
 97	private JTextField tPort;
 98	private JTextField tUser;
 99	private JPasswordField tPass;
100	private JTextField tNonProxy;
101	//}}}
102}