aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Su <[email protected]>2010-12-01 16:14:51 -0500
committerAndrew Su <[email protected]>2010-12-01 16:14:51 -0500
commitc62f2432becc8dc15fd00a5645df44b152078f02 (patch)
treed38ef94e05d69d392e39fb517e2270363eafbafb
parenta77dfee6288633aba7e9fa49b44354561c07f2ad (diff)
Add control panel (GUI) for modifying icedtea-web settings.
-rw-r--r--ChangeLog31
-rw-r--r--Makefile.am15
-rw-r--r--NEWS2
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/AboutPanel.java63
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsDialog.java148
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsPane.java345
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/ComboItem.java57
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java327
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java152
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java99
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/JREPanel.java47
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java46
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/NamedBorderPanel.java60
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java278
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java141
-rw-r--r--netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java233
-rw-r--r--netx/net/sourceforge/jnlp/resources/Messages.properties126
-rw-r--r--netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java19
18 files changed, 2178 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index c74c491..b37e8c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2010-12-01 Andrew Su <[email protected]>
+
+ * NEWS: Added controlpanel for modifying deployments.properties
+ * Makefile.am:
+ (CONTROLPANEL_LAUNCHER_OBJECTS): Objects used to compile binary
+ control panel.
+ (all-local): Add $(NETX_DIR)/launcher/controlpanel/itw-settings.
+ (install-exec-local): Install the control panel binary.
+ (uninstall-local): Removes the compiled control panel binary.
+ ($(NETX_DIR)/launcher/controlpanel/%.o): Create the launcher objects.
+ ($(NETX_DIR)/launcher/controlpanel/itw-settings): Link the objects to
+ make the launcher.
+ * netx/net/sourceforge/jnlp/controlpanel/AboutPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/ComboItem.java,
+ * netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/JREPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/NamedBorderPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java,
+ * netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java,
+ * netx/net/sourceforge/jnlp/controlpanel/network/AdvancedProxySettingsDialog.java,
+ * netx/net/sourceforge/jnlp/controlpanel/network/AdvancedProxySettingsPane.java,
+ * netx/net/sourceforge/jnlp/controlpanel/network/NetworkSettingsPanel.java,:
+ New classes. All methods are new as well.
+ * netx/net/sourceforge/jnlp/resources/Messages.properties: Added
+ messages used by control panel.
+ * netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java:
+ Changed to not display a close button if null parent frame.
+
2010-11-30 Andrew John Hughes <[email protected]>
* Makefile.am:
diff --git a/Makefile.am b/Makefile.am
index 95ab499..cf7f38f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,7 +29,7 @@ NETX_PKGS = javax.jnlp net.sourceforge.nanoxml net.sourceforge.jnlp \
net.sourceforge.jnlp.cache net.sourceforge.jnlp.event \
net.sourceforge.jnlp.security net.sourceforge.jnlp.security.viewer \
net.sourceforge.jnlp.services net.sourceforge.jnlp.tools \
- net.sourceforge.jnlp.util
+ net.sourceforge.jnlp.util net.sourceforge.jnlp.controlpanel
# Conditional defintions
if ENABLE_PLUGIN
@@ -74,6 +74,7 @@ LAUNCHER_SRCDIR = $(abs_top_srcdir)/launcher
LAUNCHER_OBJECTS = java.o java_md.o splashscreen_stubs.o
PLUGIN_LAUNCHER_OBJECTS = $(addprefix $(PLUGIN_DIR)/launcher/,$(LAUNCHER_OBJECTS))
NETX_LAUNCHER_OBJECTS = $(addprefix $(NETX_DIR)/launcher/,$(LAUNCHER_OBJECTS))
+CONTROLPANEL_LAUNCHER_OBJECTS = $(addprefix $(NETX_DIR)/launcher/controlpanel/,$(LAUNCHER_OBJECTS))
LAUNCHER_FLAGS = -O2 -fno-strict-aliasing -fPIC -pthread -W -Wall -Wno-unused -Wno-parentheses -pipe -fno-omit-frame-pointer \
-g -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT -DLAUNCHER_NAME='"java"' -I$(LAUNCHER_SRCDIR) \
-DJDK_MAJOR_VERSION='"1"' -DJDK_MINOR_VERSION='"6"' -DLIBARCHNAME='"$(JRE_ARCH_DIR)"'
@@ -89,7 +90,7 @@ EXTRA_DIST = $(top_srcdir)/netx $(top_srcdir)/plugin javaws.png javaws.desktop.i
# =================
all-local: stamps/netx-dist.stamp extra-lib/about.jar stamps/plugin.stamp $(NETX_DIR)/launcher/javaws \
- javaws.desktop stamps/docs.stamp
+ javaws.desktop stamps/docs.stamp $(NETX_DIR)/launcher/controlpanel/itweb-settings
clean-local: clean-netx clean-plugin clean-liveconnect clean-extra clean-bootstrap-directory \
clean-native-ecj clean-desktop-files clean-docs
@@ -110,6 +111,7 @@ endif
${INSTALL_DATA} $(NETX_DIR)/lib/classes.jar $(DESTDIR)$(prefix)/jre/lib/netx.jar
${INSTALL_PROGRAM} $(NETX_DIR)/launcher/javaws $(DESTDIR)$(bindir)
${INSTALL_DATA} extra-lib/about.jar $(DESTDIR)$(prefix)/jre/lib
+ ${INSTALL_PROGRAM} $(NETX_DIR)/launcher/controlpanel/itweb-settings $(DESTDIR)$(bindir)
install-data-local:
${mkinstalldirs} -d $(DESTDIR)$(prefix)/man/man1
@@ -140,6 +142,7 @@ uninstall-local:
rm -f $(DESTDIR)$(prefix)/man/man1/javaws.1
rm -f $(DESTDIR)$(bindir)/pluginappletviewer
rm -f $(DESTDIR)$(bindir)/javaws
+ rm -f $(DESTDIR)$(bindir)/itweb-settings
rm -rf $(DESTDIR)$(htmldir)
# Plugin
@@ -322,9 +325,17 @@ $(NETX_DIR)/launcher/%.o: $(LAUNCHER_SRCDIR)/%.c
$(CC) $(LAUNCHER_FLAGS) -DJAVA_ARGS='{ "-J-ms8m", "net.sourceforge.jnlp.runtime.Boot", }' -DPROGNAME='"javaws"' \
-c -o $@ $<
+$(NETX_DIR)/launcher/controlpanel/%.o: $(LAUNCHER_SRCDIR)/%.c
+ mkdir -p $(NETX_DIR)/launcher/controlpanel && \
+ $(CC) $(LAUNCHER_FLAGS) -DJAVA_ARGS='{ "-J-ms8m", "net.sourceforge.jnlp.controlpanel.ControlPanel", }' \
+ -DPROGNAME='"itweb-settings"' -c -o $@ $<
+
$(NETX_DIR)/launcher/javaws: $(NETX_LAUNCHER_OBJECTS)
$(CC) $(NETX_LAUNCHER_OBJECTS) $(LAUNCHER_LINK)
+$(NETX_DIR)/launcher/controlpanel/itweb-settings: $(CONTROLPANEL_LAUNCHER_OBJECTS)
+ $(CC) $(CONTROLPANEL_LAUNCHER_OBJECTS) $(LAUNCHER_LINK)
+
javaws.desktop: javaws.desktop.in
sed "s#PATH_TO_JAVAWS#$(DESTDIR)$(bindir)/javaws#" < $(srcdir)/javaws.desktop.in > javaws.desktop
diff --git a/NEWS b/NEWS
index 8583d20..ba7e4f6 100644
--- a/NEWS
+++ b/NEWS
@@ -26,3 +26,5 @@ New in release 1.0 (2010-XX-XX):
- Add a new option -Xclearcache
- Interfaces javax.jnlp.IntegrationService and javax.jnlp.DownloadService2 are now available
- PR592: NetX can create invalid desktop entry files
+* Control Panel
+ - Modifications to deployments.properties file can now be done through a GUI
diff --git a/netx/net/sourceforge/jnlp/controlpanel/AboutPanel.java b/netx/net/sourceforge/jnlp/controlpanel/AboutPanel.java
new file mode 100644
index 0000000..126923d
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/AboutPanel.java
@@ -0,0 +1,63 @@
+/* AboutPanel.java -- Display information about the control panel and icedtea-web.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.Box;
+import javax.swing.JLabel;
+
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This class provides a GUI interface which shows some basic information on
+ * this project.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class AboutPanel extends NamedBorderPanel {
+
+ public AboutPanel() {
+ super(Translator.R("CPHeadAbout"), new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ JLabel logo = new JLabel();
+ JLabel aboutLabel = new JLabel("<html>" + Translator.R("CPAboutInfo") + "</html>");
+
+ c.fill = GridBagConstraints.BOTH;
+ c.gridy = 0;
+ c.gridx = 0;
+ c.weighty = 0;
+ c.weightx = 0;
+ add(logo, c);
+ c.gridx = 1;
+ c.weightx = 1;
+ add(aboutLabel, c);
+
+ /* Keep all the elements at the top of the panel (Extra padding) */
+ Component filler = Box.createRigidArea(new Dimension(1, 1));
+ c.weighty = 1;
+ c.gridy++;
+ add(filler, c);
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsDialog.java b/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsDialog.java
new file mode 100644
index 0000000..2334947
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsDialog.java
@@ -0,0 +1,148 @@
+/* AdvancedProxySettingsDialog.java -- Display the dialog for modifying proxy settings.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Toolkit;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JDialog;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This dialog provides a means for user to edit more of the proxy settings.
+ *
+ * @author Andrew Su <[email protected], [email protected]>
+ *
+ */
+public class AdvancedProxySettingsDialog extends JDialog {
+
+ private boolean initialized = false;
+ private static final String dialogTitle = Translator.R("APSDialogTitle");
+ private DeploymentConfiguration config; // Configuration file which contains all the settings.
+
+ AdvancedProxySettingsPane topPanel;
+
+ /**
+ * Creates a new instance of the proxy settings dialog.
+ *
+ * @param config
+ * Loaded DeploymentConfiguration file.
+ */
+ public AdvancedProxySettingsDialog(DeploymentConfiguration config) {
+ super((Frame) null, dialogTitle, true); // Don't need a parent.
+ this.config = config;
+
+ /* Prepare for adding components to dialog box */
+ Container contentPane = getContentPane();
+ contentPane.setLayout(new GridBagLayout());
+ setMinimumSize(new Dimension(456, 404));
+ setPreferredSize(new Dimension(456, 404));
+
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ c.weighty = 1;
+ c.gridx = 0;
+ c.gridy = 0;
+ topPanel = new AdvancedProxySettingsPane(this, this.config);
+ contentPane.add(topPanel, c);
+
+ pack();
+
+ /* Set focus to default button when first activated */
+ WindowAdapter adapter = new WindowAdapter() {
+ private boolean gotFocus = false;
+
+ public void windowGainedFocus(WindowEvent we) {
+ // Once window gets focus, set initial focus
+ if (!gotFocus) {
+ topPanel.focusOnDefaultButton();
+ gotFocus = true;
+ }
+ }
+ };
+ addWindowFocusListener(adapter);
+
+ initialized = true;
+ }
+
+ /**
+ * Check whether the dialog has finished being created.
+ *
+ * @return True if dialog is ready to be displayed.
+ */
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ /**
+ * Center the dialog box.
+ */
+ private void centerDialog() {
+ Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension dialogSize = getSize();
+
+ setLocation((screen.width - dialogSize.width) / 2, (screen.height - dialogSize.height) / 2);
+ }
+
+ /**
+ * Display the Proxy Settings Dialog.
+ *
+ * @param config
+ * A loaded DeploymentConfiguration file.
+ * @throws Exception
+ */
+ public static void showAdvancedProxySettingsDialog(final DeploymentConfiguration config) throws Exception {
+ setSystemLookAndFeel();
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ AdvancedProxySettingsDialog psd = new AdvancedProxySettingsDialog(config);
+ psd.setResizable(false);
+ psd.centerDialog();
+ psd.setVisible(true);
+ psd.dispose();
+ }
+ });
+
+
+
+ }
+
+ /**
+ * Set the look and feel.
+ */
+ private static void setSystemLookAndFeel() {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception e) {
+ // don't worry if we can't.
+ }
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsPane.java b/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsPane.java
new file mode 100644
index 0000000..adeb32e
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/AdvancedProxySettingsPane.java
@@ -0,0 +1,345 @@
+/* AdvancedProxySettingsPane.java -- Provides the panel which can modify proxy settings.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This is the pane that modifies the proxy settings in more detail.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class AdvancedProxySettingsPane extends JPanel {
+
+ private JDialog parent;
+ private DeploymentConfiguration config;
+
+ /** List of properties used by this panel */
+ public static String[] properties = { "deployment.proxy.http.host",
+ "deployment.proxy.http.port",
+ "deployment.proxy.https.host",
+ "deployment.proxy.https.port",
+ "deployment.proxy.ftp.host",
+ "deployment.proxy.ftp.port",
+ "deployment.proxy.socks.host",
+ "deployment.proxy.socks.port",
+ "deployment.proxy.same",
+ "deployment.proxy.override.hosts" };
+ private String[] fields = new String[properties.length];
+
+ private JComponent defaultFocusComponent = null;
+
+ /**
+ * Creates a new instance of the proxy settings panel.
+ *
+ * @param parent
+ * JDialog this is associated with.
+ * @param config
+ * Loaded DeploymentConfiguration file.
+ */
+ public AdvancedProxySettingsPane(JDialog parent, DeploymentConfiguration config) {
+ super(new BorderLayout());
+ this.parent = parent;
+ this.config = config;
+
+ getProperties();
+ addComponents();
+ }
+
+ /**
+ * Place properties into an array, this is so when cancel is hit. We don't
+ * overwrite the original values.
+ */
+ private void getProperties() {
+ for (int i = 0; i < fields.length; i++) {
+ fields[i] = this.config.getProperty(properties[i]);
+ }
+ }
+
+ /**
+ * Add the components to the panel. FIXME: We should probably refactor the
+ * listeners and do them in a more generic way. Also can change this from
+ * using textfield to using a table.
+ */
+ private void addComponents() {
+ JPanel topPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ JPanel servers = new NamedBorderPanel(Translator.R("APSServersPanel"));
+ servers.setLayout(new GridBagLayout());
+
+ JLabel type = new JLabel(Translator.R("APSProxyTypeLabel"));
+ JLabel proxyAddress = new JLabel(Translator.R("APSProxyAddressLabel"));
+ JLabel port = new JLabel(Translator.R("APSProxyPortLabel"));
+
+ // This addresses the HTTP proxy settings.
+ JLabel http = new JLabel(Translator.R("APSLabelHTTP") + ":");
+ final JTextField httpAddressField = new JTextField(fields[0]);
+ final JTextField httpPortField = new JTextField(fields[1]);
+ httpAddressField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[0] = httpAddressField.getText();
+ }
+ });
+ httpPortField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[1] = httpPortField.getText();
+ }
+ });
+ httpAddressField.addMouseListener(new MiddleClickListener(this.config, properties[0]));
+ httpPortField.addMouseListener(new MiddleClickListener(this.config, properties[1]));
+
+ // This addresses the HTTPS proxy settings.
+ JLabel secure = new JLabel(Translator.R("APSLabelSecure") + ":");
+ final JTextField secureAddressField = new JTextField(fields[2]);
+ final JTextField securePortField = new JTextField(fields[3]);
+ secureAddressField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[2] = secureAddressField.getText();
+ }
+ });
+ securePortField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[3] = securePortField.getText();
+ }
+ });
+ secureAddressField.addMouseListener(new MiddleClickListener(this.config, properties[2]));
+ securePortField.addMouseListener(new MiddleClickListener(this.config, properties[3]));
+
+ // This addresses the FTP proxy settings.
+ JLabel ftp = new JLabel(Translator.R("APSLabelFTP") + ":");
+ final JTextField ftpAddressField = new JTextField(fields[4]);
+ final JTextField ftpPortField = new JTextField(fields[5]);
+ ftpAddressField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[4] = ftpAddressField.getText();
+ }
+ });
+ ftpPortField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[5] = ftpPortField.getText();
+ }
+ });
+ ftpAddressField.addMouseListener(new MiddleClickListener(this.config, properties[4]));
+ ftpPortField.addMouseListener(new MiddleClickListener(this.config, properties[5]));
+
+ // This addresses the Socks proxy settings.
+ JLabel socks = new JLabel(Translator.R("APSLabelSocks") + ":");
+ final JTextField socksAddressField = new JTextField(fields[6]);
+ final JTextField socksPortField = new JTextField(fields[7]);
+ socksAddressField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[6] = socksAddressField.getText();
+ }
+ });
+ socksPortField.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[7] = socksPortField.getText();
+ }
+ });
+ socksAddressField.addMouseListener(new MiddleClickListener(this.config, properties[6]));
+ socksPortField.addMouseListener(new MiddleClickListener(this.config, properties[7]));
+
+ JCheckBox sameProxyForAll = new JCheckBox(Translator.R("APSSameProxyForAllProtocols"), Boolean.parseBoolean(fields[8]));
+ sameProxyForAll.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ fields[8] = String.valueOf(e.getStateChange() == ItemEvent.SELECTED);
+ }
+ });
+
+ JPanel p = new JPanel();
+ BoxLayout bl = new BoxLayout(p, BoxLayout.Y_AXIS);
+ p.setLayout(bl);
+ p.add(sameProxyForAll);
+
+ c.fill = GridBagConstraints.BOTH;
+ c.gridheight = 1;
+ c.gridy = 0;
+ c.gridwidth = 1;
+ c.weightx = 0;
+ c.gridx = 0;
+ servers.add(type, c);
+ c.gridwidth = 2;
+ c.weightx = 1;
+ c.gridx = 1;
+ servers.add(proxyAddress, c);
+ c.gridwidth = 1;
+ c.weightx = 1;
+ c.gridx = 4;
+ servers.add(port, c);
+
+ plant(1, http, httpAddressField, httpPortField, servers, c);
+ plant(2, secure, secureAddressField, securePortField, servers, c);
+ plant(3, ftp, ftpAddressField, ftpPortField, servers, c);
+ plant(4, socks, socksAddressField, socksPortField, servers, c);
+ c.gridwidth = 5;
+ c.gridx = 0;
+ c.gridy = 5;
+ servers.add(p, c);
+
+ JPanel exceptions = new NamedBorderPanel(Translator.R("APSExceptionsLabel"));
+ exceptions.setLayout(new BorderLayout());
+ JLabel exceptionDescription = new JLabel(Translator.R("APSExceptionsDescription"));
+ final JTextArea exceptionListArea = new JTextArea();
+ exceptionListArea.setLineWrap(true);
+ exceptionListArea.setText(fields[9]);
+ exceptionListArea.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ fields[9] = exceptionListArea.getText();
+ }
+ });
+ exceptionListArea.addMouseListener(new MiddleClickListener(this.config, fields[9]));
+ JLabel exceptionFormat = new JLabel(Translator.R("APSExceptionInstruction"));
+ JScrollPane exceptionScroll = new JScrollPane(exceptionListArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ exceptions.add(exceptionDescription, BorderLayout.NORTH);
+ exceptions.add(exceptionScroll, BorderLayout.CENTER);
+ exceptions.add(exceptionFormat, BorderLayout.SOUTH);
+
+ c.gridx = 0;
+ c.weightx = 1;
+ c.weighty = 0;
+ c.gridy = 0;
+ topPanel.add(servers, c);
+ c.weighty = 1;
+ c.gridy = 1;
+ topPanel.add(exceptions, c);
+
+ this.add(topPanel);
+ this.add(createButtonPanel(), BorderLayout.SOUTH);
+
+ }
+
+ /**
+ * Helper method to help make adding component shorter.
+ */
+ private void plant(int y, JLabel label, JTextField addr, JTextField port, JPanel addTo, GridBagConstraints c) {
+ c.gridy = y;
+
+ c.gridwidth = 1;
+ c.weightx = 0;
+ c.gridx = 0;
+ addTo.add(label, c);
+ c.gridwidth = 2;
+ c.weightx = 1;
+ c.gridx = 1;
+ addTo.add(addr, c);
+ c.gridwidth = 1;
+ c.weightx = 0;
+ c.gridx = 3;
+ addTo.add(new JLabel(":"), c);
+ c.gridwidth = 1;
+ c.weightx = 0.3;
+ c.gridx = 4;
+ addTo.add(port, c);
+ }
+
+ /**
+ * Make the button panel.
+ *
+ * @return
+ */
+ private JPanel createButtonPanel() {
+ JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
+
+ List<JButton> buttons = new ArrayList<JButton>();
+
+ JButton okButton = new JButton(Translator.R("ButOk"));
+ okButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ for (int i = 0; i < fields.length; i++)
+ config.setProperty(properties[i], fields[i]);
+
+ parent.dispose();
+ }
+ });
+ buttons.add(okButton);
+
+ JButton cancelButton = new JButton(Translator.R("ButCancel"));
+ cancelButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ parent.dispose();
+ }
+ });
+ buttons.add(cancelButton);
+
+ int maxWidth = 0;
+ int maxHeight = 0;
+ for (JButton button : buttons) {
+ maxWidth = Math.max(button.getMinimumSize().width, maxWidth);
+ maxHeight = Math.max(button.getMinimumSize().height, maxHeight);
+ }
+
+ int wantedWidth = maxWidth + 10;
+ int wantedHeight = maxHeight;
+ for (JButton button : buttons) {
+ button.setPreferredSize(new Dimension(wantedWidth, wantedHeight));
+ buttonPanel.add(button);
+ }
+
+ return buttonPanel;
+ }
+
+ /**
+ * Put focus onto default button.
+ */
+ public void focusOnDefaultButton() {
+ if (defaultFocusComponent != null) {
+ defaultFocusComponent.requestFocusInWindow();
+ }
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/ComboItem.java b/netx/net/sourceforge/jnlp/controlpanel/ComboItem.java
new file mode 100644
index 0000000..080f364
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/ComboItem.java
@@ -0,0 +1,57 @@
+/* ComboItem.java -- Allow storage of an item whose name differs from its value.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+/**
+ * This is to be used with combobox items. Allows storing a value which differs
+ * from the key.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class ComboItem {
+ String text = null;
+ private String value; // Value to be compared with.
+
+ /**
+ * Create a new instance of combobox items.
+ *
+ * @param text
+ * Text to be displayed by JComboBox
+ * @param value
+ * Value associated with this item.
+ */
+ public ComboItem(String text, String value) {
+ this.text = text;
+ this.value = value;
+ }
+
+ public String toString() {
+ return this.text;
+ }
+
+ /**
+ * Get the value associated with this item.
+ *
+ * @return Associated value.
+ */
+ public String getValue() {
+ return this.value;
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
new file mode 100644
index 0000000..27812a9
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java
@@ -0,0 +1,327 @@
+/* ControlPanel.java -- Display the control panel for modifying deployment settings.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+import javax.naming.ConfigurationException;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.runtime.Translator;
+import net.sourceforge.jnlp.security.viewer.CertificatePane;
+
+/**
+ * This is the control panel for Java. It provides a GUI for modifying the
+ * deployments.properties file.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class ControlPanel extends JFrame {
+
+ /**
+ * Class for keeping track of the panels and their associated text.
+ *
+ * @author @author Andrew Su ([email protected], [email protected])
+ *
+ */
+ private class SettingsPanel {
+ final String value;
+ final JPanel panel;
+
+ public SettingsPanel(String value, JPanel panel) {
+ this.value = value;
+ this.panel = panel;
+ }
+
+ public JPanel getPanel() {
+ return panel;
+ }
+
+ public String toString() {
+ return value;
+ }
+ }
+
+ private DeploymentConfiguration config = null;
+
+ /*
+ * actual configuration options
+ */
+ private String configBrowserCommand = null;
+
+ /**
+ * Creates a new instance of the ControlPanel.
+ *
+ * @param config
+ * Loaded DeploymentsConfiguration file.
+ *
+ */
+ public ControlPanel(DeploymentConfiguration config) {
+ super();
+ setTitle(Translator.R("CPHead"));
+
+ this.config = config;
+
+ JPanel mainPanel = createMainSettingsPanel();
+ JPanel buttonPanel = createButtonPanel();
+
+ add(mainPanel, BorderLayout.CENTER);
+ add(buttonPanel, BorderLayout.SOUTH);
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ pack();
+ setMinimumSize(getPreferredSize());
+ setResizable(false);
+ }
+
+ /**
+ * Creates the "ok" "apply" and "cancel" buttons.
+ *
+ * @return A panel with the "ok" "apply" and "cancel" button.
+ */
+ private JPanel createButtonPanel() {
+ JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
+
+ List<JButton> buttons = new ArrayList<JButton>();
+
+ JButton okButton = new JButton(Translator.R("ButOk"));
+ okButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ControlPanel.this.saveConfiguration();
+ ControlPanel.this.dispose();
+ }
+ });
+ buttons.add(okButton);
+
+ JButton applyButton = new JButton(Translator.R("ButApply"));
+ applyButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ControlPanel.this.saveConfiguration();
+ }
+ });
+ buttons.add(applyButton);
+
+ JButton cancelButton = new JButton(Translator.R("ButCancel"));
+ cancelButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ ControlPanel.this.dispose();
+ }
+ });
+ buttons.add(cancelButton);
+
+ int maxWidth = 0;
+ int maxHeight = 0;
+ for (JButton button : buttons) {
+ maxWidth = Math.max(button.getMinimumSize().width, maxWidth);
+ maxHeight = Math.max(button.getMinimumSize().height, maxHeight);
+ }
+
+ int wantedWidth = maxWidth + 10;
+ int wantedHeight = maxHeight + 2;
+ for (JButton button : buttons) {
+ button.setPreferredSize(new Dimension(wantedWidth, wantedHeight));
+ buttonPanel.add(button);
+ }
+
+ return buttonPanel;
+ }
+
+ /**
+ * Add the different settings panels to the GUI.
+ *
+ * @return A panel with all the components in place.
+ */
+ private JPanel createMainSettingsPanel() {
+
+ loadConfiguration();
+
+ SettingsPanel[] panels = new SettingsPanel[] { new SettingsPanel(Translator.R("CPTabAbout"), createAboutPanel()),
+ new SettingsPanel(Translator.R("CPTabCache"), createCacheSettingsPanel()),
+ new SettingsPanel(Translator.R("CPTabCertificate"), createCertificatesSettingsPanel()),
+// new SettingsPanel(Translator.R("CPTabClassLoader"), createClassLoaderSettingsPanel()),
+ new SettingsPanel(Translator.R("CPTabDebugging"), createDebugSettingsPanel()),
+ new SettingsPanel(Translator.R("CPTabDesktopIntegration"), createDesktopSettingsPanel()),
+ new SettingsPanel(Translator.R("CPTabNetwork"), createNetworkSettingsPanel()),
+ new SettingsPanel(Translator.R("CPTabRuntimes"), createRuntimesSettingsPanel()),
+ new SettingsPanel(Translator.R("CPTabSecurity"), createSecuritySettingsPanel()), };
+
+ // Add panels.
+ final JPanel settingsPanel = new JPanel(new CardLayout());
+ for (SettingsPanel panel : panels) {
+ JPanel p = panel.getPanel();
+ p.setPreferredSize(new Dimension(530, 360));
+ settingsPanel.add(p, panel.toString());
+ }
+
+ final JList settingsList = new JList(panels);
+ settingsList.addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ JList list = (JList) e.getSource();
+ SettingsPanel panel = (SettingsPanel) list.getSelectedValue();
+ CardLayout cl = (CardLayout) settingsPanel.getLayout();
+ cl.show(settingsPanel, panel.toString());
+ }
+ });
+ JScrollPane settingsListScrollPane = new JScrollPane(settingsList);
+ settingsListScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
+ final JPanel settingsDetailPanel = new JPanel();
+ settingsDetailPanel.setLayout(new BorderLayout());
+ settingsDetailPanel.add(settingsPanel, BorderLayout.CENTER);
+ settingsDetailPanel.setBorder(new EmptyBorder(0, 5, -3, 0));
+
+ JPanel mainPanel = new JPanel(new BorderLayout());
+ mainPanel.add(settingsListScrollPane, BorderLayout.LINE_START);
+ mainPanel.add(settingsDetailPanel, BorderLayout.CENTER);
+ mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+ settingsList.setSelectedIndex(0);
+
+ return mainPanel;
+ }
+
+ private JPanel createAboutPanel() {
+ return new AboutPanel();
+ }
+
+ private JPanel createCacheSettingsPanel() {
+ return new TemporaryInternetFilesPanel(this.config);
+ }
+
+ private JPanel createCertificatesSettingsPanel() {
+ JPanel p = new NamedBorderPanel(Translator.R("CPHeadCertificates"), new BorderLayout());
+ p.add(new CertificatePane(null), BorderLayout.CENTER);
+ return p;
+ }
+
+ private JPanel createClassLoaderSettingsPanel() {
+ return createNotImplementedPanel();
+ }
+
+ private JPanel createDebugSettingsPanel() {
+ return new DebuggingPanel(this.config);
+ }
+
+ private JPanel createDesktopSettingsPanel() {
+ return new DesktopShortcutPanel(this.config);
+ }
+
+ private JPanel createNetworkSettingsPanel() {
+ return new NetworkSettingsPanel(this.config);
+ }
+
+ private JPanel createRuntimesSettingsPanel() {
+ return new JREPanel();
+ }
+
+ private JPanel createSecuritySettingsPanel() {
+ return new SecuritySettingsPanel(this.config);
+ }
+
+ /**
+ * This is a placeholder panel.
+ *
+ * @return
+ */
+ private JPanel createNotImplementedPanel() {
+
+ JPanel notImplementedPanel = new NamedBorderPanel("Unimplemented");
+ notImplementedPanel.setLayout(new BorderLayout());
+
+ URL imgUrl = getClass().getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png");
+ Image img;
+ try {
+ img = ImageIO.read(imgUrl);
+ ImageIcon icon = new ImageIcon(img);
+ JLabel label = new JLabel("Not Implemented", icon, SwingConstants.CENTER);
+ notImplementedPanel.add(label);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return notImplementedPanel;
+ }
+
+ /**
+ * Get the location of the browser.
+ */
+ private void loadConfiguration() {
+ configBrowserCommand = config.getProperty("deployment.browser.path");
+ if (configBrowserCommand == null) {
+ configBrowserCommand = "";
+ }
+ }
+
+ /**
+ * Save the configuration changes.
+ */
+ private void saveConfiguration() {
+ try {
+ config.save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ JNLPRuntime.initialize(true);
+ final DeploymentConfiguration config = JNLPRuntime.getConfiguration();
+ try {
+ config.load();
+ } catch (ConfigurationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ final ControlPanel editor = new ControlPanel(config);
+ editor.setVisible(true);
+ }
+ });
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java b/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java
new file mode 100644
index 0000000..0693357
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/DebuggingPanel.java
@@ -0,0 +1,152 @@
+/* DebuggingPanel.java -- Displays and sets options for debugging.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+import javax.swing.Box;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This displays the options related to debugging.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class DebuggingPanel extends NamedBorderPanel implements ItemListener {
+
+ /** List of properties used by this panel */
+ public static String[] properties = { "deployment.trace", // Debugging
+ "deployment.log", // Debugging
+ "deployment.javapi.lifecycle.exception", // Debugging
+ "deployment.console.startup.mode", // Java Console
+ };
+ private DeploymentConfiguration config;
+
+ /**
+ * Create a new instance of the debugging panel.
+ *
+ * @param config
+ * loaded DeploymentConfiguration file.
+ */
+ public DebuggingPanel(DeploymentConfiguration config) {
+ super(Translator.R("CPHeadDebugging"), new GridBagLayout());
+
+ this.config = config;
+
+ addComponents();
+ }
+
+ /**
+ * Add components to panel.
+ */
+ private void addComponents() {
+ GridBagConstraints c = new GridBagConstraints();
+
+ JLabel debuggingDescription = new JLabel("<html>" + Translator.R("CPDebuggingDescription") + "<hr /><br /></html>");
+
+ JCheckBox[] debuggingOptions = { new JCheckBox(Translator.R("DPEnableTracing")),
+ new JCheckBox(Translator.R("DPEnableLogging")),
+ new JCheckBox(Translator.R("DPLifeCycleExceptions")) };
+
+ ComboItem[] javaConsoleItems = { new ComboItem(Translator.R("DPDisable"), "DISABLE"),
+ new ComboItem(Translator.R("DPHide"), "HIDE"),
+ new ComboItem(Translator.R("DPShow"), "SHOW"), };
+
+ JLabel consoleLabel = new JLabel(Translator.R("DPJavaConsole"));
+ JComboBox consoleComboBox = new JComboBox();
+ consoleComboBox.setActionCommand("deployment.console.startup.mode"); // The property this comboBox affects.
+
+ JPanel consolePanel = new JPanel();
+ consolePanel.setLayout(new FlowLayout(FlowLayout.LEADING));
+ consolePanel.add(consoleLabel);
+ consolePanel.add(consoleComboBox);
+
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ c.gridx = 0;
+ c.gridy = 0;
+ add(debuggingDescription, c);
+
+ /*
+ * Add the items to the panel unless we can not get the values for them.
+ */
+ for (int i = 0; i < properties.length; i++) {
+ try {
+ String s = config.getProperty(properties[i]);
+ c.gridy = i + 1;
+
+ switch (i) {
+ case 0:
+ case 1:
+ case 2:
+ debuggingOptions[i].setSelected(Boolean.parseBoolean(s));
+ debuggingOptions[i].setActionCommand(properties[i]);
+ debuggingOptions[i].addItemListener(this);
+ add(debuggingOptions[i], c);
+ break;
+ case 3:
+ for (int j = 0; j < javaConsoleItems.length; j++) {
+ consoleComboBox.addItem(javaConsoleItems[j]);
+ if (config.getProperty("deployment.console.startup.mode").equals(javaConsoleItems[j].getValue())) consoleComboBox.setSelectedIndex(j);
+ }
+ consoleComboBox.addItemListener(this);
+ add(consolePanel, c);
+ }
+
+ } catch (Exception e) {
+ debuggingOptions[i] = null;
+ }
+ }
+
+ // pack the bottom so that it doesn't change size if resized.
+ Component filler = Box.createRigidArea(new Dimension(1, 1));
+ c.gridy++;
+ c.weighty = 1;
+ add(filler, c);
+ }
+
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+
+ Object o = e.getSource();
+
+ if (o instanceof JCheckBox) {
+ JCheckBox jcb = (JCheckBox) o;
+ config.setProperty(jcb.getActionCommand(), String.valueOf(jcb.isSelected()));
+ } else if (o instanceof JComboBox) {
+ JComboBox jcb = (JComboBox) o;
+ ComboItem c = (ComboItem) e.getItem();
+ config.setProperty(jcb.getActionCommand(), c.getValue());
+ }
+
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java b/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java
new file mode 100644
index 0000000..3d13c62
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/DesktopShortcutPanel.java
@@ -0,0 +1,99 @@
+/* DesktopShortcutPanel.java -- Display option for adding desktop shortcut.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+import javax.swing.Box;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This class provides the panel that allows the user to set whether they want
+ * to create a desktop shortcut for javaws.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class DesktopShortcutPanel extends NamedBorderPanel implements ItemListener {
+
+ private DeploymentConfiguration config;
+
+ /**
+ * Create a new instance of the desktop shortcut settings panel.
+ *
+ * @param config
+ * Loaded DeploymentConfiguration file.
+ */
+ public DesktopShortcutPanel(DeploymentConfiguration config) {
+ super(Translator.R("CPHeadDesktopIntegration"), new GridBagLayout());
+ this.config = config;
+
+ addComponents();
+ }
+
+ /**
+ * Add components to panel.
+ */
+ private void addComponents() {
+ GridBagConstraints c = new GridBagConstraints();
+ JLabel description = new JLabel("<html>" + Translator.R("CPDesktopIntegrationDescription") + "<hr /></html>");
+ JComboBox shortcutComboOptions = new JComboBox();
+ ComboItem[] items = { new ComboItem(Translator.R("DSPNeverCreate"), "NEVER"),
+ new ComboItem(Translator.R("DSPAlwaysAllow"), "ALWAYS"),
+ new ComboItem(Translator.R("DSPAskUser"), "ASK_USER"),
+ new ComboItem(Translator.R("DSPAskIfHinted"), "ASK_IF_HINTED"),
+ new ComboItem(Translator.R("DSPAlwaysIfHinted"), "ALWAYS_IF_HINTED") };
+
+ shortcutComboOptions.setActionCommand("deployment.javaws.shortcut"); // The configuration property this combobox affects.
+ for (int j = 0; j < items.length; j++) {
+ shortcutComboOptions.addItem(items[j]);
+ if (config.getProperty("deployment.javaws.shortcut").equals(items[j].getValue())) shortcutComboOptions.setSelectedIndex(j);
+ }
+
+ shortcutComboOptions.addItemListener(this);
+
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ c.gridx = 0;
+ c.gridy = 0;
+ add(description, c);
+ c.gridy = 1;
+ add(shortcutComboOptions, c);
+
+ // This is to keep it from expanding vertically if resized.
+ Component filler = Box.createRigidArea(new Dimension(1, 1));
+ c.gridy++;
+ c.weighty = 1;
+ add(filler, c);
+ }
+
+ public void itemStateChanged(ItemEvent e) {
+ ComboItem c = (ComboItem) e.getItem();
+ config.setProperty(((JComboBox) e.getSource()).getActionCommand(), c.getValue());
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/JREPanel.java b/netx/net/sourceforge/jnlp/controlpanel/JREPanel.java
new file mode 100644
index 0000000..b146695
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/JREPanel.java
@@ -0,0 +1,47 @@
+/* JREPanel.java - Displays option for changing to another Java Runtime.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JLabel;
+
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This panel is to allow access to setting the JRE but we currently do not
+ * support this.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class JREPanel extends NamedBorderPanel {
+
+ /**
+ * Creates a new instance of the JRE settings panel. (Currently not
+ * supported).
+ */
+ public JREPanel() {
+ super(Translator.R("CPHeadJRESettings"));
+ setLayout(new BorderLayout());
+
+ JLabel jreLabel = new JLabel("<html>" + Translator.R("CPJRESupport") + "</html>");
+ add(jreLabel, BorderLayout.NORTH);
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java b/netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java
new file mode 100644
index 0000000..0062684
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/MiddleClickListener.java
@@ -0,0 +1,46 @@
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+
+/**
+ * When middle click pastes to the checkboxes it doesn't register it... This is
+ * to fix that problem. Not needed in Windows.
+ *
+ * @author Andrew Su <[email protected], [email protected]>
+ *
+ */
+class MiddleClickListener extends MouseAdapter {
+
+ DeploymentConfiguration config;
+ private String property;
+
+ /**
+ * Creates a new instance of middle-click listener.
+ *
+ * @param config
+ * Loaded DeploymentConfiguration file.
+ * @param property
+ * the property in configuration file to edit.
+ */
+ public MiddleClickListener(DeploymentConfiguration config, String property) {
+ this.config = config;
+ this.property = property;
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ Object obj = e.getSource();
+ String result = null;
+ if (obj instanceof JTextField)
+ result = ((JTextField) obj).getText();
+ else if (obj instanceof JTextArea) result = ((JTextArea) obj).getText();
+
+ config.setProperty(property, result);
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/NamedBorderPanel.java b/netx/net/sourceforge/jnlp/controlpanel/NamedBorderPanel.java
new file mode 100644
index 0000000..c7b2506
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/NamedBorderPanel.java
@@ -0,0 +1,60 @@
+/* NamedBorderPanel.java -- Makes a border which has a name.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.LayoutManager;
+
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+
+/**
+ * This class provides the a panel that has a border with the name specified.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+public class NamedBorderPanel extends JPanel {
+
+ /**
+ * Creates a new instance of JPanel with a named border and specified
+ * layout.
+ *
+ * @param title
+ * Name to be displayed.
+ * @param layout
+ * Layout to use with this panel.
+ */
+ public NamedBorderPanel(String title, LayoutManager layout) {
+ this(title);
+ setLayout(layout);
+ }
+
+ /**
+ * Creates a new instance of JPanel with a named border.
+ *
+ * @param title
+ * Name to be displayed.
+ */
+ public NamedBorderPanel(String title) {
+ super();
+ setBorder(BorderFactory.createCompoundBorder(
+ BorderFactory.createTitledBorder(title),
+ BorderFactory.createEmptyBorder(5, 5, 5, 5)));
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java b/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java
new file mode 100644
index 0000000..4b6ee04
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/NetworkSettingsPanel.java
@@ -0,0 +1,278 @@
+/* NetworkSettingsPanel.java -- Sets proxy settings for network.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.BorderLayout;
+import java.awt.CardLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.util.ArrayList;
+
+import javax.swing.Box;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This is the pane used with creating a JDialog version. This allows changing
+ * the network configuration: Proxy
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+@SuppressWarnings("serial")
+public class NetworkSettingsPanel extends JPanel implements ActionListener {
+
+ private DeploymentConfiguration config;
+
+ private JPanel description;
+ private ArrayList<JPanel> proxyPanels = new ArrayList<JPanel>(); // The stuff with editable fields
+
+ /** List of properties used by this panel */
+ public static String[] properties = { "deployment.proxy.type",
+ "deployment.proxy.http.host",
+ "deployment.proxy.http.port",
+ "deployment.proxy.bypass.local",
+ "deployment.proxy.auto.config.url", };
+
+ /**
+ * Creates a new instance of the network settings panel.
+ *
+ * @param config
+ * Loaded DeploymentConfiguration file.
+ */
+ public NetworkSettingsPanel(DeploymentConfiguration config) {
+ super();
+ this.config = config;
+ setLayout(new BorderLayout());
+
+ addComponents();
+ }
+
+ /**
+ * This adds the components to the panel.
+ */
+ protected void addComponents() {
+ JPanel settingPanel = new NamedBorderPanel(Translator.R("CPHeadNetworkSettings"));
+ settingPanel.setLayout(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.BOTH;
+ c.weightx = 1;
+ c.weighty = 1;
+ c.gridx = 0;
+
+ JLabel networkDesc = new JLabel("<html>" + Translator.R("CPNetworkSettingsDescription") + "<hr /></html>");
+
+ JLabel[] description = { new JLabel("<html>" + Translator.R("NSDescription-1") + "</html>"),
+ new JLabel("<html>" + Translator.R("NSDescription0") + "</html>"),
+ new JLabel("<html>" + Translator.R("NSDescription1") + "</html>"),
+ new JLabel("<html>" + Translator.R("NSDescription2") + "</html>"),
+ new JLabel("<html>" + Translator.R("NSDescription3") + "</html>") };
+
+ this.description = new JPanel(new CardLayout());
+ for (int i = 0; i < description.length; i++)
+ this.description.add(description[i], String.valueOf(i - 1));
+
+ // Settings for selecting Proxy Server
+ JPanel proxyServerPanel = new JPanel(new BorderLayout());
+ JPanel proxyLocationPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+ JPanel proxyBypassPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+
+ JLabel addressLabel = new JLabel(Translator.R("NSAddress") + ":");
+ JLabel portLabel = new JLabel(Translator.R("NSPort") + ":");
+ final JTextField addressField = new JTextField(config.getProperty(properties[1]), 10);
+ addressField.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ config.setProperty(properties[1], addressField.getText());
+ }
+ });
+
+ addressField.addMouseListener(new MiddleClickListener(this.config, properties[1]));
+ final JTextField portField = new JTextField(config.getProperty(properties[2]), 3);
+ portField.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ config.setProperty(properties[2], portField.getText());
+ }
+ });
+ // Create the button which allows setting of other types of proxy.
+ JButton advancedProxyButton = new JButton(Translator.R("NSAdvanced") + "...");
+ advancedProxyButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ AdvancedProxySettingsDialog.showAdvancedProxySettingsDialog(config);
+ addressField.setText(config.getProperty(properties[1]));
+ portField.setText(config.getProperty(properties[2]));
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+ }
+ });
+
+ JCheckBox bypassCheckBox = new JCheckBox(Translator.R("NSBypassLocal"), Boolean.parseBoolean(config.getProperty(properties[3])));
+ bypassCheckBox.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ config.setProperty(properties[3], String.valueOf(e.getStateChange() == ItemEvent.SELECTED));
+ }
+ });
+ proxyLocationPanel.add(Box.createRigidArea(new Dimension(13, 0)));
+ proxyLocationPanel.add(addressLabel);
+ proxyLocationPanel.add(addressField);
+ proxyLocationPanel.add(portLabel);
+ proxyLocationPanel.add(portField);
+ proxyLocationPanel.add(advancedProxyButton);
+ proxyBypassPanel.add(Box.createRigidArea(new Dimension(10, 0)));
+ proxyBypassPanel.add(bypassCheckBox);
+
+ proxyServerPanel.add(proxyLocationPanel, BorderLayout.CENTER);
+ proxyServerPanel.add(proxyBypassPanel, BorderLayout.SOUTH);
+
+ JRadioButton directConnection = new JRadioButton(Translator.R("NSDirectConnection"), config.getProperty(properties[0]).equals("0"));
+ directConnection.setActionCommand("0");
+ directConnection.addActionListener(this);
+
+ JRadioButton useProxyServer = new JRadioButton(Translator.R("NSManualProxy"), config.getProperty(properties[0]).equals("1"));
+ useProxyServer.setActionCommand("1");
+ useProxyServer.addActionListener(this);
+
+ JRadioButton useAutoProxyConfigScript = new JRadioButton(Translator.R("NSAutoProxy"), config.getProperty(properties[0]).equals("2"));
+ useAutoProxyConfigScript.setActionCommand("2");
+ useAutoProxyConfigScript.addActionListener(this);
+
+ JRadioButton useBrowserSettings = new JRadioButton(Translator.R("NSBrowserProxy"), config.getProperty(properties[0]).equals("3"));
+ useBrowserSettings.setActionCommand("3");
+ useBrowserSettings.addActionListener(this);
+
+ ButtonGroup modeSelect = new ButtonGroup();
+ modeSelect.add(useBrowserSettings);
+ modeSelect.add(useProxyServer);
+ modeSelect.add(useAutoProxyConfigScript);
+ modeSelect.add(directConnection);
+
+ // Settings for Automatic Proxy Configuration Script
+ JPanel proxyAutoPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+ JLabel locationLabel = new JLabel(Translator.R("NSScriptLocation") + ":");
+ final JTextField locationField = new JTextField(config.getProperty(properties[4]), 20);
+ locationField.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ String value = locationField.getText();
+ if (value.trim().equals("")) value = null;
+ config.setProperty(properties[4], value);
+ }
+ });
+
+ proxyAutoPanel.add(Box.createRigidArea(new Dimension(13, 0)));
+ proxyAutoPanel.add(locationLabel);
+ proxyAutoPanel.add(locationField);
+
+ c.gridy = 0;
+ settingPanel.add(networkDesc, c);
+ c.gridy = 1;
+ settingPanel.add(this.description, c);
+ c.gridy = 2;
+ settingPanel.add(directConnection, c);
+ c.gridy = 3;
+ settingPanel.add(useBrowserSettings, c);
+ c.gridy = 4;
+ settingPanel.add(useProxyServer, c);
+ c.gridy = 5;
+ settingPanel.add(proxyServerPanel, c);
+ proxyPanels.add(proxyServerPanel);
+ c.gridy = 6;
+ settingPanel.add(useAutoProxyConfigScript, c);
+ c.gridy = 7;
+ settingPanel.add(proxyAutoPanel, c);
+ proxyPanels.add(proxyAutoPanel);
+
+ // Filler to pack the bottom of the panel.
+ Component filler = Box.createRigidArea(new Dimension(1, 1));
+ c.gridy++;
+ c.weighty = 1;
+ settingPanel.add(filler, c);
+
+ setState(); // depending on default setting we will enable or disable
+
+ add(settingPanel, BorderLayout.CENTER);
+
+ }
+
+ /**
+ * Enable/Disable the panel and all its children recursively.
+ *
+ * @param panel
+ * JPanel which needs to be enabled or disabled.
+ * @param enable
+ * true if the panel and its children are to be enabled, false
+ * otherwise.
+ */
+ private void enablePanel(JPanel panel, boolean enable) {
+ // This will be used to enable all components in this panel recursively.
+ // Ridiculously slow if lots of nested panels.
+ for (Component c : panel.getComponents()) {
+ if (c instanceof JPanel) {
+ enablePanel((JPanel) c, enable);
+ }
+ c.setEnabled(enable);
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ config.setProperty(properties[0], e.getActionCommand());
+ setState();
+ }
+
+ /**
+ * This enables and disables the appropriate panels.
+ */
+ private void setState() {
+ ((CardLayout) this.description.getLayout()).show(this.description, config.getProperty(properties[0]));
+ if (config.getProperty(properties[0]).equals("0")) {
+ for (JPanel panel : proxyPanels)
+ enablePanel(panel, false);
+ } else if (config.getProperty(properties[0]).equals("1")) {
+ enablePanel(proxyPanels.get(1), false);
+ enablePanel(proxyPanels.get(0), true);
+ } else if (config.getProperty(properties[0]).equals("2")) {
+ enablePanel(proxyPanels.get(0), false);
+ enablePanel(proxyPanels.get(1), true);
+ } else if (config.getProperty(properties[0]).equals("3")) {
+ for (JPanel panel : proxyPanels)
+ enablePanel(panel, false);
+ }
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java b/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java
new file mode 100644
index 0000000..18d574a
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/SecuritySettingsPanel.java
@@ -0,0 +1,141 @@
+/* SecuritySettingsPanel.java -- Display possible security settings.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * This provides a way for the user to modify the security settings through a
+ * GUI.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+@SuppressWarnings("serial")
+public class SecuritySettingsPanel extends NamedBorderPanel implements ActionListener {
+
+ private DeploymentConfiguration config;
+
+ // NOTE: All the ones listed with "Default" are in Oracle's implementation.
+ // Not shown on deployments.properties webpage. Add support for these later!
+ /** List of properties used by this panel */
+ public static String[] properties = { "deployment.security.askgrantdialog.show",
+ "deployment.security.askgrantdialog.notinca",
+ "deployment.security.browser.keystore.use", // default TRUE
+ "deployment.security.clientauth.keystore.auto", // Default FALSE
+ "deployment.security.jsse.hostmismatch.warning",
+ "deployment.security.https.warning.show", // Default FALSE
+ "deployment.security.sandbox.awtwarningwindow",
+ "deployment.security.sandbox.jnlp.enhanced",
+ "deployment.security.validation.crl", // Default TRUE
+ "deployment.security.validation.ocsp", // Default FALSE
+ "deployment.security.pretrust.list", // Default TRUE
+ "deployment.security.blacklist.check", // Default TRUE
+ "deployment.security.password.cache", // Default TRUE
+ "deployment.security.SSLv2Hello", // Default FALSE
+ "deployment.security.SSLv3", // Default TRUE
+ "deployment.security.TLSv1", // Default TRUE
+// "deployment.security.mixcode", // Default TRUE
+ };
+
+ /**
+ * This creates a new instance of the security settings panel.
+ *
+ * @param config
+ * Loaded DeploymentConfiguration file.
+ */
+ public SecuritySettingsPanel(DeploymentConfiguration config) {
+ super(Translator.R("CPHeadSecurity"), new BorderLayout());
+ this.config = config;
+
+ addComponents();
+ }
+
+ /**
+ * Add the components to the panel.
+ */
+ private void addComponents() {
+ JPanel topPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+
+ JLabel description = new JLabel("<html>" + Translator.R("CPSecurityDescription") + "<hr /></html>");
+
+ JCheckBox[] securityGeneralOptions = { new JCheckBox(Translator.R("SGPAllowUserGrantSigned")),
+ new JCheckBox(Translator.R("SGPAllowUserGrantUntrust")),
+ new JCheckBox(Translator.R("SGpUseBrowserKeystore")),
+ new JCheckBox(Translator.R("SGPUsePersonalCertOneMatch")),
+ new JCheckBox(Translator.R("SGPWarnCertHostMismatch")),
+ new JCheckBox(Translator.R("SGPShowValid")),
+ new JCheckBox(Translator.R("SGPShowSandboxWarning")),
+ new JCheckBox(Translator.R("SGPAllowUserAcceptJNLPSecurityRequests")),
+ new JCheckBox(Translator.R("SGPCheckCertRevocationList")),
+ new JCheckBox(Translator.R("SGPEnableOnlineCertValidate")),
+ new JCheckBox(Translator.R("SGPEnableTrustedPublisherList")),
+ new JCheckBox(Translator.R("SGPEnableBlacklistRevocation")),
+ new JCheckBox(Translator.R("SGPEnableCachingPassword")),
+ new JCheckBox(Translator.R("SGPUseSSL2")),
+ new JCheckBox(Translator.R("SGPUseSSL3")),
+ new JCheckBox(Translator.R("SGPUseTLS1")), };
+
+ c.fill = GridBagConstraints.BOTH;
+ c.gridx = 0;
+ c.weightx = 1;
+
+ topPanel.add(description, c);
+
+ // Only display the ones with properties that are valid or existent.
+ for (int i = 0; i < properties.length; i++) {
+ try {
+ String s = config.getProperty(properties[i]);
+ securityGeneralOptions[i].setSelected(Boolean.parseBoolean(s));
+ securityGeneralOptions[i].setActionCommand(properties[i]);
+ securityGeneralOptions[i].addActionListener(this);
+ c.gridy = i + 1;
+ topPanel.add(securityGeneralOptions[i], c);
+ } catch (Exception e) {
+ securityGeneralOptions[i] = null;
+ }
+ }
+
+ Component filler = Box.createRigidArea(new Dimension(1, 1));
+ c.weighty = 1;
+ c.gridy++;
+ topPanel.add(filler, c);
+
+ add(topPanel, BorderLayout.CENTER);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ config.setProperty(e.getActionCommand(), String.valueOf(((JCheckBox) e.getSource()).isSelected()));
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java b/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java
new file mode 100644
index 0000000..ef56a18
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/controlpanel/TemporaryInternetFilesPanel.java
@@ -0,0 +1,233 @@
+/* TemporaryInternetFilesPanel.java -- Display and sets cache settings.
+Copyright (C) 2010 Red Hat
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+package net.sourceforge.jnlp.controlpanel;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.naming.ConfigurationException;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import net.sourceforge.jnlp.runtime.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.Translator;
+
+/**
+ * The actual panel that contains the fields that the user can edit accordingly.
+ * This is provided as a pane for inside the Panel itself, can also be used to
+ * display as a dialog.
+ * TODO: Add functionality:
+ * Delete Cache.
+ * Restore Defaults.
+ * View Cache.
+ *
+ * @author Andrew Su ([email protected], [email protected])
+ *
+ */
+@SuppressWarnings("serial")
+public class TemporaryInternetFilesPanel extends NamedBorderPanel implements ChangeListener {
+
+ private DeploymentConfiguration config;
+ private int minSize = -1;
+ private int maxSize = 1000;
+
+ /** List of properties used by this panel */
+ public static String[] properties = { "deployment.javapi.cache.enabled", // false == enabled
+ "deployment.user.cachedir",
+ "deployment.cache.max.size", // Specified in MB
+ "deployment.cache.jarcompression", // Allows values 0-9
+ };
+
+ private JComponent defaultFocusComponent = null;
+ JSpinner spCacheSize;
+ JSlider slCacheSize;
+
+ public TemporaryInternetFilesPanel(DeploymentConfiguration config) {
+ super(Translator.R("CPHeadTempInternetFiles"));
+ this.config = config;
+ setLayout(new BorderLayout());
+
+ addComponents();
+ }
+
+ /**
+ * Add components to panel.
+ */
+ private void addComponents() {
+ JPanel topPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints c = new GridBagConstraints();
+ c.fill = GridBagConstraints.BOTH;
+
+ JLabel description = new JLabel("<html>" + Translator.R("CPTempInternetFilesDescription") + "<hr /></html>");
+
+ JCheckBox enableCaching = new JCheckBox(Translator.R("TIFPEnableCache"), !Boolean.parseBoolean(this.config.getProperty(properties[0])));
+ enableCaching.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ config.setProperty(properties[0], String.valueOf(!(e.getStateChange() == ItemEvent.SELECTED)));
+ }
+ });
+
+ // This displays the option for changing location of cache
+ // User can NOT edit the text field must do it through dialog.
+ JPanel locationPanel = new NamedBorderPanel(Translator.R("TIFPLocation"), new GridBagLayout());
+ JLabel locationDescription = new JLabel(Translator.R("TIFPLocationLabel") + ":");
+ final JTextField location = new JTextField(this.config.getProperty(properties[1]));
+ location.setEditable(false); // Can not c&p into the location field.
+ JButton bLocation = new JButton(Translator.R("TIFPChange") + "...");
+ bLocation.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
+ String result = fileChooser.getSelectedFile().getAbsolutePath();
+ location.setText(result);
+ config.setProperty(properties[1], result);
+ }
+ }
+ });
+
+ c.weightx = 1;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+ c.gridx = 0;
+ c.gridy = 0;
+ locationPanel.add(locationDescription, c);
+ c.gridwidth = 1;
+ c.gridy = 1;
+ locationPanel.add(location, c);
+ c.gridx = 1;
+ c.weightx = 0;
+ locationPanel.add(bLocation, c);
+
+ // This section deals with how to use the disk space.
+ JPanel diskSpacePanel = new NamedBorderPanel(Translator.R("TIFPDiskSpace"), new GridBagLayout());
+ JLabel lCompression = new JLabel(Translator.R("TIFPCompressionLevel")); // Sets compression level for jar files.
+ ComboItem[] compressionOptions = { new ComboItem(Translator.R("TIFPNone"), "0"),
+ new ComboItem("1", "1"),
+ new ComboItem("2", "2"),
+ new ComboItem("3", "3"),
+ new ComboItem("4", "4"),
+ new ComboItem("5", "5"),
+ new ComboItem("6", "6"),
+ new ComboItem("7", "7"),
+ new ComboItem("8", "8"),
+ new ComboItem(Translator.R("TIFPMax"), "9"), };
+ JComboBox cbCompression = new JComboBox(compressionOptions);
+ cbCompression.setSelectedIndex(Integer.parseInt(this.config.getProperty(properties[3])));
+ cbCompression.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ config.setProperty(properties[3], ((ComboItem) e.getItem()).getValue());
+ }
+ });
+
+ // This is to work with how much space is available for caching.
+ JLabel lCacheSize = new JLabel(Translator.R("TIFPCacheSize") + ":");
+ slCacheSize = new JSlider(minSize, maxSize, Integer.parseInt(this.config.getProperty(properties[2])));
+ slCacheSize.setMinorTickSpacing(50);
+ slCacheSize.setPaintTicks(true);
+ SpinnerNumberModel snmCacheSize = new SpinnerNumberModel(Integer.parseInt(this.config.getProperty(properties[2])), minSize, maxSize, 1);
+ spCacheSize = new JSpinner(snmCacheSize);
+
+ slCacheSize.addChangeListener(this);
+ spCacheSize.addChangeListener(this);
+
+ c.gridy = 0;
+ c.gridx = 0;
+ c.weightx = 1;
+ diskSpacePanel.add(lCompression, c);
+ c.gridx = 1;
+ c.weightx = 0;
+ diskSpacePanel.add(cbCompression, c);
+ c.gridy = 1;
+ c.gridx = 0;
+ c.gridwidth = GridBagConstraints.REMAINDER;
+ c.weightx = 1;
+ diskSpacePanel.add(lCacheSize, c);
+ c.gridwidth = 1;
+ c.gridy = 2;
+ diskSpacePanel.add(slCacheSize, c);
+ c.gridx = 1;
+ diskSpacePanel.add(spCacheSize, c);
+
+ JPanel buttonDeleteRestore = new JPanel(new FlowLayout(FlowLayout.TRAILING));
+ JButton bDelete = new JButton(Translator.R("TIFPDeleteFiles") + "...");
+ JButton bRestore = new JButton(Translator.R("TIFPRestoreDefaults"));
+ //TODO: Add functionality to restore and delete. Also need to add a view button!
+ bDelete.setEnabled(false);
+ bRestore.setEnabled(false);
+ buttonDeleteRestore.add(bDelete);
+ buttonDeleteRestore.add(bRestore);
+
+ c.weighty = 0;
+ c.gridx = 0;
+ c.gridy = 0;
+ topPanel.add(enableCaching, c);
+ c.gridy = 1;
+ topPanel.add(locationPanel, c);
+ c.gridy = 2;
+ topPanel.add(diskSpacePanel, c);
+ c.weighty = 1;
+ c.gridy = 3;
+ topPanel.add(buttonDeleteRestore, c);
+ add(description, BorderLayout.NORTH);
+ add(topPanel, BorderLayout.CENTER);
+ }
+
+ /**
+ * Give focus to the default button.
+ */
+ public void focusOnDefaultButton() {
+ if (defaultFocusComponent != null) {
+ defaultFocusComponent.requestFocusInWindow();
+ }
+ }
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ Object o = e.getSource();
+ if (o instanceof JSlider)
+ spCacheSize.setValue(((JSlider) o).getValue());
+ else if (o instanceof JSpinner) slCacheSize.setValue((Integer) ((JSpinner) o).getValue());
+
+ config.setProperty(properties[2], spCacheSize.getValue().toString());
+ }
+}
diff --git a/netx/net/sourceforge/jnlp/resources/Messages.properties b/netx/net/sourceforge/jnlp/resources/Messages.properties
index 19112bb..ed9a69c 100644
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties
@@ -233,3 +233,129 @@ KSJsseCerts=Trusted JSSE Certificates
KSCaCerts=Trusted Root CA Certificates
KSJsseCaCerts=Trusted JSSE Root CA Certificates,
KSClientCerts=Client Authentication Certificates
+
+# Control Panel - Tab Descriptions
+CPAboutDescription=View version information about Icedtea Control Panel.
+CPNetworkSettingsDescription=Configure network settings, including how IcedTea-Web connects to the internet and whether to use any proxies.
+CPTempInternetFilesDescription=Java stores application data for faster execution the next time you run it.
+CPJRESettingsDescription=View and manage Java Runtime Environment versions and settings for Java applications and applets.
+CPCertificatesDescription=Use certificates to positively identify yourself, certifications, authorities, and plublishers.
+CPSecurityDescription=Use this to configure security settings.
+CPDebuggingDescription=Enable options here to help with debugging
+CPDesktopIntegrationDescription=Set whether or not to allow creation of desktop shortcut.
+
+# Control Panel - Buttons
+CPButAbout=About...
+CPButNetworkSettings=Network Settings...
+CPButSettings=Settings...
+CPButView=View...
+CPButCertificates=Certificates...
+
+# Control Panel - Headers
+CPHead=IcedTea Web Control Panel
+CPHeadAbout=About
+CPHeadNetworkSettings=Network Proxy Settings
+CPHeadTempInternetFiles=Temporary Internet Files
+CPHeadJRESettings=Java Runtime Environment Settings
+CPHeadCertificates=Certificates
+CPHeadDebugging=Debugging Settings
+CPHeadDesktopIntegration=Desktop Integrations
+CPHeadSecurity=Security Settings
+
+# Control Panel - Tabs
+CPTabAbout=About IcedTea-Web
+CPTabCache=Cache
+CPTabCertificate=Certificates
+CPTabClassLoader=Class Loaders
+CPTabDebugging=Debugging
+CPTabDesktopIntegration=Desktop Integration
+CPTabNetwork=Network
+CPTabRuntimes=Runtimes
+CPTabSecurity=Security
+
+# Control Panel - AboutPanel
+CPAboutInfo=This is the control panel for setting deployments.properties.<br/>Not all options will take effect until implemented.<br/>Currently does not support multiple JRE.<br/>
+
+# Control Panel - AdvancedProxySettings
+APSDialogTitle=Network Settings
+APSServersPanel=Servers
+APSProxyTypeLabel=Type
+APSProxyAddressLabel=Proxy Address
+APSProxyPortLabel=Proxy Port
+APSLabelHTTP=HTTP
+APSLabelSecure=Secure
+APSLabelFTP=FTP
+APSLabelSocks=Socks
+APSSameProxyForAllProtocols=Use the same proxy server for all protocols.
+APSExceptionsLabel=Exceptions
+APSExceptionsDescription=Do not use proxy server for addresses beginning with
+APSExceptionInstruction=Separate each entry with a semicolon.
+
+# Control Panel - DebugginPanel
+DPEnableTracing=Enable tracing
+DPEnableLogging=Enable logging
+DPLifeCycleExceptions=Show applet lifecycle exceptions
+DPDisable=Disable
+DPHide=Hide on startup
+DPShow=Show on startup
+DPJavaConsole=Java Console
+
+# Control Panel - DesktopShortcutPanel
+DSPNeverCreate=Never create
+DSPAlwaysAllow=Always allow
+DSPAskUser=Ask user
+DSPAskIfHinted=Ask if hinted
+DSPAlwaysIfHinted=Always if hinted
+
+# Control Panel - NetworkSettingsPanel
+NSDescription-1=Unknown Setting.
+NSDescription0=Use direct connection.
+NSDescription1=Override browser proxy settings.
+NSDescription2=Use automatic proxy configuration script at the specified location.
+NSDescription3=Use proxy settings from your default browser to connect to the internet.
+NSAddress=Address
+NSPort=Port
+NSAdvanced=Advanced
+NSBypassLocal=Bypass proxy server for local addresses
+NSDirectConnection=Direct connection
+NSManualProxy=Manual proxy server
+NSAutoProxy=Automatic proxy configuration script
+NSBrowserProxy=Use browser settings
+NSScriptLocation=Script location
+
+# Control Panel - SecurityGeneralPanel
+SGPAllowUserGrantSigned=Allow users to grant permissions to signed content
+SGPAllowUserGrantUntrust=Allow users to grant permissions to content from an untrusted authority
+SGPUseBrowserKeystore=Use certificates and keys in browser keystore (Unsupported)
+SGPUsePersonalCertOneMatch=Use personal certificate automatically if only one matches server request (Unsupported)
+SGPWarnCertHostMismatch=Warn if site certificate does not match hostname
+SGPShowValid=Show site certificate even if it is valid (Unsupported)
+SGPShowSandboxWarning=Show sandbox warning banner
+SGPAllowUserAcceptJNLPSecurityRequests=Allow user to accept JNLP security requests
+SGPCheckCertRevocationList=Check certificates for revocation using Certificate Revocation Lists (CRLs) (Unsupported)
+SGPEnableOnlineCertValidate=Enable online certificate validation (Unsupported)
+SGPEnableTrustedPublisherList=Enable list of trusted publishers (Unsupported)
+SGPEnableBlacklistRevocation=Enable blacklist revocation check (Unsupported)
+SGPEnableCachingPassword=Enable caching password for authentication (Unsupported)
+SGPUseSSL2=Use SSL 2.0 compatible ClientHello format (Unsupported)
+SGPUseSSL3=Use SSL 3.0 (Unsupported)
+SGPUseTLS1=Use TLS 1.0 (Unsupported)
+
+# Control Panel - TemporaryInternetFilesPanel
+TIFPEnableCache=Keep temporary files on my computer
+TIFPLocation=Location
+TIFPLocationLabel=Select the location where temporary files are kept
+TIFPChange=Change
+TIFPDiskSpace=Disk space
+TIFPCompressionLevel=Select the compression level for JAR files
+TIFPNone=None
+TIFPMax=Max
+TIFPCacheSize=Set the amount of disk space for storing temporary files
+TIFPDeleteFiles=Delete files
+TIFPRestoreDefaults=Restore defaults
+
+# Control Panel - Misc.
+CPJRESupport=Icedtea-web currently does not support multiple JRE.
+
+# Buttons
+ButApply=Apply
diff --git a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java
index ce36154..c85c856 100644
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java
@@ -230,17 +230,18 @@ public class CertificatePane extends JPanel {
tablePanel.add(tabbedPane, BorderLayout.CENTER);
tablePanel.add(buttonPanel, BorderLayout.SOUTH);
- JPanel closePanel = new JPanel(new BorderLayout());
- closePanel.setBorder(BorderFactory.createEmptyBorder(7,7,7,7));
- JButton closeButton = new JButton(R("ButClose"));
- closeButton.addActionListener(new CloseButtonListener());
- defaultFocusComponent = closeButton;
- closePanel.add(closeButton, BorderLayout.EAST);
-
main.add(certificateTypePanel, BorderLayout.NORTH);
main.add(tablePanel, BorderLayout.CENTER);
- main.add(closePanel, BorderLayout.SOUTH);
-
+
+ if (parent != null){
+ JPanel closePanel = new JPanel(new BorderLayout());
+ closePanel.setBorder(BorderFactory.createEmptyBorder(7,7,7,7));
+ JButton closeButton = new JButton(R("ButClose"));
+ closeButton.addActionListener(new CloseButtonListener());
+ defaultFocusComponent = closeButton;
+ closePanel.add(closeButton, BorderLayout.EAST);
+ main.add(closePanel, BorderLayout.SOUTH);
+ }
add(main);
}