summaryrefslogtreecommitdiff
path: root/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-31 15:30:34 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-31 15:30:34 +0000
commit4032e46810c24dc3f013de296a2133f4651696b9 (patch)
tree2c81a1a0f3ddec6b9901c61d7fb887b418d8e3a6 /BKUApplet/src/main/java/at/gv/egiz/bku/online/applet
parent35096aca11df113631a982554e85a22fff350813 (diff)
downloadmocca-4032e46810c24dc3f013de296a2133f4651696b9.tar.gz
mocca-4032e46810c24dc3f013de296a2133f4651696b9.tar.bz2
mocca-4032e46810c24dc3f013de296a2133f4651696b9.zip
local HelpListener
card locked/not activated git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@137 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUApplet/src/main/java/at/gv/egiz/bku/online/applet')
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java46
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java4
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java83
3 files changed, 48 insertions, 85 deletions
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
new file mode 100644
index 00000000..a0305eb4
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.online.applet;
+
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import java.applet.AppletContext;
+import java.net.URL;
+
+/**
+ *
+ * @author clemens
+ */
+public class AppletHelpListener extends AbstractHelpListener {
+
+ protected AppletContext ctx;
+
+ public AppletHelpListener(AppletContext ctx, URL helpURL, String locale) {
+ super(helpURL, locale);
+ if (ctx == null) {
+ throw new RuntimeException("no applet context provided");
+ }
+ this.ctx = ctx;
+ }
+
+ @Override
+ public void showDocument(URL helpDocument) throws Exception {
+ ctx.showDocument(helpDocument, "_blank");
+ }
+
+
+}
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 470534da..2b0188bb 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
@@ -82,10 +82,10 @@ public class BKUApplet extends JApplet {
}
String guiStyle = getMyAppletParameter(GUI_STYLE);
BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle);
- ExternalHelpListener helpListener = null;
+ AppletHelpListener helpListener = null;
try {
URL helpURL = getMyAppletParameterURL(HELP_URL);
- helpListener = new ExternalHelpListener(getAppletContext(), helpURL, localeString);
+ helpListener = new AppletHelpListener(getAppletContext(), helpURL, localeString);
} catch (MalformedURLException ex) {
log.error("invalid help URL: " + ex.getMessage());
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
deleted file mode 100644
index f92a6963..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.online.applet;
-
-import java.applet.AppletContext;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author clemens
- */
-public class ExternalHelpListener implements ActionListener {
-
- protected final static Log log = LogFactory.getLog(ExternalHelpListener.class);
- protected AppletContext ctx;
- protected String helpURLBase;
- protected String locale;
-
- public ExternalHelpListener(AppletContext ctx, URL helpURL, String locale) {
- if (ctx == null) {
- throw new RuntimeException("no applet context provided");
- }
- if (helpURL == null || "".equals(helpURL)) {
- throw new RuntimeException("no help URL provided");
- }
- this.ctx = ctx;
- this.helpURLBase = helpURL.toString();
- this.locale = locale;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- log.debug("received help action: " + e.getActionCommand());
- URL helpURL;
- try {
- String urlString = helpURLBase;
- if (locale != null) {
- urlString = appendParameter(urlString, "locale", locale);
- }
- if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
- urlString = appendParameter(urlString, "topic", e.getActionCommand());
- }
- helpURL = new URL(urlString);
- } catch (MalformedURLException ex) {
- try {
- log.error("failed to create help URL: " + ex.getMessage());
- helpURL = new URL(helpURLBase);
- } catch (MalformedURLException ex1) {
- log.error("failed to create default help URL, requested help will not be displayed");
- return;
- }
- }
- ctx.showDocument(helpURL, "_blank");
- }
-
- private String appendParameter(String url, String paramName, String paramValue) {
- if (url.indexOf('?') < 0) {
- return url + "?" + paramName + "=" + paramValue;
- } else {
- return url + "&" + paramName + "=" + paramValue;
- }
- }
-}