From 3de114f63e762efc028aea8a935f0a1e1b6b2ed7 Mon Sep 17 00:00:00 2001 From: tkellner Date: Mon, 8 Apr 2013 18:41:20 +0000 Subject: Get rid of switchFocus Label / Listener git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1164 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 12 +- .../egiz/bku/online/applet/ActivationApplet.java | 6 +- .../bku/online/applet/GetCertificateApplet.java | 7 +- .../egiz/bku/online/applet/HardwareInfoApplet.java | 7 +- .../egiz/bku/online/applet/IdentityLinkApplet.java | 7 +- .../bku/online/applet/PINManagementApplet.java | 7 +- .../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 201 +++------------------ .../gv/egiz/bku/gui/SwitchFocusFocusListener.java | 68 ------- .../at/gv/egiz/bku/gui/SwitchFocusListener.java | 78 -------- .../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +- .../java/at/gv/egiz/bku/gui/ActivationGUI.java | 5 +- .../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 5 +- .../java/at/gv/egiz/bku/gui/GetCertificateGUI.java | 4 +- .../at/gv/egiz/bku/gui/GetHardwareInfoGUI.java | 4 +- .../java/at/gv/egiz/bku/gui/IdentityLinkGUI.java | 10 +- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 26 +-- .../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 2 +- .../local/stal/LocalGetCertificateSTALFactory.java | 3 +- .../stal/LocalGetHardwareInfoSTALFactory.java | 3 +- .../local/stal/LocalIdentityLinkSTALFactory.java | 3 +- .../gv/egiz/bku/local/stal/LocalSTALFactory.java | 3 +- BKUOnline/src/main/webapp/applet.jsp | 3 - 22 files changed, 65 insertions(+), 401 deletions(-) delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java 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 495b9726..8ae1471b 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 @@ -56,7 +56,6 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; import at.gv.egiz.bku.gui.BKUGUIImpl; import at.gv.egiz.bku.gui.HelpListener; -import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.viewer.FontProvider; import at.gv.egiz.bku.online.applet.viewer.URLFontLoader; import at.gv.egiz.smcc.SignatureCardFactory; @@ -219,10 +218,6 @@ public class BKUApplet extends JApplet { log.warn("Cannot set help URL. {}", e.getMessage()); } - SwitchFocusListener switchFocusListener = new SwitchFocusListener( - getAppletContext(), "focusToBrowser"); - - //ViewerHelpListener example: // try { // String absoluteHelpURL = new URL(getCodeBase(), getParameter(HELP_URL)).toString(); @@ -261,7 +256,7 @@ public class BKUApplet extends JApplet { System.err.println("invalid font provider URL " + ex.getMessage()); } gui = createGUI(contentPanel, getLocale(), guiStyle, - backgroundImgURL, fontProvider, helpListener, switchFocusListener); + backgroundImgURL, fontProvider, helpListener); worker = createBKUWorker(this, gui); } @@ -300,10 +295,9 @@ public class BKUApplet extends JApplet { // /////////////////////////////////////////////////////////////////////////// protected BKUGUIFacade createGUI(Container contentPane, Locale locale, Style guiStyle, URL backgroundImgURL, - FontProvider fontProvider, HelpListener helpListener, - SwitchFocusListener switchFocusListener) { + FontProvider fontProvider, HelpListener helpListener) { return new BKUGUIImpl(contentPane, locale, guiStyle, backgroundImgURL, - fontProvider, helpListener, switchFocusListener); + fontProvider, helpListener); } protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) { diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java index a7692b79..99b2765e 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -26,7 +26,6 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.ActivationGUI; import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.viewer.FontProvider; @@ -96,8 +95,7 @@ public class ActivationApplet extends BKUApplet { Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, - SwitchFocusListener switchFocusListener) { - return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); + HelpListener helpListener) { + return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener); } } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GetCertificateApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GetCertificateApplet.java index 06b7f249..2674ea8f 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GetCertificateApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GetCertificateApplet.java @@ -31,7 +31,6 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.GetCertificateGUI; import at.gv.egiz.bku.gui.GetCertificateGUIFacade; import at.gv.egiz.bku.gui.HelpListener; -import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.viewer.FontProvider; /** @@ -46,11 +45,9 @@ public class GetCertificateApplet extends BKUApplet { @Override protected BKUGUIFacade createGUI(Container contentPane, Locale locale, BKUGUIFacade.Style guiStyle, URL backgroundImgURL, - FontProvider fontProvider, HelpListener helpListener, - SwitchFocusListener switchFocusListener) { + FontProvider fontProvider, HelpListener helpListener) { return new GetCertificateGUI(contentPane, locale, - backgroundImgURL, fontProvider, helpListener, - switchFocusListener); + backgroundImgURL, fontProvider, helpListener); } @Override diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java index 18397613..1678bd73 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java @@ -31,7 +31,6 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.GetHardwareInfoGUI; import at.gv.egiz.bku.gui.GetHardwareInfoGUIFacade; import at.gv.egiz.bku.gui.HelpListener; -import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.viewer.FontProvider; /** @@ -45,11 +44,9 @@ public class HardwareInfoApplet extends BKUApplet { @Override protected BKUGUIFacade createGUI(Container contentPane, Locale locale, BKUGUIFacade.Style guiStyle, URL backgroundImgURL, - FontProvider fontProvider, HelpListener helpListener, - SwitchFocusListener switchFocusListener) { + FontProvider fontProvider, HelpListener helpListener) { return new GetHardwareInfoGUI(contentPane, locale, - backgroundImgURL, fontProvider, helpListener, - switchFocusListener); + backgroundImgURL, fontProvider, helpListener); } @Override diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java index 279a16fa..75c7c8eb 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java @@ -32,7 +32,6 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.IdentityLinkGUI; import at.gv.egiz.bku.gui.IdentityLinkGUIFacade; -import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.viewer.FontProvider; /** @@ -45,11 +44,9 @@ private static final long serialVersionUID = 1L; @Override protected BKUGUIFacade createGUI(Container contentPane, Locale locale, BKUGUIFacade.Style guiStyle, URL backgroundImgURL, - FontProvider fontProvider, HelpListener helpListener, - SwitchFocusListener switchFocusListener) { + FontProvider fontProvider, HelpListener helpListener) { return new IdentityLinkGUI(contentPane, locale, - backgroundImgURL, fontProvider, helpListener, - switchFocusListener); + backgroundImgURL, fontProvider, helpListener); } @Override diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java index c1b7c3a2..cff2c5c5 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java @@ -28,7 +28,6 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.PINManagementGUI; import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.viewer.FontProvider; import java.awt.Container; import java.net.URL; @@ -45,11 +44,9 @@ public class PINManagementApplet extends BKUApplet { @Override protected BKUGUIFacade createGUI(Container contentPane, Locale locale, BKUGUIFacade.Style guiStyle, URL backgroundImgURL, - FontProvider fontProvider, HelpListener helpListener, - SwitchFocusListener switchFocusListener) { + FontProvider fontProvider, HelpListener helpListener) { return new PINManagementGUI(contentPane, locale, - backgroundImgURL, fontProvider, helpListener, - switchFocusListener); + backgroundImgURL, fontProvider, helpListener); } @Override 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 a44ceb82..c75bd0eb 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 @@ -93,7 +93,6 @@ public class BKUGUIImpl implements BKUGUIFacade { protected SecureViewerDialog secureViewer; protected HelpListener helpListener; - protected SwitchFocusFocusListener switchFocusKeyListener; protected FontProvider fontProvider; protected Container contentPane; @@ -110,7 +109,6 @@ public class BKUGUIImpl implements BKUGUIFacade { protected JLabel titleLabel; protected JLabel msgTitleLabel; protected JLabel helpLabel; - protected JLabel switchFocusDummyLabel; /** remember the pinfield to return to worker */ protected JPasswordField pinField; protected Document pinpadPIN; @@ -171,7 +169,7 @@ public class BKUGUIImpl implements BKUGUIFacade { */ public BKUGUIImpl(Container contentPane, Locale locale, Style guiStyle, URL background, FontProvider fontProvider, - HelpListener helpListener, SwitchFocusListener switchFocusListener) { + HelpListener helpListener) { this.contentPane = contentPane; Window w = SwingUtilities.getWindowAncestor(contentPane); if (w != null && w instanceof JFrame) { @@ -209,8 +207,6 @@ public class BKUGUIImpl implements BKUGUIFacade { // ensure that buttons can be fired with enter key too UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); - registerSwitchFocusListener(switchFocusListener); - this.fontProvider = fontProvider; this.helpListener = helpListener; createGUI(background); @@ -387,14 +383,6 @@ public class BKUGUIImpl implements BKUGUIFacade { helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } - // This is a hidden label. When it gains focus, it hands over focus to - // the web browser - switchFocusDummyLabel = new JLabel(); - switchFocusDummyLabel.setText(""); - switchFocusDummyLabel.setName(SWITCH_FOCUS_DUMMY_LABEL_NAME); - switchFocusDummyLabel.setFocusable(true); - switchFocusDummyLabel.addFocusListener(switchFocusKeyListener); - buttonSize = initButtonSize(); baseButtonSize = buttonSize; @@ -429,9 +417,6 @@ public class BKUGUIImpl implements BKUGUIFacade { verticalHeader.addComponent(helpLabel); } - horizontalHeader.addComponent(switchFocusDummyLabel); - verticalHeader.addComponent(switchFocusDummyLabel); - headerPanelLayout.setHorizontalGroup(horizontalHeader); headerPanelLayout.setVerticalGroup(verticalHeader); } @@ -515,9 +500,6 @@ public class BKUGUIImpl implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); - // avoid that dummy label gains focus during load - switchFocusDummyLabel.setFocusable(false); - if (renderHeaderPanel) { if (numRetries < 0) { String verifyTitle = getMessage(TITLE_VERIFY_PIN); @@ -561,18 +543,6 @@ public class BKUGUIImpl implements BKUGUIFacade { } }); - pinField.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - // focus has been set accordingly - re-enable dummy - // label - switchFocusDummyLabel.setFocusable(true); - } - - }); - infoLabel = new JLabel(); if (numRetries < 0) { infoLabel.setFont(infoLabel.getFont().deriveFont( @@ -633,8 +603,6 @@ public class BKUGUIImpl implements BKUGUIFacade { Short.MAX_VALUE).addComponent(helpLabel); infoVertical.addComponent(helpLabel); } - infoHorizontal.addComponent(switchFocusDummyLabel); - infoVertical.addComponent(switchFocusDummyLabel); } // align pinfield and pinsize to the right @@ -811,9 +779,6 @@ public class BKUGUIImpl implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); - // avoid that dummy label gains focus during load - switchFocusDummyLabel.setFocusable(false); - if (renderHeaderPanel) { if (retries < 0) { titleLabel.setText(getMessage(titleKey)); @@ -885,8 +850,6 @@ public class BKUGUIImpl implements BKUGUIFacade { Short.MAX_VALUE).addComponent(helpLabel); infoVertical.addComponent(helpLabel); } - infoHorizontal.addComponent(switchFocusDummyLabel); - infoVertical.addComponent(switchFocusDummyLabel); } @@ -961,18 +924,6 @@ public class BKUGUIImpl implements BKUGUIFacade { infoLabel.setFocusable(true); - infoLabel.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - // focus has been set accordingly - re-enable dummy - // label - switchFocusDummyLabel.setFocusable(true); - } - - }); - String accessibleData = cutOffHTMLTags(infoLabel.getText()) + cutOffHTMLTags(pinLabel.getText()) + cutOffHTMLTags(pinsizeLabel.getText()); @@ -1053,9 +1004,6 @@ public class BKUGUIImpl implements BKUGUIFacade { .setFocusTraversalPolicy(new AdvancedShowSigDataGUIFocusTraversalPolicy()); } - // avoid that dummy label gains focus during load - switchFocusDummyLabel.setFocusable(false); - if (renderHeaderPanel) { titleLabel.setText(getMessage(TITLE_SIGNATURE_DATA)); } @@ -1141,8 +1089,6 @@ public class BKUGUIImpl implements BKUGUIFacade { Short.MAX_VALUE).addComponent(helpLabel); infoVertical.addComponent(helpLabel); } - infoHorizontal.addComponent(switchFocusDummyLabel); - infoVertical.addComponent(switchFocusDummyLabel); } @@ -1156,18 +1102,6 @@ public class BKUGUIImpl implements BKUGUIFacade { enterPINButton.setActionCommand(enterPINCommand); enterPINButton.addActionListener(enterPINListener); - enterPINButton.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - // focus has been set accordingly - re-enable dummy - // label - switchFocusDummyLabel.setFocusable(true); - } - - }); - if (renderCancelButton) { cancelButton.setFont(cancelButton.getFont().deriveFont( cancelButton.getFont().getStyle() @@ -1292,9 +1226,6 @@ public class BKUGUIImpl implements BKUGUIFacade { .setFocusTraversalPolicy(new AdvancedSigPinGUIFocusTraversalPolicy()); } - // avoid that dummy label gains focus during load - switchFocusDummyLabel.setFocusable(false); - if (renderHeaderPanel) { if (numRetries < 0) { titleLabel.setText(getMessage(TITLE_SIGN)); @@ -1427,24 +1358,6 @@ public class BKUGUIImpl implements BKUGUIFacade { } }); - // FIXME: For some reason, the switchFocusDummyLabel obtains the - // focus even - // if the pinField requests the focus. Therefore, the - // switchFocusDummyLabel is - // deactivated first and enabled only after the pinField has - // obtained the focus - pinField.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - // focus has been set accordingly - re-enable dummy - // label - switchFocusDummyLabel.setFocusable(true); - } - - }); - pinsizeLabel.setFont(pinsizeLabel.getFont() .deriveFont( pinsizeLabel.getFont().getStyle() @@ -1475,8 +1388,6 @@ public class BKUGUIImpl implements BKUGUIFacade { Short.MAX_VALUE).addComponent(helpLabel); infoVertical.addComponent(helpLabel); } - infoHorizontal.addComponent(switchFocusDummyLabel); - infoVertical.addComponent(switchFocusDummyLabel); } @@ -1690,9 +1601,6 @@ public class BKUGUIImpl implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); - // avoid that dummy label gains focus during load - switchFocusDummyLabel.setFocusable(false); - if (renderHeaderPanel) { titleLabel.setText(getMessage(titleKey)); } @@ -1749,8 +1657,6 @@ public class BKUGUIImpl implements BKUGUIFacade { Short.MAX_VALUE).addComponent(helpLabel); titleVertical.addComponent(helpLabel); } - titleHorizontal.addComponent(switchFocusDummyLabel); - titleVertical.addComponent(switchFocusDummyLabel); mainHorizontal.addGroup(titleHorizontal); mainVertical.addGroup(titleVertical); @@ -1765,18 +1671,6 @@ public class BKUGUIImpl implements BKUGUIFacade { msgLabel.getAccessibleContext().setAccessibleDescription( accessibleData + msgLabel.getText()); - msgLabel.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - // focus has been set accordingly - re-enable dummy - // label - switchFocusDummyLabel.setFocusable(true); - } - - }); - mainPanelLayout.setHorizontalGroup(mainHorizontal .addComponent(msgLabel)); mainPanelLayout.setVerticalGroup(mainVertical @@ -2107,8 +2001,6 @@ public class BKUGUIImpl implements BKUGUIFacade { Short.MAX_VALUE).addComponent(helpLabel); messageVertical.addComponent(helpLabel); } - messageHorizontal.addComponent(switchFocusDummyLabel); - messageVertical.addComponent(switchFocusDummyLabel); } mainPanelLayout.setHorizontalGroup(mainPanelLayout @@ -2277,28 +2169,6 @@ public class BKUGUIImpl implements BKUGUIFacade { } } - // ////////////////////////////////////////////////////////////////////////// - // UTILITY METHODS - // ////////////////////////////////////////////////////////////////////////// - - private void registerSwitchFocusListener(ActionListener switchFocusListener) { - if (switchFocusListener != null) { - this.switchFocusKeyListener = new SwitchFocusFocusListener( - switchFocusListener); - - } else { - - this.switchFocusKeyListener = new SwitchFocusFocusListener( - new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - log.warn("No switch focus listener registered."); - } - }); - } - } - // ////////////////////////////////////////////////////////////////////////// // INITIALIZERS (MAY BE OVERRIDDEN BY SUBCLASSES) // ////////////////////////////////////////////////////////////////////////// @@ -2639,19 +2509,13 @@ public class BKUGUIImpl implements BKUGUIFacade { return helpLabel; } else { - return switchFocusDummyLabel; + return null; } } if (component.equals(helpLabel)) { - return switchFocusDummyLabel; - } - - // should never be the case - if (component.equals(switchFocusDummyLabel)) { - - return pinField; + return null; } // default @@ -2664,7 +2528,7 @@ public class BKUGUIImpl implements BKUGUIFacade { if (component.equals(pinField)) { - return switchFocusDummyLabel; + return null; } if (component.equals(signButton)) { @@ -2695,18 +2559,6 @@ public class BKUGUIImpl implements BKUGUIFacade { return infoLabel; } - // should never be the case - if (component.equals(switchFocusDummyLabel)) { - - if (helpLabel != null && helpLabel.isVisible()) { - - return helpLabel; - } else { - - return infoLabel; - } - } - // default return pinField; } @@ -2726,7 +2578,13 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public Component getLastComponent(Container container) { - return switchFocusDummyLabel; + if (helpLabel != null && helpLabel.isVisible()) { + + return helpLabel; + } else { + + return infoLabel; + } } } @@ -2753,19 +2611,13 @@ public class BKUGUIImpl implements BKUGUIFacade { return helpLabel; } else { - return switchFocusDummyLabel; + return null; } } if (component.equals(helpLabel)) { - return switchFocusDummyLabel; - } - - // should never be the case - if (component.equals(switchFocusDummyLabel)) { - - return enterPINButton; + return null; } // default @@ -2777,8 +2629,13 @@ public class BKUGUIImpl implements BKUGUIFacade { Component component) { if (component.equals(enterPINButton)) { + if (helpLabel != null && helpLabel.isVisible()) { - return switchFocusDummyLabel; + return helpLabel; + } else { + + return infoLabel; + } } if (component.equals(cancelButton)) { @@ -2796,18 +2653,6 @@ public class BKUGUIImpl implements BKUGUIFacade { return infoLabel; } - // should never be the case - if (component.equals(switchFocusDummyLabel)) { - - if (helpLabel != null && helpLabel.isVisible()) { - - return helpLabel; - } else { - - return infoLabel; - } - } - // default return enterPINButton; } @@ -2827,7 +2672,13 @@ public class BKUGUIImpl implements BKUGUIFacade { @Override public Component getLastComponent(Container container) { - return switchFocusDummyLabel; + if (helpLabel != null && helpLabel.isVisible()) { + + return helpLabel; + } else { + + return infoLabel; + } } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java deleted file mode 100644 index 359153dd..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egiz.bku.gui; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Thomas Zefferer - */ -public class SwitchFocusFocusListener extends FocusAdapter { - - private final Logger log = LoggerFactory.getLogger(SwitchFocusFocusListener.class); - - protected ActionListener swichFocusListener; - - public SwitchFocusFocusListener(ActionListener externalSwitchFocusListener) { - super(); - this.swichFocusListener = externalSwitchFocusListener; - } - - public ActionListener getActionListener() { - return swichFocusListener; - } - - @Override - public void focusGained(FocusEvent arg0) { - - log.debug("SwitchFocusFocusListener detected focusGained event!"); - Component comp = arg0.getComponent(); - log.debug("Component that caused event: {}.", comp.getName()); - comp.transferFocus(); - - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null); - swichFocusListener.actionPerformed(e); - } - - -} 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 deleted file mode 100644 index d9bafe4d..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -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 - */ -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 + "()"; - - } - -} diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java index e1e97535..e1aaacca 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java @@ -49,7 +49,7 @@ public class BKUGUITest { Container contentPane = testFrame.getContentPane(); // contentPane.setPreferredSize(new Dimension(170, 150)); contentPane.setPreferredSize(new Dimension(290, 190)); - BKUGUIFacade gui = new BKUGUIImpl(contentPane, null, BKUGUIFacade.Style.advanced, null, new DummyFontLoader(), null, null); + BKUGUIFacade gui = new BKUGUIImpl(contentPane, null, BKUGUIFacade.Style.advanced, null, new DummyFontLoader(), null); BKUGUIWorker worker = new BKUGUIWorker(); worker.init(gui); testFrame.pack(); diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java index 5754f52a..a37d73b9 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java @@ -63,9 +63,8 @@ public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, - SwitchFocusListener switchFocusListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); + HelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener); progressBar = new JProgressBar(); } diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java index 2b81a40e..5f3dabfe 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java @@ -50,9 +50,8 @@ public class CardMgmtGUI extends BKUGUIImpl { Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, - SwitchFocusListener switchFocusListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); + HelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener); } @Override diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java index c669094c..965ce27e 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java @@ -60,9 +60,9 @@ public class GetCertificateGUI extends CardMgmtGUI implements public GetCertificateGUI(Container contentPane, Locale locale, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, SwitchFocusListener switchFocusListener) { + HelpListener helpListener) { super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider, - helpListener, switchFocusListener); + helpListener); } diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java index e6265a07..1aea3d83 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java @@ -64,9 +64,9 @@ public class GetHardwareInfoGUI extends CardMgmtGUI implements public GetHardwareInfoGUI(Container contentPane, Locale locale, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, SwitchFocusListener switchFocusListener) { + HelpListener helpListener) { super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider, - helpListener, switchFocusListener); + helpListener); } diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java index aed3b5f1..84282ed7 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java @@ -65,9 +65,9 @@ public class IdentityLinkGUI extends CardMgmtGUI implements protected JButton activateButton; public IdentityLinkGUI(Container contentPane, Locale locale, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, SwitchFocusListener switchFocusListener) { + HelpListener helpListener) { super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider, - helpListener, switchFocusListener); + helpListener); // TODO Auto-generated constructor stub this.activateButton = new JButton(); } @@ -181,10 +181,8 @@ public class IdentityLinkGUI extends CardMgmtGUI implements messageHorizontal.addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED, 0, - Short.MAX_VALUE).addComponent(switchFocusDummyLabel) - .addComponent(helpLabel); - messageVertical.addComponent(switchFocusDummyLabel).addComponent( - helpLabel); + Short.MAX_VALUE).addComponent(helpLabel); + messageVertical.addComponent(helpLabel); } mainPanelLayout.setHorizontalGroup( diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index e3e0ec83..d09d348a 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -82,9 +82,9 @@ public class PINManagementGUI extends CardMgmtGUI implements public PINManagementGUI(Container contentPane, Locale locale, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, SwitchFocusListener switchFocusListener) { + HelpListener helpListener) { super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider, - helpListener, switchFocusListener); + helpListener); cancelButton = new JButton(); this.pinStatusRenderer = new PINStatusRenderer(cardmgmtMessages); @@ -236,10 +236,8 @@ public class PINManagementGUI extends CardMgmtGUI implements // messageHorizontal // .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, // Short.MAX_VALUE) - // .addComponent(switchFocusDummyLabel) // .addComponent(helpLabel); // messageVertical - // .addComponent(switchFocusDummyLabel) // .addComponent(helpLabel); // } // @@ -301,10 +299,8 @@ public class PINManagementGUI extends CardMgmtGUI implements if (!renderHeaderPanel) { messageHorizontal.addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED, 0, - Short.MAX_VALUE).addComponent(switchFocusDummyLabel) - .addComponent(helpLabel); - messageVertical.addComponent(switchFocusDummyLabel).addComponent( - helpLabel); + Short.MAX_VALUE).addComponent(helpLabel); + messageVertical.addComponent(helpLabel); } mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup( @@ -474,11 +470,8 @@ public class PINManagementGUI extends CardMgmtGUI implements if (!renderHeaderPanel) { infoHorizontal.addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED, 0, - Short.MAX_VALUE) - .addComponent(switchFocusDummyLabel).addComponent( - helpLabel); - infoVertical.addComponent(switchFocusDummyLabel) - .addComponent(helpLabel); + Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); } GroupLayout.ParallelGroup pinHorizontal; @@ -977,11 +970,8 @@ public class PINManagementGUI extends CardMgmtGUI implements if (!renderHeaderPanel) { infoHorizontal.addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED, 0, - Short.MAX_VALUE) - .addComponent(switchFocusDummyLabel).addComponent( - helpLabel); - infoVertical.addComponent(switchFocusDummyLabel) - .addComponent(helpLabel); + Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); } GroupLayout.ParallelGroup pinHorizontal; diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java index 768a7034..e5b052c8 100644 --- a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java +++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java @@ -49,7 +49,7 @@ public class ActivationGuiTest { Container contentPane = testFrame.getContentPane(); contentPane.setPreferredSize(new Dimension(152, 145)); // contentPane.setPreferredSize(new Dimension(300, 190)); - ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, new DummyFontLoader(), null, null); + ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, new DummyFontLoader(), null); BKUGUIWorker worker = new BKUGUIWorker(); worker.init(gui); testFrame.pack(); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetCertificateSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetCertificateSTALFactory.java index b6237489..19db5b8f 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetCertificateSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetCertificateSTALFactory.java @@ -86,8 +86,7 @@ public class LocalGetCertificateSTALFactory implements STALFactory { dialog.getLocale(), null, new ResourceFontLoader(), - helpListener, - null); + helpListener); BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { GetCertificateGUIFacade.class, } ); stal = new LocalBKUWorker(proxy, dialog); dialog.setPreferredSize(PREFERRED_SIZE); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java index 1caccf6f..83a010b6 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java @@ -86,8 +86,7 @@ public class LocalGetHardwareInfoSTALFactory implements STALFactory { dialog.getLocale(), null, new ResourceFontLoader(), - helpListener, - null); + helpListener); BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { GetHardwareInfoGUIFacade.class, } ); stal = new LocalBKUWorker(proxy, dialog); dialog.setPreferredSize(PREFERRED_SIZE); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java index 8dc0ad50..c0a3b886 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java @@ -82,8 +82,7 @@ public class LocalIdentityLinkSTALFactory implements STALFactory { dialog.getLocale(), null, new ResourceFontLoader(), - helpListener, - null); + helpListener); BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { IdentityLinkGUIFacade.class} ); stal = new LocalBKUWorker(proxy, dialog); dialog.setPreferredSize(PREFERRED_SIZE); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java index 97abf012..d0fee745 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java @@ -108,8 +108,7 @@ public class LocalSTALFactory implements STALFactory { dialog.getLocale(), null, new ResourceFontLoader(), - helpListener, - null); + helpListener); BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { PINManagementGUIFacade.class} ); SMCCHelper.setUseSWCard(configurationFacade.getUseSWCard()); stal = new LocalBKUWorker(proxy, dialog); diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index aada7f14..21a7d665 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -150,9 +150,6 @@ var buttonWidth = ; var buttonHeight = ; var buttons = ["incButton", "decButton", "helpButton"]; - function focusToBrowser() { - document.getElementById("focus").focus(); - } function focusToApplet() { var applet = document.getElementById("moccaapplet"); if (applet != null) { -- cgit v1.2.3