summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-11-05 17:22:51 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-11-05 17:22:51 +0000
commit8171050e1b21733a5e55ce97ebc9134f6afb1abb (patch)
tree974fbcc2723e367339e67db86e8e736aad9990b8
parent2cf6fcb31e85b0e3b367121219932ec86b205da8 (diff)
downloadmocca-8171050e1b21733a5e55ce97ebc9134f6afb1abb.tar.gz
mocca-8171050e1b21733a5e55ce97ebc9134f6afb1abb.tar.bz2
mocca-8171050e1b21733a5e55ce97ebc9134f6afb1abb.zip
java.awt.Desktop BROWSE for help and hashdatadisplay
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@152 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java2
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java35
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java6
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java27
-rw-r--r--BKUApplet/src/test/resources/appletTest.html2
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java1
-rw-r--r--BKUOnline/src/main/webapp/helpfiles/index.html2
7 files changed, 50 insertions, 25 deletions
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
index 2141165b..cf842d55 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
@@ -199,7 +199,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
//if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) {
URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId);
log.debug("register SignRequestHandler for HashDataURL " + hashDataURL);
- addRequestHandler(SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL));
+ addRequestHandler(SignRequest.class, new ExternalDisplaySignRequestHandler(hashDataURL)); //
}
}
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
index 4040431f..743dc7ef 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
@@ -18,30 +18,45 @@
package at.gv.egiz.bku.online.applet;
import at.gv.egiz.bku.gui.AbstractHelpListener;
-import java.applet.AppletContext;
+import java.awt.Desktop;
import java.net.URL;
import java.util.Locale;
/**
- *
+ * Now uses java.awt.Desktop, which deprecates
+ * the distinction between local and applet help listener
+ * TODO: integrate in AbstractHelpListener
+ *
+ * @deprecated
* @author clemens
*/
public class AppletHelpListener extends AbstractHelpListener {
- protected AppletContext ctx;
+// protected AppletContext ctx;
+ protected Desktop desktop;
- public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
+ public AppletHelpListener(URL helpURL, Locale locale) {
super(helpURL, locale);
- if (ctx == null) {
- throw new RuntimeException("no applet context provided");
+// if (ctx == null) {
+// throw new RuntimeException("no applet context provided");
+// }
+// this.ctx = ctx;
+ if (Desktop.isDesktopSupported()) {
+ this.desktop = Desktop.getDesktop();
}
- this.ctx = ctx;
}
@Override
public void showDocument(URL helpDocument) throws Exception {
- ctx.showDocument(helpDocument, "_blank");
+// ctx.showDocument(helpDocument, "_blank");
+ if (desktop == null) {
+ log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
+ } else {
+ if (!desktop.isSupported(Desktop.Action.BROWSE)) {
+ log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
+ } else {
+ Desktop.getDesktop().browse(helpDocument.toURI());
+ }
+ }
}
-
-
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 4eab7e89..482273b0 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -16,14 +16,10 @@
*/
package at.gv.egiz.bku.online.applet;
-import at.gv.egiz.bku.smccstal.AbstractBKUWorker;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;
import javax.swing.JApplet;
@@ -105,7 +101,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
log.debug("setting locale to " + getLocale());
BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle);
- AppletHelpListener helpListener = new AppletHelpListener(getAppletContext(), helpURL, getLocale());
+ AppletHelpListener helpListener = new AppletHelpListener(helpURL, getLocale()); //getAppletContext(),
gui.init(getContentPane(), getLocale(), backgroundImgURL, helpListener);
worker = new AppletBKUWorker(gui, getAppletContext(), this);
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
index 2c9fde71..e4567a6c 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
@@ -17,7 +17,6 @@
package at.gv.egiz.bku.online.applet;
-import java.applet.AppletContext;
import java.net.URL;
import java.util.List;
@@ -26,28 +25,42 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.smccstal.SignRequestHandler;
import at.gv.egiz.stal.signedinfo.ReferenceType;
+import java.awt.Desktop;
/**
*
- * @author clemens
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
public class ExternalDisplaySignRequestHandler extends SignRequestHandler {
private static final Log log = LogFactory.getLog(ExternalDisplaySignRequestHandler.class);
- AppletContext ctx;
- URL hashDataURL;
+// AppletContext ctx;
+ protected URL hashDataURL;
+ protected Desktop desktop;
- public ExternalDisplaySignRequestHandler(AppletContext ctx, URL hashDataURL) {
- this.ctx = ctx;
+ public ExternalDisplaySignRequestHandler(URL hashDataURL) {
+// this.ctx = ctx;
this.hashDataURL = hashDataURL;
+ if (Desktop.isDesktopSupported()) {
+ desktop = Desktop.getDesktop();
+ }
}
@Override
public void displayHashDataInputs(List<ReferenceType> signedReferences) throws Exception {
//TODO pass reference Id's to servlet (TODO servlet)
log.debug("displaying hashdata inputs at " + hashDataURL);
- ctx.showDocument(hashDataURL, "_blank");
+// ctx.showDocument(hashDataURL, "_blank");
+ if (desktop == null) {
+ log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
+ } else {
+ if (!desktop.isSupported(Desktop.Action.BROWSE)) {
+ log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
+ } else {
+ Desktop.getDesktop().browse(hashDataURL.toURI());
+ }
+ }
}
}
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index daf8445b..5aec1998 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -23,7 +23,7 @@
<param name="GuiStyle" value="advanced"/>
<param name="Background" value="http://localhost:3495/DemoIntegration/mocca_background.png"/>
<param name="WSDL_URL" value="http://localhost:3495/stal?wsdl"/>
- <param name="HelpURL" value="http://localhost:3495/help"/>
+ <param name="HelpURL" value="http://localhost:3495/help/"/>
<param name="HashDataDisplay" value="internal"/>
<!--param name="HashDataURL" value="http://localhost:3495/BKUOnline-1.0-SNAPSHOT/hashDataInput"/-->
<param name="SessionId" value="TestSession"/>
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
index e32c9c3d..2251a474 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -25,6 +25,7 @@ import java.util.Locale;
/**
*
+ * @deprecated see AppletHelpListener
* @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
public class LocalHelpListener extends AbstractHelpListener {
diff --git a/BKUOnline/src/main/webapp/helpfiles/index.html b/BKUOnline/src/main/webapp/helpfiles/index.html
index 84db59c6..49aaed66 100644
--- a/BKUOnline/src/main/webapp/helpfiles/index.html
+++ b/BKUOnline/src/main/webapp/helpfiles/index.html
@@ -11,7 +11,7 @@
</head>
<body>
- <h2>No help item provided</h2>
+ <h2>Default help page if no help item is provided</h2>
</body>
</html>