From 6211ed7f96c4ee6e1616a7c1e44477b9f3e8117f Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 3 Nov 2008 12:36:42 +0000 Subject: localization git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@140 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/online/applet/BKUApplet.java | 20 +++++++------------- .../java/at/gv/egiz/bku/online/applet/BKUWorker.java | 17 ++++++----------- 2 files changed, 13 insertions(+), 24 deletions(-) (limited to 'BKUApplet/src/main/java/at') 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 50d66d80..bde055ec 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 @@ -40,7 +40,6 @@ public class BKUApplet extends JApplet { private static Log log = LogFactory.getLog(BKUApplet.class); public static final String GUI_STYLE = "GuiStyle"; - public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages"; public final static String LOCALE_PARAM_KEY = "Locale"; public final static String LOGO_URL_KEY = "LogoURL"; public final static String WSDL_URL = "WSDL_URL"; @@ -52,7 +51,6 @@ public class BKUApplet extends JApplet { public static final String REDIRECT_URL = "RedirectURL"; public static final String REDIRECT_TARGET = "RedirectTarget"; public static final String HASHDATA_DISPLAY_INTERNAL = "internal"; - protected ResourceBundle resourceBundle; protected BKUWorker worker; protected Thread workerThread; @@ -64,14 +62,9 @@ public class BKUApplet extends JApplet { log.info("Welcome to MOCCA\n"); log.debug("Called init()"); HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); - String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); - Locale locale = null; - if (localeString != null) { - locale = new Locale(localeString); - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, - locale); - } else { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); + String locale = getMyAppletParameter(LOCALE_PARAM_KEY); + if (locale != null) { + this.setLocale(new Locale(locale)); } String backgroundString = getMyAppletParameter(BACKGROUND_PARAM); URL background = null; @@ -84,15 +77,16 @@ public class BKUApplet extends JApplet { } String guiStyle = getMyAppletParameter(GUI_STYLE); BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); + log.debug("setting GUI locale to " + getLocale()); AppletHelpListener helpListener = null; try { URL helpURL = getMyAppletParameterURL(HELP_URL); - helpListener = new AppletHelpListener(getAppletContext(), helpURL, locale); + helpListener = new AppletHelpListener(getAppletContext(), helpURL, getLocale()); } catch (MalformedURLException ex) { log.error("invalid help URL: " + ex.getMessage()); } - gui.init(getContentPane(), localeString, background, helpListener); - worker = new BKUWorker(gui, this, resourceBundle); + gui.init(getContentPane(), getLocale(), background, helpListener); + worker = new BKUWorker(gui, this); } @Override diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java index 78f3dc12..843f6c4c 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java @@ -48,7 +48,6 @@ import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.util.STALTranslator; -import javax.naming.ConfigurationException; public class BKUWorker extends AbstractSMCCSTAL implements Runnable, ActionListener, SMCCSTALRequestHandler { @@ -57,25 +56,22 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, protected BKUGUIFacade gui; protected BKUApplet parent; private STALPortType stalPort; -// private URL hashDataURL; protected List actionCommandList = new ArrayList(); protected Boolean actionPerformed = false; protected boolean finished = false; - protected ResourceBundle errorMessages; /** * * @param gui * must not be null */ - public BKUWorker(BKUGUIFacade gui, BKUApplet parent, - ResourceBundle errorMessageBundle) { - if ((gui == null) || (parent == null) || (errorMessageBundle == null)) { + public BKUWorker(BKUGUIFacade gui, BKUApplet parent) { + if (gui == null || parent == null) { throw new NullPointerException("Parameter must not be set to null"); } this.gui = gui; + this.locale = gui.getLocale(); this.parent = parent; - this.errorMessages = errorMessageBundle; addRequestHandler(QuitRequest.class, this); // register SignRequestHandler once we have a webservice port } @@ -86,9 +82,9 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, * @param gui * @param errorMessageBundle */ - protected BKUWorker(BKUGUIFacade gui, ResourceBundle errorMessageBundle) { + protected BKUWorker(BKUGUIFacade gui) { this.gui = gui; - this.errorMessages = errorMessageBundle; + this.locale = gui.getLocale(); addRequestHandler(QuitRequest.class, this); } @@ -342,8 +338,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } break; case SMCCHelper.CARD_FOUND: - // gui.showWaitDialog(null); - signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); + signatureCard = smccHelper.getSignatureCard(locale); return false; } smccHelper.update(3000); -- cgit v1.2.3