aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-07-10 18:31:48 +0200
committerJiri Vanek <[email protected]>2013-07-10 18:31:48 +0200
commit75ee86cad9f42b975194b9870aa1decadae88d9c (patch)
tree308c6379a5e0eddd66128cbce2a79d8113eb2312 /netx/net/sourceforge/jnlp
parent871e40074835623e8c3bd5d5d94227834956b077 (diff)
Implemented new about dialogue (by Andrew Azores). Andrew added to authors
Diffstat (limited to 'netx/net/sourceforge/jnlp')
-rw-r--r--netx/net/sourceforge/jnlp/about/AboutDialog.java192
-rw-r--r--netx/net/sourceforge/jnlp/about/HTMLPanel.java84
-rw-r--r--netx/net/sourceforge/jnlp/resources/Messages.properties12
-rw-r--r--netx/net/sourceforge/jnlp/resources/about.html44
-rw-r--r--netx/net/sourceforge/jnlp/resources/about.jnlp17
-rw-r--r--netx/net/sourceforge/jnlp/resources/itw_logo.pngbin0 -> 2191 bytes
-rw-r--r--netx/net/sourceforge/jnlp/resources/jamIcon.jpgbin0 -> 10580 bytes
-rw-r--r--netx/net/sourceforge/jnlp/runtime/Boot.java72
8 files changed, 360 insertions, 61 deletions
diff --git a/netx/net/sourceforge/jnlp/about/AboutDialog.java b/netx/net/sourceforge/jnlp/about/AboutDialog.java
new file mode 100644
index 0000000..7ae32bc
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/about/AboutDialog.java
@@ -0,0 +1,192 @@
+/* Main.java
+ Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea 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, version 2.
+
+IcedTea 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 IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.about;
+
+import static net.sourceforge.jnlp.runtime.Translator.R;
+
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+
+import net.sourceforge.jnlp.util.ScreenFinder;
+
+public class AboutDialog extends JPanel implements Runnable, ActionListener {
+
+ private static final String about_url = "/net/sourceforge/jnlp/resources/about.html";
+ private static final String authors_url = "/net/sourceforge/jnlp/resources/AUTHORS.html";
+ private static final String changelog_url = "/net/sourceforge/jnlp/resources/ChangeLog.html";
+ private static final String copying_url = "/net/sourceforge/jnlp/resources/COPYING.html";
+ private static final String news_url = "/net/sourceforge/jnlp/resources/NEWS.html";
+
+ private JFrame frame;
+ private JPanel contentPane;
+ private HTMLPanel aboutPanel, authorsPanel, newsPanel, changelogPanel, copyingPanel;
+ private JButton aboutButton, authorsButton, newsButton, changelogButton, copyingButton;
+
+ public AboutDialog() throws IOException {
+ super(new GridBagLayout());
+
+ frame = new JFrame("About IcedTea-Web");
+ frame.setContentPane(this);
+ frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+
+ URL res_about = getClass().getResource(about_url);
+ URL res_authors = getClass().getResource(authors_url);
+ URL res_news = getClass().getResource(news_url);
+ URL res_changelog = getClass().getResource(changelog_url);
+ URL res_copying = getClass().getResource(copying_url);
+
+ aboutPanel = new HTMLPanel(res_about, R("AboutDialogueTabAbout"));
+ authorsPanel = new HTMLPanel(res_authors, R("AboutDialogueTabAuthors"));
+ newsPanel = new HTMLPanel(res_news, R("News"));
+ changelogPanel = new HTMLPanel(res_changelog, R("AboutDialogueTabChangelog"));
+ copyingPanel = new HTMLPanel(res_copying, R("AboutDialogueTabGPLv2"));
+
+ aboutButton = new JButton(aboutPanel.getIdentifier());
+ aboutButton.setActionCommand(aboutPanel.getIdentifier());
+ aboutButton.addActionListener(this);
+
+ authorsButton = new JButton(authorsPanel.getIdentifier());
+ authorsButton.setActionCommand(authorsPanel.getIdentifier());
+ authorsButton.addActionListener(this);
+
+ newsButton = new JButton(newsPanel.getIdentifier());
+ newsButton.setActionCommand(newsPanel.getIdentifier());
+ newsButton.addActionListener(this);
+
+ changelogButton = new JButton(changelogPanel.getIdentifier());
+ changelogButton.setActionCommand(changelogPanel.getIdentifier());
+ changelogButton.addActionListener(this);
+
+ copyingButton = new JButton(copyingPanel.getIdentifier());
+ copyingButton.setActionCommand(copyingPanel.getIdentifier());
+ copyingButton.addActionListener(this);
+
+ contentPane = aboutPanel;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String action = e.getActionCommand();
+ if (action.equals(((HTMLPanel) contentPane).getIdentifier()))
+ return;
+
+ if (action.equals(aboutPanel.getIdentifier())) {
+ contentPane = aboutPanel;
+ } else if (action.equals(authorsPanel.getIdentifier())) {
+ contentPane = authorsPanel;
+ } else if (action.equals(newsPanel.getIdentifier())) {
+ contentPane = newsPanel;
+ } else if (action.equals(changelogPanel.getIdentifier())) {
+ contentPane = changelogPanel;
+ } else if (action.equals(copyingPanel.getIdentifier())) {
+ contentPane = copyingPanel;
+ }
+
+ layoutWindow();
+ }
+
+ private void layoutWindow() {
+ this.removeAll();
+
+ GridBagConstraints gbc = new GridBagConstraints();
+
+ gbc.fill = GridBagConstraints.BOTH;
+ gbc.gridy = 0;
+ gbc.gridx = 0;
+ gbc.gridwidth = 5;
+ gbc.weightx = 1.0;
+ gbc.weighty = 1.0;
+ this.add(contentPane, gbc);
+
+ gbc.gridy = 1;
+ gbc.gridx = 0;
+ gbc.gridwidth = 1;
+ gbc.ipady = 16;
+ this.add(aboutButton, gbc);
+
+ gbc.gridx = 1;
+ this.add(authorsButton, gbc);
+
+ gbc.gridx = 2;
+ this.add(newsButton, gbc);
+
+ gbc.gridx = 3;
+ this.add(changelogButton, gbc);
+
+ gbc.gridx = 4;
+ this.add(copyingButton, gbc);
+
+ Dimension contentSize = new Dimension(640, 480);
+ contentPane.setMinimumSize(contentSize);
+ contentPane.setPreferredSize(contentSize);
+ contentPane.setBorder(new EmptyBorder(0, 0, 8, 0));
+
+ this.setBorder(new EmptyBorder(8, 8, 8, 8));
+
+ frame.pack();
+ }
+
+ @Override
+ public void run() {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception e) {
+ }
+
+ layoutWindow();
+ ScreenFinder.centerWindowsToCurrentScreen(frame);
+ frame.setVisible(true);
+ }
+
+ public static void display() throws IOException {
+ SwingUtilities.invokeLater(new AboutDialog());
+ }
+
+}
diff --git a/netx/net/sourceforge/jnlp/about/HTMLPanel.java b/netx/net/sourceforge/jnlp/about/HTMLPanel.java
new file mode 100644
index 0000000..67c1733
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/about/HTMLPanel.java
@@ -0,0 +1,84 @@
+/* HTMLPanel.java
+ Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea 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, version 2.
+
+IcedTea 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 IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.about;
+
+import java.awt.BorderLayout;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+
+public class HTMLPanel extends JPanel {
+
+ private String id;
+
+ public HTMLPanel(URL url, String identifier) throws IOException {
+ super(new BorderLayout());
+ id = identifier;
+ JEditorPane pane = new JEditorPane(url);
+ pane.setContentType("text/html");
+ pane.setEditable(false);
+ pane.addHyperlinkListener(new UrlHyperlinkListener());
+ JScrollPane scroller = new JScrollPane(pane);
+ this.add(scroller, BorderLayout.CENTER);
+ }
+
+ public String getIdentifier() {
+ return id;
+ }
+
+ private class UrlHyperlinkListener implements HyperlinkListener {
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent event) {
+ if (Desktop.isDesktopSupported() && event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ try {
+ Desktop.getDesktop().browse(event.getURL().toURI());
+ } catch (URISyntaxException ex) {
+ } catch (IOException ex) {
+ }
+ }
+ }
+ }
+
+}
diff --git a/netx/net/sourceforge/jnlp/resources/Messages.properties b/netx/net/sourceforge/jnlp/resources/Messages.properties
index d0de783..232f7d0 100644
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties
@@ -33,6 +33,13 @@ Username=Username:
Value=Value
Version=Version
+#about dialogue
+AboutDialogueTabAbout=About
+AboutDialogueTabAuthors=Authors
+AboutDialogueTabChangelog=Changelog
+AboutDialogueTabNews=News
+AboutDialogueTabGPLv2=GPLv2
+
# LS - Severity
LSMinor=Minor
LSFatal=Fatal
@@ -138,6 +145,7 @@ PBadHeapSize=Invalid value for heap size ({0})
# Runtime
BLaunchAbout=Launching about window...
+BLaunchAboutFailure=Was not able to launch About window
BNeedsFile=Must specify a .jnlp file
RNoAboutJnlp=Unable to find about.jnlp
BFileLoc=JNLP file location
@@ -172,6 +180,10 @@ RProxyFirefoxOptionNotImplemented=Browser proxy option "{0}" ({1}) not supported
RBrowserLocationPromptTitle=Browser Location
RBrowserLocationPromptMessage=Specify Browser Location
RBrowserLocationPromptMessageWithReason=Specify Browser Location (the browser command "{0}" is invalid).
+BAboutITW=The IcedTea-Web project provides a Free Software web browser plugin running applets written in the Java programming language and an implementation of Java Web Start, originally based on the NetX project. Visit the IcedTea-Web homepage: http://icedtea.classpath.org/wiki/IcedTea-Web . Use "man javaws" or "javaws -help" for more information.
+BFileInfoAuthors=Names and email addresses of contributors to this project can be found in the file AUTHORS in the IcedTea-Web root directory.
+BFileInfoCopying=The full GPLv2 license of this project can be found in the file COPYING in the IcedTea-Web root directory.
+BFileInfoNews=News about releases of this project can be found in the file NEWS in the IcedTea-Web root directory.
# Boot options, message should be shorter than this ---------------->
BOUsage=javaws [-run-options] <jnlp file>
diff --git a/netx/net/sourceforge/jnlp/resources/about.html b/netx/net/sourceforge/jnlp/resources/about.html
new file mode 100644
index 0000000..73674d2
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/resources/about.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <title>
+ </title>
+ </head>
+ <body>
+ <center><img src="itw_logo.png" alt="IcedTea-Web Logo" width="413" height="240"></center><br>
+ <b>IcedTea-Web</b> provides a Free Software web browser plugin running applets
+ written in the Java programming language and an implementation of Java Web Start, originally based on the NetX project.
+ <br><br>NetX allows Java applets and applications to be downloaded over the
+ network, cached, and (by default) run in a secure sandbox environment. Subsequent runs of the applet
+ download the latest version automatically. Update and security settings, among others, can be set using the itw-settings command.
+ <br>IcedTea-Web also includes a plugin to <a href="http://www.java.com/en/download/testjava.jsp">enable Java applets</a>
+ within web browsers.
+ <br><br>
+ <h2><b>
+ Features of NetX:
+ </b></h2>
+ <ul>
+ <li><b>Modular:</b> Easily add JNLP capabilities to an application.</li>
+ <li><b>Saves Memory:</b> Launch programs in a shared JVM.</li>
+ <li><b>Fast startup:</b> Runs applications from a cache for fast starting.</li>
+ <li><b>Security:</b> Run any application in a sandbox or log its activities.</li>
+ <li><b>Auto-Update:</b> Applications can auto-update without special code.</li>
+ <li><b>Network Deployment:</b> Deploy to the internet, not with installers.</li>
+ <li><b>Open Source:</b> GNU Lesser General Public License.</li>
+ </ul>
+ Visit the <a href="http://icedtea.classpath.org/wiki/Main_Page">IcedTea project wiki</a>
+ or specifically the <a href="http://icedtea.classpath.org/wiki/IcedTea-Web">IcedTea-Web home</a> pages for more information.
+ <br>Help with common issues with IcedTea-Web can be found <a href="http://icedtea.classpath.org/wiki/IcedTea-Web#Common_Issues">here</a>.
+ <br><br><h2><b>
+ Contributing:
+ </b></h2>
+ <br>
+ A <a href="http://icedtea.classpath.org/wiki/DeveloperQuickStart">QuickStart</a> guide for the IcedTea project is available on the wiki.
+ <a href="http://icedtea.classpath.org/wiki/IcedTea-Web#Code_style">Code style</a> guidelines and
+ <a href="http://icedtea.classpath.org/wiki/IcedTea-Web/DevelopingWithEclipse">Eclipse setup</a> instructions for IcedTea-Web
+ are available as well. Patches should be accompanied by unit tests and
+ <a href="http://icedtea.classpath.org/wiki/Reproducers">reproducers</a> before being sent to
+ <a href="http://mail.openjdk.java.net/mailman/listinfo/distro-pkg-dev">the mailing list</a>.
+ </body>
+</html>
+
diff --git a/netx/net/sourceforge/jnlp/resources/about.jnlp b/netx/net/sourceforge/jnlp/resources/about.jnlp
deleted file mode 100644
index 44763b6..0000000
--- a/netx/net/sourceforge/jnlp/resources/about.jnlp
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<jnlp spec="1.0" href="about.jnlp" codebase=".">
- <information>
- <title>About window for NetX</title>
- <vendor>NetX</vendor>
- <homepage href="http://jnlp.sourceforge.net/netx/"/>
- <description>Displays information about NetX</description>
- <offline/>
- </information>
- <resources>
- <j2se version="1.4+"/>
- <jar href="about.jar"/>
- </resources>
- <application-desc main-class="net.sourceforge.javaws.about.Main">
- </application-desc>
-</jnlp>
-
diff --git a/netx/net/sourceforge/jnlp/resources/itw_logo.png b/netx/net/sourceforge/jnlp/resources/itw_logo.png
new file mode 100644
index 0000000..1886f0f
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/resources/itw_logo.png
Binary files differ
diff --git a/netx/net/sourceforge/jnlp/resources/jamIcon.jpg b/netx/net/sourceforge/jnlp/resources/jamIcon.jpg
new file mode 100644
index 0000000..6a827c7
--- /dev/null
+++ b/netx/net/sourceforge/jnlp/resources/jamIcon.jpg
Binary files differ
diff --git a/netx/net/sourceforge/jnlp/runtime/Boot.java b/netx/net/sourceforge/jnlp/runtime/Boot.java
index 76a95ce..76b89b4 100644
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java
@@ -19,6 +19,7 @@ package net.sourceforge.jnlp.runtime;
import static net.sourceforge.jnlp.runtime.Translator.R;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -31,6 +32,7 @@ import java.util.Map;
import net.sourceforge.jnlp.LaunchException;
import net.sourceforge.jnlp.Launcher;
import net.sourceforge.jnlp.ParserSettings;
+import net.sourceforge.jnlp.about.AboutDialog;
import net.sourceforge.jnlp.cache.CacheUtil;
import net.sourceforge.jnlp.cache.UpdatePolicy;
import net.sourceforge.jnlp.security.viewer.CertificateViewer;
@@ -58,12 +60,6 @@ public final class Boot implements PrivilegedAction<Void> {
public static final String name = Boot.class.getPackage().getImplementationTitle();
public static final String version = Boot.class.getPackage().getImplementationVersion();
- /** the text to display before launching the about link */
- private static final String aboutMessage = ""
- + name + " " + version
- + "\n"
- + R("BLaunchAbout");
-
private static final String miniLicense = "\n"
+ " netx - an open-source JNLP client.\n"
+ " Copyright (C) 2001-2003 Jon A. Maxwell (JAM)\n"
@@ -83,6 +79,17 @@ public final class Boot implements PrivilegedAction<Void> {
+ " Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
+ "\n";
+ private static final String itwInfoMessage = ""
+ + name + " " + version
+ + "\n\n* "
+ + R("BAboutITW")
+ + "\n* "
+ + R("BFileInfoAuthors")
+ + "\n* "
+ + R("BFileInfoNews")
+ + "\n* "
+ + R("BFileInfoCopying");
+
private static final String helpMessage = "\n"
+ "Usage: " + R("BOUsage") + "\n"
+ " " + R("BOUsage2") + "\n"
@@ -143,8 +150,21 @@ public final class Boot implements PrivilegedAction<Void> {
System.exit(0);
}
- if (null != getOption("-about"))
- System.out.println(aboutMessage);
+ if (null != getOption("-about")) {
+ System.out.println(itwInfoMessage);
+ if (null != getOption("-headless")) {
+ System.exit(0);
+ } else {
+ System.out.println(R("BLaunchAbout"));
+ try {
+ AboutDialog.display();
+ return;
+ } catch (IOException e) {
+ System.out.println(R("BLaunchAboutFailure"));
+ throw new RuntimeException(e);
+ }
+ }
+ }
if (null != getOption("-verbose"))
JNLPRuntime.setDebug(true);
@@ -234,33 +254,6 @@ public final class Boot implements PrivilegedAction<Void> {
}
/**
- * Returns the location of the about.jnlp file or null if this file
- * does not exist.
- */
- private static String getAboutFile() {
- ClassLoader cl = Boot.class.getClassLoader();
- if (cl == null) {
- cl = ClassLoader.getSystemClassLoader();
- }
- try {
- //extracts full path to about.jnlp
- String s = cl.getResource("net/sourceforge/jnlp/runtime/Boot.class").toString();
- s=s.substring(0,s.indexOf("!"));
- s=s.substring(s.indexOf(":")+1);
- s=s.substring(s.indexOf(":")+1);
- s="file://"+s.replace("netx.jar","about.jnlp");
- if (JNLPRuntime.isDebug()){
- System.out.println("Using " + s + " as about.jnlp URL");
- }
-
- return s;
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
* Returns the url of file to open; does not return if no file was
* specified, or if the file location was invalid.
*/
@@ -268,15 +261,6 @@ public final class Boot implements PrivilegedAction<Void> {
String location = getJNLPFile();
- // override -jnlp with aboutFile
- if (getOption("-about") != null) {
- location = getAboutFile();
- if (location == null)
- fatalError(R("RNoAboutJnlp"));
- } else {
- location = getJNLPFile();
- }
-
if (location == null) {
System.out.println(helpMessage);
System.exit(1);