diff options
Diffstat (limited to 'BKUApplet/src/main/java')
-rw-r--r-- | BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java | 2 | ||||
-rw-r--r-- | BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java | 38 |
2 files changed, 9 insertions, 31 deletions
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 b4407b22..4b49c5d5 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 @@ -90,7 +90,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { try { URL helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID)); // helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale()); - helpListener = new DefaultHelpListener(helpURL, getLocale()); + helpListener = new DefaultHelpListener(getAppletContext(), helpURL, getLocale()); } catch (MalformedURLException ex) { log.warn("failed to load help URL, disabling help: " + ex.getMessage()); } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java index 9876ef7e..6eec5665 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java @@ -16,49 +16,28 @@ */ package at.gv.egiz.bku.online.applet; +import at.gv.egiz.bku.gui.HelpViewer; import at.gv.egiz.bku.gui.AbstractHelpListener; -import at.gv.egiz.bku.gui.ViewerDialog; -import java.io.InputStream; +import java.applet.AppletContext; import java.net.URL; -import java.net.URLConnection; import java.util.Locale; import javax.swing.SwingUtilities; /** - * This class depends on BKU utils, and therefore is not part of BKUCommonGUI * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ public class DefaultHelpListener extends AbstractHelpListener { - public DefaultHelpListener(URL helpURL, Locale locale) { + protected AppletContext ctx; + + public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) { super(helpURL, locale); + this.ctx = ctx; } @Override - public void showDocument(URL helpURL, final String helpTopic) throws Exception { - log.debug("open connection " + helpURL); - URLConnection conn = helpURL.openConnection(); - - log.debug("show help document " + conn.getContentType()); // + ";" + conn.getContentEncoding()); - -// Charset cs; -// if (conn.getContentEncoding() == null) { -// cs = Charset.forName("UTF-8"); -// } else { -// try { -// cs = Charset.forName(conn.getContentEncoding()); -// } catch (Exception ex) { -// log.debug("charset " + conn.getContentEncoding() + " not supported, assuming UTF-8: " + ex.getMessage()); -// cs = Charset.forName("UTF-8"); -// } -// } - -// InputStreamReader isr = new InputStreamReader(conn.getInputStream(), cs); -// final Reader content = new BufferedReader(isr); - final InputStream content = conn.getInputStream(); - final String mimeType = conn.getContentType(); - + public void showDocument(final URL helpURL, final String helpTopic) throws Exception { log.debug("schedule help dialog"); SwingUtilities.invokeLater(new Runnable() { @@ -68,10 +47,9 @@ public class DefaultHelpListener extends AbstractHelpListener { log.debug("show help dialog"); - ViewerDialog.showHelp(null, helpTopic, content, mimeType, messages); + HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages); } }); -// gui.showHelpDialog(helpDocument.getStream(), mimetype, encoding); } } |