From 4032e46810c24dc3f013de296a2133f4651696b9 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 31 Oct 2008 15:30:34 +0000 Subject: local HelpListener card locked/not activated git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@137 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java new file mode 100644 index 00000000..68d61bef --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -0,0 +1,84 @@ +/* + * 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.gui; + +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 Orthacker + */ +public abstract class AbstractHelpListener implements ActionListener { + + protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); + protected String helpURLBase; + protected String locale; + + public AbstractHelpListener(URL baseURL, String locale) { + if (baseURL == null || "".equals(baseURL)) { + throw new RuntimeException("no help URL provided"); + } + this.helpURLBase = baseURL.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; + } + } + try { + showDocument(helpURL); + } catch (Exception ex) { + log.error("could not display help document " + helpURL + ": " + ex.getMessage()); + } + } + + private String appendParameter(String url, String paramName, String paramValue) { + if (url.indexOf('?') < 0) { + return url + "?" + paramName + "=" + paramValue; + } else { + return url + "&" + paramName + "=" + paramValue; + } + } + + public abstract void showDocument(URL helpDocument) throws Exception; + +} -- cgit v1.2.3 From 9829de9c9b19dcca15676aaf9737195cc059a66c Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 3 Nov 2008 09:37:14 +0000 Subject: local HelpListener DesktopAPI git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@138 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index 68d61bef..6e3167c1 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -21,6 +21,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.MalformedURLException; import java.net.URL; +import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,9 +33,9 @@ public abstract class AbstractHelpListener implements ActionListener { protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); protected String helpURLBase; - protected String locale; + protected Locale locale; - public AbstractHelpListener(URL baseURL, String locale) { + public AbstractHelpListener(URL baseURL, Locale locale) { if (baseURL == null || "".equals(baseURL)) { throw new RuntimeException("no help URL provided"); } @@ -49,7 +50,7 @@ public abstract class AbstractHelpListener implements ActionListener { try { String urlString = helpURLBase; if (locale != null) { - urlString = appendParameter(urlString, "locale", locale); + urlString = appendParameter(urlString, "locale", locale.toString()); } if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { urlString = appendParameter(urlString, "topic", e.getActionCommand()); -- cgit v1.2.3 From 2cf6fcb31e85b0e3b367121219932ec86b205da8 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 5 Nov 2008 14:42:05 +0000 Subject: help jsp git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@151 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 45 +++++++++------------- 1 file changed, 19 insertions(+), 26 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index 6e3167c1..a249a376 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -32,39 +32,22 @@ import org.apache.commons.logging.LogFactory; public abstract class AbstractHelpListener implements ActionListener { protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); - protected String helpURLBase; +// protected String helpURLBase; + protected URL baseURL; protected Locale locale; public AbstractHelpListener(URL baseURL, Locale locale) { if (baseURL == null || "".equals(baseURL)) { throw new RuntimeException("no help URL provided"); } - this.helpURLBase = baseURL.toString(); + this.baseURL = baseURL; 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.toString()); - } - 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; - } - } + URL helpURL = constructHelpURL(baseURL, e.getActionCommand()); try { showDocument(helpURL); } catch (Exception ex) { @@ -72,12 +55,22 @@ public abstract class AbstractHelpListener implements ActionListener { } } - private String appendParameter(String url, String paramName, String paramValue) { - if (url.indexOf('?') < 0) { - return url + "?" + paramName + "=" + paramValue; - } else { - return url + "&" + paramName + "=" + paramValue; + private URL constructHelpURL(URL baseURL, String helpItem) { + URL helpURL = baseURL; + log.trace("constructing help URL: " + helpURL); + try { + if (locale != null) { + helpURL = new URL(helpURL, locale.toString() + "/"); + log.trace("constructing help URL: " + helpURL); + } + if (helpItem != null && !"".equals(helpItem)) { + helpURL = new URL(helpURL, helpItem + ".html"); + log.trace("constructing help URL: " + helpURL); + } + } catch (MalformedURLException ex) { + log.error("Failed to construct help URL for help item " + helpItem + ": " + ex.getMessage()); } + return helpURL; } public abstract void showDocument(URL helpDocument) throws Exception; -- cgit v1.2.3 From 9662ac90b6aa84bc54543d3c8670ba6c8e42bbac Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Nov 2008 18:24:57 +0000 Subject: FRAME HashDataDisplay FRAME Help git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@165 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index a249a376..f46f5227 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package at.gv.egiz.bku.gui; import java.awt.event.ActionEvent; @@ -22,19 +21,24 @@ import java.awt.event.ActionListener; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; +import java.util.ResourceBundle; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * + * Implement the showDocument(URL) method to provide an actual HelpListener. + * This class does not keep a GUI reference and subclasses should not interfere with the GUI. + * Therefore, any errors occurring in showDocument() should be handled/displayed within + * showDocument() and exceptions thrown from showDocument() are logged, not displayed in the GUI. + * * @author Clemens Orthacker */ public abstract class AbstractHelpListener implements ActionListener { protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); -// protected String helpURLBase; protected URL baseURL; protected Locale locale; + protected ResourceBundle messages; public AbstractHelpListener(URL baseURL, Locale locale) { if (baseURL == null || "".equals(baseURL)) { @@ -42,6 +46,11 @@ public abstract class AbstractHelpListener implements ActionListener { } this.baseURL = baseURL; this.locale = locale; + if (locale != null) { + messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE, locale); + } else { + messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE); + } } @Override @@ -49,30 +58,36 @@ public abstract class AbstractHelpListener implements ActionListener { log.debug("received help action: " + e.getActionCommand()); URL helpURL = constructHelpURL(baseURL, e.getActionCommand()); try { - showDocument(helpURL); + showDocument(helpURL, e.getActionCommand()); } catch (Exception ex) { log.error("could not display help document " + helpURL + ": " + ex.getMessage()); } } - - private URL constructHelpURL(URL baseURL, String helpItem) { + + private URL constructHelpURL(URL baseURL, String helpTopic) { URL helpURL = baseURL; log.trace("constructing help URL: " + helpURL); try { if (locale != null) { helpURL = new URL(helpURL, locale.toString() + "/"); log.trace("constructing help URL: " + helpURL); - } - if (helpItem != null && !"".equals(helpItem)) { - helpURL = new URL(helpURL, helpItem + ".html"); + } + if (helpTopic != null && !"".equals(helpTopic)) { + helpURL = new URL(helpURL, helpTopic + ".html"); log.trace("constructing help URL: " + helpURL); } } catch (MalformedURLException ex) { - log.error("Failed to construct help URL for help item " + helpItem + ": " + ex.getMessage()); + log.error("Failed to construct help URL for help item " + helpTopic + ": " + ex.getMessage()); } return helpURL; } - - public abstract void showDocument(URL helpDocument) throws Exception; - + + /** + * Errors from HelpListeners should not (are not) displayed in the applet, + * but should rather be in the HelpListener specific way. + * Therefore, implementations SHOULD NOT throw exceptions (these are only logged). + * @param helpDocument + * @throws java.lang.Exception + */ + public abstract void showDocument(URL helpDocument, String helpTopic) throws Exception; } -- cgit v1.2.3 From 959130f29903568c6b7fe3d6538b33887b3b1aaf Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 27 Nov 2008 15:22:32 +0000 Subject: help viewer label removed git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@221 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index f46f5227..b871263e 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -30,6 +30,9 @@ import org.apache.commons.logging.LogFactory; * This class does not keep a GUI reference and subclasses should not interfere with the GUI. * Therefore, any errors occurring in showDocument() should be handled/displayed within * showDocument() and exceptions thrown from showDocument() are logged, not displayed in the GUI. + *
+ * The help URL is build as [baseURL]/[locale]/[helpTopic].html + * (note that no session information is contained). * * @author Clemens Orthacker */ @@ -41,7 +44,7 @@ public abstract class AbstractHelpListener implements ActionListener { protected ResourceBundle messages; public AbstractHelpListener(URL baseURL, Locale locale) { - if (baseURL == null || "".equals(baseURL)) { + if (baseURL == null || "".equals(baseURL.toString())) { throw new RuntimeException("no help URL provided"); } this.baseURL = baseURL; -- cgit v1.2.3 From 145003155c05e915b900989a27cef1271398164b Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 26 Aug 2009 17:31:32 +0000 Subject: MOCCA TLS Server CA cert installation servlet removed help.jsp (and jsp dependencies in jetty) moved html pages to src/main/webapp (encoding problem?) switch to BASIC download protocol in BKUWebStart (no jnlpDownloadServlet required, see template.xml) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@474 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/gui/AbstractHelpListener.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index b871263e..6fd1ffea 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -38,6 +38,11 @@ import org.apache.commons.logging.LogFactory; */ public abstract class AbstractHelpListener implements ActionListener { + /** + * any locale not in the list will be mapped to 'de' + */ + public static final String[] SUPPORTED_LANGUAGES = new String[] { "de" }; + protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); protected URL baseURL; protected Locale locale; @@ -71,12 +76,14 @@ public abstract class AbstractHelpListener implements ActionListener { URL helpURL = baseURL; log.trace("constructing help URL: " + helpURL); try { - if (locale != null) { - helpURL = new URL(helpURL, locale.toString() + "/"); - log.trace("constructing help URL: " + helpURL); - } + // not localized for now + //check if locale.getLanguage() supported and add default if not +// if (locale != null) { +// helpURL = new URL(helpURL, locale.toString() + "/"); +// log.trace("constructing help URL: " + helpURL); +// } if (helpTopic != null && !"".equals(helpTopic)) { - helpURL = new URL(helpURL, helpTopic + ".html"); + helpURL = new URL(helpURL, "de/" + helpTopic + ".html"); log.trace("constructing help URL: " + helpURL); } } catch (MalformedURLException ex) { -- cgit v1.2.3