From caca721368d8c24559b1cd5ea2018884b4874f6b Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 10 Nov 2009 15:30:16 +0000 Subject: Removed switchFocusListener due to problem with viewer/help dialogs on Firefox/Mac git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@539 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 5 +---- .../bku/online/applet/viewer/URLFontLoader.java | 8 +++---- .../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 18 +++++++-------- .../at/gv/egiz/bku/gui/SecureViewerDialog.java | 15 ++++++------- .../at/gv/egiz/bku/gui/SwitchFocusListener.java | 4 ++-- BKUOnline/src/main/webapp/applet.jsp | 26 +--------------------- .../gv/egiz/bku/smccstal/AbstractPINProvider.java | 4 ++-- .../gv/egiz/bku/smccstal/PINProviderFactory.java | 5 +++++ 8 files changed, 31 insertions(+), 54 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 2094e55c..895fdbb5 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 @@ -187,9 +187,6 @@ public class BKUApplet extends JApplet { log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help"); } - SwitchFocusListener switchFocusListener = new SwitchFocusListener( - getAppletContext(), "focusToBrowser()"); - // Note: We need a panel in order to be able to set the background // properly. // Setting the background without a panel has side effects with the @@ -212,7 +209,7 @@ public class BKUApplet extends JApplet { URLFontLoader fontProvider = new URLFontLoader(getCodeBase()); fontProvider.loadInBackground(); BKUGUIFacade gui = createGUI(contentPanel, getLocale(), guiStyle, - backgroundImgURL, fontProvider, helpListener, switchFocusListener); + backgroundImgURL, fontProvider, helpListener, null); worker = createBKUWorker(this, gui); } catch (MalformedURLException ex) { diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java index f914aed7..49615887 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java @@ -41,13 +41,13 @@ public class URLFontLoader extends SwingWorker implements FontProv public URLFontLoader(URL codebase) throws MalformedURLException { this.fontURL = new URL(codebase, SANSMONO_FONT_RESOURCE); if (log.isDebugEnabled()) { - log.debug(Thread.currentThread() + " setting font load URL: " + fontURL); + log.debug("[" + Thread.currentThread().getName() + "] setting font load URL: " + fontURL); } } public void loadInBackground() { if (log.isDebugEnabled()) { - log.debug(Thread.currentThread() + " scheduling font loading in background: " + fontURL); + log.debug("[" + Thread.currentThread().getName() + "] scheduling font loading in background: " + fontURL); } this.execute(); } @@ -55,7 +55,7 @@ public class URLFontLoader extends SwingWorker implements FontProv @Override protected Font doInBackground() throws MalformedURLException, FontFormatException, IOException { if (log.isDebugEnabled()) { - log.debug(Thread.currentThread() + " loading font in background..."); + log.debug("[" + Thread.currentThread().getName() + "] loading font in background..."); } return Font.createFont(Font.TRUETYPE_FONT, fontURL.openStream()); } @@ -67,7 +67,7 @@ public class URLFontLoader extends SwingWorker implements FontProv */ @Override public Font getFont() throws FontProviderException { - log.debug(Thread.currentThread() + " get font"); + log.debug("[" + Thread.currentThread().getName() + "] get font (EDT?)"); try { return get(); } catch (InterruptedException ex) { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java index 8df4bd72..34f278fb 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java @@ -159,7 +159,7 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public void run() { - log.debug("initializing gui [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] initializing gui"); if (renderIconPanel) { initIconPanel(background); @@ -565,7 +565,7 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public void run() { - log.debug("show card-pin dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show card-pin dialog"); mainPanel.removeAll(); buttonPanel.removeAll(); @@ -758,7 +758,7 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public void run() { - log.debug("show pinpad signature-pin dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show pinpad signature-pin dialog"); mainPanel.removeAll(); buttonPanel.removeAll(); @@ -927,7 +927,7 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public void run() { - log.debug("show signature-pin dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show signature-pin dialog"); mainPanel.removeAll(); buttonPanel.removeAll(); @@ -1215,7 +1215,7 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public void run() { - log.debug("show message dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show message dialog"); mainPanel.removeAll(); buttonPanel.removeAll(); @@ -1385,7 +1385,7 @@ public class BKUGUIImpl implements BKUGUIFacade { backListener, backCommand); } else if (dataToBeSigned.size() == 1) { try { - log.debug("scheduling secure viewer"); + log.debug("[" + Thread.currentThread().getName() + "] scheduling secure viewer"); SwingUtilities.invokeLater(new Runnable() { @@ -1419,7 +1419,7 @@ public class BKUGUIImpl implements BKUGUIFacade { */ private void showSecureViewer(HashDataInput dataToBeSigned) throws FontProviderException { - log.debug("show secure viewer [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show secure viewer"); if (secureViewer == null) { secureViewer = new SecureViewerDialog(null, messages, fontProvider, helpMouseListener.getActionListener()); @@ -1439,14 +1439,14 @@ public class BKUGUIImpl implements BKUGUIFacade { private void showSignedReferencesListDialog(final List signedReferences, final ActionListener backListener, final String backCommand) { - log.debug("scheduling signed references list dialog"); + log.debug("[" + Thread.currentThread().getName() + "] scheduling signed references list dialog"); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - log.debug("show signed references list dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show signed references list dialog"); mainPanel.removeAll(); buttonPanel.removeAll(); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java index c0b14a85..878a998b 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java @@ -54,8 +54,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.LayoutStyle; import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.text.DefaultEditorKit; import javax.swing.text.Document; import javax.swing.text.EditorKit; import javax.swing.text.StyledEditorKit; @@ -73,7 +71,6 @@ public class SecureViewerDialog extends JDialog implements ActionListener { * BKUApplet includes BKUFonts as runtime dependency only, the jar is copied to the applet dir in BKUOnline with dependency-plugin * BKUViewer has compile dependency BKUFonts, transitive in BKUOnline and BKULocal */ - public static final String PLAINTEXT_FONT_RESOURCE = "DejaVuSansMono.ttf"; public static final Dimension VIEWER_DIMENSION = new Dimension(600, 400); protected static final Log log = LogFactory.getLog(SecureViewerDialog.class); // private static SecureViewerDialog dialog; @@ -227,6 +224,8 @@ public class SecureViewerDialog extends JDialog implements ActionListener { */ public void setContent(HashDataInput hashDataInput) { //throws FontProviderException { + log.debug("[" + Thread.currentThread().getName() + "] set viewer content"); + this.content = null; viewer.setText(null); @@ -285,6 +284,7 @@ public class SecureViewerDialog extends JDialog implements ActionListener { viewerLabel.setText(""); } + log.debug("VIEWER FONT: " + viewer.getFont()); setVisible(true); toFront(); } @@ -320,12 +320,11 @@ public class SecureViewerDialog extends JDialog implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if ("close".equals(e.getActionCommand())) { -// SecureViewerDialog.dialog.setVisible(false); - log.trace(Thread.currentThread() + " closing secure viewer"); + log.trace("[" + Thread.currentThread().getName() + "] closing secure viewer"); setVisible(false); log.trace("secure viewer closed"); } else if ("save".equals(e.getActionCommand())) { - log.trace(Thread.currentThread() + " display secure viewer save dialog"); + log.trace("[" + Thread.currentThread().getName() + "] display secure viewer save dialog"); showSaveDialog(content, null, null); log.trace("done secure viewer save"); } else { @@ -336,14 +335,14 @@ public class SecureViewerDialog extends JDialog implements ActionListener { private void showSaveDialog(final HashDataInput hashDataInput, final ActionListener okListener, final String okCommand) { - log.debug("scheduling save dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] scheduling save dialog"); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - log.debug("show save dialog [" + Thread.currentThread().getName() + "]"); + log.debug("[" + Thread.currentThread().getName() + "] show save dialog"); String userHome = System.getProperty("user.home"); 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 1e3fabbd..48b641e2 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 @@ -33,8 +33,8 @@ public class SwitchFocusListener implements ActionListener { ctx.showDocument (new URL("javascript:" + javascriptFunction)); } - catch (MalformedURLException me) { - + catch (MalformedURLException me) { + log.warn("Unable to call external javascript function.", me); } diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index df0b3ca5..423b349e 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -71,7 +71,7 @@ } %> - + - - diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractPINProvider.java index e2499023..bc52c955 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractPINProvider.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractPINProvider.java @@ -47,7 +47,7 @@ public abstract class AbstractPINProvider implements PINProvider, ActionListener this.wait(); } } catch (InterruptedException e) { - log.error("interrupt in waitForAction"); + log.error("[" + Thread.currentThread().getName() + "] interrupt in waitForAction"); throw e; } actionPerformed = false; @@ -60,7 +60,7 @@ public abstract class AbstractPINProvider implements PINProvider, ActionListener @Override public void actionPerformed(ActionEvent e) { - log.debug("command " + e.getActionCommand()); + log.debug("[" + Thread.currentThread().getName() + "] action performed - " + e.getActionCommand()); action = e.getActionCommand(); actionPerformed(); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java index 543fbb3a..e5afe0ae 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java @@ -116,7 +116,9 @@ public class PINProviderFactory { this, "secureViewer"); do { + log.debug("[" + Thread.currentThread().getName() + "] wait for action"); waitForAction(); + log.debug("[" + Thread.currentThread().getName() + "] received action"); if ("secureViewer".equals(action)) { try { @@ -169,6 +171,7 @@ public class PINProviderFactory { this, "ok", this, "cancel"); + log.debug("[" + Thread.currentThread().getName() + "] wait for action"); waitForAction(); gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, @@ -216,7 +219,9 @@ public class PINProviderFactory { PinpadSignaturePinProvider.this, "secureViewer"); while (true) { + log.debug("[" + Thread.currentThread().getName() + "] wait for action"); waitForAction(); + log.debug("[" + Thread.currentThread().getName() + "] received action"); if ("secureViewer".equals(action)) { viewer.displayDataToBeSigned(signedInfo, -- cgit v1.2.3