diff options
Diffstat (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java')
-rw-r--r-- | BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java | 98 |
1 files changed, 54 insertions, 44 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java index 48b641e2..171d24b8 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java @@ -1,44 +1,54 @@ -package at.gv.egiz.bku.gui;
-
-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 Thomas Zefferer <thomas.zefferer@iaik.tugraz.at>
- */
-public class SwitchFocusListener implements ActionListener {
-
- protected final static Log log = LogFactory.getLog(SwitchFocusListener.class);
-
- protected AppletContext ctx;
- protected String javascriptFunction;
-
- public SwitchFocusListener(AppletContext ctx, String javascriptFunction) {
-
- this.ctx = ctx;
- this.javascriptFunction = javascriptFunction;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- try {
- ctx.showDocument
- (new URL("javascript:" + javascriptFunction));
- }
- catch (MalformedURLException me) {
-
- log.warn("Unable to call external javascript function.", me);
- }
-
-
- }
-
-}
+package at.gv.egiz.bku.gui; + +import java.applet.AppletContext; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Thomas Zefferer <thomas.zefferer@iaik.tugraz.at> + */ +public class SwitchFocusListener implements ActionListener { + + private final Logger log = LoggerFactory.getLogger(SwitchFocusListener.class); + + protected String functionName; + protected AppletContext ctx; + protected String javascriptFunction; + + public SwitchFocusListener(AppletContext ctx, String javascriptFunctionName) { + + this.ctx = ctx; + this.functionName = javascriptFunctionName; + buildJSFunction(); + } + + @Override + public void actionPerformed(ActionEvent e) { + + log.debug("SwitchFocusListener fires!"); + + try { + ctx.showDocument + (new URL("javascript:" + javascriptFunction)); + } + catch (MalformedURLException me) { + + log.warn("Unable to call external javascript function.", me); + } + + + } + + protected void buildJSFunction() { + + this.javascriptFunction = functionName + "()"; + + } + +} |