1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin.jtella;
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.component.HostList;
30 import org.xnap.gui.util.GUIHelper;
31 import org.xnap.gui.util.GridBagHelper;
32
33 /***
34 * Provides the JTella preferences panel.
35 */
36 public class JTellaPreferencesPanel extends AbstractSettingsPanel {
37
38
39
40 private JTellaPreferences jtellaPrefs = JTellaPlugin.getPreferences();
41
42 private JCheckBox jcbAutoConnect;
43 private HostList hlHostCaches;
44
45
46
47 public JTellaPreferencesPanel()
48 {
49 setLayout(new GridBagLayout());
50
51 jcbAutoConnect
52 = new JCheckBox(XNap.tr("Connect To Network On Startup"),
53 jtellaPrefs.getAutoConnect());
54 GridBagHelper.add(this, jcbAutoConnect);
55
56 JPanel jpHostCaches = new JPanel(new GridBagLayout());
57 jpHostCaches.setBorder
58 (GUIHelper.createDefaultBorder(XNap.tr("Host Caches")));
59 GridBagHelper.add(this, jpHostCaches);
60
61 GridBagHelper.add(jpHostCaches,
62 XNap.tr("Ask these caches for hosts."));
63 hlHostCaches = new HostList(5, jtellaPrefs.getHostCaches());
64 GridBagHelper.add(jpHostCaches, hlHostCaches);
65
66 GridBagHelper.addVerticalSpacer(this);
67 }
68
69
70
71 public void apply()
72 {
73 jtellaPrefs.setAutoConnect(jcbAutoConnect.isSelected());
74 jtellaPrefs.setHostCaches(hlHostCaches.getStringItems());
75 }
76
77 public String getDescription()
78 {
79 return XNap.tr("JTella connection configuration.");
80 }
81
82 public String getTitle()
83 {
84 return JTellaPlugin.getInstance().getInfo().getName();
85 }
86
87 }
88
89
90