View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.plugin.openantivirus;
21  
22  import java.awt.GridBagLayout;
23  
24  import javax.swing.JCheckBox;
25  import javax.swing.JPanel;
26  
27  import org.xnap.XNap;
28  import org.xnap.gui.AbstractSettingsPanel;
29  import org.xnap.gui.util.GUIHelper;
30  import org.xnap.gui.util.GridBagHelper;
31  
32  public class OAVPreferencesPanel extends AbstractSettingsPanel {
33  
34      //--- Data Field(s) ----
35  
36      private OAVPreferences oavPrefs = OAVPlugin.getPreferences();
37  
38  	private JCheckBox jcbScanDownloadDirs;
39      private JCheckBox jcbScanFinishedTransfers;
40      
41      //--- Constructor(s) ---
42  
43      public OAVPreferencesPanel()
44      {
45  		setLayout(new GridBagLayout());
46  
47  		// startup
48  		JPanel jpStartup = new JPanel(new GridBagLayout());
49  		jpStartup.setBorder(GUIHelper.createDefaultBorder(XNap.tr("Startup")));
50  		GridBagHelper.add(this, jpStartup);
51  
52  		jcbScanDownloadDirs 
53  			= new JCheckBox(XNap.tr("Scan download directories", 1),
54  							oavPrefs.getScanDownloadDirs());
55  		GridBagHelper.add(jpStartup, jcbScanDownloadDirs);
56  
57  		// runtime
58  		JPanel jpRuntime = new JPanel(new GridBagLayout());
59  		jpRuntime.setBorder(GUIHelper.createDefaultBorder(XNap.tr("Runtime")));
60  		GridBagHelper.add(this, jpRuntime);
61  
62  		jcbScanFinishedTransfers 
63  			= new JCheckBox(XNap.tr("Scan download directories", 1),
64  							oavPrefs.getScanFinishedTransfers());
65  		GridBagHelper.add(jpRuntime, jcbScanFinishedTransfers);
66  
67  
68  		GridBagHelper.addVerticalSpacer(this);
69      }
70  
71      //--- Method(s) ---
72  
73      public void apply()
74  	{
75  		oavPrefs.setScanDownloadDirs(jcbScanDownloadDirs.isSelected());
76  		oavPrefs.setScanFinishedTransfers
77  			(jcbScanFinishedTransfers.isSelected());
78      }
79  
80  	public String getDescription()
81  	{
82  		return XNap.tr("Sets the scan properties.");
83  	}
84  
85      public String getTitle()
86      {
87  		return "OpenAntiVirus";
88      }
89  
90  
91  }